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.79 2001/11/28 21:50:31)"
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 # Make sure IFS has a sensible default
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
108 # Parse our command line options once, thoroughly.
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
123 execute_dlfiles="$execute_dlfiles $arg"
135 # Have we seen a non-optional argument yet?
142 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
147 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
152 echo "$progname: enabling shell trace mode"
162 if test "$build_libtool_libs" = yes; then
163 echo "enable shared libraries"
165 echo "disable shared libraries"
167 if test "$build_old_libs" = yes; then
168 echo "enable static libraries"
170 echo "disable static libraries"
175 --finish) mode="finish" ;;
177 --mode) prevopt="--mode" prev=mode ;;
178 --mode=*) mode="$optarg" ;;
180 --preserve-dup-deps) duplicate_deps="yes" ;;
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
204 if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
210 # If this variable is set in any of the actions, the command in it
211 # will be execed at the end. This prevents here-documents from being
212 # left over by shells.
215 if test -z "$show_help"; then
217 # Infer the operation mode.
218 if test -z "$mode"; then
220 *cc | *++ | gcc* | *-gcc*)
232 *db | *dbx | *strace | *truss)
242 # If we have no mode, but dlfiles were specified, then do execute mode.
243 test -n "$execute_dlfiles" && mode=execute
245 # Just use the default operation mode.
246 if test -z "$mode"; then
247 if test -n "$nonopt"; then
248 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
250 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
257 # Only execute mode is allowed to have -dlopen flags.
258 if test -n "$execute_dlfiles" && test "$mode" != execute; then
259 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
264 # Change the help message to a mode-specific one.
266 help="Try \`$modename --help --mode=$mode' for more information."
268 # These modes are in order of execution frequency so that they run quickly.
270 # libtool compile mode
272 modename="$modename: compile"
273 # Get the compilation command and the source file.
286 # Aesthetically quote the previous argument.
288 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
291 # Double-quote args containing other shell metacharacters.
292 # Many Bourne shells cannot handle close brackets correctly
293 # in scan sets, so we specify it separately.
294 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
299 # Add the previous argument to base_compile.
300 if test -z "$base_compile"; then
301 base_compile="$lastarg"
303 base_compile="$base_compile $lastarg"
309 # Accept any command-line options.
312 if test "$user_target" != "no"; then
313 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
340 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
342 save_ifs="$IFS"; IFS=','
346 # Double-quote args containing other shell metacharacters.
347 # Many Bourne shells cannot handle close brackets correctly
348 # in scan sets, so we specify it separately.
350 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
354 lastarg="$lastarg $arg"
357 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
359 # Add the arguments to base_compile.
360 if test -z "$base_compile"; then
361 base_compile="$lastarg"
363 base_compile="$base_compile $lastarg"
371 # The next one is the -o target name
376 # We got the output file
383 # Accept the current argument as the source file.
387 # Aesthetically quote the previous argument.
389 # Backslashify any backslashes, double quotes, and dollar signs.
390 # These are the only characters that are still specially
391 # interpreted inside of double-quoted scrings.
392 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
394 # Double-quote args containing other shell metacharacters.
395 # Many Bourne shells cannot handle close brackets correctly
396 # in scan sets, so we specify it separately.
398 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
399 lastarg="\"$lastarg\""
403 # Add the previous argument to base_compile.
404 if test -z "$base_compile"; then
405 base_compile="$lastarg"
407 base_compile="$base_compile $lastarg"
415 # Get the name of the library object.
416 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
419 $echo "$modename: you must specify a target with \`-o'" 1>&2
424 # Recognize several different file suffixes.
425 # If the user specifies -o file.o, it is replaced with file.lo
440 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
443 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
445 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
450 if test -z "$base_compile"; then
451 $echo "$modename: you must specify a compilation command" 1>&2
456 # Delete any leftover library objects.
457 if test "$build_old_libs" = yes; then
458 removelist="$obj $libobj"
464 trap "$run $rm $removelist; exit 1" 1 2 15
466 # On Cygwin there's no "real" PIC flag so we must build both object types
468 cygwin* | mingw* | pw32* | os2*)
472 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
473 # non-PIC code in shared libraries is not supported
477 # Calculate the filename of the output object if compiler does
478 # not support -o with -c
479 if test "$compiler_c_o" = no; then
480 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481 lockfile="$output_obj.lock"
482 removelist="$removelist $output_obj $lockfile"
483 trap "$run $rm $removelist; exit 1" 1 2 15
489 # Lock this critical section if it is needed
490 # We use this script file to make the link, it avoids creating a new file
491 if test "$need_locks" = yes; then
492 until $run ln "$0" "$lockfile" 2>/dev/null; do
493 $show "Waiting for $lockfile to be removed"
496 elif test "$need_locks" = warn; then
497 if test -f "$lockfile"; then
499 *** ERROR, $lockfile exists and contains:
500 `cat $lockfile 2>/dev/null`
502 This indicates that another process is trying to use the same
503 temporary object file, and libtool could not work around it because
504 your compiler does not support \`-c' and \`-o' together. If you
505 repeat this compilation, it may succeed, by chance, but you had better
506 avoid parallel builds (make -j) in this platform, or get a better
512 echo $srcfile > "$lockfile"
515 if test -n "$fix_srcfile_path"; then
516 eval srcfile=\"$fix_srcfile_path\"
519 # Only build a PIC object if we are building libtool libraries.
520 if test "$build_libtool_libs" = yes; then
521 # Without this assignment, base_compile gets emptied.
522 fbsd_hideous_sh_bug=$base_compile
524 if test "$pic_mode" != no; then
525 # All platforms use -DPIC, to notify preprocessed assembler code.
526 command="$base_compile $srcfile $pic_flag -DPIC"
528 # Don't build PIC code
529 command="$base_compile $srcfile"
531 if test "$build_old_libs" = yes; then
533 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
534 if test "X$dir" = "X$libobj"; then
539 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
541 if test -d "$dir"; then
548 if test $status -ne 0 && test ! -d $dir; then
553 if test "$compiler_o_lo" = yes; then
555 command="$command -o $output_obj"
556 elif test "$compiler_c_o" = yes; then
558 command="$command -o $output_obj"
561 $run $rm "$output_obj"
563 if $run eval "$command"; then :
565 test -n "$output_obj" && $run $rm $removelist
569 if test "$need_locks" = warn &&
570 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
572 *** ERROR, $lockfile contains:
573 `cat $lockfile 2>/dev/null`
575 but it should contain:
578 This indicates that another process is trying to use the same
579 temporary object file, and libtool could not work around it because
580 your compiler does not support \`-c' and \`-o' together. If you
581 repeat this compilation, it may succeed, by chance, but you had better
582 avoid parallel builds (make -j) in this platform, or get a better
589 # Just move the object if needed, then go on to compile the next one
590 if test x"$output_obj" != x"$libobj"; then
591 $show "$mv $output_obj $libobj"
592 if $run $mv $output_obj $libobj; then :
600 # If we have no pic_flag, then copy the object into place and finish.
601 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
602 test "$build_old_libs" = yes; then
603 # Rename the .lo from within objdir to obj
604 if test -f $obj; then
609 $show "$mv $libobj $obj"
610 if $run $mv $libobj $obj; then :
617 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
618 if test "X$xdir" = "X$obj"; then
623 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
624 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
625 # Now arrange that obj and lo_libobj become the same file
626 $show "(cd $xdir && $LN_S $baseobj $libobj)"
627 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
628 # Unlock the critical section if it was locked
629 if test "$need_locks" != no; then
640 # Allow error messages only from the first compilation.
641 suppress_output=' >/dev/null 2>&1'
644 # Only build a position-dependent object if we build old libraries.
645 if test "$build_old_libs" = yes; then
646 if test "$pic_mode" != yes; then
647 # Don't build PIC code
648 command="$base_compile $srcfile"
650 # All platforms use -DPIC, to notify preprocessed assembler code.
651 command="$base_compile $srcfile $pic_flag -DPIC"
653 if test "$compiler_c_o" = yes; then
654 command="$command -o $obj"
658 # Suppress compiler output if we already did a PIC compilation.
659 command="$command$suppress_output"
660 $run $rm "$output_obj"
662 if $run eval "$command"; then :
668 if test "$need_locks" = warn &&
669 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
671 *** ERROR, $lockfile contains:
672 `cat $lockfile 2>/dev/null`
674 but it should contain:
677 This indicates that another process is trying to use the same
678 temporary object file, and libtool could not work around it because
679 your compiler does not support \`-c' and \`-o' together. If you
680 repeat this compilation, it may succeed, by chance, but you had better
681 avoid parallel builds (make -j) in this platform, or get a better
688 # Just move the object if needed
689 if test x"$output_obj" != x"$obj"; then
690 $show "$mv $output_obj $obj"
691 if $run $mv $output_obj $obj; then :
699 # Create an invalid libtool object if no PIC, so that we do not
700 # accidentally link it into a program.
701 if test "$build_libtool_libs" != yes; then
702 $show "echo timestamp > $libobj"
703 $run eval "echo timestamp > \$libobj" || exit $?
705 # Move the .lo from within objdir
706 $show "$mv $libobj $lo_libobj"
707 if $run $mv $libobj $lo_libobj; then :
716 # Unlock the critical section if it was locked
717 if test "$need_locks" != no; then
726 modename="$modename: link"
728 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
729 # It is impossible to link a dll without this setting, and
730 # we shouldn't force the makefile maintainer to figure out
731 # which system we are compiling for in order to pass an extra
732 # flag for every libtool invokation.
735 # FIXME: Unfortunately, there are problems with the above when trying
736 # to make a dll which has undefined symbols, in which case not
737 # even a static library is built. For now, we need to specify
738 # -no-undefined on the libtool link line when we can be certain
739 # that all symbols are satisfied, otherwise we get a static library.
746 libtool_args="$nonopt"
747 compile_command="$nonopt"
748 finalize_command="$nonopt"
761 lib_search_path=`pwd`
769 export_symbols_regex=
776 prefer_static_libs=no
788 # We need to know -static, to get the right output filenames.
792 -all-static | -static)
793 if test "X$arg" = "X-all-static"; then
794 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
795 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
797 if test -n "$link_static_flag"; then
798 dlopen_self=$dlopen_self_static
801 if test -z "$pic_flag" && test -n "$link_static_flag"; then
802 dlopen_self=$dlopen_self_static
805 build_libtool_libs=no
807 prefer_static_libs=yes
813 # See if our shared archives depend on static archives.
814 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
816 # Go through the arguments, transforming them on the way.
817 while test $# -gt 0; do
821 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
822 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
826 libtool_args="$libtool_args $qarg"
828 # If the previous option needs an argument, assign it.
829 if test -n "$prev"; then
832 compile_command="$compile_command @OUTPUT@"
833 finalize_command="$finalize_command @OUTPUT@"
839 if test "$preload" = no; then
840 # Add the symbol object into the linking commands.
841 compile_command="$compile_command @SYMFILE@"
842 finalize_command="$finalize_command @SYMFILE@"
846 *.la | *.lo) ;; # We handle these cases below.
848 if test "$dlself" = no; then
856 if test "$prev" = dlprefiles; then
858 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
868 if test "$prev" = dlfiles; then
869 dlfiles="$dlfiles $arg"
871 dlprefiles="$dlprefiles $arg"
879 export_symbols="$arg"
880 if test ! -f "$arg"; then
881 $echo "$modename: symbol file \`$arg' does not exist"
888 export_symbols_regex="$arg"
898 # We need an absolute path.
900 [\\/]* | [A-Za-z]:[\\/]*) ;;
902 $echo "$modename: only absolute run-paths are allowed" 1>&2
906 if test "$prev" = rpath; then
909 *) rpath="$rpath $arg" ;;
914 *) xrpath="$xrpath $arg" ;;
921 compiler_flags="$compiler_flags $qarg"
923 compile_command="$compile_command $qarg"
924 finalize_command="$finalize_command $qarg"
928 linker_flags="$linker_flags $qarg"
929 compiler_flags="$compiler_flags $wl$qarg"
931 compile_command="$compile_command $wl$qarg"
932 finalize_command="$finalize_command $wl$qarg"
936 eval "$prev=\"\$arg\""
947 if test -n "$link_static_flag"; then
948 compile_command="$compile_command $link_static_flag"
949 finalize_command="$finalize_command $link_static_flag"
955 # FIXME: remove this flag sometime in the future.
956 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
980 -export-symbols | -export-symbols-regex)
981 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
982 $echo "$modename: more than one -exported-symbols argument is not allowed"
985 if test "X$arg" = "X-export-symbols"; then
993 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
994 # so, if we see these flags be careful not to treat them like -L
996 case $with_gcc/$host in
997 no/*-*-irix* | no/*-*-nonstopux*)
998 compile_command="$compile_command $arg"
999 finalize_command="$finalize_command $arg"
1006 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1007 # We need an absolute path.
1009 [\\/]* | [A-Za-z]:[\\/]*) ;;
1011 absdir=`cd "$dir" && pwd`
1012 if test -z "$absdir"; then
1013 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1022 deplibs="$deplibs -L$dir"
1023 lib_search_path="$lib_search_path $dir"
1027 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1028 case :$dllsearchpath: in
1030 *) dllsearchpath="$dllsearchpath:$dir";;
1038 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1040 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1041 # These systems don't actually have a C or math library (as such)
1044 *-*-mingw* | *-*-os2*)
1045 # These systems don't actually have a C library (as such)
1046 test "X$arg" = "X-lc" && continue
1048 *-*-openbsd* | *-*-freebsd*)
1049 # Do not include libc due to us having libc/libc_r.
1050 test "X$arg" = "X-lc" && continue
1053 elif test "X$arg" = "X-lc_r"; then
1055 *-*-openbsd* | *-*-freebsd*)
1056 # Do not include libc_r directly, use -pthread flag.
1061 deplibs="$deplibs $arg"
1077 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1078 # The PATH hackery in wrapper scripts is required on Windows
1079 # in order for the loader to find any dlls it needs.
1080 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1081 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1084 *) no_install=yes ;;
1112 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1113 # We need an absolute path.
1115 [\\/]* | [A-Za-z]:[\\/]*) ;;
1117 $echo "$modename: only absolute run-paths are allowed" 1>&2
1123 *) xrpath="$xrpath $dir" ;;
1129 # The effects of -static are defined in a previous loop.
1130 # We used to do the same as -all-static on platforms that
1131 # didn't have a PIC flag, but the assumption that the effects
1132 # would be equivalent was wrong. It would break on at least
1133 # Digital Unix and AIX.
1148 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1150 save_ifs="$IFS"; IFS=','
1151 for flag in $args; do
1154 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1159 compiler_flags="$compiler_flags $flag"
1162 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1166 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1168 save_ifs="$IFS"; IFS=','
1169 for flag in $args; do
1172 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1177 compiler_flags="$compiler_flags $wl$flag"
1178 linker_flags="$linker_flags $flag"
1181 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1194 # Some other compiler flag.
1196 # Unknown arguments in both finalize_command and compile_command need
1197 # to be aesthetically quoted because they are evaled later.
1198 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1200 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1207 # A library or standard object.
1208 if test "$prev" = dlfiles; then
1209 # This file was specified with -dlopen.
1210 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1211 dlfiles="$dlfiles $arg"
1215 # If libtool objects are unsupported, then we need to preload.
1220 if test "$prev" = dlprefiles; then
1221 # Preload the old-style object.
1222 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1226 *.lo) libobjs="$libobjs $arg" ;;
1227 *) objs="$objs $arg" ;;
1234 deplibs="$deplibs $arg"
1235 old_deplibs="$old_deplibs $arg"
1240 # A libtool-controlled library.
1242 if test "$prev" = dlfiles; then
1243 # This library was specified with -dlopen.
1244 dlfiles="$dlfiles $arg"
1246 elif test "$prev" = dlprefiles; then
1247 # The library was specified with -dlpreopen.
1248 dlprefiles="$dlprefiles $arg"
1251 deplibs="$deplibs $arg"
1256 # Some other compiler argument.
1258 # Unknown arguments in both finalize_command and compile_command need
1259 # to be aesthetically quoted because they are evaled later.
1260 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1262 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1269 # Now actually substitute the argument into the commands.
1270 if test -n "$arg"; then
1271 compile_command="$compile_command $arg"
1272 finalize_command="$finalize_command $arg"
1274 done # argument parsing loop
1276 if test -n "$prev"; then
1277 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1282 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1283 eval arg=\"$export_dynamic_flag_spec\"
1284 compile_command="$compile_command $arg"
1285 finalize_command="$finalize_command $arg"
1288 # calculate the name of the file, without its directory
1289 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1290 libobjs_save="$libobjs"
1292 if test -n "$shlibpath_var"; then
1293 # get the directories listed in $shlibpath_var
1294 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1298 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1299 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1301 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1302 if test "X$output_objdir" = "X$output"; then
1303 output_objdir="$objdir"
1305 output_objdir="$output_objdir/$objdir"
1307 # Create the object directory.
1308 if test ! -d $output_objdir; then
1309 $show "$mkdir $output_objdir"
1310 $run $mkdir $output_objdir
1312 if test $status -ne 0 && test ! -d $output_objdir; then
1317 # Determine the type of output
1320 $echo "$modename: you must specify an output file" 1>&2
1324 *.$libext) linkmode=oldlib ;;
1325 *.lo | *.$objext) linkmode=obj ;;
1326 *.la) linkmode=lib ;;
1327 *) linkmode=prog ;; # Anything else should be a program.
1332 # Find all interdependent deplibs by searching for libraries
1333 # that are linked more than once (e.g. -la -lb -la)
1334 for deplib in $deplibs; do
1335 if test "X$duplicate_deps" = "Xyes" ; then
1337 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1340 libs="$libs $deplib"
1345 need_relink=no # whether we're linking any uninstalled libtool libraries
1346 notinst_deplibs= # not-installed libtool libraries
1347 notinst_path= # paths that contain not-installed libtool libraries
1351 for file in $dlfiles $dlprefiles; do
1355 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1367 passes="conv scan dlopen dlpreopen link"
1372 for pass in $passes; do
1373 if test $linkmode = prog; then
1374 # Determine which files to process
1378 save_deplibs="$deplibs" # Collect dlpreopened libraries
1381 dlpreopen) libs="$dlprefiles" ;;
1382 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1385 for deplib in $libs; do
1390 if test $linkmode = oldlib && test $linkmode = obj; then
1391 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1394 if test $pass = conv; then
1395 deplibs="$deplib $deplibs"
1398 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1399 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1400 # Search the libtool library
1401 lib="$searchdir/lib${name}.la"
1402 if test -f "$lib"; then
1407 if test "$found" != yes; then
1408 # deplib doesn't seem to be a libtool library
1409 if test "$linkmode,$pass" = "prog,link"; then
1410 compile_deplibs="$deplib $compile_deplibs"
1411 finalize_deplibs="$deplib $finalize_deplibs"
1413 deplibs="$deplib $deplibs"
1414 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1422 deplibs="$deplib $deplibs"
1423 test $pass = conv && continue
1424 newdependency_libs="$deplib $newdependency_libs"
1425 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1428 if test $pass = conv; then
1429 deplibs="$deplib $deplibs"
1432 if test $pass = scan; then
1433 deplibs="$deplib $deplibs"
1434 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1436 compile_deplibs="$deplib $compile_deplibs"
1437 finalize_deplibs="$deplib $finalize_deplibs"
1441 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1447 if test $pass = link; then
1448 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1449 # Make sure the xrpath contains only unique directories.
1452 *) xrpath="$xrpath $dir" ;;
1455 deplibs="$deplib $deplibs"
1458 *.la) lib="$deplib" ;;
1460 if test $pass = conv; then
1461 deplibs="$deplib $deplibs"
1466 if test "$deplibs_check_method" != pass_all; then
1468 echo "*** Warning: Trying to link with static lib archive $deplib."
1469 echo "*** I have the capability to make that library automatically link in when"
1470 echo "*** you link to this library. But I can only do this if you have a"
1471 echo "*** shared version of the library, which you do not appear to have"
1472 echo "*** because the file extensions .$libext of this argument makes me believe"
1473 echo "*** that it is just a static archive that I should not used here."
1476 echo "*** Warning: Linking the shared library $output against the"
1477 echo "*** static library $deplib is not portable!"
1478 deplibs="$deplib $deplibs"
1483 if test $pass != link; then
1484 deplibs="$deplib $deplibs"
1486 compile_deplibs="$deplib $compile_deplibs"
1487 finalize_deplibs="$deplib $finalize_deplibs"
1494 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1495 # If there is no dlopen support or we're linking statically,
1496 # we need to preload.
1497 newdlprefiles="$newdlprefiles $deplib"
1498 compile_deplibs="$deplib $compile_deplibs"
1499 finalize_deplibs="$deplib $finalize_deplibs"
1501 newdlfiles="$newdlfiles $deplib"
1510 if test $found = yes || test -f "$lib"; then :
1512 $echo "$modename: cannot find the library \`$lib'" 1>&2
1516 # Check to see that this really is a libtool archive.
1517 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1519 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1523 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1524 test "X$ladir" = "X$lib" && ladir="."
1532 # If the library was installed with an old release of libtool,
1533 # it will not redefine variable installed.
1538 */* | *\\*) . $lib ;;
1542 if test "$linkmode,$pass" = "lib,link" ||
1543 test "$linkmode,$pass" = "prog,scan" ||
1544 { test $linkmode = oldlib && test $linkmode = obj; }; then
1545 # Add dl[pre]opened files of deplib
1546 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1547 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1550 if test $pass = conv; then
1551 # Only check for convenience libraries
1552 deplibs="$lib $deplibs"
1553 if test -z "$libdir"; then
1554 if test -z "$old_library"; then
1555 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1558 # It is a libtool convenience library, so add in its objects.
1559 convenience="$convenience $ladir/$objdir/$old_library"
1560 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1562 for deplib in $dependency_libs; do
1563 deplibs="$deplib $deplibs"
1564 if test "X$duplicate_deps" = "Xyes" ; then
1565 case "$tmp_libs " in
1566 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1569 tmp_libs="$tmp_libs $deplib"
1571 elif test $linkmode != prog && test $linkmode != lib; then
1572 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1578 # Get the name of the library we link against.
1580 for l in $old_library $library_names; do
1583 if test -z "$linklib"; then
1584 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1588 # This library was specified with -dlopen.
1589 if test $pass = dlopen; then
1590 if test -z "$libdir"; then
1591 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1594 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1595 # If there is no dlname, no dlopen support or we're linking
1596 # statically, we need to preload.
1597 dlprefiles="$dlprefiles $lib"
1599 newdlfiles="$newdlfiles $lib"
1604 # We need an absolute path.
1606 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1608 abs_ladir=`cd "$ladir" && pwd`
1609 if test -z "$abs_ladir"; then
1610 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1611 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1616 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1618 # Find the relevant object directory and library name.
1619 if test "X$installed" = Xyes; then
1620 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1621 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1630 dir="$ladir/$objdir"
1631 absdir="$abs_ladir/$objdir"
1632 # Remove this search path later
1633 notinst_path="$notinst_path $abs_ladir"
1634 fi # $installed = yes
1635 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1637 # This library was specified with -dlpreopen.
1638 if test $pass = dlpreopen; then
1639 if test -z "$libdir"; then
1640 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1643 # Prefer using a static library (so that no silly _DYNAMIC symbols
1644 # are required to link).
1645 if test -n "$old_library"; then
1646 newdlprefiles="$newdlprefiles $dir/$old_library"
1647 # Otherwise, use the dlname, so that lt_dlopen finds it.
1648 elif test -n "$dlname"; then
1649 newdlprefiles="$newdlprefiles $dir/$dlname"
1651 newdlprefiles="$newdlprefiles $dir/$linklib"
1653 fi # $pass = dlpreopen
1655 if test -z "$libdir"; then
1656 # Link the convenience library
1657 if test $linkmode = lib; then
1658 deplibs="$dir/$old_library $deplibs"
1659 elif test "$linkmode,$pass" = "prog,link"; then
1660 compile_deplibs="$dir/$old_library $compile_deplibs"
1661 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1663 deplibs="$lib $deplibs"
1668 if test $linkmode = prog && test $pass != link; then
1669 newlib_search_path="$newlib_search_path $ladir"
1670 deplibs="$lib $deplibs"
1673 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1674 test "$build_libtool_libs" = no; then
1679 for deplib in $dependency_libs; do
1681 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1683 # Need to link against all dependency_libs?
1684 if test $linkalldeplibs = yes; then
1685 deplibs="$deplib $deplibs"
1687 # Need to hardcode shared library paths
1688 # or/and link against static libraries
1689 newdependency_libs="$deplib $newdependency_libs"
1691 if test "X$duplicate_deps" = "Xyes" ; then
1692 case "$tmp_libs " in
1693 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1696 tmp_libs="$tmp_libs $deplib"
1699 fi # $linkmode = prog...
1701 link_static=no # Whether the deplib will be linked statically
1702 if test -n "$library_names" &&
1703 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1704 # Link against this shared library
1706 if test "$linkmode,$pass" = "prog,link" ||
1707 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1708 # Hardcode the library path.
1709 # Skip directories that are in the system default run-time
1711 case " $sys_lib_dlsearch_path " in
1714 case "$compile_rpath " in
1716 *) compile_rpath="$compile_rpath $absdir"
1720 case " $sys_lib_dlsearch_path " in
1723 case "$finalize_rpath " in
1725 *) finalize_rpath="$finalize_rpath $libdir"
1729 if test $linkmode = prog; then
1730 # We need to hardcode the library path
1731 if test -n "$shlibpath_var"; then
1732 # Make sure the rpath contains only unique directories.
1733 case "$temp_rpath " in
1736 *) temp_rpath="$temp_rpath $dir" ;;
1740 fi # $linkmode,$pass = prog,link...
1742 if test "$alldeplibs" = yes &&
1743 { test "$deplibs_check_method" = pass_all ||
1744 { test "$build_libtool_libs" = yes &&
1745 test -n "$library_names"; }; }; then
1746 # We only need to search for static libraries
1750 if test "$installed" = no; then
1751 notinst_deplibs="$notinst_deplibs $lib"
1755 if test -n "$old_archive_from_expsyms_cmds"; then
1756 # figure out the soname
1757 set dummy $library_names
1760 libname=`eval \\$echo \"$libname_spec\"`
1761 # use dlname if we got it. it's perfectly good, no?
1762 if test -n "$dlname"; then
1764 elif test -n "$soname_spec"; then
1768 major=`expr $current - $age`
1772 eval soname=\"$soname_spec\"
1777 # Make a new name for the extract_expsyms_cmds to use
1779 soname=`echo $soroot | sed -e 's/^.*\///'`
1780 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1782 # If the library has no export list, then create one now
1783 if test -f "$output_objdir/$soname-def"; then :
1785 $show "extracting exported symbol list from \`$soname'"
1786 save_ifs="$IFS"; IFS='~'
1787 eval cmds=\"$extract_expsyms_cmds\"
1788 for cmd in $cmds; do
1791 $run eval "$cmd" || exit $?
1797 if test -f "$output_objdir/$newlib"; then :; else
1798 $show "generating import library for \`$soname'"
1799 save_ifs="$IFS"; IFS='~'
1800 eval cmds=\"$old_archive_from_expsyms_cmds\"
1801 for cmd in $cmds; do
1804 $run eval "$cmd" || exit $?
1808 # make sure the library variables are pointing to the new library
1811 fi # test -n $old_archive_from_expsyms_cmds
1813 if test $linkmode = prog || test "$mode" != relink; then
1818 case $hardcode_action in
1819 immediate | unsupported)
1820 if test "$hardcode_direct" = no; then
1822 elif test "$hardcode_minus_L" = no; then
1824 *-*-sunos*) add_shlibpath="$dir" ;;
1828 elif test "$hardcode_shlibpath_var" = no; then
1829 add_shlibpath="$dir"
1836 if test "$hardcode_direct" = yes; then
1838 elif test "$hardcode_minus_L" = yes; then
1841 elif test "$hardcode_shlibpath_var" = yes; then
1842 add_shlibpath="$dir"
1851 if test "$lib_linked" != yes; then
1852 $echo "$modename: configuration error: unsupported hardcode properties"
1856 if test -n "$add_shlibpath"; then
1857 case :$compile_shlibpath: in
1858 *":$add_shlibpath:"*) ;;
1859 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1862 if test $linkmode = prog; then
1863 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1864 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1866 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1867 test -n "$add" && deplibs="$add $deplibs"
1868 if test "$hardcode_direct" != yes && \
1869 test "$hardcode_minus_L" != yes && \
1870 test "$hardcode_shlibpath_var" = yes; then
1871 case :$finalize_shlibpath: in
1873 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1879 if test $linkmode = prog || test "$mode" = relink; then
1883 # Finalize command for both is simple: just hardcode it.
1884 if test "$hardcode_direct" = yes; then
1885 add="$libdir/$linklib"
1886 elif test "$hardcode_minus_L" = yes; then
1889 elif test "$hardcode_shlibpath_var" = yes; then
1890 case :$finalize_shlibpath: in
1892 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1896 # We cannot seem to hardcode it, guess we'll fake it.
1901 if test $linkmode = prog; then
1902 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1903 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1905 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1906 test -n "$add" && deplibs="$add $deplibs"
1909 elif test $linkmode = prog; then
1910 if test "$alldeplibs" = yes &&
1911 { test "$deplibs_check_method" = pass_all ||
1912 { test "$build_libtool_libs" = yes &&
1913 test -n "$library_names"; }; }; then
1914 # We only need to search for static libraries
1918 # Try to link the static library
1919 # Here we assume that one of hardcode_direct or hardcode_minus_L
1920 # is not unsupported. This is valid on all known static and
1922 if test "$hardcode_direct" != unsupported; then
1923 test -n "$old_library" && linklib="$old_library"
1924 compile_deplibs="$dir/$linklib $compile_deplibs"
1925 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1927 compile_deplibs="-l$name -L$dir $compile_deplibs"
1928 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1930 elif test "$build_libtool_libs" = yes; then
1931 # Not a shared library
1932 if test "$deplibs_check_method" != pass_all; then
1933 # We're trying link a shared library against a static one
1934 # but the system doesn't support it.
1936 # Just print a warning and add the library to dependency_libs so
1937 # that the program can be linked against the static library.
1939 echo "*** Warning: This system can not link to static lib archive $lib."
1940 echo "*** I have the capability to make that library automatically link in when"
1941 echo "*** you link to this library. But I can only do this if you have a"
1942 echo "*** shared version of the library, which you do not appear to have."
1943 if test "$module" = yes; then
1944 echo "*** But as you try to build a module library, libtool will still create "
1945 echo "*** a static module, that should work as long as the dlopening application"
1946 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1947 if test -z "$global_symbol_pipe"; then
1949 echo "*** However, this would only work if libtool was able to extract symbol"
1950 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1951 echo "*** not find such a program. So, this module is probably useless."
1952 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1954 if test "$build_old_libs" = no; then
1955 build_libtool_libs=module
1958 build_libtool_libs=no
1962 convenience="$convenience $dir/$old_library"
1963 old_convenience="$old_convenience $dir/$old_library"
1964 deplibs="$dir/$old_library $deplibs"
1967 fi # link shared/static library?
1969 if test $linkmode = lib; then
1970 if test -n "$dependency_libs" &&
1971 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1972 test $link_static = yes; }; then
1973 # Extract -R from dependency_libs
1975 for libdir in $dependency_libs; do
1977 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1979 *" $temp_xrpath "*) ;;
1980 *) xrpath="$xrpath $temp_xrpath";;
1982 *) temp_deplibs="$temp_deplibs $libdir";;
1985 dependency_libs="$temp_deplibs"
1988 newlib_search_path="$newlib_search_path $absdir"
1989 # Link against this library
1990 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1991 # ... and its dependency_libs
1993 for deplib in $dependency_libs; do
1994 newdependency_libs="$deplib $newdependency_libs"
1995 if test "X$duplicate_deps" = "Xyes" ; then
1996 case "$tmp_libs " in
1997 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2000 tmp_libs="$tmp_libs $deplib"
2003 if test $link_all_deplibs != no; then
2004 # Add the search paths of all dependency libraries
2005 for deplib in $dependency_libs; do
2007 -L*) path="$deplib" ;;
2009 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2010 test "X$dir" = "X$deplib" && dir="."
2011 # We need an absolute path.
2013 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2015 absdir=`cd "$dir" && pwd`
2016 if test -z "$absdir"; then
2017 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2022 if grep "^installed=no" $deplib > /dev/null; then
2023 path="-L$absdir/$objdir"
2025 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2026 if test -z "$libdir"; then
2027 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2030 if test "$absdir" != "$libdir"; then
2031 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2038 case " $deplibs " in
2040 *) deplibs="$deplibs $path" ;;
2043 fi # link_all_deplibs != no
2045 done # for deplib in $libs
2046 if test $pass = dlpreopen; then
2047 # Link the dlpreopened libraries before other libraries
2048 for deplib in $save_deplibs; do
2049 deplibs="$deplib $deplibs"
2052 if test $pass != dlopen; then
2053 test $pass != scan && dependency_libs="$newdependency_libs"
2054 if test $pass != conv; then
2055 # Make sure lib_search_path contains only unique directories.
2057 for dir in $newlib_search_path; do
2058 case "$lib_search_path " in
2060 *) lib_search_path="$lib_search_path $dir" ;;
2066 if test "$linkmode,$pass" != "prog,link"; then
2069 vars="compile_deplibs finalize_deplibs"
2071 for var in $vars dependency_libs; do
2072 # Add libraries to $var in reverse order
2073 eval tmp_libs=\"\$$var\"
2075 for deplib in $tmp_libs; do
2077 -L*) new_libs="$deplib $new_libs" ;;
2079 case " $specialdeplibs " in
2080 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2082 case " $new_libs " in
2084 *) new_libs="$deplib $new_libs" ;;
2092 for deplib in $new_libs; do
2095 case " $tmp_libs " in
2097 *) tmp_libs="$tmp_libs $deplib" ;;
2100 *) tmp_libs="$tmp_libs $deplib" ;;
2103 eval $var=\"$tmp_libs\"
2106 if test "$pass" = "conv" &&
2107 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2108 libs="$deplibs" # reset libs
2112 if test $linkmode = prog; then
2113 dlfiles="$newdlfiles"
2114 dlprefiles="$newdlprefiles"
2119 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2120 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2123 if test -n "$rpath"; then
2124 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2127 if test -n "$xrpath"; then
2128 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2131 if test -n "$vinfo"; then
2132 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2135 if test -n "$release"; then
2136 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2139 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2140 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2143 # Now set the variables for building old libraries.
2144 build_libtool_libs=no
2146 objs="$objs$old_deplibs"
2150 # Make sure we only generate libraries of the form `libNAME.la'.
2153 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2154 eval libname=\"$libname_spec\"
2157 if test "$module" = no; then
2158 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2162 if test "$need_lib_prefix" != no; then
2163 # Add the "lib" prefix for modules if required
2164 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2165 eval libname=\"$libname_spec\"
2167 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2172 if test -n "$objs"; then
2173 if test "$deplibs_check_method" != pass_all; then
2174 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2178 echo "*** Warning: Linking the shared library $output against the non-libtool"
2179 echo "*** objects $objs is not portable!"
2180 libobjs="$libobjs $objs"
2184 if test "$dlself" != no; then
2185 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2189 if test $# -gt 2; then
2190 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2195 if test -z "$rpath"; then
2196 if test "$build_libtool_libs" = yes; then
2197 # Building a libtool convenience library.
2199 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2200 build_libtool_libs=convenience
2204 if test -n "$vinfo"; then
2205 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2208 if test -n "$release"; then
2209 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2213 # Parse the version information argument.
2214 save_ifs="$IFS"; IFS=':'
2215 set dummy $vinfo 0 0 0
2218 if test -n "$8"; then
2219 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2228 # Check that each of the things are valid numbers.
2230 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2232 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2233 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2239 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2241 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2242 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2248 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2250 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2251 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2256 if test $age -gt $current; then
2257 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2258 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2262 # Calculate the version variables.
2266 case $version_type in
2270 # Like Linux, but with the current version available in
2271 # verstring for coding it into the library header
2272 major=.`expr $current - $age`
2273 versuffix="$major.$age.$revision"
2274 # Darwin ld doesn't like 0 for these options...
2275 minor_current=`expr $current + 1`
2276 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2281 versuffix=".$current.$revision";
2286 versuffix=".$current";
2290 case $version_type in
2291 nonstopux) verstring_prefix=nonstopux ;;
2292 *) verstring_prefix=sgi ;;
2294 verstring="$verstring_prefix$major.$revision"
2296 major=`expr $current - $age + 1`
2298 # Add in all the interfaces that we are compatible with.
2300 while test $loop != 0; do
2301 iface=`expr $revision - $loop`
2302 loop=`expr $loop - 1`
2303 verstring="$verstring_prefix$major.$iface:$verstring"
2306 # Before this point, $major must not contain `.'.
2308 versuffix="$major.$revision"
2312 major=.`expr $current - $age`
2313 versuffix="$major.$age.$revision"
2317 major=`expr $current - $age`
2318 versuffix=".$current.$age.$revision"
2319 verstring="$current.$age.$revision"
2321 # Add in all the interfaces that we are compatible with.
2323 while test $loop != 0; do
2324 iface=`expr $current - $loop`
2325 loop=`expr $loop - 1`
2326 verstring="$verstring:${iface}.0"
2329 # Make executables depend on our current version.
2330 verstring="$verstring:${current}.0"
2335 versuffix=".$current.$revision"
2339 # Use '-' rather than '.', since we only want one
2340 # extension on DOS 8.3 filesystems.
2341 major=`expr $current - $age`
2346 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2347 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2352 # Clear the version info if we defaulted, and they specified a release.
2353 if test -z "$vinfo" && test -n "$release"; then
2356 case $version_type in
2358 # we can't check for "0.0" in archive_cmds due to quoting
2359 # problems, so we reset it completely
2366 if test "$need_version" = no; then
2373 # Remove version info from name if versioning should be avoided
2374 if test "$avoid_version" = yes && test "$need_version" = no; then
2380 # Check to see if the archive will have undefined symbols.
2381 if test "$allow_undefined" = yes; then
2382 if test "$allow_undefined_flag" = unsupported; then
2383 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2384 build_libtool_libs=no
2388 # Don't allow undefined symbols.
2389 allow_undefined_flag="$no_undefined_flag"
2393 if test "$mode" != relink; then
2394 # Remove our outputs.
2395 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2396 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2399 # Now set the variables for building old libraries.
2400 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2401 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2403 # Transform .lo files to .o files.
2404 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2407 # Eliminate all temporary directories.
2408 for path in $notinst_path; do
2409 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2410 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2411 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2414 if test -n "$xrpath"; then
2415 # If the user specified any rpath flags, then add them.
2417 for libdir in $xrpath; do
2418 temp_xrpath="$temp_xrpath -R$libdir"
2419 case "$finalize_rpath " in
2421 *) finalize_rpath="$finalize_rpath $libdir" ;;
2424 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2425 dependency_libs="$temp_xrpath $dependency_libs"
2429 # Make sure dlfiles contains only unique files that won't be dlpreopened
2430 old_dlfiles="$dlfiles"
2432 for lib in $old_dlfiles; do
2433 case " $dlprefiles $dlfiles " in
2435 *) dlfiles="$dlfiles $lib" ;;
2439 # Make sure dlprefiles contains only unique files
2440 old_dlprefiles="$dlprefiles"
2442 for lib in $old_dlprefiles; do
2443 case "$dlprefiles " in
2445 *) dlprefiles="$dlprefiles $lib" ;;
2449 if test "$build_libtool_libs" = yes; then
2450 if test -n "$rpath"; then
2452 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2453 # these systems don't actually have a c library (as such)!
2455 *-*-rhapsody* | *-*-darwin1.[012])
2456 # Rhapsody C library is in the System framework
2457 deplibs="$deplibs -framework System"
2460 # Don't link with libc until the a.out ld.so is fixed.
2462 *-*-openbsd* | *-*-freebsd*)
2463 # Do not include libc due to us having libc/libc_r.
2466 # Add libc to deplibs on all other systems if necessary.
2467 if test $build_libtool_need_lc = "yes"; then
2468 deplibs="$deplibs -lc"
2474 # Transform deplibs into only deplibs that can be linked in shared.
2476 libname_save=$libname
2477 release_save=$release
2478 versuffix_save=$versuffix
2480 # I'm not sure if I'm treating the release correctly. I think
2481 # release should show up in the -l (ie -lgmp5) so we don't want to
2482 # add it in twice. Is that correct?
2488 case $deplibs_check_method in
2490 # Don't check for shared/static. Everything works.
2491 # This might be a little naive. We might want to check
2492 # whether the library exists or not. But this is on
2493 # osf3 & osf4 and I'm not really sure... Just
2494 # implementing what was already the behaviour.
2498 # This code stresses the "libraries are programs" paradigm to its
2499 # limits. Maybe even breaks it. We compile a program, linking it
2500 # against the deplibs as a proxy for the library. Then we can check
2501 # whether they linked in statically or dynamically with ldd.
2503 cat > conftest.c <<EOF
2504 int main() { return 0; }
2507 $CC -o conftest conftest.c $deplibs
2508 if test $? -eq 0 ; then
2509 ldd_output=`ldd conftest`
2510 for i in $deplibs; do
2511 name="`expr $i : '-l\(.*\)'`"
2512 # If $name is empty we are operating on a -L argument.
2513 if test -n "$name" && test "$name" != "0"; then
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: dynamic linker does not accept needed library $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 I believe you do not have"
2527 echo "*** because a test_compile did reveal that the linker did not use it for"
2528 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2531 newdeplibs="$newdeplibs $i"
2535 # Error occured in the first compile. Let's try to salvage
2536 # the situation: Compile a separate program for each library.
2537 for i in $deplibs; do
2538 name="`expr $i : '-l\(.*\)'`"
2539 # If $name is empty we are operating on a -L argument.
2540 if test -n "$name" && test "$name" != "0"; then
2542 $CC -o conftest conftest.c $i
2544 if test $? -eq 0 ; then
2545 ldd_output=`ldd conftest`
2546 libname=`eval \\$echo \"$libname_spec\"`
2547 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2548 set dummy $deplib_matches
2550 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2551 newdeplibs="$newdeplibs $i"
2555 echo "*** Warning: dynamic linker does not accept needed library $i."
2556 echo "*** I have the capability to make that library automatically link in when"
2557 echo "*** you link to this library. But I can only do this if you have a"
2558 echo "*** shared version of the library, which you do not appear to have"
2559 echo "*** because a test_compile did reveal that the linker did not use this one"
2560 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2565 echo "*** Warning! Library $i is needed by this library but I was not able to"
2566 echo "*** make it link in! You will probably need to install it or some"
2567 echo "*** library that it depends on before this library will be fully"
2568 echo "*** functional. Installing it before continuing would be even better."
2571 newdeplibs="$newdeplibs $i"
2577 set dummy $deplibs_check_method
2578 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2579 for a_deplib in $deplibs; do
2580 name="`expr $a_deplib : '-l\(.*\)'`"
2581 # If $name is empty we are operating on a -L argument.
2582 if test -n "$name" && test "$name" != "0"; then
2583 libname=`eval \\$echo \"$libname_spec\"`
2584 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2585 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2586 for potent_lib in $potential_libs; do
2587 # Follow soft links.
2588 if ls -lLd "$potent_lib" 2>/dev/null \
2589 | grep " -> " >/dev/null; then
2592 # The statement above tries to avoid entering an
2593 # endless loop below, in case of cyclic links.
2594 # We might still enter an endless loop, since a link
2595 # loop can be closed while we follow links,
2597 potlib="$potent_lib"
2598 while test -h "$potlib" 2>/dev/null; do
2599 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2601 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2602 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2605 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2607 | egrep "$file_magic_regex" > /dev/null; then
2608 newdeplibs="$newdeplibs $a_deplib"
2614 if test -n "$a_deplib" ; then
2617 echo "*** Warning: linker path does not have real file for library $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"
2621 echo "*** because I did check the linker path looking for a file starting"
2622 if test -z "$potlib" ; then
2623 echo "*** with $libname but no candidates were found. (...for file magic test)"
2625 echo "*** with $libname and none of the candidates passed a file format test"
2626 echo "*** using a file magic. Last file checked: $potlib"
2630 # Add a -L argument.
2631 newdeplibs="$newdeplibs $a_deplib"
2633 done # Gone through all deplibs.
2636 set dummy $deplibs_check_method
2637 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2638 for a_deplib in $deplibs; do
2639 name="`expr $a_deplib : '-l\(.*\)'`"
2640 # If $name is empty we are operating on a -L argument.
2641 if test -n "$name" && test "$name" != "0"; then
2642 libname=`eval \\$echo \"$libname_spec\"`
2643 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2644 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2645 for potent_lib in $potential_libs; do
2646 potlib="$potent_lib" # see symlink-check below in file_magic test
2647 if eval echo \"$potent_lib\" 2>/dev/null \
2649 | egrep "$match_pattern_regex" > /dev/null; then
2650 newdeplibs="$newdeplibs $a_deplib"
2656 if test -n "$a_deplib" ; then
2659 echo "*** Warning: linker path does not have real file for library $a_deplib."
2660 echo "*** I have the capability to make that library automatically link in when"
2661 echo "*** you link to this library. But I can only do this if you have a"
2662 echo "*** shared version of the library, which you do not appear to have"
2663 echo "*** because I did check the linker path looking for a file starting"
2664 if test -z "$potlib" ; then
2665 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2667 echo "*** with $libname and none of the candidates passed a file format test"
2668 echo "*** using a regex pattern. Last file checked: $potlib"
2672 # Add a -L argument.
2673 newdeplibs="$newdeplibs $a_deplib"
2675 done # Gone through all deplibs.
2679 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2680 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2681 grep . >/dev/null; then
2683 if test "X$deplibs_check_method" = "Xnone"; then
2684 echo "*** Warning: inter-library dependencies are not supported in this platform."
2686 echo "*** Warning: inter-library dependencies are not known to be supported."
2688 echo "*** All declared inter-library dependencies are being dropped."
2693 versuffix=$versuffix_save
2695 release=$release_save
2696 libname=$libname_save
2700 *-*-rhapsody* | *-*-darwin1.[012])
2701 # On Rhapsody replace the C library is the System framework
2702 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2706 if test "$droppeddeps" = yes; then
2707 if test "$module" = yes; then
2709 echo "*** Warning: libtool could not satisfy all declared inter-library"
2710 echo "*** dependencies of module $libname. Therefore, libtool will create"
2711 echo "*** a static module, that should work as long as the dlopening"
2712 echo "*** application is linked with the -dlopen flag."
2713 if test -z "$global_symbol_pipe"; then
2715 echo "*** However, this would only work if libtool was able to extract symbol"
2716 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2717 echo "*** not find such a program. So, this module is probably useless."
2718 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2720 if test "$build_old_libs" = no; then
2721 oldlibs="$output_objdir/$libname.$libext"
2722 build_libtool_libs=module
2725 build_libtool_libs=no
2728 echo "*** The inter-library dependencies that have been dropped here will be"
2729 echo "*** automatically added whenever a program is linked with this library"
2730 echo "*** or is declared to -dlopen it."
2732 if test $allow_undefined = no; then
2734 echo "*** Since this library must not contain undefined symbols,"
2735 echo "*** because either the platform does not support them or"
2736 echo "*** it was explicitly requested with -no-undefined,"
2737 echo "*** libtool will only create a static version of it."
2738 if test "$build_old_libs" = no; then
2739 oldlibs="$output_objdir/$libname.$libext"
2740 build_libtool_libs=module
2743 build_libtool_libs=no
2748 # Done checking deplibs!
2752 # All the library-specific variables (install_libdir is set above).
2757 # Test again, we may have decided not to build it any more
2758 if test "$build_libtool_libs" = yes; then
2759 if test $hardcode_into_libs = yes; then
2760 # Hardcode the library paths
2763 rpath="$finalize_rpath"
2764 test "$mode" != relink && rpath="$compile_rpath$rpath"
2765 for libdir in $rpath; do
2766 if test -n "$hardcode_libdir_flag_spec"; then
2767 if test -n "$hardcode_libdir_separator"; then
2768 if test -z "$hardcode_libdirs"; then
2769 hardcode_libdirs="$libdir"
2771 # Just accumulate the unique libdirs.
2772 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2773 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2776 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2781 eval flag=\"$hardcode_libdir_flag_spec\"
2782 dep_rpath="$dep_rpath $flag"
2784 elif test -n "$runpath_var"; then
2785 case "$perm_rpath " in
2787 *) perm_rpath="$perm_rpath $libdir" ;;
2791 # Substitute the hardcoded libdirs into the rpath.
2792 if test -n "$hardcode_libdir_separator" &&
2793 test -n "$hardcode_libdirs"; then
2794 libdir="$hardcode_libdirs"
2795 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2797 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2798 # We should set the runpath_var.
2800 for dir in $perm_rpath; do
2803 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2805 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2808 shlibpath="$finalize_shlibpath"
2809 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2810 if test -n "$shlibpath"; then
2811 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2814 # Get the real and link names of the library.
2815 eval library_names=\"$library_names_spec\"
2816 set dummy $library_names
2820 if test -n "$soname_spec"; then
2821 eval soname=\"$soname_spec\"
2825 test -z "$dlname" && dlname=$soname
2827 lib="$output_objdir/$realname"
2830 linknames="$linknames $link"
2833 # Ensure that we have .o objects for linkers which dislike .lo
2834 # (e.g. aix) in case we are running --disable-static
2835 for obj in $libobjs; do
2836 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2837 if test "X$xdir" = "X$obj"; then
2842 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2843 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2844 if test ! -f $xdir/$oldobj; then
2845 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2846 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2850 # Use standard objects if they are pic
2851 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2853 # Prepare the list of exported symbols
2854 if test -z "$export_symbols"; then
2855 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2856 $show "generating symbol list for \`$libname.la'"
2857 export_symbols="$output_objdir/$libname.exp"
2858 $run $rm $export_symbols
2859 eval cmds=\"$export_symbols_cmds\"
2860 save_ifs="$IFS"; IFS='~'
2861 for cmd in $cmds; do
2864 $run eval "$cmd" || exit $?
2867 if test -n "$export_symbols_regex"; then
2868 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2869 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2870 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2871 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2876 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2877 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2880 if test -n "$convenience"; then
2881 if test -n "$whole_archive_flag_spec"; then
2882 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2884 gentop="$output_objdir/${outputname}x"
2885 $show "${rm}r $gentop"
2886 $run ${rm}r "$gentop"
2887 $show "mkdir $gentop"
2888 $run mkdir "$gentop"
2890 if test $status -ne 0 && test ! -d "$gentop"; then
2893 generated="$generated $gentop"
2895 for xlib in $convenience; do
2896 # Extract the objects.
2898 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2899 *) xabs=`pwd`"/$xlib" ;;
2901 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2902 xdir="$gentop/$xlib"
2904 $show "${rm}r $xdir"
2909 if test $status -ne 0 && test ! -d "$xdir"; then
2912 $show "(cd $xdir && $AR x $xabs)"
2913 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2915 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2920 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2921 eval flag=\"$thread_safe_flag_spec\"
2922 linker_flags="$linker_flags $flag"
2925 # Make a backup of the uninstalled library when relinking
2926 if test "$mode" = relink; then
2927 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2930 # Do each of the archive commands.
2931 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2932 eval cmds=\"$archive_expsym_cmds\"
2934 eval cmds=\"$archive_cmds\"
2936 save_ifs="$IFS"; IFS='~'
2937 for cmd in $cmds; do
2940 $run eval "$cmd" || exit $?
2944 # Restore the uninstalled library and exit
2945 if test "$mode" = relink; then
2946 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2950 # Create links to the real library.
2951 for linkname in $linknames; do
2952 if test "$realname" != "$linkname"; then
2953 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2954 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2958 # If -module or -export-dynamic was specified, set the dlname.
2959 if test "$module" = yes || test "$export_dynamic" = yes; then
2960 # On all known operating systems, these are identical.
2967 if test -n "$deplibs"; then
2968 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2971 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2972 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2975 if test -n "$rpath"; then
2976 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2979 if test -n "$xrpath"; then
2980 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2983 if test -n "$vinfo"; then
2984 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2987 if test -n "$release"; then
2988 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2993 if test -n "$objs$old_deplibs"; then
2994 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2998 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3006 # Delete the old objects.
3007 $run $rm $obj $libobj
3009 # Objects from convenience libraries. This assumes
3010 # single-version convenience libraries. Whenever we create
3011 # different ones for PIC/non-PIC, this we'll have to duplicate
3015 # reload_cmds runs $LD directly, so let us get rid of
3016 # -Wl from whole_archive_flag_spec
3019 if test -n "$convenience"; then
3020 if test -n "$whole_archive_flag_spec"; then
3021 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3023 gentop="$output_objdir/${obj}x"
3024 $show "${rm}r $gentop"
3025 $run ${rm}r "$gentop"
3026 $show "mkdir $gentop"
3027 $run mkdir "$gentop"
3029 if test $status -ne 0 && test ! -d "$gentop"; then
3032 generated="$generated $gentop"
3034 for xlib in $convenience; do
3035 # Extract the objects.
3037 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3038 *) xabs=`pwd`"/$xlib" ;;
3040 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3041 xdir="$gentop/$xlib"
3043 $show "${rm}r $xdir"
3048 if test $status -ne 0 && test ! -d "$xdir"; then
3051 $show "(cd $xdir && $AR x $xabs)"
3052 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3054 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3059 # Create the old-style object.
3060 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
3063 eval cmds=\"$reload_cmds\"
3064 save_ifs="$IFS"; IFS='~'
3065 for cmd in $cmds; do
3068 $run eval "$cmd" || exit $?
3072 # Exit if we aren't doing a library object file.
3073 if test -z "$libobj"; then
3074 if test -n "$gentop"; then
3075 $show "${rm}r $gentop"
3082 if test "$build_libtool_libs" != yes; then
3083 if test -n "$gentop"; then
3084 $show "${rm}r $gentop"
3088 # Create an invalid libtool object if no PIC, so that we don't
3089 # accidentally link it into a program.
3090 $show "echo timestamp > $libobj"
3091 $run eval "echo timestamp > $libobj" || exit $?
3095 if test -n "$pic_flag" || test "$pic_mode" != default; then
3096 # Only do commands if we really have different PIC objects.
3097 reload_objs="$libobjs $reload_conv_objs"
3099 eval cmds=\"$reload_cmds\"
3100 save_ifs="$IFS"; IFS='~'
3101 for cmd in $cmds; do
3104 $run eval "$cmd" || exit $?
3108 # Just create a symlink.
3111 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3112 if test "X$xdir" = "X$libobj"; then
3117 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3118 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3119 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3120 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3123 if test -n "$gentop"; then
3124 $show "${rm}r $gentop"
3133 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3135 if test -n "$vinfo"; then
3136 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3139 if test -n "$release"; then
3140 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3143 if test "$preload" = yes; then
3144 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3145 test "$dlopen_self_static" = unknown; then
3146 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3151 *-*-rhapsody* | *-*-darwin1.[012])
3152 # On Rhapsody replace the C library is the System framework
3153 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3154 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3158 compile_command="$compile_command $compile_deplibs"
3159 finalize_command="$finalize_command $finalize_deplibs"
3161 if test -n "$rpath$xrpath"; then
3162 # If the user specified any rpath flags, then add them.
3163 for libdir in $rpath $xrpath; do
3164 # This is the magic to use -rpath.
3165 case "$finalize_rpath " in
3167 *) finalize_rpath="$finalize_rpath $libdir" ;;
3172 # Now hardcode the library paths
3175 for libdir in $compile_rpath $finalize_rpath; do
3176 if test -n "$hardcode_libdir_flag_spec"; then
3177 if test -n "$hardcode_libdir_separator"; then
3178 if test -z "$hardcode_libdirs"; then
3179 hardcode_libdirs="$libdir"
3181 # Just accumulate the unique libdirs.
3182 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3183 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3186 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3191 eval flag=\"$hardcode_libdir_flag_spec\"
3192 rpath="$rpath $flag"
3194 elif test -n "$runpath_var"; then
3195 case "$perm_rpath " in
3197 *) perm_rpath="$perm_rpath $libdir" ;;
3201 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3202 case :$dllsearchpath: in
3204 *) dllsearchpath="$dllsearchpath:$libdir";;
3209 # Substitute the hardcoded libdirs into the rpath.
3210 if test -n "$hardcode_libdir_separator" &&
3211 test -n "$hardcode_libdirs"; then
3212 libdir="$hardcode_libdirs"
3213 eval rpath=\" $hardcode_libdir_flag_spec\"
3215 compile_rpath="$rpath"
3219 for libdir in $finalize_rpath; do
3220 if test -n "$hardcode_libdir_flag_spec"; then
3221 if test -n "$hardcode_libdir_separator"; then
3222 if test -z "$hardcode_libdirs"; then
3223 hardcode_libdirs="$libdir"
3225 # Just accumulate the unique libdirs.
3226 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3227 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3230 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3235 eval flag=\"$hardcode_libdir_flag_spec\"
3236 rpath="$rpath $flag"
3238 elif test -n "$runpath_var"; then
3239 case "$finalize_perm_rpath " in
3241 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3245 # Substitute the hardcoded libdirs into the rpath.
3246 if test -n "$hardcode_libdir_separator" &&
3247 test -n "$hardcode_libdirs"; then
3248 libdir="$hardcode_libdirs"
3249 eval rpath=\" $hardcode_libdir_flag_spec\"
3251 finalize_rpath="$rpath"
3253 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3254 # Transform all the library objects into standard objects.
3255 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3256 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3260 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3261 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3262 dlsyms="${outputname}S.c"
3264 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3268 if test -n "$dlsyms"; then
3272 # Discover the nlist of each of the dlfiles.
3273 nlist="$output_objdir/${outputname}.nm"
3275 $show "$rm $nlist ${nlist}S ${nlist}T"
3276 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3278 # Parse the name list into a source file.
3279 $show "creating $output_objdir/$dlsyms"
3281 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3282 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3283 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3289 /* Prevent the only kind of declaration conflicts we can make. */
3290 #define lt_preloaded_symbols some_other_symbol
3292 /* External symbol declarations for the compiler. */\
3295 if test "$dlself" = yes; then
3296 $show "generating symbol list for \`$output'"
3298 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3300 # Add our own program objects to the symbol list.
3301 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3302 for arg in $progfiles; do
3303 $show "extracting global C symbols from \`$arg'"
3304 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3307 if test -n "$exclude_expsyms"; then
3308 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3309 $run eval '$mv "$nlist"T "$nlist"'
3312 if test -n "$export_symbols_regex"; then
3313 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3314 $run eval '$mv "$nlist"T "$nlist"'
3317 # Prepare the list of exported symbols
3318 if test -z "$export_symbols"; then
3319 export_symbols="$output_objdir/$output.exp"
3320 $run $rm $export_symbols
3321 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3323 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3324 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3325 $run eval 'mv "$nlist"T "$nlist"'
3329 for arg in $dlprefiles; do
3330 $show "extracting global C symbols from \`$arg'"
3331 name=`echo "$arg" | sed -e 's%^.*/%%'`
3332 $run eval 'echo ": $name " >> "$nlist"'
3333 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3336 if test -z "$run"; then
3337 # Make sure we have at least an empty file.
3338 test -f "$nlist" || : > "$nlist"
3340 if test -n "$exclude_expsyms"; then
3341 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3342 $mv "$nlist"T "$nlist"
3345 # Try sorting and uniquifying the output.
3346 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3349 grep -v "^: " < "$nlist" > "$nlist"S
3352 if test -f "$nlist"S; then
3353 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3355 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3358 $echo >> "$output_objdir/$dlsyms" "\
3360 #undef lt_preloaded_symbols
3362 #if defined (__STDC__) && __STDC__
3363 # define lt_ptr void *
3365 # define lt_ptr char *
3369 /* The mapping between symbol names and symbols. */
3374 lt_preloaded_symbols[] =
3378 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3380 $echo >> "$output_objdir/$dlsyms" "\
3384 /* This works around a problem in FreeBSD linker */
3385 #ifdef FREEBSD_WORKAROUND
3386 static const void *lt_preloaded_setup() {
3387 return lt_preloaded_symbols;
3397 pic_flag_for_symtable=
3399 # compiling the symbol table file with pic_flag works around
3400 # a FreeBSD bug that causes programs to crash when -lm is
3401 # linked before any other PIC object. But we must not use
3402 # pic_flag when linking with -static. The problem exists in
3403 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3404 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3405 case "$compile_command " in
3407 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3410 case "$compile_command " in
3412 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3416 # Now compile the dynamic symbol file.
3417 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3418 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3420 # Clean up the generated files.
3421 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3422 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3424 # Transform the symbol file into the correct name.
3425 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3426 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3429 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3434 # We keep going just in case the user didn't refer to
3435 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3436 # really was required.
3438 # Nullify the symbol file.
3439 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3440 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3443 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3444 # Replace the output file specification.
3445 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3446 link_command="$compile_command$compile_rpath"
3448 # We have no uninstalled library dependencies, so finalize right now.
3449 $show "$link_command"
3450 $run eval "$link_command"
3453 # Delete the generated files.
3454 if test -n "$dlsyms"; then
3455 $show "$rm $output_objdir/${outputname}S.${objext}"
3456 $run $rm "$output_objdir/${outputname}S.${objext}"
3462 if test -n "$shlibpath_var"; then
3463 # We should set the shlibpath_var
3465 for dir in $temp_rpath; do
3467 [\\/]* | [A-Za-z]:[\\/]*)
3472 # Relative path: add a thisdir entry.
3473 rpath="$rpath\$thisdir/$dir:"
3480 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3481 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3483 if test -n "$finalize_shlibpath"; then
3484 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3489 if test -n "$runpath_var"; then
3490 if test -n "$perm_rpath"; then
3491 # We should set the runpath_var.
3493 for dir in $perm_rpath; do
3496 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3498 if test -n "$finalize_perm_rpath"; then
3499 # We should set the runpath_var.
3501 for dir in $finalize_perm_rpath; do
3504 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3508 if test "$no_install" = yes; then
3509 # We don't need to create a wrapper script.
3510 link_command="$compile_var$compile_command$compile_rpath"
3511 # Replace the output file specification.
3512 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3513 # Delete the old output file.
3515 # Link the executable and exit
3516 $show "$link_command"
3517 $run eval "$link_command" || exit $?
3521 if test "$hardcode_action" = relink; then
3522 # Fast installation is not supported
3523 link_command="$compile_var$compile_command$compile_rpath"
3524 relink_command="$finalize_var$finalize_command$finalize_rpath"
3526 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3527 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3529 if test "$fast_install" != no; then
3530 link_command="$finalize_var$compile_command$finalize_rpath"
3531 if test "$fast_install" = yes; then
3532 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3534 # fast_install is set to needless
3538 link_command="$compile_var$compile_command$compile_rpath"
3539 relink_command="$finalize_var$finalize_command$finalize_rpath"
3543 # Replace the output file specification.
3544 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3546 # Delete the old output files.
3547 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3549 $show "$link_command"
3550 $run eval "$link_command" || exit $?
3552 # Now create the wrapper script.
3553 $show "creating $output"
3555 # Quote the relink command for shipping.
3556 if test -n "$relink_command"; then
3557 # Preserve any variables that may affect compiler behavior
3558 for var in $variables_saved_for_relink; do
3559 if eval test -z \"\${$var+set}\"; then
3560 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3561 elif eval var_value=\$$var; test -z "$var_value"; then
3562 relink_command="$var=; export $var; $relink_command"
3564 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3565 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3568 relink_command="(cd `pwd`; $relink_command)"
3569 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3572 # Quote $echo for shipping.
3573 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3575 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3576 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3578 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3580 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3583 # Only actually do things if our run command is non-null.
3584 if test -z "$run"; then
3585 # win32 will think the script is a binary if it has
3586 # a .exe suffix, so we strip it off here.
3588 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3590 # test for cygwin because mv fails w/o .exe extensions
3592 *cygwin*) exeext=.exe ;;
3596 trap "$rm $output; exit 1" 1 2 15
3601 # $output - temporary wrapper script for $objdir/$outputname
3602 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3604 # The $output program cannot be directly executed until all the libtool
3605 # libraries that it depends on are installed.
3607 # This wrapper script should never be moved out of the build directory.
3608 # If it is, it will not operate correctly.
3610 # Sed substitution that helps us do robust quoting. It backslashifies
3611 # metacharacters that are still active within double-quoted strings.
3612 Xsed='sed -e 1s/^X//'
3613 sed_quote_subst='$sed_quote_subst'
3615 # The HP-UX ksh and POSIX shell print the target directory to stdout
3617 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3619 relink_command=\"$relink_command\"
3621 # This environment variable determines our operation mode.
3622 if test \"\$libtool_install_magic\" = \"$magic\"; then
3623 # install mode needs the following variable:
3624 notinst_deplibs='$notinst_deplibs'
3626 # When we are sourced in execute mode, \$file and \$echo are already set.
3627 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3630 # Make sure echo works.
3631 if test \"X\$1\" = X--no-reexec; then
3632 # Discard the --no-reexec flag, and continue.
3634 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3635 # Yippee, \$echo works!
3638 # Restart under the correct shell, and then maybe \$echo will work.
3639 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3645 # Find the directory that this script lives in.
3646 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3647 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3649 # Follow symbolic links until we get to the real thisdir.
3650 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3651 while test -n \"\$file\"; do
3652 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3654 # If there was a directory component, then change thisdir.
3655 if test \"x\$destdir\" != \"x\$file\"; then
3656 case \"\$destdir\" in
3657 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3658 *) thisdir=\"\$thisdir/\$destdir\" ;;
3662 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3663 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3666 # Try to get the absolute directory name.
3667 absdir=\`cd \"\$thisdir\" && pwd\`
3668 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3671 if test "$fast_install" = yes; then
3673 program=lt-'$outputname'$exeext
3674 progdir=\"\$thisdir/$objdir\"
3676 if test ! -f \"\$progdir/\$program\" || \\
3677 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3678 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3680 file=\"\$\$-\$program\"
3682 if test ! -d \"\$progdir\"; then
3683 $mkdir \"\$progdir\"
3685 $rm \"\$progdir/\$file\"
3690 # relink executable if necessary
3691 if test -n \"\$relink_command\"; then
3692 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3694 $echo \"\$relink_command_output\" >&2
3695 $rm \"\$progdir/\$file\"
3700 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3701 { $rm \"\$progdir/\$program\";
3702 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3703 $rm \"\$progdir/\$file\"
3707 program='$outputname'
3708 progdir=\"\$thisdir/$objdir\"
3714 if test -f \"\$progdir/\$program\"; then"
3716 # Export our shlibpath_var if we have one.
3717 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3719 # Add our own library path to $shlibpath_var
3720 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3722 # Some systems cannot cope with colon-terminated $shlibpath_var
3723 # The second colon is a workaround for a bug in BeOS R4 sed
3724 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3726 export $shlibpath_var
3730 # fixup the dll searchpath if we need to.
3731 if test -n "$dllsearchpath"; then
3733 # Add the dll search path components to the executable PATH
3734 PATH=$dllsearchpath:\$PATH
3739 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3740 # Run the actual program with our arguments.
3743 # win32 systems need to use the prog path for dll
3745 *-*-cygwin* | *-*-pw32*)
3747 exec \$progdir/\$program \${1+\"\$@\"}
3751 # Backslashes separate directories on plain windows
3752 *-*-mingw | *-*-os2*)
3754 exec \$progdir\\\\\$program \${1+\"\$@\"}
3760 # Export the path to the program.
3761 PATH=\"\$progdir:\$PATH\"
3764 exec \$program \${1+\"\$@\"}
3769 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3773 # The program doesn't exist.
3774 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3775 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3776 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3787 # See if we need to build an old-fashioned archive.
3788 for oldlib in $oldlibs; do
3790 if test "$build_libtool_libs" = convenience; then
3791 oldobjs="$libobjs_save"
3792 addlibs="$convenience"
3793 build_libtool_libs=no
3795 if test "$build_libtool_libs" = module; then
3796 oldobjs="$libobjs_save"
3797 build_libtool_libs=no
3799 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3801 addlibs="$old_convenience"
3804 if test -n "$addlibs"; then
3805 gentop="$output_objdir/${outputname}x"
3806 $show "${rm}r $gentop"
3807 $run ${rm}r "$gentop"
3808 $show "mkdir $gentop"
3809 $run mkdir "$gentop"
3811 if test $status -ne 0 && test ! -d "$gentop"; then
3814 generated="$generated $gentop"
3816 # Add in members from convenience archives.
3817 for xlib in $addlibs; do
3818 # Extract the objects.
3820 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3821 *) xabs=`pwd`"/$xlib" ;;
3823 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3824 xdir="$gentop/$xlib"
3826 $show "${rm}r $xdir"
3831 if test $status -ne 0 && test ! -d "$xdir"; then
3834 $show "(cd $xdir && $AR x $xabs)"
3835 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3837 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3841 # Do each command in the archive commands.
3842 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3843 eval cmds=\"$old_archive_from_new_cmds\"
3845 # Ensure that we have .o objects in place in case we decided
3846 # not to build a shared library, and have fallen back to building
3847 # static libs even though --disable-static was passed!
3848 for oldobj in $oldobjs; do
3849 if test ! -f $oldobj; then
3850 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3851 if test "X$xdir" = "X$oldobj"; then
3856 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3857 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3858 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3859 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3863 eval cmds=\"$old_archive_cmds\"
3865 save_ifs="$IFS"; IFS='~'
3866 for cmd in $cmds; do
3869 $run eval "$cmd" || exit $?
3874 if test -n "$generated"; then
3875 $show "${rm}r$generated"
3876 $run ${rm}r$generated
3879 # Now create the libtool archive.
3883 test "$build_old_libs" = yes && old_library="$libname.$libext"
3884 $show "creating $output"
3886 # Preserve any variables that may affect compiler behavior
3887 for var in $variables_saved_for_relink; do
3888 if eval test -z \"\${$var+set}\"; then
3889 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3890 elif eval var_value=\$$var; test -z "$var_value"; then
3891 relink_command="$var=; export $var; $relink_command"
3893 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3894 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3897 # Quote the link command for shipping.
3898 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3899 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3901 # Only create the output if not a dry run.
3902 if test -z "$run"; then
3903 for installed in no yes; do
3904 if test "$installed" = yes; then
3905 if test -z "$install_libdir"; then
3908 output="$output_objdir/$outputname"i
3909 # Replace all uninstalled libtool libraries with the installed ones
3911 for deplib in $dependency_libs; do
3914 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3915 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3916 if test -z "$libdir"; then
3917 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3920 newdependency_libs="$newdependency_libs $libdir/$name"
3922 *) newdependency_libs="$newdependency_libs $deplib" ;;
3925 dependency_libs="$newdependency_libs"
3927 for lib in $dlfiles; do
3928 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3929 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3930 if test -z "$libdir"; then
3931 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3934 newdlfiles="$newdlfiles $libdir/$name"
3936 dlfiles="$newdlfiles"
3938 for lib in $dlprefiles; do
3939 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3940 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3941 if test -z "$libdir"; then
3942 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3945 newdlprefiles="$newdlprefiles $libdir/$name"
3947 dlprefiles="$newdlprefiles"
3950 # place dlname in correct position for cygwin
3952 case $host,$output,$installed,$module,$dlname in
3953 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3956 # $outputname - a libtool library file
3957 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3959 # Please DO NOT delete this file!
3960 # It is necessary for linking the library.
3962 # The name that we can dlopen(3).
3965 # Names of this library.
3966 library_names='$library_names'
3968 # The name of the static archive.
3969 old_library='$old_library'
3971 # Libraries that this one depends upon.
3972 dependency_libs='$dependency_libs'
3974 # Version information for $libname.
3979 # Is this an already installed library?
3980 installed=$installed
3982 # Files to dlopen/dlpreopen
3984 dlpreopen='$dlprefiles'
3986 # Directory that this library needs to be installed in:
3987 libdir='$install_libdir'"
3988 if test "$installed" = no && test $need_relink = yes; then
3990 relink_command=\"$relink_command\""
3995 # Do a symbolic link so that the libtool archive can be found in
3996 # LD_LIBRARY_PATH before the program is installed.
3997 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3998 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4004 # libtool install mode
4006 modename="$modename: install"
4008 # There may be an optional sh(1) argument at the beginning of
4009 # install_prog (especially on Windows NT).
4010 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4011 # Allow the use of GNU shtool's install command.
4012 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4013 # Aesthetically quote it.
4014 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4016 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4020 install_prog="$arg "
4028 # The real first argument should be the name of the installation program.
4029 # Aesthetically quote it.
4030 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4032 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4036 install_prog="$install_prog$arg"
4038 # We need to accept at least all the BSD install flags.
4048 if test -n "$dest"; then
4049 files="$files $dest"
4067 # If the previous option needed an argument, then skip it.
4068 if test -n "$prev"; then
4077 # Aesthetically quote the argument.
4078 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4080 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4084 install_prog="$install_prog $arg"
4087 if test -z "$install_prog"; then
4088 $echo "$modename: you must specify an install program" 1>&2
4093 if test -n "$prev"; then
4094 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4099 if test -z "$files"; then
4100 if test -z "$dest"; then
4101 $echo "$modename: no file or destination specified" 1>&2
4103 $echo "$modename: you must specify a destination" 1>&2
4109 # Strip any trailing slash from the destination.
4110 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4112 # Check to see that the destination is a directory.
4113 test -d "$dest" && isdir=yes
4114 if test "$isdir" = yes; then
4118 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4119 test "X$destdir" = "X$dest" && destdir=.
4120 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4122 # Not a directory, so check to see that there is only one file specified.
4124 if test $# -gt 2; then
4125 $echo "$modename: \`$dest' is not a directory" 1>&2
4131 [\\/]* | [A-Za-z]:[\\/]*) ;;
4133 for file in $files; do
4137 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4146 # This variable tells wrapper scripts just to set variables rather
4147 # than running their programs.
4148 libtool_install_magic="$magic"
4153 for file in $files; do
4155 # Do each installation.
4158 # Do the static libraries later.
4159 staticlibs="$staticlibs $file"
4163 # Check to see that this really is a libtool archive.
4164 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4166 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4174 # If there is no directory component, then add one.
4176 */* | *\\*) . $file ;;
4180 # Add the libdir to current_libdirs if it is the destination.
4181 if test "X$destdir" = "X$libdir"; then
4182 case "$current_libdirs " in
4184 *) current_libdirs="$current_libdirs $libdir" ;;
4187 # Note the libdir as a future libdir.
4188 case "$future_libdirs " in
4190 *) future_libdirs="$future_libdirs $libdir" ;;
4194 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4195 test "X$dir" = "X$file/" && dir=
4198 if test -n "$relink_command"; then
4199 $echo "$modename: warning: relinking \`$file'" 1>&2
4200 $show "$relink_command"
4201 if $run eval "$relink_command"; then :
4203 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4208 # See the names of the shared library.
4209 set dummy $library_names
4210 if test -n "$2"; then
4216 test -n "$relink_command" && srcname="$realname"T
4218 # Install the shared library and build the symlinks.
4219 $show "$install_prog $dir/$srcname $destdir/$realname"
4220 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4221 if test -n "$stripme" && test -n "$striplib"; then
4222 $show "$striplib $destdir/$realname"
4223 $run eval "$striplib $destdir/$realname" || exit $?
4226 if test $# -gt 0; then
4227 # Delete the old symlinks, and create new ones.
4230 if test "$linkname" != "$realname"; then
4231 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4232 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4237 # Do each command in the postinstall commands.
4238 lib="$destdir/$realname"
4239 eval cmds=\"$postinstall_cmds\"
4240 save_ifs="$IFS"; IFS='~'
4241 for cmd in $cmds; do
4244 $run eval "$cmd" || exit $?
4249 # Install the pseudo-library for information purposes.
4250 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4251 instname="$dir/$name"i
4252 $show "$install_prog $instname $destdir/$name"
4253 $run eval "$install_prog $instname $destdir/$name" || exit $?
4255 # Maybe install the static library, too.
4256 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4260 # Install (i.e. copy) a libtool object.
4262 # Figure out destination file name, if it wasn't already specified.
4263 if test -n "$destname"; then
4264 destfile="$destdir/$destname"
4266 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4267 destfile="$destdir/$destfile"
4270 # Deduce the name of the destination old-style object file.
4273 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4276 staticdest="$destfile"
4280 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4286 # Install the libtool object if requested.
4287 if test -n "$destfile"; then
4288 $show "$install_prog $file $destfile"
4289 $run eval "$install_prog $file $destfile" || exit $?
4292 # Install the old object if enabled.
4293 if test "$build_old_libs" = yes; then
4294 # Deduce the name of the old-style object file.
4295 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4297 $show "$install_prog $staticobj $staticdest"
4298 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4304 # Figure out destination file name, if it wasn't already specified.
4305 if test -n "$destname"; then
4306 destfile="$destdir/$destname"
4308 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4309 destfile="$destdir/$destfile"
4312 # Do a test to see if this is really a libtool program.
4315 wrapper=`echo $file | sed -e 's,.exe$,,'`
4321 if (sed -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4325 # If there is no directory component, then add one.
4327 */* | *\\*) . $wrapper ;;
4331 # Check the variables that should have been set.
4332 if test -z "$notinst_deplibs"; then
4333 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4338 for lib in $notinst_deplibs; do
4339 # Check to see that each library is installed.
4341 if test -f "$lib"; then
4342 # If there is no directory component, then add one.
4344 */* | *\\*) . $lib ;;
4348 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4349 if test -n "$libdir" && test ! -f "$libfile"; then
4350 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4356 # If there is no directory component, then add one.
4358 */* | *\\*) . $wrapper ;;
4363 if test "$fast_install" = no && test -n "$relink_command"; then
4364 if test "$finalize" = yes && test -z "$run"; then
4366 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4367 tmpdir="$tmpdir/libtool-$$"
4368 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4370 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4373 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4374 outputname="$tmpdir/$file"
4375 # Replace the output file specification.
4376 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4378 $show "$relink_command"
4379 if $run eval "$relink_command"; then :
4381 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4387 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4390 # Install the binary that we compiled earlier.
4391 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4395 # remove .exe since cygwin /usr/bin/install will append another
4397 case $install_prog,$host in
4398 /usr/bin/install*,*cygwin*)
4399 case $file:$destfile in
4404 destfile=$destfile.exe
4407 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4412 $show "$install_prog$stripme $file $destfile"
4413 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4414 test -n "$outputname" && ${rm}r "$tmpdir"
4419 for file in $staticlibs; do
4420 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4422 # Set up the ranlib parameters.
4423 oldlib="$destdir/$name"
4425 $show "$install_prog $file $oldlib"
4426 $run eval "$install_prog \$file \$oldlib" || exit $?
4428 if test -n "$stripme" && test -n "$striplib"; then
4429 $show "$old_striplib $oldlib"
4430 $run eval "$old_striplib $oldlib" || exit $?
4433 # Do each command in the postinstall commands.
4434 eval cmds=\"$old_postinstall_cmds\"
4435 save_ifs="$IFS"; IFS='~'
4436 for cmd in $cmds; do
4439 $run eval "$cmd" || exit $?
4444 if test -n "$future_libdirs"; then
4445 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4448 if test -n "$current_libdirs"; then
4449 # Maybe just do a dry run.
4450 test -n "$run" && current_libdirs=" -n$current_libdirs"
4451 exec_cmd='$SHELL $0 --finish$current_libdirs'
4457 # libtool finish mode
4459 modename="$modename: finish"
4463 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4466 libdirs="$libdirs $dir"
4469 for libdir in $libdirs; do
4470 if test -n "$finish_cmds"; then
4471 # Do each command in the finish commands.
4472 eval cmds=\"$finish_cmds\"
4473 save_ifs="$IFS"; IFS='~'
4474 for cmd in $cmds; do
4477 $run eval "$cmd" || admincmds="$admincmds
4482 if test -n "$finish_eval"; then
4483 # Do the single finish_eval.
4484 eval cmds=\"$finish_eval\"
4485 $run eval "$cmds" || admincmds="$admincmds
4491 # Exit here if they wanted silent mode.
4492 test "$show" = ":" && exit 0
4494 echo "----------------------------------------------------------------------"
4495 echo "Libraries have been installed in:"
4496 for libdir in $libdirs; do
4500 echo "If you ever happen to want to link against installed libraries"
4501 echo "in a given directory, LIBDIR, you must either use libtool, and"
4502 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4503 echo "flag during linking and do at least one of the following:"
4504 if test -n "$shlibpath_var"; then
4505 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4506 echo " during execution"
4508 if test -n "$runpath_var"; then
4509 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4510 echo " during linking"
4512 if test -n "$hardcode_libdir_flag_spec"; then
4514 eval flag=\"$hardcode_libdir_flag_spec\"
4516 echo " - use the \`$flag' linker flag"
4518 if test -n "$admincmds"; then
4519 echo " - have your system administrator run these commands:$admincmds"
4521 if test -f /etc/ld.so.conf; then
4522 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4525 echo "See any operating system documentation about shared libraries for"
4526 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4527 echo "----------------------------------------------------------------------"
4531 # libtool execute mode
4533 modename="$modename: execute"
4535 # The first argument is the command name.
4537 if test -z "$cmd"; then
4538 $echo "$modename: you must specify a COMMAND" 1>&2
4543 # Handle -dlopen flags immediately.
4544 for file in $execute_dlfiles; do
4545 if test ! -f "$file"; then
4546 $echo "$modename: \`$file' is not a file" 1>&2
4554 # Check to see that this really is a libtool archive.
4555 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4557 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4562 # Read the libtool library.
4566 # If there is no directory component, then add one.
4568 */* | *\\*) . $file ;;
4572 # Skip this library if it cannot be dlopened.
4573 if test -z "$dlname"; then
4574 # Warn if it was a shared library.
4575 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4579 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4580 test "X$dir" = "X$file" && dir=.
4582 if test -f "$dir/$objdir/$dlname"; then
4585 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4591 # Just add the directory containing the .lo file.
4592 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4593 test "X$dir" = "X$file" && dir=.
4597 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4602 # Get the absolute pathname.
4603 absdir=`cd "$dir" && pwd`
4604 test -n "$absdir" && dir="$absdir"
4606 # Now add the directory to shlibpath_var.
4607 if eval "test -z \"\$$shlibpath_var\""; then
4608 eval "$shlibpath_var=\"\$dir\""
4610 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4614 # This variable tells wrapper scripts just to set shlibpath_var
4615 # rather than running their programs.
4616 libtool_execute_magic="$magic"
4618 # Check if any of the arguments is a wrapper script.
4625 # Do a test to see if this is really a libtool program.
4626 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4627 # If there is no directory component, then add one.
4629 */* | *\\*) . $file ;;
4633 # Transform arg to wrapped name.
4634 file="$progdir/$program"
4638 # Quote arguments (to preserve shell metacharacters).
4639 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4640 args="$args \"$file\""
4643 if test -z "$run"; then
4644 if test -n "$shlibpath_var"; then
4645 # Export the shlibpath_var.
4646 eval "export $shlibpath_var"
4649 # Restore saved enviroment variables
4650 if test "${save_LC_ALL+set}" = set; then
4651 LC_ALL="$save_LC_ALL"; export LC_ALL
4653 if test "${save_LANG+set}" = set; then
4654 LANG="$save_LANG"; export LANG
4657 # Now prepare to actually exec the command.
4658 exec_cmd="\$cmd$args"
4660 # Display what would be done.
4661 if test -n "$shlibpath_var"; then
4662 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4663 $echo "export $shlibpath_var"
4670 # libtool clean and uninstall mode
4672 modename="$modename: $mode"
4678 # This variable tells wrapper scripts just to set variables rather
4679 # than running their programs.
4680 libtool_install_magic="$magic"
4685 -f) rm="$rm $arg"; rmforce=yes ;;
4686 -*) rm="$rm $arg" ;;
4687 *) files="$files $arg" ;;
4691 if test -z "$rm"; then
4692 $echo "$modename: you must specify an RM program" 1>&2
4699 for file in $files; do
4700 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4701 if test "X$dir" = "X$file"; then
4705 objdir="$dir/$objdir"
4707 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4708 test $mode = uninstall && objdir="$dir"
4710 # Remember objdir for removal later, being careful to avoid duplicates
4711 if test $mode = clean; then
4714 *) rmdirs="$rmdirs $objdir" ;;
4718 # Don't error if the file doesn't exist and rm -f was used.
4719 if (test -L "$file") >/dev/null 2>&1 \
4720 || (test -h "$file") >/dev/null 2>&1 \
4721 || test -f "$file"; then
4723 elif test -d "$file"; then
4726 elif test "$rmforce" = yes; then
4734 # Possibly a libtool archive, so verify it.
4735 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4738 # Delete the libtool libraries and symlinks.
4739 for n in $library_names; do
4740 rmfiles="$rmfiles $objdir/$n"
4742 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4743 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4745 if test $mode = uninstall; then
4746 if test -n "$library_names"; then
4747 # Do each command in the postuninstall commands.
4748 eval cmds=\"$postuninstall_cmds\"
4749 save_ifs="$IFS"; IFS='~'
4750 for cmd in $cmds; do
4754 if test $? != 0 && test "$rmforce" != yes; then
4761 if test -n "$old_library"; then
4762 # Do each command in the old_postuninstall commands.
4763 eval cmds=\"$old_postuninstall_cmds\"
4764 save_ifs="$IFS"; IFS='~'
4765 for cmd in $cmds; do
4769 if test $? != 0 && test "$rmforce" != yes; then
4775 # FIXME: should reinstall the best remaining shared library.
4781 if test "$build_old_libs" = yes; then
4782 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4783 rmfiles="$rmfiles $dir/$oldobj"
4788 # Do a test to see if this is a libtool program.
4789 if test $mode = clean &&
4790 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4794 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4795 if test "$fast_install" = yes && test -n "$relink_command"; then
4796 rmfiles="$rmfiles $objdir/lt-$name"
4801 $show "$rm $rmfiles"
4802 $run $rm $rmfiles || exit_status=1
4805 # Try to remove the ${objdir}s in the directories where we deleted files
4806 for dir in $rmdirs; do
4807 if test -d "$dir"; then
4809 $run rmdir $dir >/dev/null 2>&1
4817 $echo "$modename: you must specify a MODE" 1>&2
4818 $echo "$generic_help" 1>&2
4823 if test -z "$exec_cmd"; then
4824 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4825 $echo "$generic_help" 1>&2
4828 fi # test -z "$show_help"
4830 if test -n "$exec_cmd"; then
4835 # We need to display help for each of the modes.
4838 "Usage: $modename [OPTION]... [MODE-ARG]...
4840 Provide generalized library-building support services.
4842 --config show all configuration variables
4843 --debug enable verbose shell tracing
4844 -n, --dry-run display commands without modifying any files
4845 --features display basic configuration information and exit
4846 --finish same as \`--mode=finish'
4847 --help display this help message and exit
4848 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4849 --quiet same as \`--silent'
4850 --silent don't print informational messages
4851 --version print version information
4853 MODE must be one of the following:
4855 clean remove files from the build directory
4856 compile compile a source file into a libtool object
4857 execute automatically set library path, then run a program
4858 finish complete the installation of libtool libraries
4859 install install libraries or executables
4860 link create a library or an executable
4861 uninstall remove libraries from an installed directory
4863 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4864 a more detailed description of MODE."
4870 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4872 Remove files from the build directory.
4874 RM is the name of the program to use to delete files associated with each FILE
4875 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4878 If FILE is a libtool library, object or program, all the files associated
4879 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4884 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4886 Compile a source file into a libtool library object.
4888 This mode accepts the following additional options:
4890 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4891 -prefer-pic try to building PIC objects only
4892 -prefer-non-pic try to building non-PIC objects only
4893 -static always build a \`.o' file suitable for static linking
4895 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4896 from the given SOURCEFILE.
4898 The output file name is determined by removing the directory component from
4899 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4900 library object suffix, \`.lo'."
4905 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4907 Automatically set library path, then run a program.
4909 This mode accepts the following additional options:
4911 -dlopen FILE add the directory containing FILE to the library path
4913 This mode sets the library path environment variable according to \`-dlopen'
4916 If any of the ARGS are libtool executable wrappers, then they are translated
4917 into their corresponding uninstalled binary, and any of their required library
4918 directories are added to the library path.
4920 Then, COMMAND is executed, with ARGS as arguments."
4925 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4927 Complete the installation of libtool libraries.
4929 Each LIBDIR is a directory that contains libtool libraries.
4931 The commands that this mode executes may require superuser privileges. Use
4932 the \`--dry-run' option if you just want to see what would be executed."
4937 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4939 Install executables or libraries.
4941 INSTALL-COMMAND is the installation command. The first component should be
4942 either the \`install' or \`cp' program.
4944 The rest of the components are interpreted as arguments to that command (only
4945 BSD-compatible install options are recognized)."
4950 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4952 Link object files or libraries together to form another library, or to
4953 create an executable program.
4955 LINK-COMMAND is a command using the C compiler that you would use to create
4956 a program from several object files.
4958 The following components of LINK-COMMAND are treated specially:
4960 -all-static do not do any dynamic linking at all
4961 -avoid-version do not add a version suffix if possible
4962 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4963 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4964 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4965 -export-symbols SYMFILE
4966 try to export only the symbols listed in SYMFILE
4967 -export-symbols-regex REGEX
4968 try to export only the symbols matching REGEX
4969 -LLIBDIR search LIBDIR for required installed libraries
4970 -lNAME OUTPUT-FILE requires the installed library libNAME
4971 -module build a library that can dlopened
4972 -no-fast-install disable the fast-install mode
4973 -no-install link a not-installable executable
4974 -no-undefined declare that a library does not refer to external symbols
4975 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4976 -release RELEASE specify package release information
4977 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4978 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4979 -static do not do any dynamic linking of libtool libraries
4980 -version-info CURRENT[:REVISION[:AGE]]
4981 specify library version info [each variable defaults to 0]
4983 All other options (arguments beginning with \`-') are ignored.
4985 Every other argument is treated as a filename. Files ending in \`.la' are
4986 treated as uninstalled libtool libraries, other files are standard or library
4989 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4990 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4991 required, except when creating a convenience library.
4993 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4994 using \`ar' and \`ranlib', or on Windows using \`lib'.
4996 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4997 is created, otherwise an executable program is created."
5002 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5004 Remove libraries from an installation directory.
5006 RM is the name of the program to use to delete files associated with each FILE
5007 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5010 If FILE is a libtool library, all the files associated with it are deleted.
5011 Otherwise, only FILE itself is deleted using RM."
5015 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5022 $echo "Try \`$modename --help' for more information about other modes."