1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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.
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
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
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+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP='tr \r\n \100\100'
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.
116 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
125 # Make sure IFS has a sensible default
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147 lo2o="s/\\.lo\$/.${objext}/"
148 o2lo="s/\\.${objext}\$/.lo/"
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
162 my_template="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir="${my_template}-$$"
169 # If mktemp works, use that first and foremost
170 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask=`umask`
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" || {
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189 $echo "X$my_tmpdir" | $Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
201 win32_libid_type="unknown"
202 win32_fileres=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library*) # definitely import
205 win32_libid_type="x86 archive import"
207 *ar\ archive*) # could be an import, or static
208 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210 win32_nmres=`eval $NM -f posix -A $1 | \
219 import*) win32_libid_type="x86 archive import";;
220 *) win32_libid_type="x86 archive static";;
225 win32_libid_type="x86 DLL"
227 *executable*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel*)
230 win32_libid_type="x86 DLL"
235 $echo $win32_libid_type
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
247 if test -n "$available_tags" && test -z "$tagname"; then
251 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 CC_quoted="$CC_quoted $arg"
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
270 # Double-quote args containing other shell metacharacters.
272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
276 CC_quoted="$CC_quoted $arg"
278 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
279 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
280 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
281 extendcc=${host}-${CC}
282 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
283 # (Gentoo-specific hack because we always export $CHOST)
284 mungedcc=${CHOST-${host}}-${trimedcc}
286 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
287 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
290 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
291 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
292 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
293 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
294 # The compiler in the base compile command matches
295 # the one in the tagged configuration.
296 # Assume this is the tagged configuration we want.
303 # If $tagname still isn't set, then no tagged configuration
304 # was found and let the user know that the "--tag" command
305 # line option must be used.
306 if test -z "$tagname"; then
307 $echo "$modename: unable to infer tagged configuration"
308 $echo "$modename: specify a tag with \`--tag'" 1>&2
311 # $echo "$modename: using $tagname tagged configuration"
319 # func_extract_an_archive dir oldlib
320 func_extract_an_archive ()
322 f_ex_an_ar_dir="$1"; shift
323 f_ex_an_ar_oldlib="$1"
325 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
326 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
327 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
330 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
335 # func_extract_archives gentop oldlib ...
336 func_extract_archives ()
338 my_gentop="$1"; shift
346 $show "${rm}r $my_gentop"
347 $run ${rm}r "$my_gentop"
348 $show "$mkdir $my_gentop"
349 $run $mkdir "$my_gentop"
351 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
355 for my_xlib in $my_oldlibs; do
356 # Extract the objects.
358 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
359 *) my_xabs=`pwd`"/$my_xlib" ;;
361 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
364 case " $extracted_archives " in
366 extracted_serial=`expr $extracted_serial + 1`
367 my_xlib_u=lt$extracted_serial-$my_xlib ;;
371 extracted_archives="$extracted_archives $my_xlib_u"
372 my_xdir="$my_gentop/$my_xlib_u"
374 $show "${rm}r $my_xdir"
375 $run ${rm}r "$my_xdir"
376 $show "$mkdir $my_xdir"
377 $run $mkdir "$my_xdir"
379 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
384 $show "Extracting $my_xabs"
385 # Do not bother doing anything if just a dry run
386 if test -z "$run"; then
387 darwin_orig_dir=`pwd`
388 cd $my_xdir || exit $?
389 darwin_archive=$my_xabs
391 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
392 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
393 if test -n "$darwin_arches"; then
394 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
396 $show "$darwin_base_archive has multiple architectures $darwin_arches"
397 for darwin_arch in $darwin_arches ; do
398 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
399 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
400 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
401 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
403 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
404 done # $darwin_arches
405 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
406 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
409 for darwin_file in $darwin_filelist; do
410 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
411 lipo -create -output "$darwin_file" $darwin_files
412 done # $darwin_filelist
414 cd "$darwin_orig_dir"
416 cd "$darwin_orig_dir"
417 func_extract_an_archive "$my_xdir" "$my_xabs"
422 func_extract_an_archive "$my_xdir" "$my_xabs"
425 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
427 func_extract_archives_result="$my_oldobjs"
429 # End of Shell function definitions
430 #####################################
433 eval std_shrext=\"$shrext_cmds\"
437 # Parse our command line options once, thoroughly.
438 while test "$#" -gt 0
444 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
448 # If the previous option needs an argument, assign it.
449 if test -n "$prev"; then
452 execute_dlfiles="$execute_dlfiles $arg"
456 preserve_args="${preserve_args}=$arg"
458 # Check whether tagname contains only valid characters
461 $echo "$progname: invalid tag name: $tagname" 1>&2
468 # Don't test for the "default" C tag, as we know, it's there, but
469 # not specially marked.
472 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
473 taglist="$taglist $tagname"
474 # Evaluate the configuration.
475 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
477 $echo "$progname: ignoring unknown tag $tagname" 1>&2
492 # Have we seen a non-optional argument yet?
500 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
502 Copyright (C) 2007 Free Software Foundation, Inc.
503 This is free software; see the source for copying conditions. There is NO
504 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
509 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
510 # Now print the configurations for the tags.
511 for tagname in $taglist; do
512 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
518 $echo "$progname: enabling shell trace mode"
520 preserve_args="$preserve_args $arg"
529 if test "$build_libtool_libs" = yes; then
530 $echo "enable shared libraries"
532 $echo "disable shared libraries"
534 if test "$build_old_libs" = yes; then
535 $echo "enable static libraries"
537 $echo "disable static libraries"
542 --finish) mode="finish" ;;
544 --mode) prevopt="--mode" prev=mode ;;
545 --mode=*) mode="$optarg" ;;
547 --preserve-dup-deps) duplicate_deps="yes" ;;
551 preserve_args="$preserve_args $arg"
557 preserve_args="$preserve_args --tag"
560 set tag "$optarg" ${1+"$@"}
563 preserve_args="$preserve_args --tag"
572 $echo "$modename: unrecognized option \`$arg'" 1>&2
584 if test -n "$prevopt"; then
585 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
590 case $disable_libs in
594 build_libtool_libs=no
598 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
602 # If this variable is set in any of the actions, the command in it
603 # will be execed at the end. This prevents here-documents from being
604 # left over by shells.
607 if test -z "$show_help"; then
609 # Infer the operation mode.
610 if test -z "$mode"; then
611 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
612 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
614 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
626 *db | *dbx | *strace | *truss)
636 # If we have no mode, but dlfiles were specified, then do execute mode.
637 test -n "$execute_dlfiles" && mode=execute
639 # Just use the default operation mode.
640 if test -z "$mode"; then
641 if test -n "$nonopt"; then
642 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
644 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
651 # Only execute mode is allowed to have -dlopen flags.
652 if test -n "$execute_dlfiles" && test "$mode" != execute; then
653 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
658 # Change the help message to a mode-specific one.
660 help="Try \`$modename --help --mode=$mode' for more information."
662 # These modes are in order of execution frequency so that they run quickly.
664 # libtool compile mode
666 modename="$modename: compile"
667 # Get the compilation command and the source file.
669 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
680 # do not "continue". Instead, add this to base_compile
692 # Accept any command-line options.
695 if test -n "$libobj" ; then
696 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
703 -static | -prefer-pic | -prefer-non-pic)
714 arg_mode=arg # the next one goes into the "base_compile" arg list
715 continue # The current "srcfile" will either be retained or
716 ;; # replaced later. I would guess that would be a bug.
719 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
721 save_ifs="$IFS"; IFS=','
725 # Double-quote args containing other shell metacharacters.
726 # Many Bourne shells cannot handle close brackets correctly
727 # in scan sets, so we specify it separately.
729 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
733 lastarg="$lastarg $arg"
736 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
738 # Add the arguments to base_compile.
739 base_compile="$base_compile $lastarg"
744 # Accept the current argument as the source file.
745 # The previous "srcfile" becomes the current argument.
752 esac # case $arg_mode
754 # Aesthetically quote the previous argument.
755 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
758 # Double-quote args containing other shell metacharacters.
759 # Many Bourne shells cannot handle close brackets correctly
760 # in scan sets, and some SunOS ksh mistreat backslash-escaping
761 # in scan sets (worked around with variable expansion),
762 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
763 # at all, so we specify them separately.
764 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
765 lastarg="\"$lastarg\""
769 base_compile="$base_compile $lastarg"
774 $echo "$modename: you must specify an argument for -Xcompile"
778 $echo "$modename: you must specify a target with \`-o'" 1>&2
782 # Get the name of the library object.
783 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
787 # Recognize several different file suffixes.
788 # If the user specifies -o file.o, it is replaced with file.lo
798 *.class) xform=class ;;
801 *.[fF][09]?) xform=[fF][09]. ;;
803 *.java) xform=java ;;
807 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
810 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
812 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
817 func_infer_tag $base_compile
819 for arg in $later; do
838 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
840 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
841 qlibobj="\"$qlibobj\"" ;;
843 test "X$libobj" != "X$qlibobj" \
844 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
845 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
846 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
847 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
848 if test "X$xdir" = "X$obj"; then
853 lobj=${xdir}$objdir/$objname
855 if test -z "$base_compile"; then
856 $echo "$modename: you must specify a compilation command" 1>&2
861 # Delete any leftover library objects.
862 if test "$build_old_libs" = yes; then
863 removelist="$obj $lobj $libobj ${libobj}T"
865 removelist="$lobj $libobj ${libobj}T"
869 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
871 # On Cygwin there's no "real" PIC flag so we must build both object types
873 cygwin* | mingw* | pw32* | os2*)
877 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
878 # non-PIC code in shared libraries is not supported
882 # Calculate the filename of the output object if compiler does
883 # not support -o with -c
884 if test "$compiler_c_o" = no; then
885 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
886 lockfile="$output_obj.lock"
887 removelist="$removelist $output_obj $lockfile"
888 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
895 # Lock this critical section if it is needed
896 # We use this script file to make the link, it avoids creating a new file
897 if test "$need_locks" = yes; then
898 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
899 $show "Waiting for $lockfile to be removed"
902 elif test "$need_locks" = warn; then
903 if test -f "$lockfile"; then
905 *** ERROR, $lockfile exists and contains:
906 `cat $lockfile 2>/dev/null`
908 This indicates that another process is trying to use the same
909 temporary object file, and libtool could not work around it because
910 your compiler does not support \`-c' and \`-o' together. If you
911 repeat this compilation, it may succeed, by chance, but you had better
912 avoid parallel builds (make -j) in this platform, or get a better
918 $echo "$srcfile" > "$lockfile"
921 if test -n "$fix_srcfile_path"; then
922 eval srcfile=\"$fix_srcfile_path\"
924 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
926 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
927 qsrcfile="\"$qsrcfile\"" ;;
930 $run $rm "$libobj" "${libobj}T"
932 # Create a libtool object file (analogous to a ".la" file),
933 # but don't create it if we're doing a dry run.
934 test -z "$run" && cat > ${libobj}T <<EOF
935 # $libobj - a libtool object file
936 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
938 # Please DO NOT delete this file!
939 # It is necessary for linking the library.
941 # Name of the PIC object.
944 # Only build a PIC object if we are building libtool libraries.
945 if test "$build_libtool_libs" = yes; then
946 # Without this assignment, base_compile gets emptied.
947 fbsd_hideous_sh_bug=$base_compile
949 if test "$pic_mode" != no; then
950 command="$base_compile $qsrcfile $pic_flag"
952 # Don't build PIC code
953 command="$base_compile $qsrcfile"
956 if test ! -d "${xdir}$objdir"; then
957 $show "$mkdir ${xdir}$objdir"
958 $run $mkdir ${xdir}$objdir
960 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
965 if test -z "$output_obj"; then
966 # Place PIC objects in $objdir
967 command="$command -o $lobj"
970 $run $rm "$lobj" "$output_obj"
973 if $run eval "$command"; then :
975 test -n "$output_obj" && $run $rm $removelist
979 if test "$need_locks" = warn &&
980 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
982 *** ERROR, $lockfile contains:
983 `cat $lockfile 2>/dev/null`
985 but it should contain:
988 This indicates that another process is trying to use the same
989 temporary object file, and libtool could not work around it because
990 your compiler does not support \`-c' and \`-o' together. If you
991 repeat this compilation, it may succeed, by chance, but you had better
992 avoid parallel builds (make -j) in this platform, or get a better
999 # Just move the object if needed, then go on to compile the next one
1000 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1001 $show "$mv $output_obj $lobj"
1002 if $run $mv $output_obj $lobj; then :
1005 $run $rm $removelist
1010 # Append the name of the PIC object to the libtool object file.
1011 test -z "$run" && cat >> ${libobj}T <<EOF
1012 pic_object='$objdir/$objname'
1016 # Allow error messages only from the first compilation.
1017 if test "$suppress_opt" = yes; then
1018 suppress_output=' >/dev/null 2>&1'
1021 # No PIC object so indicate it doesn't exist in the libtool
1023 test -z "$run" && cat >> ${libobj}T <<EOF
1029 # Only build a position-dependent object if we build old libraries.
1030 if test "$build_old_libs" = yes; then
1031 if test "$pic_mode" != yes; then
1032 # Don't build PIC code
1033 command="$base_compile $qsrcfile"
1035 command="$base_compile $qsrcfile $pic_flag"
1037 if test "$compiler_c_o" = yes; then
1038 command="$command -o $obj"
1041 # Suppress compiler output if we already did a PIC compilation.
1042 command="$command$suppress_output"
1043 $run $rm "$obj" "$output_obj"
1045 if $run eval "$command"; then :
1047 $run $rm $removelist
1051 if test "$need_locks" = warn &&
1052 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1054 *** ERROR, $lockfile contains:
1055 `cat $lockfile 2>/dev/null`
1057 but it should contain:
1060 This indicates that another process is trying to use the same
1061 temporary object file, and libtool could not work around it because
1062 your compiler does not support \`-c' and \`-o' together. If you
1063 repeat this compilation, it may succeed, by chance, but you had better
1064 avoid parallel builds (make -j) in this platform, or get a better
1067 $run $rm $removelist
1071 # Just move the object if needed
1072 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1073 $show "$mv $output_obj $obj"
1074 if $run $mv $output_obj $obj; then :
1077 $run $rm $removelist
1082 # Append the name of the non-PIC object the libtool object file.
1083 # Only append if the libtool object file exists.
1084 test -z "$run" && cat >> ${libobj}T <<EOF
1085 # Name of the non-PIC object.
1086 non_pic_object='$objname'
1090 # Append the name of the non-PIC object the libtool object file.
1091 # Only append if the libtool object file exists.
1092 test -z "$run" && cat >> ${libobj}T <<EOF
1093 # Name of the non-PIC object.
1099 $run $mv "${libobj}T" "${libobj}"
1101 # Unlock the critical section if it was locked
1102 if test "$need_locks" != no; then
1103 $run $rm "$lockfile"
1111 modename="$modename: link"
1113 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1114 # It is impossible to link a dll without this setting, and
1115 # we shouldn't force the makefile maintainer to figure out
1116 # which system we are compiling for in order to pass an extra
1117 # flag for every libtool invocation.
1118 # allow_undefined=no
1120 # FIXME: Unfortunately, there are problems with the above when trying
1121 # to make a dll which has undefined symbols, in which case not
1122 # even a static library is built. For now, we need to specify
1123 # -no-undefined on the libtool link line when we can be certain
1124 # that all symbols are satisfied, otherwise we get a static library.
1131 libtool_args="$nonopt"
1132 base_compile="$nonopt $@"
1133 compile_command="$nonopt"
1134 finalize_command="$nonopt"
1147 lib_search_path=`pwd`
1156 export_symbols_regex=
1164 notinst_path= # paths that contain not-installed libtool libraries
1165 precious_files_regex=
1166 prefer_static_libs=no
1179 func_infer_tag $base_compile
1181 # We need to know -static, to get the right output filenames.
1185 -all-static | -static | -static-libtool-libs)
1188 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1189 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1191 if test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1194 prefer_static_libs=yes
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1200 prefer_static_libs=built
1202 -static-libtool-libs)
1203 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1204 dlopen_self=$dlopen_self_static
1206 prefer_static_libs=yes
1209 build_libtool_libs=no
1216 # See if our shared archives depend on static archives.
1217 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1219 # Go through the arguments, transforming them on the way.
1220 while test "$#" -gt 0; do
1224 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1225 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1229 libtool_args="$libtool_args $qarg"
1231 # If the previous option needs an argument, assign it.
1232 if test -n "$prev"; then
1235 compile_command="$compile_command @OUTPUT@"
1236 finalize_command="$finalize_command @OUTPUT@"
1242 if test "$preload" = no; then
1243 # Add the symbol object into the linking commands.
1244 compile_command="$compile_command @SYMFILE@"
1245 finalize_command="$finalize_command @SYMFILE@"
1249 *.la | *.lo) ;; # We handle these cases below.
1251 if test "$dlself" = no; then
1259 if test "$prev" = dlprefiles; then
1261 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1271 if test "$prev" = dlfiles; then
1272 dlfiles="$dlfiles $arg"
1274 dlprefiles="$dlprefiles $arg"
1282 export_symbols="$arg"
1283 if test ! -f "$arg"; then
1284 $echo "$modename: symbol file \`$arg' does not exist"
1291 export_symbols_regex="$arg"
1296 inst_prefix_dir="$arg"
1301 precious_files_regex="$arg"
1311 if test -f "$arg"; then
1314 for fil in `cat $save_arg`
1316 # moreargs="$moreargs $fil"
1318 # A libtool-controlled object.
1320 # Check to see that this really is a libtool object.
1321 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1326 # If there is no directory component, then add one.
1328 */* | *\\*) . $arg ;;
1332 if test -z "$pic_object" || \
1333 test -z "$non_pic_object" ||
1334 test "$pic_object" = none && \
1335 test "$non_pic_object" = none; then
1336 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1340 # Extract subdirectory from the argument.
1341 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1342 if test "X$xdir" = "X$arg"; then
1348 if test "$pic_object" != none; then
1349 # Prepend the subdirectory the object is found in.
1350 pic_object="$xdir$pic_object"
1352 if test "$prev" = dlfiles; then
1353 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1354 dlfiles="$dlfiles $pic_object"
1358 # If libtool objects are unsupported, then we need to preload.
1363 # CHECK ME: I think I busted this. -Ossama
1364 if test "$prev" = dlprefiles; then
1365 # Preload the old-style object.
1366 dlprefiles="$dlprefiles $pic_object"
1371 libobjs="$libobjs $pic_object"
1376 if test "$non_pic_object" != none; then
1377 # Prepend the subdirectory the object is found in.
1378 non_pic_object="$xdir$non_pic_object"
1380 # A standard non-PIC object
1381 non_pic_objects="$non_pic_objects $non_pic_object"
1382 if test -z "$pic_object" || test "$pic_object" = none ; then
1383 arg="$non_pic_object"
1386 # If the PIC object exists, use it instead.
1387 # $xdir was prepended to $pic_object above.
1388 non_pic_object="$pic_object"
1389 non_pic_objects="$non_pic_objects $non_pic_object"
1392 # Only an error if not doing a dry-run.
1393 if test -z "$run"; then
1394 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1399 # Extract subdirectory from the argument.
1400 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1401 if test "X$xdir" = "X$arg"; then
1407 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1408 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1409 libobjs="$libobjs $pic_object"
1410 non_pic_objects="$non_pic_objects $non_pic_object"
1415 $echo "$modename: link input file \`$save_arg' does not exist"
1423 # We need an absolute path.
1425 [\\/]* | [A-Za-z]:[\\/]*) ;;
1427 $echo "$modename: only absolute run-paths are allowed" 1>&2
1431 if test "$prev" = rpath; then
1434 *) rpath="$rpath $arg" ;;
1439 *) xrpath="$xrpath $arg" ;;
1446 compiler_flags="$compiler_flags $qarg"
1448 compile_command="$compile_command $qarg"
1449 finalize_command="$finalize_command $qarg"
1453 linker_flags="$linker_flags $qarg"
1454 compiler_flags="$compiler_flags $wl$qarg"
1456 compile_command="$compile_command $wl$qarg"
1457 finalize_command="$finalize_command $wl$qarg"
1461 linker_flags="$linker_flags $qarg"
1462 compiler_flags="$compiler_flags $qarg"
1464 compile_command="$compile_command $qarg"
1465 finalize_command="$finalize_command $qarg"
1473 darwin_framework|darwin_framework_skip)
1474 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1475 compile_command="$compile_command $arg"
1476 finalize_command="$finalize_command $arg"
1481 eval "$prev=\"\$arg\""
1486 fi # test -n "$prev"
1492 if test -n "$link_static_flag"; then
1493 compile_command="$compile_command $link_static_flag"
1494 finalize_command="$finalize_command $link_static_flag"
1500 # FIXME: remove this flag sometime in the future.
1501 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1525 -export-symbols | -export-symbols-regex)
1526 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1527 $echo "$modename: more than one -exported-symbols argument is not allowed"
1530 if test "X$arg" = "X-export-symbols"; then
1538 -framework|-arch|-isysroot)
1540 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1541 prev=darwin_framework_skip ;;
1542 *) compiler_flags="$compiler_flags $arg"
1543 prev=darwin_framework ;;
1545 compile_command="$compile_command $arg"
1546 finalize_command="$finalize_command $arg"
1555 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1556 # so, if we see these flags be careful not to treat them like -L
1558 case $with_gcc/$host in
1559 no/*-*-irix* | /*-*-irix*)
1560 compile_command="$compile_command $arg"
1561 finalize_command="$finalize_command $arg"
1568 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1569 # We need an absolute path.
1571 [\\/]* | [A-Za-z]:[\\/]*) ;;
1573 absdir=`cd "$dir" && pwd`
1574 if test -z "$absdir"; then
1575 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1577 notinst_path="$notinst_path $dir"
1585 deplibs="$deplibs -L$dir"
1586 lib_search_path="$lib_search_path $dir"
1590 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1591 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1592 case :$dllsearchpath: in
1594 *) dllsearchpath="$dllsearchpath:$dir";;
1596 case :$dllsearchpath: in
1597 *":$testbindir:"*) ;;
1598 *) dllsearchpath="$dllsearchpath:$testbindir";;
1606 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1609 # These systems don't actually have a C or math library (as such)
1613 # These systems don't actually have a C library (as such)
1614 test "X$arg" = "X-lc" && continue
1616 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1617 # Do not include libc due to us having libc/libc_r.
1618 test "X$arg" = "X-lc" && continue
1620 *-*-rhapsody* | *-*-darwin1.[012])
1621 # Rhapsody C and math libraries are in the System framework
1622 deplibs="$deplibs -framework System"
1625 *-*-sco3.2v5* | *-*-sco5v6*)
1626 # Causes problems with __ctype
1627 test "X$arg" = "X-lc" && continue
1629 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1630 # Compiler inserts libc in the correct place for threads to work
1631 test "X$arg" = "X-lc" && continue
1634 elif test "X$arg" = "X-lc_r"; then
1636 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1637 # Do not include libc_r directly, use -pthread flag.
1642 deplibs="$deplibs $arg"
1646 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1647 # classes, name mangling, and exception handling.
1649 compile_command="$compile_command $arg"
1650 compiler_flags="$compiler_flags $arg"
1651 finalize_command="$finalize_command $arg"
1656 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1657 compiler_flags="$compiler_flags $arg"
1658 compile_command="$compile_command $arg"
1659 finalize_command="$finalize_command $arg"
1668 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671 # +DA*, +DD* enable 64-bit mode on the HP compiler
1672 # -q* pass through compiler args for the IBM compiler
1673 # -m* pass through architecture-specific compiler args for GCC
1674 # -m*, -t[45]*, -txscale* pass through architecture-specific
1675 # compiler args for GCC
1676 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677 # -F/path gives path to uninstalled frameworks, gcc on darwin
1678 # @file GCC response files
1679 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1682 # Unknown arguments in both finalize_command and compile_command need
1683 # to be aesthetically quoted because they are evaled later.
1684 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1686 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1690 compile_command="$compile_command $arg"
1691 finalize_command="$finalize_command $arg"
1692 compiler_flags="$compiler_flags $arg"
1708 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # and Darwin in order for the loader to find any dlls it needs.
1711 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1715 *) no_install=yes ;;
1732 -precious-files-regex)
1753 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754 # We need an absolute path.
1756 [\\/]* | [A-Za-z]:[\\/]*) ;;
1758 $echo "$modename: only absolute run-paths are allowed" 1>&2
1764 *) xrpath="$xrpath $dir" ;;
1769 -static | -static-libtool-libs)
1770 # The effects of -static are defined in a previous loop.
1771 # We used to do the same as -all-static on platforms that
1772 # didn't have a PIC flag, but the assumption that the effects
1773 # would be equivalent was wrong. It would break on at least
1774 # Digital Unix and AIX.
1794 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1796 save_ifs="$IFS"; IFS=','
1797 for flag in $args; do
1800 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1805 compiler_flags="$compiler_flags $flag"
1808 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1812 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1814 save_ifs="$IFS"; IFS=','
1815 for flag in $args; do
1818 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1823 compiler_flags="$compiler_flags $wl$flag"
1824 linker_flags="$linker_flags $flag"
1827 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1845 # Some other compiler flag.
1847 # Unknown arguments in both finalize_command and compile_command need
1848 # to be aesthetically quoted because they are evaled later.
1849 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1851 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1858 # A standard object.
1863 # A libtool-controlled object.
1865 # Check to see that this really is a libtool object.
1866 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1871 # If there is no directory component, then add one.
1873 */* | *\\*) . $arg ;;
1877 if test -z "$pic_object" || \
1878 test -z "$non_pic_object" ||
1879 test "$pic_object" = none && \
1880 test "$non_pic_object" = none; then
1881 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1885 # Extract subdirectory from the argument.
1886 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$xdir" = "X$arg"; then
1893 if test "$pic_object" != none; then
1894 # Prepend the subdirectory the object is found in.
1895 pic_object="$xdir$pic_object"
1897 if test "$prev" = dlfiles; then
1898 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899 dlfiles="$dlfiles $pic_object"
1903 # If libtool objects are unsupported, then we need to preload.
1908 # CHECK ME: I think I busted this. -Ossama
1909 if test "$prev" = dlprefiles; then
1910 # Preload the old-style object.
1911 dlprefiles="$dlprefiles $pic_object"
1916 libobjs="$libobjs $pic_object"
1921 if test "$non_pic_object" != none; then
1922 # Prepend the subdirectory the object is found in.
1923 non_pic_object="$xdir$non_pic_object"
1925 # A standard non-PIC object
1926 non_pic_objects="$non_pic_objects $non_pic_object"
1927 if test -z "$pic_object" || test "$pic_object" = none ; then
1928 arg="$non_pic_object"
1931 # If the PIC object exists, use it instead.
1932 # $xdir was prepended to $pic_object above.
1933 non_pic_object="$pic_object"
1934 non_pic_objects="$non_pic_objects $non_pic_object"
1937 # Only an error if not doing a dry-run.
1938 if test -z "$run"; then
1939 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1944 # Extract subdirectory from the argument.
1945 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946 if test "X$xdir" = "X$arg"; then
1952 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954 libobjs="$libobjs $pic_object"
1955 non_pic_objects="$non_pic_objects $non_pic_object"
1962 deplibs="$deplibs $arg"
1963 old_deplibs="$old_deplibs $arg"
1968 # A libtool-controlled library.
1970 if test "$prev" = dlfiles; then
1971 # This library was specified with -dlopen.
1972 dlfiles="$dlfiles $arg"
1974 elif test "$prev" = dlprefiles; then
1975 # The library was specified with -dlpreopen.
1976 dlprefiles="$dlprefiles $arg"
1979 deplibs="$deplibs $arg"
1984 # Some other compiler argument.
1986 # Unknown arguments in both finalize_command and compile_command need
1987 # to be aesthetically quoted because they are evaled later.
1988 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1990 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1997 # Now actually substitute the argument into the commands.
1998 if test -n "$arg"; then
1999 compile_command="$compile_command $arg"
2000 finalize_command="$finalize_command $arg"
2002 done # argument parsing loop
2004 if test -n "$prev"; then
2005 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2010 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011 eval arg=\"$export_dynamic_flag_spec\"
2012 compile_command="$compile_command $arg"
2013 finalize_command="$finalize_command $arg"
2017 # calculate the name of the file, without its directory
2018 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019 libobjs_save="$libobjs"
2021 if test -n "$shlibpath_var"; then
2022 # get the directories listed in $shlibpath_var
2023 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2027 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2030 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031 if test "X$output_objdir" = "X$output"; then
2032 output_objdir="$objdir"
2034 output_objdir="$output_objdir/$objdir"
2036 # Create the object directory.
2037 if test ! -d "$output_objdir"; then
2038 $show "$mkdir $output_objdir"
2039 $run $mkdir $output_objdir
2041 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2046 # Determine the type of output
2049 $echo "$modename: you must specify an output file" 1>&2
2053 *.$libext) linkmode=oldlib ;;
2054 *.lo | *.$objext) linkmode=obj ;;
2055 *.la) linkmode=lib ;;
2056 *) linkmode=prog ;; # Anything else should be a program.
2060 *cygwin* | *mingw* | *pw32*)
2061 # don't eliminate duplications in $postdeps and $predeps
2062 duplicate_compiler_generated_deps=yes
2065 duplicate_compiler_generated_deps=$duplicate_deps
2071 # Find all interdependent deplibs by searching for libraries
2072 # that are linked more than once (e.g. -la -lb -la)
2073 for deplib in $deplibs; do
2074 if test "X$duplicate_deps" = "Xyes" ; then
2076 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2079 libs="$libs $deplib"
2082 if test "$linkmode" = lib; then
2083 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2085 # Compute libraries that are listed more than once in $predeps
2086 # $postdeps and mark them as special (i.e., whose duplicates are
2087 # not to be eliminated).
2089 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090 for pre_post_dep in $predeps $postdeps; do
2091 case "$pre_post_deps " in
2092 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2094 pre_post_deps="$pre_post_deps $pre_post_dep"
2103 need_relink=no # whether we're linking any uninstalled libtool libraries
2104 notinst_deplibs= # not-installed libtool libraries
2108 for file in $dlfiles $dlprefiles; do
2112 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2124 passes="conv scan dlopen dlpreopen link"
2129 for pass in $passes; do
2130 if test "$linkmode,$pass" = "lib,link" ||
2131 test "$linkmode,$pass" = "prog,scan"; then
2135 if test "$linkmode" = prog; then
2137 dlopen) libs="$dlfiles" ;;
2138 dlpreopen) libs="$dlprefiles" ;;
2139 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2142 if test "$pass" = dlopen; then
2143 # Collect dlpreopened libraries
2144 save_deplibs="$deplibs"
2147 for deplib in $libs; do
2151 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152 if test "$linkmode,$pass" = "prog,link"; then
2153 compile_deplibs="$deplib $compile_deplibs"
2154 finalize_deplibs="$deplib $finalize_deplibs"
2156 compiler_flags="$compiler_flags $deplib"
2161 if test "$linkmode" != lib && test "$linkmode" != prog; then
2162 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2165 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2167 for search_ext in .la $std_shrext .so .a; do
2168 # Search the libtool library
2169 lib="$searchdir/lib${name}${search_ext}"
2170 if test -f "$lib"; then
2171 if test "$search_ext" = ".la"; then
2180 if test "$found" != yes; then
2181 # deplib doesn't seem to be a libtool library
2182 if test "$linkmode,$pass" = "prog,link"; then
2183 compile_deplibs="$deplib $compile_deplibs"
2184 finalize_deplibs="$deplib $finalize_deplibs"
2186 deplibs="$deplib $deplibs"
2187 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2190 else # deplib is a libtool library
2191 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2192 # We need to do some special things here, and not later.
2193 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2194 case " $predeps $postdeps " in
2196 if (${SED} -e '2q' $lib |
2197 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2201 */* | *\\*) . $lib ;;
2204 for l in $old_library $library_names; do
2207 if test "X$ll" = "X$old_library" ; then # only static version available
2209 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2210 test "X$ladir" = "X$lib" && ladir="."
2211 lib=$ladir/$old_library
2212 if test "$linkmode,$pass" = "prog,link"; then
2213 compile_deplibs="$deplib $compile_deplibs"
2214 finalize_deplibs="$deplib $finalize_deplibs"
2216 deplibs="$deplib $deplibs"
2217 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2231 deplibs="$deplib $deplibs"
2232 test "$pass" = conv && continue
2233 newdependency_libs="$deplib $newdependency_libs"
2234 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2237 if test "$pass" = conv; then
2238 deplibs="$deplib $deplibs"
2241 if test "$pass" = scan; then
2242 deplibs="$deplib $deplibs"
2244 compile_deplibs="$deplib $compile_deplibs"
2245 finalize_deplibs="$deplib $finalize_deplibs"
2247 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2250 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2256 if test "$pass" = link; then
2257 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2258 # Make sure the xrpath contains only unique directories.
2261 *) xrpath="$xrpath $dir" ;;
2264 deplibs="$deplib $deplibs"
2267 *.la) lib="$deplib" ;;
2269 if test "$pass" = conv; then
2270 deplibs="$deplib $deplibs"
2276 case $deplibs_check_method in
2278 set dummy $deplibs_check_method
2279 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2280 if eval $echo \"$deplib\" 2>/dev/null \
2282 | $EGREP "$match_pattern_regex" > /dev/null; then
2290 if test "$valid_a_lib" != yes; then
2292 $echo "*** Warning: Trying to link with static lib archive $deplib."
2293 $echo "*** I have the capability to make that library automatically link in when"
2294 $echo "*** you link to this library. But I can only do this if you have a"
2295 $echo "*** shared version of the library, which you do not appear to have"
2296 $echo "*** because the file extensions .$libext of this argument makes me believe"
2297 $echo "*** that it is just a static archive that I should not used here."
2300 $echo "*** Warning: Linking the shared library $output against the"
2301 $echo "*** static library $deplib is not portable!"
2302 deplibs="$deplib $deplibs"
2307 if test "$pass" != link; then
2308 deplibs="$deplib $deplibs"
2310 compile_deplibs="$deplib $compile_deplibs"
2311 finalize_deplibs="$deplib $finalize_deplibs"
2318 if test "$pass" = conv; then
2319 deplibs="$deplib $deplibs"
2320 elif test "$linkmode" = prog; then
2321 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2322 # If there is no dlopen support or we're linking statically,
2323 # we need to preload.
2324 newdlprefiles="$newdlprefiles $deplib"
2325 compile_deplibs="$deplib $compile_deplibs"
2326 finalize_deplibs="$deplib $finalize_deplibs"
2328 newdlfiles="$newdlfiles $deplib"
2338 if test "$found" = yes || test -f "$lib"; then :
2340 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2344 # Check to see that this really is a libtool archive.
2345 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2347 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2351 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2352 test "X$ladir" = "X$lib" && ladir="."
2360 # If the library was installed with an old release of libtool,
2361 # it will not redefine variables installed, or shouldnotlink
2369 */* | *\\*) . $lib ;;
2373 if test "$linkmode,$pass" = "lib,link" ||
2374 test "$linkmode,$pass" = "prog,scan" ||
2375 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2376 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2377 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2380 if test "$pass" = conv; then
2381 # Only check for convenience libraries
2382 deplibs="$lib $deplibs"
2383 if test -z "$libdir"; then
2384 if test -z "$old_library"; then
2385 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2388 # It is a libtool convenience library, so add in its objects.
2389 convenience="$convenience $ladir/$objdir/$old_library"
2390 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2392 for deplib in $dependency_libs; do
2393 deplibs="$deplib $deplibs"
2394 if test "X$duplicate_deps" = "Xyes" ; then
2395 case "$tmp_libs " in
2396 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2399 tmp_libs="$tmp_libs $deplib"
2401 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2402 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2409 # Get the name of the library we link against.
2411 for l in $old_library $library_names; do
2414 if test -z "$linklib"; then
2415 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2419 # This library was specified with -dlopen.
2420 if test "$pass" = dlopen; then
2421 if test -z "$libdir"; then
2422 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2425 if test -z "$dlname" ||
2426 test "$dlopen_support" != yes ||
2427 test "$build_libtool_libs" = no; then
2428 # If there is no dlname, no dlopen support or we're linking
2429 # statically, we need to preload. We also need to preload any
2430 # dependent libraries so libltdl's deplib preloader doesn't
2431 # bomb out in the load deplibs phase.
2432 dlprefiles="$dlprefiles $lib $dependency_libs"
2434 newdlfiles="$newdlfiles $lib"
2439 # We need an absolute path.
2441 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2443 abs_ladir=`cd "$ladir" && pwd`
2444 if test -z "$abs_ladir"; then
2445 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2446 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2451 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2453 # Find the relevant object directory and library name.
2454 if test "X$installed" = Xyes; then
2455 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2456 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2464 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2466 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2469 # Remove this search path later
2470 notinst_path="$notinst_path $abs_ladir"
2472 dir="$ladir/$objdir"
2473 absdir="$abs_ladir/$objdir"
2474 # Remove this search path later
2475 notinst_path="$notinst_path $abs_ladir"
2477 fi # $installed = yes
2478 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2480 # This library was specified with -dlpreopen.
2481 if test "$pass" = dlpreopen; then
2482 if test -z "$libdir"; then
2483 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2486 # Prefer using a static library (so that no silly _DYNAMIC symbols
2487 # are required to link).
2488 if test -n "$old_library"; then
2489 newdlprefiles="$newdlprefiles $dir/$old_library"
2490 # Otherwise, use the dlname, so that lt_dlopen finds it.
2491 elif test -n "$dlname"; then
2492 newdlprefiles="$newdlprefiles $dir/$dlname"
2494 newdlprefiles="$newdlprefiles $dir/$linklib"
2496 fi # $pass = dlpreopen
2498 if test -z "$libdir"; then
2499 # Link the convenience library
2500 if test "$linkmode" = lib; then
2501 deplibs="$dir/$old_library $deplibs"
2502 elif test "$linkmode,$pass" = "prog,link"; then
2503 compile_deplibs="$dir/$old_library $compile_deplibs"
2504 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2506 deplibs="$lib $deplibs" # used for prog,scan pass
2512 if test "$linkmode" = prog && test "$pass" != link; then
2513 newlib_search_path="$newlib_search_path $ladir"
2514 deplibs="$lib $deplibs"
2517 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2518 test "$build_libtool_libs" = no; then
2523 for deplib in $dependency_libs; do
2525 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2527 # Need to link against all dependency_libs?
2528 if test "$linkalldeplibs" = yes; then
2529 deplibs="$deplib $deplibs"
2531 # Need to hardcode shared library paths
2532 # or/and link against static libraries
2533 newdependency_libs="$deplib $newdependency_libs"
2535 if test "X$duplicate_deps" = "Xyes" ; then
2536 case "$tmp_libs " in
2537 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2540 tmp_libs="$tmp_libs $deplib"
2543 fi # $linkmode = prog...
2545 if test "$linkmode,$pass" = "prog,link"; then
2546 if test -n "$library_names" &&
2547 { { test "$prefer_static_libs" = no ||
2548 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2549 test -z "$old_library"; }; then
2550 # We need to hardcode the library path
2551 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2552 # Make sure the rpath contains only unique directories.
2553 case "$temp_rpath " in
2556 *) temp_rpath="$temp_rpath $absdir" ;;
2560 # Hardcode the library path.
2561 # Skip directories that are in the system default run-time
2563 case " $sys_lib_dlsearch_path " in
2566 case "$compile_rpath " in
2568 *) compile_rpath="$compile_rpath $absdir"
2572 case " $sys_lib_dlsearch_path " in
2575 case "$finalize_rpath " in
2577 *) finalize_rpath="$finalize_rpath $libdir"
2581 fi # $linkmode,$pass = prog,link...
2583 if test "$alldeplibs" = yes &&
2584 { test "$deplibs_check_method" = pass_all ||
2585 { test "$build_libtool_libs" = yes &&
2586 test -n "$library_names"; }; }; then
2587 # We only need to search for static libraries
2592 link_static=no # Whether the deplib will be linked statically
2593 use_static_libs=$prefer_static_libs
2594 if test "$use_static_libs" = built && test "$installed" = yes ; then
2597 if test -n "$library_names" &&
2598 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2599 if test "$installed" = no; then
2600 notinst_deplibs="$notinst_deplibs $lib"
2603 # This is a shared library
2605 # Warn about portability, can't link against -module's on
2606 # some systems (darwin)
2607 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2609 if test "$linkmode" = prog; then
2610 $echo "*** Warning: Linking the executable $output against the loadable module"
2612 $echo "*** Warning: Linking the shared library $output against the loadable module"
2614 $echo "*** $linklib is not portable!"
2616 if test "$linkmode" = lib &&
2617 test "$hardcode_into_libs" = yes; then
2618 # Hardcode the library path.
2619 # Skip directories that are in the system default run-time
2621 case " $sys_lib_dlsearch_path " in
2624 case "$compile_rpath " in
2626 *) compile_rpath="$compile_rpath $absdir"
2630 case " $sys_lib_dlsearch_path " in
2633 case "$finalize_rpath " in
2635 *) finalize_rpath="$finalize_rpath $libdir"
2641 if test -n "$old_archive_from_expsyms_cmds"; then
2642 # figure out the soname
2643 set dummy $library_names
2646 libname=`eval \\$echo \"$libname_spec\"`
2647 # use dlname if we got it. it's perfectly good, no?
2648 if test -n "$dlname"; then
2650 elif test -n "$soname_spec"; then
2654 major=`expr $current - $age`
2658 eval soname=\"$soname_spec\"
2663 # Make a new name for the extract_expsyms_cmds to use
2665 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2666 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2668 # If the library has no export list, then create one now
2669 if test -f "$output_objdir/$soname-def"; then :
2671 $show "extracting exported symbol list from \`$soname'"
2672 save_ifs="$IFS"; IFS='~'
2673 cmds=$extract_expsyms_cmds
2674 for cmd in $cmds; do
2678 $run eval "$cmd" || exit $?
2684 if test -f "$output_objdir/$newlib"; then :; else
2685 $show "generating import library for \`$soname'"
2686 save_ifs="$IFS"; IFS='~'
2687 cmds=$old_archive_from_expsyms_cmds
2688 for cmd in $cmds; do
2692 $run eval "$cmd" || exit $?
2696 # make sure the library variables are pointing to the new library
2699 fi # test -n "$old_archive_from_expsyms_cmds"
2701 if test "$linkmode" = prog || test "$mode" != relink; then
2706 case $hardcode_action in
2707 immediate | unsupported)
2708 if test "$hardcode_direct" = no; then
2711 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2712 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2713 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2714 *-*-unixware7*) add_dir="-L$dir" ;;
2716 # if the lib is a module then we can not link against
2717 # it, someone is ignoring the new warnings I added
2718 if /usr/bin/file -L $add 2> /dev/null |
2719 $EGREP ": [^:]* bundle" >/dev/null ; then
2720 $echo "** Warning, lib $linklib is a module, not a shared library"
2721 if test -z "$old_library" ; then
2723 $echo "** And there doesn't seem to be a static archive available"
2724 $echo "** The link will probably fail, sorry"
2726 add="$dir/$old_library"
2730 elif test "$hardcode_minus_L" = no; then
2732 *-*-sunos*) add_shlibpath="$dir" ;;
2736 elif test "$hardcode_shlibpath_var" = no; then
2737 add_shlibpath="$dir"
2744 if test "$hardcode_direct" = yes; then
2746 elif test "$hardcode_minus_L" = yes; then
2748 # Try looking first in the location we're being installed to.
2749 if test -n "$inst_prefix_dir"; then
2752 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2757 elif test "$hardcode_shlibpath_var" = yes; then
2758 add_shlibpath="$dir"
2767 if test "$lib_linked" != yes; then
2768 $echo "$modename: configuration error: unsupported hardcode properties"
2772 if test -n "$add_shlibpath"; then
2773 case :$compile_shlibpath: in
2774 *":$add_shlibpath:"*) ;;
2775 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2778 if test "$linkmode" = prog; then
2779 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2780 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2782 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2783 test -n "$add" && deplibs="$add $deplibs"
2784 if test "$hardcode_direct" != yes && \
2785 test "$hardcode_minus_L" != yes && \
2786 test "$hardcode_shlibpath_var" = yes; then
2787 case :$finalize_shlibpath: in
2789 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2795 if test "$linkmode" = prog || test "$mode" = relink; then
2799 # Finalize command for both is simple: just hardcode it.
2800 if test "$hardcode_direct" = yes; then
2801 add="$libdir/$linklib"
2802 elif test "$hardcode_minus_L" = yes; then
2805 elif test "$hardcode_shlibpath_var" = yes; then
2806 case :$finalize_shlibpath: in
2808 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2811 elif test "$hardcode_automatic" = yes; then
2812 if test -n "$inst_prefix_dir" &&
2813 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2814 add="$inst_prefix_dir$libdir/$linklib"
2816 add="$libdir/$linklib"
2819 # We cannot seem to hardcode it, guess we'll fake it.
2821 # Try looking first in the location we're being installed to.
2822 if test -n "$inst_prefix_dir"; then
2825 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2832 if test "$linkmode" = prog; then
2833 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2834 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2836 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2837 test -n "$add" && deplibs="$add $deplibs"
2840 elif test "$linkmode" = prog; then
2841 # Here we assume that one of hardcode_direct or hardcode_minus_L
2842 # is not unsupported. This is valid on all known static and
2844 if test "$hardcode_direct" != unsupported; then
2845 test -n "$old_library" && linklib="$old_library"
2846 compile_deplibs="$dir/$linklib $compile_deplibs"
2847 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2849 compile_deplibs="-l$name -L$dir $compile_deplibs"
2850 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2852 elif test "$build_libtool_libs" = yes; then
2853 # Not a shared library
2854 if test "$deplibs_check_method" != pass_all; then
2855 # We're trying link a shared library against a static one
2856 # but the system doesn't support it.
2858 # Just print a warning and add the library to dependency_libs so
2859 # that the program can be linked against the static library.
2861 $echo "*** Warning: This system can not link to static lib archive $lib."
2862 $echo "*** I have the capability to make that library automatically link in when"
2863 $echo "*** you link to this library. But I can only do this if you have a"
2864 $echo "*** shared version of the library, which you do not appear to have."
2865 if test "$module" = yes; then
2866 $echo "*** But as you try to build a module library, libtool will still create "
2867 $echo "*** a static module, that should work as long as the dlopening application"
2868 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2869 if test -z "$global_symbol_pipe"; then
2871 $echo "*** However, this would only work if libtool was able to extract symbol"
2872 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2873 $echo "*** not find such a program. So, this module is probably useless."
2874 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2876 if test "$build_old_libs" = no; then
2877 build_libtool_libs=module
2880 build_libtool_libs=no
2884 deplibs="$dir/$old_library $deplibs"
2887 fi # link shared/static library?
2889 if test "$linkmode" = lib; then
2890 if test -n "$dependency_libs" &&
2891 { test "$hardcode_into_libs" != yes ||
2892 test "$build_old_libs" = yes ||
2893 test "$link_static" = yes; }; then
2894 # Extract -R from dependency_libs
2896 for libdir in $dependency_libs; do
2898 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2900 *" $temp_xrpath "*) ;;
2901 *) xrpath="$xrpath $temp_xrpath";;
2903 *) temp_deplibs="$temp_deplibs $libdir";;
2906 dependency_libs="$temp_deplibs"
2909 newlib_search_path="$newlib_search_path $absdir"
2910 # Link against this library
2911 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2912 # ... and its dependency_libs
2914 for deplib in $dependency_libs; do
2915 newdependency_libs="$deplib $newdependency_libs"
2916 if test "X$duplicate_deps" = "Xyes" ; then
2917 case "$tmp_libs " in
2918 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2921 tmp_libs="$tmp_libs $deplib"
2924 if test "$link_all_deplibs" != no; then
2925 # Add the search paths of all dependency libraries
2926 for deplib in $dependency_libs; do
2928 -L*) path="$deplib" ;;
2930 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2931 test "X$dir" = "X$deplib" && dir="."
2932 # We need an absolute path.
2934 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2936 absdir=`cd "$dir" && pwd`
2937 if test -z "$absdir"; then
2938 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2943 if grep "^installed=no" $deplib > /dev/null; then
2944 path="$absdir/$objdir"
2946 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2947 if test -z "$libdir"; then
2948 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2951 if test "$absdir" != "$libdir"; then
2952 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2959 # we do not want to link against static libs,
2960 # but need to link against shared
2961 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2962 if test -n "$deplibrary_names" ; then
2963 for tmp in $deplibrary_names ; do
2966 if test -f "$path/$depdepl" ; then
2967 depdepl="$path/$depdepl"
2969 # do not add paths which are already there
2970 case " $newlib_search_path " in
2972 *) newlib_search_path="$newlib_search_path $path";;
2985 # Again, we only want to link against shared libraries
2986 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2987 for tmp in $newlib_search_path ; do
2988 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2989 eval depdepl="$tmp/lib$tmp_libs.dylib"
3000 case " $deplibs " in
3002 *) deplibs="$path $deplibs" ;;
3004 case " $deplibs " in
3006 *) deplibs="$depdepl $deplibs" ;;
3009 fi # link_all_deplibs != no
3011 done # for deplib in $libs
3012 dependency_libs="$newdependency_libs"
3013 if test "$pass" = dlpreopen; then
3014 # Link the dlpreopened libraries before other libraries
3015 for deplib in $save_deplibs; do
3016 deplibs="$deplib $deplibs"
3019 if test "$pass" != dlopen; then
3020 if test "$pass" != conv; then
3021 # Make sure lib_search_path contains only unique directories.
3023 for dir in $newlib_search_path; do
3024 case "$lib_search_path " in
3026 *) lib_search_path="$lib_search_path $dir" ;;
3032 if test "$linkmode,$pass" != "prog,link"; then
3035 vars="compile_deplibs finalize_deplibs"
3037 for var in $vars dependency_libs; do
3038 # Add libraries to $var in reverse order
3039 eval tmp_libs=\"\$$var\"
3041 for deplib in $tmp_libs; do
3042 # FIXME: Pedantically, this is the right thing to do, so
3043 # that some nasty dependency loop isn't accidentally
3045 #new_libs="$deplib $new_libs"
3046 # Pragmatically, this seems to cause very few problems in
3049 -L*) new_libs="$deplib $new_libs" ;;
3052 # And here is the reason: when a library appears more
3053 # than once as an explicit dependence of a library, or
3054 # is implicitly linked in more than once by the
3055 # compiler, it is considered special, and multiple
3056 # occurrences thereof are not removed. Compare this
3057 # with having the same library being listed as a
3058 # dependency of multiple other libraries: in this case,
3059 # we know (pedantically, we assume) the library does not
3060 # need to be listed more than once, so we keep only the
3061 # last copy. This is not always right, but it is rare
3062 # enough that we require users that really mean to play
3063 # such unportable linking tricks to link the library
3064 # using -Wl,-lname, so that libtool does not consider it
3065 # for duplicate removal.
3066 case " $specialdeplibs " in
3067 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3069 case " $new_libs " in
3071 *) new_libs="$deplib $new_libs" ;;
3079 for deplib in $new_libs; do
3082 case " $tmp_libs " in
3084 *) tmp_libs="$tmp_libs $deplib" ;;
3087 *) tmp_libs="$tmp_libs $deplib" ;;
3090 eval $var=\"$tmp_libs\"
3093 # Last step: remove runtime libs from dependency_libs
3094 # (they stay in deplibs)
3096 for i in $dependency_libs ; do
3097 case " $predeps $postdeps $compiler_lib_search_path " in
3102 if test -n "$i" ; then
3103 tmp_libs="$tmp_libs $i"
3106 dependency_libs=$tmp_libs
3108 if test "$linkmode" = prog; then
3109 dlfiles="$newdlfiles"
3110 dlprefiles="$newdlprefiles"
3115 if test -n "$deplibs"; then
3116 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3119 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3120 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3123 if test -n "$rpath"; then
3124 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3127 if test -n "$xrpath"; then
3128 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3131 if test -n "$vinfo"; then
3132 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3135 if test -n "$release"; then
3136 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3139 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3140 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3143 # Now set the variables for building old libraries.
3144 build_libtool_libs=no
3146 objs="$objs$old_deplibs"
3150 # Make sure we only generate libraries of the form `libNAME.la'.
3153 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3154 eval shared_ext=\"$shrext_cmds\"
3155 eval libname=\"$libname_spec\"
3158 if test "$module" = no; then
3159 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3163 if test "$need_lib_prefix" != no; then
3164 # Add the "lib" prefix for modules if required
3165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3166 eval shared_ext=\"$shrext_cmds\"
3167 eval libname=\"$libname_spec\"
3169 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3174 if test -n "$objs"; then
3175 if test "$deplibs_check_method" != pass_all; then
3176 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3180 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3181 $echo "*** objects $objs is not portable!"
3182 libobjs="$libobjs $objs"
3186 if test "$dlself" != no; then
3187 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3191 if test "$#" -gt 2; then
3192 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3197 if test -z "$rpath"; then
3198 if test "$build_libtool_libs" = yes; then
3199 # Building a libtool convenience library.
3200 # Some compilers have problems with a `.al' extension so
3201 # convenience libraries should have the same extension an
3202 # archive normally would.
3203 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3204 build_libtool_libs=convenience
3208 if test -n "$vinfo"; then
3209 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3212 if test -n "$release"; then
3213 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3217 # Parse the version information argument.
3218 save_ifs="$IFS"; IFS=':'
3219 set dummy $vinfo 0 0 0
3222 if test -n "$8"; then
3223 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3228 # convert absolute version numbers to libtool ages
3229 # this retains compatibility with .la files and attempts
3230 # to make the code below a bit more comprehensible
3232 case $vinfo_number in
3236 number_revision="$4"
3238 # There are really only two kinds -- those that
3239 # use the current revision as the major version
3240 # and those that subtract age and use age as
3241 # a minor version. But, then there is irix
3242 # which has an extra 1 added just for fun
3244 case $version_type in
3245 darwin|linux|osf|windows|none)
3246 current=`expr $number_major + $number_minor`
3248 revision="$number_revision"
3250 freebsd-aout|freebsd-elf|sunos)
3251 current="$number_major"
3252 revision="$number_minor"
3256 current=`expr $number_major + $number_minor`
3258 revision="$number_minor"
3259 lt_irix_increment=no
3270 # Check that each of the things are valid numbers.
3272 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]) ;;
3274 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3275 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3281 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]) ;;
3283 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3284 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3290 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]) ;;
3292 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3293 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3298 if test "$age" -gt "$current"; then
3299 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3300 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3304 # Calculate the version variables.
3308 case $version_type in
3312 # Like Linux, but with the current version available in
3313 # verstring for coding it into the library header
3314 major=.`expr $current - $age`
3315 versuffix="$major.$age.$revision"
3316 # Darwin ld doesn't like 0 for these options...
3317 minor_current=`expr $current + 1`
3318 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3319 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3324 versuffix=".$current.$revision";
3329 versuffix=".$current";
3333 if test "X$lt_irix_increment" = "Xno"; then
3334 major=`expr $current - $age`
3336 major=`expr $current - $age + 1`
3338 case $version_type in
3339 nonstopux) verstring_prefix=nonstopux ;;
3340 *) verstring_prefix=sgi ;;
3342 verstring="$verstring_prefix$major.$revision"
3344 # Add in all the interfaces that we are compatible with.
3346 while test "$loop" -ne 0; do
3347 iface=`expr $revision - $loop`
3348 loop=`expr $loop - 1`
3349 verstring="$verstring_prefix$major.$iface:$verstring"
3352 # Before this point, $major must not contain `.'.
3354 versuffix="$major.$revision"
3358 major=.`expr $current - $age`
3359 versuffix="$major.$age.$revision"
3363 major=.`expr $current - $age`
3364 versuffix=".$current.$age.$revision"
3365 verstring="$current.$age.$revision"
3367 # Add in all the interfaces that we are compatible with.
3369 while test "$loop" -ne 0; do
3370 iface=`expr $current - $loop`
3371 loop=`expr $loop - 1`
3372 verstring="$verstring:${iface}.0"
3375 # Make executables depend on our current version.
3376 verstring="$verstring:${current}.0"
3381 versuffix=".$current.$revision"
3385 # Use '-' rather than '.', since we only want one
3386 # extension on DOS 8.3 filesystems.
3387 major=`expr $current - $age`
3392 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3393 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3398 # Clear the version info if we defaulted, and they specified a release.
3399 if test -z "$vinfo" && test -n "$release"; then
3401 case $version_type in
3403 # we can't check for "0.0" in archive_cmds due to quoting
3404 # problems, so we reset it completely
3411 if test "$need_version" = no; then
3418 # Remove version info from name if versioning should be avoided
3419 if test "$avoid_version" = yes && test "$need_version" = no; then
3425 # Check to see if the archive will have undefined symbols.
3426 if test "$allow_undefined" = yes; then
3427 if test "$allow_undefined_flag" = unsupported; then
3428 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3429 build_libtool_libs=no
3433 # Don't allow undefined symbols.
3434 allow_undefined_flag="$no_undefined_flag"
3438 if test "$mode" != relink; then
3439 # Remove our outputs, but don't remove object files since they
3440 # may have been created when compiling PIC objects.
3442 tempremovelist=`$echo "$output_objdir/*"`
3443 for p in $tempremovelist; do
3447 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3448 if test "X$precious_files_regex" != "X"; then
3449 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3454 removelist="$removelist $p"
3459 if test -n "$removelist"; then
3460 $show "${rm}r $removelist"
3461 $run ${rm}r $removelist
3465 # Now set the variables for building old libraries.
3466 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3467 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3469 # Transform .lo files to .o files.
3470 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3473 # Eliminate all temporary directories.
3474 #for path in $notinst_path; do
3475 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3476 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3477 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3480 if test -n "$xrpath"; then
3481 # If the user specified any rpath flags, then add them.
3483 for libdir in $xrpath; do
3484 temp_xrpath="$temp_xrpath -R$libdir"
3485 case "$finalize_rpath " in
3487 *) finalize_rpath="$finalize_rpath $libdir" ;;
3490 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3491 dependency_libs="$temp_xrpath $dependency_libs"
3495 # Make sure dlfiles contains only unique files that won't be dlpreopened
3496 old_dlfiles="$dlfiles"
3498 for lib in $old_dlfiles; do
3499 case " $dlprefiles $dlfiles " in
3501 *) dlfiles="$dlfiles $lib" ;;
3505 # Make sure dlprefiles contains only unique files
3506 old_dlprefiles="$dlprefiles"
3508 for lib in $old_dlprefiles; do
3509 case "$dlprefiles " in
3511 *) dlprefiles="$dlprefiles $lib" ;;
3515 if test "$build_libtool_libs" = yes; then
3516 if test -n "$rpath"; then
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3519 # these systems don't actually have a c library (as such)!
3521 *-*-rhapsody* | *-*-darwin1.[012])
3522 # Rhapsody C library is in the System framework
3523 deplibs="$deplibs -framework System"
3526 # Don't link with libc until the a.out ld.so is fixed.
3528 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3529 # Do not include libc due to us having libc/libc_r.
3531 *-*-sco3.2v5* | *-*-sco5v6*)
3532 # Causes problems with __ctype
3534 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3535 # Compiler inserts libc in the correct place for threads to work
3538 # Add libc to deplibs on all other systems if necessary.
3539 if test "$build_libtool_need_lc" = "yes"; then
3540 deplibs="$deplibs -lc"
3546 # Transform deplibs into only deplibs that can be linked in shared.
3548 libname_save=$libname
3549 release_save=$release
3550 versuffix_save=$versuffix
3552 # I'm not sure if I'm treating the release correctly. I think
3553 # release should show up in the -l (ie -lgmp5) so we don't want to
3554 # add it in twice. Is that correct?
3560 case $deplibs_check_method in
3562 # Don't check for shared/static. Everything works.
3563 # This might be a little naive. We might want to check
3564 # whether the library exists or not. But this is on
3565 # osf3 & osf4 and I'm not really sure... Just
3566 # implementing what was already the behavior.
3570 # This code stresses the "libraries are programs" paradigm to its
3571 # limits. Maybe even breaks it. We compile a program, linking it
3572 # against the deplibs as a proxy for the library. Then we can check
3573 # whether they linked in statically or dynamically with ldd.
3575 cat > conftest.c <<EOF
3576 int main() { return 0; }
3579 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3580 ldd_output=`ldd conftest`
3581 for i in $deplibs; do
3582 name=`expr $i : '-l\(.*\)'`
3583 # If $name is empty we are operating on a -L argument.
3584 if test "$name" != "" && test "$name" != "0"; then
3585 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3586 case " $predeps $postdeps " in
3588 newdeplibs="$newdeplibs $i"
3593 if test -n "$i" ; then
3594 libname=`eval \\$echo \"$libname_spec\"`
3595 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3596 set dummy $deplib_matches
3598 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3599 newdeplibs="$newdeplibs $i"
3603 $echo "*** Warning: dynamic linker does not accept needed library $i."
3604 $echo "*** I have the capability to make that library automatically link in when"
3605 $echo "*** you link to this library. But I can only do this if you have a"
3606 $echo "*** shared version of the library, which I believe you do not have"
3607 $echo "*** because a test_compile did reveal that the linker did not use it for"
3608 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3612 newdeplibs="$newdeplibs $i"
3616 # Error occurred in the first compile. Let's try to salvage
3617 # the situation: Compile a separate program for each library.
3618 for i in $deplibs; do
3619 name=`expr $i : '-l\(.*\)'`
3620 # If $name is empty we are operating on a -L argument.
3621 if test "$name" != "" && test "$name" != "0"; then
3623 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3624 ldd_output=`ldd conftest`
3625 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3626 case " $predeps $postdeps " in
3628 newdeplibs="$newdeplibs $i"
3633 if test -n "$i" ; then
3634 libname=`eval \\$echo \"$libname_spec\"`
3635 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3636 set dummy $deplib_matches
3638 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3639 newdeplibs="$newdeplibs $i"
3643 $echo "*** Warning: dynamic linker does not accept needed library $i."
3644 $echo "*** I have the capability to make that library automatically link in when"
3645 $echo "*** you link to this library. But I can only do this if you have a"
3646 $echo "*** shared version of the library, which you do not appear to have"
3647 $echo "*** because a test_compile did reveal that the linker did not use this one"
3648 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3654 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3655 $echo "*** make it link in! You will probably need to install it or some"
3656 $echo "*** library that it depends on before this library will be fully"
3657 $echo "*** functional. Installing it before continuing would be even better."
3660 newdeplibs="$newdeplibs $i"
3666 set dummy $deplibs_check_method
3667 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3668 for a_deplib in $deplibs; do
3669 name=`expr $a_deplib : '-l\(.*\)'`
3670 # If $name is empty we are operating on a -L argument.
3671 if test "$name" != "" && test "$name" != "0"; then
3672 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3673 case " $predeps $postdeps " in
3675 newdeplibs="$newdeplibs $a_deplib"
3680 if test -n "$a_deplib" ; then
3681 libname=`eval \\$echo \"$libname_spec\"`
3682 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3683 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3684 for potent_lib in $potential_libs; do
3685 # Follow soft links.
3686 if ls -lLd "$potent_lib" 2>/dev/null \
3687 | grep " -> " >/dev/null; then
3690 # The statement above tries to avoid entering an
3691 # endless loop below, in case of cyclic links.
3692 # We might still enter an endless loop, since a link
3693 # loop can be closed while we follow links,
3695 potlib="$potent_lib"
3696 while test -h "$potlib" 2>/dev/null; do
3697 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3699 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3700 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3703 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3705 | $EGREP "$file_magic_regex" > /dev/null; then
3706 newdeplibs="$newdeplibs $a_deplib"
3713 if test -n "$a_deplib" ; then
3716 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3717 $echo "*** I have the capability to make that library automatically link in when"
3718 $echo "*** you link to this library. But I can only do this if you have a"
3719 $echo "*** shared version of the library, which you do not appear to have"
3720 $echo "*** because I did check the linker path looking for a file starting"
3721 if test -z "$potlib" ; then
3722 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3724 $echo "*** with $libname and none of the candidates passed a file format test"
3725 $echo "*** using a file magic. Last file checked: $potlib"
3729 # Add a -L argument.
3730 newdeplibs="$newdeplibs $a_deplib"
3732 done # Gone through all deplibs.
3735 set dummy $deplibs_check_method
3736 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3737 for a_deplib in $deplibs; do
3738 name=`expr $a_deplib : '-l\(.*\)'`
3739 # If $name is empty we are operating on a -L argument.
3740 if test -n "$name" && test "$name" != "0"; then
3741 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3742 case " $predeps $postdeps " in
3744 newdeplibs="$newdeplibs $a_deplib"
3749 if test -n "$a_deplib" ; then
3750 libname=`eval \\$echo \"$libname_spec\"`
3751 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3752 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3753 for potent_lib in $potential_libs; do
3754 potlib="$potent_lib" # see symlink-check above in file_magic test
3755 if eval $echo \"$potent_lib\" 2>/dev/null \
3757 | $EGREP "$match_pattern_regex" > /dev/null; then
3758 newdeplibs="$newdeplibs $a_deplib"
3765 if test -n "$a_deplib" ; then
3768 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3769 $echo "*** I have the capability to make that library automatically link in when"
3770 $echo "*** you link to this library. But I can only do this if you have a"
3771 $echo "*** shared version of the library, which you do not appear to have"
3772 $echo "*** because I did check the linker path looking for a file starting"
3773 if test -z "$potlib" ; then
3774 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3776 $echo "*** with $libname and none of the candidates passed a file format test"
3777 $echo "*** using a regex pattern. Last file checked: $potlib"
3781 # Add a -L argument.
3782 newdeplibs="$newdeplibs $a_deplib"
3784 done # Gone through all deplibs.
3788 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3789 -e 's/ -[LR][^ ]*//g'`
3790 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3791 for i in $predeps $postdeps ; do
3792 # can't use Xsed below, because $i might contain '/'
3793 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3796 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3797 | grep . >/dev/null; then
3799 if test "X$deplibs_check_method" = "Xnone"; then
3800 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3802 $echo "*** Warning: inter-library dependencies are not known to be supported."
3804 $echo "*** All declared inter-library dependencies are being dropped."
3809 versuffix=$versuffix_save
3811 release=$release_save
3812 libname=$libname_save
3816 *-*-rhapsody* | *-*-darwin1.[012])
3817 # On Rhapsody replace the C library is the System framework
3818 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3822 if test "$droppeddeps" = yes; then
3823 if test "$module" = yes; then
3825 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3826 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3827 $echo "*** a static module, that should work as long as the dlopening"
3828 $echo "*** application is linked with the -dlopen flag."
3829 if test -z "$global_symbol_pipe"; then
3831 $echo "*** However, this would only work if libtool was able to extract symbol"
3832 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3833 $echo "*** not find such a program. So, this module is probably useless."
3834 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3836 if test "$build_old_libs" = no; then
3837 oldlibs="$output_objdir/$libname.$libext"
3838 build_libtool_libs=module
3841 build_libtool_libs=no
3844 $echo "*** The inter-library dependencies that have been dropped here will be"
3845 $echo "*** automatically added whenever a program is linked with this library"
3846 $echo "*** or is declared to -dlopen it."
3848 if test "$allow_undefined" = no; then
3850 $echo "*** Since this library must not contain undefined symbols,"
3851 $echo "*** because either the platform does not support them or"
3852 $echo "*** it was explicitly requested with -no-undefined,"
3853 $echo "*** libtool will only create a static version of it."
3854 if test "$build_old_libs" = no; then
3855 oldlibs="$output_objdir/$libname.$libext"
3856 build_libtool_libs=module
3859 build_libtool_libs=no
3864 # Done checking deplibs!
3869 # move library search paths that coincide with paths to not yet
3870 # installed libraries to the beginning of the library search list
3872 for path in $notinst_path; do
3873 case " $new_libs " in
3874 *" -L$path/$objdir "*) ;;
3876 case " $deplibs " in
3877 *" -L$path/$objdir "*)
3878 new_libs="$new_libs -L$path/$objdir" ;;
3883 for deplib in $deplibs; do
3886 case " $new_libs " in
3888 *) new_libs="$new_libs $deplib" ;;
3891 *) new_libs="$new_libs $deplib" ;;
3897 # All the library-specific variables (install_libdir is set above).
3902 # Test again, we may have decided not to build it any more
3903 if test "$build_libtool_libs" = yes; then
3904 if test "$hardcode_into_libs" = yes; then
3905 # Hardcode the library paths
3908 rpath="$finalize_rpath"
3909 test "$mode" != relink && rpath="$compile_rpath$rpath"
3910 for libdir in $rpath; do
3911 if test -n "$hardcode_libdir_flag_spec"; then
3912 if test -n "$hardcode_libdir_separator"; then
3913 if test -z "$hardcode_libdirs"; then
3914 hardcode_libdirs="$libdir"
3916 # Just accumulate the unique libdirs.
3917 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3918 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3921 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3926 eval flag=\"$hardcode_libdir_flag_spec\"
3927 dep_rpath="$dep_rpath $flag"
3929 elif test -n "$runpath_var"; then
3930 case "$perm_rpath " in
3932 *) perm_rpath="$perm_rpath $libdir" ;;
3936 # Substitute the hardcoded libdirs into the rpath.
3937 if test -n "$hardcode_libdir_separator" &&
3938 test -n "$hardcode_libdirs"; then
3939 libdir="$hardcode_libdirs"
3940 if test -n "$hardcode_libdir_flag_spec_ld"; then
3941 case $archive_cmds in
3942 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3943 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3946 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3949 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3950 # We should set the runpath_var.
3952 for dir in $perm_rpath; do
3955 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3957 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3960 shlibpath="$finalize_shlibpath"
3961 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3962 if test -n "$shlibpath"; then
3963 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3966 # Get the real and link names of the library.
3967 eval shared_ext=\"$shrext_cmds\"
3968 eval library_names=\"$library_names_spec\"
3969 set dummy $library_names
3973 if test -n "$soname_spec"; then
3974 eval soname=\"$soname_spec\"
3978 if test -z "$dlname"; then
3982 lib="$output_objdir/$realname"
3986 linknames="$linknames $link"
3989 # Use standard objects if they are pic
3990 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3992 # Prepare the list of exported symbols
3993 if test -z "$export_symbols"; then
3994 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3995 $show "generating symbol list for \`$libname.la'"
3996 export_symbols="$output_objdir/$libname.exp"
3997 $run $rm $export_symbols
3998 cmds=$export_symbols_cmds
3999 save_ifs="$IFS"; IFS='~'
4000 for cmd in $cmds; do
4003 if len=`expr "X$cmd" : ".*"` &&
4004 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4006 $run eval "$cmd" || exit $?
4007 skipped_export=false
4009 # The command line is too long to execute in one step.
4010 $show "using reloadable object file for export list..."
4012 # Break out early, otherwise skipped_export may be
4013 # set to false by a later but shorter cmd.
4018 if test -n "$export_symbols_regex"; then
4019 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4020 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4021 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4022 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4027 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4028 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4032 for test_deplib in $deplibs; do
4033 case " $convenience " in
4034 *" $test_deplib "*) ;;
4036 tmp_deplibs="$tmp_deplibs $test_deplib"
4040 deplibs="$tmp_deplibs"
4042 if test -n "$convenience"; then
4043 if test -n "$whole_archive_flag_spec"; then
4044 save_libobjs=$libobjs
4045 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4047 gentop="$output_objdir/${outputname}x"
4048 generated="$generated $gentop"
4050 func_extract_archives $gentop $convenience
4051 libobjs="$libobjs $func_extract_archives_result"
4055 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4056 eval flag=\"$thread_safe_flag_spec\"
4057 linker_flags="$linker_flags $flag"
4060 # Make a backup of the uninstalled library when relinking
4061 if test "$mode" = relink; then
4062 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4065 # Do each of the archive commands.
4066 if test "$module" = yes && test -n "$module_cmds" ; then
4067 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4068 eval test_cmds=\"$module_expsym_cmds\"
4069 cmds=$module_expsym_cmds
4071 eval test_cmds=\"$module_cmds\"
4075 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4076 eval test_cmds=\"$archive_expsym_cmds\"
4077 cmds=$archive_expsym_cmds
4079 eval test_cmds=\"$archive_cmds\"
4084 if test "X$skipped_export" != "X:" &&
4085 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4086 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4089 # The command line is too long to link in one step, link piecewise.
4090 $echo "creating reloadable object files..."
4092 # Save the value of $output and $libobjs because we want to
4093 # use them later. If we have whole_archive_flag_spec, we
4094 # want to use save_libobjs as it was before
4095 # whole_archive_flag_spec was expanded, because we can't
4096 # assume the linker understands whole_archive_flag_spec.
4097 # This may have to be revisited, in case too many
4098 # convenience libraries get linked in and end up exceeding
4100 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4101 save_libobjs=$libobjs
4104 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4106 # Clear the reloadable object creation command queue and
4107 # initialize k to one.
4114 output=$output_objdir/$output_la-${k}.$objext
4115 # Loop over the list of objects to be linked.
4116 for obj in $save_libobjs
4118 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4119 if test "X$objlist" = X ||
4120 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4121 test "$len" -le "$max_cmd_len"; }; then
4122 objlist="$objlist $obj"
4124 # The command $test_cmds is almost too long, add a
4125 # command to the queue.
4126 if test "$k" -eq 1 ; then
4127 # The first file doesn't have a previous command to add.
4128 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4130 # All subsequent reloadable object files will link in
4131 # the last one created.
4132 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4134 last_robj=$output_objdir/$output_la-${k}.$objext
4136 output=$output_objdir/$output_la-${k}.$objext
4141 # Handle the remaining objects by creating one last
4142 # reloadable object file. All subsequent reloadable object
4143 # files will link in the last one created.
4144 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4145 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4147 if ${skipped_export-false}; then
4148 $show "generating symbol list for \`$libname.la'"
4149 export_symbols="$output_objdir/$libname.exp"
4150 $run $rm $export_symbols
4152 # Append the command to create the export file.
4153 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4156 # Set up a command to remove the reloadable object files
4157 # after they are used.
4159 while test "$i" -lt "$k"
4162 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"