Compiled short changelog from git history
[libipt_ACCOUNT] / ltmain.sh
CommitLineData
3a07e3fb
TJ
1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun configure.
3#
fa7f168c 4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
ef04510a 5# 2007, 2008 Free Software Foundation, Inc.
3a07e3fb
TJ
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
fa7f168c 20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
3a07e3fb
TJ
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
fa7f168c
TJ
27basename="s,^.*/,,g"
28
29# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30# is ksh but when the shell is invoked as "sh" and the current value of
31# the _XPG environment variable is not equal to 1 (one), the special
32# positional parameter $0, within a function call, is the name of the
33# function.
34progpath="$0"
35
36# The name of this program:
37progname=`echo "$progpath" | $SED $basename`
38modename="$progname"
39
40# Global variables:
41EXIT_SUCCESS=0
42EXIT_FAILURE=1
43
44PROGRAM=ltmain.sh
45PACKAGE=libtool
ef04510a
TJ
46VERSION=1.5.26
47TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
fa7f168c
TJ
48
49# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51 emulate sh
52 NULLCMD=:
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
56 setopt NO_GLOB_SUBST
57else
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59fi
60BIN_SH=xpg4; export BIN_SH # for Tru64
61DUALCASE=1; export DUALCASE # for MKS sh
62
3a07e3fb
TJ
63# Check that we have a working $echo.
64if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
66 shift
67elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
69 :
70elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
72 :
73else
74 # Restart under the correct shell, and then maybe $echo will work.
fa7f168c 75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
3a07e3fb
TJ
76fi
77
78if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
80 shift
81 cat <<EOF
82$*
83EOF
fa7f168c 84 exit $EXIT_SUCCESS
3a07e3fb
TJ
85fi
86
3a07e3fb
TJ
87default_mode=
88help="Try \`$progname --help' for more information."
89magic="%%%MAGIC variable%%%"
90mkdir="mkdir"
91mv="mv -f"
92rm="rm -f"
93
94# Sed substitution that helps us do robust quoting. It backslashifies
95# metacharacters that are still active within double-quoted strings.
fa7f168c 96Xsed="${SED}"' -e 1s/^X//'
3a07e3fb 97sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
fa7f168c
TJ
98# test EBCDIC or ASCII
99case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102 SP2NL='tr \040 \012'
103 NL2SP='tr \015\012 \040\040'
104 ;;
105 *) # EBCDIC based system
106 SP2NL='tr \100 \n'
107 NL2SP='tr \r\n \100\100'
108 ;;
109esac
3a07e3fb
TJ
110
111# NLS nuisances.
112# Only set LANG and LC_ALL to C if already set.
113# These must not be set unconditionally because not all systems understand
114# e.g. LANG=C (notably SCO).
115# We save the old values to restore during execute mode.
ef04510a
TJ
116lt_env=
117for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
fa7f168c
TJ
118do
119 eval "if test \"\${$lt_var+set}\" = set; then
120 save_$lt_var=\$$lt_var
ef04510a 121 lt_env=\"$lt_var=\$$lt_var \$lt_env\"
fa7f168c
TJ
122 $lt_var=C
123 export $lt_var
124 fi"
125done
3a07e3fb 126
ef04510a
TJ
127if test -n "$lt_env"; then
128 lt_env="env $lt_env"
129fi
130
3a07e3fb 131# Make sure IFS has a sensible default
fa7f168c
TJ
132lt_nl='
133'
134IFS=" $lt_nl"
3a07e3fb
TJ
135
136if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
fa7f168c
TJ
137 $echo "$modename: not configured to build any kind of library" 1>&2
138 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
139 exit $EXIT_FAILURE
3a07e3fb
TJ
140fi
141
142# Global variables.
143mode=$default_mode
144nonopt=
145prev=
146prevopt=
147run=
148show="$echo"
149show_help=
150execute_dlfiles=
fa7f168c
TJ
151duplicate_deps=no
152preserve_args=
3a07e3fb
TJ
153lo2o="s/\\.lo\$/.${objext}/"
154o2lo="s/\\.${objext}\$/.lo/"
fa7f168c
TJ
155extracted_archives=
156extracted_serial=0
157
158#####################################
159# Shell function definitions:
160# This seems to be the best place for them
161
162# func_mktempdir [string]
163# Make a temporary directory that won't clash with other running
164# libtool processes, and avoids race conditions if possible. If
165# given, STRING is the basename for that directory.
166func_mktempdir ()
167{
168 my_template="${TMPDIR-/tmp}/${1-$progname}"
169
170 if test "$run" = ":"; then
171 # Return a directory name, but don't create it in dry-run mode
172 my_tmpdir="${my_template}-$$"
173 else
174
175 # If mktemp works, use that first and foremost
176 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177
178 if test ! -d "$my_tmpdir"; then
179 # Failing that, at least try and use $RANDOM to avoid a race
180 my_tmpdir="${my_template}-${RANDOM-0}$$"
181
182 save_mktempdir_umask=`umask`
183 umask 0077
184 $mkdir "$my_tmpdir"
185 umask $save_mktempdir_umask
186 fi
187
188 # If we're not in dry-run mode, bomb out on failure
189 test -d "$my_tmpdir" || {
190 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191 exit $EXIT_FAILURE
192 }
193 fi
194
195 $echo "X$my_tmpdir" | $Xsed
196}
197
198
199# func_win32_libid arg
200# return the library type of file 'arg'
201#
202# Need a lot of goo to handle *both* DLLs and import libs
203# Has to be a shell function in order to 'eat' the argument
204# that is supplied when $file_magic_command is called.
205func_win32_libid ()
206{
207 win32_libid_type="unknown"
208 win32_fileres=`file -L $1 2>/dev/null`
209 case $win32_fileres in
210 *ar\ archive\ import\ library*) # definitely import
211 win32_libid_type="x86 archive import"
212 ;;
213 *ar\ archive*) # could be an import, or static
214 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216 win32_nmres=`eval $NM -f posix -A $1 | \
217 $SED -n -e '1,100{
218 / I /{
219 s,.*,import,
220 p
221 q
222 }
223 }'`
224 case $win32_nmres in
225 import*) win32_libid_type="x86 archive import";;
226 *) win32_libid_type="x86 archive static";;
227 esac
228 fi
229 ;;
230 *DLL*)
231 win32_libid_type="x86 DLL"
232 ;;
233 *executable*) # but shell scripts are "executable" too...
234 case $win32_fileres in
235 *MS\ Windows\ PE\ Intel*)
236 win32_libid_type="x86 DLL"
237 ;;
238 esac
239 ;;
240 esac
241 $echo $win32_libid_type
242}
243
244
245# func_infer_tag arg
246# Infer tagged configuration to use if any are available and
247# if one wasn't chosen via the "--tag" command line option.
248# Only attempt this if the compiler in the base compile
249# command doesn't match the default compiler.
250# arg is usually of the form 'gcc ...'
251func_infer_tag ()
252{
253 if test -n "$available_tags" && test -z "$tagname"; then
254 CC_quoted=
255 for arg in $CC; do
256 case $arg in
257 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
258 arg="\"$arg\""
259 ;;
260 esac
261 CC_quoted="$CC_quoted $arg"
262 done
263 case $@ in
264 # Blanks in the command may have been stripped by the calling shell,
265 # but not from the CC environment variable when configure was run.
266 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267 # Blanks at the start of $base_compile will cause this to fail
268 # if we don't check for them as well.
269 *)
270 for z in $available_tags; do
271 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272 # Evaluate the configuration.
273 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274 CC_quoted=
275 for arg in $CC; do
276 # Double-quote args containing other shell metacharacters.
277 case $arg in
278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
279 arg="\"$arg\""
280 ;;
281 esac
282 CC_quoted="$CC_quoted $arg"
283 done
284 case "$@ " in
285 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286 # The compiler in the base compile command matches
287 # the one in the tagged configuration.
288 # Assume this is the tagged configuration we want.
289 tagname=$z
290 break
291 ;;
292 esac
293 fi
294 done
295 # If $tagname still isn't set, then no tagged configuration
296 # was found and let the user know that the "--tag" command
297 # line option must be used.
298 if test -z "$tagname"; then
299 $echo "$modename: unable to infer tagged configuration"
300 $echo "$modename: specify a tag with \`--tag'" 1>&2
301 exit $EXIT_FAILURE
302# else
303# $echo "$modename: using $tagname tagged configuration"
304 fi
305 ;;
306 esac
307 fi
308}
309
310
311# func_extract_an_archive dir oldlib
312func_extract_an_archive ()
313{
314 f_ex_an_ar_dir="$1"; shift
315 f_ex_an_ar_oldlib="$1"
316
317 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320 :
321 else
322 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323 exit $EXIT_FAILURE
324 fi
325}
326
327# func_extract_archives gentop oldlib ...
328func_extract_archives ()
329{
330 my_gentop="$1"; shift
331 my_oldlibs=${1+"$@"}
332 my_oldobjs=""
333 my_xlib=""
334 my_xabs=""
335 my_xdir=""
336 my_status=""
337
338 $show "${rm}r $my_gentop"
339 $run ${rm}r "$my_gentop"
340 $show "$mkdir $my_gentop"
341 $run $mkdir "$my_gentop"
342 my_status=$?
343 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344 exit $my_status
345 fi
346
347 for my_xlib in $my_oldlibs; do
348 # Extract the objects.
349 case $my_xlib in
350 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351 *) my_xabs=`pwd`"/$my_xlib" ;;
352 esac
353 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354 my_xlib_u=$my_xlib
355 while :; do
356 case " $extracted_archives " in
357 *" $my_xlib_u "*)
358 extracted_serial=`expr $extracted_serial + 1`
359 my_xlib_u=lt$extracted_serial-$my_xlib ;;
360 *) break ;;
361 esac
362 done
363 extracted_archives="$extracted_archives $my_xlib_u"
364 my_xdir="$my_gentop/$my_xlib_u"
365
366 $show "${rm}r $my_xdir"
367 $run ${rm}r "$my_xdir"
368 $show "$mkdir $my_xdir"
369 $run $mkdir "$my_xdir"
370 exit_status=$?
371 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372 exit $exit_status
373 fi
374 case $host in
375 *-darwin*)
376 $show "Extracting $my_xabs"
377 # Do not bother doing anything if just a dry run
378 if test -z "$run"; then
379 darwin_orig_dir=`pwd`
380 cd $my_xdir || exit $?
381 darwin_archive=$my_xabs
382 darwin_curdir=`pwd`
383 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385 if test -n "$darwin_arches"; then
386 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387 darwin_arch=
388 $show "$darwin_base_archive has multiple architectures $darwin_arches"
389 for darwin_arch in $darwin_arches ; do
390 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394 cd "$darwin_curdir"
395 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396 done # $darwin_arches
397 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399 darwin_file=
400 darwin_files=
401 for darwin_file in $darwin_filelist; do
402 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403 lipo -create -output "$darwin_file" $darwin_files
404 done # $darwin_filelist
405 ${rm}r unfat-$$
406 cd "$darwin_orig_dir"
407 else
408 cd "$darwin_orig_dir"
409 func_extract_an_archive "$my_xdir" "$my_xabs"
410 fi # $darwin_arches
411 fi # $run
412 ;;
413 *)
414 func_extract_an_archive "$my_xdir" "$my_xabs"
415 ;;
416 esac
417 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418 done
419 func_extract_archives_result="$my_oldobjs"
420}
421# End of Shell function definitions
422#####################################
423
424# Darwin sucks
425eval std_shrext=\"$shrext_cmds\"
426
427disable_libs=no
3a07e3fb
TJ
428
429# Parse our command line options once, thoroughly.
fa7f168c 430while test "$#" -gt 0
3a07e3fb
TJ
431do
432 arg="$1"
433 shift
434
435 case $arg in
436 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437 *) optarg= ;;
438 esac
439
440 # If the previous option needs an argument, assign it.
441 if test -n "$prev"; then
442 case $prev in
443 execute_dlfiles)
444 execute_dlfiles="$execute_dlfiles $arg"
445 ;;
fa7f168c
TJ
446 tag)
447 tagname="$arg"
448 preserve_args="${preserve_args}=$arg"
449
450 # Check whether tagname contains only valid characters
451 case $tagname in
452 *[!-_A-Za-z0-9,/]*)
453 $echo "$progname: invalid tag name: $tagname" 1>&2
454 exit $EXIT_FAILURE
455 ;;
456 esac
457
458 case $tagname in
459 CC)
460 # Don't test for the "default" C tag, as we know, it's there, but
461 # not specially marked.
462 ;;
463 *)
464 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465 taglist="$taglist $tagname"
466 # Evaluate the configuration.
467 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468 else
469 $echo "$progname: ignoring unknown tag $tagname" 1>&2
470 fi
471 ;;
472 esac
473 ;;
3a07e3fb
TJ
474 *)
475 eval "$prev=\$arg"
476 ;;
477 esac
478
479 prev=
480 prevopt=
481 continue
482 fi
483
484 # Have we seen a non-optional argument yet?
485 case $arg in
486 --help)
487 show_help=yes
488 ;;
489
490 --version)
fa7f168c
TJ
491 echo "\
492$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493
ef04510a 494Copyright (C) 2008 Free Software Foundation, Inc.
fa7f168c
TJ
495This is free software; see the source for copying conditions. There is NO
496warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497 exit $?
3a07e3fb
TJ
498 ;;
499
500 --config)
fa7f168c
TJ
501 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502 # Now print the configurations for the tags.
503 for tagname in $taglist; do
504 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505 done
506 exit $?
3a07e3fb
TJ
507 ;;
508
509 --debug)
fa7f168c 510 $echo "$progname: enabling shell trace mode"
3a07e3fb 511 set -x
fa7f168c 512 preserve_args="$preserve_args $arg"
3a07e3fb
TJ
513 ;;
514
515 --dry-run | -n)
516 run=:
517 ;;
518
519 --features)
fa7f168c 520 $echo "host: $host"
3a07e3fb 521 if test "$build_libtool_libs" = yes; then
fa7f168c 522 $echo "enable shared libraries"
3a07e3fb 523 else
fa7f168c 524 $echo "disable shared libraries"
3a07e3fb
TJ
525 fi
526 if test "$build_old_libs" = yes; then
fa7f168c 527 $echo "enable static libraries"
3a07e3fb 528 else
fa7f168c 529 $echo "disable static libraries"
3a07e3fb 530 fi
fa7f168c 531 exit $?
3a07e3fb
TJ
532 ;;
533
534 --finish) mode="finish" ;;
535
536 --mode) prevopt="--mode" prev=mode ;;
537 --mode=*) mode="$optarg" ;;
538
fa7f168c
TJ
539 --preserve-dup-deps) duplicate_deps="yes" ;;
540
3a07e3fb
TJ
541 --quiet | --silent)
542 show=:
fa7f168c
TJ
543 preserve_args="$preserve_args $arg"
544 ;;
545
546 --tag)
547 prevopt="--tag"
548 prev=tag
549 preserve_args="$preserve_args --tag"
550 ;;
551 --tag=*)
552 set tag "$optarg" ${1+"$@"}
553 shift
554 prev=tag
555 preserve_args="$preserve_args --tag"
3a07e3fb
TJ
556 ;;
557
558 -dlopen)
559 prevopt="-dlopen"
560 prev=execute_dlfiles
561 ;;
562
563 -*)
564 $echo "$modename: unrecognized option \`$arg'" 1>&2
565 $echo "$help" 1>&2
fa7f168c 566 exit $EXIT_FAILURE
3a07e3fb
TJ
567 ;;
568
569 *)
570 nonopt="$arg"
571 break
572 ;;
573 esac
574done
575
576if test -n "$prevopt"; then
577 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578 $echo "$help" 1>&2
fa7f168c 579 exit $EXIT_FAILURE
3a07e3fb
TJ
580fi
581
fa7f168c
TJ
582case $disable_libs in
583no)
584 ;;
585shared)
586 build_libtool_libs=no
587 build_old_libs=yes
588 ;;
589static)
590 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591 ;;
592esac
593
3a07e3fb
TJ
594# If this variable is set in any of the actions, the command in it
595# will be execed at the end. This prevents here-documents from being
596# left over by shells.
597exec_cmd=
598
599if test -z "$show_help"; then
600
601 # Infer the operation mode.
602 if test -z "$mode"; then
fa7f168c
TJ
603 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
3a07e3fb 605 case $nonopt in
fa7f168c 606 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
3a07e3fb
TJ
607 mode=link
608 for arg
609 do
610 case $arg in
611 -c)
612 mode=compile
613 break
614 ;;
615 esac
616 done
617 ;;
618 *db | *dbx | *strace | *truss)
619 mode=execute
620 ;;
621 *install*|cp|mv)
622 mode=install
623 ;;
624 *rm)
625 mode=uninstall
626 ;;
627 *)
628 # If we have no mode, but dlfiles were specified, then do execute mode.
629 test -n "$execute_dlfiles" && mode=execute
630
631 # Just use the default operation mode.
632 if test -z "$mode"; then
633 if test -n "$nonopt"; then
634 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635 else
636 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637 fi
638 fi
639 ;;
640 esac
641 fi
642
643 # Only execute mode is allowed to have -dlopen flags.
644 if test -n "$execute_dlfiles" && test "$mode" != execute; then
645 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646 $echo "$help" 1>&2
fa7f168c 647 exit $EXIT_FAILURE
3a07e3fb
TJ
648 fi
649
650 # Change the help message to a mode-specific one.
651 generic_help="$help"
652 help="Try \`$modename --help --mode=$mode' for more information."
653
654 # These modes are in order of execution frequency so that they run quickly.
655 case $mode in
656 # libtool compile mode
657 compile)
658 modename="$modename: compile"
659 # Get the compilation command and the source file.
660 base_compile=
fa7f168c
TJ
661 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
662 suppress_opt=yes
3a07e3fb 663 suppress_output=
fa7f168c
TJ
664 arg_mode=normal
665 libobj=
666 later=
3a07e3fb 667
3a07e3fb
TJ
668 for arg
669 do
fa7f168c
TJ
670 case $arg_mode in
671 arg )
672 # do not "continue". Instead, add this to base_compile
673 lastarg="$arg"
674 arg_mode=normal
675 ;;
3a07e3fb 676
fa7f168c
TJ
677 target )
678 libobj="$arg"
679 arg_mode=normal
3a07e3fb
TJ
680 continue
681 ;;
3a07e3fb 682
fa7f168c
TJ
683 normal )
684 # Accept any command-line options.
685 case $arg in
686 -o)
687 if test -n "$libobj" ; then
688 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689 exit $EXIT_FAILURE
690 fi
691 arg_mode=target
692 continue
693 ;;
3a07e3fb 694
fa7f168c
TJ
695 -static | -prefer-pic | -prefer-non-pic)
696 later="$later $arg"
697 continue
698 ;;
3a07e3fb 699
fa7f168c
TJ
700 -no-suppress)
701 suppress_opt=no
702 continue
703 ;;
3a07e3fb 704
fa7f168c
TJ
705 -Xcompiler)
706 arg_mode=arg # the next one goes into the "base_compile" arg list
707 continue # The current "srcfile" will either be retained or
708 ;; # replaced later. I would guess that would be a bug.
3a07e3fb 709
fa7f168c
TJ
710 -Wc,*)
711 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712 lastarg=
713 save_ifs="$IFS"; IFS=','
714 for arg in $args; do
715 IFS="$save_ifs"
3a07e3fb 716
fa7f168c
TJ
717 # Double-quote args containing other shell metacharacters.
718 # Many Bourne shells cannot handle close brackets correctly
719 # in scan sets, so we specify it separately.
720 case $arg in
721 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
722 arg="\"$arg\""
723 ;;
724 esac
725 lastarg="$lastarg $arg"
726 done
3a07e3fb 727 IFS="$save_ifs"
fa7f168c 728 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
3a07e3fb 729
fa7f168c 730 # Add the arguments to base_compile.
3a07e3fb 731 base_compile="$base_compile $lastarg"
fa7f168c
TJ
732 continue
733 ;;
3a07e3fb 734
fa7f168c
TJ
735 * )
736 # Accept the current argument as the source file.
737 # The previous "srcfile" becomes the current argument.
738 #
739 lastarg="$srcfile"
740 srcfile="$arg"
741 ;;
742 esac # case $arg
3a07e3fb 743 ;;
fa7f168c 744 esac # case $arg_mode
3a07e3fb
TJ
745
746 # Aesthetically quote the previous argument.
3a07e3fb
TJ
747 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748
fa7f168c 749 case $lastarg in
3a07e3fb
TJ
750 # Double-quote args containing other shell metacharacters.
751 # Many Bourne shells cannot handle close brackets correctly
fa7f168c
TJ
752 # in scan sets, and some SunOS ksh mistreat backslash-escaping
753 # in scan sets (worked around with variable expansion),
754 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755 # at all, so we specify them separately.
3a07e3fb
TJ
756 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
757 lastarg="\"$lastarg\""
758 ;;
759 esac
760
fa7f168c
TJ
761 base_compile="$base_compile $lastarg"
762 done # for arg
3a07e3fb 763
fa7f168c
TJ
764 case $arg_mode in
765 arg)
766 $echo "$modename: you must specify an argument for -Xcompile"
767 exit $EXIT_FAILURE
3a07e3fb 768 ;;
fa7f168c
TJ
769 target)
770 $echo "$modename: you must specify a target with \`-o'" 1>&2
771 exit $EXIT_FAILURE
3a07e3fb
TJ
772 ;;
773 *)
fa7f168c
TJ
774 # Get the name of the library object.
775 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
3a07e3fb
TJ
776 ;;
777 esac
778
779 # Recognize several different file suffixes.
780 # If the user specifies -o file.o, it is replaced with file.lo
fa7f168c 781 xform='[cCFSifmso]'
3a07e3fb
TJ
782 case $libobj in
783 *.ada) xform=ada ;;
784 *.adb) xform=adb ;;
785 *.ads) xform=ads ;;
786 *.asm) xform=asm ;;
787 *.c++) xform=c++ ;;
788 *.cc) xform=cc ;;
fa7f168c
TJ
789 *.ii) xform=ii ;;
790 *.class) xform=class ;;
3a07e3fb
TJ
791 *.cpp) xform=cpp ;;
792 *.cxx) xform=cxx ;;
fa7f168c 793 *.[fF][09]?) xform=[fF][09]. ;;
3a07e3fb 794 *.for) xform=for ;;
fa7f168c
TJ
795 *.java) xform=java ;;
796 *.obj) xform=obj ;;
ef04510a 797 *.sx) xform=sx ;;
3a07e3fb
TJ
798 esac
799
800 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801
802 case $libobj in
803 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804 *)
805 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
fa7f168c 806 exit $EXIT_FAILURE
3a07e3fb
TJ
807 ;;
808 esac
809
fa7f168c
TJ
810 func_infer_tag $base_compile
811
812 for arg in $later; do
813 case $arg in
814 -static)
815 build_old_libs=yes
816 continue
817 ;;
818
819 -prefer-pic)
820 pic_mode=yes
821 continue
822 ;;
823
824 -prefer-non-pic)
825 pic_mode=no
826 continue
827 ;;
828 esac
829 done
830
831 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832 case $qlibobj in
833 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834 qlibobj="\"$qlibobj\"" ;;
835 esac
836 test "X$libobj" != "X$qlibobj" \
837 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
838 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841 if test "X$xdir" = "X$obj"; then
842 xdir=
843 else
844 xdir=$xdir/
845 fi
846 lobj=${xdir}$objdir/$objname
847
3a07e3fb
TJ
848 if test -z "$base_compile"; then
849 $echo "$modename: you must specify a compilation command" 1>&2
850 $echo "$help" 1>&2
fa7f168c 851 exit $EXIT_FAILURE
3a07e3fb
TJ
852 fi
853
854 # Delete any leftover library objects.
855 if test "$build_old_libs" = yes; then
fa7f168c 856 removelist="$obj $lobj $libobj ${libobj}T"
3a07e3fb 857 else
fa7f168c 858 removelist="$lobj $libobj ${libobj}T"
3a07e3fb
TJ
859 fi
860
861 $run $rm $removelist
fa7f168c 862 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
3a07e3fb
TJ
863
864 # On Cygwin there's no "real" PIC flag so we must build both object types
865 case $host_os in
866 cygwin* | mingw* | pw32* | os2*)
867 pic_mode=default
868 ;;
869 esac
870 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871 # non-PIC code in shared libraries is not supported
872 pic_mode=default
873 fi
874
875 # Calculate the filename of the output object if compiler does
876 # not support -o with -c
877 if test "$compiler_c_o" = no; then
878 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879 lockfile="$output_obj.lock"
880 removelist="$removelist $output_obj $lockfile"
fa7f168c 881 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
3a07e3fb 882 else
fa7f168c 883 output_obj=
3a07e3fb
TJ
884 need_locks=no
885 lockfile=
886 fi
887
888 # Lock this critical section if it is needed
889 # We use this script file to make the link, it avoids creating a new file
890 if test "$need_locks" = yes; then
fa7f168c 891 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
3a07e3fb
TJ
892 $show "Waiting for $lockfile to be removed"
893 sleep 2
894 done
895 elif test "$need_locks" = warn; then
896 if test -f "$lockfile"; then
fa7f168c 897 $echo "\
3a07e3fb
TJ
898*** ERROR, $lockfile exists and contains:
899`cat $lockfile 2>/dev/null`
900
901This indicates that another process is trying to use the same
902temporary object file, and libtool could not work around it because
903your compiler does not support \`-c' and \`-o' together. If you
904repeat this compilation, it may succeed, by chance, but you had better
905avoid parallel builds (make -j) in this platform, or get a better
906compiler."
907
908 $run $rm $removelist
fa7f168c 909 exit $EXIT_FAILURE
3a07e3fb 910 fi
fa7f168c 911 $echo "$srcfile" > "$lockfile"
3a07e3fb
TJ
912 fi
913
914 if test -n "$fix_srcfile_path"; then
915 eval srcfile=\"$fix_srcfile_path\"
916 fi
fa7f168c
TJ
917 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
918 case $qsrcfile in
919 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
920 qsrcfile="\"$qsrcfile\"" ;;
921 esac
922
923 $run $rm "$libobj" "${libobj}T"
924
925 # Create a libtool object file (analogous to a ".la" file),
926 # but don't create it if we're doing a dry run.
927 test -z "$run" && cat > ${libobj}T <<EOF
928# $libobj - a libtool object file
929# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
930#
931# Please DO NOT delete this file!
932# It is necessary for linking the library.
933
934# Name of the PIC object.
935EOF
3a07e3fb
TJ
936
937 # Only build a PIC object if we are building libtool libraries.
938 if test "$build_libtool_libs" = yes; then
939 # Without this assignment, base_compile gets emptied.
940 fbsd_hideous_sh_bug=$base_compile
941
942 if test "$pic_mode" != no; then
fa7f168c 943 command="$base_compile $qsrcfile $pic_flag"
3a07e3fb
TJ
944 else
945 # Don't build PIC code
fa7f168c 946 command="$base_compile $qsrcfile"
3a07e3fb 947 fi
3a07e3fb 948
fa7f168c
TJ
949 if test ! -d "${xdir}$objdir"; then
950 $show "$mkdir ${xdir}$objdir"
951 $run $mkdir ${xdir}$objdir
952 exit_status=$?
953 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
954 exit $exit_status
3a07e3fb
TJ
955 fi
956 fi
fa7f168c
TJ
957
958 if test -z "$output_obj"; then
959 # Place PIC objects in $objdir
960 command="$command -o $lobj"
3a07e3fb
TJ
961 fi
962
fa7f168c
TJ
963 $run $rm "$lobj" "$output_obj"
964
3a07e3fb 965 $show "$command"
ef04510a 966 if $run eval $lt_env "$command"; then :
3a07e3fb
TJ
967 else
968 test -n "$output_obj" && $run $rm $removelist
fa7f168c 969 exit $EXIT_FAILURE
3a07e3fb
TJ
970 fi
971
972 if test "$need_locks" = warn &&
fa7f168c
TJ
973 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
974 $echo "\
3a07e3fb
TJ
975*** ERROR, $lockfile contains:
976`cat $lockfile 2>/dev/null`
977
978but it should contain:
979$srcfile
980
981This indicates that another process is trying to use the same
982temporary object file, and libtool could not work around it because
983your compiler does not support \`-c' and \`-o' together. If you
984repeat this compilation, it may succeed, by chance, but you had better
985avoid parallel builds (make -j) in this platform, or get a better
986compiler."
987
988 $run $rm $removelist
fa7f168c 989 exit $EXIT_FAILURE
3a07e3fb
TJ
990 fi
991
992 # Just move the object if needed, then go on to compile the next one
fa7f168c
TJ
993 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
994 $show "$mv $output_obj $lobj"
995 if $run $mv $output_obj $lobj; then :
3a07e3fb
TJ
996 else
997 error=$?
998 $run $rm $removelist
999 exit $error
1000 fi
1001 fi
1002
fa7f168c
TJ
1003 # Append the name of the PIC object to the libtool object file.
1004 test -z "$run" && cat >> ${libobj}T <<EOF
1005pic_object='$objdir/$objname'
3a07e3fb 1006
fa7f168c 1007EOF
3a07e3fb 1008
fa7f168c
TJ
1009 # Allow error messages only from the first compilation.
1010 if test "$suppress_opt" = yes; then
1011 suppress_output=' >/dev/null 2>&1'
3a07e3fb 1012 fi
fa7f168c
TJ
1013 else
1014 # No PIC object so indicate it doesn't exist in the libtool
1015 # object file.
1016 test -z "$run" && cat >> ${libobj}T <<EOF
1017pic_object=none
3a07e3fb 1018
fa7f168c 1019EOF
3a07e3fb
TJ
1020 fi
1021
1022 # Only build a position-dependent object if we build old libraries.
1023 if test "$build_old_libs" = yes; then
1024 if test "$pic_mode" != yes; then
1025 # Don't build PIC code
fa7f168c 1026 command="$base_compile $qsrcfile"
3a07e3fb 1027 else
fa7f168c 1028 command="$base_compile $qsrcfile $pic_flag"
3a07e3fb
TJ
1029 fi
1030 if test "$compiler_c_o" = yes; then
1031 command="$command -o $obj"
3a07e3fb
TJ
1032 fi
1033
1034 # Suppress compiler output if we already did a PIC compilation.
1035 command="$command$suppress_output"
fa7f168c 1036 $run $rm "$obj" "$output_obj"
3a07e3fb 1037 $show "$command"
ef04510a 1038 if $run eval $lt_env "$command"; then :
3a07e3fb
TJ
1039 else
1040 $run $rm $removelist
fa7f168c 1041 exit $EXIT_FAILURE
3a07e3fb
TJ
1042 fi
1043
1044 if test "$need_locks" = warn &&
fa7f168c
TJ
1045 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1046 $echo "\
3a07e3fb
TJ
1047*** ERROR, $lockfile contains:
1048`cat $lockfile 2>/dev/null`
1049
1050but it should contain:
1051$srcfile
1052
1053This indicates that another process is trying to use the same
1054temporary object file, and libtool could not work around it because
1055your compiler does not support \`-c' and \`-o' together. If you
1056repeat this compilation, it may succeed, by chance, but you had better
1057avoid parallel builds (make -j) in this platform, or get a better
1058compiler."
1059
1060 $run $rm $removelist
fa7f168c 1061 exit $EXIT_FAILURE
3a07e3fb
TJ
1062 fi
1063
1064 # Just move the object if needed
fa7f168c 1065 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
3a07e3fb
TJ
1066 $show "$mv $output_obj $obj"
1067 if $run $mv $output_obj $obj; then :
1068 else
1069 error=$?
1070 $run $rm $removelist
1071 exit $error
1072 fi
1073 fi
1074
fa7f168c
TJ
1075 # Append the name of the non-PIC object the libtool object file.
1076 # Only append if the libtool object file exists.
1077 test -z "$run" && cat >> ${libobj}T <<EOF
1078# Name of the non-PIC object.
1079non_pic_object='$objname'
1080
1081EOF
1082 else
1083 # Append the name of the non-PIC object the libtool object file.
1084 # Only append if the libtool object file exists.
1085 test -z "$run" && cat >> ${libobj}T <<EOF
1086# Name of the non-PIC object.
1087non_pic_object=none
1088
1089EOF
3a07e3fb
TJ
1090 fi
1091
fa7f168c
TJ
1092 $run $mv "${libobj}T" "${libobj}"
1093
3a07e3fb
TJ
1094 # Unlock the critical section if it was locked
1095 if test "$need_locks" != no; then
1096 $run $rm "$lockfile"
1097 fi
1098
fa7f168c 1099 exit $EXIT_SUCCESS
3a07e3fb
TJ
1100 ;;
1101
1102 # libtool link mode
1103 link | relink)
1104 modename="$modename: link"
1105 case $host in
1106 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1107 # It is impossible to link a dll without this setting, and
1108 # we shouldn't force the makefile maintainer to figure out
1109 # which system we are compiling for in order to pass an extra
fa7f168c 1110 # flag for every libtool invocation.
3a07e3fb
TJ
1111 # allow_undefined=no
1112
1113 # FIXME: Unfortunately, there are problems with the above when trying
1114 # to make a dll which has undefined symbols, in which case not
1115 # even a static library is built. For now, we need to specify
1116 # -no-undefined on the libtool link line when we can be certain
1117 # that all symbols are satisfied, otherwise we get a static library.
1118 allow_undefined=yes
1119 ;;
1120 *)
1121 allow_undefined=yes
1122 ;;
1123 esac
1124 libtool_args="$nonopt"
fa7f168c 1125 base_compile="$nonopt $@"
3a07e3fb
TJ
1126 compile_command="$nonopt"
1127 finalize_command="$nonopt"
1128
1129 compile_rpath=
1130 finalize_rpath=
1131 compile_shlibpath=
1132 finalize_shlibpath=
1133 convenience=
1134 old_convenience=
1135 deplibs=
1136 old_deplibs=
1137 compiler_flags=
1138 linker_flags=
1139 dllsearchpath=
1140 lib_search_path=`pwd`
fa7f168c 1141 inst_prefix_dir=
3a07e3fb
TJ
1142
1143 avoid_version=no
1144 dlfiles=
1145 dlprefiles=
1146 dlself=no
1147 export_dynamic=no
1148 export_symbols=
1149 export_symbols_regex=
1150 generated=
1151 libobjs=
1152 ltlibs=
1153 module=no
1154 no_install=no
1155 objs=
fa7f168c
TJ
1156 non_pic_objects=
1157 notinst_path= # paths that contain not-installed libtool libraries
1158 precious_files_regex=
3a07e3fb
TJ
1159 prefer_static_libs=no
1160 preload=no
1161 prev=
1162 prevarg=
1163 release=
1164 rpath=
1165 xrpath=
1166 perm_rpath=
1167 temp_rpath=
1168 thread_safe=no
1169 vinfo=
fa7f168c 1170 vinfo_number=no
ef04510a 1171 single_module="${wl}-single_module"
fa7f168c
TJ
1172
1173 func_infer_tag $base_compile
3a07e3fb
TJ
1174
1175 # We need to know -static, to get the right output filenames.
1176 for arg
1177 do
1178 case $arg in
fa7f168c
TJ
1179 -all-static | -static | -static-libtool-libs)
1180 case $arg in
1181 -all-static)
3a07e3fb
TJ
1182 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184 fi
1185 if test -n "$link_static_flag"; then
1186 dlopen_self=$dlopen_self_static
1187 fi
fa7f168c
TJ
1188 prefer_static_libs=yes
1189 ;;
1190 -static)
3a07e3fb
TJ
1191 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1193 fi
fa7f168c
TJ
1194 prefer_static_libs=built
1195 ;;
1196 -static-libtool-libs)
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1199 fi
1200 prefer_static_libs=yes
1201 ;;
1202 esac
3a07e3fb
TJ
1203 build_libtool_libs=no
1204 build_old_libs=yes
3a07e3fb
TJ
1205 break
1206 ;;
1207 esac
1208 done
1209
1210 # See if our shared archives depend on static archives.
1211 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1212
1213 # Go through the arguments, transforming them on the way.
fa7f168c 1214 while test "$#" -gt 0; do
3a07e3fb
TJ
1215 arg="$1"
1216 shift
1217 case $arg in
1218 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1219 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220 ;;
1221 *) qarg=$arg ;;
1222 esac
1223 libtool_args="$libtool_args $qarg"
1224
1225 # If the previous option needs an argument, assign it.
1226 if test -n "$prev"; then
1227 case $prev in
1228 output)
1229 compile_command="$compile_command @OUTPUT@"
1230 finalize_command="$finalize_command @OUTPUT@"
1231 ;;
1232 esac
1233
1234 case $prev in
1235 dlfiles|dlprefiles)
1236 if test "$preload" = no; then
1237 # Add the symbol object into the linking commands.
1238 compile_command="$compile_command @SYMFILE@"
1239 finalize_command="$finalize_command @SYMFILE@"
1240 preload=yes
1241 fi
1242 case $arg in
1243 *.la | *.lo) ;; # We handle these cases below.
1244 force)
1245 if test "$dlself" = no; then
1246 dlself=needless
1247 export_dynamic=yes
1248 fi
1249 prev=
1250 continue
1251 ;;
1252 self)
1253 if test "$prev" = dlprefiles; then
1254 dlself=yes
1255 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1256 dlself=yes
1257 else
1258 dlself=needless
1259 export_dynamic=yes
1260 fi
1261 prev=
1262 continue
1263 ;;
1264 *)
1265 if test "$prev" = dlfiles; then
1266 dlfiles="$dlfiles $arg"
1267 else
1268 dlprefiles="$dlprefiles $arg"
1269 fi
1270 prev=
1271 continue
1272 ;;
1273 esac
1274 ;;
1275 expsyms)
1276 export_symbols="$arg"
1277 if test ! -f "$arg"; then
1278 $echo "$modename: symbol file \`$arg' does not exist"
fa7f168c 1279 exit $EXIT_FAILURE
3a07e3fb
TJ
1280 fi
1281 prev=
1282 continue
1283 ;;
1284 expsyms_regex)
1285 export_symbols_regex="$arg"
1286 prev=
1287 continue
1288 ;;
fa7f168c
TJ
1289 inst_prefix)
1290 inst_prefix_dir="$arg"
1291 prev=
1292 continue
1293 ;;
1294 precious_regex)
1295 precious_files_regex="$arg"
1296 prev=
1297 continue
1298 ;;
3a07e3fb
TJ
1299 release)
1300 release="-$arg"
1301 prev=
1302 continue
1303 ;;
fa7f168c
TJ
1304 objectlist)
1305 if test -f "$arg"; then
1306 save_arg=$arg
1307 moreargs=
1308 for fil in `cat $save_arg`
1309 do
1310# moreargs="$moreargs $fil"
1311 arg=$fil
1312 # A libtool-controlled object.
1313
1314 # Check to see that this really is a libtool object.
1315 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1316 pic_object=
1317 non_pic_object=
1318
1319 # Read the .lo file
1320 # If there is no directory component, then add one.
1321 case $arg in
1322 */* | *\\*) . $arg ;;
1323 *) . ./$arg ;;
1324 esac
1325
1326 if test -z "$pic_object" || \
1327 test -z "$non_pic_object" ||
1328 test "$pic_object" = none && \
1329 test "$non_pic_object" = none; then
1330 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331 exit $EXIT_FAILURE
1332 fi
1333
1334 # Extract subdirectory from the argument.
1335 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336 if test "X$xdir" = "X$arg"; then
1337 xdir=
1338 else
1339 xdir="$xdir/"
1340 fi
1341
1342 if test "$pic_object" != none; then
1343 # Prepend the subdirectory the object is found in.
1344 pic_object="$xdir$pic_object"
1345
1346 if test "$prev" = dlfiles; then
1347 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348 dlfiles="$dlfiles $pic_object"
1349 prev=
1350 continue
1351 else
1352 # If libtool objects are unsupported, then we need to preload.
1353 prev=dlprefiles
1354 fi
1355 fi
1356
1357 # CHECK ME: I think I busted this. -Ossama
1358 if test "$prev" = dlprefiles; then
1359 # Preload the old-style object.
1360 dlprefiles="$dlprefiles $pic_object"
1361 prev=
1362 fi
1363
1364 # A PIC object.
1365 libobjs="$libobjs $pic_object"
1366 arg="$pic_object"
1367 fi
1368
1369 # Non-PIC object.
1370 if test "$non_pic_object" != none; then
1371 # Prepend the subdirectory the object is found in.
1372 non_pic_object="$xdir$non_pic_object"
1373
1374 # A standard non-PIC object
1375 non_pic_objects="$non_pic_objects $non_pic_object"
1376 if test -z "$pic_object" || test "$pic_object" = none ; then
1377 arg="$non_pic_object"
1378 fi
1379 else
1380 # If the PIC object exists, use it instead.
1381 # $xdir was prepended to $pic_object above.
1382 non_pic_object="$pic_object"
1383 non_pic_objects="$non_pic_objects $non_pic_object"
1384 fi
1385 else
1386 # Only an error if not doing a dry-run.
1387 if test -z "$run"; then
1388 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389 exit $EXIT_FAILURE
1390 else
1391 # Dry-run case.
1392
1393 # Extract subdirectory from the argument.
1394 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395 if test "X$xdir" = "X$arg"; then
1396 xdir=
1397 else
1398 xdir="$xdir/"
1399 fi
1400
1401 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403 libobjs="$libobjs $pic_object"
1404 non_pic_objects="$non_pic_objects $non_pic_object"
1405 fi
1406 fi
1407 done
1408 else
1409 $echo "$modename: link input file \`$save_arg' does not exist"
1410 exit $EXIT_FAILURE
1411 fi
1412 arg=$save_arg
1413 prev=
1414 continue
1415 ;;
3a07e3fb
TJ
1416 rpath | xrpath)
1417 # We need an absolute path.
1418 case $arg in
1419 [\\/]* | [A-Za-z]:[\\/]*) ;;
1420 *)
1421 $echo "$modename: only absolute run-paths are allowed" 1>&2
fa7f168c 1422 exit $EXIT_FAILURE
3a07e3fb
TJ
1423 ;;
1424 esac
1425 if test "$prev" = rpath; then
1426 case "$rpath " in
1427 *" $arg "*) ;;
1428 *) rpath="$rpath $arg" ;;
1429 esac
1430 else
1431 case "$xrpath " in
1432 *" $arg "*) ;;
1433 *) xrpath="$xrpath $arg" ;;
1434 esac
1435 fi
1436 prev=
1437 continue
1438 ;;
1439 xcompiler)
1440 compiler_flags="$compiler_flags $qarg"
1441 prev=
1442 compile_command="$compile_command $qarg"
1443 finalize_command="$finalize_command $qarg"
1444 continue
1445 ;;
1446 xlinker)
1447 linker_flags="$linker_flags $qarg"
1448 compiler_flags="$compiler_flags $wl$qarg"
1449 prev=
1450 compile_command="$compile_command $wl$qarg"
1451 finalize_command="$finalize_command $wl$qarg"
1452 continue
1453 ;;
fa7f168c
TJ
1454 xcclinker)
1455 linker_flags="$linker_flags $qarg"
1456 compiler_flags="$compiler_flags $qarg"
1457 prev=
1458 compile_command="$compile_command $qarg"
1459 finalize_command="$finalize_command $qarg"
1460 continue
1461 ;;
1462 shrext)
1463 shrext_cmds="$arg"
1464 prev=
1465 continue
1466 ;;
1467 darwin_framework|darwin_framework_skip)
1468 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469 compile_command="$compile_command $arg"
1470 finalize_command="$finalize_command $arg"
1471 prev=
1472 continue
1473 ;;
3a07e3fb
TJ
1474 *)
1475 eval "$prev=\"\$arg\""
1476 prev=
1477 continue
1478 ;;
1479 esac
fa7f168c 1480 fi # test -n "$prev"
3a07e3fb
TJ
1481
1482 prevarg="$arg"
1483
1484 case $arg in
1485 -all-static)
1486 if test -n "$link_static_flag"; then
1487 compile_command="$compile_command $link_static_flag"
1488 finalize_command="$finalize_command $link_static_flag"
1489 fi
1490 continue
1491 ;;
1492
1493 -allow-undefined)
1494 # FIXME: remove this flag sometime in the future.
1495 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1496 continue
1497 ;;
1498
1499 -avoid-version)
1500 avoid_version=yes
1501 continue
1502 ;;
1503
1504 -dlopen)
1505 prev=dlfiles
1506 continue
1507 ;;
1508
1509 -dlpreopen)
1510 prev=dlprefiles
1511 continue
1512 ;;
1513
1514 -export-dynamic)
1515 export_dynamic=yes
1516 continue
1517 ;;
1518
1519 -export-symbols | -export-symbols-regex)
1520 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521 $echo "$modename: more than one -exported-symbols argument is not allowed"
fa7f168c 1522 exit $EXIT_FAILURE
3a07e3fb
TJ
1523 fi
1524 if test "X$arg" = "X-export-symbols"; then
1525 prev=expsyms
1526 else
1527 prev=expsyms_regex
1528 fi
1529 continue
1530 ;;
1531
fa7f168c
TJ
1532 -framework|-arch|-isysroot)
1533 case " $CC " in
1534 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1535 prev=darwin_framework_skip ;;
1536 *) compiler_flags="$compiler_flags $arg"
1537 prev=darwin_framework ;;
1538 esac
1539 compile_command="$compile_command $arg"
1540 finalize_command="$finalize_command $arg"
1541 continue
1542 ;;
1543
1544 -inst-prefix-dir)
1545 prev=inst_prefix
1546 continue
1547 ;;
1548
3a07e3fb
TJ
1549 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550 # so, if we see these flags be careful not to treat them like -L
1551 -L[A-Z][A-Z]*:*)
1552 case $with_gcc/$host in
fa7f168c 1553 no/*-*-irix* | /*-*-irix*)
3a07e3fb
TJ
1554 compile_command="$compile_command $arg"
1555 finalize_command="$finalize_command $arg"
1556 ;;
1557 esac
1558 continue
1559 ;;
1560
1561 -L*)
1562 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563 # We need an absolute path.
1564 case $dir in
1565 [\\/]* | [A-Za-z]:[\\/]*) ;;
1566 *)
1567 absdir=`cd "$dir" && pwd`
1568 if test -z "$absdir"; then
1569 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
fa7f168c
TJ
1570 absdir="$dir"
1571 notinst_path="$notinst_path $dir"
3a07e3fb
TJ
1572 fi
1573 dir="$absdir"
1574 ;;
1575 esac
1576 case "$deplibs " in
1577 *" -L$dir "*) ;;
1578 *)
1579 deplibs="$deplibs -L$dir"
1580 lib_search_path="$lib_search_path $dir"
1581 ;;
1582 esac
1583 case $host in
1584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
fa7f168c 1585 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3a07e3fb
TJ
1586 case :$dllsearchpath: in
1587 *":$dir:"*) ;;
1588 *) dllsearchpath="$dllsearchpath:$dir";;
1589 esac
fa7f168c
TJ
1590 case :$dllsearchpath: in
1591 *":$testbindir:"*) ;;
1592 *) dllsearchpath="$dllsearchpath:$testbindir";;
1593 esac
3a07e3fb
TJ
1594 ;;
1595 esac
1596 continue
1597 ;;
1598
1599 -l*)
1600 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601 case $host in
fa7f168c 1602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3a07e3fb
TJ
1603 # These systems don't actually have a C or math library (as such)
1604 continue
1605 ;;
fa7f168c 1606 *-*-os2*)
3a07e3fb
TJ
1607 # These systems don't actually have a C library (as such)
1608 test "X$arg" = "X-lc" && continue
1609 ;;
fa7f168c 1610 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3a07e3fb
TJ
1611 # Do not include libc due to us having libc/libc_r.
1612 test "X$arg" = "X-lc" && continue
1613 ;;
fa7f168c
TJ
1614 *-*-rhapsody* | *-*-darwin1.[012])
1615 # Rhapsody C and math libraries are in the System framework
1616 deplibs="$deplibs -framework System"
3a07e3fb
TJ
1617 continue
1618 ;;
fa7f168c
TJ
1619 *-*-sco3.2v5* | *-*-sco5v6*)
1620 # Causes problems with __ctype
1621 test "X$arg" = "X-lc" && continue
1622 ;;
1623 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624 # Compiler inserts libc in the correct place for threads to work
1625 test "X$arg" = "X-lc" && continue
1626 ;;
3a07e3fb 1627 esac
fa7f168c
TJ
1628 elif test "X$arg" = "X-lc_r"; then
1629 case $host in
1630 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631 # Do not include libc_r directly, use -pthread flag.
1632 continue
1633 ;;
1634 esac
3a07e3fb
TJ
1635 fi
1636 deplibs="$deplibs $arg"
1637 continue
1638 ;;
1639
fa7f168c
TJ
1640 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641 # classes, name mangling, and exception handling.
1642 -model)
1643 compile_command="$compile_command $arg"
1644 compiler_flags="$compiler_flags $arg"
1645 finalize_command="$finalize_command $arg"
1646 prev=xcompiler
1647 continue
1648 ;;
1649
1650 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651 compiler_flags="$compiler_flags $arg"
1652 compile_command="$compile_command $arg"
1653 finalize_command="$finalize_command $arg"
1654 continue
1655 ;;
1656
ef04510a
TJ
1657 -multi_module)
1658 single_module="${wl}-multi_module"
1659 continue
1660 ;;
1661
3a07e3fb
TJ
1662 -module)
1663 module=yes
1664 continue
1665 ;;
1666
fa7f168c
TJ
1667 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1669 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670 # +DA*, +DD* enable 64-bit mode on the HP compiler
1671 # -q* pass through compiler args for the IBM compiler
1672 # -m* pass through architecture-specific compiler args for GCC
1673 # -m*, -t[45]*, -txscale* pass through architecture-specific
1674 # compiler args for GCC
1675 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676 # -F/path gives path to uninstalled frameworks, gcc on darwin
1677 # @file GCC response files
1678 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1680
1681 # Unknown arguments in both finalize_command and compile_command need
1682 # to be aesthetically quoted because they are evaled later.
1683 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1684 case $arg in
1685 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1686 arg="\"$arg\""
1687 ;;
1688 esac
1689 compile_command="$compile_command $arg"
1690 finalize_command="$finalize_command $arg"
1691 compiler_flags="$compiler_flags $arg"
1692 continue
1693 ;;
1694
1695 -shrext)
1696 prev=shrext
1697 continue
1698 ;;
1699
3a07e3fb
TJ
1700 -no-fast-install)
1701 fast_install=no
1702 continue
1703 ;;
1704
1705 -no-install)
1706 case $host in
fa7f168c 1707 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
3a07e3fb 1708 # The PATH hackery in wrapper scripts is required on Windows
fa7f168c 1709 # and Darwin in order for the loader to find any dlls it needs.
3a07e3fb
TJ
1710 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1711 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1712 fast_install=no
1713 ;;
1714 *) no_install=yes ;;
1715 esac
1716 continue
1717 ;;
1718
1719 -no-undefined)
1720 allow_undefined=no
1721 continue
1722 ;;
1723
fa7f168c
TJ
1724 -objectlist)
1725 prev=objectlist
1726 continue
1727 ;;
1728
3a07e3fb
TJ
1729 -o) prev=output ;;
1730
fa7f168c
TJ
1731 -precious-files-regex)
1732 prev=precious_regex
1733 continue
1734 ;;
1735
3a07e3fb
TJ
1736 -release)
1737 prev=release
1738 continue
1739 ;;
1740
1741 -rpath)
1742 prev=rpath
1743 continue
1744 ;;
1745
1746 -R)
1747 prev=xrpath
1748 continue
1749 ;;
1750
1751 -R*)
1752 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1753 # We need an absolute path.
1754 case $dir in
1755 [\\/]* | [A-Za-z]:[\\/]*) ;;
1756 *)
1757 $echo "$modename: only absolute run-paths are allowed" 1>&2
fa7f168c 1758 exit $EXIT_FAILURE
3a07e3fb
TJ
1759 ;;
1760 esac
1761 case "$xrpath " in
1762 *" $dir "*) ;;
1763 *) xrpath="$xrpath $dir" ;;
1764 esac
1765 continue
1766 ;;
1767
fa7f168c 1768 -static | -static-libtool-libs)
3a07e3fb
TJ
1769 # The effects of -static are defined in a previous loop.
1770 # We used to do the same as -all-static on platforms that
1771 # didn't have a PIC flag, but the assumption that the effects
1772 # would be equivalent was wrong. It would break on at least
1773 # Digital Unix and AIX.
1774 continue
1775 ;;
1776
1777 -thread-safe)
1778 thread_safe=yes
1779 continue
1780 ;;
1781
1782 -version-info)
1783 prev=vinfo
1784 continue
1785 ;;
fa7f168c
TJ
1786 -version-number)
1787 prev=vinfo
1788 vinfo_number=yes
1789 continue
1790 ;;
3a07e3fb
TJ
1791
1792 -Wc,*)
1793 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1794 arg=
1795 save_ifs="$IFS"; IFS=','
1796 for flag in $args; do
1797 IFS="$save_ifs"
1798 case $flag in
1799 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1800 flag="\"$flag\""
1801 ;;
1802 esac
1803 arg="$arg $wl$flag"
1804 compiler_flags="$compiler_flags $flag"
1805 done
1806 IFS="$save_ifs"
1807 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1808 ;;
1809
1810 -Wl,*)
1811 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1812 arg=
1813 save_ifs="$IFS"; IFS=','
1814 for flag in $args; do
1815 IFS="$save_ifs"
1816 case $flag in
1817 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1818 flag="\"$flag\""
1819 ;;
1820 esac
1821 arg="$arg $wl$flag"
1822 compiler_flags="$compiler_flags $wl$flag"
1823 linker_flags="$linker_flags $flag"
1824 done
1825 IFS="$save_ifs"
1826 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1827 ;;
1828
1829 -Xcompiler)
1830 prev=xcompiler
1831 continue
1832 ;;
1833
1834 -Xlinker)
1835 prev=xlinker
1836 continue
1837 ;;
1838
fa7f168c
TJ
1839 -XCClinker)
1840 prev=xcclinker
1841 continue
1842 ;;
1843
3a07e3fb
TJ
1844 # Some other compiler flag.
1845 -* | +*)
1846 # Unknown arguments in both finalize_command and compile_command need
1847 # to be aesthetically quoted because they are evaled later.
1848 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1849 case $arg in
1850 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1851 arg="\"$arg\""
1852 ;;
1853 esac
1854 ;;
1855
fa7f168c
TJ
1856 *.$objext)
1857 # A standard object.
1858 objs="$objs $arg"
1859 ;;
3a07e3fb 1860
fa7f168c
TJ
1861 *.lo)
1862 # A libtool-controlled object.
1863
1864 # Check to see that this really is a libtool object.
1865 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1866 pic_object=
1867 non_pic_object=
1868
1869 # Read the .lo file
1870 # If there is no directory component, then add one.
3a07e3fb 1871 case $arg in
fa7f168c
TJ
1872 */* | *\\*) . $arg ;;
1873 *) . ./$arg ;;
3a07e3fb 1874 esac
fa7f168c
TJ
1875
1876 if test -z "$pic_object" || \
1877 test -z "$non_pic_object" ||
1878 test "$pic_object" = none && \
1879 test "$non_pic_object" = none; then
1880 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1881 exit $EXIT_FAILURE
1882 fi
1883
1884 # Extract subdirectory from the argument.
1885 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1886 if test "X$xdir" = "X$arg"; then
1887 xdir=
1888 else
1889 xdir="$xdir/"
1890 fi
1891
1892 if test "$pic_object" != none; then
1893 # Prepend the subdirectory the object is found in.
1894 pic_object="$xdir$pic_object"
1895
1896 if test "$prev" = dlfiles; then
1897 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1898 dlfiles="$dlfiles $pic_object"
1899 prev=
1900 continue
1901 else
1902 # If libtool objects are unsupported, then we need to preload.
1903 prev=dlprefiles
1904 fi
1905 fi
1906
1907 # CHECK ME: I think I busted this. -Ossama
1908 if test "$prev" = dlprefiles; then
1909 # Preload the old-style object.
1910 dlprefiles="$dlprefiles $pic_object"
1911 prev=
1912 fi
1913
1914 # A PIC object.
1915 libobjs="$libobjs $pic_object"
1916 arg="$pic_object"
1917 fi
1918
1919 # Non-PIC object.
1920 if test "$non_pic_object" != none; then
1921 # Prepend the subdirectory the object is found in.
1922 non_pic_object="$xdir$non_pic_object"
1923
1924 # A standard non-PIC object
1925 non_pic_objects="$non_pic_objects $non_pic_object"
1926 if test -z "$pic_object" || test "$pic_object" = none ; then
1927 arg="$non_pic_object"
1928 fi
1929 else
1930 # If the PIC object exists, use it instead.
1931 # $xdir was prepended to $pic_object above.
1932 non_pic_object="$pic_object"
1933 non_pic_objects="$non_pic_objects $non_pic_object"
1934 fi
1935 else
1936 # Only an error if not doing a dry-run.
1937 if test -z "$run"; then
1938 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1939 exit $EXIT_FAILURE
1940 else
1941 # Dry-run case.
1942
1943 # Extract subdirectory from the argument.
1944 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1945 if test "X$xdir" = "X$arg"; then
1946 xdir=
1947 else
1948 xdir="$xdir/"
1949 fi
1950
1951 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1952 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1953 libobjs="$libobjs $pic_object"
1954 non_pic_objects="$non_pic_objects $non_pic_object"
1955 fi
3a07e3fb
TJ
1956 fi
1957 ;;
1958
1959 *.$libext)
1960 # An archive.
1961 deplibs="$deplibs $arg"
1962 old_deplibs="$old_deplibs $arg"
1963 continue
1964 ;;
1965
1966 *.la)
1967 # A libtool-controlled library.
1968
1969 if test "$prev" = dlfiles; then
1970 # This library was specified with -dlopen.
1971 dlfiles="$dlfiles $arg"
1972 prev=
1973 elif test "$prev" = dlprefiles; then
1974 # The library was specified with -dlpreopen.
1975 dlprefiles="$dlprefiles $arg"
1976 prev=
1977 else
1978 deplibs="$deplibs $arg"
1979 fi
1980 continue
1981 ;;
1982
1983 # Some other compiler argument.
1984 *)
1985 # Unknown arguments in both finalize_command and compile_command need
1986 # to be aesthetically quoted because they are evaled later.
1987 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1988 case $arg in
1989 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1990 arg="\"$arg\""
1991 ;;
1992 esac
1993 ;;
1994 esac # arg
1995
1996 # Now actually substitute the argument into the commands.
1997 if test -n "$arg"; then
1998 compile_command="$compile_command $arg"
1999 finalize_command="$finalize_command $arg"
2000 fi
2001 done # argument parsing loop
2002
2003 if test -n "$prev"; then
2004 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2005 $echo "$help" 1>&2
fa7f168c 2006 exit $EXIT_FAILURE
3a07e3fb
TJ
2007 fi
2008
2009 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2010 eval arg=\"$export_dynamic_flag_spec\"
2011 compile_command="$compile_command $arg"
2012 finalize_command="$finalize_command $arg"
2013 fi
2014
fa7f168c 2015 oldlibs=
3a07e3fb
TJ
2016 # calculate the name of the file, without its directory
2017 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2018 libobjs_save="$libobjs"
2019
2020 if test -n "$shlibpath_var"; then
2021 # get the directories listed in $shlibpath_var
2022 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2023 else
2024 shlib_search_path=
2025 fi
2026 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2027 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2028
2029 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2030 if test "X$output_objdir" = "X$output"; then
2031 output_objdir="$objdir"
2032 else
2033 output_objdir="$output_objdir/$objdir"
2034 fi
2035 # Create the object directory.
fa7f168c 2036 if test ! -d "$output_objdir"; then
3a07e3fb
TJ
2037 $show "$mkdir $output_objdir"
2038 $run $mkdir $output_objdir
fa7f168c
TJ
2039 exit_status=$?
2040 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2041 exit $exit_status
3a07e3fb
TJ
2042 fi
2043 fi
2044
2045 # Determine the type of output
2046 case $output in
2047 "")
2048 $echo "$modename: you must specify an output file" 1>&2
2049 $echo "$help" 1>&2
fa7f168c 2050 exit $EXIT_FAILURE
3a07e3fb
TJ
2051 ;;
2052 *.$libext) linkmode=oldlib ;;
2053 *.lo | *.$objext) linkmode=obj ;;
2054 *.la) linkmode=lib ;;
2055 *) linkmode=prog ;; # Anything else should be a program.
2056 esac
2057
fa7f168c
TJ
2058 case $host in
2059 *cygwin* | *mingw* | *pw32*)
2060 # don't eliminate duplications in $postdeps and $predeps
2061 duplicate_compiler_generated_deps=yes
2062 ;;
2063 *)
2064 duplicate_compiler_generated_deps=$duplicate_deps
2065 ;;
2066 esac
3a07e3fb 2067 specialdeplibs=
fa7f168c 2068
3a07e3fb
TJ
2069 libs=
2070 # Find all interdependent deplibs by searching for libraries
2071 # that are linked more than once (e.g. -la -lb -la)
2072 for deplib in $deplibs; do
fa7f168c
TJ
2073 if test "X$duplicate_deps" = "Xyes" ; then
2074 case "$libs " in
2075 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2076 esac
2077 fi
3a07e3fb
TJ
2078 libs="$libs $deplib"
2079 done
fa7f168c
TJ
2080
2081 if test "$linkmode" = lib; then
2082 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2083
2084 # Compute libraries that are listed more than once in $predeps
2085 # $postdeps and mark them as special (i.e., whose duplicates are
2086 # not to be eliminated).
2087 pre_post_deps=
2088 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2089 for pre_post_dep in $predeps $postdeps; do
2090 case "$pre_post_deps " in
2091 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2092 esac
2093 pre_post_deps="$pre_post_deps $pre_post_dep"
2094 done
2095 fi
2096 pre_post_deps=
2097 fi
2098
3a07e3fb
TJ
2099 deplibs=
2100 newdependency_libs=
2101 newlib_search_path=
2102 need_relink=no # whether we're linking any uninstalled libtool libraries
2103 notinst_deplibs= # not-installed libtool libraries
3a07e3fb
TJ
2104 case $linkmode in
2105 lib)
2106 passes="conv link"
2107 for file in $dlfiles $dlprefiles; do
2108 case $file in
2109 *.la) ;;
2110 *)
2111 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
fa7f168c 2112 exit $EXIT_FAILURE
3a07e3fb
TJ
2113 ;;
2114 esac
2115 done
2116 ;;
2117 prog)
2118 compile_deplibs=
2119 finalize_deplibs=
2120 alldeplibs=no
2121 newdlfiles=
2122 newdlprefiles=
2123 passes="conv scan dlopen dlpreopen link"
2124 ;;
2125 *) passes="conv"
2126 ;;
2127 esac
2128 for pass in $passes; do
fa7f168c
TJ
2129 if test "$linkmode,$pass" = "lib,link" ||
2130 test "$linkmode,$pass" = "prog,scan"; then
2131 libs="$deplibs"
2132 deplibs=
2133 fi
3a07e3fb 2134 if test "$linkmode" = prog; then
3a07e3fb 2135 case $pass in
fa7f168c 2136 dlopen) libs="$dlfiles" ;;
3a07e3fb
TJ
2137 dlpreopen) libs="$dlprefiles" ;;
2138 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2139 esac
2140 fi
fa7f168c
TJ
2141 if test "$pass" = dlopen; then
2142 # Collect dlpreopened libraries
2143 save_deplibs="$deplibs"
2144 deplibs=
2145 fi
3a07e3fb
TJ
2146 for deplib in $libs; do
2147 lib=
2148 found=no
2149 case $deplib in
fa7f168c
TJ
2150 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2151 if test "$linkmode,$pass" = "prog,link"; then
2152 compile_deplibs="$deplib $compile_deplibs"
2153 finalize_deplibs="$deplib $finalize_deplibs"
2154 else
2155 compiler_flags="$compiler_flags $deplib"
3a07e3fb 2156 fi
fa7f168c
TJ
2157 continue
2158 ;;
2159 -l*)
2160 if test "$linkmode" != lib && test "$linkmode" != prog; then
2161 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
3a07e3fb
TJ
2162 continue
2163 fi
2164 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
ef04510a
TJ
2165 if test "$linkmode" = lib; then
2166 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2167 else
2168 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2169 fi
2170 for searchdir in $searchdirs; do
fa7f168c
TJ
2171 for search_ext in .la $std_shrext .so .a; do
2172 # Search the libtool library
2173 lib="$searchdir/lib${name}${search_ext}"
2174 if test -f "$lib"; then
2175 if test "$search_ext" = ".la"; then
2176 found=yes
2177 else
2178 found=no
2179 fi
2180 break 2
2181 fi
2182 done
3a07e3fb
TJ
2183 done
2184 if test "$found" != yes; then
2185 # deplib doesn't seem to be a libtool library
2186 if test "$linkmode,$pass" = "prog,link"; then
2187 compile_deplibs="$deplib $compile_deplibs"
2188 finalize_deplibs="$deplib $finalize_deplibs"
2189 else
2190 deplibs="$deplib $deplibs"
2191 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2192 fi
2193 continue
fa7f168c
TJ
2194 else # deplib is a libtool library
2195 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2196 # We need to do some special things here, and not later.
2197 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2198 case " $predeps $postdeps " in
2199 *" $deplib "*)
2200 if (${SED} -e '2q' $lib |
2201 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2202 library_names=
2203 old_library=
2204 case $lib in
2205 */* | *\\*) . $lib ;;
2206 *) . ./$lib ;;
2207 esac
2208 for l in $old_library $library_names; do
2209 ll="$l"
2210 done
2211 if test "X$ll" = "X$old_library" ; then # only static version available
2212 found=no
2213 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2214 test "X$ladir" = "X$lib" && ladir="."
2215 lib=$ladir/$old_library
2216 if test "$linkmode,$pass" = "prog,link"; then
2217 compile_deplibs="$deplib $compile_deplibs"
2218 finalize_deplibs="$deplib $finalize_deplibs"
2219 else
2220 deplibs="$deplib $deplibs"
2221 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2222 fi
2223 continue
2224 fi
2225 fi
2226 ;;
2227 *) ;;
2228 esac
2229 fi
3a07e3fb
TJ
2230 fi
2231 ;; # -l
2232 -L*)
2233 case $linkmode in
2234 lib)
2235 deplibs="$deplib $deplibs"
2236 test "$pass" = conv && continue
2237 newdependency_libs="$deplib $newdependency_libs"
2238 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2239 ;;
2240 prog)
2241 if test "$pass" = conv; then
2242 deplibs="$deplib $deplibs"
2243 continue
2244 fi
2245 if test "$pass" = scan; then
2246 deplibs="$deplib $deplibs"
3a07e3fb
TJ
2247 else
2248 compile_deplibs="$deplib $compile_deplibs"
2249 finalize_deplibs="$deplib $finalize_deplibs"
2250 fi
fa7f168c 2251 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
3a07e3fb
TJ
2252 ;;
2253 *)
fa7f168c 2254 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
3a07e3fb
TJ
2255 ;;
2256 esac # linkmode
2257 continue
2258 ;; # -L
2259 -R*)
2260 if test "$pass" = link; then
2261 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2262 # Make sure the xrpath contains only unique directories.
2263 case "$xrpath " in
2264 *" $dir "*) ;;
2265 *) xrpath="$xrpath $dir" ;;
2266 esac
2267 fi
2268 deplibs="$deplib $deplibs"
2269 continue
2270 ;;
2271 *.la) lib="$deplib" ;;
2272 *.$libext)
2273 if test "$pass" = conv; then
2274 deplibs="$deplib $deplibs"
2275 continue
2276 fi
2277 case $linkmode in
2278 lib)
fa7f168c
TJ
2279 valid_a_lib=no
2280 case $deplibs_check_method in
2281 match_pattern*)
2282 set dummy $deplibs_check_method
2283 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2284 if eval $echo \"$deplib\" 2>/dev/null \
2285 | $SED 10q \
2286 | $EGREP "$match_pattern_regex" > /dev/null; then
2287 valid_a_lib=yes
2288 fi
2289 ;;
2290 pass_all)
2291 valid_a_lib=yes
2292 ;;
2293 esac
2294 if test "$valid_a_lib" != yes; then
2295 $echo
2296 $echo "*** Warning: Trying to link with static lib archive $deplib."
2297 $echo "*** I have the capability to make that library automatically link in when"
2298 $echo "*** you link to this library. But I can only do this if you have a"
2299 $echo "*** shared version of the library, which you do not appear to have"
2300 $echo "*** because the file extensions .$libext of this argument makes me believe"
2301 $echo "*** that it is just a static archive that I should not used here."
3a07e3fb 2302 else
fa7f168c
TJ
2303 $echo
2304 $echo "*** Warning: Linking the shared library $output against the"
2305 $echo "*** static library $deplib is not portable!"
3a07e3fb
TJ
2306 deplibs="$deplib $deplibs"
2307 fi
2308 continue
2309 ;;
2310 prog)
2311 if test "$pass" != link; then
2312 deplibs="$deplib $deplibs"
2313 else
2314 compile_deplibs="$deplib $compile_deplibs"
2315 finalize_deplibs="$deplib $finalize_deplibs"
2316 fi
2317 continue
2318 ;;
2319 esac # linkmode
2320 ;; # *.$libext
2321 *.lo | *.$objext)
fa7f168c
TJ
2322 if test "$pass" = conv; then
2323 deplibs="$deplib $deplibs"
2324 elif test "$linkmode" = prog; then
2325 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2326 # If there is no dlopen support or we're linking statically,
2327 # we need to preload.
2328 newdlprefiles="$newdlprefiles $deplib"
2329 compile_deplibs="$deplib $compile_deplibs"
2330 finalize_deplibs="$deplib $finalize_deplibs"
2331 else
2332 newdlfiles="$newdlfiles $deplib"
2333 fi
3a07e3fb
TJ
2334 fi
2335 continue
2336 ;;
2337 %DEPLIBS%)
2338 alldeplibs=yes
2339 continue
2340 ;;
2341 esac # case $deplib
fa7f168c 2342 if test "$found" = yes || test -f "$lib"; then :
3a07e3fb 2343 else
fa7f168c
TJ
2344 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2345 exit $EXIT_FAILURE
3a07e3fb
TJ
2346 fi
2347
2348 # Check to see that this really is a libtool archive.
fa7f168c 2349 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
3a07e3fb
TJ
2350 else
2351 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
fa7f168c 2352 exit $EXIT_FAILURE
3a07e3fb
TJ
2353 fi
2354
2355 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2356 test "X$ladir" = "X$lib" && ladir="."
2357
2358 dlname=
2359 dlopen=
2360 dlpreopen=
2361 libdir=
2362 library_names=
2363 old_library=
2364 # If the library was installed with an old release of libtool,
fa7f168c 2365 # it will not redefine variables installed, or shouldnotlink
3a07e3fb 2366 installed=yes
fa7f168c
TJ
2367 shouldnotlink=no
2368 avoidtemprpath=
2369
3a07e3fb
TJ
2370
2371 # Read the .la file
2372 case $lib in
2373 */* | *\\*) . $lib ;;
2374 *) . ./$lib ;;
2375 esac
2376
2377 if test "$linkmode,$pass" = "lib,link" ||
2378 test "$linkmode,$pass" = "prog,scan" ||
fa7f168c 2379 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3a07e3fb
TJ
2380 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2381 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2382 fi
2383
2384 if test "$pass" = conv; then
2385 # Only check for convenience libraries
2386 deplibs="$lib $deplibs"
2387 if test -z "$libdir"; then
2388 if test -z "$old_library"; then
2389 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
fa7f168c 2390 exit $EXIT_FAILURE
3a07e3fb
TJ
2391 fi
2392 # It is a libtool convenience library, so add in its objects.
2393 convenience="$convenience $ladir/$objdir/$old_library"
2394 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2395 tmp_libs=
2396 for deplib in $dependency_libs; do
2397 deplibs="$deplib $deplibs"
fa7f168c
TJ
2398 if test "X$duplicate_deps" = "Xyes" ; then
2399 case "$tmp_libs " in
2400 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2401 esac
2402 fi
3a07e3fb
TJ
2403 tmp_libs="$tmp_libs $deplib"
2404 done
2405 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2406 $echo "$modename: \`$lib' is not a convenience library" 1>&2
fa7f168c 2407 exit $EXIT_FAILURE
3a07e3fb
TJ
2408 fi
2409 continue
2410 fi # $pass = conv
2411
fa7f168c 2412
3a07e3fb
TJ
2413 # Get the name of the library we link against.
2414 linklib=
2415 for l in $old_library $library_names; do
2416 linklib="$l"
2417 done
2418 if test -z "$linklib"; then
2419 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
fa7f168c 2420 exit $EXIT_FAILURE
3a07e3fb
TJ
2421 fi
2422
2423 # This library was specified with -dlopen.
2424 if test "$pass" = dlopen; then
2425 if test -z "$libdir"; then
2426 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
fa7f168c 2427 exit $EXIT_FAILURE
3a07e3fb 2428 fi
fa7f168c
TJ
2429 if test -z "$dlname" ||
2430 test "$dlopen_support" != yes ||
2431 test "$build_libtool_libs" = no; then
3a07e3fb 2432 # If there is no dlname, no dlopen support or we're linking
fa7f168c
TJ
2433 # statically, we need to preload. We also need to preload any
2434 # dependent libraries so libltdl's deplib preloader doesn't
2435 # bomb out in the load deplibs phase.
2436 dlprefiles="$dlprefiles $lib $dependency_libs"
3a07e3fb
TJ
2437 else
2438 newdlfiles="$newdlfiles $lib"
2439 fi
2440 continue
2441 fi # $pass = dlopen
2442
2443 # We need an absolute path.
2444 case $ladir in
2445 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2446 *)
2447 abs_ladir=`cd "$ladir" && pwd`
2448 if test -z "$abs_ladir"; then
2449 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2450 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2451 abs_ladir="$ladir"
2452 fi
2453 ;;
2454 esac
2455 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2456
2457 # Find the relevant object directory and library name.
2458 if test "X$installed" = Xyes; then
2459 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2460 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2461 dir="$ladir"
2462 absdir="$abs_ladir"
2463 libdir="$abs_ladir"
2464 else
2465 dir="$libdir"
2466 absdir="$libdir"
2467 fi
fa7f168c 2468 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3a07e3fb 2469 else
fa7f168c
TJ
2470 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2471 dir="$ladir"
2472 absdir="$abs_ladir"
2473 # Remove this search path later
2474 notinst_path="$notinst_path $abs_ladir"
2475 else
2476 dir="$ladir/$objdir"
2477 absdir="$abs_ladir/$objdir"
2478 # Remove this search path later
2479 notinst_path="$notinst_path $abs_ladir"
2480 fi
3a07e3fb
TJ
2481 fi # $installed = yes
2482 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2483
2484 # This library was specified with -dlpreopen.
2485 if test "$pass" = dlpreopen; then
2486 if test -z "$libdir"; then
2487 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
fa7f168c 2488 exit $EXIT_FAILURE
3a07e3fb
TJ
2489 fi
2490 # Prefer using a static library (so that no silly _DYNAMIC symbols
2491 # are required to link).
2492 if test -n "$old_library"; then
2493 newdlprefiles="$newdlprefiles $dir/$old_library"
2494 # Otherwise, use the dlname, so that lt_dlopen finds it.
2495 elif test -n "$dlname"; then
2496 newdlprefiles="$newdlprefiles $dir/$dlname"
2497 else
2498 newdlprefiles="$newdlprefiles $dir/$linklib"
2499 fi
2500 fi # $pass = dlpreopen
2501
2502 if test -z "$libdir"; then
2503 # Link the convenience library
2504 if test "$linkmode" = lib; then
2505 deplibs="$dir/$old_library $deplibs"
2506 elif test "$linkmode,$pass" = "prog,link"; then
2507 compile_deplibs="$dir/$old_library $compile_deplibs"
2508 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2509 else
fa7f168c 2510 deplibs="$lib $deplibs" # used for prog,scan pass
3a07e3fb
TJ
2511 fi
2512 continue
2513 fi
2514
fa7f168c 2515
3a07e3fb
TJ
2516 if test "$linkmode" = prog && test "$pass" != link; then
2517 newlib_search_path="$newlib_search_path $ladir"
2518 deplibs="$lib $deplibs"
2519
2520 linkalldeplibs=no
2521 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2522 test "$build_libtool_libs" = no; then
2523 linkalldeplibs=yes
2524 fi
2525
2526 tmp_libs=
2527 for deplib in $dependency_libs; do
2528 case $deplib in
2529 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2530 esac
2531 # Need to link against all dependency_libs?
fa7f168c 2532 if test "$linkalldeplibs" = yes; then
3a07e3fb
TJ
2533 deplibs="$deplib $deplibs"
2534 else
2535 # Need to hardcode shared library paths
2536 # or/and link against static libraries
2537 newdependency_libs="$deplib $newdependency_libs"
2538 fi
fa7f168c
TJ
2539 if test "X$duplicate_deps" = "Xyes" ; then
2540 case "$tmp_libs " in
2541 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2542 esac
2543 fi
3a07e3fb
TJ
2544 tmp_libs="$tmp_libs $deplib"
2545 done # for deplib
2546 continue
2547 fi # $linkmode = prog...
2548
fa7f168c
TJ
2549 if test "$linkmode,$pass" = "prog,link"; then
2550 if test -n "$library_names" &&
2551 { { test "$prefer_static_libs" = no ||
2552 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2553 test -z "$old_library"; }; then
2554 # We need to hardcode the library path
2555 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2556 # Make sure the rpath contains only unique directories.
2557 case "$temp_rpath " in
2558 *" $dir "*) ;;
2559 *" $absdir "*) ;;
2560 *) temp_rpath="$temp_rpath $absdir" ;;
2561 esac
2562 fi
3a07e3fb 2563
3a07e3fb
TJ
2564 # Hardcode the library path.
2565 # Skip directories that are in the system default run-time
2566 # search path.
2567 case " $sys_lib_dlsearch_path " in
2568 *" $absdir "*) ;;
2569 *)
2570 case "$compile_rpath " in
2571 *" $absdir "*) ;;
2572 *) compile_rpath="$compile_rpath $absdir"
2573 esac
2574 ;;
2575 esac
2576 case " $sys_lib_dlsearch_path " in
2577 *" $libdir "*) ;;
2578 *)
2579 case "$finalize_rpath " in
2580 *" $libdir "*) ;;
2581 *) finalize_rpath="$finalize_rpath $libdir"
2582 esac
2583 ;;
2584 esac
3a07e3fb
TJ
2585 fi # $linkmode,$pass = prog,link...
2586
2587 if test "$alldeplibs" = yes &&
2588 { test "$deplibs_check_method" = pass_all ||
2589 { test "$build_libtool_libs" = yes &&
2590 test -n "$library_names"; }; }; then
2591 # We only need to search for static libraries
2592 continue
2593 fi
fa7f168c 2594 fi
3a07e3fb 2595
fa7f168c
TJ
2596 link_static=no # Whether the deplib will be linked statically
2597 use_static_libs=$prefer_static_libs
2598 if test "$use_static_libs" = built && test "$installed" = yes ; then
2599 use_static_libs=no
2600 fi
2601 if test -n "$library_names" &&
2602 { test "$use_static_libs" = no || test -z "$old_library"; }; then
3a07e3fb
TJ
2603 if test "$installed" = no; then
2604 notinst_deplibs="$notinst_deplibs $lib"
2605 need_relink=yes
2606 fi
fa7f168c
TJ
2607 # This is a shared library
2608
2609 # Warn about portability, can't link against -module's on
2610 # some systems (darwin)
2611 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2612 $echo
2613 if test "$linkmode" = prog; then
2614 $echo "*** Warning: Linking the executable $output against the loadable module"
2615 else
2616 $echo "*** Warning: Linking the shared library $output against the loadable module"
2617 fi
2618 $echo "*** $linklib is not portable!"
2619 fi
2620 if test "$linkmode" = lib &&
2621 test "$hardcode_into_libs" = yes; then
2622 # Hardcode the library path.
2623 # Skip directories that are in the system default run-time
2624 # search path.
2625 case " $sys_lib_dlsearch_path " in
2626 *" $absdir "*) ;;
2627 *)
2628 case "$compile_rpath " in
2629 *" $absdir "*) ;;
2630 *) compile_rpath="$compile_rpath $absdir"
2631 esac
2632 ;;
2633 esac
2634 case " $sys_lib_dlsearch_path " in
2635 *" $libdir "*) ;;
2636 *)
2637 case "$finalize_rpath " in
2638 *" $libdir "*) ;;
2639 *) finalize_rpath="$finalize_rpath $libdir"
2640 esac
2641 ;;
2642 esac
2643 fi
3a07e3fb
TJ
2644
2645 if test -n "$old_archive_from_expsyms_cmds"; then
2646 # figure out the soname
2647 set dummy $library_names
2648 realname="$2"
2649 shift; shift
2650 libname=`eval \\$echo \"$libname_spec\"`
2651 # use dlname if we got it. it's perfectly good, no?
2652 if test -n "$dlname"; then
2653 soname="$dlname"
2654 elif test -n "$soname_spec"; then
2655 # bleh windows
2656 case $host in
fa7f168c 2657 *cygwin* | mingw*)
3a07e3fb
TJ
2658 major=`expr $current - $age`
2659 versuffix="-$major"
2660 ;;
2661 esac
2662 eval soname=\"$soname_spec\"
2663 else
2664 soname="$realname"
2665 fi
2666
2667 # Make a new name for the extract_expsyms_cmds to use
2668 soroot="$soname"
fa7f168c
TJ
2669 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2670 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
3a07e3fb
TJ
2671
2672 # If the library has no export list, then create one now
2673 if test -f "$output_objdir/$soname-def"; then :
2674 else
2675 $show "extracting exported symbol list from \`$soname'"
2676 save_ifs="$IFS"; IFS='~'
fa7f168c 2677 cmds=$extract_expsyms_cmds
3a07e3fb
TJ
2678 for cmd in $cmds; do
2679 IFS="$save_ifs"
fa7f168c 2680 eval cmd=\"$cmd\"
3a07e3fb
TJ
2681 $show "$cmd"
2682 $run eval "$cmd" || exit $?
2683 done
2684 IFS="$save_ifs"
2685 fi
2686
2687 # Create $newlib
2688 if test -f "$output_objdir/$newlib"; then :; else
2689 $show "generating import library for \`$soname'"
2690 save_ifs="$IFS"; IFS='~'
fa7f168c 2691 cmds=$old_archive_from_expsyms_cmds
3a07e3fb
TJ
2692 for cmd in $cmds; do
2693 IFS="$save_ifs"
fa7f168c 2694 eval cmd=\"$cmd\"
3a07e3fb
TJ
2695 $show "$cmd"
2696 $run eval "$cmd" || exit $?
2697 done
2698 IFS="$save_ifs"
2699 fi
2700 # make sure the library variables are pointing to the new library
2701 dir=$output_objdir
2702 linklib=$newlib
fa7f168c 2703 fi # test -n "$old_archive_from_expsyms_cmds"
3a07e3fb
TJ
2704
2705 if test "$linkmode" = prog || test "$mode" != relink; then
2706 add_shlibpath=
2707 add_dir=
2708 add=
2709 lib_linked=yes
2710 case $hardcode_action in
2711 immediate | unsupported)
2712 if test "$hardcode_direct" = no; then
2713 add="$dir/$linklib"
fa7f168c
TJ
2714 case $host in
2715 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2716 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2717 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2718 *-*-unixware7*) add_dir="-L$dir" ;;
2719 *-*-darwin* )
2720 # if the lib is a module then we can not link against
2721 # it, someone is ignoring the new warnings I added
2722 if /usr/bin/file -L $add 2> /dev/null |
2723 $EGREP ": [^:]* bundle" >/dev/null ; then
2724 $echo "** Warning, lib $linklib is a module, not a shared library"
2725 if test -z "$old_library" ; then
2726 $echo
2727 $echo "** And there doesn't seem to be a static archive available"
2728 $echo "** The link will probably fail, sorry"
2729 else
2730 add="$dir/$old_library"
2731 fi
2732 fi
2733 esac
3a07e3fb
TJ
2734 elif test "$hardcode_minus_L" = no; then
2735 case $host in
2736 *-*-sunos*) add_shlibpath="$dir" ;;
2737 esac
2738 add_dir="-L$dir"
2739 add="-l$name"
2740 elif test "$hardcode_shlibpath_var" = no; then
2741 add_shlibpath="$dir"
2742 add="-l$name"
2743 else
2744 lib_linked=no
2745 fi
2746 ;;
2747 relink)
2748 if test "$hardcode_direct" = yes; then
2749 add="$dir/$linklib"
2750 elif test "$hardcode_minus_L" = yes; then
2751 add_dir="-L$dir"
fa7f168c
TJ
2752 # Try looking first in the location we're being installed to.
2753 if test -n "$inst_prefix_dir"; then
2754 case $libdir in
2755 [\\/]*)
2756 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2757 ;;
2758 esac
2759 fi
3a07e3fb
TJ
2760 add="-l$name"
2761 elif test "$hardcode_shlibpath_var" = yes; then
2762 add_shlibpath="$dir"
2763 add="-l$name"
2764 else
2765 lib_linked=no
2766 fi
2767 ;;
2768 *) lib_linked=no ;;
2769 esac
2770
2771 if test "$lib_linked" != yes; then
2772 $echo "$modename: configuration error: unsupported hardcode properties"
fa7f168c 2773 exit $EXIT_FAILURE
3a07e3fb
TJ
2774 fi
2775
2776 if test -n "$add_shlibpath"; then
2777 case :$compile_shlibpath: in
2778 *":$add_shlibpath:"*) ;;
2779 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2780 esac
2781 fi
2782 if test "$linkmode" = prog; then
2783 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2784 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2785 else
2786 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2787 test -n "$add" && deplibs="$add $deplibs"
2788 if test "$hardcode_direct" != yes && \
2789 test "$hardcode_minus_L" != yes && \
2790 test "$hardcode_shlibpath_var" = yes; then
2791 case :$finalize_shlibpath: in
2792 *":$libdir:"*) ;;
2793 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2794 esac
2795 fi
2796 fi
2797 fi
2798
2799 if test "$linkmode" = prog || test "$mode" = relink; then
2800 add_shlibpath=
2801 add_dir=
2802 add=
2803 # Finalize command for both is simple: just hardcode it.
2804 if test "$hardcode_direct" = yes; then
2805 add="$libdir/$linklib"
2806 elif test "$hardcode_minus_L" = yes; then
2807 add_dir="-L$libdir"
2808 add="-l$name"
2809 elif test "$hardcode_shlibpath_var" = yes; then
2810 case :$finalize_shlibpath: in
2811 *":$libdir:"*) ;;
2812 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2813 esac
2814 add="-l$name"
fa7f168c
TJ
2815 elif test "$hardcode_automatic" = yes; then
2816 if test -n "$inst_prefix_dir" &&
2817 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2818 add="$inst_prefix_dir$libdir/$linklib"
2819 else
2820 add="$libdir/$linklib"
2821 fi
3a07e3fb
TJ
2822 else
2823 # We cannot seem to hardcode it, guess we'll fake it.
2824 add_dir="-L$libdir"
fa7f168c
TJ
2825 # Try looking first in the location we're being installed to.
2826 if test -n "$inst_prefix_dir"; then
2827 case $libdir in
2828 [\\/]*)
2829 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2830 ;;
2831 esac
2832 fi
3a07e3fb
TJ
2833 add="-l$name"
2834 fi
2835
2836 if test "$linkmode" = prog; then
2837 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2838 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2839 else
2840 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2841 test -n "$add" && deplibs="$add $deplibs"
2842 fi
2843 fi
2844 elif test "$linkmode" = prog; then
3a07e3fb
TJ
2845 # Here we assume that one of hardcode_direct or hardcode_minus_L
2846 # is not unsupported. This is valid on all known static and
2847 # shared platforms.
2848 if test "$hardcode_direct" != unsupported; then
2849 test -n "$old_library" && linklib="$old_library"
2850 compile_deplibs="$dir/$linklib $compile_deplibs"
2851 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2852 else
2853 compile_deplibs="-l$name -L$dir $compile_deplibs"
2854 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2855 fi
2856 elif test "$build_libtool_libs" = yes; then
2857 # Not a shared library
2858 if test "$deplibs_check_method" != pass_all; then
2859 # We're trying link a shared library against a static one
2860 # but the system doesn't support it.
2861
2862 # Just print a warning and add the library to dependency_libs so
2863 # that the program can be linked against the static library.
fa7f168c
TJ
2864 $echo
2865 $echo "*** Warning: This system can not link to static lib archive $lib."
2866 $echo "*** I have the capability to make that library automatically link in when"
2867 $echo "*** you link to this library. But I can only do this if you have a"
2868 $echo "*** shared version of the library, which you do not appear to have."
3a07e3fb 2869 if test "$module" = yes; then
fa7f168c
TJ
2870 $echo "*** But as you try to build a module library, libtool will still create "
2871 $echo "*** a static module, that should work as long as the dlopening application"
2872 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
3a07e3fb 2873 if test -z "$global_symbol_pipe"; then
fa7f168c
TJ
2874 $echo
2875 $echo "*** However, this would only work if libtool was able to extract symbol"
2876 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2877 $echo "*** not find such a program. So, this module is probably useless."
2878 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3a07e3fb
TJ
2879 fi
2880 if test "$build_old_libs" = no; then
2881 build_libtool_libs=module
2882 build_old_libs=yes
2883 else
2884 build_libtool_libs=no
2885 fi
2886 fi
2887 else
3a07e3fb
TJ
2888 deplibs="$dir/$old_library $deplibs"
2889 link_static=yes
2890 fi
2891 fi # link shared/static library?
2892
2893 if test "$linkmode" = lib; then
2894 if test -n "$dependency_libs" &&
fa7f168c
TJ
2895 { test "$hardcode_into_libs" != yes ||
2896 test "$build_old_libs" = yes ||
2897 test "$link_static" = yes; }; then
3a07e3fb
TJ
2898 # Extract -R from dependency_libs
2899 temp_deplibs=
2900 for libdir in $dependency_libs; do
2901 case $libdir in
2902 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2903 case " $xrpath " in
2904 *" $temp_xrpath "*) ;;
2905 *) xrpath="$xrpath $temp_xrpath";;
2906 esac;;
2907 *) temp_deplibs="$temp_deplibs $libdir";;
2908 esac
2909 done
2910 dependency_libs="$temp_deplibs"
2911 fi
2912
2913 newlib_search_path="$newlib_search_path $absdir"
2914 # Link against this library
2915 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2916 # ... and its dependency_libs
2917 tmp_libs=
2918 for deplib in $dependency_libs; do
2919 newdependency_libs="$deplib $newdependency_libs"
fa7f168c
TJ
2920 if test "X$duplicate_deps" = "Xyes" ; then
2921 case "$tmp_libs " in
2922 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2923 esac
2924 fi
3a07e3fb
TJ
2925 tmp_libs="$tmp_libs $deplib"
2926 done
2927
2928 if test "$link_all_deplibs" != no; then
2929 # Add the search paths of all dependency libraries
2930 for deplib in $dependency_libs; do
2931 case $deplib in
2932 -L*) path="$deplib" ;;
2933 *.la)
2934 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2935 test "X$dir" = "X$deplib" && dir="."
2936 # We need an absolute path.
2937 case $dir in
2938 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2939 *)
2940 absdir=`cd "$dir" && pwd`
2941 if test -z "$absdir"; then
2942 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2943 absdir="$dir"
2944 fi
2945 ;;
2946 esac
2947 if grep "^installed=no" $deplib > /dev/null; then
fa7f168c 2948 path="$absdir/$objdir"
3a07e3fb 2949 else
fa7f168c 2950 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3a07e3fb
TJ
2951 if test -z "$libdir"; then
2952 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
fa7f168c 2953 exit $EXIT_FAILURE
3a07e3fb
TJ
2954 fi
2955 if test "$absdir" != "$libdir"; then
2956 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2957 fi
fa7f168c 2958 path="$absdir"
3a07e3fb 2959 fi
fa7f168c
TJ
2960 depdepl=
2961 case $host in
2962 *-*-darwin*)
2963 # we do not want to link against static libs,
2964 # but need to link against shared
2965 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
ef04510a 2966 eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
fa7f168c
TJ
2967 if test -n "$deplibrary_names" ; then
2968 for tmp in $deplibrary_names ; do
2969 depdepl=$tmp
2970 done
ef04510a
TJ
2971 if test -f "$deplibdir/$depdepl" ; then
2972 depdepl="$deplibdir/$depdepl"
2973 elif test -f "$path/$depdepl" ; then
fa7f168c 2974 depdepl="$path/$depdepl"
ef04510a
TJ
2975 else
2976 # Can't find it, oh well...
2977 depdepl=
fa7f168c
TJ
2978 fi
2979 # do not add paths which are already there
2980 case " $newlib_search_path " in
2981 *" $path "*) ;;
2982 *) newlib_search_path="$newlib_search_path $path";;
2983 esac
2984 fi
2985 path=""
2986 ;;
2987 *)
2988 path="-L$path"
2989 ;;
2990 esac
2991 ;;
2992 -l*)
2993 case $host in
2994 *-*-darwin*)
2995 # Again, we only want to link against shared libraries
2996 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2997 for tmp in $newlib_search_path ; do
2998 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2999 eval depdepl="$tmp/lib$tmp_libs.dylib"
3000 break
3001 fi
3002 done
3003 path=""
3004 ;;
3005 *) continue ;;
3006 esac
3a07e3fb
TJ
3007 ;;
3008 *) continue ;;
3009 esac
3010 case " $deplibs " in
3011 *" $path "*) ;;
fa7f168c
TJ
3012 *) deplibs="$path $deplibs" ;;
3013 esac
3014 case " $deplibs " in
3015 *" $depdepl "*) ;;
3016 *) deplibs="$depdepl $deplibs" ;;
3a07e3fb
TJ
3017 esac
3018 done
3019 fi # link_all_deplibs != no
3020 fi # linkmode = lib
3021 done # for deplib in $libs
fa7f168c 3022 dependency_libs="$newdependency_libs"
3a07e3fb
TJ
3023 if test "$pass" = dlpreopen; then
3024 # Link the dlpreopened libraries before other libraries
3025 for deplib in $save_deplibs; do
3026 deplibs="$deplib $deplibs"
3027 done
3028 fi
3029 if test "$pass" != dlopen; then
3a07e3fb
TJ
3030 if test "$pass" != conv; then
3031 # Make sure lib_search_path contains only unique directories.
3032 lib_search_path=
3033 for dir in $newlib_search_path; do
3034 case "$lib_search_path " in
3035 *" $dir "*) ;;
3036 *) lib_search_path="$lib_search_path $dir" ;;
3037 esac
3038 done
3039 newlib_search_path=
3040 fi
3041
3042 if test "$linkmode,$pass" != "prog,link"; then
3043 vars="deplibs"
3044 else
3045 vars="compile_deplibs finalize_deplibs"
3046 fi
3047 for var in $vars dependency_libs; do
3048 # Add libraries to $var in reverse order
3049 eval tmp_libs=\"\$$var\"
3050 new_libs=
3051 for deplib in $tmp_libs; do
fa7f168c
TJ
3052 # FIXME: Pedantically, this is the right thing to do, so
3053 # that some nasty dependency loop isn't accidentally
3054 # broken:
3055 #new_libs="$deplib $new_libs"
3056 # Pragmatically, this seems to cause very few problems in
3057 # practice:
3a07e3fb
TJ
3058 case $deplib in
3059 -L*) new_libs="$deplib $new_libs" ;;
fa7f168c 3060 -R*) ;;
3a07e3fb 3061 *)
fa7f168c
TJ
3062 # And here is the reason: when a library appears more
3063 # than once as an explicit dependence of a library, or
3064 # is implicitly linked in more than once by the
3065 # compiler, it is considered special, and multiple
3066 # occurrences thereof are not removed. Compare this
3067 # with having the same library being listed as a
3068 # dependency of multiple other libraries: in this case,
3069 # we know (pedantically, we assume) the library does not
3070 # need to be listed more than once, so we keep only the
3071 # last copy. This is not always right, but it is rare
3072 # enough that we require users that really mean to play
3073 # such unportable linking tricks to link the library
3074 # using -Wl,-lname, so that libtool does not consider it
3075 # for duplicate removal.
3a07e3fb
TJ
3076 case " $specialdeplibs " in
3077 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3078 *)
3079 case " $new_libs " in
3080 *" $deplib "*) ;;
3081 *) new_libs="$deplib $new_libs" ;;
3082 esac
3083 ;;
3084 esac
3085 ;;
3086 esac
3087 done
3088 tmp_libs=
3089 for deplib in $new_libs; do
3090 case $deplib in
3091 -L*)
3092 case " $tmp_libs " in
3093 *" $deplib "*) ;;
3094 *) tmp_libs="$tmp_libs $deplib" ;;
3095 esac
3096 ;;
3097 *) tmp_libs="$tmp_libs $deplib" ;;
3098 esac
3099 done
3100 eval $var=\"$tmp_libs\"
3101 done # for var
3102 fi
fa7f168c
TJ
3103 # Last step: remove runtime libs from dependency_libs
3104 # (they stay in deplibs)
3105 tmp_libs=
3106 for i in $dependency_libs ; do
3107 case " $predeps $postdeps $compiler_lib_search_path " in
3108 *" $i "*)
3109 i=""
3110 ;;
3111 esac
3112 if test -n "$i" ; then
3113 tmp_libs="$tmp_libs $i"
3114 fi
3115 done
3116 dependency_libs=$tmp_libs
3a07e3fb
TJ
3117 done # for pass
3118 if test "$linkmode" = prog; then
3119 dlfiles="$newdlfiles"
3120 dlprefiles="$newdlprefiles"
3121 fi
3122
3123 case $linkmode in
3124 oldlib)
ef04510a
TJ
3125 case " $deplibs" in
3126 *\ -l* | *\ -L*)
3127 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3128 esac
fa7f168c 3129
3a07e3fb
TJ
3130 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3131 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3132 fi
3133
3134 if test -n "$rpath"; then
3135 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3136 fi
3137
3138 if test -n "$xrpath"; then
3139 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3140 fi
3141
3142 if test -n "$vinfo"; then
fa7f168c 3143 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3a07e3fb
TJ
3144 fi
3145
3146 if test -n "$release"; then
3147 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3148 fi
3149
3150 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3151 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3152 fi
3153
3154 # Now set the variables for building old libraries.
3155 build_libtool_libs=no
3156 oldlibs="$output"
3157 objs="$objs$old_deplibs"
3158 ;;
3159
3160 lib)
3161 # Make sure we only generate libraries of the form `libNAME.la'.
3162 case $outputname in
3163 lib*)
3164 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
fa7f168c 3165 eval shared_ext=\"$shrext_cmds\"
3a07e3fb
TJ
3166 eval libname=\"$libname_spec\"
3167 ;;
3168 *)
3169 if test "$module" = no; then
3170 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3171 $echo "$help" 1>&2
fa7f168c 3172 exit $EXIT_FAILURE
3a07e3fb
TJ
3173 fi
3174 if test "$need_lib_prefix" != no; then
3175 # Add the "lib" prefix for modules if required
3176 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
fa7f168c 3177 eval shared_ext=\"$shrext_cmds\"
3a07e3fb
TJ
3178 eval libname=\"$libname_spec\"
3179 else
3180 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3181 fi
3182 ;;
3183 esac
3184
3185 if test -n "$objs"; then
3186 if test "$deplibs_check_method" != pass_all; then
3187 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
fa7f168c 3188 exit $EXIT_FAILURE
3a07e3fb 3189 else
fa7f168c
TJ
3190 $echo
3191 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3192 $echo "*** objects $objs is not portable!"
3a07e3fb
TJ
3193 libobjs="$libobjs $objs"
3194 fi
3195 fi
3196
3197 if test "$dlself" != no; then
3198 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3199 fi
3200
3201 set dummy $rpath
fa7f168c 3202 if test "$#" -gt 2; then
3a07e3fb
TJ
3203 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3204 fi
3205 install_libdir="$2"
3206
3207 oldlibs=
3208 if test -z "$rpath"; then
3209 if test "$build_libtool_libs" = yes; then
3210 # Building a libtool convenience library.
fa7f168c
TJ
3211 # Some compilers have problems with a `.al' extension so
3212 # convenience libraries should have the same extension an
3213 # archive normally would.
3a07e3fb
TJ
3214 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3215 build_libtool_libs=convenience
3216 build_old_libs=yes
3217 fi
3218
3219 if test -n "$vinfo"; then
fa7f168c 3220 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3a07e3fb
TJ
3221 fi
3222
3223 if test -n "$release"; then
3224 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3225 fi
3226 else
3227
3228 # Parse the version information argument.
3229 save_ifs="$IFS"; IFS=':'
3230 set dummy $vinfo 0 0 0
3231 IFS="$save_ifs"
3232
3233 if test -n "$8"; then
3234 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3235 $echo "$help" 1>&2
fa7f168c 3236 exit $EXIT_FAILURE
3a07e3fb
TJ
3237 fi
3238
fa7f168c
TJ
3239 # convert absolute version numbers to libtool ages
3240 # this retains compatibility with .la files and attempts
3241 # to make the code below a bit more comprehensible
3242
3243 case $vinfo_number in
3244 yes)
3245 number_major="$2"
3246 number_minor="$3"
3247 number_revision="$4"
3248 #
3249 # There are really only two kinds -- those that
3250 # use the current revision as the major version
3251 # and those that subtract age and use age as
3252 # a minor version. But, then there is irix
3253 # which has an extra 1 added just for fun
3254 #
3255 case $version_type in
3256 darwin|linux|osf|windows|none)
3257 current=`expr $number_major + $number_minor`
3258 age="$number_minor"
3259 revision="$number_revision"
3260 ;;
3261 freebsd-aout|freebsd-elf|sunos)
3262 current="$number_major"
3263 revision="$number_minor"
3264 age="0"
3265 ;;
3266 irix|nonstopux)
3267 current=`expr $number_major + $number_minor`
3268 age="$number_minor"
3269 revision="$number_minor"
3270 lt_irix_increment=no
3271 ;;
3272 esac
3273 ;;
3274 no)
3275 current="$2"
3276 revision="$3"
3277 age="$4"
3278 ;;
3279 esac
3a07e3fb
TJ
3280
3281 # Check that each of the things are valid numbers.
3282 case $current in
fa7f168c 3283 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]) ;;
3a07e3fb 3284 *)
fa7f168c 3285 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3a07e3fb 3286 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
fa7f168c 3287 exit $EXIT_FAILURE
3a07e3fb
TJ
3288 ;;
3289 esac
3290
3291 case $revision in
fa7f168c 3292 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]) ;;
3a07e3fb 3293 *)
fa7f168c 3294 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3a07e3fb 3295 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
fa7f168c 3296 exit $EXIT_FAILURE
3a07e3fb
TJ
3297 ;;
3298 esac
3299
3300 case $age in
fa7f168c 3301 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]) ;;
3a07e3fb 3302 *)
fa7f168c 3303 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3a07e3fb 3304 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
fa7f168c 3305 exit $EXIT_FAILURE
3a07e3fb
TJ
3306 ;;
3307 esac
3308
fa7f168c 3309 if test "$age" -gt "$current"; then
3a07e3fb
TJ
3310 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3311 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
fa7f168c 3312 exit $EXIT_FAILURE
3a07e3fb
TJ
3313 fi
3314
3315 # Calculate the version variables.
3316 major=
3317 versuffix=
3318 verstring=
3319 case $version_type in
3320 none) ;;
3321
3322 darwin)
3323 # Like Linux, but with the current version available in
3324 # verstring for coding it into the library header
3325 major=.`expr $current - $age`
3326 versuffix="$major.$age.$revision"
3327 # Darwin ld doesn't like 0 for these options...
3328 minor_current=`expr $current + 1`
fa7f168c 3329 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3a07e3fb
TJ
3330 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3331 ;;
3332
3333 freebsd-aout)
3334 major=".$current"
3335 versuffix=".$current.$revision";
3336 ;;
3337
3338 freebsd-elf)
3339 major=".$current"
3340 versuffix=".$current";
3341 ;;
3342
fa7f168c
TJ
3343 irix | nonstopux)
3344 if test "X$lt_irix_increment" = "Xno"; then
3345 major=`expr $current - $age`
3346 else
3347 major=`expr $current - $age + 1`
3348 fi
3349 case $version_type in
3350 nonstopux) verstring_prefix=nonstopux ;;
3351 *) verstring_prefix=sgi ;;
3352 esac
3353 verstring="$verstring_prefix$major.$revision"
3a07e3fb
TJ
3354
3355 # Add in all the interfaces that we are compatible with.
3356 loop=$revision
fa7f168c 3357 while test "$loop" -ne 0; do
3a07e3fb
TJ
3358 iface=`expr $revision - $loop`
3359 loop=`expr $loop - 1`
fa7f168c 3360 verstring="$verstring_prefix$major.$iface:$verstring"
3a07e3fb
TJ
3361 done
3362
3363 # Before this point, $major must not contain `.'.
3364 major=.$major
3365 versuffix="$major.$revision"
3366 ;;
3367
3368 linux)
3369 major=.`expr $current - $age`
3370 versuffix="$major.$age.$revision"
3371 ;;
3372
3373 osf)
fa7f168c 3374 major=.`expr $current - $age`
3a07e3fb
TJ
3375 versuffix=".$current.$age.$revision"
3376 verstring="$current.$age.$revision"
3377
3378 # Add in all the interfaces that we are compatible with.
3379 loop=$age
fa7f168c 3380 while test "$loop" -ne 0; do
3a07e3fb
TJ
3381 iface=`expr $current - $loop`
3382 loop=`expr $loop - 1`
3383 verstring="$verstring:${iface}.0"
3384 done
3385
3386 # Make executables depend on our current version.
3387 verstring="$verstring:${current}.0"
3388 ;;
3389
3390 sunos)
3391 major=".$current"
3392 versuffix=".$current.$revision"
3393 ;;
3394
3395 windows)
3396 # Use '-' rather than '.', since we only want one
3397 # extension on DOS 8.3 filesystems.
3398 major=`expr $current - $age`
3399 versuffix="-$major"
3400 ;;
3401
3402 *)
3403 $echo "$modename: unknown library version type \`$version_type'" 1>&2
fa7f168c
TJ
3404 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3405 exit $EXIT_FAILURE
3a07e3fb
TJ
3406 ;;
3407 esac
3408
3409 # Clear the version info if we defaulted, and they specified a release.
3410 if test -z "$vinfo" && test -n "$release"; then
3411 major=
3a07e3fb
TJ
3412 case $version_type in
3413 darwin)
3414 # we can't check for "0.0" in archive_cmds due to quoting
3415 # problems, so we reset it completely
fa7f168c 3416 verstring=
3a07e3fb
TJ
3417 ;;
3418 *)
3419 verstring="0.0"
3420 ;;
3421 esac
3422 if test "$need_version" = no; then
3423 versuffix=
3424 else
3425 versuffix=".0.0"
3426 fi
3427 fi
3428
3429 # Remove version info from name if versioning should be avoided
3430 if test "$avoid_version" = yes && test "$need_version" = no; then
3431 major=
3432 versuffix=
3433 verstring=""
3434 fi
3435
3436 # Check to see if the archive will have undefined symbols.
3437 if test "$allow_undefined" = yes; then
3438 if test "$allow_undefined_flag" = unsupported; then
3439 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3440 build_libtool_libs=no
3441 build_old_libs=yes
3442 fi
3443 else
3444 # Don't allow undefined symbols.
3445 allow_undefined_flag="$no_undefined_flag"
3446 fi
3447 fi
3448
3449 if test "$mode" != relink; then
fa7f168c
TJ
3450 # Remove our outputs, but don't remove object files since they
3451 # may have been created when compiling PIC objects.
3452 removelist=
3453 tempremovelist=`$echo "$output_objdir/*"`
3454 for p in $tempremovelist; do
3455 case $p in
3456 *.$objext)
3457 ;;
3458 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3459 if test "X$precious_files_regex" != "X"; then
3460 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3461 then
3462 continue
3463 fi
3464 fi
3465 removelist="$removelist $p"
3466 ;;
3467 *) ;;
3468 esac
3469 done
3470 if test -n "$removelist"; then
3471 $show "${rm}r $removelist"
3472 $run ${rm}r $removelist
3473 fi
3a07e3fb
TJ
3474 fi
3475
3476 # Now set the variables for building old libraries.
3477 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3478 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3479
3480 # Transform .lo files to .o files.
3481 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3482 fi
3483
3484 # Eliminate all temporary directories.
fa7f168c
TJ
3485 #for path in $notinst_path; do
3486 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3487 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3488 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3489 #done
3a07e3fb
TJ
3490
3491 if test -n "$xrpath"; then
3492 # If the user specified any rpath flags, then add them.
3493 temp_xrpath=
3494 for libdir in $xrpath; do
3495 temp_xrpath="$temp_xrpath -R$libdir"
3496 case "$finalize_rpath " in
3497 *" $libdir "*) ;;
3498 *) finalize_rpath="$finalize_rpath $libdir" ;;
3499 esac
3500 done
fa7f168c 3501 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3a07e3fb
TJ
3502 dependency_libs="$temp_xrpath $dependency_libs"
3503 fi
3504 fi
3505
3506 # Make sure dlfiles contains only unique files that won't be dlpreopened
3507 old_dlfiles="$dlfiles"
3508 dlfiles=
3509 for lib in $old_dlfiles; do
3510 case " $dlprefiles $dlfiles " in
3511 *" $lib "*) ;;
3512 *) dlfiles="$dlfiles $lib" ;;
3513 esac
3514 done
3515
3516 # Make sure dlprefiles contains only unique files
3517 old_dlprefiles="$dlprefiles"
3518 dlprefiles=
3519 for lib in $old_dlprefiles; do
3520 case "$dlprefiles " in
3521 *" $lib "*) ;;
3522 *) dlprefiles="$dlprefiles $lib" ;;
3523 esac
3524 done
3525
3526 if test "$build_libtool_libs" = yes; then
3527 if test -n "$rpath"; then
3528 case $host in
3529 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3530 # these systems don't actually have a c library (as such)!
3531 ;;
3532 *-*-rhapsody* | *-*-darwin1.[012])
3533 # Rhapsody C library is in the System framework
3534 deplibs="$deplibs -framework System"
3535 ;;
3536 *-*-netbsd*)
3537 # Don't link with libc until the a.out ld.so is fixed.
3538 ;;
fa7f168c 3539 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3a07e3fb
TJ
3540 # Do not include libc due to us having libc/libc_r.
3541 ;;
fa7f168c
TJ
3542 *-*-sco3.2v5* | *-*-sco5v6*)
3543 # Causes problems with __ctype
3544 ;;
3545 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3546 # Compiler inserts libc in the correct place for threads to work
3547 ;;
3548 *)
3a07e3fb
TJ
3549 # Add libc to deplibs on all other systems if necessary.
3550 if test "$build_libtool_need_lc" = "yes"; then
3551 deplibs="$deplibs -lc"
3552 fi
3553 ;;
3554 esac
3555 fi
3556
3557 # Transform deplibs into only deplibs that can be linked in shared.
3558 name_save=$name
3559 libname_save=$libname
3560 release_save=$release
3561 versuffix_save=$versuffix
3562 major_save=$major
3563 # I'm not sure if I'm treating the release correctly. I think
3564 # release should show up in the -l (ie -lgmp5) so we don't want to
3565 # add it in twice. Is that correct?
3566 release=""
3567 versuffix=""
3568 major=""
3569 newdeplibs=
3570 droppeddeps=no
3571 case $deplibs_check_method in
3572 pass_all)
3573 # Don't check for shared/static. Everything works.
3574 # This might be a little naive. We might want to check
3575 # whether the library exists or not. But this is on
3576 # osf3 & osf4 and I'm not really sure... Just
fa7f168c 3577 # implementing what was already the behavior.
3a07e3fb
TJ
3578 newdeplibs=$deplibs
3579 ;;
3580 test_compile)
3581 # This code stresses the "libraries are programs" paradigm to its
3582 # limits. Maybe even breaks it. We compile a program, linking it
3583 # against the deplibs as a proxy for the library. Then we can check
3584 # whether they linked in statically or dynamically with ldd.
3585 $rm conftest.c
3586 cat > conftest.c <<EOF
3587 int main() { return 0; }
3588EOF
3589 $rm conftest
fa7f168c 3590 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3a07e3fb
TJ
3591 ldd_output=`ldd conftest`
3592 for i in $deplibs; do
fa7f168c 3593 name=`expr $i : '-l\(.*\)'`
3a07e3fb 3594 # If $name is empty we are operating on a -L argument.
fa7f168c
TJ
3595 if test "$name" != "" && test "$name" != "0"; then
3596 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3597 case " $predeps $postdeps " in
3598 *" $i "*)
3599 newdeplibs="$newdeplibs $i"
3600 i=""
3601 ;;
3602 esac
3603 fi
3604 if test -n "$i" ; then
3605 libname=`eval \\$echo \"$libname_spec\"`
3606 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3607 set dummy $deplib_matches
3608 deplib_match=$2
3609 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3610 newdeplibs="$newdeplibs $i"
3611 else
3612 droppeddeps=yes
3613 $echo
3614 $echo "*** Warning: dynamic linker does not accept needed library $i."
3615 $echo "*** I have the capability to make that library automatically link in when"
3616 $echo "*** you link to this library. But I can only do this if you have a"
3617 $echo "*** shared version of the library, which I believe you do not have"
3618 $echo "*** because a test_compile did reveal that the linker did not use it for"
3619 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3620 fi
3a07e3fb
TJ
3621 fi
3622 else
3623 newdeplibs="$newdeplibs $i"
3624 fi
3625 done
3626 else
fa7f168c
TJ
3627 # Error occurred in the first compile. Let's try to salvage
3628 # the situation: Compile a separate program for each library.
3a07e3fb 3629 for i in $deplibs; do
fa7f168c
TJ
3630 name=`expr $i : '-l\(.*\)'`
3631 # If $name is empty we are operating on a -L argument.
3632 if test "$name" != "" && test "$name" != "0"; then
3a07e3fb 3633 $rm conftest
fa7f168c 3634 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3a07e3fb 3635 ldd_output=`ldd conftest`
fa7f168c
TJ
3636 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3637 case " $predeps $postdeps " in
3638 *" $i "*)
3639 newdeplibs="$newdeplibs $i"
3640 i=""
3641 ;;
3642 esac
3643 fi
3644 if test -n "$i" ; then
3645 libname=`eval \\$echo \"$libname_spec\"`
3646 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3647 set dummy $deplib_matches
3648 deplib_match=$2
3649 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3650 newdeplibs="$newdeplibs $i"
3651 else
3652 droppeddeps=yes
3653 $echo
3654 $echo "*** Warning: dynamic linker does not accept needed library $i."
3655 $echo "*** I have the capability to make that library automatically link in when"
3656 $echo "*** you link to this library. But I can only do this if you have a"
3657 $echo "*** shared version of the library, which you do not appear to have"
3658 $echo "*** because a test_compile did reveal that the linker did not use this one"
3659 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3660 fi
3a07e3fb
TJ
3661 fi
3662 else
3663 droppeddeps=yes
fa7f168c
TJ
3664 $echo
3665 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3666 $echo "*** make it link in! You will probably need to install it or some"
3667 $echo "*** library that it depends on before this library will be fully"
3668 $echo "*** functional. Installing it before continuing would be even better."
3a07e3fb
TJ
3669 fi
3670 else
3671 newdeplibs="$newdeplibs $i"
3672 fi
3673 done
3674 fi
3675 ;;
3676 file_magic*)
3677 set dummy $deplibs_check_method
3678 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3679 for a_deplib in $deplibs; do
fa7f168c 3680 name=`expr $a_deplib : '-l\(.*\)'`
3a07e3fb 3681 # If $name is empty we are operating on a -L argument.
fa7f168c
TJ
3682 if test "$name" != "" && test "$name" != "0"; then
3683 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3684 case " $predeps $postdeps " in
3685 *" $a_deplib "*)
3686 newdeplibs="$newdeplibs $a_deplib"
3687 a_deplib=""
3688 ;;
3689 esac
3690 fi
3691 if test -n "$a_deplib" ; then
3692 libname=`eval \\$echo \"$libname_spec\"`
3693 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3694 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3695 for potent_lib in $potential_libs; do
3a07e3fb
TJ
3696 # Follow soft links.
3697 if ls -lLd "$potent_lib" 2>/dev/null \
3698 | grep " -> " >/dev/null; then
3699 continue
3700 fi
3701 # The statement above tries to avoid entering an
3702 # endless loop below, in case of cyclic links.
3703 # We might still enter an endless loop, since a link
3704 # loop can be closed while we follow links,
3705 # but so what?
3706 potlib="$potent_lib"
3707 while test -h "$potlib" 2>/dev/null; do
fa7f168c 3708 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3a07e3fb
TJ
3709 case $potliblink in
3710 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3711 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3712 esac
3713 done
3714 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
fa7f168c
TJ
3715 | ${SED} 10q \
3716 | $EGREP "$file_magic_regex" > /dev/null; then
3a07e3fb
TJ
3717 newdeplibs="$newdeplibs $a_deplib"
3718 a_deplib=""
3719 break 2
3720 fi
fa7f168c
TJ
3721 done
3722 done
3723 fi
3a07e3fb
TJ
3724 if test -n "$a_deplib" ; then
3725 droppeddeps=yes
fa7f168c
TJ
3726 $echo
3727 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3728 $echo "*** I have the capability to make that library automatically link in when"
3729 $echo "*** you link to this library. But I can only do this if you have a"
3730 $echo "*** shared version of the library, which you do not appear to have"
3731 $echo "*** because I did check the linker path looking for a file starting"
3732 if test -z "$potlib" ; then
3733 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3734 else
3735 $echo "*** with $libname and none of the candidates passed a file format test"
3736 $echo "*** using a file magic. Last file checked: $potlib"
3737 fi
3a07e3fb
TJ
3738 fi
3739 else
3740 # Add a -L argument.
3741 newdeplibs="$newdeplibs $a_deplib"
3742 fi
3743 done # Gone through all deplibs.
3744 ;;
3745 match_pattern*)
3746 set dummy $deplibs_check_method
3747 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3748 for a_deplib in $deplibs; do
fa7f168c 3749 name=`expr $a_deplib : '-l\(.*\)'`
3a07e3fb
TJ
3750 # If $name is empty we are operating on a -L argument.
3751 if test -n "$name" && test "$name" != "0"; then
fa7f168c
TJ
3752 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3753 case " $predeps $postdeps " in
3754 *" $a_deplib "*)
3755 newdeplibs="$newdeplibs $a_deplib"
3756 a_deplib=""
3757 ;;
3758 esac
3759 fi
3760 if test -n "$a_deplib" ; then
3761 libname=`eval \\$echo \"$libname_spec\"`
3762 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3763 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3764 for potent_lib in $potential_libs; do
3765 potlib="$potent_lib" # see symlink-check above in file_magic test
3766 if eval $echo \"$potent_lib\" 2>/dev/null \
3767 | ${SED} 10q \
3768 | $EGREP "$match_pattern_regex" > /dev/null; then
3769 newdeplibs="$newdeplibs $a_deplib"
3770 a_deplib=""
3771 break 2
3772 fi
3773 done
3a07e3fb 3774 done
fa7f168c 3775 fi
3a07e3fb
TJ
3776 if test -n "$a_deplib" ; then
3777 droppeddeps=yes
fa7f168c
TJ
3778 $echo
3779 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3780 $echo "*** I have the capability to make that library automatically link in when"
3781 $echo "*** you link to this library. But I can only do this if you have a"
3782 $echo "*** shared version of the library, which you do not appear to have"
3783 $echo "*** because I did check the linker path looking for a file starting"
3784 if test -z "$potlib" ; then
3785 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3786 else
3787 $echo "*** with $libname and none of the candidates passed a file format test"
3788 $echo "*** using a regex pattern. Last file checked: $potlib"
3789 fi
3a07e3fb
TJ
3790 fi
3791 else
3792 # Add a -L argument.
3793 newdeplibs="$newdeplibs $a_deplib"
3794 fi
3795 done # Gone through all deplibs.
3796 ;;
3797 none | unknown | *)
3798 newdeplibs=""
fa7f168c
TJ
3799 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3800 -e 's/ -[LR][^ ]*//g'`
3801 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3802 for i in $predeps $postdeps ; do
3803 # can't use Xsed below, because $i might contain '/'
3804 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3805 done
3806 fi
3807 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3808 | grep . >/dev/null; then
3809 $echo
3a07e3fb 3810 if test "X$deplibs_check_method" = "Xnone"; then
fa7f168c 3811 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3a07e3fb 3812