1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun ltconfig.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
59 TIMESTAMP=" (1.641.2.256 2001/05/28 20:09:07 with GCC-local changes)"
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
73 NL2SP='tr \015\012 \040\040'
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 if test "$LTCONFIG_VERSION" != "$VERSION"; then
88 echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
93 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
94 echo "$modename: not configured to build any kind of library" 1>&2
95 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
108 lo2o="s/\\.lo\$/.${objext}/"
109 o2lo="s/\\.${objext}\$/.lo/"
111 # Parse our command line options once, thoroughly.
118 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
122 # If the previous option needs an argument, assign it.
123 if test -n "$prev"; then
126 execute_dlfiles="$execute_dlfiles $arg"
131 # Check whether tagname contains only valid characters
134 echo "$progname: invalid tag name: $tagname" 1>&2
141 # Don't test for the "default" C tag, as we know, it's there, but
142 # not specially marked.
145 if grep "^### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
146 taglist="$taglist $tagname"
147 # Evaluate the configuration.
148 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
150 echo "$progname: ignoring unknown tag $tagname" 1>&2
165 # Have we seen a non-optional argument yet?
172 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
177 sed -n -e '/^### BEGIN LIBTOOL CONFIG/,/^### END LIBTOOL CONFIG/p' < "$0"
178 # Now print the configurations for the tags.
179 for tagname in $taglist; do
180 sed -n -e "/^### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
186 echo "$progname: enabling shell trace mode"
196 if test "$build_libtool_libs" = yes; then
197 echo "enable shared libraries"
199 echo "disable shared libraries"
201 if test "$build_old_libs" = yes; then
202 echo "enable static libraries"
204 echo "disable static libraries"
209 --finish) mode="finish" ;;
211 --mode) prevopt="--mode" prev=mode ;;
212 --mode=*) mode="$optarg" ;;
218 --tag) prevopt="--tag" prev=tag ;;
220 set tag "$optarg" ${1+"$@"}
231 $echo "$modename: unrecognized option \`$arg'" 1>&2
243 if test -n "$prevopt"; then
244 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
249 # If this variable is set in any of the actions, the command in it
250 # will be execed at the end. This prevents here-documents from being
251 # left over by shells.
254 if test -z "$show_help"; then
256 # Infer the operation mode.
257 if test -z "$mode"; then
259 *cc | *++ | gcc* | *-gcc*)
271 *db | *dbx | *strace | *truss)
281 # If we have no mode, but dlfiles were specified, then do execute mode.
282 test -n "$execute_dlfiles" && mode=execute
284 # Just use the default operation mode.
285 if test -z "$mode"; then
286 if test -n "$nonopt"; then
287 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
289 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
296 # Only execute mode is allowed to have -dlopen flags.
297 if test -n "$execute_dlfiles" && test "$mode" != execute; then
298 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
303 # Change the help message to a mode-specific one.
305 help="Try \`$modename --help --mode=$mode' for more information."
307 # These modes are in order of execution frequency so that they run quickly.
309 # libtool compile mode
311 modename="$modename: compile"
312 # Get the compilation command and the source file.
325 # Aesthetically quote the previous argument.
327 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
330 # Double-quote args containing other shell metacharacters.
331 # Many Bourne shells cannot handle close brackets correctly
332 # in scan sets, so we specify it separately.
333 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
338 # Add the previous argument to base_compile.
339 if test -z "$base_compile"; then
340 base_compile="$lastarg"
342 base_compile="$base_compile $lastarg"
348 # Accept any command-line options.
351 if test "$user_target" != "no"; then
352 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
379 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
381 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
385 # Double-quote args containing other shell metacharacters.
386 # Many Bourne shells cannot handle close brackets correctly
387 # in scan sets, so we specify it separately.
389 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
393 lastarg="$lastarg $arg"
396 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
398 # Add the arguments to base_compile.
399 if test -z "$base_compile"; then
400 base_compile="$lastarg"
402 base_compile="$base_compile $lastarg"
410 # The next one is the -o target name
415 # We got the output file
422 # Accept the current argument as the source file.
426 # Aesthetically quote the previous argument.
428 # Backslashify any backslashes, double quotes, and dollar signs.
429 # These are the only characters that are still specially
430 # interpreted inside of double-quoted scrings.
431 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
433 # Double-quote args containing other shell metacharacters.
434 # Many Bourne shells cannot handle close brackets correctly
435 # in scan sets, so we specify it separately.
437 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
438 lastarg="\"$lastarg\""
442 # Add the previous argument to base_compile.
443 if test -z "$base_compile"; then
444 base_compile="$lastarg"
446 base_compile="$base_compile $lastarg"
454 # Get the name of the library object.
455 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
458 $echo "$modename: you must specify a target with \`-o'" 1>&2
463 # Recognize several different file suffixes.
464 # If the user specifies -o file.o, it is replaced with file.lo
473 *.class) xform=class ;;
478 *.java) xform=java ;;
481 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
484 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
486 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
491 # Infer tagged configuration to use if any are available and
492 # if one wasn't chosen via the "--tag" command line option.
493 # Only attempt this if the compiler in the base compile
494 # command doesn't match the default compiler.
495 if test -n "$available_tags" && test -z "$tagname"; then
496 case $base_compile in
498 # Blanks in the command may have been stripped by the calling shell,
499 # but not from the CC environment variable when ltconfig was run.
502 for z in $available_tags; do
503 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
504 # Evaluate the configuration.
505 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
506 case $base_compile in
508 # The compiler in the base compile command matches
509 # the one in the tagged configuration.
510 # Assume this is the tagged configuration we want.
521 # If $tagname still isn't set, then no tagged configuration
522 # was found and let the user know that the "--tag" command
523 # line option must be used.
524 if test -z "$tagname"; then
525 echo "$modename: unable to infer tagged configuration"
526 echo "$modename: specify a tag with \`--tag'" 1>&2
529 # echo "$modename: using $tagname tagged configuration"
535 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
536 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
537 if test "X$xdir" = "X$obj"; then
542 lobj=${xdir}$objdir/$objname
544 if test -z "$base_compile"; then
545 $echo "$modename: you must specify a compilation command" 1>&2
550 # Delete any leftover library objects.
551 if test "$build_old_libs" = yes; then
552 removelist="$obj $lobj $libobj ${libobj}T"
554 removelist="$lobj $libobj ${libobj}T"
558 trap "$run $rm $removelist; exit 1" 1 2 15
560 # On Cygwin there's no "real" PIC flag so we must build both object types
562 cygwin* | mingw* | pw32* | os2*)
566 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
567 # non-PIC code in shared libraries is not supported
571 # Calculate the filename of the output object if compiler does
572 # not support -o with -c
573 if test "$compiler_c_o" = no; then
574 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
575 lockfile="$output_obj.lock"
576 removelist="$removelist $output_obj $lockfile"
577 trap "$run $rm $removelist; exit 1" 1 2 15
584 # Lock this critical section if it is needed
585 # We use this script file to make the link, it avoids creating a new file
586 if test "$need_locks" = yes; then
587 until $run ln "$0" "$lockfile" 2>/dev/null; do
588 $show "Waiting for $lockfile to be removed"
591 elif test "$need_locks" = warn; then
592 if test -f "$lockfile"; then
594 *** ERROR, $lockfile exists and contains:
595 `cat $lockfile 2>/dev/null`
597 This indicates that another process is trying to use the same
598 temporary object file, and libtool could not work around it because
599 your compiler does not support \`-c' and \`-o' together. If you
600 repeat this compilation, it may succeed, by chance, but you had better
601 avoid parallel builds (make -j) in this platform, or get a better
607 echo $srcfile > "$lockfile"
610 if test -n "$fix_srcfile_path"; then
611 eval srcfile=\"$fix_srcfile_path\"
614 $run $rm "$libobj" "${libobj}T"
616 # Create a libtool object file (analogous to a ".la" file),
617 # but don't create it if we're doing a dry run.
618 test -z "$run" && cat > ${libobj}T <<EOF
619 # $libobj - a libtool object file
620 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
622 # Please DO NOT delete this file!
623 # It is necessary for linking the library.
625 # Name of the PIC object.
628 # Only build a PIC object if we are building libtool libraries.
629 if test "$build_libtool_libs" = yes; then
630 # Without this assignment, base_compile gets emptied.
631 fbsd_hideous_sh_bug=$base_compile
633 if test "$pic_mode" != no; then
634 command="$base_compile $srcfile $pic_flag"
636 # Don't build PIC code
637 command="$base_compile $srcfile"
640 if test ! -d ${xdir}$objdir; then
641 $show "$mkdir ${xdir}$objdir"
642 $run $mkdir ${xdir}$objdir
644 if test $status -ne 0 && test ! -d ${xdir}$objdir; then
649 if test -z "$output_obj"; then
650 # Place PIC objects in $objdir
651 command="$command -o $lobj"
654 $run $rm "$lobj" "$output_obj"
657 if $run eval "$command"; then :
659 test -n "$output_obj" && $run $rm $removelist
663 if test "$need_locks" = warn &&
664 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
666 *** ERROR, $lockfile contains:
667 `cat $lockfile 2>/dev/null`
669 but it should contain:
672 This indicates that another process is trying to use the same
673 temporary object file, and libtool could not work around it because
674 your compiler does not support \`-c' and \`-o' together. If you
675 repeat this compilation, it may succeed, by chance, but you had better
676 avoid parallel builds (make -j) in this platform, or get a better
683 # Just move the object if needed, then go on to compile the next one
684 if test -n "$output_obj" && test "x$output_obj" != "x$lobj"; then
685 $show "$mv $output_obj $lobj"
686 if $run $mv $output_obj $lobj; then :
694 # Append the name of the PIC object to the libtool object file.
695 test -z "$run" && cat >> ${libobj}T <<EOF
696 pic_object='$objdir/$objname'
700 # Allow error messages only from the first compilation.
701 suppress_output=' >/dev/null 2>&1'
703 # No PIC object so indicate it doesn't exist in the libtool
705 test -z "$run" && cat >> ${libobj}T <<EOF
711 # Only build a position-dependent object if we build old libraries.
712 if test "$build_old_libs" = yes; then
713 if test "$pic_mode" != yes; then
714 # Don't build PIC code
715 command="$base_compile $srcfile"
717 command="$base_compile $srcfile $pic_flag"
719 if test "$compiler_c_o" = yes; then
720 command="$command -o $obj"
723 # Suppress compiler output if we already did a PIC compilation.
724 command="$command$suppress_output"
725 $run $rm "$obj" "$output_obj"
727 if $run eval "$command"; then :
733 if test "$need_locks" = warn &&
734 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
736 *** ERROR, $lockfile contains:
737 `cat $lockfile 2>/dev/null`
739 but it should contain:
742 This indicates that another process is trying to use the same
743 temporary object file, and libtool could not work around it because
744 your compiler does not support \`-c' and \`-o' together. If you
745 repeat this compilation, it may succeed, by chance, but you had better
746 avoid parallel builds (make -j) in this platform, or get a better
753 # Just move the object if needed
754 if test -n "$output_obj" && test "x$output_obj" != "x$obj"; then
755 $show "$mv $output_obj $obj"
756 if $run $mv $output_obj $obj; then :
764 # Append the name of the non-PIC object the libtool object file.
765 # Only append if the libtool object file exists.
766 test -z "$run" && cat >> ${libobj}T <<EOF
767 # Name of the non-PIC object.
768 non_pic_object='$objname'
772 # Append the name of the non-PIC object the libtool object file.
773 # Only append if the libtool object file exists.
774 test -z "$run" && cat >> ${libobj}T <<EOF
775 # Name of the non-PIC object.
781 $run $mv "${libobj}T" "${libobj}"
783 # Unlock the critical section if it was locked
784 if test "$need_locks" != no; then
793 modename="$modename: link"
795 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
796 # It is impossible to link a dll without this setting, and
797 # we shouldn't force the makefile maintainer to figure out
798 # which system we are compiling for in order to pass an extra
799 # flag for every libtool invokation.
802 # FIXME: Unfortunately, there are problems with the above when trying
803 # to make a dll which has undefined symbols, in which case not
804 # even a static library is built. For now, we need to specify
805 # -no-undefined on the libtool link line when we can be certain
806 # that all symbols are satisfied, otherwise we get a static library.
813 libtool_args="$nonopt"
814 base_compile="$nonopt"
815 compile_command="$nonopt"
816 finalize_command="$nonopt"
829 lib_search_path=`pwd`
837 export_symbols_regex=
845 prefer_static_libs=no
857 # We need to know -static, to get the right output filenames.
861 -all-static | -static)
862 if test "X$arg" = "X-all-static"; then
863 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
864 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
866 if test -n "$link_static_flag"; then
867 dlopen_self=$dlopen_self_static
870 if test -z "$pic_flag" && test -n "$link_static_flag"; then
871 dlopen_self=$dlopen_self_static
874 build_libtool_libs=no
876 prefer_static_libs=yes
882 # See if our shared archives depend on static archives.
883 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
885 # Go through the arguments, transforming them on the way.
886 while test $# -gt 0; do
888 base_compile="$base_compile $arg"
891 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
892 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
896 libtool_args="$libtool_args $qarg"
898 # If the previous option needs an argument, assign it.
899 if test -n "$prev"; then
902 compile_command="$compile_command @OUTPUT@"
903 finalize_command="$finalize_command @OUTPUT@"
909 if test "$preload" = no; then
910 # Add the symbol object into the linking commands.
911 compile_command="$compile_command @SYMFILE@"
912 finalize_command="$finalize_command @SYMFILE@"
916 *.la | *.lo) ;; # We handle these cases below.
918 if test "$dlself" = no; then
926 if test "$prev" = dlprefiles; then
928 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
938 if test "$prev" = dlfiles; then
939 dlfiles="$dlfiles $arg"
941 dlprefiles="$dlprefiles $arg"
949 export_symbols="$arg"
950 if test ! -f "$arg"; then
951 $echo "$modename: symbol file \`$arg' does not exist"
958 export_symbols_regex="$arg"
968 if test -f "$arg"; then
971 for fil in `cat $save_arg`
973 # moreargs="$moreargs $fil"
975 # A libtool-controlled object.
977 # Check to see that this really is a libtool object.
978 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
983 # If there is no directory component, then add one.
985 */* | *\\*) . $arg ;;
989 if test -z "$pic_object" || \
990 test -z "$non_pic_object" ||
991 test "$pic_object" = none && \
992 test "$non_pic_object" = none; then
993 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
997 # Extract subdirectory from the argument.
998 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
999 if test "X$xdir" = "X$arg"; then
1005 if test "$pic_object" != none; then
1006 # Prepend the subdirectory the object is found in.
1007 pic_object="$xdir$pic_object"
1009 if test "$prev" = dlfiles; then
1010 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1011 dlfiles="$dlfiles $pic_object"
1015 # If libtool objects are unsupported, then we need to preload.
1020 # CHECK ME: I think I busted this. -Ossama
1021 if test "$prev" = dlprefiles; then
1022 # Preload the old-style object.
1023 dlprefiles="$dlprefiles $pic_object"
1028 libobjs="$libobjs $pic_object"
1033 if test "$non_pic_object" != none; then
1034 # Prepend the subdirectory the object is found in.
1035 non_pic_object="$xdir$non_pic_object"
1037 # A standard non-PIC object
1038 non_pic_objects="$non_pic_objects $non_pic_object"
1039 if test -z "$pic_object" || test "$pic_object" = none ; then
1040 arg="$non_pic_object"
1044 # Only an error if not doing a dry-run.
1045 if test -z "$run"; then
1046 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1051 # Extract subdirectory from the argument.
1052 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1053 if test "X$xdir" = "X$arg"; then
1059 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1060 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1061 libobjs="$libobjs $pic_object"
1062 non_pic_objects="$non_pic_objects $non_pic_object"
1067 $echo "$modename: link input file \`$save_arg' does not exist"
1075 # We need an absolute path.
1077 [\\/]* | [A-Za-z]:[\\/]*) ;;
1079 $echo "$modename: only absolute run-paths are allowed" 1>&2
1083 if test "$prev" = rpath; then
1086 *) rpath="$rpath $arg" ;;
1091 *) xrpath="$xrpath $arg" ;;
1098 compiler_flags="$compiler_flags $qarg"
1100 compile_command="$compile_command $qarg"
1101 finalize_command="$finalize_command $qarg"
1105 linker_flags="$linker_flags $qarg"
1106 compiler_flags="$compiler_flags $wl$qarg"
1108 compile_command="$compile_command $wl$qarg"
1109 finalize_command="$finalize_command $wl$qarg"
1113 eval "$prev=\"\$arg\""
1124 if test -n "$link_static_flag"; then
1125 compile_command="$compile_command $link_static_flag"
1126 finalize_command="$finalize_command $link_static_flag"
1132 # FIXME: remove this flag sometime in the future.
1133 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1157 -export-symbols | -export-symbols-regex)
1158 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1159 $echo "$modename: more than one -exported-symbols argument is not allowed"
1162 if test "X$arg" = "X-export-symbols"; then
1170 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1171 # so, if we see these flags be careful not to treat them like -L
1173 case $with_gcc/$host in
1175 compile_command="$compile_command $arg"
1176 finalize_command="$finalize_command $arg"
1183 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1184 # We need an absolute path.
1186 [\\/]* | [A-Za-z]:[\\/]*) ;;
1188 absdir=`cd "$dir" && pwd`
1189 if test -z "$absdir"; then
1190 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1199 deplibs="$deplibs -L$dir"
1200 lib_search_path="$lib_search_path $dir"
1204 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1205 case :$dllsearchpath: in
1207 *) dllsearchpath="$dllsearchpath:$dir";;
1215 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1217 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1218 # These systems don't actually have a C or math library (as such)
1221 *-*-mingw* | *-*-os2*)
1222 # These systems don't actually have a C library (as such)
1223 test "X$arg" = "X-lc" && continue
1227 deplibs="$deplibs $arg"
1243 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1244 # The PATH hackery in wrapper scripts is required on Windows
1245 # in order for the loader to find any dlls it needs.
1246 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1247 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1250 *) no_install=yes ;;
1283 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1284 # We need an absolute path.
1286 [\\/]* | [A-Za-z]:[\\/]*) ;;
1288 $echo "$modename: only absolute run-paths are allowed" 1>&2
1294 *) xrpath="$xrpath $dir" ;;
1300 # The effects of -static are defined in a previous loop.
1301 # We used to do the same as -all-static on platforms that
1302 # didn't have a PIC flag, but the assumption that the effects
1303 # would be equivalent was wrong. It would break on at least
1304 # Digital Unix and AIX.
1319 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1321 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1322 for flag in $args; do
1325 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1330 compiler_flags="$compiler_flags $flag"
1333 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1337 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1339 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1340 for flag in $args; do
1343 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1348 compiler_flags="$compiler_flags $wl$flag"
1349 linker_flags="$linker_flags $flag"
1352 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1365 # Some other compiler flag.
1367 # Unknown arguments in both finalize_command and compile_command need
1368 # to be aesthetically quoted because they are evaled later.
1369 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1371 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1378 # A standard object.
1383 # A libtool-controlled object.
1385 # Check to see that this really is a libtool object.
1386 if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1391 # If there is no directory component, then add one.
1393 */* | *\\*) . $arg ;;
1397 if test -z "$pic_object" || \
1398 test -z "$non_pic_object" ||
1399 test "$pic_object" = none && \
1400 test "$non_pic_object" = none; then
1401 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1405 # Extract subdirectory from the argument.
1406 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1407 if test "X$xdir" = "X$arg"; then
1413 if test "$pic_object" != none; then
1414 # Prepend the subdirectory the object is found in.
1415 pic_object="$xdir$pic_object"
1417 if test "$prev" = dlfiles; then
1418 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1419 dlfiles="$dlfiles $pic_object"
1423 # If libtool objects are unsupported, then we need to preload.
1428 # CHECK ME: I think I busted this. -Ossama
1429 if test "$prev" = dlprefiles; then
1430 # Preload the old-style object.
1431 dlprefiles="$dlprefiles $pic_object"
1436 libobjs="$libobjs $pic_object"
1441 if test "$non_pic_object" != none; then
1442 # Prepend the subdirectory the object is found in.
1443 non_pic_object="$xdir$non_pic_object"
1445 # A standard non-PIC object
1446 non_pic_objects="$non_pic_objects $non_pic_object"
1447 if test -z "$pic_object" || test "$pic_object" = none ; then
1448 arg="$non_pic_object"
1452 # Only an error if not doing a dry-run.
1453 if test -z "$run"; then
1454 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1459 # Extract subdirectory from the argument.
1460 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1461 if test "X$xdir" = "X$arg"; then
1467 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1468 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1469 libobjs="$libobjs $pic_object"
1470 non_pic_objects="$non_pic_objects $non_pic_object"
1477 deplibs="$deplibs $arg"
1478 old_deplibs="$old_deplibs $arg"
1483 # A libtool-controlled library.
1485 if test "$prev" = dlfiles; then
1486 # This library was specified with -dlopen.
1487 dlfiles="$dlfiles $arg"
1489 elif test "$prev" = dlprefiles; then
1490 # The library was specified with -dlpreopen.
1491 dlprefiles="$dlprefiles $arg"
1494 deplibs="$deplibs $arg"
1499 # Some other compiler argument.
1501 # Unknown arguments in both finalize_command and compile_command need
1502 # to be aesthetically quoted because they are evaled later.
1503 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1505 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1512 # Now actually substitute the argument into the commands.
1513 if test -n "$arg"; then
1514 compile_command="$compile_command $arg"
1515 finalize_command="$finalize_command $arg"
1517 done # argument parsing loop
1519 if test -n "$prev"; then
1520 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1525 # Infer tagged configuration to use if any are available and
1526 # if one wasn't chosen via the "--tag" command line option.
1527 # Only attempt this if the compiler in the base link
1528 # command doesn't match the default compiler.
1529 if test -n "$available_tags" && test -z "$tagname"; then
1530 case $base_compile in
1532 # Blanks in the command may have been stripped by the calling shell,
1533 # but not from the CC environment variable when ltconfig was run.
1536 for z in $available_tags; do
1537 if grep "^### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1538 # Evaluate the configuration.
1539 eval "`sed -n -e '/^### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1540 case $base_compile in
1542 # The compiler in $compile_command matches
1543 # the one in the tagged configuration.
1544 # Assume this is the tagged configuration we want.
1555 # If $tagname still isn't set, then no tagged configuration
1556 # was found and let the user know that the "--tag" command
1557 # line option must be used.
1558 if test -z "$tagname"; then
1559 echo "$modename: unable to infer tagged configuration"
1560 echo "$modename: specify a tag with \`--tag'" 1>&2
1563 # echo "$modename: using $tagname tagged configuration"
1569 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1570 eval arg=\"$export_dynamic_flag_spec\"
1571 compile_command="$compile_command $arg"
1572 finalize_command="$finalize_command $arg"
1575 # calculate the name of the file, without its directory
1576 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1577 libobjs_save="$libobjs"
1579 if test -n "$shlibpath_var"; then
1580 # get the directories listed in $shlibpath_var
1581 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1585 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1586 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1588 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1589 if test "X$output_objdir" = "X$output"; then
1590 output_objdir="$objdir"
1592 output_objdir="$output_objdir/$objdir"
1594 # Create the object directory.
1595 if test ! -d $output_objdir; then
1596 $show "$mkdir $output_objdir"
1597 $run $mkdir $output_objdir
1599 if test $status -ne 0 && test ! -d $output_objdir; then
1604 # Determine the type of output
1607 $echo "$modename: you must specify an output file" 1>&2
1611 *.$libext) linkmode=oldlib ;;
1612 *.lo | *.$objext) linkmode=obj ;;
1613 *.la) linkmode=lib ;;
1614 *) linkmode=prog ;; # Anything else should be a program.
1619 # Find all interdependent deplibs by searching for libraries
1620 # that are linked more than once (e.g. -la -lb -la)
1621 for deplib in $deplibs; do
1623 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1625 libs="$libs $deplib"
1628 if test $linkmode = lib; then
1629 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1631 # Compute libraries that are listed more than once in $predeps
1632 # $postdeps and mark them as special (i.e., whose duplicates are
1633 # not to be eliminated).
1635 for pre_post_dep in $predeps $postdeps; do
1636 case "$pre_post_deps " in
1637 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1639 pre_post_deps="$pre_post_deps $pre_post_dep"
1647 need_relink=no # whether we're linking any uninstalled libtool libraries
1648 notinst_deplibs= # not-installed libtool libraries
1649 notinst_path= # paths that contain not-installed libtool libraries
1653 for file in $dlfiles $dlprefiles; do
1657 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1669 passes="conv scan dlopen dlpreopen link"
1674 for pass in $passes; do
1675 if test $linkmode = prog; then
1676 # Determine which files to process
1680 save_deplibs="$deplibs" # Collect dlpreopened libraries
1683 dlpreopen) libs="$dlprefiles" ;;
1684 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1687 for deplib in $libs; do
1692 if test $linkmode = oldlib && test $linkmode = obj; then
1693 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1696 if test $pass = conv; then
1697 deplibs="$deplib $deplibs"
1700 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1701 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1702 # Search the libtool library
1703 lib="$searchdir/lib${name}.la"
1704 if test -f "$lib"; then
1709 if test "$found" != yes; then
1710 # deplib doesn't seem to be a libtool library
1711 if test "$linkmode,$pass" = "prog,link"; then
1712 compile_deplibs="$deplib $compile_deplibs"
1713 finalize_deplibs="$deplib $finalize_deplibs"
1715 deplibs="$deplib $deplibs"
1716 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1724 deplibs="$deplib $deplibs"
1725 test $pass = conv && continue
1726 newdependency_libs="$deplib $newdependency_libs"
1727 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1730 if test $pass = conv; then
1731 deplibs="$deplib $deplibs"
1734 if test $pass = scan; then
1735 deplibs="$deplib $deplibs"
1736 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1738 compile_deplibs="$deplib $compile_deplibs"
1739 finalize_deplibs="$deplib $finalize_deplibs"
1743 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1749 if test $pass = link; then
1750 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1751 # Make sure the xrpath contains only unique directories.
1754 *) xrpath="$xrpath $dir" ;;
1757 deplibs="$deplib $deplibs"
1760 *.la) lib="$deplib" ;;
1762 if test $pass = conv; then
1763 deplibs="$deplib $deplibs"
1768 if test "$deplibs_check_method" != pass_all; then
1770 echo "*** Warning: This library needs some functionality provided by $deplib."
1771 echo "*** I have the capability to make that library automatically link in when"
1772 echo "*** you link to this library. But I can only do this if you have a"
1773 echo "*** shared version of the library, which you do not appear to have."
1776 echo "*** Warning: Linking the shared library $output against the"
1777 echo "*** static library $deplib is not portable!"
1778 deplibs="$deplib $deplibs"
1783 if test $pass != link; then
1784 deplibs="$deplib $deplibs"
1786 compile_deplibs="$deplib $compile_deplibs"
1787 finalize_deplibs="$deplib $finalize_deplibs"
1794 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1795 # If there is no dlopen support or we're linking statically,
1796 # we need to preload.
1797 newdlprefiles="$newdlprefiles $deplib"
1798 compile_deplibs="$deplib $compile_deplibs"
1799 finalize_deplibs="$deplib $finalize_deplibs"
1801 newdlfiles="$newdlfiles $deplib"
1810 if test $found = yes || test -f "$lib"; then :
1812 $echo "$modename: cannot find the library \`$lib'" 1>&2
1816 # Check to see that this really is a libtool archive.
1817 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1819 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1823 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1824 test "X$ladir" = "X$lib" && ladir="."
1832 # If the library was installed with an old release of libtool,
1833 # it will not redefine variable installed.
1838 */* | *\\*) . $lib ;;
1842 if test "$linkmode,$pass" = "lib,link" ||
1843 test "$linkmode,$pass" = "prog,scan" ||
1844 { test $linkmode = oldlib && test $linkmode = obj; }; then
1845 # Add dl[pre]opened files of deplib
1846 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1847 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1850 if test $pass = conv; then
1851 # Only check for convenience libraries
1852 deplibs="$lib $deplibs"
1853 if test -z "$libdir"; then
1854 if test -z "$old_library"; then
1855 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1858 # It is a libtool convenience library, so add in its objects.
1859 convenience="$convenience $ladir/$objdir/$old_library"
1860 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1862 for deplib in $dependency_libs; do
1863 deplibs="$deplib $deplibs"
1864 case "$tmp_libs " in
1865 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1867 tmp_libs="$tmp_libs $deplib"
1869 elif test $linkmode != prog && test $linkmode != lib; then
1870 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1876 # Get the name of the library we link against.
1878 for l in $old_library $library_names; do
1881 if test -z "$linklib"; then
1882 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1886 # This library was specified with -dlopen.
1887 if test $pass = dlopen; then
1888 if test -z "$libdir"; then
1889 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1892 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1893 # If there is no dlname, no dlopen support or we're linking
1894 # statically, we need to preload.
1895 dlprefiles="$dlprefiles $lib"
1897 newdlfiles="$newdlfiles $lib"
1902 # We need an absolute path.
1904 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1906 abs_ladir=`cd "$ladir" && pwd`
1907 if test -z "$abs_ladir"; then
1908 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1909 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1914 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1916 # Find the relevant object directory and library name.
1917 if test "X$installed" = Xyes; then
1918 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1919 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1928 dir="$ladir/$objdir"
1929 absdir="$abs_ladir/$objdir"
1930 # Remove this search path later
1931 notinst_path="$notinst_path $abs_ladir"
1932 fi # $installed = yes
1933 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1935 # This library was specified with -dlpreopen.
1936 if test $pass = dlpreopen; then
1937 if test -z "$libdir"; then
1938 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1941 # Prefer using a static library (so that no silly _DYNAMIC symbols
1942 # are required to link).
1943 if test -n "$old_library"; then
1944 newdlprefiles="$newdlprefiles $dir/$old_library"
1945 # Otherwise, use the dlname, so that lt_dlopen finds it.
1946 elif test -n "$dlname"; then
1947 newdlprefiles="$newdlprefiles $dir/$dlname"
1949 newdlprefiles="$newdlprefiles $dir/$linklib"
1951 fi # $pass = dlpreopen
1953 if test -z "$libdir"; then
1954 # Link the convenience library
1955 if test $linkmode = lib; then
1956 deplibs="$dir/$old_library $deplibs"
1957 elif test "$linkmode,$pass" = "prog,link"; then
1958 compile_deplibs="$dir/$old_library $compile_deplibs"
1959 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1961 deplibs="$lib $deplibs"
1966 if test $linkmode = prog && test $pass != link; then
1967 newlib_search_path="$newlib_search_path $ladir"
1968 deplibs="$lib $deplibs"
1971 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1972 test "$build_libtool_libs" = no; then
1977 for deplib in $dependency_libs; do
1979 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1981 # Need to link against all dependency_libs?
1982 if test $linkalldeplibs = yes; then
1983 deplibs="$deplib $deplibs"
1985 # Need to hardcode shared library paths
1986 # or/and link against static libraries
1987 newdependency_libs="$deplib $newdependency_libs"
1989 case "$tmp_libs " in
1990 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1992 tmp_libs="$tmp_libs $deplib"
1995 fi # $linkmode = prog...
1997 link_static=no # Whether the deplib will be linked statically
1998 if test -n "$library_names" &&
1999 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2000 # Link against this shared library
2002 if test "$linkmode,$pass" = "prog,link" ||
2003 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2004 # Hardcode the library path.
2005 # Skip directories that are in the system default run-time
2007 case " $sys_lib_dlsearch_path " in
2010 case "$compile_rpath " in
2012 *) compile_rpath="$compile_rpath $absdir"
2016 case " $sys_lib_dlsearch_path " in
2019 case "$finalize_rpath " in
2021 *) finalize_rpath="$finalize_rpath $libdir"
2025 if test $linkmode = prog; then
2026 # We need to hardcode the library path
2027 if test -n "$shlibpath_var"; then
2028 # Make sure the rpath contains only unique directories.
2029 case "$temp_rpath " in
2032 *) temp_rpath="$temp_rpath $dir" ;;
2036 fi # $linkmode,$pass = prog,link...
2038 if test "$alldeplibs" = yes &&
2039 { test "$deplibs_check_method" = pass_all ||
2040 { test "$build_libtool_libs" = yes &&
2041 test -n "$library_names"; }; }; then
2042 # We only need to search for static libraries
2046 if test "$installed" = no; then
2047 notinst_deplibs="$notinst_deplibs $lib"
2051 if test -n "$old_archive_from_expsyms_cmds"; then
2052 # figure out the soname
2053 set dummy $library_names
2056 libname=`eval \\$echo \"$libname_spec\"`
2057 # use dlname if we got it. it's perfectly good, no?
2058 if test -n "$dlname"; then
2060 elif test -n "$soname_spec"; then
2064 major=`expr $current - $age`
2068 eval soname=\"$soname_spec\"
2073 # Make a new name for the extract_expsyms_cmds to use
2075 soname=`echo $soroot | sed -e 's/^.*\///'`
2076 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2078 # If the library has no export list, then create one now
2079 if test -f "$output_objdir/$soname-def"; then :
2081 $show "extracting exported symbol list from \`$soname'"
2082 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2083 eval cmds=\"$extract_expsyms_cmds\"
2084 for cmd in $cmds; do
2087 $run eval "$cmd" || exit $?
2093 if test -f "$output_objdir/$newlib"; then :; else
2094 $show "generating import library for \`$soname'"
2095 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2096 eval cmds=\"$old_archive_from_expsyms_cmds\"
2097 for cmd in $cmds; do
2100 $run eval "$cmd" || exit $?
2104 # make sure the library variables are pointing to the new library
2107 fi # test -n $old_archive_from_expsyms_cmds
2109 if test $linkmode = prog || test "$mode" != relink; then
2114 case $hardcode_action in
2115 immediate | unsupported)
2116 if test "$hardcode_direct" = no; then
2118 elif test "$hardcode_minus_L" = no; then
2120 *-*-sunos*) add_shlibpath="$dir" ;;
2124 elif test "$hardcode_shlibpath_var" = no; then
2125 add_shlibpath="$dir"
2132 if test "$hardcode_direct" = yes; then
2134 elif test "$hardcode_minus_L" = yes; then
2137 elif test "$hardcode_shlibpath_var" = yes; then
2138 add_shlibpath="$dir"
2147 if test "$lib_linked" != yes; then
2148 $echo "$modename: configuration error: unsupported hardcode properties"
2152 if test -n "$add_shlibpath"; then
2153 case :$compile_shlibpath: in
2154 *":$add_shlibpath:"*) ;;
2155 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2158 if test $linkmode = prog; then
2159 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2160 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2162 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2163 test -n "$add" && deplibs="$add $deplibs"
2164 if test "$hardcode_direct" != yes && \
2165 test "$hardcode_minus_L" != yes && \
2166 test "$hardcode_shlibpath_var" = yes; then
2167 case :$finalize_shlibpath: in
2169 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2175 if test $linkmode = prog || test "$mode" = relink; then
2179 # Finalize command for both is simple: just hardcode it.
2180 if test "$hardcode_direct" = yes; then
2181 add="$libdir/$linklib"
2182 elif test "$hardcode_minus_L" = yes; then
2185 elif test "$hardcode_shlibpath_var" = yes; then
2186 case :$finalize_shlibpath: in
2188 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2192 # We cannot seem to hardcode it, guess we'll fake it.
2197 if test $linkmode = prog; then
2198 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2199 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2201 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2202 test -n "$add" && deplibs="$add $deplibs"
2205 elif test $linkmode = prog; then
2206 if test "$alldeplibs" = yes &&
2207 { test "$deplibs_check_method" = pass_all ||
2208 { test "$build_libtool_libs" = yes &&
2209 test -n "$library_names"; }; }; then
2210 # We only need to search for static libraries
2214 # Try to link the static library
2215 # Here we assume that one of hardcode_direct or hardcode_minus_L
2216 # is not unsupported. This is valid on all known static and
2218 if test "$hardcode_direct" != unsupported; then
2219 test -n "$old_library" && linklib="$old_library"
2220 compile_deplibs="$dir/$linklib $compile_deplibs"
2221 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2223 compile_deplibs="-l$name -L$dir $compile_deplibs"
2224 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2226 elif test "$build_libtool_libs" = yes; then
2227 # Not a shared library
2228 if test "$deplibs_check_method" != pass_all; then
2229 # We're trying link a shared library against a static one
2230 # but the system doesn't support it.
2232 # Just print a warning and add the library to dependency_libs so
2233 # that the program can be linked against the static library.
2235 echo "*** Warning: This library needs some functionality provided by $lib."
2236 echo "*** I have the capability to make that library automatically link in when"
2237 echo "*** you link to this library. But I can only do this if you have a"
2238 echo "*** shared version of the library, which you do not appear to have."
2239 if test "$module" = yes; then
2240 echo "*** Therefore, libtool will create a static module, that should work "
2241 echo "*** as long as the dlopening application is linked with the -dlopen flag."
2242 if test -z "$global_symbol_pipe"; then
2244 echo "*** However, this would only work if libtool was able to extract symbol"
2245 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2246 echo "*** not find such a program. So, this module is probably useless."
2247 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2249 if test "$build_old_libs" = no; then
2250 build_libtool_libs=module
2253 build_libtool_libs=no
2257 convenience="$convenience $dir/$old_library"
2258 old_convenience="$old_convenience $dir/$old_library"
2259 deplibs="$dir/$old_library $deplibs"
2262 fi # link shared/static library?
2264 if test $linkmode = lib; then
2265 if test -n "$dependency_libs" &&
2266 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2267 test $link_static = yes; }; then
2268 # Extract -R from dependency_libs
2270 for libdir in $dependency_libs; do
2272 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2274 *" $temp_xrpath "*) ;;
2275 *) xrpath="$xrpath $temp_xrpath";;
2277 *) temp_deplibs="$temp_deplibs $libdir";;
2280 dependency_libs="$temp_deplibs"
2283 newlib_search_path="$newlib_search_path $absdir"
2284 # Link against this library
2285 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2286 # ... and its dependency_libs
2288 for deplib in $dependency_libs; do
2289 newdependency_libs="$deplib $newdependency_libs"
2290 case "$tmp_libs " in
2291 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2293 tmp_libs="$tmp_libs $deplib"
2296 if test $link_all_deplibs != no; then
2297 # Add the search paths of all dependency libraries
2298 for deplib in $dependency_libs; do
2300 -L*) path="$deplib" ;;
2302 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2303 test "X$dir" = "X$deplib" && dir="."
2304 # We need an absolute path.
2306 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2308 absdir=`cd "$dir" && pwd`
2309 if test -z "$absdir"; then
2310 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2315 if grep "^installed=no" $deplib > /dev/null; then
2316 path="-L$absdir/$objdir"
2318 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2319 if test -z "$libdir"; then
2320 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2323 if test "$absdir" != "$libdir"; then
2324 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2331 case " $deplibs " in
2333 *) deplibs="$path $deplibs" ;;
2336 fi # link_all_deplibs != no
2338 done # for deplib in $libs
2339 if test $pass = dlpreopen; then
2340 # Link the dlpreopened libraries before other libraries
2341 for deplib in $save_deplibs; do
2342 deplibs="$deplib $deplibs"
2345 if test $pass != dlopen; then
2346 test $pass != scan && dependency_libs="$newdependency_libs"
2347 if test $pass != conv; then
2348 # Make sure lib_search_path contains only unique directories.
2350 for dir in $newlib_search_path; do
2351 case "$lib_search_path " in
2353 *) lib_search_path="$lib_search_path $dir" ;;
2359 if test "$linkmode,$pass" != "prog,link"; then
2362 vars="compile_deplibs finalize_deplibs"
2364 for var in $vars dependency_libs; do
2365 # Add libraries to $var in reverse order
2366 eval tmp_libs=\"\$$var\"
2368 for deplib in $tmp_libs; do
2370 -L*) new_libs="$deplib $new_libs" ;;
2372 case " $specialdeplibs " in
2373 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2375 case " $new_libs " in
2377 *) new_libs="$deplib $new_libs" ;;
2385 for deplib in $new_libs; do
2388 case " $tmp_libs " in
2390 *) tmp_libs="$tmp_libs $deplib" ;;
2393 *) tmp_libs="$tmp_libs $deplib" ;;
2396 eval $var=\"$tmp_libs\"
2399 if test "$pass" = "conv" &&
2400 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2401 libs="$deplibs" # reset libs
2405 if test $linkmode = prog; then
2406 dlfiles="$newdlfiles"
2407 dlprefiles="$newdlprefiles"
2412 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2413 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2416 if test -n "$rpath"; then
2417 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2420 if test -n "$xrpath"; then
2421 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2424 if test -n "$vinfo"; then
2425 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2428 if test -n "$release"; then
2429 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2432 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2433 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2436 # Now set the variables for building old libraries.
2437 build_libtool_libs=no
2439 objs="$objs$old_deplibs"
2443 # Make sure we only generate libraries of the form `libNAME.la'.
2446 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2447 eval libname=\"$libname_spec\"
2450 if test "$module" = no; then
2451 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2455 if test "$need_lib_prefix" != no; then
2456 # Add the "lib" prefix for modules if required
2457 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2458 eval libname=\"$libname_spec\"
2460 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2465 if test -n "$objs"; then
2466 if test "$deplibs_check_method" != pass_all; then
2467 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2471 echo "*** Warning: Linking the shared library $output against the non-libtool"
2472 echo "*** objects $objs is not portable!"
2473 libobjs="$libobjs $objs"
2477 if test "$dlself" != no; then
2478 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2482 if test $# -gt 2; then
2483 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2488 if test -z "$rpath"; then
2489 if test "$build_libtool_libs" = yes; then
2490 # Building a libtool convenience library.
2491 # Some compilers have problems with a `.al' extension so
2492 # convenience libraries should have the same extension an
2493 # archive normally would.
2494 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2495 build_libtool_libs=convenience
2499 if test -n "$vinfo"; then
2500 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2503 if test -n "$release"; then
2504 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2508 # Parse the version information argument.
2509 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2510 set dummy $vinfo 0 0 0
2513 if test -n "$8"; then
2514 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2523 # Check that each of the things are valid numbers.
2525 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2527 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2528 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2534 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2536 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2537 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2543 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2545 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2546 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2551 if test $age -gt $current; then
2552 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2553 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2557 # Calculate the version variables.
2561 case $version_type in
2565 # Like Linux, but with the current version available in
2566 # verstring for coding it into the library header
2567 major=.`expr $current - $age`
2568 versuffix="$major.$age.$revision"
2569 # Darwin ld doesn't like 0 for these options...
2570 minor_current=`expr $current + 1`
2571 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2576 versuffix=".$current.$revision";
2581 versuffix=".$current";
2585 major=`expr $current - $age + 1`
2586 verstring="sgi$major.$revision"
2588 # Add in all the interfaces that we are compatible with.
2590 while test $loop != 0; do
2591 iface=`expr $revision - $loop`
2592 loop=`expr $loop - 1`
2593 verstring="sgi$major.$iface:$verstring"
2596 # Before this point, $major must not contain `.'.
2598 versuffix="$major.$revision"
2602 major=.`expr $current - $age`
2603 versuffix="$major.$age.$revision"
2607 major=`expr $current - $age`
2608 versuffix=".$current.$age.$revision"
2609 verstring="$current.$age.$revision"
2611 # Add in all the interfaces that we are compatible with.
2613 while test $loop != 0; do
2614 iface=`expr $current - $loop`
2615 loop=`expr $loop - 1`
2616 verstring="$verstring:${iface}.0"
2619 # Make executables depend on our current version.
2620 verstring="$verstring:${current}.0"
2625 versuffix=".$current.$revision"
2629 # Use '-' rather than '.', since we only want one
2630 # extension on DOS 8.3 filesystems.
2631 major=`expr $current - $age`
2636 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2637 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2642 # Clear the version info if we defaulted, and they specified a release.
2643 if test -z "$vinfo" && test -n "$release"; then
2646 if test "$need_version" = no; then
2653 # Remove version info from name if versioning should be avoided
2654 if test "$avoid_version" = yes && test "$need_version" = no; then
2660 # Check to see if the archive will have undefined symbols.
2661 if test "$allow_undefined" = yes; then
2662 if test "$allow_undefined_flag" = unsupported; then
2663 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2664 build_libtool_libs=no
2668 # Don't allow undefined symbols.
2669 allow_undefined_flag="$no_undefined_flag"
2673 if test "$mode" != relink; then
2674 # Remove our outputs, but don't remove object files since they
2675 # may have been created when compiling PIC objects.
2677 tempremovelist=`echo "$output_objdir/*"`
2678 for p in $tempremovelist; do
2682 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2683 removelist="$removelist $p"
2688 if test -n "$removelist"; then
2689 $show "${rm}r $removelist"
2690 $run ${rm}r $removelist
2694 # Now set the variables for building old libraries.
2695 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2696 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2698 # Transform .lo files to .o files.
2699 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2702 # Eliminate all temporary directories.
2703 for path in $notinst_path; do
2704 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2705 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2706 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2709 if test -n "$xrpath"; then
2710 # If the user specified any rpath flags, then add them.
2712 for libdir in $xrpath; do
2713 temp_xrpath="$temp_xrpath -R$libdir"
2714 case "$finalize_rpath " in
2716 *) finalize_rpath="$finalize_rpath $libdir" ;;
2719 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2720 dependency_libs="$temp_xrpath $dependency_libs"
2724 # Make sure dlfiles contains only unique files that won't be dlpreopened
2725 old_dlfiles="$dlfiles"
2727 for lib in $old_dlfiles; do
2728 case " $dlprefiles $dlfiles " in
2730 *) dlfiles="$dlfiles $lib" ;;
2734 # Make sure dlprefiles contains only unique files
2735 old_dlprefiles="$dlprefiles"
2737 for lib in $old_dlprefiles; do
2738 case "$dlprefiles " in
2740 *) dlprefiles="$dlprefiles $lib" ;;
2744 if test "$build_libtool_libs" = yes; then
2745 if test -n "$rpath"; then
2747 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2748 # these systems don't actually have a c library (as such)!
2750 *-*-rhapsody* | *-*-darwin1.[012])
2751 # Rhapsody C library is in the System framework
2752 deplibs="$deplibs -framework System"
2755 # Don't link with libc until the a.out ld.so is fixed.
2758 # Add libc to deplibs on all other systems if necessary.
2759 if test $build_libtool_need_lc = "yes"; then
2760 deplibs="$deplibs -lc"
2766 # Transform deplibs into only deplibs that can be linked in shared.
2768 libname_save=$libname
2769 release_save=$release
2770 versuffix_save=$versuffix
2772 # I'm not sure if I'm treating the release correctly. I think
2773 # release should show up in the -l (ie -lgmp5) so we don't want to
2774 # add it in twice. Is that correct?
2780 case $deplibs_check_method in
2782 # Don't check for shared/static. Everything works.
2783 # This might be a little naive. We might want to check
2784 # whether the library exists or not. But this is on
2785 # osf3 & osf4 and I'm not really sure... Just
2786 # implementing what was already the behaviour.
2790 # This code stresses the "libraries are programs" paradigm to its
2791 # limits. Maybe even breaks it. We compile a program, linking it
2792 # against the deplibs as a proxy for the library. Then we can check
2793 # whether they linked in statically or dynamically with ldd.
2795 cat > conftest.c <<EOF
2796 int main() { return 0; }
2799 $LTCC -o conftest conftest.c $deplibs
2800 if test $? -eq 0 ; then
2801 ldd_output=`ldd conftest`
2802 for i in $deplibs; do
2803 name="`expr $i : '-l\(.*\)'`"
2804 # If $name is empty we are operating on a -L argument.
2805 if test -n "$name" && test "$name" != "0"; then
2806 libname=`eval \\$echo \"$libname_spec\"`
2807 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2808 set dummy $deplib_matches
2810 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2811 newdeplibs="$newdeplibs $i"
2815 echo "*** Warning: This library needs some functionality provided by $i."
2816 echo "*** I have the capability to make that library automatically link in when"
2817 echo "*** you link to this library. But I can only do this if you have a"
2818 echo "*** shared version of the library, which you do not appear to have."
2821 newdeplibs="$newdeplibs $i"
2825 # Error occured in the first compile. Let's try to salvage the situation:
2826 # Compile a seperate program for each library.
2827 for i in $deplibs; do
2828 name="`expr $i : '-l\(.*\)'`"
2829 # If $name is empty we are operating on a -L argument.
2830 if test -n "$name" && test "$name" != "0"; then
2832 $LTCC -o conftest conftest.c $i
2834 if test $? -eq 0 ; then
2835 ldd_output=`ldd conftest`
2836 libname=`eval \\$echo \"$libname_spec\"`
2837 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2838 set dummy $deplib_matches
2840 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2841 newdeplibs="$newdeplibs $i"
2845 echo "*** Warning: This library needs some functionality provided by $i."
2846 echo "*** I have the capability to make that library automatically link in when"
2847 echo "*** you link to this library. But I can only do this if you have a"
2848 echo "*** shared version of the library, which you do not appear to have."
2853 echo "*** Warning! Library $i is needed by this library but I was not able to"
2854 echo "*** make it link in! You will probably need to install it or some"
2855 echo "*** library that it depends on before this library will be fully"
2856 echo "*** functional. Installing it before continuing would be even better."
2859 newdeplibs="$newdeplibs $i"
2865 set dummy $deplibs_check_method
2866 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2867 for a_deplib in $deplibs; do
2868 name="`expr $a_deplib : '-l\(.*\)'`"
2869 # If $name is empty we are operating on a -L argument.
2870 if test -n "$name" && test "$name" != "0"; then
2871 libname=`eval \\$echo \"$libname_spec\"`
2872 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2873 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2874 for potent_lib in $potential_libs; do
2875 # Follow soft links.
2876 if ls -lLd "$potent_lib" 2>/dev/null \
2877 | grep " -> " >/dev/null; then
2880 # The statement above tries to avoid entering an
2881 # endless loop below, in case of cyclic links.
2882 # We might still enter an endless loop, since a link
2883 # loop can be closed while we follow links,
2885 potlib="$potent_lib"
2886 while test -h "$potlib" 2>/dev/null; do
2887 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2889 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2890 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2893 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2895 | egrep "$file_magic_regex" > /dev/null; then
2896 newdeplibs="$newdeplibs $a_deplib"
2902 if test -n "$a_deplib" ; then
2905 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2906 echo "*** I have the capability to make that library automatically link in when"
2907 echo "*** you link to this library. But I can only do this if you have a"
2908 echo "*** shared version of the library, which you do not appear to have."
2911 # Add a -L argument.
2912 newdeplibs="$newdeplibs $a_deplib"
2914 done # Gone through all deplibs.
2917 set dummy $deplibs_check_method
2918 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2919 for a_deplib in $deplibs; do
2920 name="`expr $a_deplib : '-l\(.*\)'`"
2921 # If $name is empty we are operating on a -L argument.
2922 if test -n "$name" && test "$name" != "0"; then
2923 libname=`eval \\$echo \"$libname_spec\"`
2924 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2925 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2926 for potent_lib in $potential_libs; do
2927 if eval echo \"$potent_lib\" 2>/dev/null \
2929 | egrep "$match_pattern_regex" > /dev/null; then
2930 newdeplibs="$newdeplibs $a_deplib"
2936 if test -n "$a_deplib" ; then
2939 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2940 echo "*** I have the capability to make that library automatically link in when"
2941 echo "*** you link to this library. But I can only do this if you have a"
2942 echo "*** shared version of the library, which you do not appear to have."
2945 # Add a -L argument.
2946 newdeplibs="$newdeplibs $a_deplib"
2948 done # Gone through all deplibs.
2952 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2953 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2954 grep . >/dev/null; then
2956 if test "X$deplibs_check_method" = "Xnone"; then
2957 echo "*** Warning: inter-library dependencies are not supported in this platform."
2959 echo "*** Warning: inter-library dependencies are not known to be supported."
2961 echo "*** All declared inter-library dependencies are being dropped."
2966 versuffix=$versuffix_save
2968 release=$release_save
2969 libname=$libname_save
2973 *-*-rhapsody* | *-*-darwin1.[012])
2974 # On Rhapsody replace the C library is the System framework
2975 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2979 if test "$droppeddeps" = yes; then
2980 if test "$module" = yes; then
2982 echo "*** Warning: libtool could not satisfy all declared inter-library"
2983 echo "*** dependencies of module $libname. Therefore, libtool will create"
2984 echo "*** a static module, that should work as long as the dlopening"
2985 echo "*** application is linked with the -dlopen flag."
2986 if test -z "$global_symbol_pipe"; then
2988 echo "*** However, this would only work if libtool was able to extract symbol"
2989 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2990 echo "*** not find such a program. So, this module is probably useless."
2991 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2993 if test "$build_old_libs" = no; then
2994 oldlibs="$output_objdir/$libname.$libext"
2995 build_libtool_libs=module
2998 build_libtool_libs=no
3001 echo "*** The inter-library dependencies that have been dropped here will be"
3002 echo "*** automatically added whenever a program is linked with this library"
3003 echo "*** or is declared to -dlopen it."
3005 if test $allow_undefined = no; then
3007 echo "*** Since this library must not contain undefined symbols,"
3008 echo "*** because either the platform does not support them or"
3009 echo "*** it was explicitly requested with -no-undefined,"
3010 echo "*** libtool will only create a static version of it."
3011 if test "$build_old_libs" = no; then
3012 oldlibs="$output_objdir/$libname.$libext"
3013 build_libtool_libs=module
3016 build_libtool_libs=no
3021 # Done checking deplibs!
3025 # All the library-specific variables (install_libdir is set above).
3030 # Test again, we may have decided not to build it any more
3031 if test "$build_libtool_libs" = yes; then
3032 if test $hardcode_into_libs = yes; then
3033 # Hardcode the library paths
3036 rpath="$finalize_rpath"
3037 test "$mode" != relink && rpath="$compile_rpath$rpath"
3038 for libdir in $rpath; do
3039 if test -n "$hardcode_libdir_flag_spec"; then
3040 if test -n "$hardcode_libdir_separator"; then
3041 if test -z "$hardcode_libdirs"; then
3042 hardcode_libdirs="$libdir"
3044 # Just accumulate the unique libdirs.
3045 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3046 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3049 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3054 eval flag=\"$hardcode_libdir_flag_spec\"
3055 dep_rpath="$dep_rpath $flag"
3057 elif test -n "$runpath_var"; then
3058 case "$perm_rpath " in
3060 *) perm_rpath="$perm_rpath $libdir" ;;
3064 # Substitute the hardcoded libdirs into the rpath.
3065 if test -n "$hardcode_libdir_separator" &&
3066 test -n "$hardcode_libdirs"; then
3067 libdir="$hardcode_libdirs"
3068 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3070 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3071 # We should set the runpath_var.
3073 for dir in $perm_rpath; do
3076 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3078 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3081 shlibpath="$finalize_shlibpath"
3082 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3083 if test -n "$shlibpath"; then
3084 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3087 # Get the real and link names of the library.
3088 eval library_names=\"$library_names_spec\"
3089 set dummy $library_names
3093 if test -n "$soname_spec"; then
3094 eval soname=\"$soname_spec\"
3098 test -z "$dlname" && dlname=$soname
3100 lib="$output_objdir/$realname"
3103 linknames="$linknames $link"
3106 # # Ensure that we have .o objects for linkers which dislike .lo
3107 # # (e.g. aix) in case we are running --disable-static
3108 # for obj in $libobjs; do
3109 # xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3110 # if test "X$xdir" = "X$obj"; then
3115 # baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3116 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3117 # if test ! -f $xdir/$oldobj && test "$baseobj" != "$oldobj"; then
3118 # $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3119 # $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3123 # Use standard objects if they are pic
3124 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3126 # Prepare the list of exported symbols
3127 if test -z "$export_symbols"; then
3128 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3129 $show "generating symbol list for \`$libname.la'"
3130 export_symbols="$output_objdir/$libname.exp"
3131 $run $rm $export_symbols
3132 eval cmds=\"$export_symbols_cmds\"
3133 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3134 for cmd in $cmds; do
3137 $run eval "$cmd" || exit $?
3140 if test -n "$export_symbols_regex"; then
3141 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3142 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3143 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3144 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3149 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3150 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3153 if test -n "$convenience"; then
3154 if test -n "$whole_archive_flag_spec"; then
3155 save_libobjs=$libobjs
3156 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3158 gentop="$output_objdir/${outputname}x"
3159 $show "${rm}r $gentop"
3160 $run ${rm}r "$gentop"
3161 $show "$mkdir $gentop"
3162 $run $mkdir "$gentop"
3164 if test $status -ne 0 && test ! -d "$gentop"; then
3167 generated="$generated $gentop"
3169 for xlib in $convenience; do
3170 # Extract the objects.
3172 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3173 *) xabs=`pwd`"/$xlib" ;;
3175 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3176 xdir="$gentop/$xlib"
3178 $show "${rm}r $xdir"
3180 $show "$mkdir $xdir"
3183 if test $status -ne 0 && test ! -d "$xdir"; then
3186 $show "(cd $xdir && $AR x $xabs)"
3187 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3189 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3194 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3195 eval flag=\"$thread_safe_flag_spec\"
3196 linker_flags="$linker_flags $flag"
3199 # Make a backup of the uninstalled library when relinking
3200 if test "$mode" = relink; then
3201 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3204 # Do each of the archive commands.
3205 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3206 eval cmds=\"$archive_expsym_cmds\"
3208 eval cmds=\"$archive_cmds\"
3210 if len=`expr "X$cmds" : ".*"` &&
3211 test $len -le $max_cmd_len; then
3214 # The command line is too long to link in one step, link piecewise.
3215 $echo "creating reloadable object files..."
3217 # Save the value of $output and $libobjs because we want to
3218 # use them later. If we have whole_archive_flag_spec, we
3219 # want to use save_libobjs as it was before
3220 # whole_archive_flag_spec was expanded, because we can't
3221 # assume the linker understands whole_archive_flag_spec.
3222 # This may have to be revisited, in case too many
3223 # convenience libraries get linked in and end up exceeding
3225 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3226 save_libobjs=$libobjs
3230 # Clear the reloadable object creation command queue and
3231 # initialize k to one.
3238 output=$output_objdir/$save_output-${k}.$objext
3239 # Loop over the list of objects to be linked.
3240 for obj in $save_libobjs
3242 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3243 if test "X$objlist" = X ||
3244 { len=`expr "X$test_cmds" : ".*"` &&
3245 test $len -le $max_cmd_len; }; then
3246 objlist="$objlist $obj"
3248 # The command $test_cmds is almost too long, add a
3249 # command to the queue.
3250 if test $k -eq 1 ; then
3251 # The first file doesn't have a previous command to add.
3252 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3254 # All subsequent reloadable object files will link in
3255 # the last one created.
3256 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3258 last_robj=$output_objdir/$save_output-${k}.$objext
3260 output=$output_objdir/$save_output-${k}.$objext
3265 # Handle the remaining objects by creating one last
3266 # reloadable object file. All subsequent reloadable object
3267 # files will link in the last one created.
3268 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3269 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3271 # Set up a command to remove the reloadale object files
3272 # after they are used.
3274 while test $i -lt $k
3277 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3280 $echo "creating a temporary reloadable object file: $output"
3282 # Loop through the commands generated above and execute them.
3283 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3284 for cmd in $concat_cmds; do
3287 $run eval "$cmd" || exit $?
3292 # Restore the value of output.
3295 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3296 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3298 # Expand the library linking commands again to reset the
3299 # value of $libobjs for piecewise linking.
3301 # Do each of the archive commands.
3302 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3303 eval cmds=\"$archive_expsym_cmds\"
3305 eval cmds=\"$archive_cmds\"
3308 # Append the command to remove the reloadable object files
3309 # to the just-reset $cmds.
3310 eval cmds=\"\$cmds~$rm $delfiles\"
3312 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3313 for cmd in $cmds; do
3316 $run eval "$cmd" || exit $?
3320 # Restore the uninstalled library and exit
3321 if test "$mode" = relink; then
3322 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3326 # Create links to the real library.
3327 for linkname in $linknames; do
3328 if test "$realname" != "$linkname"; then
3329 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3330 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3334 # If -module or -export-dynamic was specified, set the dlname.
3335 if test "$module" = yes || test "$export_dynamic" = yes; then
3336 # On all known operating systems, these are identical.
3343 if test -n "$deplibs"; then
3344 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3347 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3348 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3351 if test -n "$rpath"; then
3352 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3355 if test -n "$xrpath"; then
3356 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3359 if test -n "$vinfo"; then
3360 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3363 if test -n "$release"; then
3364 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3369 if test -n "$objs$old_deplibs"; then
3370 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3374 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3382 # Delete the old objects.
3383 $run $rm $obj $libobj
3385 # Objects from convenience libraries. This assumes
3386 # single-version convenience libraries. Whenever we create
3387 # different ones for PIC/non-PIC, this we'll have to duplicate
3391 # reload_cmds runs $LD directly, so let us get rid of
3392 # -Wl from whole_archive_flag_spec
3395 if test -n "$convenience"; then
3396 if test -n "$whole_archive_flag_spec"; then
3397 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3399 gentop="$output_objdir/${obj}x"
3400 $show "${rm}r $gentop"
3401 $run ${rm}r "$gentop"
3402 $show "$mkdir $gentop"
3403 $run $mkdir "$gentop"
3405 if test $status -ne 0 && test ! -d "$gentop"; then