1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # The name of this program.
52 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
59 TIMESTAMP=" (1.922.2.110 2002/10/23 01:39:54)"
62 help="Try \`$progname --help' for more information."
63 magic="%%%MAGIC variable%%%"
68 # Sed substitution that helps us do robust quoting. It backslashifies
69 # metacharacters that are still active within double-quoted strings.
70 Xsed="${SED}"' -e 1s/^X//'
71 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72 # test EBCDIC or ASCII
73 case `echo A|od -x` in
74 *[Cc]1*) # EBCDIC based system
75 SP2NL="tr '\100' '\n'"
76 NL2SP="tr '\r\n' '\100\100'"
78 *) # Assume ASCII based system
79 SP2NL="tr '\040' '\012'"
80 NL2SP="tr '\015\012' '\040\040'"
85 # Only set LANG and LC_ALL to C if already set.
86 # These must not be set unconditionally because not all systems understand
87 # e.g. LANG=C (notably SCO).
88 # We save the old values to restore during execute mode.
89 if test "${LC_ALL+set}" = set; then
90 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
92 if test "${LANG+set}" = set; then
93 save_LANG="$LANG"; LANG=C; export LANG
96 # Make sure IFS has a sensible default
99 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100 echo "$modename: not configured to build any kind of library" 1>&2
101 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
114 lo2o="s/\\.lo\$/.${objext}/"
115 o2lo="s/\\.${objext}\$/.lo/"
117 # Parse our command line options once, thoroughly.
124 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
128 # If the previous option needs an argument, assign it.
129 if test -n "$prev"; then
132 execute_dlfiles="$execute_dlfiles $arg"
144 # Have we seen a non-optional argument yet?
151 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
156 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
161 echo "$progname: enabling shell trace mode"
171 if test "$build_libtool_libs" = yes; then
172 echo "enable shared libraries"
174 echo "disable shared libraries"
176 if test "$build_old_libs" = yes; then
177 echo "enable static libraries"
179 echo "disable static libraries"
184 --finish) mode="finish" ;;
186 --mode) prevopt="--mode" prev=mode ;;
187 --mode=*) mode="$optarg" ;;
189 --preserve-dup-deps) duplicate_deps="yes" ;;
201 $echo "$modename: unrecognized option \`$arg'" 1>&2
213 if test -n "$prevopt"; then
214 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
219 # If this variable is set in any of the actions, the command in it
220 # will be execed at the end. This prevents here-documents from being
221 # left over by shells.
224 if test -z "$show_help"; then
226 # Infer the operation mode.
227 if test -z "$mode"; then
229 *cc | *++ | gcc* | *-gcc* | xlc*)
241 *db | *dbx | *strace | *truss)
251 # If we have no mode, but dlfiles were specified, then do execute mode.
252 test -n "$execute_dlfiles" && mode=execute
254 # Just use the default operation mode.
255 if test -z "$mode"; then
256 if test -n "$nonopt"; then
257 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
259 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
266 # Only execute mode is allowed to have -dlopen flags.
267 if test -n "$execute_dlfiles" && test "$mode" != execute; then
268 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
273 # Change the help message to a mode-specific one.
275 help="Try \`$modename --help --mode=$mode' for more information."
277 # These modes are in order of execution frequency so that they run quickly.
279 # libtool compile mode
281 modename="$modename: compile"
282 # Get the compilation command and the source file.
295 # Aesthetically quote the previous argument.
297 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
300 # Double-quote args containing other shell metacharacters.
301 # Many Bourne shells cannot handle close brackets correctly
302 # in scan sets, so we specify it separately.
303 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
308 # Add the previous argument to base_compile.
309 if test -z "$base_compile"; then
310 base_compile="$lastarg"
312 base_compile="$base_compile $lastarg"
318 # Accept any command-line options.
321 if test "$user_target" != "no"; then
322 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
349 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
351 save_ifs="$IFS"; IFS=','
355 # Double-quote args containing other shell metacharacters.
356 # Many Bourne shells cannot handle close brackets correctly
357 # in scan sets, so we specify it separately.
359 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
363 lastarg="$lastarg $arg"
366 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
368 # Add the arguments to base_compile.
369 if test -z "$base_compile"; then
370 base_compile="$lastarg"
372 base_compile="$base_compile $lastarg"
380 # The next one is the -o target name
385 # We got the output file
392 # Accept the current argument as the source file.
396 # Aesthetically quote the previous argument.
398 # Backslashify any backslashes, double quotes, and dollar signs.
399 # These are the only characters that are still specially
400 # interpreted inside of double-quoted scrings.
401 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
403 # Double-quote args containing other shell metacharacters.
404 # Many Bourne shells cannot handle close brackets correctly
405 # in scan sets, so we specify it separately.
407 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
408 lastarg="\"$lastarg\""
412 # Add the previous argument to base_compile.
413 if test -z "$base_compile"; then
414 base_compile="$lastarg"
416 base_compile="$base_compile $lastarg"
424 # Get the name of the library object.
425 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
428 $echo "$modename: you must specify a target with \`-o'" 1>&2
433 # Recognize several different file suffixes.
434 # If the user specifies -o file.o, it is replaced with file.lo
449 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
452 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
454 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
459 if test -z "$base_compile"; then
460 $echo "$modename: you must specify a compilation command" 1>&2
465 # Delete any leftover library objects.
466 if test "$build_old_libs" = yes; then
467 removelist="$obj $libobj"
473 trap "$run $rm $removelist; exit 1" 1 2 15
475 # On Cygwin there's no "real" PIC flag so we must build both object types
477 cygwin* | mingw* | pw32* | os2*)
481 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
482 # non-PIC code in shared libraries is not supported
486 # Calculate the filename of the output object if compiler does
487 # not support -o with -c
488 if test "$compiler_c_o" = no; then
489 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490 lockfile="$output_obj.lock"
491 removelist="$removelist $output_obj $lockfile"
492 trap "$run $rm $removelist; exit 1" 1 2 15
498 # Lock this critical section if it is needed
499 # We use this script file to make the link, it avoids creating a new file
500 if test "$need_locks" = yes; then
501 until $run ln "$0" "$lockfile" 2>/dev/null; do
502 $show "Waiting for $lockfile to be removed"
505 elif test "$need_locks" = warn; then
506 if test -f "$lockfile"; then
508 *** ERROR, $lockfile exists and contains:
509 `cat $lockfile 2>/dev/null`
511 This indicates that another process is trying to use the same
512 temporary object file, and libtool could not work around it because
513 your compiler does not support \`-c' and \`-o' together. If you
514 repeat this compilation, it may succeed, by chance, but you had better
515 avoid parallel builds (make -j) in this platform, or get a better
521 echo $srcfile > "$lockfile"
524 if test -n "$fix_srcfile_path"; then
525 eval srcfile=\"$fix_srcfile_path\"
528 # Only build a PIC object if we are building libtool libraries.
529 if test "$build_libtool_libs" = yes; then
530 # Without this assignment, base_compile gets emptied.
531 fbsd_hideous_sh_bug=$base_compile
533 if test "$pic_mode" != no; then
534 # All platforms use -DPIC, to notify preprocessed assembler code.
535 command="$base_compile $srcfile $pic_flag -DPIC"
537 # Don't build PIC code
538 command="$base_compile $srcfile"
540 if test "$build_old_libs" = yes; then
542 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543 if test "X$dir" = "X$libobj"; then
548 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
550 if test -d "$dir"; then
557 if test $status -ne 0 && test ! -d $dir; then
562 if test "$compiler_o_lo" = yes; then
564 command="$command -o $output_obj"
565 elif test "$compiler_c_o" = yes; then
567 command="$command -o $output_obj"
570 $run $rm "$output_obj"
572 if $run eval "$command"; then :
574 test -n "$output_obj" && $run $rm $removelist
578 if test "$need_locks" = warn &&
579 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
581 *** ERROR, $lockfile contains:
582 `cat $lockfile 2>/dev/null`
584 but it should contain:
587 This indicates that another process is trying to use the same
588 temporary object file, and libtool could not work around it because
589 your compiler does not support \`-c' and \`-o' together. If you
590 repeat this compilation, it may succeed, by chance, but you had better
591 avoid parallel builds (make -j) in this platform, or get a better
598 # Just move the object if needed, then go on to compile the next one
599 if test x"$output_obj" != x"$libobj"; then
600 $show "$mv $output_obj $libobj"
601 if $run $mv $output_obj $libobj; then :
609 # If we have no pic_flag, then copy the object into place and finish.
610 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611 test "$build_old_libs" = yes; then
612 # Rename the .lo from within objdir to obj
613 if test -f $obj; then
618 $show "$mv $libobj $obj"
619 if $run $mv $libobj $obj; then :
626 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627 if test "X$xdir" = "X$obj"; then
632 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634 # Now arrange that obj and lo_libobj become the same file
635 $show "(cd $xdir && $LN_S $baseobj $libobj)"
636 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637 # Unlock the critical section if it was locked
638 if test "$need_locks" != no; then
649 # Allow error messages only from the first compilation.
650 suppress_output=' >/dev/null 2>&1'
653 # Only build a position-dependent object if we build old libraries.
654 if test "$build_old_libs" = yes; then
655 if test "$pic_mode" != yes; then
656 # Don't build PIC code
657 command="$base_compile $srcfile"
659 # All platforms use -DPIC, to notify preprocessed assembler code.
660 command="$base_compile $srcfile $pic_flag -DPIC"
662 if test "$compiler_c_o" = yes; then
663 command="$command -o $obj"
667 # Suppress compiler output if we already did a PIC compilation.
668 command="$command$suppress_output"
669 $run $rm "$output_obj"
671 if $run eval "$command"; then :
677 if test "$need_locks" = warn &&
678 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
680 *** ERROR, $lockfile contains:
681 `cat $lockfile 2>/dev/null`
683 but it should contain:
686 This indicates that another process is trying to use the same
687 temporary object file, and libtool could not work around it because
688 your compiler does not support \`-c' and \`-o' together. If you
689 repeat this compilation, it may succeed, by chance, but you had better
690 avoid parallel builds (make -j) in this platform, or get a better
697 # Just move the object if needed
698 if test x"$output_obj" != x"$obj"; then
699 $show "$mv $output_obj $obj"
700 if $run $mv $output_obj $obj; then :
708 # Create an invalid libtool object if no PIC, so that we do not
709 # accidentally link it into a program.
710 if test "$build_libtool_libs" != yes; then
711 $show "echo timestamp > $libobj"
712 $run eval "echo timestamp > \$libobj" || exit $?
714 # Move the .lo from within objdir
715 $show "$mv $libobj $lo_libobj"
716 if $run $mv $libobj $lo_libobj; then :
725 # Unlock the critical section if it was locked
726 if test "$need_locks" != no; then
735 modename="$modename: link"
737 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
738 # It is impossible to link a dll without this setting, and
739 # we shouldn't force the makefile maintainer to figure out
740 # which system we are compiling for in order to pass an extra
741 # flag for every libtool invokation.
744 # FIXME: Unfortunately, there are problems with the above when trying
745 # to make a dll which has undefined symbols, in which case not
746 # even a static library is built. For now, we need to specify
747 # -no-undefined on the libtool link line when we can be certain
748 # that all symbols are satisfied, otherwise we get a static library.
755 libtool_args="$nonopt"
756 compile_command="$nonopt"
757 finalize_command="$nonopt"
770 lib_search_path=`pwd`
778 export_symbols_regex=
785 prefer_static_libs=no
797 # We need to know -static, to get the right output filenames.
801 -all-static | -static)
802 if test "X$arg" = "X-all-static"; then
803 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
804 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
806 if test -n "$link_static_flag"; then
807 dlopen_self=$dlopen_self_static
810 if test -z "$pic_flag" && test -n "$link_static_flag"; then
811 dlopen_self=$dlopen_self_static
814 build_libtool_libs=no
816 prefer_static_libs=yes
822 # See if our shared archives depend on static archives.
823 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
825 # Go through the arguments, transforming them on the way.
826 while test $# -gt 0; do
830 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
831 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
835 libtool_args="$libtool_args $qarg"
837 # If the previous option needs an argument, assign it.
838 if test -n "$prev"; then
841 compile_command="$compile_command @OUTPUT@"
842 finalize_command="$finalize_command @OUTPUT@"
848 if test "$preload" = no; then
849 # Add the symbol object into the linking commands.
850 compile_command="$compile_command @SYMFILE@"
851 finalize_command="$finalize_command @SYMFILE@"
855 *.la | *.lo) ;; # We handle these cases below.
857 if test "$dlself" = no; then
865 if test "$prev" = dlprefiles; then
867 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
877 if test "$prev" = dlfiles; then
878 dlfiles="$dlfiles $arg"
880 dlprefiles="$dlprefiles $arg"
888 export_symbols="$arg"
889 if test ! -f "$arg"; then
890 $echo "$modename: symbol file \`$arg' does not exist"
897 export_symbols_regex="$arg"
907 # We need an absolute path.
909 [\\/]* | [A-Za-z]:[\\/]*) ;;
911 $echo "$modename: only absolute run-paths are allowed" 1>&2
915 if test "$prev" = rpath; then
918 *) rpath="$rpath $arg" ;;
923 *) xrpath="$xrpath $arg" ;;
930 compiler_flags="$compiler_flags $qarg"
932 compile_command="$compile_command $qarg"
933 finalize_command="$finalize_command $qarg"
937 linker_flags="$linker_flags $qarg"
938 compiler_flags="$compiler_flags $wl$qarg"
940 compile_command="$compile_command $wl$qarg"
941 finalize_command="$finalize_command $wl$qarg"
945 eval "$prev=\"\$arg\""
956 if test -n "$link_static_flag"; then
957 compile_command="$compile_command $link_static_flag"
958 finalize_command="$finalize_command $link_static_flag"
964 # FIXME: remove this flag sometime in the future.
965 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
989 -export-symbols | -export-symbols-regex)
990 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
991 $echo "$modename: more than one -exported-symbols argument is not allowed"
994 if test "X$arg" = "X-export-symbols"; then
1002 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1003 # so, if we see these flags be careful not to treat them like -L
1005 case $with_gcc/$host in
1006 no/*-*-irix* | no/*-*-nonstopux*)
1007 compile_command="$compile_command $arg"
1008 finalize_command="$finalize_command $arg"
1015 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1016 # We need an absolute path.
1018 [\\/]* | [A-Za-z]:[\\/]*) ;;
1020 absdir=`cd "$dir" && pwd`
1021 if test -z "$absdir"; then
1022 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1031 deplibs="$deplibs -L$dir"
1032 lib_search_path="$lib_search_path $dir"
1036 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1037 case :$dllsearchpath: in
1039 *) dllsearchpath="$dllsearchpath:$dir";;
1047 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1049 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1050 # These systems don't actually have a C or math library (as such)
1053 *-*-mingw* | *-*-os2*)
1054 # These systems don't actually have a C library (as such)
1055 test "X$arg" = "X-lc" && continue
1057 *-*-openbsd* | *-*-freebsd*)
1058 # Do not include libc due to us having libc/libc_r.
1059 test "X$arg" = "X-lc" && continue
1062 elif test "X$arg" = "X-lc_r"; then
1064 *-*-openbsd* | *-*-freebsd4*)
1065 # Do not include libc_r directly, use -pthread flag.
1070 deplibs="$deplibs $arg"
1078 # Do not build the useless static library
1092 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1093 # The PATH hackery in wrapper scripts is required on Windows
1094 # in order for the loader to find any dlls it needs.
1095 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1096 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1099 *) no_install=yes ;;
1127 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1128 # We need an absolute path.
1130 [\\/]* | [A-Za-z]:[\\/]*) ;;
1132 $echo "$modename: only absolute run-paths are allowed" 1>&2
1138 *) xrpath="$xrpath $dir" ;;
1144 # The effects of -static are defined in a previous loop.
1145 # We used to do the same as -all-static on platforms that
1146 # didn't have a PIC flag, but the assumption that the effects
1147 # would be equivalent was wrong. It would break on at least
1148 # Digital Unix and AIX.
1163 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1165 save_ifs="$IFS"; IFS=','
1166 for flag in $args; do
1169 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1174 compiler_flags="$compiler_flags $flag"
1177 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1181 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1183 save_ifs="$IFS"; IFS=','
1184 for flag in $args; do
1187 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1192 compiler_flags="$compiler_flags $wl$flag"
1193 linker_flags="$linker_flags $flag"
1196 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1209 # Some other compiler flag.
1211 # Unknown arguments in both finalize_command and compile_command need
1212 # to be aesthetically quoted because they are evaled later.
1213 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1215 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1222 # A library or standard object.
1223 if test "$prev" = dlfiles; then
1224 # This file was specified with -dlopen.
1225 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1226 dlfiles="$dlfiles $arg"
1230 # If libtool objects are unsupported, then we need to preload.
1235 if test "$prev" = dlprefiles; then
1236 # Preload the old-style object.
1237 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1241 *.lo) libobjs="$libobjs $arg" ;;
1242 *) objs="$objs $arg" ;;
1249 deplibs="$deplibs $arg"
1250 old_deplibs="$old_deplibs $arg"
1255 # A libtool-controlled library.
1257 if test "$prev" = dlfiles; then
1258 # This library was specified with -dlopen.
1259 dlfiles="$dlfiles $arg"
1261 elif test "$prev" = dlprefiles; then
1262 # The library was specified with -dlpreopen.
1263 dlprefiles="$dlprefiles $arg"
1266 deplibs="$deplibs $arg"
1271 # Some other compiler argument.
1273 # Unknown arguments in both finalize_command and compile_command need
1274 # to be aesthetically quoted because they are evaled later.
1275 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1277 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1284 # Now actually substitute the argument into the commands.
1285 if test -n "$arg"; then
1286 compile_command="$compile_command $arg"
1287 finalize_command="$finalize_command $arg"
1289 done # argument parsing loop
1291 if test -n "$prev"; then
1292 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1297 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1298 eval arg=\"$export_dynamic_flag_spec\"
1299 compile_command="$compile_command $arg"
1300 finalize_command="$finalize_command $arg"
1303 # calculate the name of the file, without its directory
1304 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1305 libobjs_save="$libobjs"
1307 if test -n "$shlibpath_var"; then
1308 # get the directories listed in $shlibpath_var
1309 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1313 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1314 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1316 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1317 if test "X$output_objdir" = "X$output"; then
1318 output_objdir="$objdir"
1320 output_objdir="$output_objdir/$objdir"
1322 # Create the object directory.
1323 if test ! -d $output_objdir; then
1324 $show "$mkdir $output_objdir"
1325 $run $mkdir $output_objdir
1327 if test $status -ne 0 && test ! -d $output_objdir; then
1332 # Determine the type of output
1335 $echo "$modename: you must specify an output file" 1>&2
1339 *.$libext) linkmode=oldlib ;;
1340 *.lo | *.$objext) linkmode=obj ;;
1341 *.la) linkmode=lib ;;
1342 *) linkmode=prog ;; # Anything else should be a program.
1347 # Find all interdependent deplibs by searching for libraries
1348 # that are linked more than once (e.g. -la -lb -la)
1349 for deplib in $deplibs; do
1350 if test "X$duplicate_deps" = "Xyes" ; then
1352 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1355 libs="$libs $deplib"
1360 need_relink=no # whether we're linking any uninstalled libtool libraries
1361 notinst_deplibs= # not-installed libtool libraries
1362 notinst_path= # paths that contain not-installed libtool libraries
1366 for file in $dlfiles $dlprefiles; do
1370 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1382 passes="conv scan dlopen dlpreopen link"
1387 for pass in $passes; do
1388 if test $linkmode = prog; then
1389 # Determine which files to process
1393 save_deplibs="$deplibs" # Collect dlpreopened libraries
1396 dlpreopen) libs="$dlprefiles" ;;
1397 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1400 for deplib in $libs; do
1405 if test $linkmode = oldlib && test $linkmode = obj; then
1406 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1409 if test $pass = conv; then
1410 deplibs="$deplib $deplibs"
1413 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1414 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1415 # Search the libtool library
1416 lib="$searchdir/lib${name}.la"
1417 if test -f "$lib"; then
1422 if test "$found" != yes; then
1423 # deplib doesn't seem to be a libtool library
1424 if test "$linkmode,$pass" = "prog,link"; then
1425 compile_deplibs="$deplib $compile_deplibs"
1426 finalize_deplibs="$deplib $finalize_deplibs"
1428 deplibs="$deplib $deplibs"
1429 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1437 deplibs="$deplib $deplibs"
1438 test $pass = conv && continue
1439 newdependency_libs="$deplib $newdependency_libs"
1440 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1443 if test $pass = conv; then
1444 deplibs="$deplib $deplibs"
1447 if test $pass = scan; then
1448 deplibs="$deplib $deplibs"
1449 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1451 compile_deplibs="$deplib $compile_deplibs"
1452 finalize_deplibs="$deplib $finalize_deplibs"
1456 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1462 if test $pass = link; then
1463 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1464 # Make sure the xrpath contains only unique directories.
1467 *) xrpath="$xrpath $dir" ;;
1470 deplibs="$deplib $deplibs"
1473 *.la) lib="$deplib" ;;
1475 if test $pass = conv; then
1476 deplibs="$deplib $deplibs"
1481 if test "$deplibs_check_method" != pass_all; then
1483 echo "*** Warning: Trying to link with static lib archive $deplib."
1484 echo "*** I have the capability to make that library automatically link in when"
1485 echo "*** you link to this library. But I can only do this if you have a"
1486 echo "*** shared version of the library, which you do not appear to have"
1487 echo "*** because the file extensions .$libext of this argument makes me believe"
1488 echo "*** that it is just a static archive that I should not used here."
1491 echo "*** Warning: Linking the shared library $output against the"
1492 echo "*** static library $deplib is not portable!"
1493 deplibs="$deplib $deplibs"
1498 if test $pass != link; then
1499 deplibs="$deplib $deplibs"
1501 compile_deplibs="$deplib $compile_deplibs"
1502 finalize_deplibs="$deplib $finalize_deplibs"
1509 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1510 # If there is no dlopen support or we're linking statically,
1511 # we need to preload.
1512 newdlprefiles="$newdlprefiles $deplib"
1513 compile_deplibs="$deplib $compile_deplibs"
1514 finalize_deplibs="$deplib $finalize_deplibs"
1516 newdlfiles="$newdlfiles $deplib"
1525 if test $found = yes || test -f "$lib"; then :
1527 $echo "$modename: cannot find the library \`$lib'" 1>&2
1531 # Check to see that this really is a libtool archive.
1532 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1534 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1538 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1539 test "X$ladir" = "X$lib" && ladir="."
1547 # If the library was installed with an old release of libtool,
1548 # it will not redefine variable installed.
1553 */* | *\\*) . $lib ;;
1557 if test "$linkmode,$pass" = "lib,link" ||
1558 test "$linkmode,$pass" = "prog,scan" ||
1559 { test $linkmode = oldlib && test $linkmode = obj; }; then
1560 # Add dl[pre]opened files of deplib
1561 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1562 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1565 if test $pass = conv; then
1566 # Only check for convenience libraries
1567 deplibs="$lib $deplibs"
1568 if test -z "$libdir"; then
1569 if test -z "$old_library"; then
1570 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1573 # It is a libtool convenience library, so add in its objects.
1574 convenience="$convenience $ladir/$objdir/$old_library"
1575 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1577 for deplib in $dependency_libs; do
1578 deplibs="$deplib $deplibs"
1579 if test "X$duplicate_deps" = "Xyes" ; then
1580 case "$tmp_libs " in
1581 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1584 tmp_libs="$tmp_libs $deplib"
1586 elif test $linkmode != prog && test $linkmode != lib; then
1587 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1593 # Get the name of the library we link against.
1595 for l in $old_library $library_names; do
1598 if test -z "$linklib"; then
1599 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1603 # This library was specified with -dlopen.
1604 if test $pass = dlopen; then
1605 if test -z "$libdir"; then
1606 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1609 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1610 # If there is no dlname, no dlopen support or we're linking
1611 # statically, we need to preload.
1612 dlprefiles="$dlprefiles $lib"
1614 newdlfiles="$newdlfiles $lib"
1619 # We need an absolute path.
1621 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1623 abs_ladir=`cd "$ladir" && pwd`
1624 if test -z "$abs_ladir"; then
1625 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1626 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1631 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1633 # Find the relevant object directory and library name.
1634 if test "X$installed" = Xyes; then
1635 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1636 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1645 dir="$ladir/$objdir"
1646 absdir="$abs_ladir/$objdir"
1647 # Remove this search path later
1648 notinst_path="$notinst_path $abs_ladir"
1649 fi # $installed = yes
1650 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1652 # This library was specified with -dlpreopen.
1653 if test $pass = dlpreopen; then
1654 if test -z "$libdir"; then
1655 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1658 # Prefer using a static library (so that no silly _DYNAMIC symbols
1659 # are required to link).
1660 if test -n "$old_library"; then
1661 newdlprefiles="$newdlprefiles $dir/$old_library"
1662 # Otherwise, use the dlname, so that lt_dlopen finds it.
1663 elif test -n "$dlname"; then
1664 newdlprefiles="$newdlprefiles $dir/$dlname"
1666 newdlprefiles="$newdlprefiles $dir/$linklib"
1668 fi # $pass = dlpreopen
1670 if test -z "$libdir"; then
1671 # Link the convenience library
1672 if test $linkmode = lib; then
1673 deplibs="$dir/$old_library $deplibs"
1674 elif test "$linkmode,$pass" = "prog,link"; then
1675 compile_deplibs="$dir/$old_library $compile_deplibs"
1676 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1678 deplibs="$lib $deplibs"
1683 if test $linkmode = prog && test $pass != link; then
1684 newlib_search_path="$newlib_search_path $ladir"
1685 deplibs="$lib $deplibs"
1688 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1689 test "$build_libtool_libs" = no; then
1694 for deplib in $dependency_libs; do
1696 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1698 # Need to link against all dependency_libs?
1699 if test $linkalldeplibs = yes; then
1700 deplibs="$deplib $deplibs"
1702 # Need to hardcode shared library paths
1703 # or/and link against static libraries
1704 newdependency_libs="$deplib $newdependency_libs"
1706 if test "X$duplicate_deps" = "Xyes" ; then
1707 case "$tmp_libs " in
1708 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1711 tmp_libs="$tmp_libs $deplib"
1714 fi # $linkmode = prog...
1716 link_static=no # Whether the deplib will be linked statically
1717 if test -n "$library_names" &&
1718 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1719 # Link against this shared library
1721 if test "$linkmode,$pass" = "prog,link" ||
1722 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1723 # Hardcode the library path.
1724 # Skip directories that are in the system default run-time
1726 case " $sys_lib_dlsearch_path " in
1729 case "$compile_rpath " in
1731 *) compile_rpath="$compile_rpath $absdir"
1735 case " $sys_lib_dlsearch_path " in
1738 case "$finalize_rpath " in
1740 *) finalize_rpath="$finalize_rpath $libdir"
1744 if test $linkmode = prog; then
1745 # We need to hardcode the library path
1746 if test -n "$shlibpath_var"; then
1747 # Make sure the rpath contains only unique directories.
1748 case "$temp_rpath " in
1751 *) temp_rpath="$temp_rpath $dir" ;;
1755 fi # $linkmode,$pass = prog,link...
1757 if test "$alldeplibs" = yes &&
1758 { test "$deplibs_check_method" = pass_all ||
1759 { test "$build_libtool_libs" = yes &&
1760 test -n "$library_names"; }; }; then
1761 # We only need to search for static libraries
1765 if test "$installed" = no; then
1766 notinst_deplibs="$notinst_deplibs $lib"
1770 if test -n "$old_archive_from_expsyms_cmds"; then
1771 # figure out the soname
1772 set dummy $library_names
1775 libname=`eval \\$echo \"$libname_spec\"`
1776 # use dlname if we got it. it's perfectly good, no?
1777 if test -n "$dlname"; then
1779 elif test -n "$soname_spec"; then
1783 major=`expr $current - $age`
1787 eval soname=\"$soname_spec\"
1792 # Make a new name for the extract_expsyms_cmds to use
1794 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1795 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1797 # If the library has no export list, then create one now
1798 if test -f "$output_objdir/$soname-def"; then :
1800 $show "extracting exported symbol list from \`$soname'"
1801 save_ifs="$IFS"; IFS='~'
1802 eval cmds=\"$extract_expsyms_cmds\"
1803 for cmd in $cmds; do
1806 $run eval "$cmd" || exit $?
1812 if test -f "$output_objdir/$newlib"; then :; else
1813 $show "generating import library for \`$soname'"
1814 save_ifs="$IFS"; IFS='~'
1815 eval cmds=\"$old_archive_from_expsyms_cmds\"
1816 for cmd in $cmds; do
1819 $run eval "$cmd" || exit $?
1823 # make sure the library variables are pointing to the new library
1826 fi # test -n $old_archive_from_expsyms_cmds
1828 if test $linkmode = prog || test "$mode" != relink; then
1833 case $hardcode_action in
1834 immediate | unsupported)
1835 if test "$hardcode_direct" = no; then
1837 elif test "$hardcode_minus_L" = no; then
1839 *-*-sunos*) add_shlibpath="$dir" ;;
1843 elif test "$hardcode_shlibpath_var" = no; then
1844 add_shlibpath="$dir"
1851 if test "$hardcode_direct" = yes; then
1853 elif test "$hardcode_minus_L" = yes; then
1856 elif test "$hardcode_shlibpath_var" = yes; then
1857 add_shlibpath="$dir"
1866 if test "$lib_linked" != yes; then
1867 $echo "$modename: configuration error: unsupported hardcode properties"
1871 if test -n "$add_shlibpath"; then
1872 case :$compile_shlibpath: in
1873 *":$add_shlibpath:"*) ;;
1874 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1877 if test $linkmode = prog; then
1878 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1879 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1881 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1882 test -n "$add" && deplibs="$add $deplibs"
1883 if test "$hardcode_direct" != yes && \
1884 test "$hardcode_minus_L" != yes && \
1885 test "$hardcode_shlibpath_var" = yes; then
1886 case :$finalize_shlibpath: in
1888 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1894 if test $linkmode = prog || test "$mode" = relink; then
1898 # Finalize command for both is simple: just hardcode it.
1899 if test "$hardcode_direct" = yes; then
1900 add="$libdir/$linklib"
1901 elif test "$hardcode_minus_L" = yes; then
1904 elif test "$hardcode_shlibpath_var" = yes; then
1905 case :$finalize_shlibpath: in
1907 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1911 # We cannot seem to hardcode it, guess we'll fake it.
1916 if test $linkmode = prog; then
1917 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1918 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1920 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1921 test -n "$add" && deplibs="$add $deplibs"
1924 elif test $linkmode = prog; then
1925 if test "$alldeplibs" = yes &&
1926 { test "$deplibs_check_method" = pass_all ||
1927 { test "$build_libtool_libs" = yes &&
1928 test -n "$library_names"; }; }; then
1929 # We only need to search for static libraries
1933 # Try to link the static library
1934 # Here we assume that one of hardcode_direct or hardcode_minus_L
1935 # is not unsupported. This is valid on all known static and
1937 if test "$hardcode_direct" != unsupported; then
1938 test -n "$old_library" && linklib="$old_library"
1939 compile_deplibs="$dir/$linklib $compile_deplibs"
1940 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1942 compile_deplibs="-l$name -L$dir $compile_deplibs"
1943 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1945 elif test "$build_libtool_libs" = yes; then
1946 # Not a shared library
1947 if test "$deplibs_check_method" != pass_all; then
1948 # We're trying link a shared library against a static one
1949 # but the system doesn't support it.
1951 # Just print a warning and add the library to dependency_libs so
1952 # that the program can be linked against the static library.
1954 echo "*** Warning: This system can not link to static lib archive $lib."
1955 echo "*** I have the capability to make that library automatically link in when"
1956 echo "*** you link to this library. But I can only do this if you have a"
1957 echo "*** shared version of the library, which you do not appear to have."
1958 if test "$module" = yes; then
1959 echo "*** But as you try to build a module library, libtool will still create "
1960 echo "*** a static module, that should work as long as the dlopening application"
1961 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1962 if test -z "$global_symbol_pipe"; then
1964 echo "*** However, this would only work if libtool was able to extract symbol"
1965 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1966 echo "*** not find such a program. So, this module is probably useless."
1967 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1969 if test "$build_old_libs" = no; then
1970 build_libtool_libs=module
1973 build_libtool_libs=no
1977 convenience="$convenience $dir/$old_library"
1978 old_convenience="$old_convenience $dir/$old_library"
1979 deplibs="$dir/$old_library $deplibs"
1982 fi # link shared/static library?
1984 if test $linkmode = lib; then
1985 if test -n "$dependency_libs" &&
1986 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1987 test $link_static = yes; }; then
1988 # Extract -R from dependency_libs
1990 for libdir in $dependency_libs; do
1992 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1994 *" $temp_xrpath "*) ;;
1995 *) xrpath="$xrpath $temp_xrpath";;
1997 *) temp_deplibs="$temp_deplibs $libdir";;
2000 dependency_libs="$temp_deplibs"
2003 newlib_search_path="$newlib_search_path $absdir"
2004 # Link against this library
2005 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2006 # ... and its dependency_libs
2008 for deplib in $dependency_libs; do
2009 newdependency_libs="$deplib $newdependency_libs"
2010 if test "X$duplicate_deps" = "Xyes" ; then
2011 case "$tmp_libs " in
2012 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2015 tmp_libs="$tmp_libs $deplib"
2018 if test $link_all_deplibs != no; then
2019 # Add the search paths of all dependency libraries
2020 for deplib in $dependency_libs; do
2022 -L*) path="$deplib" ;;
2024 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2025 test "X$dir" = "X$deplib" && dir="."
2026 # We need an absolute path.
2028 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2030 absdir=`cd "$dir" && pwd`
2031 if test -z "$absdir"; then
2032 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2037 if grep "^installed=no" $deplib > /dev/null; then
2038 path="-L$absdir/$objdir"
2040 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2041 if test -z "$libdir"; then
2042 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2045 if test "$absdir" != "$libdir"; then
2046 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2053 case " $deplibs " in
2055 *) deplibs="$deplibs $path" ;;
2058 fi # link_all_deplibs != no
2060 done # for deplib in $libs
2061 if test $pass = dlpreopen; then
2062 # Link the dlpreopened libraries before other libraries
2063 for deplib in $save_deplibs; do
2064 deplibs="$deplib $deplibs"
2067 if test $pass != dlopen; then
2068 test $pass != scan && dependency_libs="$newdependency_libs"
2069 if test $pass != conv; then
2070 # Make sure lib_search_path contains only unique directories.
2072 for dir in $newlib_search_path; do
2073 case "$lib_search_path " in
2075 *) lib_search_path="$lib_search_path $dir" ;;
2081 if test "$linkmode,$pass" != "prog,link"; then
2084 vars="compile_deplibs finalize_deplibs"
2086 for var in $vars dependency_libs; do
2087 # Add libraries to $var in reverse order
2088 eval tmp_libs=\"\$$var\"
2090 for deplib in $tmp_libs; do
2092 -L*) new_libs="$deplib $new_libs" ;;
2094 case " $specialdeplibs " in
2095 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2097 case " $new_libs " in
2099 *) new_libs="$deplib $new_libs" ;;
2107 for deplib in $new_libs; do
2110 case " $tmp_libs " in
2112 *) tmp_libs="$tmp_libs $deplib" ;;
2115 *) tmp_libs="$tmp_libs $deplib" ;;
2118 eval $var=\"$tmp_libs\"
2121 if test "$pass" = "conv" &&
2122 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2123 libs="$deplibs" # reset libs
2127 if test $linkmode = prog; then
2128 dlfiles="$newdlfiles"
2129 dlprefiles="$newdlprefiles"
2134 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2135 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2138 if test -n "$rpath"; then
2139 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2142 if test -n "$xrpath"; then
2143 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2146 if test -n "$vinfo"; then
2147 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2150 if test -n "$release"; then
2151 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2154 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2155 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2158 # Now set the variables for building old libraries.
2159 build_libtool_libs=no
2161 objs="$objs$old_deplibs"
2165 # Make sure we only generate libraries of the form `libNAME.la'.
2168 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2169 eval libname=\"$libname_spec\"
2172 if test "$module" = no; then
2173 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2177 if test "$need_lib_prefix" != no; then
2178 # Add the "lib" prefix for modules if required
2179 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2180 eval libname=\"$libname_spec\"
2182 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2187 if test -n "$objs"; then
2188 if test "$deplibs_check_method" != pass_all; then
2189 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2193 echo "*** Warning: Linking the shared library $output against the non-libtool"
2194 echo "*** objects $objs is not portable!"
2195 libobjs="$libobjs $objs"
2199 if test "$dlself" != no; then
2200 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2204 if test $# -gt 2; then
2205 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2210 if test -z "$rpath"; then
2211 if test "$build_libtool_libs" = yes; then
2212 # Building a libtool convenience library.
2214 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2215 build_libtool_libs=convenience
2219 if test -n "$vinfo"; then
2220 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2223 if test -n "$release"; then
2224 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2228 # Parse the version information argument.
2229 save_ifs="$IFS"; IFS=':'
2230 set dummy $vinfo 0 0 0
2233 if test -n "$8"; then
2234 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2243 # Check that each of the things are valid numbers.
2245 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2247 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2248 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2254 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2256 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2257 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2263 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2265 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2266 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2271 if test $age -gt $current; then
2272 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2273 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2277 # Calculate the version variables.
2281 case $version_type in
2285 # Like Linux, but with the current version available in
2286 # verstring for coding it into the library header
2287 major=.`expr $current - $age`
2288 versuffix="$major.$age.$revision"
2289 # Darwin ld doesn't like 0 for these options...
2290 minor_current=`expr $current + 1`
2291 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2296 versuffix=".$current.$revision";
2301 versuffix=".$current";
2305 major=`expr $current - $age + 1`
2307 case $version_type in
2308 nonstopux) verstring_prefix=nonstopux ;;
2309 *) verstring_prefix=sgi ;;
2311 verstring="$verstring_prefix$major.$revision"
2313 # Add in all the interfaces that we are compatible with.
2315 while test $loop != 0; do
2316 iface=`expr $revision - $loop`
2317 loop=`expr $loop - 1`
2318 verstring="$verstring_prefix$major.$iface:$verstring"
2321 # Before this point, $major must not contain `.'.
2323 versuffix="$major.$revision"
2327 major=.`expr $current - $age`
2328 versuffix="$major.$age.$revision"
2332 major=.`expr $current - $age`
2333 versuffix=".$current.$age.$revision"
2334 verstring="$current.$age.$revision"
2336 # Add in all the interfaces that we are compatible with.
2338 while test $loop != 0; do
2339 iface=`expr $current - $loop`
2340 loop=`expr $loop - 1`
2341 verstring="$verstring:${iface}.0"
2344 # Make executables depend on our current version.
2345 verstring="$verstring:${current}.0"
2350 versuffix=".$current.$revision"
2354 # Use '-' rather than '.', since we only want one
2355 # extension on DOS 8.3 filesystems.
2356 major=`expr $current - $age`
2361 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2362 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2367 # Clear the version info if we defaulted, and they specified a release.
2368 if test -z "$vinfo" && test -n "$release"; then
2371 case $version_type in
2373 # we can't check for "0.0" in archive_cmds due to quoting
2374 # problems, so we reset it completely
2381 if test "$need_version" = no; then
2388 # Remove version info from name if versioning should be avoided
2389 if test "$avoid_version" = yes && test "$need_version" = no; then
2395 # Check to see if the archive will have undefined symbols.
2396 if test "$allow_undefined" = yes; then
2397 if test "$allow_undefined_flag" = unsupported; then
2398 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2399 build_libtool_libs=no
2403 # Don't allow undefined symbols.
2404 allow_undefined_flag="$no_undefined_flag"
2408 if test "$mode" != relink; then
2409 # Remove our outputs.
2410 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2411 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2414 # Now set the variables for building old libraries.
2415 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2416 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2418 # Transform .lo files to .o files.
2419 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2422 # Eliminate all temporary directories.
2423 for path in $notinst_path; do
2424 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2425 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2426 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2429 if test -n "$xrpath"; then
2430 # If the user specified any rpath flags, then add them.
2432 for libdir in $xrpath; do
2433 temp_xrpath="$temp_xrpath -R$libdir"
2434 case "$finalize_rpath " in
2436 *) finalize_rpath="$finalize_rpath $libdir" ;;
2439 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2440 dependency_libs="$temp_xrpath $dependency_libs"
2444 # Make sure dlfiles contains only unique files that won't be dlpreopened
2445 old_dlfiles="$dlfiles"
2447 for lib in $old_dlfiles; do
2448 case " $dlprefiles $dlfiles " in
2450 *) dlfiles="$dlfiles $lib" ;;
2454 # Make sure dlprefiles contains only unique files
2455 old_dlprefiles="$dlprefiles"
2457 for lib in $old_dlprefiles; do
2458 case "$dlprefiles " in
2460 *) dlprefiles="$dlprefiles $lib" ;;
2464 if test "$build_libtool_libs" = yes; then
2465 if test -n "$rpath"; then
2467 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2468 # these systems don't actually have a c library (as such)!
2470 *-*-rhapsody* | *-*-darwin1.[012])
2471 # Rhapsody C library is in the System framework
2472 deplibs="$deplibs -framework System"
2475 # Don't link with libc until the a.out ld.so is fixed.
2477 *-*-openbsd* | *-*-freebsd*)
2478 # Do not include libc due to us having libc/libc_r.
2481 # Add libc to deplibs on all other systems if necessary.
2482 if test $build_libtool_need_lc = "yes"; then
2483 deplibs="$deplibs -lc"
2489 # Transform deplibs into only deplibs that can be linked in shared.
2491 libname_save=$libname
2492 release_save=$release
2493 versuffix_save=$versuffix
2495 # I'm not sure if I'm treating the release correctly. I think
2496 # release should show up in the -l (ie -lgmp5) so we don't want to
2497 # add it in twice. Is that correct?
2503 case $deplibs_check_method in
2505 # Don't check for shared/static. Everything works.
2506 # This might be a little naive. We might want to check
2507 # whether the library exists or not. But this is on
2508 # osf3 & osf4 and I'm not really sure... Just
2509 # implementing what was already the behaviour.
2513 # This code stresses the "libraries are programs" paradigm to its
2514 # limits. Maybe even breaks it. We compile a program, linking it
2515 # against the deplibs as a proxy for the library. Then we can check
2516 # whether they linked in statically or dynamically with ldd.
2518 cat > conftest.c <<EOF
2519 int main() { return 0; }
2522 $CC -o conftest conftest.c $deplibs
2523 if test $? -eq 0 ; then
2524 ldd_output=`ldd conftest`
2525 for i in $deplibs; do
2526 name="`expr $i : '-l\(.*\)'`"
2527 # If $name is empty we are operating on a -L argument.
2528 if test -n "$name" && test "$name" != "0"; then
2529 libname=`eval \\$echo \"$libname_spec\"`
2530 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2531 set dummy $deplib_matches
2533 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2534 newdeplibs="$newdeplibs $i"
2538 echo "*** Warning: dynamic linker does not accept needed library $i."
2539 echo "*** I have the capability to make that library automatically link in when"
2540 echo "*** you link to this library. But I can only do this if you have a"
2541 echo "*** shared version of the library, which I believe you do not have"
2542 echo "*** because a test_compile did reveal that the linker did not use it for"
2543 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2546 newdeplibs="$newdeplibs $i"
2550 # Error occured in the first compile. Let's try to salvage
2551 # the situation: Compile a separate program for each library.
2552 for i in $deplibs; do
2553 name="`expr $i : '-l\(.*\)'`"
2554 # If $name is empty we are operating on a -L argument.
2555 if test -n "$name" && test "$name" != "0"; then
2557 $CC -o conftest conftest.c $i
2559 if test $? -eq 0 ; then
2560 ldd_output=`ldd conftest`
2561 libname=`eval \\$echo \"$libname_spec\"`
2562 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2563 set dummy $deplib_matches
2565 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2566 newdeplibs="$newdeplibs $i"
2570 echo "*** Warning: dynamic linker does not accept needed library $i."
2571 echo "*** I have the capability to make that library automatically link in when"
2572 echo "*** you link to this library. But I can only do this if you have a"
2573 echo "*** shared version of the library, which you do not appear to have"
2574 echo "*** because a test_compile did reveal that the linker did not use this one"
2575 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2580 echo "*** Warning! Library $i is needed by this library but I was not able to"
2581 echo "*** make it link in! You will probably need to install it or some"
2582 echo "*** library that it depends on before this library will be fully"
2583 echo "*** functional. Installing it before continuing would be even better."
2586 newdeplibs="$newdeplibs $i"
2592 set dummy $deplibs_check_method
2593 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2594 for a_deplib in $deplibs; do
2595 name="`expr $a_deplib : '-l\(.*\)'`"
2596 # If $name is empty we are operating on a -L argument.
2597 if test -n "$name" && test "$name" != "0"; then
2598 libname=`eval \\$echo \"$libname_spec\"`
2599 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2600 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2601 for potent_lib in $potential_libs; do
2602 # Follow soft links.
2603 if ls -lLd "$potent_lib" 2>/dev/null \
2604 | grep " -> " >/dev/null; then
2607 # The statement above tries to avoid entering an
2608 # endless loop below, in case of cyclic links.
2609 # We might still enter an endless loop, since a link
2610 # loop can be closed while we follow links,
2612 potlib="$potent_lib"
2613 while test -h "$potlib" 2>/dev/null; do
2614 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2616 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2617 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2620 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2622 | egrep "$file_magic_regex" > /dev/null; then
2623 newdeplibs="$newdeplibs $a_deplib"
2629 if test -n "$a_deplib" ; then
2632 echo "*** Warning: linker path does not have real file for library $a_deplib."
2633 echo "*** I have the capability to make that library automatically link in when"
2634 echo "*** you link to this library. But I can only do this if you have a"
2635 echo "*** shared version of the library, which you do not appear to have"
2636 echo "*** because I did check the linker path looking for a file starting"
2637 if test -z "$potlib" ; then
2638 echo "*** with $libname but no candidates were found. (...for file magic test)"
2640 echo "*** with $libname and none of the candidates passed a file format test"
2641 echo "*** using a file magic. Last file checked: $potlib"
2645 # Add a -L argument.
2646 newdeplibs="$newdeplibs $a_deplib"
2648 done # Gone through all deplibs.
2651 set dummy $deplibs_check_method
2652 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2653 for a_deplib in $deplibs; do
2654 name="`expr $a_deplib : '-l\(.*\)'`"
2655 # If $name is empty we are operating on a -L argument.
2656 if test -n "$name" && test "$name" != "0"; then
2657 libname=`eval \\$echo \"$libname_spec\"`
2658 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2659 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2660 for potent_lib in $potential_libs; do
2661 potlib="$potent_lib" # see symlink-check below in file_magic test
2662 if eval echo \"$potent_lib\" 2>/dev/null \
2664 | egrep "$match_pattern_regex" > /dev/null; then
2665 newdeplibs="$newdeplibs $a_deplib"
2671 if test -n "$a_deplib" ; then
2674 echo "*** Warning: linker path does not have real file for library $a_deplib."
2675 echo "*** I have the capability to make that library automatically link in when"
2676 echo "*** you link to this library. But I can only do this if you have a"
2677 echo "*** shared version of the library, which you do not appear to have"
2678 echo "*** because I did check the linker path looking for a file starting"
2679 if test -z "$potlib" ; then
2680 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2682 echo "*** with $libname and none of the candidates passed a file format test"
2683 echo "*** using a regex pattern. Last file checked: $potlib"
2687 # Add a -L argument.
2688 newdeplibs="$newdeplibs $a_deplib"
2690 done # Gone through all deplibs.
2694 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2695 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2696 grep . >/dev/null; then
2698 if test "X$deplibs_check_method" = "Xnone"; then
2699 echo "*** Warning: inter-library dependencies are not supported in this platform."
2701 echo "*** Warning: inter-library dependencies are not known to be supported."
2703 echo "*** All declared inter-library dependencies are being dropped."
2708 versuffix=$versuffix_save
2710 release=$release_save
2711 libname=$libname_save
2715 *-*-rhapsody* | *-*-darwin1.[012])
2716 # On Rhapsody replace the C library is the System framework
2717 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2721 if test "$droppeddeps" = yes; then
2722 if test "$module" = yes; then
2724 echo "*** Warning: libtool could not satisfy all declared inter-library"
2725 echo "*** dependencies of module $libname. Therefore, libtool will create"
2726 echo "*** a static module, that should work as long as the dlopening"
2727 echo "*** application is linked with the -dlopen flag."
2728 if test -z "$global_symbol_pipe"; then
2730 echo "*** However, this would only work if libtool was able to extract symbol"
2731 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2732 echo "*** not find such a program. So, this module is probably useless."
2733 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2735 if test "$build_old_libs" = no; then
2736 oldlibs="$output_objdir/$libname.$libext"
2737 build_libtool_libs=module
2740 build_libtool_libs=no
2743 echo "*** The inter-library dependencies that have been dropped here will be"
2744 echo "*** automatically added whenever a program is linked with this library"
2745 echo "*** or is declared to -dlopen it."
2747 if test $allow_undefined = no; then
2749 echo "*** Since this library must not contain undefined symbols,"
2750 echo "*** because either the platform does not support them or"
2751 echo "*** it was explicitly requested with -no-undefined,"
2752 echo "*** libtool will only create a static version of it."
2753 if test "$build_old_libs" = no; then
2754 oldlibs="$output_objdir/$libname.$libext"
2755 build_libtool_libs=module
2758 build_libtool_libs=no
2763 # Done checking deplibs!
2767 # All the library-specific variables (install_libdir is set above).
2772 # Test again, we may have decided not to build it any more
2773 if test "$build_libtool_libs" = yes; then
2774 if test $hardcode_into_libs = yes; then
2775 # Hardcode the library paths
2778 rpath="$finalize_rpath"
2779 test "$mode" != relink && rpath="$compile_rpath$rpath"
2780 for libdir in $rpath; do
2781 if test -n "$hardcode_libdir_flag_spec"; then
2782 if test -n "$hardcode_libdir_separator"; then
2783 if test -z "$hardcode_libdirs"; then
2784 hardcode_libdirs="$libdir"
2786 # Just accumulate the unique libdirs.
2787 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2788 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2791 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2796 eval flag=\"$hardcode_libdir_flag_spec\"
2797 dep_rpath="$dep_rpath $flag"
2799 elif test -n "$runpath_var"; then
2800 case "$perm_rpath " in
2802 *) perm_rpath="$perm_rpath $libdir" ;;
2806 # Substitute the hardcoded libdirs into the rpath.
2807 if test -n "$hardcode_libdir_separator" &&
2808 test -n "$hardcode_libdirs"; then
2809 libdir="$hardcode_libdirs"
2810 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2812 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2813 # We should set the runpath_var.
2815 for dir in $perm_rpath; do
2818 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2820 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2823 shlibpath="$finalize_shlibpath"
2824 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2825 if test -n "$shlibpath"; then
2826 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2829 # Get the real and link names of the library.
2830 eval library_names=\"$library_names_spec\"
2831 set dummy $library_names
2835 if test -n "$soname_spec"; then
2836 eval soname=\"$soname_spec\"
2840 test -z "$dlname" && dlname=$soname
2842 lib="$output_objdir/$realname"
2845 linknames="$linknames $link"
2848 # Ensure that we have .o objects for linkers which dislike .lo
2849 # (e.g. aix) in case we are running --disable-static
2850 for obj in $libobjs; do
2851 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2852 if test "X$xdir" = "X$obj"; then
2857 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2858 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2859 if test ! -f $xdir/$oldobj; then
2860 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2861 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2865 # Use standard objects if they are pic
2866 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2868 # Prepare the list of exported symbols
2869 if test -z "$export_symbols"; then
2870 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2871 $show "generating symbol list for \`$libname.la'"
2872 export_symbols="$output_objdir/$libname.exp"
2873 $run $rm $export_symbols
2874 eval cmds=\"$export_symbols_cmds\"
2875 save_ifs="$IFS"; IFS='~'
2876 for cmd in $cmds; do
2879 $run eval "$cmd" || exit $?
2882 if test -n "$export_symbols_regex"; then
2883 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2884 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2885 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2886 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2891 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2892 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2895 if test -n "$convenience"; then
2896 if test -n "$whole_archive_flag_spec"; then
2897 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2899 gentop="$output_objdir/${outputname}x"
2900 $show "${rm}r $gentop"
2901 $run ${rm}r "$gentop"
2902 $show "mkdir $gentop"
2903 $run mkdir "$gentop"
2905 if test $status -ne 0 && test ! -d "$gentop"; then
2908 generated="$generated $gentop"
2910 for xlib in $convenience; do
2911 # Extract the objects.
2913 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2914 *) xabs=`pwd`"/$xlib" ;;
2916 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2917 xdir="$gentop/$xlib"
2919 $show "${rm}r $xdir"
2924 if test $status -ne 0 && test ! -d "$xdir"; then
2927 $show "(cd $xdir && $AR x $xabs)"
2928 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2930 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2935 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2936 eval flag=\"$thread_safe_flag_spec\"
2937 linker_flags="$linker_flags $flag"
2940 # Make a backup of the uninstalled library when relinking
2941 if test "$mode" = relink; then
2942 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2945 # Do each of the archive commands.
2946 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2947 eval cmds=\"$archive_expsym_cmds\"
2949 save_deplibs="$deplibs"
2950 for conv in $convenience; do
2952 for test_deplib in $deplibs; do
2953 if test "$test_deplib" != "$conv"; then
2954 tmp_deplibs="$tmp_deplibs $test_deplib"
2957 deplibs="$tmp_deplibs"
2959 eval cmds=\"$archive_cmds\"
2960 deplibs="$save_deplibs"
2962 save_ifs="$IFS"; IFS='~'
2963 for cmd in $cmds; do
2966 $run eval "$cmd" || exit $?
2970 # Restore the uninstalled library and exit
2971 if test "$mode" = relink; then
2972 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2976 # Create links to the real library.
2977 for linkname in $linknames; do
2978 if test "$realname" != "$linkname"; then
2979 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2980 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2984 # If -module or -export-dynamic was specified, set the dlname.
2985 if test "$module" = yes || test "$export_dynamic" = yes; then
2986 # On all known operating systems, these are identical.
2993 if test -n "$deplibs"; then
2994 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2997 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2998 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3001 if test -n "$rpath"; then
3002 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3005 if test -n "$xrpath"; then
3006 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3009 if test -n "$vinfo"; then
3010 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3013 if test -n "$release"; then
3014 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3019 if test -n "$objs$old_deplibs"; then
3020 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3024 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3032 # Delete the old objects.
3033 $run $rm $obj $libobj
3035 # Objects from convenience libraries. This assumes
3036 # single-version convenience libraries. Whenever we create
3037 # different ones for PIC/non-PIC, this we'll have to duplicate
3041 # reload_cmds runs $LD directly, so let us get rid of
3042 # -Wl from whole_archive_flag_spec
3045 if test -n "$convenience"; then
3046 if test -n "$whole_archive_flag_spec"; then
3047 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3049 gentop="$output_objdir/${obj}x"
3050 $show "${rm}r $gentop"
3051 $run ${rm}r "$gentop"
3052 $show "mkdir $gentop"
3053 $run mkdir "$gentop"
3055 if test $status -ne 0 && test ! -d "$gentop"; then
3058 generated="$generated $gentop"
3060 for xlib in $convenience; do
3061 # Extract the objects.
3063 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3064 *) xabs=`pwd`"/$xlib" ;;
3066 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3067 xdir="$gentop/$xlib"
3069 $show "${rm}r $xdir"
3074 if test $status -ne 0 && test ! -d "$xdir"; then
3077 $show "(cd $xdir && $AR x $xabs)"
3078 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3080 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3085 # Create the old-style object.
3086 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
3089 eval cmds=\"$reload_cmds\"
3090 save_ifs="$IFS"; IFS='~'
3091 for cmd in $cmds; do
3094 $run eval "$cmd" || exit $?
3098 # Exit if we aren't doing a library object file.
3099 if test -z "$libobj"; then
3100 if test -n "$gentop"; then
3101 $show "${rm}r $gentop"
3108 if test "$build_libtool_libs" != yes; then
3109 if test -n "$gentop"; then
3110 $show "${rm}r $gentop"
3114 # Create an invalid libtool object if no PIC, so that we don't
3115 # accidentally link it into a program.
3116 $show "echo timestamp > $libobj"
3117 $run eval "echo timestamp > $libobj" || exit $?
3121 if test -n "$pic_flag" || test "$pic_mode" != default; then
3122 # Only do commands if we really have different PIC objects.
3123 reload_objs="$libobjs $reload_conv_objs"
3125 eval cmds=\"$reload_cmds\"
3126 save_ifs="$IFS"; IFS='~'
3127 for cmd in $cmds; do
3130 $run eval "$cmd" || exit $?
3134 # Just create a symlink.
3137 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3138 if test "X$xdir" = "X$libobj"; then
3143 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3144 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3145 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3146 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3149 if test -n "$gentop"; then
3150 $show "${rm}r $gentop"
3159 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3161 if test -n "$vinfo"; then
3162 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3165 if test -n "$release"; then
3166 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3169 if test "$preload" = yes; then
3170 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3171 test "$dlopen_self_static" = unknown; then
3172 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3177 *-*-rhapsody* | *-*-darwin1.[012])
3178 # On Rhapsody replace the C library is the System framework
3179 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3180 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3183 # Don't allow lazy linking, it breaks C++ global constructors
3184 compile_command="$compile_command ${wl}-bind_at_load"
3185 finalize_command="$finalize_command ${wl}-bind_at_load"
3191 compile_command="$compile_command $compile_deplibs"
3192 finalize_command="$finalize_command $finalize_deplibs"
3194 if test -n "$rpath$xrpath"; then
3195 # If the user specified any rpath flags, then add them.
3196 for libdir in $rpath $xrpath; do
3197 # This is the magic to use -rpath.
3198 case "$finalize_rpath " in
3200 *) finalize_rpath="$finalize_rpath $libdir" ;;
3205 # Now hardcode the library paths
3208 for libdir in $compile_rpath $finalize_rpath; do
3209 if test -n "$hardcode_libdir_flag_spec"; then
3210 if test -n "$hardcode_libdir_separator"; then
3211 if test -z "$hardcode_libdirs"; then
3212 hardcode_libdirs="$libdir"
3214 # Just accumulate the unique libdirs.
3215 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3216 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3219 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3224 eval flag=\"$hardcode_libdir_flag_spec\"
3225 rpath="$rpath $flag"
3227 elif test -n "$runpath_var"; then
3228 case "$perm_rpath " in
3230 *) perm_rpath="$perm_rpath $libdir" ;;
3234 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3235 case :$dllsearchpath: in
3237 *) dllsearchpath="$dllsearchpath:$libdir";;
3242 # Substitute the hardcoded libdirs into the rpath.
3243 if test -n "$hardcode_libdir_separator" &&
3244 test -n "$hardcode_libdirs"; then
3245 libdir="$hardcode_libdirs"
3246 eval rpath=\" $hardcode_libdir_flag_spec\"
3248 compile_rpath="$rpath"
3252 for libdir in $finalize_rpath; do
3253 if test -n "$hardcode_libdir_flag_spec"; then
3254 if test -n "$hardcode_libdir_separator"; then
3255 if test -z "$hardcode_libdirs"; then
3256 hardcode_libdirs="$libdir"
3258 # Just accumulate the unique libdirs.
3259 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3260 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3263 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3268 eval flag=\"$hardcode_libdir_flag_spec\"
3269 rpath="$rpath $flag"
3271 elif test -n "$runpath_var"; then
3272 case "$finalize_perm_rpath " in
3274 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3278 # Substitute the hardcoded libdirs into the rpath.
3279 if test -n "$hardcode_libdir_separator" &&
3280 test -n "$hardcode_libdirs"; then
3281 libdir="$hardcode_libdirs"
3282 eval rpath=\" $hardcode_libdir_flag_spec\"
3284 finalize_rpath="$rpath"
3286 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3287 # Transform all the library objects into standard objects.
3288 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3289 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3293 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3294 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3295 dlsyms="${outputname}S.c"
3297 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3301 if test -n "$dlsyms"; then
3305 # Discover the nlist of each of the dlfiles.
3306 nlist="$output_objdir/${outputname}.nm"
3308 $show "$rm $nlist ${nlist}S ${nlist}T"
3309 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3311 # Parse the name list into a source file.
3312 $show "creating $output_objdir/$dlsyms"
3314 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3315 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3316 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3322 /* Prevent the only kind of declaration conflicts we can make. */
3323 #define lt_preloaded_symbols some_other_symbol
3325 /* External symbol declarations for the compiler. */\
3328 if test "$dlself" = yes; then
3329 $show "generating symbol list for \`$output'"
3331 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3333 # Add our own program objects to the symbol list.
3334 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3335 for arg in $progfiles; do
3336 $show "extracting global C symbols from \`$arg'"
3337 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3340 if test -n "$exclude_expsyms"; then
3341 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3342 $run eval '$mv "$nlist"T "$nlist"'
3345 if test -n "$export_symbols_regex"; then
3346 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3347 $run eval '$mv "$nlist"T "$nlist"'
3350 # Prepare the list of exported symbols
3351 if test -z "$export_symbols"; then
3352 export_symbols="$output_objdir/$output.exp"
3353 $run $rm $export_symbols
3354 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3356 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3357 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3358 $run eval 'mv "$nlist"T "$nlist"'
3362 for arg in $dlprefiles; do
3363 $show "extracting global C symbols from \`$arg'"
3364 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3365 $run eval 'echo ": $name " >> "$nlist"'
3366 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3369 if test -z "$run"; then
3370 # Make sure we have at least an empty file.
3371 test -f "$nlist" || : > "$nlist"
3373 if test -n "$exclude_expsyms"; then
3374 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3375 $mv "$nlist"T "$nlist"
3378 # Try sorting and uniquifying the output.
3379 if grep -v "^: " < "$nlist" |
3380 if sort -k 3 </dev/null >/dev/null 2>&1; then
3385 uniq > "$nlist"S; then
3388 grep -v "^: " < "$nlist" > "$nlist"S
3391 if test -f "$nlist"S; then
3392 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3394 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3397 $echo >> "$output_objdir/$dlsyms" "\
3399 #undef lt_preloaded_symbols
3401 #if defined (__STDC__) && __STDC__
3402 # define lt_ptr void *
3404 # define lt_ptr char *
3408 /* The mapping between symbol names and symbols. */
3413 lt_preloaded_symbols[] =
3417 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3419 $echo >> "$output_objdir/$dlsyms" "\
3423 /* This works around a problem in FreeBSD linker */
3424 #ifdef FREEBSD_WORKAROUND
3425 static const void *lt_preloaded_setup() {
3426 return lt_preloaded_symbols;
3436 pic_flag_for_symtable=
3438 # compiling the symbol table file with pic_flag works around
3439 # a FreeBSD bug that causes programs to crash when -lm is
3440 # linked before any other PIC object. But we must not use
3441 # pic_flag when linking with -static. The problem exists in
3442 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3443 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3444 case "$compile_command " in
3446 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3449 case "$compile_command " in
3451 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3455 # Now compile the dynamic symbol file.
3456 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3457 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3459 # Clean up the generated files.
3460 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3461 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3463 # Transform the symbol file into the correct name.
3464 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3465 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3468 # FreeBSD doesn't need this...
3471 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3476 # We keep going just in case the user didn't refer to
3477 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3478 # really was required.
3480 # Nullify the symbol file.
3481 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3482 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3485 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3486 # Replace the output file specification.
3487 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3488 link_command="$compile_command$compile_rpath"
3490 # We have no uninstalled library dependencies, so finalize right now.
3491 $show "$link_command"
3492 $run eval "$link_command"
3495 # Delete the generated files.
3496 if test -n "$dlsyms"; then
3497 $show "$rm $output_objdir/${outputname}S.${objext}"
3498 $run $rm "$output_objdir/${outputname}S.${objext}"
3504 if test -n "$shlibpath_var"; then
3505 # We should set the shlibpath_var
3507 for dir in $temp_rpath; do
3509 [\\/]* | [A-Za-z]:[\\/]*)
3514 # Relative path: add a thisdir entry.
3515 rpath="$rpath\$thisdir/$dir:"
3522 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3523 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3525 if test -n "$finalize_shlibpath"; then
3526 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3531 if test -n "$runpath_var"; then
3532 if test -n "$perm_rpath"; then
3533 # We should set the runpath_var.
3535 for dir in $perm_rpath; do
3538 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3540 if test -n "$finalize_perm_rpath"; then
3541 # We should set the runpath_var.
3543 for dir in $finalize_perm_rpath; do
3546 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3550 if test "$no_install" = yes; then
3551 # We don't need to create a wrapper script.
3552 link_command="$compile_var$compile_command$compile_rpath"
3553 # Replace the output file specification.
3554 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3555 # Delete the old output file.
3557 # Link the executable and exit
3558 $show "$link_command"
3559 $run eval "$link_command" || exit $?
3563 if test "$hardcode_action" = relink; then
3564 # Fast installation is not supported
3565 link_command="$compile_var$compile_command$compile_rpath"
3566 relink_command="$finalize_var$finalize_command$finalize_rpath"
3568 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3569 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3571 if test "$fast_install" != no; then
3572 link_command="$finalize_var$compile_command$finalize_rpath"
3573 if test "$fast_install" = yes; then
3574 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3576 # fast_install is set to needless
3580 link_command="$compile_var$compile_command$compile_rpath"
3581 relink_command="$finalize_var$finalize_command$finalize_rpath"
3585 # Replace the output file specification.
3586 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3588 # Delete the old output files.
3589 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3591 $show "$link_command"
3592 $run eval "$link_command" || exit $?
3594 # Now create the wrapper script.
3595 $show "creating $output"
3597 # Quote the relink command for shipping.
3598 if test -n "$relink_command"; then
3599 # Preserve any variables that may affect compiler behavior
3600 for var in $variables_saved_for_relink; do
3601 if eval test -z \"\${$var+set}\"; then
3602 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3603 elif eval var_value=\$$var; test -z "$var_value"; then
3604 relink_command="$var=; export $var; $relink_command"
3606 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3607 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3610 relink_command="(cd `pwd`; $relink_command)"
3611 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3614 # Quote $echo for shipping.
3615 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3617 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3618 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3620 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3622 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3625 # Only actually do things if our run command is non-null.
3626 if test -z "$run"; then
3627 # win32 will think the script is a binary if it has
3628 # a .exe suffix, so we strip it off here.
3630 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3632 # test for cygwin because mv fails w/o .exe extensions
3634 *cygwin*) exeext=.exe ;;
3638 trap "$rm $output; exit 1" 1 2 15
3643 # $output - temporary wrapper script for $objdir/$outputname
3644 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3646 # The $output program cannot be directly executed until all the libtool
3647 # libraries that it depends on are installed.
3649 # This wrapper script should never be moved out of the build directory.
3650 # If it is, it will not operate correctly.
3652 # Sed substitution that helps us do robust quoting. It backslashifies
3653 # metacharacters that are still active within double-quoted strings.
3654 Xsed="${SED}"' -e 1s/^X//'
3655 sed_quote_subst='$sed_quote_subst'
3657 # The HP-UX ksh and POSIX shell print the target directory to stdout
3659 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3661 relink_command=\"$relink_command\"
3663 # This environment variable determines our operation mode.
3664 if test \"\$libtool_install_magic\" = \"$magic\"; then
3665 # install mode needs the following variable:
3666 notinst_deplibs='$notinst_deplibs'
3668 # When we are sourced in execute mode, \$file and \$echo are already set.
3669 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3672 # Make sure echo works.
3673 if test \"X\$1\" = X--no-reexec; then
3674 # Discard the --no-reexec flag, and continue.
3676 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3677 # Yippee, \$echo works!
3680 # Restart under the correct shell, and then maybe \$echo will work.
3681 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3687 # Find the directory that this script lives in.
3688 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3689 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3691 # Follow symbolic links until we get to the real thisdir.
3692 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3693 while test -n \"\$file\"; do
3694 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3696 # If there was a directory component, then change thisdir.
3697 if test \"x\$destdir\" != \"x\$file\"; then
3698 case \"\$destdir\" in
3699 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3700 *) thisdir=\"\$thisdir/\$destdir\" ;;
3704 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3705 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3708 # Try to get the absolute directory name.
3709 absdir=\`cd \"\$thisdir\" && pwd\`
3710 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3713 if test "$fast_install" = yes; then
3715 program=lt-'$outputname'$exeext
3716 progdir=\"\$thisdir/$objdir\"
3718 if test ! -f \"\$progdir/\$program\" || \\
3719 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3720 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3722 file=\"\$\$-\$program\"
3724 if test ! -d \"\$progdir\"; then
3725 $mkdir \"\$progdir\"
3727 $rm \"\$progdir/\$file\"
3732 # relink executable if necessary
3733 if test -n \"\$relink_command\"; then
3734 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3736 $echo \"\$relink_command_output\" >&2
3737 $rm \"\$progdir/\$file\"
3742 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3743 { $rm \"\$progdir/\$program\";
3744 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3745 $rm \"\$progdir/\$file\"
3749 program='$outputname'
3750 progdir=\"\$thisdir/$objdir\"
3756 if test -f \"\$progdir/\$program\"; then"
3758 # Export our shlibpath_var if we have one.
3759 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3761 # Add our own library path to $shlibpath_var
3762 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3764 # Some systems cannot cope with colon-terminated $shlibpath_var
3765 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3766 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3768 export $shlibpath_var
3772 # fixup the dll searchpath if we need to.
3773 if test -n "$dllsearchpath"; then
3775 # Add the dll search path components to the executable PATH
3776 PATH=$dllsearchpath:\$PATH
3781 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3782 # Run the actual program with our arguments.
3785 # win32 systems need to use the prog path for dll
3787 *-*-cygwin* | *-*-pw32*)
3789 exec \$progdir/\$program \${1+\"\$@\"}
3793 # Backslashes separate directories on plain windows
3794 *-*-mingw | *-*-os2*)
3796 exec \$progdir\\\\\$program \${1+\"\$@\"}
3802 # Export the path to the program.
3803 PATH=\"\$progdir:\$PATH\"
3806 exec \$program \${1+\"\$@\"}
3811 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3815 # The program doesn't exist.
3816 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3817 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3818 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3829 # See if we need to build an old-fashioned archive.
3830 for oldlib in $oldlibs; do
3832 if test "$build_libtool_libs" = convenience; then
3833 oldobjs="$libobjs_save"
3834 addlibs="$convenience"
3835 build_libtool_libs=no
3837 if test "$build_libtool_libs" = module; then
3838 oldobjs="$libobjs_save"
3839 build_libtool_libs=no
3841 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3843 addlibs="$old_convenience"
3846 if test -n "$addlibs"; then
3847 gentop="$output_objdir/${outputname}x"
3848 $show "${rm}r $gentop"
3849 $run ${rm}r "$gentop"
3850 $show "mkdir $gentop"
3851 $run mkdir "$gentop"
3853 if test $status -ne 0 && test ! -d "$gentop"; then
3856 generated="$generated $gentop"
3858 # Add in members from convenience archives.
3859 for xlib in $addlibs; do
3860 # Extract the objects.
3862 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3863 *) xabs=`pwd`"/$xlib" ;;
3865 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3866 xdir="$gentop/$xlib"
3868 $show "${rm}r $xdir"
3873 if test $status -ne 0 && test ! -d "$xdir"; then
3876 $show "(cd $xdir && $AR x $xabs)"
3877 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3879 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3883 # Do each command in the archive commands.
3884 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3885 eval cmds=\"$old_archive_from_new_cmds\"
3887 # Ensure that we have .o objects in place in case we decided
3888 # not to build a shared library, and have fallen back to building
3889 # static libs even though --disable-static was passed!
3890 for oldobj in $oldobjs; do
3891 if test ! -f $oldobj; then
3892 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3893 if test "X$xdir" = "X$oldobj"; then
3898 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3899 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3900 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3901 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3905 eval cmds=\"$old_archive_cmds\"
3907 save_ifs="$IFS"; IFS='~'
3908 for cmd in $cmds; do
3911 $run eval "$cmd" || exit $?
3916 if test -n "$generated"; then
3917 $show "${rm}r$generated"
3918 $run ${rm}r$generated
3921 # Now create the libtool archive.
3925 test "$build_old_libs" = yes && old_library="$libname.$libext"
3926 $show "creating $output"
3928 # Preserve any variables that may affect compiler behavior
3929 for var in $variables_saved_for_relink; do
3930 if eval test -z \"\${$var+set}\"; then
3931 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3932 elif eval var_value=\$$var; test -z "$var_value"; then
3933 relink_command="$var=; export $var; $relink_command"
3935 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3936 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3939 # Quote the link command for shipping.
3940 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3941 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3943 # Only create the output if not a dry run.
3944 if test -z "$run"; then
3945 for installed in no yes; do
3946 if test "$installed" = yes; then
3947 if test -z "$install_libdir"; then
3950 output="$output_objdir/$outputname"i
3951 # Replace all uninstalled libtool libraries with the installed ones
3953 for deplib in $dependency_libs; do
3956 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3957 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3958 if test -z "$libdir"; then
3959 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3962 newdependency_libs="$newdependency_libs $libdir/$name"
3964 *) newdependency_libs="$newdependency_libs $deplib" ;;
3967 dependency_libs="$newdependency_libs"
3969 for lib in $dlfiles; do
3970 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3971 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3972 if test -z "$libdir"; then
3973 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3976 newdlfiles="$newdlfiles $libdir/$name"
3978 dlfiles="$newdlfiles"
3980 for lib in $dlprefiles; do
3981 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3982 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3983 if test -z "$libdir"; then
3984 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3987 newdlprefiles="$newdlprefiles $libdir/$name"
3989 dlprefiles="$newdlprefiles"
3992 # place dlname in correct position for cygwin
3994 case $host,$output,$installed,$module,$dlname in
3995 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3998 # $outputname - a libtool library file
3999 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4001 # Please DO NOT delete this file!
4002 # It is necessary for linking the library.
4004 # The name that we can dlopen(3).
4007 # Names of this library.
4008 library_names='$library_names'
4010 # The name of the static archive.
4011 old_library='$old_library'
4013 # Libraries that this one depends upon.
4014 dependency_libs='$dependency_libs'
4016 # Version information for $libname.
4021 # Is this an already installed library?
4022 installed=$installed
4024 # Files to dlopen/dlpreopen
4026 dlpreopen='$dlprefiles'
4028 # Directory that this library needs to be installed in:
4029 libdir='$install_libdir'"
4030 if test "$installed" = no && test $need_relink = yes; then
4032 relink_command=\"$relink_command\""
4037 # Do a symbolic link so that the libtool archive can be found in
4038 # LD_LIBRARY_PATH before the program is installed.
4039 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4040 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4046 # libtool install mode
4048 modename="$modename: install"
4050 # There may be an optional sh(1) argument at the beginning of
4051 # install_prog (especially on Windows NT).
4052 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4053 # Allow the use of GNU shtool's install command.
4054 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4055 # Aesthetically quote it.
4056 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4058 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4062 install_prog="$arg "
4070 # The real first argument should be the name of the installation program.
4071 # Aesthetically quote it.
4072 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4074 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4078 install_prog="$install_prog$arg"
4080 # We need to accept at least all the BSD install flags.
4090 if test -n "$dest"; then
4091 files="$files $dest"
4109 # If the previous option needed an argument, then skip it.
4110 if test -n "$prev"; then
4119 # Aesthetically quote the argument.
4120 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4122 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4126 install_prog="$install_prog $arg"
4129 if test -z "$install_prog"; then
4130 $echo "$modename: you must specify an install program" 1>&2
4135 if test -n "$prev"; then
4136 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4141 if test -z "$files"; then
4142 if test -z "$dest"; then
4143 $echo "$modename: no file or destination specified" 1>&2
4145 $echo "$modename: you must specify a destination" 1>&2
4151 # Strip any trailing slash from the destination.
4152 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4154 # Check to see that the destination is a directory.
4155 test -d "$dest" && isdir=yes
4156 if test "$isdir" = yes; then
4160 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4161 test "X$destdir" = "X$dest" && destdir=.
4162 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4164 # Not a directory, so check to see that there is only one file specified.
4166 if test $# -gt 2; then
4167 $echo "$modename: \`$dest' is not a directory" 1>&2
4173 [\\/]* | [A-Za-z]:[\\/]*) ;;
4175 for file in $files; do
4179 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4188 # This variable tells wrapper scripts just to set variables rather
4189 # than running their programs.
4190 libtool_install_magic="$magic"
4195 for file in $files; do
4197 # Do each installation.
4200 # Do the static libraries later.
4201 staticlibs="$staticlibs $file"
4205 # Check to see that this really is a libtool archive.
4206 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4208 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4216 # If there is no directory component, then add one.
4218 */* | *\\*) . $file ;;
4222 # Add the libdir to current_libdirs if it is the destination.
4223 if test "X$destdir" = "X$libdir"; then
4224 case "$current_libdirs " in
4226 *) current_libdirs="$current_libdirs $libdir" ;;
4229 # Note the libdir as a future libdir.
4230 case "$future_libdirs " in
4232 *) future_libdirs="$future_libdirs $libdir" ;;
4236 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4237 test "X$dir" = "X$file/" && dir=
4240 if test -n "$relink_command"; then
4241 $echo "$modename: warning: relinking \`$file'" 1>&2
4242 $show "$relink_command"
4243 if $run eval "$relink_command"; then :
4245 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4250 # See the names of the shared library.
4251 set dummy $library_names
4252 if test -n "$2"; then
4258 test -n "$relink_command" && srcname="$realname"T
4260 # Install the shared library and build the symlinks.
4261 $show "$install_prog $dir/$srcname $destdir/$realname"
4262 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4263 if test -n "$stripme" && test -n "$striplib"; then
4264 $show "$striplib $destdir/$realname"
4265 $run eval "$striplib $destdir/$realname" || exit $?
4268 if test $# -gt 0; then
4269 # Delete the old symlinks, and create new ones.
4272 if test "$linkname" != "$realname"; then
4273 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4274 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4279 # Do each command in the postinstall commands.
4280 lib="$destdir/$realname"
4281 eval cmds=\"$postinstall_cmds\"
4282 save_ifs="$IFS"; IFS='~'
4283 for cmd in $cmds; do
4286 $run eval "$cmd" || exit $?
4291 # Install the pseudo-library for information purposes.
4294 # Do not install the useless pseudo-library
4297 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4298 instname="$dir/$name"i
4299 $show "$install_prog $instname $destdir/$name"
4300 $run eval "$install_prog $instname $destdir/$name" || exit $?
4304 # Maybe install the static library, too.
4305 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4309 # Install (i.e. copy) a libtool object.
4311 # Figure out destination file name, if it wasn't already specified.
4312 if test -n "$destname"; then
4313 destfile="$destdir/$destname"
4315 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4316 destfile="$destdir/$destfile"
4319 # Deduce the name of the destination old-style object file.
4322 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4325 staticdest="$destfile"
4329 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4335 # Install the libtool object if requested.
4336 if test -n "$destfile"; then
4337 $show "$install_prog $file $destfile"
4338 $run eval "$install_prog $file $destfile" || exit $?
4341 # Install the old object if enabled.
4342 if test "$build_old_libs" = yes; then
4343 # Deduce the name of the old-style object file.
4344 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4346 $show "$install_prog $staticobj $staticdest"
4347 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4353 # Figure out destination file name, if it wasn't already specified.
4354 if test -n "$destname"; then
4355 destfile="$destdir/$destname"
4357 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4358 destfile="$destdir/$destfile"
4361 # Do a test to see if this is really a libtool program.
4364 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4370 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4374 # If there is no directory component, then add one.
4376 */* | *\\*) . $wrapper ;;
4380 # Check the variables that should have been set.
4381 if test -z "$notinst_deplibs"; then
4382 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4387 for lib in $notinst_deplibs; do
4388 # Check to see that each library is installed.
4390 if test -f "$lib"; then
4391 # If there is no directory component, then add one.
4393 */* | *\\*) . $lib ;;
4397 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4398 if test -n "$libdir" && test ! -f "$libfile"; then
4399 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4405 # If there is no directory component, then add one.
4407 */* | *\\*) . $wrapper ;;
4412 if test "$fast_install" = no && test -n "$relink_command"; then
4413 if test "$finalize" = yes && test -z "$run"; then
4415 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4416 tmpdir="$tmpdir/libtool-$$"
4417 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4419 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4422 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4423 outputname="$tmpdir/$file"
4424 # Replace the output file specification.
4425 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4427 $show "$relink_command"
4428 if $run eval "$relink_command"; then :
4430 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4436 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4439 # Install the binary that we compiled earlier.
4440 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4444 # remove .exe since cygwin /usr/bin/install will append another
4446 case $install_prog,$host in
4447 /usr/bin/install*,*cygwin*)
4448 case $file:$destfile in
4453 destfile=$destfile.exe
4456 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4461 $show "$install_prog$stripme $file $destfile"
4462 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4463 test -n "$outputname" && ${rm}r "$tmpdir"
4468 for file in $staticlibs; do
4469 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4471 # Set up the ranlib parameters.
4472 oldlib="$destdir/$name"
4474 $show "$install_prog $file $oldlib"
4475 $run eval "$install_prog \$file \$oldlib" || exit $?
4477 if test -n "$stripme" && test -n "$striplib"; then
4478 $show "$old_striplib $oldlib"
4479 $run eval "$old_striplib $oldlib" || exit $?
4482 # Do each command in the postinstall commands.
4483 eval cmds=\"$old_postinstall_cmds\"
4484 save_ifs="$IFS"; IFS='~'
4485 for cmd in $cmds; do
4488 $run eval "$cmd" || exit $?
4493 if test -n "$future_libdirs"; then
4494 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4497 if test -n "$current_libdirs"; then
4498 # Maybe just do a dry run.
4499 test -n "$run" && current_libdirs=" -n$current_libdirs"
4500 exec_cmd='$SHELL $0 --finish$current_libdirs'
4506 # libtool finish mode
4508 modename="$modename: finish"
4512 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4515 libdirs="$libdirs $dir"
4518 for libdir in $libdirs; do
4519 if test -n "$finish_cmds"; then
4520 # Do each command in the finish commands.
4521 eval cmds=\"$finish_cmds\"
4522 save_ifs="$IFS"; IFS='~'
4523 for cmd in $cmds; do
4526 $run eval "$cmd" || admincmds="$admincmds
4531 if test -n "$finish_eval"; then
4532 # Do the single finish_eval.
4533 eval cmds=\"$finish_eval\"
4534 $run eval "$cmds" || admincmds="$admincmds
4540 # Exit here if they wanted silent mode.
4541 test "$show" = ":" && exit 0
4543 echo "----------------------------------------------------------------------"
4544 echo "Libraries have been installed in:"
4545 for libdir in $libdirs; do
4549 echo "If you ever happen to want to link against installed libraries"
4550 echo "in a given directory, LIBDIR, you must either use libtool, and"
4551 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4552 echo "flag during linking and do at least one of the following:"
4553 if test -n "$shlibpath_var"; then
4554 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4555 echo " during execution"
4557 if test -n "$runpath_var"; then
4558 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4559 echo " during linking"
4561 if test -n "$hardcode_libdir_flag_spec"; then
4563 eval flag=\"$hardcode_libdir_flag_spec\"
4565 echo " - use the \`$flag' linker flag"
4567 if test -n "$admincmds"; then
4568 echo " - have your system administrator run these commands:$admincmds"
4570 if test -f /etc/ld.so.conf; then
4571 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4574 echo "See any operating system documentation about shared libraries for"
4575 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4576 echo "----------------------------------------------------------------------"
4580 # libtool execute mode
4582 modename="$modename: execute"
4584 # The first argument is the command name.
4586 if test -z "$cmd"; then
4587 $echo "$modename: you must specify a COMMAND" 1>&2
4592 # Handle -dlopen flags immediately.
4593 for file in $execute_dlfiles; do
4594 if test ! -f "$file"; then
4595 $echo "$modename: \`$file' is not a file" 1>&2
4603 # Check to see that this really is a libtool archive.
4604 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4606 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4611 # Read the libtool library.
4615 # If there is no directory component, then add one.
4617 */* | *\\*) . $file ;;
4621 # Skip this library if it cannot be dlopened.
4622 if test -z "$dlname"; then
4623 # Warn if it was a shared library.
4624 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4628 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4629 test "X$dir" = "X$file" && dir=.
4631 if test -f "$dir/$objdir/$dlname"; then
4634 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4640 # Just add the directory containing the .lo file.
4641 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4642 test "X$dir" = "X$file" && dir=.
4646 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4651 # Get the absolute pathname.
4652 absdir=`cd "$dir" && pwd`
4653 test -n "$absdir" && dir="$absdir"
4655 # Now add the directory to shlibpath_var.
4656 if eval "test -z \"\$$shlibpath_var\""; then
4657 eval "$shlibpath_var=\"\$dir\""
4659 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4663 # This variable tells wrapper scripts just to set shlibpath_var
4664 # rather than running their programs.
4665 libtool_execute_magic="$magic"
4667 # Check if any of the arguments is a wrapper script.
4674 # Do a test to see if this is really a libtool program.
4675 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4676 # If there is no directory component, then add one.
4678 */* | *\\*) . $file ;;
4682 # Transform arg to wrapped name.
4683 file="$progdir/$program"
4687 # Quote arguments (to preserve shell metacharacters).
4688 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4689 args="$args \"$file\""
4692 if test -z "$run"; then
4693 if test -n "$shlibpath_var"; then
4694 # Export the shlibpath_var.
4695 eval "export $shlibpath_var"
4698 # Restore saved enviroment variables
4699 if test "${save_LC_ALL+set}" = set; then
4700 LC_ALL="$save_LC_ALL"; export LC_ALL
4702 if test "${save_LANG+set}" = set; then
4703 LANG="$save_LANG"; export LANG
4706 # Now prepare to actually exec the command.
4707 exec_cmd="\$cmd$args"
4709 # Display what would be done.
4710 if test -n "$shlibpath_var"; then
4711 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4712 $echo "export $shlibpath_var"
4719 # libtool clean and uninstall mode
4721 modename="$modename: $mode"
4727 # This variable tells wrapper scripts just to set variables rather
4728 # than running their programs.
4729 libtool_install_magic="$magic"
4734 -f) rm="$rm $arg"; rmforce=yes ;;
4735 -*) rm="$rm $arg" ;;
4736 *) files="$files $arg" ;;
4740 if test -z "$rm"; then
4741 $echo "$modename: you must specify an RM program" 1>&2
4748 for file in $files; do
4749 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4750 if test "X$dir" = "X$file"; then
4754 objdir="$dir/$objdir"
4756 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4757 test $mode = uninstall && objdir="$dir"
4759 # Remember objdir for removal later, being careful to avoid duplicates
4760 if test $mode = clean; then
4763 *) rmdirs="$rmdirs $objdir" ;;
4767 # Don't error if the file doesn't exist and rm -f was used.
4768 if (test -L "$file") >/dev/null 2>&1 \
4769 || (test -h "$file") >/dev/null 2>&1 \
4770 || test -f "$file"; then
4772 elif test -d "$file"; then
4775 elif test "$rmforce" = yes; then
4783 # Possibly a libtool archive, so verify it.
4784 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4787 # Delete the libtool libraries and symlinks.
4788 for n in $library_names; do
4789 rmfiles="$rmfiles $objdir/$n"
4791 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4792 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4794 if test $mode = uninstall; then
4795 if test -n "$library_names"; then
4796 # Do each command in the postuninstall commands.
4797 eval cmds=\"$postuninstall_cmds\"
4798 save_ifs="$IFS"; IFS='~'
4799 for cmd in $cmds; do
4803 if test $? != 0 && test "$rmforce" != yes; then
4810 if test -n "$old_library"; then
4811 # Do each command in the old_postuninstall commands.
4812 eval cmds=\"$old_postuninstall_cmds\"
4813 save_ifs="$IFS"; IFS='~'
4814 for cmd in $cmds; do
4818 if test $? != 0 && test "$rmforce" != yes; then
4824 # FIXME: should reinstall the best remaining shared library.
4830 if test "$build_old_libs" = yes; then
4831 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4832 rmfiles="$rmfiles $dir/$oldobj"
4837 # Do a test to see if this is a libtool program.
4838 if test $mode = clean &&
4839 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4843 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4844 if test "$fast_install" = yes && test -n "$relink_command"; then
4845 rmfiles="$rmfiles $objdir/lt-$name"
4850 $show "$rm $rmfiles"
4851 $run $rm $rmfiles || exit_status=1
4854 # Try to remove the ${objdir}s in the directories where we deleted files
4855 for dir in $rmdirs; do
4856 if test -d "$dir"; then
4858 $run rmdir $dir >/dev/null 2>&1
4866 $echo "$modename: you must specify a MODE" 1>&2
4867 $echo "$generic_help" 1>&2
4872 if test -z "$exec_cmd"; then
4873 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4874 $echo "$generic_help" 1>&2
4877 fi # test -z "$show_help"
4879 if test -n "$exec_cmd"; then
4884 # We need to display help for each of the modes.
4887 "Usage: $modename [OPTION]... [MODE-ARG]...
4889 Provide generalized library-building support services.
4891 --config show all configuration variables
4892 --debug enable verbose shell tracing
4893 -n, --dry-run display commands without modifying any files
4894 --features display basic configuration information and exit
4895 --finish same as \`--mode=finish'
4896 --help display this help message and exit
4897 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4898 --quiet same as \`--silent'
4899 --silent don't print informational messages
4900 --version print version information
4902 MODE must be one of the following:
4904 clean remove files from the build directory
4905 compile compile a source file into a libtool object
4906 execute automatically set library path, then run a program
4907 finish complete the installation of libtool libraries
4908 install install libraries or executables
4909 link create a library or an executable
4910 uninstall remove libraries from an installed directory
4912 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4913 a more detailed description of MODE."
4919 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4921 Remove files from the build directory.
4923 RM is the name of the program to use to delete files associated with each FILE
4924 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4927 If FILE is a libtool library, object or program, all the files associated
4928 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4933 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4935 Compile a source file into a libtool library object.
4937 This mode accepts the following additional options:
4939 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4940 -prefer-pic try to building PIC objects only
4941 -prefer-non-pic try to building non-PIC objects only
4942 -static always build a \`.o' file suitable for static linking
4944 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4945 from the given SOURCEFILE.
4947 The output file name is determined by removing the directory component from
4948 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4949 library object suffix, \`.lo'."
4954 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4956 Automatically set library path, then run a program.
4958 This mode accepts the following additional options:
4960 -dlopen FILE add the directory containing FILE to the library path
4962 This mode sets the library path environment variable according to \`-dlopen'
4965 If any of the ARGS are libtool executable wrappers, then they are translated
4966 into their corresponding uninstalled binary, and any of their required library
4967 directories are added to the library path.
4969 Then, COMMAND is executed, with ARGS as arguments."
4974 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4976 Complete the installation of libtool libraries.
4978 Each LIBDIR is a directory that contains libtool libraries.
4980 The commands that this mode executes may require superuser privileges. Use
4981 the \`--dry-run' option if you just want to see what would be executed."
4986 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4988 Install executables or libraries.
4990 INSTALL-COMMAND is the installation command. The first component should be
4991 either the \`install' or \`cp' program.
4993 The rest of the components are interpreted as arguments to that command (only
4994 BSD-compatible install options are recognized)."
4999 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5001 Link object files or libraries together to form another library, or to
5002 create an executable program.
5004 LINK-COMMAND is a command using the C compiler that you would use to create
5005 a program from several object files.
5007 The following components of LINK-COMMAND are treated specially:
5009 -all-static do not do any dynamic linking at all
5010 -avoid-version do not add a version suffix if possible
5011 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5012 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5013 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5014 -export-symbols SYMFILE
5015 try to export only the symbols listed in SYMFILE
5016 -export-symbols-regex REGEX
5017 try to export only the symbols matching REGEX
5018 -LLIBDIR search LIBDIR for required installed libraries
5019 -lNAME OUTPUT-FILE requires the installed library libNAME
5020 -module build a library that can dlopened
5021 -no-fast-install disable the fast-install mode
5022 -no-install link a not-installable executable
5023 -no-undefined declare that a library does not refer to external symbols
5024 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5025 -release RELEASE specify package release information
5026 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5027 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5028 -static do not do any dynamic linking of libtool libraries
5029 -version-info CURRENT[:REVISION[:AGE]]
5030 specify library version info [each variable defaults to 0]
5032 All other options (arguments beginning with \`-') are ignored.
5034 Every other argument is treated as a filename. Files ending in \`.la' are
5035 treated as uninstalled libtool libraries, other files are standard or library
5038 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5039 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5040 required, except when creating a convenience library.
5042 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5043 using \`ar' and \`ranlib', or on Windows using \`lib'.
5045 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5046 is created, otherwise an executable program is created."
5051 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5053 Remove libraries from an installation directory.
5055 RM is the name of the program to use to delete files associated with each FILE
5056 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5059 If FILE is a libtool library, all the files associated with it are deleted.
5060 Otherwise, only FILE itself is deleted using RM."
5064 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5071 $echo "Try \`$modename --help' for more information about other modes."