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.27 2001/08/18 22:31:47)"
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 if test "$need_version" = no; then
2343 # Remove version info from name if versioning should be avoided
2344 if test "$avoid_version" = yes && test "$need_version" = no; then
2350 # Check to see if the archive will have undefined symbols.
2351 if test "$allow_undefined" = yes; then
2352 if test "$allow_undefined_flag" = unsupported; then
2353 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2354 build_libtool_libs=no
2358 # Don't allow undefined symbols.
2359 allow_undefined_flag="$no_undefined_flag"
2363 if test "$mode" != relink; then
2364 # Remove our outputs.
2365 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2366 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2369 # Now set the variables for building old libraries.
2370 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2371 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2373 # Transform .lo files to .o files.
2374 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2377 # Eliminate all temporary directories.
2378 for path in $notinst_path; do
2379 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2380 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2381 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2384 if test -n "$xrpath"; then
2385 # If the user specified any rpath flags, then add them.
2387 for libdir in $xrpath; do
2388 temp_xrpath="$temp_xrpath -R$libdir"
2389 case "$finalize_rpath " in
2391 *) finalize_rpath="$finalize_rpath $libdir" ;;
2394 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2395 dependency_libs="$temp_xrpath $dependency_libs"
2399 # Make sure dlfiles contains only unique files that won't be dlpreopened
2400 old_dlfiles="$dlfiles"
2402 for lib in $old_dlfiles; do
2403 case " $dlprefiles $dlfiles " in
2405 *) dlfiles="$dlfiles $lib" ;;
2409 # Make sure dlprefiles contains only unique files
2410 old_dlprefiles="$dlprefiles"
2412 for lib in $old_dlprefiles; do
2413 case "$dlprefiles " in
2415 *) dlprefiles="$dlprefiles $lib" ;;
2419 if test "$build_libtool_libs" = yes; then
2420 if test -n "$rpath"; then
2422 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2423 # these systems don't actually have a c library (as such)!
2425 *-*-rhapsody* | *-*-darwin1.[012])
2426 # Rhapsody C library is in the System framework
2427 deplibs="$deplibs -framework System"
2430 # Don't link with libc until the a.out ld.so is fixed.
2433 # Do not include libc due to us having libc/libc_r.
2436 # Add libc to deplibs on all other systems if necessary.
2437 if test $build_libtool_need_lc = "yes"; then
2438 deplibs="$deplibs -lc"
2444 # Transform deplibs into only deplibs that can be linked in shared.
2446 libname_save=$libname
2447 release_save=$release
2448 versuffix_save=$versuffix
2450 # I'm not sure if I'm treating the release correctly. I think
2451 # release should show up in the -l (ie -lgmp5) so we don't want to
2452 # add it in twice. Is that correct?
2458 case $deplibs_check_method in
2460 # Don't check for shared/static. Everything works.
2461 # This might be a little naive. We might want to check
2462 # whether the library exists or not. But this is on
2463 # osf3 & osf4 and I'm not really sure... Just
2464 # implementing what was already the behaviour.
2468 # This code stresses the "libraries are programs" paradigm to its
2469 # limits. Maybe even breaks it. We compile a program, linking it
2470 # against the deplibs as a proxy for the library. Then we can check
2471 # whether they linked in statically or dynamically with ldd.
2473 cat > conftest.c <<EOF
2474 int main() { return 0; }
2477 $CC -o conftest conftest.c $deplibs
2478 if test $? -eq 0 ; then
2479 ldd_output=`ldd conftest`
2480 for i in $deplibs; do
2481 name="`expr $i : '-l\(.*\)'`"
2482 # If $name is empty we are operating on a -L argument.
2483 if test -n "$name" && test "$name" != "0"; then
2484 libname=`eval \\$echo \"$libname_spec\"`
2485 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2486 set dummy $deplib_matches
2488 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2489 newdeplibs="$newdeplibs $i"
2493 echo "*** Warning: This library needs some functionality provided by $i."
2494 echo "*** I have the capability to make that library automatically link in when"
2495 echo "*** you link to this library. But I can only do this if you have a"
2496 echo "*** shared version of the library, which you do not appear to have."
2499 newdeplibs="$newdeplibs $i"
2503 # Error occured in the first compile. Let's try to salvage the situation:
2504 # Compile a seperate program for each library.
2505 for i in $deplibs; do
2506 name="`expr $i : '-l\(.*\)'`"
2507 # If $name is empty we are operating on a -L argument.
2508 if test -n "$name" && test "$name" != "0"; then
2510 $CC -o conftest conftest.c $i
2512 if test $? -eq 0 ; then
2513 ldd_output=`ldd conftest`
2514 libname=`eval \\$echo \"$libname_spec\"`
2515 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2516 set dummy $deplib_matches
2518 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2519 newdeplibs="$newdeplibs $i"
2523 echo "*** Warning: This library needs some functionality provided by $i."
2524 echo "*** I have the capability to make that library automatically link in when"
2525 echo "*** you link to this library. But I can only do this if you have a"
2526 echo "*** shared version of the library, which you do not appear to have."
2531 echo "*** Warning! Library $i is needed by this library but I was not able to"
2532 echo "*** make it link in! You will probably need to install it or some"
2533 echo "*** library that it depends on before this library will be fully"
2534 echo "*** functional. Installing it before continuing would be even better."
2537 newdeplibs="$newdeplibs $i"
2543 set dummy $deplibs_check_method
2544 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2545 for a_deplib in $deplibs; do
2546 name="`expr $a_deplib : '-l\(.*\)'`"
2547 # If $name is empty we are operating on a -L argument.
2548 if test -n "$name" && test "$name" != "0"; then
2549 libname=`eval \\$echo \"$libname_spec\"`
2550 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2551 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2552 for potent_lib in $potential_libs; do
2553 # Follow soft links.
2554 if ls -lLd "$potent_lib" 2>/dev/null \
2555 | grep " -> " >/dev/null; then
2558 # The statement above tries to avoid entering an
2559 # endless loop below, in case of cyclic links.
2560 # We might still enter an endless loop, since a link
2561 # loop can be closed while we follow links,
2563 potlib="$potent_lib"
2564 while test -h "$potlib" 2>/dev/null; do
2565 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2567 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2568 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2571 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2573 | egrep "$file_magic_regex" > /dev/null; then
2574 newdeplibs="$newdeplibs $a_deplib"
2580 if test -n "$a_deplib" ; then
2583 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2584 echo "*** I have the capability to make that library automatically link in when"
2585 echo "*** you link to this library. But I can only do this if you have a"
2586 echo "*** shared version of the library, which you do not appear to have."
2589 # Add a -L argument.
2590 newdeplibs="$newdeplibs $a_deplib"
2592 done # Gone through all deplibs.
2595 set dummy $deplibs_check_method
2596 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2597 for a_deplib in $deplibs; do
2598 name="`expr $a_deplib : '-l\(.*\)'`"
2599 # If $name is empty we are operating on a -L argument.
2600 if test -n "$name" && test "$name" != "0"; then
2601 libname=`eval \\$echo \"$libname_spec\"`
2602 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2603 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2604 for potent_lib in $potential_libs; do
2605 if eval echo \"$potent_lib\" 2>/dev/null \
2607 | egrep "$match_pattern_regex" > /dev/null; then
2608 newdeplibs="$newdeplibs $a_deplib"
2614 if test -n "$a_deplib" ; then
2617 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2618 echo "*** I have the capability to make that library automatically link in when"
2619 echo "*** you link to this library. But I can only do this if you have a"
2620 echo "*** shared version of the library, which you do not appear to have."
2623 # Add a -L argument.
2624 newdeplibs="$newdeplibs $a_deplib"
2626 done # Gone through all deplibs.
2630 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2631 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2632 grep . >/dev/null; then
2634 if test "X$deplibs_check_method" = "Xnone"; then
2635 echo "*** Warning: inter-library dependencies are not supported in this platform."
2637 echo "*** Warning: inter-library dependencies are not known to be supported."
2639 echo "*** All declared inter-library dependencies are being dropped."
2644 versuffix=$versuffix_save
2646 release=$release_save
2647 libname=$libname_save
2651 *-*-rhapsody* | *-*-darwin1.[012])
2652 # On Rhapsody replace the C library is the System framework
2653 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2657 if test "$droppeddeps" = yes; then
2658 if test "$module" = yes; then
2660 echo "*** Warning: libtool could not satisfy all declared inter-library"
2661 echo "*** dependencies of module $libname. Therefore, libtool will create"
2662 echo "*** a static module, that should work as long as the dlopening"
2663 echo "*** application is linked with the -dlopen flag."
2664 if test -z "$global_symbol_pipe"; then
2666 echo "*** However, this would only work if libtool was able to extract symbol"
2667 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2668 echo "*** not find such a program. So, this module is probably useless."
2669 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2671 if test "$build_old_libs" = no; then
2672 oldlibs="$output_objdir/$libname.$libext"
2673 build_libtool_libs=module
2676 build_libtool_libs=no
2679 echo "*** The inter-library dependencies that have been dropped here will be"
2680 echo "*** automatically added whenever a program is linked with this library"
2681 echo "*** or is declared to -dlopen it."
2683 if test $allow_undefined = no; then
2685 echo "*** Since this library must not contain undefined symbols,"
2686 echo "*** because either the platform does not support them or"
2687 echo "*** it was explicitly requested with -no-undefined,"
2688 echo "*** libtool will only create a static version of it."
2689 if test "$build_old_libs" = no; then
2690 oldlibs="$output_objdir/$libname.$libext"
2691 build_libtool_libs=module
2694 build_libtool_libs=no
2699 # Done checking deplibs!
2703 # All the library-specific variables (install_libdir is set above).
2708 # Test again, we may have decided not to build it any more
2709 if test "$build_libtool_libs" = yes; then
2710 if test $hardcode_into_libs = yes; then
2711 # Hardcode the library paths
2714 rpath="$finalize_rpath"
2715 test "$mode" != relink && rpath="$compile_rpath$rpath"
2716 for libdir in $rpath; do
2717 if test -n "$hardcode_libdir_flag_spec"; then
2718 if test -n "$hardcode_libdir_separator"; then
2719 if test -z "$hardcode_libdirs"; then
2720 hardcode_libdirs="$libdir"
2722 # Just accumulate the unique libdirs.
2723 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2724 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2727 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2732 eval flag=\"$hardcode_libdir_flag_spec\"
2733 dep_rpath="$dep_rpath $flag"
2735 elif test -n "$runpath_var"; then
2736 case "$perm_rpath " in
2738 *) perm_rpath="$perm_rpath $libdir" ;;
2742 # Substitute the hardcoded libdirs into the rpath.
2743 if test -n "$hardcode_libdir_separator" &&
2744 test -n "$hardcode_libdirs"; then
2745 libdir="$hardcode_libdirs"
2746 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2748 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2749 # We should set the runpath_var.
2751 for dir in $perm_rpath; do
2754 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2756 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2759 shlibpath="$finalize_shlibpath"
2760 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2761 if test -n "$shlibpath"; then
2762 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2765 # Get the real and link names of the library.
2766 eval library_names=\"$library_names_spec\"
2767 set dummy $library_names
2771 if test -n "$soname_spec"; then
2772 eval soname=\"$soname_spec\"
2776 test -z "$dlname" && dlname=$soname
2778 lib="$output_objdir/$realname"
2781 linknames="$linknames $link"
2784 # Ensure that we have .o objects for linkers which dislike .lo
2785 # (e.g. aix) in case we are running --disable-static
2786 for obj in $libobjs; do
2787 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2788 if test "X$xdir" = "X$obj"; then
2793 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2794 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2795 if test ! -f $xdir/$oldobj; then
2796 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2797 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2801 # Use standard objects if they are pic
2802 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2804 # Prepare the list of exported symbols
2805 if test -z "$export_symbols"; then
2806 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2807 $show "generating symbol list for \`$libname.la'"
2808 export_symbols="$output_objdir/$libname.exp"
2809 $run $rm $export_symbols
2810 eval cmds=\"$export_symbols_cmds\"
2811 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2812 for cmd in $cmds; do
2815 $run eval "$cmd" || exit $?
2818 if test -n "$export_symbols_regex"; then
2819 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2820 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2821 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2822 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2827 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2828 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2831 if test -n "$convenience"; then
2832 if test -n "$whole_archive_flag_spec"; then
2833 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2835 gentop="$output_objdir/${outputname}x"
2836 $show "${rm}r $gentop"
2837 $run ${rm}r "$gentop"
2838 $show "mkdir $gentop"
2839 $run mkdir "$gentop"
2841 if test $status -ne 0 && test ! -d "$gentop"; then
2844 generated="$generated $gentop"
2846 for xlib in $convenience; do
2847 # Extract the objects.
2849 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2850 *) xabs=`pwd`"/$xlib" ;;
2852 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2853 xdir="$gentop/$xlib"
2855 $show "${rm}r $xdir"
2860 if test $status -ne 0 && test ! -d "$xdir"; then
2863 $show "(cd $xdir && $AR x $xabs)"
2864 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2866 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2871 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2872 eval flag=\"$thread_safe_flag_spec\"
2873 linker_flags="$linker_flags $flag"
2876 # Make a backup of the uninstalled library when relinking
2877 if test "$mode" = relink; then
2878 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2881 # Do each of the archive commands.
2882 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2883 eval cmds=\"$archive_expsym_cmds\"
2885 eval cmds=\"$archive_cmds\"
2887 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
2888 for cmd in $cmds; do
2891 $run eval "$cmd" || exit $?
2895 # Restore the uninstalled library and exit
2896 if test "$mode" = relink; then
2897 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2901 # Create links to the real library.
2902 for linkname in $linknames; do
2903 if test "$realname" != "$linkname"; then
2904 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2905 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2909 # If -module or -export-dynamic was specified, set the dlname.
2910 if test "$module" = yes || test "$export_dynamic" = yes; then
2911 # On all known operating systems, these are identical.
2918 if test -n "$deplibs"; then
2919 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2922 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2923 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2926 if test -n "$rpath"; then
2927 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2930 if test -n "$xrpath"; then
2931 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2934 if test -n "$vinfo"; then
2935 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2938 if test -n "$release"; then
2939 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2944 if test -n "$objs$old_deplibs"; then
2945 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2949 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2957 # Delete the old objects.
2958 $run $rm $obj $libobj
2960 # Objects from convenience libraries. This assumes
2961 # single-version convenience libraries. Whenever we create
2962 # different ones for PIC/non-PIC, this we'll have to duplicate
2966 # reload_cmds runs $LD directly, so let us get rid of
2967 # -Wl from whole_archive_flag_spec
2970 if test -n "$convenience"; then
2971 if test -n "$whole_archive_flag_spec"; then
2972 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2974 gentop="$output_objdir/${obj}x"
2975 $show "${rm}r $gentop"
2976 $run ${rm}r "$gentop"
2977 $show "mkdir $gentop"
2978 $run mkdir "$gentop"
2980 if test $status -ne 0 && test ! -d "$gentop"; then
2983 generated="$generated $gentop"
2985 for xlib in $convenience; do
2986 # Extract the objects.
2988 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2989 *) xabs=`pwd`"/$xlib" ;;
2991 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2992 xdir="$gentop/$xlib"
2994 $show "${rm}r $xdir"
2999 if test $status -ne 0 && test ! -d "$xdir"; then
3002 $show "(cd $xdir && $AR x $xabs)"
3003 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3005 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3010 # Create the old-style object.
3011 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
3014 eval cmds=\"$reload_cmds\"
3015 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3016 for cmd in $cmds; do
3019 $run eval "$cmd" || exit $?
3023 # Exit if we aren't doing a library object file.
3024 if test -z "$libobj"; then
3025 if test -n "$gentop"; then
3026 $show "${rm}r $gentop"
3033 if test "$build_libtool_libs" != yes; then
3034 if test -n "$gentop"; then
3035 $show "${rm}r $gentop"
3039 # Create an invalid libtool object if no PIC, so that we don't
3040 # accidentally link it into a program.
3041 $show "echo timestamp > $libobj"
3042 $run eval "echo timestamp > $libobj" || exit $?
3046 if test -n "$pic_flag" || test "$pic_mode" != default; then
3047 # Only do commands if we really have different PIC objects.
3048 reload_objs="$libobjs $reload_conv_objs"
3050 eval cmds=\"$reload_cmds\"
3051 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3052 for cmd in $cmds; do
3055 $run eval "$cmd" || exit $?
3059 # Just create a symlink.
3062 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3063 if test "X$xdir" = "X$libobj"; then
3068 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3069 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3070 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3071 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3074 if test -n "$gentop"; then
3075 $show "${rm}r $gentop"
3084 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3086 if test -n "$vinfo"; then
3087 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3090 if test -n "$release"; then
3091 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3094 if test "$preload" = yes; then
3095 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3096 test "$dlopen_self_static" = unknown; then
3097 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3102 *-*-rhapsody* | *-*-darwin1.[012])
3103 # On Rhapsody replace the C library is the System framework
3104 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3105 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3109 compile_command="$compile_command $compile_deplibs"
3110 finalize_command="$finalize_command $finalize_deplibs"
3112 if test -n "$rpath$xrpath"; then
3113 # If the user specified any rpath flags, then add them.
3114 for libdir in $rpath $xrpath; do
3115 # This is the magic to use -rpath.
3116 case "$finalize_rpath " in
3118 *) finalize_rpath="$finalize_rpath $libdir" ;;
3123 # Now hardcode the library paths
3126 for libdir in $compile_rpath $finalize_rpath; do
3127 if test -n "$hardcode_libdir_flag_spec"; then
3128 if test -n "$hardcode_libdir_separator"; then
3129 if test -z "$hardcode_libdirs"; then
3130 hardcode_libdirs="$libdir"
3132 # Just accumulate the unique libdirs.
3133 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3134 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3137 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3142 eval flag=\"$hardcode_libdir_flag_spec\"
3143 rpath="$rpath $flag"
3145 elif test -n "$runpath_var"; then
3146 case "$perm_rpath " in
3148 *) perm_rpath="$perm_rpath $libdir" ;;
3152 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3153 case :$dllsearchpath: in
3155 *) dllsearchpath="$dllsearchpath:$libdir";;
3160 # Substitute the hardcoded libdirs into the rpath.
3161 if test -n "$hardcode_libdir_separator" &&
3162 test -n "$hardcode_libdirs"; then
3163 libdir="$hardcode_libdirs"
3164 eval rpath=\" $hardcode_libdir_flag_spec\"
3166 compile_rpath="$rpath"
3170 for libdir in $finalize_rpath; do
3171 if test -n "$hardcode_libdir_flag_spec"; then
3172 if test -n "$hardcode_libdir_separator"; then
3173 if test -z "$hardcode_libdirs"; then
3174 hardcode_libdirs="$libdir"
3176 # Just accumulate the unique libdirs.
3177 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3178 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3181 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3186 eval flag=\"$hardcode_libdir_flag_spec\"
3187 rpath="$rpath $flag"
3189 elif test -n "$runpath_var"; then
3190 case "$finalize_perm_rpath " in
3192 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3196 # Substitute the hardcoded libdirs into the rpath.
3197 if test -n "$hardcode_libdir_separator" &&
3198 test -n "$hardcode_libdirs"; then
3199 libdir="$hardcode_libdirs"
3200 eval rpath=\" $hardcode_libdir_flag_spec\"
3202 finalize_rpath="$rpath"
3204 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3205 # Transform all the library objects into standard objects.
3206 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3207 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3211 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3212 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3213 dlsyms="${outputname}S.c"
3215 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3219 if test -n "$dlsyms"; then
3223 # Discover the nlist of each of the dlfiles.
3224 nlist="$output_objdir/${outputname}.nm"
3226 $show "$rm $nlist ${nlist}S ${nlist}T"
3227 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3229 # Parse the name list into a source file.
3230 $show "creating $output_objdir/$dlsyms"
3232 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3233 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3234 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3240 /* Prevent the only kind of declaration conflicts we can make. */
3241 #define lt_preloaded_symbols some_other_symbol
3243 /* External symbol declarations for the compiler. */\
3246 if test "$dlself" = yes; then
3247 $show "generating symbol list for \`$output'"
3249 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3251 # Add our own program objects to the symbol list.
3252 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3253 for arg in $progfiles; do
3254 $show "extracting global C symbols from \`$arg'"
3255 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3258 if test -n "$exclude_expsyms"; then
3259 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3260 $run eval '$mv "$nlist"T "$nlist"'
3263 if test -n "$export_symbols_regex"; then
3264 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3265 $run eval '$mv "$nlist"T "$nlist"'
3268 # Prepare the list of exported symbols
3269 if test -z "$export_symbols"; then
3270 export_symbols="$output_objdir/$output.exp"
3271 $run $rm $export_symbols
3272 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3274 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3275 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3276 $run eval 'mv "$nlist"T "$nlist"'
3280 for arg in $dlprefiles; do
3281 $show "extracting global C symbols from \`$arg'"
3282 name=`echo "$arg" | sed -e 's%^.*/%%'`
3283 $run eval 'echo ": $name " >> "$nlist"'
3284 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3287 if test -z "$run"; then
3288 # Make sure we have at least an empty file.
3289 test -f "$nlist" || : > "$nlist"
3291 if test -n "$exclude_expsyms"; then
3292 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3293 $mv "$nlist"T "$nlist"
3296 # Try sorting and uniquifying the output.
3297 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3300 grep -v "^: " < "$nlist" > "$nlist"S
3303 if test -f "$nlist"S; then
3304 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3306 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3309 $echo >> "$output_objdir/$dlsyms" "\
3311 #undef lt_preloaded_symbols
3313 #if defined (__STDC__) && __STDC__
3314 # define lt_ptr void *
3316 # define lt_ptr char *
3320 /* The mapping between symbol names and symbols. */
3325 lt_preloaded_symbols[] =
3329 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3331 $echo >> "$output_objdir/$dlsyms" "\
3335 /* This works around a problem in FreeBSD linker */
3336 #ifdef FREEBSD_WORKAROUND
3337 static const void *lt_preloaded_setup() {
3338 return lt_preloaded_symbols;
3348 pic_flag_for_symtable=
3350 # compiling the symbol table file with pic_flag works around
3351 # a FreeBSD bug that causes programs to crash when -lm is
3352 # linked before any other PIC object. But we must not use
3353 # pic_flag when linking with -static. The problem exists in
3354 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3355 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3356 case "$compile_command " in
3358 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3361 case "$compile_command " in
3363 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3367 # Now compile the dynamic symbol file.
3368 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3369 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3371 # Clean up the generated files.
3372 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3373 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3375 # Transform the symbol file into the correct name.
3376 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3377 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3380 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3385 # We keep going just in case the user didn't refer to
3386 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3387 # really was required.
3389 # Nullify the symbol file.
3390 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3391 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3394 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3395 # Replace the output file specification.
3396 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3397 link_command="$compile_command$compile_rpath"
3399 # We have no uninstalled library dependencies, so finalize right now.
3400 $show "$link_command"
3401 $run eval "$link_command"
3404 # Delete the generated files.
3405 if test -n "$dlsyms"; then
3406 $show "$rm $output_objdir/${outputname}S.${objext}"
3407 $run $rm "$output_objdir/${outputname}S.${objext}"
3413 if test -n "$shlibpath_var"; then
3414 # We should set the shlibpath_var
3416 for dir in $temp_rpath; do
3418 [\\/]* | [A-Za-z]:[\\/]*)
3423 # Relative path: add a thisdir entry.
3424 rpath="$rpath\$thisdir/$dir:"
3431 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3432 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3434 if test -n "$finalize_shlibpath"; then
3435 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3440 if test -n "$runpath_var"; then
3441 if test -n "$perm_rpath"; then
3442 # We should set the runpath_var.
3444 for dir in $perm_rpath; do
3447 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3449 if test -n "$finalize_perm_rpath"; then
3450 # We should set the runpath_var.
3452 for dir in $finalize_perm_rpath; do
3455 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3459 if test "$no_install" = yes; then
3460 # We don't need to create a wrapper script.
3461 link_command="$compile_var$compile_command$compile_rpath"
3462 # Replace the output file specification.
3463 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3464 # Delete the old output file.
3466 # Link the executable and exit
3467 $show "$link_command"
3468 $run eval "$link_command" || exit $?
3472 if test "$hardcode_action" = relink; then
3473 # Fast installation is not supported
3474 link_command="$compile_var$compile_command$compile_rpath"
3475 relink_command="$finalize_var$finalize_command$finalize_rpath"
3477 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3478 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3480 if test "$fast_install" != no; then
3481 link_command="$finalize_var$compile_command$finalize_rpath"
3482 if test "$fast_install" = yes; then
3483 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3485 # fast_install is set to needless
3489 link_command="$compile_var$compile_command$compile_rpath"
3490 relink_command="$finalize_var$finalize_command$finalize_rpath"
3494 # Replace the output file specification.
3495 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3497 # Delete the old output files.
3498 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3500 $show "$link_command"
3501 $run eval "$link_command" || exit $?
3503 # Now create the wrapper script.
3504 $show "creating $output"
3506 # Quote the relink command for shipping.
3507 if test -n "$relink_command"; then
3508 # Preserve any variables that may affect compiler behavior
3509 for var in $variables_saved_for_relink; do
3510 if eval test -z \"\${$var+set}\"; then
3511 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3512 elif eval var_value=\$$var; test -z "$var_value"; then
3513 relink_command="$var=; export $var; $relink_command"
3515 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3516 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3519 relink_command="cd `pwd`; $relink_command"
3520 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3523 # Quote $echo for shipping.
3524 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3526 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3527 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3529 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3531 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3534 # Only actually do things if our run command is non-null.
3535 if test -z "$run"; then
3536 # win32 will think the script is a binary if it has
3537 # a .exe suffix, so we strip it off here.
3539 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3541 # test for cygwin because mv fails w/o .exe extensions
3543 *cygwin*) exeext=.exe ;;
3547 trap "$rm $output; exit 1" 1 2 15
3552 # $output - temporary wrapper script for $objdir/$outputname
3553 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3555 # The $output program cannot be directly executed until all the libtool
3556 # libraries that it depends on are installed.
3558 # This wrapper script should never be moved out of the build directory.
3559 # If it is, it will not operate correctly.
3561 # Sed substitution that helps us do robust quoting. It backslashifies
3562 # metacharacters that are still active within double-quoted strings.
3563 Xsed='sed -e 1s/^X//'
3564 sed_quote_subst='$sed_quote_subst'
3566 # The HP-UX ksh and POSIX shell print the target directory to stdout
3568 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3570 relink_command=\"$relink_command\"
3572 # This environment variable determines our operation mode.
3573 if test \"\$libtool_install_magic\" = \"$magic\"; then
3574 # install mode needs the following variable:
3575 notinst_deplibs='$notinst_deplibs'
3577 # When we are sourced in execute mode, \$file and \$echo are already set.
3578 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3581 # Make sure echo works.
3582 if test \"X\$1\" = X--no-reexec; then
3583 # Discard the --no-reexec flag, and continue.
3585 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3586 # Yippee, \$echo works!
3589 # Restart under the correct shell, and then maybe \$echo will work.
3590 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3596 # Find the directory that this script lives in.
3597 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3598 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3600 # Follow symbolic links until we get to the real thisdir.
3601 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3602 while test -n \"\$file\"; do
3603 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3605 # If there was a directory component, then change thisdir.
3606 if test \"x\$destdir\" != \"x\$file\"; then
3607 case \"\$destdir\" in
3608 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3609 *) thisdir=\"\$thisdir/\$destdir\" ;;
3613 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3614 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3617 # Try to get the absolute directory name.
3618 absdir=\`cd \"\$thisdir\" && pwd\`
3619 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3622 if test "$fast_install" = yes; then
3624 program=lt-'$outputname'$exeext
3625 progdir=\"\$thisdir/$objdir\"
3627 if test ! -f \"\$progdir/\$program\" || \\
3628 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3629 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3631 file=\"\$\$-\$program\"
3633 if test ! -d \"\$progdir\"; then
3634 $mkdir \"\$progdir\"
3636 $rm \"\$progdir/\$file\"
3641 # relink executable if necessary
3642 if test -n \"\$relink_command\"; then
3643 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3645 $echo \"\$relink_command_output\" >&2
3646 $rm \"\$progdir/\$file\"
3651 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3652 { $rm \"\$progdir/\$program\";
3653 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3654 $rm \"\$progdir/\$file\"
3658 program='$outputname'
3659 progdir=\"\$thisdir/$objdir\"
3665 if test -f \"\$progdir/\$program\"; then"
3667 # Export our shlibpath_var if we have one.
3668 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3670 # Add our own library path to $shlibpath_var
3671 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3673 # Some systems cannot cope with colon-terminated $shlibpath_var
3674 # The second colon is a workaround for a bug in BeOS R4 sed
3675 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3677 export $shlibpath_var
3681 # fixup the dll searchpath if we need to.
3682 if test -n "$dllsearchpath"; then
3684 # Add the dll search path components to the executable PATH
3685 PATH=$dllsearchpath:\$PATH
3690 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3691 # Run the actual program with our arguments.
3694 # win32 systems need to use the prog path for dll
3696 *-*-cygwin* | *-*-pw32*)
3698 exec \$progdir/\$program \${1+\"\$@\"}
3702 # Backslashes separate directories on plain windows
3703 *-*-mingw | *-*-os2*)
3705 exec \$progdir\\\\\$program \${1+\"\$@\"}
3711 # Export the path to the program.
3712 PATH=\"\$progdir:\$PATH\"
3715 exec \$program \${1+\"\$@\"}
3720 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3724 # The program doesn't exist.
3725 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3726 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3727 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3738 # See if we need to build an old-fashioned archive.
3739 for oldlib in $oldlibs; do
3741 if test "$build_libtool_libs" = convenience; then
3742 oldobjs="$libobjs_save"
3743 addlibs="$convenience"
3744 build_libtool_libs=no
3746 if test "$build_libtool_libs" = module; then
3747 oldobjs="$libobjs_save"
3748 build_libtool_libs=no
3750 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3752 addlibs="$old_convenience"
3755 if test -n "$addlibs"; then
3756 gentop="$output_objdir/${outputname}x"
3757 $show "${rm}r $gentop"
3758 $run ${rm}r "$gentop"
3759 $show "mkdir $gentop"
3760 $run mkdir "$gentop"
3762 if test $status -ne 0 && test ! -d "$gentop"; then
3765 generated="$generated $gentop"
3767 # Add in members from convenience archives.
3768 for xlib in $addlibs; do
3769 # Extract the objects.
3771 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3772 *) xabs=`pwd`"/$xlib" ;;
3774 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3775 xdir="$gentop/$xlib"
3777 $show "${rm}r $xdir"
3782 if test $status -ne 0 && test ! -d "$xdir"; then
3785 $show "(cd $xdir && $AR x $xabs)"
3786 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3788 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3792 # Do each command in the archive commands.
3793 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3794 eval cmds=\"$old_archive_from_new_cmds\"
3796 # Ensure that we have .o objects in place in case we decided
3797 # not to build a shared library, and have fallen back to building
3798 # static libs even though --disable-static was passed!
3799 for oldobj in $oldobjs; do
3800 if test ! -f $oldobj; then
3801 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3802 if test "X$xdir" = "X$oldobj"; then
3807 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3808 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3809 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3810 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3814 eval cmds=\"$old_archive_cmds\"
3816 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
3817 for cmd in $cmds; do
3820 $run eval "$cmd" || exit $?
3825 if test -n "$generated"; then
3826 $show "${rm}r$generated"
3827 $run ${rm}r$generated
3830 # Now create the libtool archive.
3834 test "$build_old_libs" = yes && old_library="$libname.$libext"
3835 $show "creating $output"
3837 # Preserve any variables that may affect compiler behavior
3838 for var in $variables_saved_for_relink; do
3839 if eval test -z \"\${$var+set}\"; then
3840 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3841 elif eval var_value=\$$var; test -z "$var_value"; then
3842 relink_command="$var=; export $var; $relink_command"
3844 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3845 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3848 # Quote the link command for shipping.
3849 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3850 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3852 # Only create the output if not a dry run.
3853 if test -z "$run"; then
3854 for installed in no yes; do
3855 if test "$installed" = yes; then
3856 if test -z "$install_libdir"; then
3859 output="$output_objdir/$outputname"i
3860 # Replace all uninstalled libtool libraries with the installed ones
3862 for deplib in $dependency_libs; do
3865 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3866 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3867 if test -z "$libdir"; then
3868 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3871 newdependency_libs="$newdependency_libs $libdir/$name"
3873 *) newdependency_libs="$newdependency_libs $deplib" ;;
3876 dependency_libs="$newdependency_libs"
3878 for lib in $dlfiles; do
3879 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3880 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3881 if test -z "$libdir"; then
3882 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3885 newdlfiles="$newdlfiles $libdir/$name"
3887 dlfiles="$newdlfiles"
3889 for lib in $dlprefiles; do
3890 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3891 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3892 if test -z "$libdir"; then
3893 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3896 newdlprefiles="$newdlprefiles $libdir/$name"
3898 dlprefiles="$newdlprefiles"
3901 # place dlname in correct position for cygwin
3903 case $host,$output,$installed,$module,$dlname in
3904 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3907 # $outputname - a libtool library file
3908 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3910 # Please DO NOT delete this file!
3911 # It is necessary for linking the library.
3913 # The name that we can dlopen(3).
3916 # Names of this library.
3917 library_names='$library_names'
3919 # The name of the static archive.
3920 old_library='$old_library'
3922 # Libraries that this one depends upon.
3923 dependency_libs='$dependency_libs'
3925 # Version information for $libname.
3930 # Is this an already installed library?
3931 installed=$installed
3933 # Files to dlopen/dlpreopen
3935 dlpreopen='$dlprefiles'
3937 # Directory that this library needs to be installed in:
3938 libdir='$install_libdir'"
3939 if test "$installed" = no && test $need_relink = yes; then
3941 relink_command=\"$relink_command\""
3946 # Do a symbolic link so that the libtool archive can be found in
3947 # LD_LIBRARY_PATH before the program is installed.
3948 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3949 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3955 # libtool install mode
3957 modename="$modename: install"
3959 # There may be an optional sh(1) argument at the beginning of
3960 # install_prog (especially on Windows NT).
3961 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3962 # Allow the use of GNU shtool's install command.
3963 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3964 # Aesthetically quote it.
3965 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3967 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3971 install_prog="$arg "
3979 # The real first argument should be the name of the installation program.
3980 # Aesthetically quote it.
3981 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3983 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3987 install_prog="$install_prog$arg"
3989 # We need to accept at least all the BSD install flags.
3999 if test -n "$dest"; then
4000 files="$files $dest"
4018 # If the previous option needed an argument, then skip it.
4019 if test -n "$prev"; then
4028 # Aesthetically quote the argument.
4029 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4031 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4035 install_prog="$install_prog $arg"
4038 if test -z "$install_prog"; then
4039 $echo "$modename: you must specify an install program" 1>&2
4044 if test -n "$prev"; then
4045 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4050 if test -z "$files"; then
4051 if test -z "$dest"; then
4052 $echo "$modename: no file or destination specified" 1>&2
4054 $echo "$modename: you must specify a destination" 1>&2
4060 # Strip any trailing slash from the destination.
4061 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4063 # Check to see that the destination is a directory.
4064 test -d "$dest" && isdir=yes
4065 if test "$isdir" = yes; then
4069 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4070 test "X$destdir" = "X$dest" && destdir=.
4071 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4073 # Not a directory, so check to see that there is only one file specified.
4075 if test $# -gt 2; then
4076 $echo "$modename: \`$dest' is not a directory" 1>&2
4082 [\\/]* | [A-Za-z]:[\\/]*) ;;
4084 for file in $files; do
4088 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4097 # This variable tells wrapper scripts just to set variables rather
4098 # than running their programs.
4099 libtool_install_magic="$magic"
4104 for file in $files; do
4106 # Do each installation.
4109 # Do the static libraries later.
4110 staticlibs="$staticlibs $file"
4114 # Check to see that this really is a libtool archive.
4115 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4117 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4125 # If there is no directory component, then add one.
4127 */* | *\\*) . $file ;;
4131 # Add the libdir to current_libdirs if it is the destination.
4132 if test "X$destdir" = "X$libdir"; then
4133 case "$current_libdirs " in
4135 *) current_libdirs="$current_libdirs $libdir" ;;
4138 # Note the libdir as a future libdir.
4139 case "$future_libdirs " in
4141 *) future_libdirs="$future_libdirs $libdir" ;;
4145 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4146 test "X$dir" = "X$file/" && dir=
4149 if test -n "$relink_command"; then
4150 $echo "$modename: warning: relinking \`$file'" 1>&2
4151 $show "$relink_command"
4152 if $run eval "$relink_command"; then :
4154 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4159 # See the names of the shared library.
4160 set dummy $library_names
4161 if test -n "$2"; then
4167 test -n "$relink_command" && srcname="$realname"T
4169 # Install the shared library and build the symlinks.
4170 $show "$install_prog $dir/$srcname $destdir/$realname"
4171 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4172 if test -n "$stripme" && test -n "$striplib"; then
4173 $show "$striplib $destdir/$realname"
4174 $run eval "$striplib $destdir/$realname" || exit $?
4177 if test $# -gt 0; then
4178 # Delete the old symlinks, and create new ones.
4181 if test "$linkname" != "$realname"; then
4182 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4183 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4188 # Do each command in the postinstall commands.
4189 lib="$destdir/$realname"
4190 eval cmds=\"$postinstall_cmds\"
4191 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4192 for cmd in $cmds; do
4195 $run eval "$cmd" || exit $?
4200 # Install the pseudo-library for information purposes.
4201 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4202 instname="$dir/$name"i
4203 $show "$install_prog $instname $destdir/$name"
4204 $run eval "$install_prog $instname $destdir/$name" || exit $?
4206 # Maybe install the static library, too.
4207 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4211 # Install (i.e. copy) a libtool object.
4213 # Figure out destination file name, if it wasn't already specified.
4214 if test -n "$destname"; then
4215 destfile="$destdir/$destname"
4217 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4218 destfile="$destdir/$destfile"
4221 # Deduce the name of the destination old-style object file.
4224 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4227 staticdest="$destfile"
4231 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4237 # Install the libtool object if requested.
4238 if test -n "$destfile"; then
4239 $show "$install_prog $file $destfile"
4240 $run eval "$install_prog $file $destfile" || exit $?
4243 # Install the old object if enabled.
4244 if test "$build_old_libs" = yes; then
4245 # Deduce the name of the old-style object file.
4246 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4248 $show "$install_prog $staticobj $staticdest"
4249 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4255 # Figure out destination file name, if it wasn't already specified.
4256 if test -n "$destname"; then
4257 destfile="$destdir/$destname"
4259 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4260 destfile="$destdir/$destfile"
4263 # Do a test to see if this is really a libtool program.
4264 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4268 # If there is no directory component, then add one.
4270 */* | *\\*) . $file ;;
4274 # Check the variables that should have been set.
4275 if test -z "$notinst_deplibs"; then
4276 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4281 for lib in $notinst_deplibs; do
4282 # Check to see that each library is installed.
4284 if test -f "$lib"; then
4285 # If there is no directory component, then add one.
4287 */* | *\\*) . $lib ;;
4291 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4292 if test -n "$libdir" && test ! -f "$libfile"; then
4293 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4299 # If there is no directory component, then add one.
4301 */* | *\\*) . $file ;;
4306 if test "$fast_install" = no && test -n "$relink_command"; then
4307 if test "$finalize" = yes && test -z "$run"; then
4309 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4310 tmpdir="$tmpdir/libtool-$$"
4311 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4313 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4316 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4317 outputname="$tmpdir/$file"
4318 # Replace the output file specification.
4319 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4321 $show "$relink_command"
4322 if $run eval "$relink_command"; then :
4324 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4330 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4333 # Install the binary that we compiled earlier.
4334 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4338 # remove .exe since cygwin /usr/bin/install will append another
4340 case $install_prog,$host in
4341 /usr/bin/install*,*cygwin*)
4342 case $file:$destfile in
4347 destfile=$destfile.exe
4350 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4355 $show "$install_prog$stripme $file $destfile"
4356 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4357 test -n "$outputname" && ${rm}r "$tmpdir"
4362 for file in $staticlibs; do
4363 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4365 # Set up the ranlib parameters.
4366 oldlib="$destdir/$name"
4368 $show "$install_prog $file $oldlib"
4369 $run eval "$install_prog \$file \$oldlib" || exit $?
4371 if test -n "$stripme" && test -n "$striplib"; then
4372 $show "$old_striplib $oldlib"
4373 $run eval "$old_striplib $oldlib" || exit $?
4376 # Do each command in the postinstall commands.
4377 eval cmds=\"$old_postinstall_cmds\"
4378 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4379 for cmd in $cmds; do
4382 $run eval "$cmd" || exit $?
4387 if test -n "$future_libdirs"; then
4388 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4391 if test -n "$current_libdirs"; then
4392 # Maybe just do a dry run.
4393 test -n "$run" && current_libdirs=" -n$current_libdirs"
4394 exec_cmd='$SHELL $0 --finish$current_libdirs'
4400 # libtool finish mode
4402 modename="$modename: finish"
4406 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4409 libdirs="$libdirs $dir"
4412 for libdir in $libdirs; do
4413 if test -n "$finish_cmds"; then
4414 # Do each command in the finish commands.
4415 eval cmds=\"$finish_cmds\"
4416 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4417 for cmd in $cmds; do
4420 $run eval "$cmd" || admincmds="$admincmds
4425 if test -n "$finish_eval"; then
4426 # Do the single finish_eval.
4427 eval cmds=\"$finish_eval\"
4428 $run eval "$cmds" || admincmds="$admincmds
4434 # Exit here if they wanted silent mode.
4435 test "$show" = ":" && exit 0
4437 echo "----------------------------------------------------------------------"
4438 echo "Libraries have been installed in:"
4439 for libdir in $libdirs; do
4443 echo "If you ever happen to want to link against installed libraries"
4444 echo "in a given directory, LIBDIR, you must either use libtool, and"
4445 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4446 echo "flag during linking and do at least one of the following:"
4447 if test -n "$shlibpath_var"; then
4448 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4449 echo " during execution"
4451 if test -n "$runpath_var"; then
4452 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4453 echo " during linking"
4455 if test -n "$hardcode_libdir_flag_spec"; then
4457 eval flag=\"$hardcode_libdir_flag_spec\"
4459 echo " - use the \`$flag' linker flag"
4461 if test -n "$admincmds"; then
4462 echo " - have your system administrator run these commands:$admincmds"
4464 if test -f /etc/ld.so.conf; then
4465 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4468 echo "See any operating system documentation about shared libraries for"
4469 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4470 echo "----------------------------------------------------------------------"
4474 # libtool execute mode
4476 modename="$modename: execute"
4478 # The first argument is the command name.
4480 if test -z "$cmd"; then
4481 $echo "$modename: you must specify a COMMAND" 1>&2
4486 # Handle -dlopen flags immediately.
4487 for file in $execute_dlfiles; do
4488 if test ! -f "$file"; then
4489 $echo "$modename: \`$file' is not a file" 1>&2
4497 # Check to see that this really is a libtool archive.
4498 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4500 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4505 # Read the libtool library.
4509 # If there is no directory component, then add one.
4511 */* | *\\*) . $file ;;
4515 # Skip this library if it cannot be dlopened.
4516 if test -z "$dlname"; then
4517 # Warn if it was a shared library.
4518 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4522 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4523 test "X$dir" = "X$file" && dir=.
4525 if test -f "$dir/$objdir/$dlname"; then
4528 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4534 # Just add the directory containing the .lo file.
4535 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4536 test "X$dir" = "X$file" && dir=.
4540 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4545 # Get the absolute pathname.
4546 absdir=`cd "$dir" && pwd`
4547 test -n "$absdir" && dir="$absdir"
4549 # Now add the directory to shlibpath_var.
4550 if eval "test -z \"\$$shlibpath_var\""; then
4551 eval "$shlibpath_var=\"\$dir\""
4553 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4557 # This variable tells wrapper scripts just to set shlibpath_var
4558 # rather than running their programs.
4559 libtool_execute_magic="$magic"
4561 # Check if any of the arguments is a wrapper script.
4568 # Do a test to see if this is really a libtool program.
4569 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4570 # If there is no directory component, then add one.
4572 */* | *\\*) . $file ;;
4576 # Transform arg to wrapped name.
4577 file="$progdir/$program"
4581 # Quote arguments (to preserve shell metacharacters).
4582 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4583 args="$args \"$file\""
4586 if test -z "$run"; then
4587 if test -n "$shlibpath_var"; then
4588 # Export the shlibpath_var.
4589 eval "export $shlibpath_var"
4592 # Restore saved enviroment variables
4593 if test "${save_LC_ALL+set}" = set; then
4594 LC_ALL="$save_LC_ALL"; export LC_ALL
4596 if test "${save_LANG+set}" = set; then
4597 LANG="$save_LANG"; export LANG
4600 # Now prepare to actually exec the command.
4601 exec_cmd='"$cmd"$args'
4603 # Display what would be done.
4604 if test -n "$shlibpath_var"; then
4605 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4606 $echo "export $shlibpath_var"
4613 # libtool clean and uninstall mode
4615 modename="$modename: $mode"
4621 # This variable tells wrapper scripts just to set variables rather
4622 # than running their programs.
4623 libtool_install_magic="$magic"
4628 -f) rm="$rm $arg"; rmforce=yes ;;
4629 -*) rm="$rm $arg" ;;
4630 *) files="$files $arg" ;;
4634 if test -z "$rm"; then
4635 $echo "$modename: you must specify an RM program" 1>&2
4642 for file in $files; do
4643 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4644 if test "X$dir" = "X$file"; then
4648 objdir="$dir/$objdir"
4650 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4651 test $mode = uninstall && objdir="$dir"
4653 # Remember objdir for removal later, being careful to avoid duplicates
4654 if test $mode = clean; then
4657 *) rmdirs="$rmdirs $objdir" ;;
4661 # Don't error if the file doesn't exist and rm -f was used.
4662 if (test -L "$file") >/dev/null 2>&1 \
4663 || (test -h "$file") >/dev/null 2>&1 \
4664 || test -f "$file"; then
4666 elif test -d "$file"; then
4669 elif test "$rmforce" = yes; then
4677 # Possibly a libtool archive, so verify it.
4678 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4681 # Delete the libtool libraries and symlinks.
4682 for n in $library_names; do
4683 rmfiles="$rmfiles $objdir/$n"
4685 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4686 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4688 if test $mode = uninstall; then
4689 if test -n "$library_names"; then
4690 # Do each command in the postuninstall commands.
4691 eval cmds=\"$postuninstall_cmds\"
4692 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4693 for cmd in $cmds; do
4697 if test $? != 0 && test "$rmforce" != yes; then
4704 if test -n "$old_library"; then
4705 # Do each command in the old_postuninstall commands.
4706 eval cmds=\"$old_postuninstall_cmds\"
4707 IFS="${IFS= }"; save_ifs="$IFS"; IFS='~'
4708 for cmd in $cmds; do
4712 if test $? != 0 && test "$rmforce" != yes; then
4718 # FIXME: should reinstall the best remaining shared library.
4724 if test "$build_old_libs" = yes; then
4725 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4726 rmfiles="$rmfiles $dir/$oldobj"
4731 # Do a test to see if this is a libtool program.
4732 if test $mode = clean &&
4733 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4737 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4738 if test "$fast_install" = yes && test -n "$relink_command"; then
4739 rmfiles="$rmfiles $objdir/lt-$name"
4744 $show "$rm $rmfiles"
4745 $run $rm $rmfiles || exit_status=1
4748 # Try to remove the ${objdir}s in the directories where we deleted files
4749 for dir in $rmdirs; do
4750 if test -d "$dir"; then
4752 $run rmdir $dir >/dev/null 2>&1
4760 $echo "$modename: you must specify a MODE" 1>&2
4761 $echo "$generic_help" 1>&2
4766 if test -z "$exec_cmd"; then
4767 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4768 $echo "$generic_help" 1>&2
4771 fi # test -z "$show_help"
4773 if test -n "$exec_cmd"; then
4778 # We need to display help for each of the modes.
4781 "Usage: $modename [OPTION]... [MODE-ARG]...
4783 Provide generalized library-building support services.
4785 --config show all configuration variables
4786 --debug enable verbose shell tracing
4787 -n, --dry-run display commands without modifying any files
4788 --features display basic configuration information and exit
4789 --finish same as \`--mode=finish'
4790 --help display this help message and exit
4791 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4792 --quiet same as \`--silent'
4793 --silent don't print informational messages
4794 --version print version information
4796 MODE must be one of the following:
4798 clean remove files from the build directory
4799 compile compile a source file into a libtool object
4800 execute automatically set library path, then run a program
4801 finish complete the installation of libtool libraries
4802 install install libraries or executables
4803 link create a library or an executable
4804 uninstall remove libraries from an installed directory
4806 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4807 a more detailed description of MODE."
4813 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4815 Remove files from the build directory.
4817 RM is the name of the program to use to delete files associated with each FILE
4818 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4821 If FILE is a libtool library, object or program, all the files associated
4822 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4827 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4829 Compile a source file into a libtool library object.
4831 This mode accepts the following additional options:
4833 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4834 -prefer-pic try to building PIC objects only
4835 -prefer-non-pic try to building non-PIC objects only
4836 -static always build a \`.o' file suitable for static linking
4838 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4839 from the given SOURCEFILE.
4841 The output file name is determined by removing the directory component from
4842 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4843 library object suffix, \`.lo'."
4848 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4850 Automatically set library path, then run a program.
4852 This mode accepts the following additional options:
4854 -dlopen FILE add the directory containing FILE to the library path
4856 This mode sets the library path environment variable according to \`-dlopen'
4859 If any of the ARGS are libtool executable wrappers, then they are translated
4860 into their corresponding uninstalled binary, and any of their required library
4861 directories are added to the library path.
4863 Then, COMMAND is executed, with ARGS as arguments."
4868 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4870 Complete the installation of libtool libraries.
4872 Each LIBDIR is a directory that contains libtool libraries.
4874 The commands that this mode executes may require superuser privileges. Use
4875 the \`--dry-run' option if you just want to see what would be executed."
4880 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4882 Install executables or libraries.
4884 INSTALL-COMMAND is the installation command. The first component should be
4885 either the \`install' or \`cp' program.
4887 The rest of the components are interpreted as arguments to that command (only
4888 BSD-compatible install options are recognized)."
4893 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4895 Link object files or libraries together to form another library, or to
4896 create an executable program.
4898 LINK-COMMAND is a command using the C compiler that you would use to create
4899 a program from several object files.
4901 The following components of LINK-COMMAND are treated specially:
4903 -all-static do not do any dynamic linking at all
4904 -avoid-version do not add a version suffix if possible
4905 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4906 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4907 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4908 -export-symbols SYMFILE
4909 try to export only the symbols listed in SYMFILE
4910 -export-symbols-regex REGEX
4911 try to export only the symbols matching REGEX
4912 -LLIBDIR search LIBDIR for required installed libraries
4913 -lNAME OUTPUT-FILE requires the installed library libNAME
4914 -module build a library that can dlopened
4915 -no-fast-install disable the fast-install mode
4916 -no-install link a not-installable executable
4917 -no-undefined declare that a library does not refer to external symbols
4918 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4919 -release RELEASE specify package release information
4920 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4921 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4922 -static do not do any dynamic linking of libtool libraries
4923 -version-info CURRENT[:REVISION[:AGE]]
4924 specify library version info [each variable defaults to 0]
4926 All other options (arguments beginning with \`-') are ignored.
4928 Every other argument is treated as a filename. Files ending in \`.la' are
4929 treated as uninstalled libtool libraries, other files are standard or library
4932 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4933 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4934 required, except when creating a convenience library.
4936 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4937 using \`ar' and \`ranlib', or on Windows using \`lib'.
4939 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4940 is created, otherwise an executable program is created."
4945 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4947 Remove libraries from an installation directory.
4949 RM is the name of the program to use to delete files associated with each FILE
4950 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4953 If FILE is a libtool library, all the files associated with it are deleted.
4954 Otherwise, only FILE itself is deleted using RM."
4958 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4965 $echo "Try \`$modename --help' for more information about other modes."