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.111 2002/10/23 02:54:36)"
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* | g++* | 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`
779 export_symbols_regex=
786 prefer_static_libs=no
798 # We need to know -static, to get the right output filenames.
802 -all-static | -static)
803 if test "X$arg" = "X-all-static"; then
804 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
805 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
807 if test -n "$link_static_flag"; then
808 dlopen_self=$dlopen_self_static
811 if test -z "$pic_flag" && test -n "$link_static_flag"; then
812 dlopen_self=$dlopen_self_static
815 build_libtool_libs=no
817 prefer_static_libs=yes
823 # See if our shared archives depend on static archives.
824 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
826 # Go through the arguments, transforming them on the way.
827 while test $# -gt 0; do
831 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
832 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
836 libtool_args="$libtool_args $qarg"
838 # If the previous option needs an argument, assign it.
839 if test -n "$prev"; then
842 compile_command="$compile_command @OUTPUT@"
843 finalize_command="$finalize_command @OUTPUT@"
849 if test "$preload" = no; then
850 # Add the symbol object into the linking commands.
851 compile_command="$compile_command @SYMFILE@"
852 finalize_command="$finalize_command @SYMFILE@"
856 *.la | *.lo) ;; # We handle these cases below.
858 if test "$dlself" = no; then
866 if test "$prev" = dlprefiles; then
868 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
878 if test "$prev" = dlfiles; then
879 dlfiles="$dlfiles $arg"
881 dlprefiles="$dlprefiles $arg"
889 export_symbols="$arg"
890 if test ! -f "$arg"; then
891 $echo "$modename: symbol file \`$arg' does not exist"
898 export_symbols_regex="$arg"
903 inst_prefix_dir="$arg"
913 # We need an absolute path.
915 [\\/]* | [A-Za-z]:[\\/]*) ;;
917 $echo "$modename: only absolute run-paths are allowed" 1>&2
921 if test "$prev" = rpath; then
924 *) rpath="$rpath $arg" ;;
929 *) xrpath="$xrpath $arg" ;;
936 compiler_flags="$compiler_flags $qarg"
938 compile_command="$compile_command $qarg"
939 finalize_command="$finalize_command $qarg"
943 linker_flags="$linker_flags $qarg"
944 compiler_flags="$compiler_flags $wl$qarg"
946 compile_command="$compile_command $wl$qarg"
947 finalize_command="$finalize_command $wl$qarg"
951 eval "$prev=\"\$arg\""
962 if test -n "$link_static_flag"; then
963 compile_command="$compile_command $link_static_flag"
964 finalize_command="$finalize_command $link_static_flag"
970 # FIXME: remove this flag sometime in the future.
971 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
995 -export-symbols | -export-symbols-regex)
996 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
997 $echo "$modename: more than one -exported-symbols argument is not allowed"
1000 if test "X$arg" = "X-export-symbols"; then
1013 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1014 # so, if we see these flags be careful not to treat them like -L
1016 case $with_gcc/$host in
1017 no/*-*-irix* | no/*-*-nonstopux*)
1018 compile_command="$compile_command $arg"
1019 finalize_command="$finalize_command $arg"
1026 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1027 # We need an absolute path.
1029 [\\/]* | [A-Za-z]:[\\/]*) ;;
1031 absdir=`cd "$dir" && pwd`
1032 if test -z "$absdir"; then
1033 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1042 deplibs="$deplibs -L$dir"
1043 lib_search_path="$lib_search_path $dir"
1047 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1048 case :$dllsearchpath: in
1050 *) dllsearchpath="$dllsearchpath:$dir";;
1058 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1060 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1061 # These systems don't actually have a C or math library (as such)
1064 *-*-mingw* | *-*-os2*)
1065 # These systems don't actually have a C library (as such)
1066 test "X$arg" = "X-lc" && continue
1068 *-*-openbsd* | *-*-freebsd*)
1069 # Do not include libc due to us having libc/libc_r.
1070 test "X$arg" = "X-lc" && continue
1073 elif test "X$arg" = "X-lc_r"; then
1075 *-*-openbsd* | *-*-freebsd*)
1076 # Do not include libc_r directly, use -pthread flag.
1081 deplibs="$deplibs $arg"
1097 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1098 # The PATH hackery in wrapper scripts is required on Windows
1099 # in order for the loader to find any dlls it needs.
1100 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1101 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1104 *) no_install=yes ;;
1132 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1133 # We need an absolute path.
1135 [\\/]* | [A-Za-z]:[\\/]*) ;;
1137 $echo "$modename: only absolute run-paths are allowed" 1>&2
1143 *) xrpath="$xrpath $dir" ;;
1149 # The effects of -static are defined in a previous loop.
1150 # We used to do the same as -all-static on platforms that
1151 # didn't have a PIC flag, but the assumption that the effects
1152 # would be equivalent was wrong. It would break on at least
1153 # Digital Unix and AIX.
1168 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1170 save_ifs="$IFS"; IFS=','
1171 for flag in $args; do
1174 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1179 compiler_flags="$compiler_flags $flag"
1182 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1186 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1188 save_ifs="$IFS"; IFS=','
1189 for flag in $args; do
1192 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1197 compiler_flags="$compiler_flags $wl$flag"
1198 linker_flags="$linker_flags $flag"
1201 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1214 # Some other compiler flag.
1216 # Unknown arguments in both finalize_command and compile_command need
1217 # to be aesthetically quoted because they are evaled later.
1218 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1220 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1227 # A library or standard object.
1228 if test "$prev" = dlfiles; then
1229 # This file was specified with -dlopen.
1230 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1231 dlfiles="$dlfiles $arg"
1235 # If libtool objects are unsupported, then we need to preload.
1240 if test "$prev" = dlprefiles; then
1241 # Preload the old-style object.
1242 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1246 *.lo) libobjs="$libobjs $arg" ;;
1247 *) objs="$objs $arg" ;;
1254 deplibs="$deplibs $arg"
1255 old_deplibs="$old_deplibs $arg"
1260 # A libtool-controlled library.
1262 if test "$prev" = dlfiles; then
1263 # This library was specified with -dlopen.
1264 dlfiles="$dlfiles $arg"
1266 elif test "$prev" = dlprefiles; then
1267 # The library was specified with -dlpreopen.
1268 dlprefiles="$dlprefiles $arg"
1271 deplibs="$deplibs $arg"
1276 # Some other compiler argument.
1278 # Unknown arguments in both finalize_command and compile_command need
1279 # to be aesthetically quoted because they are evaled later.
1280 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1282 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1289 # Now actually substitute the argument into the commands.
1290 if test -n "$arg"; then
1291 compile_command="$compile_command $arg"
1292 finalize_command="$finalize_command $arg"
1294 done # argument parsing loop
1296 if test -n "$prev"; then
1297 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1302 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1303 eval arg=\"$export_dynamic_flag_spec\"
1304 compile_command="$compile_command $arg"
1305 finalize_command="$finalize_command $arg"
1308 # calculate the name of the file, without its directory
1309 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1310 libobjs_save="$libobjs"
1312 if test -n "$shlibpath_var"; then
1313 # get the directories listed in $shlibpath_var
1314 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1318 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1319 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1321 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1322 if test "X$output_objdir" = "X$output"; then
1323 output_objdir="$objdir"
1325 output_objdir="$output_objdir/$objdir"
1327 # Create the object directory.
1328 if test ! -d $output_objdir; then
1329 $show "$mkdir $output_objdir"
1330 $run $mkdir $output_objdir
1332 if test $status -ne 0 && test ! -d $output_objdir; then
1337 # Determine the type of output
1340 $echo "$modename: you must specify an output file" 1>&2
1344 *.$libext) linkmode=oldlib ;;
1345 *.lo | *.$objext) linkmode=obj ;;
1346 *.la) linkmode=lib ;;
1347 *) linkmode=prog ;; # Anything else should be a program.
1352 # Find all interdependent deplibs by searching for libraries
1353 # that are linked more than once (e.g. -la -lb -la)
1354 for deplib in $deplibs; do
1355 if test "X$duplicate_deps" = "Xyes" ; then
1357 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1360 libs="$libs $deplib"
1365 need_relink=no # whether we're linking any uninstalled libtool libraries
1366 notinst_deplibs= # not-installed libtool libraries
1367 notinst_path= # paths that contain not-installed libtool libraries
1371 for file in $dlfiles $dlprefiles; do
1375 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1387 passes="conv scan dlopen dlpreopen link"
1392 for pass in $passes; do
1393 if test $linkmode = prog; then
1394 # Determine which files to process
1398 save_deplibs="$deplibs" # Collect dlpreopened libraries
1401 dlpreopen) libs="$dlprefiles" ;;
1402 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1405 for deplib in $libs; do
1410 if test $linkmode = oldlib && test $linkmode = obj; then
1411 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1414 if test $pass = conv; then
1415 deplibs="$deplib $deplibs"
1418 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1419 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1420 # Search the libtool library
1421 lib="$searchdir/lib${name}.la"
1422 if test -f "$lib"; then
1427 if test "$found" != yes; then
1428 # deplib doesn't seem to be a libtool library
1429 if test "$linkmode,$pass" = "prog,link"; then
1430 compile_deplibs="$deplib $compile_deplibs"
1431 finalize_deplibs="$deplib $finalize_deplibs"
1433 deplibs="$deplib $deplibs"
1434 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1442 deplibs="$deplib $deplibs"
1443 test $pass = conv && continue
1444 newdependency_libs="$deplib $newdependency_libs"
1445 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1448 if test $pass = conv; then
1449 deplibs="$deplib $deplibs"
1452 if test $pass = scan; then
1453 deplibs="$deplib $deplibs"
1454 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1456 compile_deplibs="$deplib $compile_deplibs"
1457 finalize_deplibs="$deplib $finalize_deplibs"
1461 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1467 if test $pass = link; then
1468 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1469 # Make sure the xrpath contains only unique directories.
1472 *) xrpath="$xrpath $dir" ;;
1475 deplibs="$deplib $deplibs"
1478 *.la) lib="$deplib" ;;
1480 if test $pass = conv; then
1481 deplibs="$deplib $deplibs"
1486 if test "$deplibs_check_method" != pass_all; then
1488 echo "*** Warning: Trying to link with static lib archive $deplib."
1489 echo "*** I have the capability to make that library automatically link in when"
1490 echo "*** you link to this library. But I can only do this if you have a"
1491 echo "*** shared version of the library, which you do not appear to have"
1492 echo "*** because the file extensions .$libext of this argument makes me believe"
1493 echo "*** that it is just a static archive that I should not used here."
1496 echo "*** Warning: Linking the shared library $output against the"
1497 echo "*** static library $deplib is not portable!"
1498 deplibs="$deplib $deplibs"
1503 if test $pass != link; then
1504 deplibs="$deplib $deplibs"
1506 compile_deplibs="$deplib $compile_deplibs"
1507 finalize_deplibs="$deplib $finalize_deplibs"
1514 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1515 # If there is no dlopen support or we're linking statically,
1516 # we need to preload.
1517 newdlprefiles="$newdlprefiles $deplib"
1518 compile_deplibs="$deplib $compile_deplibs"
1519 finalize_deplibs="$deplib $finalize_deplibs"
1521 newdlfiles="$newdlfiles $deplib"
1530 if test $found = yes || test -f "$lib"; then :
1532 $echo "$modename: cannot find the library \`$lib'" 1>&2
1536 # Check to see that this really is a libtool archive.
1537 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1539 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1543 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1544 test "X$ladir" = "X$lib" && ladir="."
1552 # If the library was installed with an old release of libtool,
1553 # it will not redefine variable installed.
1558 */* | *\\*) . $lib ;;
1562 if test "$linkmode,$pass" = "lib,link" ||
1563 test "$linkmode,$pass" = "prog,scan" ||
1564 { test $linkmode = oldlib && test $linkmode = obj; }; then
1565 # Add dl[pre]opened files of deplib
1566 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1567 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1570 if test $pass = conv; then
1571 # Only check for convenience libraries
1572 deplibs="$lib $deplibs"
1573 if test -z "$libdir"; then
1574 if test -z "$old_library"; then
1575 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1578 # It is a libtool convenience library, so add in its objects.
1579 convenience="$convenience $ladir/$objdir/$old_library"
1580 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1582 for deplib in $dependency_libs; do
1583 deplibs="$deplib $deplibs"
1584 if test "X$duplicate_deps" = "Xyes" ; then
1585 case "$tmp_libs " in
1586 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1589 tmp_libs="$tmp_libs $deplib"
1591 elif test $linkmode != prog && test $linkmode != lib; then
1592 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1598 # Get the name of the library we link against.
1600 for l in $old_library $library_names; do
1603 if test -z "$linklib"; then
1604 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1608 # This library was specified with -dlopen.
1609 if test $pass = dlopen; then
1610 if test -z "$libdir"; then
1611 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1614 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1615 # If there is no dlname, no dlopen support or we're linking
1616 # statically, we need to preload.
1617 dlprefiles="$dlprefiles $lib"
1619 newdlfiles="$newdlfiles $lib"
1624 # We need an absolute path.
1626 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1628 abs_ladir=`cd "$ladir" && pwd`
1629 if test -z "$abs_ladir"; then
1630 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1631 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1636 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1638 # Find the relevant object directory and library name.
1639 if test "X$installed" = Xyes; then
1640 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1641 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1650 dir="$ladir/$objdir"
1651 absdir="$abs_ladir/$objdir"
1652 # Remove this search path later
1653 notinst_path="$notinst_path $abs_ladir"
1654 fi # $installed = yes
1655 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1657 # This library was specified with -dlpreopen.
1658 if test $pass = dlpreopen; then
1659 if test -z "$libdir"; then
1660 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1663 # Prefer using a static library (so that no silly _DYNAMIC symbols
1664 # are required to link).
1665 if test -n "$old_library"; then
1666 newdlprefiles="$newdlprefiles $dir/$old_library"
1667 # Otherwise, use the dlname, so that lt_dlopen finds it.
1668 elif test -n "$dlname"; then
1669 newdlprefiles="$newdlprefiles $dir/$dlname"
1671 newdlprefiles="$newdlprefiles $dir/$linklib"
1673 fi # $pass = dlpreopen
1675 if test -z "$libdir"; then
1676 # Link the convenience library
1677 if test $linkmode = lib; then
1678 deplibs="$dir/$old_library $deplibs"
1679 elif test "$linkmode,$pass" = "prog,link"; then
1680 compile_deplibs="$dir/$old_library $compile_deplibs"
1681 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1683 deplibs="$lib $deplibs"
1688 if test $linkmode = prog && test $pass != link; then
1689 newlib_search_path="$newlib_search_path $ladir"
1690 deplibs="$lib $deplibs"
1693 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1694 test "$build_libtool_libs" = no; then
1699 for deplib in $dependency_libs; do
1701 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1703 # Need to link against all dependency_libs?
1704 if test $linkalldeplibs = yes; then
1705 deplibs="$deplib $deplibs"
1707 # Need to hardcode shared library paths
1708 # or/and link against static libraries
1709 newdependency_libs="$deplib $newdependency_libs"
1711 if test "X$duplicate_deps" = "Xyes" ; then
1712 case "$tmp_libs " in
1713 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1716 tmp_libs="$tmp_libs $deplib"
1719 fi # $linkmode = prog...
1721 link_static=no # Whether the deplib will be linked statically
1722 if test -n "$library_names" &&
1723 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1724 # Link against this shared library
1726 if test "$linkmode,$pass" = "prog,link" ||
1727 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1728 # Hardcode the library path.
1729 # Skip directories that are in the system default run-time
1731 case " $sys_lib_dlsearch_path " in
1734 case "$compile_rpath " in
1736 *) compile_rpath="$compile_rpath $absdir"
1740 case " $sys_lib_dlsearch_path " in
1743 case "$finalize_rpath " in
1745 *) finalize_rpath="$finalize_rpath $libdir"
1749 if test $linkmode = prog; then
1750 # We need to hardcode the library path
1751 if test -n "$shlibpath_var"; then
1752 # Make sure the rpath contains only unique directories.
1753 case "$temp_rpath " in
1756 *) temp_rpath="$temp_rpath $dir" ;;
1760 fi # $linkmode,$pass = prog,link...
1762 if test "$alldeplibs" = yes &&
1763 { test "$deplibs_check_method" = pass_all ||
1764 { test "$build_libtool_libs" = yes &&
1765 test -n "$library_names"; }; }; then
1766 # We only need to search for static libraries
1770 if test "$installed" = no; then
1771 notinst_deplibs="$notinst_deplibs $lib"
1775 if test -n "$old_archive_from_expsyms_cmds"; then
1776 # figure out the soname
1777 set dummy $library_names
1780 libname=`eval \\$echo \"$libname_spec\"`
1781 # use dlname if we got it. it's perfectly good, no?
1782 if test -n "$dlname"; then
1784 elif test -n "$soname_spec"; then
1788 major=`expr $current - $age`
1792 eval soname=\"$soname_spec\"
1797 # Make a new name for the extract_expsyms_cmds to use
1799 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1800 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1802 # If the library has no export list, then create one now
1803 if test -f "$output_objdir/$soname-def"; then :
1805 $show "extracting exported symbol list from \`$soname'"
1806 save_ifs="$IFS"; IFS='~'
1807 eval cmds=\"$extract_expsyms_cmds\"
1808 for cmd in $cmds; do
1811 $run eval "$cmd" || exit $?
1817 if test -f "$output_objdir/$newlib"; then :; else
1818 $show "generating import library for \`$soname'"
1819 save_ifs="$IFS"; IFS='~'
1820 eval cmds=\"$old_archive_from_expsyms_cmds\"
1821 for cmd in $cmds; do
1824 $run eval "$cmd" || exit $?
1828 # make sure the library variables are pointing to the new library
1831 fi # test -n $old_archive_from_expsyms_cmds
1833 if test $linkmode = prog || test "$mode" != relink; then
1838 case $hardcode_action in
1839 immediate | unsupported)
1840 if test "$hardcode_direct" = no; then
1842 elif test "$hardcode_minus_L" = no; then
1844 *-*-sunos*) add_shlibpath="$dir" ;;
1848 elif test "$hardcode_shlibpath_var" = no; then
1849 add_shlibpath="$dir"
1856 if test "$hardcode_direct" = yes; then
1858 elif test "$hardcode_minus_L" = yes; then
1860 # Try looking first in the location we're being installed to.
1861 if test -n "$inst_prefix_dir"; then
1864 add_dir="-L$inst_prefix_dir$libdir $add_dir"
1869 elif test "$hardcode_shlibpath_var" = yes; then
1870 add_shlibpath="$dir"
1879 if test "$lib_linked" != yes; then
1880 $echo "$modename: configuration error: unsupported hardcode properties"
1884 if test -n "$add_shlibpath"; then
1885 case :$compile_shlibpath: in
1886 *":$add_shlibpath:"*) ;;
1887 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1890 if test $linkmode = prog; then
1891 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1892 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1894 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1895 test -n "$add" && deplibs="$add $deplibs"
1896 if test "$hardcode_direct" != yes && \
1897 test "$hardcode_minus_L" != yes && \
1898 test "$hardcode_shlibpath_var" = yes; then
1899 case :$finalize_shlibpath: in
1901 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1907 if test $linkmode = prog || test "$mode" = relink; then
1911 # Finalize command for both is simple: just hardcode it.
1912 if test "$hardcode_direct" = yes; then
1913 add="$libdir/$linklib"
1914 elif test "$hardcode_minus_L" = yes; then
1917 elif test "$hardcode_shlibpath_var" = yes; then
1918 case :$finalize_shlibpath: in
1920 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1924 # We cannot seem to hardcode it, guess we'll fake it.
1926 # Try looking first in the location we're being installed to.
1927 if test -n "$inst_prefix_dir"; then
1930 add_dir="-L$inst_prefix_dir$libdir $add_dir"
1937 if test $linkmode = prog; then
1938 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1939 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1941 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1942 test -n "$add" && deplibs="$add $deplibs"
1945 elif test $linkmode = prog; then
1946 if test "$alldeplibs" = yes &&
1947 { test "$deplibs_check_method" = pass_all ||
1948 { test "$build_libtool_libs" = yes &&
1949 test -n "$library_names"; }; }; then
1950 # We only need to search for static libraries
1954 # Try to link the static library
1955 # Here we assume that one of hardcode_direct or hardcode_minus_L
1956 # is not unsupported. This is valid on all known static and
1958 if test "$hardcode_direct" != unsupported; then
1959 test -n "$old_library" && linklib="$old_library"
1960 compile_deplibs="$dir/$linklib $compile_deplibs"
1961 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1963 compile_deplibs="-l$name -L$dir $compile_deplibs"
1964 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1966 elif test "$build_libtool_libs" = yes; then
1967 # Not a shared library
1968 if test "$deplibs_check_method" != pass_all; then
1969 # We're trying link a shared library against a static one
1970 # but the system doesn't support it.
1972 # Just print a warning and add the library to dependency_libs so
1973 # that the program can be linked against the static library.
1975 echo "*** Warning: This system can not link to static lib archive $lib."
1976 echo "*** I have the capability to make that library automatically link in when"
1977 echo "*** you link to this library. But I can only do this if you have a"
1978 echo "*** shared version of the library, which you do not appear to have."
1979 if test "$module" = yes; then
1980 echo "*** But as you try to build a module library, libtool will still create "
1981 echo "*** a static module, that should work as long as the dlopening application"
1982 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1983 if test -z "$global_symbol_pipe"; then
1985 echo "*** However, this would only work if libtool was able to extract symbol"
1986 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1987 echo "*** not find such a program. So, this module is probably useless."
1988 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1990 if test "$build_old_libs" = no; then
1991 build_libtool_libs=module
1994 build_libtool_libs=no
1998 convenience="$convenience $dir/$old_library"
1999 old_convenience="$old_convenience $dir/$old_library"
2000 deplibs="$dir/$old_library $deplibs"
2003 fi # link shared/static library?
2005 if test $linkmode = lib; then
2006 if test -n "$dependency_libs" &&
2007 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2008 test $link_static = yes; }; then
2009 # Extract -R from dependency_libs
2011 for libdir in $dependency_libs; do
2013 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2015 *" $temp_xrpath "*) ;;
2016 *) xrpath="$xrpath $temp_xrpath";;
2018 *) temp_deplibs="$temp_deplibs $libdir";;
2021 dependency_libs="$temp_deplibs"
2024 newlib_search_path="$newlib_search_path $absdir"
2025 # Link against this library
2026 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2027 # ... and its dependency_libs
2029 for deplib in $dependency_libs; do
2030 newdependency_libs="$deplib $newdependency_libs"
2031 if test "X$duplicate_deps" = "Xyes" ; then
2032 case "$tmp_libs " in
2033 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2036 tmp_libs="$tmp_libs $deplib"
2039 if test $link_all_deplibs != no; then
2040 # Add the search paths of all dependency libraries
2041 for deplib in $dependency_libs; do
2043 -L*) path="$deplib" ;;
2045 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2046 test "X$dir" = "X$deplib" && dir="."
2047 # We need an absolute path.
2049 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2051 absdir=`cd "$dir" && pwd`
2052 if test -z "$absdir"; then
2053 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2058 if grep "^installed=no" $deplib > /dev/null; then
2059 path="-L$absdir/$objdir"
2061 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2062 if test -z "$libdir"; then
2063 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2066 if test "$absdir" != "$libdir"; then
2067 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2074 case " $deplibs " in
2076 *) deplibs="$deplibs $path" ;;
2079 fi # link_all_deplibs != no
2081 done # for deplib in $libs
2082 if test $pass = dlpreopen; then
2083 # Link the dlpreopened libraries before other libraries
2084 for deplib in $save_deplibs; do
2085 deplibs="$deplib $deplibs"
2088 if test $pass != dlopen; then
2089 test $pass != scan && dependency_libs="$newdependency_libs"
2090 if test $pass != conv; then
2091 # Make sure lib_search_path contains only unique directories.
2093 for dir in $newlib_search_path; do
2094 case "$lib_search_path " in
2096 *) lib_search_path="$lib_search_path $dir" ;;
2102 if test "$linkmode,$pass" != "prog,link"; then
2105 vars="compile_deplibs finalize_deplibs"
2107 for var in $vars dependency_libs; do
2108 # Add libraries to $var in reverse order
2109 eval tmp_libs=\"\$$var\"
2111 for deplib in $tmp_libs; do
2113 -L*) new_libs="$deplib $new_libs" ;;
2115 case " $specialdeplibs " in
2116 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2118 case " $new_libs " in
2120 *) new_libs="$deplib $new_libs" ;;
2128 for deplib in $new_libs; do
2131 case " $tmp_libs " in
2133 *) tmp_libs="$tmp_libs $deplib" ;;
2136 *) tmp_libs="$tmp_libs $deplib" ;;
2139 eval $var=\"$tmp_libs\"
2142 if test "$pass" = "conv" &&
2143 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2144 libs="$deplibs" # reset libs
2148 if test $linkmode = prog; then
2149 dlfiles="$newdlfiles"
2150 dlprefiles="$newdlprefiles"
2155 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2156 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2159 if test -n "$rpath"; then
2160 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2163 if test -n "$xrpath"; then
2164 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2167 if test -n "$vinfo"; then
2168 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2171 if test -n "$release"; then
2172 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2175 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2176 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2179 # Now set the variables for building old libraries.
2180 build_libtool_libs=no
2182 objs="$objs$old_deplibs"
2186 # Make sure we only generate libraries of the form `libNAME.la'.
2189 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2190 eval libname=\"$libname_spec\"
2193 if test "$module" = no; then
2194 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2198 if test "$need_lib_prefix" != no; then
2199 # Add the "lib" prefix for modules if required
2200 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2201 eval libname=\"$libname_spec\"
2203 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2208 if test -n "$objs"; then
2209 if test "$deplibs_check_method" != pass_all; then
2210 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2214 echo "*** Warning: Linking the shared library $output against the non-libtool"
2215 echo "*** objects $objs is not portable!"
2216 libobjs="$libobjs $objs"
2220 if test "$dlself" != no; then
2221 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2225 if test $# -gt 2; then
2226 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2231 if test -z "$rpath"; then
2232 if test "$build_libtool_libs" = yes; then
2233 # Building a libtool convenience library.
2235 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2236 build_libtool_libs=convenience
2240 if test -n "$vinfo"; then
2241 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2244 if test -n "$release"; then
2245 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2249 # Parse the version information argument.
2250 save_ifs="$IFS"; IFS=':'
2251 set dummy $vinfo 0 0 0
2254 if test -n "$8"; then
2255 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2264 # Check that each of the things are valid numbers.
2266 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2268 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2269 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2275 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2277 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2278 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2284 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2286 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2292 if test $age -gt $current; then
2293 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2294 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2298 # Calculate the version variables.
2302 case $version_type in
2306 # Like Linux, but with the current version available in
2307 # verstring for coding it into the library header
2308 major=.`expr $current - $age`
2309 versuffix="$major.$age.$revision"
2310 # Darwin ld doesn't like 0 for these options...
2311 minor_current=`expr $current + 1`
2312 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2317 versuffix=".$current.$revision";
2322 versuffix=".$current";
2326 major=`expr $current - $age + 1`
2328 case $version_type in
2329 nonstopux) verstring_prefix=nonstopux ;;
2330 *) verstring_prefix=sgi ;;
2332 verstring="$verstring_prefix$major.$revision"
2334 # Add in all the interfaces that we are compatible with.
2336 while test $loop != 0; do
2337 iface=`expr $revision - $loop`
2338 loop=`expr $loop - 1`
2339 verstring="$verstring_prefix$major.$iface:$verstring"
2342 # Before this point, $major must not contain `.'.
2344 versuffix="$major.$revision"
2348 major=.`expr $current - $age`
2349 versuffix="$major.$age.$revision"
2353 major=.`expr $current - $age`
2354 versuffix=".$current.$age.$revision"
2355 verstring="$current.$age.$revision"
2357 # Add in all the interfaces that we are compatible with.
2359 while test $loop != 0; do
2360 iface=`expr $current - $loop`
2361 loop=`expr $loop - 1`
2362 verstring="$verstring:${iface}.0"
2365 # Make executables depend on our current version.
2366 verstring="$verstring:${current}.0"
2371 versuffix=".$current.$revision"
2375 # Use '-' rather than '.', since we only want one
2376 # extension on DOS 8.3 filesystems.
2377 major=`expr $current - $age`
2382 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2383 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2388 # Clear the version info if we defaulted, and they specified a release.
2389 if test -z "$vinfo" && test -n "$release"; then
2392 case $version_type in
2394 # we can't check for "0.0" in archive_cmds due to quoting
2395 # problems, so we reset it completely
2402 if test "$need_version" = no; then
2409 # Remove version info from name if versioning should be avoided
2410 if test "$avoid_version" = yes && test "$need_version" = no; then
2416 # Check to see if the archive will have undefined symbols.
2417 if test "$allow_undefined" = yes; then
2418 if test "$allow_undefined_flag" = unsupported; then
2419 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2420 build_libtool_libs=no
2424 # Don't allow undefined symbols.
2425 allow_undefined_flag="$no_undefined_flag"
2429 if test "$mode" != relink; then
2430 # Remove our outputs.
2431 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2432 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2435 # Now set the variables for building old libraries.
2436 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2437 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2439 # Transform .lo files to .o files.
2440 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2443 # Eliminate all temporary directories.
2444 for path in $notinst_path; do
2445 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2446 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2447 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2450 if test -n "$xrpath"; then
2451 # If the user specified any rpath flags, then add them.
2453 for libdir in $xrpath; do
2454 temp_xrpath="$temp_xrpath -R$libdir"
2455 case "$finalize_rpath " in
2457 *) finalize_rpath="$finalize_rpath $libdir" ;;
2460 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2461 dependency_libs="$temp_xrpath $dependency_libs"
2465 # Make sure dlfiles contains only unique files that won't be dlpreopened
2466 old_dlfiles="$dlfiles"
2468 for lib in $old_dlfiles; do
2469 case " $dlprefiles $dlfiles " in
2471 *) dlfiles="$dlfiles $lib" ;;
2475 # Make sure dlprefiles contains only unique files
2476 old_dlprefiles="$dlprefiles"
2478 for lib in $old_dlprefiles; do
2479 case "$dlprefiles " in
2481 *) dlprefiles="$dlprefiles $lib" ;;
2485 if test "$build_libtool_libs" = yes; then
2486 if test -n "$rpath"; then
2488 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2489 # these systems don't actually have a c library (as such)!
2491 *-*-rhapsody* | *-*-darwin1.[012])
2492 # Rhapsody C library is in the System framework
2493 deplibs="$deplibs -framework System"
2496 # Don't link with libc until the a.out ld.so is fixed.
2498 *-*-openbsd* | *-*-freebsd*)
2499 # Do not include libc due to us having libc/libc_r.
2502 # Add libc to deplibs on all other systems if necessary.
2503 if test $build_libtool_need_lc = "yes"; then
2504 deplibs="$deplibs -lc"
2510 # Transform deplibs into only deplibs that can be linked in shared.
2512 libname_save=$libname
2513 release_save=$release
2514 versuffix_save=$versuffix
2516 # I'm not sure if I'm treating the release correctly. I think
2517 # release should show up in the -l (ie -lgmp5) so we don't want to
2518 # add it in twice. Is that correct?
2524 case $deplibs_check_method in
2526 # Don't check for shared/static. Everything works.
2527 # This might be a little naive. We might want to check
2528 # whether the library exists or not. But this is on
2529 # osf3 & osf4 and I'm not really sure... Just
2530 # implementing what was already the behaviour.
2534 # This code stresses the "libraries are programs" paradigm to its
2535 # limits. Maybe even breaks it. We compile a program, linking it
2536 # against the deplibs as a proxy for the library. Then we can check
2537 # whether they linked in statically or dynamically with ldd.
2539 cat > conftest.c <<EOF
2540 int main() { return 0; }
2543 $CC -o conftest conftest.c $deplibs
2544 if test $? -eq 0 ; then
2545 ldd_output=`ldd conftest`
2546 for i in $deplibs; do
2547 name="`expr $i : '-l\(.*\)'`"
2548 # If $name is empty we are operating on a -L argument.
2549 if test -n "$name" && test "$name" != "0"; then
2550 libname=`eval \\$echo \"$libname_spec\"`
2551 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2552 set dummy $deplib_matches
2554 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2555 newdeplibs="$newdeplibs $i"
2559 echo "*** Warning: dynamic linker does not accept needed library $i."
2560 echo "*** I have the capability to make that library automatically link in when"
2561 echo "*** you link to this library. But I can only do this if you have a"
2562 echo "*** shared version of the library, which I believe you do not have"
2563 echo "*** because a test_compile did reveal that the linker did not use it for"
2564 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2567 newdeplibs="$newdeplibs $i"
2571 # Error occured in the first compile. Let's try to salvage
2572 # the situation: Compile a separate program for each library.
2573 for i in $deplibs; do
2574 name="`expr $i : '-l\(.*\)'`"
2575 # If $name is empty we are operating on a -L argument.
2576 if test -n "$name" && test "$name" != "0"; then
2578 $CC -o conftest conftest.c $i
2580 if test $? -eq 0 ; then
2581 ldd_output=`ldd conftest`
2582 libname=`eval \\$echo \"$libname_spec\"`
2583 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2584 set dummy $deplib_matches
2586 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2587 newdeplibs="$newdeplibs $i"
2591 echo "*** Warning: dynamic linker does not accept needed library $i."
2592 echo "*** I have the capability to make that library automatically link in when"
2593 echo "*** you link to this library. But I can only do this if you have a"
2594 echo "*** shared version of the library, which you do not appear to have"
2595 echo "*** because a test_compile did reveal that the linker did not use this one"
2596 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2601 echo "*** Warning! Library $i is needed by this library but I was not able to"
2602 echo "*** make it link in! You will probably need to install it or some"
2603 echo "*** library that it depends on before this library will be fully"
2604 echo "*** functional. Installing it before continuing would be even better."
2607 newdeplibs="$newdeplibs $i"
2613 set dummy $deplibs_check_method
2614 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2615 for a_deplib in $deplibs; do
2616 name="`expr $a_deplib : '-l\(.*\)'`"
2617 # If $name is empty we are operating on a -L argument.
2618 if test -n "$name" && test "$name" != "0"; then
2619 libname=`eval \\$echo \"$libname_spec\"`
2620 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2621 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2622 for potent_lib in $potential_libs; do
2623 # Follow soft links.
2624 if ls -lLd "$potent_lib" 2>/dev/null \
2625 | grep " -> " >/dev/null; then
2628 # The statement above tries to avoid entering an
2629 # endless loop below, in case of cyclic links.
2630 # We might still enter an endless loop, since a link
2631 # loop can be closed while we follow links,
2633 potlib="$potent_lib"
2634 while test -h "$potlib" 2>/dev/null; do
2635 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2637 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2638 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2641 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2643 | egrep "$file_magic_regex" > /dev/null; then
2644 newdeplibs="$newdeplibs $a_deplib"
2650 if test -n "$a_deplib" ; then
2653 echo "*** Warning: linker path does not have real file for library $a_deplib."
2654 echo "*** I have the capability to make that library automatically link in when"
2655 echo "*** you link to this library. But I can only do this if you have a"
2656 echo "*** shared version of the library, which you do not appear to have"
2657 echo "*** because I did check the linker path looking for a file starting"
2658 if test -z "$potlib" ; then
2659 echo "*** with $libname but no candidates were found. (...for file magic test)"
2661 echo "*** with $libname and none of the candidates passed a file format test"
2662 echo "*** using a file magic. Last file checked: $potlib"
2666 # Add a -L argument.
2667 newdeplibs="$newdeplibs $a_deplib"
2669 done # Gone through all deplibs.
2672 set dummy $deplibs_check_method
2673 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2674 for a_deplib in $deplibs; do
2675 name="`expr $a_deplib : '-l\(.*\)'`"
2676 # If $name is empty we are operating on a -L argument.
2677 if test -n "$name" && test "$name" != "0"; then
2678 libname=`eval \\$echo \"$libname_spec\"`
2679 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2680 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2681 for potent_lib in $potential_libs; do
2682 potlib="$potent_lib" # see symlink-check below in file_magic test
2683 if eval echo \"$potent_lib\" 2>/dev/null \
2685 | egrep "$match_pattern_regex" > /dev/null; then
2686 newdeplibs="$newdeplibs $a_deplib"
2692 if test -n "$a_deplib" ; then
2695 echo "*** Warning: linker path does not have real file for library $a_deplib."
2696 echo "*** I have the capability to make that library automatically link in when"
2697 echo "*** you link to this library. But I can only do this if you have a"
2698 echo "*** shared version of the library, which you do not appear to have"
2699 echo "*** because I did check the linker path looking for a file starting"
2700 if test -z "$potlib" ; then
2701 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2703 echo "*** with $libname and none of the candidates passed a file format test"
2704 echo "*** using a regex pattern. Last file checked: $potlib"
2708 # Add a -L argument.
2709 newdeplibs="$newdeplibs $a_deplib"
2711 done # Gone through all deplibs.
2715 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2716 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2717 grep . >/dev/null; then
2719 if test "X$deplibs_check_method" = "Xnone"; then
2720 echo "*** Warning: inter-library dependencies are not supported in this platform."
2722 echo "*** Warning: inter-library dependencies are not known to be supported."
2724 echo "*** All declared inter-library dependencies are being dropped."
2729 versuffix=$versuffix_save
2731 release=$release_save
2732 libname=$libname_save
2736 *-*-rhapsody* | *-*-darwin1.[012])
2737 # On Rhapsody replace the C library is the System framework
2738 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2742 if test "$droppeddeps" = yes; then
2743 if test "$module" = yes; then
2745 echo "*** Warning: libtool could not satisfy all declared inter-library"
2746 echo "*** dependencies of module $libname. Therefore, libtool will create"
2747 echo "*** a static module, that should work as long as the dlopening"
2748 echo "*** application is linked with the -dlopen flag."
2749 if test -z "$global_symbol_pipe"; then
2751 echo "*** However, this would only work if libtool was able to extract symbol"
2752 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2753 echo "*** not find such a program. So, this module is probably useless."
2754 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2756 if test "$build_old_libs" = no; then
2757 oldlibs="$output_objdir/$libname.$libext"
2758 build_libtool_libs=module
2761 build_libtool_libs=no
2764 echo "*** The inter-library dependencies that have been dropped here will be"
2765 echo "*** automatically added whenever a program is linked with this library"
2766 echo "*** or is declared to -dlopen it."
2768 if test $allow_undefined = no; then
2770 echo "*** Since this library must not contain undefined symbols,"
2771 echo "*** because either the platform does not support them or"
2772 echo "*** it was explicitly requested with -no-undefined,"
2773 echo "*** libtool will only create a static version of it."
2774 if test "$build_old_libs" = no; then
2775 oldlibs="$output_objdir/$libname.$libext"
2776 build_libtool_libs=module
2779 build_libtool_libs=no
2784 # Done checking deplibs!
2788 # All the library-specific variables (install_libdir is set above).
2793 # Test again, we may have decided not to build it any more
2794 if test "$build_libtool_libs" = yes; then
2795 if test $hardcode_into_libs = yes; then
2796 # Hardcode the library paths
2799 rpath="$finalize_rpath"
2800 test "$mode" != relink && rpath="$compile_rpath$rpath"
2801 for libdir in $rpath; do
2802 if test -n "$hardcode_libdir_flag_spec"; then
2803 if test -n "$hardcode_libdir_separator"; then
2804 if test -z "$hardcode_libdirs"; then
2805 hardcode_libdirs="$libdir"
2807 # Just accumulate the unique libdirs.
2808 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2809 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2812 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2817 eval flag=\"$hardcode_libdir_flag_spec\"
2818 dep_rpath="$dep_rpath $flag"
2820 elif test -n "$runpath_var"; then
2821 case "$perm_rpath " in
2823 *) perm_rpath="$perm_rpath $libdir" ;;
2827 # Substitute the hardcoded libdirs into the rpath.
2828 if test -n "$hardcode_libdir_separator" &&
2829 test -n "$hardcode_libdirs"; then
2830 libdir="$hardcode_libdirs"
2831 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2833 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2834 # We should set the runpath_var.
2836 for dir in $perm_rpath; do
2839 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2841 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2844 shlibpath="$finalize_shlibpath"
2845 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2846 if test -n "$shlibpath"; then
2847 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2850 # Get the real and link names of the library.
2851 eval library_names=\"$library_names_spec\"
2852 set dummy $library_names
2856 if test -n "$soname_spec"; then
2857 eval soname=\"$soname_spec\"
2861 test -z "$dlname" && dlname=$soname
2863 lib="$output_objdir/$realname"
2866 linknames="$linknames $link"
2869 # Ensure that we have .o objects for linkers which dislike .lo
2870 # (e.g. aix) in case we are running --disable-static
2871 for obj in $libobjs; do
2872 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2873 if test "X$xdir" = "X$obj"; then
2878 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2879 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2880 if test ! -f $xdir/$oldobj; then
2881 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2882 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2886 # Use standard objects if they are pic
2887 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2889 # Prepare the list of exported symbols
2890 if test -z "$export_symbols"; then
2891 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2892 $show "generating symbol list for \`$libname.la'"
2893 export_symbols="$output_objdir/$libname.exp"
2894 $run $rm $export_symbols
2895 eval cmds=\"$export_symbols_cmds\"
2896 save_ifs="$IFS"; IFS='~'
2897 for cmd in $cmds; do
2900 $run eval "$cmd" || exit $?
2903 if test -n "$export_symbols_regex"; then
2904 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2905 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2906 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2907 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2912 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2913 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2916 if test -n "$convenience"; then
2917 if test -n "$whole_archive_flag_spec"; then
2918 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2920 gentop="$output_objdir/${outputname}x"
2921 $show "${rm}r $gentop"
2922 $run ${rm}r "$gentop"
2923 $show "mkdir $gentop"
2924 $run mkdir "$gentop"
2926 if test $status -ne 0 && test ! -d "$gentop"; then
2929 generated="$generated $gentop"
2931 for xlib in $convenience; do
2932 # Extract the objects.
2934 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2935 *) xabs=`pwd`"/$xlib" ;;
2937 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2938 xdir="$gentop/$xlib"
2940 $show "${rm}r $xdir"
2945 if test $status -ne 0 && test ! -d "$xdir"; then
2948 $show "(cd $xdir && $AR x $xabs)"
2949 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2951 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2956 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2957 eval flag=\"$thread_safe_flag_spec\"
2958 linker_flags="$linker_flags $flag"
2961 # Make a backup of the uninstalled library when relinking
2962 if test "$mode" = relink; then
2963 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2966 # Do each of the archive commands.
2967 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2968 eval cmds=\"$archive_expsym_cmds\"
2970 save_deplibs="$deplibs"
2971 for conv in $convenience; do
2973 for test_deplib in $deplibs; do
2974 if test "$test_deplib" != "$conv"; then
2975 tmp_deplibs="$tmp_deplibs $test_deplib"
2978 deplibs="$tmp_deplibs"
2980 eval cmds=\"$archive_cmds\"
2981 deplibs="$save_deplibs"
2983 save_ifs="$IFS"; IFS='~'
2984 for cmd in $cmds; do
2987 $run eval "$cmd" || exit $?
2991 # Restore the uninstalled library and exit
2992 if test "$mode" = relink; then
2993 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2997 # Create links to the real library.
2998 for linkname in $linknames; do
2999 if test "$realname" != "$linkname"; then
3000 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3001 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3005 # If -module or -export-dynamic was specified, set the dlname.
3006 if test "$module" = yes || test "$export_dynamic" = yes; then
3007 # On all known operating systems, these are identical.
3014 if test -n "$deplibs"; then
3015 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3018 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3019 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3022 if test -n "$rpath"; then
3023 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3026 if test -n "$xrpath"; then
3027 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3030 if test -n "$vinfo"; then
3031 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3034 if test -n "$release"; then
3035 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3040 if test -n "$objs$old_deplibs"; then
3041 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3045 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3053 # Delete the old objects.
3054 $run $rm $obj $libobj
3056 # Objects from convenience libraries. This assumes
3057 # single-version convenience libraries. Whenever we create
3058 # different ones for PIC/non-PIC, this we'll have to duplicate
3062 # reload_cmds runs $LD directly, so let us get rid of
3063 # -Wl from whole_archive_flag_spec
3066 if test -n "$convenience"; then
3067 if test -n "$whole_archive_flag_spec"; then
3068 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3070 gentop="$output_objdir/${obj}x"
3071 $show "${rm}r $gentop"
3072 $run ${rm}r "$gentop"
3073 $show "mkdir $gentop"
3074 $run mkdir "$gentop"
3076 if test $status -ne 0 && test ! -d "$gentop"; then
3079 generated="$generated $gentop"
3081 for xlib in $convenience; do
3082 # Extract the objects.
3084 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3085 *) xabs=`pwd`"/$xlib" ;;
3087 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3088 xdir="$gentop/$xlib"
3090 $show "${rm}r $xdir"
3095 if test $status -ne 0 && test ! -d "$xdir"; then
3098 $show "(cd $xdir && $AR x $xabs)"
3099 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3101 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3106 # Create the old-style object.
3107 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
3110 eval cmds=\"$reload_cmds\"
3111 save_ifs="$IFS"; IFS='~'
3112 for cmd in $cmds; do
3115 $run eval "$cmd" || exit $?
3119 # Exit if we aren't doing a library object file.
3120 if test -z "$libobj"; then
3121 if test -n "$gentop"; then
3122 $show "${rm}r $gentop"
3129 if test "$build_libtool_libs" != yes; then
3130 if test -n "$gentop"; then
3131 $show "${rm}r $gentop"
3135 # Create an invalid libtool object if no PIC, so that we don't
3136 # accidentally link it into a program.
3137 $show "echo timestamp > $libobj"
3138 $run eval "echo timestamp > $libobj" || exit $?
3142 if test -n "$pic_flag" || test "$pic_mode" != default; then
3143 # Only do commands if we really have different PIC objects.
3144 reload_objs="$libobjs $reload_conv_objs"
3146 eval cmds=\"$reload_cmds\"
3147 save_ifs="$IFS"; IFS='~'
3148 for cmd in $cmds; do
3151 $run eval "$cmd" || exit $?
3155 # Just create a symlink.
3158 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3159 if test "X$xdir" = "X$libobj"; then
3164 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3165 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3166 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3167 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3170 if test -n "$gentop"; then
3171 $show "${rm}r $gentop"
3180 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3182 if test -n "$vinfo"; then
3183 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3186 if test -n "$release"; then
3187 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3190 if test "$preload" = yes; then
3191 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3192 test "$dlopen_self_static" = unknown; then
3193 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3198 *-*-rhapsody* | *-*-darwin1.[012])
3199 # On Rhapsody replace the C library is the System framework
3200 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3201 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3204 # Don't allow lazy linking, it breaks C++ global constructors
3205 compile_command="$compile_command ${wl}-bind_at_load"
3206 finalize_command="$finalize_command ${wl}-bind_at_load"
3212 compile_command="$compile_command $compile_deplibs"
3213 finalize_command="$finalize_command $finalize_deplibs"
3215 if test -n "$rpath$xrpath"; then
3216 # If the user specified any rpath flags, then add them.
3217 for libdir in $rpath $xrpath; do
3218 # This is the magic to use -rpath.
3219 case "$finalize_rpath " in
3221 *) finalize_rpath="$finalize_rpath $libdir" ;;
3226 # Now hardcode the library paths
3229 for libdir in $compile_rpath $finalize_rpath; do
3230 if test -n "$hardcode_libdir_flag_spec"; then
3231 if test -n "$hardcode_libdir_separator"; then
3232 if test -z "$hardcode_libdirs"; then
3233 hardcode_libdirs="$libdir"
3235 # Just accumulate the unique libdirs.
3236 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3237 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3240 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3245 eval flag=\"$hardcode_libdir_flag_spec\"
3246 rpath="$rpath $flag"
3248 elif test -n "$runpath_var"; then
3249 case "$perm_rpath " in
3251 *) perm_rpath="$perm_rpath $libdir" ;;
3255 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3256 case :$dllsearchpath: in
3258 *) dllsearchpath="$dllsearchpath:$libdir";;
3263 # Substitute the hardcoded libdirs into the rpath.
3264 if test -n "$hardcode_libdir_separator" &&
3265 test -n "$hardcode_libdirs"; then
3266 libdir="$hardcode_libdirs"
3267 eval rpath=\" $hardcode_libdir_flag_spec\"
3269 compile_rpath="$rpath"
3273 for libdir in $finalize_rpath; do
3274 if test -n "$hardcode_libdir_flag_spec"; then
3275 if test -n "$hardcode_libdir_separator"; then
3276 if test -z "$hardcode_libdirs"; then
3277 hardcode_libdirs="$libdir"
3279 # Just accumulate the unique libdirs.
3280 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3281 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3284 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3289 eval flag=\"$hardcode_libdir_flag_spec\"
3290 rpath="$rpath $flag"
3292 elif test -n "$runpath_var"; then
3293 case "$finalize_perm_rpath " in
3295 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3299 # Substitute the hardcoded libdirs into the rpath.
3300 if test -n "$hardcode_libdir_separator" &&
3301 test -n "$hardcode_libdirs"; then
3302 libdir="$hardcode_libdirs"
3303 eval rpath=\" $hardcode_libdir_flag_spec\"
3305 finalize_rpath="$rpath"
3307 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3308 # Transform all the library objects into standard objects.
3309 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3310 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3314 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3315 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3316 dlsyms="${outputname}S.c"
3318 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3322 if test -n "$dlsyms"; then
3326 # Discover the nlist of each of the dlfiles.
3327 nlist="$output_objdir/${outputname}.nm"
3329 $show "$rm $nlist ${nlist}S ${nlist}T"
3330 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3332 # Parse the name list into a source file.
3333 $show "creating $output_objdir/$dlsyms"
3335 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3336 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3337 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3343 /* Prevent the only kind of declaration conflicts we can make. */
3344 #define lt_preloaded_symbols some_other_symbol
3346 /* External symbol declarations for the compiler. */\
3349 if test "$dlself" = yes; then
3350 $show "generating symbol list for \`$output'"
3352 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3354 # Add our own program objects to the symbol list.
3355 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3356 for arg in $progfiles; do
3357 $show "extracting global C symbols from \`$arg'"
3358 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3361 if test -n "$exclude_expsyms"; then
3362 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3363 $run eval '$mv "$nlist"T "$nlist"'
3366 if test -n "$export_symbols_regex"; then
3367 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3368 $run eval '$mv "$nlist"T "$nlist"'
3371 # Prepare the list of exported symbols
3372 if test -z "$export_symbols"; then
3373 export_symbols="$output_objdir/$output.exp"
3374 $run $rm $export_symbols
3375 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3377 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3378 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3379 $run eval 'mv "$nlist"T "$nlist"'
3383 for arg in $dlprefiles; do
3384 $show "extracting global C symbols from \`$arg'"
3385 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3386 $run eval 'echo ": $name " >> "$nlist"'
3387 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3390 if test -z "$run"; then
3391 # Make sure we have at least an empty file.
3392 test -f "$nlist" || : > "$nlist"
3394 if test -n "$exclude_expsyms"; then
3395 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3396 $mv "$nlist"T "$nlist"
3399 # Try sorting and uniquifying the output.
3400 if grep -v "^: " < "$nlist" |
3401 if sort -k 3 </dev/null >/dev/null 2>&1; then
3406 uniq > "$nlist"S; then
3409 grep -v "^: " < "$nlist" > "$nlist"S
3412 if test -f "$nlist"S; then
3413 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3415 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3418 $echo >> "$output_objdir/$dlsyms" "\
3420 #undef lt_preloaded_symbols
3422 #if defined (__STDC__) && __STDC__
3423 # define lt_ptr void *
3425 # define lt_ptr char *
3429 /* The mapping between symbol names and symbols. */
3434 lt_preloaded_symbols[] =
3438 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3440 $echo >> "$output_objdir/$dlsyms" "\
3444 /* This works around a problem in FreeBSD linker */
3445 #ifdef FREEBSD_WORKAROUND
3446 static const void *lt_preloaded_setup() {
3447 return lt_preloaded_symbols;
3457 pic_flag_for_symtable=
3459 # compiling the symbol table file with pic_flag works around
3460 # a FreeBSD bug that causes programs to crash when -lm is
3461 # linked before any other PIC object. But we must not use
3462 # pic_flag when linking with -static. The problem exists in
3463 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3464 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3465 case "$compile_command " in
3467 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3470 case "$compile_command " in
3472 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3476 # Now compile the dynamic symbol file.
3477 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3478 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3480 # Clean up the generated files.
3481 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3482 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3484 # Transform the symbol file into the correct name.
3485 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3486 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3489 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3494 # We keep going just in case the user didn't refer to
3495 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3496 # really was required.
3498 # Nullify the symbol file.
3499 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3500 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3503 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3504 # Replace the output file specification.
3505 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3506 link_command="$compile_command$compile_rpath"
3508 # We have no uninstalled library dependencies, so finalize right now.
3509 $show "$link_command"
3510 $run eval "$link_command"
3513 # Delete the generated files.
3514 if test -n "$dlsyms"; then
3515 $show "$rm $output_objdir/${outputname}S.${objext}"
3516 $run $rm "$output_objdir/${outputname}S.${objext}"
3522 if test -n "$shlibpath_var"; then
3523 # We should set the shlibpath_var
3525 for dir in $temp_rpath; do
3527 [\\/]* | [A-Za-z]:[\\/]*)
3532 # Relative path: add a thisdir entry.
3533 rpath="$rpath\$thisdir/$dir:"
3540 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3541 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3543 if test -n "$finalize_shlibpath"; then
3544 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3549 if test -n "$runpath_var"; then
3550 if test -n "$perm_rpath"; then
3551 # We should set the runpath_var.
3553 for dir in $perm_rpath; do
3556 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3558 if test -n "$finalize_perm_rpath"; then
3559 # We should set the runpath_var.
3561 for dir in $finalize_perm_rpath; do
3564 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3568 if test "$no_install" = yes; then
3569 # We don't need to create a wrapper script.
3570 link_command="$compile_var$compile_command$compile_rpath"
3571 # Replace the output file specification.
3572 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3573 # Delete the old output file.
3575 # Link the executable and exit
3576 $show "$link_command"
3577 $run eval "$link_command" || exit $?
3581 if test "$hardcode_action" = relink; then
3582 # Fast installation is not supported
3583 link_command="$compile_var$compile_command$compile_rpath"
3584 relink_command="$finalize_var$finalize_command$finalize_rpath"
3586 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3587 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3589 if test "$fast_install" != no; then
3590 link_command="$finalize_var$compile_command$finalize_rpath"
3591 if test "$fast_install" = yes; then
3592 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3594 # fast_install is set to needless
3598 link_command="$compile_var$compile_command$compile_rpath"
3599 relink_command="$finalize_var$finalize_command$finalize_rpath"
3603 # Replace the output file specification.
3604 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3606 # Delete the old output files.
3607 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3609 $show "$link_command"
3610 $run eval "$link_command" || exit $?
3612 # Now create the wrapper script.
3613 $show "creating $output"
3615 # Quote the relink command for shipping.
3616 if test -n "$relink_command"; then
3617 # Preserve any variables that may affect compiler behavior
3618 for var in $variables_saved_for_relink; do
3619 if eval test -z \"\${$var+set}\"; then
3620 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3621 elif eval var_value=\$$var; test -z "$var_value"; then
3622 relink_command="$var=; export $var; $relink_command"
3624 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3625 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3628 relink_command="(cd `pwd`; $relink_command)"
3629 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3632 # Quote $echo for shipping.
3633 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3635 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3636 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3638 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3640 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3643 # Only actually do things if our run command is non-null.
3644 if test -z "$run"; then
3645 # win32 will think the script is a binary if it has
3646 # a .exe suffix, so we strip it off here.
3648 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3650 # test for cygwin because mv fails w/o .exe extensions
3652 *cygwin*) exeext=.exe ;;
3656 trap "$rm $output; exit 1" 1 2 15
3661 # $output - temporary wrapper script for $objdir/$outputname
3662 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3664 # The $output program cannot be directly executed until all the libtool
3665 # libraries that it depends on are installed.
3667 # This wrapper script should never be moved out of the build directory.
3668 # If it is, it will not operate correctly.
3670 # Sed substitution that helps us do robust quoting. It backslashifies
3671 # metacharacters that are still active within double-quoted strings.
3672 Xsed="${SED}"' -e 1s/^X//'
3673 sed_quote_subst='$sed_quote_subst'
3675 # The HP-UX ksh and POSIX shell print the target directory to stdout
3677 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3679 relink_command=\"$relink_command\"
3681 # This environment variable determines our operation mode.
3682 if test \"\$libtool_install_magic\" = \"$magic\"; then
3683 # install mode needs the following variable:
3684 notinst_deplibs='$notinst_deplibs'
3686 # When we are sourced in execute mode, \$file and \$echo are already set.
3687 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3690 # Make sure echo works.
3691 if test \"X\$1\" = X--no-reexec; then
3692 # Discard the --no-reexec flag, and continue.
3694 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3695 # Yippee, \$echo works!
3698 # Restart under the correct shell, and then maybe \$echo will work.
3699 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3705 # Find the directory that this script lives in.
3706 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3707 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3709 # Follow symbolic links until we get to the real thisdir.
3710 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3711 while test -n \"\$file\"; do
3712 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3714 # If there was a directory component, then change thisdir.
3715 if test \"x\$destdir\" != \"x\$file\"; then
3716 case \"\$destdir\" in
3717 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3718 *) thisdir=\"\$thisdir/\$destdir\" ;;
3722 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3723 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3726 # Try to get the absolute directory name.
3727 absdir=\`cd \"\$thisdir\" && pwd\`
3728 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3731 if test "$fast_install" = yes; then
3733 program=lt-'$outputname'$exeext
3734 progdir=\"\$thisdir/$objdir\"
3736 if test ! -f \"\$progdir/\$program\" || \\
3737 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3738 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3740 file=\"\$\$-\$program\"
3742 if test ! -d \"\$progdir\"; then
3743 $mkdir \"\$progdir\"
3745 $rm \"\$progdir/\$file\"
3750 # relink executable if necessary
3751 if test -n \"\$relink_command\"; then
3752 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3754 $echo \"\$relink_command_output\" >&2
3755 $rm \"\$progdir/\$file\"
3760 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3761 { $rm \"\$progdir/\$program\";
3762 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3763 $rm \"\$progdir/\$file\"
3767 program='$outputname'
3768 progdir=\"\$thisdir/$objdir\"
3774 if test -f \"\$progdir/\$program\"; then"
3776 # Export our shlibpath_var if we have one.
3777 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3779 # Add our own library path to $shlibpath_var
3780 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3782 # Some systems cannot cope with colon-terminated $shlibpath_var
3783 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3784 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3786 export $shlibpath_var
3790 # fixup the dll searchpath if we need to.
3791 if test -n "$dllsearchpath"; then
3793 # Add the dll search path components to the executable PATH
3794 PATH=$dllsearchpath:\$PATH
3799 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3800 # Run the actual program with our arguments.
3803 # win32 systems need to use the prog path for dll
3805 *-*-cygwin* | *-*-pw32*)
3807 exec \$progdir/\$program \${1+\"\$@\"}
3811 # Backslashes separate directories on plain windows
3812 *-*-mingw | *-*-os2*)
3814 exec \$progdir\\\\\$program \${1+\"\$@\"}
3820 # Export the path to the program.
3821 PATH=\"\$progdir:\$PATH\"
3824 exec \$program \${1+\"\$@\"}
3829 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3833 # The program doesn't exist.
3834 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3835 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3836 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3847 # See if we need to build an old-fashioned archive.
3848 for oldlib in $oldlibs; do
3850 if test "$build_libtool_libs" = convenience; then
3851 oldobjs="$libobjs_save"
3852 addlibs="$convenience"
3853 build_libtool_libs=no
3855 if test "$build_libtool_libs" = module; then
3856 oldobjs="$libobjs_save"
3857 build_libtool_libs=no
3859 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3861 addlibs="$old_convenience"
3864 if test -n "$addlibs"; then
3865 gentop="$output_objdir/${outputname}x"
3866 $show "${rm}r $gentop"
3867 $run ${rm}r "$gentop"
3868 $show "mkdir $gentop"
3869 $run mkdir "$gentop"
3871 if test $status -ne 0 && test ! -d "$gentop"; then
3874 generated="$generated $gentop"
3876 # Add in members from convenience archives.
3877 for xlib in $addlibs; do
3878 # Extract the objects.
3880 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3881 *) xabs=`pwd`"/$xlib" ;;
3883 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3884 xdir="$gentop/$xlib"
3886 $show "${rm}r $xdir"
3891 if test $status -ne 0 && test ! -d "$xdir"; then
3894 $show "(cd $xdir && $AR x $xabs)"
3895 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3897 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3901 # Do each command in the archive commands.
3902 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3903 eval cmds=\"$old_archive_from_new_cmds\"
3905 # Ensure that we have .o objects in place in case we decided
3906 # not to build a shared library, and have fallen back to building
3907 # static libs even though --disable-static was passed!
3908 for oldobj in $oldobjs; do
3909 if test ! -f $oldobj; then
3910 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3911 if test "X$xdir" = "X$oldobj"; then
3916 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3917 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3918 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3919 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3923 eval cmds=\"$old_archive_cmds\"
3925 save_ifs="$IFS"; IFS='~'
3926 for cmd in $cmds; do
3929 $run eval "$cmd" || exit $?
3934 if test -n "$generated"; then
3935 $show "${rm}r$generated"
3936 $run ${rm}r$generated
3939 # Now create the libtool archive.
3943 test "$build_old_libs" = yes && old_library="$libname.$libext"
3944 $show "creating $output"
3946 # Preserve any variables that may affect compiler behavior
3947 for var in $variables_saved_for_relink; do
3948 if eval test -z \"\${$var+set}\"; then
3949 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3950 elif eval var_value=\$$var; test -z "$var_value"; then
3951 relink_command="$var=; export $var; $relink_command"
3953 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3954 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3957 # Quote the link command for shipping.
3958 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3959 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3961 # Only create the output if not a dry run.
3962 if test -z "$run"; then
3963 for installed in no yes; do
3964 if test "$installed" = yes; then
3965 if test -z "$install_libdir"; then
3968 output="$output_objdir/$outputname"i
3969 # Replace all uninstalled libtool libraries with the installed ones
3971 for deplib in $dependency_libs; do
3974 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3975 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3976 if test -z "$libdir"; then
3977 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3980 newdependency_libs="$newdependency_libs $libdir/$name"
3982 *) newdependency_libs="$newdependency_libs $deplib" ;;
3985 dependency_libs="$newdependency_libs"
3987 for lib in $dlfiles; do
3988 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3989 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3990 if test -z "$libdir"; then
3991 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3994 newdlfiles="$newdlfiles $libdir/$name"
3996 dlfiles="$newdlfiles"
3998 for lib in $dlprefiles; do
3999 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4000 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4001 if test -z "$libdir"; then
4002 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4005 newdlprefiles="$newdlprefiles $libdir/$name"
4007 dlprefiles="$newdlprefiles"
4010 # place dlname in correct position for cygwin
4012 case $host,$output,$installed,$module,$dlname in
4013 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4016 # $outputname - a libtool library file
4017 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4019 # Please DO NOT delete this file!
4020 # It is necessary for linking the library.
4022 # The name that we can dlopen(3).
4025 # Names of this library.
4026 library_names='$library_names'
4028 # The name of the static archive.
4029 old_library='$old_library'
4031 # Libraries that this one depends upon.
4032 dependency_libs='$dependency_libs'
4034 # Version information for $libname.
4039 # Is this an already installed library?
4040 installed=$installed
4042 # Files to dlopen/dlpreopen
4044 dlpreopen='$dlprefiles'
4046 # Directory that this library needs to be installed in:
4047 libdir='$install_libdir'"
4048 if test "$installed" = no && test $need_relink = yes; then
4050 relink_command=\"$relink_command\""
4055 # Do a symbolic link so that the libtool archive can be found in
4056 # LD_LIBRARY_PATH before the program is installed.
4057 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4058 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4064 # libtool install mode
4066 modename="$modename: install"
4068 # There may be an optional sh(1) argument at the beginning of
4069 # install_prog (especially on Windows NT).
4070 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4071 # Allow the use of GNU shtool's install command.
4072 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4073 # Aesthetically quote it.
4074 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4076 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4080 install_prog="$arg "
4088 # The real first argument should be the name of the installation program.
4089 # Aesthetically quote it.
4090 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4092 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4096 install_prog="$install_prog$arg"
4098 # We need to accept at least all the BSD install flags.
4108 if test -n "$dest"; then
4109 files="$files $dest"
4127 # If the previous option needed an argument, then skip it.
4128 if test -n "$prev"; then
4137 # Aesthetically quote the argument.
4138 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4140 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4144 install_prog="$install_prog $arg"
4147 if test -z "$install_prog"; then
4148 $echo "$modename: you must specify an install program" 1>&2
4153 if test -n "$prev"; then
4154 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4159 if test -z "$files"; then
4160 if test -z "$dest"; then
4161 $echo "$modename: no file or destination specified" 1>&2
4163 $echo "$modename: you must specify a destination" 1>&2
4169 # Strip any trailing slash from the destination.
4170 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4172 # Check to see that the destination is a directory.
4173 test -d "$dest" && isdir=yes
4174 if test "$isdir" = yes; then
4178 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4179 test "X$destdir" = "X$dest" && destdir=.
4180 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4182 # Not a directory, so check to see that there is only one file specified.
4184 if test $# -gt 2; then
4185 $echo "$modename: \`$dest' is not a directory" 1>&2
4191 [\\/]* | [A-Za-z]:[\\/]*) ;;
4193 for file in $files; do
4197 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4206 # This variable tells wrapper scripts just to set variables rather
4207 # than running their programs.
4208 libtool_install_magic="$magic"
4213 for file in $files; do
4215 # Do each installation.
4218 # Do the static libraries later.
4219 staticlibs="$staticlibs $file"
4223 # Check to see that this really is a libtool archive.
4224 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4226 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4234 # If there is no directory component, then add one.
4236 */* | *\\*) . $file ;;
4240 # Add the libdir to current_libdirs if it is the destination.
4241 if test "X$destdir" = "X$libdir"; then
4242 case "$current_libdirs " in
4244 *) current_libdirs="$current_libdirs $libdir" ;;
4247 # Note the libdir as a future libdir.
4248 case "$future_libdirs " in
4250 *) future_libdirs="$future_libdirs $libdir" ;;
4254 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4255 test "X$dir" = "X$file/" && dir=
4258 if test -n "$relink_command"; then
4259 # Determine the prefix the user has applied to our future dir.
4260 inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4262 # Don't allow the user to place us outside of our expected
4263 # location b/c this prevents finding dependent libraries that
4264 # are installed to the same prefix.
4265 if test "$inst_prefix_dir" = "$destdir"; then
4266 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4270 if test -n "$inst_prefix_dir"; then
4271 # Stick the inst_prefix_dir data into the link command.
4272 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4274 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4277 $echo "$modename: warning: relinking \`$file'" 1>&2
4278 $show "$relink_command"
4279 if $run eval "$relink_command"; then :
4281 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4286 # See the names of the shared library.
4287 set dummy $library_names
4288 if test -n "$2"; then
4294 test -n "$relink_command" && srcname="$realname"T
4296 # Install the shared library and build the symlinks.
4297 $show "$install_prog $dir/$srcname $destdir/$realname"
4298 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4299 if test -n "$stripme" && test -n "$striplib"; then
4300 $show "$striplib $destdir/$realname"
4301 $run eval "$striplib $destdir/$realname" || exit $?
4304 if test $# -gt 0; then
4305 # Delete the old symlinks, and create new ones.
4308 if test "$linkname" != "$realname"; then
4309 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4310 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4315 # Do each command in the postinstall commands.
4316 lib="$destdir/$realname"
4317 eval cmds=\"$postinstall_cmds\"
4318 save_ifs="$IFS"; IFS='~'
4319 for cmd in $cmds; do
4322 $run eval "$cmd" || exit $?
4327 # Install the pseudo-library for information purposes.
4328 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4329 instname="$dir/$name"i
4330 $show "$install_prog $instname $destdir/$name"
4331 $run eval "$install_prog $instname $destdir/$name" || exit $?
4333 # Maybe install the static library, too.
4334 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4338 # Install (i.e. copy) a libtool object.
4340 # Figure out destination file name, if it wasn't already specified.
4341 if test -n "$destname"; then
4342 destfile="$destdir/$destname"
4344 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4345 destfile="$destdir/$destfile"
4348 # Deduce the name of the destination old-style object file.
4351 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4354 staticdest="$destfile"
4358 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4364 # Install the libtool object if requested.
4365 if test -n "$destfile"; then
4366 $show "$install_prog $file $destfile"
4367 $run eval "$install_prog $file $destfile" || exit $?
4370 # Install the old object if enabled.
4371 if test "$build_old_libs" = yes; then
4372 # Deduce the name of the old-style object file.
4373 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4375 $show "$install_prog $staticobj $staticdest"
4376 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4382 # Figure out destination file name, if it wasn't already specified.
4383 if test -n "$destname"; then
4384 destfile="$destdir/$destname"
4386 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4387 destfile="$destdir/$destfile"
4390 # Do a test to see if this is really a libtool program.
4393 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4399 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4403 # If there is no directory component, then add one.
4405 */* | *\\*) . $wrapper ;;
4409 # Check the variables that should have been set.
4410 if test -z "$notinst_deplibs"; then
4411 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4416 for lib in $notinst_deplibs; do
4417 # Check to see that each library is installed.
4419 if test -f "$lib"; then
4420 # If there is no directory component, then add one.
4422 */* | *\\*) . $lib ;;
4426 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4427 if test -n "$libdir" && test ! -f "$libfile"; then
4428 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4434 # If there is no directory component, then add one.
4436 */* | *\\*) . $wrapper ;;
4441 if test "$fast_install" = no && test -n "$relink_command"; then
4442 if test "$finalize" = yes && test -z "$run"; then
4444 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4445 tmpdir="$tmpdir/libtool-$$"
4446 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4448 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4451 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4452 outputname="$tmpdir/$file"
4453 # Replace the output file specification.
4454 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4456 $show "$relink_command"
4457 if $run eval "$relink_command"; then :
4459 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4465 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4468 # Install the binary that we compiled earlier.
4469 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4473 # remove .exe since cygwin /usr/bin/install will append another
4475 case $install_prog,$host in
4476 /usr/bin/install*,*cygwin*)
4477 case $file:$destfile in
4482 destfile=$destfile.exe
4485 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4490 $show "$install_prog$stripme $file $destfile"
4491 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4492 test -n "$outputname" && ${rm}r "$tmpdir"
4497 for file in $staticlibs; do
4498 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4500 # Set up the ranlib parameters.
4501 oldlib="$destdir/$name"
4503 $show "$install_prog $file $oldlib"
4504 $run eval "$install_prog \$file \$oldlib" || exit $?
4506 if test -n "$stripme" && test -n "$striplib"; then
4507 $show "$old_striplib $oldlib"
4508 $run eval "$old_striplib $oldlib" || exit $?
4511 # Do each command in the postinstall commands.
4512 eval cmds=\"$old_postinstall_cmds\"
4513 save_ifs="$IFS"; IFS='~'
4514 for cmd in $cmds; do
4517 $run eval "$cmd" || exit $?
4522 if test -n "$future_libdirs"; then
4523 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4526 if test -n "$current_libdirs"; then
4527 # Maybe just do a dry run.
4528 test -n "$run" && current_libdirs=" -n$current_libdirs"
4529 exec_cmd='$SHELL $0 --finish$current_libdirs'
4535 # libtool finish mode
4537 modename="$modename: finish"
4541 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4544 libdirs="$libdirs $dir"
4547 for libdir in $libdirs; do
4548 if test -n "$finish_cmds"; then
4549 # Do each command in the finish commands.
4550 eval cmds=\"$finish_cmds\"
4551 save_ifs="$IFS"; IFS='~'
4552 for cmd in $cmds; do
4555 $run eval "$cmd" || admincmds="$admincmds
4560 if test -n "$finish_eval"; then
4561 # Do the single finish_eval.
4562 eval cmds=\"$finish_eval\"
4563 $run eval "$cmds" || admincmds="$admincmds
4569 # Exit here if they wanted silent mode.
4570 test "$show" = ":" && exit 0
4572 echo "----------------------------------------------------------------------"
4573 echo "Libraries have been installed in:"
4574 for libdir in $libdirs; do
4578 echo "If you ever happen to want to link against installed libraries"
4579 echo "in a given directory, LIBDIR, you must either use libtool, and"
4580 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4581 echo "flag during linking and do at least one of the following:"
4582 if test -n "$shlibpath_var"; then
4583 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4584 echo " during execution"
4586 if test -n "$runpath_var"; then
4587 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4588 echo " during linking"
4590 if test -n "$hardcode_libdir_flag_spec"; then
4592 eval flag=\"$hardcode_libdir_flag_spec\"
4594 echo " - use the \`$flag' linker flag"
4596 if test -n "$admincmds"; then
4597 echo " - have your system administrator run these commands:$admincmds"
4599 if test -f /etc/ld.so.conf; then
4600 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4603 echo "See any operating system documentation about shared libraries for"
4604 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4605 echo "----------------------------------------------------------------------"
4609 # libtool execute mode
4611 modename="$modename: execute"
4613 # The first argument is the command name.
4615 if test -z "$cmd"; then
4616 $echo "$modename: you must specify a COMMAND" 1>&2
4621 # Handle -dlopen flags immediately.
4622 for file in $execute_dlfiles; do
4623 if test ! -f "$file"; then
4624 $echo "$modename: \`$file' is not a file" 1>&2
4632 # Check to see that this really is a libtool archive.
4633 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4635 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4640 # Read the libtool library.
4644 # If there is no directory component, then add one.
4646 */* | *\\*) . $file ;;
4650 # Skip this library if it cannot be dlopened.
4651 if test -z "$dlname"; then
4652 # Warn if it was a shared library.
4653 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4657 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4658 test "X$dir" = "X$file" && dir=.
4660 if test -f "$dir/$objdir/$dlname"; then
4663 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4669 # Just add the directory containing the .lo file.
4670 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4671 test "X$dir" = "X$file" && dir=.
4675 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4680 # Get the absolute pathname.
4681 absdir=`cd "$dir" && pwd`
4682 test -n "$absdir" && dir="$absdir"
4684 # Now add the directory to shlibpath_var.
4685 if eval "test -z \"\$$shlibpath_var\""; then
4686 eval "$shlibpath_var=\"\$dir\""
4688 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4692 # This variable tells wrapper scripts just to set shlibpath_var
4693 # rather than running their programs.
4694 libtool_execute_magic="$magic"
4696 # Check if any of the arguments is a wrapper script.
4703 # Do a test to see if this is really a libtool program.
4704 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4705 # If there is no directory component, then add one.
4707 */* | *\\*) . $file ;;
4711 # Transform arg to wrapped name.
4712 file="$progdir/$program"
4716 # Quote arguments (to preserve shell metacharacters).
4717 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4718 args="$args \"$file\""
4721 if test -z "$run"; then
4722 if test -n "$shlibpath_var"; then
4723 # Export the shlibpath_var.
4724 eval "export $shlibpath_var"
4727 # Restore saved enviroment variables
4728 if test "${save_LC_ALL+set}" = set; then
4729 LC_ALL="$save_LC_ALL"; export LC_ALL
4731 if test "${save_LANG+set}" = set; then
4732 LANG="$save_LANG"; export LANG
4735 # Now prepare to actually exec the command.
4736 exec_cmd="\$cmd$args"
4738 # Display what would be done.
4739 if test -n "$shlibpath_var"; then
4740 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4741 $echo "export $shlibpath_var"
4748 # libtool clean and uninstall mode
4750 modename="$modename: $mode"
4756 # This variable tells wrapper scripts just to set variables rather
4757 # than running their programs.
4758 libtool_install_magic="$magic"
4763 -f) rm="$rm $arg"; rmforce=yes ;;
4764 -*) rm="$rm $arg" ;;
4765 *) files="$files $arg" ;;
4769 if test -z "$rm"; then
4770 $echo "$modename: you must specify an RM program" 1>&2
4777 for file in $files; do
4778 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4779 if test "X$dir" = "X$file"; then
4783 objdir="$dir/$objdir"
4785 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4786 test $mode = uninstall && objdir="$dir"
4788 # Remember objdir for removal later, being careful to avoid duplicates
4789 if test $mode = clean; then
4792 *) rmdirs="$rmdirs $objdir" ;;
4796 # Don't error if the file doesn't exist and rm -f was used.
4797 if (test -L "$file") >/dev/null 2>&1 \
4798 || (test -h "$file") >/dev/null 2>&1 \
4799 || test -f "$file"; then
4801 elif test -d "$file"; then
4804 elif test "$rmforce" = yes; then
4812 # Possibly a libtool archive, so verify it.
4813 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4816 # Delete the libtool libraries and symlinks.
4817 for n in $library_names; do
4818 rmfiles="$rmfiles $objdir/$n"
4820 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4821 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4823 if test $mode = uninstall; then
4824 if test -n "$library_names"; then
4825 # Do each command in the postuninstall commands.
4826 eval cmds=\"$postuninstall_cmds\"
4827 save_ifs="$IFS"; IFS='~'
4828 for cmd in $cmds; do
4832 if test $? != 0 && test "$rmforce" != yes; then
4839 if test -n "$old_library"; then
4840 # Do each command in the old_postuninstall commands.
4841 eval cmds=\"$old_postuninstall_cmds\"
4842 save_ifs="$IFS"; IFS='~'
4843 for cmd in $cmds; do
4847 if test $? != 0 && test "$rmforce" != yes; then
4853 # FIXME: should reinstall the best remaining shared library.
4859 if test "$build_old_libs" = yes; then
4860 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4861 rmfiles="$rmfiles $dir/$oldobj"
4866 # Do a test to see if this is a libtool program.
4867 if test $mode = clean &&
4868 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4872 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4873 if test "$fast_install" = yes && test -n "$relink_command"; then
4874 rmfiles="$rmfiles $objdir/lt-$name"
4879 $show "$rm $rmfiles"
4880 $run $rm $rmfiles || exit_status=1
4883 # Try to remove the ${objdir}s in the directories where we deleted files
4884 for dir in $rmdirs; do
4885 if test -d "$dir"; then
4887 $run rmdir $dir >/dev/null 2>&1
4895 $echo "$modename: you must specify a MODE" 1>&2
4896 $echo "$generic_help" 1>&2
4901 if test -z "$exec_cmd"; then
4902 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4903 $echo "$generic_help" 1>&2
4906 fi # test -z "$show_help"
4908 if test -n "$exec_cmd"; then
4913 # We need to display help for each of the modes.
4916 "Usage: $modename [OPTION]... [MODE-ARG]...
4918 Provide generalized library-building support services.
4920 --config show all configuration variables
4921 --debug enable verbose shell tracing
4922 -n, --dry-run display commands without modifying any files
4923 --features display basic configuration information and exit
4924 --finish same as \`--mode=finish'
4925 --help display this help message and exit
4926 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4927 --quiet same as \`--silent'
4928 --silent don't print informational messages
4929 --version print version information
4931 MODE must be one of the following:
4933 clean remove files from the build directory
4934 compile compile a source file into a libtool object
4935 execute automatically set library path, then run a program
4936 finish complete the installation of libtool libraries
4937 install install libraries or executables
4938 link create a library or an executable
4939 uninstall remove libraries from an installed directory
4941 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4942 a more detailed description of MODE."
4948 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4950 Remove files from the build directory.
4952 RM is the name of the program to use to delete files associated with each FILE
4953 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4956 If FILE is a libtool library, object or program, all the files associated
4957 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4962 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4964 Compile a source file into a libtool library object.
4966 This mode accepts the following additional options:
4968 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4969 -prefer-pic try to building PIC objects only
4970 -prefer-non-pic try to building non-PIC objects only
4971 -static always build a \`.o' file suitable for static linking
4973 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4974 from the given SOURCEFILE.
4976 The output file name is determined by removing the directory component from
4977 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4978 library object suffix, \`.lo'."
4983 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4985 Automatically set library path, then run a program.
4987 This mode accepts the following additional options:
4989 -dlopen FILE add the directory containing FILE to the library path
4991 This mode sets the library path environment variable according to \`-dlopen'
4994 If any of the ARGS are libtool executable wrappers, then they are translated
4995 into their corresponding uninstalled binary, and any of their required library
4996 directories are added to the library path.
4998 Then, COMMAND is executed, with ARGS as arguments."
5003 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5005 Complete the installation of libtool libraries.
5007 Each LIBDIR is a directory that contains libtool libraries.
5009 The commands that this mode executes may require superuser privileges. Use
5010 the \`--dry-run' option if you just want to see what would be executed."
5015 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5017 Install executables or libraries.
5019 INSTALL-COMMAND is the installation command. The first component should be
5020 either the \`install' or \`cp' program.
5022 The rest of the components are interpreted as arguments to that command (only
5023 BSD-compatible install options are recognized)."
5028 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5030 Link object files or libraries together to form another library, or to
5031 create an executable program.
5033 LINK-COMMAND is a command using the C compiler that you would use to create
5034 a program from several object files.
5036 The following components of LINK-COMMAND are treated specially:
5038 -all-static do not do any dynamic linking at all
5039 -avoid-version do not add a version suffix if possible
5040 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5041 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5042 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5043 -export-symbols SYMFILE
5044 try to export only the symbols listed in SYMFILE
5045 -export-symbols-regex REGEX
5046 try to export only the symbols matching REGEX
5047 -LLIBDIR search LIBDIR for required installed libraries
5048 -lNAME OUTPUT-FILE requires the installed library libNAME
5049 -module build a library that can dlopened
5050 -no-fast-install disable the fast-install mode
5051 -no-install link a not-installable executable
5052 -no-undefined declare that a library does not refer to external symbols
5053 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5054 -release RELEASE specify package release information
5055 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5056 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5057 -static do not do any dynamic linking of libtool libraries
5058 -version-info CURRENT[:REVISION[:AGE]]
5059 specify library version info [each variable defaults to 0]
5061 All other options (arguments beginning with \`-') are ignored.
5063 Every other argument is treated as a filename. Files ending in \`.la' are
5064 treated as uninstalled libtool libraries, other files are standard or library
5067 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5068 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5069 required, except when creating a convenience library.
5071 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5072 using \`ar' and \`ranlib', or on Windows using \`lib'.
5074 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5075 is created, otherwise an executable program is created."
5080 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5082 Remove libraries from an installation directory.
5084 RM is the name of the program to use to delete files associated with each FILE
5085 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5088 If FILE is a libtool library, all the files associated with it are deleted.
5089 Otherwise, only FILE itself is deleted using RM."
5093 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5100 $echo "Try \`$modename --help' for more information about other modes."