ltmain.sh revision 1.1.1.3.24.1 1 1.1 lukem # ltmain.sh - Provide generalized library-building support services.
2 1.1 lukem # NOTE: Changing this file will not affect anything until you rerun configure.
3 1.1 lukem #
4 1.1 lukem # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 1.1 lukem # Free Software Foundation, Inc.
6 1.1 lukem # Originally by Gordon Matzigkeit <gord (at] gnu.ai.mit.edu>, 1996
7 1.1 lukem #
8 1.1 lukem # This program is free software; you can redistribute it and/or modify
9 1.1 lukem # it under the terms of the GNU General Public License as published by
10 1.1 lukem # the Free Software Foundation; either version 2 of the License, or
11 1.1 lukem # (at your option) any later version.
12 1.1 lukem #
13 1.1 lukem # This program is distributed in the hope that it will be useful, but
14 1.1 lukem # WITHOUT ANY WARRANTY; without even the implied warranty of
15 1.1 lukem # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 1.1 lukem # General Public License for more details.
17 1.1 lukem #
18 1.1 lukem # You should have received a copy of the GNU General Public License
19 1.1 lukem # along with this program; if not, write to the Free Software
20 1.1 lukem # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 1.1 lukem #
22 1.1 lukem # As a special exception to the GNU General Public License, if you
23 1.1 lukem # distribute this file as part of a program that contains a
24 1.1 lukem # configuration script generated by Autoconf, you may include it under
25 1.1 lukem # the same distribution terms that you use for the rest of that program.
26 1.1 lukem
27 1.1 lukem # This file is distributed with OpenLDAP Software, which contains a
28 1.1 lukem # configuration script generated by Autoconf, and is distributable
29 1.1 lukem # under the same distributions terms as OpenLDAP itself.
30 1.1 lukem
31 1.1.1.3.24.1 tls ## Portions Copyright 1998-2014 The OpenLDAP Foundation.
32 1.1 lukem ## All rights reserved.
33 1.1 lukem ##
34 1.1 lukem ## Redistribution and use in source and binary forms, with or without
35 1.1 lukem ## modification, are permitted only as authorized by the OpenLDAP
36 1.1 lukem ## Public License.
37 1.1 lukem ##
38 1.1 lukem ## A copy of this license is available in the file LICENSE in the
39 1.1 lukem ## top-level directory of the distribution or, alternatively, at
40 1.1 lukem ## <http://www.OpenLDAP.org/license.html>.
41 1.1 lukem
42 1.1 lukem basename="s,^.*/,,g"
43 1.1 lukem
44 1.1 lukem # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
45 1.1 lukem # is ksh but when the shell is invoked as "sh" and the current value of
46 1.1 lukem # the _XPG environment variable is not equal to 1 (one), the special
47 1.1 lukem # positional parameter $0, within a function call, is the name of the
48 1.1 lukem # function.
49 1.1 lukem progpath="$0"
50 1.1 lukem
51 1.1 lukem # The name of this program:
52 1.1 lukem progname=`echo "$progpath" | $SED $basename`
53 1.1 lukem modename="$progname"
54 1.1 lukem
55 1.1 lukem # Global variables:
56 1.1 lukem EXIT_SUCCESS=0
57 1.1 lukem EXIT_FAILURE=1
58 1.1 lukem
59 1.1 lukem PROGRAM=ltmain.sh
60 1.1 lukem PACKAGE=libtool
61 1.1 lukem VERSION=1.5.22-OpenLDAP
62 1.1 lukem TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
63 1.1 lukem
64 1.1 lukem # See if we are running on zsh, and set the options which allow our
65 1.1 lukem # commands through without removal of \ escapes.
66 1.1 lukem if test -n "${ZSH_VERSION+set}" ; then
67 1.1 lukem setopt NO_GLOB_SUBST
68 1.1 lukem fi
69 1.1 lukem
70 1.1 lukem # Check that we have a working $echo.
71 1.1 lukem if test "X$1" = X--no-reexec; then
72 1.1 lukem # Discard the --no-reexec flag, and continue.
73 1.1 lukem shift
74 1.1 lukem elif test "X$1" = X--fallback-echo; then
75 1.1 lukem # Avoid inline document here, it may be left over
76 1.1 lukem :
77 1.1 lukem elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
78 1.1 lukem # Yippee, $echo works!
79 1.1 lukem :
80 1.1 lukem else
81 1.1 lukem # Restart under the correct shell, and then maybe $echo will work.
82 1.1 lukem exec $SHELL "$progpath" --no-reexec ${1+"$@"}
83 1.1 lukem fi
84 1.1 lukem
85 1.1 lukem if test "X$1" = X--fallback-echo; then
86 1.1 lukem # used as fallback echo
87 1.1 lukem shift
88 1.1 lukem cat <<EOF
89 1.1 lukem $*
90 1.1 lukem EOF
91 1.1 lukem exit $EXIT_SUCCESS
92 1.1 lukem fi
93 1.1 lukem
94 1.1 lukem default_mode=
95 1.1 lukem help="Try \`$progname --help' for more information."
96 1.1 lukem magic="%%%MAGIC variable%%%"
97 1.1 lukem mkdir="mkdir"
98 1.1 lukem mv="mv -f"
99 1.1 lukem rm="rm -f"
100 1.1 lukem
101 1.1 lukem # Sed substitution that helps us do robust quoting. It backslashifies
102 1.1 lukem # metacharacters that are still active within double-quoted strings.
103 1.1 lukem Xsed="${SED}"' -e 1s/^X//'
104 1.1 lukem sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
105 1.1 lukem # test EBCDIC or ASCII
106 1.1 lukem case `echo X|tr X '\101'` in
107 1.1 lukem A) # ASCII based system
108 1.1 lukem # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
109 1.1 lukem SP2NL='tr \040 \012'
110 1.1 lukem NL2SP='tr \015\012 \040\040'
111 1.1 lukem ;;
112 1.1 lukem *) # EBCDIC based system
113 1.1 lukem SP2NL='tr \100 \n'
114 1.1 lukem NL2SP='tr \r\n \100\100'
115 1.1 lukem ;;
116 1.1 lukem esac
117 1.1 lukem
118 1.1 lukem # NLS nuisances.
119 1.1 lukem # Only set LANG and LC_ALL to C if already set.
120 1.1 lukem # These must not be set unconditionally because not all systems understand
121 1.1 lukem # e.g. LANG=C (notably SCO).
122 1.1 lukem # We save the old values to restore during execute mode.
123 1.1 lukem if test "${LC_ALL+set}" = set; then
124 1.1 lukem save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
125 1.1 lukem fi
126 1.1 lukem if test "${LANG+set}" = set; then
127 1.1 lukem save_LANG="$LANG"; LANG=C; export LANG
128 1.1 lukem fi
129 1.1 lukem
130 1.1 lukem # Make sure IFS has a sensible default
131 1.1 lukem lt_nl='
132 1.1 lukem '
133 1.1 lukem IFS=" $lt_nl"
134 1.1 lukem
135 1.1 lukem if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
136 1.1 lukem $echo "$modename: not configured to build any kind of library" 1>&2
137 1.1 lukem $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
138 1.1 lukem exit $EXIT_FAILURE
139 1.1 lukem fi
140 1.1 lukem
141 1.1 lukem # Global variables.
142 1.1 lukem mode=$default_mode
143 1.1 lukem nonopt=
144 1.1 lukem prev=
145 1.1 lukem prevopt=
146 1.1 lukem run=
147 1.1 lukem show="$echo"
148 1.1 lukem show_help=
149 1.1 lukem execute_dlfiles=
150 1.1 lukem duplicate_deps=no
151 1.1 lukem preserve_args=
152 1.1 lukem lo2o="s/\\.lo\$/.${objext}/"
153 1.1 lukem o2lo="s/\\.${objext}\$/.lo/"
154 1.1 lukem
155 1.1 lukem #####################################
156 1.1 lukem # Shell function definitions:
157 1.1 lukem # This seems to be the best place for them
158 1.1 lukem
159 1.1 lukem # func_mktempdir [string]
160 1.1 lukem # Make a temporary directory that won't clash with other running
161 1.1 lukem # libtool processes, and avoids race conditions if possible. If
162 1.1 lukem # given, STRING is the basename for that directory.
163 1.1 lukem func_mktempdir ()
164 1.1 lukem {
165 1.1 lukem my_template="${TMPDIR-/tmp}/${1-$progname}"
166 1.1 lukem
167 1.1 lukem if test "$run" = ":"; then
168 1.1 lukem # Return a directory name, but don't create it in dry-run mode
169 1.1 lukem my_tmpdir="${my_template}-$$"
170 1.1 lukem else
171 1.1 lukem
172 1.1 lukem # If mktemp works, use that first and foremost
173 1.1 lukem my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
174 1.1 lukem
175 1.1 lukem if test ! -d "$my_tmpdir"; then
176 1.1 lukem # Failing that, at least try and use $RANDOM to avoid a race
177 1.1 lukem my_tmpdir="${my_template}-${RANDOM-0}$$"
178 1.1 lukem
179 1.1 lukem save_mktempdir_umask=`umask`
180 1.1 lukem umask 0077
181 1.1 lukem $mkdir "$my_tmpdir"
182 1.1 lukem umask $save_mktempdir_umask
183 1.1 lukem fi
184 1.1 lukem
185 1.1 lukem # If we're not in dry-run mode, bomb out on failure
186 1.1 lukem test -d "$my_tmpdir" || {
187 1.1 lukem $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
188 1.1 lukem exit $EXIT_FAILURE
189 1.1 lukem }
190 1.1 lukem fi
191 1.1 lukem
192 1.1 lukem $echo "X$my_tmpdir" | $Xsed
193 1.1 lukem }
194 1.1 lukem
195 1.1 lukem
196 1.1 lukem # func_win32_libid arg
197 1.1 lukem # return the library type of file 'arg'
198 1.1 lukem #
199 1.1 lukem # Need a lot of goo to handle *both* DLLs and import libs
200 1.1 lukem # Has to be a shell function in order to 'eat' the argument
201 1.1 lukem # that is supplied when $file_magic_command is called.
202 1.1 lukem func_win32_libid ()
203 1.1 lukem {
204 1.1 lukem win32_libid_type="unknown"
205 1.1 lukem win32_fileres=`file -L $1 2>/dev/null`
206 1.1 lukem case $win32_fileres in
207 1.1 lukem *ar\ archive\ import\ library*) # definitely import
208 1.1 lukem win32_libid_type="x86 archive import"
209 1.1 lukem ;;
210 1.1 lukem *ar\ archive*) # could be an import, or static
211 1.1 lukem if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
212 1.1 lukem $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
213 1.1 lukem win32_nmres=`eval $NM -f posix -A $1 | \
214 1.1 lukem $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
215 1.1 lukem case $win32_nmres in
216 1.1 lukem import*) win32_libid_type="x86 archive import";;
217 1.1 lukem *) win32_libid_type="x86 archive static";;
218 1.1 lukem esac
219 1.1 lukem fi
220 1.1 lukem ;;
221 1.1 lukem *DLL*)
222 1.1 lukem win32_libid_type="x86 DLL"
223 1.1 lukem ;;
224 1.1 lukem *executable*) # but shell scripts are "executable" too...
225 1.1 lukem case $win32_fileres in
226 1.1 lukem *MS\ Windows\ PE\ Intel*)
227 1.1 lukem win32_libid_type="x86 DLL"
228 1.1 lukem ;;
229 1.1 lukem esac
230 1.1 lukem ;;
231 1.1 lukem esac
232 1.1 lukem $echo $win32_libid_type
233 1.1 lukem }
234 1.1 lukem
235 1.1 lukem
236 1.1 lukem # func_infer_tag arg
237 1.1 lukem # Infer tagged configuration to use if any are available and
238 1.1 lukem # if one wasn't chosen via the "--tag" command line option.
239 1.1 lukem # Only attempt this if the compiler in the base compile
240 1.1 lukem # command doesn't match the default compiler.
241 1.1 lukem # arg is usually of the form 'gcc ...'
242 1.1 lukem func_infer_tag ()
243 1.1 lukem {
244 1.1 lukem # FreeBSD-specific: where we install compilers with non-standard names
245 1.1 lukem tag_compilers_CC="*cc cc* *gcc gcc*"
246 1.1 lukem tag_compilers_CXX="*c++ c++* *g++ g++*"
247 1.1 lukem base_compiler=`set -- "$@"; echo $1`
248 1.1 lukem
249 1.1 lukem # If $tagname isn't set, then try to infer if the default "CC" tag applies
250 1.1 lukem if test -z "$tagname"; then
251 1.1 lukem for zp in $tag_compilers_CC; do
252 1.1 lukem case $base_compiler in
253 1.1 lukem $zp) tagname="CC"; break;;
254 1.1 lukem esac
255 1.1 lukem done
256 1.1 lukem fi
257 1.1 lukem
258 1.1 lukem if test -n "$available_tags" && test -z "$tagname"; then
259 1.1 lukem CC_quoted=
260 1.1 lukem for arg in $CC; do
261 1.1 lukem case $arg in
262 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
263 1.1 lukem arg="\"$arg\""
264 1.1 lukem ;;
265 1.1 lukem esac
266 1.1 lukem CC_quoted="$CC_quoted $arg"
267 1.1 lukem done
268 1.1 lukem case $@ in
269 1.1 lukem # Blanks in the command may have been stripped by the calling shell,
270 1.1 lukem # but not from the CC environment variable when configure was run.
271 1.1 lukem " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
272 1.1 lukem # Blanks at the start of $base_compile will cause this to fail
273 1.1 lukem # if we don't check for them as well.
274 1.1 lukem *)
275 1.1 lukem for z in $available_tags; do
276 1.1 lukem if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
277 1.1 lukem # Evaluate the configuration.
278 1.1 lukem eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
279 1.1 lukem CC_quoted=
280 1.1 lukem for arg in $CC; do
281 1.1 lukem # Double-quote args containing other shell metacharacters.
282 1.1 lukem case $arg in
283 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
284 1.1 lukem arg="\"$arg\""
285 1.1 lukem ;;
286 1.1 lukem esac
287 1.1 lukem CC_quoted="$CC_quoted $arg"
288 1.1 lukem done
289 1.1 lukem case "$@ " in
290 1.1 lukem " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
291 1.1 lukem # The compiler in the base compile command matches
292 1.1 lukem # the one in the tagged configuration.
293 1.1 lukem # Assume this is the tagged configuration we want.
294 1.1 lukem tagname=$z
295 1.1 lukem break
296 1.1 lukem ;;
297 1.1 lukem esac
298 1.1 lukem
299 1.1 lukem # FreeBSD-specific: try compilers based on inferred tag
300 1.1 lukem if test -z "$tagname"; then
301 1.1 lukem eval "tag_compilers=\$tag_compilers_${z}"
302 1.1 lukem if test -n "$tag_compilers"; then
303 1.1 lukem for zp in $tag_compilers; do
304 1.1 lukem case $base_compiler in
305 1.1 lukem $zp) tagname=$z; break;;
306 1.1 lukem esac
307 1.1 lukem done
308 1.1 lukem if test -n "$tagname"; then
309 1.1 lukem break
310 1.1 lukem fi
311 1.1 lukem fi
312 1.1 lukem fi
313 1.1 lukem fi
314 1.1 lukem done
315 1.1 lukem # If $tagname still isn't set, then no tagged configuration
316 1.1 lukem # was found and let the user know that the "--tag" command
317 1.1 lukem # line option must be used.
318 1.1 lukem if test -z "$tagname"; then
319 1.1 lukem $echo "$modename: unable to infer tagged configuration"
320 1.1 lukem $echo "$modename: specify a tag with \`--tag'" 1>&2
321 1.1 lukem exit $EXIT_FAILURE
322 1.1 lukem # else
323 1.1 lukem # $echo "$modename: using $tagname tagged configuration"
324 1.1 lukem fi
325 1.1 lukem ;;
326 1.1 lukem esac
327 1.1 lukem fi
328 1.1 lukem }
329 1.1 lukem
330 1.1 lukem
331 1.1 lukem # func_extract_an_archive dir oldlib
332 1.1 lukem func_extract_an_archive ()
333 1.1 lukem {
334 1.1 lukem f_ex_an_ar_dir="$1"; shift
335 1.1 lukem f_ex_an_ar_oldlib="$1"
336 1.1 lukem
337 1.1 lukem $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
338 1.1 lukem $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
339 1.1 lukem if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
340 1.1 lukem :
341 1.1 lukem else
342 1.1 lukem $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
343 1.1 lukem exit $EXIT_FAILURE
344 1.1 lukem fi
345 1.1 lukem }
346 1.1 lukem
347 1.1 lukem # func_extract_archives gentop oldlib ...
348 1.1 lukem func_extract_archives ()
349 1.1 lukem {
350 1.1 lukem my_gentop="$1"; shift
351 1.1 lukem my_oldlibs=${1+"$@"}
352 1.1 lukem my_oldobjs=""
353 1.1 lukem my_xlib=""
354 1.1 lukem my_xabs=""
355 1.1 lukem my_xdir=""
356 1.1 lukem my_status=""
357 1.1 lukem
358 1.1 lukem $show "${rm}r $my_gentop"
359 1.1 lukem $run ${rm}r "$my_gentop"
360 1.1 lukem $show "$mkdir $my_gentop"
361 1.1 lukem $run $mkdir "$my_gentop"
362 1.1 lukem my_status=$?
363 1.1 lukem if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
364 1.1 lukem exit $my_status
365 1.1 lukem fi
366 1.1 lukem
367 1.1 lukem for my_xlib in $my_oldlibs; do
368 1.1 lukem # Extract the objects.
369 1.1 lukem case $my_xlib in
370 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
371 1.1 lukem *) my_xabs=`pwd`"/$my_xlib" ;;
372 1.1 lukem esac
373 1.1 lukem my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
374 1.1 lukem my_xdir="$my_gentop/$my_xlib"
375 1.1 lukem
376 1.1 lukem $show "${rm}r $my_xdir"
377 1.1 lukem $run ${rm}r "$my_xdir"
378 1.1 lukem $show "$mkdir $my_xdir"
379 1.1 lukem $run $mkdir "$my_xdir"
380 1.1 lukem exit_status=$?
381 1.1 lukem if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
382 1.1 lukem exit $exit_status
383 1.1 lukem fi
384 1.1 lukem case $host in
385 1.1 lukem *-darwin*)
386 1.1 lukem $show "Extracting $my_xabs"
387 1.1 lukem # Do not bother doing anything if just a dry run
388 1.1 lukem if test -z "$run"; then
389 1.1 lukem darwin_orig_dir=`pwd`
390 1.1 lukem cd $my_xdir || exit $?
391 1.1 lukem darwin_archive=$my_xabs
392 1.1 lukem darwin_curdir=`pwd`
393 1.1 lukem darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
394 1.1 lukem darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
395 1.1 lukem if test -n "$darwin_arches"; then
396 1.1 lukem darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
397 1.1 lukem darwin_arch=
398 1.1 lukem $show "$darwin_base_archive has multiple architectures $darwin_arches"
399 1.1 lukem for darwin_arch in $darwin_arches ; do
400 1.1 lukem mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
401 1.1 lukem lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
402 1.1 lukem cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
403 1.1 lukem func_extract_an_archive "`pwd`" "${darwin_base_archive}"
404 1.1 lukem cd "$darwin_curdir"
405 1.1 lukem $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
406 1.1 lukem done # $darwin_arches
407 1.1 lukem ## Okay now we have a bunch of thin objects, gotta fatten them up :)
408 1.1 lukem darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
409 1.1 lukem darwin_file=
410 1.1 lukem darwin_files=
411 1.1 lukem for darwin_file in $darwin_filelist; do
412 1.1 lukem darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
413 1.1 lukem lipo -create -output "$darwin_file" $darwin_files
414 1.1 lukem done # $darwin_filelist
415 1.1 lukem ${rm}r unfat-$$
416 1.1 lukem cd "$darwin_orig_dir"
417 1.1 lukem else
418 1.1 lukem cd "$darwin_orig_dir"
419 1.1 lukem func_extract_an_archive "$my_xdir" "$my_xabs"
420 1.1 lukem fi # $darwin_arches
421 1.1 lukem fi # $run
422 1.1 lukem ;;
423 1.1 lukem *)
424 1.1 lukem func_extract_an_archive "$my_xdir" "$my_xabs"
425 1.1 lukem ;;
426 1.1 lukem esac
427 1.1 lukem my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
428 1.1 lukem done
429 1.1 lukem func_extract_archives_result="$my_oldobjs"
430 1.1 lukem }
431 1.1 lukem # End of Shell function definitions
432 1.1 lukem #####################################
433 1.1 lukem
434 1.1 lukem # Darwin sucks
435 1.1 lukem eval std_shrext=\"$shrext_cmds\"
436 1.1 lukem
437 1.1 lukem disable_libs=no
438 1.1 lukem
439 1.1 lukem # Parse our command line options once, thoroughly.
440 1.1 lukem while test "$#" -gt 0
441 1.1 lukem do
442 1.1 lukem arg="$1"
443 1.1 lukem shift
444 1.1 lukem
445 1.1 lukem case $arg in
446 1.1 lukem -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
447 1.1 lukem *) optarg= ;;
448 1.1 lukem esac
449 1.1 lukem
450 1.1 lukem # If the previous option needs an argument, assign it.
451 1.1 lukem if test -n "$prev"; then
452 1.1 lukem case $prev in
453 1.1 lukem execute_dlfiles)
454 1.1 lukem execute_dlfiles="$execute_dlfiles $arg"
455 1.1 lukem ;;
456 1.1 lukem tag)
457 1.1 lukem tagname="$arg"
458 1.1 lukem preserve_args="${preserve_args}=$arg"
459 1.1 lukem
460 1.1 lukem # Check whether tagname contains only valid characters
461 1.1 lukem case $tagname in
462 1.1 lukem *[!-_A-Za-z0-9,/]*)
463 1.1 lukem $echo "$progname: invalid tag name: $tagname" 1>&2
464 1.1 lukem exit $EXIT_FAILURE
465 1.1 lukem ;;
466 1.1 lukem esac
467 1.1 lukem
468 1.1 lukem case $tagname in
469 1.1 lukem CC)
470 1.1 lukem # Don't test for the "default" C tag, as we know, it's there, but
471 1.1 lukem # not specially marked.
472 1.1 lukem ;;
473 1.1 lukem *)
474 1.1 lukem if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
475 1.1 lukem taglist="$taglist $tagname"
476 1.1 lukem # Evaluate the configuration.
477 1.1 lukem eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
478 1.1 lukem else
479 1.1 lukem $echo "$progname: ignoring unknown tag $tagname" 1>&2
480 1.1 lukem fi
481 1.1 lukem ;;
482 1.1 lukem esac
483 1.1 lukem ;;
484 1.1 lukem *)
485 1.1 lukem eval "$prev=\$arg"
486 1.1 lukem ;;
487 1.1 lukem esac
488 1.1 lukem
489 1.1 lukem prev=
490 1.1 lukem prevopt=
491 1.1 lukem continue
492 1.1 lukem fi
493 1.1 lukem
494 1.1 lukem # Have we seen a non-optional argument yet?
495 1.1 lukem case $arg in
496 1.1 lukem --help)
497 1.1 lukem show_help=yes
498 1.1 lukem ;;
499 1.1 lukem
500 1.1 lukem --version)
501 1.1 lukem $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
502 1.1 lukem $echo
503 1.1 lukem $echo "Copyright (C) 2005 Free Software Foundation, Inc."
504 1.1 lukem $echo "This is free software; see the source for copying conditions. There is NO"
505 1.1 lukem $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
506 1.1 lukem exit $?
507 1.1 lukem ;;
508 1.1 lukem
509 1.1 lukem --config)
510 1.1 lukem ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
511 1.1 lukem # Now print the configurations for the tags.
512 1.1 lukem for tagname in $taglist; do
513 1.1 lukem ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
514 1.1 lukem done
515 1.1 lukem exit $?
516 1.1 lukem ;;
517 1.1 lukem
518 1.1 lukem --debug)
519 1.1 lukem $echo "$progname: enabling shell trace mode"
520 1.1 lukem set -x
521 1.1 lukem preserve_args="$preserve_args $arg"
522 1.1 lukem ;;
523 1.1 lukem
524 1.1 lukem --dry-run | -n)
525 1.1 lukem run=:
526 1.1 lukem ;;
527 1.1 lukem
528 1.1 lukem --features)
529 1.1 lukem $echo "host: $host"
530 1.1 lukem if test "$build_libtool_libs" = yes; then
531 1.1 lukem $echo "enable shared libraries"
532 1.1 lukem else
533 1.1 lukem $echo "disable shared libraries"
534 1.1 lukem fi
535 1.1 lukem if test "$build_old_libs" = yes; then
536 1.1 lukem $echo "enable static libraries"
537 1.1 lukem else
538 1.1 lukem $echo "disable static libraries"
539 1.1 lukem fi
540 1.1 lukem exit $?
541 1.1 lukem ;;
542 1.1 lukem
543 1.1 lukem --finish) mode="finish" ;;
544 1.1 lukem
545 1.1 lukem --mode) prevopt="--mode" prev=mode ;;
546 1.1 lukem --mode=*) mode="$optarg" ;;
547 1.1 lukem
548 1.1 lukem --preserve-dup-deps) duplicate_deps="yes" ;;
549 1.1 lukem
550 1.1 lukem --quiet | --silent)
551 1.1 lukem show=:
552 1.1 lukem preserve_args="$preserve_args $arg"
553 1.1 lukem ;;
554 1.1 lukem
555 1.1 lukem --tag)
556 1.1 lukem prevopt="--tag"
557 1.1 lukem prev=tag
558 1.1 lukem preserve_args="$preserve_args --tag"
559 1.1 lukem ;;
560 1.1 lukem --tag=*)
561 1.1 lukem set tag "$optarg" ${1+"$@"}
562 1.1 lukem shift
563 1.1 lukem prev=tag
564 1.1 lukem preserve_args="$preserve_args --tag"
565 1.1 lukem ;;
566 1.1 lukem
567 1.1 lukem -dlopen)
568 1.1 lukem prevopt="-dlopen"
569 1.1 lukem prev=execute_dlfiles
570 1.1 lukem ;;
571 1.1 lukem
572 1.1 lukem -*)
573 1.1 lukem $echo "$modename: unrecognized option \`$arg'" 1>&2
574 1.1 lukem $echo "$help" 1>&2
575 1.1 lukem exit $EXIT_FAILURE
576 1.1 lukem ;;
577 1.1 lukem
578 1.1 lukem *)
579 1.1 lukem nonopt="$arg"
580 1.1 lukem break
581 1.1 lukem ;;
582 1.1 lukem esac
583 1.1 lukem done
584 1.1 lukem
585 1.1 lukem if test -n "$prevopt"; then
586 1.1 lukem $echo "$modename: option \`$prevopt' requires an argument" 1>&2
587 1.1 lukem $echo "$help" 1>&2
588 1.1 lukem exit $EXIT_FAILURE
589 1.1 lukem fi
590 1.1 lukem
591 1.1 lukem case $disable_libs in
592 1.1 lukem no)
593 1.1 lukem ;;
594 1.1 lukem shared)
595 1.1 lukem build_libtool_libs=no
596 1.1 lukem build_old_libs=yes
597 1.1 lukem ;;
598 1.1 lukem static)
599 1.1 lukem build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
600 1.1 lukem ;;
601 1.1 lukem esac
602 1.1 lukem
603 1.1 lukem # If this variable is set in any of the actions, the command in it
604 1.1 lukem # will be execed at the end. This prevents here-documents from being
605 1.1 lukem # left over by shells.
606 1.1 lukem exec_cmd=
607 1.1 lukem
608 1.1 lukem if test -z "$show_help"; then
609 1.1 lukem
610 1.1 lukem # Infer the operation mode.
611 1.1 lukem if test -z "$mode"; then
612 1.1 lukem $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
613 1.1 lukem $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
614 1.1 lukem case $nonopt in
615 1.1 lukem *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
616 1.1 lukem mode=link
617 1.1 lukem for arg
618 1.1 lukem do
619 1.1 lukem case $arg in
620 1.1 lukem -c)
621 1.1 lukem mode=compile
622 1.1 lukem break
623 1.1 lukem ;;
624 1.1 lukem esac
625 1.1 lukem done
626 1.1 lukem ;;
627 1.1 lukem *db | *dbx | *strace | *truss)
628 1.1 lukem mode=execute
629 1.1 lukem ;;
630 1.1 lukem *install*|cp|mv)
631 1.1 lukem mode=install
632 1.1 lukem ;;
633 1.1 lukem *rm)
634 1.1 lukem mode=uninstall
635 1.1 lukem ;;
636 1.1 lukem *)
637 1.1 lukem # If we have no mode, but dlfiles were specified, then do execute mode.
638 1.1 lukem test -n "$execute_dlfiles" && mode=execute
639 1.1 lukem
640 1.1 lukem # Just use the default operation mode.
641 1.1 lukem if test -z "$mode"; then
642 1.1 lukem if test -n "$nonopt"; then
643 1.1 lukem $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
644 1.1 lukem else
645 1.1 lukem $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
646 1.1 lukem fi
647 1.1 lukem fi
648 1.1 lukem ;;
649 1.1 lukem esac
650 1.1 lukem fi
651 1.1 lukem
652 1.1 lukem # Only execute mode is allowed to have -dlopen flags.
653 1.1 lukem if test -n "$execute_dlfiles" && test "$mode" != execute; then
654 1.1 lukem $echo "$modename: unrecognized option \`-dlopen'" 1>&2
655 1.1 lukem $echo "$help" 1>&2
656 1.1 lukem exit $EXIT_FAILURE
657 1.1 lukem fi
658 1.1 lukem
659 1.1 lukem # Change the help message to a mode-specific one.
660 1.1 lukem generic_help="$help"
661 1.1 lukem help="Try \`$modename --help --mode=$mode' for more information."
662 1.1 lukem
663 1.1 lukem # These modes are in order of execution frequency so that they run quickly.
664 1.1 lukem case $mode in
665 1.1 lukem # libtool compile mode
666 1.1 lukem compile)
667 1.1 lukem modename="$modename: compile"
668 1.1 lukem # Get the compilation command and the source file.
669 1.1 lukem base_compile=
670 1.1 lukem srcfile="$nonopt" # always keep a non-empty value in "srcfile"
671 1.1 lukem suppress_opt=yes
672 1.1 lukem suppress_output=
673 1.1 lukem arg_mode=normal
674 1.1 lukem libobj=
675 1.1 lukem later=
676 1.1 lukem
677 1.1 lukem for arg
678 1.1 lukem do
679 1.1 lukem case $arg_mode in
680 1.1 lukem arg )
681 1.1 lukem # do not "continue". Instead, add this to base_compile
682 1.1 lukem lastarg="$arg"
683 1.1 lukem arg_mode=normal
684 1.1 lukem ;;
685 1.1 lukem
686 1.1 lukem target )
687 1.1 lukem libobj="$arg"
688 1.1 lukem arg_mode=normal
689 1.1 lukem continue
690 1.1 lukem ;;
691 1.1 lukem
692 1.1 lukem normal )
693 1.1 lukem # Accept any command-line options.
694 1.1 lukem case $arg in
695 1.1 lukem -o)
696 1.1 lukem if test -n "$libobj" ; then
697 1.1 lukem $echo "$modename: you cannot specify \`-o' more than once" 1>&2
698 1.1 lukem exit $EXIT_FAILURE
699 1.1 lukem fi
700 1.1 lukem arg_mode=target
701 1.1 lukem continue
702 1.1 lukem ;;
703 1.1 lukem
704 1.1 lukem -static | -prefer-pic | -prefer-non-pic)
705 1.1 lukem later="$later $arg"
706 1.1 lukem continue
707 1.1 lukem ;;
708 1.1 lukem
709 1.1 lukem -no-suppress)
710 1.1 lukem suppress_opt=no
711 1.1 lukem continue
712 1.1 lukem ;;
713 1.1 lukem
714 1.1 lukem -Xcompiler)
715 1.1 lukem arg_mode=arg # the next one goes into the "base_compile" arg list
716 1.1 lukem continue # The current "srcfile" will either be retained or
717 1.1 lukem ;; # replaced later. I would guess that would be a bug.
718 1.1 lukem
719 1.1 lukem -Wc,*)
720 1.1 lukem args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
721 1.1 lukem lastarg=
722 1.1 lukem save_ifs="$IFS"; IFS=','
723 1.1 lukem for arg in $args; do
724 1.1 lukem IFS="$save_ifs"
725 1.1 lukem
726 1.1 lukem # Double-quote args containing other shell metacharacters.
727 1.1 lukem # Many Bourne shells cannot handle close brackets correctly
728 1.1 lukem # in scan sets, so we specify it separately.
729 1.1 lukem case $arg in
730 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
731 1.1 lukem arg="\"$arg\""
732 1.1 lukem ;;
733 1.1 lukem esac
734 1.1 lukem lastarg="$lastarg $arg"
735 1.1 lukem done
736 1.1 lukem IFS="$save_ifs"
737 1.1 lukem lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
738 1.1 lukem
739 1.1 lukem # Add the arguments to base_compile.
740 1.1 lukem base_compile="$base_compile $lastarg"
741 1.1 lukem continue
742 1.1 lukem ;;
743 1.1 lukem
744 1.1 lukem * )
745 1.1 lukem # Accept the current argument as the source file.
746 1.1 lukem # The previous "srcfile" becomes the current argument.
747 1.1 lukem #
748 1.1 lukem lastarg="$srcfile"
749 1.1 lukem srcfile="$arg"
750 1.1 lukem ;;
751 1.1 lukem esac # case $arg
752 1.1 lukem ;;
753 1.1 lukem esac # case $arg_mode
754 1.1 lukem
755 1.1 lukem # Aesthetically quote the previous argument.
756 1.1 lukem lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
757 1.1 lukem
758 1.1 lukem case $lastarg in
759 1.1 lukem # Double-quote args containing other shell metacharacters.
760 1.1 lukem # Many Bourne shells cannot handle close brackets correctly
761 1.1 lukem # in scan sets, and some SunOS ksh mistreat backslash-escaping
762 1.1 lukem # in scan sets (worked around with variable expansion),
763 1.1 lukem # and furthermore cannot handle '|' '&' '(' ')' in scan sets
764 1.1 lukem # at all, so we specify them separately.
765 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
766 1.1 lukem lastarg="\"$lastarg\""
767 1.1 lukem ;;
768 1.1 lukem esac
769 1.1 lukem
770 1.1 lukem base_compile="$base_compile $lastarg"
771 1.1 lukem done # for arg
772 1.1 lukem
773 1.1 lukem case $arg_mode in
774 1.1 lukem arg)
775 1.1 lukem $echo "$modename: you must specify an argument for -Xcompile"
776 1.1 lukem exit $EXIT_FAILURE
777 1.1 lukem ;;
778 1.1 lukem target)
779 1.1 lukem $echo "$modename: you must specify a target with \`-o'" 1>&2
780 1.1 lukem exit $EXIT_FAILURE
781 1.1 lukem ;;
782 1.1 lukem *)
783 1.1 lukem # Get the name of the library object.
784 1.1 lukem [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
785 1.1 lukem ;;
786 1.1 lukem esac
787 1.1 lukem
788 1.1 lukem # Recognize several different file suffixes.
789 1.1 lukem # If the user specifies -o file.o, it is replaced with file.lo
790 1.1 lukem xform='[cCFSifmso]'
791 1.1 lukem case $libobj in
792 1.1 lukem *.ada) xform=ada ;;
793 1.1 lukem *.adb) xform=adb ;;
794 1.1 lukem *.ads) xform=ads ;;
795 1.1 lukem *.asm) xform=asm ;;
796 1.1 lukem *.c++) xform=c++ ;;
797 1.1 lukem *.cc) xform=cc ;;
798 1.1 lukem *.ii) xform=ii ;;
799 1.1 lukem *.class) xform=class ;;
800 1.1 lukem *.cpp) xform=cpp ;;
801 1.1 lukem *.cxx) xform=cxx ;;
802 1.1 lukem *.f90) xform=f90 ;;
803 1.1 lukem *.for) xform=for ;;
804 1.1 lukem *.java) xform=java ;;
805 1.1 lukem esac
806 1.1 lukem
807 1.1 lukem libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
808 1.1 lukem
809 1.1 lukem case $libobj in
810 1.1 lukem *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
811 1.1 lukem *)
812 1.1 lukem $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
813 1.1 lukem exit $EXIT_FAILURE
814 1.1 lukem ;;
815 1.1 lukem esac
816 1.1 lukem
817 1.1 lukem func_infer_tag $base_compile
818 1.1 lukem
819 1.1 lukem for arg in $later; do
820 1.1 lukem case $arg in
821 1.1 lukem -static)
822 1.1 lukem build_old_libs=yes
823 1.1 lukem continue
824 1.1 lukem ;;
825 1.1 lukem
826 1.1 lukem -prefer-pic)
827 1.1 lukem pic_mode=yes
828 1.1 lukem continue
829 1.1 lukem ;;
830 1.1 lukem
831 1.1 lukem -prefer-non-pic)
832 1.1 lukem pic_mode=no
833 1.1 lukem continue
834 1.1 lukem ;;
835 1.1 lukem esac
836 1.1 lukem done
837 1.1 lukem
838 1.1 lukem qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
839 1.1 lukem case $qlibobj in
840 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
841 1.1 lukem qlibobj="\"$qlibobj\"" ;;
842 1.1 lukem esac
843 1.1 lukem test "X$libobj" != "X$qlibobj" \
844 1.1 lukem && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
845 1.1 lukem && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
846 1.1 lukem objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
847 1.1 lukem xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
848 1.1 lukem if test "X$xdir" = "X$obj"; then
849 1.1 lukem xdir=
850 1.1 lukem else
851 1.1 lukem xdir=$xdir/
852 1.1 lukem fi
853 1.1 lukem lobj=${xdir}$objdir/$objname
854 1.1 lukem
855 1.1 lukem if test -z "$base_compile"; then
856 1.1 lukem $echo "$modename: you must specify a compilation command" 1>&2
857 1.1 lukem $echo "$help" 1>&2
858 1.1 lukem exit $EXIT_FAILURE
859 1.1 lukem fi
860 1.1 lukem
861 1.1 lukem # Delete any leftover library objects.
862 1.1 lukem if test "$build_old_libs" = yes; then
863 1.1 lukem removelist="$obj $lobj $libobj ${libobj}T"
864 1.1 lukem else
865 1.1 lukem removelist="$lobj $libobj ${libobj}T"
866 1.1 lukem fi
867 1.1 lukem
868 1.1 lukem $run $rm $removelist
869 1.1 lukem trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
870 1.1 lukem
871 1.1 lukem # On Cygwin there's no "real" PIC flag so we must build both object types
872 1.1 lukem case $host_os in
873 1.1 lukem cygwin* | mingw* | pw32* | os2*)
874 1.1 lukem pic_mode=default
875 1.1 lukem ;;
876 1.1 lukem esac
877 1.1 lukem if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
878 1.1 lukem # non-PIC code in shared libraries is not supported
879 1.1 lukem pic_mode=default
880 1.1 lukem fi
881 1.1 lukem
882 1.1 lukem # Calculate the filename of the output object if compiler does
883 1.1 lukem # not support -o with -c
884 1.1 lukem if test "$compiler_c_o" = no; then
885 1.1 lukem output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
886 1.1 lukem lockfile="$output_obj.lock"
887 1.1 lukem removelist="$removelist $output_obj $lockfile"
888 1.1 lukem trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
889 1.1 lukem else
890 1.1 lukem output_obj=
891 1.1 lukem need_locks=no
892 1.1 lukem lockfile=
893 1.1 lukem fi
894 1.1 lukem
895 1.1 lukem # Lock this critical section if it is needed
896 1.1 lukem # We use this script file to make the link, it avoids creating a new file
897 1.1 lukem if test "$need_locks" = yes; then
898 1.1 lukem until $run ln "$progpath" "$lockfile" 2>/dev/null; do
899 1.1 lukem $show "Waiting for $lockfile to be removed"
900 1.1 lukem sleep 2
901 1.1 lukem done
902 1.1 lukem elif test "$need_locks" = warn; then
903 1.1 lukem if test -f "$lockfile"; then
904 1.1 lukem $echo "\
905 1.1 lukem *** ERROR, $lockfile exists and contains:
906 1.1 lukem `cat $lockfile 2>/dev/null`
907 1.1 lukem
908 1.1 lukem This indicates that another process is trying to use the same
909 1.1 lukem temporary object file, and libtool could not work around it because
910 1.1 lukem your compiler does not support \`-c' and \`-o' together. If you
911 1.1 lukem repeat this compilation, it may succeed, by chance, but you had better
912 1.1 lukem avoid parallel builds (make -j) in this platform, or get a better
913 1.1 lukem compiler."
914 1.1 lukem
915 1.1 lukem $run $rm $removelist
916 1.1 lukem exit $EXIT_FAILURE
917 1.1 lukem fi
918 1.1 lukem $echo "$srcfile" > "$lockfile"
919 1.1 lukem fi
920 1.1 lukem
921 1.1 lukem if test -n "$fix_srcfile_path"; then
922 1.1 lukem eval srcfile=\"$fix_srcfile_path\"
923 1.1 lukem fi
924 1.1 lukem qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
925 1.1 lukem case $qsrcfile in
926 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
927 1.1 lukem qsrcfile="\"$qsrcfile\"" ;;
928 1.1 lukem esac
929 1.1 lukem
930 1.1 lukem $run $rm "$libobj" "${libobj}T"
931 1.1 lukem
932 1.1 lukem # Create a libtool object file (analogous to a ".la" file),
933 1.1 lukem # but don't create it if we're doing a dry run.
934 1.1 lukem test -z "$run" && cat > ${libobj}T <<EOF
935 1.1 lukem # $libobj - a libtool object file
936 1.1 lukem # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
937 1.1 lukem #
938 1.1 lukem # Please DO NOT delete this file!
939 1.1 lukem # It is necessary for linking the library.
940 1.1 lukem
941 1.1 lukem # Name of the PIC object.
942 1.1 lukem EOF
943 1.1 lukem
944 1.1 lukem # Only build a PIC object if we are building libtool libraries.
945 1.1 lukem if test "$build_libtool_libs" = yes; then
946 1.1 lukem # Without this assignment, base_compile gets emptied.
947 1.1 lukem fbsd_hideous_sh_bug=$base_compile
948 1.1 lukem
949 1.1 lukem if test "$pic_mode" != no; then
950 1.1 lukem command="$base_compile $qsrcfile $pic_flag"
951 1.1 lukem else
952 1.1 lukem # Don't build PIC code
953 1.1 lukem command="$base_compile $qsrcfile"
954 1.1 lukem fi
955 1.1 lukem
956 1.1 lukem if test ! -d "${xdir}$objdir"; then
957 1.1 lukem $show "$mkdir ${xdir}$objdir"
958 1.1 lukem $run $mkdir ${xdir}$objdir
959 1.1 lukem exit_status=$?
960 1.1 lukem if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
961 1.1 lukem exit $exit_status
962 1.1 lukem fi
963 1.1 lukem fi
964 1.1 lukem
965 1.1 lukem if test -z "$output_obj"; then
966 1.1 lukem # Place PIC objects in $objdir
967 1.1 lukem command="$command -o $lobj"
968 1.1 lukem fi
969 1.1 lukem
970 1.1 lukem $run $rm "$lobj" "$output_obj"
971 1.1 lukem
972 1.1 lukem $show "$command"
973 1.1 lukem if $run eval "$command"; then :
974 1.1 lukem else
975 1.1 lukem test -n "$output_obj" && $run $rm $removelist
976 1.1 lukem exit $EXIT_FAILURE
977 1.1 lukem fi
978 1.1 lukem
979 1.1 lukem if test "$need_locks" = warn &&
980 1.1 lukem test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
981 1.1 lukem $echo "\
982 1.1 lukem *** ERROR, $lockfile contains:
983 1.1 lukem `cat $lockfile 2>/dev/null`
984 1.1 lukem
985 1.1 lukem but it should contain:
986 1.1 lukem $srcfile
987 1.1 lukem
988 1.1 lukem This indicates that another process is trying to use the same
989 1.1 lukem temporary object file, and libtool could not work around it because
990 1.1 lukem your compiler does not support \`-c' and \`-o' together. If you
991 1.1 lukem repeat this compilation, it may succeed, by chance, but you had better
992 1.1 lukem avoid parallel builds (make -j) in this platform, or get a better
993 1.1 lukem compiler."
994 1.1 lukem
995 1.1 lukem $run $rm $removelist
996 1.1 lukem exit $EXIT_FAILURE
997 1.1 lukem fi
998 1.1 lukem
999 1.1 lukem # Just move the object if needed, then go on to compile the next one
1000 1.1 lukem if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1001 1.1 lukem $show "$mv $output_obj $lobj"
1002 1.1 lukem if $run $mv $output_obj $lobj; then :
1003 1.1 lukem else
1004 1.1 lukem error=$?
1005 1.1 lukem $run $rm $removelist
1006 1.1 lukem exit $error
1007 1.1 lukem fi
1008 1.1 lukem fi
1009 1.1 lukem
1010 1.1 lukem # Append the name of the PIC object to the libtool object file.
1011 1.1 lukem test -z "$run" && cat >> ${libobj}T <<EOF
1012 1.1 lukem pic_object='$objdir/$objname'
1013 1.1 lukem
1014 1.1 lukem EOF
1015 1.1 lukem
1016 1.1 lukem # Allow error messages only from the first compilation.
1017 1.1 lukem if test "$suppress_opt" = yes; then
1018 1.1 lukem suppress_output=' >/dev/null 2>&1'
1019 1.1 lukem fi
1020 1.1 lukem else
1021 1.1 lukem # No PIC object so indicate it doesn't exist in the libtool
1022 1.1 lukem # object file.
1023 1.1 lukem test -z "$run" && cat >> ${libobj}T <<EOF
1024 1.1 lukem pic_object=none
1025 1.1 lukem
1026 1.1 lukem EOF
1027 1.1 lukem fi
1028 1.1 lukem
1029 1.1 lukem # Only build a position-dependent object if we build old libraries.
1030 1.1 lukem if test "$build_old_libs" = yes; then
1031 1.1 lukem if test "$pic_mode" != yes; then
1032 1.1 lukem # Don't build PIC code
1033 1.1 lukem command="$base_compile $qsrcfile"
1034 1.1 lukem else
1035 1.1 lukem command="$base_compile $qsrcfile $pic_flag"
1036 1.1 lukem fi
1037 1.1 lukem if test "$compiler_c_o" = yes; then
1038 1.1 lukem command="$command -o $obj"
1039 1.1 lukem fi
1040 1.1 lukem
1041 1.1 lukem # Suppress compiler output if we already did a PIC compilation.
1042 1.1 lukem command="$command$suppress_output"
1043 1.1 lukem $run $rm "$obj" "$output_obj"
1044 1.1 lukem $show "$command"
1045 1.1 lukem if $run eval "$command"; then :
1046 1.1 lukem else
1047 1.1 lukem $run $rm $removelist
1048 1.1 lukem exit $EXIT_FAILURE
1049 1.1 lukem fi
1050 1.1 lukem
1051 1.1 lukem if test "$need_locks" = warn &&
1052 1.1 lukem test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1053 1.1 lukem $echo "\
1054 1.1 lukem *** ERROR, $lockfile contains:
1055 1.1 lukem `cat $lockfile 2>/dev/null`
1056 1.1 lukem
1057 1.1 lukem but it should contain:
1058 1.1 lukem $srcfile
1059 1.1 lukem
1060 1.1 lukem This indicates that another process is trying to use the same
1061 1.1 lukem temporary object file, and libtool could not work around it because
1062 1.1 lukem your compiler does not support \`-c' and \`-o' together. If you
1063 1.1 lukem repeat this compilation, it may succeed, by chance, but you had better
1064 1.1 lukem avoid parallel builds (make -j) in this platform, or get a better
1065 1.1 lukem compiler."
1066 1.1 lukem
1067 1.1 lukem $run $rm $removelist
1068 1.1 lukem exit $EXIT_FAILURE
1069 1.1 lukem fi
1070 1.1 lukem
1071 1.1 lukem # Just move the object if needed
1072 1.1 lukem if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1073 1.1 lukem $show "$mv $output_obj $obj"
1074 1.1 lukem if $run $mv $output_obj $obj; then :
1075 1.1 lukem else
1076 1.1 lukem error=$?
1077 1.1 lukem $run $rm $removelist
1078 1.1 lukem exit $error
1079 1.1 lukem fi
1080 1.1 lukem fi
1081 1.1 lukem
1082 1.1 lukem # Append the name of the non-PIC object the libtool object file.
1083 1.1 lukem # Only append if the libtool object file exists.
1084 1.1 lukem test -z "$run" && cat >> ${libobj}T <<EOF
1085 1.1 lukem # Name of the non-PIC object.
1086 1.1 lukem non_pic_object='$objname'
1087 1.1 lukem
1088 1.1 lukem EOF
1089 1.1 lukem else
1090 1.1 lukem # Append the name of the non-PIC object the libtool object file.
1091 1.1 lukem # Only append if the libtool object file exists.
1092 1.1 lukem test -z "$run" && cat >> ${libobj}T <<EOF
1093 1.1 lukem # Name of the non-PIC object.
1094 1.1 lukem non_pic_object=none
1095 1.1 lukem
1096 1.1 lukem EOF
1097 1.1 lukem fi
1098 1.1 lukem
1099 1.1 lukem $run $mv "${libobj}T" "${libobj}"
1100 1.1 lukem
1101 1.1 lukem # Unlock the critical section if it was locked
1102 1.1 lukem if test "$need_locks" != no; then
1103 1.1 lukem $run $rm "$lockfile"
1104 1.1 lukem fi
1105 1.1 lukem
1106 1.1 lukem exit $EXIT_SUCCESS
1107 1.1 lukem ;;
1108 1.1 lukem
1109 1.1 lukem # libtool link mode
1110 1.1 lukem link | relink)
1111 1.1 lukem modename="$modename: link"
1112 1.1 lukem case $host in
1113 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1114 1.1 lukem # It is impossible to link a dll without this setting, and
1115 1.1 lukem # we shouldn't force the makefile maintainer to figure out
1116 1.1 lukem # which system we are compiling for in order to pass an extra
1117 1.1 lukem # flag for every libtool invocation.
1118 1.1 lukem # allow_undefined=no
1119 1.1 lukem
1120 1.1 lukem # FIXME: Unfortunately, there are problems with the above when trying
1121 1.1 lukem # to make a dll which has undefined symbols, in which case not
1122 1.1 lukem # even a static library is built. For now, we need to specify
1123 1.1 lukem # -no-undefined on the libtool link line when we can be certain
1124 1.1 lukem # that all symbols are satisfied, otherwise we get a static library.
1125 1.1 lukem allow_undefined=yes
1126 1.1 lukem ;;
1127 1.1 lukem *)
1128 1.1 lukem allow_undefined=yes
1129 1.1 lukem ;;
1130 1.1 lukem esac
1131 1.1 lukem libtool_args="$nonopt"
1132 1.1 lukem base_compile="$nonopt $@"
1133 1.1 lukem compile_command="$nonopt"
1134 1.1 lukem finalize_command="$nonopt"
1135 1.1 lukem
1136 1.1 lukem compile_rpath=
1137 1.1 lukem finalize_rpath=
1138 1.1 lukem compile_shlibpath=
1139 1.1 lukem finalize_shlibpath=
1140 1.1 lukem convenience=
1141 1.1 lukem old_convenience=
1142 1.1 lukem deplibs=
1143 1.1 lukem old_deplibs=
1144 1.1 lukem compiler_flags=
1145 1.1 lukem linker_flags=
1146 1.1 lukem dllsearchpath=
1147 1.1 lukem lib_search_path=`pwd`
1148 1.1 lukem inst_prefix_dir=
1149 1.1 lukem
1150 1.1 lukem avoid_version=no
1151 1.1 lukem dlfiles=
1152 1.1 lukem dlprefiles=
1153 1.1 lukem dlself=no
1154 1.1 lukem export_dynamic=no
1155 1.1 lukem export_symbols=
1156 1.1 lukem export_symbols_regex=
1157 1.1 lukem generated=
1158 1.1 lukem libobjs=
1159 1.1 lukem ltlibs=
1160 1.1 lukem module=no
1161 1.1 lukem no_install=no
1162 1.1 lukem objs=
1163 1.1 lukem non_pic_objects=
1164 1.1 lukem notinst_path= # paths that contain not-installed libtool libraries
1165 1.1 lukem precious_files_regex=
1166 1.1 lukem prefer_static_libs=no
1167 1.1 lukem preload=no
1168 1.1 lukem prev=
1169 1.1 lukem prevarg=
1170 1.1 lukem release=
1171 1.1 lukem rpath=
1172 1.1 lukem xrpath=
1173 1.1 lukem perm_rpath=
1174 1.1 lukem temp_rpath=
1175 1.1 lukem thread_safe=no
1176 1.1 lukem vinfo=
1177 1.1 lukem vinfo_number=no
1178 1.1 lukem
1179 1.1 lukem func_infer_tag $base_compile
1180 1.1 lukem
1181 1.1 lukem # We need to know -static, to get the right output filenames.
1182 1.1 lukem for arg
1183 1.1 lukem do
1184 1.1 lukem case $arg in
1185 1.1 lukem -all-static | -static)
1186 1.1 lukem if test "X$arg" = "X-all-static"; then
1187 1.1 lukem if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1188 1.1 lukem $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1189 1.1 lukem fi
1190 1.1 lukem if test -n "$link_static_flag"; then
1191 1.1 lukem dlopen_self=$dlopen_self_static
1192 1.1 lukem fi
1193 1.1 lukem prefer_static_libs=yes
1194 1.1 lukem else
1195 1.1 lukem if test -z "$pic_flag" && test -n "$link_static_flag"; then
1196 1.1 lukem dlopen_self=$dlopen_self_static
1197 1.1 lukem fi
1198 1.1 lukem prefer_static_libs=built
1199 1.1 lukem fi
1200 1.1 lukem build_libtool_libs=no
1201 1.1 lukem build_old_libs=yes
1202 1.1 lukem break
1203 1.1 lukem ;;
1204 1.1 lukem esac
1205 1.1 lukem done
1206 1.1 lukem
1207 1.1 lukem # See if our shared archives depend on static archives.
1208 1.1 lukem test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1209 1.1 lukem
1210 1.1 lukem # Go through the arguments, transforming them on the way.
1211 1.1 lukem while test "$#" -gt 0; do
1212 1.1 lukem arg="$1"
1213 1.1 lukem shift
1214 1.1 lukem case $arg in
1215 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1216 1.1 lukem qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1217 1.1 lukem ;;
1218 1.1 lukem *) qarg=$arg ;;
1219 1.1 lukem esac
1220 1.1 lukem libtool_args="$libtool_args $qarg"
1221 1.1 lukem
1222 1.1 lukem # If the previous option needs an argument, assign it.
1223 1.1 lukem if test -n "$prev"; then
1224 1.1 lukem case $prev in
1225 1.1 lukem output)
1226 1.1 lukem compile_command="$compile_command @OUTPUT@"
1227 1.1 lukem finalize_command="$finalize_command @OUTPUT@"
1228 1.1 lukem ;;
1229 1.1 lukem esac
1230 1.1 lukem
1231 1.1 lukem case $prev in
1232 1.1 lukem dlfiles|dlprefiles)
1233 1.1 lukem if test "$preload" = no; then
1234 1.1 lukem # Add the symbol object into the linking commands.
1235 1.1 lukem compile_command="$compile_command @SYMFILE@"
1236 1.1 lukem finalize_command="$finalize_command @SYMFILE@"
1237 1.1 lukem preload=yes
1238 1.1 lukem fi
1239 1.1 lukem case $arg in
1240 1.1 lukem *.la | *.lo) ;; # We handle these cases below.
1241 1.1 lukem force)
1242 1.1 lukem if test "$dlself" = no; then
1243 1.1 lukem dlself=needless
1244 1.1 lukem export_dynamic=yes
1245 1.1 lukem fi
1246 1.1 lukem prev=
1247 1.1 lukem continue
1248 1.1 lukem ;;
1249 1.1 lukem self)
1250 1.1 lukem if test "$prev" = dlprefiles; then
1251 1.1 lukem dlself=yes
1252 1.1 lukem elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1253 1.1 lukem dlself=yes
1254 1.1 lukem else
1255 1.1 lukem dlself=needless
1256 1.1 lukem export_dynamic=yes
1257 1.1 lukem fi
1258 1.1 lukem prev=
1259 1.1 lukem continue
1260 1.1 lukem ;;
1261 1.1 lukem *)
1262 1.1 lukem if test "$prev" = dlfiles; then
1263 1.1 lukem dlfiles="$dlfiles $arg"
1264 1.1 lukem else
1265 1.1 lukem dlprefiles="$dlprefiles $arg"
1266 1.1 lukem fi
1267 1.1 lukem prev=
1268 1.1 lukem continue
1269 1.1 lukem ;;
1270 1.1 lukem esac
1271 1.1 lukem ;;
1272 1.1 lukem expsyms)
1273 1.1 lukem export_symbols="$arg"
1274 1.1 lukem if test ! -f "$arg"; then
1275 1.1 lukem $echo "$modename: symbol file \`$arg' does not exist"
1276 1.1 lukem exit $EXIT_FAILURE
1277 1.1 lukem fi
1278 1.1 lukem prev=
1279 1.1 lukem continue
1280 1.1 lukem ;;
1281 1.1 lukem expsyms_regex)
1282 1.1 lukem export_symbols_regex="$arg"
1283 1.1 lukem prev=
1284 1.1 lukem continue
1285 1.1 lukem ;;
1286 1.1 lukem inst_prefix)
1287 1.1 lukem inst_prefix_dir="$arg"
1288 1.1 lukem prev=
1289 1.1 lukem continue
1290 1.1 lukem ;;
1291 1.1 lukem precious_regex)
1292 1.1 lukem precious_files_regex="$arg"
1293 1.1 lukem prev=
1294 1.1 lukem continue
1295 1.1 lukem ;;
1296 1.1 lukem release)
1297 1.1 lukem release="-$arg"
1298 1.1 lukem prev=
1299 1.1 lukem continue
1300 1.1 lukem ;;
1301 1.1 lukem objectlist)
1302 1.1 lukem if test -f "$arg"; then
1303 1.1 lukem save_arg=$arg
1304 1.1 lukem moreargs=
1305 1.1 lukem for fil in `cat $save_arg`
1306 1.1 lukem do
1307 1.1 lukem # moreargs="$moreargs $fil"
1308 1.1 lukem arg=$fil
1309 1.1 lukem # A libtool-controlled object.
1310 1.1 lukem
1311 1.1 lukem # Check to see that this really is a libtool object.
1312 1.1 lukem if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1313 1.1 lukem pic_object=
1314 1.1 lukem non_pic_object=
1315 1.1 lukem
1316 1.1 lukem # Read the .lo file
1317 1.1 lukem # If there is no directory component, then add one.
1318 1.1 lukem case $arg in
1319 1.1 lukem */* | *\\*) . $arg ;;
1320 1.1 lukem *) . ./$arg ;;
1321 1.1 lukem esac
1322 1.1 lukem
1323 1.1 lukem if test -z "$pic_object" || \
1324 1.1 lukem test -z "$non_pic_object" ||
1325 1.1 lukem test "$pic_object" = none && \
1326 1.1 lukem test "$non_pic_object" = none; then
1327 1.1 lukem $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1328 1.1 lukem exit $EXIT_FAILURE
1329 1.1 lukem fi
1330 1.1 lukem
1331 1.1 lukem # Extract subdirectory from the argument.
1332 1.1 lukem xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1333 1.1 lukem if test "X$xdir" = "X$arg"; then
1334 1.1 lukem xdir=
1335 1.1 lukem else
1336 1.1 lukem xdir="$xdir/"
1337 1.1 lukem fi
1338 1.1 lukem
1339 1.1 lukem if test "$pic_object" != none; then
1340 1.1 lukem # Prepend the subdirectory the object is found in.
1341 1.1 lukem pic_object="$xdir$pic_object"
1342 1.1 lukem
1343 1.1 lukem if test "$prev" = dlfiles; then
1344 1.1 lukem if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1345 1.1 lukem dlfiles="$dlfiles $pic_object"
1346 1.1 lukem prev=
1347 1.1 lukem continue
1348 1.1 lukem else
1349 1.1 lukem # If libtool objects are unsupported, then we need to preload.
1350 1.1 lukem prev=dlprefiles
1351 1.1 lukem fi
1352 1.1 lukem fi
1353 1.1 lukem
1354 1.1 lukem # CHECK ME: I think I busted this. -Ossama
1355 1.1 lukem if test "$prev" = dlprefiles; then
1356 1.1 lukem # Preload the old-style object.
1357 1.1 lukem dlprefiles="$dlprefiles $pic_object"
1358 1.1 lukem prev=
1359 1.1 lukem fi
1360 1.1 lukem
1361 1.1 lukem # A PIC object.
1362 1.1 lukem libobjs="$libobjs $pic_object"
1363 1.1 lukem arg="$pic_object"
1364 1.1 lukem fi
1365 1.1 lukem
1366 1.1 lukem # Non-PIC object.
1367 1.1 lukem if test "$non_pic_object" != none; then
1368 1.1 lukem # Prepend the subdirectory the object is found in.
1369 1.1 lukem non_pic_object="$xdir$non_pic_object"
1370 1.1 lukem
1371 1.1 lukem # A standard non-PIC object
1372 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1373 1.1 lukem if test -z "$pic_object" || test "$pic_object" = none ; then
1374 1.1 lukem arg="$non_pic_object"
1375 1.1 lukem fi
1376 1.1 lukem else
1377 1.1 lukem # If the PIC object exists, use it instead.
1378 1.1 lukem # $xdir was prepended to $pic_object above.
1379 1.1 lukem non_pic_object="$pic_object"
1380 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1381 1.1 lukem fi
1382 1.1 lukem else
1383 1.1 lukem # Only an error if not doing a dry-run.
1384 1.1 lukem if test -z "$run"; then
1385 1.1 lukem $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1386 1.1 lukem exit $EXIT_FAILURE
1387 1.1 lukem else
1388 1.1 lukem # Dry-run case.
1389 1.1 lukem
1390 1.1 lukem # Extract subdirectory from the argument.
1391 1.1 lukem xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1392 1.1 lukem if test "X$xdir" = "X$arg"; then
1393 1.1 lukem xdir=
1394 1.1 lukem else
1395 1.1 lukem xdir="$xdir/"
1396 1.1 lukem fi
1397 1.1 lukem
1398 1.1 lukem pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1399 1.1 lukem non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1400 1.1 lukem libobjs="$libobjs $pic_object"
1401 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1402 1.1 lukem fi
1403 1.1 lukem fi
1404 1.1 lukem done
1405 1.1 lukem else
1406 1.1 lukem $echo "$modename: link input file \`$save_arg' does not exist"
1407 1.1 lukem exit $EXIT_FAILURE
1408 1.1 lukem fi
1409 1.1 lukem arg=$save_arg
1410 1.1 lukem prev=
1411 1.1 lukem continue
1412 1.1 lukem ;;
1413 1.1 lukem rpath | xrpath)
1414 1.1 lukem # We need an absolute path.
1415 1.1 lukem case $arg in
1416 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) ;;
1417 1.1 lukem *)
1418 1.1 lukem $echo "$modename: only absolute run-paths are allowed" 1>&2
1419 1.1 lukem exit $EXIT_FAILURE
1420 1.1 lukem ;;
1421 1.1 lukem esac
1422 1.1 lukem if test "$prev" = rpath; then
1423 1.1 lukem case "$rpath " in
1424 1.1 lukem *" $arg "*) ;;
1425 1.1 lukem *) rpath="$rpath $arg" ;;
1426 1.1 lukem esac
1427 1.1 lukem else
1428 1.1 lukem case "$xrpath " in
1429 1.1 lukem *" $arg "*) ;;
1430 1.1 lukem *) xrpath="$xrpath $arg" ;;
1431 1.1 lukem esac
1432 1.1 lukem fi
1433 1.1 lukem prev=
1434 1.1 lukem continue
1435 1.1 lukem ;;
1436 1.1 lukem xcompiler)
1437 1.1 lukem compiler_flags="$compiler_flags $qarg"
1438 1.1 lukem prev=
1439 1.1 lukem compile_command="$compile_command $qarg"
1440 1.1 lukem finalize_command="$finalize_command $qarg"
1441 1.1 lukem continue
1442 1.1 lukem ;;
1443 1.1 lukem xlinker)
1444 1.1 lukem linker_flags="$linker_flags $qarg"
1445 1.1 lukem compiler_flags="$compiler_flags $wl$qarg"
1446 1.1 lukem prev=
1447 1.1 lukem compile_command="$compile_command $wl$qarg"
1448 1.1 lukem finalize_command="$finalize_command $wl$qarg"
1449 1.1 lukem continue
1450 1.1 lukem ;;
1451 1.1 lukem xcclinker)
1452 1.1 lukem linker_flags="$linker_flags $qarg"
1453 1.1 lukem compiler_flags="$compiler_flags $qarg"
1454 1.1 lukem prev=
1455 1.1 lukem compile_command="$compile_command $qarg"
1456 1.1 lukem finalize_command="$finalize_command $qarg"
1457 1.1 lukem continue
1458 1.1 lukem ;;
1459 1.1 lukem shrext)
1460 1.1 lukem shrext_cmds="$arg"
1461 1.1 lukem prev=
1462 1.1 lukem continue
1463 1.1 lukem ;;
1464 1.1 lukem darwin_framework|darwin_framework_skip)
1465 1.1 lukem test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1466 1.1 lukem compile_command="$compile_command $arg"
1467 1.1 lukem finalize_command="$finalize_command $arg"
1468 1.1 lukem prev=
1469 1.1 lukem continue
1470 1.1 lukem ;;
1471 1.1 lukem *)
1472 1.1 lukem eval "$prev=\"\$arg\""
1473 1.1 lukem prev=
1474 1.1 lukem continue
1475 1.1 lukem ;;
1476 1.1 lukem esac
1477 1.1 lukem fi # test -n "$prev"
1478 1.1 lukem
1479 1.1 lukem prevarg="$arg"
1480 1.1 lukem
1481 1.1 lukem case $arg in
1482 1.1 lukem -all-static)
1483 1.1 lukem if test -n "$link_static_flag"; then
1484 1.1 lukem compile_command="$compile_command $link_static_flag"
1485 1.1 lukem finalize_command="$finalize_command $link_static_flag"
1486 1.1 lukem fi
1487 1.1 lukem continue
1488 1.1 lukem ;;
1489 1.1 lukem
1490 1.1 lukem -allow-undefined)
1491 1.1 lukem # FIXME: remove this flag sometime in the future.
1492 1.1 lukem $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1493 1.1 lukem continue
1494 1.1 lukem ;;
1495 1.1 lukem
1496 1.1 lukem -avoid-version)
1497 1.1 lukem avoid_version=yes
1498 1.1 lukem continue
1499 1.1 lukem ;;
1500 1.1 lukem
1501 1.1 lukem -dlopen)
1502 1.1 lukem prev=dlfiles
1503 1.1 lukem continue
1504 1.1 lukem ;;
1505 1.1 lukem
1506 1.1 lukem -dlpreopen)
1507 1.1 lukem prev=dlprefiles
1508 1.1 lukem continue
1509 1.1 lukem ;;
1510 1.1 lukem
1511 1.1 lukem -export-dynamic)
1512 1.1 lukem export_dynamic=yes
1513 1.1 lukem continue
1514 1.1 lukem ;;
1515 1.1 lukem
1516 1.1 lukem -export-symbols | -export-symbols-regex)
1517 1.1 lukem if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1518 1.1 lukem $echo "$modename: more than one -exported-symbols argument is not allowed"
1519 1.1 lukem exit $EXIT_FAILURE
1520 1.1 lukem fi
1521 1.1 lukem if test "X$arg" = "X-export-symbols"; then
1522 1.1 lukem prev=expsyms
1523 1.1 lukem else
1524 1.1 lukem prev=expsyms_regex
1525 1.1 lukem fi
1526 1.1 lukem continue
1527 1.1 lukem ;;
1528 1.1 lukem
1529 1.1 lukem -framework|-arch|-isysroot)
1530 1.1 lukem case " $CC " in
1531 1.1 lukem *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1532 1.1 lukem prev=darwin_framework_skip ;;
1533 1.1 lukem *) compiler_flags="$compiler_flags $arg"
1534 1.1 lukem prev=darwin_framework ;;
1535 1.1 lukem esac
1536 1.1 lukem compile_command="$compile_command $arg"
1537 1.1 lukem finalize_command="$finalize_command $arg"
1538 1.1 lukem continue
1539 1.1 lukem ;;
1540 1.1 lukem
1541 1.1 lukem -inst-prefix-dir)
1542 1.1 lukem prev=inst_prefix
1543 1.1 lukem continue
1544 1.1 lukem ;;
1545 1.1 lukem
1546 1.1 lukem # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1547 1.1 lukem # so, if we see these flags be careful not to treat them like -L
1548 1.1 lukem -L[A-Z][A-Z]*:*)
1549 1.1 lukem case $with_gcc/$host in
1550 1.1 lukem no/*-*-irix* | /*-*-irix*)
1551 1.1 lukem compile_command="$compile_command $arg"
1552 1.1 lukem finalize_command="$finalize_command $arg"
1553 1.1 lukem ;;
1554 1.1 lukem esac
1555 1.1 lukem continue
1556 1.1 lukem ;;
1557 1.1 lukem
1558 1.1 lukem -L*)
1559 1.1 lukem dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1560 1.1 lukem # We need an absolute path.
1561 1.1 lukem case $dir in
1562 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) ;;
1563 1.1 lukem *)
1564 1.1 lukem absdir=`cd "$dir" && pwd`
1565 1.1 lukem if test -z "$absdir"; then
1566 1.1 lukem $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1567 1.1 lukem absdir="$dir"
1568 1.1 lukem notinst_path="$notinst_path $dir"
1569 1.1 lukem fi
1570 1.1 lukem dir="$absdir"
1571 1.1 lukem ;;
1572 1.1 lukem esac
1573 1.1 lukem case "$deplibs " in
1574 1.1 lukem *" -L$dir "*) ;;
1575 1.1 lukem *)
1576 1.1 lukem deplibs="$deplibs -L$dir"
1577 1.1 lukem lib_search_path="$lib_search_path $dir"
1578 1.1 lukem ;;
1579 1.1 lukem esac
1580 1.1 lukem case $host in
1581 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1582 1.1 lukem testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1583 1.1 lukem case :$dllsearchpath: in
1584 1.1 lukem *":$dir:"*) ;;
1585 1.1 lukem *) dllsearchpath="$dllsearchpath:$dir";;
1586 1.1 lukem esac
1587 1.1 lukem case :$dllsearchpath: in
1588 1.1 lukem *":$testbindir:"*) ;;
1589 1.1 lukem *) dllsearchpath="$dllsearchpath:$testbindir";;
1590 1.1 lukem esac
1591 1.1 lukem ;;
1592 1.1 lukem esac
1593 1.1 lukem continue
1594 1.1 lukem ;;
1595 1.1 lukem
1596 1.1 lukem -l*)
1597 1.1 lukem if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1598 1.1 lukem case $host in
1599 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1600 1.1 lukem # These systems don't actually have a C or math library (as such)
1601 1.1 lukem continue
1602 1.1 lukem ;;
1603 1.1 lukem *-*-os2*)
1604 1.1 lukem # These systems don't actually have a C library (as such)
1605 1.1 lukem test "X$arg" = "X-lc" && continue
1606 1.1 lukem ;;
1607 1.1 lukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1608 1.1 lukem # Do not include libc due to us having libc/libc_r.
1609 1.1 lukem test "X$arg" = "X-lc" && continue
1610 1.1 lukem ;;
1611 1.1 lukem *-*-rhapsody* | *-*-darwin1.[012])
1612 1.1 lukem # Rhapsody C and math libraries are in the System framework
1613 1.1 lukem deplibs="$deplibs -framework System"
1614 1.1 lukem continue
1615 1.1 lukem ;;
1616 1.1 lukem *-*-sco3.2v5* | *-*-sco5v6*)
1617 1.1 lukem # Causes problems with __ctype
1618 1.1 lukem test "X$arg" = "X-lc" && continue
1619 1.1 lukem ;;
1620 1.1 lukem *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1621 1.1 lukem # Compiler inserts libc in the correct place for threads to work
1622 1.1 lukem test "X$arg" = "X-lc" && continue
1623 1.1 lukem ;;
1624 1.1 lukem esac
1625 1.1 lukem elif test "X$arg" = "X-lc_r"; then
1626 1.1 lukem case $host in
1627 1.1 lukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1628 1.1 lukem # Do not include libc_r directly, use -pthread flag.
1629 1.1 lukem continue
1630 1.1 lukem ;;
1631 1.1 lukem esac
1632 1.1 lukem fi
1633 1.1 lukem deplibs="$deplibs $arg"
1634 1.1 lukem continue
1635 1.1 lukem ;;
1636 1.1 lukem
1637 1.1 lukem # Tru64 UNIX uses -model [arg] to determine the layout of C++
1638 1.1 lukem # classes, name mangling, and exception handling.
1639 1.1 lukem -model)
1640 1.1 lukem compile_command="$compile_command $arg"
1641 1.1 lukem compiler_flags="$compiler_flags $arg"
1642 1.1 lukem finalize_command="$finalize_command $arg"
1643 1.1 lukem prev=xcompiler
1644 1.1 lukem continue
1645 1.1 lukem ;;
1646 1.1 lukem
1647 1.1 lukem -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1648 1.1 lukem compiler_flags="$compiler_flags $arg"
1649 1.1 lukem compile_command="$compile_command $arg"
1650 1.1 lukem finalize_command="$finalize_command $arg"
1651 1.1 lukem deplibs="$deplibs $arg"
1652 1.1 lukem continue
1653 1.1 lukem ;;
1654 1.1 lukem
1655 1.1 lukem -module)
1656 1.1 lukem module=yes
1657 1.1 lukem continue
1658 1.1 lukem ;;
1659 1.1 lukem
1660 1.1 lukem # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1661 1.1 lukem # -r[0-9][0-9]* specifies the processor on the SGI compiler
1662 1.1 lukem # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1663 1.1 lukem # +DA*, +DD* enable 64-bit mode on the HP compiler
1664 1.1 lukem # -q* pass through compiler args for the IBM compiler
1665 1.1 lukem # -m* pass through architecture-specific compiler args for GCC
1666 1.1 lukem # -m*, -t[45]*, -txscale* pass through architecture-specific
1667 1.1 lukem # compiler args for GCC
1668 1.1 lukem # -pg pass through profiling flag for GCC
1669 1.1 lukem # @file GCC response files
1670 1.1 lukem -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1671 1.1 lukem -t[45]*|-txscale*|@*)
1672 1.1 lukem
1673 1.1 lukem # Unknown arguments in both finalize_command and compile_command need
1674 1.1 lukem # to be aesthetically quoted because they are evaled later.
1675 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1676 1.1 lukem case $arg in
1677 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1678 1.1 lukem arg="\"$arg\""
1679 1.1 lukem ;;
1680 1.1 lukem esac
1681 1.1 lukem compile_command="$compile_command $arg"
1682 1.1 lukem finalize_command="$finalize_command $arg"
1683 1.1 lukem compiler_flags="$compiler_flags $arg"
1684 1.1 lukem continue
1685 1.1 lukem ;;
1686 1.1 lukem
1687 1.1 lukem -shrext)
1688 1.1 lukem prev=shrext
1689 1.1 lukem continue
1690 1.1 lukem ;;
1691 1.1 lukem
1692 1.1 lukem -no-fast-install)
1693 1.1 lukem fast_install=no
1694 1.1 lukem continue
1695 1.1 lukem ;;
1696 1.1 lukem
1697 1.1 lukem -no-install)
1698 1.1 lukem case $host in
1699 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1700 1.1 lukem # The PATH hackery in wrapper scripts is required on Windows
1701 1.1 lukem # in order for the loader to find any dlls it needs.
1702 1.1 lukem $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1703 1.1 lukem $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1704 1.1 lukem fast_install=no
1705 1.1 lukem ;;
1706 1.1 lukem *) no_install=yes ;;
1707 1.1 lukem esac
1708 1.1 lukem continue
1709 1.1 lukem ;;
1710 1.1 lukem
1711 1.1 lukem -no-undefined)
1712 1.1 lukem allow_undefined=no
1713 1.1 lukem continue
1714 1.1 lukem ;;
1715 1.1 lukem
1716 1.1 lukem -objectlist)
1717 1.1 lukem prev=objectlist
1718 1.1 lukem continue
1719 1.1 lukem ;;
1720 1.1 lukem
1721 1.1 lukem -o) prev=output ;;
1722 1.1 lukem
1723 1.1 lukem -precious-files-regex)
1724 1.1 lukem prev=precious_regex
1725 1.1 lukem continue
1726 1.1 lukem ;;
1727 1.1 lukem
1728 1.1 lukem -release)
1729 1.1 lukem prev=release
1730 1.1 lukem continue
1731 1.1 lukem ;;
1732 1.1 lukem
1733 1.1 lukem -rpath)
1734 1.1 lukem prev=rpath
1735 1.1 lukem continue
1736 1.1 lukem ;;
1737 1.1 lukem
1738 1.1 lukem -R)
1739 1.1 lukem prev=xrpath
1740 1.1 lukem continue
1741 1.1 lukem ;;
1742 1.1 lukem
1743 1.1 lukem -R*)
1744 1.1 lukem dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1745 1.1 lukem # We need an absolute path.
1746 1.1 lukem case $dir in
1747 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) ;;
1748 1.1 lukem *)
1749 1.1 lukem $echo "$modename: only absolute run-paths are allowed" 1>&2
1750 1.1 lukem exit $EXIT_FAILURE
1751 1.1 lukem ;;
1752 1.1 lukem esac
1753 1.1 lukem case "$xrpath " in
1754 1.1 lukem *" $dir "*) ;;
1755 1.1 lukem *) xrpath="$xrpath $dir" ;;
1756 1.1 lukem esac
1757 1.1 lukem continue
1758 1.1 lukem ;;
1759 1.1 lukem
1760 1.1 lukem -static)
1761 1.1 lukem # The effects of -static are defined in a previous loop.
1762 1.1 lukem # We used to do the same as -all-static on platforms that
1763 1.1 lukem # didn't have a PIC flag, but the assumption that the effects
1764 1.1 lukem # would be equivalent was wrong. It would break on at least
1765 1.1 lukem # Digital Unix and AIX.
1766 1.1 lukem continue
1767 1.1 lukem ;;
1768 1.1 lukem
1769 1.1 lukem -thread-safe)
1770 1.1 lukem thread_safe=yes
1771 1.1 lukem continue
1772 1.1 lukem ;;
1773 1.1 lukem
1774 1.1 lukem -version-info)
1775 1.1 lukem prev=vinfo
1776 1.1 lukem continue
1777 1.1 lukem ;;
1778 1.1 lukem -version-number)
1779 1.1 lukem prev=vinfo
1780 1.1 lukem vinfo_number=yes
1781 1.1 lukem continue
1782 1.1 lukem ;;
1783 1.1 lukem
1784 1.1 lukem -Wc,*)
1785 1.1 lukem args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1786 1.1 lukem arg=
1787 1.1 lukem save_ifs="$IFS"; IFS=','
1788 1.1 lukem for flag in $args; do
1789 1.1 lukem IFS="$save_ifs"
1790 1.1 lukem case $flag in
1791 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1792 1.1 lukem flag="\"$flag\""
1793 1.1 lukem ;;
1794 1.1 lukem esac
1795 1.1 lukem arg="$arg $wl$flag"
1796 1.1 lukem compiler_flags="$compiler_flags $flag"
1797 1.1 lukem done
1798 1.1 lukem IFS="$save_ifs"
1799 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1800 1.1 lukem ;;
1801 1.1 lukem
1802 1.1 lukem -Wl,*)
1803 1.1 lukem args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1804 1.1 lukem arg=
1805 1.1 lukem save_ifs="$IFS"; IFS=','
1806 1.1 lukem for flag in $args; do
1807 1.1 lukem IFS="$save_ifs"
1808 1.1 lukem case $flag in
1809 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1810 1.1 lukem flag="\"$flag\""
1811 1.1 lukem ;;
1812 1.1 lukem esac
1813 1.1 lukem arg="$arg $wl$flag"
1814 1.1 lukem compiler_flags="$compiler_flags $wl$flag"
1815 1.1 lukem linker_flags="$linker_flags $flag"
1816 1.1 lukem done
1817 1.1 lukem IFS="$save_ifs"
1818 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1819 1.1 lukem ;;
1820 1.1 lukem
1821 1.1 lukem -Xcompiler)
1822 1.1 lukem prev=xcompiler
1823 1.1 lukem continue
1824 1.1 lukem ;;
1825 1.1 lukem
1826 1.1 lukem -Xlinker)
1827 1.1 lukem prev=xlinker
1828 1.1 lukem continue
1829 1.1 lukem ;;
1830 1.1 lukem
1831 1.1 lukem -XCClinker)
1832 1.1 lukem prev=xcclinker
1833 1.1 lukem continue
1834 1.1 lukem ;;
1835 1.1 lukem
1836 1.1 lukem # Some other compiler flag.
1837 1.1 lukem -* | +*)
1838 1.1 lukem # Unknown arguments in both finalize_command and compile_command need
1839 1.1 lukem # to be aesthetically quoted because they are evaled later.
1840 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1841 1.1 lukem case $arg in
1842 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1843 1.1 lukem arg="\"$arg\""
1844 1.1 lukem ;;
1845 1.1 lukem esac
1846 1.1 lukem ;;
1847 1.1 lukem
1848 1.1 lukem *.$objext)
1849 1.1 lukem # A standard object.
1850 1.1 lukem objs="$objs $arg"
1851 1.1 lukem ;;
1852 1.1 lukem
1853 1.1 lukem *.lo)
1854 1.1 lukem # A libtool-controlled object.
1855 1.1 lukem
1856 1.1 lukem # Check to see that this really is a libtool object.
1857 1.1 lukem if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1858 1.1 lukem pic_object=
1859 1.1 lukem non_pic_object=
1860 1.1 lukem
1861 1.1 lukem # Read the .lo file
1862 1.1 lukem # If there is no directory component, then add one.
1863 1.1 lukem case $arg in
1864 1.1 lukem */* | *\\*) . $arg ;;
1865 1.1 lukem *) . ./$arg ;;
1866 1.1 lukem esac
1867 1.1 lukem
1868 1.1 lukem if test -z "$pic_object" || \
1869 1.1 lukem test -z "$non_pic_object" ||
1870 1.1 lukem test "$pic_object" = none && \
1871 1.1 lukem test "$non_pic_object" = none; then
1872 1.1 lukem $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1873 1.1 lukem exit $EXIT_FAILURE
1874 1.1 lukem fi
1875 1.1 lukem
1876 1.1 lukem # Extract subdirectory from the argument.
1877 1.1 lukem xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1878 1.1 lukem if test "X$xdir" = "X$arg"; then
1879 1.1 lukem xdir=
1880 1.1 lukem else
1881 1.1 lukem xdir="$xdir/"
1882 1.1 lukem fi
1883 1.1 lukem
1884 1.1 lukem if test "$pic_object" != none; then
1885 1.1 lukem # Prepend the subdirectory the object is found in.
1886 1.1 lukem pic_object="$xdir$pic_object"
1887 1.1 lukem
1888 1.1 lukem if test "$prev" = dlfiles; then
1889 1.1 lukem if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1890 1.1 lukem dlfiles="$dlfiles $pic_object"
1891 1.1 lukem prev=
1892 1.1 lukem continue
1893 1.1 lukem else
1894 1.1 lukem # If libtool objects are unsupported, then we need to preload.
1895 1.1 lukem prev=dlprefiles
1896 1.1 lukem fi
1897 1.1 lukem fi
1898 1.1 lukem
1899 1.1 lukem # CHECK ME: I think I busted this. -Ossama
1900 1.1 lukem if test "$prev" = dlprefiles; then
1901 1.1 lukem # Preload the old-style object.
1902 1.1 lukem dlprefiles="$dlprefiles $pic_object"
1903 1.1 lukem prev=
1904 1.1 lukem fi
1905 1.1 lukem
1906 1.1 lukem # A PIC object.
1907 1.1 lukem libobjs="$libobjs $pic_object"
1908 1.1 lukem arg="$pic_object"
1909 1.1 lukem fi
1910 1.1 lukem
1911 1.1 lukem # Non-PIC object.
1912 1.1 lukem if test "$non_pic_object" != none; then
1913 1.1 lukem # Prepend the subdirectory the object is found in.
1914 1.1 lukem non_pic_object="$xdir$non_pic_object"
1915 1.1 lukem
1916 1.1 lukem # A standard non-PIC object
1917 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1918 1.1 lukem if test -z "$pic_object" || test "$pic_object" = none ; then
1919 1.1 lukem arg="$non_pic_object"
1920 1.1 lukem fi
1921 1.1 lukem else
1922 1.1 lukem # If the PIC object exists, use it instead.
1923 1.1 lukem # $xdir was prepended to $pic_object above.
1924 1.1 lukem non_pic_object="$pic_object"
1925 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1926 1.1 lukem fi
1927 1.1 lukem else
1928 1.1 lukem # Only an error if not doing a dry-run.
1929 1.1 lukem if test -z "$run"; then
1930 1.1 lukem $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1931 1.1 lukem exit $EXIT_FAILURE
1932 1.1 lukem else
1933 1.1 lukem # Dry-run case.
1934 1.1 lukem
1935 1.1 lukem # Extract subdirectory from the argument.
1936 1.1 lukem xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1937 1.1 lukem if test "X$xdir" = "X$arg"; then
1938 1.1 lukem xdir=
1939 1.1 lukem else
1940 1.1 lukem xdir="$xdir/"
1941 1.1 lukem fi
1942 1.1 lukem
1943 1.1 lukem pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1944 1.1 lukem non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1945 1.1 lukem libobjs="$libobjs $pic_object"
1946 1.1 lukem non_pic_objects="$non_pic_objects $non_pic_object"
1947 1.1 lukem fi
1948 1.1 lukem fi
1949 1.1 lukem ;;
1950 1.1 lukem
1951 1.1 lukem *.$libext)
1952 1.1 lukem # An archive.
1953 1.1 lukem deplibs="$deplibs $arg"
1954 1.1 lukem old_deplibs="$old_deplibs $arg"
1955 1.1 lukem continue
1956 1.1 lukem ;;
1957 1.1 lukem
1958 1.1 lukem *.la)
1959 1.1 lukem # A libtool-controlled library.
1960 1.1 lukem
1961 1.1 lukem if test "$prev" = dlfiles; then
1962 1.1 lukem # This library was specified with -dlopen.
1963 1.1 lukem dlfiles="$dlfiles $arg"
1964 1.1 lukem prev=
1965 1.1 lukem elif test "$prev" = dlprefiles; then
1966 1.1 lukem # The library was specified with -dlpreopen.
1967 1.1 lukem dlprefiles="$dlprefiles $arg"
1968 1.1 lukem prev=
1969 1.1 lukem else
1970 1.1 lukem deplibs="$deplibs $arg"
1971 1.1 lukem fi
1972 1.1 lukem continue
1973 1.1 lukem ;;
1974 1.1 lukem
1975 1.1 lukem # Some other compiler argument.
1976 1.1 lukem *)
1977 1.1 lukem # Unknown arguments in both finalize_command and compile_command need
1978 1.1 lukem # to be aesthetically quoted because they are evaled later.
1979 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1980 1.1 lukem case $arg in
1981 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1982 1.1 lukem arg="\"$arg\""
1983 1.1 lukem ;;
1984 1.1 lukem esac
1985 1.1 lukem ;;
1986 1.1 lukem esac # arg
1987 1.1 lukem
1988 1.1 lukem # Now actually substitute the argument into the commands.
1989 1.1 lukem if test -n "$arg"; then
1990 1.1 lukem compile_command="$compile_command $arg"
1991 1.1 lukem finalize_command="$finalize_command $arg"
1992 1.1 lukem fi
1993 1.1 lukem done # argument parsing loop
1994 1.1 lukem
1995 1.1 lukem if test -n "$prev"; then
1996 1.1 lukem $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1997 1.1 lukem $echo "$help" 1>&2
1998 1.1 lukem exit $EXIT_FAILURE
1999 1.1 lukem fi
2000 1.1 lukem
2001 1.1 lukem if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2002 1.1 lukem eval arg=\"$export_dynamic_flag_spec\"
2003 1.1 lukem compile_command="$compile_command $arg"
2004 1.1 lukem finalize_command="$finalize_command $arg"
2005 1.1 lukem fi
2006 1.1 lukem
2007 1.1 lukem oldlibs=
2008 1.1 lukem # calculate the name of the file, without its directory
2009 1.1 lukem outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2010 1.1 lukem libobjs_save="$libobjs"
2011 1.1 lukem
2012 1.1 lukem if test -n "$shlibpath_var"; then
2013 1.1 lukem # get the directories listed in $shlibpath_var
2014 1.1 lukem eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2015 1.1 lukem else
2016 1.1 lukem shlib_search_path=
2017 1.1 lukem fi
2018 1.1 lukem eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2019 1.1 lukem eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2020 1.1 lukem
2021 1.1 lukem output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2022 1.1 lukem if test "X$output_objdir" = "X$output"; then
2023 1.1 lukem output_objdir="$objdir"
2024 1.1 lukem else
2025 1.1 lukem output_objdir="$output_objdir/$objdir"
2026 1.1 lukem fi
2027 1.1 lukem # Create the object directory.
2028 1.1 lukem if test ! -d "$output_objdir"; then
2029 1.1 lukem $show "$mkdir $output_objdir"
2030 1.1 lukem $run $mkdir $output_objdir
2031 1.1 lukem exit_status=$?
2032 1.1 lukem if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2033 1.1 lukem exit $exit_status
2034 1.1 lukem fi
2035 1.1 lukem fi
2036 1.1 lukem
2037 1.1 lukem # Determine the type of output
2038 1.1 lukem case $output in
2039 1.1 lukem "")
2040 1.1 lukem $echo "$modename: you must specify an output file" 1>&2
2041 1.1 lukem $echo "$help" 1>&2
2042 1.1 lukem exit $EXIT_FAILURE
2043 1.1 lukem ;;
2044 1.1 lukem *.$libext) linkmode=oldlib ;;
2045 1.1 lukem *.lo | *.$objext) linkmode=obj ;;
2046 1.1 lukem *.la) linkmode=lib ;;
2047 1.1 lukem *) linkmode=prog ;; # Anything else should be a program.
2048 1.1 lukem esac
2049 1.1 lukem
2050 1.1 lukem case $host in
2051 1.1 lukem *cygwin* | *mingw* | *pw32*)
2052 1.1 lukem # don't eliminate duplications in $postdeps and $predeps
2053 1.1 lukem duplicate_compiler_generated_deps=yes
2054 1.1 lukem ;;
2055 1.1 lukem *)
2056 1.1 lukem duplicate_compiler_generated_deps=$duplicate_deps
2057 1.1 lukem ;;
2058 1.1 lukem esac
2059 1.1 lukem specialdeplibs=
2060 1.1 lukem
2061 1.1 lukem libs=
2062 1.1 lukem # Find all interdependent deplibs by searching for libraries
2063 1.1 lukem # that are linked more than once (e.g. -la -lb -la)
2064 1.1 lukem for deplib in $deplibs; do
2065 1.1 lukem if test "X$duplicate_deps" = "Xyes" ; then
2066 1.1 lukem case "$libs " in
2067 1.1 lukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2068 1.1 lukem esac
2069 1.1 lukem fi
2070 1.1 lukem libs="$libs $deplib"
2071 1.1 lukem done
2072 1.1 lukem
2073 1.1 lukem if test "$linkmode" = lib; then
2074 1.1 lukem libs="$predeps $libs $compiler_lib_search_path $postdeps"
2075 1.1 lukem
2076 1.1 lukem # Compute libraries that are listed more than once in $predeps
2077 1.1 lukem # $postdeps and mark them as special (i.e., whose duplicates are
2078 1.1 lukem # not to be eliminated).
2079 1.1 lukem pre_post_deps=
2080 1.1 lukem if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2081 1.1 lukem for pre_post_dep in $predeps $postdeps; do
2082 1.1 lukem case "$pre_post_deps " in
2083 1.1 lukem *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2084 1.1 lukem esac
2085 1.1 lukem pre_post_deps="$pre_post_deps $pre_post_dep"
2086 1.1 lukem done
2087 1.1 lukem fi
2088 1.1 lukem pre_post_deps=
2089 1.1 lukem fi
2090 1.1 lukem
2091 1.1 lukem deplibs=
2092 1.1 lukem newdependency_libs=
2093 1.1 lukem newlib_search_path=
2094 1.1 lukem need_relink=no # whether we're linking any uninstalled libtool libraries
2095 1.1 lukem notinst_deplibs= # not-installed libtool libraries
2096 1.1 lukem case $linkmode in
2097 1.1 lukem lib)
2098 1.1 lukem passes="conv link"
2099 1.1 lukem for file in $dlfiles $dlprefiles; do
2100 1.1 lukem case $file in
2101 1.1 lukem *.la) ;;
2102 1.1 lukem *)
2103 1.1 lukem $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2104 1.1 lukem exit $EXIT_FAILURE
2105 1.1 lukem ;;
2106 1.1 lukem esac
2107 1.1 lukem done
2108 1.1 lukem ;;
2109 1.1 lukem prog)
2110 1.1 lukem compile_deplibs=
2111 1.1 lukem finalize_deplibs=
2112 1.1 lukem alldeplibs=no
2113 1.1 lukem newdlfiles=
2114 1.1 lukem newdlprefiles=
2115 1.1 lukem passes="conv scan dlopen dlpreopen link"
2116 1.1 lukem ;;
2117 1.1 lukem *) passes="conv"
2118 1.1 lukem ;;
2119 1.1 lukem esac
2120 1.1 lukem for pass in $passes; do
2121 1.1 lukem if test "$linkmode,$pass" = "lib,link" ||
2122 1.1 lukem test "$linkmode,$pass" = "prog,scan"; then
2123 1.1 lukem libs="$deplibs"
2124 1.1 lukem deplibs=
2125 1.1 lukem fi
2126 1.1 lukem if test "$linkmode" = prog; then
2127 1.1 lukem case $pass in
2128 1.1 lukem dlopen) libs="$dlfiles" ;;
2129 1.1 lukem dlpreopen) libs="$dlprefiles" ;;
2130 1.1 lukem link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2131 1.1 lukem esac
2132 1.1 lukem fi
2133 1.1 lukem if test "$pass" = dlopen; then
2134 1.1 lukem # Collect dlpreopened libraries
2135 1.1 lukem save_deplibs="$deplibs"
2136 1.1 lukem deplibs=
2137 1.1 lukem fi
2138 1.1 lukem for deplib in $libs; do
2139 1.1 lukem lib=
2140 1.1 lukem found=no
2141 1.1 lukem case $deplib in
2142 1.1 lukem -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2143 1.1 lukem if test "$linkmode,$pass" = "prog,link"; then
2144 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2145 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2146 1.1 lukem else
2147 1.1 lukem compiler_flags="$compiler_flags $deplib"
2148 1.1 lukem fi
2149 1.1 lukem
2150 1.1 lukem case $linkmode in
2151 1.1 lukem lib)
2152 1.1 lukem deplibs="$deplib $deplibs"
2153 1.1 lukem test "$pass" = conv && continue
2154 1.1 lukem newdependency_libs="$deplib $newdependency_libs"
2155 1.1 lukem ;;
2156 1.1 lukem prog)
2157 1.1 lukem if test "$pass" = conv; then
2158 1.1 lukem deplibs="$deplib $deplibs"
2159 1.1 lukem continue
2160 1.1 lukem fi
2161 1.1 lukem if test "$pass" = scan; then
2162 1.1 lukem deplibs="$deplib $deplibs"
2163 1.1 lukem else
2164 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2165 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2166 1.1 lukem fi
2167 1.1 lukem ;;
2168 1.1 lukem *)
2169 1.1 lukem ;;
2170 1.1 lukem esac # linkmode
2171 1.1 lukem
2172 1.1 lukem continue
2173 1.1 lukem ;;
2174 1.1 lukem -l*)
2175 1.1 lukem if test "$linkmode" != lib && test "$linkmode" != prog; then
2176 1.1 lukem $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2177 1.1 lukem continue
2178 1.1 lukem fi
2179 1.1 lukem name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2180 1.1 lukem for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2181 1.1 lukem for search_ext in .la $std_shrext .so .a; do
2182 1.1 lukem # Search the libtool library
2183 1.1 lukem lib="$searchdir/lib${name}${search_ext}"
2184 1.1 lukem if test -f "$lib"; then
2185 1.1 lukem if test "$search_ext" = ".la"; then
2186 1.1 lukem found=yes
2187 1.1 lukem else
2188 1.1 lukem found=no
2189 1.1 lukem fi
2190 1.1 lukem break 2
2191 1.1 lukem fi
2192 1.1 lukem done
2193 1.1 lukem done
2194 1.1 lukem if test "$found" != yes; then
2195 1.1 lukem # deplib doesn't seem to be a libtool library
2196 1.1 lukem if test "$linkmode,$pass" = "prog,link"; then
2197 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2198 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2199 1.1 lukem else
2200 1.1 lukem deplibs="$deplib $deplibs"
2201 1.1 lukem test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2202 1.1 lukem fi
2203 1.1 lukem continue
2204 1.1 lukem else # deplib is a libtool library
2205 1.1 lukem # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2206 1.1 lukem # We need to do some special things here, and not later.
2207 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2208 1.1 lukem case " $predeps $postdeps " in
2209 1.1 lukem *" $deplib "*)
2210 1.1 lukem if (${SED} -e '2q' $lib |
2211 1.1 lukem grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2212 1.1 lukem library_names=
2213 1.1 lukem old_library=
2214 1.1 lukem case $lib in
2215 1.1 lukem */* | *\\*) . $lib ;;
2216 1.1 lukem *) . ./$lib ;;
2217 1.1 lukem esac
2218 1.1 lukem for l in $old_library $library_names; do
2219 1.1 lukem ll="$l"
2220 1.1 lukem done
2221 1.1 lukem if test "X$ll" = "X$old_library" ; then # only static version available
2222 1.1 lukem found=no
2223 1.1 lukem ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2224 1.1 lukem test "X$ladir" = "X$lib" && ladir="."
2225 1.1 lukem lib=$ladir/$old_library
2226 1.1 lukem if test "$linkmode,$pass" = "prog,link"; then
2227 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2228 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2229 1.1 lukem else
2230 1.1 lukem deplibs="$deplib $deplibs"
2231 1.1 lukem test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2232 1.1 lukem fi
2233 1.1 lukem continue
2234 1.1 lukem fi
2235 1.1 lukem fi
2236 1.1 lukem ;;
2237 1.1 lukem *) ;;
2238 1.1 lukem esac
2239 1.1 lukem fi
2240 1.1 lukem fi
2241 1.1 lukem ;; # -l
2242 1.1 lukem -L*)
2243 1.1 lukem case $linkmode in
2244 1.1 lukem lib)
2245 1.1 lukem deplibs="$deplib $deplibs"
2246 1.1 lukem test "$pass" = conv && continue
2247 1.1 lukem newdependency_libs="$deplib $newdependency_libs"
2248 1.1 lukem newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2249 1.1 lukem ;;
2250 1.1 lukem prog)
2251 1.1 lukem if test "$pass" = conv; then
2252 1.1 lukem deplibs="$deplib $deplibs"
2253 1.1 lukem continue
2254 1.1 lukem fi
2255 1.1 lukem if test "$pass" = scan; then
2256 1.1 lukem deplibs="$deplib $deplibs"
2257 1.1 lukem else
2258 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2259 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2260 1.1 lukem fi
2261 1.1 lukem newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2262 1.1 lukem ;;
2263 1.1 lukem *)
2264 1.1 lukem $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2265 1.1 lukem ;;
2266 1.1 lukem esac # linkmode
2267 1.1 lukem continue
2268 1.1 lukem ;; # -L
2269 1.1 lukem -R*)
2270 1.1 lukem if test "$pass" = link; then
2271 1.1 lukem dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2272 1.1 lukem # Make sure the xrpath contains only unique directories.
2273 1.1 lukem case "$xrpath " in
2274 1.1 lukem *" $dir "*) ;;
2275 1.1 lukem *) xrpath="$xrpath $dir" ;;
2276 1.1 lukem esac
2277 1.1 lukem fi
2278 1.1 lukem deplibs="$deplib $deplibs"
2279 1.1 lukem continue
2280 1.1 lukem ;;
2281 1.1 lukem *.la) lib="$deplib" ;;
2282 1.1 lukem *.$libext)
2283 1.1 lukem if test "$pass" = conv; then
2284 1.1 lukem deplibs="$deplib $deplibs"
2285 1.1 lukem continue
2286 1.1 lukem fi
2287 1.1 lukem case $linkmode in
2288 1.1 lukem lib)
2289 1.1 lukem valid_a_lib=no
2290 1.1 lukem case $deplibs_check_method in
2291 1.1 lukem match_pattern*)
2292 1.1 lukem set dummy $deplibs_check_method
2293 1.1 lukem match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2294 1.1 lukem if eval $echo \"$deplib\" 2>/dev/null \
2295 1.1 lukem | $SED 10q \
2296 1.1 lukem | $EGREP "$match_pattern_regex" > /dev/null; then
2297 1.1 lukem valid_a_lib=yes
2298 1.1 lukem fi
2299 1.1 lukem ;;
2300 1.1 lukem pass_all)
2301 1.1 lukem valid_a_lib=yes
2302 1.1 lukem ;;
2303 1.1 lukem esac
2304 1.1 lukem if test "$valid_a_lib" != yes; then
2305 1.1 lukem $echo
2306 1.1 lukem $echo "*** Warning: Trying to link with static lib archive $deplib."
2307 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
2308 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
2309 1.1 lukem $echo "*** shared version of the library, which you do not appear to have"
2310 1.1 lukem $echo "*** because the file extensions .$libext of this argument makes me believe"
2311 1.1 lukem $echo "*** that it is just a static archive that I should not used here."
2312 1.1 lukem else
2313 1.1 lukem $echo
2314 1.1 lukem $echo "*** Warning: Linking the shared library $output against the"
2315 1.1 lukem $echo "*** static library $deplib is not portable!"
2316 1.1 lukem deplibs="$deplib $deplibs"
2317 1.1 lukem fi
2318 1.1 lukem continue
2319 1.1 lukem ;;
2320 1.1 lukem prog)
2321 1.1 lukem if test "$pass" != link; then
2322 1.1 lukem deplibs="$deplib $deplibs"
2323 1.1 lukem else
2324 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2325 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2326 1.1 lukem fi
2327 1.1 lukem continue
2328 1.1 lukem ;;
2329 1.1 lukem esac # linkmode
2330 1.1 lukem ;; # *.$libext
2331 1.1 lukem *.lo | *.$objext)
2332 1.1 lukem if test "$pass" = conv; then
2333 1.1 lukem deplibs="$deplib $deplibs"
2334 1.1 lukem elif test "$linkmode" = prog; then
2335 1.1 lukem if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2336 1.1 lukem # If there is no dlopen support or we're linking statically,
2337 1.1 lukem # we need to preload.
2338 1.1 lukem newdlprefiles="$newdlprefiles $deplib"
2339 1.1 lukem compile_deplibs="$deplib $compile_deplibs"
2340 1.1 lukem finalize_deplibs="$deplib $finalize_deplibs"
2341 1.1 lukem else
2342 1.1 lukem newdlfiles="$newdlfiles $deplib"
2343 1.1 lukem fi
2344 1.1 lukem fi
2345 1.1 lukem continue
2346 1.1 lukem ;;
2347 1.1 lukem %DEPLIBS%)
2348 1.1 lukem alldeplibs=yes
2349 1.1 lukem continue
2350 1.1 lukem ;;
2351 1.1 lukem esac # case $deplib
2352 1.1 lukem if test "$found" = yes || test -f "$lib"; then :
2353 1.1 lukem else
2354 1.1 lukem $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2355 1.1 lukem exit $EXIT_FAILURE
2356 1.1 lukem fi
2357 1.1 lukem
2358 1.1 lukem # Check to see that this really is a libtool archive.
2359 1.1 lukem if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2360 1.1 lukem else
2361 1.1 lukem $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2362 1.1 lukem exit $EXIT_FAILURE
2363 1.1 lukem fi
2364 1.1 lukem
2365 1.1 lukem ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2366 1.1 lukem test "X$ladir" = "X$lib" && ladir="."
2367 1.1 lukem
2368 1.1 lukem dlname=
2369 1.1 lukem dlopen=
2370 1.1 lukem dlpreopen=
2371 1.1 lukem libdir=
2372 1.1 lukem library_names=
2373 1.1 lukem old_library=
2374 1.1 lukem # If the library was installed with an old release of libtool,
2375 1.1 lukem # it will not redefine variables installed, or shouldnotlink
2376 1.1 lukem installed=yes
2377 1.1 lukem shouldnotlink=no
2378 1.1 lukem avoidtemprpath=
2379 1.1 lukem
2380 1.1 lukem
2381 1.1 lukem # Read the .la file
2382 1.1 lukem case $lib in
2383 1.1 lukem */* | *\\*) . $lib ;;
2384 1.1 lukem *) . ./$lib ;;
2385 1.1 lukem esac
2386 1.1 lukem
2387 1.1 lukem if test "$linkmode,$pass" = "lib,link" ||
2388 1.1 lukem test "$linkmode,$pass" = "prog,scan" ||
2389 1.1 lukem { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2390 1.1 lukem test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2391 1.1 lukem test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2392 1.1 lukem fi
2393 1.1 lukem
2394 1.1 lukem if test "$pass" = conv; then
2395 1.1 lukem # Only check for convenience libraries
2396 1.1 lukem deplibs="$lib $deplibs"
2397 1.1 lukem if test -z "$libdir"; then
2398 1.1 lukem if test -z "$old_library"; then
2399 1.1 lukem $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2400 1.1 lukem exit $EXIT_FAILURE
2401 1.1 lukem fi
2402 1.1 lukem # It is a libtool convenience library, so add in its objects.
2403 1.1 lukem convenience="$convenience $ladir/$objdir/$old_library"
2404 1.1 lukem old_convenience="$old_convenience $ladir/$objdir/$old_library"
2405 1.1 lukem tmp_libs=
2406 1.1 lukem for deplib in $dependency_libs; do
2407 1.1 lukem deplibs="$deplib $deplibs"
2408 1.1 lukem if test "X$duplicate_deps" = "Xyes" ; then
2409 1.1 lukem case "$tmp_libs " in
2410 1.1 lukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2411 1.1 lukem esac
2412 1.1 lukem fi
2413 1.1 lukem tmp_libs="$tmp_libs $deplib"
2414 1.1 lukem done
2415 1.1 lukem elif test "$linkmode" != prog && test "$linkmode" != lib; then
2416 1.1 lukem $echo "$modename: \`$lib' is not a convenience library" 1>&2
2417 1.1 lukem exit $EXIT_FAILURE
2418 1.1 lukem fi
2419 1.1 lukem continue
2420 1.1 lukem fi # $pass = conv
2421 1.1 lukem
2422 1.1 lukem
2423 1.1 lukem # Get the name of the library we link against.
2424 1.1 lukem linklib=
2425 1.1 lukem for l in $old_library $library_names; do
2426 1.1 lukem linklib="$l"
2427 1.1 lukem done
2428 1.1 lukem if test -z "$linklib"; then
2429 1.1 lukem $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2430 1.1 lukem exit $EXIT_FAILURE
2431 1.1 lukem fi
2432 1.1 lukem
2433 1.1 lukem # This library was specified with -dlopen.
2434 1.1 lukem if test "$pass" = dlopen; then
2435 1.1 lukem if test -z "$libdir"; then
2436 1.1 lukem $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2437 1.1 lukem exit $EXIT_FAILURE
2438 1.1 lukem fi
2439 1.1 lukem if test -z "$dlname" ||
2440 1.1 lukem test "$dlopen_support" != yes ||
2441 1.1 lukem test "$build_libtool_libs" = no; then
2442 1.1 lukem # If there is no dlname, no dlopen support or we're linking
2443 1.1 lukem # statically, we need to preload. We also need to preload any
2444 1.1 lukem # dependent libraries so libltdl's deplib preloader doesn't
2445 1.1 lukem # bomb out in the load deplibs phase.
2446 1.1 lukem dlprefiles="$dlprefiles $lib $dependency_libs"
2447 1.1 lukem else
2448 1.1 lukem newdlfiles="$newdlfiles $lib"
2449 1.1 lukem fi
2450 1.1 lukem continue
2451 1.1 lukem fi # $pass = dlopen
2452 1.1 lukem
2453 1.1 lukem # We need an absolute path.
2454 1.1 lukem case $ladir in
2455 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2456 1.1 lukem *)
2457 1.1 lukem abs_ladir=`cd "$ladir" && pwd`
2458 1.1 lukem if test -z "$abs_ladir"; then
2459 1.1 lukem $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2460 1.1 lukem $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2461 1.1 lukem abs_ladir="$ladir"
2462 1.1 lukem fi
2463 1.1 lukem ;;
2464 1.1 lukem esac
2465 1.1 lukem laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2466 1.1 lukem
2467 1.1 lukem # Find the relevant object directory and library name.
2468 1.1 lukem if test "X$installed" = Xyes; then
2469 1.1 lukem if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2470 1.1 lukem $echo "$modename: warning: library \`$lib' was moved." 1>&2
2471 1.1 lukem dir="$ladir"
2472 1.1 lukem absdir="$abs_ladir"
2473 1.1 lukem libdir="$abs_ladir"
2474 1.1 lukem else
2475 1.1 lukem dir="$libdir"
2476 1.1 lukem absdir="$libdir"
2477 1.1 lukem fi
2478 1.1 lukem test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2479 1.1 lukem else
2480 1.1 lukem if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2481 1.1 lukem dir="$ladir"
2482 1.1 lukem absdir="$abs_ladir"
2483 1.1 lukem # Remove this search path later
2484 1.1 lukem notinst_path="$notinst_path $abs_ladir"
2485 1.1 lukem else
2486 1.1 lukem dir="$ladir/$objdir"
2487 1.1 lukem absdir="$abs_ladir/$objdir"
2488 1.1 lukem # Remove this search path later
2489 1.1 lukem notinst_path="$notinst_path $abs_ladir"
2490 1.1 lukem fi
2491 1.1 lukem fi # $installed = yes
2492 1.1 lukem name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2493 1.1 lukem
2494 1.1 lukem # This library was specified with -dlpreopen.
2495 1.1 lukem if test "$pass" = dlpreopen; then
2496 1.1 lukem if test -z "$libdir"; then
2497 1.1 lukem $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2498 1.1 lukem exit $EXIT_FAILURE
2499 1.1 lukem fi
2500 1.1 lukem # Prefer using a static library (so that no silly _DYNAMIC symbols
2501 1.1 lukem # are required to link).
2502 1.1 lukem if test -n "$old_library"; then
2503 1.1 lukem newdlprefiles="$newdlprefiles $dir/$old_library"
2504 1.1 lukem # Otherwise, use the dlname, so that lt_dlopen finds it.
2505 1.1 lukem elif test -n "$dlname"; then
2506 1.1 lukem newdlprefiles="$newdlprefiles $dir/$dlname"
2507 1.1 lukem else
2508 1.1 lukem newdlprefiles="$newdlprefiles $dir/$linklib"
2509 1.1 lukem fi
2510 1.1 lukem fi # $pass = dlpreopen
2511 1.1 lukem
2512 1.1 lukem if test -z "$libdir"; then
2513 1.1 lukem # Link the convenience library
2514 1.1 lukem if test "$linkmode" = lib; then
2515 1.1 lukem deplibs="$dir/$old_library $deplibs"
2516 1.1 lukem elif test "$linkmode,$pass" = "prog,link"; then
2517 1.1 lukem compile_deplibs="$dir/$old_library $compile_deplibs"
2518 1.1 lukem finalize_deplibs="$dir/$old_library $finalize_deplibs"
2519 1.1 lukem else
2520 1.1 lukem deplibs="$lib $deplibs" # used for prog,scan pass
2521 1.1 lukem fi
2522 1.1 lukem continue
2523 1.1 lukem fi
2524 1.1 lukem
2525 1.1 lukem
2526 1.1 lukem if test "$linkmode" = prog && test "$pass" != link; then
2527 1.1 lukem newlib_search_path="$newlib_search_path $ladir"
2528 1.1 lukem deplibs="$lib $deplibs"
2529 1.1 lukem
2530 1.1 lukem linkalldeplibs=no
2531 1.1 lukem if test "$link_all_deplibs" != no || test -z "$library_names" ||
2532 1.1 lukem test "$build_libtool_libs" = no; then
2533 1.1 lukem linkalldeplibs=yes
2534 1.1 lukem fi
2535 1.1 lukem
2536 1.1 lukem tmp_libs=
2537 1.1 lukem for deplib in $dependency_libs; do
2538 1.1 lukem case $deplib in
2539 1.1 lukem -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2540 1.1 lukem esac
2541 1.1 lukem # Need to link against all dependency_libs?
2542 1.1 lukem if test "$linkalldeplibs" = yes; then
2543 1.1 lukem deplibs="$deplib $deplibs"
2544 1.1 lukem else
2545 1.1 lukem # Need to hardcode shared library paths
2546 1.1 lukem # or/and link against static libraries
2547 1.1 lukem newdependency_libs="$deplib $newdependency_libs"
2548 1.1 lukem fi
2549 1.1 lukem if test "X$duplicate_deps" = "Xyes" ; then
2550 1.1 lukem case "$tmp_libs " in
2551 1.1 lukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2552 1.1 lukem esac
2553 1.1 lukem fi
2554 1.1 lukem tmp_libs="$tmp_libs $deplib"
2555 1.1 lukem done # for deplib
2556 1.1 lukem continue
2557 1.1 lukem fi # $linkmode = prog...
2558 1.1 lukem
2559 1.1 lukem if test "$linkmode,$pass" = "prog,link"; then
2560 1.1 lukem if test -n "$library_names" &&
2561 1.1 lukem { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2562 1.1 lukem # We need to hardcode the library path
2563 1.1 lukem if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2564 1.1 lukem # Make sure the rpath contains only unique directories.
2565 1.1 lukem case "$temp_rpath " in
2566 1.1 lukem *" $dir "*) ;;
2567 1.1 lukem *" $absdir "*) ;;
2568 1.1 lukem *) temp_rpath="$temp_rpath $absdir" ;;
2569 1.1 lukem esac
2570 1.1 lukem fi
2571 1.1 lukem
2572 1.1 lukem # Hardcode the library path.
2573 1.1 lukem # Skip directories that are in the system default run-time
2574 1.1 lukem # search path.
2575 1.1 lukem case " $sys_lib_dlsearch_path " in
2576 1.1 lukem *" $absdir "*) ;;
2577 1.1 lukem *)
2578 1.1 lukem case "$compile_rpath " in
2579 1.1 lukem *" $absdir "*) ;;
2580 1.1 lukem *) compile_rpath="$compile_rpath $absdir"
2581 1.1 lukem esac
2582 1.1 lukem ;;
2583 1.1 lukem esac
2584 1.1 lukem case " $sys_lib_dlsearch_path " in
2585 1.1 lukem *" $libdir "*) ;;
2586 1.1 lukem *)
2587 1.1 lukem case "$finalize_rpath " in
2588 1.1 lukem *" $libdir "*) ;;
2589 1.1 lukem *) finalize_rpath="$finalize_rpath $libdir"
2590 1.1 lukem esac
2591 1.1 lukem ;;
2592 1.1 lukem esac
2593 1.1 lukem fi # $linkmode,$pass = prog,link...
2594 1.1 lukem
2595 1.1 lukem if test "$alldeplibs" = yes &&
2596 1.1 lukem { test "$deplibs_check_method" = pass_all ||
2597 1.1 lukem { test "$build_libtool_libs" = yes &&
2598 1.1 lukem test -n "$library_names"; }; }; then
2599 1.1 lukem # We only need to search for static libraries
2600 1.1 lukem continue
2601 1.1 lukem fi
2602 1.1 lukem fi
2603 1.1 lukem
2604 1.1 lukem link_static=no # Whether the deplib will be linked statically
2605 1.1 lukem use_static_libs=$prefer_static_libs
2606 1.1 lukem if test "$use_static_libs" = built && test "$installed" = yes ; then
2607 1.1 lukem use_static_libs=no
2608 1.1 lukem fi
2609 1.1 lukem if test -n "$library_names" &&
2610 1.1 lukem { test "$use_static_libs" = no || test -z "$old_library"; }; then
2611 1.1 lukem if test "$installed" = no; then
2612 1.1 lukem notinst_deplibs="$notinst_deplibs $lib"
2613 1.1 lukem need_relink=yes
2614 1.1 lukem fi
2615 1.1 lukem # This is a shared library
2616 1.1 lukem
2617 1.1 lukem # Warn about portability, can't link against -module's on
2618 1.1 lukem # some systems (darwin)
2619 1.1 lukem if test "$shouldnotlink" = yes && test "$pass" = link ; then
2620 1.1 lukem $echo
2621 1.1 lukem if test "$linkmode" = prog; then
2622 1.1 lukem $echo "*** Warning: Linking the executable $output against the loadable module"
2623 1.1 lukem else
2624 1.1 lukem $echo "*** Warning: Linking the shared library $output against the loadable module"
2625 1.1 lukem fi
2626 1.1 lukem $echo "*** $linklib is not portable!"
2627 1.1 lukem fi
2628 1.1 lukem if test "$linkmode" = lib &&
2629 1.1 lukem test "$hardcode_into_libs" = yes; then
2630 1.1 lukem # Hardcode the library path.
2631 1.1 lukem # Skip directories that are in the system default run-time
2632 1.1 lukem # search path.
2633 1.1 lukem case " $sys_lib_dlsearch_path " in
2634 1.1 lukem *" $absdir "*) ;;
2635 1.1 lukem *)
2636 1.1 lukem case "$compile_rpath " in
2637 1.1 lukem *" $absdir "*) ;;
2638 1.1 lukem *) compile_rpath="$compile_rpath $absdir"
2639 1.1 lukem esac
2640 1.1 lukem ;;
2641 1.1 lukem esac
2642 1.1 lukem case " $sys_lib_dlsearch_path " in
2643 1.1 lukem *" $libdir "*) ;;
2644 1.1 lukem *)
2645 1.1 lukem case "$finalize_rpath " in
2646 1.1 lukem *" $libdir "*) ;;
2647 1.1 lukem *) finalize_rpath="$finalize_rpath $libdir"
2648 1.1 lukem esac
2649 1.1 lukem ;;
2650 1.1 lukem esac
2651 1.1 lukem fi
2652 1.1 lukem
2653 1.1 lukem if test -n "$old_archive_from_expsyms_cmds"; then
2654 1.1 lukem # figure out the soname
2655 1.1 lukem set dummy $library_names
2656 1.1 lukem realname="$2"
2657 1.1 lukem shift; shift
2658 1.1 lukem libname=`eval \\$echo \"$libname_spec\"`
2659 1.1 lukem # use dlname if we got it. it's perfectly good, no?
2660 1.1 lukem if test -n "$dlname"; then
2661 1.1 lukem soname="$dlname"
2662 1.1 lukem elif test -n "$soname_spec"; then
2663 1.1 lukem # bleh windows
2664 1.1 lukem case $host in
2665 1.1 lukem *cygwin* | mingw*)
2666 1.1 lukem major=`expr $current - $age`
2667 1.1 lukem versuffix="-$major"
2668 1.1 lukem ;;
2669 1.1 lukem esac
2670 1.1 lukem eval soname=\"$soname_spec\"
2671 1.1 lukem else
2672 1.1 lukem soname="$realname"
2673 1.1 lukem fi
2674 1.1 lukem
2675 1.1 lukem # Make a new name for the extract_expsyms_cmds to use
2676 1.1 lukem soroot="$soname"
2677 1.1 lukem soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2678 1.1 lukem newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2679 1.1 lukem
2680 1.1 lukem # If the library has no export list, then create one now
2681 1.1 lukem if test -f "$output_objdir/$soname-def"; then :
2682 1.1 lukem else
2683 1.1 lukem $show "extracting exported symbol list from \`$soname'"
2684 1.1 lukem save_ifs="$IFS"; IFS='~'
2685 1.1 lukem cmds=$extract_expsyms_cmds
2686 1.1 lukem for cmd in $cmds; do
2687 1.1 lukem IFS="$save_ifs"
2688 1.1 lukem eval cmd=\"$cmd\"
2689 1.1 lukem $show "$cmd"
2690 1.1 lukem $run eval "$cmd" || exit $?
2691 1.1 lukem done
2692 1.1 lukem IFS="$save_ifs"
2693 1.1 lukem fi
2694 1.1 lukem
2695 1.1 lukem # Create $newlib
2696 1.1 lukem if test -f "$output_objdir/$newlib"; then :; else
2697 1.1 lukem $show "generating import library for \`$soname'"
2698 1.1 lukem save_ifs="$IFS"; IFS='~'
2699 1.1 lukem cmds=$old_archive_from_expsyms_cmds
2700 1.1 lukem for cmd in $cmds; do
2701 1.1 lukem IFS="$save_ifs"
2702 1.1 lukem eval cmd=\"$cmd\"
2703 1.1 lukem $show "$cmd"
2704 1.1 lukem $run eval "$cmd" || exit $?
2705 1.1 lukem done
2706 1.1 lukem IFS="$save_ifs"
2707 1.1 lukem fi
2708 1.1 lukem # make sure the library variables are pointing to the new library
2709 1.1 lukem dir=$output_objdir
2710 1.1 lukem linklib=$newlib
2711 1.1 lukem fi # test -n "$old_archive_from_expsyms_cmds"
2712 1.1 lukem
2713 1.1 lukem if test "$linkmode" = prog || test "$mode" != relink; then
2714 1.1 lukem add_shlibpath=
2715 1.1 lukem add_dir=
2716 1.1 lukem add=
2717 1.1 lukem lib_linked=yes
2718 1.1 lukem case $hardcode_action in
2719 1.1 lukem immediate | unsupported)
2720 1.1 lukem if test "$hardcode_direct" = no; then
2721 1.1 lukem add="$dir/$linklib"
2722 1.1 lukem case $host in
2723 1.1 lukem *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2724 1.1 lukem *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2725 1.1 lukem *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2726 1.1 lukem *-*-unixware7*) add_dir="-L$dir" ;;
2727 1.1 lukem *-*-darwin* )
2728 1.1 lukem # if the lib is a module then we can not link against
2729 1.1 lukem # it, someone is ignoring the new warnings I added
2730 1.1 lukem if /usr/bin/file -L $add 2> /dev/null |
2731 1.1 lukem $EGREP ": [^:]* bundle" >/dev/null ; then
2732 1.1 lukem $echo "** Warning, lib $linklib is a module, not a shared library"
2733 1.1 lukem if test -z "$old_library" ; then
2734 1.1 lukem $echo
2735 1.1 lukem $echo "** And there doesn't seem to be a static archive available"
2736 1.1 lukem $echo "** The link will probably fail, sorry"
2737 1.1 lukem else
2738 1.1 lukem add="$dir/$old_library"
2739 1.1 lukem fi
2740 1.1 lukem fi
2741 1.1 lukem esac
2742 1.1 lukem elif test "$hardcode_minus_L" = no; then
2743 1.1 lukem case $host in
2744 1.1 lukem *-*-sunos*) add_shlibpath="$dir" ;;
2745 1.1 lukem esac
2746 1.1 lukem add_dir="-L$dir"
2747 1.1 lukem add="-l$name"
2748 1.1 lukem elif test "$hardcode_shlibpath_var" = no; then
2749 1.1 lukem add_shlibpath="$dir"
2750 1.1 lukem add="-l$name"
2751 1.1 lukem else
2752 1.1 lukem lib_linked=no
2753 1.1 lukem fi
2754 1.1 lukem ;;
2755 1.1 lukem relink)
2756 1.1 lukem if test "$hardcode_direct" = yes; then
2757 1.1 lukem add="$dir/$linklib"
2758 1.1 lukem elif test "$hardcode_minus_L" = yes; then
2759 1.1 lukem add_dir="-L$dir"
2760 1.1 lukem # Try looking first in the location we're being installed to.
2761 1.1 lukem if test -n "$inst_prefix_dir"; then
2762 1.1 lukem case $libdir in
2763 1.1 lukem [\\/]*)
2764 1.1 lukem add_dir="$add_dir -L$inst_prefix_dir$libdir"
2765 1.1 lukem ;;
2766 1.1 lukem esac
2767 1.1 lukem fi
2768 1.1 lukem add="-l$name"
2769 1.1 lukem elif test "$hardcode_shlibpath_var" = yes; then
2770 1.1 lukem add_shlibpath="$dir"
2771 1.1 lukem add="-l$name"
2772 1.1 lukem else
2773 1.1 lukem lib_linked=no
2774 1.1 lukem fi
2775 1.1 lukem ;;
2776 1.1 lukem *) lib_linked=no ;;
2777 1.1 lukem esac
2778 1.1 lukem
2779 1.1 lukem if test "$lib_linked" != yes; then
2780 1.1 lukem $echo "$modename: configuration error: unsupported hardcode properties"
2781 1.1 lukem exit $EXIT_FAILURE
2782 1.1 lukem fi
2783 1.1 lukem
2784 1.1 lukem if test -n "$add_shlibpath"; then
2785 1.1 lukem case :$compile_shlibpath: in
2786 1.1 lukem *":$add_shlibpath:"*) ;;
2787 1.1 lukem *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2788 1.1 lukem esac
2789 1.1 lukem fi
2790 1.1 lukem if test "$linkmode" = prog; then
2791 1.1 lukem test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2792 1.1 lukem test -n "$add" && compile_deplibs="$add $compile_deplibs"
2793 1.1 lukem else
2794 1.1 lukem test -n "$add_dir" && deplibs="$add_dir $deplibs"
2795 1.1 lukem test -n "$add" && deplibs="$add $deplibs"
2796 1.1 lukem if test "$hardcode_direct" != yes && \
2797 1.1 lukem test "$hardcode_minus_L" != yes && \
2798 1.1 lukem test "$hardcode_shlibpath_var" = yes; then
2799 1.1 lukem case :$finalize_shlibpath: in
2800 1.1 lukem *":$libdir:"*) ;;
2801 1.1 lukem *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2802 1.1 lukem esac
2803 1.1 lukem fi
2804 1.1 lukem fi
2805 1.1 lukem fi
2806 1.1 lukem
2807 1.1 lukem if test "$linkmode" = prog || test "$mode" = relink; then
2808 1.1 lukem add_shlibpath=
2809 1.1 lukem add_dir=
2810 1.1 lukem add=
2811 1.1 lukem # Finalize command for both is simple: just hardcode it.
2812 1.1 lukem if test "$hardcode_direct" = yes; then
2813 1.1 lukem add="$libdir/$linklib"
2814 1.1 lukem elif test "$hardcode_minus_L" = yes; then
2815 1.1 lukem add_dir="-L$libdir"
2816 1.1 lukem add="-l$name"
2817 1.1 lukem elif test "$hardcode_shlibpath_var" = yes; then
2818 1.1 lukem case :$finalize_shlibpath: in
2819 1.1 lukem *":$libdir:"*) ;;
2820 1.1 lukem *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2821 1.1 lukem esac
2822 1.1 lukem add="-l$name"
2823 1.1 lukem elif test "$hardcode_automatic" = yes; then
2824 1.1 lukem if test -n "$inst_prefix_dir" &&
2825 1.1 lukem test -f "$inst_prefix_dir$libdir/$linklib" ; then
2826 1.1 lukem add="$inst_prefix_dir$libdir/$linklib"
2827 1.1 lukem else
2828 1.1 lukem add="$libdir/$linklib"
2829 1.1 lukem fi
2830 1.1 lukem else
2831 1.1 lukem # We cannot seem to hardcode it, guess we'll fake it.
2832 1.1 lukem add_dir="-L$libdir"
2833 1.1 lukem # Try looking first in the location we're being installed to.
2834 1.1 lukem if test -n "$inst_prefix_dir"; then
2835 1.1 lukem case $libdir in
2836 1.1 lukem [\\/]*)
2837 1.1 lukem add_dir="$add_dir -L$inst_prefix_dir$libdir"
2838 1.1 lukem ;;
2839 1.1 lukem esac
2840 1.1 lukem fi
2841 1.1 lukem add="-l$name"
2842 1.1 lukem fi
2843 1.1 lukem
2844 1.1 lukem if test "$linkmode" = prog; then
2845 1.1 lukem test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2846 1.1 lukem test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2847 1.1 lukem else
2848 1.1 lukem test -n "$add_dir" && deplibs="$add_dir $deplibs"
2849 1.1 lukem test -n "$add" && deplibs="$add $deplibs"
2850 1.1 lukem fi
2851 1.1 lukem fi
2852 1.1 lukem elif test "$linkmode" = prog; then
2853 1.1 lukem # Here we assume that one of hardcode_direct or hardcode_minus_L
2854 1.1 lukem # is not unsupported. This is valid on all known static and
2855 1.1 lukem # shared platforms.
2856 1.1 lukem if test "$hardcode_direct" != unsupported; then
2857 1.1 lukem test -n "$old_library" && linklib="$old_library"
2858 1.1 lukem compile_deplibs="$dir/$linklib $compile_deplibs"
2859 1.1 lukem finalize_deplibs="$dir/$linklib $finalize_deplibs"
2860 1.1 lukem else
2861 1.1 lukem compile_deplibs="-l$name -L$dir $compile_deplibs"
2862 1.1 lukem finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2863 1.1 lukem fi
2864 1.1 lukem elif test "$build_libtool_libs" = yes; then
2865 1.1 lukem # Not a shared library
2866 1.1 lukem if test "$deplibs_check_method" != pass_all; then
2867 1.1 lukem # We're trying link a shared library against a static one
2868 1.1 lukem # but the system doesn't support it.
2869 1.1 lukem
2870 1.1 lukem # Just print a warning and add the library to dependency_libs so
2871 1.1 lukem # that the program can be linked against the static library.
2872 1.1 lukem $echo
2873 1.1 lukem $echo "*** Warning: This system can not link to static lib archive $lib."
2874 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
2875 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
2876 1.1 lukem $echo "*** shared version of the library, which you do not appear to have."
2877 1.1 lukem if test "$module" = yes; then
2878 1.1 lukem $echo "*** But as you try to build a module library, libtool will still create "
2879 1.1 lukem $echo "*** a static module, that should work as long as the dlopening application"
2880 1.1 lukem $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2881 1.1 lukem if test -z "$global_symbol_pipe"; then
2882 1.1 lukem $echo
2883 1.1 lukem $echo "*** However, this would only work if libtool was able to extract symbol"
2884 1.1 lukem $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2885 1.1 lukem $echo "*** not find such a program. So, this module is probably useless."
2886 1.1 lukem $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2887 1.1 lukem fi
2888 1.1 lukem if test "$build_old_libs" = no; then
2889 1.1 lukem build_libtool_libs=module
2890 1.1 lukem build_old_libs=yes
2891 1.1 lukem else
2892 1.1 lukem build_libtool_libs=no
2893 1.1 lukem fi
2894 1.1 lukem fi
2895 1.1 lukem else
2896 1.1 lukem deplibs="$dir/$old_library $deplibs"
2897 1.1 lukem link_static=yes
2898 1.1 lukem fi
2899 1.1 lukem fi # link shared/static library?
2900 1.1 lukem
2901 1.1 lukem if test "$linkmode" = lib; then
2902 1.1 lukem if test -n "$dependency_libs" &&
2903 1.1 lukem { test "$hardcode_into_libs" != yes ||
2904 1.1 lukem test "$build_old_libs" = yes ||
2905 1.1 lukem test "$link_static" = yes; }; then
2906 1.1 lukem # Extract -R from dependency_libs
2907 1.1 lukem temp_deplibs=
2908 1.1 lukem for libdir in $dependency_libs; do
2909 1.1 lukem case $libdir in
2910 1.1 lukem -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2911 1.1 lukem case " $xrpath " in
2912 1.1 lukem *" $temp_xrpath "*) ;;
2913 1.1 lukem *) xrpath="$xrpath $temp_xrpath";;
2914 1.1 lukem esac;;
2915 1.1 lukem *) temp_deplibs="$temp_deplibs $libdir";;
2916 1.1 lukem esac
2917 1.1 lukem done
2918 1.1 lukem dependency_libs="$temp_deplibs"
2919 1.1 lukem fi
2920 1.1 lukem
2921 1.1 lukem newlib_search_path="$newlib_search_path $absdir"
2922 1.1 lukem # Link against this library
2923 1.1 lukem test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2924 1.1 lukem # ... and its dependency_libs
2925 1.1 lukem tmp_libs=
2926 1.1 lukem for deplib in $dependency_libs; do
2927 1.1 lukem newdependency_libs="$deplib $newdependency_libs"
2928 1.1 lukem if test "X$duplicate_deps" = "Xyes" ; then
2929 1.1 lukem case "$tmp_libs " in
2930 1.1 lukem *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2931 1.1 lukem esac
2932 1.1 lukem fi
2933 1.1 lukem tmp_libs="$tmp_libs $deplib"
2934 1.1 lukem done
2935 1.1 lukem
2936 1.1 lukem if test "$link_all_deplibs" != no; then
2937 1.1 lukem # Add the search paths of all dependency libraries
2938 1.1 lukem for deplib in $dependency_libs; do
2939 1.1 lukem case $deplib in
2940 1.1 lukem -L*) path="$deplib" ;;
2941 1.1 lukem *.la)
2942 1.1 lukem dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2943 1.1 lukem test "X$dir" = "X$deplib" && dir="."
2944 1.1 lukem # We need an absolute path.
2945 1.1 lukem case $dir in
2946 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2947 1.1 lukem *)
2948 1.1 lukem absdir=`cd "$dir" && pwd`
2949 1.1 lukem if test -z "$absdir"; then
2950 1.1 lukem $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2951 1.1 lukem absdir="$dir"
2952 1.1 lukem fi
2953 1.1 lukem ;;
2954 1.1 lukem esac
2955 1.1 lukem if grep "^installed=no" $deplib > /dev/null; then
2956 1.1 lukem path="$absdir/$objdir"
2957 1.1 lukem else
2958 1.1 lukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2959 1.1 lukem if test -z "$libdir"; then
2960 1.1 lukem $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2961 1.1 lukem exit $EXIT_FAILURE
2962 1.1 lukem fi
2963 1.1 lukem if test "$absdir" != "$libdir"; then
2964 1.1 lukem $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2965 1.1 lukem fi
2966 1.1 lukem path="$absdir"
2967 1.1 lukem fi
2968 1.1 lukem depdepl=
2969 1.1 lukem case $host in
2970 1.1 lukem *-*-darwin*)
2971 1.1 lukem # we do not want to link against static libs,
2972 1.1 lukem # but need to link against shared
2973 1.1 lukem eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2974 1.1 lukem if test -n "$deplibrary_names" ; then
2975 1.1 lukem for tmp in $deplibrary_names ; do
2976 1.1 lukem depdepl=$tmp
2977 1.1 lukem done
2978 1.1 lukem if test -f "$path/$depdepl" ; then
2979 1.1 lukem depdepl="$path/$depdepl"
2980 1.1 lukem fi
2981 1.1 lukem # do not add paths which are already there
2982 1.1 lukem case " $newlib_search_path " in
2983 1.1 lukem *" $path "*) ;;
2984 1.1 lukem *) newlib_search_path="$newlib_search_path $path";;
2985 1.1 lukem esac
2986 1.1 lukem fi
2987 1.1 lukem path=""
2988 1.1 lukem ;;
2989 1.1 lukem *)
2990 1.1 lukem path="-L$path"
2991 1.1 lukem ;;
2992 1.1 lukem esac
2993 1.1 lukem ;;
2994 1.1 lukem -l*)
2995 1.1 lukem case $host in
2996 1.1 lukem *-*-darwin*)
2997 1.1 lukem # Again, we only want to link against shared libraries
2998 1.1 lukem eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2999 1.1 lukem for tmp in $newlib_search_path ; do
3000 1.1 lukem if test -f "$tmp/lib$tmp_libs.dylib" ; then
3001 1.1 lukem eval depdepl="$tmp/lib$tmp_libs.dylib"
3002 1.1 lukem break
3003 1.1 lukem fi
3004 1.1 lukem done
3005 1.1 lukem path=""
3006 1.1 lukem ;;
3007 1.1 lukem *) continue ;;
3008 1.1 lukem esac
3009 1.1 lukem ;;
3010 1.1 lukem *) continue ;;
3011 1.1 lukem esac
3012 1.1 lukem case " $deplibs " in
3013 1.1 lukem *" $path "*) ;;
3014 1.1 lukem *) deplibs="$path $deplibs" ;;
3015 1.1 lukem esac
3016 1.1 lukem case " $deplibs " in
3017 1.1 lukem *" $depdepl "*) ;;
3018 1.1 lukem *) deplibs="$depdepl $deplibs" ;;
3019 1.1 lukem esac
3020 1.1 lukem done
3021 1.1 lukem fi # link_all_deplibs != no
3022 1.1 lukem fi # linkmode = lib
3023 1.1 lukem done # for deplib in $libs
3024 1.1 lukem dependency_libs="$newdependency_libs"
3025 1.1 lukem if test "$pass" = dlpreopen; then
3026 1.1 lukem # Link the dlpreopened libraries before other libraries
3027 1.1 lukem for deplib in $save_deplibs; do
3028 1.1 lukem deplibs="$deplib $deplibs"
3029 1.1 lukem done
3030 1.1 lukem fi
3031 1.1 lukem if test "$pass" != dlopen; then
3032 1.1 lukem if test "$pass" != conv; then
3033 1.1 lukem # Make sure lib_search_path contains only unique directories.
3034 1.1 lukem lib_search_path=
3035 1.1 lukem for dir in $newlib_search_path; do
3036 1.1 lukem case "$lib_search_path " in
3037 1.1 lukem *" $dir "*) ;;
3038 1.1 lukem *) lib_search_path="$lib_search_path $dir" ;;
3039 1.1 lukem esac
3040 1.1 lukem done
3041 1.1 lukem newlib_search_path=
3042 1.1 lukem fi
3043 1.1 lukem
3044 1.1 lukem if test "$linkmode,$pass" != "prog,link"; then
3045 1.1 lukem vars="deplibs"
3046 1.1 lukem else
3047 1.1 lukem vars="compile_deplibs finalize_deplibs"
3048 1.1 lukem fi
3049 1.1 lukem for var in $vars dependency_libs; do
3050 1.1 lukem # Add libraries to $var in reverse order
3051 1.1 lukem eval tmp_libs=\"\$$var\"
3052 1.1 lukem new_libs=
3053 1.1 lukem for deplib in $tmp_libs; do
3054 1.1 lukem # FIXME: Pedantically, this is the right thing to do, so
3055 1.1 lukem # that some nasty dependency loop isn't accidentally
3056 1.1 lukem # broken:
3057 1.1 lukem #new_libs="$deplib $new_libs"
3058 1.1 lukem # Pragmatically, this seems to cause very few problems in
3059 1.1 lukem # practice:
3060 1.1 lukem case $deplib in
3061 1.1 lukem -L*) new_libs="$deplib $new_libs" ;;
3062 1.1 lukem -R*) ;;
3063 1.1 lukem *)
3064 1.1 lukem # And here is the reason: when a library appears more
3065 1.1 lukem # than once as an explicit dependence of a library, or
3066 1.1 lukem # is implicitly linked in more than once by the
3067 1.1 lukem # compiler, it is considered special, and multiple
3068 1.1 lukem # occurrences thereof are not removed. Compare this
3069 1.1 lukem # with having the same library being listed as a
3070 1.1 lukem # dependency of multiple other libraries: in this case,
3071 1.1 lukem # we know (pedantically, we assume) the library does not
3072 1.1 lukem # need to be listed more than once, so we keep only the
3073 1.1 lukem # last copy. This is not always right, but it is rare
3074 1.1 lukem # enough that we require users that really mean to play
3075 1.1 lukem # such unportable linking tricks to link the library
3076 1.1 lukem # using -Wl,-lname, so that libtool does not consider it
3077 1.1 lukem # for duplicate removal.
3078 1.1 lukem case " $specialdeplibs " in
3079 1.1 lukem *" $deplib "*) new_libs="$deplib $new_libs" ;;
3080 1.1 lukem *)
3081 1.1 lukem case " $new_libs " in
3082 1.1 lukem *" $deplib "*) ;;
3083 1.1 lukem *) new_libs="$deplib $new_libs" ;;
3084 1.1 lukem esac
3085 1.1 lukem ;;
3086 1.1 lukem esac
3087 1.1 lukem ;;
3088 1.1 lukem esac
3089 1.1 lukem done
3090 1.1 lukem tmp_libs=
3091 1.1 lukem for deplib in $new_libs; do
3092 1.1 lukem case $deplib in
3093 1.1 lukem -L*)
3094 1.1 lukem case " $tmp_libs " in
3095 1.1 lukem *" $deplib "*) ;;
3096 1.1 lukem *) tmp_libs="$tmp_libs $deplib" ;;
3097 1.1 lukem esac
3098 1.1 lukem ;;
3099 1.1 lukem *) tmp_libs="$tmp_libs $deplib" ;;
3100 1.1 lukem esac
3101 1.1 lukem done
3102 1.1 lukem eval $var=\"$tmp_libs\"
3103 1.1 lukem done # for var
3104 1.1 lukem fi
3105 1.1 lukem # Last step: remove runtime libs from dependency_libs
3106 1.1 lukem # (they stay in deplibs)
3107 1.1 lukem tmp_libs=
3108 1.1 lukem for i in $dependency_libs ; do
3109 1.1 lukem case " $predeps $postdeps $compiler_lib_search_path " in
3110 1.1 lukem *" $i "*)
3111 1.1 lukem i=""
3112 1.1 lukem ;;
3113 1.1 lukem esac
3114 1.1 lukem if test -n "$i" ; then
3115 1.1 lukem tmp_libs="$tmp_libs $i"
3116 1.1 lukem fi
3117 1.1 lukem done
3118 1.1 lukem dependency_libs=$tmp_libs
3119 1.1 lukem done # for pass
3120 1.1 lukem if test "$linkmode" = prog; then
3121 1.1 lukem dlfiles="$newdlfiles"
3122 1.1 lukem dlprefiles="$newdlprefiles"
3123 1.1 lukem fi
3124 1.1 lukem
3125 1.1 lukem case $linkmode in
3126 1.1 lukem oldlib)
3127 1.1 lukem if test -n "$deplibs"; then
3128 1.1 lukem $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3129 1.1 lukem fi
3130 1.1 lukem
3131 1.1 lukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3132 1.1 lukem $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3133 1.1 lukem fi
3134 1.1 lukem
3135 1.1 lukem if test -n "$rpath"; then
3136 1.1 lukem $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3137 1.1 lukem fi
3138 1.1 lukem
3139 1.1 lukem if test -n "$xrpath"; then
3140 1.1 lukem $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3141 1.1 lukem fi
3142 1.1 lukem
3143 1.1 lukem if test -n "$vinfo"; then
3144 1.1 lukem $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3145 1.1 lukem fi
3146 1.1 lukem
3147 1.1 lukem if test -n "$release"; then
3148 1.1 lukem $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3149 1.1 lukem fi
3150 1.1 lukem
3151 1.1 lukem if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3152 1.1 lukem $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3153 1.1 lukem fi
3154 1.1 lukem
3155 1.1 lukem # Now set the variables for building old libraries.
3156 1.1 lukem build_libtool_libs=no
3157 1.1 lukem oldlibs="$output"
3158 1.1 lukem objs="$objs$old_deplibs"
3159 1.1 lukem ;;
3160 1.1 lukem
3161 1.1 lukem lib)
3162 1.1 lukem # Make sure we only generate libraries of the form `libNAME.la'.
3163 1.1 lukem case $outputname in
3164 1.1 lukem lib*)
3165 1.1 lukem name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3166 1.1 lukem eval shared_ext=\"$shrext_cmds\"
3167 1.1 lukem eval libname=\"$libname_spec\"
3168 1.1 lukem ;;
3169 1.1 lukem *)
3170 1.1 lukem if test "$module" = no; then
3171 1.1 lukem $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3172 1.1 lukem $echo "$help" 1>&2
3173 1.1 lukem exit $EXIT_FAILURE
3174 1.1 lukem fi
3175 1.1 lukem if test "$need_lib_prefix" != no; then
3176 1.1 lukem # Add the "lib" prefix for modules if required
3177 1.1 lukem name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3178 1.1 lukem eval shared_ext=\"$shrext_cmds\"
3179 1.1 lukem eval libname=\"$libname_spec\"
3180 1.1 lukem else
3181 1.1 lukem libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3182 1.1 lukem fi
3183 1.1 lukem ;;
3184 1.1 lukem esac
3185 1.1 lukem
3186 1.1 lukem if test -n "$objs"; then
3187 1.1 lukem if test "$deplibs_check_method" != pass_all; then
3188 1.1 lukem $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3189 1.1 lukem exit $EXIT_FAILURE
3190 1.1 lukem else
3191 1.1 lukem $echo
3192 1.1 lukem $echo "*** Warning: Linking the shared library $output against the non-libtool"
3193 1.1 lukem $echo "*** objects $objs is not portable!"
3194 1.1 lukem libobjs="$libobjs $objs"
3195 1.1 lukem fi
3196 1.1 lukem fi
3197 1.1 lukem
3198 1.1 lukem if test "$dlself" != no; then
3199 1.1 lukem $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3200 1.1 lukem fi
3201 1.1 lukem
3202 1.1 lukem set dummy $rpath
3203 1.1 lukem if test "$#" -gt 2; then
3204 1.1 lukem $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3205 1.1 lukem fi
3206 1.1 lukem install_libdir="$2"
3207 1.1 lukem
3208 1.1 lukem oldlibs=
3209 1.1 lukem if test -z "$rpath"; then
3210 1.1 lukem if test "$build_libtool_libs" = yes; then
3211 1.1 lukem # Building a libtool convenience library.
3212 1.1 lukem # Some compilers have problems with a `.al' extension so
3213 1.1 lukem # convenience libraries should have the same extension an
3214 1.1 lukem # archive normally would.
3215 1.1 lukem oldlibs="$output_objdir/$libname.$libext $oldlibs"
3216 1.1 lukem build_libtool_libs=convenience
3217 1.1 lukem build_old_libs=yes
3218 1.1 lukem fi
3219 1.1 lukem
3220 1.1 lukem if test -n "$vinfo"; then
3221 1.1 lukem $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3222 1.1 lukem fi
3223 1.1 lukem
3224 1.1 lukem if test -n "$release"; then
3225 1.1 lukem $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3226 1.1 lukem fi
3227 1.1 lukem else
3228 1.1 lukem
3229 1.1 lukem # Parse the version information argument.
3230 1.1 lukem save_ifs="$IFS"; IFS=':'
3231 1.1 lukem set dummy $vinfo 0 0 0
3232 1.1 lukem IFS="$save_ifs"
3233 1.1 lukem
3234 1.1 lukem if test -n "$8"; then
3235 1.1 lukem $echo "$modename: too many parameters to \`-version-info'" 1>&2
3236 1.1 lukem $echo "$help" 1>&2
3237 1.1 lukem exit $EXIT_FAILURE
3238 1.1 lukem fi
3239 1.1 lukem
3240 1.1 lukem # convert absolute version numbers to libtool ages
3241 1.1 lukem # this retains compatibility with .la files and attempts
3242 1.1 lukem # to make the code below a bit more comprehensible
3243 1.1 lukem
3244 1.1 lukem case $vinfo_number in
3245 1.1 lukem yes)
3246 1.1 lukem number_major="$2"
3247 1.1 lukem number_minor="$3"
3248 1.1 lukem number_revision="$4"
3249 1.1 lukem #
3250 1.1 lukem # There are really only two kinds -- those that
3251 1.1 lukem # use the current revision as the major version
3252 1.1 lukem # and those that subtract age and use age as
3253 1.1 lukem # a minor version. But, then there is irix
3254 1.1 lukem # which has an extra 1 added just for fun
3255 1.1 lukem #
3256 1.1 lukem case $version_type in
3257 1.1 lukem darwin|linux|osf|windows)
3258 1.1 lukem current=`expr $number_major + $number_minor`
3259 1.1 lukem age="$number_minor"
3260 1.1 lukem revision="$number_revision"
3261 1.1 lukem ;;
3262 1.1 lukem freebsd-aout|freebsd-elf|sunos)
3263 1.1 lukem current="$number_major"
3264 1.1 lukem revision="$number_minor"
3265 1.1 lukem age="0"
3266 1.1 lukem ;;
3267 1.1 lukem irix|nonstopux)
3268 1.1 lukem current=`expr $number_major + $number_minor - 1`
3269 1.1 lukem age="$number_minor"
3270 1.1 lukem revision="$number_minor"
3271 1.1 lukem ;;
3272 1.1 lukem esac
3273 1.1 lukem ;;
3274 1.1 lukem no)
3275 1.1 lukem current="$2"
3276 1.1 lukem revision="$3"
3277 1.1 lukem age="$4"
3278 1.1 lukem ;;
3279 1.1 lukem esac
3280 1.1 lukem
3281 1.1 lukem # Check that each of the things are valid numbers.
3282 1.1 lukem case $current in
3283 1.1 lukem 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3284 1.1 lukem *)
3285 1.1 lukem $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3286 1.1 lukem $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287 1.1 lukem exit $EXIT_FAILURE
3288 1.1 lukem ;;
3289 1.1 lukem esac
3290 1.1 lukem
3291 1.1 lukem case $revision in
3292 1.1 lukem 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3293 1.1 lukem *)
3294 1.1 lukem $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3295 1.1 lukem $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3296 1.1 lukem exit $EXIT_FAILURE
3297 1.1 lukem ;;
3298 1.1 lukem esac
3299 1.1 lukem
3300 1.1 lukem case $age in
3301 1.1 lukem 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3302 1.1 lukem *)
3303 1.1 lukem $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3304 1.1 lukem $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3305 1.1 lukem exit $EXIT_FAILURE
3306 1.1 lukem ;;
3307 1.1 lukem esac
3308 1.1 lukem
3309 1.1 lukem if test "$age" -gt "$current"; then
3310 1.1 lukem $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3311 1.1 lukem $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3312 1.1 lukem exit $EXIT_FAILURE
3313 1.1 lukem fi
3314 1.1 lukem
3315 1.1 lukem # Calculate the version variables.
3316 1.1 lukem major=
3317 1.1 lukem versuffix=
3318 1.1 lukem verstring=
3319 1.1 lukem case $version_type in
3320 1.1 lukem none) ;;
3321 1.1 lukem
3322 1.1 lukem darwin)
3323 1.1 lukem # Like Linux, but with the current version available in
3324 1.1 lukem # verstring for coding it into the library header
3325 1.1 lukem major=.`expr $current - $age`
3326 1.1 lukem versuffix="$major.$age.$revision"
3327 1.1 lukem # Darwin ld doesn't like 0 for these options...
3328 1.1 lukem minor_current=`expr $current + 1`
3329 1.1 lukem verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3330 1.1 lukem ;;
3331 1.1 lukem
3332 1.1 lukem freebsd-aout)
3333 1.1 lukem major=".$current"
3334 1.1 lukem versuffix=".$current.$revision";
3335 1.1 lukem ;;
3336 1.1 lukem
3337 1.1 lukem freebsd-elf)
3338 1.1 lukem major=".$current"
3339 1.1 lukem versuffix=".$current";
3340 1.1 lukem ;;
3341 1.1 lukem
3342 1.1 lukem irix | nonstopux)
3343 1.1 lukem major=`expr $current - $age + 1`
3344 1.1 lukem
3345 1.1 lukem case $version_type in
3346 1.1 lukem nonstopux) verstring_prefix=nonstopux ;;
3347 1.1 lukem *) verstring_prefix=sgi ;;
3348 1.1 lukem esac
3349 1.1 lukem verstring="$verstring_prefix$major.$revision"
3350 1.1 lukem
3351 1.1 lukem # Add in all the interfaces that we are compatible with.
3352 1.1 lukem loop=$revision
3353 1.1 lukem while test "$loop" -ne 0; do
3354 1.1 lukem iface=`expr $revision - $loop`
3355 1.1 lukem loop=`expr $loop - 1`
3356 1.1 lukem verstring="$verstring_prefix$major.$iface:$verstring"
3357 1.1 lukem done
3358 1.1 lukem
3359 1.1 lukem # Before this point, $major must not contain `.'.
3360 1.1 lukem major=.$major
3361 1.1 lukem versuffix="$major.$revision"
3362 1.1 lukem ;;
3363 1.1 lukem
3364 1.1 lukem linux)
3365 1.1 lukem major=.`expr $current - $age`
3366 1.1 lukem versuffix="$major.$age.$revision"
3367 1.1 lukem ;;
3368 1.1 lukem
3369 1.1 lukem osf)
3370 1.1 lukem major=.`expr $current - $age`
3371 1.1 lukem versuffix=".$current.$age.$revision"
3372 1.1 lukem verstring="$current.$age.$revision"
3373 1.1 lukem
3374 1.1 lukem # Add in all the interfaces that we are compatible with.
3375 1.1 lukem loop=$age
3376 1.1 lukem while test "$loop" -ne 0; do
3377 1.1 lukem iface=`expr $current - $loop`
3378 1.1 lukem loop=`expr $loop - 1`
3379 1.1 lukem verstring="$verstring:${iface}.0"
3380 1.1 lukem done
3381 1.1 lukem
3382 1.1 lukem # Make executables depend on our current version.
3383 1.1 lukem verstring="$verstring:${current}.0"
3384 1.1 lukem ;;
3385 1.1 lukem
3386 1.1 lukem sunos)
3387 1.1 lukem major=".$current"
3388 1.1 lukem versuffix=".$current.$revision"
3389 1.1 lukem ;;
3390 1.1 lukem
3391 1.1 lukem windows)
3392 1.1 lukem # Use '-' rather than '.', since we only want one
3393 1.1 lukem # extension on DOS 8.3 filesystems.
3394 1.1 lukem major=`expr $current - $age`
3395 1.1 lukem versuffix="-$major"
3396 1.1 lukem ;;
3397 1.1 lukem
3398 1.1 lukem *)
3399 1.1 lukem $echo "$modename: unknown library version type \`$version_type'" 1>&2
3400 1.1 lukem $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3401 1.1 lukem exit $EXIT_FAILURE
3402 1.1 lukem ;;
3403 1.1 lukem esac
3404 1.1 lukem
3405 1.1 lukem # Clear the version info if we defaulted, and they specified a release.
3406 1.1 lukem if test -z "$vinfo" && test -n "$release"; then
3407 1.1 lukem major=
3408 1.1 lukem case $version_type in
3409 1.1 lukem darwin)
3410 1.1 lukem # we can't check for "0.0" in archive_cmds due to quoting
3411 1.1 lukem # problems, so we reset it completely
3412 1.1 lukem verstring=
3413 1.1 lukem ;;
3414 1.1 lukem *)
3415 1.1 lukem verstring="0.0"
3416 1.1 lukem ;;
3417 1.1 lukem esac
3418 1.1 lukem if test "$need_version" = no; then
3419 1.1 lukem versuffix=
3420 1.1 lukem else
3421 1.1 lukem versuffix=".0.0"
3422 1.1 lukem fi
3423 1.1 lukem fi
3424 1.1 lukem
3425 1.1 lukem # Remove version info from name if versioning should be avoided
3426 1.1 lukem if test "$avoid_version" = yes && test "$need_version" = no; then
3427 1.1 lukem major=
3428 1.1 lukem versuffix=
3429 1.1 lukem verstring=""
3430 1.1 lukem fi
3431 1.1 lukem
3432 1.1 lukem # Check to see if the archive will have undefined symbols.
3433 1.1 lukem if test "$allow_undefined" = yes; then
3434 1.1 lukem if test "$allow_undefined_flag" = unsupported; then
3435 1.1 lukem $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3436 1.1 lukem build_libtool_libs=no
3437 1.1 lukem build_old_libs=yes
3438 1.1 lukem fi
3439 1.1 lukem else
3440 1.1 lukem # Don't allow undefined symbols.
3441 1.1 lukem allow_undefined_flag="$no_undefined_flag"
3442 1.1 lukem fi
3443 1.1 lukem fi
3444 1.1 lukem
3445 1.1 lukem if test "$mode" != relink; then
3446 1.1 lukem # Remove our outputs, but don't remove object files since they
3447 1.1 lukem # may have been created when compiling PIC objects.
3448 1.1 lukem removelist=
3449 1.1 lukem tempremovelist=`$echo "$output_objdir/*"`
3450 1.1 lukem for p in $tempremovelist; do
3451 1.1 lukem case $p in
3452 1.1 lukem *.$objext)
3453 1.1 lukem ;;
3454 1.1 lukem $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3455 1.1 lukem if test "X$precious_files_regex" != "X"; then
3456 1.1 lukem if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3457 1.1 lukem then
3458 1.1 lukem continue
3459 1.1 lukem fi
3460 1.1 lukem fi
3461 1.1 lukem removelist="$removelist $p"
3462 1.1 lukem ;;
3463 1.1 lukem *) ;;
3464 1.1 lukem esac
3465 1.1 lukem done
3466 1.1 lukem if test -n "$removelist"; then
3467 1.1 lukem $show "${rm}r $removelist"
3468 1.1 lukem $run ${rm}r $removelist
3469 1.1 lukem fi
3470 1.1 lukem fi
3471 1.1 lukem
3472 1.1 lukem # Now set the variables for building old libraries.
3473 1.1 lukem if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3474 1.1 lukem oldlibs="$oldlibs $output_objdir/$libname.$libext"
3475 1.1 lukem
3476 1.1 lukem # Transform .lo files to .o files.
3477 1.1 lukem oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3478 1.1 lukem fi
3479 1.1 lukem
3480 1.1 lukem # Eliminate all temporary directories.
3481 1.1 lukem for path in $notinst_path; do
3482 1.1 lukem lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3483 1.1 lukem deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3484 1.1 lukem dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3485 1.1 lukem done
3486 1.1 lukem
3487 1.1 lukem if test -n "$xrpath"; then
3488 1.1 lukem # If the user specified any rpath flags, then add them.
3489 1.1 lukem temp_xrpath=
3490 1.1 lukem for libdir in $xrpath; do
3491 1.1 lukem temp_xrpath="$temp_xrpath -R$libdir"
3492 1.1 lukem case "$finalize_rpath " in
3493 1.1 lukem *" $libdir "*) ;;
3494 1.1 lukem *) finalize_rpath="$finalize_rpath $libdir" ;;
3495 1.1 lukem esac
3496 1.1 lukem done
3497 1.1 lukem if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3498 1.1 lukem dependency_libs="$temp_xrpath $dependency_libs"
3499 1.1 lukem fi
3500 1.1 lukem fi
3501 1.1 lukem
3502 1.1 lukem # Make sure dlfiles contains only unique files that won't be dlpreopened
3503 1.1 lukem old_dlfiles="$dlfiles"
3504 1.1 lukem dlfiles=
3505 1.1 lukem for lib in $old_dlfiles; do
3506 1.1 lukem case " $dlprefiles $dlfiles " in
3507 1.1 lukem *" $lib "*) ;;
3508 1.1 lukem *) dlfiles="$dlfiles $lib" ;;
3509 1.1 lukem esac
3510 1.1 lukem done
3511 1.1 lukem
3512 1.1 lukem # Make sure dlprefiles contains only unique files
3513 1.1 lukem old_dlprefiles="$dlprefiles"
3514 1.1 lukem dlprefiles=
3515 1.1 lukem for lib in $old_dlprefiles; do
3516 1.1 lukem case "$dlprefiles " in
3517 1.1 lukem *" $lib "*) ;;
3518 1.1 lukem *) dlprefiles="$dlprefiles $lib" ;;
3519 1.1 lukem esac
3520 1.1 lukem done
3521 1.1 lukem
3522 1.1 lukem if test "$build_libtool_libs" = yes; then
3523 1.1 lukem if test -n "$rpath"; then
3524 1.1 lukem case $host in
3525 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3526 1.1 lukem # these systems don't actually have a c library (as such)!
3527 1.1 lukem ;;
3528 1.1 lukem *-*-rhapsody* | *-*-darwin1.[012])
3529 1.1 lukem # Rhapsody C library is in the System framework
3530 1.1 lukem deplibs="$deplibs -framework System"
3531 1.1 lukem ;;
3532 1.1 lukem *-*-netbsd*)
3533 1.1 lukem # Don't link with libc until the a.out ld.so is fixed.
3534 1.1 lukem ;;
3535 1.1 lukem *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3536 1.1 lukem # Do not include libc due to us having libc/libc_r.
3537 1.1 lukem ;;
3538 1.1 lukem *-*-sco3.2v5* | *-*-sco5v6*)
3539 1.1 lukem # Causes problems with __ctype
3540 1.1 lukem ;;
3541 1.1 lukem *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3542 1.1 lukem # Compiler inserts libc in the correct place for threads to work
3543 1.1 lukem ;;
3544 1.1 lukem *)
3545 1.1 lukem # Add libc to deplibs on all other systems if necessary.
3546 1.1 lukem if test "$build_libtool_need_lc" = "yes"; then
3547 1.1 lukem deplibs="$deplibs -lc"
3548 1.1 lukem fi
3549 1.1 lukem ;;
3550 1.1 lukem esac
3551 1.1 lukem fi
3552 1.1 lukem
3553 1.1 lukem # Transform deplibs into only deplibs that can be linked in shared.
3554 1.1 lukem name_save=$name
3555 1.1 lukem libname_save=$libname
3556 1.1 lukem release_save=$release
3557 1.1 lukem versuffix_save=$versuffix
3558 1.1 lukem major_save=$major
3559 1.1 lukem # I'm not sure if I'm treating the release correctly. I think
3560 1.1 lukem # release should show up in the -l (ie -lgmp5) so we don't want to
3561 1.1 lukem # add it in twice. Is that correct?
3562 1.1 lukem release=""
3563 1.1 lukem versuffix=""
3564 1.1 lukem major=""
3565 1.1 lukem newdeplibs=
3566 1.1 lukem droppeddeps=no
3567 1.1 lukem case $deplibs_check_method in
3568 1.1 lukem pass_all)
3569 1.1 lukem # Don't check for shared/static. Everything works.
3570 1.1 lukem # This might be a little naive. We might want to check
3571 1.1 lukem # whether the library exists or not. But this is on
3572 1.1 lukem # osf3 & osf4 and I'm not really sure... Just
3573 1.1 lukem # implementing what was already the behavior.
3574 1.1 lukem newdeplibs=$deplibs
3575 1.1 lukem ;;
3576 1.1 lukem test_compile)
3577 1.1 lukem # This code stresses the "libraries are programs" paradigm to its
3578 1.1 lukem # limits. Maybe even breaks it. We compile a program, linking it
3579 1.1 lukem # against the deplibs as a proxy for the library. Then we can check
3580 1.1 lukem # whether they linked in statically or dynamically with ldd.
3581 1.1 lukem $rm conftest.c
3582 1.1 lukem cat > conftest.c <<EOF
3583 1.1 lukem int main() { return 0; }
3584 1.1 lukem EOF
3585 1.1 lukem $rm conftest
3586 1.1 lukem $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3587 1.1 lukem if test "$?" -eq 0 ; then
3588 1.1 lukem ldd_output=`ldd conftest`
3589 1.1 lukem for i in $deplibs; do
3590 1.1 lukem name=`expr $i : '-l\(.*\)'`
3591 1.1 lukem # If $name is empty we are operating on a -L argument.
3592 1.1 lukem if test "$name" != "" && test "$name" -ne "0"; then
3593 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3594 1.1 lukem case " $predeps $postdeps " in
3595 1.1 lukem *" $i "*)
3596 1.1 lukem newdeplibs="$newdeplibs $i"
3597 1.1 lukem i=""
3598 1.1 lukem ;;
3599 1.1 lukem esac
3600 1.1 lukem fi
3601 1.1 lukem if test -n "$i" ; then
3602 1.1 lukem libname=`eval \\$echo \"$libname_spec\"`
3603 1.1 lukem deplib_matches=`eval \\$echo \"$library_names_spec\"`
3604 1.1 lukem set dummy $deplib_matches
3605 1.1 lukem deplib_match=$2
3606 1.1 lukem if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3607 1.1 lukem newdeplibs="$newdeplibs $i"
3608 1.1 lukem else
3609 1.1 lukem droppeddeps=yes
3610 1.1 lukem $echo
3611 1.1 lukem $echo "*** Warning: dynamic linker does not accept needed library $i."
3612 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
3613 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
3614 1.1 lukem $echo "*** shared version of the library, which I believe you do not have"
3615 1.1 lukem $echo "*** because a test_compile did reveal that the linker did not use it for"
3616 1.1 lukem $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3617 1.1 lukem fi
3618 1.1 lukem fi
3619 1.1 lukem else
3620 1.1 lukem newdeplibs="$newdeplibs $i"
3621 1.1 lukem fi
3622 1.1 lukem done
3623 1.1 lukem else
3624 1.1 lukem # Error occurred in the first compile. Let's try to salvage
3625 1.1 lukem # the situation: Compile a separate program for each library.
3626 1.1 lukem for i in $deplibs; do
3627 1.1 lukem name=`expr $i : '-l\(.*\)'`
3628 1.1 lukem # If $name is empty we are operating on a -L argument.
3629 1.1 lukem if test "$name" != "" && test "$name" != "0"; then
3630 1.1 lukem $rm conftest
3631 1.1 lukem $LTCC $LTCFLAGS -o conftest conftest.c $i
3632 1.1 lukem # Did it work?
3633 1.1 lukem if test "$?" -eq 0 ; then
3634 1.1 lukem ldd_output=`ldd conftest`
3635 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3636 1.1 lukem case " $predeps $postdeps " in
3637 1.1 lukem *" $i "*)
3638 1.1 lukem newdeplibs="$newdeplibs $i"
3639 1.1 lukem i=""
3640 1.1 lukem ;;
3641 1.1 lukem esac
3642 1.1 lukem fi
3643 1.1 lukem if test -n "$i" ; then
3644 1.1 lukem libname=`eval \\$echo \"$libname_spec\"`
3645 1.1 lukem deplib_matches=`eval \\$echo \"$library_names_spec\"`
3646 1.1 lukem set dummy $deplib_matches
3647 1.1 lukem deplib_match=$2
3648 1.1 lukem if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3649 1.1 lukem newdeplibs="$newdeplibs $i"
3650 1.1 lukem else
3651 1.1 lukem droppeddeps=yes
3652 1.1 lukem $echo
3653 1.1 lukem $echo "*** Warning: dynamic linker does not accept needed library $i."
3654 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
3655 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
3656 1.1 lukem $echo "*** shared version of the library, which you do not appear to have"
3657 1.1 lukem $echo "*** because a test_compile did reveal that the linker did not use this one"
3658 1.1 lukem $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3659 1.1 lukem fi
3660 1.1 lukem fi
3661 1.1 lukem else
3662 1.1 lukem droppeddeps=yes
3663 1.1 lukem $echo
3664 1.1 lukem $echo "*** Warning! Library $i is needed by this library but I was not able to"
3665 1.1 lukem $echo "*** make it link in! You will probably need to install it or some"
3666 1.1 lukem $echo "*** library that it depends on before this library will be fully"
3667 1.1 lukem $echo "*** functional. Installing it before continuing would be even better."
3668 1.1 lukem fi
3669 1.1 lukem else
3670 1.1 lukem newdeplibs="$newdeplibs $i"
3671 1.1 lukem fi
3672 1.1 lukem done
3673 1.1 lukem fi
3674 1.1 lukem ;;
3675 1.1 lukem file_magic*)
3676 1.1 lukem set dummy $deplibs_check_method
3677 1.1 lukem file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3678 1.1 lukem for a_deplib in $deplibs; do
3679 1.1 lukem name=`expr $a_deplib : '-l\(.*\)'`
3680 1.1 lukem # If $name is empty we are operating on a -L argument.
3681 1.1 lukem if test "$name" != "" && test "$name" != "0"; then
3682 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3683 1.1 lukem case " $predeps $postdeps " in
3684 1.1 lukem *" $a_deplib "*)
3685 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3686 1.1 lukem a_deplib=""
3687 1.1 lukem ;;
3688 1.1 lukem esac
3689 1.1 lukem fi
3690 1.1 lukem if test -n "$a_deplib" ; then
3691 1.1 lukem libname=`eval \\$echo \"$libname_spec\"`
3692 1.1 lukem for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3693 1.1 lukem potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3694 1.1 lukem for potent_lib in $potential_libs; do
3695 1.1 lukem # Follow soft links.
3696 1.1 lukem if ls -lLd "$potent_lib" 2>/dev/null \
3697 1.1 lukem | grep " -> " >/dev/null; then
3698 1.1 lukem continue
3699 1.1 lukem fi
3700 1.1 lukem # The statement above tries to avoid entering an
3701 1.1 lukem # endless loop below, in case of cyclic links.
3702 1.1 lukem # We might still enter an endless loop, since a link
3703 1.1 lukem # loop can be closed while we follow links,
3704 1.1 lukem # but so what?
3705 1.1 lukem potlib="$potent_lib"
3706 1.1 lukem while test -h "$potlib" 2>/dev/null; do
3707 1.1 lukem potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3708 1.1 lukem case $potliblink in
3709 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3710 1.1 lukem *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3711 1.1 lukem esac
3712 1.1 lukem done
3713 1.1 lukem if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3714 1.1 lukem | ${SED} 10q \
3715 1.1 lukem | $EGREP "$file_magic_regex" > /dev/null; then
3716 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3717 1.1 lukem a_deplib=""
3718 1.1 lukem break 2
3719 1.1 lukem fi
3720 1.1 lukem done
3721 1.1 lukem done
3722 1.1 lukem fi
3723 1.1 lukem if test -n "$a_deplib" ; then
3724 1.1 lukem droppeddeps=yes
3725 1.1 lukem $echo
3726 1.1 lukem $echo "*** Warning: linker path does not have real file for library $a_deplib."
3727 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
3728 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
3729 1.1 lukem $echo "*** shared version of the library, which you do not appear to have"
3730 1.1 lukem $echo "*** because I did check the linker path looking for a file starting"
3731 1.1 lukem if test -z "$potlib" ; then
3732 1.1 lukem $echo "*** with $libname but no candidates were found. (...for file magic test)"
3733 1.1 lukem else
3734 1.1 lukem $echo "*** with $libname and none of the candidates passed a file format test"
3735 1.1 lukem $echo "*** using a file magic. Last file checked: $potlib"
3736 1.1 lukem fi
3737 1.1 lukem fi
3738 1.1 lukem else
3739 1.1 lukem # Add a -L argument.
3740 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3741 1.1 lukem fi
3742 1.1 lukem done # Gone through all deplibs.
3743 1.1 lukem ;;
3744 1.1 lukem match_pattern*)
3745 1.1 lukem set dummy $deplibs_check_method
3746 1.1 lukem match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3747 1.1 lukem for a_deplib in $deplibs; do
3748 1.1 lukem name=`expr $a_deplib : '-l\(.*\)'`
3749 1.1 lukem # If $name is empty we are operating on a -L argument.
3750 1.1 lukem if test -n "$name" && test "$name" != "0"; then
3751 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3752 1.1 lukem case " $predeps $postdeps " in
3753 1.1 lukem *" $a_deplib "*)
3754 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3755 1.1 lukem a_deplib=""
3756 1.1 lukem ;;
3757 1.1 lukem esac
3758 1.1 lukem fi
3759 1.1 lukem if test -n "$a_deplib" ; then
3760 1.1 lukem libname=`eval \\$echo \"$libname_spec\"`
3761 1.1 lukem for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3762 1.1 lukem potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3763 1.1 lukem for potent_lib in $potential_libs; do
3764 1.1 lukem potlib="$potent_lib" # see symlink-check above in file_magic test
3765 1.1 lukem if eval $echo \"$potent_lib\" 2>/dev/null \
3766 1.1 lukem | ${SED} 10q \
3767 1.1 lukem | $EGREP "$match_pattern_regex" > /dev/null; then
3768 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3769 1.1 lukem a_deplib=""
3770 1.1 lukem break 2
3771 1.1 lukem fi
3772 1.1 lukem done
3773 1.1 lukem done
3774 1.1 lukem fi
3775 1.1 lukem if test -n "$a_deplib" ; then
3776 1.1 lukem droppeddeps=yes
3777 1.1 lukem $echo
3778 1.1 lukem $echo "*** Warning: linker path does not have real file for library $a_deplib."
3779 1.1 lukem $echo "*** I have the capability to make that library automatically link in when"
3780 1.1 lukem $echo "*** you link to this library. But I can only do this if you have a"
3781 1.1 lukem $echo "*** shared version of the library, which you do not appear to have"
3782 1.1 lukem $echo "*** because I did check the linker path looking for a file starting"
3783 1.1 lukem if test -z "$potlib" ; then
3784 1.1 lukem $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3785 1.1 lukem else
3786 1.1 lukem $echo "*** with $libname and none of the candidates passed a file format test"
3787 1.1 lukem $echo "*** using a regex pattern. Last file checked: $potlib"
3788 1.1 lukem fi
3789 1.1 lukem fi
3790 1.1 lukem else
3791 1.1 lukem # Add a -L argument.
3792 1.1 lukem newdeplibs="$newdeplibs $a_deplib"
3793 1.1 lukem fi
3794 1.1 lukem done # Gone through all deplibs.
3795 1.1 lukem ;;
3796 1.1 lukem none | unknown | *)
3797 1.1 lukem newdeplibs=""
3798 1.1 lukem tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3799 1.1 lukem -e 's/ -[LR][^ ]*//g'`
3800 1.1 lukem if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3801 1.1 lukem for i in $predeps $postdeps ; do
3802 1.1 lukem # can't use Xsed below, because $i might contain '/'
3803 1.1 lukem tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3804 1.1 lukem done
3805 1.1 lukem fi
3806 1.1 lukem if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3807 1.1 lukem | grep . >/dev/null; then
3808 1.1 lukem $echo
3809 1.1 lukem if test "X$deplibs_check_method" = "Xnone"; then
3810 1.1 lukem $echo "*** Warning: inter-library dependencies are not supported in this platform."
3811 1.1 lukem else
3812 1.1 lukem $echo "*** Warning: inter-library dependencies are not known to be supported."
3813 1.1 lukem fi
3814 1.1 lukem $echo "*** All declared inter-library dependencies are being dropped."
3815 1.1 lukem droppeddeps=yes
3816 1.1 lukem fi
3817 1.1 lukem ;;
3818 1.1 lukem esac
3819 1.1 lukem versuffix=$versuffix_save
3820 1.1 lukem major=$major_save
3821 1.1 lukem release=$release_save
3822 1.1 lukem libname=$libname_save
3823 1.1 lukem name=$name_save
3824 1.1 lukem
3825 1.1 lukem case $host in
3826 1.1 lukem *-*-rhapsody* | *-*-darwin1.[012])
3827 1.1 lukem # On Rhapsody replace the C library is the System framework
3828 1.1 lukem newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3829 1.1 lukem ;;
3830 1.1 lukem esac
3831 1.1 lukem
3832 1.1 lukem if test "$droppeddeps" = yes; then
3833 1.1 lukem if test "$module" = yes; then
3834 1.1 lukem $echo
3835 1.1 lukem $echo "*** Warning: libtool could not satisfy all declared inter-library"
3836 1.1 lukem $echo "*** dependencies of module $libname. Therefore, libtool will create"
3837 1.1 lukem $echo "*** a static module, that should work as long as the dlopening"
3838 1.1 lukem $echo "*** application is linked with the -dlopen flag."
3839 1.1 lukem if test -z "$global_symbol_pipe"; then
3840 1.1 lukem $echo
3841 1.1 lukem $echo "*** However, this would only work if libtool was able to extract symbol"
3842 1.1 lukem $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3843 1.1 lukem $echo "*** not find such a program. So, this module is probably useless."
3844 1.1 lukem $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3845 1.1 lukem fi
3846 1.1 lukem if test "$build_old_libs" = no; then
3847 1.1 lukem oldlibs="$output_objdir/$libname.$libext"
3848 1.1 lukem build_libtool_libs=module
3849 1.1 lukem build_old_libs=yes
3850 1.1 lukem else
3851 1.1 lukem build_libtool_libs=no
3852 1.1 lukem fi
3853 1.1 lukem else
3854 1.1 lukem $echo "*** The inter-library dependencies that have been dropped here will be"
3855 1.1 lukem $echo "*** automatically added whenever a program is linked with this library"
3856 1.1 lukem $echo "*** or is declared to -dlopen it."
3857 1.1 lukem
3858 1.1 lukem if test "$allow_undefined" = no; then
3859 1.1 lukem $echo
3860 1.1 lukem $echo "*** Since this library must not contain undefined symbols,"
3861 1.1 lukem $echo "*** because either the platform does not support them or"
3862 1.1 lukem $echo "*** it was explicitly requested with -no-undefined,"
3863 1.1 lukem $echo "*** libtool will only create a static version of it."
3864 1.1 lukem if test "$build_old_libs" = no; then
3865 1.1 lukem oldlibs="$output_objdir/$libname.$libext"
3866 1.1 lukem build_libtool_libs=module
3867 1.1 lukem build_old_libs=yes
3868 1.1 lukem else
3869 1.1 lukem build_libtool_libs=no
3870 1.1 lukem fi
3871 1.1 lukem fi
3872 1.1 lukem fi
3873 1.1 lukem fi
3874 1.1 lukem # Done checking deplibs!
3875 1.1 lukem deplibs=$newdeplibs
3876 1.1 lukem fi
3877 1.1 lukem
3878 1.1 lukem
3879 1.1 lukem # move library search paths that coincide with paths to not yet
3880 1.1 lukem # installed libraries to the beginning of the library search list
3881 1.1 lukem new_libs=
3882 1.1 lukem for path in $notinst_path; do
3883 1.1 lukem case " $new_libs " in
3884 1.1 lukem *" -L$path/$objdir "*) ;;
3885 1.1 lukem *)
3886 1.1 lukem case " $deplibs " in
3887 1.1 lukem *" -L$path/$objdir "*)
3888 1.1 lukem new_libs="$new_libs -L$path/$objdir" ;;
3889 1.1 lukem esac
3890 1.1 lukem ;;
3891 1.1 lukem esac
3892 1.1 lukem done
3893 1.1 lukem for deplib in $deplibs; do
3894 1.1 lukem case $deplib in
3895 1.1 lukem -L*)
3896 1.1 lukem case " $new_libs " in
3897 1.1 lukem *" $deplib "*) ;;
3898 1.1 lukem *) new_libs="$new_libs $deplib" ;;
3899 1.1 lukem esac
3900 1.1 lukem ;;
3901 1.1 lukem *) new_libs="$new_libs $deplib" ;;
3902 1.1 lukem esac
3903 1.1 lukem done
3904 1.1 lukem deplibs="$new_libs"
3905 1.1 lukem
3906 1.1 lukem
3907 1.1 lukem # All the library-specific variables (install_libdir is set above).
3908 1.1 lukem library_names=
3909 1.1 lukem old_library=
3910 1.1 lukem dlname=
3911 1.1 lukem
3912 1.1 lukem # Test again, we may have decided not to build it any more
3913 1.1 lukem if test "$build_libtool_libs" = yes; then
3914 1.1 lukem if test "$hardcode_into_libs" = yes; then
3915 1.1 lukem # Hardcode the library paths
3916 1.1 lukem hardcode_libdirs=
3917 1.1 lukem dep_rpath=
3918 1.1 lukem rpath="$finalize_rpath"
3919 1.1 lukem test "$mode" != relink && rpath="$compile_rpath$rpath"
3920 1.1 lukem for libdir in $rpath; do
3921 1.1 lukem if test -n "$hardcode_libdir_flag_spec"; then
3922 1.1 lukem if test -n "$hardcode_libdir_separator"; then
3923 1.1 lukem if test -z "$hardcode_libdirs"; then
3924 1.1 lukem hardcode_libdirs="$libdir"
3925 1.1 lukem else
3926 1.1 lukem # Just accumulate the unique libdirs.
3927 1.1 lukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3928 1.1 lukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3929 1.1 lukem ;;
3930 1.1 lukem *)
3931 1.1 lukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3932 1.1 lukem ;;
3933 1.1 lukem esac
3934 1.1 lukem fi
3935 1.1 lukem else
3936 1.1 lukem eval flag=\"$hardcode_libdir_flag_spec\"
3937 1.1 lukem dep_rpath="$dep_rpath $flag"
3938 1.1 lukem fi
3939 1.1 lukem elif test -n "$runpath_var"; then
3940 1.1 lukem case "$perm_rpath " in
3941 1.1 lukem *" $libdir "*) ;;
3942 1.1 lukem *) perm_rpath="$perm_rpath $libdir" ;;
3943 1.1 lukem esac
3944 1.1 lukem fi
3945 1.1 lukem done
3946 1.1 lukem # Substitute the hardcoded libdirs into the rpath.
3947 1.1 lukem if test -n "$hardcode_libdir_separator" &&
3948 1.1 lukem test -n "$hardcode_libdirs"; then
3949 1.1 lukem libdir="$hardcode_libdirs"
3950 1.1 lukem if test -n "$hardcode_libdir_flag_spec_ld"; then
3951 1.1 lukem eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3952 1.1 lukem else
3953 1.1 lukem eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3954 1.1 lukem fi
3955 1.1 lukem fi
3956 1.1 lukem if test -n "$runpath_var" && test -n "$perm_rpath"; then
3957 1.1 lukem # We should set the runpath_var.
3958 1.1 lukem rpath=
3959 1.1 lukem for dir in $perm_rpath; do
3960 1.1 lukem rpath="$rpath$dir:"
3961 1.1 lukem done
3962 1.1 lukem eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3963 1.1 lukem fi
3964 1.1 lukem test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3965 1.1 lukem fi
3966 1.1 lukem
3967 1.1 lukem shlibpath="$finalize_shlibpath"
3968 1.1 lukem test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3969 1.1 lukem if test -n "$shlibpath"; then
3970 1.1 lukem eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3971 1.1 lukem fi
3972 1.1 lukem
3973 1.1 lukem # Get the real and link names of the library.
3974 1.1 lukem eval shared_ext=\"$shrext_cmds\"
3975 1.1 lukem eval library_names=\"$library_names_spec\"
3976 1.1 lukem set dummy $library_names
3977 1.1 lukem realname="$2"
3978 1.1 lukem shift; shift
3979 1.1 lukem
3980 1.1 lukem if test -n "$soname_spec"; then
3981 1.1 lukem eval soname=\"$soname_spec\"
3982 1.1 lukem else
3983 1.1 lukem soname="$realname"
3984 1.1 lukem fi
3985 1.1 lukem if test -z "$dlname"; then
3986 1.1 lukem dlname=$soname
3987 1.1 lukem fi
3988 1.1 lukem
3989 1.1 lukem lib="$output_objdir/$realname"
3990 1.1 lukem linknames=
3991 1.1 lukem for link
3992 1.1 lukem do
3993 1.1 lukem linknames="$linknames $link"
3994 1.1 lukem done
3995 1.1 lukem
3996 1.1 lukem # Use standard objects if they are pic
3997 1.1 lukem test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3998 1.1 lukem
3999 1.1 lukem # Prepare the list of exported symbols
4000 1.1 lukem if test -z "$export_symbols"; then
4001 1.1 lukem if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4002 1.1 lukem $show "generating symbol list for \`$libname.la'"
4003 1.1 lukem export_symbols="$output_objdir/$libname.exp"
4004 1.1 lukem $run $rm $export_symbols
4005 1.1 lukem cmds=$export_symbols_cmds
4006 1.1 lukem save_ifs="$IFS"; IFS='~'
4007 1.1 lukem for cmd in $cmds; do
4008 1.1 lukem IFS="$save_ifs"
4009 1.1 lukem eval cmd=\"$cmd\"
4010 1.1 lukem if len=`expr "X$cmd" : ".*"` &&
4011 1.1 lukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4012 1.1 lukem $show "$cmd"
4013 1.1 lukem $run eval "$cmd" || exit $?
4014 1.1 lukem skipped_export=false
4015 1.1 lukem else
4016 1.1 lukem # The command line is too long to execute in one step.
4017 1.1 lukem $show "using reloadable object file for export list..."
4018 1.1 lukem skipped_export=:
4019 1.1 lukem # Break out early, otherwise skipped_export may be
4020 1.1 lukem # set to false by a later but shorter cmd.
4021 1.1 lukem break
4022 1.1 lukem fi
4023 1.1 lukem done
4024 1.1 lukem IFS="$save_ifs"
4025 1.1 lukem if test -n "$export_symbols_regex"; then
4026 1.1 lukem $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4027 1.1 lukem $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4028 1.1 lukem $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4029 1.1 lukem $run eval '$mv "${export_symbols}T" "$export_symbols"'
4030 1.1 lukem fi
4031 1.1 lukem fi
4032 1.1 lukem fi
4033 1.1 lukem
4034 1.1 lukem if test -n "$export_symbols" && test -n "$include_expsyms"; then
4035 1.1 lukem $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4036 1.1 lukem fi
4037 1.1 lukem
4038 1.1 lukem tmp_deplibs=
4039 1.1 lukem for test_deplib in $deplibs; do
4040 1.1 lukem case " $convenience " in
4041 1.1 lukem *" $test_deplib "*) ;;
4042 1.1 lukem *)
4043 1.1 lukem tmp_deplibs="$tmp_deplibs $test_deplib"
4044 1.1 lukem ;;
4045 1.1 lukem esac
4046 1.1 lukem done
4047 1.1 lukem deplibs="$tmp_deplibs"
4048 1.1 lukem
4049 1.1 lukem if test -n "$convenience"; then
4050 1.1 lukem if test -n "$whole_archive_flag_spec"; then
4051 1.1 lukem save_libobjs=$libobjs
4052 1.1 lukem eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4053 1.1 lukem else
4054 1.1 lukem gentop="$output_objdir/${outputname}x"
4055 1.1 lukem generated="$generated $gentop"
4056 1.1 lukem
4057 1.1 lukem func_extract_archives $gentop $convenience
4058 1.1 lukem libobjs="$libobjs $func_extract_archives_result"
4059 1.1 lukem fi
4060 1.1 lukem fi
4061 1.1 lukem
4062 1.1 lukem if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4063 1.1 lukem eval flag=\"$thread_safe_flag_spec\"
4064 1.1 lukem linker_flags="$linker_flags $flag"
4065 1.1 lukem fi
4066 1.1 lukem
4067 1.1 lukem # Make a backup of the uninstalled library when relinking
4068 1.1 lukem if test "$mode" = relink; then
4069 1.1 lukem $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4070 1.1 lukem fi
4071 1.1 lukem
4072 1.1 lukem # Do each of the archive commands.
4073 1.1 lukem if test "$module" = yes && test -n "$module_cmds" ; then
4074 1.1 lukem if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4075 1.1 lukem eval test_cmds=\"$module_expsym_cmds\"
4076 1.1 lukem cmds=$module_expsym_cmds
4077 1.1 lukem else
4078 1.1 lukem eval test_cmds=\"$module_cmds\"
4079 1.1 lukem cmds=$module_cmds
4080 1.1 lukem fi
4081 1.1 lukem else
4082 1.1 lukem if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4083 1.1 lukem eval test_cmds=\"$archive_expsym_cmds\"
4084 1.1 lukem cmds=$archive_expsym_cmds
4085 1.1 lukem else
4086 1.1 lukem eval test_cmds=\"$archive_cmds\"
4087 1.1 lukem cmds=$archive_cmds
4088 1.1 lukem fi
4089 1.1 lukem fi
4090 1.1 lukem
4091 1.1 lukem if test "X$skipped_export" != "X:" &&
4092 1.1 lukem len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4093 1.1 lukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4094 1.1 lukem :
4095 1.1 lukem else
4096 1.1 lukem # The command line is too long to link in one step, link piecewise.
4097 1.1 lukem $echo "creating reloadable object files..."
4098 1.1 lukem
4099 1.1 lukem # Save the value of $output and $libobjs because we want to
4100 1.1 lukem # use them later. If we have whole_archive_flag_spec, we
4101 1.1 lukem # want to use save_libobjs as it was before
4102 1.1 lukem # whole_archive_flag_spec was expanded, because we can't
4103 1.1 lukem # assume the linker understands whole_archive_flag_spec.
4104 1.1 lukem # This may have to be revisited, in case too many
4105 1.1 lukem # convenience libraries get linked in and end up exceeding
4106 1.1 lukem # the spec.
4107 1.1 lukem if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4108 1.1 lukem save_libobjs=$libobjs
4109 1.1 lukem fi
4110 1.1 lukem save_output=$output
4111 1.1 lukem output_la=`$echo "X$output" | $Xsed -e "$basename"`
4112 1.1 lukem
4113 1.1 lukem # Clear the reloadable object creation command queue and
4114 1.1 lukem # initialize k to one.
4115 1.1 lukem test_cmds=
4116 1.1 lukem concat_cmds=
4117 1.1 lukem objlist=
4118 1.1 lukem delfiles=
4119 1.1 lukem last_robj=
4120 1.1 lukem k=1
4121 1.1 lukem output=$output_objdir/$output_la-${k}.$objext
4122 1.1 lukem # Loop over the list of objects to be linked.
4123 1.1 lukem for obj in $save_libobjs
4124 1.1 lukem do
4125 1.1 lukem eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4126 1.1 lukem if test "X$objlist" = X ||
4127 1.1 lukem { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4128 1.1 lukem test "$len" -le "$max_cmd_len"; }; then
4129 1.1 lukem objlist="$objlist $obj"
4130 1.1 lukem else
4131 1.1 lukem # The command $test_cmds is almost too long, add a
4132 1.1 lukem # command to the queue.
4133 1.1 lukem if test "$k" -eq 1 ; then
4134 1.1 lukem # The first file doesn't have a previous command to add.
4135 1.1 lukem eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4136 1.1 lukem else
4137 1.1 lukem # All subsequent reloadable object files will link in
4138 1.1 lukem # the last one created.
4139 1.1 lukem eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4140 1.1 lukem fi
4141 1.1 lukem last_robj=$output_objdir/$output_la-${k}.$objext
4142 1.1 lukem k=`expr $k + 1`
4143 1.1 lukem output=$output_objdir/$output_la-${k}.$objext
4144 1.1 lukem objlist=$obj
4145 1.1 lukem len=1
4146 1.1 lukem fi
4147 1.1 lukem done
4148 1.1 lukem # Handle the remaining objects by creating one last
4149 1.1 lukem # reloadable object file. All subsequent reloadable object
4150 1.1 lukem # files will link in the last one created.
4151 1.1 lukem test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4152 1.1 lukem eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4153 1.1 lukem
4154 1.1 lukem if ${skipped_export-false}; then
4155 1.1 lukem $show "generating symbol list for \`$libname.la'"
4156 1.1 lukem export_symbols="$output_objdir/$libname.exp"
4157 1.1 lukem $run $rm $export_symbols
4158 1.1 lukem libobjs=$output
4159 1.1 lukem # Append the command to create the export file.
4160 1.1 lukem eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4161 1.1 lukem fi
4162 1.1 lukem
4163 1.1 lukem # Set up a command to remove the reloadable object files
4164 1.1 lukem # after they are used.
4165 1.1 lukem i=0
4166 1.1 lukem while test "$i" -lt "$k"
4167 1.1 lukem do
4168 1.1 lukem i=`expr $i + 1`
4169 1.1 lukem delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4170 1.1 lukem done
4171 1.1 lukem
4172 1.1 lukem $echo "creating a temporary reloadable object file: $output"
4173 1.1 lukem
4174 1.1 lukem # Loop through the commands generated above and execute them.
4175 1.1 lukem save_ifs="$IFS"; IFS='~'
4176 1.1 lukem for cmd in $concat_cmds; do
4177 1.1 lukem IFS="$save_ifs"
4178 1.1 lukem $show "$cmd"
4179 1.1 lukem $run eval "$cmd" || exit $?
4180 1.1 lukem done
4181 1.1 lukem IFS="$save_ifs"
4182 1.1 lukem
4183 1.1 lukem libobjs=$output
4184 1.1 lukem # Restore the value of output.
4185 1.1 lukem output=$save_output
4186 1.1 lukem
4187 1.1 lukem if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4188 1.1 lukem eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4189 1.1 lukem fi
4190 1.1 lukem # Expand the library linking commands again to reset the
4191 1.1 lukem # value of $libobjs for piecewise linking.
4192 1.1 lukem
4193 1.1 lukem # Do each of the archive commands.
4194 1.1 lukem if test "$module" = yes && test -n "$module_cmds" ; then
4195 1.1 lukem if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4196 1.1 lukem cmds=$module_expsym_cmds
4197 1.1 lukem else
4198 1.1 lukem cmds=$module_cmds
4199 1.1 lukem fi
4200 1.1 lukem else
4201 1.1 lukem if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4202 1.1 lukem cmds=$archive_expsym_cmds
4203 1.1 lukem else
4204 1.1 lukem cmds=$archive_cmds
4205 1.1 lukem fi
4206 1.1 lukem fi
4207 1.1 lukem
4208 1.1 lukem # Append the command to remove the reloadable object files
4209 1.1 lukem # to the just-reset $cmds.
4210 1.1 lukem eval cmds=\"\$cmds~\$rm $delfiles\"
4211 1.1 lukem fi
4212 1.1 lukem save_ifs="$IFS"; IFS='~'
4213 1.1 lukem for cmd in $cmds; do
4214 1.1 lukem IFS="$save_ifs"
4215 1.1 lukem eval cmd=\"$cmd\"
4216 1.1 lukem $show "$cmd"
4217 1.1 lukem $run eval "$cmd" || {
4218 1.1 lukem lt_exit=$?
4219 1.1 lukem
4220 1.1 lukem # Restore the uninstalled library and exit
4221 1.1 lukem if test "$mode" = relink; then
4222 1.1 lukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4223 1.1 lukem fi
4224 1.1 lukem
4225 1.1 lukem exit $lt_exit
4226 1.1 lukem }
4227 1.1 lukem done
4228 1.1 lukem IFS="$save_ifs"
4229 1.1 lukem
4230 1.1 lukem # Restore the uninstalled library and exit
4231 1.1 lukem if test "$mode" = relink; then
4232 1.1 lukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4233 1.1 lukem
4234 1.1 lukem if test -n "$convenience"; then
4235 1.1 lukem if test -z "$whole_archive_flag_spec"; then
4236 1.1 lukem $show "${rm}r $gentop"
4237 1.1 lukem $run ${rm}r "$gentop"
4238 1.1 lukem fi
4239 1.1 lukem fi
4240 1.1 lukem
4241 1.1 lukem exit $EXIT_SUCCESS
4242 1.1 lukem fi
4243 1.1 lukem
4244 1.1 lukem # Create links to the real library.
4245 1.1 lukem for linkname in $linknames; do
4246 1.1 lukem if test "$realname" != "$linkname"; then
4247 1.1 lukem $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4248 1.1 lukem $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4249 1.1 lukem fi
4250 1.1 lukem done
4251 1.1 lukem
4252 1.1 lukem # If -module or -export-dynamic was specified, set the dlname.
4253 1.1 lukem if test "$module" = yes || test "$export_dynamic" = yes; then
4254 1.1 lukem # On all known operating systems, these are identical.
4255 1.1 lukem dlname="$soname"
4256 1.1 lukem fi
4257 1.1 lukem fi
4258 1.1 lukem ;;
4259 1.1 lukem
4260 1.1 lukem obj)
4261 1.1 lukem if test -n "$deplibs"; then
4262 1.1 lukem $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4263 1.1 lukem fi
4264 1.1 lukem
4265 1.1 lukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4266 1.1 lukem $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4267 1.1 lukem fi
4268 1.1 lukem
4269 1.1 lukem if test -n "$rpath"; then
4270 1.1 lukem $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4271 1.1 lukem fi
4272 1.1 lukem
4273 1.1 lukem if test -n "$xrpath"; then
4274 1.1 lukem $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4275 1.1 lukem fi
4276 1.1 lukem
4277 1.1 lukem if test -n "$vinfo"; then
4278 1.1 lukem $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4279 1.1 lukem fi
4280 1.1 lukem
4281 1.1 lukem if test -n "$release"; then
4282 1.1 lukem $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4283 1.1 lukem fi
4284 1.1 lukem
4285 1.1 lukem case $output in
4286 1.1 lukem *.lo)
4287 1.1 lukem if test -n "$objs$old_deplibs"; then
4288 1.1 lukem $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4289 1.1 lukem exit $EXIT_FAILURE
4290 1.1 lukem fi
4291 1.1 lukem libobj="$output"
4292 1.1 lukem obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4293 1.1 lukem ;;
4294 1.1 lukem *)
4295 1.1 lukem libobj=
4296 1.1 lukem obj="$output"
4297 1.1 lukem ;;
4298 1.1 lukem esac
4299 1.1 lukem
4300 1.1 lukem # Delete the old objects.
4301 1.1 lukem $run $rm $obj $libobj
4302 1.1 lukem
4303 1.1 lukem # Objects from convenience libraries. This assumes
4304 1.1 lukem # single-version convenience libraries. Whenever we create
4305 1.1 lukem # different ones for PIC/non-PIC, this we'll have to duplicate
4306 1.1 lukem # the extraction.
4307 1.1 lukem reload_conv_objs=
4308 1.1 lukem gentop=
4309 1.1 lukem # reload_cmds runs $LD directly, so let us get rid of
4310 1.1 lukem # -Wl from whole_archive_flag_spec
4311 1.1 lukem wl=
4312 1.1 lukem
4313 1.1 lukem if test -n "$convenience"; then
4314 1.1 lukem if test -n "$whole_archive_flag_spec"; then
4315 1.1 lukem eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4316 1.1 lukem else
4317 1.1 lukem gentop="$output_objdir/${obj}x"
4318 1.1 lukem generated="$generated $gentop"
4319 1.1 lukem
4320 1.1 lukem func_extract_archives $gentop $convenience
4321 1.1 lukem reload_conv_objs="$reload_objs $func_extract_archives_result"
4322 1.1 lukem fi
4323 1.1 lukem fi
4324 1.1 lukem
4325 1.1 lukem # Create the old-style object.
4326 1.1 lukem reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4327 1.1 lukem
4328 1.1 lukem output="$obj"
4329 1.1 lukem cmds=$reload_cmds
4330 1.1 lukem save_ifs="$IFS"; IFS='~'
4331 1.1 lukem for cmd in $cmds; do
4332 1.1 lukem IFS="$save_ifs"
4333 1.1 lukem eval cmd=\"$cmd\"
4334 1.1 lukem $show "$cmd"
4335 1.1 lukem $run eval "$cmd" || exit $?
4336 1.1 lukem done
4337 1.1 lukem IFS="$save_ifs"
4338 1.1 lukem
4339 1.1 lukem # Exit if we aren't doing a library object file.
4340 1.1 lukem if test -z "$libobj"; then
4341 1.1 lukem if test -n "$gentop"; then
4342 1.1 lukem $show "${rm}r $gentop"
4343 1.1 lukem $run ${rm}r $gentop
4344 1.1 lukem fi
4345 1.1 lukem
4346 1.1 lukem exit $EXIT_SUCCESS
4347 1.1 lukem fi
4348 1.1 lukem
4349 1.1 lukem if test "$build_libtool_libs" != yes; then
4350 1.1 lukem if test -n "$gentop"; then
4351 1.1 lukem $show "${rm}r $gentop"
4352 1.1 lukem $run ${rm}r $gentop
4353 1.1 lukem fi
4354 1.1 lukem
4355 1.1 lukem # Create an invalid libtool object if no PIC, so that we don't
4356 1.1 lukem # accidentally link it into a program.
4357 1.1 lukem # $show "echo timestamp > $libobj"
4358 1.1 lukem # $run eval "echo timestamp > $libobj" || exit $?
4359 1.1 lukem exit $EXIT_SUCCESS
4360 1.1 lukem fi
4361 1.1 lukem
4362 1.1 lukem if test -n "$pic_flag" || test "$pic_mode" != default; then
4363 1.1 lukem # Only do commands if we really have different PIC objects.
4364 1.1 lukem reload_objs="$libobjs $reload_conv_objs"
4365 1.1 lukem output="$libobj"
4366 1.1 lukem cmds=$reload_cmds
4367 1.1 lukem save_ifs="$IFS"; IFS='~'
4368 1.1 lukem for cmd in $cmds; do
4369 1.1 lukem IFS="$save_ifs"
4370 1.1 lukem eval cmd=\"$cmd\"
4371 1.1 lukem $show "$cmd"
4372 1.1 lukem $run eval "$cmd" || exit $?
4373 1.1 lukem done
4374 1.1 lukem IFS="$save_ifs"
4375 1.1 lukem fi
4376 1.1 lukem
4377 1.1 lukem if test -n "$gentop"; then
4378 1.1 lukem $show "${rm}r $gentop"
4379 1.1 lukem $run ${rm}r $gentop
4380 1.1 lukem fi
4381 1.1 lukem
4382 1.1 lukem exit $EXIT_SUCCESS
4383 1.1 lukem ;;
4384 1.1 lukem
4385 1.1 lukem prog)
4386 1.1 lukem case $host in
4387 1.1 lukem *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4388 1.1 lukem esac
4389 1.1 lukem if test -n "$vinfo"; then
4390 1.1 lukem $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4391 1.1 lukem fi
4392 1.1 lukem
4393 1.1 lukem if test -n "$release"; then
4394 1.1 lukem $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4395 1.1 lukem fi
4396 1.1 lukem
4397 1.1 lukem if test "$preload" = yes; then
4398 1.1 lukem if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4399 1.1 lukem test "$dlopen_self_static" = unknown; then
4400 1.1 lukem $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4401 1.1 lukem fi
4402 1.1 lukem fi
4403 1.1 lukem
4404 1.1 lukem case $host in
4405 1.1 lukem *-*-rhapsody* | *-*-darwin1.[012])
4406 1.1 lukem # On Rhapsody replace the C library is the System framework
4407 1.1 lukem compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4408 1.1 lukem finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4409 1.1 lukem ;;
4410 1.1 lukem esac
4411 1.1 lukem
4412 1.1 lukem case $host in
4413 1.1 lukem *darwin*)
4414 1.1 lukem # Don't allow lazy linking, it breaks C++ global constructors
4415 1.1 lukem if test "$tagname" = CXX ; then
4416 1.1 lukem compile_command="$compile_command ${wl}-bind_at_load"
4417 1.1 lukem finalize_command="$finalize_command ${wl}-bind_at_load"
4418 1.1 lukem fi
4419 1.1 lukem ;;
4420 1.1 lukem esac
4421 1.1 lukem
4422 1.1 lukem
4423 1.1 lukem # move library search paths that coincide with paths to not yet
4424 1.1 lukem # installed libraries to the beginning of the library search list
4425 1.1 lukem new_libs=
4426 1.1 lukem for path in $notinst_path; do
4427 1.1 lukem case " $new_libs " in
4428 1.1 lukem *" -L$path/$objdir "*) ;;
4429 1.1 lukem *)
4430 1.1 lukem case " $compile_deplibs " in
4431 1.1 lukem *" -L$path/$objdir "*)
4432 1.1 lukem new_libs="$new_libs -L$path/$objdir" ;;
4433 1.1 lukem esac
4434 1.1 lukem ;;
4435 1.1 lukem esac
4436 1.1 lukem done
4437 1.1 lukem for deplib in $compile_deplibs; do
4438 1.1 lukem case $deplib in
4439 1.1 lukem -L*)
4440 1.1 lukem case " $new_libs " in
4441 1.1 lukem *" $deplib "*) ;;
4442 1.1 lukem *) new_libs="$new_libs $deplib" ;;
4443 1.1 lukem esac
4444 1.1 lukem ;;
4445 1.1 lukem *) new_libs="$new_libs $deplib" ;;
4446 1.1 lukem esac
4447 1.1 lukem done
4448 1.1 lukem compile_deplibs="$new_libs"
4449 1.1 lukem
4450 1.1 lukem
4451 1.1 lukem compile_command="$compile_command $compile_deplibs"
4452 1.1 lukem finalize_command="$finalize_command $finalize_deplibs"
4453 1.1 lukem
4454 1.1 lukem if test -n "$rpath$xrpath"; then
4455 1.1 lukem # If the user specified any rpath flags, then add them.
4456 1.1 lukem for libdir in $rpath $xrpath; do
4457 1.1 lukem # This is the magic to use -rpath.
4458 1.1 lukem case "$finalize_rpath " in
4459 1.1 lukem *" $libdir "*) ;;
4460 1.1 lukem *) finalize_rpath="$finalize_rpath $libdir" ;;
4461 1.1 lukem esac
4462 1.1 lukem done
4463 1.1 lukem fi
4464 1.1 lukem
4465 1.1 lukem # Now hardcode the library paths
4466 1.1 lukem rpath=
4467 1.1 lukem hardcode_libdirs=
4468 1.1 lukem for libdir in $compile_rpath $finalize_rpath; do
4469 1.1 lukem if test -n "$hardcode_libdir_flag_spec"; then
4470 1.1 lukem if test -n "$hardcode_libdir_separator"; then
4471 1.1 lukem if test -z "$hardcode_libdirs"; then
4472 1.1 lukem hardcode_libdirs="$libdir"
4473 1.1 lukem else
4474 1.1 lukem # Just accumulate the unique libdirs.
4475 1.1 lukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4476 1.1 lukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4477 1.1 lukem ;;
4478 1.1 lukem *)
4479 1.1 lukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4480 1.1 lukem ;;
4481 1.1 lukem esac
4482 1.1 lukem fi
4483 1.1 lukem else
4484 1.1 lukem eval flag=\"$hardcode_libdir_flag_spec\"
4485 1.1 lukem rpath="$rpath $flag"
4486 1.1 lukem fi
4487 1.1 lukem elif test -n "$runpath_var"; then
4488 1.1 lukem case "$perm_rpath " in
4489 1.1 lukem *" $libdir "*) ;;
4490 1.1 lukem *) perm_rpath="$perm_rpath $libdir" ;;
4491 1.1 lukem esac
4492 1.1 lukem fi
4493 1.1 lukem case $host in
4494 1.1 lukem *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4495 1.1 lukem testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4496 1.1 lukem case :$dllsearchpath: in
4497 1.1 lukem *":$libdir:"*) ;;
4498 1.1 lukem *) dllsearchpath="$dllsearchpath:$libdir";;
4499 1.1 lukem esac
4500 1.1 lukem case :$dllsearchpath: in
4501 1.1 lukem *":$testbindir:"*) ;;
4502 1.1 lukem *) dllsearchpath="$dllsearchpath:$testbindir";;
4503 1.1 lukem esac
4504 1.1 lukem ;;
4505 1.1 lukem esac
4506 1.1 lukem done
4507 1.1 lukem # Substitute the hardcoded libdirs into the rpath.
4508 1.1 lukem if test -n "$hardcode_libdir_separator" &&
4509 1.1 lukem test -n "$hardcode_libdirs"; then
4510 1.1 lukem libdir="$hardcode_libdirs"
4511 1.1 lukem eval rpath=\" $hardcode_libdir_flag_spec\"
4512 1.1 lukem fi
4513 1.1 lukem compile_rpath="$rpath"
4514 1.1 lukem
4515 1.1 lukem rpath=
4516 1.1 lukem hardcode_libdirs=
4517 1.1 lukem for libdir in $finalize_rpath; do
4518 1.1 lukem if test -n "$hardcode_libdir_flag_spec"; then
4519 1.1 lukem if test -n "$hardcode_libdir_separator"; then
4520 1.1 lukem if test -z "$hardcode_libdirs"; then
4521 1.1 lukem hardcode_libdirs="$libdir"
4522 1.1 lukem else
4523 1.1 lukem # Just accumulate the unique libdirs.
4524 1.1 lukem case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4525 1.1 lukem *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4526 1.1 lukem ;;
4527 1.1 lukem *)
4528 1.1 lukem hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4529 1.1 lukem ;;
4530 1.1 lukem esac
4531 1.1 lukem fi
4532 1.1 lukem else
4533 1.1 lukem eval flag=\"$hardcode_libdir_flag_spec\"
4534 1.1 lukem rpath="$rpath $flag"
4535 1.1 lukem fi
4536 1.1 lukem elif test -n "$runpath_var"; then
4537 1.1 lukem case "$finalize_perm_rpath " in
4538 1.1 lukem *" $libdir "*) ;;
4539 1.1 lukem *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4540 1.1 lukem esac
4541 1.1 lukem fi
4542 1.1 lukem done
4543 1.1 lukem # Substitute the hardcoded libdirs into the rpath.
4544 1.1 lukem if test -n "$hardcode_libdir_separator" &&
4545 1.1 lukem test -n "$hardcode_libdirs"; then
4546 1.1 lukem libdir="$hardcode_libdirs"
4547 1.1 lukem eval rpath=\" $hardcode_libdir_flag_spec\"
4548 1.1 lukem fi
4549 1.1 lukem finalize_rpath="$rpath"
4550 1.1 lukem
4551 1.1 lukem if test -n "$libobjs" && test "$build_old_libs" = yes; then
4552 1.1 lukem # Transform all the library objects into standard objects.
4553 1.1 lukem compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4554 1.1 lukem finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4555 1.1 lukem fi
4556 1.1 lukem
4557 1.1 lukem dlsyms=
4558 1.1 lukem if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4559 1.1 lukem if test -n "$NM" && test -n "$global_symbol_pipe"; then
4560 1.1 lukem dlsyms="${outputname}S.c"
4561 1.1 lukem else
4562 1.1 lukem $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4563 1.1 lukem fi
4564 1.1 lukem fi
4565 1.1 lukem
4566 1.1 lukem if test -n "$dlsyms"; then
4567 1.1 lukem case $dlsyms in
4568 1.1 lukem "") ;;
4569 1.1 lukem *.c)
4570 1.1 lukem # Discover the nlist of each of the dlfiles.
4571 1.1 lukem nlist="$output_objdir/${outputname}.nm"
4572 1.1 lukem
4573 1.1 lukem $show "$rm $nlist ${nlist}S ${nlist}T"
4574 1.1 lukem $run $rm "$nlist" "${nlist}S" "${nlist}T"
4575 1.1 lukem
4576 1.1 lukem # Parse the name list into a source file.
4577 1.1 lukem $show "creating $output_objdir/$dlsyms"
4578 1.1 lukem
4579 1.1 lukem test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4580 1.1 lukem /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4581 1.1 lukem /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4582 1.1 lukem
4583 1.1 lukem #ifdef __cplusplus
4584 1.1 lukem extern \"C\" {
4585 1.1 lukem #endif
4586 1.1 lukem
4587 1.1 lukem /* Prevent the only kind of declaration conflicts we can make. */
4588 1.1 lukem #define lt_preloaded_symbols some_other_symbol
4589 1.1 lukem
4590 1.1 lukem /* External symbol declarations for the compiler. */\
4591 1.1 lukem "
4592 1.1 lukem
4593 1.1 lukem if test "$dlself" = yes; then
4594 1.1 lukem $show "generating symbol list for \`$output'"
4595 1.1 lukem
4596 1.1 lukem test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4597 1.1 lukem
4598 1.1 lukem # Add our own program objects to the symbol list.
4599 1.1 lukem progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4600 1.1 lukem for arg in $progfiles; do
4601 1.1 lukem $show "extracting global C symbols from \`$arg'"
4602 1.1 lukem $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4603 1.1 lukem done
4604 1.1 lukem
4605 1.1 lukem if test -n "$exclude_expsyms"; then
4606 1.1 lukem $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4607 1.1 lukem $run eval '$mv "$nlist"T "$nlist"'
4608 1.1 lukem fi
4609 1.1 lukem
4610 1.1 lukem if test -n "$export_symbols_regex"; then
4611 1.1 lukem $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4612 1.1 lukem $run eval '$mv "$nlist"T "$nlist"'
4613 1.1 lukem fi
4614 1.1 lukem
4615 1.1 lukem # Prepare the list of exported symbols
4616 1.1 lukem if test -z "$export_symbols"; then
4617 1.1 lukem export_symbols="$output_objdir/$outputname.exp"
4618 1.1 lukem $run $rm $export_symbols
4619 1.1 lukem $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4620 1.1 lukem case $host in
4621 1.1 lukem *cygwin* | *mingw* )
4622 1.1 lukem $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4623 1.1 lukem $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4624 1.1 lukem ;;
4625 1.1 lukem esac
4626 1.1 lukem else
4627 1.1 lukem $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4628 1.1 lukem $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4629 1.1 lukem $run eval 'mv "$nlist"T "$nlist"'
4630 1.1 lukem case $host in
4631 1.1 lukem *cygwin* | *mingw* )
4632 1.1 lukem $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4633 1.1 lukem $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4634 1.1 lukem ;;
4635 1.1 lukem esac
4636 1.1 lukem fi
4637 1.1 lukem fi
4638 1.1 lukem
4639 1.1 lukem for arg in $dlprefiles; do
4640 1.1 lukem $show "extracting global C symbols from \`$arg'"
4641 1.1 lukem name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4642 1.1 lukem $run eval '$echo ": $name " >> "$nlist"'
4643 1.1 lukem $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4644 1.1 lukem done
4645 1.1 lukem
4646 1.1 lukem if test -z "$run"; then
4647 1.1 lukem # Make sure we have at least an empty file.
4648 1.1 lukem test -f "$nlist" || : > "$nlist"
4649 1.1 lukem
4650 1.1 lukem if test -n "$exclude_expsyms"; then
4651 1.1 lukem $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4652 1.1 lukem $mv "$nlist"T "$nlist"
4653 1.1 lukem fi
4654 1.1 lukem
4655 1.1 lukem # Try sorting and uniquifying the output.
4656 1.1 lukem if grep -v "^: " < "$nlist" |
4657 1.1 lukem if sort -k 3 </dev/null >/dev/null 2>&1; then
4658 1.1 lukem sort -k 3
4659 1.1 lukem else
4660 1.1 lukem sort +2
4661 1.1 lukem fi |
4662 1.1 lukem uniq > "$nlist"S; then
4663 1.1 lukem :
4664 1.1 lukem else
4665 1.1 lukem grep -v "^: " < "$nlist" > "$nlist"S
4666 1.1 lukem fi
4667 1.1 lukem
4668 1.1 lukem if test -f "$nlist"S; then
4669 1.1 lukem eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4670 1.1 lukem else
4671 1.1 lukem $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4672 1.1 lukem fi
4673 1.1 lukem
4674 1.1 lukem $echo >> "$output_objdir/$dlsyms" "\
4675 1.1 lukem
4676 1.1 lukem #undef lt_preloaded_symbols
4677 1.1 lukem
4678 1.1 lukem #if defined (__STDC__) && __STDC__
4679 1.1 lukem # define lt_ptr void *
4680 1.1 lukem #else
4681 1.1 lukem # define lt_ptr char *
4682 1.1 lukem # define const
4683 1.1 lukem #endif
4684 1.1 lukem
4685 1.1 lukem /* The mapping between symbol names and symbols. */
4686 1.1 lukem "
4687 1.1 lukem
4688 1.1 lukem case $host in
4689 1.1 lukem *cygwin* | *mingw* )
4690 1.1 lukem $echo >> "$output_objdir/$dlsyms" "\
4691 1.1 lukem /* DATA imports from DLLs on WIN32 can't be const, because
4692 1.1 lukem runtime relocations are performed -- see ld's documentation
4693 1.1 lukem on pseudo-relocs */
4694 1.1 lukem struct {
4695 1.1 lukem "
4696 1.1 lukem ;;
4697 1.1 lukem * )
4698 1.1 lukem $echo >> "$output_objdir/$dlsyms" "\
4699 1.1 lukem const struct {
4700 1.1 lukem "
4701 1.1 lukem ;;
4702 1.1 lukem esac
4703 1.1 lukem
4704 1.1 lukem
4705 1.1 lukem $echo >> "$output_objdir/$dlsyms" "\
4706 1.1 lukem const char *name;
4707 1.1 lukem lt_ptr address;
4708 1.1 lukem }
4709 1.1 lukem lt_preloaded_symbols[] =
4710 1.1 lukem {\
4711 1.1 lukem "
4712 1.1 lukem
4713 1.1 lukem eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4714 1.1 lukem
4715 1.1 lukem $echo >> "$output_objdir/$dlsyms" "\
4716 1.1 lukem {0, (lt_ptr) 0}
4717 1.1 lukem };
4718 1.1 lukem
4719 1.1 lukem /* This works around a problem in FreeBSD linker */
4720 1.1 lukem #ifdef FREEBSD_WORKAROUND
4721 1.1 lukem static const void *lt_preloaded_setup() {
4722 1.1 lukem return lt_preloaded_symbols;
4723 1.1 lukem }
4724 1.1 lukem #endif
4725 1.1 lukem
4726 1.1 lukem #ifdef __cplusplus
4727 1.1 lukem }
4728 1.1 lukem #endif\
4729 1.1 lukem "
4730 1.1 lukem fi
4731 1.1 lukem
4732 1.1 lukem pic_flag_for_symtable=
4733 1.1 lukem case $host in
4734 1.1 lukem # compiling the symbol table file with pic_flag works around
4735 1.1 lukem # a FreeBSD bug that causes programs to crash when -lm is
4736 1.1 lukem # linked before any other PIC object. But we must not use
4737 1.1 lukem # pic_flag when linking with -static. The problem exists in
4738 1.1 lukem # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4739 1.1 lukem *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4740 1.1 lukem case "$compile_command " in
4741 1.1 lukem *" -static "*) ;;
4742 1.1 lukem *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4743 1.1 lukem esac;;
4744 1.1 lukem *-*-hpux*)
4745 1.1 lukem case "$compile_command " in
4746 1.1 lukem *" -static "*) ;;
4747 1.1 lukem *) pic_flag_for_symtable=" $pic_flag";;
4748 1.1 lukem esac
4749 1.1 lukem esac
4750 1.1 lukem
4751 1.1 lukem # Now compile the dynamic symbol file.
4752 1.1 lukem $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4753 1.1 lukem $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4754 1.1 lukem
4755 1.1 lukem # Clean up the generated files.
4756 1.1 lukem $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4757 1.1 lukem $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4758 1.1 lukem
4759 1.1 lukem # Transform the symbol file into the correct name.
4760 1.1 lukem case $host in
4761 1.1 lukem *cygwin* | *mingw* )
4762 1.1 lukem if test -f "$output_objdir/${outputname}.def" ; then
4763 1.1 lukem compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4764 1.1 lukem finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4765 1.1 lukem else
4766 1.1 lukem compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4767 1.1 lukem finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4768 1.1 lukem fi
4769 1.1 lukem ;;
4770 1.1 lukem * )
4771 1.1 lukem compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4772 1.1 lukem finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4773 1.1 lukem ;;
4774 1.1 lukem esac
4775 1.1 lukem ;;
4776 1.1 lukem *-*-freebsd*)
4777 1.1 lukem # FreeBSD doesn't need this...
4778 1.1 lukem ;;
4779 1.1 lukem *)
4780 1.1 lukem $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4781 1.1 lukem exit $EXIT_FAILURE
4782 1.1 lukem ;;
4783 1.1 lukem esac
4784 1.1 lukem else
4785 1.1 lukem # We keep going just in case the user didn't refer to
4786 1.1 lukem # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4787 1.1 lukem # really was required.
4788 1.1 lukem
4789 1.1 lukem # Nullify the symbol file.
4790 1.1 lukem compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4791 1.1 lukem finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4792 1.1 lukem fi
4793 1.1 lukem
4794 1.1 lukem if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4795 1.1 lukem # Replace the output file specification.
4796 1.1 lukem compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4797 1.1 lukem link_command="$compile_command$compile_rpath"
4798 1.1 lukem
4799 1.1 lukem # We have no uninstalled library dependencies, so finalize right now.
4800 1.1 lukem $show "$link_command"
4801 1.1 lukem $run eval "$link_command"
4802 1.1 lukem exit_status=$?
4803 1.1 lukem
4804 1.1 lukem # Delete the generated files.
4805 1.1 lukem if test -n "$dlsyms"; then
4806 1.1 lukem $show "$rm $output_objdir/${outputname}S.${objext}"
4807 1.1 lukem $run $rm "$output_objdir/${outputname}S.${objext}"
4808 1.1 lukem fi
4809 1.1 lukem
4810 1.1 lukem exit $exit_status
4811 1.1 lukem fi
4812 1.1 lukem
4813 1.1 lukem if test -n "$shlibpath_var"; then
4814 1.1 lukem # We should set the shlibpath_var
4815 1.1 lukem rpath=
4816 1.1 lukem for dir in $temp_rpath; do
4817 1.1 lukem case $dir in
4818 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*)
4819 1.1 lukem # Absolute path.
4820 1.1 lukem rpath="$rpath$dir:"
4821 1.1 lukem ;;
4822 1.1 lukem *)
4823 1.1 lukem # Relative path: add a thisdir entry.
4824 1.1 lukem rpath="$rpath\$thisdir/$dir:"
4825 1.1 lukem ;;
4826 1.1 lukem esac
4827 1.1 lukem done
4828 1.1 lukem temp_rpath="$rpath"
4829 1.1 lukem fi
4830 1.1 lukem
4831 1.1 lukem if test -n "$compile_shlibpath$finalize_shlibpath"; then
4832 1.1 lukem compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4833 1.1 lukem fi
4834 1.1 lukem if test -n "$finalize_shlibpath"; then
4835 1.1 lukem finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4836 1.1 lukem fi
4837 1.1 lukem
4838 1.1 lukem compile_var=
4839 1.1 lukem finalize_var=
4840 1.1 lukem if test -n "$runpath_var"; then
4841 1.1 lukem if test -n "$perm_rpath"; then
4842 1.1 lukem # We should set the runpath_var.
4843 1.1 lukem rpath=
4844 1.1 lukem for dir in $perm_rpath; do
4845 1.1 lukem rpath="$rpath$dir:"
4846 1.1 lukem done
4847 1.1 lukem compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4848 1.1 lukem fi
4849 1.1 lukem if test -n "$finalize_perm_rpath"; then
4850 1.1 lukem # We should set the runpath_var.
4851 1.1 lukem rpath=
4852 1.1 lukem for dir in $finalize_perm_rpath; do
4853 1.1 lukem rpath="$rpath$dir:"
4854 1.1 lukem done
4855 1.1 lukem finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4856 1.1 lukem fi
4857 1.1 lukem fi
4858 1.1 lukem
4859 1.1 lukem if test "$no_install" = yes; then
4860 1.1 lukem # We don't need to create a wrapper script.
4861 1.1 lukem link_command="$compile_var$compile_command$compile_rpath"
4862 1.1 lukem # Replace the output file specification.
4863 1.1 lukem link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4864 1.1 lukem # Delete the old output file.
4865 1.1 lukem $run $rm $output
4866 1.1 lukem # Link the executable and exit
4867 1.1 lukem $show "$link_command"
4868 1.1 lukem $run eval "$link_command" || exit $?
4869 1.1 lukem exit $EXIT_SUCCESS
4870 1.1 lukem fi
4871 1.1 lukem
4872 1.1 lukem if test "$hardcode_action" = relink; then
4873 1.1 lukem # Fast installation is not supported
4874 1.1 lukem link_command="$compile_var$compile_command$compile_rpath"
4875 1.1 lukem relink_command="$finalize_var$finalize_command$finalize_rpath"
4876 1.1 lukem
4877 1.1 lukem $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4878 1.1 lukem $echo "$modename: \`$output' will be relinked during installation" 1>&2
4879 1.1 lukem else
4880 1.1 lukem if test "$fast_install" != no; then
4881 1.1 lukem link_command="$finalize_var$compile_command$finalize_rpath"
4882 1.1 lukem if test "$fast_install" = yes; then
4883 1.1 lukem relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4884 1.1 lukem else
4885 1.1 lukem # fast_install is set to needless
4886 1.1 lukem relink_command=
4887 1.1 lukem fi
4888 1.1 lukem else
4889 1.1 lukem link_command="$compile_var$compile_command$compile_rpath"
4890 1.1 lukem relink_command="$finalize_var$finalize_command$finalize_rpath"
4891 1.1 lukem fi
4892 1.1 lukem fi
4893 1.1 lukem
4894 1.1 lukem # Replace the output file specification.
4895 1.1 lukem link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4896 1.1 lukem
4897 1.1 lukem # Delete the old output files.
4898 1.1 lukem $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4899 1.1 lukem
4900 1.1 lukem $show "$link_command"
4901 1.1 lukem $run eval "$link_command" || exit $?
4902 1.1 lukem
4903 1.1 lukem # Now create the wrapper script.
4904 1.1 lukem $show "creating $output"
4905 1.1 lukem
4906 1.1 lukem # Quote the relink command for shipping.
4907 1.1 lukem if test -n "$relink_command"; then
4908 1.1 lukem # Preserve any variables that may affect compiler behavior
4909 1.1 lukem for var in $variables_saved_for_relink; do
4910 1.1 lukem if eval test -z \"\${$var+set}\"; then
4911 1.1 lukem relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4912 1.1 lukem elif eval var_value=\$$var; test -z "$var_value"; then
4913 1.1 lukem relink_command="$var=; export $var; $relink_command"
4914 1.1 lukem else
4915 1.1 lukem var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4916 1.1 lukem relink_command="$var=\"$var_value\"; export $var; $relink_command"
4917 1.1 lukem fi
4918 1.1 lukem done
4919 1.1 lukem relink_command="(cd `pwd`; $relink_command)"
4920 1.1 lukem relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4921 1.1 lukem fi
4922 1.1 lukem
4923 1.1 lukem # Quote $echo for shipping.
4924 1.1 lukem if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4925 1.1 lukem case $progpath in
4926 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4927 1.1 lukem *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4928 1.1 lukem esac
4929 1.1 lukem qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4930 1.1 lukem else
4931 1.1 lukem qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4932 1.1 lukem fi
4933 1.1 lukem
4934 1.1 lukem # Only actually do things if our run command is non-null.
4935 1.1 lukem if test -z "$run"; then
4936 1.1 lukem # win32 will think the script is a binary if it has
4937 1.1 lukem # a .exe suffix, so we strip it off here.
4938 1.1 lukem case $output in
4939 1.1 lukem *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4940 1.1 lukem esac
4941 1.1 lukem # test for cygwin because mv fails w/o .exe extensions
4942 1.1 lukem case $host in
4943 1.1 lukem *cygwin*)
4944 1.1 lukem exeext=.exe
4945 1.1 lukem outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4946 1.1 lukem *) exeext= ;;
4947 1.1 lukem esac
4948 1.1 lukem case $host in
4949 1.1 lukem *cygwin* | *mingw* )
4950 1.1 lukem output_name=`basename $output`
4951 1.1 lukem output_path=`dirname $output`
4952 1.1 lukem cwrappersource="$output_path/$objdir/lt-$output_name.c"
4953 1.1 lukem cwrapper="$output_path/$output_name.exe"
4954 1.1 lukem $rm $cwrappersource $cwrapper
4955 1.1 lukem trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4956 1.1 lukem
4957 1.1 lukem cat > $cwrappersource <<EOF
4958 1.1 lukem
4959 1.1 lukem /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4960 1.1 lukem Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4961 1.1 lukem
4962 1.1 lukem The $output program cannot be directly executed until all the libtool
4963 1.1 lukem libraries that it depends on are installed.
4964 1.1 lukem
4965 1.1 lukem This wrapper executable should never be moved out of the build directory.
4966 1.1 lukem If it is, it will not operate correctly.
4967 1.1 lukem
4968 1.1 lukem Currently, it simply execs the wrapper *script* "/bin/sh $output",
4969 1.1 lukem but could eventually absorb all of the scripts functionality and
4970 1.1 lukem exec $objdir/$outputname directly.
4971 1.1 lukem */
4972 1.1 lukem EOF
4973 1.1 lukem cat >> $cwrappersource<<"EOF"
4974 1.1 lukem #include <stdio.h>
4975 1.1 lukem #include <stdlib.h>
4976 1.1 lukem #include <unistd.h>
4977 1.1 lukem #include <malloc.h>
4978 1.1 lukem #include <stdarg.h>
4979 1.1 lukem #include <assert.h>
4980 1.1 lukem #include <string.h>
4981 1.1 lukem #include <ctype.h>
4982 1.1 lukem #include <sys/stat.h>
4983 1.1 lukem
4984 1.1 lukem #if defined(PATH_MAX)
4985 1.1 lukem # define LT_PATHMAX PATH_MAX
4986 1.1 lukem #elif defined(MAXPATHLEN)
4987 1.1 lukem # define LT_PATHMAX MAXPATHLEN
4988 1.1 lukem #else
4989 1.1 lukem # define LT_PATHMAX 1024
4990 1.1 lukem #endif
4991 1.1 lukem
4992 1.1 lukem #ifndef DIR_SEPARATOR
4993 1.1 lukem # define DIR_SEPARATOR '/'
4994 1.1 lukem # define PATH_SEPARATOR ':'
4995 1.1 lukem #endif
4996 1.1 lukem
4997 1.1 lukem #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4998 1.1 lukem defined (__OS2__)
4999 1.1 lukem # define HAVE_DOS_BASED_FILE_SYSTEM
5000 1.1 lukem # ifndef DIR_SEPARATOR_2
5001 1.1 lukem # define DIR_SEPARATOR_2 '\\'
5002 1.1 lukem # endif
5003 1.1 lukem # ifndef PATH_SEPARATOR_2
5004 1.1 lukem # define PATH_SEPARATOR_2 ';'
5005 1.1 lukem # endif
5006 1.1 lukem #endif
5007 1.1 lukem
5008 1.1 lukem #ifndef DIR_SEPARATOR_2
5009 1.1 lukem # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5010 1.1 lukem #else /* DIR_SEPARATOR_2 */
5011 1.1 lukem # define IS_DIR_SEPARATOR(ch) \
5012 1.1 lukem (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5013 1.1 lukem #endif /* DIR_SEPARATOR_2 */
5014 1.1 lukem
5015 1.1 lukem #ifndef PATH_SEPARATOR_2
5016 1.1 lukem # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5017 1.1 lukem #else /* PATH_SEPARATOR_2 */
5018 1.1 lukem # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5019 1.1 lukem #endif /* PATH_SEPARATOR_2 */
5020 1.1 lukem
5021 1.1 lukem #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5022 1.1 lukem #define XFREE(stale) do { \
5023 1.1 lukem if (stale) { free ((void *) stale); stale = 0; } \
5024 1.1 lukem } while (0)
5025 1.1 lukem
5026 1.1 lukem /* -DDEBUG is fairly common in CFLAGS. */
5027 1.1 lukem #undef DEBUG
5028 1.1 lukem #if defined DEBUGWRAPPER
5029 1.1 lukem # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5030 1.1 lukem #else
5031 1.1 lukem # define DEBUG(format, ...)
5032 1.1 lukem #endif
5033 1.1 lukem
5034 1.1 lukem const char *program_name = NULL;
5035 1.1 lukem
5036 1.1 lukem void * xmalloc (size_t num);
5037 1.1 lukem char * xstrdup (const char *string);
5038 1.1 lukem const char * base_name (const char *name);
5039 1.1 lukem char * find_executable(const char *wrapper);
5040 1.1 lukem int check_executable(const char *path);
5041 1.1 lukem char * strendzap(char *str, const char *pat);
5042 1.1 lukem void lt_fatal (const char *message, ...);
5043 1.1 lukem
5044 1.1 lukem int
5045 1.1 lukem main (int argc, char *argv[])
5046 1.1 lukem {
5047 1.1 lukem char **newargz;
5048 1.1 lukem int i;
5049 1.1 lukem
5050 1.1 lukem program_name = (char *) xstrdup (base_name (argv[0]));
5051 1.1 lukem DEBUG("(main) argv[0] : %s\n",argv[0]);
5052 1.1 lukem DEBUG("(main) program_name : %s\n",program_name);
5053 1.1 lukem newargz = XMALLOC(char *, argc+2);
5054 1.1 lukem EOF
5055 1.1 lukem
5056 1.1 lukem cat >> $cwrappersource <<EOF
5057 1.1 lukem newargz[0] = (char *) xstrdup("$SHELL");
5058 1.1 lukem EOF
5059 1.1 lukem
5060 1.1 lukem cat >> $cwrappersource <<"EOF"
5061 1.1 lukem newargz[1] = find_executable(argv[0]);
5062 1.1 lukem if (newargz[1] == NULL)
5063 1.1 lukem lt_fatal("Couldn't find %s", argv[0]);
5064 1.1 lukem DEBUG("(main) found exe at : %s\n",newargz[1]);
5065 1.1 lukem /* we know the script has the same name, without the .exe */
5066 1.1 lukem /* so make sure newargz[1] doesn't end in .exe */
5067 1.1 lukem strendzap(newargz[1],".exe");
5068 1.1 lukem for (i = 1; i < argc; i++)
5069 1.1 lukem newargz[i+1] = xstrdup(argv[i]);
5070 1.1 lukem newargz[argc+1] = NULL;
5071 1.1 lukem
5072 1.1 lukem for (i=0; i<argc+1; i++)
5073 1.1 lukem {
5074 1.1 lukem DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5075 1.1 lukem ;
5076 1.1 lukem }
5077 1.1 lukem
5078 1.1 lukem EOF
5079 1.1 lukem
5080 1.1 lukem case $host_os in
5081 1.1 lukem mingw*)
5082 1.1 lukem cat >> $cwrappersource <<EOF
5083 1.1 lukem execv("$SHELL",(char const **)newargz);
5084 1.1 lukem EOF
5085 1.1 lukem ;;
5086 1.1 lukem *)
5087 1.1 lukem cat >> $cwrappersource <<EOF
5088 1.1 lukem execv("$SHELL",newargz);
5089 1.1 lukem EOF
5090 1.1 lukem ;;
5091 1.1 lukem esac
5092 1.1 lukem
5093 1.1 lukem cat >> $cwrappersource <<"EOF"
5094 1.1 lukem return 127;
5095 1.1 lukem }
5096 1.1 lukem
5097 1.1 lukem void *
5098 1.1 lukem xmalloc (size_t num)
5099 1.1 lukem {
5100 1.1 lukem void * p = (void *) malloc (num);
5101 1.1 lukem if (!p)
5102 1.1 lukem lt_fatal ("Memory exhausted");
5103 1.1 lukem
5104 1.1 lukem return p;
5105 1.1 lukem }
5106 1.1 lukem
5107 1.1 lukem char *
5108 1.1 lukem xstrdup (const char *string)
5109 1.1 lukem {
5110 1.1 lukem return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5111 1.1 lukem ;
5112 1.1 lukem }
5113 1.1 lukem
5114 1.1 lukem const char *
5115 1.1 lukem base_name (const char *name)
5116 1.1 lukem {
5117 1.1 lukem const char *base;
5118 1.1 lukem
5119 1.1 lukem #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5120 1.1 lukem /* Skip over the disk name in MSDOS pathnames. */
5121 1.1 lukem if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5122 1.1 lukem name += 2;
5123 1.1 lukem #endif
5124 1.1 lukem
5125 1.1 lukem for (base = name; *name; name++)
5126 1.1 lukem if (IS_DIR_SEPARATOR (*name))
5127 1.1 lukem base = name + 1;
5128 1.1 lukem return base;
5129 1.1 lukem }
5130 1.1 lukem
5131 1.1 lukem int
5132 1.1 lukem check_executable(const char * path)
5133 1.1 lukem {
5134 1.1 lukem struct stat st;
5135 1.1 lukem
5136 1.1 lukem DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5137 1.1 lukem if ((!path) || (!*path))
5138 1.1 lukem return 0;
5139 1.1 lukem
5140 1.1 lukem if ((stat (path, &st) >= 0) &&
5141 1.1 lukem (
5142 1.1 lukem /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5143 1.1 lukem #if defined (S_IXOTH)
5144 1.1 lukem ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5145 1.1 lukem #endif
5146 1.1 lukem #if defined (S_IXGRP)
5147 1.1 lukem ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5148 1.1 lukem #endif
5149 1.1 lukem ((st.st_mode & S_IXUSR) == S_IXUSR))
5150 1.1 lukem )
5151 1.1 lukem return 1;
5152 1.1 lukem else
5153 1.1 lukem return 0;
5154 1.1 lukem }
5155 1.1 lukem
5156 1.1 lukem /* Searches for the full path of the wrapper. Returns
5157 1.1 lukem newly allocated full path name if found, NULL otherwise */
5158 1.1 lukem char *
5159 1.1 lukem find_executable (const char* wrapper)
5160 1.1 lukem {
5161 1.1 lukem int has_slash = 0;
5162 1.1 lukem const char* p;
5163 1.1 lukem const char* p_next;
5164 1.1 lukem /* static buffer for getcwd */
5165 1.1 lukem char tmp[LT_PATHMAX + 1];
5166 1.1 lukem int tmp_len;
5167 1.1 lukem char* concat_name;
5168 1.1 lukem
5169 1.1 lukem DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5170 1.1 lukem
5171 1.1 lukem if ((wrapper == NULL) || (*wrapper == '\0'))
5172 1.1 lukem return NULL;
5173 1.1 lukem
5174 1.1 lukem /* Absolute path? */
5175 1.1 lukem #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5176 1.1 lukem if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5177 1.1 lukem {
5178 1.1 lukem concat_name = xstrdup (wrapper);
5179 1.1 lukem if (check_executable(concat_name))
5180 1.1 lukem return concat_name;
5181 1.1 lukem XFREE(concat_name);
5182 1.1 lukem }
5183 1.1 lukem else
5184 1.1 lukem {
5185 1.1 lukem #endif
5186 1.1 lukem if (IS_DIR_SEPARATOR (wrapper[0]))
5187 1.1 lukem {
5188 1.1 lukem concat_name = xstrdup (wrapper);
5189 1.1 lukem if (check_executable(concat_name))
5190 1.1 lukem return concat_name;
5191 1.1 lukem XFREE(concat_name);
5192 1.1 lukem }
5193 1.1 lukem #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5194 1.1 lukem }
5195 1.1 lukem #endif
5196 1.1 lukem
5197 1.1 lukem for (p = wrapper; *p; p++)
5198 1.1 lukem if (*p == '/')
5199 1.1 lukem {
5200 1.1 lukem has_slash = 1;
5201 1.1 lukem break;
5202 1.1 lukem }
5203 1.1 lukem if (!has_slash)
5204 1.1 lukem {
5205 1.1 lukem /* no slashes; search PATH */
5206 1.1 lukem const char* path = getenv ("PATH");
5207 1.1 lukem if (path != NULL)
5208 1.1 lukem {
5209 1.1 lukem for (p = path; *p; p = p_next)
5210 1.1 lukem {
5211 1.1 lukem const char* q;
5212 1.1 lukem size_t p_len;
5213 1.1 lukem for (q = p; *q; q++)
5214 1.1 lukem if (IS_PATH_SEPARATOR(*q))
5215 1.1 lukem break;
5216 1.1 lukem p_len = q - p;
5217 1.1 lukem p_next = (*q == '\0' ? q : q + 1);
5218 1.1 lukem if (p_len == 0)
5219 1.1 lukem {
5220 1.1 lukem /* empty path: current directory */
5221 1.1 lukem if (getcwd (tmp, LT_PATHMAX) == NULL)
5222 1.1 lukem lt_fatal ("getcwd failed");
5223 1.1 lukem tmp_len = strlen(tmp);
5224 1.1 lukem concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5225 1.1 lukem memcpy (concat_name, tmp, tmp_len);
5226 1.1 lukem concat_name[tmp_len] = '/';
5227 1.1 lukem strcpy (concat_name + tmp_len + 1, wrapper);
5228 1.1 lukem }
5229 1.1 lukem else
5230 1.1 lukem {
5231 1.1 lukem concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5232 1.1 lukem memcpy (concat_name, p, p_len);
5233 1.1 lukem concat_name[p_len] = '/';
5234 1.1 lukem strcpy (concat_name + p_len + 1, wrapper);
5235 1.1 lukem }
5236 1.1 lukem if (check_executable(concat_name))
5237 1.1 lukem return concat_name;
5238 1.1 lukem XFREE(concat_name);
5239 1.1 lukem }
5240 1.1 lukem }
5241 1.1 lukem /* not found in PATH; assume curdir */
5242 1.1 lukem }
5243 1.1 lukem /* Relative path | not found in path: prepend cwd */
5244 1.1 lukem if (getcwd (tmp, LT_PATHMAX) == NULL)
5245 1.1 lukem lt_fatal ("getcwd failed");
5246 1.1 lukem tmp_len = strlen(tmp);
5247 1.1 lukem concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5248 1.1 lukem memcpy (concat_name, tmp, tmp_len);
5249 1.1 lukem concat_name[tmp_len] = '/';
5250 1.1 lukem strcpy (concat_name + tmp_len + 1, wrapper);
5251 1.1 lukem
5252 1.1 lukem if (check_executable(concat_name))
5253 1.1 lukem return concat_name;
5254 1.1 lukem XFREE(concat_name);
5255 1.1 lukem return NULL;
5256 1.1 lukem }
5257 1.1 lukem
5258 1.1 lukem char *
5259 1.1 lukem strendzap(char *str, const char *pat)
5260 1.1 lukem {
5261 1.1 lukem size_t len, patlen;
5262 1.1 lukem
5263 1.1 lukem assert(str != NULL);
5264 1.1 lukem assert(pat != NULL);
5265 1.1 lukem
5266 1.1 lukem len = strlen(str);
5267 1.1 lukem patlen = strlen(pat);
5268 1.1 lukem
5269 1.1 lukem if (patlen <= len)
5270 1.1 lukem {
5271 1.1 lukem str += len - patlen;
5272 1.1 lukem if (strcmp(str, pat) == 0)
5273 1.1 lukem *str = '\0';
5274 1.1 lukem }
5275 1.1 lukem return str;
5276 1.1 lukem }
5277 1.1 lukem
5278 1.1 lukem static void
5279 1.1 lukem lt_error_core (int exit_status, const char * mode,
5280 1.1 lukem const char * message, va_list ap)
5281 1.1 lukem {
5282 1.1 lukem fprintf (stderr, "%s: %s: ", program_name, mode);
5283 1.1 lukem vfprintf (stderr, message, ap);
5284 1.1 lukem fprintf (stderr, ".\n");
5285 1.1 lukem
5286 1.1 lukem if (exit_status >= 0)
5287 1.1 lukem exit (exit_status);
5288 1.1 lukem }
5289 1.1 lukem
5290 1.1 lukem void
5291 1.1 lukem lt_fatal (const char *message, ...)
5292 1.1 lukem {
5293 1.1 lukem va_list ap;
5294 1.1 lukem va_start (ap, message);
5295 1.1 lukem lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5296 1.1 lukem va_end (ap);
5297 1.1 lukem }
5298 1.1 lukem EOF
5299 1.1 lukem # we should really use a build-platform specific compiler
5300 1.1 lukem # here, but OTOH, the wrappers (shell script and this C one)
5301 1.1 lukem # are only useful if you want to execute the "real" binary.
5302 1.1 lukem # Since the "real" binary is built for $host, then this
5303 1.1 lukem # wrapper might as well be built for $host, too.
5304 1.1 lukem $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5305 1.1 lukem ;;
5306 1.1 lukem esac
5307 1.1 lukem $rm $output
5308 1.1 lukem trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5309 1.1 lukem
5310 1.1 lukem $echo > $output "\
5311 1.1 lukem #! $SHELL
5312 1.1 lukem
5313 1.1 lukem # $output - temporary wrapper script for $objdir/$outputname
5314 1.1 lukem # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5315 1.1 lukem #
5316 1.1 lukem # The $output program cannot be directly executed until all the libtool
5317 1.1 lukem # libraries that it depends on are installed.
5318 1.1 lukem #
5319 1.1 lukem # This wrapper script should never be moved out of the build directory.
5320 1.1 lukem # If it is, it will not operate correctly.
5321 1.1 lukem
5322 1.1 lukem # Sed substitution that helps us do robust quoting. It backslashifies
5323 1.1 lukem # metacharacters that are still active within double-quoted strings.
5324 1.1 lukem Xsed='${SED} -e 1s/^X//'
5325 1.1 lukem sed_quote_subst='$sed_quote_subst'
5326 1.1 lukem
5327 1.1 lukem # The HP-UX ksh and POSIX shell print the target directory to stdout
5328 1.1 lukem # if CDPATH is set.
5329 1.1 lukem (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5330 1.1 lukem
5331 1.1 lukem relink_command=\"$relink_command\"
5332 1.1 lukem
5333 1.1 lukem # This environment variable determines our operation mode.
5334 1.1 lukem if test \"\$libtool_install_magic\" = \"$magic\"; then
5335 1.1 lukem # install mode needs the following variable:
5336 1.1 lukem notinst_deplibs='$notinst_deplibs'
5337 1.1 lukem else
5338 1.1 lukem # When we are sourced in execute mode, \$file and \$echo are already set.
5339 1.1 lukem if test \"\$libtool_execute_magic\" != \"$magic\"; then
5340 1.1 lukem echo=\"$qecho\"
5341 1.1 lukem file=\"\$0\"
5342 1.1 lukem # Make sure echo works.
5343 1.1 lukem if test \"X\$1\" = X--no-reexec; then
5344 1.1 lukem # Discard the --no-reexec flag, and continue.
5345 1.1 lukem shift
5346 1.1 lukem elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5347 1.1 lukem # Yippee, \$echo works!
5348 1.1 lukem :
5349 1.1 lukem else
5350 1.1 lukem # Restart under the correct shell, and then maybe \$echo will work.
5351 1.1 lukem exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5352 1.1 lukem fi
5353 1.1 lukem fi\
5354 1.1 lukem "
5355 1.1 lukem $echo >> $output "\
5356 1.1 lukem
5357 1.1 lukem # Find the directory that this script lives in.
5358 1.1 lukem thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5359 1.1 lukem test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5360 1.1 lukem
5361 1.1 lukem # Follow symbolic links until we get to the real thisdir.
5362 1.1 lukem file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5363 1.1 lukem while test -n \"\$file\"; do
5364 1.1 lukem destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5365 1.1 lukem
5366 1.1 lukem # If there was a directory component, then change thisdir.
5367 1.1 lukem if test \"x\$destdir\" != \"x\$file\"; then
5368 1.1 lukem case \"\$destdir\" in
5369 1.1 lukem [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5370 1.1 lukem *) thisdir=\"\$thisdir/\$destdir\" ;;
5371 1.1 lukem esac
5372 1.1 lukem fi
5373 1.1 lukem
5374 1.1 lukem file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5375 1.1 lukem file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5376 1.1 lukem done
5377 1.1 lukem
5378 1.1 lukem # Try to get the absolute directory name.
5379 1.1 lukem absdir=\`cd \"\$thisdir\" && pwd\`
5380 1.1 lukem test -n \"\$absdir\" && thisdir=\"\$absdir\"
5381 1.1 lukem "
5382 1.1 lukem
5383 1.1 lukem if test "$fast_install" = yes; then
5384 1.1 lukem $echo >> $output "\
5385 1.1 lukem program=lt-'$outputname'$exeext
5386 1.1 lukem progdir=\"\$thisdir/$objdir\"
5387 1.1 lukem
5388 1.1 lukem if test ! -f \"\$progdir/\$program\" || \\
5389 1.1 lukem { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5390 1.1 lukem test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5391 1.1 lukem
5392 1.1 lukem file=\"\$\$-\$program\"
5393 1.1 lukem
5394 1.1 lukem if test ! -d \"\$progdir\"; then
5395 1.1 lukem $mkdir \"\$progdir\"
5396 1.1 lukem else
5397 1.1 lukem $rm \"\$progdir/\$file\"
5398 1.1 lukem fi"
5399 1.1 lukem
5400 1.1 lukem $echo >> $output "\
5401 1.1 lukem
5402 1.1 lukem # relink executable if necessary
5403 1.1 lukem if test -n \"\$relink_command\"; then
5404 1.1 lukem if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5405 1.1 lukem else
5406 1.1 lukem $echo \"\$relink_command_output\" >&2
5407 1.1 lukem $rm \"\$progdir/\$file\"
5408 1.1 lukem exit $EXIT_FAILURE
5409 1.1 lukem fi
5410 1.1 lukem fi
5411 1.1 lukem
5412 1.1 lukem $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5413 1.1 lukem { $rm \"\$progdir/\$program\";
5414 1.1 lukem $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5415 1.1 lukem $rm \"\$progdir/\$file\"
5416 1.1 lukem fi"
5417 1.1 lukem else
5418 1.1 lukem $echo >> $output "\
5419 1.1 lukem program='$outputname'
5420 1.1 lukem progdir=\"\$thisdir/$objdir\"
5421 1.1 lukem "
5422 1.1 lukem fi
5423 1.1 lukem
5424 1.1 lukem $echo >> $output "\
5425 1.1 lukem
5426 1.1 lukem if test -f \"\$progdir/\$program\"; then"
5427 1.1 lukem
5428 1.1 lukem # Export our shlibpath_var if we have one.
5429 1.1 lukem if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5430 1.1 lukem $echo >> $output "\
5431 1.1 lukem # Add our own library path to $shlibpath_var
5432 1.1 lukem $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5433 1.1 lukem
5434 1.1 lukem # Some systems cannot cope with colon-terminated $shlibpath_var
5435 1.1 lukem # The second colon is a workaround for a bug in BeOS R4 sed
5436 1.1 lukem $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5437 1.1 lukem
5438 1.1 lukem export $shlibpath_var
5439 1.1 lukem "
5440 1.1 lukem fi
5441 1.1 lukem
5442 1.1 lukem # fixup the dll searchpath if we need to.
5443 1.1 lukem if test -n "$dllsearchpath"; then
5444 1.1 lukem $echo >> $output "\
5445 1.1 lukem # Add the dll search path components to the executable PATH
5446 1.1 lukem PATH=$dllsearchpath:\$PATH
5447 1.1 lukem "
5448 1.1 lukem fi
5449 1.1 lukem
5450 1.1 lukem $echo >> $output "\
5451 1.1 lukem if test \"\$libtool_execute_magic\" != \"$magic\"; then
5452 1.1 lukem # Run the actual program with our arguments.
5453 1.1 lukem "
5454 1.1 lukem case $host in
5455 1.1 lukem # Backslashes separate directories on plain windows
5456 1.1 lukem *-*-mingw | *-*-os2*)
5457 1.1 lukem $echo >> $output "\
5458 1.1 lukem exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5459 1.1 lukem "
5460 1.1 lukem ;;
5461 1.1 lukem
5462 1.1 lukem *)
5463 1.1 lukem $echo >> $output "\
5464 1.1 lukem exec \"\$progdir/\$program\" \${1+\"\$@\"}
5465 1.1 lukem "
5466 1.1 lukem ;;
5467 1.1 lukem esac
5468 1.1 lukem $echo >> $output "\
5469 1.1 lukem \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5470 1.1 lukem exit $EXIT_FAILURE
5471 1.1 lukem fi
5472 1.1 lukem else
5473 1.1 lukem # The program doesn't exist.
5474 1.1 lukem \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5475 1.1 lukem \$echo \"This script is just a wrapper for \$program.\" 1>&2
5476 1.1 lukem $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5477 1.1 lukem exit $EXIT_FAILURE
5478 1.1 lukem fi
5479 1.1 lukem fi\
5480 1.1 lukem "
5481 1.1 lukem chmod +x $output
5482 1.1 lukem fi
5483 1.1 lukem exit $EXIT_SUCCESS
5484 1.1 lukem ;;
5485 1.1 lukem esac
5486 1.1 lukem
5487 1.1 lukem # See if we need to build an old-fashioned archive.
5488 1.1 lukem for oldlib in $oldlibs; do
5489 1.1 lukem
5490 1.1 lukem if test "$build_libtool_libs" = convenience; then
5491 1.1 lukem oldobjs="$libobjs_save"
5492 1.1 lukem addlibs="$convenience"
5493 1.1 lukem build_libtool_libs=no
5494 1.1 lukem else
5495 1.1 lukem if test "$build_libtool_libs" = module; then
5496 1.1 lukem oldobjs="$libobjs_save"
5497 1.1 lukem build_libtool_libs=no
5498 1.1 lukem else
5499 1.1 lukem oldobjs="$old_deplibs $non_pic_objects"
5500 1.1 lukem fi
5501 1.1 lukem addlibs="$old_convenience"
5502 1.1 lukem fi
5503 1.1 lukem
5504 1.1 lukem if test -n "$addlibs"; then
5505 1.1 lukem gentop="$output_objdir/${outputname}x"
5506 1.1 lukem generated="$generated $gentop"
5507 1.1 lukem
5508 1.1 lukem func_extract_archives $gentop $addlibs
5509 1.1 lukem oldobjs="$oldobjs $func_extract_archives_result"
5510 1.1 lukem fi
5511 1.1 lukem
5512 1.1 lukem # Do each command in the archive commands.
5513 1.1 lukem if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5514 1.1 lukem cmds=$old_archive_from_new_cmds
5515 1.1 lukem else
5516 1.1 lukem # POSIX demands no paths to be encoded in archives. We have
5517 1.1 lukem # to avoid creating archives with duplicate basenames if we
5518 1.1 lukem # might have to extract them afterwards, e.g., when creating a
5519 1.1 lukem # static archive out of a convenience library, or when linking
5520 1.1 lukem # the entirety of a libtool archive into another (currently
5521 1.1 lukem # not supported by libtool).
5522 1.1 lukem if (for obj in $oldobjs
5523 1.1 lukem do
5524 1.1 lukem $echo "X$obj" | $Xsed -e 's%^.*/%%'
5525 1.1 lukem done | sort | sort -uc >/dev/null 2>&1); then
5526 1.1 lukem :
5527 1.1 lukem else
5528 1.1 lukem $echo "copying selected object files to avoid basename conflicts..."
5529 1.1 lukem
5530 1.1 lukem if test -z "$gentop"; then
5531 1.1 lukem gentop="$output_objdir/${outputname}x"
5532 1.1 lukem generated="$generated $gentop"
5533 1.1 lukem
5534 1.1 lukem $show "${rm}r $gentop"
5535 1.1 lukem $run ${rm}r "$gentop"
5536 1.1 lukem $show "$mkdir $gentop"
5537 1.1 lukem $run $mkdir "$gentop"
5538 1.1 lukem exit_status=$?
5539 1.1 lukem if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5540 1.1 lukem exit $exit_status
5541 1.1 lukem fi
5542 1.1 lukem fi
5543 1.1 lukem
5544 1.1 lukem save_oldobjs=$oldobjs
5545 1.1 lukem oldobjs=
5546 1.1 lukem counter=1
5547 1.1 lukem for obj in $save_oldobjs
5548 1.1 lukem do
5549 1.1 lukem objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5550 1.1 lukem case " $oldobjs " in
5551 1.1 lukem " ") oldobjs=$obj ;;
5552 1.1 lukem *[\ /]"$objbase "*)
5553 1.1 lukem while :; do
5554 1.1 lukem # Make sure we don't pick an alternate name that also
5555 1.1 lukem # overlaps.
5556 1.1 lukem newobj=lt$counter-$objbase
5557 1.1 lukem counter=`expr $counter + 1`
5558 1.1 lukem case " $oldobjs " in
5559 1.1 lukem *[\ /]"$newobj "*) ;;
5560 1.1 lukem *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5561 1.1 lukem esac
5562 1.1 lukem done
5563 1.1 lukem $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5564 1.1 lukem $run ln "$obj" "$gentop/$newobj" ||
5565 1.1 lukem $run cp "$obj" "$gentop/$newobj"
5566 1.1 lukem oldobjs="$oldobjs $gentop/$newobj"
5567 1.1 lukem ;;
5568 1.1 lukem *) oldobjs="$oldobjs $obj" ;;
5569 1.1 lukem esac
5570 1.1 lukem done
5571 1.1 lukem fi
5572 1.1 lukem
5573 1.1 lukem eval cmds=\"$old_archive_cmds\"
5574 1.1 lukem
5575 1.1 lukem if len=`expr "X$cmds" : ".*"` &&
5576 1.1 lukem test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5577 1.1 lukem cmds=$old_archive_cmds
5578 1.1 lukem else
5579 1.1 lukem # the command line is too long to link in one step, link in parts
5580 1.1 lukem $echo "using piecewise archive linking..."
5581 1.1 lukem save_RANLIB=$RANLIB
5582 1.1 lukem RANLIB=:
5583 1.1 lukem objlist=
5584 1.1 lukem concat_cmds=
5585 1.1 lukem save_oldobjs=$oldobjs
5586 1.1 lukem
5587 1.1 lukem # Is there a better way of finding the last object in the list?
5588 1.1 lukem for obj in $save_oldobjs
5589 1.1 lukem do
5590 1.1 lukem last_oldobj=$obj
5591 1.1 lukem done
5592 1.1 lukem for obj in $save_oldobjs
5593 1.1 lukem do
5594 1.1 lukem oldobjs="$objlist $obj"
5595 1.1 lukem objlist="$objlist $obj"
5596 1.1 lukem eval test_cmds=\"$old_archive_cmds\"
5597 1.1 lukem if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5598 1.1 lukem test "$len" -le "$max_cmd_len"; then
5599 1.1 lukem :
5600 1.1 lukem else
5601 1.1 lukem # the above command should be used before it gets too long
5602 1.1 lukem oldobjs=$objlist
5603 1.1 lukem if test "$obj" = "$last_oldobj" ; then
5604 1.1 lukem RANLIB=$save_RANLIB
5605 1.1 lukem fi
5606 1.1 lukem test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5607 1.1 lukem eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5608 1.1 lukem objlist=
5609 1.1 lukem fi
5610 1.1 lukem done
5611 1.1 lukem RANLIB=$save_RANLIB
5612 1.1 lukem oldobjs=$objlist
5613 1.1 lukem if test "X$oldobjs" = "X" ; then
5614 1.1 lukem eval cmds=\"\$concat_cmds\"
5615 1.1 lukem else
5616 1.1 lukem eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5617 1.1 lukem fi
5618 1.1 lukem fi
5619 1.1 lukem fi
5620 1.1 lukem save_ifs="$IFS"; IFS='~'
5621 1.1 lukem for cmd in $cmds; do
5622 1.1 lukem eval cmd=\"$cmd\"
5623 1.1 lukem IFS="$save_ifs"
5624 1.1 lukem $show "$cmd"
5625 1.1 lukem $run eval "$cmd" || exit $?
5626 1.1 lukem done
5627 1.1 lukem IFS="$save_ifs"
5628 1.1 lukem done
5629 1.1 lukem
5630 1.1 lukem if test -n "$generated"; then
5631 1.1 lukem $show "${rm}r$generated"
5632 1.1 lukem $run ${rm}r$generated
5633 1.1 lukem fi
5634 1.1 lukem
5635 1.1 lukem # Now create the libtool archive.
5636 1.1 lukem case $output in
5637 1.1 lukem *.la)
5638 1.1 lukem old_library=
5639 1.1 lukem test "$build_old_libs" = yes && old_library="$libname.$libext"
5640 1.1 lukem $show "creating $output"
5641 1.1 lukem
5642 1.1 lukem # Preserve any variables that may affect compiler behavior
5643 1.1 lukem for var in $variables_saved_for_relink; do
5644 1.1 lukem if eval test -z \"\${$var+set}\"; then
5645 1.1 lukem relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5646 1.1 lukem elif eval var_value=\$$var; test -z "$var_value"; then
5647 1.1 lukem relink_command="$var=; export $var; $relink_command"
5648 1.1 lukem else
5649 1.1 lukem var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5650 1.1 lukem relink_command="$var=\"$var_value\"; export $var; $relink_command"
5651 1.1 lukem fi
5652 1.1 lukem done
5653 1.1 lukem # Quote the link command for shipping.
5654 1.1 lukem relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5655 1.1 lukem relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5656 1.1 lukem if test "$hardcode_automatic" = yes ; then
5657 1.1 lukem relink_command=
5658 1.1 lukem fi
5659 1.1 lukem
5660 1.1 lukem
5661 1.1 lukem # Only create the output if not a dry run.
5662 1.1 lukem if test -z "$run"; then
5663 1.1 lukem for installed in no yes; do
5664 1.1 lukem if test "$installed" = yes; then
5665 1.1 lukem if test -z "$install_libdir"; then
5666 1.1 lukem break
5667 1.1 lukem fi
5668 1.1 lukem output="$output_objdir/$outputname"i
5669 1.1 lukem # Replace all uninstalled libtool libraries with the installed ones
5670 1.1 lukem newdependency_libs=
5671 1.1 lukem for deplib in $dependency_libs; do
5672 1.1 lukem case $deplib in
5673 1.1 lukem *.la)
5674 1.1 lukem name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5675 1.1 lukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5676 1.1 lukem if test -z "$libdir"; then
5677 1.1 lukem $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5678 1.1 lukem exit $EXIT_FAILURE
5679 1.1 lukem fi
5680 1.1 lukem newdependency_libs="$newdependency_libs $libdir/$name"
5681 1.1 lukem ;;
5682 1.1 lukem *) newdependency_libs="$newdependency_libs $deplib" ;;
5683 1.1 lukem esac
5684 1.1 lukem done
5685 1.1 lukem dependency_libs="$newdependency_libs"
5686 1.1 lukem newdlfiles=
5687 1.1 lukem for lib in $dlfiles; do
5688 1.1 lukem name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5689 1.1 lukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5690 1.1 lukem if test -z "$libdir"; then
5691 1.1 lukem $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5692 1.1 lukem exit $EXIT_FAILURE
5693 1.1 lukem fi
5694 1.1 lukem newdlfiles="$newdlfiles $libdir/$name"
5695 1.1 lukem done
5696 1.1 lukem dlfiles="$newdlfiles"
5697 1.1 lukem newdlprefiles=
5698 1.1 lukem for lib in $dlprefiles; do
5699 1.1 lukem name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5700 1.1 lukem eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5701 1.1 lukem if test -z "$libdir"; then
5702 1.1 lukem $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5703 1.1 lukem exit $EXIT_FAILURE
5704 1.1 lukem fi
5705 1.1 lukem newdlprefiles="$newdlprefiles $libdir/$name"
5706 1.1 lukem done
5707 1.1 lukem dlprefiles="$newdlprefiles"
5708 1.1 lukem else
5709 1.1 lukem newdlfiles=
5710 1.1 lukem for lib in $dlfiles; do
5711 1.1 lukem case $lib in
5712 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5713 1.1 lukem *) abs=`pwd`"/$lib" ;;
5714 1.1 lukem esac
5715 1.1 lukem newdlfiles="$newdlfiles $abs"
5716 1.1 lukem done
5717 1.1 lukem dlfiles="$newdlfiles"
5718 1.1 lukem newdlprefiles=
5719 1.1 lukem for lib in $dlprefiles; do
5720 1.1 lukem case $lib in
5721 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5722 1.1 lukem *) abs=`pwd`"/$lib" ;;
5723 1.1 lukem esac
5724 1.1 lukem newdlprefiles="$newdlprefiles $abs"
5725 1.1 lukem done
5726 1.1 lukem dlprefiles="$newdlprefiles"
5727 1.1 lukem fi
5728 1.1 lukem $rm $output
5729 1.1 lukem # place dlname in correct position for cygwin
5730 1.1 lukem tdlname=$dlname
5731 1.1 lukem case $host,$output,$installed,$module,$dlname in
5732 1.1 lukem *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5733 1.1 lukem esac
5734 1.1 lukem $echo > $output "\
5735 1.1 lukem # $outputname - a libtool library file
5736 1.1 lukem # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5737 1.1 lukem #
5738 1.1 lukem # Please DO NOT delete this file!
5739 1.1 lukem # It is necessary for linking the library.
5740 1.1 lukem
5741 1.1 lukem # The name that we can dlopen(3).
5742 1.1 lukem dlname='$tdlname'
5743 1.1 lukem
5744 1.1 lukem # Names of this library.
5745 1.1 lukem library_names='$library_names'
5746 1.1 lukem
5747 1.1 lukem # The name of the static archive.
5748 1.1 lukem old_library='$old_library'
5749 1.1 lukem
5750 1.1 lukem # Libraries that this one depends upon.
5751 1.1 lukem dependency_libs='$dependency_libs'
5752 1.1 lukem
5753 1.1 lukem # Version information for $libname.
5754 1.1 lukem current=$current
5755 1.1 lukem age=$age
5756 1.1 lukem revision=$revision
5757 1.1 lukem
5758 1.1 lukem # Is this an already installed library?
5759 1.1 lukem installed=$installed
5760 1.1 lukem
5761 1.1 lukem # Should we warn about portability when linking against -modules?
5762 1.1 lukem shouldnotlink=$module
5763 1.1 lukem
5764 1.1 lukem # Files to dlopen/dlpreopen
5765 1.1 lukem dlopen='$dlfiles'
5766 1.1 lukem dlpreopen='$dlprefiles'
5767 1.1 lukem
5768 1.1 lukem # Directory that this library needs to be installed in:
5769 1.1 lukem libdir='$install_libdir'"
5770 1.1 lukem if test "$installed" = no && test "$need_relink" = yes; then
5771 1.1 lukem $echo >> $output "\
5772 1.1 lukem relink_command=\"$relink_command\""
5773 1.1 lukem fi
5774 1.1 lukem done
5775 1.1 lukem fi
5776 1.1 lukem
5777 1.1 lukem # Do a symbolic link so that the libtool archive can be found in
5778 1.1 lukem # LD_LIBRARY_PATH before the program is installed.
5779 1.1 lukem $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5780 1.1 lukem $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5781 1.1 lukem ;;
5782 1.1 lukem esac
5783 1.1 lukem exit $EXIT_SUCCESS
5784 1.1 lukem ;;
5785 1.1 lukem
5786 1.1 lukem # libtool install mode
5787 1.1 lukem install)
5788 1.1 lukem modename="$modename: install"
5789 1.1 lukem
5790 1.1 lukem # There may be an optional sh(1) argument at the beginning of
5791 1.1 lukem # install_prog (especially on Windows NT).
5792 1.1 lukem if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5793 1.1 lukem # Allow the use of GNU shtool's install command.
5794 1.1 lukem $echo "X$nonopt" | grep shtool > /dev/null; then
5795 1.1 lukem # Aesthetically quote it.
5796 1.1 lukem arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5797 1.1 lukem case $arg in
5798 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5799 1.1 lukem arg="\"$arg\""
5800 1.1 lukem ;;
5801 1.1 lukem esac
5802 1.1 lukem install_prog="$arg "
5803 1.1 lukem arg="$1"
5804 1.1 lukem shift
5805 1.1 lukem else
5806 1.1 lukem install_prog=
5807 1.1 lukem arg=$nonopt
5808 1.1 lukem fi
5809 1.1 lukem
5810 1.1 lukem # The real first argument should be the name of the installation program.
5811 1.1 lukem # Aesthetically quote it.
5812 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5813 1.1 lukem case $arg in
5814 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5815 1.1 lukem arg="\"$arg\""
5816 1.1 lukem ;;
5817 1.1 lukem esac
5818 1.1 lukem install_prog="$install_prog$arg"
5819 1.1 lukem
5820 1.1 lukem # We need to accept at least all the BSD install flags.
5821 1.1 lukem dest=
5822 1.1 lukem files=
5823 1.1 lukem opts=
5824 1.1 lukem prev=
5825 1.1 lukem install_type=
5826 1.1 lukem isdir=no
5827 1.1 lukem stripme=
5828 1.1 lukem for arg
5829 1.1 lukem do
5830 1.1 lukem if test -n "$dest"; then
5831 1.1 lukem files="$files $dest"
5832 1.1 lukem dest=$arg
5833 1.1 lukem continue
5834 1.1 lukem fi
5835 1.1 lukem
5836 1.1 lukem case $arg in
5837 1.1 lukem -d) isdir=yes ;;
5838 1.1 lukem -f)
5839 1.1 lukem case " $install_prog " in
5840 1.1 lukem *[\\\ /]cp\ *) ;;
5841 1.1 lukem *) prev=$arg ;;
5842 1.1 lukem esac
5843 1.1 lukem ;;
5844 1.1 lukem -g | -m | -o) prev=$arg ;;
5845 1.1 lukem -s)
5846 1.1 lukem stripme=" -s"
5847 1.1 lukem continue
5848 1.1 lukem ;;
5849 1.1 lukem -*)
5850 1.1 lukem ;;
5851 1.1 lukem *)
5852 1.1 lukem # If the previous option needed an argument, then skip it.
5853 1.1 lukem if test -n "$prev"; then
5854 1.1 lukem prev=
5855 1.1 lukem else
5856 1.1 lukem dest=$arg
5857 1.1 lukem continue
5858 1.1 lukem fi
5859 1.1 lukem ;;
5860 1.1 lukem esac
5861 1.1 lukem
5862 1.1 lukem # Aesthetically quote the argument.
5863 1.1 lukem arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5864 1.1 lukem case $arg in
5865 1.1 lukem *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5866 1.1 lukem arg="\"$arg\""
5867 1.1 lukem ;;
5868 1.1 lukem esac
5869 1.1 lukem install_prog="$install_prog $arg"
5870 1.1 lukem done
5871 1.1 lukem
5872 1.1 lukem if test -z "$install_prog"; then
5873 1.1 lukem $echo "$modename: you must specify an install program" 1>&2
5874 1.1 lukem $echo "$help" 1>&2
5875 1.1 lukem exit $EXIT_FAILURE
5876 1.1 lukem fi
5877 1.1 lukem
5878 1.1 lukem if test -n "$prev"; then
5879 1.1 lukem $echo "$modename: the \`$prev' option requires an argument" 1>&2
5880 1.1 lukem $echo "$help" 1>&2
5881 1.1 lukem exit $EXIT_FAILURE
5882 1.1 lukem fi
5883 1.1 lukem
5884 1.1 lukem if test -z "$files"; then
5885 1.1 lukem if test -z "$dest"; then
5886 1.1 lukem $echo "$modename: no file or destination specified" 1>&2
5887 1.1 lukem else
5888 1.1 lukem $echo "$modename: you must specify a destination" 1>&2
5889 1.1 lukem fi
5890 1.1 lukem $echo "$help" 1>&2
5891 1.1 lukem exit $EXIT_FAILURE
5892 1.1 lukem fi
5893 1.1 lukem
5894 1.1 lukem # Strip any trailing slash from the destination.
5895 1.1 lukem dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5896 1.1 lukem
5897 1.1 lukem # Check to see that the destination is a directory.
5898 1.1 lukem test -d "$dest" && isdir=yes
5899 1.1 lukem if test "$isdir" = yes; then
5900 1.1 lukem destdir="$dest"
5901 1.1 lukem destname=
5902 1.1 lukem else
5903 1.1 lukem destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5904 1.1 lukem test "X$destdir" = "X$dest" && destdir=.
5905 1.1 lukem destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5906 1.1 lukem
5907 1.1 lukem # Not a directory, so check to see that there is only one file specified.
5908 1.1 lukem set dummy $files
5909 1.1 lukem if test "$#" -gt 2; then
5910 1.1 lukem $echo "$modename: \`$dest' is not a directory" 1>&2
5911 1.1 lukem $echo "$help" 1>&2
5912 1.1 lukem exit $EXIT_FAILURE
5913 1.1 lukem fi
5914 1.1 lukem fi
5915 1.1 lukem case $destdir in
5916 1.1 lukem [\\/]* | [A-Za-z]:[\\/]*) ;;
5917 1.1 lukem *)
5918 1.1 lukem for file in $files; do
5919 1.1 lukem case $file in
5920 1.1 lukem *.lo) ;;
5921 1.1 lukem *)
5922 1.1 lukem $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5923 1.1 lukem $echo "$help" 1>&2
5924 1.1 lukem exit $EXIT_FAILURE
5925 1.1 lukem ;;
5926 1.1 lukem esac
5927 1.1 lukem done
5928 1.1 lukem ;;
5929 1.1 lukem esac
5930 1.1 lukem
5931 1.1 lukem # This variable tells wrapper scripts just to set variables rather
5932 1.1 lukem # than running their programs.
5933 1.1 lukem libtool_install_magic="$magic"
5934 1.1 lukem
5935 1.1 lukem staticlibs=
5936 1.1 lukem future_libdirs=
5937 1.1 lukem current_libdirs=
5938 1.1 lukem for file in $files; do
5939 1.1 lukem
5940 1.1 lukem # Do each installation.
5941 1.1 lukem case $file in
5942 1.1 lukem *.$libext)
5943 1.1 lukem # Do the static libraries later.
5944 1.1 lukem staticlibs="$staticlibs $file"
5945 1.1 lukem ;;
5946 1.1 lukem
5947 1.1 lukem *.la)
5948 1.1 lukem # Check to see that this really is a libtool archive.
5949 1.1 lukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5950 1.1 lukem else
5951 1.1 lukem $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5952 1.1 lukem $echo "$help" 1>&2
5953 1.1 lukem exit $EXIT_FAILURE
5954 1.1 lukem fi
5955 1.1 lukem
5956 1.1 lukem library_names=
5957 1.1 lukem old_library=
5958 1.1 lukem relink_command=
5959 1.1 lukem # If there is no directory component, then add one.
5960 1.1 lukem case $file in
5961 1.1 lukem */* | *\\*) . $file ;;
5962 1.1 lukem *) . ./$file ;;
5963 1.1 lukem esac
5964 1.1 lukem
5965 1.1 lukem # Add the libdir to current_libdirs if it is the destination.
5966 1.1 lukem if test "X$destdir" = "X$libdir"; then
5967 1.1 lukem case "$current_libdirs " in
5968 1.1 lukem *" $libdir "*) ;;
5969 1.1 lukem *) current_libdirs="$current_libdirs $libdir" ;;
5970 1.1 lukem esac
5971 1.1 lukem else
5972 1.1 lukem # Note the libdir as a future libdir.
5973 1.1 lukem case "$future_libdirs " in
5974 1.1 lukem *" $libdir "*) ;;
5975 1.1 lukem *) future_libdirs="$future_libdirs $libdir" ;;
5976 1.1 lukem esac
5977 1.1 lukem fi
5978 1.1 lukem
5979 1.1 lukem dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5980 1.1 lukem test "X$dir" = "X$file/" && dir=
5981 1.1 lukem dir="$dir$objdir"
5982 1.1 lukem
5983 1.1 lukem if test -n "$relink_command"; then
5984 1.1 lukem # Determine the prefix the user has applied to our future dir.
5985 1.1 lukem inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5986 1.1 lukem
5987 1.1 lukem # Don't allow the user to place us outside of our expected
5988 1.1 lukem # location b/c this prevents finding dependent libraries that
5989 1.1 lukem # are installed to the same prefix.
5990 1.1 lukem # At present, this check doesn't affect windows .dll's that
5991 1.1 lukem # are installed into $libdir/../bin (currently, that works fine)
5992 1.1 lukem # but it's something to keep an eye on.
5993 1.1 lukem if test "$inst_prefix_dir" = "$destdir"; then
5994 1.1 lukem $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5995 1.1 lukem exit $EXIT_FAILURE
5996 1.1 lukem fi
5997 1.1 lukem
5998 1.1 lukem if test -n "$inst_prefix_dir"; then
5999 1.1 lukem # Stick the inst_prefix_dir data into the link command.
6000 1.1 lukem relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
6001 1.1 lukem else
6002 1.1 lukem relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
6003 1.1 lukem fi
6004 1.1 lukem
6005 1.1 lukem $echo "$modename: warning: relinking \`$file'" 1>&2
6006 1.1 lukem $show "$relink_command"
6007 1.1 lukem if $run eval "$relink_command"; then :
6008 1.1 lukem else
6009 1.1 lukem $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6010 1.1 lukem exit $EXIT_FAILURE
6011 1.1 lukem fi
6012 1.1 lukem fi
6013 1.1 lukem
6014 1.1 lukem # See the names of the shared library.
6015 1.1 lukem set dummy $library_names
6016 1.1 lukem if test -n "$2"; then
6017 1.1 lukem realname="$2"
6018 1.1 lukem shift
6019 1.1 lukem shift
6020 1.1 lukem
6021 1.1 lukem srcname="$realname"
6022 1.1 lukem test -n "$relink_command" && srcname="$realname"T
6023 1.1 lukem
6024 1.1 lukem # Install the shared library and build the symlinks.
6025 1.1 lukem $show "$install_prog $dir/$srcname $destdir/$realname"
6026 1.1 lukem $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6027 1.1 lukem if test -n "$stripme" && test -n "$striplib"; then
6028 1.1 lukem $show "$striplib $destdir/$realname"
6029 1.1 lukem $run eval "$striplib $destdir/$realname" || exit $?
6030 1.1 lukem fi
6031 1.1 lukem
6032 1.1 lukem if test "$#" -gt 0; then
6033 1.1 lukem # Delete the old symlinks, and create new ones.
6034 1.1 lukem # Try `ln -sf' first, because the `ln' binary might depend on
6035 1.1 lukem # the symlink we replace! Solaris /bin/ln does not understand -f,
6036 1.1 lukem # so we also need to try rm && ln -s.
6037 1.1 lukem for linkname
6038 1.1 lukem do
6039 1.1 lukem if test "$linkname" != "$realname"; then
6040 1.1 lukem $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6041 1.1 lukem $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6042 1.1 lukem fi
6043 1.1 lukem done
6044 1.1 lukem fi
6045 1.1 lukem
6046 1.1 lukem # Do each command in the postinstall commands.
6047 1.1 lukem lib="$destdir/$realname"
6048 1.1 lukem cmds=$postinstall_cmds
6049 1.1 lukem save_ifs="$IFS"; IFS='~'
6050 1.1 lukem for cmd in $cmds; do
6051 1.1 lukem IFS="$save_ifs"
6052 1.1 lukem eval cmd=\"$cmd\"
6053 1.1 lukem $show "$cmd"
6054 1.1 lukem $run eval "$cmd" || {
6055 1.1 lukem lt_exit=$?
6056 1.1 lukem
6057 1.1 lukem # Restore the uninstalled library and exit
6058 1.1 lukem if test "$mode" = relink; then
6059 1.1 lukem $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6060 1.1 lukem fi
6061 1.1 lukem
6062 1.1 lukem exit $lt_exit
6063 1.1 lukem }
6064 1.1 lukem done
6065 1.1 lukem IFS="$save_ifs"
6066 1.1 lukem fi
6067 1.1 lukem
6068 1.1 lukem # Install the pseudo-library for information purposes.
6069 1.1 lukem name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 1.1 lukem instname="$dir/$name"i
6071 1.1 lukem $show "$install_prog $instname $destdir/$name"
6072 1.1 lukem $run eval "$install_prog $instname $destdir/$name" || exit $?
6073 1.1 lukem
6074 1.1 lukem # Maybe install the static library, too.
6075 1.1 lukem test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6076 1.1 lukem ;;
6077 1.1 lukem
6078 1.1 lukem *.lo)
6079 1.1 lukem # Install (i.e. copy) a libtool object.
6080 1.1 lukem
6081 1.1 lukem # Figure out destination file name, if it wasn't already specified.
6082 1.1 lukem if test -n "$destname"; then
6083 1.1 lukem destfile="$destdir/$destname"
6084 1.1 lukem else
6085 1.1 lukem destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6086 1.1 lukem destfile="$destdir/$destfile"
6087 1.1 lukem fi
6088 1.1 lukem
6089 1.1 lukem # Deduce the name of the destination old-style object file.
6090 1.1 lukem case $destfile in
6091 1.1 lukem *.lo)
6092 1.1 lukem staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6093 1.1 lukem ;;
6094 1.1 lukem *.$objext)
6095 1.1 lukem staticdest="$destfile"
6096 1.1 lukem destfile=
6097 1.1 lukem ;;
6098 1.1 lukem *)
6099 1.1 lukem $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6100 1.1 lukem $echo "$help" 1>&2
6101 1.1 lukem exit $EXIT_FAILURE
6102 1.1 lukem ;;
6103 1.1 lukem esac
6104 1.1 lukem
6105 1.1 lukem # Install the libtool object if requested.
6106 1.1 lukem if test -n "$destfile"; then
6107 1.1 lukem $show "$install_prog $file $destfile"
6108 1.1 lukem $run eval "$install_prog $file $destfile" || exit $?
6109 1.1 lukem fi
6110 1.1 lukem
6111 1.1 lukem # Install the old object if enabled.
6112 1.1 lukem if test "$build_old_libs" = yes; then
6113 1.1 lukem # Deduce the name of the old-style object file.
6114 1.1 lukem staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6115 1.1 lukem
6116 1.1 lukem $show "$install_prog $staticobj $staticdest"
6117 1.1 lukem $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6118 1.1 lukem fi
6119 1.1 lukem exit $EXIT_SUCCESS
6120 1.1 lukem ;;
6121 1.1 lukem
6122 1.1 lukem *)
6123 1.1 lukem # Figure out destination file name, if it wasn't already specified.
6124 1.1 lukem if test -n "$destname"; then
6125 1.1 lukem destfile="$destdir/$destname"
6126 1.1 lukem else
6127 1.1 lukem destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6128 1.1 lukem destfile="$destdir/$destfile"
6129 1.1 lukem fi
6130 1.1 lukem
6131 1.1 lukem # If the file is missing, and there is a .exe on the end, strip it
6132 1.1 lukem # because it is most likely a libtool script we actually want to
6133 1.1 lukem # install
6134 1.1 lukem stripped_ext=""
6135 1.1 lukem case $file in
6136 1.1 lukem *.exe)
6137 1.1 lukem if test ! -f "$file"; then
6138 1.1 lukem file=`$echo $file|${SED} 's,.exe$,,'`
6139 1.1 lukem stripped_ext=".exe"
6140 1.1 lukem fi
6141 1.1 lukem ;;
6142 1.1 lukem esac
6143 1.1 lukem
6144 1.1 lukem # Do a test to see if this is really a libtool program.
6145 1.1 lukem case $host in
6146 1.1 lukem *cygwin*|*mingw*)
6147 1.1 lukem wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6148 1.1 lukem ;;
6149 1.1 lukem *)
6150 1.1 lukem wrapper=$file
6151 1.1 lukem ;;
6152 1.1 lukem esac
6153 1.1 lukem if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6154 1.1 lukem notinst_deplibs=
6155 1.1 lukem relink_command=
6156 1.1 lukem
6157 1.1 lukem # Note that it is not necessary on cygwin/mingw to append a dot to
6158 1.1 lukem # foo even if both foo and FILE.exe exist: automatic-append-.exe
6159 1.1 lukem # behavior happens only for exec(3), not for open(2)! Also, sourcing
6160 1.1 lukem # `FILE.' does not work on cygwin managed mounts.
6161 1.1 lukem #
6162 1.1 lukem # If there is no directory component, then add one.
6163 1.1 lukem case $wrapper in
6164 1.1 lukem */* | *\\*) . ${wrapper} ;;
6165 1.1 lukem *) . ./${wrapper} ;;
6166 1.1 lukem esac
6167 1.1 lukem
6168 1.1 lukem # Check the variables that should have been set.
6169 1.1 lukem if test -z "$notinst_deplibs"; then
6170 1.1 lukem $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6171 1.1 lukem exit $EXIT_FAILURE
6172 1.1 lukem fi
6173 1.1 lukem
6174 1.1 lukem finalize=yes
6175 1.1 lukem for lib in $notinst_deplibs; do
6176 1.1 lukem # Check to see that each library is installed.
6177 1.1 lukem libdir=
6178 1.1 lukem if test -f "$lib"; then
6179 1.1 lukem # If there is no directory component, then add one.
6180 1.1 lukem case $lib in
6181 1.1 lukem */* | *\\*) . $lib ;;
6182 1.1 lukem *) . ./$lib ;;
6183 1.1 lukem esac
6184 1.1 lukem fi
6185 1.1 lukem libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6186 1.1 lukem if test -n "$libdir" && test ! -f "$libfile"; then
6187 1.1 lukem $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6188 1.1 lukem finalize=no
6189 1.1 lukem fi
6190 1.1 lukem done
6191 1.1 lukem
6192 1.1 lukem relink_command=
6193 1.1 lukem # Note that it is not necessary on cygwin/mingw to append a dot to
6194 1.1 lukem # foo even if both foo and FILE.exe exist: automatic-append-.exe
6195 1.1 lukem # behavior happens only for exec(3), not for open(2)! Also, sourcing
6196 1.1 lukem # `FILE.' does not work on cygwin managed mounts.
6197 1.1 lukem #
6198 1.1 lukem # If there is no directory component, then add one.
6199 1.1 lukem case $wrapper in
6200 1.1 lukem */* | *\\*) . ${wrapper} ;;
6201 1.1 lukem *) . ./${wrapper} ;;
6202 1.1 lukem esac
6203 1.1 lukem
6204 1.1 lukem outputname=
6205 1.1 lukem if test "$fast_install" = no && test -n "$relink_command"; then
6206 1.1 lukem if test "$finalize" = yes && test -z "$run"; then
6207 1.1 lukem tmpdir=`func_mktempdir`
6208 1.1 lukem file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6209 1.1 lukem outputname="$tmpdir/$file"
6210 1.1 lukem # Replace the output file specification.
6211 1.1 lukem relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6212 1.1 lukem
6213 1.1 lukem $show "$relink_command"
6214 1.1 lukem if $run eval "$relink_command"; then :
6215 1.1 lukem else
6216 1.1 lukem $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6217 1.1 lukem ${rm}r "$tmpdir"
6218 1.1 lukem continue
6219 1.1 lukem fi
6220 1.1 lukem file="$outputname"
6221 1.1 lukem else
6222 1.1 lukem $echo "$modename: warning: cannot relink \`$file'" 1>&2
6223 1.1 lukem fi
6224 1.1 lukem else
6225 1.1 lukem # Install the binary that we compiled earlier.
6226 1.1 lukem file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6227 1.1 lukem fi
6228 1.1 lukem fi
6229 1.1 lukem
6230 1.1 lukem # remove .exe since cygwin /usr/bin/install will append another
6231 1.1 lukem # one anyway
6232 1.1 lukem case $install_prog,$host in
6233 1.1 lukem */usr/bin/install*,*cygwin*)
6234 1.1 lukem case $file:$destfile in
6235 1.1 lukem *.exe:*.exe)
6236 1.1 lukem # this is ok
6237 1.1 lukem ;;
6238 1.1 lukem *.exe:*)
6239 1.1 lukem destfile=$destfile.exe
6240 1.1 lukem ;;
6241 1.1 lukem *:*.exe)
6242 1.1 lukem destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6243 1.1 lukem ;;
6244 1.1 lukem esac
6245 1.1 lukem ;;
6246 1.1 lukem esac
6247 1.1 lukem $show "$install_prog$stripme $file $destfile"
6248 1.1 lukem $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6249 1.1 lukem test -n "$outputname" && ${rm}r "$tmpdir"
6250 1.1 lukem ;;
6251 1.1 lukem esac
6252 1.1 lukem done
6253 1.1 lukem
6254 1.1 lukem for file in $staticlibs; do
6255 1.1 lukem name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6256 1.1 lukem
6257 1.1 lukem # Set up the ranlib parameters.
6258 1.1 lukem oldlib="$destdir/$name"
6259 1.1 lukem
6260 1.1 lukem $show "$install_prog $file $oldlib"
6261 1.1 lukem $run eval "$install_prog \$file \$oldlib" || exit $?
6262 1.1 lukem
6263 1.1 lukem if test -n "$stripme" && test -n "$old_striplib"; then
6264 1.1 lukem $show "$old_striplib $oldlib"
6265 1.1 lukem $run eval "$old_striplib $oldlib" || exit $?
6266 1.1 lukem fi
6267 1.1 lukem
6268 1.1 lukem # Do each command in the postinstall commands.
6269 1.1 lukem cmds=$old_postinstall_cmds
6270 1.1 lukem save_ifs="$IFS"; IFS='~'
6271 1.1 lukem for cmd in $cmds; do
6272 1.1 lukem IFS="$save_ifs"
6273 1.1 lukem eval cmd=\"$cmd\"
6274 1.1 lukem $show "$cmd"
6275 1.1 lukem $run eval "$cmd" || exit $?
6276 1.1 lukem done
6277 1.1 lukem IFS="$save_ifs"
6278 1.1 lukem done
6279 1.1 lukem
6280 1.1 lukem if test -n "$future_libdirs"; then
6281 1.1 lukem $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6282 1.1 lukem fi
6283 1.1 lukem
6284 1.1 lukem if test -n "$current_libdirs"; then
6285 1.1 lukem # Maybe just do a dry run.
6286 1.1 lukem test -n "$run" && current_libdirs=" -n$current_libdirs"
6287 1.1 lukem exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6288 1.1 lukem else
6289 1.1 lukem exit $EXIT_SUCCESS
6290 1.1 lukem fi
6291 1.1 lukem ;;
6292 1.1 lukem
6293 1.1 lukem # libtool finish mode
6294 1.1 lukem finish)
6295 1.1 lukem modename="$modename: finish"
6296 1.1 lukem libdirs="$nonopt"
6297 1.1 lukem admincmds=
6298 1.1 lukem
6299 1.1 lukem if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6300 1.1 lukem for dir
6301 1.1 lukem do
6302 1.1 lukem libdirs="$libdirs $dir"
6303 1.1 lukem done
6304 1.1 lukem
6305 1.1 lukem for libdir in $libdirs; do
6306 1.1 lukem if test -n "$finish_cmds"; then
6307 1.1 lukem # Do each command in the finish commands.
6308 1.1 lukem cmds=$finish_cmds
6309 1.1 lukem save_ifs="$IFS"; IFS='~'
6310 1.1 lukem for cmd in $cmds; do
6311 1.1 lukem IFS="$save_ifs"
6312 1.1 lukem eval cmd=\"$cmd\"
6313 1.1 lukem $show "$cmd"
6314 1.1 lukem $run eval "$cmd" || admincmds="$admincmds
6315 1.1 lukem $cmd"
6316 1.1 lukem done
6317 1.1 lukem IFS="$save_ifs"
6318 1.1 lukem fi
6319 1.1 lukem if test -n "$finish_eval"; then
6320 1.1 lukem # Do the single finish_eval.
6321 1.1 lukem eval cmds=\"$finish_eval\"
6322 1.1 lukem $run eval "$cmds" || admincmds="$admincmds
6323 1.1 lukem $cmds"
6324 1.1 lukem fi
6325 1.1 lukem done
6326 1.1 lukem fi
6327 1.1 lukem
6328 1.1 lukem # Exit here if they wanted silent mode.
6329 1.1 lukem test "$show" = : && exit $EXIT_SUCCESS
6330 1.1 lukem
6331 1.1 lukem $echo "X----------------------------------------------------------------------" | $Xsed
6332 1.1 lukem $echo "Libraries have been installed in:"
6333 1.1 lukem for libdir in $libdirs; do
6334 1.1 lukem $echo " $libdir"
6335 1.1 lukem done
6336 1.1 lukem $echo
6337 1.1 lukem $echo "If you ever happen to want to link against installed libraries"
6338 1.1 lukem $echo "in a given directory, LIBDIR, you must either use libtool, and"
6339 1.1 lukem $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6340 1.1 lukem $echo "flag during linking and do at least one of the following:"
6341 1.1 lukem if test -n "$shlibpath_var"; then
6342 1.1 lukem $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6343 1.1 lukem $echo " during execution"
6344 1.1 lukem fi
6345 1.1 lukem if test -n "$runpath_var"; then
6346 1.1 lukem $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6347 1.1 lukem $echo " during linking"
6348 1.1 lukem fi
6349 1.1 lukem if test -n "$hardcode_libdir_flag_spec"; then
6350 1.1 lukem libdir=LIBDIR
6351 1.1 lukem eval flag=\"$hardcode_libdir_flag_spec\"
6352 1.1 lukem
6353 1.1 lukem $echo " - use the \`$flag' linker flag"
6354 1.1 lukem fi
6355 1.1 lukem if test -n "$admincmds"; then
6356 1.1 lukem $echo " - have your system administrator run these commands:$admincmds"
6357 1.1 lukem fi
6358 1.1 lukem if test -f /etc/ld.so.conf; then
6359 1.1 lukem $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6360 1.1 lukem fi
6361 1.1 lukem $echo
6362 1.1 lukem $echo "See any operating system documentation about shared libraries for"
6363 1.1 lukem $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6364 1.1 lukem $echo "X----------------------------------------------------------------------" | $Xsed
6365 1.1 lukem exit $EXIT_SUCCESS
6366 1.1 lukem ;;
6367 1.1 lukem
6368 1.1 lukem # libtool execute mode
6369 1.1 lukem execute)
6370 1.1 lukem modename="$modename: execute"
6371 1.1 lukem
6372 1.1 lukem # The first argument is the command name.
6373 1.1 lukem cmd="$nonopt"
6374 1.1 lukem if test -z "$cmd"; then
6375 1.1 lukem $echo "$modename: you must specify a COMMAND" 1>&2
6376 1.1 lukem $echo "$help"
6377 1.1 lukem exit $EXIT_FAILURE
6378 1.1 lukem fi
6379 1.1 lukem
6380 1.1 lukem # Handle -dlopen flags immediately.
6381 1.1 lukem for file in $execute_dlfiles; do
6382 1.1 lukem if test ! -f "$file"; then
6383 1.1 lukem $echo "$modename: \`$file' is not a file" 1>&2
6384 1.1 lukem $echo "$help" 1>&2
6385 1.1 lukem exit $EXIT_FAILURE
6386 1.1 lukem fi
6387 1.1 lukem
6388 1.1 lukem dir=
6389 1.1 lukem case $file in
6390 1.1 lukem *.la)
6391 1.1 lukem # Check to see that this really is a libtool archive.
6392 1.1 lukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6393 1.1 lukem else
6394 1.1 lukem $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6395 1.1 lukem $echo "$help" 1>&2
6396 1.1 lukem exit $EXIT_FAILURE
6397 1.1 lukem fi
6398 1.1 lukem
6399 1.1 lukem # Read the libtool library.
6400 1.1 lukem dlname=
6401 1.1 lukem library_names=
6402 1.1 lukem
6403 1.1 lukem # If there is no directory component, then add one.
6404 1.1 lukem case $file in
6405 1.1 lukem */* | *\\*) . $file ;;
6406 1.1 lukem *) . ./$file ;;
6407 1.1 lukem esac
6408 1.1 lukem
6409 1.1 lukem # Skip this library if it cannot be dlopened.
6410 1.1 lukem if test -z "$dlname"; then
6411 1.1 lukem # Warn if it was a shared library.
6412 1.1 lukem test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6413 1.1 lukem continue
6414 1.1 lukem fi
6415 1.1 lukem
6416 1.1 lukem dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6417 1.1 lukem test "X$dir" = "X$file" && dir=.
6418 1.1 lukem
6419 1.1 lukem if test -f "$dir/$objdir/$dlname"; then
6420 1.1 lukem dir="$dir/$objdir"
6421 1.1 lukem else
6422 1.1 lukem $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6423 1.1 lukem exit $EXIT_FAILURE
6424 1.1 lukem fi
6425 1.1 lukem ;;
6426 1.1 lukem
6427 1.1 lukem *.lo)
6428 1.1 lukem # Just add the directory containing the .lo file.
6429 1.1 lukem dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6430 1.1 lukem test "X$dir" = "X$file" && dir=.
6431 1.1 lukem ;;
6432 1.1 lukem
6433 1.1 lukem *)
6434 1.1 lukem $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6435 1.1 lukem continue
6436 1.1 lukem ;;
6437 1.1 lukem esac
6438 1.1 lukem
6439 1.1 lukem # Get the absolute pathname.
6440 1.1 lukem absdir=`cd "$dir" && pwd`
6441 1.1 lukem test -n "$absdir" && dir="$absdir"
6442 1.1 lukem
6443 1.1 lukem # Now add the directory to shlibpath_var.
6444 1.1 lukem if eval "test -z \"\$$shlibpath_var\""; then
6445 1.1 lukem eval "$shlibpath_var=\"\$dir\""
6446 1.1 lukem else
6447 1.1 lukem eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6448 1.1 lukem fi
6449 1.1 lukem done
6450 1.1 lukem
6451 1.1 lukem # This variable tells wrapper scripts just to set shlibpath_var
6452 1.1 lukem # rather than running their programs.
6453 1.1 lukem libtool_execute_magic="$magic"
6454 1.1 lukem
6455 1.1 lukem # Check if any of the arguments is a wrapper script.
6456 1.1 lukem args=
6457 1.1 lukem for file
6458 1.1 lukem do
6459 1.1 lukem case $file in
6460 1.1 lukem -*) ;;
6461 1.1 lukem *)
6462 1.1 lukem # Do a test to see if this is really a libtool program.
6463 1.1 lukem if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6464 1.1 lukem # If there is no directory component, then add one.
6465 1.1 lukem case $file in
6466 1.1 lukem */* | *\\*) . $file ;;
6467 1.1 lukem *) . ./$file ;;
6468 1.1 lukem esac
6469 1.1 lukem
6470 1.1 lukem # Transform arg to wrapped name.
6471 1.1 lukem file="$progdir/$program"
6472 1.1 lukem fi
6473 1.1 lukem ;;
6474 1.1 lukem esac
6475 1.1 lukem # Quote arguments (to preserve shell metacharacters).
6476 1.1 lukem file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6477 1.1 lukem args="$args \"$file\""
6478 1.1 lukem done
6479 1.1 lukem
6480 1.1 lukem if test -z "$run"; then
6481 1.1 lukem if test -n "$shlibpath_var"; then
6482 1.1 lukem # Export the shlibpath_var.
6483 1.1 lukem eval "export $shlibpath_var"
6484 1.1 lukem fi
6485 1.1 lukem
6486 1.1 lukem # Restore saved environment variables
6487 1.1 lukem if test "${save_LC_ALL+set}" = set; then
6488 1.1 lukem LC_ALL="$save_LC_ALL"; export LC_ALL
6489 1.1 lukem fi
6490 1.1 lukem if test "${save_LANG+set}" = set; then
6491 1.1 lukem LANG="$save_LANG"; export LANG
6492 1.1 lukem fi
6493 1.1 lukem
6494 1.1 lukem # Now prepare to actually exec the command.
6495 1.1 lukem exec_cmd="\$cmd$args"
6496 1.1 lukem else
6497 1.1 lukem # Display what would be done.
6498 1.1 lukem if test -n "$shlibpath_var"; then
6499 1.1 lukem eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6500 1.1 lukem $echo "export $shlibpath_var"
6501 1.1 lukem fi
6502 1.1 lukem $echo "$cmd$args"
6503 1.1 lukem exit $EXIT_SUCCESS
6504 1.1 lukem fi
6505 1.1 lukem ;;
6506 1.1 lukem
6507 1.1 lukem # libtool clean and uninstall mode
6508 1.1 lukem clean | uninstall)
6509 1.1 lukem modename="$modename: $mode"
6510 1.1 lukem rm="$nonopt"
6511 1.1 lukem files=
6512 1.1 lukem rmforce=
6513 1.1 lukem exit_status=0
6514 1.1 lukem
6515 1.1 lukem # This variable tells wrapper scripts just to set variables rather
6516 1.1 lukem # than running their programs.
6517 1.1 lukem libtool_install_magic="$magic"
6518 1.1 lukem
6519 1.1 lukem for arg
6520 1.1 lukem do
6521 1.1 lukem case $arg in
6522 1.1 lukem -f) rm="$rm $arg"; rmforce=yes ;;
6523 1.1 lukem -*) rm="$rm $arg" ;;
6524 1.1 lukem *) files="$files $arg" ;;
6525 1.1 lukem esac
6526 1.1 lukem done
6527 1.1 lukem
6528 1.1 lukem if test -z "$rm"; then
6529 1.1 lukem $echo "$modename: you must specify an RM program" 1>&2
6530 1.1 lukem $echo "$help" 1>&2
6531 1.1 lukem exit $EXIT_FAILURE
6532 1.1 lukem fi
6533 1.1 lukem
6534 1.1 lukem rmdirs=
6535 1.1 lukem
6536 1.1 lukem origobjdir="$objdir"
6537 1.1 lukem for file in $files; do
6538 1.1 lukem dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6539 1.1 lukem if test "X$dir" = "X$file"; then
6540 1.1 lukem dir=.
6541 1.1 lukem objdir="$origobjdir"
6542 1.1 lukem else
6543 1.1 lukem objdir="$dir/$origobjdir"
6544 1.1 lukem fi
6545 1.1 lukem name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6546 1.1 lukem test "$mode" = uninstall && objdir="$dir"
6547 1.1 lukem
6548 1.1 lukem # Remember objdir for removal later, being careful to avoid duplicates
6549 1.1 lukem if test "$mode" = clean; then
6550 1.1 lukem case " $rmdirs " in
6551 1.1 lukem *" $objdir "*) ;;
6552 1.1 lukem *) rmdirs="$rmdirs $objdir" ;;
6553 1.1 lukem esac
6554 1.1 lukem fi
6555 1.1 lukem
6556 1.1 lukem # Don't error if the file doesn't exist and rm -f was used.
6557 1.1 lukem if (test -L "$file") >/dev/null 2>&1 \
6558 1.1 lukem || (test -h "$file") >/dev/null 2>&1 \
6559 1.1 lukem || test -f "$file"; then
6560 1.1 lukem :
6561 1.1 lukem elif test -d "$file"; then
6562 1.1 lukem exit_status=1
6563 1.1 lukem continue
6564 1.1 lukem elif test "$rmforce" = yes; then
6565 1.1 lukem continue
6566 1.1 lukem fi
6567 1.1 lukem
6568 1.1 lukem rmfiles="$file"
6569 1.1 lukem
6570 1.1 lukem case $name in
6571 1.1 lukem *.la)
6572 1.1 lukem # Possibly a libtool archive, so verify it.
6573 1.1 lukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6574 1.1 lukem . $dir/$name
6575 1.1 lukem
6576 1.1 lukem # Delete the libtool libraries and symlinks.
6577 1.1 lukem for n in $library_names; do
6578 1.1 lukem rmfiles="$rmfiles $objdir/$n"
6579 1.1 lukem done
6580 1.1 lukem test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6581 1.1 lukem
6582 1.1 lukem case "$mode" in
6583 1.1 lukem clean)
6584 1.1 lukem case " $library_names " in
6585 1.1 lukem # " " in the beginning catches empty $dlname
6586 1.1 lukem *" $dlname "*) ;;
6587 1.1 lukem *) rmfiles="$rmfiles $objdir/$dlname" ;;
6588 1.1 lukem esac
6589 1.1 lukem test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6590 1.1 lukem ;;
6591 1.1 lukem uninstall)
6592 1.1 lukem if test -n "$library_names"; then
6593 1.1 lukem # Do each command in the postuninstall commands.
6594 1.1 lukem cmds=$postuninstall_cmds
6595 1.1 lukem save_ifs="$IFS"; IFS='~'
6596 1.1 lukem for cmd in $cmds; do
6597 1.1 lukem IFS="$save_ifs"
6598 1.1 lukem eval cmd=\"$cmd\"
6599 1.1 lukem $show "$cmd"
6600 1.1 lukem $run eval "$cmd"
6601 1.1 lukem if test "$?" -ne 0 && test "$rmforce" != yes; then
6602 1.1 lukem exit_status=1
6603 1.1 lukem fi
6604 1.1 lukem done
6605 1.1 lukem IFS="$save_ifs"
6606 1.1 lukem fi
6607 1.1 lukem
6608 1.1 lukem if test -n "$old_library"; then
6609 1.1 lukem # Do each command in the old_postuninstall commands.
6610 1.1 lukem cmds=$old_postuninstall_cmds
6611 1.1 lukem save_ifs="$IFS"; IFS='~'
6612 1.1 lukem for cmd in $cmds; do
6613 1.1 lukem IFS="$save_ifs"
6614 1.1 lukem eval cmd=\"$cmd\"
6615 1.1 lukem $show "$cmd"
6616 1.1 lukem $run eval "$cmd"
6617 1.1 lukem if test "$?" -ne 0 && test "$rmforce" != yes; then
6618 1.1 lukem exit_status=1
6619 1.1 lukem fi
6620 1.1 lukem done
6621 1.1 lukem IFS="$save_ifs"
6622 1.1 lukem fi
6623 1.1 lukem # FIXME: should reinstall the best remaining shared library.
6624 1.1 lukem ;;
6625 1.1 lukem esac
6626 1.1 lukem fi
6627 1.1 lukem ;;
6628 1.1 lukem
6629 1.1 lukem *.lo)
6630 1.1 lukem # Possibly a libtool object, so verify it.
6631 1.1 lukem if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6632 1.1 lukem
6633 1.1 lukem # Read the .lo file
6634 1.1 lukem . $dir/$name
6635 1.1 lukem
6636 1.1 lukem # Add PIC object to the list of files to remove.
6637 1.1 lukem if test -n "$pic_object" \
6638 1.1 lukem && test "$pic_object" != none; then
6639 1.1 lukem rmfiles="$rmfiles $dir/$pic_object"
6640 1.1 lukem fi
6641 1.1 lukem
6642 1.1 lukem # Add non-PIC object to the list of files to remove.
6643 1.1 lukem if test -n "$non_pic_object" \
6644 1.1 lukem && test "$non_pic_object" != none; then
6645 1.1 lukem rmfiles="$rmfiles $dir/$non_pic_object"
6646 1.1 lukem fi
6647 1.1 lukem fi
6648 1.1 lukem ;;
6649 1.1 lukem
6650 1.1 lukem *)
6651 1.1 lukem if test "$mode" = clean ; then
6652 1.1 lukem noexename=$name
6653 1.1 lukem case $file in
6654 1.1 lukem *.exe)
6655 1.1 lukem file=`$echo $file|${SED} 's,.exe$,,'`
6656 1.1 lukem noexename=`$echo $name|${SED} 's,.exe$,,'`
6657 1.1 lukem # $file with .exe has already been added to rmfiles,
6658 1.1 lukem # add $file without .exe
6659 1.1 lukem rmfiles="$rmfiles $file"
6660 1.1 lukem ;;
6661 1.1 lukem esac
6662 1.1 lukem # Do a test to see if this is a libtool program.
6663 1.1 lukem if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6664 1.1 lukem relink_command=
6665 1.1 lukem . $dir/$noexename
6666 1.1 lukem
6667 1.1 lukem # note $name still contains .exe if it was in $file originally
6668 1.1 lukem # as does the version of $file that was added into $rmfiles
6669 1.1 lukem rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6670 1.1 lukem if test "$fast_install" = yes && test -n "$relink_command"; then
6671 1.1 lukem rmfiles="$rmfiles $objdir/lt-$name"
6672 1.1 lukem fi
6673 1.1 lukem if test "X$noexename" != "X$name" ; then
6674 1.1 lukem rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6675 1.1 lukem fi
6676 1.1 lukem fi
6677 1.1 lukem fi
6678 1.1 lukem ;;
6679 1.1 lukem esac
6680 1.1 lukem $show "$rm $rmfiles"
6681 1.1 lukem $run $rm $rmfiles || exit_status=1
6682 1.1 lukem done
6683 1.1 lukem objdir="$origobjdir"
6684 1.1 lukem
6685 1.1 lukem # Try to remove the ${objdir}s in the directories where we deleted files
6686 1.1 lukem for dir in $rmdirs; do
6687 1.1 lukem if test -d "$dir"; then
6688 1.1 lukem $show "rmdir $dir"
6689 1.1 lukem $run rmdir $dir >/dev/null 2>&1
6690 1.1 lukem fi
6691 1.1 lukem done
6692 1.1 lukem
6693 1.1 lukem exit $exit_status
6694 1.1 lukem ;;
6695 1.1 lukem
6696 1.1 lukem "")
6697 1.1 lukem $echo "$modename: you must specify a MODE" 1>&2
6698 1.1 lukem $echo "$generic_help" 1>&2
6699 1.1 lukem exit $EXIT_FAILURE
6700 1.1 lukem ;;
6701 1.1 lukem esac
6702 1.1 lukem
6703 1.1 lukem if test -z "$exec_cmd"; then
6704 1.1 lukem $echo "$modename: invalid operation mode \`$mode'" 1>&2
6705 1.1 lukem $echo "$generic_help" 1>&2
6706 1.1 lukem exit $EXIT_FAILURE
6707 1.1 lukem fi
6708 1.1 lukem fi # test -z "$show_help"
6709 1.1 lukem
6710 1.1 lukem if test -n "$exec_cmd"; then
6711 1.1 lukem eval exec $exec_cmd
6712 1.1 lukem exit $EXIT_FAILURE
6713 1.1 lukem fi
6714 1.1 lukem
6715 1.1 lukem # We need to display help for each of the modes.
6716 1.1 lukem case $mode in
6717 1.1 lukem "") $echo \
6718 1.1 lukem "Usage: $modename [OPTION]... [MODE-ARG]...
6719 1.1 lukem
6720 1.1 lukem Provide generalized library-building support services.
6721 1.1 lukem
6722 1.1 lukem --config show all configuration variables
6723 1.1 lukem --debug enable verbose shell tracing
6724 1.1 lukem -n, --dry-run display commands without modifying any files
6725 1.1 lukem --features display basic configuration information and exit
6726 1.1 lukem --finish same as \`--mode=finish'
6727 1.1 lukem --help display this help message and exit
6728 1.1 lukem --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6729 1.1 lukem --quiet same as \`--silent'
6730 1.1 lukem --silent don't print informational messages
6731 1.1 lukem --tag=TAG use configuration variables from tag TAG
6732 1.1 lukem --version print version information
6733 1.1 lukem
6734 1.1 lukem MODE must be one of the following:
6735 1.1 lukem
6736 1.1 lukem clean remove files from the build directory
6737 1.1 lukem compile compile a source file into a libtool object
6738 1.1 lukem execute automatically set library path, then run a program
6739 1.1 lukem finish complete the installation of libtool libraries
6740 1.1 lukem install install libraries or executables
6741 1.1 lukem link create a library or an executable
6742 1.1 lukem uninstall remove libraries from an installed directory
6743 1.1 lukem
6744 1.1 lukem MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6745 1.1 lukem a more detailed description of MODE.
6746 1.1 lukem
6747 1.1 lukem Report bugs to <bug-libtool (at] gnu.org>."
6748 1.1 lukem exit $EXIT_SUCCESS
6749 1.1 lukem ;;
6750 1.1 lukem
6751 1.1 lukem clean)
6752 1.1 lukem $echo \
6753 1.1 lukem "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6754 1.1 lukem
6755 1.1 lukem Remove files from the build directory.
6756 1.1 lukem
6757 1.1 lukem RM is the name of the program to use to delete files associated with each FILE
6758 1.1 lukem (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6759 1.1 lukem to RM.
6760 1.1 lukem
6761 1.1 lukem If FILE is a libtool library, object or program, all the files associated
6762 1.1 lukem with it are deleted. Otherwise, only FILE itself is deleted using RM."
6763 1.1 lukem ;;
6764 1.1 lukem
6765 1.1 lukem compile)
6766 1.1 lukem $echo \
6767 1.1 lukem "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6768 1.1 lukem
6769 1.1 lukem Compile a source file into a libtool library object.
6770 1.1 lukem
6771 1.1 lukem This mode accepts the following additional options:
6772 1.1 lukem
6773 1.1 lukem -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6774 1.1 lukem -prefer-pic try to building PIC objects only
6775 1.1 lukem -prefer-non-pic try to building non-PIC objects only
6776 1.1 lukem -static always build a \`.o' file suitable for static linking
6777 1.1 lukem
6778 1.1 lukem COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6779 1.1 lukem from the given SOURCEFILE.
6780 1.1 lukem
6781 1.1 lukem The output file name is determined by removing the directory component from
6782 1.1 lukem SOURCEFILE, then substituting the C source code suffix \`.c' with the
6783 1.1 lukem library object suffix, \`.lo'."
6784 1.1 lukem ;;
6785 1.1 lukem
6786 1.1 lukem execute)
6787 1.1 lukem $echo \
6788 1.1 lukem "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6789 1.1 lukem
6790 1.1 lukem Automatically set library path, then run a program.
6791 1.1 lukem
6792 1.1 lukem This mode accepts the following additional options:
6793 1.1 lukem
6794 1.1 lukem -dlopen FILE add the directory containing FILE to the library path
6795 1.1 lukem
6796 1.1 lukem This mode sets the library path environment variable according to \`-dlopen'
6797 1.1 lukem flags.
6798 1.1 lukem
6799 1.1 lukem If any of the ARGS are libtool executable wrappers, then they are translated
6800 1.1 lukem into their corresponding uninstalled binary, and any of their required library
6801 1.1 lukem directories are added to the library path.
6802 1.1 lukem
6803 1.1 lukem Then, COMMAND is executed, with ARGS as arguments."
6804 1.1 lukem ;;
6805 1.1 lukem
6806 1.1 lukem finish)
6807 1.1 lukem $echo \
6808 1.1 lukem "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6809 1.1 lukem
6810 1.1 lukem Complete the installation of libtool libraries.
6811 1.1 lukem
6812 1.1 lukem Each LIBDIR is a directory that contains libtool libraries.
6813 1.1 lukem
6814 1.1 lukem The commands that this mode executes may require superuser privileges. Use
6815 1.1 lukem the \`--dry-run' option if you just want to see what would be executed."
6816 1.1 lukem ;;
6817 1.1 lukem
6818 1.1 lukem install)
6819 1.1 lukem $echo \
6820 1.1 lukem "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6821 1.1 lukem
6822 1.1 lukem Install executables or libraries.
6823 1.1 lukem
6824 1.1 lukem INSTALL-COMMAND is the installation command. The first component should be
6825 1.1 lukem either the \`install' or \`cp' program.
6826 1.1 lukem
6827 1.1 lukem The rest of the components are interpreted as arguments to that command (only
6828 1.1 lukem BSD-compatible install options are recognized)."
6829 1.1 lukem ;;
6830 1.1 lukem
6831 1.1 lukem link)
6832 1.1 lukem $echo \
6833 1.1 lukem "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6834 1.1 lukem
6835 1.1 lukem Link object files or libraries together to form another library, or to
6836 1.1 lukem create an executable program.
6837 1.1 lukem
6838 1.1 lukem LINK-COMMAND is a command using the C compiler that you would use to create
6839 1.1 lukem a program from several object files.
6840 1.1 lukem
6841 1.1 lukem The following components of LINK-COMMAND are treated specially:
6842 1.1 lukem
6843 1.1 lukem -all-static do not do any dynamic linking at all
6844 1.1 lukem -avoid-version do not add a version suffix if possible
6845 1.1 lukem -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6846 1.1 lukem -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6847 1.1 lukem -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6848 1.1 lukem -export-symbols SYMFILE
6849 1.1 lukem try to export only the symbols listed in SYMFILE
6850 1.1 lukem -export-symbols-regex REGEX
6851 1.1 lukem try to export only the symbols matching REGEX
6852 1.1 lukem -LLIBDIR search LIBDIR for required installed libraries
6853 1.1 lukem -lNAME OUTPUT-FILE requires the installed library libNAME
6854 1.1 lukem -module build a library that can dlopened
6855 1.1 lukem -no-fast-install disable the fast-install mode
6856 1.1 lukem -no-install link a not-installable executable
6857 1.1 lukem -no-undefined declare that a library does not refer to external symbols
6858 1.1 lukem -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6859 1.1 lukem -objectlist FILE Use a list of object files found in FILE to specify objects
6860 1.1 lukem -precious-files-regex REGEX
6861 1.1 lukem don't remove output files matching REGEX
6862 1.1 lukem -release RELEASE specify package release information
6863 1.1 lukem -rpath LIBDIR the created library will eventually be installed in LIBDIR
6864 1.1 lukem -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6865 1.1 lukem -static do not do any dynamic linking of libtool libraries
6866 1.1 lukem -version-info CURRENT[:REVISION[:AGE]]
6867 1.1 lukem specify library version info [each variable defaults to 0]
6868 1.1 lukem
6869 1.1 lukem All other options (arguments beginning with \`-') are ignored.
6870 1.1 lukem
6871 1.1 lukem Every other argument is treated as a filename. Files ending in \`.la' are
6872 1.1 lukem treated as uninstalled libtool libraries, other files are standard or library
6873 1.1 lukem object files.
6874 1.1 lukem
6875 1.1 lukem If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6876 1.1 lukem only library objects (\`.lo' files) may be specified, and \`-rpath' is
6877 1.1 lukem required, except when creating a convenience library.
6878 1.1 lukem
6879 1.1 lukem If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6880 1.1 lukem using \`ar' and \`ranlib', or on Windows using \`lib'.
6881 1.1 lukem
6882 1.1 lukem If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6883 1.1 lukem is created, otherwise an executable program is created."
6884 1.1 lukem ;;
6885 1.1 lukem
6886 1.1 lukem uninstall)
6887 1.1 lukem $echo \
6888 1.1 lukem "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6889 1.1 lukem
6890 1.1 lukem Remove libraries from an installation directory.
6891 1.1 lukem
6892 1.1 lukem RM is the name of the program to use to delete files associated with each FILE
6893 1.1 lukem (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6894 1.1 lukem to RM.
6895 1.1 lukem
6896 1.1 lukem If FILE is a libtool library, all the files associated with it are deleted.
6897 1.1 lukem Otherwise, only FILE itself is deleted using RM."
6898 1.1 lukem ;;
6899 1.1 lukem
6900 1.1 lukem *)
6901 1.1 lukem $echo "$modename: invalid operation mode \`$mode'" 1>&2
6902 1.1 lukem $echo "$help" 1>&2
6903 1.1 lukem exit $EXIT_FAILURE
6904 1.1 lukem ;;
6905 1.1 lukem esac
6906 1.1 lukem
6907 1.1 lukem $echo
6908 1.1 lukem $echo "Try \`$modename --help' for more information about other modes."
6909 1.1 lukem
6910 1.1 lukem exit $?
6911 1.1 lukem
6912 1.1 lukem # The TAGs below are defined such that we never get into a situation
6913 1.1 lukem # in which we disable both kinds of libraries. Given conflicting
6914 1.1 lukem # choices, we go for a static library, that is the most portable,
6915 1.1 lukem # since we can't tell whether shared libraries were disabled because
6916 1.1 lukem # the user asked for that or because the platform doesn't support
6917 1.1 lukem # them. This is particularly important on AIX, because we don't
6918 1.1 lukem # support having both static and shared libraries enabled at the same
6919 1.1 lukem # time on that platform, so we default to a shared-only configuration.
6920 1.1 lukem # If a disable-shared tag is given, we'll fallback to a static-only
6921 1.1 lukem # configuration. But we'll never go from static-only to shared-only.
6922 1.1 lukem
6923 1.1 lukem # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6924 1.1 lukem disable_libs=shared
6925 1.1 lukem # ### END LIBTOOL TAG CONFIG: disable-shared
6926 1.1 lukem
6927 1.1 lukem # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6928 1.1 lukem disable_libs=static
6929 1.1 lukem # ### END LIBTOOL TAG CONFIG: disable-static
6930 1.1 lukem
6931 1.1 lukem # Local Variables:
6932 1.1 lukem # mode:shell-script
6933 1.1 lukem # sh-indentation:2
6934 1.1 lukem # End:
6935