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.53 2001/09/11 03:18:52)"
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" ;;
190 $echo "$modename: unrecognized option \`$arg'" 1>&2
202 if test -n "$prevopt"; then
203 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
208 # If this variable is set in any of the actions, the command in it
209 # will be execed at the end. This prevents here-documents from being
210 # left over by shells.
213 if test -z "$show_help"; then
215 # Infer the operation mode.
216 if test -z "$mode"; then
218 *cc | *++ | gcc* | *-gcc*)
230 *db | *dbx | *strace | *truss)
240 # If we have no mode, but dlfiles were specified, then do execute mode.
241 test -n "$execute_dlfiles" && mode=execute
243 # Just use the default operation mode.
244 if test -z "$mode"; then
245 if test -n "$nonopt"; then
246 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
248 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
255 # Only execute mode is allowed to have -dlopen flags.
256 if test -n "$execute_dlfiles" && test "$mode" != execute; then
257 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
262 # Change the help message to a mode-specific one.
264 help="Try \`$modename --help --mode=$mode' for more information."
266 # These modes are in order of execution frequency so that they run quickly.
268 # libtool compile mode
270 modename="$modename: compile"
271 # Get the compilation command and the source file.
284 # Aesthetically quote the previous argument.
286 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289 # Double-quote args containing other shell metacharacters.
290 # Many Bourne shells cannot handle close brackets correctly
291 # in scan sets, so we specify it separately.
292 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
297 # Add the previous argument to base_compile.
298 if test -z "$base_compile"; then
299 base_compile="$lastarg"
301 base_compile="$base_compile $lastarg"
307 # Accept any command-line options.
310 if test "$user_target" != "no"; then
311 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
338 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
340 save_ifs="$IFS"; IFS=','
344 # Double-quote args containing other shell metacharacters.
345 # Many Bourne shells cannot handle close brackets correctly
346 # in scan sets, so we specify it separately.
348 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
352 lastarg="$lastarg $arg"
355 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
357 # Add the arguments to base_compile.
358 if test -z "$base_compile"; then
359 base_compile="$lastarg"
361 base_compile="$base_compile $lastarg"
369 # The next one is the -o target name
374 # We got the output file
381 # Accept the current argument as the source file.
385 # Aesthetically quote the previous argument.
387 # Backslashify any backslashes, double quotes, and dollar signs.
388 # These are the only characters that are still specially
389 # interpreted inside of double-quoted scrings.
390 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
392 # Double-quote args containing other shell metacharacters.
393 # Many Bourne shells cannot handle close brackets correctly
394 # in scan sets, so we specify it separately.
396 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
397 lastarg="\"$lastarg\""
401 # Add the previous argument to base_compile.
402 if test -z "$base_compile"; then
403 base_compile="$lastarg"
405 base_compile="$base_compile $lastarg"
413 # Get the name of the library object.
414 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417 $echo "$modename: you must specify a target with \`-o'" 1>&2
422 # Recognize several different file suffixes.
423 # If the user specifies -o file.o, it is replaced with file.lo
438 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
443 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
448 if test -z "$base_compile"; then
449 $echo "$modename: you must specify a compilation command" 1>&2
454 # Delete any leftover library objects.
455 if test "$build_old_libs" = yes; then
456 removelist="$obj $libobj"
462 trap "$run $rm $removelist; exit 1" 1 2 15
464 # On Cygwin there's no "real" PIC flag so we must build both object types
466 cygwin* | mingw* | pw32* | os2*)
470 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
471 # non-PIC code in shared libraries is not supported
475 # Calculate the filename of the output object if compiler does
476 # not support -o with -c
477 if test "$compiler_c_o" = no; then
478 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
479 lockfile="$output_obj.lock"
480 removelist="$removelist $output_obj $lockfile"
481 trap "$run $rm $removelist; exit 1" 1 2 15
487 # Lock this critical section if it is needed
488 # We use this script file to make the link, it avoids creating a new file
489 if test "$need_locks" = yes; then
490 until $run ln "$0" "$lockfile" 2>/dev/null; do
491 $show "Waiting for $lockfile to be removed"
494 elif test "$need_locks" = warn; then
495 if test -f "$lockfile"; then
497 *** ERROR, $lockfile exists and contains:
498 `cat $lockfile 2>/dev/null`
500 This indicates that another process is trying to use the same
501 temporary object file, and libtool could not work around it because
502 your compiler does not support \`-c' and \`-o' together. If you
503 repeat this compilation, it may succeed, by chance, but you had better
504 avoid parallel builds (make -j) in this platform, or get a better
510 echo $srcfile > "$lockfile"
513 if test -n "$fix_srcfile_path"; then
514 eval srcfile=\"$fix_srcfile_path\"
517 # Only build a PIC object if we are building libtool libraries.
518 if test "$build_libtool_libs" = yes; then
519 # Without this assignment, base_compile gets emptied.
520 fbsd_hideous_sh_bug=$base_compile
522 if test "$pic_mode" != no; then
523 # All platforms use -DPIC, to notify preprocessed assembler code.
524 command="$base_compile $srcfile $pic_flag -DPIC"
526 # Don't build PIC code
527 command="$base_compile $srcfile"
529 if test "$build_old_libs" = yes; then
531 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
532 if test "X$dir" = "X$libobj"; then
537 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
539 if test -d "$dir"; then
546 if test $status -ne 0 && test ! -d $dir; then
549 $show "chmod 777 $dir"
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
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
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
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
1315 $show "chmod 777 $output_objdir"
1316 $run chmod 777 $output_objdir
1319 # Determine the type of output
1322 $echo "$modename: you must specify an output file" 1>&2
1326 *.$libext) linkmode=oldlib ;;
1327 *.lo | *.$objext) linkmode=obj ;;
1328 *.la) linkmode=lib ;;
1329 *) linkmode=prog ;; # Anything else should be a program.
1334 # Find all interdependent deplibs by searching for libraries
1335 # that are linked more than once (e.g. -la -lb -la)
1336 for deplib in $deplibs; do
1338 *" $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: This library needs some functionality provided by $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."
1474 echo "*** Warning: Linking the shared library $output against the"
1475 echo "*** static library $deplib is not portable!"
1476 deplibs="$deplib $deplibs"
1481 if test $pass != link; then
1482 deplibs="$deplib $deplibs"
1484 compile_deplibs="$deplib $compile_deplibs"
1485 finalize_deplibs="$deplib $finalize_deplibs"
1492 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1493 # If there is no dlopen support or we're linking statically,
1494 # we need to preload.
1495 newdlprefiles="$newdlprefiles $deplib"
1496 compile_deplibs="$deplib $compile_deplibs"
1497 finalize_deplibs="$deplib $finalize_deplibs"
1499 newdlfiles="$newdlfiles $deplib"
1508 if test $found = yes || test -f "$lib"; then :
1510 $echo "$modename: cannot find the library \`$lib'" 1>&2
1514 # Check to see that this really is a libtool archive.
1515 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1517 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1521 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1522 test "X$ladir" = "X$lib" && ladir="."
1530 # If the library was installed with an old release of libtool,
1531 # it will not redefine variable installed.
1536 */* | *\\*) . $lib ;;
1540 if test "$linkmode,$pass" = "lib,link" ||
1541 test "$linkmode,$pass" = "prog,scan" ||
1542 { test $linkmode = oldlib && test $linkmode = obj; }; then
1543 # Add dl[pre]opened files of deplib
1544 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1545 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1548 if test $pass = conv; then
1549 # Only check for convenience libraries
1550 deplibs="$lib $deplibs"
1551 if test -z "$libdir"; then
1552 if test -z "$old_library"; then
1553 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1556 # It is a libtool convenience library, so add in its objects.
1557 convenience="$convenience $ladir/$objdir/$old_library"
1558 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1560 for deplib in $dependency_libs; do
1561 deplibs="$deplib $deplibs"
1562 case "$tmp_libs " in
1563 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1565 tmp_libs="$tmp_libs $deplib"
1567 elif test $linkmode != prog && test $linkmode != lib; then
1568 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1574 # Get the name of the library we link against.
1576 for l in $old_library $library_names; do
1579 if test -z "$linklib"; then
1580 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1584 # This library was specified with -dlopen.
1585 if test $pass = dlopen; then
1586 if test -z "$libdir"; then
1587 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1590 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1591 # If there is no dlname, no dlopen support or we're linking
1592 # statically, we need to preload.
1593 dlprefiles="$dlprefiles $lib"
1595 newdlfiles="$newdlfiles $lib"
1600 # We need an absolute path.
1602 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1604 abs_ladir=`cd "$ladir" && pwd`
1605 if test -z "$abs_ladir"; then
1606 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1607 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1612 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1614 # Find the relevant object directory and library name.
1615 if test "X$installed" = Xyes; then
1616 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1617 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1626 dir="$ladir/$objdir"
1627 absdir="$abs_ladir/$objdir"
1628 # Remove this search path later
1629 notinst_path="$notinst_path $abs_ladir"
1630 fi # $installed = yes
1631 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1633 # This library was specified with -dlpreopen.
1634 if test $pass = dlpreopen; then
1635 if test -z "$libdir"; then
1636 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1639 # Prefer using a static library (so that no silly _DYNAMIC symbols
1640 # are required to link).
1641 if test -n "$old_library"; then
1642 newdlprefiles="$newdlprefiles $dir/$old_library"
1643 # Otherwise, use the dlname, so that lt_dlopen finds it.
1644 elif test -n "$dlname"; then
1645 newdlprefiles="$newdlprefiles $dir/$dlname"
1647 newdlprefiles="$newdlprefiles $dir/$linklib"
1649 fi # $pass = dlpreopen
1651 if test -z "$libdir"; then
1652 # Link the convenience library
1653 if test $linkmode = lib; then
1654 deplibs="$dir/$old_library $deplibs"
1655 elif test "$linkmode,$pass" = "prog,link"; then
1656 compile_deplibs="$dir/$old_library $compile_deplibs"
1657 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1659 deplibs="$lib $deplibs"
1664 if test $linkmode = prog && test $pass != link; then
1665 newlib_search_path="$newlib_search_path $ladir"
1666 deplibs="$lib $deplibs"
1669 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1670 test "$build_libtool_libs" = no; then
1675 for deplib in $dependency_libs; do
1677 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1679 # Need to link against all dependency_libs?
1680 if test $linkalldeplibs = yes; then
1681 deplibs="$deplib $deplibs"
1683 # Need to hardcode shared library paths
1684 # or/and link against static libraries
1685 newdependency_libs="$deplib $newdependency_libs"
1687 case "$tmp_libs " in
1688 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1690 tmp_libs="$tmp_libs $deplib"
1693 fi # $linkmode = prog...
1695 link_static=no # Whether the deplib will be linked statically
1696 if test -n "$library_names" &&
1697 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1698 # Link against this shared library
1700 if test "$linkmode,$pass" = "prog,link" ||
1701 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1702 # Hardcode the library path.
1703 # Skip directories that are in the system default run-time
1705 case " $sys_lib_dlsearch_path " in
1708 case "$compile_rpath " in
1710 *) compile_rpath="$compile_rpath $absdir"
1714 case " $sys_lib_dlsearch_path " in
1717 case "$finalize_rpath " in
1719 *) finalize_rpath="$finalize_rpath $libdir"
1723 if test $linkmode = prog; then
1724 # We need to hardcode the library path
1725 if test -n "$shlibpath_var"; then
1726 # Make sure the rpath contains only unique directories.
1727 case "$temp_rpath " in
1730 *) temp_rpath="$temp_rpath $dir" ;;
1734 fi # $linkmode,$pass = prog,link...
1736 if test "$alldeplibs" = yes &&
1737 { test "$deplibs_check_method" = pass_all ||
1738 { test "$build_libtool_libs" = yes &&
1739 test -n "$library_names"; }; }; then
1740 # We only need to search for static libraries
1744 if test "$installed" = no; then
1745 notinst_deplibs="$notinst_deplibs $lib"
1749 if test -n "$old_archive_from_expsyms_cmds"; then
1750 # figure out the soname
1751 set dummy $library_names
1754 libname=`eval \\$echo \"$libname_spec\"`
1755 # use dlname if we got it. it's perfectly good, no?
1756 if test -n "$dlname"; then
1758 elif test -n "$soname_spec"; then
1762 major=`expr $current - $age`
1766 eval soname=\"$soname_spec\"
1771 # Make a new name for the extract_expsyms_cmds to use
1773 soname=`echo $soroot | sed -e 's/^.*\///'`
1774 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1776 # If the library has no export list, then create one now
1777 if test -f "$output_objdir/$soname-def"; then :
1779 $show "extracting exported symbol list from \`$soname'"
1780 save_ifs="$IFS"; IFS='~'
1781 eval cmds=\"$extract_expsyms_cmds\"
1782 for cmd in $cmds; do
1785 $run eval "$cmd" || exit $?
1791 if test -f "$output_objdir/$newlib"; then :; else
1792 $show "generating import library for \`$soname'"
1793 save_ifs="$IFS"; IFS='~'
1794 eval cmds=\"$old_archive_from_expsyms_cmds\"
1795 for cmd in $cmds; do
1798 $run eval "$cmd" || exit $?
1802 # make sure the library variables are pointing to the new library
1805 fi # test -n $old_archive_from_expsyms_cmds
1807 if test $linkmode = prog || test "$mode" != relink; then
1812 case $hardcode_action in
1813 immediate | unsupported)
1814 if test "$hardcode_direct" = no; then
1816 elif test "$hardcode_minus_L" = no; then
1818 *-*-sunos*) add_shlibpath="$dir" ;;
1822 elif test "$hardcode_shlibpath_var" = no; then
1823 add_shlibpath="$dir"
1830 if test "$hardcode_direct" = yes; then
1832 elif test "$hardcode_minus_L" = yes; then
1835 elif test "$hardcode_shlibpath_var" = yes; then
1836 add_shlibpath="$dir"
1845 if test "$lib_linked" != yes; then
1846 $echo "$modename: configuration error: unsupported hardcode properties"
1850 if test -n "$add_shlibpath"; then
1851 case :$compile_shlibpath: in
1852 *":$add_shlibpath:"*) ;;
1853 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1856 if test $linkmode = prog; then
1857 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1858 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1860 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1861 test -n "$add" && deplibs="$add $deplibs"
1862 if test "$hardcode_direct" != yes && \
1863 test "$hardcode_minus_L" != yes && \
1864 test "$hardcode_shlibpath_var" = yes; then
1865 case :$finalize_shlibpath: in
1867 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1873 if test $linkmode = prog || test "$mode" = relink; then
1877 # Finalize command for both is simple: just hardcode it.
1878 if test "$hardcode_direct" = yes; then
1879 add="$libdir/$linklib"
1880 elif test "$hardcode_minus_L" = yes; then
1883 elif test "$hardcode_shlibpath_var" = yes; then
1884 case :$finalize_shlibpath: in
1886 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1890 # We cannot seem to hardcode it, guess we'll fake it.
1891 if test "X$installed" = Xyes; then
1894 add_dir="-L$DESTDIR$libdir"
1899 if test $linkmode = prog; then
1900 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1901 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1903 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1904 test -n "$add" && deplibs="$add $deplibs"
1907 elif test $linkmode = prog; then
1908 if test "$alldeplibs" = yes &&
1909 { test "$deplibs_check_method" = pass_all ||
1910 { test "$build_libtool_libs" = yes &&
1911 test -n "$library_names"; }; }; then
1912 # We only need to search for static libraries
1916 # Try to link the static library
1917 # Here we assume that one of hardcode_direct or hardcode_minus_L
1918 # is not unsupported. This is valid on all known static and
1920 if test "$hardcode_direct" != unsupported; then
1921 test -n "$old_library" && linklib="$old_library"
1922 compile_deplibs="$dir/$linklib $compile_deplibs"
1923 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1925 compile_deplibs="-l$name -L$dir $compile_deplibs"
1926 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1928 elif test "$build_libtool_libs" = yes; then
1929 # Not a shared library
1930 if test "$deplibs_check_method" != pass_all; then
1931 # We're trying link a shared library against a static one
1932 # but the system doesn't support it.
1934 # Just print a warning and add the library to dependency_libs so
1935 # that the program can be linked against the static library.
1937 echo "*** Warning: This library needs some functionality provided by $lib."
1938 echo "*** I have the capability to make that library automatically link in when"
1939 echo "*** you link to this library. But I can only do this if you have a"
1940 echo "*** shared version of the library, which you do not appear to have."
1941 if test "$module" = yes; then
1942 echo "*** Therefore, libtool will create a static module, that should work "
1943 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1944 if test -z "$global_symbol_pipe"; then
1946 echo "*** However, this would only work if libtool was able to extract symbol"
1947 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1948 echo "*** not find such a program. So, this module is probably useless."
1949 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1951 if test "$build_old_libs" = no; then
1952 build_libtool_libs=module
1955 build_libtool_libs=no
1959 convenience="$convenience $dir/$old_library"
1960 old_convenience="$old_convenience $dir/$old_library"
1961 deplibs="$dir/$old_library $deplibs"
1964 fi # link shared/static library?
1966 if test $linkmode = lib; then
1967 if test -n "$dependency_libs" &&
1968 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1969 test $link_static = yes; }; then
1970 # Extract -R from dependency_libs
1972 for libdir in $dependency_libs; do
1974 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1976 *" $temp_xrpath "*) ;;
1977 *) xrpath="$xrpath $temp_xrpath";;
1979 *) temp_deplibs="$temp_deplibs $libdir";;
1982 dependency_libs="$temp_deplibs"
1985 newlib_search_path="$newlib_search_path $absdir"
1986 # Link against this library
1987 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1988 # ... and its dependency_libs
1990 for deplib in $dependency_libs; do
1991 newdependency_libs="$deplib $newdependency_libs"
1992 case "$tmp_libs " in
1993 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1995 tmp_libs="$tmp_libs $deplib"
1998 if test $link_all_deplibs != no; then
1999 # Add the search paths of all dependency libraries
2000 for deplib in $dependency_libs; do
2002 -L*) path="$deplib" ;;
2004 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2005 test "X$dir" = "X$deplib" && dir="."
2006 # We need an absolute path.
2008 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2010 absdir=`cd "$dir" && pwd`
2011 if test -z "$absdir"; then
2012 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2017 if grep "^installed=no" $deplib > /dev/null; then
2018 path="-L$absdir/$objdir"
2020 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2021 if test -z "$libdir"; then
2022 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2025 if test "$absdir" != "$libdir"; then
2026 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2033 case " $deplibs " in
2035 *) deplibs="$deplibs $path" ;;
2038 fi # link_all_deplibs != no
2040 done # for deplib in $libs
2041 if test $pass = dlpreopen; then
2042 # Link the dlpreopened libraries before other libraries
2043 for deplib in $save_deplibs; do
2044 deplibs="$deplib $deplibs"
2047 if test $pass != dlopen; then
2048 test $pass != scan && dependency_libs="$newdependency_libs"
2049 if test $pass != conv; then
2050 # Make sure lib_search_path contains only unique directories.
2052 for dir in $newlib_search_path; do
2053 case "$lib_search_path " in
2055 *) lib_search_path="$lib_search_path $dir" ;;
2061 if test "$linkmode,$pass" != "prog,link"; then
2064 vars="compile_deplibs finalize_deplibs"
2066 for var in $vars dependency_libs; do
2067 # Add libraries to $var in reverse order
2068 eval tmp_libs=\"\$$var\"
2070 for deplib in $tmp_libs; do
2072 -L*) new_libs="$deplib $new_libs" ;;
2074 case " $specialdeplibs " in
2075 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2077 case " $new_libs " in
2079 *) new_libs="$deplib $new_libs" ;;
2087 for deplib in $new_libs; do
2090 case " $tmp_libs " in
2092 *) tmp_libs="$tmp_libs $deplib" ;;
2095 *) tmp_libs="$tmp_libs $deplib" ;;
2098 eval $var=\"$tmp_libs\"
2101 if test "$pass" = "conv" &&
2102 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2103 libs="$deplibs" # reset libs
2107 if test $linkmode = prog; then
2108 dlfiles="$newdlfiles"
2109 dlprefiles="$newdlprefiles"
2114 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2115 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2118 if test -n "$rpath"; then
2119 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2122 if test -n "$xrpath"; then
2123 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2126 if test -n "$vinfo"; then
2127 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2130 if test -n "$release"; then
2131 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2134 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2135 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2138 # Now set the variables for building old libraries.
2139 build_libtool_libs=no
2141 objs="$objs$old_deplibs"
2145 # Make sure we only generate libraries of the form `libNAME.la'.
2148 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2149 eval libname=\"$libname_spec\"
2152 if test "$module" = no; then
2153 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2157 if test "$need_lib_prefix" != no; then
2158 # Add the "lib" prefix for modules if required
2159 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2160 eval libname=\"$libname_spec\"
2162 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2167 if test -n "$objs"; then
2168 if test "$deplibs_check_method" != pass_all; then
2169 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2173 echo "*** Warning: Linking the shared library $output against the non-libtool"
2174 echo "*** objects $objs is not portable!"
2175 libobjs="$libobjs $objs"
2179 if test "$dlself" != no; then
2180 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2184 if test $# -gt 2; then
2185 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2190 if test -z "$rpath"; then
2191 if test "$build_libtool_libs" = yes; then
2192 # Building a libtool convenience library.
2194 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2195 build_libtool_libs=convenience
2199 if test -n "$vinfo"; then
2200 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2203 if test -n "$release"; then
2204 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2208 # Parse the version information argument.
2209 save_ifs="$IFS"; IFS=':'
2210 set dummy $vinfo 0 0 0
2213 if test -n "$8"; then
2214 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2223 # Check that each of the things are valid numbers.
2225 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2227 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2228 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2234 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2236 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2237 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2243 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2245 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2246 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2251 if test $age -gt $current; then
2252 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2253 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2257 # Calculate the version variables.
2261 case $version_type in
2265 # Like Linux, but with the current version available in
2266 # verstring for coding it into the library header
2267 major=.`expr $current - $age`
2268 versuffix="$major.$age.$revision"
2269 # Darwin ld doesn't like 0 for these options...
2270 minor_current=`expr $current + 1`
2271 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2276 versuffix=".$current.$revision";
2281 versuffix=".$current";
2285 major=`expr $current - $age + 1`
2286 verstring="sgi$major.$revision"
2288 # Add in all the interfaces that we are compatible with.
2290 while test $loop != 0; do
2291 iface=`expr $revision - $loop`
2292 loop=`expr $loop - 1`
2293 verstring="sgi$major.$iface:$verstring"
2296 # Before this point, $major must not contain `.'.
2298 versuffix="$major.$revision"
2302 major=.`expr $current - $age`
2303 versuffix="$major.$age.$revision"
2307 major=`expr $current - $age`
2308 versuffix=".$current.$age.$revision"
2309 verstring="$current.$age.$revision"
2311 # Add in all the interfaces that we are compatible with.
2313 while test $loop != 0; do
2314 iface=`expr $current - $loop`
2315 loop=`expr $loop - 1`
2316 verstring="$verstring:${iface}.0"
2319 # Make executables depend on our current version.
2320 verstring="$verstring:${current}.0"
2325 versuffix=".$current.$revision"
2329 # Use '-' rather than '.', since we only want one
2330 # extension on DOS 8.3 filesystems.
2331 major=`expr $current - $age`
2336 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2337 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2342 # Clear the version info if we defaulted, and they specified a release.
2343 if test -z "$vinfo" && test -n "$release"; then
2346 case $version_type in
2348 # we can't check for "0.0" in archive_cmds due to quoting
2349 # problems, so we reset it completely
2356 if test "$need_version" = no; then
2363 # Remove version info from name if versioning should be avoided
2364 if test "$avoid_version" = yes && test "$need_version" = no; then
2370 # Check to see if the archive will have undefined symbols.
2371 if test "$allow_undefined" = yes; then
2372 if test "$allow_undefined_flag" = unsupported; then
2373 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2374 build_libtool_libs=no
2378 # Don't allow undefined symbols.
2379 allow_undefined_flag="$no_undefined_flag"
2383 if test "$mode" != relink; then
2384 # Remove our outputs.
2385 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2386 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2389 # Now set the variables for building old libraries.
2390 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2391 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2393 # Transform .lo files to .o files.
2394 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2397 # Eliminate all temporary directories.
2398 for path in $notinst_path; do
2399 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2400 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2401 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2404 if test -n "$xrpath"; then
2405 # If the user specified any rpath flags, then add them.
2407 for libdir in $xrpath; do
2408 temp_xrpath="$temp_xrpath -R$libdir"
2409 case "$finalize_rpath " in
2411 *) finalize_rpath="$finalize_rpath $libdir" ;;
2414 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2415 dependency_libs="$temp_xrpath $dependency_libs"
2419 # Make sure dlfiles contains only unique files that won't be dlpreopened
2420 old_dlfiles="$dlfiles"
2422 for lib in $old_dlfiles; do
2423 case " $dlprefiles $dlfiles " in
2425 *) dlfiles="$dlfiles $lib" ;;
2429 # Make sure dlprefiles contains only unique files
2430 old_dlprefiles="$dlprefiles"
2432 for lib in $old_dlprefiles; do
2433 case "$dlprefiles " in
2435 *) dlprefiles="$dlprefiles $lib" ;;
2439 if test "$build_libtool_libs" = yes; then
2440 if test -n "$rpath"; then
2442 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2443 # these systems don't actually have a c library (as such)!
2445 *-*-rhapsody* | *-*-darwin1.[012])
2446 # Rhapsody C library is in the System framework
2447 deplibs="$deplibs -framework System"
2450 # Don't link with libc until the a.out ld.so is fixed.
2453 # Do not include libc due to us having libc/libc_r.
2456 # Add libc to deplibs on all other systems if necessary.
2457 if test $build_libtool_need_lc = "yes"; then
2458 deplibs="$deplibs -lc"
2464 # Transform deplibs into only deplibs that can be linked in shared.
2466 libname_save=$libname
2467 release_save=$release
2468 versuffix_save=$versuffix
2470 # I'm not sure if I'm treating the release correctly. I think
2471 # release should show up in the -l (ie -lgmp5) so we don't want to
2472 # add it in twice. Is that correct?
2478 case $deplibs_check_method in
2480 # Don't check for shared/static. Everything works.
2481 # This might be a little naive. We might want to check
2482 # whether the library exists or not. But this is on
2483 # osf3 & osf4 and I'm not really sure... Just
2484 # implementing what was already the behaviour.
2488 # This code stresses the "libraries are programs" paradigm to its
2489 # limits. Maybe even breaks it. We compile a program, linking it
2490 # against the deplibs as a proxy for the library. Then we can check
2491 # whether they linked in statically or dynamically with ldd.
2493 cat > conftest.c <<EOF
2494 int main() { return 0; }
2497 $CC -o conftest conftest.c $deplibs
2498 if test $? -eq 0 ; then
2499 ldd_output=`ldd conftest`
2500 for i in $deplibs; do
2501 name="`expr $i : '-l\(.*\)'`"
2502 # If $name is empty we are operating on a -L argument.
2503 if test -n "$name" && test "$name" != "0"; then
2504 libname=`eval \\$echo \"$libname_spec\"`
2505 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2506 set dummy $deplib_matches
2508 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2509 newdeplibs="$newdeplibs $i"
2513 echo "*** Warning: This library needs some functionality provided by $i."
2514 echo "*** I have the capability to make that library automatically link in when"
2515 echo "*** you link to this library. But I can only do this if you have a"
2516 echo "*** shared version of the library, which you do not appear to have."
2519 newdeplibs="$newdeplibs $i"
2523 # Error occured in the first compile. Let's try to salvage the situation:
2524 # Compile a seperate program for each library.
2525 for i in $deplibs; do
2526 name="`expr $i : '-l\(.*\)'`"
2527 # If $name is empty we are operating on a -L argument.
2528 if test -n "$name" && test "$name" != "0"; then
2530 $CC -o conftest conftest.c $i
2532 if test $? -eq 0 ; then
2533 ldd_output=`ldd conftest`
2534 libname=`eval \\$echo \"$libname_spec\"`
2535 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2536 set dummy $deplib_matches
2538 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2539 newdeplibs="$newdeplibs $i"
2543 echo "*** Warning: This library needs some functionality provided by $i."
2544 echo "*** I have the capability to make that library automatically link in when"
2545 echo "*** you link to this library. But I can only do this if you have a"
2546 echo "*** shared version of the library, which you do not appear to have."
2551 echo "*** Warning! Library $i is needed by this library but I was not able to"
2552 echo "*** make it link in! You will probably need to install it or some"
2553 echo "*** library that it depends on before this library will be fully"
2554 echo "*** functional. Installing it before continuing would be even better."
2557 newdeplibs="$newdeplibs $i"
2563 set dummy $deplibs_check_method
2564 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2565 for a_deplib in $deplibs; do
2566 name="`expr $a_deplib : '-l\(.*\)'`"
2567 # If $name is empty we are operating on a -L argument.
2568 if test -n "$name" && test "$name" != "0"; then
2569 libname=`eval \\$echo \"$libname_spec\"`
2570 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2571 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2572 for potent_lib in $potential_libs; do
2573 # Follow soft links.
2574 if ls -lLd "$potent_lib" 2>/dev/null \
2575 | grep " -> " >/dev/null; then
2578 # The statement above tries to avoid entering an
2579 # endless loop below, in case of cyclic links.
2580 # We might still enter an endless loop, since a link
2581 # loop can be closed while we follow links,
2583 potlib="$potent_lib"
2584 while test -h "$potlib" 2>/dev/null; do
2585 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2587 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2588 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2591 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2593 | egrep "$file_magic_regex" > /dev/null; then
2594 newdeplibs="$newdeplibs $a_deplib"
2600 if test -n "$a_deplib" ; then
2603 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2604 echo "*** I have the capability to make that library automatically link in when"
2605 echo "*** you link to this library. But I can only do this if you have a"
2606 echo "*** shared version of the library, which you do not appear to have."
2609 # Add a -L argument.
2610 newdeplibs="$newdeplibs $a_deplib"
2612 done # Gone through all deplibs.
2615 set dummy $deplibs_check_method
2616 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2617 for a_deplib in $deplibs; do
2618 name="`expr $a_deplib : '-l\(.*\)'`"
2619 # If $name is empty we are operating on a -L argument.
2620 if test -n "$name" && test "$name" != "0"; then
2621 libname=`eval \\$echo \"$libname_spec\"`
2622 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2623 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2624 for potent_lib in $potential_libs; do
2625 if eval echo \"$potent_lib\" 2>/dev/null \
2627 | egrep "$match_pattern_regex" > /dev/null; then
2628 newdeplibs="$newdeplibs $a_deplib"
2634 if test -n "$a_deplib" ; then
2637 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2638 echo "*** I have the capability to make that library automatically link in when"
2639 echo "*** you link to this library. But I can only do this if you have a"
2640 echo "*** shared version of the library, which you do not appear to have."
2643 # Add a -L argument.
2644 newdeplibs="$newdeplibs $a_deplib"
2646 done # Gone through all deplibs.
2650 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2651 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2652 grep . >/dev/null; then
2654 if test "X$deplibs_check_method" = "Xnone"; then
2655 echo "*** Warning: inter-library dependencies are not supported in this platform."
2657 echo "*** Warning: inter-library dependencies are not known to be supported."
2659 echo "*** All declared inter-library dependencies are being dropped."
2664 versuffix=$versuffix_save
2666 release=$release_save
2667 libname=$libname_save
2671 *-*-rhapsody* | *-*-darwin1.[012])
2672 # On Rhapsody replace the C library is the System framework
2673 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2677 if test "$droppeddeps" = yes; then
2678 if test "$module" = yes; then
2680 echo "*** Warning: libtool could not satisfy all declared inter-library"
2681 echo "*** dependencies of module $libname. Therefore, libtool will create"
2682 echo "*** a static module, that should work as long as the dlopening"
2683 echo "*** application is linked with the -dlopen flag."
2684 if test -z "$global_symbol_pipe"; then
2686 echo "*** However, this would only work if libtool was able to extract symbol"
2687 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2688 echo "*** not find such a program. So, this module is probably useless."
2689 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2691 if test "$build_old_libs" = no; then
2692 oldlibs="$output_objdir/$libname.$libext"
2693 build_libtool_libs=module
2696 build_libtool_libs=no
2699 echo "*** The inter-library dependencies that have been dropped here will be"
2700 echo "*** automatically added whenever a program is linked with this library"
2701 echo "*** or is declared to -dlopen it."
2703 if test $allow_undefined = no; then
2705 echo "*** Since this library must not contain undefined symbols,"
2706 echo "*** because either the platform does not support them or"
2707 echo "*** it was explicitly requested with -no-undefined,"
2708 echo "*** libtool will only create a static version of it."
2709 if test "$build_old_libs" = no; then
2710 oldlibs="$output_objdir/$libname.$libext"
2711 build_libtool_libs=module
2714 build_libtool_libs=no
2719 # Done checking deplibs!
2723 # All the library-specific variables (install_libdir is set above).
2728 # Test again, we may have decided not to build it any more
2729 if test "$build_libtool_libs" = yes; then
2730 if test $hardcode_into_libs = yes; then
2731 # Hardcode the library paths
2734 rpath="$finalize_rpath"
2735 test "$mode" != relink && rpath="$compile_rpath$rpath"
2736 for libdir in $rpath; do
2737 if test -n "$hardcode_libdir_flag_spec"; then
2738 if test -n "$hardcode_libdir_separator"; then
2739 if test -z "$hardcode_libdirs"; then
2740 hardcode_libdirs="$libdir"
2742 # Just accumulate the unique libdirs.
2743 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2744 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2747 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2752 eval flag=\"$hardcode_libdir_flag_spec\"
2753 dep_rpath="$dep_rpath $flag"
2755 elif test -n "$runpath_var"; then
2756 case "$perm_rpath " in
2758 *) perm_rpath="$perm_rpath $libdir" ;;
2762 # Substitute the hardcoded libdirs into the rpath.
2763 if test -n "$hardcode_libdir_separator" &&
2764 test -n "$hardcode_libdirs"; then
2765 libdir="$hardcode_libdirs"
2766 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2768 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2769 # We should set the runpath_var.
2771 for dir in $perm_rpath; do
2774 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2776 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2779 shlibpath="$finalize_shlibpath"
2780 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2781 if test -n "$shlibpath"; then
2782 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2785 # Get the real and link names of the library.
2786 eval library_names=\"$library_names_spec\"
2787 set dummy $library_names
2791 if test -n "$soname_spec"; then
2792 eval soname=\"$soname_spec\"
2796 test -z "$dlname" && dlname=$soname
2798 lib="$output_objdir/$realname"
2801 linknames="$linknames $link"
2804 # Ensure that we have .o objects for linkers which dislike .lo
2805 # (e.g. aix) in case we are running --disable-static
2806 for obj in $libobjs; do
2807 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2808 if test "X$xdir" = "X$obj"; then
2813 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2814 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2815 if test ! -f $xdir/$oldobj; then
2816 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2817 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2821 # Use standard objects if they are pic
2822 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2824 # Prepare the list of exported symbols
2825 if test -z "$export_symbols"; then
2826 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2827 $show "generating symbol list for \`$libname.la'"
2828 export_symbols="$output_objdir/$libname.exp"
2829 $run $rm $export_symbols
2830 eval cmds=\"$export_symbols_cmds\"
2831 save_ifs="$IFS"; IFS='~'
2832 for cmd in $cmds; do
2835 $run eval "$cmd" || exit $?
2838 if test -n "$export_symbols_regex"; then
2839 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2840 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2841 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2842 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2847 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2848 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2851 if test -n "$convenience"; then
2852 if test -n "$whole_archive_flag_spec"; then
2853 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2855 gentop="$output_objdir/${outputname}x"
2856 $show "${rm}r $gentop"
2857 $run ${rm}r "$gentop"
2858 $show "mkdir $gentop"
2859 $run mkdir "$gentop"
2861 if test $status -ne 0 && test ! -d "$gentop"; then
2864 generated="$generated $gentop"
2866 for xlib in $convenience; do
2867 # Extract the objects.
2869 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2870 *) xabs=`pwd`"/$xlib" ;;
2872 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2873 xdir="$gentop/$xlib"
2875 $show "${rm}r $xdir"
2880 if test $status -ne 0 && test ! -d "$xdir"; then
2883 $show "(cd $xdir && $AR x $xabs)"
2884 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2886 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2891 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2892 eval flag=\"$thread_safe_flag_spec\"
2893 linker_flags="$linker_flags $flag"
2896 # Make a backup of the uninstalled library when relinking
2897 if test "$mode" = relink; then
2898 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2901 # Do each of the archive commands.
2902 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2903 eval cmds=\"$archive_expsym_cmds\"
2905 eval cmds=\"$archive_cmds\"
2907 save_ifs="$IFS"; IFS='~'
2908 for cmd in $cmds; do
2911 $run eval "$cmd" || exit $?
2915 # Restore the uninstalled library and exit
2916 if test "$mode" = relink; then
2917 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2921 # Create links to the real library.
2922 for linkname in $linknames; do
2923 if test "$realname" != "$linkname"; then
2924 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2925 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2929 # If -module or -export-dynamic was specified, set the dlname.
2930 if test "$module" = yes || test "$export_dynamic" = yes; then
2931 # On all known operating systems, these are identical.
2938 if test -n "$deplibs"; then
2939 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2942 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2943 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2946 if test -n "$rpath"; then
2947 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2950 if test -n "$xrpath"; then
2951 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2954 if test -n "$vinfo"; then
2955 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2958 if test -n "$release"; then
2959 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2964 if test -n "$objs$old_deplibs"; then
2965 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2969 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2977 # Delete the old objects.
2978 $run $rm $obj $libobj
2980 # Objects from convenience libraries. This assumes
2981 # single-version convenience libraries. Whenever we create
2982 # different ones for PIC/non-PIC, this we'll have to duplicate
2986 # reload_cmds runs $LD directly, so let us get rid of
2987 # -Wl from whole_archive_flag_spec
2990 if test -n "$convenience"; then
2991 if test -n "$whole_archive_flag_spec"; then
2992 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2994 gentop="$output_objdir/${obj}x"
2995 $show "${rm}r $gentop"
2996 $run ${rm}r "$gentop"
2997 $show "mkdir $gentop"
2998 $run mkdir "$gentop"
3000 if test $status -ne 0 && test ! -d "$gentop"; then
3003 generated="$generated $gentop"
3005 for xlib in $convenience; do
3006 # Extract the objects.
3008 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3009 *) xabs=`pwd`"/$xlib" ;;
3011 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3012 xdir="$gentop/$xlib"
3014 $show "${rm}r $xdir"
3019 if test $status -ne 0 && test ! -d "$xdir"; then
3022 $show "(cd $xdir && $AR x $xabs)"
3023 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3025 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3030 # Create the old-style object.
3031 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
3034 eval cmds=\"$reload_cmds\"
3035 save_ifs="$IFS"; IFS='~'
3036 for cmd in $cmds; do
3039 $run eval "$cmd" || exit $?
3043 # Exit if we aren't doing a library object file.
3044 if test -z "$libobj"; then
3045 if test -n "$gentop"; then
3046 $show "${rm}r $gentop"
3053 if test "$build_libtool_libs" != yes; then
3054 if test -n "$gentop"; then
3055 $show "${rm}r $gentop"
3059 # Create an invalid libtool object if no PIC, so that we don't
3060 # accidentally link it into a program.
3061 $show "echo timestamp > $libobj"
3062 $run eval "echo timestamp > $libobj" || exit $?
3066 if test -n "$pic_flag" || test "$pic_mode" != default; then
3067 # Only do commands if we really have different PIC objects.
3068 reload_objs="$libobjs $reload_conv_objs"
3070 eval cmds=\"$reload_cmds\"
3071 save_ifs="$IFS"; IFS='~'
3072 for cmd in $cmds; do
3075 $run eval "$cmd" || exit $?
3079 # Just create a symlink.
3082 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3083 if test "X$xdir" = "X$libobj"; then
3088 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3089 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3090 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3091 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3094 if test -n "$gentop"; then
3095 $show "${rm}r $gentop"
3104 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3106 if test -n "$vinfo"; then
3107 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3110 if test -n "$release"; then
3111 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3114 if test "$preload" = yes; then
3115 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3116 test "$dlopen_self_static" = unknown; then
3117 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3122 *-*-rhapsody* | *-*-darwin1.[012])
3123 # On Rhapsody replace the C library is the System framework
3124 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3125 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3129 compile_command="$compile_command $compile_deplibs"
3130 finalize_command="$finalize_command $finalize_deplibs"
3132 if test -n "$rpath$xrpath"; then
3133 # If the user specified any rpath flags, then add them.
3134 for libdir in $rpath $xrpath; do
3135 # This is the magic to use -rpath.
3136 case "$finalize_rpath " in
3138 *) finalize_rpath="$finalize_rpath $libdir" ;;
3143 # Now hardcode the library paths
3146 for libdir in $compile_rpath $finalize_rpath; do
3147 if test -n "$hardcode_libdir_flag_spec"; then
3148 if test -n "$hardcode_libdir_separator"; then
3149 if test -z "$hardcode_libdirs"; then
3150 hardcode_libdirs="$libdir"
3152 # Just accumulate the unique libdirs.
3153 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3154 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3157 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3162 eval flag=\"$hardcode_libdir_flag_spec\"
3163 rpath="$rpath $flag"
3165 elif test -n "$runpath_var"; then
3166 case "$perm_rpath " in
3168 *) perm_rpath="$perm_rpath $libdir" ;;
3172 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3173 case :$dllsearchpath: in
3175 *) dllsearchpath="$dllsearchpath:$libdir";;
3180 # Substitute the hardcoded libdirs into the rpath.
3181 if test -n "$hardcode_libdir_separator" &&
3182 test -n "$hardcode_libdirs"; then
3183 libdir="$hardcode_libdirs"
3184 eval rpath=\" $hardcode_libdir_flag_spec\"
3186 compile_rpath="$rpath"
3190 for libdir in $finalize_rpath; do
3191 if test -n "$hardcode_libdir_flag_spec"; then
3192 if test -n "$hardcode_libdir_separator"; then
3193 if test -z "$hardcode_libdirs"; then
3194 hardcode_libdirs="$libdir"
3196 # Just accumulate the unique libdirs.
3197 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3198 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3201 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3206 eval flag=\"$hardcode_libdir_flag_spec\"
3207 rpath="$rpath $flag"
3209 elif test -n "$runpath_var"; then
3210 case "$finalize_perm_rpath " in
3212 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3216 # Substitute the hardcoded libdirs into the rpath.
3217 if test -n "$hardcode_libdir_separator" &&
3218 test -n "$hardcode_libdirs"; then
3219 libdir="$hardcode_libdirs"
3220 eval rpath=\" $hardcode_libdir_flag_spec\"
3222 finalize_rpath="$rpath"
3224 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3225 # Transform all the library objects into standard objects.
3226 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3227 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3231 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3232 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3233 dlsyms="${outputname}S.c"
3235 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3239 if test -n "$dlsyms"; then
3243 # Discover the nlist of each of the dlfiles.
3244 nlist="$output_objdir/${outputname}.nm"
3246 $show "$rm $nlist ${nlist}S ${nlist}T"
3247 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3249 # Parse the name list into a source file.
3250 $show "creating $output_objdir/$dlsyms"
3252 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3253 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3254 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3260 /* Prevent the only kind of declaration conflicts we can make. */
3261 #define lt_preloaded_symbols some_other_symbol
3263 /* External symbol declarations for the compiler. */\
3266 if test "$dlself" = yes; then
3267 $show "generating symbol list for \`$output'"
3269 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3271 # Add our own program objects to the symbol list.
3272 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3273 for arg in $progfiles; do
3274 $show "extracting global C symbols from \`$arg'"
3275 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3278 if test -n "$exclude_expsyms"; then
3279 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3280 $run eval '$mv "$nlist"T "$nlist"'
3283 if test -n "$export_symbols_regex"; then
3284 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3285 $run eval '$mv "$nlist"T "$nlist"'
3288 # Prepare the list of exported symbols
3289 if test -z "$export_symbols"; then
3290 export_symbols="$output_objdir/$output.exp"
3291 $run $rm $export_symbols
3292 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3294 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3295 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3296 $run eval 'mv "$nlist"T "$nlist"'
3300 for arg in $dlprefiles; do
3301 $show "extracting global C symbols from \`$arg'"
3302 name=`echo "$arg" | sed -e 's%^.*/%%'`
3303 $run eval 'echo ": $name " >> "$nlist"'
3304 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3307 if test -z "$run"; then
3308 # Make sure we have at least an empty file.
3309 test -f "$nlist" || : > "$nlist"
3311 if test -n "$exclude_expsyms"; then
3312 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3313 $mv "$nlist"T "$nlist"
3316 # Try sorting and uniquifying the output.
3317 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3320 grep -v "^: " < "$nlist" > "$nlist"S
3323 if test -f "$nlist"S; then
3324 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3326 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3329 $echo >> "$output_objdir/$dlsyms" "\
3331 #undef lt_preloaded_symbols
3333 #if defined (__STDC__) && __STDC__
3334 # define lt_ptr void *
3336 # define lt_ptr char *
3340 /* The mapping between symbol names and symbols. */
3345 lt_preloaded_symbols[] =
3349 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3351 $echo >> "$output_objdir/$dlsyms" "\
3355 /* This works around a problem in FreeBSD linker */
3356 #ifdef FREEBSD_WORKAROUND
3357 static const void *lt_preloaded_setup() {
3358 return lt_preloaded_symbols;
3368 pic_flag_for_symtable=
3370 # compiling the symbol table file with pic_flag works around
3371 # a FreeBSD bug that causes programs to crash when -lm is
3372 # linked before any other PIC object. But we must not use
3373 # pic_flag when linking with -static. The problem exists in
3374 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3375 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3376 case "$compile_command " in
3378 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3381 case "$compile_command " in
3383 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3387 # Now compile the dynamic symbol file.
3388 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3389 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3391 # Clean up the generated files.
3392 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3393 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3395 # Transform the symbol file into the correct name.
3396 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3397 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3400 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3405 # We keep going just in case the user didn't refer to
3406 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3407 # really was required.
3409 # Nullify the symbol file.
3410 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3411 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3414 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3415 # Replace the output file specification.
3416 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3417 link_command="$compile_command$compile_rpath"
3419 # We have no uninstalled library dependencies, so finalize right now.
3420 $show "$link_command"
3421 $run eval "$link_command"
3424 # Delete the generated files.
3425 if test -n "$dlsyms"; then
3426 $show "$rm $output_objdir/${outputname}S.${objext}"
3427 $run $rm "$output_objdir/${outputname}S.${objext}"
3433 if test -n "$shlibpath_var"; then
3434 # We should set the shlibpath_var
3436 for dir in $temp_rpath; do
3438 [\\/]* | [A-Za-z]:[\\/]*)
3443 # Relative path: add a thisdir entry.
3444 rpath="$rpath\$thisdir/$dir:"
3451 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3452 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3454 if test -n "$finalize_shlibpath"; then
3455 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3460 if test -n "$runpath_var"; then
3461 if test -n "$perm_rpath"; then
3462 # We should set the runpath_var.
3464 for dir in $perm_rpath; do
3467 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3469 if test -n "$finalize_perm_rpath"; then
3470 # We should set the runpath_var.
3472 for dir in $finalize_perm_rpath; do
3475 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3479 if test "$no_install" = yes; then
3480 # We don't need to create a wrapper script.
3481 link_command="$compile_var$compile_command$compile_rpath"
3482 # Replace the output file specification.
3483 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3484 # Delete the old output file.
3486 # Link the executable and exit
3487 $show "$link_command"
3488 $run eval "$link_command" || exit $?
3492 if test "$hardcode_action" = relink; then
3493 # Fast installation is not supported
3494 link_command="$compile_var$compile_command$compile_rpath"
3495 relink_command="$finalize_var$finalize_command$finalize_rpath"
3497 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3498 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3500 if test "$fast_install" != no; then
3501 link_command="$finalize_var$compile_command$finalize_rpath"
3502 if test "$fast_install" = yes; then
3503 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3505 # fast_install is set to needless
3509 link_command="$compile_var$compile_command$compile_rpath"
3510 relink_command="$finalize_var$finalize_command$finalize_rpath"
3514 # Replace the output file specification.
3515 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3517 # Delete the old output files.
3518 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3520 $show "$link_command"
3521 $run eval "$link_command" || exit $?
3523 # Now create the wrapper script.
3524 $show "creating $output"
3526 # Quote the relink command for shipping.
3527 if test -n "$relink_command"; then
3528 # Preserve any variables that may affect compiler behavior
3529 for var in $variables_saved_for_relink; do
3530 if eval test -z \"\${$var+set}\"; then
3531 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3532 elif eval var_value=\$$var; test -z "$var_value"; then
3533 relink_command="$var=; export $var; $relink_command"
3535 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3536 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3539 relink_command="cd `pwd`; $relink_command"
3540 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3543 # Quote $echo for shipping.
3544 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3546 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3547 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3549 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3551 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3554 # Only actually do things if our run command is non-null.
3555 if test -z "$run"; then
3556 # win32 will think the script is a binary if it has
3557 # a .exe suffix, so we strip it off here.
3559 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3561 # test for cygwin because mv fails w/o .exe extensions
3563 *cygwin*) exeext=.exe ;;
3567 trap "$rm $output; exit 1" 1 2 15
3572 # $output - temporary wrapper script for $objdir/$outputname
3573 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3575 # The $output program cannot be directly executed until all the libtool
3576 # libraries that it depends on are installed.
3578 # This wrapper script should never be moved out of the build directory.
3579 # If it is, it will not operate correctly.
3581 # Sed substitution that helps us do robust quoting. It backslashifies
3582 # metacharacters that are still active within double-quoted strings.
3583 Xsed='sed -e 1s/^X//'
3584 sed_quote_subst='$sed_quote_subst'
3586 # The HP-UX ksh and POSIX shell print the target directory to stdout
3588 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3590 relink_command=\"$relink_command\"
3592 # This environment variable determines our operation mode.
3593 if test \"\$libtool_install_magic\" = \"$magic\"; then
3594 # install mode needs the following variable:
3595 notinst_deplibs='$notinst_deplibs'
3597 # When we are sourced in execute mode, \$file and \$echo are already set.
3598 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3601 # Make sure echo works.
3602 if test \"X\$1\" = X--no-reexec; then
3603 # Discard the --no-reexec flag, and continue.
3605 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3606 # Yippee, \$echo works!
3609 # Restart under the correct shell, and then maybe \$echo will work.
3610 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3616 # Find the directory that this script lives in.
3617 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3618 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3620 # Follow symbolic links until we get to the real thisdir.
3621 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3622 while test -n \"\$file\"; do
3623 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3625 # If there was a directory component, then change thisdir.
3626 if test \"x\$destdir\" != \"x\$file\"; then
3627 case \"\$destdir\" in
3628 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3629 *) thisdir=\"\$thisdir/\$destdir\" ;;
3633 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3634 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3637 # Try to get the absolute directory name.
3638 absdir=\`cd \"\$thisdir\" && pwd\`
3639 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3642 if test "$fast_install" = yes; then
3644 program=lt-'$outputname'$exeext
3645 progdir=\"\$thisdir/$objdir\"
3647 if test ! -f \"\$progdir/\$program\" || \\
3648 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3649 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3651 file=\"\$\$-\$program\"
3653 if test ! -d \"\$progdir\"; then
3654 $mkdir \"\$progdir\"
3656 $rm \"\$progdir/\$file\"
3661 # relink executable if necessary
3662 if test -n \"\$relink_command\"; then
3663 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3665 $echo \"\$relink_command_output\" >&2
3666 $rm \"\$progdir/\$file\"
3671 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3672 { $rm \"\$progdir/\$program\";
3673 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3674 $rm \"\$progdir/\$file\"
3678 program='$outputname'
3679 progdir=\"\$thisdir/$objdir\"
3685 if test -f \"\$progdir/\$program\"; then"
3687 # Export our shlibpath_var if we have one.
3688 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3690 # Add our own library path to $shlibpath_var
3691 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3693 # Some systems cannot cope with colon-terminated $shlibpath_var
3694 # The second colon is a workaround for a bug in BeOS R4 sed
3695 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3697 export $shlibpath_var
3701 # fixup the dll searchpath if we need to.
3702 if test -n "$dllsearchpath"; then
3704 # Add the dll search path components to the executable PATH
3705 PATH=$dllsearchpath:\$PATH
3710 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3711 # Run the actual program with our arguments.
3714 # win32 systems need to use the prog path for dll
3716 *-*-cygwin* | *-*-pw32*)
3718 exec \$progdir/\$program \${1+\"\$@\"}
3722 # Backslashes separate directories on plain windows
3723 *-*-mingw | *-*-os2*)
3725 exec \$progdir\\\\\$program \${1+\"\$@\"}
3731 # Export the path to the program.
3732 PATH=\"\$progdir:\$PATH\"
3735 exec \$program \${1+\"\$@\"}
3740 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3744 # The program doesn't exist.
3745 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3746 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3747 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3758 # See if we need to build an old-fashioned archive.
3759 for oldlib in $oldlibs; do
3761 if test "$build_libtool_libs" = convenience; then
3762 oldobjs="$libobjs_save"
3763 addlibs="$convenience"
3764 build_libtool_libs=no
3766 if test "$build_libtool_libs" = module; then
3767 oldobjs="$libobjs_save"
3768 build_libtool_libs=no
3770 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3772 addlibs="$old_convenience"
3775 if test -n "$addlibs"; then
3776 gentop="$output_objdir/${outputname}x"
3777 $show "${rm}r $gentop"
3778 $run ${rm}r "$gentop"
3779 $show "mkdir $gentop"
3780 $run mkdir "$gentop"
3782 if test $status -ne 0 && test ! -d "$gentop"; then
3785 generated="$generated $gentop"
3787 # Add in members from convenience archives.
3788 for xlib in $addlibs; do
3789 # Extract the objects.
3791 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3792 *) xabs=`pwd`"/$xlib" ;;
3794 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3795 xdir="$gentop/$xlib"
3797 $show "${rm}r $xdir"
3802 if test $status -ne 0 && test ! -d "$xdir"; then
3805 $show "(cd $xdir && $AR x $xabs)"
3806 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3808 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3812 # Do each command in the archive commands.
3813 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3814 eval cmds=\"$old_archive_from_new_cmds\"
3816 # Ensure that we have .o objects in place in case we decided
3817 # not to build a shared library, and have fallen back to building
3818 # static libs even though --disable-static was passed!
3819 for oldobj in $oldobjs; do
3820 if test ! -f $oldobj; then
3821 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3822 if test "X$xdir" = "X$oldobj"; then
3827 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3828 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3829 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3830 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3834 eval cmds=\"$old_archive_cmds\"
3836 save_ifs="$IFS"; IFS='~'
3837 for cmd in $cmds; do
3840 $run eval "$cmd" || exit $?
3845 if test -n "$generated"; then
3846 $show "${rm}r$generated"
3847 $run ${rm}r$generated
3850 # Now create the libtool archive.
3854 test "$build_old_libs" = yes && old_library="$libname.$libext"
3855 $show "creating $output"
3857 # Preserve any variables that may affect compiler behavior
3858 for var in $variables_saved_for_relink; do
3859 if eval test -z \"\${$var+set}\"; then
3860 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3861 elif eval var_value=\$$var; test -z "$var_value"; then
3862 relink_command="$var=; export $var; $relink_command"
3864 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3865 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3868 # Quote the link command for shipping.
3869 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3870 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3872 # Only create the output if not a dry run.
3873 if test -z "$run"; then
3874 for installed in no yes; do
3875 if test "$installed" = yes; then
3876 if test -z "$install_libdir"; then
3879 output="$output_objdir/$outputname"i
3880 # Replace all uninstalled libtool libraries with the installed ones
3882 for deplib in $dependency_libs; do
3885 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3886 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3887 if test -z "$libdir"; then
3888 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3891 newdependency_libs="$newdependency_libs $libdir/$name"
3893 *) newdependency_libs="$newdependency_libs $deplib" ;;
3896 dependency_libs="$newdependency_libs"
3898 for lib in $dlfiles; do
3899 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3900 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3901 if test -z "$libdir"; then
3902 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3905 newdlfiles="$newdlfiles $libdir/$name"
3907 dlfiles="$newdlfiles"
3909 for lib in $dlprefiles; do
3910 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3911 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3912 if test -z "$libdir"; then
3913 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3916 newdlprefiles="$newdlprefiles $libdir/$name"
3918 dlprefiles="$newdlprefiles"
3921 # place dlname in correct position for cygwin
3923 case $host,$output,$installed,$module,$dlname in
3924 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3927 # $outputname - a libtool library file
3928 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3930 # Please DO NOT delete this file!
3931 # It is necessary for linking the library.
3933 # The name that we can dlopen(3).
3936 # Names of this library.
3937 library_names='$library_names'
3939 # The name of the static archive.
3940 old_library='$old_library'
3942 # Libraries that this one depends upon.
3943 dependency_libs='$dependency_libs'
3945 # Version information for $libname.
3950 # Is this an already installed library?
3951 installed=$installed
3953 # Files to dlopen/dlpreopen
3955 dlpreopen='$dlprefiles'
3957 # Directory that this library needs to be installed in:
3958 libdir='$install_libdir'"
3959 if test "$installed" = no && test $need_relink = yes; then
3961 relink_command=\"$relink_command\""
3966 # Do a symbolic link so that the libtool archive can be found in
3967 # LD_LIBRARY_PATH before the program is installed.
3968 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3969 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3975 # libtool install mode
3977 modename="$modename: install"
3979 # There may be an optional sh(1) argument at the beginning of
3980 # install_prog (especially on Windows NT).
3981 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3982 # Allow the use of GNU shtool's install command.
3983 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3984 # Aesthetically quote it.
3985 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3987 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3991 install_prog="$arg "
3999 # The real first argument should be the name of the installation program.
4000 # Aesthetically quote it.
4001 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4003 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4007 install_prog="$install_prog$arg"
4009 # We need to accept at least all the BSD install flags.
4019 if test -n "$dest"; then
4020 files="$files $dest"
4038 # If the previous option needed an argument, then skip it.
4039 if test -n "$prev"; then
4048 # Aesthetically quote the argument.
4049 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4051 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4055 install_prog="$install_prog $arg"
4058 if test -z "$install_prog"; then
4059 $echo "$modename: you must specify an install program" 1>&2
4064 if test -n "$prev"; then
4065 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4070 if test -z "$files"; then
4071 if test -z "$dest"; then
4072 $echo "$modename: no file or destination specified" 1>&2
4074 $echo "$modename: you must specify a destination" 1>&2
4080 # Strip any trailing slash from the destination.
4081 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4083 # Check to see that the destination is a directory.
4084 test -d "$dest" && isdir=yes
4085 if test "$isdir" = yes; then
4089 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4090 test "X$destdir" = "X$dest" && destdir=.
4091 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4093 # Not a directory, so check to see that there is only one file specified.
4095 if test $# -gt 2; then
4096 $echo "$modename: \`$dest' is not a directory" 1>&2
4102 [\\/]* | [A-Za-z]:[\\/]*) ;;
4104 for file in $files; do
4108 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4117 # This variable tells wrapper scripts just to set variables rather
4118 # than running their programs.
4119 libtool_install_magic="$magic"
4124 for file in $files; do
4126 # Do each installation.
4129 # Do the static libraries later.
4130 staticlibs="$staticlibs $file"
4134 # Check to see that this really is a libtool archive.
4135 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4137 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4145 # If there is no directory component, then add one.
4147 */* | *\\*) . $file ;;
4151 # Add the libdir to current_libdirs if it is the destination.
4153 if test "X$destdir" = "X$libdir"; then
4154 case "$current_libdirs " in
4156 *) current_libdirs="$current_libdirs $libdir" ;;
4161 DESTDIR=`$echo "$destdir" | sed -e 's!'"$libdir"'$!!'`
4162 if test "X$destdir" != "X$DESTDIR$libdir"; then
4167 # Note the libdir as a future libdir.
4168 case "$future_libdirs " in
4170 *) future_libdirs="$future_libdirs $libdir" ;;
4174 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4175 test "X$dir" = "X$file/" && dir=
4178 if test -n "$relink_command"; then
4179 $echo "$modename: warning: relinking \`$file'" 1>&2
4181 $show "$relink_command"
4182 if $run eval "$relink_command"; then :
4184 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4190 # See the names of the shared library.
4191 set dummy $library_names
4192 if test -n "$2"; then
4198 test -n "$relink_command" && srcname="$realname"T
4200 # Install the shared library and build the symlinks.
4201 $show "$install_prog $dir/$srcname $destdir/$realname"
4202 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4203 if test -n "$stripme" && test -n "$striplib"; then
4204 $show "$striplib $destdir/$realname"
4205 $run eval "$striplib $destdir/$realname" || exit $?
4208 if test $# -gt 0; then
4209 # Delete the old symlinks, and create new ones.
4212 if test "$linkname" != "$realname"; then
4213 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4214 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4219 # Do each command in the postinstall commands.
4220 lib="$destdir/$realname"
4221 eval cmds=\"$postinstall_cmds\"
4222 save_ifs="$IFS"; IFS='~'
4223 for cmd in $cmds; do
4226 $run eval "$cmd" || exit $?
4231 # Install the pseudo-library for information purposes.
4232 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4233 instname="$dir/$name"i
4234 $show "$install_prog $instname $destdir/$name"
4235 $run eval "$install_prog $instname $destdir/$name" || exit $?
4237 # Maybe install the static library, too.
4238 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4242 # Install (i.e. copy) a libtool object.
4244 # Figure out destination file name, if it wasn't already specified.
4245 if test -n "$destname"; then
4246 destfile="$destdir/$destname"
4248 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4249 destfile="$destdir/$destfile"
4252 # Deduce the name of the destination old-style object file.
4255 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4258 staticdest="$destfile"
4262 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4268 # Install the libtool object if requested.
4269 if test -n "$destfile"; then
4270 $show "$install_prog $file $destfile"
4271 $run eval "$install_prog $file $destfile" || exit $?
4274 # Install the old object if enabled.
4275 if test "$build_old_libs" = yes; then
4276 # Deduce the name of the old-style object file.
4277 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4279 $show "$install_prog $staticobj $staticdest"
4280 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4286 # Figure out destination file name, if it wasn't already specified.
4287 if test -n "$destname"; then
4288 destfile="$destdir/$destname"
4290 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4291 destfile="$destdir/$destfile"
4294 # Do a test to see if this is really a libtool program.
4295 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4299 # If there is no directory component, then add one.
4301 */* | *\\*) . $file ;;
4305 # Check the variables that should have been set.
4306 if test -z "$notinst_deplibs"; then
4307 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4312 for lib in $notinst_deplibs; do
4313 # Check to see that each library is installed.
4315 if test -f "$lib"; then
4316 # If there is no directory component, then add one.
4318 */* | *\\*) . $lib ;;
4322 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4323 if test -n "$libdir" && test ! -f "$libfile"; then
4324 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4330 # If there is no directory component, then add one.
4332 */* | *\\*) . $file ;;
4337 if test "$fast_install" = no && test -n "$relink_command"; then
4338 if test "$finalize" = yes && test -z "$run"; then
4340 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4341 tmpdir="$tmpdir/libtool-$$"
4342 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4344 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4347 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4348 outputname="$tmpdir/$file"
4349 # Replace the output file specification.
4350 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4352 $show "$relink_command"
4353 if $run eval "$relink_command"; then :
4355 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4361 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4364 # Install the binary that we compiled earlier.
4365 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4369 # remove .exe since cygwin /usr/bin/install will append another
4371 case $install_prog,$host in
4372 /usr/bin/install*,*cygwin*)
4373 case $file:$destfile in
4378 destfile=$destfile.exe
4381 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4386 $show "$install_prog$stripme $file $destfile"
4387 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4388 test -n "$outputname" && ${rm}r "$tmpdir"
4393 for file in $staticlibs; do
4394 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4396 # Set up the ranlib parameters.
4397 oldlib="$destdir/$name"
4399 $show "$install_prog $file $oldlib"
4400 $run eval "$install_prog \$file \$oldlib" || exit $?
4402 if test -n "$stripme" && test -n "$striplib"; then
4403 $show "$old_striplib $oldlib"
4404 $run eval "$old_striplib $oldlib" || exit $?
4407 # Do each command in the postinstall commands.
4408 eval cmds=\"$old_postinstall_cmds\"
4409 save_ifs="$IFS"; IFS='~'
4410 for cmd in $cmds; do
4413 $run eval "$cmd" || exit $?
4418 if test -n "$future_libdirs"; then
4419 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4422 if test -n "$current_libdirs"; then
4423 # Maybe just do a dry run.
4424 test -n "$run" && current_libdirs=" -n$current_libdirs"
4425 exec_cmd='$SHELL $0 --finish$current_libdirs'
4431 # libtool finish mode
4433 modename="$modename: finish"
4437 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4440 libdirs="$libdirs $dir"
4443 for libdir in $libdirs; do
4444 if test -n "$finish_cmds"; then
4445 # Do each command in the finish commands.
4446 eval cmds=\"$finish_cmds\"
4447 save_ifs="$IFS"; IFS='~'
4448 for cmd in $cmds; do
4451 $run eval "$cmd" || admincmds="$admincmds
4456 if test -n "$finish_eval"; then
4457 # Do the single finish_eval.
4458 eval cmds=\"$finish_eval\"
4459 $run eval "$cmds" || admincmds="$admincmds
4465 # Exit here if they wanted silent mode.
4466 test "$show" = ":" && exit 0
4468 echo "----------------------------------------------------------------------"
4469 echo "Libraries have been installed in:"
4470 for libdir in $libdirs; do
4474 echo "If you ever happen to want to link against installed libraries"
4475 echo "in a given directory, LIBDIR, you must either use libtool, and"
4476 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4477 echo "flag during linking and do at least one of the following:"
4478 if test -n "$shlibpath_var"; then
4479 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4480 echo " during execution"
4482 if test -n "$runpath_var"; then
4483 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4484 echo " during linking"
4486 if test -n "$hardcode_libdir_flag_spec"; then
4488 eval flag=\"$hardcode_libdir_flag_spec\"
4490 echo " - use the \`$flag' linker flag"
4492 if test -n "$admincmds"; then
4493 echo " - have your system administrator run these commands:$admincmds"
4495 if test -f /etc/ld.so.conf; then
4496 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4499 echo "See any operating system documentation about shared libraries for"
4500 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4501 echo "----------------------------------------------------------------------"
4505 # libtool execute mode
4507 modename="$modename: execute"
4509 # The first argument is the command name.
4511 if test -z "$cmd"; then
4512 $echo "$modename: you must specify a COMMAND" 1>&2
4517 # Handle -dlopen flags immediately.
4518 for file in $execute_dlfiles; do
4519 if test ! -f "$file"; then
4520 $echo "$modename: \`$file' is not a file" 1>&2
4528 # Check to see that this really is a libtool archive.
4529 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4531 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4536 # Read the libtool library.
4540 # If there is no directory component, then add one.
4542 */* | *\\*) . $file ;;
4546 # Skip this library if it cannot be dlopened.
4547 if test -z "$dlname"; then
4548 # Warn if it was a shared library.
4549 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4553 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4554 test "X$dir" = "X$file" && dir=.
4556 if test -f "$dir/$objdir/$dlname"; then
4559 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4565 # Just add the directory containing the .lo file.
4566 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4567 test "X$dir" = "X$file" && dir=.
4571 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4576 # Get the absolute pathname.
4577 absdir=`cd "$dir" && pwd`
4578 test -n "$absdir" && dir="$absdir"
4580 # Now add the directory to shlibpath_var.
4581 if eval "test -z \"\$$shlibpath_var\""; then
4582 eval "$shlibpath_var=\"\$dir\""
4584 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4588 # This variable tells wrapper scripts just to set shlibpath_var
4589 # rather than running their programs.
4590 libtool_execute_magic="$magic"
4592 # Check if any of the arguments is a wrapper script.
4599 # Do a test to see if this is really a libtool program.
4600 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4601 # If there is no directory component, then add one.
4603 */* | *\\*) . $file ;;
4607 # Transform arg to wrapped name.
4608 file="$progdir/$program"
4612 # Quote arguments (to preserve shell metacharacters).
4613 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4614 args="$args \"$file\""
4617 if test -z "$run"; then
4618 if test -n "$shlibpath_var"; then
4619 # Export the shlibpath_var.
4620 eval "export $shlibpath_var"
4623 # Restore saved enviroment variables
4624 if test "${save_LC_ALL+set}" = set; then
4625 LC_ALL="$save_LC_ALL"; export LC_ALL
4627 if test "${save_LANG+set}" = set; then
4628 LANG="$save_LANG"; export LANG
4631 # Now prepare to actually exec the command.
4632 exec_cmd='"$cmd"$args'
4634 # Display what would be done.
4635 if test -n "$shlibpath_var"; then
4636 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4637 $echo "export $shlibpath_var"
4644 # libtool clean and uninstall mode
4646 modename="$modename: $mode"
4652 # This variable tells wrapper scripts just to set variables rather
4653 # than running their programs.
4654 libtool_install_magic="$magic"
4659 -f) rm="$rm $arg"; rmforce=yes ;;
4660 -*) rm="$rm $arg" ;;
4661 *) files="$files $arg" ;;
4665 if test -z "$rm"; then
4666 $echo "$modename: you must specify an RM program" 1>&2
4673 for file in $files; do
4674 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4675 if test "X$dir" = "X$file"; then
4679 objdir="$dir/$objdir"
4681 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4682 test $mode = uninstall && objdir="$dir"
4684 # Remember objdir for removal later, being careful to avoid duplicates
4685 if test $mode = clean; then
4688 *) rmdirs="$rmdirs $objdir" ;;
4692 # Don't error if the file doesn't exist and rm -f was used.
4693 if (test -L "$file") >/dev/null 2>&1 \
4694 || (test -h "$file") >/dev/null 2>&1 \
4695 || test -f "$file"; then
4697 elif test -d "$file"; then
4700 elif test "$rmforce" = yes; then
4708 # Possibly a libtool archive, so verify it.
4709 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4712 # Delete the libtool libraries and symlinks.
4713 for n in $library_names; do
4714 rmfiles="$rmfiles $objdir/$n"
4716 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4717 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4719 if test $mode = uninstall; then
4720 if test -n "$library_names"; then
4721 # Do each command in the postuninstall commands.
4722 eval cmds=\"$postuninstall_cmds\"
4723 save_ifs="$IFS"; IFS='~'
4724 for cmd in $cmds; do
4728 if test $? != 0 && test "$rmforce" != yes; then
4735 if test -n "$old_library"; then
4736 # Do each command in the old_postuninstall commands.
4737 eval cmds=\"$old_postuninstall_cmds\"
4738 save_ifs="$IFS"; IFS='~'
4739 for cmd in $cmds; do
4743 if test $? != 0 && test "$rmforce" != yes; then
4749 # FIXME: should reinstall the best remaining shared library.
4755 if test "$build_old_libs" = yes; then
4756 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4757 rmfiles="$rmfiles $dir/$oldobj"
4762 # Do a test to see if this is a libtool program.
4763 if test $mode = clean &&
4764 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4768 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4769 if test "$fast_install" = yes && test -n "$relink_command"; then
4770 rmfiles="$rmfiles $objdir/lt-$name"
4775 $show "$rm $rmfiles"
4776 $run $rm $rmfiles || exit_status=1
4779 # Try to remove the ${objdir}s in the directories where we deleted files
4780 for dir in $rmdirs; do
4781 if test -d "$dir"; then
4783 $run rmdir $dir >/dev/null 2>&1
4791 $echo "$modename: you must specify a MODE" 1>&2
4792 $echo "$generic_help" 1>&2
4797 if test -z "$exec_cmd"; then
4798 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4799 $echo "$generic_help" 1>&2
4802 fi # test -z "$show_help"
4804 if test -n "$exec_cmd"; then
4809 # We need to display help for each of the modes.
4812 "Usage: $modename [OPTION]... [MODE-ARG]...
4814 Provide generalized library-building support services.
4816 --config show all configuration variables
4817 --debug enable verbose shell tracing
4818 -n, --dry-run display commands without modifying any files
4819 --features display basic configuration information and exit
4820 --finish same as \`--mode=finish'
4821 --help display this help message and exit
4822 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4823 --quiet same as \`--silent'
4824 --silent don't print informational messages
4825 --version print version information
4827 MODE must be one of the following:
4829 clean remove files from the build directory
4830 compile compile a source file into a libtool object
4831 execute automatically set library path, then run a program
4832 finish complete the installation of libtool libraries
4833 install install libraries or executables
4834 link create a library or an executable
4835 uninstall remove libraries from an installed directory
4837 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4838 a more detailed description of MODE."
4844 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4846 Remove files from the build directory.
4848 RM is the name of the program to use to delete files associated with each FILE
4849 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4852 If FILE is a libtool library, object or program, all the files associated
4853 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4858 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4860 Compile a source file into a libtool library object.
4862 This mode accepts the following additional options:
4864 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4865 -prefer-pic try to building PIC objects only
4866 -prefer-non-pic try to building non-PIC objects only
4867 -static always build a \`.o' file suitable for static linking
4869 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4870 from the given SOURCEFILE.
4872 The output file name is determined by removing the directory component from
4873 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4874 library object suffix, \`.lo'."
4879 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4881 Automatically set library path, then run a program.
4883 This mode accepts the following additional options:
4885 -dlopen FILE add the directory containing FILE to the library path
4887 This mode sets the library path environment variable according to \`-dlopen'
4890 If any of the ARGS are libtool executable wrappers, then they are translated
4891 into their corresponding uninstalled binary, and any of their required library
4892 directories are added to the library path.
4894 Then, COMMAND is executed, with ARGS as arguments."
4899 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4901 Complete the installation of libtool libraries.
4903 Each LIBDIR is a directory that contains libtool libraries.
4905 The commands that this mode executes may require superuser privileges. Use
4906 the \`--dry-run' option if you just want to see what would be executed."
4911 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4913 Install executables or libraries.
4915 INSTALL-COMMAND is the installation command. The first component should be
4916 either the \`install' or \`cp' program.
4918 The rest of the components are interpreted as arguments to that command (only
4919 BSD-compatible install options are recognized)."
4924 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4926 Link object files or libraries together to form another library, or to
4927 create an executable program.
4929 LINK-COMMAND is a command using the C compiler that you would use to create
4930 a program from several object files.
4932 The following components of LINK-COMMAND are treated specially:
4934 -all-static do not do any dynamic linking at all
4935 -avoid-version do not add a version suffix if possible
4936 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4937 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4938 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4939 -export-symbols SYMFILE
4940 try to export only the symbols listed in SYMFILE
4941 -export-symbols-regex REGEX
4942 try to export only the symbols matching REGEX
4943 -LLIBDIR search LIBDIR for required installed libraries
4944 -lNAME OUTPUT-FILE requires the installed library libNAME
4945 -module build a library that can dlopened
4946 -no-fast-install disable the fast-install mode
4947 -no-install link a not-installable executable
4948 -no-undefined declare that a library does not refer to external symbols
4949 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4950 -release RELEASE specify package release information
4951 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4952 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4953 -static do not do any dynamic linking of libtool libraries
4954 -version-info CURRENT[:REVISION[:AGE]]
4955 specify library version info [each variable defaults to 0]
4957 All other options (arguments beginning with \`-') are ignored.
4959 Every other argument is treated as a filename. Files ending in \`.la' are
4960 treated as uninstalled libtool libraries, other files are standard or library
4963 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4964 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4965 required, except when creating a convenience library.
4967 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4968 using \`ar' and \`ranlib', or on Windows using \`lib'.
4970 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4971 is created, otherwise an executable program is created."
4976 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4978 Remove libraries from an installation directory.
4980 RM is the name of the program to use to delete files associated with each FILE
4981 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4984 If FILE is a libtool library, all the files associated with it are deleted.
4985 Otherwise, only FILE itself is deleted using RM."
4989 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4996 $echo "Try \`$modename --help' for more information about other modes."