1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # define SED for historic ltconfig's generated by Libtool 1.3
52 test -z "$SED" && SED=sed
54 # The name of this program.
55 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
62 TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
65 help="Try \`$progname --help' for more information."
66 magic="%%%MAGIC variable%%%"
71 # Sed substitution that helps us do robust quoting. It backslashifies
72 # metacharacters that are still active within double-quoted strings.
73 Xsed="${SED}"' -e 1s/^X//'
74 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75 # test EBCDIC or ASCII
76 case `echo A|od -x` in
77 *[Cc]1*) # EBCDIC based system
78 SP2NL="tr '\100' '\n'"
79 NL2SP="tr '\r\n' '\100\100'"
81 *) # Assume ASCII based system
82 SP2NL="tr '\040' '\012'"
83 NL2SP="tr '\015\012' '\040\040'"
88 # Only set LANG and LC_ALL to C if already set.
89 # These must not be set unconditionally because not all systems understand
90 # e.g. LANG=C (notably SCO).
91 # We save the old values to restore during execute mode.
92 if test "${LC_ALL+set}" = set; then
93 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
95 if test "${LANG+set}" = set; then
96 save_LANG="$LANG"; LANG=C; export LANG
99 # Make sure IFS has a sensible default
102 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103 echo "$modename: not configured to build any kind of library" 1>&2
104 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
117 lo2o="s/\\.lo\$/.${objext}/"
118 o2lo="s/\\.${objext}\$/.lo/"
120 # Parse our command line options once, thoroughly.
127 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
131 # If the previous option needs an argument, assign it.
132 if test -n "$prev"; then
135 execute_dlfiles="$execute_dlfiles $arg"
147 # Have we seen a non-optional argument yet?
154 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
159 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
164 echo "$progname: enabling shell trace mode"
174 if test "$build_libtool_libs" = yes; then
175 echo "enable shared libraries"
177 echo "disable shared libraries"
179 if test "$build_old_libs" = yes; then
180 echo "enable static libraries"
182 echo "disable static libraries"
187 --finish) mode="finish" ;;
189 --mode) prevopt="--mode" prev=mode ;;
190 --mode=*) mode="$optarg" ;;
192 --preserve-dup-deps) duplicate_deps="yes" ;;
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* | xlc*)
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`
782 export_symbols_regex=
789 prefer_static_libs=no
801 # We need to know -static, to get the right output filenames.
805 -all-static | -static)
806 if test "X$arg" = "X-all-static"; then
807 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
808 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
810 if test -n "$link_static_flag"; then
811 dlopen_self=$dlopen_self_static
814 if test -z "$pic_flag" && test -n "$link_static_flag"; then
815 dlopen_self=$dlopen_self_static
818 build_libtool_libs=no
820 prefer_static_libs=yes
826 # See if our shared archives depend on static archives.
827 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
829 # Go through the arguments, transforming them on the way.
830 while test $# -gt 0; do
834 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
835 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
839 libtool_args="$libtool_args $qarg"
841 # If the previous option needs an argument, assign it.
842 if test -n "$prev"; then
845 compile_command="$compile_command @OUTPUT@"
846 finalize_command="$finalize_command @OUTPUT@"
852 if test "$preload" = no; then
853 # Add the symbol object into the linking commands.
854 compile_command="$compile_command @SYMFILE@"
855 finalize_command="$finalize_command @SYMFILE@"
859 *.la | *.lo) ;; # We handle these cases below.
861 if test "$dlself" = no; then
869 if test "$prev" = dlprefiles; then
871 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
881 if test "$prev" = dlfiles; then
882 dlfiles="$dlfiles $arg"
884 dlprefiles="$dlprefiles $arg"
892 export_symbols="$arg"
893 if test ! -f "$arg"; then
894 $echo "$modename: symbol file \`$arg' does not exist"
901 export_symbols_regex="$arg"
906 inst_prefix_dir="$arg"
916 # We need an absolute path.
918 [\\/]* | [A-Za-z]:[\\/]*) ;;
920 $echo "$modename: only absolute run-paths are allowed" 1>&2
924 if test "$prev" = rpath; then
927 *) rpath="$rpath $arg" ;;
932 *) xrpath="$xrpath $arg" ;;
939 compiler_flags="$compiler_flags $qarg"
941 compile_command="$compile_command $qarg"
942 finalize_command="$finalize_command $qarg"
946 linker_flags="$linker_flags $qarg"
947 compiler_flags="$compiler_flags $wl$qarg"
949 compile_command="$compile_command $wl$qarg"
950 finalize_command="$finalize_command $wl$qarg"
954 eval "$prev=\"\$arg\""
965 if test -n "$link_static_flag"; then
966 compile_command="$compile_command $link_static_flag"
967 finalize_command="$finalize_command $link_static_flag"
973 # FIXME: remove this flag sometime in the future.
974 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
998 -export-symbols | -export-symbols-regex)
999 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1000 $echo "$modename: more than one -exported-symbols argument is not allowed"
1003 if test "X$arg" = "X-export-symbols"; then
1016 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1017 # so, if we see these flags be careful not to treat them like -L
1019 case $with_gcc/$host in
1020 no/*-*-irix* | no/*-*-nonstopux*)
1021 compile_command="$compile_command $arg"
1022 finalize_command="$finalize_command $arg"
1029 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1030 # We need an absolute path.
1032 [\\/]* | [A-Za-z]:[\\/]*) ;;
1034 absdir=`cd "$dir" && pwd`
1035 if test -z "$absdir"; then
1036 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1045 deplibs="$deplibs -L$dir"
1046 lib_search_path="$lib_search_path $dir"
1050 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1051 case :$dllsearchpath: in
1053 *) dllsearchpath="$dllsearchpath:$dir";;
1061 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1063 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1064 # These systems don't actually have a C or math library (as such)
1067 *-*-mingw* | *-*-os2*)
1068 # These systems don't actually have a C library (as such)
1069 test "X$arg" = "X-lc" && continue
1071 *-*-openbsd* | *-*-freebsd*)
1072 # Do not include libc due to us having libc/libc_r.
1073 test "X$arg" = "X-lc" && continue
1076 elif test "X$arg" = "X-lc_r"; then
1078 *-*-openbsd* | *-*-freebsd*)
1079 # Do not include libc_r directly, use -pthread flag.
1084 deplibs="$deplibs $arg"
1100 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1101 # The PATH hackery in wrapper scripts is required on Windows
1102 # in order for the loader to find any dlls it needs.
1103 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1104 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1107 *) no_install=yes ;;
1135 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1136 # We need an absolute path.
1138 [\\/]* | [A-Za-z]:[\\/]*) ;;
1140 $echo "$modename: only absolute run-paths are allowed" 1>&2
1146 *) xrpath="$xrpath $dir" ;;
1152 # The effects of -static are defined in a previous loop.
1153 # We used to do the same as -all-static on platforms that
1154 # didn't have a PIC flag, but the assumption that the effects
1155 # would be equivalent was wrong. It would break on at least
1156 # Digital Unix and AIX.
1171 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1173 save_ifs="$IFS"; IFS=','
1174 for flag in $args; do
1177 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1182 compiler_flags="$compiler_flags $flag"
1185 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1189 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1191 save_ifs="$IFS"; IFS=','
1192 for flag in $args; do
1195 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1200 compiler_flags="$compiler_flags $wl$flag"
1201 linker_flags="$linker_flags $flag"
1204 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1217 # Some other compiler flag.
1219 # Unknown arguments in both finalize_command and compile_command need
1220 # to be aesthetically quoted because they are evaled later.
1221 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1223 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1230 # A library or standard object.
1231 if test "$prev" = dlfiles; then
1232 # This file was specified with -dlopen.
1233 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1234 dlfiles="$dlfiles $arg"
1238 # If libtool objects are unsupported, then we need to preload.
1243 if test "$prev" = dlprefiles; then
1244 # Preload the old-style object.
1245 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1249 *.lo) libobjs="$libobjs $arg" ;;
1250 *) objs="$objs $arg" ;;
1257 deplibs="$deplibs $arg"
1258 old_deplibs="$old_deplibs $arg"
1263 # A libtool-controlled library.
1265 if test "$prev" = dlfiles; then
1266 # This library was specified with -dlopen.
1267 dlfiles="$dlfiles $arg"
1269 elif test "$prev" = dlprefiles; then
1270 # The library was specified with -dlpreopen.
1271 dlprefiles="$dlprefiles $arg"
1274 deplibs="$deplibs $arg"
1279 # Some other compiler argument.
1281 # Unknown arguments in both finalize_command and compile_command need
1282 # to be aesthetically quoted because they are evaled later.
1283 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1285 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1292 # Now actually substitute the argument into the commands.
1293 if test -n "$arg"; then
1294 compile_command="$compile_command $arg"
1295 finalize_command="$finalize_command $arg"
1297 done # argument parsing loop
1299 if test -n "$prev"; then
1300 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1305 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1306 eval arg=\"$export_dynamic_flag_spec\"
1307 compile_command="$compile_command $arg"
1308 finalize_command="$finalize_command $arg"
1311 # calculate the name of the file, without its directory
1312 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1313 libobjs_save="$libobjs"
1315 if test -n "$shlibpath_var"; then
1316 # get the directories listed in $shlibpath_var
1317 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1321 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1322 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1324 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1325 if test "X$output_objdir" = "X$output"; then
1326 output_objdir="$objdir"
1328 output_objdir="$output_objdir/$objdir"
1330 # Create the object directory.
1331 if test ! -d $output_objdir; then
1332 $show "$mkdir $output_objdir"
1333 $run $mkdir $output_objdir
1335 if test $status -ne 0 && test ! -d $output_objdir; then
1340 # Determine the type of output
1343 $echo "$modename: you must specify an output file" 1>&2
1347 *.$libext) linkmode=oldlib ;;
1348 *.lo | *.$objext) linkmode=obj ;;
1349 *.la) linkmode=lib ;;
1350 *) linkmode=prog ;; # Anything else should be a program.
1355 # Find all interdependent deplibs by searching for libraries
1356 # that are linked more than once (e.g. -la -lb -la)
1357 for deplib in $deplibs; do
1358 if test "X$duplicate_deps" = "Xyes" ; then
1360 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1363 libs="$libs $deplib"
1368 need_relink=no # whether we're linking any uninstalled libtool libraries
1369 notinst_deplibs= # not-installed libtool libraries
1370 notinst_path= # paths that contain not-installed libtool libraries
1374 for file in $dlfiles $dlprefiles; do
1378 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1390 passes="conv scan dlopen dlpreopen link"
1395 for pass in $passes; do
1396 if test $linkmode = prog; then
1397 # Determine which files to process
1401 save_deplibs="$deplibs" # Collect dlpreopened libraries
1404 dlpreopen) libs="$dlprefiles" ;;
1405 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1408 for deplib in $libs; do
1413 if test $linkmode = oldlib && test $linkmode = obj; then
1414 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1417 if test $pass = conv; then
1418 deplibs="$deplib $deplibs"
1421 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1422 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1423 # Search the libtool library
1424 lib="$searchdir/lib${name}.la"
1425 if test -f "$lib"; then
1430 if test "$found" != yes; then
1431 # deplib doesn't seem to be a libtool library
1432 if test "$linkmode,$pass" = "prog,link"; then
1433 compile_deplibs="$deplib $compile_deplibs"
1434 finalize_deplibs="$deplib $finalize_deplibs"
1436 deplibs="$deplib $deplibs"
1437 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1445 deplibs="$deplib $deplibs"
1446 test $pass = conv && continue
1447 newdependency_libs="$deplib $newdependency_libs"
1448 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1451 if test $pass = conv; then
1452 deplibs="$deplib $deplibs"
1455 if test $pass = scan; then
1456 deplibs="$deplib $deplibs"
1457 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1459 compile_deplibs="$deplib $compile_deplibs"
1460 finalize_deplibs="$deplib $finalize_deplibs"
1464 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1470 if test $pass = link; then
1471 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1472 # Make sure the xrpath contains only unique directories.
1475 *) xrpath="$xrpath $dir" ;;
1478 deplibs="$deplib $deplibs"
1481 *.la) lib="$deplib" ;;
1483 if test $pass = conv; then
1484 deplibs="$deplib $deplibs"
1489 if test "$deplibs_check_method" != pass_all; then
1491 echo "*** Warning: Trying to link with static lib archive $deplib."
1492 echo "*** I have the capability to make that library automatically link in when"
1493 echo "*** you link to this library. But I can only do this if you have a"
1494 echo "*** shared version of the library, which you do not appear to have"
1495 echo "*** because the file extensions .$libext of this argument makes me believe"
1496 echo "*** that it is just a static archive that I should not used here."
1499 echo "*** Warning: Linking the shared library $output against the"
1500 echo "*** static library $deplib is not portable!"
1501 deplibs="$deplib $deplibs"
1506 if test $pass != link; then
1507 deplibs="$deplib $deplibs"
1509 compile_deplibs="$deplib $compile_deplibs"
1510 finalize_deplibs="$deplib $finalize_deplibs"
1517 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1518 # If there is no dlopen support or we're linking statically,
1519 # we need to preload.
1520 newdlprefiles="$newdlprefiles $deplib"
1521 compile_deplibs="$deplib $compile_deplibs"
1522 finalize_deplibs="$deplib $finalize_deplibs"
1524 newdlfiles="$newdlfiles $deplib"
1533 if test $found = yes || test -f "$lib"; then :
1535 $echo "$modename: cannot find the library \`$lib'" 1>&2
1539 # Check to see that this really is a libtool archive.
1540 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1542 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1546 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1547 test "X$ladir" = "X$lib" && ladir="."
1555 # If the library was installed with an old release of libtool,
1556 # it will not redefine variable installed.
1561 */* | *\\*) . $lib ;;
1565 if test "$linkmode,$pass" = "lib,link" ||
1566 test "$linkmode,$pass" = "prog,scan" ||
1567 { test $linkmode = oldlib && test $linkmode = obj; }; then
1568 # Add dl[pre]opened files of deplib
1569 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1570 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1573 if test $pass = conv; then
1574 # Only check for convenience libraries
1575 deplibs="$lib $deplibs"
1576 if test -z "$libdir"; then
1577 if test -z "$old_library"; then
1578 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1581 # It is a libtool convenience library, so add in its objects.
1582 convenience="$convenience $ladir/$objdir/$old_library"
1583 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1585 for deplib in $dependency_libs; do
1586 deplibs="$deplib $deplibs"
1587 if test "X$duplicate_deps" = "Xyes" ; then
1588 case "$tmp_libs " in
1589 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1592 tmp_libs="$tmp_libs $deplib"
1594 elif test $linkmode != prog && test $linkmode != lib; then
1595 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1601 # Get the name of the library we link against.
1603 for l in $old_library $library_names; do
1606 if test -z "$linklib"; then
1607 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1611 # This library was specified with -dlopen.
1612 if test $pass = dlopen; then
1613 if test -z "$libdir"; then
1614 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1617 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1618 # If there is no dlname, no dlopen support or we're linking
1619 # statically, we need to preload.
1620 dlprefiles="$dlprefiles $lib"
1622 newdlfiles="$newdlfiles $lib"
1627 # We need an absolute path.
1629 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1631 abs_ladir=`cd "$ladir" && pwd`
1632 if test -z "$abs_ladir"; then
1633 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1634 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1639 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1641 # Find the relevant object directory and library name.
1642 if test "X$installed" = Xyes; then
1643 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1644 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1653 dir="$ladir/$objdir"
1654 absdir="$abs_ladir/$objdir"
1655 # Remove this search path later
1656 notinst_path="$notinst_path $abs_ladir"
1657 fi # $installed = yes
1658 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1660 # This library was specified with -dlpreopen.
1661 if test $pass = dlpreopen; then
1662 if test -z "$libdir"; then
1663 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1666 # Prefer using a static library (so that no silly _DYNAMIC symbols
1667 # are required to link).
1668 if test -n "$old_library"; then
1669 newdlprefiles="$newdlprefiles $dir/$old_library"
1670 # Otherwise, use the dlname, so that lt_dlopen finds it.
1671 elif test -n "$dlname"; then
1672 newdlprefiles="$newdlprefiles $dir/$dlname"
1674 newdlprefiles="$newdlprefiles $dir/$linklib"
1676 fi # $pass = dlpreopen
1678 if test -z "$libdir"; then
1679 # Link the convenience library
1680 if test $linkmode = lib; then
1681 deplibs="$dir/$old_library $deplibs"
1682 elif test "$linkmode,$pass" = "prog,link"; then
1683 compile_deplibs="$dir/$old_library $compile_deplibs"
1684 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1686 deplibs="$lib $deplibs"
1691 if test $linkmode = prog && test $pass != link; then
1692 newlib_search_path="$newlib_search_path $ladir"
1693 deplibs="$lib $deplibs"
1696 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1697 test "$build_libtool_libs" = no; then
1702 for deplib in $dependency_libs; do
1704 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1706 # Need to link against all dependency_libs?
1707 if test $linkalldeplibs = yes; then
1708 deplibs="$deplib $deplibs"
1710 # Need to hardcode shared library paths
1711 # or/and link against static libraries
1712 newdependency_libs="$deplib $newdependency_libs"
1714 if test "X$duplicate_deps" = "Xyes" ; then
1715 case "$tmp_libs " in
1716 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1719 tmp_libs="$tmp_libs $deplib"
1722 fi # $linkmode = prog...
1724 link_static=no # Whether the deplib will be linked statically
1725 if test -n "$library_names" &&
1726 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1727 # Link against this shared library
1729 if test "$linkmode,$pass" = "prog,link" ||
1730 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1731 # Hardcode the library path.
1732 # Skip directories that are in the system default run-time
1734 case " $sys_lib_dlsearch_path " in
1737 case "$compile_rpath " in
1739 *) compile_rpath="$compile_rpath $absdir"
1743 case " $sys_lib_dlsearch_path " in
1746 case "$finalize_rpath " in
1748 *) finalize_rpath="$finalize_rpath $libdir"
1752 if test $linkmode = prog; then
1753 # We need to hardcode the library path
1754 if test -n "$shlibpath_var"; then
1755 # Make sure the rpath contains only unique directories.
1756 case "$temp_rpath " in
1759 *) temp_rpath="$temp_rpath $dir" ;;
1763 fi # $linkmode,$pass = prog,link...
1765 if test "$alldeplibs" = yes &&
1766 { test "$deplibs_check_method" = pass_all ||
1767 { test "$build_libtool_libs" = yes &&
1768 test -n "$library_names"; }; }; then
1769 # We only need to search for static libraries
1773 if test "$installed" = no; then
1774 notinst_deplibs="$notinst_deplibs $lib"
1778 if test -n "$old_archive_from_expsyms_cmds"; then
1779 # figure out the soname
1780 set dummy $library_names
1783 libname=`eval \\$echo \"$libname_spec\"`
1784 # use dlname if we got it. it's perfectly good, no?
1785 if test -n "$dlname"; then
1787 elif test -n "$soname_spec"; then
1791 major=`expr $current - $age`
1795 eval soname=\"$soname_spec\"
1800 # Make a new name for the extract_expsyms_cmds to use
1802 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1803 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1805 # If the library has no export list, then create one now
1806 if test -f "$output_objdir/$soname-def"; then :
1808 $show "extracting exported symbol list from \`$soname'"
1809 save_ifs="$IFS"; IFS='~'
1810 eval cmds=\"$extract_expsyms_cmds\"
1811 for cmd in $cmds; do
1814 $run eval "$cmd" || exit $?
1820 if test -f "$output_objdir/$newlib"; then :; else
1821 $show "generating import library for \`$soname'"
1822 save_ifs="$IFS"; IFS='~'
1823 eval cmds=\"$old_archive_from_expsyms_cmds\"
1824 for cmd in $cmds; do
1827 $run eval "$cmd" || exit $?
1831 # make sure the library variables are pointing to the new library
1834 fi # test -n $old_archive_from_expsyms_cmds
1836 if test $linkmode = prog || test "$mode" != relink; then
1841 case $hardcode_action in
1842 immediate | unsupported)
1843 if test "$hardcode_direct" = no; then
1845 elif test "$hardcode_minus_L" = no; then
1847 *-*-sunos*) add_shlibpath="$dir" ;;
1851 elif test "$hardcode_shlibpath_var" = no; then
1852 add_shlibpath="$dir"
1859 if test "$hardcode_direct" = yes; then
1861 elif test "$hardcode_minus_L" = yes; then
1864 elif test "$hardcode_shlibpath_var" = yes; then
1865 add_shlibpath="$dir"
1874 if test "$lib_linked" != yes; then
1875 $echo "$modename: configuration error: unsupported hardcode properties"
1879 if test -n "$add_shlibpath"; then
1880 case :$compile_shlibpath: in
1881 *":$add_shlibpath:"*) ;;
1882 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1885 if test $linkmode = prog; then
1886 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1887 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1889 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1890 test -n "$add" && deplibs="$add $deplibs"
1891 if test "$hardcode_direct" != yes && \
1892 test "$hardcode_minus_L" != yes && \
1893 test "$hardcode_shlibpath_var" = yes; then
1894 case :$finalize_shlibpath: in
1896 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1902 if test $linkmode = prog || test "$mode" = relink; then
1906 # Finalize command for both is simple: just hardcode it.
1907 if test "$hardcode_direct" = yes; then
1908 add="$libdir/$linklib"
1909 elif test "$hardcode_minus_L" = yes; then
1910 # Try looking first in the location we're being installed to.
1912 if test -n "$inst_prefix_dir"; then
1915 add_dir="-L$inst_prefix_dir$libdir"
1919 add_dir="$add_dir -L$libdir"
1921 elif test "$hardcode_shlibpath_var" = yes; then
1922 case :$finalize_shlibpath: in
1924 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1928 # We cannot seem to hardcode it, guess we'll fake it.
1929 # Try looking first in the location we're being installed to.
1931 if test -n "$inst_prefix_dir"; then
1934 add_dir="-L$inst_prefix_dir$libdir"
1938 add_dir="$add_dir -L$libdir"
1942 if test $linkmode = prog; then
1943 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1944 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1946 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1947 test -n "$add" && deplibs="$add $deplibs"
1950 elif test $linkmode = prog; then
1951 if test "$alldeplibs" = yes &&
1952 { test "$deplibs_check_method" = pass_all ||
1953 { test "$build_libtool_libs" = yes &&
1954 test -n "$library_names"; }; }; then
1955 # We only need to search for static libraries
1959 # Try to link the static library
1960 # Here we assume that one of hardcode_direct or hardcode_minus_L
1961 # is not unsupported. This is valid on all known static and
1963 if test "$hardcode_direct" != unsupported; then
1964 test -n "$old_library" && linklib="$old_library"
1965 compile_deplibs="$dir/$linklib $compile_deplibs"
1966 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1968 compile_deplibs="-l$name -L$dir $compile_deplibs"
1969 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1971 elif test "$build_libtool_libs" = yes; then
1972 # Not a shared library
1973 if test "$deplibs_check_method" != pass_all; then
1974 # We're trying link a shared library against a static one
1975 # but the system doesn't support it.
1977 # Just print a warning and add the library to dependency_libs so
1978 # that the program can be linked against the static library.
1980 echo "*** Warning: This system can not link to static lib archive $lib."
1981 echo "*** I have the capability to make that library automatically link in when"
1982 echo "*** you link to this library. But I can only do this if you have a"
1983 echo "*** shared version of the library, which you do not appear to have."
1984 if test "$module" = yes; then
1985 echo "*** But as you try to build a module library, libtool will still create "
1986 echo "*** a static module, that should work as long as the dlopening application"
1987 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1988 if test -z "$global_symbol_pipe"; then
1990 echo "*** However, this would only work if libtool was able to extract symbol"
1991 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1992 echo "*** not find such a program. So, this module is probably useless."
1993 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1995 if test "$build_old_libs" = no; then
1996 build_libtool_libs=module
1999 build_libtool_libs=no
2003 convenience="$convenience $dir/$old_library"
2004 old_convenience="$old_convenience $dir/$old_library"
2005 deplibs="$dir/$old_library $deplibs"
2008 fi # link shared/static library?
2010 if test $linkmode = lib; then
2011 if test -n "$dependency_libs" &&
2012 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2013 test $link_static = yes; }; then
2014 # Extract -R from dependency_libs
2016 for libdir in $dependency_libs; do
2018 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2020 *" $temp_xrpath "*) ;;
2021 *) xrpath="$xrpath $temp_xrpath";;
2023 *) temp_deplibs="$temp_deplibs $libdir";;
2026 dependency_libs="$temp_deplibs"
2029 newlib_search_path="$newlib_search_path $absdir"
2030 # Link against this library
2031 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2032 # ... and its dependency_libs
2034 for deplib in $dependency_libs; do
2035 newdependency_libs="$deplib $newdependency_libs"
2036 if test "X$duplicate_deps" = "Xyes" ; then
2037 case "$tmp_libs " in
2038 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2041 tmp_libs="$tmp_libs $deplib"
2044 if test $link_all_deplibs != no; then
2045 # Add the search paths of all dependency libraries
2046 for deplib in $dependency_libs; do
2048 -L*) path="$deplib" ;;
2050 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2051 test "X$dir" = "X$deplib" && dir="."
2052 # We need an absolute path.
2054 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2056 absdir=`cd "$dir" && pwd`
2057 if test -z "$absdir"; then
2058 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2063 if grep "^installed=no" $deplib > /dev/null; then
2064 path="-L$absdir/$objdir"
2066 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2067 if test -z "$libdir"; then
2068 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2071 if test "$absdir" != "$libdir"; then
2072 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2079 case " $deplibs " in
2081 *) deplibs="$deplibs $path" ;;
2084 fi # link_all_deplibs != no
2086 done # for deplib in $libs
2087 if test $pass = dlpreopen; then
2088 # Link the dlpreopened libraries before other libraries
2089 for deplib in $save_deplibs; do
2090 deplibs="$deplib $deplibs"
2093 if test $pass != dlopen; then
2094 test $pass != scan && dependency_libs="$newdependency_libs"
2095 if test $pass != conv; then
2096 # Make sure lib_search_path contains only unique directories.
2098 for dir in $newlib_search_path; do
2099 case "$lib_search_path " in
2101 *) lib_search_path="$lib_search_path $dir" ;;
2107 if test "$linkmode,$pass" != "prog,link"; then
2110 vars="compile_deplibs finalize_deplibs"
2112 for var in $vars dependency_libs; do
2113 # Add libraries to $var in reverse order
2114 eval tmp_libs=\"\$$var\"
2116 for deplib in $tmp_libs; do
2118 -L*) new_libs="$deplib $new_libs" ;;
2120 case " $specialdeplibs " in
2121 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2123 case " $new_libs " in
2125 *) new_libs="$deplib $new_libs" ;;
2133 for deplib in $new_libs; do
2136 case " $tmp_libs " in
2138 *) tmp_libs="$tmp_libs $deplib" ;;
2141 *) tmp_libs="$tmp_libs $deplib" ;;
2144 eval $var=\"$tmp_libs\"
2147 if test "$pass" = "conv" &&
2148 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2149 libs="$deplibs" # reset libs
2153 if test $linkmode = prog; then
2154 dlfiles="$newdlfiles"
2155 dlprefiles="$newdlprefiles"
2160 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2161 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2164 if test -n "$rpath"; then
2165 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2168 if test -n "$xrpath"; then
2169 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2172 if test -n "$vinfo"; then
2173 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2176 if test -n "$release"; then
2177 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2180 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2181 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2184 # Now set the variables for building old libraries.
2185 build_libtool_libs=no
2187 objs="$objs$old_deplibs"
2191 # Make sure we only generate libraries of the form `libNAME.la'.
2194 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2195 eval libname=\"$libname_spec\"
2198 if test "$module" = no; then
2199 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2203 if test "$need_lib_prefix" != no; then
2204 # Add the "lib" prefix for modules if required
2205 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2206 eval libname=\"$libname_spec\"
2208 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2213 if test -n "$objs"; then
2214 if test "$deplibs_check_method" != pass_all; then
2215 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2219 echo "*** Warning: Linking the shared library $output against the non-libtool"
2220 echo "*** objects $objs is not portable!"
2221 libobjs="$libobjs $objs"
2225 if test "$dlself" != no; then
2226 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2230 if test $# -gt 2; then
2231 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2236 if test -z "$rpath"; then
2237 if test "$build_libtool_libs" = yes; then
2238 # Building a libtool convenience library.
2240 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2241 build_libtool_libs=convenience
2245 if test -n "$vinfo"; then
2246 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2249 if test -n "$release"; then
2250 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2254 # Parse the version information argument.
2255 save_ifs="$IFS"; IFS=':'
2256 set dummy $vinfo 0 0 0
2259 if test -n "$8"; then
2260 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2269 # Check that each of the things are valid numbers.
2273 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2274 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2282 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2283 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2291 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2292 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2297 if test $age -gt $current; then
2298 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2299 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2303 # Calculate the version variables.
2307 case $version_type in
2311 # Like Linux, but with the current version available in
2312 # verstring for coding it into the library header
2313 major=.`expr $current - $age`
2314 versuffix="$major.$age.$revision"
2315 # Darwin ld doesn't like 0 for these options...
2316 minor_current=`expr $current + 1`
2317 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2322 versuffix=".$current.$revision";
2327 versuffix=".$current";
2331 major=`expr $current - $age + 1`
2333 case $version_type in
2334 nonstopux) verstring_prefix=nonstopux ;;
2335 *) verstring_prefix=sgi ;;
2337 verstring="$verstring_prefix$major.$revision"
2339 # Add in all the interfaces that we are compatible with.
2341 while test $loop != 0; do
2342 iface=`expr $revision - $loop`
2343 loop=`expr $loop - 1`
2344 verstring="$verstring_prefix$major.$iface:$verstring"
2347 # Before this point, $major must not contain `.'.
2349 versuffix="$major.$revision"
2353 major=.`expr $current - $age`
2354 versuffix="$major.$age.$revision"
2358 major=.`expr $current - $age`
2359 versuffix=".$current.$age.$revision"
2360 verstring="$current.$age.$revision"
2362 # Add in all the interfaces that we are compatible with.
2364 while test $loop != 0; do
2365 iface=`expr $current - $loop`
2366 loop=`expr $loop - 1`
2367 verstring="$verstring:${iface}.0"
2370 # Make executables depend on our current version.
2371 verstring="$verstring:${current}.0"
2376 versuffix=".$current.$revision"
2380 # Use '-' rather than '.', since we only want one
2381 # extension on DOS 8.3 filesystems.
2382 major=`expr $current - $age`
2387 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2388 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2393 # Clear the version info if we defaulted, and they specified a release.
2394 if test -z "$vinfo" && test -n "$release"; then
2397 case $version_type in
2399 # we can't check for "0.0" in archive_cmds due to quoting
2400 # problems, so we reset it completely
2407 if test "$need_version" = no; then
2414 # Remove version info from name if versioning should be avoided
2415 if test "$avoid_version" = yes && test "$need_version" = no; then
2421 # Check to see if the archive will have undefined symbols.
2422 if test "$allow_undefined" = yes; then
2423 if test "$allow_undefined_flag" = unsupported; then
2424 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2425 build_libtool_libs=no
2429 # Don't allow undefined symbols.
2430 allow_undefined_flag="$no_undefined_flag"
2434 if test "$mode" != relink; then
2435 # Remove our outputs.
2436 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2437 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2440 # Now set the variables for building old libraries.
2441 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2442 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2444 # Transform .lo files to .o files.
2445 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2448 # Eliminate all temporary directories.
2449 for path in $notinst_path; do
2450 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2451 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2452 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2455 if test -n "$xrpath"; then
2456 # If the user specified any rpath flags, then add them.
2458 for libdir in $xrpath; do
2459 temp_xrpath="$temp_xrpath -R$libdir"
2460 case "$finalize_rpath " in
2462 *) finalize_rpath="$finalize_rpath $libdir" ;;
2465 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2466 dependency_libs="$temp_xrpath $dependency_libs"
2470 # Make sure dlfiles contains only unique files that won't be dlpreopened
2471 old_dlfiles="$dlfiles"
2473 for lib in $old_dlfiles; do
2474 case " $dlprefiles $dlfiles " in
2476 *) dlfiles="$dlfiles $lib" ;;
2480 # Make sure dlprefiles contains only unique files
2481 old_dlprefiles="$dlprefiles"
2483 for lib in $old_dlprefiles; do
2484 case "$dlprefiles " in
2486 *) dlprefiles="$dlprefiles $lib" ;;
2490 if test "$build_libtool_libs" = yes; then
2491 if test -n "$rpath"; then
2493 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2494 # these systems don't actually have a c library (as such)!
2496 *-*-rhapsody* | *-*-darwin1.[012])
2497 # Rhapsody C library is in the System framework
2498 deplibs="$deplibs -framework System"
2501 # Don't link with libc until the a.out ld.so is fixed.
2503 *-*-openbsd* | *-*-freebsd*)
2504 # Do not include libc due to us having libc/libc_r.
2507 # Add libc to deplibs on all other systems if necessary.
2508 if test $build_libtool_need_lc = "yes"; then
2509 deplibs="$deplibs -lc"
2515 # Transform deplibs into only deplibs that can be linked in shared.
2517 libname_save=$libname
2518 release_save=$release
2519 versuffix_save=$versuffix
2521 # I'm not sure if I'm treating the release correctly. I think
2522 # release should show up in the -l (ie -lgmp5) so we don't want to
2523 # add it in twice. Is that correct?
2529 case $deplibs_check_method in
2531 # Don't check for shared/static. Everything works.
2532 # This might be a little naive. We might want to check
2533 # whether the library exists or not. But this is on
2534 # osf3 & osf4 and I'm not really sure... Just
2535 # implementing what was already the behaviour.
2539 # This code stresses the "libraries are programs" paradigm to its
2540 # limits. Maybe even breaks it. We compile a program, linking it
2541 # against the deplibs as a proxy for the library. Then we can check
2542 # whether they linked in statically or dynamically with ldd.
2544 cat > conftest.c <<EOF
2545 int main() { return 0; }
2548 $CC -o conftest conftest.c $deplibs
2549 if test $? -eq 0 ; then
2550 ldd_output=`ldd conftest`
2551 for i in $deplibs; do
2552 name="`expr $i : '-l\(.*\)'`"
2553 # If $name is empty we are operating on a -L argument.
2554 if test -n "$name" && test "$name" != "0"; then
2555 libname=`eval \\$echo \"$libname_spec\"`
2556 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2557 set dummy $deplib_matches
2559 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2560 newdeplibs="$newdeplibs $i"
2564 echo "*** Warning: dynamic linker does not accept needed library $i."
2565 echo "*** I have the capability to make that library automatically link in when"
2566 echo "*** you link to this library. But I can only do this if you have a"
2567 echo "*** shared version of the library, which I believe you do not have"
2568 echo "*** because a test_compile did reveal that the linker did not use it for"
2569 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2572 newdeplibs="$newdeplibs $i"
2576 # Error occured in the first compile. Let's try to salvage
2577 # the situation: Compile a separate program for each library.
2578 for i in $deplibs; do
2579 name="`expr $i : '-l\(.*\)'`"
2580 # If $name is empty we are operating on a -L argument.
2581 if test -n "$name" && test "$name" != "0"; then
2583 $CC -o conftest conftest.c $i
2585 if test $? -eq 0 ; then
2586 ldd_output=`ldd conftest`
2587 libname=`eval \\$echo \"$libname_spec\"`
2588 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2589 set dummy $deplib_matches
2591 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2592 newdeplibs="$newdeplibs $i"
2596 echo "*** Warning: dynamic linker does not accept needed library $i."
2597 echo "*** I have the capability to make that library automatically link in when"
2598 echo "*** you link to this library. But I can only do this if you have a"
2599 echo "*** shared version of the library, which you do not appear to have"
2600 echo "*** because a test_compile did reveal that the linker did not use this one"
2601 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2606 echo "*** Warning! Library $i is needed by this library but I was not able to"
2607 echo "*** make it link in! You will probably need to install it or some"
2608 echo "*** library that it depends on before this library will be fully"
2609 echo "*** functional. Installing it before continuing would be even better."
2612 newdeplibs="$newdeplibs $i"
2618 set dummy $deplibs_check_method
2619 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2620 for a_deplib in $deplibs; do
2621 name="`expr $a_deplib : '-l\(.*\)'`"
2622 # If $name is empty we are operating on a -L argument.
2623 if test -n "$name" && test "$name" != "0"; then
2624 libname=`eval \\$echo \"$libname_spec\"`
2625 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2626 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2627 for potent_lib in $potential_libs; do
2628 # Follow soft links.
2629 if ls -lLd "$potent_lib" 2>/dev/null \
2630 | grep " -> " >/dev/null; then
2633 # The statement above tries to avoid entering an
2634 # endless loop below, in case of cyclic links.
2635 # We might still enter an endless loop, since a link
2636 # loop can be closed while we follow links,
2638 potlib="$potent_lib"
2639 while test -h "$potlib" 2>/dev/null; do
2640 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2642 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2643 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2646 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2648 | egrep "$file_magic_regex" > /dev/null; then
2649 newdeplibs="$newdeplibs $a_deplib"
2655 if test -n "$a_deplib" ; then
2658 echo "*** Warning: linker path does not have real file for library $a_deplib."
2659 echo "*** I have the capability to make that library automatically link in when"
2660 echo "*** you link to this library. But I can only do this if you have a"
2661 echo "*** shared version of the library, which you do not appear to have"
2662 echo "*** because I did check the linker path looking for a file starting"
2663 if test -z "$potlib" ; then
2664 echo "*** with $libname but no candidates were found. (...for file magic test)"
2666 echo "*** with $libname and none of the candidates passed a file format test"
2667 echo "*** using a file magic. Last file checked: $potlib"
2671 # Add a -L argument.
2672 newdeplibs="$newdeplibs $a_deplib"
2674 done # Gone through all deplibs.
2677 set dummy $deplibs_check_method
2678 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2679 for a_deplib in $deplibs; do
2680 name="`expr $a_deplib : '-l\(.*\)'`"
2681 # If $name is empty we are operating on a -L argument.
2682 if test -n "$name" && test "$name" != "0"; then
2683 libname=`eval \\$echo \"$libname_spec\"`
2684 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2685 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2686 for potent_lib in $potential_libs; do
2687 potlib="$potent_lib" # see symlink-check below in file_magic test
2688 if eval echo \"$potent_lib\" 2>/dev/null \
2690 | egrep "$match_pattern_regex" > /dev/null; then
2691 newdeplibs="$newdeplibs $a_deplib"
2697 if test -n "$a_deplib" ; then
2700 echo "*** Warning: linker path does not have real file for library $a_deplib."
2701 echo "*** I have the capability to make that library automatically link in when"
2702 echo "*** you link to this library. But I can only do this if you have a"
2703 echo "*** shared version of the library, which you do not appear to have"
2704 echo "*** because I did check the linker path looking for a file starting"
2705 if test -z "$potlib" ; then
2706 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2708 echo "*** with $libname and none of the candidates passed a file format test"
2709 echo "*** using a regex pattern. Last file checked: $potlib"
2713 # Add a -L argument.
2714 newdeplibs="$newdeplibs $a_deplib"
2716 done # Gone through all deplibs.
2720 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2721 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2722 grep . >/dev/null; then
2724 if test "X$deplibs_check_method" = "Xnone"; then
2725 echo "*** Warning: inter-library dependencies are not supported in this platform."
2727 echo "*** Warning: inter-library dependencies are not known to be supported."
2729 echo "*** All declared inter-library dependencies are being dropped."
2734 versuffix=$versuffix_save
2736 release=$release_save
2737 libname=$libname_save
2741 *-*-rhapsody* | *-*-darwin1.[012])
2742 # On Rhapsody replace the C library is the System framework
2743 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2747 if test "$droppeddeps" = yes; then
2748 if test "$module" = yes; then
2750 echo "*** Warning: libtool could not satisfy all declared inter-library"
2751 echo "*** dependencies of module $libname. Therefore, libtool will create"
2752 echo "*** a static module, that should work as long as the dlopening"
2753 echo "*** application is linked with the -dlopen flag."
2754 if test -z "$global_symbol_pipe"; then
2756 echo "*** However, this would only work if libtool was able to extract symbol"
2757 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2758 echo "*** not find such a program. So, this module is probably useless."
2759 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2761 if test "$build_old_libs" = no; then
2762 oldlibs="$output_objdir/$libname.$libext"
2763 build_libtool_libs=module
2766 build_libtool_libs=no
2769 echo "*** The inter-library dependencies that have been dropped here will be"
2770 echo "*** automatically added whenever a program is linked with this library"
2771 echo "*** or is declared to -dlopen it."
2773 if test $allow_undefined = no; then
2775 echo "*** Since this library must not contain undefined symbols,"
2776 echo "*** because either the platform does not support them or"
2777 echo "*** it was explicitly requested with -no-undefined,"
2778 echo "*** libtool will only create a static version of it."
2779 if test "$build_old_libs" = no; then
2780 oldlibs="$output_objdir/$libname.$libext"
2781 build_libtool_libs=module
2784 build_libtool_libs=no
2789 # Done checking deplibs!
2793 # All the library-specific variables (install_libdir is set above).
2798 # Test again, we may have decided not to build it any more
2799 if test "$build_libtool_libs" = yes; then
2800 if test $hardcode_into_libs = yes; then
2801 # Hardcode the library paths
2804 rpath="$finalize_rpath"
2805 test "$mode" != relink && rpath="$compile_rpath$rpath"
2806 for libdir in $rpath; do
2807 if test -n "$hardcode_libdir_flag_spec"; then
2808 if test -n "$hardcode_libdir_separator"; then
2809 if test -z "$hardcode_libdirs"; then
2810 hardcode_libdirs="$libdir"
2812 # Just accumulate the unique libdirs.
2813 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2814 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2817 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2822 eval flag=\"$hardcode_libdir_flag_spec\"
2823 dep_rpath="$dep_rpath $flag"
2825 elif test -n "$runpath_var"; then
2826 case "$perm_rpath " in
2828 *) perm_rpath="$perm_rpath $libdir" ;;
2832 # Substitute the hardcoded libdirs into the rpath.
2833 if test -n "$hardcode_libdir_separator" &&
2834 test -n "$hardcode_libdirs"; then
2835 libdir="$hardcode_libdirs"
2836 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2838 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2839 # We should set the runpath_var.
2841 for dir in $perm_rpath; do
2844 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2846 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2849 shlibpath="$finalize_shlibpath"
2850 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2851 if test -n "$shlibpath"; then
2852 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2855 # Get the real and link names of the library.
2856 eval library_names=\"$library_names_spec\"
2857 set dummy $library_names
2861 if test -n "$soname_spec"; then
2862 eval soname=\"$soname_spec\"
2866 test -z "$dlname" && dlname=$soname
2868 lib="$output_objdir/$realname"
2871 linknames="$linknames $link"
2874 # Ensure that we have .o objects for linkers which dislike .lo
2875 # (e.g. aix) in case we are running --disable-static
2876 for obj in $libobjs; do
2877 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2878 if test "X$xdir" = "X$obj"; then
2883 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2884 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2885 if test ! -f $xdir/$oldobj; then
2886 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2887 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2891 # Use standard objects if they are pic
2892 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2894 # Prepare the list of exported symbols
2895 if test -z "$export_symbols"; then
2896 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2897 $show "generating symbol list for \`$libname.la'"
2898 export_symbols="$output_objdir/$libname.exp"
2899 $run $rm $export_symbols
2900 eval cmds=\"$export_symbols_cmds\"
2901 save_ifs="$IFS"; IFS='~'
2902 for cmd in $cmds; do
2905 $run eval "$cmd" || exit $?
2908 if test -n "$export_symbols_regex"; then
2909 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2910 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2911 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2912 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2917 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2918 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2921 if test -n "$convenience"; then
2922 if test -n "$whole_archive_flag_spec"; then
2923 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2925 gentop="$output_objdir/${outputname}x"
2926 $show "${rm}r $gentop"
2927 $run ${rm}r "$gentop"
2928 $show "mkdir $gentop"
2929 $run mkdir "$gentop"
2931 if test $status -ne 0 && test ! -d "$gentop"; then
2934 generated="$generated $gentop"
2936 for xlib in $convenience; do
2937 # Extract the objects.
2939 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2940 *) xabs=`pwd`"/$xlib" ;;
2942 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2943 xdir="$gentop/$xlib"
2945 $show "${rm}r $xdir"
2950 if test $status -ne 0 && test ! -d "$xdir"; then
2953 $show "(cd $xdir && $AR x $xabs)"
2954 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2956 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2961 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2962 eval flag=\"$thread_safe_flag_spec\"
2963 linker_flags="$linker_flags $flag"
2966 # Make a backup of the uninstalled library when relinking
2967 if test "$mode" = relink; then
2968 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2971 # Do each of the archive commands.
2972 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2973 eval cmds=\"$archive_expsym_cmds\"
2975 save_deplibs="$deplibs"
2976 for conv in $convenience; do
2978 for test_deplib in $deplibs; do
2979 if test "$test_deplib" != "$conv"; then
2980 tmp_deplibs="$tmp_deplibs $test_deplib"
2983 deplibs="$tmp_deplibs"
2985 eval cmds=\"$archive_cmds\"
2986 deplibs="$save_deplibs"
2988 save_ifs="$IFS"; IFS='~'
2989 for cmd in $cmds; do
2992 $run eval "$cmd" || exit $?
2996 # Restore the uninstalled library and exit
2997 if test "$mode" = relink; then
2998 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3002 # Create links to the real library.
3003 for linkname in $linknames; do
3004 if test "$realname" != "$linkname"; then
3005 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3006 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3010 # If -module or -export-dynamic was specified, set the dlname.
3011 if test "$module" = yes || test "$export_dynamic" = yes; then
3012 # On all known operating systems, these are identical.
3019 if test -n "$deplibs"; then
3020 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3023 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3024 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3027 if test -n "$rpath"; then
3028 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3031 if test -n "$xrpath"; then
3032 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3035 if test -n "$vinfo"; then
3036 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3039 if test -n "$release"; then
3040 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3045 if test -n "$objs$old_deplibs"; then
3046 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3050 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3058 # Delete the old objects.
3059 $run $rm $obj $libobj
3061 # Objects from convenience libraries. This assumes
3062 # single-version convenience libraries. Whenever we create
3063 # different ones for PIC/non-PIC, this we'll have to duplicate
3067 # reload_cmds runs $LD directly, so let us get rid of
3068 # -Wl from whole_archive_flag_spec
3071 if test -n "$convenience"; then
3072 if test -n "$whole_archive_flag_spec"; then
3073 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3075 gentop="$output_objdir/${obj}x"
3076 $show "${rm}r $gentop"
3077 $run ${rm}r "$gentop"
3078 $show "mkdir $gentop"
3079 $run mkdir "$gentop"
3081 if test $status -ne 0 && test ! -d "$gentop"; then
3084 generated="$generated $gentop"
3086 for xlib in $convenience; do
3087 # Extract the objects.
3089 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3090 *) xabs=`pwd`"/$xlib" ;;
3092 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3093 xdir="$gentop/$xlib"
3095 $show "${rm}r $xdir"
3100 if test $status -ne 0 && test ! -d "$xdir"; then
3103 $show "(cd $xdir && $AR x $xabs)"
3104 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3106 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3111 # Create the old-style object.
3112 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
3115 eval cmds=\"$reload_cmds\"
3116 save_ifs="$IFS"; IFS='~'
3117 for cmd in $cmds; do
3120 $run eval "$cmd" || exit $?
3124 # Exit if we aren't doing a library object file.
3125 if test -z "$libobj"; then
3126 if test -n "$gentop"; then
3127 $show "${rm}r $gentop"
3134 if test "$build_libtool_libs" != yes; then
3135 if test -n "$gentop"; then
3136 $show "${rm}r $gentop"
3140 # Create an invalid libtool object if no PIC, so that we don't
3141 # accidentally link it into a program.
3142 $show "echo timestamp > $libobj"
3143 $run eval "echo timestamp > $libobj" || exit $?
3147 if test -n "$pic_flag" || test "$pic_mode" != default; then
3148 # Only do commands if we really have different PIC objects.
3149 reload_objs="$libobjs $reload_conv_objs"
3151 eval cmds=\"$reload_cmds\"
3152 save_ifs="$IFS"; IFS='~'
3153 for cmd in $cmds; do
3156 $run eval "$cmd" || exit $?
3160 # Just create a symlink.
3163 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3164 if test "X$xdir" = "X$libobj"; then
3169 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3170 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3171 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3172 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3175 if test -n "$gentop"; then
3176 $show "${rm}r $gentop"
3185 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3187 if test -n "$vinfo"; then
3188 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3191 if test -n "$release"; then
3192 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3195 if test "$preload" = yes; then
3196 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3197 test "$dlopen_self_static" = unknown; then
3198 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3203 *-*-rhapsody* | *-*-darwin1.[012])
3204 # On Rhapsody replace the C library is the System framework
3205 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3206 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3209 # Don't allow lazy linking, it breaks C++ global constructors
3210 compile_command="$compile_command ${wl}-bind_at_load"
3211 finalize_command="$finalize_command ${wl}-bind_at_load"
3217 compile_command="$compile_command $compile_deplibs"
3218 finalize_command="$finalize_command $finalize_deplibs"
3220 if test -n "$rpath$xrpath"; then
3221 # If the user specified any rpath flags, then add them.
3222 for libdir in $rpath $xrpath; do
3223 # This is the magic to use -rpath.
3224 case "$finalize_rpath " in
3226 *) finalize_rpath="$finalize_rpath $libdir" ;;
3231 # Now hardcode the library paths
3234 for libdir in $compile_rpath $finalize_rpath; do
3235 if test -n "$hardcode_libdir_flag_spec"; then
3236 if test -n "$hardcode_libdir_separator"; then
3237 if test -z "$hardcode_libdirs"; then
3238 hardcode_libdirs="$libdir"
3240 # Just accumulate the unique libdirs.
3241 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3242 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3245 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3250 eval flag=\"$hardcode_libdir_flag_spec\"
3251 rpath="$rpath $flag"
3253 elif test -n "$runpath_var"; then
3254 case "$perm_rpath " in
3256 *) perm_rpath="$perm_rpath $libdir" ;;
3260 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3261 case :$dllsearchpath: in
3263 *) dllsearchpath="$dllsearchpath:$libdir";;
3268 # Substitute the hardcoded libdirs into the rpath.
3269 if test -n "$hardcode_libdir_separator" &&
3270 test -n "$hardcode_libdirs"; then
3271 libdir="$hardcode_libdirs"
3272 eval rpath=\" $hardcode_libdir_flag_spec\"
3274 compile_rpath="$rpath"
3278 for libdir in $finalize_rpath; do
3279 if test -n "$hardcode_libdir_flag_spec"; then
3280 if test -n "$hardcode_libdir_separator"; then
3281 if test -z "$hardcode_libdirs"; then
3282 hardcode_libdirs="$libdir"
3284 # Just accumulate the unique libdirs.
3285 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3286 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3289 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3294 eval flag=\"$hardcode_libdir_flag_spec\"
3295 rpath="$rpath $flag"
3297 elif test -n "$runpath_var"; then
3298 case "$finalize_perm_rpath " in
3300 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3304 # Substitute the hardcoded libdirs into the rpath.
3305 if test -n "$hardcode_libdir_separator" &&
3306 test -n "$hardcode_libdirs"; then
3307 libdir="$hardcode_libdirs"
3308 eval rpath=\" $hardcode_libdir_flag_spec\"
3310 finalize_rpath="$rpath"
3312 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3313 # Transform all the library objects into standard objects.
3314 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3315 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3319 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3320 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3321 dlsyms="${outputname}S.c"
3323 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3327 if test -n "$dlsyms"; then
3331 # Discover the nlist of each of the dlfiles.
3332 nlist="$output_objdir/${outputname}.nm"
3334 $show "$rm $nlist ${nlist}S ${nlist}T"
3335 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3337 # Parse the name list into a source file.
3338 $show "creating $output_objdir/$dlsyms"
3340 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3341 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3342 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3348 /* Prevent the only kind of declaration conflicts we can make. */
3349 #define lt_preloaded_symbols some_other_symbol
3351 /* External symbol declarations for the compiler. */\
3354 if test "$dlself" = yes; then
3355 $show "generating symbol list for \`$output'"
3357 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3359 # Add our own program objects to the symbol list.
3360 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3361 for arg in $progfiles; do
3362 $show "extracting global C symbols from \`$arg'"
3363 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3366 if test -n "$exclude_expsyms"; then
3367 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3368 $run eval '$mv "$nlist"T "$nlist"'
3371 if test -n "$export_symbols_regex"; then
3372 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3373 $run eval '$mv "$nlist"T "$nlist"'
3376 # Prepare the list of exported symbols
3377 if test -z "$export_symbols"; then
3378 export_symbols="$output_objdir/$output.exp"
3379 $run $rm $export_symbols
3380 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3382 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3383 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3384 $run eval 'mv "$nlist"T "$nlist"'
3388 for arg in $dlprefiles; do
3389 $show "extracting global C symbols from \`$arg'"
3390 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3391 $run eval 'echo ": $name " >> "$nlist"'
3392 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3395 if test -z "$run"; then
3396 # Make sure we have at least an empty file.
3397 test -f "$nlist" || : > "$nlist"
3399 if test -n "$exclude_expsyms"; then
3400 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3401 $mv "$nlist"T "$nlist"
3404 # Try sorting and uniquifying the output.
3405 if grep -v "^: " < "$nlist" |
3406 if sort -k 3 </dev/null >/dev/null 2>&1; then
3411 uniq > "$nlist"S; then
3414 grep -v "^: " < "$nlist" > "$nlist"S
3417 if test -f "$nlist"S; then
3418 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3420 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3423 $echo >> "$output_objdir/$dlsyms" "\
3425 #undef lt_preloaded_symbols
3427 #if defined (__STDC__) && __STDC__
3428 # define lt_ptr void *
3430 # define lt_ptr char *
3434 /* The mapping between symbol names and symbols. */
3439 lt_preloaded_symbols[] =
3443 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3445 $echo >> "$output_objdir/$dlsyms" "\
3449 /* This works around a problem in FreeBSD linker */
3450 #ifdef FREEBSD_WORKAROUND
3451 static const void *lt_preloaded_setup() {
3452 return lt_preloaded_symbols;
3462 pic_flag_for_symtable=
3464 # compiling the symbol table file with pic_flag works around
3465 # a FreeBSD bug that causes programs to crash when -lm is
3466 # linked before any other PIC object. But we must not use
3467 # pic_flag when linking with -static. The problem exists in
3468 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3469 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3470 case "$compile_command " in
3472 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3475 case "$compile_command " in
3477 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3481 # Now compile the dynamic symbol file.
3482 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3483 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3485 # Clean up the generated files.
3486 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3487 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3489 # Transform the symbol file into the correct name.
3490 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3491 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3494 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3499 # We keep going just in case the user didn't refer to
3500 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3501 # really was required.
3503 # Nullify the symbol file.
3504 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3505 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3508 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3509 # Replace the output file specification.
3510 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3511 link_command="$compile_command$compile_rpath"
3513 # We have no uninstalled library dependencies, so finalize right now.
3514 $show "$link_command"
3515 $run eval "$link_command"
3518 # Delete the generated files.
3519 if test -n "$dlsyms"; then
3520 $show "$rm $output_objdir/${outputname}S.${objext}"
3521 $run $rm "$output_objdir/${outputname}S.${objext}"
3527 if test -n "$shlibpath_var"; then
3528 # We should set the shlibpath_var
3530 for dir in $temp_rpath; do
3532 [\\/]* | [A-Za-z]:[\\/]*)
3537 # Relative path: add a thisdir entry.
3538 rpath="$rpath\$thisdir/$dir:"
3545 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3546 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3548 if test -n "$finalize_shlibpath"; then
3549 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3554 if test -n "$runpath_var"; then
3555 if test -n "$perm_rpath"; then
3556 # We should set the runpath_var.
3558 for dir in $perm_rpath; do
3561 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3563 if test -n "$finalize_perm_rpath"; then
3564 # We should set the runpath_var.
3566 for dir in $finalize_perm_rpath; do
3569 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3573 if test "$no_install" = yes; then
3574 # We don't need to create a wrapper script.
3575 link_command="$compile_var$compile_command$compile_rpath"
3576 # Replace the output file specification.
3577 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3578 # Delete the old output file.
3580 # Link the executable and exit
3581 $show "$link_command"
3582 $run eval "$link_command" || exit $?
3586 if test "$hardcode_action" = relink; then
3587 # Fast installation is not supported
3588 link_command="$compile_var$compile_command$compile_rpath"
3589 relink_command="$finalize_var$finalize_command$finalize_rpath"
3591 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3592 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3594 if test "$fast_install" != no; then
3595 link_command="$finalize_var$compile_command$finalize_rpath"
3596 if test "$fast_install" = yes; then
3597 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3599 # fast_install is set to needless
3603 link_command="$compile_var$compile_command$compile_rpath"
3604 relink_command="$finalize_var$finalize_command$finalize_rpath"
3608 # Replace the output file specification.
3609 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3611 # Delete the old output files.
3612 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3614 $show "$link_command"
3615 $run eval "$link_command" || exit $?
3617 # Now create the wrapper script.
3618 $show "creating $output"
3620 # Quote the relink command for shipping.
3621 if test -n "$relink_command"; then
3622 # Preserve any variables that may affect compiler behavior
3623 for var in $variables_saved_for_relink; do
3624 if eval test -z \"\${$var+set}\"; then
3625 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3626 elif eval var_value=\$$var; test -z "$var_value"; then
3627 relink_command="$var=; export $var; $relink_command"
3629 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3630 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3633 relink_command="(cd `pwd`; $relink_command)"
3634 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3637 # Quote $echo for shipping.
3638 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3640 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3641 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3643 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3645 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3648 # Only actually do things if our run command is non-null.
3649 if test -z "$run"; then
3650 # win32 will think the script is a binary if it has
3651 # a .exe suffix, so we strip it off here.
3653 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3655 # test for cygwin because mv fails w/o .exe extensions
3657 *cygwin*) exeext=.exe ;;
3661 trap "$rm $output; exit 1" 1 2 15
3666 # $output - temporary wrapper script for $objdir/$outputname
3667 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3669 # The $output program cannot be directly executed until all the libtool
3670 # libraries that it depends on are installed.
3672 # This wrapper script should never be moved out of the build directory.
3673 # If it is, it will not operate correctly.
3675 # Sed substitution that helps us do robust quoting. It backslashifies
3676 # metacharacters that are still active within double-quoted strings.
3677 Xsed="${SED}"' -e 1s/^X//'
3678 sed_quote_subst='$sed_quote_subst'
3680 # The HP-UX ksh and POSIX shell print the target directory to stdout
3682 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3684 relink_command=\"$relink_command\"
3686 # This environment variable determines our operation mode.
3687 if test \"\$libtool_install_magic\" = \"$magic\"; then
3688 # install mode needs the following variable:
3689 notinst_deplibs='$notinst_deplibs'
3691 # When we are sourced in execute mode, \$file and \$echo are already set.
3692 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3695 # Make sure echo works.
3696 if test \"X\$1\" = X--no-reexec; then
3697 # Discard the --no-reexec flag, and continue.
3699 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3700 # Yippee, \$echo works!
3703 # Restart under the correct shell, and then maybe \$echo will work.
3704 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3710 # Find the directory that this script lives in.
3711 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3712 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3714 # Follow symbolic links until we get to the real thisdir.
3715 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3716 while test -n \"\$file\"; do
3717 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3719 # If there was a directory component, then change thisdir.
3720 if test \"x\$destdir\" != \"x\$file\"; then
3721 case \"\$destdir\" in
3722 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3723 *) thisdir=\"\$thisdir/\$destdir\" ;;
3727 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3728 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3731 # Try to get the absolute directory name.
3732 absdir=\`cd \"\$thisdir\" && pwd\`
3733 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3736 if test "$fast_install" = yes; then
3738 program=lt-'$outputname'$exeext
3739 progdir=\"\$thisdir/$objdir\"
3741 if test ! -f \"\$progdir/\$program\" || \\
3742 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3743 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3745 file=\"\$\$-\$program\"
3747 if test ! -d \"\$progdir\"; then
3748 $mkdir \"\$progdir\"
3750 $rm \"\$progdir/\$file\"
3755 # relink executable if necessary
3756 if test -n \"\$relink_command\"; then
3757 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3759 $echo \"\$relink_command_output\" >&2
3760 $rm \"\$progdir/\$file\"
3765 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3766 { $rm \"\$progdir/\$program\";
3767 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3768 $rm \"\$progdir/\$file\"
3772 program='$outputname'
3773 progdir=\"\$thisdir/$objdir\"
3779 if test -f \"\$progdir/\$program\"; then"
3781 # Export our shlibpath_var if we have one.
3782 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3784 # Add our own library path to $shlibpath_var
3785 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3787 # Some systems cannot cope with colon-terminated $shlibpath_var
3788 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3789 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3791 export $shlibpath_var
3795 # fixup the dll searchpath if we need to.
3796 if test -n "$dllsearchpath"; then
3798 # Add the dll search path components to the executable PATH
3799 PATH=$dllsearchpath:\$PATH
3804 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3805 # Run the actual program with our arguments.
3808 # win32 systems need to use the prog path for dll
3810 *-*-cygwin* | *-*-pw32*)
3812 exec \$progdir/\$program \${1+\"\$@\"}
3816 # Backslashes separate directories on plain windows
3817 *-*-mingw | *-*-os2*)
3819 exec \$progdir\\\\\$program \${1+\"\$@\"}
3825 # Export the path to the program.
3826 PATH=\"\$progdir:\$PATH\"
3829 exec \$program \${1+\"\$@\"}
3834 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3838 # The program doesn't exist.
3839 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3840 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3841 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3852 # See if we need to build an old-fashioned archive.
3853 for oldlib in $oldlibs; do
3855 if test "$build_libtool_libs" = convenience; then
3856 oldobjs="$libobjs_save"
3857 addlibs="$convenience"
3858 build_libtool_libs=no
3860 if test "$build_libtool_libs" = module; then
3861 oldobjs="$libobjs_save"
3862 build_libtool_libs=no
3864 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3866 addlibs="$old_convenience"
3869 if test -n "$addlibs"; then
3870 gentop="$output_objdir/${outputname}x"
3871 $show "${rm}r $gentop"
3872 $run ${rm}r "$gentop"
3873 $show "mkdir $gentop"
3874 $run mkdir "$gentop"
3876 if test $status -ne 0 && test ! -d "$gentop"; then
3879 generated="$generated $gentop"
3881 # Add in members from convenience archives.
3882 for xlib in $addlibs; do
3883 # Extract the objects.
3885 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3886 *) xabs=`pwd`"/$xlib" ;;
3888 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3889 xdir="$gentop/$xlib"
3891 $show "${rm}r $xdir"
3896 if test $status -ne 0 && test ! -d "$xdir"; then
3899 $show "(cd $xdir && $AR x $xabs)"
3900 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3902 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3906 # Do each command in the archive commands.
3907 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3908 eval cmds=\"$old_archive_from_new_cmds\"
3910 # Ensure that we have .o objects in place in case we decided
3911 # not to build a shared library, and have fallen back to building
3912 # static libs even though --disable-static was passed!
3913 for oldobj in $oldobjs; do
3914 if test ! -f $oldobj; then
3915 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3916 if test "X$xdir" = "X$oldobj"; then
3921 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3922 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3923 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3924 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3928 eval cmds=\"$old_archive_cmds\"
3930 save_ifs="$IFS"; IFS='~'
3931 for cmd in $cmds; do
3934 $run eval "$cmd" || exit $?
3939 if test -n "$generated"; then
3940 $show "${rm}r$generated"
3941 $run ${rm}r$generated
3944 # Now create the libtool archive.
3948 test "$build_old_libs" = yes && old_library="$libname.$libext"
3949 $show "creating $output"
3951 # Preserve any variables that may affect compiler behavior
3952 for var in $variables_saved_for_relink; do
3953 if eval test -z \"\${$var+set}\"; then
3954 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3955 elif eval var_value=\$$var; test -z "$var_value"; then
3956 relink_command="$var=; export $var; $relink_command"
3958 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3959 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3962 # Quote the link command for shipping.
3963 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3964 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3966 # Only create the output if not a dry run.
3967 if test -z "$run"; then
3968 for installed in no yes; do
3969 if test "$installed" = yes; then
3970 if test -z "$install_libdir"; then
3973 output="$output_objdir/$outputname"i
3974 # Replace all uninstalled libtool libraries with the installed ones
3976 for deplib in $dependency_libs; do
3979 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3980 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3981 if test -z "$libdir"; then
3982 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3985 newdependency_libs="$newdependency_libs $libdir/$name"
3987 *) newdependency_libs="$newdependency_libs $deplib" ;;
3990 dependency_libs="$newdependency_libs"
3992 for lib in $dlfiles; do
3993 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3994 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3995 if test -z "$libdir"; then
3996 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3999 newdlfiles="$newdlfiles $libdir/$name"
4001 dlfiles="$newdlfiles"
4003 for lib in $dlprefiles; do
4004 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4005 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4006 if test -z "$libdir"; then
4007 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4010 newdlprefiles="$newdlprefiles $libdir/$name"
4012 dlprefiles="$newdlprefiles"
4015 # place dlname in correct position for cygwin
4017 case $host,$output,$installed,$module,$dlname in
4018 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4021 # $outputname - a libtool library file
4022 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4024 # Please DO NOT delete this file!
4025 # It is necessary for linking the library.
4027 # The name that we can dlopen(3).
4030 # Names of this library.
4031 library_names='$library_names'
4033 # The name of the static archive.
4034 old_library='$old_library'
4036 # Libraries that this one depends upon.
4037 dependency_libs='$dependency_libs'
4039 # Version information for $libname.
4044 # Is this an already installed library?
4045 installed=$installed
4047 # Files to dlopen/dlpreopen
4049 dlpreopen='$dlprefiles'
4051 # Directory that this library needs to be installed in:
4052 libdir='$install_libdir'"
4053 if test "$installed" = no && test $need_relink = yes; then
4055 relink_command=\"$relink_command\""
4060 # Do a symbolic link so that the libtool archive can be found in
4061 # LD_LIBRARY_PATH before the program is installed.
4062 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4063 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4069 # libtool install mode
4071 modename="$modename: install"
4073 # There may be an optional sh(1) argument at the beginning of
4074 # install_prog (especially on Windows NT).
4075 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4076 # Allow the use of GNU shtool's install command.
4077 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4078 # Aesthetically quote it.
4079 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4081 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4085 install_prog="$arg "
4093 # The real first argument should be the name of the installation program.
4094 # Aesthetically quote it.
4095 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4097 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4101 install_prog="$install_prog$arg"
4103 # We need to accept at least all the BSD install flags.
4113 if test -n "$dest"; then
4114 files="$files $dest"
4132 # If the previous option needed an argument, then skip it.
4133 if test -n "$prev"; then
4142 # Aesthetically quote the argument.
4143 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4145 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4149 install_prog="$install_prog $arg"
4152 if test -z "$install_prog"; then
4153 $echo "$modename: you must specify an install program" 1>&2
4158 if test -n "$prev"; then
4159 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4164 if test -z "$files"; then
4165 if test -z "$dest"; then
4166 $echo "$modename: no file or destination specified" 1>&2
4168 $echo "$modename: you must specify a destination" 1>&2
4174 # Strip any trailing slash from the destination.
4175 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4177 # Check to see that the destination is a directory.
4178 test -d "$dest" && isdir=yes
4179 if test "$isdir" = yes; then
4183 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4184 test "X$destdir" = "X$dest" && destdir=.
4185 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4187 # Not a directory, so check to see that there is only one file specified.
4189 if test $# -gt 2; then
4190 $echo "$modename: \`$dest' is not a directory" 1>&2
4196 [\\/]* | [A-Za-z]:[\\/]*) ;;
4198 for file in $files; do
4202 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4211 # This variable tells wrapper scripts just to set variables rather
4212 # than running their programs.
4213 libtool_install_magic="$magic"
4218 for file in $files; do
4220 # Do each installation.
4223 # Do the static libraries later.
4224 staticlibs="$staticlibs $file"
4228 # Check to see that this really is a libtool archive.
4229 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4231 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4239 # If there is no directory component, then add one.
4241 */* | *\\*) . $file ;;
4245 # Add the libdir to current_libdirs if it is the destination.
4246 if test "X$destdir" = "X$libdir"; then
4247 case "$current_libdirs " in
4249 *) current_libdirs="$current_libdirs $libdir" ;;
4252 # Note the libdir as a future libdir.
4253 case "$future_libdirs " in
4255 *) future_libdirs="$future_libdirs $libdir" ;;
4259 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4260 test "X$dir" = "X$file/" && dir=
4263 if test -n "$relink_command"; then
4264 # Determine the prefix the user has applied to our future dir.
4265 inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4267 # Don't allow the user to place us outside of our expected
4268 # location b/c this prevents finding dependent libraries that
4269 # are installed to the same prefix.
4270 if test "$inst_prefix_dir" = "$destdir"; then
4271 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4275 if test -n "$inst_prefix_dir"; then
4276 # Stick the inst_prefix_dir data into the link command.
4277 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4279 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4282 $echo "$modename: warning: relinking \`$file'" 1>&2
4283 $show "$relink_command"
4284 if $run eval "$relink_command"; then :
4286 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4291 # See the names of the shared library.
4292 set dummy $library_names
4293 if test -n "$2"; then
4299 test -n "$relink_command" && srcname="$realname"T
4301 # Install the shared library and build the symlinks.
4302 $show "$install_prog $dir/$srcname $destdir/$realname"
4303 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4304 if test -n "$stripme" && test -n "$striplib"; then
4305 $show "$striplib $destdir/$realname"
4306 $run eval "$striplib $destdir/$realname" || exit $?
4309 if test $# -gt 0; then
4310 # Delete the old symlinks, and create new ones.
4313 if test "$linkname" != "$realname"; then
4314 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4315 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4320 # Do each command in the postinstall commands.
4321 lib="$destdir/$realname"
4322 eval cmds=\"$postinstall_cmds\"
4323 save_ifs="$IFS"; IFS='~'
4324 for cmd in $cmds; do
4327 $run eval "$cmd" || exit $?
4332 # Install the pseudo-library for information purposes.
4333 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4334 instname="$dir/$name"i
4335 $show "$install_prog $instname $destdir/$name"
4336 $run eval "$install_prog $instname $destdir/$name" || exit $?
4338 # Maybe install the static library, too.
4339 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4343 # Install (i.e. copy) a libtool object.
4345 # Figure out destination file name, if it wasn't already specified.
4346 if test -n "$destname"; then
4347 destfile="$destdir/$destname"
4349 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4350 destfile="$destdir/$destfile"
4353 # Deduce the name of the destination old-style object file.
4356 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4359 staticdest="$destfile"
4363 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4369 # Install the libtool object if requested.
4370 if test -n "$destfile"; then
4371 $show "$install_prog $file $destfile"
4372 $run eval "$install_prog $file $destfile" || exit $?
4375 # Install the old object if enabled.
4376 if test "$build_old_libs" = yes; then
4377 # Deduce the name of the old-style object file.
4378 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4380 $show "$install_prog $staticobj $staticdest"
4381 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4387 # Figure out destination file name, if it wasn't already specified.
4388 if test -n "$destname"; then
4389 destfile="$destdir/$destname"
4391 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4392 destfile="$destdir/$destfile"
4395 # Do a test to see if this is really a libtool program.
4398 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4404 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4408 # If there is no directory component, then add one.
4410 */* | *\\*) . $wrapper ;;
4414 # Check the variables that should have been set.
4415 if test -z "$notinst_deplibs"; then
4416 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4421 for lib in $notinst_deplibs; do
4422 # Check to see that each library is installed.
4424 if test -f "$lib"; then
4425 # If there is no directory component, then add one.
4427 */* | *\\*) . $lib ;;
4431 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4432 if test -n "$libdir" && test ! -f "$libfile"; then
4433 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4439 # If there is no directory component, then add one.
4441 */* | *\\*) . $wrapper ;;
4446 if test "$fast_install" = no && test -n "$relink_command"; then
4447 if test "$finalize" = yes && test -z "$run"; then
4449 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4450 tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4451 if test $? = 0 ; then
4452 tmpdir="$tmpdir_mktemp"
4455 tmpdir="$tmpdir/libtool-$$"
4457 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4459 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4462 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4463 outputname="$tmpdir/$file"
4464 # Replace the output file specification.
4465 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4467 $show "$relink_command"
4468 if $run eval "$relink_command"; then :
4470 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4476 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4479 # Install the binary that we compiled earlier.
4480 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4484 # remove .exe since cygwin /usr/bin/install will append another
4486 case $install_prog,$host in
4487 /usr/bin/install*,*cygwin*)
4488 case $file:$destfile in
4493 destfile=$destfile.exe
4496 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4501 $show "$install_prog$stripme $file $destfile"
4502 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4503 test -n "$outputname" && ${rm}r "$tmpdir"
4508 for file in $staticlibs; do
4509 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4511 # Set up the ranlib parameters.
4512 oldlib="$destdir/$name"
4514 $show "$install_prog $file $oldlib"
4515 $run eval "$install_prog \$file \$oldlib" || exit $?
4517 if test -n "$stripme" && test -n "$striplib"; then
4518 $show "$old_striplib $oldlib"
4519 $run eval "$old_striplib $oldlib" || exit $?
4522 # Do each command in the postinstall commands.
4523 eval cmds=\"$old_postinstall_cmds\"
4524 save_ifs="$IFS"; IFS='~'
4525 for cmd in $cmds; do
4528 $run eval "$cmd" || exit $?
4533 if test -n "$future_libdirs"; then
4534 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4537 if test -n "$current_libdirs"; then
4538 # Maybe just do a dry run.
4539 test -n "$run" && current_libdirs=" -n$current_libdirs"
4540 exec_cmd='$SHELL $0 --finish$current_libdirs'
4546 # libtool finish mode
4548 modename="$modename: finish"
4552 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4555 libdirs="$libdirs $dir"
4558 for libdir in $libdirs; do
4559 if test -n "$finish_cmds"; then
4560 # Do each command in the finish commands.
4561 eval cmds=\"$finish_cmds\"
4562 save_ifs="$IFS"; IFS='~'
4563 for cmd in $cmds; do
4566 $run eval "$cmd" || admincmds="$admincmds
4571 if test -n "$finish_eval"; then
4572 # Do the single finish_eval.
4573 eval cmds=\"$finish_eval\"
4574 $run eval "$cmds" || admincmds="$admincmds
4580 # Exit here if they wanted silent mode.
4581 test "$show" = ":" && exit 0
4583 echo "----------------------------------------------------------------------"
4584 echo "Libraries have been installed in:"
4585 for libdir in $libdirs; do
4589 echo "If you ever happen to want to link against installed libraries"
4590 echo "in a given directory, LIBDIR, you must either use libtool, and"
4591 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4592 echo "flag during linking and do at least one of the following:"
4593 if test -n "$shlibpath_var"; then
4594 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4595 echo " during execution"
4597 if test -n "$runpath_var"; then
4598 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4599 echo " during linking"
4601 if test -n "$hardcode_libdir_flag_spec"; then
4603 eval flag=\"$hardcode_libdir_flag_spec\"
4605 echo " - use the \`$flag' linker flag"
4607 if test -n "$admincmds"; then
4608 echo " - have your system administrator run these commands:$admincmds"
4610 if test -f /etc/ld.so.conf; then
4611 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4614 echo "See any operating system documentation about shared libraries for"
4615 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4616 echo "----------------------------------------------------------------------"
4620 # libtool execute mode
4622 modename="$modename: execute"
4624 # The first argument is the command name.
4626 if test -z "$cmd"; then
4627 $echo "$modename: you must specify a COMMAND" 1>&2
4632 # Handle -dlopen flags immediately.
4633 for file in $execute_dlfiles; do
4634 if test ! -f "$file"; then
4635 $echo "$modename: \`$file' is not a file" 1>&2
4643 # Check to see that this really is a libtool archive.
4644 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4646 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4651 # Read the libtool library.
4655 # If there is no directory component, then add one.
4657 */* | *\\*) . $file ;;
4661 # Skip this library if it cannot be dlopened.
4662 if test -z "$dlname"; then
4663 # Warn if it was a shared library.
4664 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4668 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4669 test "X$dir" = "X$file" && dir=.
4671 if test -f "$dir/$objdir/$dlname"; then
4674 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4680 # Just add the directory containing the .lo file.
4681 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4682 test "X$dir" = "X$file" && dir=.
4686 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4691 # Get the absolute pathname.
4692 absdir=`cd "$dir" && pwd`
4693 test -n "$absdir" && dir="$absdir"
4695 # Now add the directory to shlibpath_var.
4696 if eval "test -z \"\$$shlibpath_var\""; then
4697 eval "$shlibpath_var=\"\$dir\""
4699 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4703 # This variable tells wrapper scripts just to set shlibpath_var
4704 # rather than running their programs.
4705 libtool_execute_magic="$magic"
4707 # Check if any of the arguments is a wrapper script.
4714 # Do a test to see if this is really a libtool program.
4715 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4716 # If there is no directory component, then add one.
4718 */* | *\\*) . $file ;;
4722 # Transform arg to wrapped name.
4723 file="$progdir/$program"
4727 # Quote arguments (to preserve shell metacharacters).
4728 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4729 args="$args \"$file\""
4732 if test -z "$run"; then
4733 if test -n "$shlibpath_var"; then
4734 # Export the shlibpath_var.
4735 eval "export $shlibpath_var"
4738 # Restore saved enviroment variables
4739 if test "${save_LC_ALL+set}" = set; then
4740 LC_ALL="$save_LC_ALL"; export LC_ALL
4742 if test "${save_LANG+set}" = set; then
4743 LANG="$save_LANG"; export LANG
4746 # Now prepare to actually exec the command.
4747 exec_cmd="\$cmd$args"
4749 # Display what would be done.
4750 if test -n "$shlibpath_var"; then
4751 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4752 $echo "export $shlibpath_var"
4759 # libtool clean and uninstall mode
4761 modename="$modename: $mode"
4767 # This variable tells wrapper scripts just to set variables rather
4768 # than running their programs.
4769 libtool_install_magic="$magic"
4774 -f) rm="$rm $arg"; rmforce=yes ;;
4775 -*) rm="$rm $arg" ;;
4776 *) files="$files $arg" ;;
4780 if test -z "$rm"; then
4781 $echo "$modename: you must specify an RM program" 1>&2
4788 for file in $files; do
4789 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4790 if test "X$dir" = "X$file"; then
4794 objdir="$dir/$objdir"
4796 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4797 test $mode = uninstall && objdir="$dir"
4799 # Remember objdir for removal later, being careful to avoid duplicates
4800 if test $mode = clean; then
4803 *) rmdirs="$rmdirs $objdir" ;;
4807 # Don't error if the file doesn't exist and rm -f was used.
4808 if (test -L "$file") >/dev/null 2>&1 \
4809 || (test -h "$file") >/dev/null 2>&1 \
4810 || test -f "$file"; then
4812 elif test -d "$file"; then
4815 elif test "$rmforce" = yes; then
4823 # Possibly a libtool archive, so verify it.
4824 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4827 # Delete the libtool libraries and symlinks.
4828 for n in $library_names; do
4829 rmfiles="$rmfiles $objdir/$n"
4831 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4832 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4834 if test $mode = uninstall; then
4835 if test -n "$library_names"; then
4836 # Do each command in the postuninstall commands.
4837 eval cmds=\"$postuninstall_cmds\"
4838 save_ifs="$IFS"; IFS='~'
4839 for cmd in $cmds; do
4843 if test $? != 0 && test "$rmforce" != yes; then
4850 if test -n "$old_library"; then
4851 # Do each command in the old_postuninstall commands.
4852 eval cmds=\"$old_postuninstall_cmds\"
4853 save_ifs="$IFS"; IFS='~'
4854 for cmd in $cmds; do
4858 if test $? != 0 && test "$rmforce" != yes; then
4864 # FIXME: should reinstall the best remaining shared library.
4870 if test "$build_old_libs" = yes; then
4871 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4872 rmfiles="$rmfiles $dir/$oldobj"
4877 # Do a test to see if this is a libtool program.
4878 if test $mode = clean &&
4879 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4883 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4884 if test "$fast_install" = yes && test -n "$relink_command"; then
4885 rmfiles="$rmfiles $objdir/lt-$name"
4890 $show "$rm $rmfiles"
4891 $run $rm $rmfiles || exit_status=1
4894 # Try to remove the ${objdir}s in the directories where we deleted files
4895 for dir in $rmdirs; do
4896 if test -d "$dir"; then
4898 $run rmdir $dir >/dev/null 2>&1
4906 $echo "$modename: you must specify a MODE" 1>&2
4907 $echo "$generic_help" 1>&2
4912 if test -z "$exec_cmd"; then
4913 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4914 $echo "$generic_help" 1>&2
4917 fi # test -z "$show_help"
4919 if test -n "$exec_cmd"; then
4924 # We need to display help for each of the modes.
4927 "Usage: $modename [OPTION]... [MODE-ARG]...
4929 Provide generalized library-building support services.
4931 --config show all configuration variables
4932 --debug enable verbose shell tracing
4933 -n, --dry-run display commands without modifying any files
4934 --features display basic configuration information and exit
4935 --finish same as \`--mode=finish'
4936 --help display this help message and exit
4937 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4938 --quiet same as \`--silent'
4939 --silent don't print informational messages
4940 --version print version information
4942 MODE must be one of the following:
4944 clean remove files from the build directory
4945 compile compile a source file into a libtool object
4946 execute automatically set library path, then run a program
4947 finish complete the installation of libtool libraries
4948 install install libraries or executables
4949 link create a library or an executable
4950 uninstall remove libraries from an installed directory
4952 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4953 a more detailed description of MODE."
4959 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4961 Remove files from the build directory.
4963 RM is the name of the program to use to delete files associated with each FILE
4964 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4967 If FILE is a libtool library, object or program, all the files associated
4968 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4973 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4975 Compile a source file into a libtool library object.
4977 This mode accepts the following additional options:
4979 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4980 -prefer-pic try to building PIC objects only
4981 -prefer-non-pic try to building non-PIC objects only
4982 -static always build a \`.o' file suitable for static linking
4984 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4985 from the given SOURCEFILE.
4987 The output file name is determined by removing the directory component from
4988 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4989 library object suffix, \`.lo'."
4994 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4996 Automatically set library path, then run a program.
4998 This mode accepts the following additional options:
5000 -dlopen FILE add the directory containing FILE to the library path
5002 This mode sets the library path environment variable according to \`-dlopen'
5005 If any of the ARGS are libtool executable wrappers, then they are translated
5006 into their corresponding uninstalled binary, and any of their required library
5007 directories are added to the library path.
5009 Then, COMMAND is executed, with ARGS as arguments."
5014 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5016 Complete the installation of libtool libraries.
5018 Each LIBDIR is a directory that contains libtool libraries.
5020 The commands that this mode executes may require superuser privileges. Use
5021 the \`--dry-run' option if you just want to see what would be executed."
5026 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5028 Install executables or libraries.
5030 INSTALL-COMMAND is the installation command. The first component should be
5031 either the \`install' or \`cp' program.
5033 The rest of the components are interpreted as arguments to that command (only
5034 BSD-compatible install options are recognized)."
5039 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5041 Link object files or libraries together to form another library, or to
5042 create an executable program.
5044 LINK-COMMAND is a command using the C compiler that you would use to create
5045 a program from several object files.
5047 The following components of LINK-COMMAND are treated specially:
5049 -all-static do not do any dynamic linking at all
5050 -avoid-version do not add a version suffix if possible
5051 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5052 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5053 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5054 -export-symbols SYMFILE
5055 try to export only the symbols listed in SYMFILE
5056 -export-symbols-regex REGEX
5057 try to export only the symbols matching REGEX
5058 -LLIBDIR search LIBDIR for required installed libraries
5059 -lNAME OUTPUT-FILE requires the installed library libNAME
5060 -module build a library that can dlopened
5061 -no-fast-install disable the fast-install mode
5062 -no-install link a not-installable executable
5063 -no-undefined declare that a library does not refer to external symbols
5064 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5065 -release RELEASE specify package release information
5066 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5067 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5068 -static do not do any dynamic linking of libtool libraries
5069 -version-info CURRENT[:REVISION[:AGE]]
5070 specify library version info [each variable defaults to 0]
5072 All other options (arguments beginning with \`-') are ignored.
5074 Every other argument is treated as a filename. Files ending in \`.la' are
5075 treated as uninstalled libtool libraries, other files are standard or library
5078 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5079 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5080 required, except when creating a convenience library.
5082 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5083 using \`ar' and \`ranlib', or on Windows using \`lib'.
5085 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5086 is created, otherwise an executable program is created."
5091 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5093 Remove libraries from an installation directory.
5095 RM is the name of the program to use to delete files associated with each FILE
5096 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5099 If FILE is a libtool library, all the files associated with it are deleted.
5100 Otherwise, only FILE itself is deleted using RM."
5104 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5111 $echo "Try \`$modename --help' for more information about other modes."