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.54 2001/09/11 03:33:37)"
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
73 NL2SP='tr \015\012 \040\040'
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 # Make sure IFS has a sensible default
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
108 # Parse our command line options once, thoroughly.
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
123 execute_dlfiles="$execute_dlfiles $arg"
135 # Have we seen a non-optional argument yet?
142 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
147 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
152 echo "$progname: enabling shell trace mode"
162 if test "$build_libtool_libs" = yes; then
163 echo "enable shared libraries"
165 echo "disable shared libraries"
167 if test "$build_old_libs" = yes; then
168 echo "enable static libraries"
170 echo "disable static libraries"
175 --finish) mode="finish" ;;
177 --mode) prevopt="--mode" prev=mode ;;
178 --mode=*) mode="$optarg" ;;
180 --preserve-dup-deps) duplicate_deps="yes" ;;
192 $echo "$modename: unrecognized option \`$arg'" 1>&2
204 if test -n "$prevopt"; then
205 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
210 # If this variable is set in any of the actions, the command in it
211 # will be execed at the end. This prevents here-documents from being
212 # left over by shells.
215 if test -z "$show_help"; then
217 # Infer the operation mode.
218 if test -z "$mode"; then
220 *cc | *++ | gcc* | *-gcc*)
232 *db | *dbx | *strace | *truss)
242 # If we have no mode, but dlfiles were specified, then do execute mode.
243 test -n "$execute_dlfiles" && mode=execute
245 # Just use the default operation mode.
246 if test -z "$mode"; then
247 if test -n "$nonopt"; then
248 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
250 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
257 # Only execute mode is allowed to have -dlopen flags.
258 if test -n "$execute_dlfiles" && test "$mode" != execute; then
259 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
264 # Change the help message to a mode-specific one.
266 help="Try \`$modename --help --mode=$mode' for more information."
268 # These modes are in order of execution frequency so that they run quickly.
270 # libtool compile mode
272 modename="$modename: compile"
273 # Get the compilation command and the source file.
286 # Aesthetically quote the previous argument.
288 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
291 # Double-quote args containing other shell metacharacters.
292 # Many Bourne shells cannot handle close brackets correctly
293 # in scan sets, so we specify it separately.
294 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
299 # Add the previous argument to base_compile.
300 if test -z "$base_compile"; then
301 base_compile="$lastarg"
303 base_compile="$base_compile $lastarg"
309 # Accept any command-line options.
312 if test "$user_target" != "no"; then
313 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
340 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
342 save_ifs="$IFS"; IFS=','
346 # Double-quote args containing other shell metacharacters.
347 # Many Bourne shells cannot handle close brackets correctly
348 # in scan sets, so we specify it separately.
350 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
354 lastarg="$lastarg $arg"
357 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
359 # Add the arguments to base_compile.
360 if test -z "$base_compile"; then
361 base_compile="$lastarg"
363 base_compile="$base_compile $lastarg"
371 # The next one is the -o target name
376 # We got the output file
383 # Accept the current argument as the source file.
387 # Aesthetically quote the previous argument.
389 # Backslashify any backslashes, double quotes, and dollar signs.
390 # These are the only characters that are still specially
391 # interpreted inside of double-quoted scrings.
392 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
394 # Double-quote args containing other shell metacharacters.
395 # Many Bourne shells cannot handle close brackets correctly
396 # in scan sets, so we specify it separately.
398 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
399 lastarg="\"$lastarg\""
403 # Add the previous argument to base_compile.
404 if test -z "$base_compile"; then
405 base_compile="$lastarg"
407 base_compile="$base_compile $lastarg"
415 # Get the name of the library object.
416 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
419 $echo "$modename: you must specify a target with \`-o'" 1>&2
424 # Recognize several different file suffixes.
425 # If the user specifies -o file.o, it is replaced with file.lo
440 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
443 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
445 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
450 if test -z "$base_compile"; then
451 $echo "$modename: you must specify a compilation command" 1>&2
456 # Delete any leftover library objects.
457 if test "$build_old_libs" = yes; then
458 removelist="$obj $libobj"
464 trap "$run $rm $removelist; exit 1" 1 2 15
466 # On Cygwin there's no "real" PIC flag so we must build both object types
468 cygwin* | mingw* | pw32* | os2*)
472 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
473 # non-PIC code in shared libraries is not supported
477 # Calculate the filename of the output object if compiler does
478 # not support -o with -c
479 if test "$compiler_c_o" = no; then
480 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
481 lockfile="$output_obj.lock"
482 removelist="$removelist $output_obj $lockfile"
483 trap "$run $rm $removelist; exit 1" 1 2 15
489 # Lock this critical section if it is needed
490 # We use this script file to make the link, it avoids creating a new file
491 if test "$need_locks" = yes; then
492 until $run ln "$0" "$lockfile" 2>/dev/null; do
493 $show "Waiting for $lockfile to be removed"
496 elif test "$need_locks" = warn; then
497 if test -f "$lockfile"; then
499 *** ERROR, $lockfile exists and contains:
500 `cat $lockfile 2>/dev/null`
502 This indicates that another process is trying to use the same
503 temporary object file, and libtool could not work around it because
504 your compiler does not support \`-c' and \`-o' together. If you
505 repeat this compilation, it may succeed, by chance, but you had better
506 avoid parallel builds (make -j) in this platform, or get a better
512 echo $srcfile > "$lockfile"
515 if test -n "$fix_srcfile_path"; then
516 eval srcfile=\"$fix_srcfile_path\"
519 # Only build a PIC object if we are building libtool libraries.
520 if test "$build_libtool_libs" = yes; then
521 # Without this assignment, base_compile gets emptied.
522 fbsd_hideous_sh_bug=$base_compile
524 if test "$pic_mode" != no; then
525 # All platforms use -DPIC, to notify preprocessed assembler code.
526 command="$base_compile $srcfile $pic_flag -DPIC"
528 # Don't build PIC code
529 command="$base_compile $srcfile"
531 if test "$build_old_libs" = yes; then
533 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
534 if test "X$dir" = "X$libobj"; then
539 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
541 if test -d "$dir"; then
548 if test $status -ne 0 && test ! -d $dir; then
553 if test "$compiler_o_lo" = yes; then
555 command="$command -o $output_obj"
556 elif test "$compiler_c_o" = yes; then
558 command="$command -o $output_obj"
561 $run $rm "$output_obj"
563 if $run eval "$command"; then :
565 test -n "$output_obj" && $run $rm $removelist
569 if test "$need_locks" = warn &&
570 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
572 *** ERROR, $lockfile contains:
573 `cat $lockfile 2>/dev/null`
575 but it should contain:
578 This indicates that another process is trying to use the same
579 temporary object file, and libtool could not work around it because
580 your compiler does not support \`-c' and \`-o' together. If you
581 repeat this compilation, it may succeed, by chance, but you had better
582 avoid parallel builds (make -j) in this platform, or get a better
589 # Just move the object if needed, then go on to compile the next one
590 if test x"$output_obj" != x"$libobj"; then
591 $show "$mv $output_obj $libobj"
592 if $run $mv $output_obj $libobj; then :
600 # If we have no pic_flag, then copy the object into place and finish.
601 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
602 test "$build_old_libs" = yes; then
603 # Rename the .lo from within objdir to obj
604 if test -f $obj; then
609 $show "$mv $libobj $obj"
610 if $run $mv $libobj $obj; then :
617 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
618 if test "X$xdir" = "X$obj"; then
623 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
624 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
625 # Now arrange that obj and lo_libobj become the same file
626 $show "(cd $xdir && $LN_S $baseobj $libobj)"
627 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
628 # Unlock the critical section if it was locked
629 if test "$need_locks" != no; then
640 # Allow error messages only from the first compilation.
641 suppress_output=' >/dev/null 2>&1'
644 # Only build a position-dependent object if we build old libraries.
645 if test "$build_old_libs" = yes; then
646 if test "$pic_mode" != yes; then
647 # Don't build PIC code
648 command="$base_compile $srcfile"
650 # All platforms use -DPIC, to notify preprocessed assembler code.
651 command="$base_compile $srcfile $pic_flag -DPIC"
653 if test "$compiler_c_o" = yes; then
654 command="$command -o $obj"
658 # Suppress compiler output if we already did a PIC compilation.
659 command="$command$suppress_output"
660 $run $rm "$output_obj"
662 if $run eval "$command"; then :
668 if test "$need_locks" = warn &&
669 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
671 *** ERROR, $lockfile contains:
672 `cat $lockfile 2>/dev/null`
674 but it should contain:
677 This indicates that another process is trying to use the same
678 temporary object file, and libtool could not work around it because
679 your compiler does not support \`-c' and \`-o' together. If you
680 repeat this compilation, it may succeed, by chance, but you had better
681 avoid parallel builds (make -j) in this platform, or get a better
688 # Just move the object if needed
689 if test x"$output_obj" != x"$obj"; then
690 $show "$mv $output_obj $obj"
691 if $run $mv $output_obj $obj; then :
699 # Create an invalid libtool object if no PIC, so that we do not
700 # accidentally link it into a program.
701 if test "$build_libtool_libs" != yes; then
702 $show "echo timestamp > $libobj"
703 $run eval "echo timestamp > \$libobj" || exit $?
705 # Move the .lo from within objdir
706 $show "$mv $libobj $lo_libobj"
707 if $run $mv $libobj $lo_libobj; then :
716 # Unlock the critical section if it was locked
717 if test "$need_locks" != no; then
726 modename="$modename: link"
728 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
729 # It is impossible to link a dll without this setting, and
730 # we shouldn't force the makefile maintainer to figure out
731 # which system we are compiling for in order to pass an extra
732 # flag for every libtool invokation.
735 # FIXME: Unfortunately, there are problems with the above when trying
736 # to make a dll which has undefined symbols, in which case not
737 # even a static library is built. For now, we need to specify
738 # -no-undefined on the libtool link line when we can be certain
739 # that all symbols are satisfied, otherwise we get a static library.
746 libtool_args="$nonopt"
747 compile_command="$nonopt"
748 finalize_command="$nonopt"
761 lib_search_path=`pwd`
770 export_symbols_regex=
777 prefer_static_libs=no
789 # We need to know -static, to get the right output filenames.
793 -all-static | -static)
794 if test "X$arg" = "X-all-static"; then
795 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
796 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
798 if test -n "$link_static_flag"; then
799 dlopen_self=$dlopen_self_static
802 if test -z "$pic_flag" && test -n "$link_static_flag"; then
803 dlopen_self=$dlopen_self_static
806 build_libtool_libs=no
808 prefer_static_libs=yes
814 # See if our shared archives depend on static archives.
815 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
817 # Go through the arguments, transforming them on the way.
818 while test $# -gt 0; do
822 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
823 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
827 libtool_args="$libtool_args $qarg"
829 # If the previous option needs an argument, assign it.
830 if test -n "$prev"; then
833 compile_command="$compile_command @OUTPUT@"
834 finalize_command="$finalize_command @OUTPUT@"
840 if test "$preload" = no; then
841 # Add the symbol object into the linking commands.
842 compile_command="$compile_command @SYMFILE@"
843 finalize_command="$finalize_command @SYMFILE@"
847 *.la | *.lo) ;; # We handle these cases below.
849 if test "$dlself" = no; then
857 if test "$prev" = dlprefiles; then
859 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
869 if test "$prev" = dlfiles; then
870 dlfiles="$dlfiles $arg"
872 dlprefiles="$dlprefiles $arg"
880 export_symbols="$arg"
881 if test ! -f "$arg"; then
882 $echo "$modename: symbol file \`$arg' does not exist"
889 export_symbols_regex="$arg"
894 inst_prefix_dir="$arg"
904 # We need an absolute path.
906 [\\/]* | [A-Za-z]:[\\/]*) ;;
908 $echo "$modename: only absolute run-paths are allowed" 1>&2
912 if test "$prev" = rpath; then
915 *) rpath="$rpath $arg" ;;
920 *) xrpath="$xrpath $arg" ;;
927 compiler_flags="$compiler_flags $qarg"
929 compile_command="$compile_command $qarg"
930 finalize_command="$finalize_command $qarg"
934 linker_flags="$linker_flags $qarg"
935 compiler_flags="$compiler_flags $wl$qarg"
937 compile_command="$compile_command $wl$qarg"
938 finalize_command="$finalize_command $wl$qarg"
942 eval "$prev=\"\$arg\""
953 if test -n "$link_static_flag"; then
954 compile_command="$compile_command $link_static_flag"
955 finalize_command="$finalize_command $link_static_flag"
961 # FIXME: remove this flag sometime in the future.
962 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
986 -export-symbols | -export-symbols-regex)
987 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
988 $echo "$modename: more than one -exported-symbols argument is not allowed"
991 if test "X$arg" = "X-export-symbols"; then
1004 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1005 # so, if we see these flags be careful not to treat them like -L
1007 case $with_gcc/$host in
1009 compile_command="$compile_command $arg"
1010 finalize_command="$finalize_command $arg"
1017 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1018 # We need an absolute path.
1020 [\\/]* | [A-Za-z]:[\\/]*) ;;
1022 absdir=`cd "$dir" && pwd`
1023 if test -z "$absdir"; then
1024 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1033 deplibs="$deplibs -L$dir"
1034 lib_search_path="$lib_search_path $dir"
1038 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1039 case :$dllsearchpath: in
1041 *) dllsearchpath="$dllsearchpath:$dir";;
1049 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1051 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1052 # These systems don't actually have a C or math library (as such)
1055 *-*-mingw* | *-*-os2*)
1056 # These systems don't actually have a C library (as such)
1057 test "X$arg" = "X-lc" && continue
1060 # Do not include libc due to us having libc/libc_r.
1061 test "X$arg" = "X-lc" && continue
1064 elif test "X$arg" = "X-lc_r"; then
1067 # Do not include libc_r directly, use -pthread flag.
1072 deplibs="$deplibs $arg"
1088 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1089 # The PATH hackery in wrapper scripts is required on Windows
1090 # in order for the loader to find any dlls it needs.
1091 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1092 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1095 *) no_install=yes ;;
1123 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1124 # We need an absolute path.
1126 [\\/]* | [A-Za-z]:[\\/]*) ;;
1128 $echo "$modename: only absolute run-paths are allowed" 1>&2
1134 *) xrpath="$xrpath $dir" ;;
1140 # The effects of -static are defined in a previous loop.
1141 # We used to do the same as -all-static on platforms that
1142 # didn't have a PIC flag, but the assumption that the effects
1143 # would be equivalent was wrong. It would break on at least
1144 # Digital Unix and AIX.
1159 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1161 save_ifs="$IFS"; IFS=','
1162 for flag in $args; do
1165 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1170 compiler_flags="$compiler_flags $flag"
1173 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1177 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1179 save_ifs="$IFS"; IFS=','
1180 for flag in $args; do
1183 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1188 compiler_flags="$compiler_flags $wl$flag"
1189 linker_flags="$linker_flags $flag"
1192 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1205 # Some other compiler flag.
1207 # Unknown arguments in both finalize_command and compile_command need
1208 # to be aesthetically quoted because they are evaled later.
1209 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1211 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1218 # A library or standard object.
1219 if test "$prev" = dlfiles; then
1220 # This file was specified with -dlopen.
1221 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1222 dlfiles="$dlfiles $arg"
1226 # If libtool objects are unsupported, then we need to preload.
1231 if test "$prev" = dlprefiles; then
1232 # Preload the old-style object.
1233 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1237 *.lo) libobjs="$libobjs $arg" ;;
1238 *) objs="$objs $arg" ;;
1245 deplibs="$deplibs $arg"
1246 old_deplibs="$old_deplibs $arg"
1251 # A libtool-controlled library.
1253 if test "$prev" = dlfiles; then
1254 # This library was specified with -dlopen.
1255 dlfiles="$dlfiles $arg"
1257 elif test "$prev" = dlprefiles; then
1258 # The library was specified with -dlpreopen.
1259 dlprefiles="$dlprefiles $arg"
1262 deplibs="$deplibs $arg"
1267 # Some other compiler argument.
1269 # Unknown arguments in both finalize_command and compile_command need
1270 # to be aesthetically quoted because they are evaled later.
1271 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1273 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1280 # Now actually substitute the argument into the commands.
1281 if test -n "$arg"; then
1282 compile_command="$compile_command $arg"
1283 finalize_command="$finalize_command $arg"
1285 done # argument parsing loop
1287 if test -n "$prev"; then
1288 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1293 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1294 eval arg=\"$export_dynamic_flag_spec\"
1295 compile_command="$compile_command $arg"
1296 finalize_command="$finalize_command $arg"
1299 # calculate the name of the file, without its directory
1300 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1301 libobjs_save="$libobjs"
1303 if test -n "$shlibpath_var"; then
1304 # get the directories listed in $shlibpath_var
1305 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1309 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1310 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1312 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1313 if test "X$output_objdir" = "X$output"; then
1314 output_objdir="$objdir"
1316 output_objdir="$output_objdir/$objdir"
1318 # Create the object directory.
1319 if test ! -d "$output_objdir"; then
1320 $show "$mkdir $output_objdir"
1321 $run $mkdir $output_objdir
1323 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1328 # Determine the type of output
1331 $echo "$modename: you must specify an output file" 1>&2
1335 *.$libext) linkmode=oldlib ;;
1336 *.lo | *.$objext) linkmode=obj ;;
1337 *.la) linkmode=lib ;;
1338 *) linkmode=prog ;; # Anything else should be a program.
1343 # Find all interdependent deplibs by searching for libraries
1344 # that are linked more than once (e.g. -la -lb -la)
1345 for deplib in $deplibs; do
1346 if test "X$duplicate_deps" = "Xyes" ; then
1348 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1351 libs="$libs $deplib"
1354 if test "$linkmode" = lib; then
1355 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1357 # Compute libraries that are listed more than once in $predeps
1358 # $postdeps and mark them as special (i.e., whose duplicates are
1359 # not to be eliminated).
1361 if test "X$duplicate_deps" = "Xyes" ; then
1362 for pre_post_dep in $predeps $postdeps; do
1363 case "$pre_post_deps " in
1364 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1366 pre_post_deps="$pre_post_deps $pre_post_dep"
1375 need_relink=no # whether we're linking any uninstalled libtool libraries
1376 notinst_deplibs= # not-installed libtool libraries
1377 notinst_path= # paths that contain not-installed libtool libraries
1381 for file in $dlfiles $dlprefiles; do
1385 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1397 passes="conv scan dlopen dlpreopen link"
1402 for pass in $passes; do
1403 if test "$linkmode" = prog; then
1404 # Determine which files to process
1408 save_deplibs="$deplibs" # Collect dlpreopened libraries
1411 dlpreopen) libs="$dlprefiles" ;;
1412 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1415 for deplib in $libs; do
1420 if test "$linkmode" = oldlib && test "$linkmode" = obj; then
1421 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1424 if test "$pass" = conv; then
1425 deplibs="$deplib $deplibs"
1428 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1429 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1430 # Search the libtool library
1431 lib="$searchdir/lib${name}.la"
1432 if test -f "$lib"; then
1437 if test "$found" != yes; then
1438 # deplib doesn't seem to be a libtool library
1439 if test "$linkmode,$pass" = "prog,link"; then
1440 compile_deplibs="$deplib $compile_deplibs"
1441 finalize_deplibs="$deplib $finalize_deplibs"
1443 deplibs="$deplib $deplibs"
1444 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1452 deplibs="$deplib $deplibs"
1453 test "$pass" = conv && continue
1454 newdependency_libs="$deplib $newdependency_libs"
1455 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1458 if test "$pass" = conv; then
1459 deplibs="$deplib $deplibs"
1462 if test "$pass" = scan; then
1463 deplibs="$deplib $deplibs"
1464 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1466 compile_deplibs="$deplib $compile_deplibs"
1467 finalize_deplibs="$deplib $finalize_deplibs"
1471 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1477 if test "$pass" = link; then
1478 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1479 # Make sure the xrpath contains only unique directories.
1482 *) xrpath="$xrpath $dir" ;;
1485 deplibs="$deplib $deplibs"
1488 *.la) lib="$deplib" ;;
1490 if test "$pass" = conv; then
1491 deplibs="$deplib $deplibs"
1496 if test "$deplibs_check_method" != pass_all; then
1498 echo "*** Warning: This library needs some functionality provided by $deplib."
1499 echo "*** I have the capability to make that library automatically link in when"
1500 echo "*** you link to this library. But I can only do this if you have a"
1501 echo "*** shared version of the library, which you do not appear to have."
1504 echo "*** Warning: Linking the shared library $output against the"
1505 echo "*** static library $deplib is not portable!"
1506 deplibs="$deplib $deplibs"
1511 if test "$pass" != link; then
1512 deplibs="$deplib $deplibs"
1514 compile_deplibs="$deplib $compile_deplibs"
1515 finalize_deplibs="$deplib $finalize_deplibs"
1522 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1523 # If there is no dlopen support or we're linking statically,
1524 # we need to preload.
1525 newdlprefiles="$newdlprefiles $deplib"
1526 compile_deplibs="$deplib $compile_deplibs"
1527 finalize_deplibs="$deplib $finalize_deplibs"
1529 newdlfiles="$newdlfiles $deplib"
1538 if test "$found" = yes || test -f "$lib"; then :
1540 $echo "$modename: cannot find the library \`$lib'" 1>&2
1544 # Check to see that this really is a libtool archive.
1545 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1547 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1551 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1552 test "X$ladir" = "X$lib" && ladir="."
1560 # If the library was installed with an old release of libtool,
1561 # it will not redefine variable installed.
1566 */* | *\\*) . $lib ;;
1570 if test "$linkmode,$pass" = "lib,link" ||
1571 test "$linkmode,$pass" = "prog,scan" ||
1572 { test "$linkmode" = oldlib && test "$linkmode" = obj; }; then
1573 # Add dl[pre]opened files of deplib
1574 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1575 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1578 if test "$pass" = conv; then
1579 # Only check for convenience libraries
1580 deplibs="$lib $deplibs"
1581 if test -z "$libdir"; then
1582 if test -z "$old_library"; then
1583 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1586 # It is a libtool convenience library, so add in its objects.
1587 convenience="$convenience $ladir/$objdir/$old_library"
1588 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1590 for deplib in $dependency_libs; do
1591 deplibs="$deplib $deplibs"
1592 if test "X$duplicate_deps" = "Xyes" ; then
1593 case "$tmp_libs " in
1594 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1597 tmp_libs="$tmp_libs $deplib"
1599 elif test "$linkmode" != prog && test "$linkmode" != lib; then
1600 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1606 # Get the name of the library we link against.
1608 for l in $old_library $library_names; do
1611 if test -z "$linklib"; then
1612 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1616 # This library was specified with -dlopen.
1617 if test "$pass" = dlopen; then
1618 if test -z "$libdir"; then
1619 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1622 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1623 # If there is no dlname, no dlopen support or we're linking
1624 # statically, we need to preload.
1625 dlprefiles="$dlprefiles $lib"
1627 newdlfiles="$newdlfiles $lib"
1632 # We need an absolute path.
1634 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1636 abs_ladir=`cd "$ladir" && pwd`
1637 if test -z "$abs_ladir"; then
1638 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1639 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1644 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1646 # Find the relevant object directory and library name.
1647 if test "X$installed" = Xyes; then
1648 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1649 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1658 dir="$ladir/$objdir"
1659 absdir="$abs_ladir/$objdir"
1660 # Remove this search path later
1661 notinst_path="$notinst_path $abs_ladir"
1662 fi # $installed = yes
1663 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1665 # This library was specified with -dlpreopen.
1666 if test "$pass" = dlpreopen; then
1667 if test -z "$libdir"; then
1668 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1671 # Prefer using a static library (so that no silly _DYNAMIC symbols
1672 # are required to link).
1673 if test -n "$old_library"; then
1674 newdlprefiles="$newdlprefiles $dir/$old_library"
1675 # Otherwise, use the dlname, so that lt_dlopen finds it.
1676 elif test -n "$dlname"; then
1677 newdlprefiles="$newdlprefiles $dir/$dlname"
1679 newdlprefiles="$newdlprefiles $dir/$linklib"
1681 fi # $pass = dlpreopen
1683 if test -z "$libdir"; then
1684 # Link the convenience library
1685 if test "$linkmode" = lib; then
1686 deplibs="$dir/$old_library $deplibs"
1687 elif test "$linkmode,$pass" = "prog,link"; then
1688 compile_deplibs="$dir/$old_library $compile_deplibs"
1689 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1691 deplibs="$lib $deplibs"
1696 if test "$linkmode" = prog && test "$pass" != link; then
1697 newlib_search_path="$newlib_search_path $ladir"
1698 deplibs="$lib $deplibs"
1701 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1702 test "$build_libtool_libs" = no; then
1707 for deplib in $dependency_libs; do
1709 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1711 # Need to link against all dependency_libs?
1712 if test "$linkalldeplibs" = yes; then
1713 deplibs="$deplib $deplibs"
1715 # Need to hardcode shared library paths
1716 # or/and link against static libraries
1717 newdependency_libs="$deplib $newdependency_libs"
1719 if test "X$duplicate_deps" = "Xyes" ; then
1720 case "$tmp_libs " in
1721 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1724 tmp_libs="$tmp_libs $deplib"
1727 fi # $linkmode = prog...
1729 link_static=no # Whether the deplib will be linked statically
1730 if test -n "$library_names" &&
1731 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1732 # Link against this shared library
1734 if test "$linkmode,$pass" = "prog,link" ||
1735 { test "$linkmode" = lib && test "$hardcode_into_libs" = yes; }; then
1736 # Hardcode the library path.
1737 # Skip directories that are in the system default run-time
1739 case " $sys_lib_dlsearch_path " in
1742 case "$compile_rpath " in
1744 *) compile_rpath="$compile_rpath $absdir"
1748 case " $sys_lib_dlsearch_path " in
1751 case "$finalize_rpath " in
1753 *) finalize_rpath="$finalize_rpath $libdir"
1757 if test "$linkmode" = prog; then
1758 # We need to hardcode the library path
1759 if test -n "$shlibpath_var"; then
1760 # Make sure the rpath contains only unique directories.
1761 case "$temp_rpath " in
1764 *) temp_rpath="$temp_rpath $dir" ;;
1768 fi # $linkmode,$pass = prog,link...
1770 if test "$alldeplibs" = yes &&
1771 { test "$deplibs_check_method" = pass_all ||
1772 { test "$build_libtool_libs" = yes &&
1773 test -n "$library_names"; }; }; then
1774 # We only need to search for static libraries
1778 if test "$installed" = no; then
1779 notinst_deplibs="$notinst_deplibs $lib"
1783 if test -n "$old_archive_from_expsyms_cmds"; then
1784 # figure out the soname
1785 set dummy $library_names
1788 libname=`eval \\$echo \"$libname_spec\"`
1789 # use dlname if we got it. it's perfectly good, no?
1790 if test -n "$dlname"; then
1792 elif test -n "$soname_spec"; then
1796 major=`expr $current - $age`
1800 eval soname=\"$soname_spec\"
1805 # Make a new name for the extract_expsyms_cmds to use
1807 soname=`echo $soroot | sed -e 's/^.*\///'`
1808 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1810 # If the library has no export list, then create one now
1811 if test -f "$output_objdir/$soname-def"; then :
1813 $show "extracting exported symbol list from \`$soname'"
1814 save_ifs="$IFS"; IFS='~'
1815 eval cmds=\"$extract_expsyms_cmds\"
1816 for cmd in $cmds; do
1819 $run eval "$cmd" || exit $?
1825 if test -f "$output_objdir/$newlib"; then :; else
1826 $show "generating import library for \`$soname'"
1827 save_ifs="$IFS"; IFS='~'
1828 eval cmds=\"$old_archive_from_expsyms_cmds\"
1829 for cmd in $cmds; do
1832 $run eval "$cmd" || exit $?
1836 # make sure the library variables are pointing to the new library
1839 fi # test -n "$old_archive_from_expsyms_cmds"
1841 if test "$linkmode" = prog || test "$mode" != relink; then
1846 case $hardcode_action in
1847 immediate | unsupported)
1848 if test "$hardcode_direct" = no; then
1850 elif test "$hardcode_minus_L" = no; then
1852 *-*-sunos*) add_shlibpath="$dir" ;;
1856 elif test "$hardcode_shlibpath_var" = no; then
1857 add_shlibpath="$dir"
1864 if test "$hardcode_direct" = yes; then
1866 elif test "$hardcode_minus_L" = yes; then
1869 elif test "$hardcode_shlibpath_var" = yes; then
1870 add_shlibpath="$dir"
1879 if test "$lib_linked" != yes; then
1880 $echo "$modename: configuration error: unsupported hardcode properties"
1884 if test -n "$add_shlibpath"; then
1885 case :$compile_shlibpath: in
1886 *":$add_shlibpath:"*) ;;
1887 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1890 if test "$linkmode" = prog; then
1891 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1892 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1894 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1895 test -n "$add" && deplibs="$add $deplibs"
1896 if test "$hardcode_direct" != yes && \
1897 test "$hardcode_minus_L" != yes && \
1898 test "$hardcode_shlibpath_var" = yes; then
1899 case :$finalize_shlibpath: in
1901 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1907 if test "$linkmode" = prog || test "$mode" = relink; then
1911 # Finalize command for both is simple: just hardcode it.
1912 if test "$hardcode_direct" = yes; then
1913 add="$libdir/$linklib"
1914 elif test "$hardcode_minus_L" = yes; then
1915 # Try looking first in the location we're being installed to.
1917 if test -n "$inst_prefix_dir"; then
1920 add_dir="-L$inst_prefix_dir$libdir"
1924 add_dir="$add_dir -L$libdir"
1926 elif test "$hardcode_shlibpath_var" = yes; then
1927 case :$finalize_shlibpath: in
1929 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1933 # We cannot seem to hardcode it, guess we'll fake it.
1934 # Try looking first in the location we're being installed to.
1936 if test -n "$inst_prefix_dir"; then
1939 add_dir="-L$inst_prefix_dir$libdir"
1943 add_dir="$add_dir -L$libdir"
1947 if test "$linkmode" = prog; then
1948 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1949 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1951 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1952 test -n "$add" && deplibs="$add $deplibs"
1955 elif test "$linkmode" = prog; then
1956 if test "$alldeplibs" = yes &&
1957 { test "$deplibs_check_method" = pass_all ||
1958 { test "$build_libtool_libs" = yes &&
1959 test -n "$library_names"; }; }; then
1960 # We only need to search for static libraries
1964 # Try to link the static library
1965 # Here we assume that one of hardcode_direct or hardcode_minus_L
1966 # is not unsupported. This is valid on all known static and
1968 if test "$hardcode_direct" != unsupported; then
1969 test -n "$old_library" && linklib="$old_library"
1970 compile_deplibs="$dir/$linklib $compile_deplibs"
1971 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1973 compile_deplibs="-l$name -L$dir $compile_deplibs"
1974 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1976 elif test "$build_libtool_libs" = yes; then
1977 # Not a shared library
1978 if test "$deplibs_check_method" != pass_all; then
1979 # We're trying link a shared library against a static one
1980 # but the system doesn't support it.
1982 # Just print a warning and add the library to dependency_libs so
1983 # that the program can be linked against the static library.
1985 echo "*** Warning: This library needs some functionality provided by $lib."
1986 echo "*** I have the capability to make that library automatically link in when"
1987 echo "*** you link to this library. But I can only do this if you have a"
1988 echo "*** shared version of the library, which you do not appear to have."
1989 if test "$module" = yes; then
1990 echo "*** Therefore, libtool will create a static module, that should work "
1991 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1992 if test -z "$global_symbol_pipe"; then
1994 echo "*** However, this would only work if libtool was able to extract symbol"
1995 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1996 echo "*** not find such a program. So, this module is probably useless."
1997 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1999 if test "$build_old_libs" = no; then
2000 build_libtool_libs=module
2003 build_libtool_libs=no
2007 convenience="$convenience $dir/$old_library"
2008 old_convenience="$old_convenience $dir/$old_library"
2009 deplibs="$dir/$old_library $deplibs"
2012 fi # link shared/static library?
2014 if test "$linkmode" = lib; then
2015 if test -n "$dependency_libs" &&
2016 { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2017 test "$link_static" = yes; }; then
2018 # Extract -R from dependency_libs
2020 for libdir in $dependency_libs; do
2022 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2024 *" $temp_xrpath "*) ;;
2025 *) xrpath="$xrpath $temp_xrpath";;
2027 *) temp_deplibs="$temp_deplibs $libdir";;
2030 dependency_libs="$temp_deplibs"
2033 newlib_search_path="$newlib_search_path $absdir"
2034 # Link against this library
2035 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2036 # ... and its dependency_libs
2038 for deplib in $dependency_libs; do
2039 newdependency_libs="$deplib $newdependency_libs"
2040 if test "X$duplicate_deps" = "Xyes" ; then
2041 case "$tmp_libs " in
2042 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2045 tmp_libs="$tmp_libs $deplib"
2048 if test "$link_all_deplibs" != no; then
2049 # Add the search paths of all dependency libraries
2050 for deplib in $dependency_libs; do
2052 -L*) path="$deplib" ;;
2054 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2055 test "X$dir" = "X$deplib" && dir="."
2056 # We need an absolute path.
2058 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2060 absdir=`cd "$dir" && pwd`
2061 if test -z "$absdir"; then
2062 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2067 if grep "^installed=no" $deplib > /dev/null; then
2068 path="-L$absdir/$objdir"
2070 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2071 if test -z "$libdir"; then
2072 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2075 if test "$absdir" != "$libdir"; then
2076 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2083 case " $deplibs " in
2085 *) deplibs="$deplibs $path" ;;
2088 fi # link_all_deplibs != no
2090 done # for deplib in $libs
2091 if test "$pass" = dlpreopen; then
2092 # Link the dlpreopened libraries before other libraries
2093 for deplib in $save_deplibs; do
2094 deplibs="$deplib $deplibs"
2097 if test "$pass" != dlopen; then
2098 test "$pass" != scan && dependency_libs="$newdependency_libs"
2099 if test "$pass" != conv; then
2100 # Make sure lib_search_path contains only unique directories.
2102 for dir in $newlib_search_path; do
2103 case "$lib_search_path " in
2105 *) lib_search_path="$lib_search_path $dir" ;;
2111 if test "$linkmode,$pass" != "prog,link"; then
2114 vars="compile_deplibs finalize_deplibs"
2116 for var in $vars dependency_libs; do
2117 # Add libraries to $var in reverse order
2118 eval tmp_libs=\"\$$var\"
2120 for deplib in $tmp_libs; do
2122 -L*) new_libs="$deplib $new_libs" ;;
2124 case " $specialdeplibs " in
2125 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2127 case " $new_libs " in
2129 *) new_libs="$deplib $new_libs" ;;
2137 for deplib in $new_libs; do
2140 case " $tmp_libs " in
2142 *) tmp_libs="$tmp_libs $deplib" ;;
2145 *) tmp_libs="$tmp_libs $deplib" ;;
2148 eval $var=\"$tmp_libs\"
2151 if test "$pass" = "conv" &&
2152 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2153 libs="$deplibs" # reset libs
2157 if test "$linkmode" = prog; then
2158 dlfiles="$newdlfiles"
2159 dlprefiles="$newdlprefiles"
2164 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2165 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2168 if test -n "$rpath"; then
2169 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2172 if test -n "$xrpath"; then
2173 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2176 if test -n "$vinfo"; then
2177 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2180 if test -n "$release"; then
2181 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2184 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2185 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2188 # Now set the variables for building old libraries.
2189 build_libtool_libs=no
2191 objs="$objs$old_deplibs"
2195 # Make sure we only generate libraries of the form `libNAME.la'.
2198 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2199 eval libname=\"$libname_spec\"
2202 if test "$module" = no; then
2203 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2207 if test "$need_lib_prefix" != no; then
2208 # Add the "lib" prefix for modules if required
2209 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2210 eval libname=\"$libname_spec\"
2212 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2217 if test -n "$objs"; then
2218 if test "$deplibs_check_method" != pass_all; then
2219 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2223 echo "*** Warning: Linking the shared library $output against the non-libtool"
2224 echo "*** objects $objs is not portable!"
2225 libobjs="$libobjs $objs"
2229 if test "$dlself" != no; then
2230 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2234 if test "$#" -gt 2; then
2235 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2240 if test -z "$rpath"; then
2241 if test "$build_libtool_libs" = yes; then
2242 # Building a libtool convenience library.
2244 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2245 build_libtool_libs=convenience
2249 if test -n "$vinfo"; then
2250 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2253 if test -n "$release"; then
2254 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2258 # Parse the version information argument.
2259 save_ifs="$IFS"; IFS=':'
2260 set dummy $vinfo 0 0 0
2263 if test -n "$8"; then
2264 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2273 # Check that each of the things are valid numbers.
2277 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2278 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2286 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2295 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2296 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2301 if test "$age" -gt "$current"; then
2302 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2303 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2307 # Calculate the version variables.
2311 case $version_type in
2315 # Like Linux, but with the current version available in
2316 # verstring for coding it into the library header
2317 major=.`expr $current - $age`
2318 versuffix="$major.$age.$revision"
2319 # Darwin ld doesn't like 0 for these options...
2320 minor_current=`expr $current + 1`
2321 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2326 versuffix=".$current.$revision";
2331 versuffix=".$current";
2335 major=`expr $current - $age + 1`
2336 verstring="sgi$major.$revision"
2338 # Add in all the interfaces that we are compatible with.
2340 while test "$loop" -ne 0; do
2341 iface=`expr $revision - $loop`
2342 loop=`expr $loop - 1`
2343 verstring="sgi$major.$iface:$verstring"
2346 # Before this point, $major must not contain `.'.
2348 versuffix="$major.$revision"
2352 major=.`expr $current - $age`
2353 versuffix="$major.$age.$revision"
2357 major=`expr $current - $age`
2358 versuffix=".$current.$age.$revision"
2359 verstring="$current.$age.$revision"
2361 # Add in all the interfaces that we are compatible with.
2363 while test "$loop" -ne 0; do
2364 iface=`expr $current - $loop`
2365 loop=`expr $loop - 1`
2366 verstring="$verstring:${iface}.0"
2369 # Make executables depend on our current version.
2370 verstring="$verstring:${current}.0"
2375 versuffix=".$current.$revision"
2379 # Use '-' rather than '.', since we only want one
2380 # extension on DOS 8.3 filesystems.
2381 major=`expr $current - $age`
2386 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2387 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2392 # Clear the version info if we defaulted, and they specified a release.
2393 if test -z "$vinfo" && test -n "$release"; then
2396 case $version_type in
2398 # we can't check for "0.0" in archive_cmds due to quoting
2399 # problems, so we reset it completely
2406 if test "$need_version" = no; then
2413 # Remove version info from name if versioning should be avoided
2414 if test "$avoid_version" = yes && test "$need_version" = no; then
2420 # Check to see if the archive will have undefined symbols.
2421 if test "$allow_undefined" = yes; then
2422 if test "$allow_undefined_flag" = unsupported; then
2423 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2424 build_libtool_libs=no
2428 # Don't allow undefined symbols.
2429 allow_undefined_flag="$no_undefined_flag"
2433 if test "$mode" != relink; then
2434 # Remove our outputs.
2435 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2436 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2439 # Now set the variables for building old libraries.
2440 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2441 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2443 # Transform .lo files to .o files.
2444 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2447 # Eliminate all temporary directories.
2448 for path in $notinst_path; do
2449 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2450 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2451 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2454 if test -n "$xrpath"; then
2455 # If the user specified any rpath flags, then add them.
2457 for libdir in $xrpath; do
2458 temp_xrpath="$temp_xrpath -R$libdir"
2459 case "$finalize_rpath " in
2461 *) finalize_rpath="$finalize_rpath $libdir" ;;
2464 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2465 dependency_libs="$temp_xrpath $dependency_libs"
2469 # Make sure dlfiles contains only unique files that won't be dlpreopened
2470 old_dlfiles="$dlfiles"
2472 for lib in $old_dlfiles; do
2473 case " $dlprefiles $dlfiles " in
2475 *) dlfiles="$dlfiles $lib" ;;
2479 # Make sure dlprefiles contains only unique files
2480 old_dlprefiles="$dlprefiles"
2482 for lib in $old_dlprefiles; do
2483 case "$dlprefiles " in
2485 *) dlprefiles="$dlprefiles $lib" ;;
2489 if test "$build_libtool_libs" = yes; then
2490 if test -n "$rpath"; then
2492 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2493 # these systems don't actually have a c library (as such)!
2495 *-*-rhapsody* | *-*-darwin1.[012])
2496 # Rhapsody C library is in the System framework
2497 deplibs="$deplibs -framework System"
2500 # Don't link with libc until the a.out ld.so is fixed.
2503 # Do not include libc due to us having libc/libc_r.
2506 # Add libc to deplibs on all other systems if necessary.
2507 if test "$build_libtool_need_lc" = "yes"; then
2508 deplibs="$deplibs -lc"
2514 # Transform deplibs into only deplibs that can be linked in shared.
2516 libname_save=$libname
2517 release_save=$release
2518 versuffix_save=$versuffix
2520 # I'm not sure if I'm treating the release correctly. I think
2521 # release should show up in the -l (ie -lgmp5) so we don't want to
2522 # add it in twice. Is that correct?
2528 case $deplibs_check_method in
2530 # Don't check for shared/static. Everything works.
2531 # This might be a little naive. We might want to check
2532 # whether the library exists or not. But this is on
2533 # osf3 & osf4 and I'm not really sure... Just
2534 # implementing what was already the behaviour.
2538 # This code stresses the "libraries are programs" paradigm to its
2539 # limits. Maybe even breaks it. We compile a program, linking it
2540 # against the deplibs as a proxy for the library. Then we can check
2541 # whether they linked in statically or dynamically with ldd.
2543 cat > conftest.c <<EOF
2544 int main() { return 0; }
2547 $CC -o conftest conftest.c $deplibs
2548 if test "$?" -eq 0 ; then
2549 ldd_output=`ldd conftest`
2550 for i in $deplibs; do
2551 name="`expr $i : '-l\(.*\)'`"
2552 # If $name is empty we are operating on a -L argument.
2553 if test -n "$name" && test "$name" != "0"; then
2554 libname=`eval \\$echo \"$libname_spec\"`
2555 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2556 set dummy $deplib_matches
2558 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2559 newdeplibs="$newdeplibs $i"
2563 echo "*** Warning: This library needs some functionality provided by $i."
2564 echo "*** I have the capability to make that library automatically link in when"
2565 echo "*** you link to this library. But I can only do this if you have a"
2566 echo "*** shared version of the library, which you do not appear to have."
2569 newdeplibs="$newdeplibs $i"
2573 # Error occured in the first compile. Let's try to salvage the situation:
2574 # Compile a seperate program for each library.
2575 for i in $deplibs; do
2576 name="`expr $i : '-l\(.*\)'`"
2577 # If $name is empty we are operating on a -L argument.
2578 if test -n "$name" && test "$name" != "0"; then
2580 $CC -o conftest conftest.c $i
2582 if test "$?" -eq 0 ; then
2583 ldd_output=`ldd conftest`
2584 libname=`eval \\$echo \"$libname_spec\"`
2585 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2586 set dummy $deplib_matches
2588 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2589 newdeplibs="$newdeplibs $i"
2593 echo "*** Warning: This library needs some functionality provided by $i."
2594 echo "*** I have the capability to make that library automatically link in when"
2595 echo "*** you link to this library. But I can only do this if you have a"
2596 echo "*** shared version of the library, which you do not appear to have."
2601 echo "*** Warning! Library $i is needed by this library but I was not able to"
2602 echo "*** make it link in! You will probably need to install it or some"
2603 echo "*** library that it depends on before this library will be fully"
2604 echo "*** functional. Installing it before continuing would be even better."
2607 newdeplibs="$newdeplibs $i"
2613 set dummy $deplibs_check_method
2614 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2615 for a_deplib in $deplibs; do
2616 name="`expr $a_deplib : '-l\(.*\)'`"
2617 # If $name is empty we are operating on a -L argument.
2618 if test -n "$name" && test "$name" != "0"; then
2619 libname=`eval \\$echo \"$libname_spec\"`
2620 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2621 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2622 for potent_lib in $potential_libs; do
2623 # Follow soft links.
2624 if ls -lLd "$potent_lib" 2>/dev/null \
2625 | grep " -> " >/dev/null; then
2628 # The statement above tries to avoid entering an
2629 # endless loop below, in case of cyclic links.
2630 # We might still enter an endless loop, since a link
2631 # loop can be closed while we follow links,
2633 potlib="$potent_lib"
2634 while test -h "$potlib" 2>/dev/null; do
2635 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2637 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2638 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2641 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2643 | egrep "$file_magic_regex" > /dev/null; then
2644 newdeplibs="$newdeplibs $a_deplib"
2650 if test -n "$a_deplib" ; then
2653 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2654 echo "*** I have the capability to make that library automatically link in when"
2655 echo "*** you link to this library. But I can only do this if you have a"
2656 echo "*** shared version of the library, which you do not appear to have."
2659 # Add a -L argument.
2660 newdeplibs="$newdeplibs $a_deplib"
2662 done # Gone through all deplibs.
2665 set dummy $deplibs_check_method
2666 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2667 for a_deplib in $deplibs; do
2668 name="`expr $a_deplib : '-l\(.*\)'`"
2669 # If $name is empty we are operating on a -L argument.
2670 if test -n "$name" && test "$name" != "0"; then
2671 libname=`eval \\$echo \"$libname_spec\"`
2672 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2673 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2674 for potent_lib in $potential_libs; do
2675 if eval echo \"$potent_lib\" 2>/dev/null \
2677 | egrep "$match_pattern_regex" > /dev/null; then
2678 newdeplibs="$newdeplibs $a_deplib"
2684 if test -n "$a_deplib" ; then
2687 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2688 echo "*** I have the capability to make that library automatically link in when"
2689 echo "*** you link to this library. But I can only do this if you have a"
2690 echo "*** shared version of the library, which you do not appear to have."
2693 # Add a -L argument.
2694 newdeplibs="$newdeplibs $a_deplib"
2696 done # Gone through all deplibs.
2700 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2701 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2702 grep . >/dev/null; then
2704 if test "X$deplibs_check_method" = "Xnone"; then
2705 echo "*** Warning: inter-library dependencies are not supported in this platform."
2707 echo "*** Warning: inter-library dependencies are not known to be supported."
2709 echo "*** All declared inter-library dependencies are being dropped."
2714 versuffix=$versuffix_save
2716 release=$release_save
2717 libname=$libname_save
2721 *-*-rhapsody* | *-*-darwin1.[012])
2722 # On Rhapsody replace the C library is the System framework
2723 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2727 if test "$droppeddeps" = yes; then
2728 if test "$module" = yes; then
2730 echo "*** Warning: libtool could not satisfy all declared inter-library"
2731 echo "*** dependencies of module $libname. Therefore, libtool will create"
2732 echo "*** a static module, that should work as long as the dlopening"
2733 echo "*** application is linked with the -dlopen flag."
2734 if test -z "$global_symbol_pipe"; then
2736 echo "*** However, this would only work if libtool was able to extract symbol"
2737 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2738 echo "*** not find such a program. So, this module is probably useless."
2739 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2741 if test "$build_old_libs" = no; then
2742 oldlibs="$output_objdir/$libname.$libext"
2743 build_libtool_libs=module
2746 build_libtool_libs=no
2749 echo "*** The inter-library dependencies that have been dropped here will be"
2750 echo "*** automatically added whenever a program is linked with this library"
2751 echo "*** or is declared to -dlopen it."
2753 if test "$allow_undefined" = no; then
2755 echo "*** Since this library must not contain undefined symbols,"
2756 echo "*** because either the platform does not support them or"
2757 echo "*** it was explicitly requested with -no-undefined,"
2758 echo "*** libtool will only create a static version of it."
2759 if test "$build_old_libs" = no; then
2760 oldlibs="$output_objdir/$libname.$libext"
2761 build_libtool_libs=module
2764 build_libtool_libs=no
2769 # Done checking deplibs!
2773 # All the library-specific variables (install_libdir is set above).
2778 # Test again, we may have decided not to build it any more
2779 if test "$build_libtool_libs" = yes; then
2780 if test "$hardcode_into_libs" = yes; then
2781 # Hardcode the library paths
2784 rpath="$finalize_rpath"
2785 test "$mode" != relink && rpath="$compile_rpath$rpath"
2786 for libdir in $rpath; do
2787 if test -n "$hardcode_libdir_flag_spec"; then
2788 if test -n "$hardcode_libdir_separator"; then
2789 if test -z "$hardcode_libdirs"; then
2790 hardcode_libdirs="$libdir"
2792 # Just accumulate the unique libdirs.
2793 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2794 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2797 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2802 eval flag=\"$hardcode_libdir_flag_spec\"
2803 dep_rpath="$dep_rpath $flag"
2805 elif test -n "$runpath_var"; then
2806 case "$perm_rpath " in
2808 *) perm_rpath="$perm_rpath $libdir" ;;
2812 # Substitute the hardcoded libdirs into the rpath.
2813 if test -n "$hardcode_libdir_separator" &&
2814 test -n "$hardcode_libdirs"; then
2815 libdir="$hardcode_libdirs"
2816 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2818 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2819 # We should set the runpath_var.
2821 for dir in $perm_rpath; do
2824 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2826 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2829 shlibpath="$finalize_shlibpath"
2830 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2831 if test -n "$shlibpath"; then
2832 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2835 # Get the real and link names of the library.
2836 eval library_names=\"$library_names_spec\"
2837 set dummy $library_names
2841 if test -n "$soname_spec"; then
2842 eval soname=\"$soname_spec\"
2846 test -z "$dlname" && dlname=$soname
2848 lib="$output_objdir/$realname"
2851 linknames="$linknames $link"
2854 # Ensure that we have .o objects for linkers which dislike .lo
2855 # (e.g. aix) in case we are running --disable-static
2856 for obj in $libobjs; do
2857 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2858 if test "X$xdir" = "X$obj"; then
2863 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2864 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2865 if test ! -f $xdir/$oldobj; then
2866 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2867 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2871 # Use standard objects if they are pic
2872 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2874 # Prepare the list of exported symbols
2875 if test -z "$export_symbols"; then
2876 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2877 $show "generating symbol list for \`$libname.la'"
2878 export_symbols="$output_objdir/$libname.exp"
2879 $run $rm $export_symbols
2880 eval cmds=\"$export_symbols_cmds\"
2881 save_ifs="$IFS"; IFS='~'
2882 for cmd in $cmds; do
2885 $run eval "$cmd" || exit $?
2888 if test -n "$export_symbols_regex"; then
2889 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2890 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2891 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2892 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2897 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2898 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2901 if test -n "$convenience"; then
2902 if test -n "$whole_archive_flag_spec"; then
2903 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2905 gentop="$output_objdir/${outputname}x"
2906 $show "${rm}r $gentop"
2907 $run ${rm}r "$gentop"
2908 $show "mkdir $gentop"
2909 $run mkdir "$gentop"
2911 if test "$status" -ne 0 && test ! -d "$gentop"; then
2914 generated="$generated $gentop"
2916 for xlib in $convenience; do
2917 # Extract the objects.
2919 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2920 *) xabs=`pwd`"/$xlib" ;;
2922 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2923 xdir="$gentop/$xlib"
2925 $show "${rm}r $xdir"
2930 if test "$status" -ne 0 && test ! -d "$xdir"; then
2933 $show "(cd $xdir && $AR x $xabs)"
2934 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2936 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2941 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2942 eval flag=\"$thread_safe_flag_spec\"
2943 linker_flags="$linker_flags $flag"
2946 # Make a backup of the uninstalled library when relinking
2947 if test "$mode" = relink; then
2948 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2951 # Do each of the archive commands.
2952 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2953 eval cmds=\"$archive_expsym_cmds\"
2955 eval cmds=\"$archive_cmds\"
2957 save_ifs="$IFS"; IFS='~'
2958 for cmd in $cmds; do
2961 $run eval "$cmd" || exit $?
2965 # Restore the uninstalled library and exit
2966 if test "$mode" = relink; then
2967 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2971 # Create links to the real library.
2972 for linkname in $linknames; do
2973 if test "$realname" != "$linkname"; then
2974 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2975 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2979 # If -module or -export-dynamic was specified, set the dlname.
2980 if test "$module" = yes || test "$export_dynamic" = yes; then
2981 # On all known operating systems, these are identical.
2988 if test -n "$deplibs"; then
2989 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2992 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2993 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2996 if test -n "$rpath"; then
2997 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3000 if test -n "$xrpath"; then
3001 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3004 if test -n "$vinfo"; then
3005 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3008 if test -n "$release"; then
3009 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3014 if test -n "$objs$old_deplibs"; then
3015 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3019 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3027 # Delete the old objects.
3028 $run $rm $obj $libobj
3030 # Objects from convenience libraries. This assumes
3031 # single-version convenience libraries. Whenever we create
3032 # different ones for PIC/non-PIC, this we'll have to duplicate
3036 # reload_cmds runs $LD directly, so let us get rid of
3037 # -Wl from whole_archive_flag_spec
3040 if test -n "$convenience"; then
3041 if test -n "$whole_archive_flag_spec"; then
3042 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3044 gentop="$output_objdir/${obj}x"
3045 $show "${rm}r $gentop"
3046 $run ${rm}r "$gentop"
3047 $show "mkdir $gentop"
3048 $run mkdir "$gentop"
3050 if test "$status" -ne 0 && test ! -d "$gentop"; then
3053 generated="$generated $gentop"
3055 for xlib in $convenience; do
3056 # Extract the objects.
3058 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3059 *) xabs=`pwd`"/$xlib" ;;
3061 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3062 xdir="$gentop/$xlib"
3064 $show "${rm}r $xdir"
3069 if test "$status" -ne 0 && test ! -d "$xdir"; then
3072 $show "(cd $xdir && $AR x $xabs)"
3073 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3075 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3080 # Create the old-style object.
3081 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
3084 eval cmds=\"$reload_cmds\"
3085 save_ifs="$IFS"; IFS='~'
3086 for cmd in $cmds; do
3089 $run eval "$cmd" || exit $?
3093 # Exit if we aren't doing a library object file.
3094 if test -z "$libobj"; then
3095 if test -n "$gentop"; then
3096 $show "${rm}r $gentop"
3103 if test "$build_libtool_libs" != yes; then
3104 if test -n "$gentop"; then
3105 $show "${rm}r $gentop"
3109 # Create an invalid libtool object if no PIC, so that we don't
3110 # accidentally link it into a program.
3111 $show "echo timestamp > $libobj"
3112 $run eval "echo timestamp > $libobj" || exit $?
3116 if test -n "$pic_flag" || test "$pic_mode" != default; then
3117 # Only do commands if we really have different PIC objects.
3118 reload_objs="$libobjs $reload_conv_objs"
3120 eval cmds=\"$reload_cmds\"
3121 save_ifs="$IFS"; IFS='~'
3122 for cmd in $cmds; do
3125 $run eval "$cmd" || exit $?
3129 # Just create a symlink.
3132 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3133 if test "X$xdir" = "X$libobj"; then
3138 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3139 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3140 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3141 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3144 if test -n "$gentop"; then
3145 $show "${rm}r $gentop"
3154 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3156 if test -n "$vinfo"; then
3157 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3160 if test -n "$release"; then
3161 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3164 if test "$preload" = yes; then
3165 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3166 test "$dlopen_self_static" = unknown; then
3167 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3172 *-*-rhapsody* | *-*-darwin1.[012])
3173 # On Rhapsody replace the C library is the System framework
3174 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3175 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3179 compile_command="$compile_command $compile_deplibs"
3180 finalize_command="$finalize_command $finalize_deplibs"
3182 if test -n "$rpath$xrpath"; then
3183 # If the user specified any rpath flags, then add them.
3184 for libdir in $rpath $xrpath; do
3185 # This is the magic to use -rpath.
3186 case "$finalize_rpath " in
3188 *) finalize_rpath="$finalize_rpath $libdir" ;;
3193 # Now hardcode the library paths
3196 for libdir in $compile_rpath $finalize_rpath; do
3197 if test -n "$hardcode_libdir_flag_spec"; then
3198 if test -n "$hardcode_libdir_separator"; then
3199 if test -z "$hardcode_libdirs"; then
3200 hardcode_libdirs="$libdir"
3202 # Just accumulate the unique libdirs.
3203 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3204 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3207 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3212 eval flag=\"$hardcode_libdir_flag_spec\"
3213 rpath="$rpath $flag"
3215 elif test -n "$runpath_var"; then
3216 case "$perm_rpath " in
3218 *) perm_rpath="$perm_rpath $libdir" ;;
3222 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3223 case :$dllsearchpath: in
3225 *) dllsearchpath="$dllsearchpath:$libdir";;
3230 # Substitute the hardcoded libdirs into the rpath.
3231 if test -n "$hardcode_libdir_separator" &&
3232 test -n "$hardcode_libdirs"; then
3233 libdir="$hardcode_libdirs"
3234 eval rpath=\" $hardcode_libdir_flag_spec\"
3236 compile_rpath="$rpath"
3240 for libdir in $finalize_rpath; do
3241 if test -n "$hardcode_libdir_flag_spec"; then
3242 if test -n "$hardcode_libdir_separator"; then
3243 if test -z "$hardcode_libdirs"; then
3244 hardcode_libdirs="$libdir"
3246 # Just accumulate the unique libdirs.
3247 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3248 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3251 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3256 eval flag=\"$hardcode_libdir_flag_spec\"
3257 rpath="$rpath $flag"
3259 elif test -n "$runpath_var"; then
3260 case "$finalize_perm_rpath " in
3262 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3266 # Substitute the hardcoded libdirs into the rpath.
3267 if test -n "$hardcode_libdir_separator" &&
3268 test -n "$hardcode_libdirs"; then
3269 libdir="$hardcode_libdirs"
3270 eval rpath=\" $hardcode_libdir_flag_spec\"
3272 finalize_rpath="$rpath"
3274 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3275 # Transform all the library objects into standard objects.
3276 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3277 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3281 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3282 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3283 dlsyms="${outputname}S.c"
3285 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3289 if test -n "$dlsyms"; then
3293 # Discover the nlist of each of the dlfiles.
3294 nlist="$output_objdir/${outputname}.nm"
3296 $show "$rm $nlist ${nlist}S ${nlist}T"
3297 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3299 # Parse the name list into a source file.
3300 $show "creating $output_objdir/$dlsyms"
3302 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3303 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3304 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3310 /* Prevent the only kind of declaration conflicts we can make. */
3311 #define lt_preloaded_symbols some_other_symbol
3313 /* External symbol declarations for the compiler. */\
3316 if test "$dlself" = yes; then
3317 $show "generating symbol list for \`$output'"
3319 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3321 # Add our own program objects to the symbol list.
3322 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3323 for arg in $progfiles; do
3324 $show "extracting global C symbols from \`$arg'"
3325 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3328 if test -n "$exclude_expsyms"; then
3329 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3330 $run eval '$mv "$nlist"T "$nlist"'
3333 if test -n "$export_symbols_regex"; then
3334 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3335 $run eval '$mv "$nlist"T "$nlist"'
3338 # Prepare the list of exported symbols
3339 if test -z "$export_symbols"; then
3340 export_symbols="$output_objdir/$output.exp"
3341 $run $rm $export_symbols
3342 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3344 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3345 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3346 $run eval 'mv "$nlist"T "$nlist"'
3350 for arg in $dlprefiles; do
3351 $show "extracting global C symbols from \`$arg'"
3352 name=`echo "$arg" | sed -e 's%^.*/%%'`
3353 $run eval 'echo ": $name " >> "$nlist"'
3354 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3357 if test -z "$run"; then
3358 # Make sure we have at least an empty file.
3359 test -f "$nlist" || : > "$nlist"
3361 if test -n "$exclude_expsyms"; then
3362 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3363 $mv "$nlist"T "$nlist"
3366 # Try sorting and uniquifying the output.
3367 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3370 grep -v "^: " < "$nlist" > "$nlist"S
3373 if test -f "$nlist"S; then
3374 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3376 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3379 $echo >> "$output_objdir/$dlsyms" "\
3381 #undef lt_preloaded_symbols
3383 #if defined (__STDC__) && __STDC__
3384 # define lt_ptr void *
3386 # define lt_ptr char *
3390 /* The mapping between symbol names and symbols. */
3395 lt_preloaded_symbols[] =
3399 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3401 $echo >> "$output_objdir/$dlsyms" "\
3405 /* This works around a problem in FreeBSD linker */
3406 #ifdef FREEBSD_WORKAROUND
3407 static const void *lt_preloaded_setup() {
3408 return lt_preloaded_symbols;
3418 pic_flag_for_symtable=
3420 # compiling the symbol table file with pic_flag works around
3421 # a FreeBSD bug that causes programs to crash when -lm is
3422 # linked before any other PIC object. But we must not use
3423 # pic_flag when linking with -static. The problem exists in
3424 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3425 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3426 case "$compile_command " in
3428 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3431 case "$compile_command " in
3433 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3437 # Now compile the dynamic symbol file.
3438 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3439 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3441 # Clean up the generated files.
3442 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3443 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3445 # Transform the symbol file into the correct name.
3446 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3447 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3450 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3455 # We keep going just in case the user didn't refer to
3456 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3457 # really was required.
3459 # Nullify the symbol file.
3460 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3461 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3464 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3465 # Replace the output file specification.
3466 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3467 link_command="$compile_command$compile_rpath"
3469 # We have no uninstalled library dependencies, so finalize right now.
3470 $show "$link_command"
3471 $run eval "$link_command"
3474 # Delete the generated files.
3475 if test -n "$dlsyms"; then
3476 $show "$rm $output_objdir/${outputname}S.${objext}"
3477 $run $rm "$output_objdir/${outputname}S.${objext}"
3483 if test -n "$shlibpath_var"; then
3484 # We should set the shlibpath_var
3486 for dir in $temp_rpath; do
3488 [\\/]* | [A-Za-z]:[\\/]*)
3493 # Relative path: add a thisdir entry.
3494 rpath="$rpath\$thisdir/$dir:"
3501 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3502 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3504 if test -n "$finalize_shlibpath"; then
3505 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3510 if test -n "$runpath_var"; then
3511 if test -n "$perm_rpath"; then
3512 # We should set the runpath_var.
3514 for dir in $perm_rpath; do
3517 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3519 if test -n "$finalize_perm_rpath"; then
3520 # We should set the runpath_var.
3522 for dir in $finalize_perm_rpath; do
3525 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3529 if test "$no_install" = yes; then
3530 # We don't need to create a wrapper script.
3531 link_command="$compile_var$compile_command$compile_rpath"
3532 # Replace the output file specification.
3533 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3534 # Delete the old output file.
3536 # Link the executable and exit
3537 $show "$link_command"
3538 $run eval "$link_command" || exit $?
3542 if test "$hardcode_action" = relink; then
3543 # Fast installation is not supported
3544 link_command="$compile_var$compile_command$compile_rpath"
3545 relink_command="$finalize_var$finalize_command$finalize_rpath"
3547 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3548 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3550 if test "$fast_install" != no; then
3551 link_command="$finalize_var$compile_command$finalize_rpath"
3552 if test "$fast_install" = yes; then
3553 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3555 # fast_install is set to needless
3559 link_command="$compile_var$compile_command$compile_rpath"
3560 relink_command="$finalize_var$finalize_command$finalize_rpath"
3564 # Replace the output file specification.
3565 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3567 # Delete the old output files.
3568 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3570 $show "$link_command"
3571 $run eval "$link_command" || exit $?
3573 # Now create the wrapper script.
3574 $show "creating $output"
3576 # Quote the relink command for shipping.
3577 if test -n "$relink_command"; then
3578 # Preserve any variables that may affect compiler behavior
3579 for var in $variables_saved_for_relink; do
3580 if eval test -z \"\${$var+set}\"; then
3581 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3582 elif eval var_value=\$$var; test -z "$var_value"; then
3583 relink_command="$var=; export $var; $relink_command"
3585 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3586 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3589 relink_command="(cd `pwd`; $relink_command)"
3590 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3593 # Quote $echo for shipping.
3594 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3596 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3597 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3599 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3601 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3604 # Only actually do things if our run command is non-null.
3605 if test -z "$run"; then
3606 # win32 will think the script is a binary if it has
3607 # a .exe suffix, so we strip it off here.
3609 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3611 # test for cygwin because mv fails w/o .exe extensions
3613 *cygwin*) exeext=.exe ;;
3617 trap "$rm $output; exit 1" 1 2 15
3622 # $output - temporary wrapper script for $objdir/$outputname
3623 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3625 # The $output program cannot be directly executed until all the libtool
3626 # libraries that it depends on are installed.
3628 # This wrapper script should never be moved out of the build directory.
3629 # If it is, it will not operate correctly.
3631 # Sed substitution that helps us do robust quoting. It backslashifies
3632 # metacharacters that are still active within double-quoted strings.
3633 Xsed='sed -e 1s/^X//'
3634 sed_quote_subst='$sed_quote_subst'
3636 # The HP-UX ksh and POSIX shell print the target directory to stdout
3638 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3640 relink_command=\"$relink_command\"
3642 # This environment variable determines our operation mode.
3643 if test \"\$libtool_install_magic\" = \"$magic\"; then
3644 # install mode needs the following variable:
3645 notinst_deplibs='$notinst_deplibs'
3647 # When we are sourced in execute mode, \$file and \$echo are already set.
3648 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3651 # Make sure echo works.
3652 if test \"X\$1\" = X--no-reexec; then
3653 # Discard the --no-reexec flag, and continue.
3655 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3656 # Yippee, \$echo works!
3659 # Restart under the correct shell, and then maybe \$echo will work.
3660 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3666 # Find the directory that this script lives in.
3667 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3668 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3670 # Follow symbolic links until we get to the real thisdir.
3671 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3672 while test -n \"\$file\"; do
3673 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3675 # If there was a directory component, then change thisdir.
3676 if test \"x\$destdir\" != \"x\$file\"; then
3677 case \"\$destdir\" in
3678 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3679 *) thisdir=\"\$thisdir/\$destdir\" ;;
3683 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3684 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3687 # Try to get the absolute directory name.
3688 absdir=\`cd \"\$thisdir\" && pwd\`
3689 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3692 if test "$fast_install" = yes; then
3694 program=lt-'$outputname'$exeext
3695 progdir=\"\$thisdir/$objdir\"
3697 if test ! -f \"\$progdir/\$program\" || \\
3698 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3699 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3701 file=\"\$\$-\$program\"
3703 if test ! -d \"\$progdir\"; then
3704 $mkdir \"\$progdir\"
3706 $rm \"\$progdir/\$file\"
3711 # relink executable if necessary
3712 if test -n \"\$relink_command\"; then
3713 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3715 $echo \"\$relink_command_output\" >&2
3716 $rm \"\$progdir/\$file\"
3721 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3722 { $rm \"\$progdir/\$program\";
3723 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3724 $rm \"\$progdir/\$file\"
3728 program='$outputname'
3729 progdir=\"\$thisdir/$objdir\"
3735 if test -f \"\$progdir/\$program\"; then"
3737 # Export our shlibpath_var if we have one.
3738 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3740 # Add our own library path to $shlibpath_var
3741 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3743 # Some systems cannot cope with colon-terminated $shlibpath_var
3744 # The second colon is a workaround for a bug in BeOS R4 sed
3745 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3747 export $shlibpath_var
3751 # fixup the dll searchpath if we need to.
3752 if test -n "$dllsearchpath"; then
3754 # Add the dll search path components to the executable PATH
3755 PATH=$dllsearchpath:\$PATH
3760 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3761 # Run the actual program with our arguments.
3764 # win32 systems need to use the prog path for dll
3766 *-*-cygwin* | *-*-pw32*)
3768 exec \$progdir/\$program \${1+\"\$@\"}
3772 # Backslashes separate directories on plain windows
3773 *-*-mingw | *-*-os2*)
3775 exec \$progdir\\\\\$program \${1+\"\$@\"}
3781 # Export the path to the program.
3782 PATH=\"\$progdir:\$PATH\"
3785 exec \$program \${1+\"\$@\"}
3790 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3794 # The program doesn't exist.
3795 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3796 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3797 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3808 # See if we need to build an old-fashioned archive.
3809 for oldlib in $oldlibs; do
3811 if test "$build_libtool_libs" = convenience; then
3812 oldobjs="$libobjs_save"
3813 addlibs="$convenience"
3814 build_libtool_libs=no
3816 if test "$build_libtool_libs" = module; then
3817 oldobjs="$libobjs_save"
3818 build_libtool_libs=no
3820 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3822 addlibs="$old_convenience"
3825 if test -n "$addlibs"; then
3826 gentop="$output_objdir/${outputname}x"
3827 $show "${rm}r $gentop"
3828 $run ${rm}r "$gentop"
3829 $show "mkdir $gentop"
3830 $run mkdir "$gentop"
3832 if test "$status" -ne 0 && test ! -d "$gentop"; then
3835 generated="$generated $gentop"
3837 # Add in members from convenience archives.
3838 for xlib in $addlibs; do
3839 # Extract the objects.
3841 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3842 *) xabs=`pwd`"/$xlib" ;;
3844 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3845 xdir="$gentop/$xlib"
3847 $show "${rm}r $xdir"
3852 if test "$status" -ne 0 && test ! -d "$xdir"; then
3855 $show "(cd $xdir && $AR x $xabs)"
3856 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3858 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3862 # Do each command in the archive commands.
3863 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3864 eval cmds=\"$old_archive_from_new_cmds\"
3866 # Ensure that we have .o objects in place in case we decided
3867 # not to build a shared library, and have fallen back to building
3868 # static libs even though --disable-static was passed!
3869 for oldobj in $oldobjs; do
3870 if test ! -f $oldobj; then
3871 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3872 if test "X$xdir" = "X$oldobj"; then
3877 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3878 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3879 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3880 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3884 eval cmds=\"$old_archive_cmds\"
3886 save_ifs="$IFS"; IFS='~'
3887 for cmd in $cmds; do
3890 $run eval "$cmd" || exit $?
3895 if test -n "$generated"; then
3896 $show "${rm}r$generated"
3897 $run ${rm}r$generated
3900 # Now create the libtool archive.
3904 test "$build_old_libs" = yes && old_library="$libname.$libext"
3905 $show "creating $output"
3907 # Preserve any variables that may affect compiler behavior
3908 for var in $variables_saved_for_relink; do
3909 if eval test -z \"\${$var+set}\"; then
3910 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3911 elif eval var_value=\$$var; test -z "$var_value"; then
3912 relink_command="$var=; export $var; $relink_command"
3914 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3915 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3918 # Quote the link command for shipping.
3919 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3920 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3922 # Only create the output if not a dry run.
3923 if test -z "$run"; then
3924 for installed in no yes; do
3925 if test "$installed" = yes; then
3926 if test -z "$install_libdir"; then
3929 output="$output_objdir/$outputname"i
3930 # Replace all uninstalled libtool libraries with the installed ones
3932 for deplib in $dependency_libs; do
3935 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3936 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3937 if test -z "$libdir"; then
3938 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3941 newdependency_libs="$newdependency_libs $libdir/$name"
3943 *) newdependency_libs="$newdependency_libs $deplib" ;;
3946 dependency_libs="$newdependency_libs"
3948 for lib in $dlfiles; do
3949 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3950 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3951 if test -z "$libdir"; then
3952 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3955 newdlfiles="$newdlfiles $libdir/$name"
3957 dlfiles="$newdlfiles"
3959 for lib in $dlprefiles; do
3960 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3961 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3962 if test -z "$libdir"; then
3963 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3966 newdlprefiles="$newdlprefiles $libdir/$name"
3968 dlprefiles="$newdlprefiles"
3971 # place dlname in correct position for cygwin
3973 case $host,$output,$installed,$module,$dlname in
3974 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3977 # $outputname - a libtool library file
3978 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3980 # Please DO NOT delete this file!
3981 # It is necessary for linking the library.
3983 # The name that we can dlopen(3).
3986 # Names of this library.
3987 library_names='$library_names'
3989 # The name of the static archive.
3990 old_library='$old_library'
3992 # Libraries that this one depends upon.
3993 dependency_libs='$dependency_libs'
3995 # Version information for $libname.
4000 # Is this an already installed library?
4001 installed=$installed
4003 # Files to dlopen/dlpreopen
4005 dlpreopen='$dlprefiles'
4007 # Directory that this library needs to be installed in:
4008 libdir='$install_libdir'"
4009 if test "$installed" = no && test "$need_relink" = yes; then
4011 relink_command=\"$relink_command\""
4016 # Do a symbolic link so that the libtool archive can be found in
4017 # LD_LIBRARY_PATH before the program is installed.
4018 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4019 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4025 # libtool install mode
4027 modename="$modename: install"
4029 # There may be an optional sh(1) argument at the beginning of
4030 # install_prog (especially on Windows NT).
4031 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4032 # Allow the use of GNU shtool's install command.
4033 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4034 # Aesthetically quote it.
4035 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4037 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4041 install_prog="$arg "
4049 # The real first argument should be the name of the installation program.
4050 # Aesthetically quote it.
4051 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4053 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4057 install_prog="$install_prog$arg"
4059 # We need to accept at least all the BSD install flags.
4069 if test -n "$dest"; then
4070 files="$files $dest"
4088 # If the previous option needed an argument, then skip it.
4089 if test -n "$prev"; then
4098 # Aesthetically quote the argument.
4099 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4101 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4105 install_prog="$install_prog $arg"
4108 if test -z "$install_prog"; then
4109 $echo "$modename: you must specify an install program" 1>&2
4114 if test -n "$prev"; then
4115 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4120 if test -z "$files"; then
4121 if test -z "$dest"; then
4122 $echo "$modename: no file or destination specified" 1>&2
4124 $echo "$modename: you must specify a destination" 1>&2
4130 # Strip any trailing slash from the destination.
4131 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4133 # Check to see that the destination is a directory.
4134 test -d "$dest" && isdir=yes
4135 if test "$isdir" = yes; then
4139 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4140 test "X$destdir" = "X$dest" && destdir=.
4141 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4143 # Not a directory, so check to see that there is only one file specified.
4145 if test "$#" -gt 2; then
4146 $echo "$modename: \`$dest' is not a directory" 1>&2
4152 [\\/]* | [A-Za-z]:[\\/]*) ;;
4154 for file in $files; do
4158 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4167 # This variable tells wrapper scripts just to set variables rather
4168 # than running their programs.
4169 libtool_install_magic="$magic"
4174 for file in $files; do
4176 # Do each installation.
4179 # Do the static libraries later.
4180 staticlibs="$staticlibs $file"
4184 # Check to see that this really is a libtool archive.
4185 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4187 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4195 # If there is no directory component, then add one.
4197 */* | *\\*) . $file ;;
4201 # Add the libdir to current_libdirs if it is the destination.
4202 if test "X$destdir" = "X$libdir"; then
4203 case "$current_libdirs " in
4205 *) current_libdirs="$current_libdirs $libdir" ;;
4208 # Note the libdir as a future libdir.
4209 case "$future_libdirs " in
4211 *) future_libdirs="$future_libdirs $libdir" ;;
4215 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4216 test "X$dir" = "X$file/" && dir=
4219 if test -n "$relink_command"; then
4220 # Determine the prefix the user has applied to our future dir.
4221 inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4223 # Don't allow the user to place us outside of our expected
4224 # location b/c this prevents finding dependent libraries that
4225 # are installed to the same prefix.
4226 if test "$inst_prefix_dir" = "$destdir"; then
4227 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4231 if test -n "$inst_prefix_dir"; then
4232 # Stick the inst_prefix_dir data into the link command.
4233 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4235 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4238 $echo "$modename: warning: relinking \`$file'" 1>&2
4239 $show "$relink_command"
4240 if $run eval "$relink_command"; then :
4242 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4247 # See the names of the shared library.
4248 set dummy $library_names
4249 if test -n "$2"; then
4255 test -n "$relink_command" && srcname="$realname"T
4257 # Install the shared library and build the symlinks.
4258 $show "$install_prog $dir/$srcname $destdir/$realname"
4259 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4260 if test -n "$stripme" && test -n "$striplib"; then
4261 $show "$striplib $destdir/$realname"
4262 $run eval "$striplib $destdir/$realname" || exit $?
4265 if test "$#" -gt 0; then
4266 # Delete the old symlinks, and create new ones.
4269 if test "$linkname" != "$realname"; then
4270 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4271 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4276 # Do each command in the postinstall commands.
4277 lib="$destdir/$realname"
4278 eval cmds=\"$postinstall_cmds\"
4279 save_ifs="$IFS"; IFS='~'
4280 for cmd in $cmds; do
4283 $run eval "$cmd" || exit $?
4288 # Install the pseudo-library for information purposes.
4289 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4290 instname="$dir/$name"i
4291 $show "$install_prog $instname $destdir/$name"
4292 $run eval "$install_prog $instname $destdir/$name" || exit $?
4294 # Maybe install the static library, too.
4295 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4299 # Install (i.e. copy) a libtool object.
4301 # Figure out destination file name, if it wasn't already specified.
4302 if test -n "$destname"; then
4303 destfile="$destdir/$destname"
4305 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4306 destfile="$destdir/$destfile"
4309 # Deduce the name of the destination old-style object file.
4312 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4315 staticdest="$destfile"
4319 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4325 # Install the libtool object if requested.
4326 if test -n "$destfile"; then
4327 $show "$install_prog $file $destfile"
4328 $run eval "$install_prog $file $destfile" || exit $?
4331 # Install the old object if enabled.
4332 if test "$build_old_libs" = yes; then
4333 # Deduce the name of the old-style object file.
4334 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4336 $show "$install_prog $staticobj $staticdest"
4337 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4343 # Figure out destination file name, if it wasn't already specified.
4344 if test -n "$destname"; then
4345 destfile="$destdir/$destname"
4347 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4348 destfile="$destdir/$destfile"
4351 # Do a test to see if this is really a libtool program.
4352 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4356 # If there is no directory component, then add one.
4358 */* | *\\*) . $file ;;
4362 # Check the variables that should have been set.
4363 if test -z "$notinst_deplibs"; then
4364 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4369 for lib in $notinst_deplibs; do
4370 # Check to see that each library is installed.
4372 if test -f "$lib"; then
4373 # If there is no directory component, then add one.
4375 */* | *\\*) . $lib ;;
4379 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4380 if test -n "$libdir" && test ! -f "$libfile"; then
4381 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4387 # If there is no directory component, then add one.
4389 */* | *\\*) . $file ;;
4394 if test "$fast_install" = no && test -n "$relink_command"; then
4395 if test "$finalize" = yes && test -z "$run"; then
4397 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4398 tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4399 if test $? = 0 ; then :
4401 tmpdir="$tmpdir/libtool-$$"
4403 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4405 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4408 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4409 outputname="$tmpdir/$file"
4410 # Replace the output file specification.
4411 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4413 $show "$relink_command"
4414 if $run eval "$relink_command"; then :
4416 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4422 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4425 # Install the binary that we compiled earlier.
4426 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4430 # remove .exe since cygwin /usr/bin/install will append another
4432 case $install_prog,$host in
4433 /usr/bin/install*,*cygwin*)
4434 case $file:$destfile in
4439 destfile=$destfile.exe
4442 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4447 $show "$install_prog$stripme $file $destfile"
4448 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4449 test -n "$outputname" && ${rm}r "$tmpdir"
4454 for file in $staticlibs; do
4455 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4457 # Set up the ranlib parameters.
4458 oldlib="$destdir/$name"
4460 $show "$install_prog $file $oldlib"
4461 $run eval "$install_prog \$file \$oldlib" || exit $?
4463 if test -n "$stripme" && test -n "$striplib"; then
4464 $show "$old_striplib $oldlib"
4465 $run eval "$old_striplib $oldlib" || exit $?
4468 # Do each command in the postinstall commands.
4469 eval cmds=\"$old_postinstall_cmds\"
4470 save_ifs="$IFS"; IFS='~'
4471 for cmd in $cmds; do
4474 $run eval "$cmd" || exit $?
4479 if test -n "$future_libdirs"; then
4480 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4483 if test -n "$current_libdirs"; then
4484 # Maybe just do a dry run.
4485 test -n "$run" && current_libdirs=" -n$current_libdirs"
4486 exec_cmd='$SHELL $0 --finish$current_libdirs'
4492 # libtool finish mode
4494 modename="$modename: finish"
4498 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4501 libdirs="$libdirs $dir"
4504 for libdir in $libdirs; do
4505 if test -n "$finish_cmds"; then
4506 # Do each command in the finish commands.
4507 eval cmds=\"$finish_cmds\"
4508 save_ifs="$IFS"; IFS='~'
4509 for cmd in $cmds; do
4512 $run eval "$cmd" || admincmds="$admincmds
4517 if test -n "$finish_eval"; then
4518 # Do the single finish_eval.
4519 eval cmds=\"$finish_eval\"
4520 $run eval "$cmds" || admincmds="$admincmds
4526 # Exit here if they wanted silent mode.
4527 test "$show" = : && exit 0
4529 echo "----------------------------------------------------------------------"
4530 echo "Libraries have been installed in:"
4531 for libdir in $libdirs; do
4535 echo "If you ever happen to want to link against installed libraries"
4536 echo "in a given directory, LIBDIR, you must either use libtool, and"
4537 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4538 echo "flag during linking and do at least one of the following:"
4539 if test -n "$shlibpath_var"; then
4540 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4541 echo " during execution"
4543 if test -n "$runpath_var"; then
4544 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4545 echo " during linking"
4547 if test -n "$hardcode_libdir_flag_spec"; then
4549 eval flag=\"$hardcode_libdir_flag_spec\"
4551 echo " - use the \`$flag' linker flag"
4553 if test -n "$admincmds"; then
4554 echo " - have your system administrator run these commands:$admincmds"
4556 if test -f /etc/ld.so.conf; then
4557 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4560 echo "See any operating system documentation about shared libraries for"
4561 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4562 echo "----------------------------------------------------------------------"
4566 # libtool execute mode
4568 modename="$modename: execute"
4570 # The first argument is the command name.
4572 if test -z "$cmd"; then
4573 $echo "$modename: you must specify a COMMAND" 1>&2
4578 # Handle -dlopen flags immediately.
4579 for file in $execute_dlfiles; do
4580 if test ! -f "$file"; then
4581 $echo "$modename: \`$file' is not a file" 1>&2
4589 # Check to see that this really is a libtool archive.
4590 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4592 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4597 # Read the libtool library.
4601 # If there is no directory component, then add one.
4603 */* | *\\*) . $file ;;
4607 # Skip this library if it cannot be dlopened.
4608 if test -z "$dlname"; then
4609 # Warn if it was a shared library.
4610 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4614 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4615 test "X$dir" = "X$file" && dir=.
4617 if test -f "$dir/$objdir/$dlname"; then
4620 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4626 # Just add the directory containing the .lo file.
4627 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4628 test "X$dir" = "X$file" && dir=.
4632 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4637 # Get the absolute pathname.
4638 absdir=`cd "$dir" && pwd`
4639 test -n "$absdir" && dir="$absdir"
4641 # Now add the directory to shlibpath_var.
4642 if eval "test -z \"\$$shlibpath_var\""; then
4643 eval "$shlibpath_var=\"\$dir\""
4645 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4649 # This variable tells wrapper scripts just to set shlibpath_var
4650 # rather than running their programs.
4651 libtool_execute_magic="$magic"
4653 # Check if any of the arguments is a wrapper script.
4660 # Do a test to see if this is really a libtool program.
4661 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4662 # If there is no directory component, then add one.
4664 */* | *\\*) . $file ;;
4668 # Transform arg to wrapped name.
4669 file="$progdir/$program"
4673 # Quote arguments (to preserve shell metacharacters).
4674 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4675 args="$args \"$file\""
4678 if test -z "$run"; then
4679 if test -n "$shlibpath_var"; then
4680 # Export the shlibpath_var.
4681 eval "export $shlibpath_var"
4684 # Restore saved enviroment variables
4685 if test "${save_LC_ALL+set}" = set; then
4686 LC_ALL="$save_LC_ALL"; export LC_ALL
4688 if test "${save_LANG+set}" = set; then
4689 LANG="$save_LANG"; export LANG
4692 # Now prepare to actually exec the command.
4693 exec_cmd="\$cmd$args"
4695 # Display what would be done.
4696 if test -n "$shlibpath_var"; then
4697 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4698 $echo "export $shlibpath_var"
4705 # libtool clean and uninstall mode
4707 modename="$modename: $mode"
4713 # This variable tells wrapper scripts just to set variables rather
4714 # than running their programs.
4715 libtool_install_magic="$magic"
4720 -f) rm="$rm $arg"; rmforce=yes ;;
4721 -*) rm="$rm $arg" ;;
4722 *) files="$files $arg" ;;
4726 if test -z "$rm"; then
4727 $echo "$modename: you must specify an RM program" 1>&2
4734 for file in $files; do
4735 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4736 if test "X$dir" = "X$file"; then
4740 objdir="$dir/$objdir"
4742 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4743 test "$mode" = uninstall && objdir="$dir"
4745 # Remember objdir for removal later, being careful to avoid duplicates
4746 if test "$mode" = clean; then
4749 *) rmdirs="$rmdirs $objdir" ;;
4753 # Don't error if the file doesn't exist and rm -f was used.
4754 if (test -L "$file") >/dev/null 2>&1 \
4755 || (test -h "$file") >/dev/null 2>&1 \
4756 || test -f "$file"; then
4758 elif test -d "$file"; then
4761 elif test "$rmforce" = yes; then
4769 # Possibly a libtool archive, so verify it.
4770 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4773 # Delete the libtool libraries and symlinks.
4774 for n in $library_names; do
4775 rmfiles="$rmfiles $objdir/$n"
4777 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4778 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4780 if test "$mode" = uninstall; then
4781 if test -n "$library_names"; then
4782 # Do each command in the postuninstall commands.
4783 eval cmds=\"$postuninstall_cmds\"
4784 save_ifs="$IFS"; IFS='~'
4785 for cmd in $cmds; do
4789 if test "$?" -ne 0 && test "$rmforce" != yes; then
4796 if test -n "$old_library"; then
4797 # Do each command in the old_postuninstall commands.
4798 eval cmds=\"$old_postuninstall_cmds\"
4799 save_ifs="$IFS"; IFS='~'
4800 for cmd in $cmds; do
4804 if test "$?" -ne 0 && test "$rmforce" != yes; then
4810 # FIXME: should reinstall the best remaining shared library.
4816 if test "$build_old_libs" = yes; then
4817 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4818 rmfiles="$rmfiles $dir/$oldobj"
4823 # Do a test to see if this is a libtool program.
4824 if test "$mode" = clean &&
4825 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4829 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4830 if test "$fast_install" = yes && test -n "$relink_command"; then
4831 rmfiles="$rmfiles $objdir/lt-$name"
4836 $show "$rm $rmfiles"
4837 $run $rm $rmfiles || exit_status=1
4840 # Try to remove the ${objdir}s in the directories where we deleted files
4841 for dir in $rmdirs; do
4842 if test -d "$dir"; then
4844 $run rmdir $dir >/dev/null 2>&1
4852 $echo "$modename: you must specify a MODE" 1>&2
4853 $echo "$generic_help" 1>&2
4858 if test -z "$exec_cmd"; then
4859 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4860 $echo "$generic_help" 1>&2
4863 fi # test -z "$show_help"
4865 if test -n "$exec_cmd"; then
4870 # We need to display help for each of the modes.
4873 "Usage: $modename [OPTION]... [MODE-ARG]...
4875 Provide generalized library-building support services.
4877 --config show all configuration variables
4878 --debug enable verbose shell tracing
4879 -n, --dry-run display commands without modifying any files
4880 --features display basic configuration information and exit
4881 --finish same as \`--mode=finish'
4882 --help display this help message and exit
4883 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4884 --quiet same as \`--silent'
4885 --silent don't print informational messages
4886 --version print version information
4888 MODE must be one of the following:
4890 clean remove files from the build directory
4891 compile compile a source file into a libtool object
4892 execute automatically set library path, then run a program
4893 finish complete the installation of libtool libraries
4894 install install libraries or executables
4895 link create a library or an executable
4896 uninstall remove libraries from an installed directory
4898 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4899 a more detailed description of MODE."
4905 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4907 Remove files from the build directory.
4909 RM is the name of the program to use to delete files associated with each FILE
4910 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4913 If FILE is a libtool library, object or program, all the files associated
4914 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4919 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4921 Compile a source file into a libtool library object.
4923 This mode accepts the following additional options:
4925 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4926 -prefer-pic try to building PIC objects only
4927 -prefer-non-pic try to building non-PIC objects only
4928 -static always build a \`.o' file suitable for static linking
4930 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4931 from the given SOURCEFILE.
4933 The output file name is determined by removing the directory component from
4934 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4935 library object suffix, \`.lo'."
4940 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4942 Automatically set library path, then run a program.
4944 This mode accepts the following additional options:
4946 -dlopen FILE add the directory containing FILE to the library path
4948 This mode sets the library path environment variable according to \`-dlopen'
4951 If any of the ARGS are libtool executable wrappers, then they are translated
4952 into their corresponding uninstalled binary, and any of their required library
4953 directories are added to the library path.
4955 Then, COMMAND is executed, with ARGS as arguments."
4960 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4962 Complete the installation of libtool libraries.
4964 Each LIBDIR is a directory that contains libtool libraries.
4966 The commands that this mode executes may require superuser privileges. Use
4967 the \`--dry-run' option if you just want to see what would be executed."
4972 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4974 Install executables or libraries.
4976 INSTALL-COMMAND is the installation command. The first component should be
4977 either the \`install' or \`cp' program.
4979 The rest of the components are interpreted as arguments to that command (only
4980 BSD-compatible install options are recognized)."
4985 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4987 Link object files or libraries together to form another library, or to
4988 create an executable program.
4990 LINK-COMMAND is a command using the C compiler that you would use to create
4991 a program from several object files.
4993 The following components of LINK-COMMAND are treated specially:
4995 -all-static do not do any dynamic linking at all
4996 -avoid-version do not add a version suffix if possible
4997 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4998 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4999 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5000 -export-symbols SYMFILE
5001 try to export only the symbols listed in SYMFILE
5002 -export-symbols-regex REGEX
5003 try to export only the symbols matching REGEX
5004 -LLIBDIR search LIBDIR for required installed libraries
5005 -lNAME OUTPUT-FILE requires the installed library libNAME
5006 -module build a library that can dlopened
5007 -no-fast-install disable the fast-install mode
5008 -no-install link a not-installable executable
5009 -no-undefined declare that a library does not refer to external symbols
5010 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5011 -release RELEASE specify package release information
5012 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5013 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5014 -static do not do any dynamic linking of libtool libraries
5015 -version-info CURRENT[:REVISION[:AGE]]
5016 specify library version info [each variable defaults to 0]
5018 All other options (arguments beginning with \`-') are ignored.
5020 Every other argument is treated as a filename. Files ending in \`.la' are
5021 treated as uninstalled libtool libraries, other files are standard or library
5024 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5025 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5026 required, except when creating a convenience library.
5028 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5029 using \`ar' and \`ranlib', or on Windows using \`lib'.
5031 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5032 is created, otherwise an executable program is created."
5037 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5039 Remove libraries from an installation directory.
5041 RM is the name of the program to use to delete files associated with each FILE
5042 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5045 If FILE is a libtool library, all the files associated with it are deleted.
5046 Otherwise, only FILE itself is deleted using RM."
5050 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5057 $echo "Try \`$modename --help' for more information about other modes."