1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
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.922.2.34 2001/09/03 01:22:13)"
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 "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
88 echo "$modename: not configured to build any kind of library" 1>&2
89 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
102 lo2o="s/\\.lo\$/.${objext}/"
103 o2lo="s/\\.${objext}\$/.lo/"
105 # Parse our command line options once, thoroughly.
112 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
116 # If the previous option needs an argument, assign it.
117 if test -n "$prev"; then
120 execute_dlfiles="$execute_dlfiles $arg"
132 # Have we seen a non-optional argument yet?
139 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
144 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
149 echo "$progname: enabling shell trace mode"
159 if test "$build_libtool_libs" = yes; then
160 echo "enable shared libraries"
162 echo "disable shared libraries"
164 if test "$build_old_libs" = yes; then
165 echo "enable static libraries"
167 echo "disable static libraries"
172 --finish) mode="finish" ;;
174 --mode) prevopt="--mode" prev=mode ;;
175 --mode=*) mode="$optarg" ;;
187 $echo "$modename: unrecognized option \`$arg'" 1>&2
199 if test -n "$prevopt"; then
200 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
205 # If this variable is set in any of the actions, the command in it
206 # will be execed at the end. This prevents here-documents from being
207 # left over by shells.
210 if test -z "$show_help"; then
212 # Infer the operation mode.
213 if test -z "$mode"; then
215 *cc | *++ | gcc* | *-gcc*)
227 *db | *dbx | *strace | *truss)
237 # If we have no mode, but dlfiles were specified, then do execute mode.
238 test -n "$execute_dlfiles" && mode=execute
240 # Just use the default operation mode.
241 if test -z "$mode"; then
242 if test -n "$nonopt"; then
243 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
245 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
252 # Only execute mode is allowed to have -dlopen flags.
253 if test -n "$execute_dlfiles" && test "$mode" != execute; then
254 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
259 # Change the help message to a mode-specific one.
261 help="Try \`$modename --help --mode=$mode' for more information."
263 # These modes are in order of execution frequency so that they run quickly.
265 # libtool compile mode
267 modename="$modename: compile"
268 # Get the compilation command and the source file.
281 # Aesthetically quote the previous argument.
283 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
286 # Double-quote args containing other shell metacharacters.
287 # Many Bourne shells cannot handle close brackets correctly
288 # in scan sets, so we specify it separately.
289 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
294 # Add the previous argument to base_compile.
295 if test -z "$base_compile"; then
296 base_compile="$lastarg"
298 base_compile="$base_compile $lastarg"
304 # Accept any command-line options.
307 if test "$user_target" != "no"; then
308 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
335 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
337 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
341 # Double-quote args containing other shell metacharacters.
342 # Many Bourne shells cannot handle close brackets correctly
343 # in scan sets, so we specify it separately.
345 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
349 lastarg="$lastarg $arg"
352 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
354 # Add the arguments to base_compile.
355 if test -z "$base_compile"; then
356 base_compile="$lastarg"
358 base_compile="$base_compile $lastarg"
366 # The next one is the -o target name
371 # We got the output file
378 # Accept the current argument as the source file.
382 # Aesthetically quote the previous argument.
384 # Backslashify any backslashes, double quotes, and dollar signs.
385 # These are the only characters that are still specially
386 # interpreted inside of double-quoted scrings.
387 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
389 # Double-quote args containing other shell metacharacters.
390 # Many Bourne shells cannot handle close brackets correctly
391 # in scan sets, so we specify it separately.
393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
394 lastarg="\"$lastarg\""
398 # Add the previous argument to base_compile.
399 if test -z "$base_compile"; then
400 base_compile="$lastarg"
402 base_compile="$base_compile $lastarg"
410 # Get the name of the library object.
411 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
414 $echo "$modename: you must specify a target with \`-o'" 1>&2
419 # Recognize several different file suffixes.
420 # If the user specifies -o file.o, it is replaced with file.lo
435 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
438 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
440 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
445 if test -z "$base_compile"; then
446 $echo "$modename: you must specify a compilation command" 1>&2
451 # Delete any leftover library objects.
452 if test "$build_old_libs" = yes; then
453 removelist="$obj $libobj"
459 trap "$run $rm $removelist; exit 1" 1 2 15
461 # On Cygwin there's no "real" PIC flag so we must build both object types
463 cygwin* | mingw* | pw32* | os2*)
467 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
468 # non-PIC code in shared libraries is not supported
472 # Calculate the filename of the output object if compiler does
473 # not support -o with -c
474 if test "$compiler_c_o" = no; then
475 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
476 lockfile="$output_obj.lock"
477 removelist="$removelist $output_obj $lockfile"
478 trap "$run $rm $removelist; exit 1" 1 2 15
484 # Lock this critical section if it is needed
485 # We use this script file to make the link, it avoids creating a new file
486 if test "$need_locks" = yes; then
487 until $run ln "$0" "$lockfile" 2>/dev/null; do
488 $show "Waiting for $lockfile to be removed"
491 elif test "$need_locks" = warn; then
492 if test -f "$lockfile"; then
494 *** ERROR, $lockfile exists and contains:
495 `cat $lockfile 2>/dev/null`
497 This indicates that another process is trying to use the same
498 temporary object file, and libtool could not work around it because
499 your compiler does not support \`-c' and \`-o' together. If you
500 repeat this compilation, it may succeed, by chance, but you had better
501 avoid parallel builds (make -j) in this platform, or get a better
507 echo $srcfile > "$lockfile"
510 if test -n "$fix_srcfile_path"; then
511 eval srcfile=\"$fix_srcfile_path\"
514 # Only build a PIC object if we are building libtool libraries.
515 if test "$build_libtool_libs" = yes; then
516 # Without this assignment, base_compile gets emptied.
517 fbsd_hideous_sh_bug=$base_compile
519 if test "$pic_mode" != no; then
520 # All platforms use -DPIC, to notify preprocessed assembler code.
521 command="$base_compile $srcfile $pic_flag -DPIC"
523 # Don't build PIC code
524 command="$base_compile $srcfile"
526 if test "$build_old_libs" = yes; then
528 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
529 if test "X$dir" = "X$libobj"; then
534 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
536 if test -d "$dir"; then
543 if test $status -ne 0 && test ! -d $dir; then
548 if test "$compiler_o_lo" = yes; then
550 command="$command -o $output_obj"
551 elif test "$compiler_c_o" = yes; then
553 command="$command -o $output_obj"
556 $run $rm "$output_obj"
558 if $run eval "$command"; then :
560 test -n "$output_obj" && $run $rm $removelist
564 if test "$need_locks" = warn &&
565 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
567 *** ERROR, $lockfile contains:
568 `cat $lockfile 2>/dev/null`
570 but it should contain:
573 This indicates that another process is trying to use the same
574 temporary object file, and libtool could not work around it because
575 your compiler does not support \`-c' and \`-o' together. If you
576 repeat this compilation, it may succeed, by chance, but you had better
577 avoid parallel builds (make -j) in this platform, or get a better
584 # Just move the object if needed, then go on to compile the next one
585 if test x"$output_obj" != x"$libobj"; then
586 $show "$mv $output_obj $libobj"
587 if $run $mv $output_obj $libobj; then :
595 # If we have no pic_flag, then copy the object into place and finish.
596 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
597 test "$build_old_libs" = yes; then
598 # Rename the .lo from within objdir to obj
599 if test -f $obj; then
604 $show "$mv $libobj $obj"
605 if $run $mv $libobj $obj; then :
612 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
613 if test "X$xdir" = "X$obj"; then
618 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
619 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
620 # Now arrange that obj and lo_libobj become the same file
621 $show "(cd $xdir && $LN_S $baseobj $libobj)"
622 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
623 # Unlock the critical section if it was locked
624 if test "$need_locks" != no; then
635 # Allow error messages only from the first compilation.
636 suppress_output=' >/dev/null 2>&1'
639 # Only build a position-dependent object if we build old libraries.
640 if test "$build_old_libs" = yes; then
641 if test "$pic_mode" != yes; then
642 # Don't build PIC code
643 command="$base_compile $srcfile"
645 # All platforms use -DPIC, to notify preprocessed assembler code.
646 command="$base_compile $srcfile $pic_flag -DPIC"
648 if test "$compiler_c_o" = yes; then
649 command="$command -o $obj"
653 # Suppress compiler output if we already did a PIC compilation.
654 command="$command$suppress_output"
655 $run $rm "$output_obj"
657 if $run eval "$command"; then :
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
684 if test x"$output_obj" != x"$obj"; then
685 $show "$mv $output_obj $obj"
686 if $run $mv $output_obj $obj; then :
694 # Create an invalid libtool object if no PIC, so that we do not
695 # accidentally link it into a program.
696 if test "$build_libtool_libs" != yes; then
697 $show "echo timestamp > $libobj"
698 $run eval "echo timestamp > \$libobj" || exit $?
700 # Move the .lo from within objdir
701 $show "$mv $libobj $lo_libobj"
702 if $run $mv $libobj $lo_libobj; then :
711 # Unlock the critical section if it was locked
712 if test "$need_locks" != no; then
721 modename="$modename: link"
723 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
724 # It is impossible to link a dll without this setting, and
725 # we shouldn't force the makefile maintainer to figure out
726 # which system we are compiling for in order to pass an extra
727 # flag for every libtool invokation.
730 # FIXME: Unfortunately, there are problems with the above when trying
731 # to make a dll which has undefined symbols, in which case not
732 # even a static library is built. For now, we need to specify
733 # -no-undefined on the libtool link line when we can be certain
734 # that all symbols are satisfied, otherwise we get a static library.
741 libtool_args="$nonopt"
742 compile_command="$nonopt"
743 finalize_command="$nonopt"
756 lib_search_path=`pwd`
764 export_symbols_regex=
771 prefer_static_libs=no
783 # We need to know -static, to get the right output filenames.
787 -all-static | -static)
788 if test "X$arg" = "X-all-static"; then
789 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
790 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
792 if test -n "$link_static_flag"; then
793 dlopen_self=$dlopen_self_static
796 if test -z "$pic_flag" && test -n "$link_static_flag"; then
797 dlopen_self=$dlopen_self_static
800 build_libtool_libs=no
802 prefer_static_libs=yes
808 # See if our shared archives depend on static archives.
809 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
811 # Go through the arguments, transforming them on the way.
812 while test $# -gt 0; do
816 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
817 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
821 libtool_args="$libtool_args $qarg"
823 # If the previous option needs an argument, assign it.
824 if test -n "$prev"; then
827 compile_command="$compile_command @OUTPUT@"
828 finalize_command="$finalize_command @OUTPUT@"
834 if test "$preload" = no; then
835 # Add the symbol object into the linking commands.
836 compile_command="$compile_command @SYMFILE@"
837 finalize_command="$finalize_command @SYMFILE@"
841 *.la | *.lo) ;; # We handle these cases below.
843 if test "$dlself" = no; then
851 if test "$prev" = dlprefiles; then
853 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
863 if test "$prev" = dlfiles; then
864 dlfiles="$dlfiles $arg"
866 dlprefiles="$dlprefiles $arg"
874 export_symbols="$arg"
875 if test ! -f "$arg"; then
876 $echo "$modename: symbol file \`$arg' does not exist"
883 export_symbols_regex="$arg"
893 # We need an absolute path.
895 [\\/]* | [A-Za-z]:[\\/]*) ;;
897 $echo "$modename: only absolute run-paths are allowed" 1>&2
901 if test "$prev" = rpath; then
904 *) rpath="$rpath $arg" ;;
909 *) xrpath="$xrpath $arg" ;;
916 compiler_flags="$compiler_flags $qarg"
918 compile_command="$compile_command $qarg"
919 finalize_command="$finalize_command $qarg"
923 linker_flags="$linker_flags $qarg"
924 compiler_flags="$compiler_flags $wl$qarg"
926 compile_command="$compile_command $wl$qarg"
927 finalize_command="$finalize_command $wl$qarg"
931 eval "$prev=\"\$arg\""
942 if test -n "$link_static_flag"; then
943 compile_command="$compile_command $link_static_flag"
944 finalize_command="$finalize_command $link_static_flag"
950 # FIXME: remove this flag sometime in the future.
951 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
975 -export-symbols | -export-symbols-regex)
976 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
977 $echo "$modename: more than one -exported-symbols argument is not allowed"
980 if test "X$arg" = "X-export-symbols"; then
988 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
989 # so, if we see these flags be careful not to treat them like -L
991 case $with_gcc/$host in
993 compile_command="$compile_command $arg"
994 finalize_command="$finalize_command $arg"
1001 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1002 # We need an absolute path.
1004 [\\/]* | [A-Za-z]:[\\/]*) ;;
1006 absdir=`cd "$dir" && pwd`
1007 if test -z "$absdir"; then
1008 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1017 deplibs="$deplibs -L$dir"
1018 lib_search_path="$lib_search_path $dir"
1022 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1023 case :$dllsearchpath: in
1025 *) dllsearchpath="$dllsearchpath:$dir";;
1033 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1035 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1036 # These systems don't actually have a C or math library (as such)
1039 *-*-mingw* | *-*-os2*)
1040 # These systems don't actually have a C library (as such)
1041 test "X$arg" = "X-lc" && continue
1044 # Do not include libc due to us having libc/libc_r.
1045 test "X$arg" = "X-lc" && continue
1049 if test "X$arg" = "X-lc_r"; then
1052 # Do not include libc_r directly, use -pthread flag.
1057 deplibs="$deplibs $arg"
1073 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1074 # The PATH hackery in wrapper scripts is required on Windows
1075 # in order for the loader to find any dlls it needs.
1076 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1077 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1080 *) no_install=yes ;;
1108 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1109 # We need an absolute path.
1111 [\\/]* | [A-Za-z]:[\\/]*) ;;
1113 $echo "$modename: only absolute run-paths are allowed" 1>&2
1119 *) xrpath="$xrpath $dir" ;;
1125 # The effects of -static are defined in a previous loop.
1126 # We used to do the same as -all-static on platforms that
1127 # didn't have a PIC flag, but the assumption that the effects
1128 # would be equivalent was wrong. It would break on at least
1129 # Digital Unix and AIX.
1144 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1146 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1147 for flag in $args; do
1150 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1155 compiler_flags="$compiler_flags $flag"
1158 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1162 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1164 IFS="${IFS= }"; save_ifs="$IFS"; IFS=','
1165 for flag in $args; do
1168 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1173 compiler_flags="$compiler_flags $wl$flag"
1174 linker_flags="$linker_flags $flag"
1177 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1190 # Some other compiler flag.
1192 # Unknown arguments in both finalize_command and compile_command need
1193 # to be aesthetically quoted because they are evaled later.
1194 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1196 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1203 # A library or standard object.
1204 if test "$prev" = dlfiles; then
1205 # This file was specified with -dlopen.
1206 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1207 dlfiles="$dlfiles $arg"
1211 # If libtool objects are unsupported, then we need to preload.
1216 if test "$prev" = dlprefiles; then
1217 # Preload the old-style object.
1218 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1222 *.lo) libobjs="$libobjs $arg" ;;
1223 *) objs="$objs $arg" ;;
1230 deplibs="$deplibs $arg"
1231 old_deplibs="$old_deplibs $arg"
1236 # A libtool-controlled library.
1238 if test "$prev" = dlfiles; then
1239 # This library was specified with -dlopen.
1240 dlfiles="$dlfiles $arg"
1242 elif test "$prev" = dlprefiles; then
1243 # The library was specified with -dlpreopen.
1244 dlprefiles="$dlprefiles $arg"
1247 deplibs="$deplibs $arg"
1252 # Some other compiler argument.
1254 # Unknown arguments in both finalize_command and compile_command need
1255 # to be aesthetically quoted because they are evaled later.
1256 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1258 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1265 # Now actually substitute the argument into the commands.
1266 if test -n "$arg"; then
1267 compile_command="$compile_command $arg"
1268 finalize_command="$finalize_command $arg"
1270 done # argument parsing loop
1272 if test -n "$prev"; then
1273 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1278 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1279 eval arg=\"$export_dynamic_flag_spec\"
1280 compile_command="$compile_command $arg"
1281 finalize_command="$finalize_command $arg"
1284 # calculate the name of the file, without its directory
1285 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1286 libobjs_save="$libobjs"
1288 if test -n "$shlibpath_var"; then
1289 # get the directories listed in $shlibpath_var
1290 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1294 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1295 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1297 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1298 if test "X$output_objdir" = "X$output"; then
1299 output_objdir="$objdir"
1301 output_objdir="$output_objdir/$objdir"
1303 # Create the object directory.
1304 if test ! -d $output_objdir; then
1305 $show "$mkdir $output_objdir"
1306 $run $mkdir $output_objdir
1308 if test $status -ne 0 && test ! -d $output_objdir; then
1313 # Determine the type of output
1316 $echo "$modename: you must specify an output file" 1>&2
1320 *.$libext) linkmode=oldlib ;;
1321 *.lo | *.$objext) linkmode=obj ;;
1322 *.la) linkmode=lib ;;
1323 *) linkmode=prog ;; # Anything else should be a program.
1328 # Find all interdependent deplibs by searching for libraries
1329 # that are linked more than once (e.g. -la -lb -la)
1330 for deplib in $deplibs; do
1332 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1334 libs="$libs $deplib"
1339 need_relink=no # whether we're linking any uninstalled libtool libraries
1340 notinst_deplibs= # not-installed libtool libraries
1341 notinst_path= # paths that contain not-installed libtool libraries
1345 for file in $dlfiles $dlprefiles; do
1349 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1361 passes="conv scan dlopen dlpreopen link"
1366 for pass in $passes; do
1367 if test $linkmode = prog; then
1368 # Determine which files to process
1372 save_deplibs="$deplibs" # Collect dlpreopened libraries
1375 dlpreopen) libs="$dlprefiles" ;;
1376 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1379 for deplib in $libs; do
1384 if test $linkmode = oldlib && test $linkmode = obj; then
1385 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1388 if test $pass = conv; then
1389 deplibs="$deplib $deplibs"
1392 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1393 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1394 # Search the libtool library
1395 lib="$searchdir/lib${name}.la"
1396 if test -f "$lib"; then
1401 if test "$found" != yes; then
1402 # deplib doesn't seem to be a libtool library
1403 if test "$linkmode,$pass" = "prog,link"; then
1404 compile_deplibs="$deplib $compile_deplibs"
1405 finalize_deplibs="$deplib $finalize_deplibs"
1407 deplibs="$deplib $deplibs"
1408 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1416 deplibs="$deplib $deplibs"
1417 test $pass = conv && continue
1418 newdependency_libs="$deplib $newdependency_libs"
1419 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1422 if test $pass = conv; then
1423 deplibs="$deplib $deplibs"
1426 if test $pass = scan; then
1427 deplibs="$deplib $deplibs"
1428 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1430 compile_deplibs="$deplib $compile_deplibs"
1431 finalize_deplibs="$deplib $finalize_deplibs"
1435 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1441 if test $pass = link; then
1442 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1443 # Make sure the xrpath contains only unique directories.
1446 *) xrpath="$xrpath $dir" ;;
1449 deplibs="$deplib $deplibs"
1452 *.la) lib="$deplib" ;;
1454 if test $pass = conv; then
1455 deplibs="$deplib $deplibs"
1460 if test "$deplibs_check_method" != pass_all; then
1462 echo "*** Warning: This library needs some functionality provided by $deplib."
1463 echo "*** I have the capability to make that library automatically link in when"
1464 echo "*** you link to this library. But I can only do this if you have a"
1465 echo "*** shared version of the library, which you do not appear to have."
1468 echo "*** Warning: Linking the shared library $output against the"
1469 echo "*** static library $deplib is not portable!"
1470 deplibs="$deplib $deplibs"
1475 if test $pass != link; then
1476 deplibs="$deplib $deplibs"
1478 compile_deplibs="$deplib $compile_deplibs"
1479 finalize_deplibs="$deplib $finalize_deplibs"
1486 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1487 # If there is no dlopen support or we're linking statically,
1488 # we need to preload.
1489 newdlprefiles="$newdlprefiles $deplib"
1490 compile_deplibs="$deplib $compile_deplibs"
1491 finalize_deplibs="$deplib $finalize_deplibs"
1493 newdlfiles="$newdlfiles $deplib"
1502 if test $found = yes || test -f "$lib"; then :
1504 $echo "$modename: cannot find the library \`$lib'" 1>&2
1508 # Check to see that this really is a libtool archive.
1509 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1511 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1515 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1516 test "X$ladir" = "X$lib" && ladir="."
1524 # If the library was installed with an old release of libtool,
1525 # it will not redefine variable installed.
1530 */* | *\\*) . $lib ;;
1534 if test "$linkmode,$pass" = "lib,link" ||
1535 test "$linkmode,$pass" = "prog,scan" ||
1536 { test $linkmode = oldlib && test $linkmode = obj; }; then
1537 # Add dl[pre]opened files of deplib
1538 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1539 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1542 if test $pass = conv; then
1543 # Only check for convenience libraries
1544 deplibs="$lib $deplibs"
1545 if test -z "$libdir"; then
1546 if test -z "$old_library"; then
1547 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1550 # It is a libtool convenience library, so add in its objects.
1551 convenience="$convenience $ladir/$objdir/$old_library"
1552 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1554 for deplib in $dependency_libs; do
1555 deplibs="$deplib $deplibs"
1556 case "$tmp_libs " in
1557 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1559 tmp_libs="$tmp_libs $deplib"
1561 elif test $linkmode != prog && test $linkmode != lib; then
1562 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1568 # Get the name of the library we link against.
1570 for l in $old_library $library_names; do
1573 if test -z "$linklib"; then
1574 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1578 # This library was specified with -dlopen.
1579 if test $pass = dlopen; then
1580 if test -z "$libdir"; then
1581 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1584 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1585 # If there is no dlname, no dlopen support or we're linking
1586 # statically, we need to preload.
1587 dlprefiles="$dlprefiles $lib"
1589 newdlfiles="$newdlfiles $lib"
1594 # We need an absolute path.
1596 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1598 abs_ladir=`cd "$ladir" && pwd`
1599 if test -z "$abs_ladir"; then
1600 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1601 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1606 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1608 # Find the relevant object directory and library name.
1609 if test "X$installed" = Xyes; then
1610 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1611 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1620 dir="$ladir/$objdir"
1621 absdir="$abs_ladir/$objdir"
1622 # Remove this search path later
1623 notinst_path="$notinst_path $abs_ladir"
1624 fi # $installed = yes
1625 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1627 # This library was specified with -dlpreopen.
1628 if test $pass = dlpreopen; then
1629 if test -z "$libdir"; then
1630 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1633 # Prefer using a static library (so that no silly _DYNAMIC symbols
1634 # are required to link).
1635 if test -n "$old_library"; then
1636 newdlprefiles="$newdlprefiles $dir/$old_library"
1637 # Otherwise, use the dlname, so that lt_dlopen finds it.
1638 elif test -n "$dlname"; then
1639 newdlprefiles="$newdlprefiles $dir/$dlname"
1641 newdlprefiles="$newdlprefiles $dir/$linklib"
1643 fi # $pass = dlpreopen
1645 if test -z "$libdir"; then
1646 # Link the convenience library
1647 if test $linkmode = lib; then
1648 deplibs="$dir/$old_library $deplibs"
1649 elif test "$linkmode,$pass" = "prog,link"; then
1650 compile_deplibs="$dir/$old_library $compile_deplibs"
1651 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1653 deplibs="$lib $deplibs"
1658 if test $linkmode = prog && test $pass != link; then
1659 newlib_search_path="$newlib_search_path $ladir"
1660 deplibs="$lib $deplibs"
1663 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1664 test "$build_libtool_libs" = no; then
1669 for deplib in $dependency_libs; do
1671 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1673 # Need to link against all dependency_libs?
1674 if test $linkalldeplibs = yes; then
1675 deplibs="$deplib $deplibs"
1677 # Need to hardcode shared library paths
1678 # or/and link against static libraries
1679 newdependency_libs="$deplib $newdependency_libs"
1681 case "$tmp_libs " in
1682 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1684 tmp_libs="$tmp_libs $deplib"
1687 fi # $linkmode = prog...
1689 link_static=no # Whether the deplib will be linked statically
1690 if test -n "$library_names" &&
1691 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1692 # Link against this shared library
1694 if test "$linkmode,$pass" = "prog,link" ||
1695 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1696 # Hardcode the library path.
1697 # Skip directories that are in the system default run-time
1699 case " $sys_lib_dlsearch_path " in
1702 case "$compile_rpath " in
1704 *) compile_rpath="$compile_rpath $absdir"
1708 case " $sys_lib_dlsearch_path " in
1711 case "$finalize_rpath " in
1713 *) finalize_rpath="$finalize_rpath $libdir"
1717 if test $linkmode = prog; then
1718 # We need to hardcode the library path
1719 if test -n "$shlibpath_var"; then
1720 # Make sure the rpath contains only unique directories.
1721 case "$temp_rpath " in
1724 *) temp_rpath="$temp_rpath $dir" ;;
1728 fi # $linkmode,$pass = prog,link...
1730 if test "$alldeplibs" = yes &&
1731 { test "$deplibs_check_method" = pass_all ||
1732 { test "$build_libtool_libs" = yes &&
1733 test -n "$library_names"; }; }; then
1734 # We only need to search for static libraries
1738 if test "$installed" = no; then
1739 notinst_deplibs="$notinst_deplibs $lib"
1743 if test -n "$old_archive_from_expsyms_cmds"; then
1744 # figure out the soname
1745 set dummy $library_names
1748 libname=`eval \\$echo \"$libname_spec\"`
1749 # use dlname if we got it. it's perfectly good, no?
1750 if test -n "$dlname"; then
1752 elif test -n "$soname_spec"; then
1756 major=`expr $current - $age`
1760 eval soname=\"$soname_spec\"
1765 # Make a new name for the extract_expsyms_cmds to use
1767 soname=`echo $soroot | sed -e 's/^.*\///'`
1768 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1770 # If the library has no export list, then create one now
1771 if test -f "$output_objdir/$soname-def"; then :
1773 $show "extracting exported symbol list from \`$soname'"
1774 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1775 eval cmds=\"$extract_expsyms_cmds\"
1776 for cmd in $cmds; do
1779 $run eval "$cmd" || exit $?
1785 if test -f "$output_objdir/$newlib"; then :; else
1786 $show "generating import library for \`$soname'"
1787 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
1788 eval cmds=\"$old_archive_from_expsyms_cmds\"
1789 for cmd in $cmds; do
1792 $run eval "$cmd" || exit $?
1796 # make sure the library variables are pointing to the new library
1799 fi # test -n $old_archive_from_expsyms_cmds
1801 if test $linkmode = prog || test "$mode" != relink; then
1806 case $hardcode_action in
1807 immediate | unsupported)
1808 if test "$hardcode_direct" = no; then
1810 elif test "$hardcode_minus_L" = no; then
1812 *-*-sunos*) add_shlibpath="$dir" ;;
1816 elif test "$hardcode_shlibpath_var" = no; then
1817 add_shlibpath="$dir"
1824 if test "$hardcode_direct" = yes; then
1826 elif test "$hardcode_minus_L" = yes; then
1829 elif test "$hardcode_shlibpath_var" = yes; then
1830 add_shlibpath="$dir"
1839 if test "$lib_linked" != yes; then
1840 $echo "$modename: configuration error: unsupported hardcode properties"
1844 if test -n "$add_shlibpath"; then
1845 case :$compile_shlibpath: in
1846 *":$add_shlibpath:"*) ;;
1847 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1850 if test $linkmode = prog; then
1851 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1852 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1854 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1855 test -n "$add" && deplibs="$add $deplibs"
1856 if test "$hardcode_direct" != yes && \
1857 test "$hardcode_minus_L" != yes && \
1858 test "$hardcode_shlibpath_var" = yes; then
1859 case :$finalize_shlibpath: in
1861 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1867 if test $linkmode = prog || test "$mode" = relink; then
1871 # Finalize command for both is simple: just hardcode it.
1872 if test "$hardcode_direct" = yes; then
1873 add="$libdir/$linklib"
1874 elif test "$hardcode_minus_L" = yes; then
1877 elif test "$hardcode_shlibpath_var" = yes; then
1878 case :$finalize_shlibpath: in
1880 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1884 # We cannot seem to hardcode it, guess we'll fake it.
1889 if test $linkmode = prog; then
1890 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1891 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1893 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1894 test -n "$add" && deplibs="$add $deplibs"
1897 elif test $linkmode = prog; then
1898 if test "$alldeplibs" = yes &&
1899 { test "$deplibs_check_method" = pass_all ||
1900 { test "$build_libtool_libs" = yes &&
1901 test -n "$library_names"; }; }; then
1902 # We only need to search for static libraries
1906 # Try to link the static library
1907 # Here we assume that one of hardcode_direct or hardcode_minus_L
1908 # is not unsupported. This is valid on all known static and
1910 if test "$hardcode_direct" != unsupported; then
1911 test -n "$old_library" && linklib="$old_library"
1912 compile_deplibs="$dir/$linklib $compile_deplibs"
1913 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1915 compile_deplibs="-l$name -L$dir $compile_deplibs"
1916 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1918 elif test "$build_libtool_libs" = yes; then
1919 # Not a shared library
1920 if test "$deplibs_check_method" != pass_all; then
1921 # We're trying link a shared library against a static one
1922 # but the system doesn't support it.
1924 # Just print a warning and add the library to dependency_libs so
1925 # that the program can be linked against the static library.
1927 echo "*** Warning: This library needs some functionality provided by $lib."
1928 echo "*** I have the capability to make that library automatically link in when"
1929 echo "*** you link to this library. But I can only do this if you have a"
1930 echo "*** shared version of the library, which you do not appear to have."
1931 if test "$module" = yes; then
1932 echo "*** Therefore, libtool will create a static module, that should work "
1933 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1934 if test -z "$global_symbol_pipe"; then
1936 echo "*** However, this would only work if libtool was able to extract symbol"
1937 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1938 echo "*** not find such a program. So, this module is probably useless."
1939 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1941 if test "$build_old_libs" = no; then
1942 build_libtool_libs=module
1945 build_libtool_libs=no
1949 convenience="$convenience $dir/$old_library"
1950 old_convenience="$old_convenience $dir/$old_library"
1951 deplibs="$dir/$old_library $deplibs"
1954 fi # link shared/static library?
1956 if test $linkmode = lib; then
1957 if test -n "$dependency_libs" &&
1958 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1959 test $link_static = yes; }; then
1960 # Extract -R from dependency_libs
1962 for libdir in $dependency_libs; do
1964 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1966 *" $temp_xrpath "*) ;;
1967 *) xrpath="$xrpath $temp_xrpath";;
1969 *) temp_deplibs="$temp_deplibs $libdir";;
1972 dependency_libs="$temp_deplibs"
1975 newlib_search_path="$newlib_search_path $absdir"
1976 # Link against this library
1977 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1978 # ... and its dependency_libs
1980 for deplib in $dependency_libs; do
1981 newdependency_libs="$deplib $newdependency_libs"
1982 case "$tmp_libs " in
1983 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1985 tmp_libs="$tmp_libs $deplib"
1988 if test $link_all_deplibs != no; then
1989 # Add the search paths of all dependency libraries
1990 for deplib in $dependency_libs; do
1992 -L*) path="$deplib" ;;
1994 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
1995 test "X$dir" = "X$deplib" && dir="."
1996 # We need an absolute path.
1998 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2000 absdir=`cd "$dir" && pwd`
2001 if test -z "$absdir"; then
2002 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2007 if grep "^installed=no" $deplib > /dev/null; then
2008 path="-L$absdir/$objdir"
2010 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2011 if test -z "$libdir"; then
2012 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2015 if test "$absdir" != "$libdir"; then
2016 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2023 case " $deplibs " in
2025 *) deplibs="$deplibs $path" ;;
2028 fi # link_all_deplibs != no
2030 done # for deplib in $libs
2031 if test $pass = dlpreopen; then
2032 # Link the dlpreopened libraries before other libraries
2033 for deplib in $save_deplibs; do
2034 deplibs="$deplib $deplibs"
2037 if test $pass != dlopen; then
2038 test $pass != scan && dependency_libs="$newdependency_libs"
2039 if test $pass != conv; then
2040 # Make sure lib_search_path contains only unique directories.
2042 for dir in $newlib_search_path; do
2043 case "$lib_search_path " in
2045 *) lib_search_path="$lib_search_path $dir" ;;
2051 if test "$linkmode,$pass" != "prog,link"; then
2054 vars="compile_deplibs finalize_deplibs"
2056 for var in $vars dependency_libs; do
2057 # Add libraries to $var in reverse order
2058 eval tmp_libs=\"\$$var\"
2060 for deplib in $tmp_libs; do
2062 -L*) new_libs="$deplib $new_libs" ;;
2064 case " $specialdeplibs " in
2065 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2067 case " $new_libs " in
2069 *) new_libs="$deplib $new_libs" ;;
2077 for deplib in $new_libs; do
2080 case " $tmp_libs " in
2082 *) tmp_libs="$tmp_libs $deplib" ;;
2085 *) tmp_libs="$tmp_libs $deplib" ;;
2088 eval $var=\"$tmp_libs\"
2091 if test "$pass" = "conv" &&
2092 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2093 libs="$deplibs" # reset libs
2097 if test $linkmode = prog; then
2098 dlfiles="$newdlfiles"
2099 dlprefiles="$newdlprefiles"
2104 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2105 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2108 if test -n "$rpath"; then
2109 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2112 if test -n "$xrpath"; then
2113 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2116 if test -n "$vinfo"; then
2117 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2120 if test -n "$release"; then
2121 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2124 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2125 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2128 # Now set the variables for building old libraries.
2129 build_libtool_libs=no
2131 objs="$objs$old_deplibs"
2135 # Make sure we only generate libraries of the form `libNAME.la'.
2138 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2139 eval libname=\"$libname_spec\"
2142 if test "$module" = no; then
2143 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2147 if test "$need_lib_prefix" != no; then
2148 # Add the "lib" prefix for modules if required
2149 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2150 eval libname=\"$libname_spec\"
2152 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2157 if test -n "$objs"; then
2158 if test "$deplibs_check_method" != pass_all; then
2159 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2163 echo "*** Warning: Linking the shared library $output against the non-libtool"
2164 echo "*** objects $objs is not portable!"
2165 libobjs="$libobjs $objs"
2169 if test "$dlself" != no; then
2170 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2174 if test $# -gt 2; then
2175 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2180 if test -z "$rpath"; then
2181 if test "$build_libtool_libs" = yes; then
2182 # Building a libtool convenience library.
2184 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2185 build_libtool_libs=convenience
2189 if test -n "$vinfo"; then
2190 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2193 if test -n "$release"; then
2194 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2198 # Parse the version information argument.
2199 IFS="${IFS= }"; save_ifs="$IFS"; IFS=':'
2200 set dummy $vinfo 0 0 0
2203 if test -n "$8"; then
2204 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2213 # Check that each of the things are valid numbers.
2215 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2217 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2218 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2224 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2226 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2227 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2233 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2235 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2236 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2241 if test $age -gt $current; then
2242 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2243 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2247 # Calculate the version variables.
2251 case $version_type in
2255 # Like Linux, but with the current version available in
2256 # verstring for coding it into the library header
2257 major=.`expr $current - $age`
2258 versuffix="$major.$age.$revision"
2259 # Darwin ld doesn't like 0 for these options...
2260 minor_current=`expr $current + 1`
2261 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2266 versuffix=".$current.$revision";
2271 versuffix=".$current";
2275 major=`expr $current - $age + 1`
2276 verstring="sgi$major.$revision"
2278 # Add in all the interfaces that we are compatible with.
2280 while test $loop != 0; do
2281 iface=`expr $revision - $loop`
2282 loop=`expr $loop - 1`
2283 verstring="sgi$major.$iface:$verstring"
2286 # Before this point, $major must not contain `.'.
2288 versuffix="$major.$revision"
2292 major=.`expr $current - $age`
2293 versuffix="$major.$age.$revision"
2297 major=`expr $current - $age`
2298 versuffix=".$current.$age.$revision"
2299 verstring="$current.$age.$revision"
2301 # Add in all the interfaces that we are compatible with.
2303 while test $loop != 0; do
2304 iface=`expr $current - $loop`
2305 loop=`expr $loop - 1`
2306 verstring="$verstring:${iface}.0"
2309 # Make executables depend on our current version.
2310 verstring="$verstring:${current}.0"
2315 versuffix=".$current.$revision"
2319 # Use '-' rather than '.', since we only want one
2320 # extension on DOS 8.3 filesystems.
2321 major=`expr $current - $age`
2326 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2327 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2332 # Clear the version info if we defaulted, and they specified a release.
2333 if test -z "$vinfo" && test -n "$release"; then
2336 case $version_type in
2338 # we can't check for "0.0" in archive_cmds due to quoting
2339 # problems, so we reset it completely
2346 if test "$need_version" = no; then
2353 # Remove version info from name if versioning should be avoided
2354 if test "$avoid_version" = yes && test "$need_version" = no; then
2360 # Check to see if the archive will have undefined symbols.
2361 if test "$allow_undefined" = yes; then
2362 if test "$allow_undefined_flag" = unsupported; then
2363 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2364 build_libtool_libs=no
2368 # Don't allow undefined symbols.
2369 allow_undefined_flag="$no_undefined_flag"
2373 if test "$mode" != relink; then
2374 # Remove our outputs.
2375 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2376 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2379 # Now set the variables for building old libraries.
2380 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2381 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2383 # Transform .lo files to .o files.
2384 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2387 # Eliminate all temporary directories.
2388 for path in $notinst_path; do
2389 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2390 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2391 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2394 if test -n "$xrpath"; then
2395 # If the user specified any rpath flags, then add them.
2397 for libdir in $xrpath; do
2398 temp_xrpath="$temp_xrpath -R$libdir"
2399 case "$finalize_rpath " in
2401 *) finalize_rpath="$finalize_rpath $libdir" ;;
2404 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2405 dependency_libs="$temp_xrpath $dependency_libs"
2409 # Make sure dlfiles contains only unique files that won't be dlpreopened
2410 old_dlfiles="$dlfiles"
2412 for lib in $old_dlfiles; do
2413 case " $dlprefiles $dlfiles " in
2415 *) dlfiles="$dlfiles $lib" ;;
2419 # Make sure dlprefiles contains only unique files
2420 old_dlprefiles="$dlprefiles"
2422 for lib in $old_dlprefiles; do
2423 case "$dlprefiles " in
2425 *) dlprefiles="$dlprefiles $lib" ;;
2429 if test "$build_libtool_libs" = yes; then
2430 if test -n "$rpath"; then
2432 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2433 # these systems don't actually have a c library (as such)!
2435 *-*-rhapsody* | *-*-darwin1.[012])
2436 # Rhapsody C library is in the System framework
2437 deplibs="$deplibs -framework System"
2440 # Don't link with libc until the a.out ld.so is fixed.
2443 # Do not include libc due to us having libc/libc_r.
2446 # Add libc to deplibs on all other systems if necessary.
2447 if test $build_libtool_need_lc = "yes"; then
2448 deplibs="$deplibs -lc"
2454 # Transform deplibs into only deplibs that can be linked in shared.
2456 libname_save=$libname
2457 release_save=$release
2458 versuffix_save=$versuffix
2460 # I'm not sure if I'm treating the release correctly. I think
2461 # release should show up in the -l (ie -lgmp5) so we don't want to
2462 # add it in twice. Is that correct?
2468 case $deplibs_check_method in
2470 # Don't check for shared/static. Everything works.
2471 # This might be a little naive. We might want to check
2472 # whether the library exists or not. But this is on
2473 # osf3 & osf4 and I'm not really sure... Just
2474 # implementing what was already the behaviour.
2478 # This code stresses the "libraries are programs" paradigm to its
2479 # limits. Maybe even breaks it. We compile a program, linking it
2480 # against the deplibs as a proxy for the library. Then we can check
2481 # whether they linked in statically or dynamically with ldd.
2483 cat > conftest.c <<EOF
2484 int main() { return 0; }
2487 $CC -o conftest conftest.c $deplibs
2488 if test $? -eq 0 ; then
2489 ldd_output=`ldd conftest`
2490 for i in $deplibs; do
2491 name="`expr $i : '-l\(.*\)'`"
2492 # If $name is empty we are operating on a -L argument.
2493 if test -n "$name" && test "$name" != "0"; then
2494 libname=`eval \\$echo \"$libname_spec\"`
2495 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2496 set dummy $deplib_matches
2498 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2499 newdeplibs="$newdeplibs $i"
2503 echo "*** Warning: This library needs some functionality provided by $i."
2504 echo "*** I have the capability to make that library automatically link in when"
2505 echo "*** you link to this library. But I can only do this if you have a"
2506 echo "*** shared version of the library, which you do not appear to have."
2509 newdeplibs="$newdeplibs $i"
2513 # Error occured in the first compile. Let's try to salvage the situation:
2514 # Compile a seperate program for each library.
2515 for i in $deplibs; do
2516 name="`expr $i : '-l\(.*\)'`"
2517 # If $name is empty we are operating on a -L argument.
2518 if test -n "$name" && test "$name" != "0"; then
2520 $CC -o conftest conftest.c $i
2522 if test $? -eq 0 ; then
2523 ldd_output=`ldd conftest`
2524 libname=`eval \\$echo \"$libname_spec\"`
2525 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2526 set dummy $deplib_matches
2528 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2529 newdeplibs="$newdeplibs $i"
2533 echo "*** Warning: This library needs some functionality provided by $i."
2534 echo "*** I have the capability to make that library automatically link in when"
2535 echo "*** you link to this library. But I can only do this if you have a"
2536 echo "*** shared version of the library, which you do not appear to have."
2541 echo "*** Warning! Library $i is needed by this library but I was not able to"
2542 echo "*** make it link in! You will probably need to install it or some"
2543 echo "*** library that it depends on before this library will be fully"
2544 echo "*** functional. Installing it before continuing would be even better."
2547 newdeplibs="$newdeplibs $i"
2553 set dummy $deplibs_check_method
2554 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2555 for a_deplib in $deplibs; do
2556 name="`expr $a_deplib : '-l\(.*\)'`"
2557 # If $name is empty we are operating on a -L argument.
2558 if test -n "$name" && test "$name" != "0"; then
2559 libname=`eval \\$echo \"$libname_spec\"`
2560 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2561 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2562 for potent_lib in $potential_libs; do
2563 # Follow soft links.
2564 if ls -lLd "$potent_lib" 2>/dev/null \
2565 | grep " -> " >/dev/null; then
2568 # The statement above tries to avoid entering an
2569 # endless loop below, in case of cyclic links.
2570 # We might still enter an endless loop, since a link
2571 # loop can be closed while we follow links,
2573 potlib="$potent_lib"
2574 while test -h "$potlib" 2>/dev/null; do
2575 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2577 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2578 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2581 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2583 | egrep "$file_magic_regex" > /dev/null; then
2584 newdeplibs="$newdeplibs $a_deplib"
2590 if test -n "$a_deplib" ; then
2593 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2594 echo "*** I have the capability to make that library automatically link in when"
2595 echo "*** you link to this library. But I can only do this if you have a"
2596 echo "*** shared version of the library, which you do not appear to have."
2599 # Add a -L argument.
2600 newdeplibs="$newdeplibs $a_deplib"
2602 done # Gone through all deplibs.
2605 set dummy $deplibs_check_method
2606 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2607 for a_deplib in $deplibs; do
2608 name="`expr $a_deplib : '-l\(.*\)'`"
2609 # If $name is empty we are operating on a -L argument.
2610 if test -n "$name" && test "$name" != "0"; then
2611 libname=`eval \\$echo \"$libname_spec\"`
2612 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2613 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2614 for potent_lib in $potential_libs; do
2615 if eval echo \"$potent_lib\" 2>/dev/null \
2617 | egrep "$match_pattern_regex" > /dev/null; then
2618 newdeplibs="$newdeplibs $a_deplib"
2624 if test -n "$a_deplib" ; then
2627 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2628 echo "*** I have the capability to make that library automatically link in when"
2629 echo "*** you link to this library. But I can only do this if you have a"
2630 echo "*** shared version of the library, which you do not appear to have."
2633 # Add a -L argument.
2634 newdeplibs="$newdeplibs $a_deplib"
2636 done # Gone through all deplibs.
2640 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2641 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2642 grep . >/dev/null; then
2644 if test "X$deplibs_check_method" = "Xnone"; then
2645 echo "*** Warning: inter-library dependencies are not supported in this platform."
2647 echo "*** Warning: inter-library dependencies are not known to be supported."
2649 echo "*** All declared inter-library dependencies are being dropped."
2654 versuffix=$versuffix_save
2656 release=$release_save
2657 libname=$libname_save
2661 *-*-rhapsody* | *-*-darwin1.[012])
2662 # On Rhapsody replace the C library is the System framework
2663 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2667 if test "$droppeddeps" = yes; then
2668 if test "$module" = yes; then
2670 echo "*** Warning: libtool could not satisfy all declared inter-library"
2671 echo "*** dependencies of module $libname. Therefore, libtool will create"
2672 echo "*** a static module, that should work as long as the dlopening"
2673 echo "*** application is linked with the -dlopen flag."
2674 if test -z "$global_symbol_pipe"; then
2676 echo "*** However, this would only work if libtool was able to extract symbol"
2677 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2678 echo "*** not find such a program. So, this module is probably useless."
2679 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2681 if test "$build_old_libs" = no; then
2682 oldlibs="$output_objdir/$libname.$libext"
2683 build_libtool_libs=module
2686 build_libtool_libs=no
2689 echo "*** The inter-library dependencies that have been dropped here will be"
2690 echo "*** automatically added whenever a program is linked with this library"
2691 echo "*** or is declared to -dlopen it."
2693 if test $allow_undefined = no; then
2695 echo "*** Since this library must not contain undefined symbols,"
2696 echo "*** because either the platform does not support them or"
2697 echo "*** it was explicitly requested with -no-undefined,"
2698 echo "*** libtool will only create a static version of it."
2699 if test "$build_old_libs" = no; then
2700 oldlibs="$output_objdir/$libname.$libext"
2701 build_libtool_libs=module
2704 build_libtool_libs=no
2709 # Done checking deplibs!
2713 # All the library-specific variables (install_libdir is set above).
2718 # Test again, we may have decided not to build it any more
2719 if test "$build_libtool_libs" = yes; then
2720 if test $hardcode_into_libs = yes; then
2721 # Hardcode the library paths
2724 rpath="$finalize_rpath"
2725 test "$mode" != relink && rpath="$compile_rpath$rpath"
2726 for libdir in $rpath; do
2727 if test -n "$hardcode_libdir_flag_spec"; then
2728 if test -n "$hardcode_libdir_separator"; then
2729 if test -z "$hardcode_libdirs"; then
2730 hardcode_libdirs="$libdir"
2732 # Just accumulate the unique libdirs.
2733 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2734 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2737 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2742 eval flag=\"$hardcode_libdir_flag_spec\"
2743 dep_rpath="$dep_rpath $flag"
2745 elif test -n "$runpath_var"; then
2746 case "$perm_rpath " in
2748 *) perm_rpath="$perm_rpath $libdir" ;;
2752 # Substitute the hardcoded libdirs into the rpath.
2753 if test -n "$hardcode_libdir_separator" &&
2754 test -n "$hardcode_libdirs"; then
2755 libdir="$hardcode_libdirs"
2756 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2758 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2759 # We should set the runpath_var.
2761 for dir in $perm_rpath; do
2764 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2766 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2769 shlibpath="$finalize_shlibpath"
2770 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2771 if test -n "$shlibpath"; then
2772 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2775 # Get the real and link names of the library.
2776 eval library_names=\"$library_names_spec\"
2777 set dummy $library_names
2781 if test -n "$soname_spec"; then
2782 eval soname=\"$soname_spec\"
2786 test -z "$dlname" && dlname=$soname
2788 lib="$output_objdir/$realname"
2791 linknames="$linknames $link"
2794 # Ensure that we have .o objects for linkers which dislike .lo
2795 # (e.g. aix) in case we are running --disable-static
2796 for obj in $libobjs; do
2797 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2798 if test "X$xdir" = "X$obj"; then
2803 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2804 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2805 if test ! -f $xdir/$oldobj; then
2806 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2807 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2811 # Use standard objects if they are pic
2812 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2814 # Prepare the list of exported symbols
2815 if test -z "$export_symbols"; then
2816 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2817 $show "generating symbol list for \`$libname.la'"
2818 export_symbols="$output_objdir/$libname.exp"
2819 $run $rm $export_symbols
2820 eval cmds=\"$export_symbols_cmds\"
2821 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2822 for cmd in $cmds; do
2825 $run eval "$cmd" || exit $?
2828 if test -n "$export_symbols_regex"; then
2829 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2830 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2831 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2832 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2837 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2838 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2841 if test -n "$convenience"; then
2842 if test -n "$whole_archive_flag_spec"; then
2843 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2845 gentop="$output_objdir/${outputname}x"
2846 $show "${rm}r $gentop"
2847 $run ${rm}r "$gentop"
2848 $show "mkdir $gentop"
2849 $run mkdir "$gentop"
2851 if test $status -ne 0 && test ! -d "$gentop"; then
2854 generated="$generated $gentop"
2856 for xlib in $convenience; do
2857 # Extract the objects.
2859 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2860 *) xabs=`pwd`"/$xlib" ;;
2862 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2863 xdir="$gentop/$xlib"
2865 $show "${rm}r $xdir"
2870 if test $status -ne 0 && test ! -d "$xdir"; then
2873 $show "(cd $xdir && $AR x $xabs)"
2874 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2876 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2881 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2882 eval flag=\"$thread_safe_flag_spec\"
2883 linker_flags="$linker_flags $flag"
2886 # Make a backup of the uninstalled library when relinking
2887 if test "$mode" = relink; then
2888 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2891 # Do each of the archive commands.
2892 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2893 eval cmds=\"$archive_expsym_cmds\"
2895 eval cmds=\"$archive_cmds\"
2897 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2898 for cmd in $cmds; do
2901 $run eval "$cmd" || exit $?
2905 # Restore the uninstalled library and exit
2906 if test "$mode" = relink; then
2907 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2911 # Create links to the real library.
2912 for linkname in $linknames; do
2913 if test "$realname" != "$linkname"; then
2914 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2915 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2919 # If -module or -export-dynamic was specified, set the dlname.
2920 if test "$module" = yes || test "$export_dynamic" = yes; then
2921 # On all known operating systems, these are identical.
2928 if test -n "$deplibs"; then
2929 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2932 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2933 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2936 if test -n "$rpath"; then
2937 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2940 if test -n "$xrpath"; then
2941 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2944 if test -n "$vinfo"; then
2945 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2948 if test -n "$release"; then
2949 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2954 if test -n "$objs$old_deplibs"; then
2955 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2959 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2967 # Delete the old objects.
2968 $run $rm $obj $libobj
2970 # Objects from convenience libraries. This assumes
2971 # single-version convenience libraries. Whenever we create
2972 # different ones for PIC/non-PIC, this we'll have to duplicate
2976 # reload_cmds runs $LD directly, so let us get rid of
2977 # -Wl from whole_archive_flag_spec
2980 if test -n "$convenience"; then
2981 if test -n "$whole_archive_flag_spec"; then
2982 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2984 gentop="$output_objdir/${obj}x"
2985 $show "${rm}r $gentop"
2986 $run ${rm}r "$gentop"
2987 $show "mkdir $gentop"
2988 $run mkdir "$gentop"
2990 if test $status -ne 0 && test ! -d "$gentop"; then
2993 generated="$generated $gentop"
2995 for xlib in $convenience; do
2996 # Extract the objects.
2998 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2999 *) xabs=`pwd`"/$xlib" ;;
3001 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3002 xdir="$gentop/$xlib"
3004 $show "${rm}r $xdir"
3009 if test $status -ne 0 && test ! -d "$xdir"; then
3012 $show "(cd $xdir && $AR x $xabs)"
3013 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3015 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3020 # Create the old-style object.
3021 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
3024 eval cmds=\"$reload_cmds\"
3025 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3026 for cmd in $cmds; do
3029 $run eval "$cmd" || exit $?
3033 # Exit if we aren't doing a library object file.
3034 if test -z "$libobj"; then
3035 if test -n "$gentop"; then
3036 $show "${rm}r $gentop"
3043 if test "$build_libtool_libs" != yes; then
3044 if test -n "$gentop"; then
3045 $show "${rm}r $gentop"
3049 # Create an invalid libtool object if no PIC, so that we don't
3050 # accidentally link it into a program.
3051 $show "echo timestamp > $libobj"
3052 $run eval "echo timestamp > $libobj" || exit $?
3056 if test -n "$pic_flag" || test "$pic_mode" != default; then
3057 # Only do commands if we really have different PIC objects.
3058 reload_objs="$libobjs $reload_conv_objs"
3060 eval cmds=\"$reload_cmds\"
3061 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3062 for cmd in $cmds; do
3065 $run eval "$cmd" || exit $?
3069 # Just create a symlink.
3072 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3073 if test "X$xdir" = "X$libobj"; then
3078 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3079 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3080 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3081 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3084 if test -n "$gentop"; then
3085 $show "${rm}r $gentop"
3094 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3096 if test -n "$vinfo"; then
3097 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3100 if test -n "$release"; then
3101 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3104 if test "$preload" = yes; then
3105 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3106 test "$dlopen_self_static" = unknown; then
3107 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3112 *-*-rhapsody* | *-*-darwin1.[012])
3113 # On Rhapsody replace the C library is the System framework
3114 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3115 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3119 compile_command="$compile_command $compile_deplibs"
3120 finalize_command="$finalize_command $finalize_deplibs"
3122 if test -n "$rpath$xrpath"; then
3123 # If the user specified any rpath flags, then add them.
3124 for libdir in $rpath $xrpath; do
3125 # This is the magic to use -rpath.
3126 case "$finalize_rpath " in
3128 *) finalize_rpath="$finalize_rpath $libdir" ;;
3133 # Now hardcode the library paths
3136 for libdir in $compile_rpath $finalize_rpath; do
3137 if test -n "$hardcode_libdir_flag_spec"; then
3138 if test -n "$hardcode_libdir_separator"; then
3139 if test -z "$hardcode_libdirs"; then
3140 hardcode_libdirs="$libdir"
3142 # Just accumulate the unique libdirs.
3143 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3144 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3147 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3152 eval flag=\"$hardcode_libdir_flag_spec\"
3153 rpath="$rpath $flag"
3155 elif test -n "$runpath_var"; then
3156 case "$perm_rpath " in
3158 *) perm_rpath="$perm_rpath $libdir" ;;
3162 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3163 case :$dllsearchpath: in
3165 *) dllsearchpath="$dllsearchpath:$libdir";;
3170 # Substitute the hardcoded libdirs into the rpath.
3171 if test -n "$hardcode_libdir_separator" &&
3172 test -n "$hardcode_libdirs"; then
3173 libdir="$hardcode_libdirs"
3174 eval rpath=\" $hardcode_libdir_flag_spec\"
3176 compile_rpath="$rpath"
3180 for libdir in $finalize_rpath; do
3181 if test -n "$hardcode_libdir_flag_spec"; then
3182 if test -n "$hardcode_libdir_separator"; then
3183 if test -z "$hardcode_libdirs"; then
3184 hardcode_libdirs="$libdir"
3186 # Just accumulate the unique libdirs.
3187 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3188 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3191 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3196 eval flag=\"$hardcode_libdir_flag_spec\"
3197 rpath="$rpath $flag"
3199 elif test -n "$runpath_var"; then
3200 case "$finalize_perm_rpath " in
3202 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3206 # Substitute the hardcoded libdirs into the rpath.
3207 if test -n "$hardcode_libdir_separator" &&
3208 test -n "$hardcode_libdirs"; then
3209 libdir="$hardcode_libdirs"
3210 eval rpath=\" $hardcode_libdir_flag_spec\"
3212 finalize_rpath="$rpath"
3214 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3215 # Transform all the library objects into standard objects.
3216 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3217 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3221 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3222 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3223 dlsyms="${outputname}S.c"
3225 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3229 if test -n "$dlsyms"; then
3233 # Discover the nlist of each of the dlfiles.
3234 nlist="$output_objdir/${outputname}.nm"
3236 $show "$rm $nlist ${nlist}S ${nlist}T"
3237 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3239 # Parse the name list into a source file.
3240 $show "creating $output_objdir/$dlsyms"
3242 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3243 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3244 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3250 /* Prevent the only kind of declaration conflicts we can make. */
3251 #define lt_preloaded_symbols some_other_symbol
3253 /* External symbol declarations for the compiler. */\
3256 if test "$dlself" = yes; then
3257 $show "generating symbol list for \`$output'"
3259 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3261 # Add our own program objects to the symbol list.
3262 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3263 for arg in $progfiles; do
3264 $show "extracting global C symbols from \`$arg'"
3265 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3268 if test -n "$exclude_expsyms"; then
3269 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3270 $run eval '$mv "$nlist"T "$nlist"'
3273 if test -n "$export_symbols_regex"; then
3274 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3275 $run eval '$mv "$nlist"T "$nlist"'
3278 # Prepare the list of exported symbols
3279 if test -z "$export_symbols"; then
3280 export_symbols="$output_objdir/$output.exp"
3281 $run $rm $export_symbols
3282 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3284 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3285 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3286 $run eval 'mv "$nlist"T "$nlist"'
3290 for arg in $dlprefiles; do
3291 $show "extracting global C symbols from \`$arg'"
3292 name=`echo "$arg" | sed -e 's%^.*/%%'`
3293 $run eval 'echo ": $name " >> "$nlist"'
3294 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3297 if test -z "$run"; then
3298 # Make sure we have at least an empty file.
3299 test -f "$nlist" || : > "$nlist"
3301 if test -n "$exclude_expsyms"; then
3302 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3303 $mv "$nlist"T "$nlist"
3306 # Try sorting and uniquifying the output.
3307 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3310 grep -v "^: " < "$nlist" > "$nlist"S
3313 if test -f "$nlist"S; then
3314 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3316 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3319 $echo >> "$output_objdir/$dlsyms" "\
3321 #undef lt_preloaded_symbols
3323 #if defined (__STDC__) && __STDC__
3324 # define lt_ptr void *
3326 # define lt_ptr char *
3330 /* The mapping between symbol names and symbols. */
3335 lt_preloaded_symbols[] =
3339 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3341 $echo >> "$output_objdir/$dlsyms" "\
3345 /* This works around a problem in FreeBSD linker */
3346 #ifdef FREEBSD_WORKAROUND
3347 static const void *lt_preloaded_setup() {
3348 return lt_preloaded_symbols;
3358 pic_flag_for_symtable=
3360 # compiling the symbol table file with pic_flag works around
3361 # a FreeBSD bug that causes programs to crash when -lm is
3362 # linked before any other PIC object. But we must not use
3363 # pic_flag when linking with -static. The problem exists in
3364 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3365 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3366 case "$compile_command " in
3368 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3371 case "$compile_command " in
3373 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3377 # Now compile the dynamic symbol file.
3378 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3379 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3381 # Clean up the generated files.
3382 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3383 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3385 # Transform the symbol file into the correct name.
3386 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3387 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3390 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3395 # We keep going just in case the user didn't refer to
3396 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3397 # really was required.
3399 # Nullify the symbol file.
3400 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3401 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3404 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3405 # Replace the output file specification.
3406 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3407 link_command="$compile_command$compile_rpath"
3409 # We have no uninstalled library dependencies, so finalize right now.
3410 $show "$link_command"
3411 $run eval "$link_command"
3414 # Delete the generated files.
3415 if test -n "$dlsyms"; then
3416 $show "$rm $output_objdir/${outputname}S.${objext}"
3417 $run $rm "$output_objdir/${outputname}S.${objext}"
3423 if test -n "$shlibpath_var"; then
3424 # We should set the shlibpath_var
3426 for dir in $temp_rpath; do
3428 [\\/]* | [A-Za-z]:[\\/]*)
3433 # Relative path: add a thisdir entry.
3434 rpath="$rpath\$thisdir/$dir:"
3441 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3442 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3444 if test -n "$finalize_shlibpath"; then
3445 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3450 if test -n "$runpath_var"; then
3451 if test -n "$perm_rpath"; then
3452 # We should set the runpath_var.
3454 for dir in $perm_rpath; do
3457 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3459 if test -n "$finalize_perm_rpath"; then
3460 # We should set the runpath_var.
3462 for dir in $finalize_perm_rpath; do
3465 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3469 if test "$no_install" = yes; then
3470 # We don't need to create a wrapper script.
3471 link_command="$compile_var$compile_command$compile_rpath"
3472 # Replace the output file specification.
3473 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3474 # Delete the old output file.
3476 # Link the executable and exit
3477 $show "$link_command"
3478 $run eval "$link_command" || exit $?
3482 if test "$hardcode_action" = relink; then
3483 # Fast installation is not supported
3484 link_command="$compile_var$compile_command$compile_rpath"
3485 relink_command="$finalize_var$finalize_command$finalize_rpath"
3487 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3488 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3490 if test "$fast_install" != no; then
3491 link_command="$finalize_var$compile_command$finalize_rpath"
3492 if test "$fast_install" = yes; then
3493 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3495 # fast_install is set to needless
3499 link_command="$compile_var$compile_command$compile_rpath"
3500 relink_command="$finalize_var$finalize_command$finalize_rpath"
3504 # Replace the output file specification.
3505 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3507 # Delete the old output files.
3508 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3510 $show "$link_command"
3511 $run eval "$link_command" || exit $?
3513 # Now create the wrapper script.
3514 $show "creating $output"
3516 # Quote the relink command for shipping.
3517 if test -n "$relink_command"; then
3518 # Preserve any variables that may affect compiler behavior
3519 for var in $variables_saved_for_relink; do
3520 if eval test -z \"\${$var+set}\"; then
3521 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3522 elif eval var_value=\$$var; test -z "$var_value"; then
3523 relink_command="$var=; export $var; $relink_command"
3525 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3526 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3529 relink_command="cd `pwd`; $relink_command"
3530 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3533 # Quote $echo for shipping.
3534 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3536 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3537 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3539 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3541 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3544 # Only actually do things if our run command is non-null.
3545 if test -z "$run"; then
3546 # win32 will think the script is a binary if it has
3547 # a .exe suffix, so we strip it off here.
3549 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3551 # test for cygwin because mv fails w/o .exe extensions
3553 *cygwin*) exeext=.exe ;;
3557 trap "$rm $output; exit 1" 1 2 15
3562 # $output - temporary wrapper script for $objdir/$outputname
3563 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3565 # The $output program cannot be directly executed until all the libtool
3566 # libraries that it depends on are installed.
3568 # This wrapper script should never be moved out of the build directory.
3569 # If it is, it will not operate correctly.
3571 # Sed substitution that helps us do robust quoting. It backslashifies
3572 # metacharacters that are still active within double-quoted strings.
3573 Xsed='sed -e 1s/^X//'
3574 sed_quote_subst='$sed_quote_subst'
3576 # The HP-UX ksh and POSIX shell print the target directory to stdout
3578 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3580 relink_command=\"$relink_command\"
3582 # This environment variable determines our operation mode.
3583 if test \"\$libtool_install_magic\" = \"$magic\"; then
3584 # install mode needs the following variable:
3585 notinst_deplibs='$notinst_deplibs'
3587 # When we are sourced in execute mode, \$file and \$echo are already set.
3588 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3591 # Make sure echo works.
3592 if test \"X\$1\" = X--no-reexec; then
3593 # Discard the --no-reexec flag, and continue.
3595 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3596 # Yippee, \$echo works!
3599 # Restart under the correct shell, and then maybe \$echo will work.
3600 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3606 # Find the directory that this script lives in.
3607 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3608 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3610 # Follow symbolic links until we get to the real thisdir.
3611 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3612 while test -n \"\$file\"; do
3613 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3615 # If there was a directory component, then change thisdir.
3616 if test \"x\$destdir\" != \"x\$file\"; then
3617 case \"\$destdir\" in
3618 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3619 *) thisdir=\"\$thisdir/\$destdir\" ;;
3623 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3624 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3627 # Try to get the absolute directory name.
3628 absdir=\`cd \"\$thisdir\" && pwd\`
3629 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3632 if test "$fast_install" = yes; then
3634 program=lt-'$outputname'$exeext
3635 progdir=\"\$thisdir/$objdir\"
3637 if test ! -f \"\$progdir/\$program\" || \\
3638 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3639 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3641 file=\"\$\$-\$program\"
3643 if test ! -d \"\$progdir\"; then
3644 $mkdir \"\$progdir\"
3646 $rm \"\$progdir/\$file\"
3651 # relink executable if necessary
3652 if test -n \"\$relink_command\"; then
3653 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3655 $echo \"\$relink_command_output\" >&2
3656 $rm \"\$progdir/\$file\"
3661 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3662 { $rm \"\$progdir/\$program\";
3663 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3664 $rm \"\$progdir/\$file\"
3668 program='$outputname'
3669 progdir=\"\$thisdir/$objdir\"
3675 if test -f \"\$progdir/\$program\"; then"
3677 # Export our shlibpath_var if we have one.
3678 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3680 # Add our own library path to $shlibpath_var
3681 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3683 # Some systems cannot cope with colon-terminated $shlibpath_var
3684 # The second colon is a workaround for a bug in BeOS R4 sed
3685 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3687 export $shlibpath_var
3691 # fixup the dll searchpath if we need to.
3692 if test -n "$dllsearchpath"; then
3694 # Add the dll search path components to the executable PATH
3695 PATH=$dllsearchpath:\$PATH
3700 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3701 # Run the actual program with our arguments.
3704 # win32 systems need to use the prog path for dll
3706 *-*-cygwin* | *-*-pw32*)
3708 exec \$progdir/\$program \${1+\"\$@\"}
3712 # Backslashes separate directories on plain windows
3713 *-*-mingw | *-*-os2*)
3715 exec \$progdir\\\\\$program \${1+\"\$@\"}
3721 # Export the path to the program.
3722 PATH=\"\$progdir:\$PATH\"
3725 exec \$program \${1+\"\$@\"}
3730 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3734 # The program doesn't exist.
3735 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3736 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3737 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3748 # See if we need to build an old-fashioned archive.
3749 for oldlib in $oldlibs; do
3751 if test "$build_libtool_libs" = convenience; then
3752 oldobjs="$libobjs_save"
3753 addlibs="$convenience"
3754 build_libtool_libs=no
3756 if test "$build_libtool_libs" = module; then
3757 oldobjs="$libobjs_save"
3758 build_libtool_libs=no
3760 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3762 addlibs="$old_convenience"
3765 if test -n "$addlibs"; then
3766 gentop="$output_objdir/${outputname}x"
3767 $show "${rm}r $gentop"
3768 $run ${rm}r "$gentop"
3769 $show "mkdir $gentop"
3770 $run mkdir "$gentop"
3772 if test $status -ne 0 && test ! -d "$gentop"; then
3775 generated="$generated $gentop"
3777 # Add in members from convenience archives.
3778 for xlib in $addlibs; do
3779 # Extract the objects.
3781 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3782 *) xabs=`pwd`"/$xlib" ;;
3784 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3785 xdir="$gentop/$xlib"
3787 $show "${rm}r $xdir"
3792 if test $status -ne 0 && test ! -d "$xdir"; then
3795 $show "(cd $xdir && $AR x $xabs)"
3796 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3798 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3802 # Do each command in the archive commands.
3803 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3804 eval cmds=\"$old_archive_from_new_cmds\"
3806 # Ensure that we have .o objects in place in case we decided
3807 # not to build a shared library, and have fallen back to building
3808 # static libs even though --disable-static was passed!
3809 for oldobj in $oldobjs; do
3810 if test ! -f $oldobj; then
3811 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3812 if test "X$xdir" = "X$oldobj"; then
3817 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3818 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3819 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3820 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3824 eval cmds=\"$old_archive_cmds\"
3826 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3827 for cmd in $cmds; do
3830 $run eval "$cmd" || exit $?
3835 if test -n "$generated"; then
3836 $show "${rm}r$generated"
3837 $run ${rm}r$generated
3840 # Now create the libtool archive.
3844 test "$build_old_libs" = yes && old_library="$libname.$libext"
3845 $show "creating $output"
3847 # Preserve any variables that may affect compiler behavior
3848 for var in $variables_saved_for_relink; do
3849 if eval test -z \"\${$var+set}\"; then
3850 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3851 elif eval var_value=\$$var; test -z "$var_value"; then
3852 relink_command="$var=; export $var; $relink_command"
3854 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3855 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3858 # Quote the link command for shipping.
3859 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3860 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3862 # Only create the output if not a dry run.
3863 if test -z "$run"; then
3864 for installed in no yes; do
3865 if test "$installed" = yes; then
3866 if test -z "$install_libdir"; then
3869 output="$output_objdir/$outputname"i
3870 # Replace all uninstalled libtool libraries with the installed ones
3872 for deplib in $dependency_libs; do
3875 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3876 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3877 if test -z "$libdir"; then
3878 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3881 newdependency_libs="$newdependency_libs $libdir/$name"
3883 *) newdependency_libs="$newdependency_libs $deplib" ;;
3886 dependency_libs="$newdependency_libs"
3888 for lib in $dlfiles; do
3889 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3890 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3891 if test -z "$libdir"; then
3892 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3895 newdlfiles="$newdlfiles $libdir/$name"
3897 dlfiles="$newdlfiles"
3899 for lib in $dlprefiles; do
3900 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3901 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3902 if test -z "$libdir"; then
3903 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3906 newdlprefiles="$newdlprefiles $libdir/$name"
3908 dlprefiles="$newdlprefiles"
3911 # place dlname in correct position for cygwin
3913 case $host,$output,$installed,$module,$dlname in
3914 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3917 # $outputname - a libtool library file
3918 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3920 # Please DO NOT delete this file!
3921 # It is necessary for linking the library.
3923 # The name that we can dlopen(3).
3926 # Names of this library.
3927 library_names='$library_names'
3929 # The name of the static archive.
3930 old_library='$old_library'
3932 # Libraries that this one depends upon.
3933 dependency_libs='$dependency_libs'
3935 # Version information for $libname.
3940 # Is this an already installed library?
3941 installed=$installed
3943 # Files to dlopen/dlpreopen
3945 dlpreopen='$dlprefiles'
3947 # Directory that this library needs to be installed in:
3948 libdir='$install_libdir'"
3949 if test "$installed" = no && test $need_relink = yes; then
3951 relink_command=\"$relink_command\""
3956 # Do a symbolic link so that the libtool archive can be found in
3957 # LD_LIBRARY_PATH before the program is installed.
3958 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3959 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3965 # libtool install mode
3967 modename="$modename: install"
3969 # There may be an optional sh(1) argument at the beginning of
3970 # install_prog (especially on Windows NT).
3971 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3972 # Allow the use of GNU shtool's install command.
3973 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3974 # Aesthetically quote it.
3975 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3977 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3981 install_prog="$arg "
3989 # The real first argument should be the name of the installation program.
3990 # Aesthetically quote it.
3991 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3993 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3997 install_prog="$install_prog$arg"
3999 # We need to accept at least all the BSD install flags.
4009 if test -n "$dest"; then
4010 files="$files $dest"
4028 # If the previous option needed an argument, then skip it.
4029 if test -n "$prev"; then
4038 # Aesthetically quote the argument.
4039 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4041 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4045 install_prog="$install_prog $arg"
4048 if test -z "$install_prog"; then
4049 $echo "$modename: you must specify an install program" 1>&2
4054 if test -n "$prev"; then
4055 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4060 if test -z "$files"; then
4061 if test -z "$dest"; then
4062 $echo "$modename: no file or destination specified" 1>&2
4064 $echo "$modename: you must specify a destination" 1>&2
4070 # Strip any trailing slash from the destination.
4071 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4073 # Check to see that the destination is a directory.
4074 test -d "$dest" && isdir=yes
4075 if test "$isdir" = yes; then
4079 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4080 test "X$destdir" = "X$dest" && destdir=.
4081 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4083 # Not a directory, so check to see that there is only one file specified.
4085 if test $# -gt 2; then
4086 $echo "$modename: \`$dest' is not a directory" 1>&2
4092 [\\/]* | [A-Za-z]:[\\/]*) ;;
4094 for file in $files; do
4098 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4107 # This variable tells wrapper scripts just to set variables rather
4108 # than running their programs.
4109 libtool_install_magic="$magic"
4114 for file in $files; do
4116 # Do each installation.
4119 # Do the static libraries later.
4120 staticlibs="$staticlibs $file"
4124 # Check to see that this really is a libtool archive.
4125 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4127 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4135 # If there is no directory component, then add one.
4137 */* | *\\*) . $file ;;
4141 # Add the libdir to current_libdirs if it is the destination.
4142 if test "X$destdir" = "X$libdir"; then
4143 case "$current_libdirs " in
4145 *) current_libdirs="$current_libdirs $libdir" ;;
4148 # Note the libdir as a future libdir.
4149 case "$future_libdirs " in
4151 *) future_libdirs="$future_libdirs $libdir" ;;
4155 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4156 test "X$dir" = "X$file/" && dir=
4159 if test -n "$relink_command"; then
4160 $echo "$modename: warning: relinking \`$file'" 1>&2
4161 $show "$relink_command"
4162 if $run eval "$relink_command"; then :
4164 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4169 # See the names of the shared library.
4170 set dummy $library_names
4171 if test -n "$2"; then
4177 test -n "$relink_command" && srcname="$realname"T
4179 # Install the shared library and build the symlinks.
4180 $show "$install_prog $dir/$srcname $destdir/$realname"
4181 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4182 if test -n "$stripme" && test -n "$striplib"; then
4183 $show "$striplib $destdir/$realname"
4184 $run eval "$striplib $destdir/$realname" || exit $?
4187 if test $# -gt 0; then
4188 # Delete the old symlinks, and create new ones.
4191 if test "$linkname" != "$realname"; then
4192 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4193 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4198 # Do each command in the postinstall commands.
4199 lib="$destdir/$realname"
4200 eval cmds=\"$postinstall_cmds\"
4201 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4202 for cmd in $cmds; do
4205 $run eval "$cmd" || exit $?
4210 # Install the pseudo-library for information purposes.
4211 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4212 instname="$dir/$name"i
4213 $show "$install_prog $instname $destdir/$name"
4214 $run eval "$install_prog $instname $destdir/$name" || exit $?
4216 # Maybe install the static library, too.
4217 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4221 # Install (i.e. copy) a libtool object.
4223 # Figure out destination file name, if it wasn't already specified.
4224 if test -n "$destname"; then
4225 destfile="$destdir/$destname"
4227 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4228 destfile="$destdir/$destfile"
4231 # Deduce the name of the destination old-style object file.
4234 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4237 staticdest="$destfile"
4241 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4247 # Install the libtool object if requested.
4248 if test -n "$destfile"; then
4249 $show "$install_prog $file $destfile"
4250 $run eval "$install_prog $file $destfile" || exit $?
4253 # Install the old object if enabled.
4254 if test "$build_old_libs" = yes; then
4255 # Deduce the name of the old-style object file.
4256 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4258 $show "$install_prog $staticobj $staticdest"
4259 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4265 # Figure out destination file name, if it wasn't already specified.
4266 if test -n "$destname"; then
4267 destfile="$destdir/$destname"
4269 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4270 destfile="$destdir/$destfile"
4273 # Do a test to see if this is really a libtool program.
4274 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4278 # If there is no directory component, then add one.
4280 */* | *\\*) . $file ;;
4284 # Check the variables that should have been set.
4285 if test -z "$notinst_deplibs"; then
4286 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4291 for lib in $notinst_deplibs; do
4292 # Check to see that each library is installed.
4294 if test -f "$lib"; then
4295 # If there is no directory component, then add one.
4297 */* | *\\*) . $lib ;;
4301 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4302 if test -n "$libdir" && test ! -f "$libfile"; then
4303 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4309 # If there is no directory component, then add one.
4311 */* | *\\*) . $file ;;
4316 if test "$fast_install" = no && test -n "$relink_command"; then
4317 if test "$finalize" = yes && test -z "$run"; then
4319 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4320 tmpdir="$tmpdir/libtool-$$"
4321 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4323 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4326 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4327 outputname="$tmpdir/$file"
4328 # Replace the output file specification.
4329 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4331 $show "$relink_command"
4332 if $run eval "$relink_command"; then :
4334 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4340 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4343 # Install the binary that we compiled earlier.
4344 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4348 # remove .exe since cygwin /usr/bin/install will append another
4350 case $install_prog,$host in
4351 /usr/bin/install*,*cygwin*)
4352 case $file:$destfile in
4357 destfile=$destfile.exe
4360 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4365 $show "$install_prog$stripme $file $destfile"
4366 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4367 test -n "$outputname" && ${rm}r "$tmpdir"
4372 for file in $staticlibs; do
4373 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4375 # Set up the ranlib parameters.
4376 oldlib="$destdir/$name"
4378 $show "$install_prog $file $oldlib"
4379 $run eval "$install_prog \$file \$oldlib" || exit $?
4381 if test -n "$stripme" && test -n "$striplib"; then
4382 $show "$old_striplib $oldlib"
4383 $run eval "$old_striplib $oldlib" || exit $?
4386 # Do each command in the postinstall commands.
4387 eval cmds=\"$old_postinstall_cmds\"
4388 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4389 for cmd in $cmds; do
4392 $run eval "$cmd" || exit $?
4397 if test -n "$future_libdirs"; then
4398 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4401 if test -n "$current_libdirs"; then
4402 # Maybe just do a dry run.
4403 test -n "$run" && current_libdirs=" -n$current_libdirs"
4404 exec_cmd='$SHELL $0 --finish$current_libdirs'
4410 # libtool finish mode
4412 modename="$modename: finish"
4416 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4419 libdirs="$libdirs $dir"
4422 for libdir in $libdirs; do
4423 if test -n "$finish_cmds"; then
4424 # Do each command in the finish commands.
4425 eval cmds=\"$finish_cmds\"
4426 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4427 for cmd in $cmds; do
4430 $run eval "$cmd" || admincmds="$admincmds
4435 if test -n "$finish_eval"; then
4436 # Do the single finish_eval.
4437 eval cmds=\"$finish_eval\"
4438 $run eval "$cmds" || admincmds="$admincmds
4444 # Exit here if they wanted silent mode.
4445 test "$show" = ":" && exit 0
4447 echo "----------------------------------------------------------------------"
4448 echo "Libraries have been installed in:"
4449 for libdir in $libdirs; do
4453 echo "If you ever happen to want to link against installed libraries"
4454 echo "in a given directory, LIBDIR, you must either use libtool, and"
4455 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4456 echo "flag during linking and do at least one of the following:"
4457 if test -n "$shlibpath_var"; then
4458 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4459 echo " during execution"
4461 if test -n "$runpath_var"; then
4462 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4463 echo " during linking"
4465 if test -n "$hardcode_libdir_flag_spec"; then
4467 eval flag=\"$hardcode_libdir_flag_spec\"
4469 echo " - use the \`$flag' linker flag"
4471 if test -n "$admincmds"; then
4472 echo " - have your system administrator run these commands:$admincmds"
4474 if test -f /etc/ld.so.conf; then
4475 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4478 echo "See any operating system documentation about shared libraries for"
4479 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4480 echo "----------------------------------------------------------------------"
4484 # libtool execute mode
4486 modename="$modename: execute"
4488 # The first argument is the command name.
4490 if test -z "$cmd"; then
4491 $echo "$modename: you must specify a COMMAND" 1>&2
4496 # Handle -dlopen flags immediately.
4497 for file in $execute_dlfiles; do
4498 if test ! -f "$file"; then
4499 $echo "$modename: \`$file' is not a file" 1>&2
4507 # Check to see that this really is a libtool archive.
4508 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4510 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4515 # Read the libtool library.
4519 # If there is no directory component, then add one.
4521 */* | *\\*) . $file ;;
4525 # Skip this library if it cannot be dlopened.
4526 if test -z "$dlname"; then
4527 # Warn if it was a shared library.
4528 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4532 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4533 test "X$dir" = "X$file" && dir=.
4535 if test -f "$dir/$objdir/$dlname"; then
4538 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4544 # Just add the directory containing the .lo file.
4545 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4546 test "X$dir" = "X$file" && dir=.
4550 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4555 # Get the absolute pathname.
4556 absdir=`cd "$dir" && pwd`
4557 test -n "$absdir" && dir="$absdir"
4559 # Now add the directory to shlibpath_var.
4560 if eval "test -z \"\$$shlibpath_var\""; then
4561 eval "$shlibpath_var=\"\$dir\""
4563 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4567 # This variable tells wrapper scripts just to set shlibpath_var
4568 # rather than running their programs.
4569 libtool_execute_magic="$magic"
4571 # Check if any of the arguments is a wrapper script.
4578 # Do a test to see if this is really a libtool program.
4579 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4580 # If there is no directory component, then add one.
4582 */* | *\\*) . $file ;;
4586 # Transform arg to wrapped name.
4587 file="$progdir/$program"
4591 # Quote arguments (to preserve shell metacharacters).
4592 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4593 args="$args \"$file\""
4596 if test -z "$run"; then
4597 if test -n "$shlibpath_var"; then
4598 # Export the shlibpath_var.
4599 eval "export $shlibpath_var"
4602 # Restore saved enviroment variables
4603 if test "${save_LC_ALL+set}" = set; then
4604 LC_ALL="$save_LC_ALL"; export LC_ALL
4606 if test "${save_LANG+set}" = set; then
4607 LANG="$save_LANG"; export LANG
4610 # Now prepare to actually exec the command.
4611 exec_cmd='"$cmd"$args'
4613 # Display what would be done.
4614 if test -n "$shlibpath_var"; then
4615 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4616 $echo "export $shlibpath_var"
4623 # libtool clean and uninstall mode
4625 modename="$modename: $mode"
4631 # This variable tells wrapper scripts just to set variables rather
4632 # than running their programs.
4633 libtool_install_magic="$magic"
4638 -f) rm="$rm $arg"; rmforce=yes ;;
4639 -*) rm="$rm $arg" ;;
4640 *) files="$files $arg" ;;
4644 if test -z "$rm"; then
4645 $echo "$modename: you must specify an RM program" 1>&2
4652 for file in $files; do
4653 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4654 if test "X$dir" = "X$file"; then
4658 objdir="$dir/$objdir"
4660 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4661 test $mode = uninstall && objdir="$dir"
4663 # Remember objdir for removal later, being careful to avoid duplicates
4664 if test $mode = clean; then
4667 *) rmdirs="$rmdirs $objdir" ;;
4671 # Don't error if the file doesn't exist and rm -f was used.
4672 if (test -L "$file") >/dev/null 2>&1 \
4673 || (test -h "$file") >/dev/null 2>&1 \
4674 || test -f "$file"; then
4676 elif test -d "$file"; then
4679 elif test "$rmforce" = yes; then
4687 # Possibly a libtool archive, so verify it.
4688 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4691 # Delete the libtool libraries and symlinks.
4692 for n in $library_names; do
4693 rmfiles="$rmfiles $objdir/$n"
4695 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4696 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4698 if test $mode = uninstall; then
4699 if test -n "$library_names"; then
4700 # Do each command in the postuninstall commands.
4701 eval cmds=\"$postuninstall_cmds\"
4702 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4703 for cmd in $cmds; do
4707 if test $? != 0 && test "$rmforce" != yes; then
4714 if test -n "$old_library"; then
4715 # Do each command in the old_postuninstall commands.
4716 eval cmds=\"$old_postuninstall_cmds\"
4717 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4718 for cmd in $cmds; do
4722 if test $? != 0 && test "$rmforce" != yes; then
4728 # FIXME: should reinstall the best remaining shared library.
4734 if test "$build_old_libs" = yes; then
4735 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4736 rmfiles="$rmfiles $dir/$oldobj"
4741 # Do a test to see if this is a libtool program.
4742 if test $mode = clean &&
4743 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4747 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4748 if test "$fast_install" = yes && test -n "$relink_command"; then
4749 rmfiles="$rmfiles $objdir/lt-$name"
4754 $show "$rm $rmfiles"
4755 $run $rm $rmfiles || exit_status=1
4758 # Try to remove the ${objdir}s in the directories where we deleted files
4759 for dir in $rmdirs; do
4760 if test -d "$dir"; then
4762 $run rmdir $dir >/dev/null 2>&1
4770 $echo "$modename: you must specify a MODE" 1>&2
4771 $echo "$generic_help" 1>&2
4776 if test -z "$exec_cmd"; then
4777 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4778 $echo "$generic_help" 1>&2
4781 fi # test -z "$show_help"
4783 if test -n "$exec_cmd"; then
4788 # We need to display help for each of the modes.
4791 "Usage: $modename [OPTION]... [MODE-ARG]...
4793 Provide generalized library-building support services.
4795 --config show all configuration variables
4796 --debug enable verbose shell tracing
4797 -n, --dry-run display commands without modifying any files
4798 --features display basic configuration information and exit
4799 --finish same as \`--mode=finish'
4800 --help display this help message and exit
4801 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4802 --quiet same as \`--silent'
4803 --silent don't print informational messages
4804 --version print version information
4806 MODE must be one of the following:
4808 clean remove files from the build directory
4809 compile compile a source file into a libtool object
4810 execute automatically set library path, then run a program
4811 finish complete the installation of libtool libraries
4812 install install libraries or executables
4813 link create a library or an executable
4814 uninstall remove libraries from an installed directory
4816 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4817 a more detailed description of MODE."
4823 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4825 Remove files from the build directory.
4827 RM is the name of the program to use to delete files associated with each FILE
4828 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4831 If FILE is a libtool library, object or program, all the files associated
4832 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4837 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4839 Compile a source file into a libtool library object.
4841 This mode accepts the following additional options:
4843 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4844 -prefer-pic try to building PIC objects only
4845 -prefer-non-pic try to building non-PIC objects only
4846 -static always build a \`.o' file suitable for static linking
4848 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4849 from the given SOURCEFILE.
4851 The output file name is determined by removing the directory component from
4852 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4853 library object suffix, \`.lo'."
4858 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4860 Automatically set library path, then run a program.
4862 This mode accepts the following additional options:
4864 -dlopen FILE add the directory containing FILE to the library path
4866 This mode sets the library path environment variable according to \`-dlopen'
4869 If any of the ARGS are libtool executable wrappers, then they are translated
4870 into their corresponding uninstalled binary, and any of their required library
4871 directories are added to the library path.
4873 Then, COMMAND is executed, with ARGS as arguments."
4878 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4880 Complete the installation of libtool libraries.
4882 Each LIBDIR is a directory that contains libtool libraries.
4884 The commands that this mode executes may require superuser privileges. Use
4885 the \`--dry-run' option if you just want to see what would be executed."
4890 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4892 Install executables or libraries.
4894 INSTALL-COMMAND is the installation command. The first component should be
4895 either the \`install' or \`cp' program.
4897 The rest of the components are interpreted as arguments to that command (only
4898 BSD-compatible install options are recognized)."
4903 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4905 Link object files or libraries together to form another library, or to
4906 create an executable program.
4908 LINK-COMMAND is a command using the C compiler that you would use to create
4909 a program from several object files.
4911 The following components of LINK-COMMAND are treated specially:
4913 -all-static do not do any dynamic linking at all
4914 -avoid-version do not add a version suffix if possible
4915 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4916 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4917 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4918 -export-symbols SYMFILE
4919 try to export only the symbols listed in SYMFILE
4920 -export-symbols-regex REGEX
4921 try to export only the symbols matching REGEX
4922 -LLIBDIR search LIBDIR for required installed libraries
4923 -lNAME OUTPUT-FILE requires the installed library libNAME
4924 -module build a library that can dlopened
4925 -no-fast-install disable the fast-install mode
4926 -no-install link a not-installable executable
4927 -no-undefined declare that a library does not refer to external symbols
4928 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4929 -release RELEASE specify package release information
4930 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4931 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4932 -static do not do any dynamic linking of libtool libraries
4933 -version-info CURRENT[:REVISION[:AGE]]
4934 specify library version info [each variable defaults to 0]
4936 All other options (arguments beginning with \`-') are ignored.
4938 Every other argument is treated as a filename. Files ending in \`.la' are
4939 treated as uninstalled libtool libraries, other files are standard or library
4942 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4943 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4944 required, except when creating a convenience library.
4946 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4947 using \`ar' and \`ranlib', or on Windows using \`lib'.
4949 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4950 is created, otherwise an executable program is created."
4955 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4957 Remove libraries from an installation directory.
4959 RM is the name of the program to use to delete files associated with each FILE
4960 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4963 If FILE is a libtool library, all the files associated with it are deleted.
4964 Otherwise, only FILE itself is deleted using RM."
4968 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4975 $echo "Try \`$modename --help' for more information about other modes."