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.254 2001/05/20 18:44:55)"
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
3408 generated="$generated $gentop"
3410 for xlib in $convenience; do
3411 # Extract the objects.
3413 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3414 *) xabs=`pwd`"/$xlib" ;;
3416 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3417 xdir="$gentop/$xlib"
3419 $show "${rm}r $xdir"
3421 $show "$mkdir $xdir"
3424 if test $status -ne 0 && test ! -d "$xdir"; then
3427 $show "(cd $xdir && $AR x $xabs)"
3428 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3430 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3435 # Create the old-style object.
3436 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
3439 eval cmds=\"$reload_cmds\"
3440 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3441 for cmd in $cmds; do
3444 $run eval "$cmd" || exit $?
3448 # Exit if we aren't doing a library object file.
3449 if test -z "$libobj"; then
3450 if test -n "$gentop"; then
3451 $show "${rm}r $gentop"
3458 if test "$build_libtool_libs" != yes; then
3459 if test -n "$gentop"; then
3460 $show "${rm}r $gentop"
3464 # Create an invalid libtool object if no PIC, so that we don't
3465 # accidentally link it into a program.
3466 # $show "echo timestamp > $libobj"
3467 # $run eval "echo timestamp > $libobj" || exit $?
3471 if test -n "$pic_flag" || test "$pic_mode" != default; then
3472 # Only do commands if we really have different PIC objects.
3473 reload_objs="$libobjs $reload_conv_objs"
3475 eval cmds=\"$reload_cmds\"
3476 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3477 for cmd in $cmds; do
3480 $run eval "$cmd" || exit $?
3484 # # Just create a symlink.
3487 # xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3488 # if test "X$xdir" = "X$libobj"; then
3493 # baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3494 # oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3495 # $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3496 # $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3499 if test -n "$gentop"; then
3500 $show "${rm}r $gentop"
3509 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3511 if test -n "$vinfo"; then
3512 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3515 if test -n "$release"; then
3516 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3519 if test "$preload" = yes; then
3520 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3521 test "$dlopen_self_static" = unknown; then
3522 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3527 *-*-rhapsody* | *-*-darwin1.[012])
3528 # On Rhapsody replace the C library is the System framework
3529 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3530 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3534 compile_command="$compile_command $compile_deplibs"
3535 finalize_command="$finalize_command $finalize_deplibs"
3537 if test -n "$rpath$xrpath"; then
3538 # If the user specified any rpath flags, then add them.
3539 for libdir in $rpath $xrpath; do
3540 # This is the magic to use -rpath.
3541 case "$finalize_rpath " in
3543 *) finalize_rpath="$finalize_rpath $libdir" ;;
3548 # Now hardcode the library paths
3551 for libdir in $compile_rpath $finalize_rpath; do
3552 if test -n "$hardcode_libdir_flag_spec"; then
3553 if test -n "$hardcode_libdir_separator"; then
3554 if test -z "$hardcode_libdirs"; then
3555 hardcode_libdirs="$libdir"
3557 # Just accumulate the unique libdirs.
3558 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3559 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3562 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3567 eval flag=\"$hardcode_libdir_flag_spec\"
3568 rpath="$rpath $flag"
3570 elif test -n "$runpath_var"; then
3571 case "$perm_rpath " in
3573 *) perm_rpath="$perm_rpath $libdir" ;;
3577 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3578 case :$dllsearchpath: in
3580 *) dllsearchpath="$dllsearchpath:$libdir";;
3585 # Substitute the hardcoded libdirs into the rpath.
3586 if test -n "$hardcode_libdir_separator" &&
3587 test -n "$hardcode_libdirs"; then
3588 libdir="$hardcode_libdirs"
3589 eval rpath=\" $hardcode_libdir_flag_spec\"
3591 compile_rpath="$rpath"
3595 for libdir in $finalize_rpath; do
3596 if test -n "$hardcode_libdir_flag_spec"; then
3597 if test -n "$hardcode_libdir_separator"; then
3598 if test -z "$hardcode_libdirs"; then
3599 hardcode_libdirs="$libdir"
3601 # Just accumulate the unique libdirs.
3602 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3603 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3606 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3611 eval flag=\"$hardcode_libdir_flag_spec\"
3612 rpath="$rpath $flag"
3614 elif test -n "$runpath_var"; then
3615 case "$finalize_perm_rpath " in
3617 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3621 # Substitute the hardcoded libdirs into the rpath.
3622 if test -n "$hardcode_libdir_separator" &&
3623 test -n "$hardcode_libdirs"; then
3624 libdir="$hardcode_libdirs"
3625 eval rpath=\" $hardcode_libdir_flag_spec\"
3627 finalize_rpath="$rpath"
3630 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3631 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3632 dlsyms="${outputname}S.c"
3634 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3638 if test -n "$dlsyms"; then
3642 # Discover the nlist of each of the dlfiles.
3643 nlist="$output_objdir/${outputname}.nm"
3645 $show "$rm $nlist ${nlist}S ${nlist}T"
3646 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3648 # Parse the name list into a source file.
3649 $show "creating $output_objdir/$dlsyms"
3651 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3652 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3653 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3659 /* Prevent the only kind of declaration conflicts we can make. */
3660 #define lt_preloaded_symbols some_other_symbol
3662 /* External symbol declarations for the compiler. */\
3665 if test "$dlself" = yes; then
3666 $show "generating symbol list for \`$output'"
3668 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3670 # Add our own program objects to the symbol list.
3671 progfiles="$objs$old_deplibs"
3672 for arg in $progfiles; do
3673 $show "extracting global C symbols from \`$arg'"
3674 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3677 if test -n "$exclude_expsyms"; then
3678 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3679 $run eval '$mv "$nlist"T "$nlist"'
3682 if test -n "$export_symbols_regex"; then
3683 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3684 $run eval '$mv "$nlist"T "$nlist"'
3687 # Prepare the list of exported symbols
3688 if test -z "$export_symbols"; then
3689 export_symbols="$output_objdir/$output.exp"
3690 $run $rm $export_symbols
3691 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3693 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3694 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3695 $run eval 'mv "$nlist"T "$nlist"'
3699 for arg in $dlprefiles; do
3700 $show "extracting global C symbols from \`$arg'"
3701 name=`echo "$arg" | sed -e 's%^.*/%%'`
3702 $run eval 'echo ": $name " >> "$nlist"'
3703 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3706 if test -z "$run"; then
3707 # Make sure we have at least an empty file.
3708 test -f "$nlist" || : > "$nlist"
3710 if test -n "$exclude_expsyms"; then
3711 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3712 $mv "$nlist"T "$nlist"
3715 # Try sorting and uniquifying the output.
3716 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3719 grep -v "^: " < "$nlist" > "$nlist"S
3722 if test -f "$nlist"S; then
3723 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3725 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3728 $echo >> "$output_objdir/$dlsyms" "\
3730 #undef lt_preloaded_symbols
3732 #if defined (__STDC__) && __STDC__
3733 # define lt_ptr_t void *
3735 # define lt_ptr_t char *
3739 /* The mapping between symbol names and symbols. */
3744 lt_preloaded_symbols[] =
3748 sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \
3749 -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \
3750 < "$nlist" >> "$output_objdir/$dlsyms"
3752 $echo >> "$output_objdir/$dlsyms" "\
3756 /* This works around a problem in FreeBSD linker */
3757 #ifdef FREEBSD_WORKAROUND
3758 static const void *lt_preloaded_setup() {
3759 return lt_preloaded_symbols;
3769 pic_flag_for_symtable=
3771 # compiling the symbol table file with pic_flag works around
3772 # a FreeBSD bug that causes programs to crash when -lm is
3773 # linked before any other PIC object. But we must not use
3774 # pic_flag when linking with -static. The problem exists in
3775 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3776 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3777 case "$compile_command " in
3779 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3782 case "$compile_command " in
3784 *) pic_flag_for_symtable=" $pic_flag";;
3788 # Now compile the dynamic symbol file.
3789 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3790 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3792 # Clean up the generated files.
3793 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3794 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3796 # Transform the symbol file into the correct name.
3797 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3798 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3801 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3806 # We keep going just in case the user didn't refer to
3807 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3808 # really was required.
3810 # Nullify the symbol file.
3811 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3812 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3815 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3816 # Replace the output file specification.
3817 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3818 link_command="$compile_command$compile_rpath"
3820 # We have no uninstalled library dependencies, so finalize right now.
3821 $show "$link_command"
3822 $run eval "$link_command"
3825 # Delete the generated files.
3826 if test -n "$dlsyms"; then
3827 $show "$rm $output_objdir/${outputname}S.${objext}"
3828 $run $rm "$output_objdir/${outputname}S.${objext}"
3834 if test -n "$shlibpath_var"; then
3835 # We should set the shlibpath_var
3837 for dir in $temp_rpath; do
3839 [\\/]* | [A-Za-z]:[\\/]*)
3844 # Relative path: add a thisdir entry.
3845 rpath="$rpath\$thisdir/$dir:"
3852 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3853 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3855 if test -n "$finalize_shlibpath"; then
3856 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3861 if test -n "$runpath_var"; then
3862 if test -n "$perm_rpath"; then
3863 # We should set the runpath_var.
3865 for dir in $perm_rpath; do
3868 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3870 if test -n "$finalize_perm_rpath"; then
3871 # We should set the runpath_var.
3873 for dir in $finalize_perm_rpath; do
3876 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3880 if test "$no_install" = yes; then
3881 # We don't need to create a wrapper script.
3882 link_command="$compile_var$compile_command$compile_rpath"
3883 # Replace the output file specification.
3884 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3885 # Delete the old output file.
3887 # Link the executable and exit
3888 $show "$link_command"
3889 $run eval "$link_command" || exit $?
3893 if test "$hardcode_action" = relink; then
3894 # Fast installation is not supported
3895 link_command="$compile_var$compile_command$compile_rpath"
3896 relink_command="$finalize_var$finalize_command$finalize_rpath"
3898 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3899 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3901 if test "$fast_install" != no; then
3902 link_command="$finalize_var$compile_command$finalize_rpath"
3903 if test "$fast_install" = yes; then
3904 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3906 # fast_install is set to needless
3910 link_command="$compile_var$compile_command$compile_rpath"
3911 relink_command="$finalize_var$finalize_command$finalize_rpath"
3915 # Replace the output file specification.
3916 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3918 # Delete the old output files.
3919 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3921 $show "$link_command"
3922 $run eval "$link_command" || exit $?
3924 # Now create the wrapper script.
3925 $show "creating $output"
3927 # Quote the relink command for shipping.
3928 if test -n "$relink_command"; then
3929 # Preserve any variables that may affect compiler behavior
3930 for var in $variables_saved_for_relink; do
3931 if eval test -z \"\${$var+set}\"; then
3932 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3933 elif eval var_value=\$$var; test -z "$var_value"; then
3934 relink_command="$var=; export $var; $relink_command"
3936 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3937 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3940 relink_command="cd `pwd`; $relink_command"
3941 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3944 # Quote $echo for shipping.
3945 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3947 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3948 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3950 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3952 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3955 # Only actually do things if our run command is non-null.
3956 if test -z "$run"; then
3957 # win32 will think the script is a binary if it has
3958 # a .exe suffix, so we strip it off here.
3960 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3962 # test for cygwin because mv fails w/o .exe extensions
3964 *cygwin*) exeext=.exe ;;
3968 trap "$rm $output; exit 1" 1 2 15
3973 # $output - temporary wrapper script for $objdir/$outputname
3974 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3976 # The $output program cannot be directly executed until all the libtool
3977 # libraries that it depends on are installed.
3979 # This wrapper script should never be moved out of the build directory.
3980 # If it is, it will not operate correctly.
3982 # Sed substitution that helps us do robust quoting. It backslashifies
3983 # metacharacters that are still active within double-quoted strings.
3984 Xsed='sed -e 1s/^X//'
3985 sed_quote_subst='$sed_quote_subst'
3987 # The HP-UX ksh and POSIX shell print the target directory to stdout
3989 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3991 relink_command=\"$relink_command\"
3993 # This environment variable determines our operation mode.
3994 if test \"\$libtool_install_magic\" = \"$magic\"; then
3995 # install mode needs the following variable:
3996 notinst_deplibs='$notinst_deplibs'
3998 # When we are sourced in execute mode, \$file and \$echo are already set.
3999 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4002 # Make sure echo works.
4003 if test \"X\$1\" = X--no-reexec; then
4004 # Discard the --no-reexec flag, and continue.
4006 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4007 # Yippee, \$echo works!
4010 # Restart under the correct shell, and then maybe \$echo will work.
4011 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4017 # Find the directory that this script lives in.
4018 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4019 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4021 # Follow symbolic links until we get to the real thisdir.
4022 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
4023 while test -n \"\$file\"; do
4024 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4026 # If there was a directory component, then change thisdir.
4027 if test \"x\$destdir\" != \"x\$file\"; then
4028 case \"\$destdir\" in
4029 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4030 *) thisdir=\"\$thisdir/\$destdir\" ;;
4034 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4035 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
4038 # Try to get the absolute directory name.
4039 absdir=\`cd \"\$thisdir\" && pwd\`
4040 test -n \"\$absdir\" && thisdir=\"\$absdir\"
4043 if test "$fast_install" = yes; then
4045 program=lt-'$outputname'$exeext
4046 progdir=\"\$thisdir/$objdir\"
4048 if test ! -f \"\$progdir/\$program\" || \\
4049 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
4050 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4052 file=\"\$\$-\$program\"
4054 if test ! -d \"\$progdir\"; then
4055 $mkdir \"\$progdir\"
4057 $rm \"\$progdir/\$file\"
4062 # relink executable if necessary
4063 if test -n \"\$relink_command\"; then
4064 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4066 $echo \"\$relink_command_output\" >&2
4067 $rm \"\$progdir/\$file\"
4072 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4073 { $rm \"\$progdir/\$program\";
4074 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4075 $rm \"\$progdir/\$file\"
4079 program='$outputname'
4080 progdir=\"\$thisdir/$objdir\"
4086 if test -f \"\$progdir/\$program\"; then"
4088 # Export our shlibpath_var if we have one.
4089 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4091 # Add our own library path to $shlibpath_var
4092 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4094 # Some systems cannot cope with colon-terminated $shlibpath_var
4095 # The second colon is a workaround for a bug in BeOS R4 sed
4096 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4098 export $shlibpath_var
4102 # fixup the dll searchpath if we need to.
4103 if test -n "$dllsearchpath"; then
4105 # Add the dll search path components to the executable PATH
4106 PATH=$dllsearchpath:\$PATH
4111 if test \"\$libtool_execute_magic\" != \"$magic\"; then
4112 # Run the actual program with our arguments.
4115 # win32 systems need to use the prog path for dll
4117 *-*-cygwin* | *-*-pw32*)
4119 exec \$progdir/\$program \${1+\"\$@\"}
4123 # Backslashes separate directories on plain windows
4124 *-*-mingw | *-*-os2*)
4126 exec \$progdir\\\\\$program \${1+\"\$@\"}
4132 # Export the path to the program.
4133 PATH=\"\$progdir:\$PATH\"
4136 exec \$program \${1+\"\$@\"}
4141 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4145 # The program doesn't exist.
4146 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4147 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4148 echo \"See the $PACKAGE documentation for more information.\" 1>&2
4159 # See if we need to build an old-fashioned archive.
4160 for oldlib in $oldlibs; do
4162 if test "$build_libtool_libs" = convenience; then
4163 oldobjs="$libobjs_save"
4164 addlibs="$convenience"
4165 build_libtool_libs=no
4167 if test "$build_libtool_libs" = module; then
4168 oldobjs="$libobjs_save"
4169 build_libtool_libs=no
4171 oldobjs="$objs$old_deplibs $non_pic_objects"
4173 addlibs="$old_convenience"
4176 if test -n "$addlibs"; then
4177 gentop="$output_objdir/${outputname}x"
4178 $show "${rm}r $gentop"
4179 $run ${rm}r "$gentop"
4180 $show "$mkdir $gentop"
4181 $run $mkdir "$gentop"
4183 if test $status -ne 0 && test ! -d "$gentop"; then
4186 generated="$generated $gentop"
4188 # Add in members from convenience archives.
4189 for xlib in $addlibs; do
4190 # Extract the objects.
4192 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4193 *) xabs=`pwd`"/$xlib" ;;
4195 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4196 xdir="$gentop/$xlib"
4198 $show "${rm}r $xdir"
4200 $show "$mkdir $xdir"
4203 if test $status -ne 0 && test ! -d "$xdir"; then
4206 $show "(cd $xdir && $AR x $xabs)"
4207 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4209 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print | $NL2SP`
4213 # Do each command in the archive commands.
4214 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4215 eval cmds=\"$old_archive_from_new_cmds\"
4217 # # Ensure that we have .o objects in place in case we decided
4218 # # not to build a shared library, and have fallen back to building
4219 # # static libs even though --disable-static was passed!
4220 # for oldobj in $oldobjs; do
4221 # if test ! -f $oldobj; then
4222 # xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
4223 # if test "X$xdir" = "X$oldobj"; then
4228 # baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
4229 # obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
4230 # $show "(cd $xdir && ${LN_S} $obj $baseobj)"
4231 # $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
4235 eval cmds=\"$old_archive_cmds\"
4237 if len=`expr "X$cmds" : ".*"` &&
4238 test $len -le $max_cmd_len; then
4241 # the command line is too long to link in one step, link in parts
4242 $echo "using piecewise archive linking..."
4247 save_oldobjs=$oldobjs
4248 for obj in $save_oldobjs
4250 oldobjs="$objlist $obj"
4251 objlist="$objlist $obj"
4252 eval test_cmds=\"$old_archive_cmds\"
4253 if len=`expr "X$test_cmds" : ".*"` &&
4254 test $len -le $max_cmd_len; then
4257 # the above command should be used before it gets too long
4259 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4260 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4266 eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4269 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4270 for cmd in $cmds; do
4273 $run eval "$cmd" || exit $?
4278 if test -n "$generated"; then
4279 $show "${rm}r$generated"
4280 $run ${rm}r$generated
4283 # Now create the libtool archive.
4287 test "$build_old_libs" = yes && old_library="$libname.$libext"
4288 $show "creating $output"
4290 # Preserve any variables that may affect compiler behavior
4291 for var in $variables_saved_for_relink; do
4292 if eval test -z \"\${$var+set}\"; then
4293 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4294 elif eval var_value=\$$var; test -z "$var_value"; then
4295 relink_command="$var=; export $var; $relink_command"
4297 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4298 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4301 # Quote the link command for shipping.
4302 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
4303 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4305 # Only create the output if not a dry run.
4306 if test -z "$run"; then
4307 for installed in no yes; do
4308 if test "$installed" = yes; then
4309 if test -z "$install_libdir"; then
4312 output="$output_objdir/$outputname"i
4313 # Replace all uninstalled libtool libraries with the installed ones
4315 for deplib in $dependency_libs; do
4318 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4319 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4320 if test -z "$libdir"; then
4321 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4324 newdependency_libs="$newdependency_libs $libdir/$name"
4326 *) newdependency_libs="$newdependency_libs $deplib" ;;
4329 dependency_libs="$newdependency_libs"
4331 for lib in $dlfiles; do
4332 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4333 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4334 if test -z "$libdir"; then
4335 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4338 newdlfiles="$newdlfiles $libdir/$name"
4340 dlfiles="$newdlfiles"
4342 for lib in $dlprefiles; do
4343 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4344 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4345 if test -z "$libdir"; then
4346 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4349 newdlprefiles="$newdlprefiles $libdir/$name"
4351 dlprefiles="$newdlprefiles"
4354 # place dlname in correct position for cygwin
4356 case $host,$output,$installed,$module,$dlname in
4357 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4360 # $outputname - a libtool library file
4361 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4363 # Please DO NOT delete this file!
4364 # It is necessary for linking the library.
4366 # The name that we can dlopen(3).
4369 # Names of this library.
4370 library_names='$library_names'
4372 # The name of the static archive.
4373 old_library='$old_library'
4375 # Libraries that this one depends upon.
4376 dependency_libs='$dependency_libs'
4378 # Version information for $libname.
4383 # Is this an already installed library?
4384 installed=$installed
4386 # Files to dlopen/dlpreopen
4388 dlpreopen='$dlprefiles'
4390 # Directory that this library needs to be installed in:
4391 libdir='$install_libdir'"
4392 if test "$installed" = no && test $need_relink = yes; then
4394 relink_command=\"$relink_command\""
4399 # Do a symbolic link so that the libtool archive can be found in
4400 # LD_LIBRARY_PATH before the program is installed.
4401 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4402 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4408 # libtool install mode
4410 modename="$modename: install"
4412 # There may be an optional sh(1) argument at the beginning of
4413 # install_prog (especially on Windows NT).
4414 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4415 # Allow the use of GNU shtool's install command.
4416 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4417 # Aesthetically quote it.
4418 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4420 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4424 install_prog="$arg "
4432 # The real first argument should be the name of the installation program.
4433 # Aesthetically quote it.
4434 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4436 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4440 install_prog="$install_prog$arg"
4442 # We need to accept at least all the BSD install flags.
4452 if test -n "$dest"; then
4453 files="$files $dest"
4471 # If the previous option needed an argument, then skip it.
4472 if test -n "$prev"; then
4481 # Aesthetically quote the argument.
4482 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4484 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4488 install_prog="$install_prog $arg"
4491 if test -z "$install_prog"; then
4492 $echo "$modename: you must specify an install program" 1>&2
4497 if test -n "$prev"; then
4498 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4503 if test -z "$files"; then
4504 if test -z "$dest"; then
4505 $echo "$modename: no file or destination specified" 1>&2
4507 $echo "$modename: you must specify a destination" 1>&2
4513 # Strip any trailing slash from the destination.
4514 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4516 # Check to see that the destination is a directory.
4517 test -d "$dest" && isdir=yes
4518 if test "$isdir" = yes; then
4522 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4523 test "X$destdir" = "X$dest" && destdir=.
4524 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4526 # Not a directory, so check to see that there is only one file specified.
4528 if test $# -gt 2; then
4529 $echo "$modename: \`$dest' is not a directory" 1>&2
4535 [\\/]* | [A-Za-z]:[\\/]*) ;;
4537 for file in $files; do
4541 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4550 # This variable tells wrapper scripts just to set variables rather
4551 # than running their programs.
4552 libtool_install_magic="$magic"
4557 for file in $files; do
4559 # Do each installation.
4562 # Do the static libraries later.
4563 staticlibs="$staticlibs $file"
4567 # Check to see that this really is a libtool archive.
4568 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4570 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4578 # If there is no directory component, then add one.
4580 */* | *\\*) . $file ;;
4584 # Add the libdir to current_libdirs if it is the destination.
4585 if test "X$destdir" = "X$libdir"; then
4586 case "$current_libdirs " in
4588 *) current_libdirs="$current_libdirs $libdir" ;;
4591 # Note the libdir as a future libdir.
4592 case "$future_libdirs " in
4594 *) future_libdirs="$future_libdirs $libdir" ;;
4598 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4599 test "X$dir" = "X$file/" && dir=
4602 if test -n "$relink_command"; then
4603 $echo "$modename: warning: relinking \`$file'" 1>&2
4604 $show "$relink_command"
4605 if $run eval "$relink_command"; then :
4607 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4612 # See the names of the shared library.
4613 set dummy $library_names
4614 if test -n "$2"; then
4620 test -n "$relink_command" && srcname="$realname"T
4622 # Install the shared library and build the symlinks.
4623 $show "$install_prog $dir/$srcname $destdir/$realname"
4624 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4625 if test -n "$stripme" && test -n "$striplib"; then
4626 $show "$striplib $destdir/$realname"
4627 $run eval "$striplib $destdir/$realname" || exit $?
4630 if test $# -gt 0; then
4631 # Delete the old symlinks, and create new ones.
4634 if test "$linkname" != "$realname"; then
4635 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4636 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4641 # Do each command in the postinstall commands.
4642 lib="$destdir/$realname"
4643 eval cmds=\"$postinstall_cmds\"
4644 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4645 for cmd in $cmds; do
4648 $run eval "$cmd" || exit $?
4653 # Install the pseudo-library for information purposes.
4654 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4655 instname="$dir/$name"i
4656 $show "$install_prog $instname $destdir/$name"
4657 $run eval "$install_prog $instname $destdir/$name" || exit $?
4659 # Maybe install the static library, too.
4660 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4664 # Install (i.e. copy) a libtool object.
4666 # Figure out destination file name, if it wasn't already specified.
4667 if test -n "$destname"; then
4668 destfile="$destdir/$destname"
4670 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4671 destfile="$destdir/$destfile"
4674 # Deduce the name of the destination old-style object file.
4677 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4680 staticdest="$destfile"
4684 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4690 # Install the libtool object if requested.
4691 if test -n "$destfile"; then
4692 $show "$install_prog $file $destfile"
4693 $run eval "$install_prog $file $destfile" || exit $?
4696 # Install the old object if enabled.
4697 if test "$build_old_libs" = yes; then
4698 # Deduce the name of the old-style object file.
4699 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4701 $show "$install_prog $staticobj $staticdest"
4702 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4708 # Figure out destination file name, if it wasn't already specified.
4709 if test -n "$destname"; then
4710 destfile="$destdir/$destname"
4712 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4713 destfile="$destdir/$destfile"
4716 # Do a test to see if this is really a libtool program.
4717 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4721 # If there is no directory component, then add one.
4723 */* | *\\*) . $file ;;
4727 # Check the variables that should have been set.
4728 if test -z "$notinst_deplibs"; then
4729 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4734 for lib in $notinst_deplibs; do
4735 # Check to see that each library is installed.
4737 if test -f "$lib"; then
4738 # If there is no directory component, then add one.
4740 */* | *\\*) . $lib ;;
4744 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4745 if test -n "$libdir" && test ! -f "$libfile"; then
4746 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4752 # If there is no directory component, then add one.
4754 */* | *\\*) . $file ;;
4759 if test "$fast_install" = no && test -n "$relink_command"; then
4760 if test "$finalize" = yes && test -z "$run"; then
4762 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4763 tmpdir="$tmpdir/libtool-$$"
4764 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4766 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4769 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4770 outputname="$tmpdir/$file"
4771 # Replace the output file specification.
4772 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4774 $show "$relink_command"
4775 if $run eval "$relink_command"; then :
4777 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4783 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4786 # Install the binary that we compiled earlier.
4787 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4792 # remove .exe since cygwin /usr/bin/install will append another
4794 case $install_prog,$host in
4795 */usr/bin/install*,*cygwin*)
4796 case $file:$destfile in
4801 destfile=$destfile.exe
4804 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4810 $show "$install_prog$stripme $file $destfile"
4811 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4812 test -n "$outputname" && ${rm}r "$tmpdir"
4817 for file in $staticlibs; do
4818 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4820 # Set up the ranlib parameters.
4821 oldlib="$destdir/$name"
4823 $show "$install_prog $file $oldlib"
4824 $run eval "$install_prog \$file \$oldlib" || exit $?
4826 if test -n "$stripme" && test -n "$striplib"; then
4827 $show "$old_striplib $oldlib"
4828 $run eval "$old_striplib $oldlib" || exit $?
4831 # Do each command in the postinstall commands.
4832 eval cmds=\"$old_postinstall_cmds\"
4833 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4834 for cmd in $cmds; do
4837 $run eval "$cmd" || exit $?
4842 if test -n "$future_libdirs"; then
4843 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4846 if test -n "$current_libdirs"; then
4847 # Maybe just do a dry run.
4848 test -n "$run" && current_libdirs=" -n$current_libdirs"
4849 exec_cmd='$SHELL $0 --finish$current_libdirs'
4855 # libtool finish mode
4857 modename="$modename: finish"
4861 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4864 libdirs="$libdirs $dir"
4867 for libdir in $libdirs; do
4868 if test -n "$finish_cmds"; then
4869 # Do each command in the finish commands.
4870 eval cmds=\"$finish_cmds\"
4871 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4872 for cmd in $cmds; do
4875 $run eval "$cmd" || admincmds="$admincmds
4880 if test -n "$finish_eval"; then
4881 # Do the single finish_eval.
4882 eval cmds=\"$finish_eval\"
4883 $run eval "$cmds" || admincmds="$admincmds
4889 # Exit here if they wanted silent mode.
4890 test "$show" = ":" && exit 0
4892 echo "----------------------------------------------------------------------"
4893 echo "Libraries have been installed in:"
4894 for libdir in $libdirs; do
4898 echo "If you ever happen to want to link against installed libraries"
4899 echo "in a given directory, LIBDIR, you must either use libtool, and"
4900 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4901 echo "flag during linking and do at least one of the following:"
4902 if test -n "$shlibpath_var"; then
4903 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4904 echo " during execution"
4906 if test -n "$runpath_var"; then
4907 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4908 echo " during linking"
4910 if test -n "$hardcode_libdir_flag_spec"; then
4912 eval flag=\"$hardcode_libdir_flag_spec\"
4914 echo " - use the \`$flag' linker flag"
4916 if test -n "$admincmds"; then
4917 echo " - have your system administrator run these commands:$admincmds"
4919 if test -f /etc/ld.so.conf; then
4920 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4923 echo "See any operating system documentation about shared libraries for"
4924 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4925 echo "----------------------------------------------------------------------"
4929 # libtool execute mode
4931 modename="$modename: execute"
4933 # The first argument is the command name.
4935 if test -z "$cmd"; then
4936 $echo "$modename: you must specify a COMMAND" 1>&2
4941 # Handle -dlopen flags immediately.
4942 for file in $execute_dlfiles; do
4943 if test ! -f "$file"; then
4944 $echo "$modename: \`$file' is not a file" 1>&2
4952 # Check to see that this really is a libtool archive.
4953 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4955 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4960 # Read the libtool library.
4964 # If there is no directory component, then add one.
4966 */* | *\\*) . $file ;;
4970 # Skip this library if it cannot be dlopened.
4971 if test -z "$dlname"; then
4972 # Warn if it was a shared library.
4973 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4977 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4978 test "X$dir" = "X$file" && dir=.
4980 if test -f "$dir/$objdir/$dlname"; then
4983 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4989 # Just add the directory containing the .lo file.
4990 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4991 test "X$dir" = "X$file" && dir=.
4995 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5000 # Get the absolute pathname.
5001 absdir=`cd "$dir" && pwd`
5002 test -n "$absdir" && dir="$absdir"
5004 # Now add the directory to shlibpath_var.
5005 if eval "test -z \"\$$shlibpath_var\""; then
5006 eval "$shlibpath_var=\"\$dir\""
5008 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5012 # This variable tells wrapper scripts just to set shlibpath_var
5013 # rather than running their programs.
5014 libtool_execute_magic="$magic"
5016 # Check if any of the arguments is a wrapper script.
5023 # Do a test to see if this is really a libtool program.
5024 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5025 # If there is no directory component, then add one.
5027 */* | *\\*) . $file ;;
5031 # Transform arg to wrapped name.
5032 file="$progdir/$program"
5036 # Quote arguments (to preserve shell metacharacters).
5037 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5038 args="$args \"$file\""
5041 if test -z "$run"; then
5042 if test -n "$shlibpath_var"; then
5043 # Export the shlibpath_var.
5044 eval "export $shlibpath_var"
5047 # Restore saved enviroment variables
5048 if test "${save_LC_ALL+set}" = set; then
5049 LC_ALL="$save_LC_ALL"; export LC_ALL
5051 if test "${save_LANG+set}" = set; then
5052 LANG="$save_LANG"; export LANG
5055 # Now prepare to actually exec the command.
5056 exec_cmd='"$cmd"$args'
5058 # Display what would be done.
5059 if test -n "$shlibpath_var"; then
5060 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5061 $echo "export $shlibpath_var"
5068 # libtool clean and uninstall mode
5070 modename="$modename: $mode"
5076 # This variable tells wrapper scripts just to set variables rather
5077 # than running their programs.
5078 libtool_install_magic="$magic"
5083 -f) rm="$rm $arg"; rmforce=yes ;;
5084 -*) rm="$rm $arg" ;;
5085 *) files="$files $arg" ;;
5089 if test -z "$rm"; then
5090 $echo "$modename: you must specify an RM program" 1>&2
5097 for file in $files; do
5098 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5099 if test "X$dir" = "X$file"; then
5103 objdir="$dir/$objdir"
5105 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5106 test $mode = uninstall && objdir="$dir"
5108 # Remember objdir for removal later, being careful to avoid duplicates
5109 if test $mode = clean; then
5112 *) rmdirs="$rmdirs $objdir" ;;
5116 # Don't error if the file doesn't exist and rm -f was used.
5117 if (test -L "$file") >/dev/null 2>&1 \
5118 || (test -h "$file") >/dev/null 2>&1 \
5119 || test -f "$file"; then
5121 elif test -d "$file"; then
5124 elif test "$rmforce" = yes; then
5132 # Possibly a libtool archive, so verify it.
5133 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5136 # Delete the libtool libraries and symlinks.
5137 for n in $library_names; do
5138 rmfiles="$rmfiles $objdir/$n"
5140 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5141 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5143 if test $mode = uninstall; then
5144 if test -n "$library_names"; then
5145 # Do each command in the postuninstall commands.
5146 eval cmds=\"$postuninstall_cmds\"
5147 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5148 for cmd in $cmds; do
5152 if test $? != 0 && test "$rmforce" != yes; then
5159 if test -n "$old_library"; then
5160 # Do each command in the old_postuninstall commands.
5161 eval cmds=\"$old_postuninstall_cmds\"
5162 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
5163 for cmd in $cmds; do
5167 if test $? != 0 && test "$rmforce" != yes; then
5173 # FIXME: should reinstall the best remaining shared library.
5179 # Possibly a libtool object, so verify it.
5180 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5185 # Add PIC object to the list of files to remove.
5186 if test -n "$pic_object" \
5187 && test "$pic_object" != none; then
5188 rmfiles="$rmfiles $dir/$pic_object"
5191 # Add non-PIC object to the list of files to remove.
5192 if test -n "$non_pic_object" \
5193 && test "$non_pic_object" != none; then
5194 rmfiles="$rmfiles $dir/$non_pic_object"
5200 # Do a test to see if this is a libtool program.
5201 if test $mode = clean &&
5202 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5206 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5207 if test "$fast_install" = yes && test -n "$relink_command"; then
5208 rmfiles="$rmfiles $objdir/lt-$name"
5213 $show "$rm $rmfiles"
5214 $run $rm $rmfiles || exit_status=1
5217 # Try to remove the ${objdir}s in the directories where we deleted files
5218 for dir in $rmdirs; do
5219 if test -d "$dir"; then
5221 $run rmdir $dir >/dev/null 2>&1
5229 $echo "$modename: you must specify a MODE" 1>&2
5230 $echo "$generic_help" 1>&2
5235 if test -z "$exec_cmd"; then
5236 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5237 $echo "$generic_help" 1>&2
5240 fi # test -z "$show_help"
5242 if test -n "$exec_cmd"; then
5247 # We need to display help for each of the modes.
5250 "Usage: $modename [OPTION]... [MODE-ARG]...
5252 Provide generalized library-building support services.
5254 --config show all configuration variables
5255 --debug enable verbose shell tracing
5256 -n, --dry-run display commands without modifying any files
5257 --features display basic configuration information and exit
5258 --finish same as \`--mode=finish'
5259 --help display this help message and exit
5260 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
5261 --quiet same as \`--silent'
5262 --silent don't print informational messages
5263 --tag=TAG use configuration variables from tag TAG
5264 --version print version information
5266 MODE must be one of the following:
5268 clean remove files from the build directory
5269 compile compile a source file into a libtool object
5270 execute automatically set library path, then run a program
5271 finish complete the installation of libtool libraries
5272 install install libraries or executables
5273 link create a library or an executable
5274 uninstall remove libraries from an installed directory
5276 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5277 a more detailed description of MODE."
5283 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5285 Remove files from the build directory.
5287 RM is the name of the program to use to delete files associated with each FILE
5288 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5291 If FILE is a libtool library, object or program, all the files associated
5292 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5297 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5299 Compile a source file into a libtool library object.
5301 This mode accepts the following additional options:
5303 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5304 -prefer-pic try to building PIC objects only
5305 -prefer-non-pic try to building non-PIC objects only
5306 -static always build a \`.o' file suitable for static linking
5308 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5309 from the given SOURCEFILE.
5311 The output file name is determined by removing the directory component from
5312 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5313 library object suffix, \`.lo'."
5318 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5320 Automatically set library path, then run a program.
5322 This mode accepts the following additional options:
5324 -dlopen FILE add the directory containing FILE to the library path
5326 This mode sets the library path environment variable according to \`-dlopen'
5329 If any of the ARGS are libtool executable wrappers, then they are translated
5330 into their corresponding uninstalled binary, and any of their required library
5331 directories are added to the library path.
5333 Then, COMMAND is executed, with ARGS as arguments."
5338 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5340 Complete the installation of libtool libraries.
5342 Each LIBDIR is a directory that contains libtool libraries.
5344 The commands that this mode executes may require superuser privileges. Use
5345 the \`--dry-run' option if you just want to see what would be executed."
5350 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5352 Install executables or libraries.
5354 INSTALL-COMMAND is the installation command. The first component should be
5355 either the \`install' or \`cp' program.
5357 The rest of the components are interpreted as arguments to that command (only
5358 BSD-compatible install options are recognized)."
5363 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5365 Link object files or libraries together to form another library, or to
5366 create an executable program.
5368 LINK-COMMAND is a command using the C compiler that you would use to create
5369 a program from several object files.
5371 The following components of LINK-COMMAND are treated specially:
5373 -all-static do not do any dynamic linking at all
5374 -avoid-version do not add a version suffix if possible
5375 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5376 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5377 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5378 -export-symbols SYMFILE
5379 try to export only the symbols listed in SYMFILE
5380 -export-symbols-regex REGEX
5381 try to export only the symbols matching REGEX
5382 -LLIBDIR search LIBDIR for required installed libraries
5383 -lNAME OUTPUT-FILE requires the installed library libNAME
5384 -module build a library that can dlopened
5385 -no-fast-install disable the fast-install mode
5386 -no-install link a not-installable executable
5387 -no-undefined declare that a library does not refer to external symbols
5388 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5389 -objectlist FILE Use a list of object files found in FILE to specify objects
5390 -release RELEASE specify package release information
5391 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5392 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5393 -static do not do any dynamic linking of libtool libraries
5394 -version-info CURRENT[:REVISION[:AGE]]
5395 specify library version info [each variable defaults to 0]
5397 All other options (arguments beginning with \`-') are ignored.
5399 Every other argument is treated as a filename. Files ending in \`.la' are
5400 treated as uninstalled libtool libraries, other files are standard or library
5403 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5404 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5405 required, except when creating a convenience library.
5407 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5408 using \`ar' and \`ranlib', or on Windows using \`lib'.
5410 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5411 is created, otherwise an executable program is created."
5416 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5418 Remove libraries from an installation directory.
5420 RM is the name of the program to use to delete files associated with each FILE
5421 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5424 If FILE is a libtool library, all the files associated with it are deleted.
5425 Otherwise, only FILE itself is deleted using RM."
5429 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5436 $echo "Try \`$modename --help' for more information about other modes."
5440 # The TAGs below are defined such that we never get into a situation
5441 # in which we disable both kinds of libraries. Given conflicting
5442 # choices, we go for a static library, that is the most portable,
5443 # since we can't tell whether shared libraries were disabled because
5444 # the user asked for that or because the platform doesn't support
5445 # them. This is particularly important on AIX, because we don't
5446 # support having both static and shared libraries enabled at the same
5447 # time on that platform, so we default to a shared-only configuration.
5448 # If a disable-shared tag is given, we'll fallback to a static-only
5449 # configuration. But we'll never go from static-only to shared-only.
5451 ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5452 build_libtool_libs=no
5454 ### END LIBTOOL TAG CONFIG: disable-shared
5456 ### BEGIN LIBTOOL TAG CONFIG: disable-static
5457 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5458 ### END LIBTOOL TAG CONFIG: disable-static