1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # The name of this program.
52 progname=`$echo "$0" | sed 's%^.*/%%'`
59 TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
73 NL2SP='tr \015\012 \040\040'
76 # Only set LANG and LC_ALL to C if already set.
77 # These must not be set unconditionally because not all systems understand
78 # e.g. LANG=C (notably SCO).
79 # We save the old values to restore during execute mode.
80 if test "${LC_ALL+set}" = set; then
81 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
83 if test "${LANG+set}" = set; then
84 save_LANG="$LANG"; LANG=C; export LANG
87 # Make sure IFS has a sensible default
90 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
91 echo "$modename: not configured to build any kind of library" 1>&2
92 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105 lo2o="s/\\.lo\$/.${objext}/"
106 o2lo="s/\\.${objext}\$/.lo/"
108 # Parse our command line options once, thoroughly.
115 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
119 # If the previous option needs an argument, assign it.
120 if test -n "$prev"; then
123 execute_dlfiles="$execute_dlfiles $arg"
135 # Have we seen a non-optional argument yet?
142 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
147 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
152 echo "$progname: enabling shell trace mode"
162 if test "$build_libtool_libs" = yes; then
163 echo "enable shared libraries"
165 echo "disable shared libraries"
167 if test "$build_old_libs" = yes; then
168 echo "enable static libraries"
170 echo "disable static libraries"
175 --finish) mode="finish" ;;
177 --mode) prevopt="--mode" prev=mode ;;
178 --mode=*) mode="$optarg" ;;
190 $echo "$modename: unrecognized option \`$arg'" 1>&2
202 if test -n "$prevopt"; then
203 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
208 # If this variable is set in any of the actions, the command in it
209 # will be execed at the end. This prevents here-documents from being
210 # left over by shells.
213 if test -z "$show_help"; then
215 # Infer the operation mode.
216 if test -z "$mode"; then
218 *cc | *++ | gcc* | *-gcc*)
230 *db | *dbx | *strace | *truss)
240 # If we have no mode, but dlfiles were specified, then do execute mode.
241 test -n "$execute_dlfiles" && mode=execute
243 # Just use the default operation mode.
244 if test -z "$mode"; then
245 if test -n "$nonopt"; then
246 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
248 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
255 # Only execute mode is allowed to have -dlopen flags.
256 if test -n "$execute_dlfiles" && test "$mode" != execute; then
257 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
262 # Change the help message to a mode-specific one.
264 help="Try \`$modename --help --mode=$mode' for more information."
266 # These modes are in order of execution frequency so that they run quickly.
268 # libtool compile mode
270 modename="$modename: compile"
271 # Get the compilation command and the source file.
284 # Aesthetically quote the previous argument.
286 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
289 # Double-quote args containing other shell metacharacters.
290 # Many Bourne shells cannot handle close brackets correctly
291 # in scan sets, so we specify it separately.
292 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
297 # Add the previous argument to base_compile.
298 if test -z "$base_compile"; then
299 base_compile="$lastarg"
301 base_compile="$base_compile $lastarg"
307 # Accept any command-line options.
310 if test "$user_target" != "no"; then
311 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
338 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
340 save_ifs="$IFS"; IFS=','
344 # Double-quote args containing other shell metacharacters.
345 # Many Bourne shells cannot handle close brackets correctly
346 # in scan sets, so we specify it separately.
348 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
352 lastarg="$lastarg $arg"
355 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
357 # Add the arguments to base_compile.
358 if test -z "$base_compile"; then
359 base_compile="$lastarg"
361 base_compile="$base_compile $lastarg"
369 # The next one is the -o target name
374 # We got the output file
381 # Accept the current argument as the source file.
385 # Aesthetically quote the previous argument.
387 # Backslashify any backslashes, double quotes, and dollar signs.
388 # These are the only characters that are still specially
389 # interpreted inside of double-quoted scrings.
390 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
392 # Double-quote args containing other shell metacharacters.
393 # Many Bourne shells cannot handle close brackets correctly
394 # in scan sets, so we specify it separately.
396 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
397 lastarg="\"$lastarg\""
401 # Add the previous argument to base_compile.
402 if test -z "$base_compile"; then
403 base_compile="$lastarg"
405 base_compile="$base_compile $lastarg"
413 # Get the name of the library object.
414 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
417 $echo "$modename: you must specify a target with \`-o'" 1>&2
422 # Recognize several different file suffixes.
423 # If the user specifies -o file.o, it is replaced with file.lo
438 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
441 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
443 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
448 if test -z "$base_compile"; then
449 $echo "$modename: you must specify a compilation command" 1>&2
454 # Delete any leftover library objects.
455 if test "$build_old_libs" = yes; then
456 removelist="$obj $libobj"
462 trap "$run $rm $removelist; exit 1" 1 2 15
464 # On Cygwin there's no "real" PIC flag so we must build both object types
466 cygwin* | mingw* | pw32* | os2*)
470 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
471 # non-PIC code in shared libraries is not supported
475 # Calculate the filename of the output object if compiler does
476 # not support -o with -c
477 if test "$compiler_c_o" = no; then
478 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
479 lockfile="$output_obj.lock"
480 removelist="$removelist $output_obj $lockfile"
481 trap "$run $rm $removelist; exit 1" 1 2 15
487 # Lock this critical section if it is needed
488 # We use this script file to make the link, it avoids creating a new file
489 if test "$need_locks" = yes; then
490 until $run ln "$0" "$lockfile" 2>/dev/null; do
491 $show "Waiting for $lockfile to be removed"
494 elif test "$need_locks" = warn; then
495 if test -f "$lockfile"; then
497 *** ERROR, $lockfile exists and contains:
498 `cat $lockfile 2>/dev/null`
500 This indicates that another process is trying to use the same
501 temporary object file, and libtool could not work around it because
502 your compiler does not support \`-c' and \`-o' together. If you
503 repeat this compilation, it may succeed, by chance, but you had better
504 avoid parallel builds (make -j) in this platform, or get a better
510 echo $srcfile > "$lockfile"
513 if test -n "$fix_srcfile_path"; then
514 eval srcfile=\"$fix_srcfile_path\"
517 # Only build a PIC object if we are building libtool libraries.
518 if test "$build_libtool_libs" = yes; then
519 # Without this assignment, base_compile gets emptied.
520 fbsd_hideous_sh_bug=$base_compile
522 if test "$pic_mode" != no; then
523 # All platforms use -DPIC, to notify preprocessed assembler code.
524 command="$base_compile $srcfile $pic_flag -DPIC"
526 # Don't build PIC code
527 command="$base_compile $srcfile"
529 if test "$build_old_libs" = yes; then
531 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
532 if test "X$dir" = "X$libobj"; then
537 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
539 if test -d "$dir"; then
546 if test $status -ne 0 && test ! -d $dir; then
551 if test "$compiler_o_lo" = yes; then
553 command="$command -o $output_obj"
554 elif test "$compiler_c_o" = yes; then
556 command="$command -o $output_obj"
559 $run $rm "$output_obj"
561 if $run eval "$command"; then :
563 test -n "$output_obj" && $run $rm $removelist
567 if test "$need_locks" = warn &&
568 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
570 *** ERROR, $lockfile contains:
571 `cat $lockfile 2>/dev/null`
573 but it should contain:
576 This indicates that another process is trying to use the same
577 temporary object file, and libtool could not work around it because
578 your compiler does not support \`-c' and \`-o' together. If you
579 repeat this compilation, it may succeed, by chance, but you had better
580 avoid parallel builds (make -j) in this platform, or get a better
587 # Just move the object if needed, then go on to compile the next one
588 if test x"$output_obj" != x"$libobj"; then
589 $show "$mv $output_obj $libobj"
590 if $run $mv $output_obj $libobj; then :
598 # If we have no pic_flag, then copy the object into place and finish.
599 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
600 test "$build_old_libs" = yes; then
601 # Rename the .lo from within objdir to obj
602 if test -f $obj; then
607 $show "$mv $libobj $obj"
608 if $run $mv $libobj $obj; then :
615 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
616 if test "X$xdir" = "X$obj"; then
621 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
622 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
623 # Now arrange that obj and lo_libobj become the same file
624 $show "(cd $xdir && $LN_S $baseobj $libobj)"
625 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
626 # Unlock the critical section if it was locked
627 if test "$need_locks" != no; then
638 # Allow error messages only from the first compilation.
639 suppress_output=' >/dev/null 2>&1'
642 # Only build a position-dependent object if we build old libraries.
643 if test "$build_old_libs" = yes; then
644 if test "$pic_mode" != yes; then
645 # Don't build PIC code
646 command="$base_compile $srcfile"
648 # All platforms use -DPIC, to notify preprocessed assembler code.
649 command="$base_compile $srcfile $pic_flag -DPIC"
651 if test "$compiler_c_o" = yes; then
652 command="$command -o $obj"
656 # Suppress compiler output if we already did a PIC compilation.
657 command="$command$suppress_output"
658 $run $rm "$output_obj"
660 if $run eval "$command"; then :
666 if test "$need_locks" = warn &&
667 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
669 *** ERROR, $lockfile contains:
670 `cat $lockfile 2>/dev/null`
672 but it should contain:
675 This indicates that another process is trying to use the same
676 temporary object file, and libtool could not work around it because
677 your compiler does not support \`-c' and \`-o' together. If you
678 repeat this compilation, it may succeed, by chance, but you had better
679 avoid parallel builds (make -j) in this platform, or get a better
686 # Just move the object if needed
687 if test x"$output_obj" != x"$obj"; then
688 $show "$mv $output_obj $obj"
689 if $run $mv $output_obj $obj; then :
697 # Create an invalid libtool object if no PIC, so that we do not
698 # accidentally link it into a program.
699 if test "$build_libtool_libs" != yes; then
700 $show "echo timestamp > $libobj"
701 $run eval "echo timestamp > \$libobj" || exit $?
703 # Move the .lo from within objdir
704 $show "$mv $libobj $lo_libobj"
705 if $run $mv $libobj $lo_libobj; then :
714 # Unlock the critical section if it was locked
715 if test "$need_locks" != no; then
724 modename="$modename: link"
726 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
727 # It is impossible to link a dll without this setting, and
728 # we shouldn't force the makefile maintainer to figure out
729 # which system we are compiling for in order to pass an extra
730 # flag for every libtool invokation.
733 # FIXME: Unfortunately, there are problems with the above when trying
734 # to make a dll which has undefined symbols, in which case not
735 # even a static library is built. For now, we need to specify
736 # -no-undefined on the libtool link line when we can be certain
737 # that all symbols are satisfied, otherwise we get a static library.
744 libtool_args="$nonopt"
745 compile_command="$nonopt"
746 finalize_command="$nonopt"
759 lib_search_path=`pwd`
767 export_symbols_regex=
774 prefer_static_libs=no
786 # We need to know -static, to get the right output filenames.
790 -all-static | -static)
791 if test "X$arg" = "X-all-static"; then
792 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
793 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
795 if test -n "$link_static_flag"; then
796 dlopen_self=$dlopen_self_static
799 if test -z "$pic_flag" && test -n "$link_static_flag"; then
800 dlopen_self=$dlopen_self_static
803 build_libtool_libs=no
805 prefer_static_libs=yes
811 # See if our shared archives depend on static archives.
812 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
814 # Go through the arguments, transforming them on the way.
815 while test $# -gt 0; do
819 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
820 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
824 libtool_args="$libtool_args $qarg"
826 # If the previous option needs an argument, assign it.
827 if test -n "$prev"; then
830 compile_command="$compile_command @OUTPUT@"
831 finalize_command="$finalize_command @OUTPUT@"
837 if test "$preload" = no; then
838 # Add the symbol object into the linking commands.
839 compile_command="$compile_command @SYMFILE@"
840 finalize_command="$finalize_command @SYMFILE@"
844 *.la | *.lo) ;; # We handle these cases below.
846 if test "$dlself" = no; then
854 if test "$prev" = dlprefiles; then
856 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
866 if test "$prev" = dlfiles; then
867 dlfiles="$dlfiles $arg"
869 dlprefiles="$dlprefiles $arg"
877 export_symbols="$arg"
878 if test ! -f "$arg"; then
879 $echo "$modename: symbol file \`$arg' does not exist"
886 export_symbols_regex="$arg"
896 # We need an absolute path.
898 [\\/]* | [A-Za-z]:[\\/]*) ;;
900 $echo "$modename: only absolute run-paths are allowed" 1>&2
904 if test "$prev" = rpath; then
907 *) rpath="$rpath $arg" ;;
912 *) xrpath="$xrpath $arg" ;;
919 compiler_flags="$compiler_flags $qarg"
921 compile_command="$compile_command $qarg"
922 finalize_command="$finalize_command $qarg"
926 linker_flags="$linker_flags $qarg"
927 compiler_flags="$compiler_flags $wl$qarg"
929 compile_command="$compile_command $wl$qarg"
930 finalize_command="$finalize_command $wl$qarg"
934 eval "$prev=\"\$arg\""
945 if test -n "$link_static_flag"; then
946 compile_command="$compile_command $link_static_flag"
947 finalize_command="$finalize_command $link_static_flag"
953 # FIXME: remove this flag sometime in the future.
954 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
978 -export-symbols | -export-symbols-regex)
979 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
980 $echo "$modename: more than one -exported-symbols argument is not allowed"
983 if test "X$arg" = "X-export-symbols"; then
991 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
992 # so, if we see these flags be careful not to treat them like -L
994 case $with_gcc/$host in
996 compile_command="$compile_command $arg"
997 finalize_command="$finalize_command $arg"
1004 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1005 # We need an absolute path.
1007 [\\/]* | [A-Za-z]:[\\/]*) ;;
1009 absdir=`cd "$dir" && pwd`
1010 if test -z "$absdir"; then
1011 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1020 deplibs="$deplibs -L$dir"
1021 lib_search_path="$lib_search_path $dir"
1025 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1026 case :$dllsearchpath: in
1028 *) dllsearchpath="$dllsearchpath:$dir";;
1036 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1038 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1039 # These systems don't actually have a C or math library (as such)
1042 *-*-mingw* | *-*-os2*)
1043 # These systems don't actually have a C library (as such)
1044 test "X$arg" = "X-lc" && continue
1047 # Do not include libc due to us having libc/libc_r.
1048 test "X$arg" = "X-lc" && continue
1051 elif test "X$arg" = "X-lc_r"; then
1054 # Do not include libc_r directly, use -pthread flag.
1059 deplibs="$deplibs $arg"
1075 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1076 # The PATH hackery in wrapper scripts is required on Windows
1077 # in order for the loader to find any dlls it needs.
1078 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1079 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1082 *) no_install=yes ;;
1110 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1111 # We need an absolute path.
1113 [\\/]* | [A-Za-z]:[\\/]*) ;;
1115 $echo "$modename: only absolute run-paths are allowed" 1>&2
1121 *) xrpath="$xrpath $dir" ;;
1127 # The effects of -static are defined in a previous loop.
1128 # We used to do the same as -all-static on platforms that
1129 # didn't have a PIC flag, but the assumption that the effects
1130 # would be equivalent was wrong. It would break on at least
1131 # Digital Unix and AIX.
1146 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1148 save_ifs="$IFS"; IFS=','
1149 for flag in $args; do
1152 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1157 compiler_flags="$compiler_flags $flag"
1160 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1164 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1166 save_ifs="$IFS"; IFS=','
1167 for flag in $args; do
1170 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1175 compiler_flags="$compiler_flags $wl$flag"
1176 linker_flags="$linker_flags $flag"
1179 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1192 # Some other compiler flag.
1194 # Unknown arguments in both finalize_command and compile_command need
1195 # to be aesthetically quoted because they are evaled later.
1196 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1198 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1205 # A library or standard object.
1206 if test "$prev" = dlfiles; then
1207 # This file was specified with -dlopen.
1208 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1209 dlfiles="$dlfiles $arg"
1213 # If libtool objects are unsupported, then we need to preload.
1218 if test "$prev" = dlprefiles; then
1219 # Preload the old-style object.
1220 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1224 *.lo) libobjs="$libobjs $arg" ;;
1225 *) objs="$objs $arg" ;;
1232 deplibs="$deplibs $arg"
1233 old_deplibs="$old_deplibs $arg"
1238 # A libtool-controlled library.
1240 if test "$prev" = dlfiles; then
1241 # This library was specified with -dlopen.
1242 dlfiles="$dlfiles $arg"
1244 elif test "$prev" = dlprefiles; then
1245 # The library was specified with -dlpreopen.
1246 dlprefiles="$dlprefiles $arg"
1249 deplibs="$deplibs $arg"
1254 # Some other compiler argument.
1256 # Unknown arguments in both finalize_command and compile_command need
1257 # to be aesthetically quoted because they are evaled later.
1258 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1260 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1267 # Now actually substitute the argument into the commands.
1268 if test -n "$arg"; then
1269 compile_command="$compile_command $arg"
1270 finalize_command="$finalize_command $arg"
1272 done # argument parsing loop
1274 if test -n "$prev"; then
1275 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1280 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1281 eval arg=\"$export_dynamic_flag_spec\"
1282 compile_command="$compile_command $arg"
1283 finalize_command="$finalize_command $arg"
1286 # calculate the name of the file, without its directory
1287 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1288 libobjs_save="$libobjs"
1290 if test -n "$shlibpath_var"; then
1291 # get the directories listed in $shlibpath_var
1292 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1296 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1297 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1299 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1300 if test "X$output_objdir" = "X$output"; then
1301 output_objdir="$objdir"
1303 output_objdir="$output_objdir/$objdir"
1305 # Create the object directory.
1306 if test ! -d $output_objdir; then
1307 $show "$mkdir $output_objdir"
1308 $run $mkdir $output_objdir
1310 if test $status -ne 0 && test ! -d $output_objdir; then
1315 # Determine the type of output
1318 $echo "$modename: you must specify an output file" 1>&2
1322 *.$libext) linkmode=oldlib ;;
1323 *.lo | *.$objext) linkmode=obj ;;
1324 *.la) linkmode=lib ;;
1325 *) linkmode=prog ;; # Anything else should be a program.
1330 # Find all interdependent deplibs by searching for libraries
1331 # that are linked more than once (e.g. -la -lb -la)
1332 for deplib in $deplibs; do
1334 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1336 libs="$libs $deplib"
1341 need_relink=no # whether we're linking any uninstalled libtool libraries
1342 notinst_deplibs= # not-installed libtool libraries
1343 notinst_path= # paths that contain not-installed libtool libraries
1347 for file in $dlfiles $dlprefiles; do
1351 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1363 passes="conv scan dlopen dlpreopen link"
1368 for pass in $passes; do
1369 if test $linkmode = prog; then
1370 # Determine which files to process
1374 save_deplibs="$deplibs" # Collect dlpreopened libraries
1377 dlpreopen) libs="$dlprefiles" ;;
1378 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1381 for deplib in $libs; do
1386 if test $linkmode = oldlib && test $linkmode = obj; then
1387 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1390 if test $pass = conv; then
1391 deplibs="$deplib $deplibs"
1394 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1395 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1396 # Search the libtool library
1397 lib="$searchdir/lib${name}.la"
1398 if test -f "$lib"; then
1403 if test "$found" != yes; then
1404 # deplib doesn't seem to be a libtool library
1405 if test "$linkmode,$pass" = "prog,link"; then
1406 compile_deplibs="$deplib $compile_deplibs"
1407 finalize_deplibs="$deplib $finalize_deplibs"
1409 deplibs="$deplib $deplibs"
1410 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1418 deplibs="$deplib $deplibs"
1419 test $pass = conv && continue
1420 newdependency_libs="$deplib $newdependency_libs"
1421 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1424 if test $pass = conv; then
1425 deplibs="$deplib $deplibs"
1428 if test $pass = scan; then
1429 deplibs="$deplib $deplibs"
1430 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1432 compile_deplibs="$deplib $compile_deplibs"
1433 finalize_deplibs="$deplib $finalize_deplibs"
1437 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1443 if test $pass = link; then
1444 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1445 # Make sure the xrpath contains only unique directories.
1448 *) xrpath="$xrpath $dir" ;;
1451 deplibs="$deplib $deplibs"
1454 *.la) lib="$deplib" ;;
1456 if test $pass = conv; then
1457 deplibs="$deplib $deplibs"
1462 if test "$deplibs_check_method" != pass_all; then
1464 echo "*** Warning: This library needs some functionality provided by $deplib."
1465 echo "*** I have the capability to make that library automatically link in when"
1466 echo "*** you link to this library. But I can only do this if you have a"
1467 echo "*** shared version of the library, which you do not appear to have."
1470 echo "*** Warning: Linking the shared library $output against the"
1471 echo "*** static library $deplib is not portable!"
1472 deplibs="$deplib $deplibs"
1477 if test $pass != link; then
1478 deplibs="$deplib $deplibs"
1480 compile_deplibs="$deplib $compile_deplibs"
1481 finalize_deplibs="$deplib $finalize_deplibs"
1488 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1489 # If there is no dlopen support or we're linking statically,
1490 # we need to preload.
1491 newdlprefiles="$newdlprefiles $deplib"
1492 compile_deplibs="$deplib $compile_deplibs"
1493 finalize_deplibs="$deplib $finalize_deplibs"
1495 newdlfiles="$newdlfiles $deplib"
1504 if test $found = yes || test -f "$lib"; then :
1506 $echo "$modename: cannot find the library \`$lib'" 1>&2
1510 # Check to see that this really is a libtool archive.
1511 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1513 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1517 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1518 test "X$ladir" = "X$lib" && ladir="."
1526 # If the library was installed with an old release of libtool,
1527 # it will not redefine variable installed.
1532 */* | *\\*) . $lib ;;
1536 if test "$linkmode,$pass" = "lib,link" ||
1537 test "$linkmode,$pass" = "prog,scan" ||
1538 { test $linkmode = oldlib && test $linkmode = obj; }; then
1539 # Add dl[pre]opened files of deplib
1540 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1541 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1544 if test $pass = conv; then
1545 # Only check for convenience libraries
1546 deplibs="$lib $deplibs"
1547 if test -z "$libdir"; then
1548 if test -z "$old_library"; then
1549 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1552 # It is a libtool convenience library, so add in its objects.
1553 convenience="$convenience $ladir/$objdir/$old_library"
1554 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1556 for deplib in $dependency_libs; do
1557 deplibs="$deplib $deplibs"
1558 case "$tmp_libs " in
1559 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1561 tmp_libs="$tmp_libs $deplib"
1563 elif test $linkmode != prog && test $linkmode != lib; then
1564 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1570 # Get the name of the library we link against.
1572 for l in $old_library $library_names; do
1575 if test -z "$linklib"; then
1576 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1580 # This library was specified with -dlopen.
1581 if test $pass = dlopen; then
1582 if test -z "$libdir"; then
1583 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1586 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1587 # If there is no dlname, no dlopen support or we're linking
1588 # statically, we need to preload.
1589 dlprefiles="$dlprefiles $lib"
1591 newdlfiles="$newdlfiles $lib"
1596 # We need an absolute path.
1598 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1600 abs_ladir=`cd "$ladir" && pwd`
1601 if test -z "$abs_ladir"; then
1602 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1603 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1608 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1610 # Find the relevant object directory and library name.
1611 if test "X$installed" = Xyes; then
1612 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1613 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1622 dir="$ladir/$objdir"
1623 absdir="$abs_ladir/$objdir"
1624 # Remove this search path later
1625 notinst_path="$notinst_path $abs_ladir"
1626 fi # $installed = yes
1627 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1629 # This library was specified with -dlpreopen.
1630 if test $pass = dlpreopen; then
1631 if test -z "$libdir"; then
1632 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1635 # Prefer using a static library (so that no silly _DYNAMIC symbols
1636 # are required to link).
1637 if test -n "$old_library"; then
1638 newdlprefiles="$newdlprefiles $dir/$old_library"
1639 # Otherwise, use the dlname, so that lt_dlopen finds it.
1640 elif test -n "$dlname"; then
1641 newdlprefiles="$newdlprefiles $dir/$dlname"
1643 newdlprefiles="$newdlprefiles $dir/$linklib"
1645 fi # $pass = dlpreopen
1647 if test -z "$libdir"; then
1648 # Link the convenience library
1649 if test $linkmode = lib; then
1650 deplibs="$dir/$old_library $deplibs"
1651 elif test "$linkmode,$pass" = "prog,link"; then
1652 compile_deplibs="$dir/$old_library $compile_deplibs"
1653 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1655 deplibs="$lib $deplibs"
1660 if test $linkmode = prog && test $pass != link; then
1661 newlib_search_path="$newlib_search_path $ladir"
1662 deplibs="$lib $deplibs"
1665 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1666 test "$build_libtool_libs" = no; then
1671 for deplib in $dependency_libs; do
1673 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1675 # Need to link against all dependency_libs?
1676 if test $linkalldeplibs = yes; then
1677 deplibs="$deplib $deplibs"
1679 # Need to hardcode shared library paths
1680 # or/and link against static libraries
1681 newdependency_libs="$deplib $newdependency_libs"
1683 case "$tmp_libs " in
1684 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1686 tmp_libs="$tmp_libs $deplib"
1689 fi # $linkmode = prog...
1691 link_static=no # Whether the deplib will be linked statically
1692 if test -n "$library_names" &&
1693 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1694 # Link against this shared library
1696 if test "$linkmode,$pass" = "prog,link" ||
1697 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1698 # Hardcode the library path.
1699 # Skip directories that are in the system default run-time
1701 case " $sys_lib_dlsearch_path " in
1704 case "$compile_rpath " in
1706 *) compile_rpath="$compile_rpath $absdir"
1710 case " $sys_lib_dlsearch_path " in
1713 case "$finalize_rpath " in
1715 *) finalize_rpath="$finalize_rpath $libdir"
1719 if test $linkmode = prog; then
1720 # We need to hardcode the library path
1721 if test -n "$shlibpath_var"; then
1722 # Make sure the rpath contains only unique directories.
1723 case "$temp_rpath " in
1726 *) temp_rpath="$temp_rpath $dir" ;;
1730 fi # $linkmode,$pass = prog,link...
1732 if test "$alldeplibs" = yes &&
1733 { test "$deplibs_check_method" = pass_all ||
1734 { test "$build_libtool_libs" = yes &&
1735 test -n "$library_names"; }; }; then
1736 # We only need to search for static libraries
1740 if test "$installed" = no; then
1741 notinst_deplibs="$notinst_deplibs $lib"
1745 if test -n "$old_archive_from_expsyms_cmds"; then
1746 # figure out the soname
1747 set dummy $library_names
1750 libname=`eval \\$echo \"$libname_spec\"`
1751 # use dlname if we got it. it's perfectly good, no?
1752 if test -n "$dlname"; then
1754 elif test -n "$soname_spec"; then
1758 major=`expr $current - $age`
1762 eval soname=\"$soname_spec\"
1767 # Make a new name for the extract_expsyms_cmds to use
1769 soname=`echo $soroot | sed -e 's/^.*\///'`
1770 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1772 # If the library has no export list, then create one now
1773 if test -f "$output_objdir/$soname-def"; then :
1775 $show "extracting exported symbol list from \`$soname'"
1776 save_ifs="$IFS"; IFS='~'
1777 eval cmds=\"$extract_expsyms_cmds\"
1778 for cmd in $cmds; do
1781 $run eval "$cmd" || exit $?
1787 if test -f "$output_objdir/$newlib"; then :; else
1788 $show "generating import library for \`$soname'"
1789 save_ifs="$IFS"; IFS='~'
1790 eval cmds=\"$old_archive_from_expsyms_cmds\"
1791 for cmd in $cmds; do
1794 $run eval "$cmd" || exit $?
1798 # make sure the library variables are pointing to the new library
1801 fi # test -n $old_archive_from_expsyms_cmds
1803 if test $linkmode = prog || test "$mode" != relink; then
1808 case $hardcode_action in
1809 immediate | unsupported)
1810 if test "$hardcode_direct" = no; then
1812 elif test "$hardcode_minus_L" = no; then
1814 *-*-sunos*) add_shlibpath="$dir" ;;
1818 elif test "$hardcode_shlibpath_var" = no; then
1819 add_shlibpath="$dir"
1826 if test "$hardcode_direct" = yes; then
1828 elif test "$hardcode_minus_L" = yes; then
1831 elif test "$hardcode_shlibpath_var" = yes; then
1832 add_shlibpath="$dir"
1841 if test "$lib_linked" != yes; then
1842 $echo "$modename: configuration error: unsupported hardcode properties"
1846 if test -n "$add_shlibpath"; then
1847 case :$compile_shlibpath: in
1848 *":$add_shlibpath:"*) ;;
1849 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1852 if test $linkmode = prog; then
1853 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1854 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1856 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1857 test -n "$add" && deplibs="$add $deplibs"
1858 if test "$hardcode_direct" != yes && \
1859 test "$hardcode_minus_L" != yes && \
1860 test "$hardcode_shlibpath_var" = yes; then
1861 case :$finalize_shlibpath: in
1863 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1869 if test $linkmode = prog || test "$mode" = relink; then
1873 # Finalize command for both is simple: just hardcode it.
1874 if test "$hardcode_direct" = yes; then
1875 add="$libdir/$linklib"
1876 elif test "$hardcode_minus_L" = yes; then
1879 elif test "$hardcode_shlibpath_var" = yes; then
1880 case :$finalize_shlibpath: in
1882 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1886 # We cannot seem to hardcode it, guess we'll fake it.
1887 if test "X$installed" = Xyes; then
1890 add_dir="-L$DESTDIR$libdir"
1895 if test $linkmode = prog; then
1896 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1897 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1899 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1900 test -n "$add" && deplibs="$add $deplibs"
1903 elif test $linkmode = prog; then
1904 if test "$alldeplibs" = yes &&
1905 { test "$deplibs_check_method" = pass_all ||
1906 { test "$build_libtool_libs" = yes &&
1907 test -n "$library_names"; }; }; then
1908 # We only need to search for static libraries
1912 # Try to link the static library
1913 # Here we assume that one of hardcode_direct or hardcode_minus_L
1914 # is not unsupported. This is valid on all known static and
1916 if test "$hardcode_direct" != unsupported; then
1917 test -n "$old_library" && linklib="$old_library"
1918 compile_deplibs="$dir/$linklib $compile_deplibs"
1919 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1921 compile_deplibs="-l$name -L$dir $compile_deplibs"
1922 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1924 elif test "$build_libtool_libs" = yes; then
1925 # Not a shared library
1926 if test "$deplibs_check_method" != pass_all; then
1927 # We're trying link a shared library against a static one
1928 # but the system doesn't support it.
1930 # Just print a warning and add the library to dependency_libs so
1931 # that the program can be linked against the static library.
1933 echo "*** Warning: This library needs some functionality provided by $lib."
1934 echo "*** I have the capability to make that library automatically link in when"
1935 echo "*** you link to this library. But I can only do this if you have a"
1936 echo "*** shared version of the library, which you do not appear to have."
1937 if test "$module" = yes; then
1938 echo "*** Therefore, libtool will create a static module, that should work "
1939 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1940 if test -z "$global_symbol_pipe"; then
1942 echo "*** However, this would only work if libtool was able to extract symbol"
1943 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1944 echo "*** not find such a program. So, this module is probably useless."
1945 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1947 if test "$build_old_libs" = no; then
1948 build_libtool_libs=module
1951 build_libtool_libs=no
1955 convenience="$convenience $dir/$old_library"
1956 old_convenience="$old_convenience $dir/$old_library"
1957 deplibs="$dir/$old_library $deplibs"
1960 fi # link shared/static library?
1962 if test $linkmode = lib; then
1963 if test -n "$dependency_libs" &&
1964 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1965 test $link_static = yes; }; then
1966 # Extract -R from dependency_libs
1968 for libdir in $dependency_libs; do
1970 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1972 *" $temp_xrpath "*) ;;
1973 *) xrpath="$xrpath $temp_xrpath";;
1975 *) temp_deplibs="$temp_deplibs $libdir";;
1978 dependency_libs="$temp_deplibs"
1981 newlib_search_path="$newlib_search_path $absdir"
1982 # Link against this library
1983 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1984 # ... and its dependency_libs
1986 for deplib in $dependency_libs; do
1987 newdependency_libs="$deplib $newdependency_libs"
1988 case "$tmp_libs " in
1989 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1991 tmp_libs="$tmp_libs $deplib"
1994 if test $link_all_deplibs != no; then
1995 # Add the search paths of all dependency libraries
1996 for deplib in $dependency_libs; do
1998 -L*) path="$deplib" ;;
2000 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2001 test "X$dir" = "X$deplib" && dir="."
2002 # We need an absolute path.
2004 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2006 absdir=`cd "$dir" && pwd`
2007 if test -z "$absdir"; then
2008 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2013 if grep "^installed=no" $deplib > /dev/null; then
2014 path="-L$absdir/$objdir"
2016 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2017 if test -z "$libdir"; then
2018 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2021 if test "$absdir" != "$libdir"; then
2022 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2029 case " $deplibs " in
2031 *) deplibs="$deplibs $path" ;;
2034 fi # link_all_deplibs != no
2036 done # for deplib in $libs
2037 if test $pass = dlpreopen; then
2038 # Link the dlpreopened libraries before other libraries
2039 for deplib in $save_deplibs; do
2040 deplibs="$deplib $deplibs"
2043 if test $pass != dlopen; then
2044 test $pass != scan && dependency_libs="$newdependency_libs"
2045 if test $pass != conv; then
2046 # Make sure lib_search_path contains only unique directories.
2048 for dir in $newlib_search_path; do
2049 case "$lib_search_path " in
2051 *) lib_search_path="$lib_search_path $dir" ;;
2057 if test "$linkmode,$pass" != "prog,link"; then
2060 vars="compile_deplibs finalize_deplibs"
2062 for var in $vars dependency_libs; do
2063 # Add libraries to $var in reverse order
2064 eval tmp_libs=\"\$$var\"
2066 for deplib in $tmp_libs; do
2068 -L*) new_libs="$deplib $new_libs" ;;
2070 case " $specialdeplibs " in
2071 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2073 case " $new_libs " in
2075 *) new_libs="$deplib $new_libs" ;;
2083 for deplib in $new_libs; do
2086 case " $tmp_libs " in
2088 *) tmp_libs="$tmp_libs $deplib" ;;
2091 *) tmp_libs="$tmp_libs $deplib" ;;
2094 eval $var=\"$tmp_libs\"
2097 if test "$pass" = "conv" &&
2098 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2099 libs="$deplibs" # reset libs
2103 if test $linkmode = prog; then
2104 dlfiles="$newdlfiles"
2105 dlprefiles="$newdlprefiles"
2110 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2111 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2114 if test -n "$rpath"; then
2115 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2118 if test -n "$xrpath"; then
2119 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2122 if test -n "$vinfo"; then
2123 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2126 if test -n "$release"; then
2127 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2130 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2131 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2134 # Now set the variables for building old libraries.
2135 build_libtool_libs=no
2137 objs="$objs$old_deplibs"
2141 # Make sure we only generate libraries of the form `libNAME.la'.
2144 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2145 eval libname=\"$libname_spec\"
2148 if test "$module" = no; then
2149 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2153 if test "$need_lib_prefix" != no; then
2154 # Add the "lib" prefix for modules if required
2155 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2156 eval libname=\"$libname_spec\"
2158 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2163 if test -n "$objs"; then
2164 if test "$deplibs_check_method" != pass_all; then
2165 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2169 echo "*** Warning: Linking the shared library $output against the non-libtool"
2170 echo "*** objects $objs is not portable!"
2171 libobjs="$libobjs $objs"
2175 if test "$dlself" != no; then
2176 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2180 if test $# -gt 2; then
2181 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2186 if test -z "$rpath"; then
2187 if test "$build_libtool_libs" = yes; then
2188 # Building a libtool convenience library.
2190 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2191 build_libtool_libs=convenience
2195 if test -n "$vinfo"; then
2196 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2199 if test -n "$release"; then
2200 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2204 # Parse the version information argument.
2205 save_ifs="$IFS"; IFS=':'
2206 set dummy $vinfo 0 0 0
2209 if test -n "$8"; then
2210 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2219 # Check that each of the things are valid numbers.
2221 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2223 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2224 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2230 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2232 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2233 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2239 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2241 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2242 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2247 if test $age -gt $current; then
2248 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2249 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2253 # Calculate the version variables.
2257 case $version_type in
2261 # Like Linux, but with the current version available in
2262 # verstring for coding it into the library header
2263 major=.`expr $current - $age`
2264 versuffix="$major.$age.$revision"
2265 # Darwin ld doesn't like 0 for these options...
2266 minor_current=`expr $current + 1`
2267 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2272 versuffix=".$current.$revision";
2277 versuffix=".$current";
2281 major=`expr $current - $age + 1`
2282 verstring="sgi$major.$revision"
2284 # Add in all the interfaces that we are compatible with.
2286 while test $loop != 0; do
2287 iface=`expr $revision - $loop`
2288 loop=`expr $loop - 1`
2289 verstring="sgi$major.$iface:$verstring"
2292 # Before this point, $major must not contain `.'.
2294 versuffix="$major.$revision"
2298 major=.`expr $current - $age`
2299 versuffix="$major.$age.$revision"
2303 major=`expr $current - $age`
2304 versuffix=".$current.$age.$revision"
2305 verstring="$current.$age.$revision"
2307 # Add in all the interfaces that we are compatible with.
2309 while test $loop != 0; do
2310 iface=`expr $current - $loop`
2311 loop=`expr $loop - 1`
2312 verstring="$verstring:${iface}.0"
2315 # Make executables depend on our current version.
2316 verstring="$verstring:${current}.0"
2321 versuffix=".$current.$revision"
2325 # Use '-' rather than '.', since we only want one
2326 # extension on DOS 8.3 filesystems.
2327 major=`expr $current - $age`
2332 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2333 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2338 # Clear the version info if we defaulted, and they specified a release.
2339 if test -z "$vinfo" && test -n "$release"; then
2342 case $version_type in
2344 # we can't check for "0.0" in archive_cmds due to quoting
2345 # problems, so we reset it completely
2352 if test "$need_version" = no; then
2359 # Remove version info from name if versioning should be avoided
2360 if test "$avoid_version" = yes && test "$need_version" = no; then
2366 # Check to see if the archive will have undefined symbols.
2367 if test "$allow_undefined" = yes; then
2368 if test "$allow_undefined_flag" = unsupported; then
2369 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2370 build_libtool_libs=no
2374 # Don't allow undefined symbols.
2375 allow_undefined_flag="$no_undefined_flag"
2379 if test "$mode" != relink; then
2380 # Remove our outputs.
2381 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2382 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2385 # Now set the variables for building old libraries.
2386 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2387 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2389 # Transform .lo files to .o files.
2390 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2393 # Eliminate all temporary directories.
2394 for path in $notinst_path; do
2395 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2396 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2397 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2400 if test -n "$xrpath"; then
2401 # If the user specified any rpath flags, then add them.
2403 for libdir in $xrpath; do
2404 temp_xrpath="$temp_xrpath -R$libdir"
2405 case "$finalize_rpath " in
2407 *) finalize_rpath="$finalize_rpath $libdir" ;;
2410 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2411 dependency_libs="$temp_xrpath $dependency_libs"
2415 # Make sure dlfiles contains only unique files that won't be dlpreopened
2416 old_dlfiles="$dlfiles"
2418 for lib in $old_dlfiles; do
2419 case " $dlprefiles $dlfiles " in
2421 *) dlfiles="$dlfiles $lib" ;;
2425 # Make sure dlprefiles contains only unique files
2426 old_dlprefiles="$dlprefiles"
2428 for lib in $old_dlprefiles; do
2429 case "$dlprefiles " in
2431 *) dlprefiles="$dlprefiles $lib" ;;
2435 if test "$build_libtool_libs" = yes; then
2436 if test -n "$rpath"; then
2438 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2439 # these systems don't actually have a c library (as such)!
2441 *-*-rhapsody* | *-*-darwin1.[012])
2442 # Rhapsody C library is in the System framework
2443 deplibs="$deplibs -framework System"
2446 # Don't link with libc until the a.out ld.so is fixed.
2449 # Do not include libc due to us having libc/libc_r.
2452 # Add libc to deplibs on all other systems if necessary.
2453 if test $build_libtool_need_lc = "yes"; then
2454 deplibs="$deplibs -lc"
2460 # Transform deplibs into only deplibs that can be linked in shared.
2462 libname_save=$libname
2463 release_save=$release
2464 versuffix_save=$versuffix
2466 # I'm not sure if I'm treating the release correctly. I think
2467 # release should show up in the -l (ie -lgmp5) so we don't want to
2468 # add it in twice. Is that correct?
2474 case $deplibs_check_method in
2476 # Don't check for shared/static. Everything works.
2477 # This might be a little naive. We might want to check
2478 # whether the library exists or not. But this is on
2479 # osf3 & osf4 and I'm not really sure... Just
2480 # implementing what was already the behaviour.
2484 # This code stresses the "libraries are programs" paradigm to its
2485 # limits. Maybe even breaks it. We compile a program, linking it
2486 # against the deplibs as a proxy for the library. Then we can check
2487 # whether they linked in statically or dynamically with ldd.
2489 cat > conftest.c <<EOF
2490 int main() { return 0; }
2493 $CC -o conftest conftest.c $deplibs
2494 if test $? -eq 0 ; then
2495 ldd_output=`ldd conftest`
2496 for i in $deplibs; do
2497 name="`expr $i : '-l\(.*\)'`"
2498 # If $name is empty we are operating on a -L argument.
2499 if test -n "$name" && test "$name" != "0"; then
2500 libname=`eval \\$echo \"$libname_spec\"`
2501 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2502 set dummy $deplib_matches
2504 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2505 newdeplibs="$newdeplibs $i"
2509 echo "*** Warning: This library needs some functionality provided by $i."
2510 echo "*** I have the capability to make that library automatically link in when"
2511 echo "*** you link to this library. But I can only do this if you have a"
2512 echo "*** shared version of the library, which you do not appear to have."
2515 newdeplibs="$newdeplibs $i"
2519 # Error occured in the first compile. Let's try to salvage the situation:
2520 # Compile a seperate program for each library.
2521 for i in $deplibs; do
2522 name="`expr $i : '-l\(.*\)'`"
2523 # If $name is empty we are operating on a -L argument.
2524 if test -n "$name" && test "$name" != "0"; then
2526 $CC -o conftest conftest.c $i
2528 if test $? -eq 0 ; then
2529 ldd_output=`ldd conftest`
2530 libname=`eval \\$echo \"$libname_spec\"`
2531 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2532 set dummy $deplib_matches
2534 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2535 newdeplibs="$newdeplibs $i"
2539 echo "*** Warning: This library needs some functionality provided by $i."
2540 echo "*** I have the capability to make that library automatically link in when"
2541 echo "*** you link to this library. But I can only do this if you have a"
2542 echo "*** shared version of the library, which you do not appear to have."
2547 echo "*** Warning! Library $i is needed by this library but I was not able to"
2548 echo "*** make it link in! You will probably need to install it or some"
2549 echo "*** library that it depends on before this library will be fully"
2550 echo "*** functional. Installing it before continuing would be even better."
2553 newdeplibs="$newdeplibs $i"
2559 set dummy $deplibs_check_method
2560 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2561 for a_deplib in $deplibs; do
2562 name="`expr $a_deplib : '-l\(.*\)'`"
2563 # If $name is empty we are operating on a -L argument.
2564 if test -n "$name" && test "$name" != "0"; then
2565 libname=`eval \\$echo \"$libname_spec\"`
2566 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2567 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2568 for potent_lib in $potential_libs; do
2569 # Follow soft links.
2570 if ls -lLd "$potent_lib" 2>/dev/null \
2571 | grep " -> " >/dev/null; then
2574 # The statement above tries to avoid entering an
2575 # endless loop below, in case of cyclic links.
2576 # We might still enter an endless loop, since a link
2577 # loop can be closed while we follow links,
2579 potlib="$potent_lib"
2580 while test -h "$potlib" 2>/dev/null; do
2581 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2583 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2584 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2587 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2589 | egrep "$file_magic_regex" > /dev/null; then
2590 newdeplibs="$newdeplibs $a_deplib"
2596 if test -n "$a_deplib" ; then
2599 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2600 echo "*** I have the capability to make that library automatically link in when"
2601 echo "*** you link to this library. But I can only do this if you have a"
2602 echo "*** shared version of the library, which you do not appear to have."
2605 # Add a -L argument.
2606 newdeplibs="$newdeplibs $a_deplib"
2608 done # Gone through all deplibs.
2611 set dummy $deplibs_check_method
2612 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2613 for a_deplib in $deplibs; do
2614 name="`expr $a_deplib : '-l\(.*\)'`"
2615 # If $name is empty we are operating on a -L argument.
2616 if test -n "$name" && test "$name" != "0"; then
2617 libname=`eval \\$echo \"$libname_spec\"`
2618 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2619 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2620 for potent_lib in $potential_libs; do
2621 if eval echo \"$potent_lib\" 2>/dev/null \
2623 | egrep "$match_pattern_regex" > /dev/null; then
2624 newdeplibs="$newdeplibs $a_deplib"
2630 if test -n "$a_deplib" ; then
2633 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2634 echo "*** I have the capability to make that library automatically link in when"
2635 echo "*** you link to this library. But I can only do this if you have a"
2636 echo "*** shared version of the library, which you do not appear to have."
2639 # Add a -L argument.
2640 newdeplibs="$newdeplibs $a_deplib"
2642 done # Gone through all deplibs.
2646 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2647 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2648 grep . >/dev/null; then
2650 if test "X$deplibs_check_method" = "Xnone"; then
2651 echo "*** Warning: inter-library dependencies are not supported in this platform."
2653 echo "*** Warning: inter-library dependencies are not known to be supported."
2655 echo "*** All declared inter-library dependencies are being dropped."
2660 versuffix=$versuffix_save
2662 release=$release_save
2663 libname=$libname_save
2667 *-*-rhapsody* | *-*-darwin1.[012])
2668 # On Rhapsody replace the C library is the System framework
2669 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2673 if test "$droppeddeps" = yes; then
2674 if test "$module" = yes; then
2676 echo "*** Warning: libtool could not satisfy all declared inter-library"
2677 echo "*** dependencies of module $libname. Therefore, libtool will create"
2678 echo "*** a static module, that should work as long as the dlopening"
2679 echo "*** application is linked with the -dlopen flag."
2680 if test -z "$global_symbol_pipe"; then
2682 echo "*** However, this would only work if libtool was able to extract symbol"
2683 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2684 echo "*** not find such a program. So, this module is probably useless."
2685 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2687 if test "$build_old_libs" = no; then
2688 oldlibs="$output_objdir/$libname.$libext"
2689 build_libtool_libs=module
2692 build_libtool_libs=no
2695 echo "*** The inter-library dependencies that have been dropped here will be"
2696 echo "*** automatically added whenever a program is linked with this library"
2697 echo "*** or is declared to -dlopen it."
2699 if test $allow_undefined = no; then
2701 echo "*** Since this library must not contain undefined symbols,"
2702 echo "*** because either the platform does not support them or"
2703 echo "*** it was explicitly requested with -no-undefined,"
2704 echo "*** libtool will only create a static version of it."
2705 if test "$build_old_libs" = no; then
2706 oldlibs="$output_objdir/$libname.$libext"
2707 build_libtool_libs=module
2710 build_libtool_libs=no
2715 # Done checking deplibs!
2719 # All the library-specific variables (install_libdir is set above).
2724 # Test again, we may have decided not to build it any more
2725 if test "$build_libtool_libs" = yes; then
2726 if test $hardcode_into_libs = yes; then
2727 # Hardcode the library paths
2730 rpath="$finalize_rpath"
2731 test "$mode" != relink && rpath="$compile_rpath$rpath"
2732 for libdir in $rpath; do
2733 if test -n "$hardcode_libdir_flag_spec"; then
2734 if test -n "$hardcode_libdir_separator"; then
2735 if test -z "$hardcode_libdirs"; then
2736 hardcode_libdirs="$libdir"
2738 # Just accumulate the unique libdirs.
2739 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2740 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2743 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2748 eval flag=\"$hardcode_libdir_flag_spec\"
2749 dep_rpath="$dep_rpath $flag"
2751 elif test -n "$runpath_var"; then
2752 case "$perm_rpath " in
2754 *) perm_rpath="$perm_rpath $libdir" ;;
2758 # Substitute the hardcoded libdirs into the rpath.
2759 if test -n "$hardcode_libdir_separator" &&
2760 test -n "$hardcode_libdirs"; then
2761 libdir="$hardcode_libdirs"
2762 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2764 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2765 # We should set the runpath_var.
2767 for dir in $perm_rpath; do
2770 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2772 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2775 shlibpath="$finalize_shlibpath"
2776 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2777 if test -n "$shlibpath"; then
2778 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2781 # Get the real and link names of the library.
2782 eval library_names=\"$library_names_spec\"
2783 set dummy $library_names
2787 if test -n "$soname_spec"; then
2788 eval soname=\"$soname_spec\"
2792 test -z "$dlname" && dlname=$soname
2794 lib="$output_objdir/$realname"
2797 linknames="$linknames $link"
2800 # Ensure that we have .o objects for linkers which dislike .lo
2801 # (e.g. aix) in case we are running --disable-static
2802 for obj in $libobjs; do
2803 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2804 if test "X$xdir" = "X$obj"; then
2809 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2810 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2811 if test ! -f $xdir/$oldobj; then
2812 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2813 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2817 # Use standard objects if they are pic
2818 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2820 # Prepare the list of exported symbols
2821 if test -z "$export_symbols"; then
2822 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2823 $show "generating symbol list for \`$libname.la'"
2824 export_symbols="$output_objdir/$libname.exp"
2825 $run $rm $export_symbols
2826 eval cmds=\"$export_symbols_cmds\"
2827 save_ifs="$IFS"; IFS='~'
2828 for cmd in $cmds; do
2831 $run eval "$cmd" || exit $?
2834 if test -n "$export_symbols_regex"; then
2835 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2836 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2837 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2838 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2843 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2844 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2847 if test -n "$convenience"; then
2848 if test -n "$whole_archive_flag_spec"; then
2849 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2851 gentop="$output_objdir/${outputname}x"
2852 $show "${rm}r $gentop"
2853 $run ${rm}r "$gentop"
2854 $show "mkdir $gentop"
2855 $run mkdir "$gentop"
2857 if test $status -ne 0 && test ! -d "$gentop"; then
2860 generated="$generated $gentop"
2862 for xlib in $convenience; do
2863 # Extract the objects.
2865 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2866 *) xabs=`pwd`"/$xlib" ;;
2868 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2869 xdir="$gentop/$xlib"
2871 $show "${rm}r $xdir"
2876 if test $status -ne 0 && test ! -d "$xdir"; then
2879 $show "(cd $xdir && $AR x $xabs)"
2880 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2882 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2887 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2888 eval flag=\"$thread_safe_flag_spec\"
2889 linker_flags="$linker_flags $flag"
2892 # Make a backup of the uninstalled library when relinking
2893 if test "$mode" = relink; then
2894 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2897 # Do each of the archive commands.
2898 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2899 eval cmds=\"$archive_expsym_cmds\"
2901 eval cmds=\"$archive_cmds\"
2903 save_ifs="$IFS"; IFS='~'
2904 for cmd in $cmds; do
2907 $run eval "$cmd" || exit $?
2911 # Restore the uninstalled library and exit
2912 if test "$mode" = relink; then
2913 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2917 # Create links to the real library.
2918 for linkname in $linknames; do
2919 if test "$realname" != "$linkname"; then
2920 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2921 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2925 # If -module or -export-dynamic was specified, set the dlname.
2926 if test "$module" = yes || test "$export_dynamic" = yes; then
2927 # On all known operating systems, these are identical.
2934 if test -n "$deplibs"; then
2935 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2938 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2939 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2942 if test -n "$rpath"; then
2943 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2946 if test -n "$xrpath"; then
2947 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2950 if test -n "$vinfo"; then
2951 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2954 if test -n "$release"; then
2955 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2960 if test -n "$objs$old_deplibs"; then
2961 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2965 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2973 # Delete the old objects.
2974 $run $rm $obj $libobj
2976 # Objects from convenience libraries. This assumes
2977 # single-version convenience libraries. Whenever we create
2978 # different ones for PIC/non-PIC, this we'll have to duplicate
2982 # reload_cmds runs $LD directly, so let us get rid of
2983 # -Wl from whole_archive_flag_spec
2986 if test -n "$convenience"; then
2987 if test -n "$whole_archive_flag_spec"; then
2988 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
2990 gentop="$output_objdir/${obj}x"
2991 $show "${rm}r $gentop"
2992 $run ${rm}r "$gentop"
2993 $show "mkdir $gentop"
2994 $run mkdir "$gentop"
2996 if test $status -ne 0 && test ! -d "$gentop"; then
2999 generated="$generated $gentop"
3001 for xlib in $convenience; do
3002 # Extract the objects.
3004 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3005 *) xabs=`pwd`"/$xlib" ;;
3007 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3008 xdir="$gentop/$xlib"
3010 $show "${rm}r $xdir"
3015 if test $status -ne 0 && test ! -d "$xdir"; then
3018 $show "(cd $xdir && $AR x $xabs)"
3019 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3021 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3026 # Create the old-style object.
3027 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
3030 eval cmds=\"$reload_cmds\"
3031 save_ifs="$IFS"; IFS='~'
3032 for cmd in $cmds; do
3035 $run eval "$cmd" || exit $?
3039 # Exit if we aren't doing a library object file.
3040 if test -z "$libobj"; then
3041 if test -n "$gentop"; then
3042 $show "${rm}r $gentop"
3049 if test "$build_libtool_libs" != yes; then
3050 if test -n "$gentop"; then
3051 $show "${rm}r $gentop"
3055 # Create an invalid libtool object if no PIC, so that we don't
3056 # accidentally link it into a program.
3057 $show "echo timestamp > $libobj"
3058 $run eval "echo timestamp > $libobj" || exit $?
3062 if test -n "$pic_flag" || test "$pic_mode" != default; then
3063 # Only do commands if we really have different PIC objects.
3064 reload_objs="$libobjs $reload_conv_objs"
3066 eval cmds=\"$reload_cmds\"
3067 save_ifs="$IFS"; IFS='~'
3068 for cmd in $cmds; do
3071 $run eval "$cmd" || exit $?
3075 # Just create a symlink.
3078 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3079 if test "X$xdir" = "X$libobj"; then
3084 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3085 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3086 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3087 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3090 if test -n "$gentop"; then
3091 $show "${rm}r $gentop"
3100 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3102 if test -n "$vinfo"; then
3103 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3106 if test -n "$release"; then
3107 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3110 if test "$preload" = yes; then
3111 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3112 test "$dlopen_self_static" = unknown; then
3113 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3118 *-*-rhapsody* | *-*-darwin1.[012])
3119 # On Rhapsody replace the C library is the System framework
3120 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3121 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3125 compile_command="$compile_command $compile_deplibs"
3126 finalize_command="$finalize_command $finalize_deplibs"
3128 if test -n "$rpath$xrpath"; then
3129 # If the user specified any rpath flags, then add them.
3130 for libdir in $rpath $xrpath; do
3131 # This is the magic to use -rpath.
3132 case "$finalize_rpath " in
3134 *) finalize_rpath="$finalize_rpath $libdir" ;;
3139 # Now hardcode the library paths
3142 for libdir in $compile_rpath $finalize_rpath; do
3143 if test -n "$hardcode_libdir_flag_spec"; then
3144 if test -n "$hardcode_libdir_separator"; then
3145 if test -z "$hardcode_libdirs"; then
3146 hardcode_libdirs="$libdir"
3148 # Just accumulate the unique libdirs.
3149 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3150 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3153 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3158 eval flag=\"$hardcode_libdir_flag_spec\"
3159 rpath="$rpath $flag"
3161 elif test -n "$runpath_var"; then
3162 case "$perm_rpath " in
3164 *) perm_rpath="$perm_rpath $libdir" ;;
3168 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3169 case :$dllsearchpath: in
3171 *) dllsearchpath="$dllsearchpath:$libdir";;
3176 # Substitute the hardcoded libdirs into the rpath.
3177 if test -n "$hardcode_libdir_separator" &&
3178 test -n "$hardcode_libdirs"; then
3179 libdir="$hardcode_libdirs"
3180 eval rpath=\" $hardcode_libdir_flag_spec\"
3182 compile_rpath="$rpath"
3186 for libdir in $finalize_rpath; do
3187 if test -n "$hardcode_libdir_flag_spec"; then
3188 if test -n "$hardcode_libdir_separator"; then
3189 if test -z "$hardcode_libdirs"; then
3190 hardcode_libdirs="$libdir"
3192 # Just accumulate the unique libdirs.
3193 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3194 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3197 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3202 eval flag=\"$hardcode_libdir_flag_spec\"
3203 rpath="$rpath $flag"
3205 elif test -n "$runpath_var"; then
3206 case "$finalize_perm_rpath " in
3208 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3212 # Substitute the hardcoded libdirs into the rpath.
3213 if test -n "$hardcode_libdir_separator" &&
3214 test -n "$hardcode_libdirs"; then
3215 libdir="$hardcode_libdirs"
3216 eval rpath=\" $hardcode_libdir_flag_spec\"
3218 finalize_rpath="$rpath"
3220 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3221 # Transform all the library objects into standard objects.
3222 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3223 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3227 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3228 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3229 dlsyms="${outputname}S.c"
3231 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3235 if test -n "$dlsyms"; then
3239 # Discover the nlist of each of the dlfiles.
3240 nlist="$output_objdir/${outputname}.nm"
3242 $show "$rm $nlist ${nlist}S ${nlist}T"
3243 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3245 # Parse the name list into a source file.
3246 $show "creating $output_objdir/$dlsyms"
3248 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3249 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3250 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3256 /* Prevent the only kind of declaration conflicts we can make. */
3257 #define lt_preloaded_symbols some_other_symbol
3259 /* External symbol declarations for the compiler. */\
3262 if test "$dlself" = yes; then
3263 $show "generating symbol list for \`$output'"
3265 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3267 # Add our own program objects to the symbol list.
3268 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3269 for arg in $progfiles; do
3270 $show "extracting global C symbols from \`$arg'"
3271 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3274 if test -n "$exclude_expsyms"; then
3275 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3276 $run eval '$mv "$nlist"T "$nlist"'
3279 if test -n "$export_symbols_regex"; then
3280 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3281 $run eval '$mv "$nlist"T "$nlist"'
3284 # Prepare the list of exported symbols
3285 if test -z "$export_symbols"; then
3286 export_symbols="$output_objdir/$output.exp"
3287 $run $rm $export_symbols
3288 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3290 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3291 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3292 $run eval 'mv "$nlist"T "$nlist"'
3296 for arg in $dlprefiles; do
3297 $show "extracting global C symbols from \`$arg'"
3298 name=`echo "$arg" | sed -e 's%^.*/%%'`
3299 $run eval 'echo ": $name " >> "$nlist"'
3300 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3303 if test -z "$run"; then
3304 # Make sure we have at least an empty file.
3305 test -f "$nlist" || : > "$nlist"
3307 if test -n "$exclude_expsyms"; then
3308 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3309 $mv "$nlist"T "$nlist"
3312 # Try sorting and uniquifying the output.
3313 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3316 grep -v "^: " < "$nlist" > "$nlist"S
3319 if test -f "$nlist"S; then
3320 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3322 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3325 $echo >> "$output_objdir/$dlsyms" "\
3327 #undef lt_preloaded_symbols
3329 #if defined (__STDC__) && __STDC__
3330 # define lt_ptr void *
3332 # define lt_ptr char *
3336 /* The mapping between symbol names and symbols. */
3341 lt_preloaded_symbols[] =
3345 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3347 $echo >> "$output_objdir/$dlsyms" "\
3351 /* This works around a problem in FreeBSD linker */
3352 #ifdef FREEBSD_WORKAROUND
3353 static const void *lt_preloaded_setup() {
3354 return lt_preloaded_symbols;
3364 pic_flag_for_symtable=
3366 # compiling the symbol table file with pic_flag works around
3367 # a FreeBSD bug that causes programs to crash when -lm is
3368 # linked before any other PIC object. But we must not use
3369 # pic_flag when linking with -static. The problem exists in
3370 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3371 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3372 case "$compile_command " in
3374 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3377 case "$compile_command " in
3379 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3383 # Now compile the dynamic symbol file.
3384 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3385 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3387 # Clean up the generated files.
3388 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3389 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3391 # Transform the symbol file into the correct name.
3392 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3393 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3396 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3401 # We keep going just in case the user didn't refer to
3402 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3403 # really was required.
3405 # Nullify the symbol file.
3406 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3407 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3410 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3411 # Replace the output file specification.
3412 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3413 link_command="$compile_command$compile_rpath"
3415 # We have no uninstalled library dependencies, so finalize right now.
3416 $show "$link_command"
3417 $run eval "$link_command"
3420 # Delete the generated files.
3421 if test -n "$dlsyms"; then
3422 $show "$rm $output_objdir/${outputname}S.${objext}"
3423 $run $rm "$output_objdir/${outputname}S.${objext}"
3429 if test -n "$shlibpath_var"; then
3430 # We should set the shlibpath_var
3432 for dir in $temp_rpath; do
3434 [\\/]* | [A-Za-z]:[\\/]*)
3439 # Relative path: add a thisdir entry.
3440 rpath="$rpath\$thisdir/$dir:"
3447 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3448 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3450 if test -n "$finalize_shlibpath"; then
3451 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3456 if test -n "$runpath_var"; then
3457 if test -n "$perm_rpath"; then
3458 # We should set the runpath_var.
3460 for dir in $perm_rpath; do
3463 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3465 if test -n "$finalize_perm_rpath"; then
3466 # We should set the runpath_var.
3468 for dir in $finalize_perm_rpath; do
3471 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3475 if test "$no_install" = yes; then
3476 # We don't need to create a wrapper script.
3477 link_command="$compile_var$compile_command$compile_rpath"
3478 # Replace the output file specification.
3479 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3480 # Delete the old output file.
3482 # Link the executable and exit
3483 $show "$link_command"
3484 $run eval "$link_command" || exit $?
3488 if test "$hardcode_action" = relink; then
3489 # Fast installation is not supported
3490 link_command="$compile_var$compile_command$compile_rpath"
3491 relink_command="$finalize_var$finalize_command$finalize_rpath"
3493 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3494 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3496 if test "$fast_install" != no; then
3497 link_command="$finalize_var$compile_command$finalize_rpath"
3498 if test "$fast_install" = yes; then
3499 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3501 # fast_install is set to needless
3505 link_command="$compile_var$compile_command$compile_rpath"
3506 relink_command="$finalize_var$finalize_command$finalize_rpath"
3510 # Replace the output file specification.
3511 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3513 # Delete the old output files.
3514 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3516 $show "$link_command"
3517 $run eval "$link_command" || exit $?
3519 # Now create the wrapper script.
3520 $show "creating $output"
3522 # Quote the relink command for shipping.
3523 if test -n "$relink_command"; then
3524 # Preserve any variables that may affect compiler behavior
3525 for var in $variables_saved_for_relink; do
3526 if eval test -z \"\${$var+set}\"; then
3527 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3528 elif eval var_value=\$$var; test -z "$var_value"; then
3529 relink_command="$var=; export $var; $relink_command"
3531 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3532 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3535 relink_command="cd `pwd`; $relink_command"
3536 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3539 # Quote $echo for shipping.
3540 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3542 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3543 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3545 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3547 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3550 # Only actually do things if our run command is non-null.
3551 if test -z "$run"; then
3552 # win32 will think the script is a binary if it has
3553 # a .exe suffix, so we strip it off here.
3555 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3557 # test for cygwin because mv fails w/o .exe extensions
3559 *cygwin*) exeext=.exe ;;
3563 trap "$rm $output; exit 1" 1 2 15
3568 # $output - temporary wrapper script for $objdir/$outputname
3569 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3571 # The $output program cannot be directly executed until all the libtool
3572 # libraries that it depends on are installed.
3574 # This wrapper script should never be moved out of the build directory.
3575 # If it is, it will not operate correctly.
3577 # Sed substitution that helps us do robust quoting. It backslashifies
3578 # metacharacters that are still active within double-quoted strings.
3579 Xsed='sed -e 1s/^X//'
3580 sed_quote_subst='$sed_quote_subst'
3582 # The HP-UX ksh and POSIX shell print the target directory to stdout
3584 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3586 relink_command=\"$relink_command\"
3588 # This environment variable determines our operation mode.
3589 if test \"\$libtool_install_magic\" = \"$magic\"; then
3590 # install mode needs the following variable:
3591 notinst_deplibs='$notinst_deplibs'
3593 # When we are sourced in execute mode, \$file and \$echo are already set.
3594 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3597 # Make sure echo works.
3598 if test \"X\$1\" = X--no-reexec; then
3599 # Discard the --no-reexec flag, and continue.
3601 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3602 # Yippee, \$echo works!
3605 # Restart under the correct shell, and then maybe \$echo will work.
3606 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3612 # Find the directory that this script lives in.
3613 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3614 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3616 # Follow symbolic links until we get to the real thisdir.
3617 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3618 while test -n \"\$file\"; do
3619 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3621 # If there was a directory component, then change thisdir.
3622 if test \"x\$destdir\" != \"x\$file\"; then
3623 case \"\$destdir\" in
3624 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3625 *) thisdir=\"\$thisdir/\$destdir\" ;;
3629 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3630 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3633 # Try to get the absolute directory name.
3634 absdir=\`cd \"\$thisdir\" && pwd\`
3635 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3638 if test "$fast_install" = yes; then
3640 program=lt-'$outputname'$exeext
3641 progdir=\"\$thisdir/$objdir\"
3643 if test ! -f \"\$progdir/\$program\" || \\
3644 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3645 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3647 file=\"\$\$-\$program\"
3649 if test ! -d \"\$progdir\"; then
3650 $mkdir \"\$progdir\"
3652 $rm \"\$progdir/\$file\"
3657 # relink executable if necessary
3658 if test -n \"\$relink_command\"; then
3659 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3661 $echo \"\$relink_command_output\" >&2
3662 $rm \"\$progdir/\$file\"
3667 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3668 { $rm \"\$progdir/\$program\";
3669 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3670 $rm \"\$progdir/\$file\"
3674 program='$outputname'
3675 progdir=\"\$thisdir/$objdir\"
3681 if test -f \"\$progdir/\$program\"; then"
3683 # Export our shlibpath_var if we have one.
3684 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3686 # Add our own library path to $shlibpath_var
3687 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3689 # Some systems cannot cope with colon-terminated $shlibpath_var
3690 # The second colon is a workaround for a bug in BeOS R4 sed
3691 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3693 export $shlibpath_var
3697 # fixup the dll searchpath if we need to.
3698 if test -n "$dllsearchpath"; then
3700 # Add the dll search path components to the executable PATH
3701 PATH=$dllsearchpath:\$PATH
3706 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3707 # Run the actual program with our arguments.
3710 # win32 systems need to use the prog path for dll
3712 *-*-cygwin* | *-*-pw32*)
3714 exec \$progdir/\$program \${1+\"\$@\"}
3718 # Backslashes separate directories on plain windows
3719 *-*-mingw | *-*-os2*)
3721 exec \$progdir\\\\\$program \${1+\"\$@\"}
3727 # Export the path to the program.
3728 PATH=\"\$progdir:\$PATH\"
3731 exec \$program \${1+\"\$@\"}
3736 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3740 # The program doesn't exist.
3741 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3742 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3743 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3754 # See if we need to build an old-fashioned archive.
3755 for oldlib in $oldlibs; do
3757 if test "$build_libtool_libs" = convenience; then
3758 oldobjs="$libobjs_save"
3759 addlibs="$convenience"
3760 build_libtool_libs=no
3762 if test "$build_libtool_libs" = module; then
3763 oldobjs="$libobjs_save"
3764 build_libtool_libs=no
3766 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3768 addlibs="$old_convenience"
3771 if test -n "$addlibs"; then
3772 gentop="$output_objdir/${outputname}x"
3773 $show "${rm}r $gentop"
3774 $run ${rm}r "$gentop"
3775 $show "mkdir $gentop"
3776 $run mkdir "$gentop"
3778 if test $status -ne 0 && test ! -d "$gentop"; then
3781 generated="$generated $gentop"
3783 # Add in members from convenience archives.
3784 for xlib in $addlibs; do
3785 # Extract the objects.
3787 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3788 *) xabs=`pwd`"/$xlib" ;;
3790 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3791 xdir="$gentop/$xlib"
3793 $show "${rm}r $xdir"
3798 if test $status -ne 0 && test ! -d "$xdir"; then
3801 $show "(cd $xdir && $AR x $xabs)"
3802 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3804 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3808 # Do each command in the archive commands.
3809 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3810 eval cmds=\"$old_archive_from_new_cmds\"
3812 # Ensure that we have .o objects in place in case we decided
3813 # not to build a shared library, and have fallen back to building
3814 # static libs even though --disable-static was passed!
3815 for oldobj in $oldobjs; do
3816 if test ! -f $oldobj; then
3817 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3818 if test "X$xdir" = "X$oldobj"; then
3823 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3824 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3825 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3826 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3830 eval cmds=\"$old_archive_cmds\"
3832 save_ifs="$IFS"; IFS='~'
3833 for cmd in $cmds; do
3836 $run eval "$cmd" || exit $?
3841 if test -n "$generated"; then
3842 $show "${rm}r$generated"
3843 $run ${rm}r$generated
3846 # Now create the libtool archive.
3850 test "$build_old_libs" = yes && old_library="$libname.$libext"
3851 $show "creating $output"
3853 # Preserve any variables that may affect compiler behavior
3854 for var in $variables_saved_for_relink; do
3855 if eval test -z \"\${$var+set}\"; then
3856 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3857 elif eval var_value=\$$var; test -z "$var_value"; then
3858 relink_command="$var=; export $var; $relink_command"
3860 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3861 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3864 # Quote the link command for shipping.
3865 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3866 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3868 # Only create the output if not a dry run.
3869 if test -z "$run"; then
3870 for installed in no yes; do
3871 if test "$installed" = yes; then
3872 if test -z "$install_libdir"; then
3875 output="$output_objdir/$outputname"i
3876 # Replace all uninstalled libtool libraries with the installed ones
3878 for deplib in $dependency_libs; do
3881 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3882 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3883 if test -z "$libdir"; then
3884 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3887 newdependency_libs="$newdependency_libs $libdir/$name"
3889 *) newdependency_libs="$newdependency_libs $deplib" ;;
3892 dependency_libs="$newdependency_libs"
3894 for lib in $dlfiles; do
3895 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3896 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3897 if test -z "$libdir"; then
3898 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3901 newdlfiles="$newdlfiles $libdir/$name"
3903 dlfiles="$newdlfiles"
3905 for lib in $dlprefiles; do
3906 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3907 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3908 if test -z "$libdir"; then
3909 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3912 newdlprefiles="$newdlprefiles $libdir/$name"
3914 dlprefiles="$newdlprefiles"
3917 # place dlname in correct position for cygwin
3919 case $host,$output,$installed,$module,$dlname in
3920 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3923 # $outputname - a libtool library file
3924 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3926 # Please DO NOT delete this file!
3927 # It is necessary for linking the library.
3929 # The name that we can dlopen(3).
3932 # Names of this library.
3933 library_names='$library_names'
3935 # The name of the static archive.
3936 old_library='$old_library'
3938 # Libraries that this one depends upon.
3939 dependency_libs='$dependency_libs'
3941 # Version information for $libname.
3946 # Is this an already installed library?
3947 installed=$installed
3949 # Files to dlopen/dlpreopen
3951 dlpreopen='$dlprefiles'
3953 # Directory that this library needs to be installed in:
3954 libdir='$install_libdir'"
3955 if test "$installed" = no && test $need_relink = yes; then
3957 relink_command=\"$relink_command\""
3962 # Do a symbolic link so that the libtool archive can be found in
3963 # LD_LIBRARY_PATH before the program is installed.
3964 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3965 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3971 # libtool install mode
3973 modename="$modename: install"
3975 # There may be an optional sh(1) argument at the beginning of
3976 # install_prog (especially on Windows NT).
3977 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3978 # Allow the use of GNU shtool's install command.
3979 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3980 # Aesthetically quote it.
3981 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3983 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3987 install_prog="$arg "
3995 # The real first argument should be the name of the installation program.
3996 # Aesthetically quote it.
3997 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
3999 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4003 install_prog="$install_prog$arg"
4005 # We need to accept at least all the BSD install flags.
4015 if test -n "$dest"; then
4016 files="$files $dest"
4034 # If the previous option needed an argument, then skip it.
4035 if test -n "$prev"; then
4044 # Aesthetically quote the argument.
4045 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4047 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4051 install_prog="$install_prog $arg"
4054 if test -z "$install_prog"; then
4055 $echo "$modename: you must specify an install program" 1>&2
4060 if test -n "$prev"; then
4061 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4066 if test -z "$files"; then
4067 if test -z "$dest"; then
4068 $echo "$modename: no file or destination specified" 1>&2
4070 $echo "$modename: you must specify a destination" 1>&2
4076 # Strip any trailing slash from the destination.
4077 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4079 # Check to see that the destination is a directory.
4080 test -d "$dest" && isdir=yes
4081 if test "$isdir" = yes; then
4085 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4086 test "X$destdir" = "X$dest" && destdir=.
4087 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4089 # Not a directory, so check to see that there is only one file specified.
4091 if test $# -gt 2; then
4092 $echo "$modename: \`$dest' is not a directory" 1>&2
4098 [\\/]* | [A-Za-z]:[\\/]*) ;;
4100 for file in $files; do
4104 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4113 # This variable tells wrapper scripts just to set variables rather
4114 # than running their programs.
4115 libtool_install_magic="$magic"
4120 for file in $files; do
4122 # Do each installation.
4125 # Do the static libraries later.
4126 staticlibs="$staticlibs $file"
4130 # Check to see that this really is a libtool archive.
4131 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4133 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4141 # If there is no directory component, then add one.
4143 */* | *\\*) . $file ;;
4147 # Add the libdir to current_libdirs if it is the destination.
4149 if test "X$destdir" = "X$libdir"; then
4150 case "$current_libdirs " in
4152 *) current_libdirs="$current_libdirs $libdir" ;;
4157 DESTDIR=`$echo "$destdir" | sed -e 's!'"$libdir"'$!!'`
4158 if test "X$destdir" != "X$DESTDIR$libdir"; then
4163 # Note the libdir as a future libdir.
4164 case "$future_libdirs " in
4166 *) future_libdirs="$future_libdirs $libdir" ;;
4170 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4171 test "X$dir" = "X$file/" && dir=
4174 if test -n "$relink_command"; then
4175 $echo "$modename: warning: relinking \`$file'" 1>&2
4177 $show "$relink_command"
4178 if $run eval "$relink_command"; then :
4180 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4186 # See the names of the shared library.
4187 set dummy $library_names
4188 if test -n "$2"; then
4194 test -n "$relink_command" && srcname="$realname"T
4196 # Install the shared library and build the symlinks.
4197 $show "$install_prog $dir/$srcname $destdir/$realname"
4198 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4199 if test -n "$stripme" && test -n "$striplib"; then
4200 $show "$striplib $destdir/$realname"
4201 $run eval "$striplib $destdir/$realname" || exit $?
4204 if test $# -gt 0; then
4205 # Delete the old symlinks, and create new ones.
4208 if test "$linkname" != "$realname"; then
4209 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4210 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4215 # Do each command in the postinstall commands.
4216 lib="$destdir/$realname"
4217 eval cmds=\"$postinstall_cmds\"
4218 save_ifs="$IFS"; IFS='~'
4219 for cmd in $cmds; do
4222 $run eval "$cmd" || exit $?
4227 # Install the pseudo-library for information purposes.
4228 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4229 instname="$dir/$name"i
4230 $show "$install_prog $instname $destdir/$name"
4231 $run eval "$install_prog $instname $destdir/$name" || exit $?
4233 # Maybe install the static library, too.
4234 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4238 # Install (i.e. copy) a libtool object.
4240 # Figure out destination file name, if it wasn't already specified.
4241 if test -n "$destname"; then
4242 destfile="$destdir/$destname"
4244 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4245 destfile="$destdir/$destfile"
4248 # Deduce the name of the destination old-style object file.
4251 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4254 staticdest="$destfile"
4258 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4264 # Install the libtool object if requested.
4265 if test -n "$destfile"; then
4266 $show "$install_prog $file $destfile"
4267 $run eval "$install_prog $file $destfile" || exit $?
4270 # Install the old object if enabled.
4271 if test "$build_old_libs" = yes; then
4272 # Deduce the name of the old-style object file.
4273 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4275 $show "$install_prog $staticobj $staticdest"
4276 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4282 # Figure out destination file name, if it wasn't already specified.
4283 if test -n "$destname"; then
4284 destfile="$destdir/$destname"
4286 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4287 destfile="$destdir/$destfile"
4290 # Do a test to see if this is really a libtool program.
4291 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4295 # If there is no directory component, then add one.
4297 */* | *\\*) . $file ;;
4301 # Check the variables that should have been set.
4302 if test -z "$notinst_deplibs"; then
4303 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4308 for lib in $notinst_deplibs; do
4309 # Check to see that each library is installed.
4311 if test -f "$lib"; then
4312 # If there is no directory component, then add one.
4314 */* | *\\*) . $lib ;;
4318 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4319 if test -n "$libdir" && test ! -f "$libfile"; then
4320 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4326 # If there is no directory component, then add one.
4328 */* | *\\*) . $file ;;
4333 if test "$fast_install" = no && test -n "$relink_command"; then
4334 if test "$finalize" = yes && test -z "$run"; then
4336 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4337 tmpdir="$tmpdir/libtool-$$"
4338 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4340 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4343 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4344 outputname="$tmpdir/$file"
4345 # Replace the output file specification.
4346 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4348 $show "$relink_command"
4349 if $run eval "$relink_command"; then :
4351 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4357 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4360 # Install the binary that we compiled earlier.
4361 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4365 # remove .exe since cygwin /usr/bin/install will append another
4367 case $install_prog,$host in
4368 /usr/bin/install*,*cygwin*)
4369 case $file:$destfile in
4374 destfile=$destfile.exe
4377 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4382 $show "$install_prog$stripme $file $destfile"
4383 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4384 test -n "$outputname" && ${rm}r "$tmpdir"
4389 for file in $staticlibs; do
4390 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4392 # Set up the ranlib parameters.
4393 oldlib="$destdir/$name"
4395 $show "$install_prog $file $oldlib"
4396 $run eval "$install_prog \$file \$oldlib" || exit $?
4398 if test -n "$stripme" && test -n "$striplib"; then
4399 $show "$old_striplib $oldlib"
4400 $run eval "$old_striplib $oldlib" || exit $?
4403 # Do each command in the postinstall commands.
4404 eval cmds=\"$old_postinstall_cmds\"
4405 save_ifs="$IFS"; IFS='~'
4406 for cmd in $cmds; do
4409 $run eval "$cmd" || exit $?
4414 if test -n "$future_libdirs"; then
4415 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4418 if test -n "$current_libdirs"; then
4419 # Maybe just do a dry run.
4420 test -n "$run" && current_libdirs=" -n$current_libdirs"
4421 exec_cmd='$SHELL $0 --finish$current_libdirs'
4427 # libtool finish mode
4429 modename="$modename: finish"
4433 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4436 libdirs="$libdirs $dir"
4439 for libdir in $libdirs; do
4440 if test -n "$finish_cmds"; then
4441 # Do each command in the finish commands.
4442 eval cmds=\"$finish_cmds\"
4443 save_ifs="$IFS"; IFS='~'
4444 for cmd in $cmds; do
4447 $run eval "$cmd" || admincmds="$admincmds
4452 if test -n "$finish_eval"; then
4453 # Do the single finish_eval.
4454 eval cmds=\"$finish_eval\"
4455 $run eval "$cmds" || admincmds="$admincmds
4461 # Exit here if they wanted silent mode.
4462 test "$show" = ":" && exit 0
4464 echo "----------------------------------------------------------------------"
4465 echo "Libraries have been installed in:"
4466 for libdir in $libdirs; do
4470 echo "If you ever happen to want to link against installed libraries"
4471 echo "in a given directory, LIBDIR, you must either use libtool, and"
4472 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4473 echo "flag during linking and do at least one of the following:"
4474 if test -n "$shlibpath_var"; then
4475 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4476 echo " during execution"
4478 if test -n "$runpath_var"; then
4479 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4480 echo " during linking"
4482 if test -n "$hardcode_libdir_flag_spec"; then
4484 eval flag=\"$hardcode_libdir_flag_spec\"
4486 echo " - use the \`$flag' linker flag"
4488 if test -n "$admincmds"; then
4489 echo " - have your system administrator run these commands:$admincmds"
4491 if test -f /etc/ld.so.conf; then
4492 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4495 echo "See any operating system documentation about shared libraries for"
4496 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4497 echo "----------------------------------------------------------------------"
4501 # libtool execute mode
4503 modename="$modename: execute"
4505 # The first argument is the command name.
4507 if test -z "$cmd"; then
4508 $echo "$modename: you must specify a COMMAND" 1>&2
4513 # Handle -dlopen flags immediately.
4514 for file in $execute_dlfiles; do
4515 if test ! -f "$file"; then
4516 $echo "$modename: \`$file' is not a file" 1>&2
4524 # Check to see that this really is a libtool archive.
4525 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4527 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4532 # Read the libtool library.
4536 # If there is no directory component, then add one.
4538 */* | *\\*) . $file ;;
4542 # Skip this library if it cannot be dlopened.
4543 if test -z "$dlname"; then
4544 # Warn if it was a shared library.
4545 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4549 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4550 test "X$dir" = "X$file" && dir=.
4552 if test -f "$dir/$objdir/$dlname"; then
4555 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4561 # Just add the directory containing the .lo file.
4562 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4563 test "X$dir" = "X$file" && dir=.
4567 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4572 # Get the absolute pathname.
4573 absdir=`cd "$dir" && pwd`
4574 test -n "$absdir" && dir="$absdir"
4576 # Now add the directory to shlibpath_var.
4577 if eval "test -z \"\$$shlibpath_var\""; then
4578 eval "$shlibpath_var=\"\$dir\""
4580 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4584 # This variable tells wrapper scripts just to set shlibpath_var
4585 # rather than running their programs.
4586 libtool_execute_magic="$magic"
4588 # Check if any of the arguments is a wrapper script.
4595 # Do a test to see if this is really a libtool program.
4596 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4597 # If there is no directory component, then add one.
4599 */* | *\\*) . $file ;;
4603 # Transform arg to wrapped name.
4604 file="$progdir/$program"
4608 # Quote arguments (to preserve shell metacharacters).
4609 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4610 args="$args \"$file\""
4613 if test -z "$run"; then
4614 if test -n "$shlibpath_var"; then
4615 # Export the shlibpath_var.
4616 eval "export $shlibpath_var"
4619 # Restore saved enviroment variables
4620 if test "${save_LC_ALL+set}" = set; then
4621 LC_ALL="$save_LC_ALL"; export LC_ALL
4623 if test "${save_LANG+set}" = set; then
4624 LANG="$save_LANG"; export LANG
4627 # Now prepare to actually exec the command.
4628 exec_cmd='"$cmd"$args'
4630 # Display what would be done.
4631 if test -n "$shlibpath_var"; then
4632 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4633 $echo "export $shlibpath_var"
4640 # libtool clean and uninstall mode
4642 modename="$modename: $mode"
4648 # This variable tells wrapper scripts just to set variables rather
4649 # than running their programs.
4650 libtool_install_magic="$magic"
4655 -f) rm="$rm $arg"; rmforce=yes ;;
4656 -*) rm="$rm $arg" ;;
4657 *) files="$files $arg" ;;
4661 if test -z "$rm"; then
4662 $echo "$modename: you must specify an RM program" 1>&2
4669 for file in $files; do
4670 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4671 if test "X$dir" = "X$file"; then
4675 objdir="$dir/$objdir"
4677 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4678 test $mode = uninstall && objdir="$dir"
4680 # Remember objdir for removal later, being careful to avoid duplicates
4681 if test $mode = clean; then
4684 *) rmdirs="$rmdirs $objdir" ;;
4688 # Don't error if the file doesn't exist and rm -f was used.
4689 if (test -L "$file") >/dev/null 2>&1 \
4690 || (test -h "$file") >/dev/null 2>&1 \
4691 || test -f "$file"; then
4693 elif test -d "$file"; then
4696 elif test "$rmforce" = yes; then
4704 # Possibly a libtool archive, so verify it.
4705 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4708 # Delete the libtool libraries and symlinks.
4709 for n in $library_names; do
4710 rmfiles="$rmfiles $objdir/$n"
4712 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4713 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4715 if test $mode = uninstall; then
4716 if test -n "$library_names"; then
4717 # Do each command in the postuninstall commands.
4718 eval cmds=\"$postuninstall_cmds\"
4719 save_ifs="$IFS"; IFS='~'
4720 for cmd in $cmds; do
4724 if test $? != 0 && test "$rmforce" != yes; then
4731 if test -n "$old_library"; then
4732 # Do each command in the old_postuninstall commands.
4733 eval cmds=\"$old_postuninstall_cmds\"
4734 save_ifs="$IFS"; IFS='~'
4735 for cmd in $cmds; do
4739 if test $? != 0 && test "$rmforce" != yes; then
4745 # FIXME: should reinstall the best remaining shared library.
4751 if test "$build_old_libs" = yes; then
4752 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4753 rmfiles="$rmfiles $dir/$oldobj"
4758 # Do a test to see if this is a libtool program.
4759 if test $mode = clean &&
4760 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4764 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4765 if test "$fast_install" = yes && test -n "$relink_command"; then
4766 rmfiles="$rmfiles $objdir/lt-$name"
4771 $show "$rm $rmfiles"
4772 $run $rm $rmfiles || exit_status=1
4775 # Try to remove the ${objdir}s in the directories where we deleted files
4776 for dir in $rmdirs; do
4777 if test -d "$dir"; then
4779 $run rmdir $dir >/dev/null 2>&1
4787 $echo "$modename: you must specify a MODE" 1>&2
4788 $echo "$generic_help" 1>&2
4793 if test -z "$exec_cmd"; then
4794 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4795 $echo "$generic_help" 1>&2
4798 fi # test -z "$show_help"
4800 if test -n "$exec_cmd"; then
4805 # We need to display help for each of the modes.
4808 "Usage: $modename [OPTION]... [MODE-ARG]...
4810 Provide generalized library-building support services.
4812 --config show all configuration variables
4813 --debug enable verbose shell tracing
4814 -n, --dry-run display commands without modifying any files
4815 --features display basic configuration information and exit
4816 --finish same as \`--mode=finish'
4817 --help display this help message and exit
4818 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4819 --quiet same as \`--silent'
4820 --silent don't print informational messages
4821 --version print version information
4823 MODE must be one of the following:
4825 clean remove files from the build directory
4826 compile compile a source file into a libtool object
4827 execute automatically set library path, then run a program
4828 finish complete the installation of libtool libraries
4829 install install libraries or executables
4830 link create a library or an executable
4831 uninstall remove libraries from an installed directory
4833 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4834 a more detailed description of MODE."
4840 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4842 Remove files from the build directory.
4844 RM is the name of the program to use to delete files associated with each FILE
4845 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4848 If FILE is a libtool library, object or program, all the files associated
4849 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4854 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4856 Compile a source file into a libtool library object.
4858 This mode accepts the following additional options:
4860 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4861 -prefer-pic try to building PIC objects only
4862 -prefer-non-pic try to building non-PIC objects only
4863 -static always build a \`.o' file suitable for static linking
4865 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4866 from the given SOURCEFILE.
4868 The output file name is determined by removing the directory component from
4869 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4870 library object suffix, \`.lo'."
4875 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4877 Automatically set library path, then run a program.
4879 This mode accepts the following additional options:
4881 -dlopen FILE add the directory containing FILE to the library path
4883 This mode sets the library path environment variable according to \`-dlopen'
4886 If any of the ARGS are libtool executable wrappers, then they are translated
4887 into their corresponding uninstalled binary, and any of their required library
4888 directories are added to the library path.
4890 Then, COMMAND is executed, with ARGS as arguments."
4895 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4897 Complete the installation of libtool libraries.
4899 Each LIBDIR is a directory that contains libtool libraries.
4901 The commands that this mode executes may require superuser privileges. Use
4902 the \`--dry-run' option if you just want to see what would be executed."
4907 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4909 Install executables or libraries.
4911 INSTALL-COMMAND is the installation command. The first component should be
4912 either the \`install' or \`cp' program.
4914 The rest of the components are interpreted as arguments to that command (only
4915 BSD-compatible install options are recognized)."
4920 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4922 Link object files or libraries together to form another library, or to
4923 create an executable program.
4925 LINK-COMMAND is a command using the C compiler that you would use to create
4926 a program from several object files.
4928 The following components of LINK-COMMAND are treated specially:
4930 -all-static do not do any dynamic linking at all
4931 -avoid-version do not add a version suffix if possible
4932 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4933 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4934 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4935 -export-symbols SYMFILE
4936 try to export only the symbols listed in SYMFILE
4937 -export-symbols-regex REGEX
4938 try to export only the symbols matching REGEX
4939 -LLIBDIR search LIBDIR for required installed libraries
4940 -lNAME OUTPUT-FILE requires the installed library libNAME
4941 -module build a library that can dlopened
4942 -no-fast-install disable the fast-install mode
4943 -no-install link a not-installable executable
4944 -no-undefined declare that a library does not refer to external symbols
4945 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4946 -release RELEASE specify package release information
4947 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4948 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4949 -static do not do any dynamic linking of libtool libraries
4950 -version-info CURRENT[:REVISION[:AGE]]
4951 specify library version info [each variable defaults to 0]
4953 All other options (arguments beginning with \`-') are ignored.
4955 Every other argument is treated as a filename. Files ending in \`.la' are
4956 treated as uninstalled libtool libraries, other files are standard or library
4959 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4960 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4961 required, except when creating a convenience library.
4963 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4964 using \`ar' and \`ranlib', or on Windows using \`lib'.
4966 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4967 is created, otherwise an executable program is created."
4972 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4974 Remove libraries from an installation directory.
4976 RM is the name of the program to use to delete files associated with each FILE
4977 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4980 If FILE is a libtool library, all the files associated with it are deleted.
4981 Otherwise, only FILE itself is deleted using RM."
4985 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4992 $echo "Try \`$modename --help' for more information about other modes."