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 # This file is distributed with OpenLDAP Software, which contains a
28 # configuration script generated by Autoconf, and is distributable
29 # under the same distributions terms as OpenLDAP inself.
30 # See the OpenLDAP COPYRIGHT and LICENSE file for details.
32 # Check that we have a working $echo.
33 if test "X$1" = X--no-reexec; then
34 # Discard the --no-reexec flag, and continue.
36 elif test "X$1" = X--fallback-echo; then
37 # Avoid inline document here, it may be left over
39 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
40 # Yippee, $echo works!
43 # Restart under the correct shell, and then maybe $echo will work.
44 exec $SHELL "$0" --no-reexec ${1+"$@"}
47 if test "X$1" = X--fallback-echo; then
48 # used as fallback echo
56 # The name of this program.
57 progname=`$echo "$0" | sed 's%^.*/%%'`
64 TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
67 help="Try \`$progname --help' for more information."
68 magic="%%%MAGIC variable%%%"
73 # Sed substitution that helps us do robust quoting. It backslashifies
74 # metacharacters that are still active within double-quoted strings.
76 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
77 # test EBCDIC or ASCII
78 case `echo '' | od -x` in
79 *15*) # EBCDIC based system
83 *) # Assume ASCII based system
85 NL2SP='tr \015\012 \040\040'
90 # Only set LANG and LC_ALL to C if already set.
91 # These must not be set unconditionally because not all systems understand
92 # e.g. LANG=C (notably SCO).
93 # We save the old values to restore during execute mode.
94 if test "${LC_ALL+set}" = set; then
95 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
97 if test "${LANG+set}" = set; then
98 save_LANG="$LANG"; LANG=C; export LANG
101 # Make sure IFS has a sensible default
104 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
105 echo "$modename: not configured to build any kind of library" 1>&2
106 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
119 lo2o="s/\\.lo\$/.${objext}/"
120 o2lo="s/\\.${objext}\$/.lo/"
122 # Parse our command line options once, thoroughly.
129 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
133 # If the previous option needs an argument, assign it.
134 if test -n "$prev"; then
137 execute_dlfiles="$execute_dlfiles $arg"
149 # Have we seen a non-optional argument yet?
156 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
161 sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
166 echo "$progname: enabling shell trace mode"
176 if test "$build_libtool_libs" = yes; then
177 echo "enable shared libraries"
179 echo "disable shared libraries"
181 if test "$build_old_libs" = yes; then
182 echo "enable static libraries"
184 echo "disable static libraries"
189 --finish) mode="finish" ;;
191 --mode) prevopt="--mode" prev=mode ;;
192 --mode=*) mode="$optarg" ;;
204 $echo "$modename: unrecognized option \`$arg'" 1>&2
216 if test -n "$prevopt"; then
217 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
222 # If this variable is set in any of the actions, the command in it
223 # will be execed at the end. This prevents here-documents from being
224 # left over by shells.
227 if test -z "$show_help"; then
229 # Infer the operation mode.
230 if test -z "$mode"; then
232 *cc | *++ | gcc* | *-gcc*)
244 *db | *dbx | *strace | *truss)
254 # If we have no mode, but dlfiles were specified, then do execute mode.
255 test -n "$execute_dlfiles" && mode=execute
257 # Just use the default operation mode.
258 if test -z "$mode"; then
259 if test -n "$nonopt"; then
260 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
262 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
269 # Only execute mode is allowed to have -dlopen flags.
270 if test -n "$execute_dlfiles" && test "$mode" != execute; then
271 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
276 # Change the help message to a mode-specific one.
278 help="Try \`$modename --help --mode=$mode' for more information."
280 # These modes are in order of execution frequency so that they run quickly.
282 # libtool compile mode
284 modename="$modename: compile"
285 # Get the compilation command and the source file.
298 # Aesthetically quote the previous argument.
300 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
303 # Double-quote args containing other shell metacharacters.
304 # Many Bourne shells cannot handle close brackets correctly
305 # in scan sets, so we specify it separately.
306 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
311 # Add the previous argument to base_compile.
312 if test -z "$base_compile"; then
313 base_compile="$lastarg"
315 base_compile="$base_compile $lastarg"
321 # Accept any command-line options.
324 if test "$user_target" != "no"; then
325 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
352 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
354 save_ifs="$IFS"; IFS=','
358 # Double-quote args containing other shell metacharacters.
359 # Many Bourne shells cannot handle close brackets correctly
360 # in scan sets, so we specify it separately.
362 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
366 lastarg="$lastarg $arg"
369 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
371 # Add the arguments to base_compile.
372 if test -z "$base_compile"; then
373 base_compile="$lastarg"
375 base_compile="$base_compile $lastarg"
383 # The next one is the -o target name
388 # We got the output file
395 # Accept the current argument as the source file.
399 # Aesthetically quote the previous argument.
401 # Backslashify any backslashes, double quotes, and dollar signs.
402 # These are the only characters that are still specially
403 # interpreted inside of double-quoted scrings.
404 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
406 # Double-quote args containing other shell metacharacters.
407 # Many Bourne shells cannot handle close brackets correctly
408 # in scan sets, so we specify it separately.
410 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
411 lastarg="\"$lastarg\""
415 # Add the previous argument to base_compile.
416 if test -z "$base_compile"; then
417 base_compile="$lastarg"
419 base_compile="$base_compile $lastarg"
427 # Get the name of the library object.
428 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
431 $echo "$modename: you must specify a target with \`-o'" 1>&2
436 # Recognize several different file suffixes.
437 # If the user specifies -o file.o, it is replaced with file.lo
452 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
455 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
457 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
462 if test -z "$base_compile"; then
463 $echo "$modename: you must specify a compilation command" 1>&2
468 # Delete any leftover library objects.
469 if test "$build_old_libs" = yes; then
470 removelist="$obj $libobj"
476 trap "$run $rm $removelist; exit 1" 1 2 15
478 # On Cygwin there's no "real" PIC flag so we must build both object types
480 cygwin* | mingw* | pw32* | os2*)
484 if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
485 # non-PIC code in shared libraries is not supported
489 # Calculate the filename of the output object if compiler does
490 # not support -o with -c
491 if test "$compiler_c_o" = no; then
492 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
493 lockfile="$output_obj.lock"
494 removelist="$removelist $output_obj $lockfile"
495 trap "$run $rm $removelist; exit 1" 1 2 15
501 # Lock this critical section if it is needed
502 # We use this script file to make the link, it avoids creating a new file
503 if test "$need_locks" = yes; then
504 until $run ln "$0" "$lockfile" 2>/dev/null; do
505 $show "Waiting for $lockfile to be removed"
508 elif test "$need_locks" = warn; then
509 if test -f "$lockfile"; then
511 *** ERROR, $lockfile exists and contains:
512 `cat $lockfile 2>/dev/null`
514 This indicates that another process is trying to use the same
515 temporary object file, and libtool could not work around it because
516 your compiler does not support \`-c' and \`-o' together. If you
517 repeat this compilation, it may succeed, by chance, but you had better
518 avoid parallel builds (make -j) in this platform, or get a better
524 echo $srcfile > "$lockfile"
527 if test -n "$fix_srcfile_path"; then
528 eval srcfile=\"$fix_srcfile_path\"
531 # Only build a PIC object if we are building libtool libraries.
532 if test "$build_libtool_libs" = yes; then
533 # Without this assignment, base_compile gets emptied.
534 fbsd_hideous_sh_bug=$base_compile
536 if test "$pic_mode" != no; then
537 # All platforms use -DPIC, to notify preprocessed assembler code.
538 command="$base_compile $srcfile $pic_flag -DPIC"
540 # Don't build PIC code
541 command="$base_compile $srcfile"
543 if test "$build_old_libs" = yes; then
545 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
546 if test "X$dir" = "X$libobj"; then
551 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
553 if test -d "$dir"; then
560 if test $status -ne 0 && test ! -d $dir; then
565 if test "$compiler_o_lo" = yes; then
567 command="$command -o $output_obj"
568 elif test "$compiler_c_o" = yes; then
570 command="$command -o $output_obj"
573 $run $rm "$output_obj"
575 if $run eval "$command"; then :
577 test -n "$output_obj" && $run $rm $removelist
581 if test "$need_locks" = warn &&
582 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
584 *** ERROR, $lockfile contains:
585 `cat $lockfile 2>/dev/null`
587 but it should contain:
590 This indicates that another process is trying to use the same
591 temporary object file, and libtool could not work around it because
592 your compiler does not support \`-c' and \`-o' together. If you
593 repeat this compilation, it may succeed, by chance, but you had better
594 avoid parallel builds (make -j) in this platform, or get a better
601 # Just move the object if needed, then go on to compile the next one
602 if test x"$output_obj" != x"$libobj"; then
603 $show "$mv $output_obj $libobj"
604 if $run $mv $output_obj $libobj; then :
612 # If we have no pic_flag, then copy the object into place and finish.
613 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
614 test "$build_old_libs" = yes; then
615 # Rename the .lo from within objdir to obj
616 if test -f $obj; then
621 $show "$mv $libobj $obj"
622 if $run $mv $libobj $obj; then :
629 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
630 if test "X$xdir" = "X$obj"; then
635 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
636 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
637 # Now arrange that obj and lo_libobj become the same file
638 $show "(cd $xdir && $LN_S $baseobj $libobj)"
639 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
640 # Unlock the critical section if it was locked
641 if test "$need_locks" != no; then
652 # Allow error messages only from the first compilation.
653 suppress_output=' >/dev/null 2>&1'
656 # Only build a position-dependent object if we build old libraries.
657 if test "$build_old_libs" = yes; then
658 if test "$pic_mode" != yes; then
659 # Don't build PIC code
660 command="$base_compile $srcfile"
662 # All platforms use -DPIC, to notify preprocessed assembler code.
663 command="$base_compile $srcfile $pic_flag -DPIC"
665 if test "$compiler_c_o" = yes; then
666 command="$command -o $obj"
670 # Suppress compiler output if we already did a PIC compilation.
671 command="$command$suppress_output"
672 $run $rm "$output_obj"
674 if $run eval "$command"; then :
680 if test "$need_locks" = warn &&
681 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
683 *** ERROR, $lockfile contains:
684 `cat $lockfile 2>/dev/null`
686 but it should contain:
689 This indicates that another process is trying to use the same
690 temporary object file, and libtool could not work around it because
691 your compiler does not support \`-c' and \`-o' together. If you
692 repeat this compilation, it may succeed, by chance, but you had better
693 avoid parallel builds (make -j) in this platform, or get a better
700 # Just move the object if needed
701 if test x"$output_obj" != x"$obj"; then
702 $show "$mv $output_obj $obj"
703 if $run $mv $output_obj $obj; then :
711 # Create an invalid libtool object if no PIC, so that we do not
712 # accidentally link it into a program.
713 if test "$build_libtool_libs" != yes; then
714 $show "echo timestamp > $libobj"
715 $run eval "echo timestamp > \$libobj" || exit $?
717 # Move the .lo from within objdir
718 $show "$mv $libobj $lo_libobj"
719 if $run $mv $libobj $lo_libobj; then :
728 # Unlock the critical section if it was locked
729 if test "$need_locks" != no; then
738 modename="$modename: link"
740 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
741 # It is impossible to link a dll without this setting, and
742 # we shouldn't force the makefile maintainer to figure out
743 # which system we are compiling for in order to pass an extra
744 # flag for every libtool invokation.
747 # FIXME: Unfortunately, there are problems with the above when trying
748 # to make a dll which has undefined symbols, in which case not
749 # even a static library is built. For now, we need to specify
750 # -no-undefined on the libtool link line when we can be certain
751 # that all symbols are satisfied, otherwise we get a static library.
758 libtool_args="$nonopt"
759 compile_command="$nonopt"
760 finalize_command="$nonopt"
773 lib_search_path=`pwd`
781 export_symbols_regex=
788 prefer_static_libs=no
800 # We need to know -static, to get the right output filenames.
804 -all-static | -static)
805 if test "X$arg" = "X-all-static"; then
806 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
807 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
809 if test -n "$link_static_flag"; then
810 dlopen_self=$dlopen_self_static
813 if test -z "$pic_flag" && test -n "$link_static_flag"; then
814 dlopen_self=$dlopen_self_static
817 build_libtool_libs=no
819 prefer_static_libs=yes
825 # See if our shared archives depend on static archives.
826 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
828 # Go through the arguments, transforming them on the way.
829 while test $# -gt 0; do
833 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
838 libtool_args="$libtool_args $qarg"
840 # If the previous option needs an argument, assign it.
841 if test -n "$prev"; then
844 compile_command="$compile_command @OUTPUT@"
845 finalize_command="$finalize_command @OUTPUT@"
851 if test "$preload" = no; then
852 # Add the symbol object into the linking commands.
853 compile_command="$compile_command @SYMFILE@"
854 finalize_command="$finalize_command @SYMFILE@"
858 *.la | *.lo) ;; # We handle these cases below.
860 if test "$dlself" = no; then
868 if test "$prev" = dlprefiles; then
870 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
880 if test "$prev" = dlfiles; then
881 dlfiles="$dlfiles $arg"
883 dlprefiles="$dlprefiles $arg"
891 export_symbols="$arg"
892 if test ! -f "$arg"; then
893 $echo "$modename: symbol file \`$arg' does not exist"
900 export_symbols_regex="$arg"
910 # We need an absolute path.
912 [\\/]* | [A-Za-z]:[\\/]*) ;;
914 $echo "$modename: only absolute run-paths are allowed" 1>&2
918 if test "$prev" = rpath; then
921 *) rpath="$rpath $arg" ;;
926 *) xrpath="$xrpath $arg" ;;
933 compiler_flags="$compiler_flags $qarg"
935 compile_command="$compile_command $qarg"
936 finalize_command="$finalize_command $qarg"
940 linker_flags="$linker_flags $qarg"
941 compiler_flags="$compiler_flags $wl$qarg"
943 compile_command="$compile_command $wl$qarg"
944 finalize_command="$finalize_command $wl$qarg"
948 eval "$prev=\"\$arg\""
959 if test -n "$link_static_flag"; then
960 compile_command="$compile_command $link_static_flag"
961 finalize_command="$finalize_command $link_static_flag"
967 # FIXME: remove this flag sometime in the future.
968 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
992 -export-symbols | -export-symbols-regex)
993 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
994 $echo "$modename: more than one -exported-symbols argument is not allowed"
997 if test "X$arg" = "X-export-symbols"; then
1005 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1006 # so, if we see these flags be careful not to treat them like -L
1008 case $with_gcc/$host in
1010 compile_command="$compile_command $arg"
1011 finalize_command="$finalize_command $arg"
1018 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1019 # We need an absolute path.
1021 [\\/]* | [A-Za-z]:[\\/]*) ;;
1023 absdir=`cd "$dir" && pwd`
1024 if test -z "$absdir"; then
1025 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1034 deplibs="$deplibs -L$dir"
1035 lib_search_path="$lib_search_path $dir"
1039 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1040 case :$dllsearchpath: in
1042 *) dllsearchpath="$dllsearchpath:$dir";;
1050 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1052 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1053 # These systems don't actually have a C or math library (as such)
1056 *-*-mingw* | *-*-os2*)
1057 # These systems don't actually have a C library (as such)
1058 test "X$arg" = "X-lc" && continue
1061 # Do not include libc due to us having libc/libc_r.
1062 test "X$arg" = "X-lc" && continue
1065 elif test "X$arg" = "X-lc_r"; then
1068 # Do not include libc_r directly, use -pthread flag.
1073 deplibs="$deplibs $arg"
1089 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1090 # The PATH hackery in wrapper scripts is required on Windows
1091 # in order for the loader to find any dlls it needs.
1092 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1093 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1096 *) no_install=yes ;;
1124 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1125 # We need an absolute path.
1127 [\\/]* | [A-Za-z]:[\\/]*) ;;
1129 $echo "$modename: only absolute run-paths are allowed" 1>&2
1135 *) xrpath="$xrpath $dir" ;;
1141 # The effects of -static are defined in a previous loop.
1142 # We used to do the same as -all-static on platforms that
1143 # didn't have a PIC flag, but the assumption that the effects
1144 # would be equivalent was wrong. It would break on at least
1145 # Digital Unix and AIX.
1160 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1162 save_ifs="$IFS"; IFS=','
1163 for flag in $args; do
1166 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1171 compiler_flags="$compiler_flags $flag"
1174 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1178 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1180 save_ifs="$IFS"; IFS=','
1181 for flag in $args; do
1184 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1189 compiler_flags="$compiler_flags $wl$flag"
1190 linker_flags="$linker_flags $flag"
1193 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1206 # Some other compiler flag.
1208 # Unknown arguments in both finalize_command and compile_command need
1209 # to be aesthetically quoted because they are evaled later.
1210 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1212 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1219 # A library or standard object.
1220 if test "$prev" = dlfiles; then
1221 # This file was specified with -dlopen.
1222 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1223 dlfiles="$dlfiles $arg"
1227 # If libtool objects are unsupported, then we need to preload.
1232 if test "$prev" = dlprefiles; then
1233 # Preload the old-style object.
1234 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1238 *.lo) libobjs="$libobjs $arg" ;;
1239 *) objs="$objs $arg" ;;
1246 deplibs="$deplibs $arg"
1247 old_deplibs="$old_deplibs $arg"
1252 # A libtool-controlled library.
1254 if test "$prev" = dlfiles; then
1255 # This library was specified with -dlopen.
1256 dlfiles="$dlfiles $arg"
1258 elif test "$prev" = dlprefiles; then
1259 # The library was specified with -dlpreopen.
1260 dlprefiles="$dlprefiles $arg"
1263 deplibs="$deplibs $arg"
1268 # Some other compiler argument.
1270 # Unknown arguments in both finalize_command and compile_command need
1271 # to be aesthetically quoted because they are evaled later.
1272 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1274 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1281 # Now actually substitute the argument into the commands.
1282 if test -n "$arg"; then
1283 compile_command="$compile_command $arg"
1284 finalize_command="$finalize_command $arg"
1286 done # argument parsing loop
1288 if test -n "$prev"; then
1289 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1294 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1295 eval arg=\"$export_dynamic_flag_spec\"
1296 compile_command="$compile_command $arg"
1297 finalize_command="$finalize_command $arg"
1300 # calculate the name of the file, without its directory
1301 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1302 libobjs_save="$libobjs"
1304 if test -n "$shlibpath_var"; then
1305 # get the directories listed in $shlibpath_var
1306 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1310 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1311 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1313 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1314 if test "X$output_objdir" = "X$output"; then
1315 output_objdir="$objdir"
1317 output_objdir="$output_objdir/$objdir"
1319 # Create the object directory.
1320 if test ! -d $output_objdir; then
1321 $show "$mkdir $output_objdir"
1322 $run $mkdir $output_objdir
1324 if test $status -ne 0 && test ! -d $output_objdir; then
1329 # Determine the type of output
1332 $echo "$modename: you must specify an output file" 1>&2
1336 *.$libext) linkmode=oldlib ;;
1337 *.lo | *.$objext) linkmode=obj ;;
1338 *.la) linkmode=lib ;;
1339 *) linkmode=prog ;; # Anything else should be a program.
1344 # Find all interdependent deplibs by searching for libraries
1345 # that are linked more than once (e.g. -la -lb -la)
1346 for deplib in $deplibs; do
1348 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1350 libs="$libs $deplib"
1355 need_relink=no # whether we're linking any uninstalled libtool libraries
1356 notinst_deplibs= # not-installed libtool libraries
1357 notinst_path= # paths that contain not-installed libtool libraries
1361 for file in $dlfiles $dlprefiles; do
1365 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1377 passes="conv scan dlopen dlpreopen link"
1382 for pass in $passes; do
1383 if test $linkmode = prog; then
1384 # Determine which files to process
1388 save_deplibs="$deplibs" # Collect dlpreopened libraries
1391 dlpreopen) libs="$dlprefiles" ;;
1392 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1395 for deplib in $libs; do
1400 if test $linkmode = oldlib && test $linkmode = obj; then
1401 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1404 if test $pass = conv; then
1405 deplibs="$deplib $deplibs"
1408 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1409 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1410 # Search the libtool library
1411 lib="$searchdir/lib${name}.la"
1412 if test -f "$lib"; then
1417 if test "$found" != yes; then
1418 # deplib doesn't seem to be a libtool library
1419 if test "$linkmode,$pass" = "prog,link"; then
1420 compile_deplibs="$deplib $compile_deplibs"
1421 finalize_deplibs="$deplib $finalize_deplibs"
1423 deplibs="$deplib $deplibs"
1424 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1432 deplibs="$deplib $deplibs"
1433 test $pass = conv && continue
1434 newdependency_libs="$deplib $newdependency_libs"
1435 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1438 if test $pass = conv; then
1439 deplibs="$deplib $deplibs"
1442 if test $pass = scan; then
1443 deplibs="$deplib $deplibs"
1444 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1446 compile_deplibs="$deplib $compile_deplibs"
1447 finalize_deplibs="$deplib $finalize_deplibs"
1451 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1457 if test $pass = link; then
1458 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1459 # Make sure the xrpath contains only unique directories.
1462 *) xrpath="$xrpath $dir" ;;
1465 deplibs="$deplib $deplibs"
1468 *.la) lib="$deplib" ;;
1470 if test $pass = conv; then
1471 deplibs="$deplib $deplibs"
1476 if test "$deplibs_check_method" != pass_all; then
1478 echo "*** Warning: This library needs some functionality provided by $deplib."
1479 echo "*** I have the capability to make that library automatically link in when"
1480 echo "*** you link to this library. But I can only do this if you have a"
1481 echo "*** shared version of the library, which you do not appear to have."
1484 echo "*** Warning: Linking the shared library $output against the"
1485 echo "*** static library $deplib is not portable!"
1486 deplibs="$deplib $deplibs"
1491 if test $pass != link; then
1492 deplibs="$deplib $deplibs"
1494 compile_deplibs="$deplib $compile_deplibs"
1495 finalize_deplibs="$deplib $finalize_deplibs"
1502 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1503 # If there is no dlopen support or we're linking statically,
1504 # we need to preload.
1505 newdlprefiles="$newdlprefiles $deplib"
1506 compile_deplibs="$deplib $compile_deplibs"
1507 finalize_deplibs="$deplib $finalize_deplibs"
1509 newdlfiles="$newdlfiles $deplib"
1518 if test $found = yes || test -f "$lib"; then :
1520 $echo "$modename: cannot find the library \`$lib'" 1>&2
1524 # Check to see that this really is a libtool archive.
1525 if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1527 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1531 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1532 test "X$ladir" = "X$lib" && ladir="."
1540 # If the library was installed with an old release of libtool,
1541 # it will not redefine variable installed.
1546 */* | *\\*) . $lib ;;
1550 if test "$linkmode,$pass" = "lib,link" ||
1551 test "$linkmode,$pass" = "prog,scan" ||
1552 { test $linkmode = oldlib && test $linkmode = obj; }; then
1553 # Add dl[pre]opened files of deplib
1554 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1555 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1558 if test $pass = conv; then
1559 # Only check for convenience libraries
1560 deplibs="$lib $deplibs"
1561 if test -z "$libdir"; then
1562 if test -z "$old_library"; then
1563 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1566 # It is a libtool convenience library, so add in its objects.
1567 convenience="$convenience $ladir/$objdir/$old_library"
1568 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1570 for deplib in $dependency_libs; do
1571 deplibs="$deplib $deplibs"
1572 case "$tmp_libs " in
1573 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1575 tmp_libs="$tmp_libs $deplib"
1577 elif test $linkmode != prog && test $linkmode != lib; then
1578 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1584 # Get the name of the library we link against.
1586 for l in $old_library $library_names; do
1589 if test -z "$linklib"; then
1590 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1594 # This library was specified with -dlopen.
1595 if test $pass = dlopen; then
1596 if test -z "$libdir"; then
1597 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1600 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1601 # If there is no dlname, no dlopen support or we're linking
1602 # statically, we need to preload.
1603 dlprefiles="$dlprefiles $lib"
1605 newdlfiles="$newdlfiles $lib"
1610 # We need an absolute path.
1612 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1614 abs_ladir=`cd "$ladir" && pwd`
1615 if test -z "$abs_ladir"; then
1616 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1617 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1622 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1624 # Find the relevant object directory and library name.
1625 if test "X$installed" = Xyes; then
1626 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1627 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1636 dir="$ladir/$objdir"
1637 absdir="$abs_ladir/$objdir"
1638 # Remove this search path later
1639 notinst_path="$notinst_path $abs_ladir"
1640 fi # $installed = yes
1641 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1643 # This library was specified with -dlpreopen.
1644 if test $pass = dlpreopen; then
1645 if test -z "$libdir"; then
1646 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1649 # Prefer using a static library (so that no silly _DYNAMIC symbols
1650 # are required to link).
1651 if test -n "$old_library"; then
1652 newdlprefiles="$newdlprefiles $dir/$old_library"
1653 # Otherwise, use the dlname, so that lt_dlopen finds it.
1654 elif test -n "$dlname"; then
1655 newdlprefiles="$newdlprefiles $dir/$dlname"
1657 newdlprefiles="$newdlprefiles $dir/$linklib"
1659 fi # $pass = dlpreopen
1661 if test -z "$libdir"; then
1662 # Link the convenience library
1663 if test $linkmode = lib; then
1664 deplibs="$dir/$old_library $deplibs"
1665 elif test "$linkmode,$pass" = "prog,link"; then
1666 compile_deplibs="$dir/$old_library $compile_deplibs"
1667 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1669 deplibs="$lib $deplibs"
1674 if test $linkmode = prog && test $pass != link; then
1675 newlib_search_path="$newlib_search_path $ladir"
1676 deplibs="$lib $deplibs"
1679 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1680 test "$build_libtool_libs" = no; then
1685 for deplib in $dependency_libs; do
1687 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1689 # Need to link against all dependency_libs?
1690 if test $linkalldeplibs = yes; then
1691 deplibs="$deplib $deplibs"
1693 # Need to hardcode shared library paths
1694 # or/and link against static libraries
1695 newdependency_libs="$deplib $newdependency_libs"
1697 case "$tmp_libs " in
1698 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1700 tmp_libs="$tmp_libs $deplib"
1703 fi # $linkmode = prog...
1705 link_static=no # Whether the deplib will be linked statically
1706 if test -n "$library_names" &&
1707 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1708 # Link against this shared library
1710 if test "$linkmode,$pass" = "prog,link" ||
1711 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1712 # Hardcode the library path.
1713 # Skip directories that are in the system default run-time
1715 case " $sys_lib_dlsearch_path " in
1718 case "$compile_rpath " in
1720 *) compile_rpath="$compile_rpath $absdir"
1724 case " $sys_lib_dlsearch_path " in
1727 case "$finalize_rpath " in
1729 *) finalize_rpath="$finalize_rpath $libdir"
1733 if test $linkmode = prog; then
1734 # We need to hardcode the library path
1735 if test -n "$shlibpath_var"; then
1736 # Make sure the rpath contains only unique directories.
1737 case "$temp_rpath " in
1740 *) temp_rpath="$temp_rpath $dir" ;;
1744 fi # $linkmode,$pass = prog,link...
1746 if test "$alldeplibs" = yes &&
1747 { test "$deplibs_check_method" = pass_all ||
1748 { test "$build_libtool_libs" = yes &&
1749 test -n "$library_names"; }; }; then
1750 # We only need to search for static libraries
1754 if test "$installed" = no; then
1755 notinst_deplibs="$notinst_deplibs $lib"
1759 if test -n "$old_archive_from_expsyms_cmds"; then
1760 # figure out the soname
1761 set dummy $library_names
1764 libname=`eval \\$echo \"$libname_spec\"`
1765 # use dlname if we got it. it's perfectly good, no?
1766 if test -n "$dlname"; then
1768 elif test -n "$soname_spec"; then
1772 major=`expr $current - $age`
1776 eval soname=\"$soname_spec\"
1781 # Make a new name for the extract_expsyms_cmds to use
1783 soname=`echo $soroot | sed -e 's/^.*\///'`
1784 newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
1786 # If the library has no export list, then create one now
1787 if test -f "$output_objdir/$soname-def"; then :
1789 $show "extracting exported symbol list from \`$soname'"
1790 save_ifs="$IFS"; IFS='~'
1791 eval cmds=\"$extract_expsyms_cmds\"
1792 for cmd in $cmds; do
1795 $run eval "$cmd" || exit $?
1801 if test -f "$output_objdir/$newlib"; then :; else
1802 $show "generating import library for \`$soname'"
1803 save_ifs="$IFS"; IFS='~'
1804 eval cmds=\"$old_archive_from_expsyms_cmds\"
1805 for cmd in $cmds; do
1808 $run eval "$cmd" || exit $?
1812 # make sure the library variables are pointing to the new library
1815 fi # test -n $old_archive_from_expsyms_cmds
1817 if test $linkmode = prog || test "$mode" != relink; then
1822 case $hardcode_action in
1823 immediate | unsupported)
1824 if test "$hardcode_direct" = no; then
1826 elif test "$hardcode_minus_L" = no; then
1828 *-*-sunos*) add_shlibpath="$dir" ;;
1832 elif test "$hardcode_shlibpath_var" = no; then
1833 add_shlibpath="$dir"
1840 if test "$hardcode_direct" = yes; then
1842 elif test "$hardcode_minus_L" = yes; then
1845 elif test "$hardcode_shlibpath_var" = yes; then
1846 add_shlibpath="$dir"
1855 if test "$lib_linked" != yes; then
1856 $echo "$modename: configuration error: unsupported hardcode properties"
1860 if test -n "$add_shlibpath"; then
1861 case :$compile_shlibpath: in
1862 *":$add_shlibpath:"*) ;;
1863 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1866 if test $linkmode = prog; then
1867 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1868 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1870 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1871 test -n "$add" && deplibs="$add $deplibs"
1872 if test "$hardcode_direct" != yes && \
1873 test "$hardcode_minus_L" != yes && \
1874 test "$hardcode_shlibpath_var" = yes; then
1875 case :$finalize_shlibpath: in
1877 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1883 if test $linkmode = prog || test "$mode" = relink; then
1887 # Finalize command for both is simple: just hardcode it.
1888 if test "$hardcode_direct" = yes; then
1889 add="$libdir/$linklib"
1890 elif test "$hardcode_minus_L" = yes; then
1893 elif test "$hardcode_shlibpath_var" = yes; then
1894 case :$finalize_shlibpath: in
1896 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1900 # We cannot seem to hardcode it, guess we'll fake it.
1905 if test $linkmode = prog; then
1906 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1907 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1909 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1910 test -n "$add" && deplibs="$add $deplibs"
1913 elif test $linkmode = prog; then
1914 if test "$alldeplibs" = yes &&
1915 { test "$deplibs_check_method" = pass_all ||
1916 { test "$build_libtool_libs" = yes &&
1917 test -n "$library_names"; }; }; then
1918 # We only need to search for static libraries
1922 # Try to link the static library
1923 # Here we assume that one of hardcode_direct or hardcode_minus_L
1924 # is not unsupported. This is valid on all known static and
1926 if test "$hardcode_direct" != unsupported; then
1927 test -n "$old_library" && linklib="$old_library"
1928 compile_deplibs="$dir/$linklib $compile_deplibs"
1929 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1931 compile_deplibs="-l$name -L$dir $compile_deplibs"
1932 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1934 elif test "$build_libtool_libs" = yes; then
1935 # Not a shared library
1936 if test "$deplibs_check_method" != pass_all; then
1937 # We're trying link a shared library against a static one
1938 # but the system doesn't support it.
1940 # Just print a warning and add the library to dependency_libs so
1941 # that the program can be linked against the static library.
1943 echo "*** Warning: This library needs some functionality provided by $lib."
1944 echo "*** I have the capability to make that library automatically link in when"
1945 echo "*** you link to this library. But I can only do this if you have a"
1946 echo "*** shared version of the library, which you do not appear to have."
1947 if test "$module" = yes; then
1948 echo "*** Therefore, libtool will create a static module, that should work "
1949 echo "*** as long as the dlopening application is linked with the -dlopen flag."
1950 if test -z "$global_symbol_pipe"; then
1952 echo "*** However, this would only work if libtool was able to extract symbol"
1953 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1954 echo "*** not find such a program. So, this module is probably useless."
1955 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1957 if test "$build_old_libs" = no; then
1958 build_libtool_libs=module
1961 build_libtool_libs=no
1965 convenience="$convenience $dir/$old_library"
1966 old_convenience="$old_convenience $dir/$old_library"
1967 deplibs="$dir/$old_library $deplibs"
1970 fi # link shared/static library?
1972 if test $linkmode = lib; then
1973 if test -n "$dependency_libs" &&
1974 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1975 test $link_static = yes; }; then
1976 # Extract -R from dependency_libs
1978 for libdir in $dependency_libs; do
1980 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1982 *" $temp_xrpath "*) ;;
1983 *) xrpath="$xrpath $temp_xrpath";;
1985 *) temp_deplibs="$temp_deplibs $libdir";;
1988 dependency_libs="$temp_deplibs"
1991 newlib_search_path="$newlib_search_path $absdir"
1992 # Link against this library
1993 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
1994 # ... and its dependency_libs
1996 for deplib in $dependency_libs; do
1997 newdependency_libs="$deplib $newdependency_libs"
1998 case "$tmp_libs " in
1999 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2001 tmp_libs="$tmp_libs $deplib"
2004 if test $link_all_deplibs != no; then
2005 # Add the search paths of all dependency libraries
2006 for deplib in $dependency_libs; do
2008 -L*) path="$deplib" ;;
2010 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2011 test "X$dir" = "X$deplib" && dir="."
2012 # We need an absolute path.
2014 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2016 absdir=`cd "$dir" && pwd`
2017 if test -z "$absdir"; then
2018 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2023 if grep "^installed=no" $deplib > /dev/null; then
2024 path="-L$absdir/$objdir"
2026 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2027 if test -z "$libdir"; then
2028 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2031 if test "$absdir" != "$libdir"; then
2032 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2039 case " $deplibs " in
2041 *) deplibs="$deplibs $path" ;;
2044 fi # link_all_deplibs != no
2046 done # for deplib in $libs
2047 if test $pass = dlpreopen; then
2048 # Link the dlpreopened libraries before other libraries
2049 for deplib in $save_deplibs; do
2050 deplibs="$deplib $deplibs"
2053 if test $pass != dlopen; then
2054 test $pass != scan && dependency_libs="$newdependency_libs"
2055 if test $pass != conv; then
2056 # Make sure lib_search_path contains only unique directories.
2058 for dir in $newlib_search_path; do
2059 case "$lib_search_path " in
2061 *) lib_search_path="$lib_search_path $dir" ;;
2067 if test "$linkmode,$pass" != "prog,link"; then
2070 vars="compile_deplibs finalize_deplibs"
2072 for var in $vars dependency_libs; do
2073 # Add libraries to $var in reverse order
2074 eval tmp_libs=\"\$$var\"
2076 for deplib in $tmp_libs; do
2078 -L*) new_libs="$deplib $new_libs" ;;
2080 case " $specialdeplibs " in
2081 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2083 case " $new_libs " in
2085 *) new_libs="$deplib $new_libs" ;;
2093 for deplib in $new_libs; do
2096 case " $tmp_libs " in
2098 *) tmp_libs="$tmp_libs $deplib" ;;
2101 *) tmp_libs="$tmp_libs $deplib" ;;
2104 eval $var=\"$tmp_libs\"
2107 if test "$pass" = "conv" &&
2108 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2109 libs="$deplibs" # reset libs
2113 if test $linkmode = prog; then
2114 dlfiles="$newdlfiles"
2115 dlprefiles="$newdlprefiles"
2120 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2121 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2124 if test -n "$rpath"; then
2125 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2128 if test -n "$xrpath"; then
2129 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2132 if test -n "$vinfo"; then
2133 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2136 if test -n "$release"; then
2137 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2140 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2141 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2144 # Now set the variables for building old libraries.
2145 build_libtool_libs=no
2147 objs="$objs$old_deplibs"
2151 # Make sure we only generate libraries of the form `libNAME.la'.
2154 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2155 eval libname=\"$libname_spec\"
2158 if test "$module" = no; then
2159 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2163 if test "$need_lib_prefix" != no; then
2164 # Add the "lib" prefix for modules if required
2165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2166 eval libname=\"$libname_spec\"
2168 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2173 if test -n "$objs"; then
2174 if test "$deplibs_check_method" != pass_all; then
2175 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2179 echo "*** Warning: Linking the shared library $output against the non-libtool"
2180 echo "*** objects $objs is not portable!"
2181 libobjs="$libobjs $objs"
2185 if test "$dlself" != no; then
2186 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2190 if test $# -gt 2; then
2191 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2196 if test -z "$rpath"; then
2197 if test "$build_libtool_libs" = yes; then
2198 # Building a libtool convenience library.
2200 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2201 build_libtool_libs=convenience
2205 if test -n "$vinfo"; then
2206 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2209 if test -n "$release"; then
2210 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2214 # Parse the version information argument.
2215 save_ifs="$IFS"; IFS=':'
2216 set dummy $vinfo 0 0 0
2219 if test -n "$8"; then
2220 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2229 # Check that each of the things are valid numbers.
2231 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2233 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2234 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2240 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2242 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2243 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2249 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2251 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2252 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2257 if test $age -gt $current; then
2258 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2259 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2263 # Calculate the version variables.
2267 case $version_type in
2271 # Like Linux, but with the current version available in
2272 # verstring for coding it into the library header
2273 major=.`expr $current - $age`
2274 versuffix="$major.$age.$revision"
2275 # Darwin ld doesn't like 0 for these options...
2276 minor_current=`expr $current + 1`
2277 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2282 versuffix=".$current.$revision";
2287 versuffix=".$current";
2291 major=`expr $current - $age + 1`
2292 verstring="sgi$major.$revision"
2294 # Add in all the interfaces that we are compatible with.
2296 while test $loop != 0; do
2297 iface=`expr $revision - $loop`
2298 loop=`expr $loop - 1`
2299 verstring="sgi$major.$iface:$verstring"
2302 # Before this point, $major must not contain `.'.
2304 versuffix="$major.$revision"
2308 major=.`expr $current - $age`
2309 versuffix="$major.$age.$revision"
2313 major=`expr $current - $age`
2314 versuffix=".$current.$age.$revision"
2315 verstring="$current.$age.$revision"
2317 # Add in all the interfaces that we are compatible with.
2319 while test $loop != 0; do
2320 iface=`expr $current - $loop`
2321 loop=`expr $loop - 1`
2322 verstring="$verstring:${iface}.0"
2325 # Make executables depend on our current version.
2326 verstring="$verstring:${current}.0"
2331 versuffix=".$current.$revision"
2335 # Use '-' rather than '.', since we only want one
2336 # extension on DOS 8.3 filesystems.
2337 major=`expr $current - $age`
2342 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2343 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2348 # Clear the version info if we defaulted, and they specified a release.
2349 if test -z "$vinfo" && test -n "$release"; then
2352 case $version_type in
2354 # we can't check for "0.0" in archive_cmds due to quoting
2355 # problems, so we reset it completely
2362 if test "$need_version" = no; then
2369 # Remove version info from name if versioning should be avoided
2370 if test "$avoid_version" = yes && test "$need_version" = no; then
2376 # Check to see if the archive will have undefined symbols.
2377 if test "$allow_undefined" = yes; then
2378 if test "$allow_undefined_flag" = unsupported; then
2379 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2380 build_libtool_libs=no
2384 # Don't allow undefined symbols.
2385 allow_undefined_flag="$no_undefined_flag"
2389 if test "$mode" != relink; then
2390 # Remove our outputs.
2391 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2392 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2395 # Now set the variables for building old libraries.
2396 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2397 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2399 # Transform .lo files to .o files.
2400 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2403 # Eliminate all temporary directories.
2404 for path in $notinst_path; do
2405 lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
2406 deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
2407 dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
2410 if test -n "$xrpath"; then
2411 # If the user specified any rpath flags, then add them.
2413 for libdir in $xrpath; do
2414 temp_xrpath="$temp_xrpath -R$libdir"
2415 case "$finalize_rpath " in
2417 *) finalize_rpath="$finalize_rpath $libdir" ;;
2420 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2421 dependency_libs="$temp_xrpath $dependency_libs"
2425 # Make sure dlfiles contains only unique files that won't be dlpreopened
2426 old_dlfiles="$dlfiles"
2428 for lib in $old_dlfiles; do
2429 case " $dlprefiles $dlfiles " in
2431 *) dlfiles="$dlfiles $lib" ;;
2435 # Make sure dlprefiles contains only unique files
2436 old_dlprefiles="$dlprefiles"
2438 for lib in $old_dlprefiles; do
2439 case "$dlprefiles " in
2441 *) dlprefiles="$dlprefiles $lib" ;;
2445 if test "$build_libtool_libs" = yes; then
2446 if test -n "$rpath"; then
2448 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2449 # these systems don't actually have a c library (as such)!
2451 *-*-rhapsody* | *-*-darwin1.[012])
2452 # Rhapsody C library is in the System framework
2453 deplibs="$deplibs -framework System"
2456 # Don't link with libc until the a.out ld.so is fixed.
2459 # Do not include libc due to us having libc/libc_r.
2462 # Add libc to deplibs on all other systems if necessary.
2463 if test $build_libtool_need_lc = "yes"; then
2464 deplibs="$deplibs -lc"
2470 # Transform deplibs into only deplibs that can be linked in shared.
2472 libname_save=$libname
2473 release_save=$release
2474 versuffix_save=$versuffix
2476 # I'm not sure if I'm treating the release correctly. I think
2477 # release should show up in the -l (ie -lgmp5) so we don't want to
2478 # add it in twice. Is that correct?
2484 case $deplibs_check_method in
2486 # Don't check for shared/static. Everything works.
2487 # This might be a little naive. We might want to check
2488 # whether the library exists or not. But this is on
2489 # osf3 & osf4 and I'm not really sure... Just
2490 # implementing what was already the behaviour.
2494 # This code stresses the "libraries are programs" paradigm to its
2495 # limits. Maybe even breaks it. We compile a program, linking it
2496 # against the deplibs as a proxy for the library. Then we can check
2497 # whether they linked in statically or dynamically with ldd.
2499 cat > conftest.c <<EOF
2500 int main() { return 0; }
2503 $CC -o conftest conftest.c $deplibs
2504 if test $? -eq 0 ; then
2505 ldd_output=`ldd conftest`
2506 for i in $deplibs; do
2507 name="`expr $i : '-l\(.*\)'`"
2508 # If $name is empty we are operating on a -L argument.
2509 if test -n "$name" && test "$name" != "0"; then
2510 libname=`eval \\$echo \"$libname_spec\"`
2511 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2512 set dummy $deplib_matches
2514 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2515 newdeplibs="$newdeplibs $i"
2519 echo "*** Warning: This library needs some functionality provided by $i."
2520 echo "*** I have the capability to make that library automatically link in when"
2521 echo "*** you link to this library. But I can only do this if you have a"
2522 echo "*** shared version of the library, which you do not appear to have."
2525 newdeplibs="$newdeplibs $i"
2529 # Error occured in the first compile. Let's try to salvage the situation:
2530 # Compile a seperate program for each library.
2531 for i in $deplibs; do
2532 name="`expr $i : '-l\(.*\)'`"
2533 # If $name is empty we are operating on a -L argument.
2534 if test -n "$name" && test "$name" != "0"; then
2536 $CC -o conftest conftest.c $i
2538 if test $? -eq 0 ; then
2539 ldd_output=`ldd conftest`
2540 libname=`eval \\$echo \"$libname_spec\"`
2541 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2542 set dummy $deplib_matches
2544 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2545 newdeplibs="$newdeplibs $i"
2549 echo "*** Warning: This library needs some functionality provided by $i."
2550 echo "*** I have the capability to make that library automatically link in when"
2551 echo "*** you link to this library. But I can only do this if you have a"
2552 echo "*** shared version of the library, which you do not appear to have."
2557 echo "*** Warning! Library $i is needed by this library but I was not able to"
2558 echo "*** make it link in! You will probably need to install it or some"
2559 echo "*** library that it depends on before this library will be fully"
2560 echo "*** functional. Installing it before continuing would be even better."
2563 newdeplibs="$newdeplibs $i"
2569 set dummy $deplibs_check_method
2570 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2571 for a_deplib in $deplibs; do
2572 name="`expr $a_deplib : '-l\(.*\)'`"
2573 # If $name is empty we are operating on a -L argument.
2574 if test -n "$name" && test "$name" != "0"; then
2575 libname=`eval \\$echo \"$libname_spec\"`
2576 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2577 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2578 for potent_lib in $potential_libs; do
2579 # Follow soft links.
2580 if ls -lLd "$potent_lib" 2>/dev/null \
2581 | grep " -> " >/dev/null; then
2584 # The statement above tries to avoid entering an
2585 # endless loop below, in case of cyclic links.
2586 # We might still enter an endless loop, since a link
2587 # loop can be closed while we follow links,
2589 potlib="$potent_lib"
2590 while test -h "$potlib" 2>/dev/null; do
2591 potliblink=`ls -ld $potlib | sed 's/.* -> //'`
2593 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2594 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2597 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2599 | egrep "$file_magic_regex" > /dev/null; then
2600 newdeplibs="$newdeplibs $a_deplib"
2606 if test -n "$a_deplib" ; then
2609 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2610 echo "*** I have the capability to make that library automatically link in when"
2611 echo "*** you link to this library. But I can only do this if you have a"
2612 echo "*** shared version of the library, which you do not appear to have."
2615 # Add a -L argument.
2616 newdeplibs="$newdeplibs $a_deplib"
2618 done # Gone through all deplibs.
2621 set dummy $deplibs_check_method
2622 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2623 for a_deplib in $deplibs; do
2624 name="`expr $a_deplib : '-l\(.*\)'`"
2625 # If $name is empty we are operating on a -L argument.
2626 if test -n "$name" && test "$name" != "0"; then
2627 libname=`eval \\$echo \"$libname_spec\"`
2628 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2629 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2630 for potent_lib in $potential_libs; do
2631 if eval echo \"$potent_lib\" 2>/dev/null \
2633 | egrep "$match_pattern_regex" > /dev/null; then
2634 newdeplibs="$newdeplibs $a_deplib"
2640 if test -n "$a_deplib" ; then
2643 echo "*** Warning: This library needs some functionality provided by $a_deplib."
2644 echo "*** I have the capability to make that library automatically link in when"
2645 echo "*** you link to this library. But I can only do this if you have a"
2646 echo "*** shared version of the library, which you do not appear to have."
2649 # Add a -L argument.
2650 newdeplibs="$newdeplibs $a_deplib"
2652 done # Gone through all deplibs.
2656 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2657 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2658 grep . >/dev/null; then
2660 if test "X$deplibs_check_method" = "Xnone"; then
2661 echo "*** Warning: inter-library dependencies are not supported in this platform."
2663 echo "*** Warning: inter-library dependencies are not known to be supported."
2665 echo "*** All declared inter-library dependencies are being dropped."
2670 versuffix=$versuffix_save
2672 release=$release_save
2673 libname=$libname_save
2677 *-*-rhapsody* | *-*-darwin1.[012])
2678 # On Rhapsody replace the C library is the System framework
2679 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2683 if test "$droppeddeps" = yes; then
2684 if test "$module" = yes; then
2686 echo "*** Warning: libtool could not satisfy all declared inter-library"
2687 echo "*** dependencies of module $libname. Therefore, libtool will create"
2688 echo "*** a static module, that should work as long as the dlopening"
2689 echo "*** application is linked with the -dlopen flag."
2690 if test -z "$global_symbol_pipe"; then
2692 echo "*** However, this would only work if libtool was able to extract symbol"
2693 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2694 echo "*** not find such a program. So, this module is probably useless."
2695 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2697 if test "$build_old_libs" = no; then
2698 oldlibs="$output_objdir/$libname.$libext"
2699 build_libtool_libs=module
2702 build_libtool_libs=no
2705 echo "*** The inter-library dependencies that have been dropped here will be"
2706 echo "*** automatically added whenever a program is linked with this library"
2707 echo "*** or is declared to -dlopen it."
2709 if test $allow_undefined = no; then
2711 echo "*** Since this library must not contain undefined symbols,"
2712 echo "*** because either the platform does not support them or"
2713 echo "*** it was explicitly requested with -no-undefined,"
2714 echo "*** libtool will only create a static version of it."
2715 if test "$build_old_libs" = no; then
2716 oldlibs="$output_objdir/$libname.$libext"
2717 build_libtool_libs=module
2720 build_libtool_libs=no
2725 # Done checking deplibs!
2729 # All the library-specific variables (install_libdir is set above).
2734 # Test again, we may have decided not to build it any more
2735 if test "$build_libtool_libs" = yes; then
2736 if test $hardcode_into_libs = yes; then
2737 # Hardcode the library paths
2740 rpath="$finalize_rpath"
2741 test "$mode" != relink && rpath="$compile_rpath$rpath"
2742 for libdir in $rpath; do
2743 if test -n "$hardcode_libdir_flag_spec"; then
2744 if test -n "$hardcode_libdir_separator"; then
2745 if test -z "$hardcode_libdirs"; then
2746 hardcode_libdirs="$libdir"
2748 # Just accumulate the unique libdirs.
2749 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2750 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2753 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2758 eval flag=\"$hardcode_libdir_flag_spec\"
2759 dep_rpath="$dep_rpath $flag"
2761 elif test -n "$runpath_var"; then
2762 case "$perm_rpath " in
2764 *) perm_rpath="$perm_rpath $libdir" ;;
2768 # Substitute the hardcoded libdirs into the rpath.
2769 if test -n "$hardcode_libdir_separator" &&
2770 test -n "$hardcode_libdirs"; then
2771 libdir="$hardcode_libdirs"
2772 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2774 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2775 # We should set the runpath_var.
2777 for dir in $perm_rpath; do
2780 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2782 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2785 shlibpath="$finalize_shlibpath"
2786 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2787 if test -n "$shlibpath"; then
2788 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2791 # Get the real and link names of the library.
2792 eval library_names=\"$library_names_spec\"
2793 set dummy $library_names
2797 if test -n "$soname_spec"; then
2798 eval soname=\"$soname_spec\"
2802 test -z "$dlname" && dlname=$soname
2804 lib="$output_objdir/$realname"
2807 linknames="$linknames $link"
2810 # Ensure that we have .o objects for linkers which dislike .lo
2811 # (e.g. aix) in case we are running --disable-static
2812 for obj in $libobjs; do
2813 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2814 if test "X$xdir" = "X$obj"; then
2819 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2820 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2821 if test ! -f $xdir/$oldobj; then
2822 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2823 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2827 # Use standard objects if they are pic
2828 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2830 # Prepare the list of exported symbols
2831 if test -z "$export_symbols"; then
2832 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2833 $show "generating symbol list for \`$libname.la'"
2834 export_symbols="$output_objdir/$libname.exp"
2835 $run $rm $export_symbols
2836 eval cmds=\"$export_symbols_cmds\"
2837 save_ifs="$IFS"; IFS='~'
2838 for cmd in $cmds; do
2841 $run eval "$cmd" || exit $?
2844 if test -n "$export_symbols_regex"; then
2845 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2846 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2847 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2848 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2853 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2854 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2857 if test -n "$convenience"; then
2858 if test -n "$whole_archive_flag_spec"; then
2859 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2861 gentop="$output_objdir/${outputname}x"
2862 $show "${rm}r $gentop"
2863 $run ${rm}r "$gentop"
2864 $show "mkdir $gentop"
2865 $run mkdir "$gentop"
2867 if test $status -ne 0 && test ! -d "$gentop"; then
2870 generated="$generated $gentop"
2872 for xlib in $convenience; do
2873 # Extract the objects.
2875 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2876 *) xabs=`pwd`"/$xlib" ;;
2878 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2879 xdir="$gentop/$xlib"
2881 $show "${rm}r $xdir"
2886 if test $status -ne 0 && test ! -d "$xdir"; then
2889 $show "(cd $xdir && $AR x $xabs)"
2890 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2892 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2897 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2898 eval flag=\"$thread_safe_flag_spec\"
2899 linker_flags="$linker_flags $flag"
2902 # Make a backup of the uninstalled library when relinking
2903 if test "$mode" = relink; then
2904 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2907 # Do each of the archive commands.
2908 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2909 eval cmds=\"$archive_expsym_cmds\"
2911 eval cmds=\"$archive_cmds\"
2913 save_ifs="$IFS"; IFS='~'
2914 for cmd in $cmds; do
2917 $run eval "$cmd" || exit $?
2921 # Restore the uninstalled library and exit
2922 if test "$mode" = relink; then
2923 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2927 # Create links to the real library.
2928 for linkname in $linknames; do
2929 if test "$realname" != "$linkname"; then
2930 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2931 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2935 # If -module or -export-dynamic was specified, set the dlname.
2936 if test "$module" = yes || test "$export_dynamic" = yes; then
2937 # On all known operating systems, these are identical.
2944 if test -n "$deplibs"; then
2945 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2948 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2949 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
2952 if test -n "$rpath"; then
2953 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
2956 if test -n "$xrpath"; then
2957 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
2960 if test -n "$vinfo"; then
2961 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
2964 if test -n "$release"; then
2965 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
2970 if test -n "$objs$old_deplibs"; then
2971 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
2975 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
2983 # Delete the old objects.
2984 $run $rm $obj $libobj
2986 # Objects from convenience libraries. This assumes
2987 # single-version convenience libraries. Whenever we create
2988 # different ones for PIC/non-PIC, this we'll have to duplicate
2992 # reload_cmds runs $LD directly, so let us get rid of
2993 # -Wl from whole_archive_flag_spec
2996 if test -n "$convenience"; then
2997 if test -n "$whole_archive_flag_spec"; then
2998 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3000 gentop="$output_objdir/${obj}x"
3001 $show "${rm}r $gentop"
3002 $run ${rm}r "$gentop"
3003 $show "mkdir $gentop"
3004 $run mkdir "$gentop"
3006 if test $status -ne 0 && test ! -d "$gentop"; then
3009 generated="$generated $gentop"
3011 for xlib in $convenience; do
3012 # Extract the objects.
3014 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3015 *) xabs=`pwd`"/$xlib" ;;
3017 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3018 xdir="$gentop/$xlib"
3020 $show "${rm}r $xdir"
3025 if test $status -ne 0 && test ! -d "$xdir"; then
3028 $show "(cd $xdir && $AR x $xabs)"
3029 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3031 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3036 # Create the old-style object.
3037 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
3040 eval cmds=\"$reload_cmds\"
3041 save_ifs="$IFS"; IFS='~'
3042 for cmd in $cmds; do
3045 $run eval "$cmd" || exit $?
3049 # Exit if we aren't doing a library object file.
3050 if test -z "$libobj"; then
3051 if test -n "$gentop"; then
3052 $show "${rm}r $gentop"
3059 if test "$build_libtool_libs" != yes; then
3060 if test -n "$gentop"; then
3061 $show "${rm}r $gentop"
3065 # Create an invalid libtool object if no PIC, so that we don't
3066 # accidentally link it into a program.
3067 $show "echo timestamp > $libobj"
3068 $run eval "echo timestamp > $libobj" || exit $?
3072 if test -n "$pic_flag" || test "$pic_mode" != default; then
3073 # Only do commands if we really have different PIC objects.
3074 reload_objs="$libobjs $reload_conv_objs"
3076 eval cmds=\"$reload_cmds\"
3077 save_ifs="$IFS"; IFS='~'
3078 for cmd in $cmds; do
3081 $run eval "$cmd" || exit $?
3085 # Just create a symlink.
3088 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3089 if test "X$xdir" = "X$libobj"; then
3094 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3095 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3096 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3097 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3100 if test -n "$gentop"; then
3101 $show "${rm}r $gentop"
3110 *cygwin*) output=`echo $output | sed -e 's,.exe$,,;s,$,.exe,'` ;;
3112 if test -n "$vinfo"; then
3113 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3116 if test -n "$release"; then
3117 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3120 if test "$preload" = yes; then
3121 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3122 test "$dlopen_self_static" = unknown; then
3123 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3128 *-*-rhapsody* | *-*-darwin1.[012])
3129 # On Rhapsody replace the C library is the System framework
3130 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3131 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3135 compile_command="$compile_command $compile_deplibs"
3136 finalize_command="$finalize_command $finalize_deplibs"
3138 if test -n "$rpath$xrpath"; then
3139 # If the user specified any rpath flags, then add them.
3140 for libdir in $rpath $xrpath; do
3141 # This is the magic to use -rpath.
3142 case "$finalize_rpath " in
3144 *) finalize_rpath="$finalize_rpath $libdir" ;;
3149 # Now hardcode the library paths
3152 for libdir in $compile_rpath $finalize_rpath; do
3153 if test -n "$hardcode_libdir_flag_spec"; then
3154 if test -n "$hardcode_libdir_separator"; then
3155 if test -z "$hardcode_libdirs"; then
3156 hardcode_libdirs="$libdir"
3158 # Just accumulate the unique libdirs.
3159 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3160 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3163 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3168 eval flag=\"$hardcode_libdir_flag_spec\"
3169 rpath="$rpath $flag"
3171 elif test -n "$runpath_var"; then
3172 case "$perm_rpath " in
3174 *) perm_rpath="$perm_rpath $libdir" ;;
3178 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3179 case :$dllsearchpath: in
3181 *) dllsearchpath="$dllsearchpath:$libdir";;
3186 # Substitute the hardcoded libdirs into the rpath.
3187 if test -n "$hardcode_libdir_separator" &&
3188 test -n "$hardcode_libdirs"; then
3189 libdir="$hardcode_libdirs"
3190 eval rpath=\" $hardcode_libdir_flag_spec\"
3192 compile_rpath="$rpath"
3196 for libdir in $finalize_rpath; do
3197 if test -n "$hardcode_libdir_flag_spec"; then
3198 if test -n "$hardcode_libdir_separator"; then
3199 if test -z "$hardcode_libdirs"; then
3200 hardcode_libdirs="$libdir"
3202 # Just accumulate the unique libdirs.
3203 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3204 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3207 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3212 eval flag=\"$hardcode_libdir_flag_spec\"
3213 rpath="$rpath $flag"
3215 elif test -n "$runpath_var"; then
3216 case "$finalize_perm_rpath " in
3218 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3222 # Substitute the hardcoded libdirs into the rpath.
3223 if test -n "$hardcode_libdir_separator" &&
3224 test -n "$hardcode_libdirs"; then
3225 libdir="$hardcode_libdirs"
3226 eval rpath=\" $hardcode_libdir_flag_spec\"
3228 finalize_rpath="$rpath"
3230 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3231 # Transform all the library objects into standard objects.
3232 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3233 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3237 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3238 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3239 dlsyms="${outputname}S.c"
3241 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3245 if test -n "$dlsyms"; then
3249 # Discover the nlist of each of the dlfiles.
3250 nlist="$output_objdir/${outputname}.nm"
3252 $show "$rm $nlist ${nlist}S ${nlist}T"
3253 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3255 # Parse the name list into a source file.
3256 $show "creating $output_objdir/$dlsyms"
3258 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3259 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3260 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3266 /* Prevent the only kind of declaration conflicts we can make. */
3267 #define lt_preloaded_symbols some_other_symbol
3269 /* External symbol declarations for the compiler. */\
3272 if test "$dlself" = yes; then
3273 $show "generating symbol list for \`$output'"
3275 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3277 # Add our own program objects to the symbol list.
3278 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3279 for arg in $progfiles; do
3280 $show "extracting global C symbols from \`$arg'"
3281 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3284 if test -n "$exclude_expsyms"; then
3285 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3286 $run eval '$mv "$nlist"T "$nlist"'
3289 if test -n "$export_symbols_regex"; then
3290 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3291 $run eval '$mv "$nlist"T "$nlist"'
3294 # Prepare the list of exported symbols
3295 if test -z "$export_symbols"; then
3296 export_symbols="$output_objdir/$output.exp"
3297 $run $rm $export_symbols
3298 $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3300 $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3301 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3302 $run eval 'mv "$nlist"T "$nlist"'
3306 for arg in $dlprefiles; do
3307 $show "extracting global C symbols from \`$arg'"
3308 name=`echo "$arg" | sed -e 's%^.*/%%'`
3309 $run eval 'echo ": $name " >> "$nlist"'
3310 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3313 if test -z "$run"; then
3314 # Make sure we have at least an empty file.
3315 test -f "$nlist" || : > "$nlist"
3317 if test -n "$exclude_expsyms"; then
3318 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3319 $mv "$nlist"T "$nlist"
3322 # Try sorting and uniquifying the output.
3323 if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3326 grep -v "^: " < "$nlist" > "$nlist"S
3329 if test -f "$nlist"S; then
3330 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3332 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3335 $echo >> "$output_objdir/$dlsyms" "\
3337 #undef lt_preloaded_symbols
3339 #if defined (__STDC__) && __STDC__
3340 # define lt_ptr void *
3342 # define lt_ptr char *
3346 /* The mapping between symbol names and symbols. */
3351 lt_preloaded_symbols[] =
3355 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3357 $echo >> "$output_objdir/$dlsyms" "\
3361 /* This works around a problem in FreeBSD linker */
3362 #ifdef FREEBSD_WORKAROUND
3363 static const void *lt_preloaded_setup() {
3364 return lt_preloaded_symbols;
3374 pic_flag_for_symtable=
3376 # compiling the symbol table file with pic_flag works around
3377 # a FreeBSD bug that causes programs to crash when -lm is
3378 # linked before any other PIC object. But we must not use
3379 # pic_flag when linking with -static. The problem exists in
3380 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3381 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3382 case "$compile_command " in
3384 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3387 case "$compile_command " in
3389 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3393 # Now compile the dynamic symbol file.
3394 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3395 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3397 # Clean up the generated files.
3398 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3399 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3401 # Transform the symbol file into the correct name.
3402 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3403 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3406 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3411 # We keep going just in case the user didn't refer to
3412 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3413 # really was required.
3415 # Nullify the symbol file.
3416 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3417 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3420 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3421 # Replace the output file specification.
3422 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3423 link_command="$compile_command$compile_rpath"
3425 # We have no uninstalled library dependencies, so finalize right now.
3426 $show "$link_command"
3427 $run eval "$link_command"
3430 # Delete the generated files.
3431 if test -n "$dlsyms"; then
3432 $show "$rm $output_objdir/${outputname}S.${objext}"
3433 $run $rm "$output_objdir/${outputname}S.${objext}"
3439 if test -n "$shlibpath_var"; then
3440 # We should set the shlibpath_var
3442 for dir in $temp_rpath; do
3444 [\\/]* | [A-Za-z]:[\\/]*)
3449 # Relative path: add a thisdir entry.
3450 rpath="$rpath\$thisdir/$dir:"
3457 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3458 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3460 if test -n "$finalize_shlibpath"; then
3461 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3466 if test -n "$runpath_var"; then
3467 if test -n "$perm_rpath"; then
3468 # We should set the runpath_var.
3470 for dir in $perm_rpath; do
3473 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3475 if test -n "$finalize_perm_rpath"; then
3476 # We should set the runpath_var.
3478 for dir in $finalize_perm_rpath; do
3481 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3485 if test "$no_install" = yes; then
3486 # We don't need to create a wrapper script.
3487 link_command="$compile_var$compile_command$compile_rpath"
3488 # Replace the output file specification.
3489 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3490 # Delete the old output file.
3492 # Link the executable and exit
3493 $show "$link_command"
3494 $run eval "$link_command" || exit $?
3498 if test "$hardcode_action" = relink; then
3499 # Fast installation is not supported
3500 link_command="$compile_var$compile_command$compile_rpath"
3501 relink_command="$finalize_var$finalize_command$finalize_rpath"
3503 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3504 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3506 if test "$fast_install" != no; then
3507 link_command="$finalize_var$compile_command$finalize_rpath"
3508 if test "$fast_install" = yes; then
3509 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3511 # fast_install is set to needless
3515 link_command="$compile_var$compile_command$compile_rpath"
3516 relink_command="$finalize_var$finalize_command$finalize_rpath"
3520 # Replace the output file specification.
3521 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3523 # Delete the old output files.
3524 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3526 $show "$link_command"
3527 $run eval "$link_command" || exit $?
3529 # Now create the wrapper script.
3530 $show "creating $output"
3532 # Quote the relink command for shipping.
3533 if test -n "$relink_command"; then
3534 # Preserve any variables that may affect compiler behavior
3535 for var in $variables_saved_for_relink; do
3536 if eval test -z \"\${$var+set}\"; then
3537 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3538 elif eval var_value=\$$var; test -z "$var_value"; then
3539 relink_command="$var=; export $var; $relink_command"
3541 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3542 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3545 relink_command="cd `pwd`; $relink_command"
3546 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3549 # Quote $echo for shipping.
3550 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3552 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3553 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3555 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3557 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3560 # Only actually do things if our run command is non-null.
3561 if test -z "$run"; then
3562 # win32 will think the script is a binary if it has
3563 # a .exe suffix, so we strip it off here.
3565 *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
3567 # test for cygwin because mv fails w/o .exe extensions
3569 *cygwin*) exeext=.exe ;;
3573 trap "$rm $output; exit 1" 1 2 15
3578 # $output - temporary wrapper script for $objdir/$outputname
3579 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3581 # The $output program cannot be directly executed until all the libtool
3582 # libraries that it depends on are installed.
3584 # This wrapper script should never be moved out of the build directory.
3585 # If it is, it will not operate correctly.
3587 # Sed substitution that helps us do robust quoting. It backslashifies
3588 # metacharacters that are still active within double-quoted strings.
3589 Xsed='sed -e 1s/^X//'
3590 sed_quote_subst='$sed_quote_subst'
3592 # The HP-UX ksh and POSIX shell print the target directory to stdout
3594 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3596 relink_command=\"$relink_command\"
3598 # This environment variable determines our operation mode.
3599 if test \"\$libtool_install_magic\" = \"$magic\"; then
3600 # install mode needs the following variable:
3601 notinst_deplibs='$notinst_deplibs'
3603 # When we are sourced in execute mode, \$file and \$echo are already set.
3604 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3607 # Make sure echo works.
3608 if test \"X\$1\" = X--no-reexec; then
3609 # Discard the --no-reexec flag, and continue.
3611 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3612 # Yippee, \$echo works!
3615 # Restart under the correct shell, and then maybe \$echo will work.
3616 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3622 # Find the directory that this script lives in.
3623 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3624 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3626 # Follow symbolic links until we get to the real thisdir.
3627 file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
3628 while test -n \"\$file\"; do
3629 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3631 # If there was a directory component, then change thisdir.
3632 if test \"x\$destdir\" != \"x\$file\"; then
3633 case \"\$destdir\" in
3634 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3635 *) thisdir=\"\$thisdir/\$destdir\" ;;
3639 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3640 file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
3643 # Try to get the absolute directory name.
3644 absdir=\`cd \"\$thisdir\" && pwd\`
3645 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3648 if test "$fast_install" = yes; then
3650 program=lt-'$outputname'$exeext
3651 progdir=\"\$thisdir/$objdir\"
3653 if test ! -f \"\$progdir/\$program\" || \\
3654 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
3655 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3657 file=\"\$\$-\$program\"
3659 if test ! -d \"\$progdir\"; then
3660 $mkdir \"\$progdir\"
3662 $rm \"\$progdir/\$file\"
3667 # relink executable if necessary
3668 if test -n \"\$relink_command\"; then
3669 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3671 $echo \"\$relink_command_output\" >&2
3672 $rm \"\$progdir/\$file\"
3677 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3678 { $rm \"\$progdir/\$program\";
3679 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3680 $rm \"\$progdir/\$file\"
3684 program='$outputname'
3685 progdir=\"\$thisdir/$objdir\"
3691 if test -f \"\$progdir/\$program\"; then"
3693 # Export our shlibpath_var if we have one.
3694 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3696 # Add our own library path to $shlibpath_var
3697 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3699 # Some systems cannot cope with colon-terminated $shlibpath_var
3700 # The second colon is a workaround for a bug in BeOS R4 sed
3701 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3703 export $shlibpath_var
3707 # fixup the dll searchpath if we need to.
3708 if test -n "$dllsearchpath"; then
3710 # Add the dll search path components to the executable PATH
3711 PATH=$dllsearchpath:\$PATH
3716 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3717 # Run the actual program with our arguments.
3720 # win32 systems need to use the prog path for dll
3722 *-*-cygwin* | *-*-pw32*)
3724 exec \$progdir/\$program \${1+\"\$@\"}
3728 # Backslashes separate directories on plain windows
3729 *-*-mingw | *-*-os2*)
3731 exec \$progdir\\\\\$program \${1+\"\$@\"}
3737 # Export the path to the program.
3738 PATH=\"\$progdir:\$PATH\"
3741 exec \$program \${1+\"\$@\"}
3746 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3750 # The program doesn't exist.
3751 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3752 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3753 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3764 # See if we need to build an old-fashioned archive.
3765 for oldlib in $oldlibs; do
3767 if test "$build_libtool_libs" = convenience; then
3768 oldobjs="$libobjs_save"
3769 addlibs="$convenience"
3770 build_libtool_libs=no
3772 if test "$build_libtool_libs" = module; then
3773 oldobjs="$libobjs_save"
3774 build_libtool_libs=no
3776 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3778 addlibs="$old_convenience"
3781 if test -n "$addlibs"; then
3782 gentop="$output_objdir/${outputname}x"
3783 $show "${rm}r $gentop"
3784 $run ${rm}r "$gentop"
3785 $show "mkdir $gentop"
3786 $run mkdir "$gentop"
3788 if test $status -ne 0 && test ! -d "$gentop"; then
3791 generated="$generated $gentop"
3793 # Add in members from convenience archives.
3794 for xlib in $addlibs; do
3795 # Extract the objects.
3797 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3798 *) xabs=`pwd`"/$xlib" ;;
3800 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3801 xdir="$gentop/$xlib"
3803 $show "${rm}r $xdir"
3808 if test $status -ne 0 && test ! -d "$xdir"; then
3811 $show "(cd $xdir && $AR x $xabs)"
3812 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3814 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3818 # Do each command in the archive commands.
3819 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3820 eval cmds=\"$old_archive_from_new_cmds\"
3822 # Ensure that we have .o objects in place in case we decided
3823 # not to build a shared library, and have fallen back to building
3824 # static libs even though --disable-static was passed!
3825 for oldobj in $oldobjs; do
3826 if test ! -f $oldobj; then
3827 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3828 if test "X$xdir" = "X$oldobj"; then
3833 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3834 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3835 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3836 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3840 eval cmds=\"$old_archive_cmds\"
3842 save_ifs="$IFS"; IFS='~'
3843 for cmd in $cmds; do
3846 $run eval "$cmd" || exit $?
3851 if test -n "$generated"; then
3852 $show "${rm}r$generated"
3853 $run ${rm}r$generated
3856 # Now create the libtool archive.
3860 test "$build_old_libs" = yes && old_library="$libname.$libext"
3861 $show "creating $output"
3863 # Preserve any variables that may affect compiler behavior
3864 for var in $variables_saved_for_relink; do
3865 if eval test -z \"\${$var+set}\"; then
3866 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3867 elif eval var_value=\$$var; test -z "$var_value"; then
3868 relink_command="$var=; export $var; $relink_command"
3870 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3871 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3874 # Quote the link command for shipping.
3875 relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args"
3876 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3878 # Only create the output if not a dry run.
3879 if test -z "$run"; then
3880 for installed in no yes; do
3881 if test "$installed" = yes; then
3882 if test -z "$install_libdir"; then
3885 output="$output_objdir/$outputname"i
3886 # Replace all uninstalled libtool libraries with the installed ones
3888 for deplib in $dependency_libs; do
3891 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3892 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3893 if test -z "$libdir"; then
3894 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3897 newdependency_libs="$newdependency_libs $libdir/$name"
3899 *) newdependency_libs="$newdependency_libs $deplib" ;;
3902 dependency_libs="$newdependency_libs"
3904 for lib in $dlfiles; do
3905 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3906 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3907 if test -z "$libdir"; then
3908 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3911 newdlfiles="$newdlfiles $libdir/$name"
3913 dlfiles="$newdlfiles"
3915 for lib in $dlprefiles; do
3916 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3917 eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3918 if test -z "$libdir"; then
3919 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3922 newdlprefiles="$newdlprefiles $libdir/$name"
3924 dlprefiles="$newdlprefiles"
3927 # place dlname in correct position for cygwin
3929 case $host,$output,$installed,$module,$dlname in
3930 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3933 # $outputname - a libtool library file
3934 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3936 # Please DO NOT delete this file!
3937 # It is necessary for linking the library.
3939 # The name that we can dlopen(3).
3942 # Names of this library.
3943 library_names='$library_names'
3945 # The name of the static archive.
3946 old_library='$old_library'
3948 # Libraries that this one depends upon.
3949 dependency_libs='$dependency_libs'
3951 # Version information for $libname.
3956 # Is this an already installed library?
3957 installed=$installed
3959 # Files to dlopen/dlpreopen
3961 dlpreopen='$dlprefiles'
3963 # Directory that this library needs to be installed in:
3964 libdir='$install_libdir'"
3965 if test "$installed" = no && test $need_relink = yes; then
3967 relink_command=\"$relink_command\""
3972 # Do a symbolic link so that the libtool archive can be found in
3973 # LD_LIBRARY_PATH before the program is installed.
3974 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
3975 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
3981 # libtool install mode
3983 modename="$modename: install"
3985 # There may be an optional sh(1) argument at the beginning of
3986 # install_prog (especially on Windows NT).
3987 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
3988 # Allow the use of GNU shtool's install command.
3989 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
3990 # Aesthetically quote it.
3991 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
3993 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
3997 install_prog="$arg "
4005 # The real first argument should be the name of the installation program.
4006 # Aesthetically quote it.
4007 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4009 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4013 install_prog="$install_prog$arg"
4015 # We need to accept at least all the BSD install flags.
4025 if test -n "$dest"; then
4026 files="$files $dest"
4044 # If the previous option needed an argument, then skip it.
4045 if test -n "$prev"; then
4054 # Aesthetically quote the argument.
4055 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4057 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4061 install_prog="$install_prog $arg"
4064 if test -z "$install_prog"; then
4065 $echo "$modename: you must specify an install program" 1>&2
4070 if test -n "$prev"; then
4071 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4076 if test -z "$files"; then
4077 if test -z "$dest"; then
4078 $echo "$modename: no file or destination specified" 1>&2
4080 $echo "$modename: you must specify a destination" 1>&2
4086 # Strip any trailing slash from the destination.
4087 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4089 # Check to see that the destination is a directory.
4090 test -d "$dest" && isdir=yes
4091 if test "$isdir" = yes; then
4095 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4096 test "X$destdir" = "X$dest" && destdir=.
4097 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4099 # Not a directory, so check to see that there is only one file specified.
4101 if test $# -gt 2; then
4102 $echo "$modename: \`$dest' is not a directory" 1>&2
4108 [\\/]* | [A-Za-z]:[\\/]*) ;;
4110 for file in $files; do
4114 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4123 # This variable tells wrapper scripts just to set variables rather
4124 # than running their programs.
4125 libtool_install_magic="$magic"
4130 for file in $files; do
4132 # Do each installation.
4135 # Do the static libraries later.
4136 staticlibs="$staticlibs $file"
4140 # Check to see that this really is a libtool archive.
4141 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4143 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4151 # If there is no directory component, then add one.
4153 */* | *\\*) . $file ;;
4157 # Add the libdir to current_libdirs if it is the destination.
4158 if test "X$destdir" = "X$libdir"; then
4159 case "$current_libdirs " in
4161 *) current_libdirs="$current_libdirs $libdir" ;;
4164 # Note the libdir as a future libdir.
4165 case "$future_libdirs " in
4167 *) future_libdirs="$future_libdirs $libdir" ;;
4171 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4172 test "X$dir" = "X$file/" && dir=
4175 if test -n "$relink_command"; then
4176 $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
4185 # See the names of the shared library.
4186 set dummy $library_names
4187 if test -n "$2"; then
4193 test -n "$relink_command" && srcname="$realname"T
4195 # Install the shared library and build the symlinks.
4196 $show "$install_prog $dir/$srcname $destdir/$realname"
4197 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4198 if test -n "$stripme" && test -n "$striplib"; then
4199 $show "$striplib $destdir/$realname"
4200 $run eval "$striplib $destdir/$realname" || exit $?
4203 if test $# -gt 0; then
4204 # Delete the old symlinks, and create new ones.
4207 if test "$linkname" != "$realname"; then
4208 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4209 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4214 # Do each command in the postinstall commands.
4215 lib="$destdir/$realname"
4216 eval cmds=\"$postinstall_cmds\"
4217 save_ifs="$IFS"; IFS='~'
4218 for cmd in $cmds; do
4221 $run eval "$cmd" || exit $?
4226 # Install the pseudo-library for information purposes.
4227 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4228 instname="$dir/$name"i
4229 $show "$install_prog $instname $destdir/$name"
4230 $run eval "$install_prog $instname $destdir/$name" || exit $?
4232 # Maybe install the static library, too.
4233 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4237 # Install (i.e. copy) a libtool object.
4239 # Figure out destination file name, if it wasn't already specified.
4240 if test -n "$destname"; then
4241 destfile="$destdir/$destname"
4243 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4244 destfile="$destdir/$destfile"
4247 # Deduce the name of the destination old-style object file.
4250 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4253 staticdest="$destfile"
4257 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4263 # Install the libtool object if requested.
4264 if test -n "$destfile"; then
4265 $show "$install_prog $file $destfile"
4266 $run eval "$install_prog $file $destfile" || exit $?
4269 # Install the old object if enabled.
4270 if test "$build_old_libs" = yes; then
4271 # Deduce the name of the old-style object file.
4272 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4274 $show "$install_prog $staticobj $staticdest"
4275 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4281 # Figure out destination file name, if it wasn't already specified.
4282 if test -n "$destname"; then
4283 destfile="$destdir/$destname"
4285 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4286 destfile="$destdir/$destfile"
4289 # Do a test to see if this is really a libtool program.
4290 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4294 # If there is no directory component, then add one.
4296 */* | *\\*) . $file ;;
4300 # Check the variables that should have been set.
4301 if test -z "$notinst_deplibs"; then
4302 $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
4307 for lib in $notinst_deplibs; do
4308 # Check to see that each library is installed.
4310 if test -f "$lib"; then
4311 # If there is no directory component, then add one.
4313 */* | *\\*) . $lib ;;
4317 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4318 if test -n "$libdir" && test ! -f "$libfile"; then
4319 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4325 # If there is no directory component, then add one.
4327 */* | *\\*) . $file ;;
4332 if test "$fast_install" = no && test -n "$relink_command"; then
4333 if test "$finalize" = yes && test -z "$run"; then
4335 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4336 tmpdir="$tmpdir/libtool-$$"
4337 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4339 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4342 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4343 outputname="$tmpdir/$file"
4344 # Replace the output file specification.
4345 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4347 $show "$relink_command"
4348 if $run eval "$relink_command"; then :
4350 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4356 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4359 # Install the binary that we compiled earlier.
4360 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4364 # remove .exe since cygwin /usr/bin/install will append another
4366 case $install_prog,$host in
4367 /usr/bin/install*,*cygwin*)
4368 case $file:$destfile in
4373 destfile=$destfile.exe
4376 destfile=`echo $destfile | sed -e 's,.exe$,,'`
4381 $show "$install_prog$stripme $file $destfile"
4382 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4383 test -n "$outputname" && ${rm}r "$tmpdir"
4388 for file in $staticlibs; do
4389 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4391 # Set up the ranlib parameters.
4392 oldlib="$destdir/$name"
4394 $show "$install_prog $file $oldlib"
4395 $run eval "$install_prog \$file \$oldlib" || exit $?
4397 if test -n "$stripme" && test -n "$striplib"; then
4398 $show "$old_striplib $oldlib"
4399 $run eval "$old_striplib $oldlib" || exit $?
4402 # Do each command in the postinstall commands.
4403 eval cmds=\"$old_postinstall_cmds\"
4404 save_ifs="$IFS"; IFS='~'
4405 for cmd in $cmds; do
4408 $run eval "$cmd" || exit $?
4413 if test -n "$future_libdirs"; then
4414 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4417 if test -n "$current_libdirs"; then
4418 # Maybe just do a dry run.
4419 test -n "$run" && current_libdirs=" -n$current_libdirs"
4420 exec_cmd='$SHELL $0 --finish$current_libdirs'
4426 # libtool finish mode
4428 modename="$modename: finish"
4432 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4435 libdirs="$libdirs $dir"
4438 for libdir in $libdirs; do
4439 if test -n "$finish_cmds"; then
4440 # Do each command in the finish commands.
4441 eval cmds=\"$finish_cmds\"
4442 save_ifs="$IFS"; IFS='~'
4443 for cmd in $cmds; do
4446 $run eval "$cmd" || admincmds="$admincmds
4451 if test -n "$finish_eval"; then
4452 # Do the single finish_eval.
4453 eval cmds=\"$finish_eval\"
4454 $run eval "$cmds" || admincmds="$admincmds
4460 # Exit here if they wanted silent mode.
4461 test "$show" = ":" && exit 0
4463 echo "----------------------------------------------------------------------"
4464 echo "Libraries have been installed in:"
4465 for libdir in $libdirs; do
4469 echo "If you ever happen to want to link against installed libraries"
4470 echo "in a given directory, LIBDIR, you must either use libtool, and"
4471 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4472 echo "flag during linking and do at least one of the following:"
4473 if test -n "$shlibpath_var"; then
4474 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4475 echo " during execution"
4477 if test -n "$runpath_var"; then
4478 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4479 echo " during linking"
4481 if test -n "$hardcode_libdir_flag_spec"; then
4483 eval flag=\"$hardcode_libdir_flag_spec\"
4485 echo " - use the \`$flag' linker flag"
4487 if test -n "$admincmds"; then
4488 echo " - have your system administrator run these commands:$admincmds"
4490 if test -f /etc/ld.so.conf; then
4491 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4494 echo "See any operating system documentation about shared libraries for"
4495 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4496 echo "----------------------------------------------------------------------"
4500 # libtool execute mode
4502 modename="$modename: execute"
4504 # The first argument is the command name.
4506 if test -z "$cmd"; then
4507 $echo "$modename: you must specify a COMMAND" 1>&2
4512 # Handle -dlopen flags immediately.
4513 for file in $execute_dlfiles; do
4514 if test ! -f "$file"; then
4515 $echo "$modename: \`$file' is not a file" 1>&2
4523 # Check to see that this really is a libtool archive.
4524 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4526 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4531 # Read the libtool library.
4535 # If there is no directory component, then add one.
4537 */* | *\\*) . $file ;;
4541 # Skip this library if it cannot be dlopened.
4542 if test -z "$dlname"; then
4543 # Warn if it was a shared library.
4544 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4548 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4549 test "X$dir" = "X$file" && dir=.
4551 if test -f "$dir/$objdir/$dlname"; then
4554 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4560 # Just add the directory containing the .lo file.
4561 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4562 test "X$dir" = "X$file" && dir=.
4566 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4571 # Get the absolute pathname.
4572 absdir=`cd "$dir" && pwd`
4573 test -n "$absdir" && dir="$absdir"
4575 # Now add the directory to shlibpath_var.
4576 if eval "test -z \"\$$shlibpath_var\""; then
4577 eval "$shlibpath_var=\"\$dir\""
4579 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4583 # This variable tells wrapper scripts just to set shlibpath_var
4584 # rather than running their programs.
4585 libtool_execute_magic="$magic"
4587 # Check if any of the arguments is a wrapper script.
4594 # Do a test to see if this is really a libtool program.
4595 if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4596 # If there is no directory component, then add one.
4598 */* | *\\*) . $file ;;
4602 # Transform arg to wrapped name.
4603 file="$progdir/$program"
4607 # Quote arguments (to preserve shell metacharacters).
4608 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4609 args="$args \"$file\""
4612 if test -z "$run"; then
4613 if test -n "$shlibpath_var"; then
4614 # Export the shlibpath_var.
4615 eval "export $shlibpath_var"
4618 # Restore saved enviroment variables
4619 if test "${save_LC_ALL+set}" = set; then
4620 LC_ALL="$save_LC_ALL"; export LC_ALL
4622 if test "${save_LANG+set}" = set; then
4623 LANG="$save_LANG"; export LANG
4626 # Now prepare to actually exec the command.
4627 exec_cmd='"$cmd"$args'
4629 # Display what would be done.
4630 if test -n "$shlibpath_var"; then
4631 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4632 $echo "export $shlibpath_var"
4639 # libtool clean and uninstall mode
4641 modename="$modename: $mode"
4647 # This variable tells wrapper scripts just to set variables rather
4648 # than running their programs.
4649 libtool_install_magic="$magic"
4654 -f) rm="$rm $arg"; rmforce=yes ;;
4655 -*) rm="$rm $arg" ;;
4656 *) files="$files $arg" ;;
4660 if test -z "$rm"; then
4661 $echo "$modename: you must specify an RM program" 1>&2
4668 for file in $files; do
4669 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4670 if test "X$dir" = "X$file"; then
4674 objdir="$dir/$objdir"
4676 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4677 test $mode = uninstall && objdir="$dir"
4679 # Remember objdir for removal later, being careful to avoid duplicates
4680 if test $mode = clean; then
4683 *) rmdirs="$rmdirs $objdir" ;;
4687 # Don't error if the file doesn't exist and rm -f was used.
4688 if (test -L "$file") >/dev/null 2>&1 \
4689 || (test -h "$file") >/dev/null 2>&1 \
4690 || test -f "$file"; then
4692 elif test -d "$file"; then
4695 elif test "$rmforce" = yes; then
4703 # Possibly a libtool archive, so verify it.
4704 if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4707 # Delete the libtool libraries and symlinks.
4708 for n in $library_names; do
4709 rmfiles="$rmfiles $objdir/$n"
4711 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4712 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4714 if test $mode = uninstall; then
4715 if test -n "$library_names"; then
4716 # Do each command in the postuninstall commands.
4717 eval cmds=\"$postuninstall_cmds\"
4718 save_ifs="$IFS"; IFS='~'
4719 for cmd in $cmds; do
4723 if test $? != 0 && test "$rmforce" != yes; then
4730 if test -n "$old_library"; then
4731 # Do each command in the old_postuninstall commands.
4732 eval cmds=\"$old_postuninstall_cmds\"
4733 save_ifs="$IFS"; IFS='~'
4734 for cmd in $cmds; do
4738 if test $? != 0 && test "$rmforce" != yes; then
4744 # FIXME: should reinstall the best remaining shared library.
4750 if test "$build_old_libs" = yes; then
4751 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4752 rmfiles="$rmfiles $dir/$oldobj"
4757 # Do a test to see if this is a libtool program.
4758 if test $mode = clean &&
4759 (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4763 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4764 if test "$fast_install" = yes && test -n "$relink_command"; then
4765 rmfiles="$rmfiles $objdir/lt-$name"
4770 $show "$rm $rmfiles"
4771 $run $rm $rmfiles || exit_status=1
4774 # Try to remove the ${objdir}s in the directories where we deleted files
4775 for dir in $rmdirs; do
4776 if test -d "$dir"; then
4778 $run rmdir $dir >/dev/null 2>&1
4786 $echo "$modename: you must specify a MODE" 1>&2
4787 $echo "$generic_help" 1>&2
4792 if test -z "$exec_cmd"; then
4793 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4794 $echo "$generic_help" 1>&2
4797 fi # test -z "$show_help"
4799 if test -n "$exec_cmd"; then
4804 # We need to display help for each of the modes.
4807 "Usage: $modename [OPTION]... [MODE-ARG]...
4809 Provide generalized library-building support services.
4811 --config show all configuration variables
4812 --debug enable verbose shell tracing
4813 -n, --dry-run display commands without modifying any files
4814 --features display basic configuration information and exit
4815 --finish same as \`--mode=finish'
4816 --help display this help message and exit
4817 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4818 --quiet same as \`--silent'
4819 --silent don't print informational messages
4820 --version print version information
4822 MODE must be one of the following:
4824 clean remove files from the build directory
4825 compile compile a source file into a libtool object
4826 execute automatically set library path, then run a program
4827 finish complete the installation of libtool libraries
4828 install install libraries or executables
4829 link create a library or an executable
4830 uninstall remove libraries from an installed directory
4832 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4833 a more detailed description of MODE."
4839 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4841 Remove files from the build directory.
4843 RM is the name of the program to use to delete files associated with each FILE
4844 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4847 If FILE is a libtool library, object or program, all the files associated
4848 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4853 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4855 Compile a source file into a libtool library object.
4857 This mode accepts the following additional options:
4859 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4860 -prefer-pic try to building PIC objects only
4861 -prefer-non-pic try to building non-PIC objects only
4862 -static always build a \`.o' file suitable for static linking
4864 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4865 from the given SOURCEFILE.
4867 The output file name is determined by removing the directory component from
4868 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4869 library object suffix, \`.lo'."
4874 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4876 Automatically set library path, then run a program.
4878 This mode accepts the following additional options:
4880 -dlopen FILE add the directory containing FILE to the library path
4882 This mode sets the library path environment variable according to \`-dlopen'
4885 If any of the ARGS are libtool executable wrappers, then they are translated
4886 into their corresponding uninstalled binary, and any of their required library
4887 directories are added to the library path.
4889 Then, COMMAND is executed, with ARGS as arguments."
4894 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4896 Complete the installation of libtool libraries.
4898 Each LIBDIR is a directory that contains libtool libraries.
4900 The commands that this mode executes may require superuser privileges. Use
4901 the \`--dry-run' option if you just want to see what would be executed."
4906 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4908 Install executables or libraries.
4910 INSTALL-COMMAND is the installation command. The first component should be
4911 either the \`install' or \`cp' program.
4913 The rest of the components are interpreted as arguments to that command (only
4914 BSD-compatible install options are recognized)."
4919 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4921 Link object files or libraries together to form another library, or to
4922 create an executable program.
4924 LINK-COMMAND is a command using the C compiler that you would use to create
4925 a program from several object files.
4927 The following components of LINK-COMMAND are treated specially:
4929 -all-static do not do any dynamic linking at all
4930 -avoid-version do not add a version suffix if possible
4931 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
4932 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
4933 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
4934 -export-symbols SYMFILE
4935 try to export only the symbols listed in SYMFILE
4936 -export-symbols-regex REGEX
4937 try to export only the symbols matching REGEX
4938 -LLIBDIR search LIBDIR for required installed libraries
4939 -lNAME OUTPUT-FILE requires the installed library libNAME
4940 -module build a library that can dlopened
4941 -no-fast-install disable the fast-install mode
4942 -no-install link a not-installable executable
4943 -no-undefined declare that a library does not refer to external symbols
4944 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
4945 -release RELEASE specify package release information
4946 -rpath LIBDIR the created library will eventually be installed in LIBDIR
4947 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
4948 -static do not do any dynamic linking of libtool libraries
4949 -version-info CURRENT[:REVISION[:AGE]]
4950 specify library version info [each variable defaults to 0]
4952 All other options (arguments beginning with \`-') are ignored.
4954 Every other argument is treated as a filename. Files ending in \`.la' are
4955 treated as uninstalled libtool libraries, other files are standard or library
4958 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
4959 only library objects (\`.lo' files) may be specified, and \`-rpath' is
4960 required, except when creating a convenience library.
4962 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
4963 using \`ar' and \`ranlib', or on Windows using \`lib'.
4965 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
4966 is created, otherwise an executable program is created."
4971 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
4973 Remove libraries from an installation directory.
4975 RM is the name of the program to use to delete files associated with each FILE
4976 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4979 If FILE is a libtool library, all the files associated with it are deleted.
4980 Otherwise, only FILE itself is deleted using RM."
4984 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4991 $echo "Try \`$modename --help' for more information about other modes."