1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # This file is distributed with OpenLDAP Software, which contains a
28 # configuration script generated by Autoconf, and is distributable
29 # under the same distributions terms as OpenLDAP inself.
30 # See the OpenLDAP COPYRIGHT and LICENSE file for details.
32 # Check that we have a working $echo.
33 if test "X$1" = X--no-reexec; then
34 # Discard the --no-reexec flag, and continue.
36 elif test "X$1" = X--fallback-echo; then
37 # Avoid inline document here, it may be left over
39 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
40 # Yippee, $echo works!
43 # Restart under the correct shell, and then maybe $echo will work.
44 exec $SHELL "$0" --no-reexec ${1+"$@"}
47 if test "X$1" = X--fallback-echo; then
48 # used as fallback echo
56 # The name of this program.
57 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
63 VERSION=1.4.3-OpenLDAP
67 help="Try \`$progname --help' for more information."
68 magic="%%%MAGIC variable%%%"
73 # Sed substitution that helps us do robust quoting. It backslashifies
74 # metacharacters that are still active within double-quoted strings.
75 Xsed="${SED}"' -e 1s/^X//'
76 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
77 # test EBCDIC or ASCII
78 case `echo A|od -x` in
79 *[Cc]1*) # EBCDIC based system
80 SP2NL="tr '\100' '\n'"
81 NL2SP="tr '\r\n' '\100\100'"
83 *) # Assume ASCII based system
84 SP2NL="tr '\040' '\012'"
85 NL2SP="tr '\015\012' '\040\040'"
90 # Only set LANG and LC_ALL to C if already set.
91 # These must not be set unconditionally because not all systems understand
92 # e.g. LANG=C (notably SCO).
93 # We save the old values to restore during execute mode.
94 if test "${LC_ALL+set}" = set; then
95 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
97 if test "${LANG+set}" = set; then
98 save_LANG="$LANG"; LANG=C; export LANG
101 # Make sure IFS has a sensible default
104 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
105 echo "$modename: not configured to build any kind of library" 1>&2
106 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
119 lo2o="s/\\.lo\$/.${objext}/"
120 o2lo="s/\\.${objext}\$/.lo/"
122 # Parse our command line options once, thoroughly.
129 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
133 # If the previous option needs an argument, assign it.
134 if test -n "$prev"; then
137 execute_dlfiles="$execute_dlfiles $arg"
149 # Have we seen a non-optional argument yet?
156 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
161 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
166 echo "$progname: enabling shell trace mode"
176 if test "$build_libtool_libs" = yes; then
177 echo "enable shared libraries"
179 echo "disable shared libraries"
181 if test "$build_old_libs" = yes; then
182 echo "enable static libraries"
184 echo "disable static libraries"
189 --finish) mode="finish" ;;
191 --mode) prevopt="--mode" prev=mode ;;
192 --mode=*) mode="$optarg" ;;
194 --preserve-dup-deps) duplicate_deps="yes" ;;
206 $echo "$modename: unrecognized option \`$arg'" 1>&2
218 if test -n "$prevopt"; then
219 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
224 # If this variable is set in any of the actions, the command in it
225 # will be execed at the end. This prevents here-documents from being
226 # left over by shells.
229 if test -z "$show_help"; then
231 # Infer the operation mode.
232 if test -z "$mode"; then
234 *cc | *++ | gcc* | *-gcc* | xlc*)
246 *db | *dbx | *strace | *truss)
256 # If we have no mode, but dlfiles were specified, then do execute mode.
257 test -n "$execute_dlfiles" && mode=execute
259 # Just use the default operation mode.
260 if test -z "$mode"; then
261 if test -n "$nonopt"; then
262 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
264 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
271 # Only execute mode is allowed to have -dlopen flags.
272 if test -n "$execute_dlfiles" && test "$mode" != execute; then
273 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
278 # Change the help message to a mode-specific one.
280 help="Try \`$modename --help --mode=$mode' for more information."
282 # These modes are in order of execution frequency so that they run quickly.
284 # libtool compile mode
286 modename="$modename: compile"
287 # Get the compilation command and the source file.
300 # Aesthetically quote the previous argument.
302 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
305 # Double-quote args containing other shell metacharacters.
306 # Many Bourne shells cannot handle close brackets correctly
307 # in scan sets, so we specify it separately.
308 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
313 # Add the previous argument to base_compile.
314 if test -z "$base_compile"; then
315 base_compile="$lastarg"
317 base_compile="$base_compile $lastarg"
323 # Accept any command-line options.
326 if test "$user_target" != "no"; then
327 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
354 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
356 save_ifs="$IFS"; IFS=','
360 # Double-quote args containing other shell metacharacters.
361 # Many Bourne shells cannot handle close brackets correctly
362 # in scan sets, so we specify it separately.
364 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
368 lastarg="$lastarg $arg"
371 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
373 # Add the arguments to base_compile.
374 if test -z "$base_compile"; then
375 base_compile="$lastarg"
377 base_compile="$base_compile $lastarg"
385 # The next one is the -o target name
390 # We got the output file
397 # Accept the current argument as the source file.
401 # Aesthetically quote the previous argument.
403 # Backslashify any backslashes, double quotes, and dollar signs.
404 # These are the only characters that are still specially
405 # interpreted inside of double-quoted scrings.
406 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
408 # Double-quote args containing other shell metacharacters.
409 # Many Bourne shells cannot handle close brackets correctly
410 # in scan sets, so we specify it separately.
412 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
413 lastarg="\"$lastarg\""
417 # Add the previous argument to base_compile.
418 if test -z "$base_compile"; then
419 base_compile="$lastarg"
421 base_compile="$base_compile $lastarg"
429 # Get the name of the library object.
430 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
433 $echo "$modename: you must specify a target with \`-o'" 1>&2
438 # Recognize several different file suffixes.
439 # If the user specifies -o file.o, it is replaced with file.lo
454 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
457 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
459 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
464 if test -z "$base_compile"; then
465 $echo "$modename: you must specify a compilation command" 1>&2
470 # Delete any leftover library objects.
471 if test "$build_old_libs" = yes; then
472 removelist="$obj $libobj"
478 trap "$run $rm $removelist; exit 1" 1 2 15
480 # On Cygwin there's no "real" PIC flag so we must build both object types
482 cygwin* | mingw* | pw32* | os2*)
486 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
487 # non-PIC code in shared libraries is not supported
491 # Calculate the filename of the output object if compiler does
492 # not support -o with -c
493 if test "$compiler_c_o" = no; then
494 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
495 lockfile="$output_obj.lock"
496 removelist="$removelist $output_obj $lockfile"
497 trap "$run $rm $removelist; exit 1" 1 2 15
503 # Lock this critical section if it is needed
504 # We use this script file to make the link, it avoids creating a new file
505 if test "$need_locks" = yes; then
506 until $run ln "$0" "$lockfile" 2>/dev/null; do
507 $show "Waiting for $lockfile to be removed"
510 elif test "$need_locks" = warn; then
511 if test -f "$lockfile"; then
513 *** ERROR, $lockfile exists and contains:
514 `cat $lockfile 2>/dev/null`
516 This indicates that another process is trying to use the same
517 temporary object file, and libtool could not work around it because
518 your compiler does not support \`-c' and \`-o' together. If you
519 repeat this compilation, it may succeed, by chance, but you had better
520 avoid parallel builds (make -j) in this platform, or get a better
526 echo $srcfile > "$lockfile"
529 if test -n "$fix_srcfile_path"; then
530 eval srcfile=\"$fix_srcfile_path\"
533 # Only build a PIC object if we are building libtool libraries.
534 if test "$build_libtool_libs" = yes; then
535 # Without this assignment, base_compile gets emptied.
536 fbsd_hideous_sh_bug=$base_compile
538 if test "$pic_mode" != no; then
539 # All platforms use -DPIC, to notify preprocessed assembler code.
540 command="$base_compile $srcfile $pic_flag -DPIC"
542 # Don't build PIC code
543 command="$base_compile $srcfile"
545 if test "$build_old_libs" = yes; then
547 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
548 if test "X$dir" = "X$libobj"; then
553 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
555 if test -d "$dir"; then
562 if test $status -ne 0 && test ! -d $dir; then
567 if test "$compiler_o_lo" = yes; then
569 command="$command -o $output_obj"
570 elif test "$compiler_c_o" = yes; then
572 command="$command -o $output_obj"
575 $run $rm "$output_obj"
577 if $run eval "$command"; then :
579 test -n "$output_obj" && $run $rm $removelist
583 if test "$need_locks" = warn &&
584 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
586 *** ERROR, $lockfile contains:
587 `cat $lockfile 2>/dev/null`
589 but it should contain:
592 This indicates that another process is trying to use the same
593 temporary object file, and libtool could not work around it because
594 your compiler does not support \`-c' and \`-o' together. If you
595 repeat this compilation, it may succeed, by chance, but you had better
596 avoid parallel builds (make -j) in this platform, or get a better
603 # Just move the object if needed, then go on to compile the next one
604 if test x"$output_obj" != x"$libobj"; then
605 $show "$mv $output_obj $libobj"
606 if $run $mv $output_obj $libobj; then :
614 # If we have no pic_flag, then copy the object into place and finish.
615 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
616 test "$build_old_libs" = yes; then
617 # Rename the .lo from within objdir to obj
618 if test -f $obj; then
623 $show "$mv $libobj $obj"
624 if $run $mv $libobj $obj; then :
631 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
632 if test "X$xdir" = "X$obj"; then
637 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
638 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
639 # Now arrange that obj and lo_libobj become the same file
640 $show "(cd $xdir && $LN_S $baseobj $libobj)"
641 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
642 # Unlock the critical section if it was locked
643 if test "$need_locks" != no; then
654 # Allow error messages only from the first compilation.
655 suppress_output=' >/dev/null 2>&1'
658 # Only build a position-dependent object if we build old libraries.
659 if test "$build_old_libs" = yes; then
660 if test "$pic_mode" != yes; then
661 # Don't build PIC code
662 command="$base_compile $srcfile"
664 # All platforms use -DPIC, to notify preprocessed assembler code.
665 command="$base_compile $srcfile $pic_flag -DPIC"
667 if test "$compiler_c_o" = yes; then
668 command="$command -o $obj"
672 # Suppress compiler output if we already did a PIC compilation.
673 command="$command$suppress_output"
674 $run $rm "$output_obj"
676 if $run eval "$command"; then :
682 if test "$need_locks" = warn &&
683 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
685 *** ERROR, $lockfile contains:
686 `cat $lockfile 2>/dev/null`
688 but it should contain:
691 This indicates that another process is trying to use the same
692 temporary object file, and libtool could not work around it because
693 your compiler does not support \`-c' and \`-o' together. If you
694 repeat this compilation, it may succeed, by chance, but you had better
695 avoid parallel builds (make -j) in this platform, or get a better
702 # Just move the object if needed
703 if test x"$output_obj" != x"$obj"; then
704 $show "$mv $output_obj $obj"
705 if $run $mv $output_obj $obj; then :
713 # Create an invalid libtool object if no PIC, so that we do not
714 # accidentally link it into a program.
715 if test "$build_libtool_libs" != yes; then
716 $show "echo timestamp > $libobj"
717 $run eval "echo timestamp > \$libobj" || exit $?
719 # Move the .lo from within objdir
720 $show "$mv $libobj $lo_libobj"
721 if $run $mv $libobj $lo_libobj; then :
730 # Unlock the critical section if it was locked
731 if test "$need_locks" != no; then
740 modename="$modename: link"
742 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
743 # It is impossible to link a dll without this setting, and
744 # we shouldn't force the makefile maintainer to figure out
745 # which system we are compiling for in order to pass an extra
746 # flag for every libtool invokation.
749 # FIXME: Unfortunately, there are problems with the above when trying
750 # to make a dll which has undefined symbols, in which case not
751 # even a static library is built. For now, we need to specify
752 # -no-undefined on the libtool link line when we can be certain
753 # that all symbols are satisfied, otherwise we get a static library.
760 libtool_args="$nonopt"
761 compile_command="$nonopt"
762 finalize_command="$nonopt"
775 lib_search_path=`pwd`
783 export_symbols_regex=
790 prefer_static_libs=no
802 # We need to know -static, to get the right output filenames.
806 -all-static | -static)
807 if test "X$arg" = "X-all-static"; then
808 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
809 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
811 if test -n "$link_static_flag"; then
812 dlopen_self=$dlopen_self_static
815 if test -z "$pic_flag" && test -n "$link_static_flag"; then
816 dlopen_self=$dlopen_self_static
819 build_libtool_libs=no
821 prefer_static_libs=yes
827 # See if our shared archives depend on static archives.
828 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
830 # Go through the arguments, transforming them on the way.
831 while test $# -gt 0; do
835 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
836 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
840 libtool_args="$libtool_args $qarg"
842 # If the previous option needs an argument, assign it.
843 if test -n "$prev"; then
846 compile_command="$compile_command @OUTPUT@"
847 finalize_command="$finalize_command @OUTPUT@"
853 if test "$preload" = no; then
854 # Add the symbol object into the linking commands.
855 compile_command="$compile_command @SYMFILE@"
856 finalize_command="$finalize_command @SYMFILE@"
860 *.la | *.lo) ;; # We handle these cases below.
862 if test "$dlself" = no; then
870 if test "$prev" = dlprefiles; then
872 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
882 if test "$prev" = dlfiles; then
883 dlfiles="$dlfiles $arg"
885 dlprefiles="$dlprefiles $arg"
893 export_symbols="$arg"
894 if test ! -f "$arg"; then
895 $echo "$modename: symbol file \`$arg' does not exist"
902 export_symbols_regex="$arg"
912 # We need an absolute path.
914 [\\/]* | [A-Za-z]:[\\/]*) ;;
916 $echo "$modename: only absolute run-paths are allowed" 1>&2
920 if test "$prev" = rpath; then
923 *) rpath="$rpath $arg" ;;
928 *) xrpath="$xrpath $arg" ;;
935 compiler_flags="$compiler_flags $qarg"
937 compile_command="$compile_command $qarg"
938 finalize_command="$finalize_command $qarg"
942 linker_flags="$linker_flags $qarg"
943 compiler_flags="$compiler_flags $wl$qarg"
945 compile_command="$compile_command $wl$qarg"
946 finalize_command="$finalize_command $wl$qarg"
950 eval "$prev=\"\$arg\""
961 if test -n "$link_static_flag"; then
962 compile_command="$compile_command $link_static_flag"
963 finalize_command="$finalize_command $link_static_flag"
969 # FIXME: remove this flag sometime in the future.
970 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
994 -export-symbols | -export-symbols-regex)
995 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
996 $echo "$modename: more than one -exported-symbols argument is not allowed"
999 if test "X$arg" = "X-export-symbols"; then
1007 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1008 # so, if we see these flags be careful not to treat them like -L
1010 case $with_gcc/$host in
1011 no/*-*-irix* | no/*-*-nonstopux*)
1012 compile_command="$compile_command $arg"
1013 finalize_command="$finalize_command $arg"
1020 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1021 # We need an absolute path.
1023 [\\/]* | [A-Za-z]:[\\/]*) ;;
1025 absdir=`cd "$dir" && pwd`
1026 if test -z "$absdir"; then
1027 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1036 deplibs="$deplibs -L$dir"
1037 lib_search_path="$lib_search_path $dir"
1041 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1042 case :$dllsearchpath: in
1044 *) dllsearchpath="$dllsearchpath:$dir";;
1052 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1054 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1055 # These systems don't actually have a C or math library (as such)
1058 *-*-mingw* | *-*-os2*)
1059 # These systems don't actually have a C library (as such)
1060 test "X$arg" = "X-lc" && continue
1062 *-*-openbsd* | *-*-freebsd*)
1063 # Do not include libc due to us having libc/libc_r.
1064 test "X$arg" = "X-lc" && continue
1067 elif test "X$arg" = "X-lc_r"; then
1069 *-*-openbsd* | *-*-freebsd*)
1070 # Do not include libc_r directly, use -pthread flag.
1075 deplibs="$deplibs $arg"
1091 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1092 # The PATH hackery in wrapper scripts is required on Windows
1093 # in order for the loader to find any dlls it needs.
1094 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1095 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1098 *) no_install=yes ;;
1126 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1127 # We need an absolute path.
1129 [\\/]* | [A-Za-z]:[\\/]*) ;;
1131 $echo "$modename: only absolute run-paths are allowed" 1>&2
1137 *) xrpath="$xrpath $dir" ;;
1143 # The effects of -static are defined in a previous loop.
1144 # We used to do the same as -all-static on platforms that
1145 # didn't have a PIC flag, but the assumption that the effects
1146 # would be equivalent was wrong. It would break on at least
1147 # Digital Unix and AIX.
1162 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1164 save_ifs="$IFS"; IFS=','
1165 for flag in $args; do
1168 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1173 compiler_flags="$compiler_flags $flag"
1176 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1180 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1182 save_ifs="$IFS"; IFS=','
1183 for flag in $args; do
1186 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1191 compiler_flags="$compiler_flags $wl$flag"
1192 linker_flags="$linker_flags $flag"
1195 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1208 # Some other compiler flag.
1210 # Unknown arguments in both finalize_command and compile_command need
1211 # to be aesthetically quoted because they are evaled later.
1212 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1214 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1221 # A library or standard object.
1222 if test "$prev" = dlfiles; then
1223 # This file was specified with -dlopen.
1224 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1225 dlfiles="$dlfiles $arg"
1229 # If libtool objects are unsupported, then we need to preload.
1234 if test "$prev" = dlprefiles; then
1235 # Preload the old-style object.
1236 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1240 *.lo) libobjs="$libobjs $arg" ;;
1241 *) objs="$objs $arg" ;;
1248 deplibs="$deplibs $arg"
1249 old_deplibs="$old_deplibs $arg"
1254 # A libtool-controlled library.
1256 if test "$prev" = dlfiles; then
1257 # This library was specified with -dlopen.
1258 dlfiles="$dlfiles $arg"
1260 elif test "$prev" = dlprefiles; then
1261 # The library was specified with -dlpreopen.
1262 dlprefiles="$dlprefiles $arg"
1265 deplibs="$deplibs $arg"
1270 # Some other compiler argument.
1272 # Unknown arguments in both finalize_command and compile_command need
1273 # to be aesthetically quoted because they are evaled later.
1274 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1276 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1283 # Now actually substitute the argument into the commands.
1284 if test -n "$arg"; then
1285 compile_command="$compile_command $arg"
1286 finalize_command="$finalize_command $arg"
1288 done # argument parsing loop
1290 if test -n "$prev"; then
1291 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1296 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1297 eval arg=\"$export_dynamic_flag_spec\"
1298 compile_command="$compile_command $arg"
1299 finalize_command="$finalize_command $arg"
1302 # calculate the name of the file, without its directory
1303 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1304 libobjs_save="$libobjs"
1306 if test -n "$shlibpath_var"; then
1307 # get the directories listed in $shlibpath_var
1308 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1312 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1313 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1315 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1316 if test "X$output_objdir" = "X$output"; then
1317 output_objdir="$objdir"
1319 output_objdir="$output_objdir/$objdir"
1321 # Create the object directory.
1322 if test ! -d $output_objdir; then
1323 $show "$mkdir $output_objdir"
1324 $run $mkdir $output_objdir
1326 if test $status -ne 0 && test ! -d $output_objdir; then
1331 # Determine the type of output
1334 $echo "$modename: you must specify an output file" 1>&2
1338 *.$libext) linkmode=oldlib ;;
1339 *.lo | *.$objext) linkmode=obj ;;
1340 *.la) linkmode=lib ;;
1341 *) linkmode=prog ;; # Anything else should be a program.
1346 # Find all interdependent deplibs by searching for libraries
1347 # that are linked more than once (e.g. -la -lb -la)
1348 for deplib in $deplibs; do
1349 if test "X$duplicate_deps" = "Xyes" ; then
1351 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1354 libs="$libs $deplib"
1359 need_relink=no # whether we're linking any uninstalled libtool libraries
1360 notinst_deplibs= # not-installed libtool libraries
1361 notinst_path= # paths that contain not-installed libtool libraries
1365 for file in $dlfiles $dlprefiles; do
1369 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1381 passes="conv scan dlopen dlpreopen link"
1386 for pass in $passes; do
1387 if test $linkmode = prog; then
1388 # Determine which files to process
1392 save_deplibs="$deplibs" # Collect dlpreopened libraries
1395 dlpreopen) libs="$dlprefiles" ;;
1396 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1399 for deplib in $libs; do
1404 if test $linkmode = oldlib && test $linkmode = obj; then
1405 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1408 if test $pass = conv; then
1409 deplibs="$deplib $deplibs"
1412 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1413 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1414 # Search the libtool library
1415 lib="$searchdir/lib${name}.la"
1416 if test -f "$lib"; then
1421 if test "$found" != yes; then
1422 # deplib doesn't seem to be a libtool library
1423 if test "$linkmode,$pass" = "prog,link"; then
1424 compile_deplibs="$deplib $compile_deplibs"
1425 finalize_deplibs="$deplib $finalize_deplibs"
1427 deplibs="$deplib $deplibs"
1428 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1436 deplibs="$deplib $deplibs"
1437 test $pass = conv && continue
1438 newdependency_libs="$deplib $newdependency_libs"
1439 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1442 if test $pass = conv; then
1443 deplibs="$deplib $deplibs"
1446 if test $pass = scan; then
1447 deplibs="$deplib $deplibs"
1448 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1450 compile_deplibs="$deplib $compile_deplibs"
1451 finalize_deplibs="$deplib $finalize_deplibs"
1455 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1461 if test $pass = link; then
1462 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1463 # Make sure the xrpath contains only unique directories.
1466 *) xrpath="$xrpath $dir" ;;
1469 deplibs="$deplib $deplibs"
1472 *.la) lib="$deplib" ;;
1474 if test $pass = conv; then
1475 deplibs="$deplib $deplibs"
1480 if test "$deplibs_check_method" != pass_all; then
1482 echo "*** Warning: Trying to link with static lib archive $deplib."
1483 echo "*** I have the capability to make that library automatically link in when"
1484 echo "*** you link to this library. But I can only do this if you have a"
1485 echo "*** shared version of the library, which you do not appear to have"
1486 echo "*** because the file extensions .$libext of this argument makes me believe"
1487 echo "*** that it is just a static archive that I should not used here."
1490 echo "*** Warning: Linking the shared library $output against the"
1491 echo "*** static library $deplib is not portable!"
1492 deplibs="$deplib $deplibs"
1497 if test $pass != link; then
1498 deplibs="$deplib $deplibs"
1500 compile_deplibs="$deplib $compile_deplibs"
1501 finalize_deplibs="$deplib $finalize_deplibs"
1508 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1509 # If there is no dlopen support or we're linking statically,
1510 # we need to preload.
1511 newdlprefiles="$newdlprefiles $deplib"
1512 compile_deplibs="$deplib $compile_deplibs"
1513 finalize_deplibs="$deplib $finalize_deplibs"
1515 newdlfiles="$newdlfiles $deplib"
1524 if test $found = yes || test -f "$lib"; then :
1526 $echo "$modename: cannot find the library \`$lib'" 1>&2
1530 # Check to see that this really is a libtool archive.
1531 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1533 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1537 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1538 test "X$ladir" = "X$lib" && ladir="."
1546 # If the library was installed with an old release of libtool,
1547 # it will not redefine variable installed.
1552 */* | *\\*) . $lib ;;
1556 if test "$linkmode,$pass" = "lib,link" ||
1557 test "$linkmode,$pass" = "prog,scan" ||
1558 { test $linkmode = oldlib && test $linkmode = obj; }; then
1559 # Add dl[pre]opened files of deplib
1560 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1561 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1564 if test $pass = conv; then
1565 # Only check for convenience libraries
1566 deplibs="$lib $deplibs"
1567 if test -z "$libdir"; then
1568 if test -z "$old_library"; then
1569 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1572 # It is a libtool convenience library, so add in its objects.
1573 convenience="$convenience $ladir/$objdir/$old_library"
1574 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1576 for deplib in $dependency_libs; do
1577 deplibs="$deplib $deplibs"
1578 if test "X$duplicate_deps" = "Xyes" ; then
1579 case "$tmp_libs " in
1580 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1583 tmp_libs="$tmp_libs $deplib"
1585 elif test $linkmode != prog && test $linkmode != lib; then
1586 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1592 # Get the name of the library we link against.
1594 for l in $old_library $library_names; do
1597 if test -z "$linklib"; then
1598 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1602 # This library was specified with -dlopen.
1603 if test $pass = dlopen; then
1604 if test -z "$libdir"; then
1605 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1608 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1609 # If there is no dlname, no dlopen support or we're linking
1610 # statically, we need to preload.
1611 dlprefiles="$dlprefiles $lib"
1613 newdlfiles="$newdlfiles $lib"
1618 # We need an absolute path.
1620 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1622 abs_ladir=`cd "$ladir" && pwd`
1623 if test -z "$abs_ladir"; then
1624 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1625 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1630 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1632 # Find the relevant object directory and library name.
1633 if test "X$installed" = Xyes; then
1634 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1635 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1644 dir="$ladir/$objdir"
1645 absdir="$abs_ladir/$objdir"
1646 # Remove this search path later
1647 notinst_path="$notinst_path $abs_ladir"
1648 fi # $installed = yes
1649 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1651 # This library was specified with -dlpreopen.
1652 if test $pass = dlpreopen; then
1653 if test -z "$libdir"; then
1654 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1657 # Prefer using a static library (so that no silly _DYNAMIC symbols
1658 # are required to link).
1659 if test -n "$old_library"; then
1660 newdlprefiles="$newdlprefiles $dir/$old_library"
1661 # Otherwise, use the dlname, so that lt_dlopen finds it.
1662 elif test -n "$dlname"; then
1663 newdlprefiles="$newdlprefiles $dir/$dlname"
1665 newdlprefiles="$newdlprefiles $dir/$linklib"
1667 fi # $pass = dlpreopen
1669 if test -z "$libdir"; then
1670 # Link the convenience library
1671 if test $linkmode = lib; then
1672 deplibs="$dir/$old_library $deplibs"
1673 elif test "$linkmode,$pass" = "prog,link"; then
1674 compile_deplibs="$dir/$old_library $compile_deplibs"
1675 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1677 deplibs="$lib $deplibs"
1682 if test $linkmode = prog && test $pass != link; then
1683 newlib_search_path="$newlib_search_path $ladir"
1684 deplibs="$lib $deplibs"
1687 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1688 test "$build_libtool_libs" = no; then
1693 for deplib in $dependency_libs; do
1695 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1697 # Need to link against all dependency_libs?
1698 if test $linkalldeplibs = yes; then
1699 deplibs="$deplib $deplibs"
1701 # Need to hardcode shared library paths
1702 # or/and link against static libraries
1703 newdependency_libs="$deplib $newdependency_libs"
1705 if test "X$duplicate_deps" = "Xyes" ; then
1706 case "$tmp_libs " in
1707 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1710 tmp_libs="$tmp_libs $deplib"
1713 fi # $linkmode = prog...
1715 link_static=no # Whether the deplib will be linked statically
1716 if test -n "$library_names" &&
1717 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1718 # Link against this shared library
1720 if test "$linkmode,$pass" = "prog,link" ||
1721 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1722 # Hardcode the library path.
1723 # Skip directories that are in the system default run-time
1725 case " $sys_lib_dlsearch_path " in
1728 case "$compile_rpath " in
1730 *) compile_rpath="$compile_rpath $absdir"
1734 case " $sys_lib_dlsearch_path " in
1737 case "$finalize_rpath " in
1739 *) finalize_rpath="$finalize_rpath $libdir"
1743 if test $linkmode = prog; then
1744 # We need to hardcode the library path
1745 if test -n "$shlibpath_var"; then
1746 # Make sure the rpath contains only unique directories.
1747 case "$temp_rpath " in
1750 *) temp_rpath="$temp_rpath $dir" ;;
1754 fi # $linkmode,$pass = prog,link...
1756 if test "$alldeplibs" = yes &&
1757 { test "$deplibs_check_method" = pass_all ||
1758 { test "$build_libtool_libs" = yes &&
1759 test -n "$library_names"; }; }; then
1760 # We only need to search for static libraries
1764 if test "$installed" = no; then
1765 notinst_deplibs="$notinst_deplibs $lib"
1769 if test -n "$old_archive_from_expsyms_cmds"; then
1770 # figure out the soname
1771 set dummy $library_names
1774 libname=`eval \\$echo \"$libname_spec\"`
1775 # use dlname if we got it. it's perfectly good, no?
1776 if test -n "$dlname"; then
1778 elif test -n "$soname_spec"; then
1782 major=`expr $current - $age`
1786 eval soname=\"$soname_spec\"
1791 # Make a new name for the extract_expsyms_cmds to use
1793 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1794 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1796 # If the library has no export list, then create one now
1797 if test -f "$output_objdir/$soname-def"; then :
1799 $show "extracting exported symbol list from \`$soname'"
1800 save_ifs="$IFS"; IFS='~'
1801 eval cmds=\"$extract_expsyms_cmds\"
1802 for cmd in $cmds; do
1805 $run eval "$cmd" || exit $?
1811 if test -f "$output_objdir/$newlib"; then :; else
1812 $show "generating import library for \`$soname'"
1813 save_ifs="$IFS"; IFS='~'
1814 eval cmds=\"$old_archive_from_expsyms_cmds\"
1815 for cmd in $cmds; do
1818 $run eval "$cmd" || exit $?
1822 # make sure the library variables are pointing to the new library
1825 fi # test -n $old_archive_from_expsyms_cmds
1827 if test $linkmode = prog || test "$mode" != relink; then
1832 case $hardcode_action in
1833 immediate | unsupported)
1834 if test "$hardcode_direct" = no; then
1836 elif test "$hardcode_minus_L" = no; then
1838 *-*-sunos*) add_shlibpath="$dir" ;;
1842 elif test "$hardcode_shlibpath_var" = no; then
1843 add_shlibpath="$dir"
1850 if test "$hardcode_direct" = yes; then
1852 elif test "$hardcode_minus_L" = yes; then
1855 elif test "$hardcode_shlibpath_var" = yes; then
1856 add_shlibpath="$dir"
1865 if test "$lib_linked" != yes; then
1866 $echo "$modename: configuration error: unsupported hardcode properties"
1870 if test -n "$add_shlibpath"; then
1871 case :$compile_shlibpath: in
1872 *":$add_shlibpath:"*) ;;
1873 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1876 if test $linkmode = prog; then
1877 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1878 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1880 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1881 test -n "$add" && deplibs="$add $deplibs"
1882 if test "$hardcode_direct" != yes && \
1883 test "$hardcode_minus_L" != yes && \
1884 test "$hardcode_shlibpath_var" = yes; then
1885 case :$finalize_shlibpath: in
1887 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1893 if test $linkmode = prog || test "$mode" = relink; then
1897 # Finalize command for both is simple: just hardcode it.
1898 if test "$hardcode_direct" = yes; then
1899 add="$libdir/$linklib"
1900 elif test "$hardcode_minus_L" = yes; then
1903 elif test "$hardcode_shlibpath_var" = yes; then
1904 case :$finalize_shlibpath: in
1906 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1910 # We cannot seem to hardcode it, guess we'll fake it.
1915 if test $linkmode = prog; then
1916 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1917 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1919 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1920 test -n "$add" && deplibs="$add $deplibs"
1923 elif test $linkmode = prog; then
1924 if test "$alldeplibs" = yes &&
1925 { test "$deplibs_check_method" = pass_all ||
1926 { test "$build_libtool_libs" = yes &&
1927 test -n "$library_names"; }; }; then
1928 # We only need to search for static libraries
1932 # Try to link the static library
1933 # Here we assume that one of hardcode_direct or hardcode_minus_L
1934 # is not unsupported. This is valid on all known static and
1936 if test "$hardcode_direct" != unsupported; then
1937 test -n "$old_library" && linklib="$old_library"
1938 compile_deplibs="$dir/$linklib $compile_deplibs"
1939 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1941 compile_deplibs="-l$name -L$dir $compile_deplibs"
1942 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1944 elif test "$build_libtool_libs" = yes; then
1945 # Not a shared library
1946 if test "$deplibs_check_method" != pass_all; then
1947 # We're trying link a shared library against a static one
1948 # but the system doesn't support it.
1950 # Just print a warning and add the library to dependency_libs so
1951 # that the program can be linked against the static library.
1953 echo "*** Warning: This system can not link to static lib archive $lib."
1954 echo "*** I have the capability to make that library automatically link in when"
1955 echo "*** you link to this library. But I can only do this if you have a"
1956 echo "*** shared version of the library, which you do not appear to have."
1957 if test "$module" = yes; then
1958 echo "*** But as you try to build a module library, libtool will still create "
1959 echo "*** a static module, that should work as long as the dlopening application"
1960 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1961 if test -z "$global_symbol_pipe"; then
1963 echo "*** However, this would only work if libtool was able to extract symbol"
1964 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1965 echo "*** not find such a program. So, this module is probably useless."
1966 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1968 if test "$build_old_libs" = no; then
1969 build_libtool_libs=module
1972 build_libtool_libs=no
1976 convenience="$convenience $dir/$old_library"
1977 old_convenience="$old_convenience $dir/$old_library"
1978 deplibs="$dir/$old_library $deplibs"
1981 fi # link shared/static library?
1983 if test $linkmode = lib; then
1984 if test -n "$dependency_libs" &&
1985 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1986 test $link_static = yes; }; then
1987 # Extract -R from dependency_libs
1989 for libdir in $dependency_libs; do
1991 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
1993 *" $temp_xrpath "*) ;;
1994 *) xrpath="$xrpath $temp_xrpath";;
1996 *) temp_deplibs="$temp_deplibs $libdir";;
1999 dependency_libs="$temp_deplibs"
2002 newlib_search_path="$newlib_search_path $absdir"
2003 # Link against this library
2004 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2005 # ... and its dependency_libs
2007 for deplib in $dependency_libs; do
2008 newdependency_libs="$deplib $newdependency_libs"
2009 if test "X$duplicate_deps" = "Xyes" ; then
2010 case "$tmp_libs " in
2011 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2014 tmp_libs="$tmp_libs $deplib"
2017 if test $link_all_deplibs != no; then
2018 # Add the search paths of all dependency libraries
2019 for deplib in $dependency_libs; do
2021 -L*) path="$deplib" ;;
2023 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2024 test "X$dir" = "X$deplib" && dir="."
2025 # We need an absolute path.
2027 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2029 absdir=`cd "$dir" && pwd`
2030 if test -z "$absdir"; then
2031 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2036 if grep "^installed=no" $deplib > /dev/null; then
2037 path="-L$absdir/$objdir"
2039 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2040 if test -z "$libdir"; then
2041 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2044 if test "$absdir" != "$libdir"; then
2045 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2052 case " $deplibs " in
2054 *) deplibs="$deplibs $path" ;;
2057 fi # link_all_deplibs != no
2059 done # for deplib in $libs
2060 if test $pass = dlpreopen; then
2061 # Link the dlpreopened libraries before other libraries
2062 for deplib in $save_deplibs; do
2063 deplibs="$deplib $deplibs"
2066 if test $pass != dlopen; then
2067 test $pass != scan && dependency_libs="$newdependency_libs"
2068 if test $pass != conv; then
2069 # Make sure lib_search_path contains only unique directories.
2071 for dir in $newlib_search_path; do
2072 case "$lib_search_path " in
2074 *) lib_search_path="$lib_search_path $dir" ;;
2080 if test "$linkmode,$pass" != "prog,link"; then
2083 vars="compile_deplibs finalize_deplibs"
2085 for var in $vars dependency_libs; do
2086 # Add libraries to $var in reverse order
2087 eval tmp_libs=\"\$$var\"
2089 for deplib in $tmp_libs; do
2091 -L*) new_libs="$deplib $new_libs" ;;
2093 case " $specialdeplibs " in
2094 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2096 case " $new_libs " in
2098 *) new_libs="$deplib $new_libs" ;;
2106 for deplib in $new_libs; do
2109 case " $tmp_libs " in
2111 *) tmp_libs="$tmp_libs $deplib" ;;
2114 *) tmp_libs="$tmp_libs $deplib" ;;
2117 eval $var=\"$tmp_libs\"
2120 if test "$pass" = "conv" &&
2121 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2122 libs="$deplibs" # reset libs
2126 if test $linkmode = prog; then
2127 dlfiles="$newdlfiles"
2128 dlprefiles="$newdlprefiles"
2133 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2134 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2137 if test -n "$rpath"; then
2138 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2141 if test -n "$xrpath"; then
2142 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2145 if test -n "$vinfo"; then
2146 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2149 if test -n "$release"; then
2150 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2153 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2154 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2157 # Now set the variables for building old libraries.
2158 build_libtool_libs=no
2160 objs="$objs$old_deplibs"
2164 # Make sure we only generate libraries of the form `libNAME.la'.
2167 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2168 eval libname=\"$libname_spec\"
2171 if test "$module" = no; then
2172 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2176 if test "$need_lib_prefix" != no; then
2177 # Add the "lib" prefix for modules if required
2178 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2179 eval libname=\"$libname_spec\"
2181 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2186 if test -n "$objs"; then
2187 if test "$deplibs_check_method" != pass_all; then
2188 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2192 echo "*** Warning: Linking the shared library $output against the non-libtool"
2193 echo "*** objects $objs is not portable!"
2194 libobjs="$libobjs $objs"
2198 if test "$dlself" != no; then
2199 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2203 if test $# -gt 2; then
2204 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2209 if test -z "$rpath"; then
2210 if test "$build_libtool_libs" = yes; then
2211 # Building a libtool convenience library.
2213 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2214 build_libtool_libs=convenience
2218 if test -n "$vinfo"; then
2219 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2222 if test -n "$release"; then
2223 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2227 # Parse the version information argument.
2228 save_ifs="$IFS"; IFS=':'
2229 set dummy $vinfo 0 0 0
2232 if test -n "$8"; then
2233 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2242 # Check that each of the things are valid numbers.
2244 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2246 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2247 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2253 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2255 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2256 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2262 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2264 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2265 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2270 if test $age -gt $current; then
2271 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2272 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2276 # Calculate the version variables.
2280 case $version_type in
2284 # Like Linux, but with the current version available in
2285 # verstring for coding it into the library header
2286 major=.`expr $current - $age`
2287 versuffix="$major.$age.$revision"
2288 # Darwin ld doesn't like 0 for these options...
2289 minor_current=`expr $current + 1`
2290 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2295 versuffix=".$current.$revision";
2300 versuffix=".$current";
2304 major=`expr $current - $age + 1`
2306 case $version_type in
2307 nonstopux) verstring_prefix=nonstopux ;;
2308 *) verstring_prefix=sgi ;;
2310 verstring="$verstring_prefix$major.$revision"
2312 # Add in all the interfaces that we are compatible with.
2314 while test $loop != 0; do
2315 iface=`expr $revision - $loop`
2316 loop=`expr $loop - 1`
2317 verstring="$verstring_prefix$major.$iface:$verstring"
2320 # Before this point, $major must not contain `.'.
2322 versuffix="$major.$revision"
2326 major=.`expr $current - $age`
2327 versuffix="$major.$age.$revision"
2331 major=.`expr $current - $age`
2332 versuffix=".$current.$age.$revision"
2333 verstring="$current.$age.$revision"
2335 # Add in all the interfaces that we are compatible with.
2337 while test $loop != 0; do
2338 iface=`expr $current - $loop`
2339 loop=`expr $loop - 1`
2340 verstring="$verstring:${iface}.0"
2343 # Make executables depend on our current version.
2344 verstring="$verstring:${current}.0"
2349 versuffix=".$current.$revision"
2353 # Use '-' rather than '.', since we only want one
2354 # extension on DOS 8.3 filesystems.
2355 major=`expr $current - $age`
2360 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2361 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2366 # Clear the version info if we defaulted, and they specified a release.
2367 if test -z "$vinfo" && test -n "$release"; then
2370 case $version_type in
2372 # we can't check for "0.0" in archive_cmds due to quoting
2373 # problems, so we reset it completely
2380 if test "$need_version" = no; then
2387 # Remove version info from name if versioning should be avoided
2388 if test "$avoid_version" = yes && test "$need_version" = no; then
2394 # Check to see if the archive will have undefined symbols.
2395 if test "$allow_undefined" = yes; then
2396 if test "$allow_undefined_flag" = unsupported; then
2397 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2398 build_libtool_libs=no
2402 # Don't allow undefined symbols.
2403 allow_undefined_flag="$no_undefined_flag"
2407 if test "$mode" != relink; then
2408 # Remove our outputs.
2409 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2410 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2413 # Now set the variables for building old libraries.
2414 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2415 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2417 # Transform .lo files to .o files.
2418 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2421 # Eliminate all temporary directories.
2422 for path in $notinst_path; do
2423 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2424 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2425 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2428 if test -n "$xrpath"; then
2429 # If the user specified any rpath flags, then add them.
2431 for libdir in $xrpath; do
2432 temp_xrpath="$temp_xrpath -R$libdir"
2433 case "$finalize_rpath " in
2435 *) finalize_rpath="$finalize_rpath $libdir" ;;
2438 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2439 dependency_libs="$temp_xrpath $dependency_libs"
2443 # Make sure dlfiles contains only unique files that won't be dlpreopened
2444 old_dlfiles="$dlfiles"
2446 for lib in $old_dlfiles; do
2447 case " $dlprefiles $dlfiles " in
2449 *) dlfiles="$dlfiles $lib" ;;
2453 # Make sure dlprefiles contains only unique files
2454 old_dlprefiles="$dlprefiles"
2456 for lib in $old_dlprefiles; do
2457 case "$dlprefiles " in
2459 *) dlprefiles="$dlprefiles $lib" ;;
2463 if test "$build_libtool_libs" = yes; then
2464 if test -n "$rpath"; then
2466 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2467 # these systems don't actually have a c library (as such)!
2469 *-*-rhapsody* | *-*-darwin1.[012])
2470 # Rhapsody C library is in the System framework
2471 deplibs="$deplibs -framework System"
2474 # Don't link with libc until the a.out ld.so is fixed.
2476 *-*-openbsd* | *-*-freebsd*)
2477 # Do not include libc due to us having libc/libc_r.
2480 # Add libc to deplibs on all other systems if necessary.
2481 if test $build_libtool_need_lc = "yes"; then
2482 deplibs="$deplibs -lc"
2488 # Transform deplibs into only deplibs that can be linked in shared.
2490 libname_save=$libname
2491 release_save=$release
2492 versuffix_save=$versuffix
2494 # I'm not sure if I'm treating the release correctly. I think
2495 # release should show up in the -l (ie -lgmp5) so we don't want to
2496 # add it in twice. Is that correct?
2502 case $deplibs_check_method in
2504 # Don't check for shared/static. Everything works.
2505 # This might be a little naive. We might want to check
2506 # whether the library exists or not. But this is on
2507 # osf3 & osf4 and I'm not really sure... Just
2508 # implementing what was already the behaviour.
2512 # This code stresses the "libraries are programs" paradigm to its
2513 # limits. Maybe even breaks it. We compile a program, linking it
2514 # against the deplibs as a proxy for the library. Then we can check
2515 # whether they linked in statically or dynamically with ldd.
2517 cat > conftest.c <<EOF
2518 int main() { return 0; }
2521 $CC -o conftest conftest.c $deplibs
2522 if test $? -eq 0 ; then
2523 ldd_output=`ldd conftest`
2524 for i in $deplibs; do
2525 name="`expr $i : '-l\(.*\)'`"
2526 # If $name is empty we are operating on a -L argument.
2527 if test -n "$name" && test "$name" != "0"; then
2528 libname=`eval \\$echo \"$libname_spec\"`
2529 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2530 set dummy $deplib_matches
2532 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2533 newdeplibs="$newdeplibs $i"
2537 echo "*** Warning: dynamic linker does not accept needed library $i."
2538 echo "*** I have the capability to make that library automatically link in when"
2539 echo "*** you link to this library. But I can only do this if you have a"
2540 echo "*** shared version of the library, which I believe you do not have"
2541 echo "*** because a test_compile did reveal that the linker did not use it for"
2542 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2545 newdeplibs="$newdeplibs $i"
2549 # Error occured in the first compile. Let's try to salvage
2550 # the situation: Compile a separate program for each library.
2551 for i in $deplibs; do
2552 name="`expr $i : '-l\(.*\)'`"
2553 # If $name is empty we are operating on a -L argument.
2554 if test -n "$name" && test "$name" != "0"; then
2556 $CC -o conftest conftest.c $i
2558 if test $? -eq 0 ; then
2559 ldd_output=`ldd conftest`
2560 libname=`eval \\$echo \"$libname_spec\"`
2561 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2562 set dummy $deplib_matches
2564 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2565 newdeplibs="$newdeplibs $i"
2569 echo "*** Warning: dynamic linker does not accept needed library $i."
2570 echo "*** I have the capability to make that library automatically link in when"
2571 echo "*** you link to this library. But I can only do this if you have a"
2572 echo "*** shared version of the library, which you do not appear to have"
2573 echo "*** because a test_compile did reveal that the linker did not use this one"
2574 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2579 echo "*** Warning! Library $i is needed by this library but I was not able to"
2580 echo "*** make it link in! You will probably need to install it or some"
2581 echo "*** library that it depends on before this library will be fully"
2582 echo "*** functional. Installing it before continuing would be even better."
2585 newdeplibs="$newdeplibs $i"
2591 set dummy $deplibs_check_method
2592 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2593 for a_deplib in $deplibs; do
2594 name="`expr $a_deplib : '-l\(.*\)'`"
2595 # If $name is empty we are operating on a -L argument.
2596 if test -n "$name" && test "$name" != "0"; then
2597 libname=`eval \\$echo \"$libname_spec\"`
2598 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2599 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2600 for potent_lib in $potential_libs; do
2601 # Follow soft links.
2602 if ls -lLd "$potent_lib" 2>/dev/null \
2603 | grep " -> " >/dev/null; then
2606 # The statement above tries to avoid entering an
2607 # endless loop below, in case of cyclic links.
2608 # We might still enter an endless loop, since a link
2609 # loop can be closed while we follow links,
2611 potlib="$potent_lib"
2612 while test -h "$potlib" 2>/dev/null; do
2613 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2615 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2616 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2619 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2621 | egrep "$file_magic_regex" > /dev/null; then
2622 newdeplibs="$newdeplibs $a_deplib"
2628 if test -n "$a_deplib" ; then
2631 echo "*** Warning: linker path does not have real file for library $a_deplib."
2632 echo "*** I have the capability to make that library automatically link in when"
2633 echo "*** you link to this library. But I can only do this if you have a"
2634 echo "*** shared version of the library, which you do not appear to have"
2635 echo "*** because I did check the linker path looking for a file starting"
2636 if test -z "$potlib" ; then
2637 echo "*** with $libname but no candidates were found. (...for file magic test)"
2639 echo "*** with $libname and none of the candidates passed a file format test"
2640 echo "*** using a file magic. Last file checked: $potlib"
2644 # Add a -L argument.
2645 newdeplibs="$newdeplibs $a_deplib"
2647 done # Gone through all deplibs.
2650 set dummy $deplibs_check_method
2651 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2652 for a_deplib in $deplibs; do
2653 name="`expr $a_deplib : '-l\(.*\)'`"
2654 # If $name is empty we are operating on a -L argument.
2655 if test -n "$name" && test "$name" != "0"; then
2656 libname=`eval \\$echo \"$libname_spec\"`
2657 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2658 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2659 for potent_lib in $potential_libs; do
2660 potlib="$potent_lib" # see symlink-check below in file_magic test
2661 if eval echo \"$potent_lib\" 2>/dev/null \
2663 | egrep "$match_pattern_regex" > /dev/null; then
2664 newdeplibs="$newdeplibs $a_deplib"
2670 if test -n "$a_deplib" ; then
2673 echo "*** Warning: linker path does not have real file for library $a_deplib."
2674 echo "*** I have the capability to make that library automatically link in when"
2675 echo "*** you link to this library. But I can only do this if you have a"
2676 echo "*** shared version of the library, which you do not appear to have"
2677 echo "*** because I did check the linker path looking for a file starting"
2678 if test -z "$potlib" ; then
2679 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2681 echo "*** with $libname and none of the candidates passed a file format test"
2682 echo "*** using a regex pattern. Last file checked: $potlib"
2686 # Add a -L argument.
2687 newdeplibs="$newdeplibs $a_deplib"
2689 done # Gone through all deplibs.
2693 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2694 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2695 grep . >/dev/null; then
2697 if test "X$deplibs_check_method" = "Xnone"; then
2698 echo "*** Warning: inter-library dependencies are not supported in this platform."
2700 echo "*** Warning: inter-library dependencies are not known to be supported."
2702 echo "*** All declared inter-library dependencies are being dropped."
2707 versuffix=$versuffix_save
2709 release=$release_save
2710 libname=$libname_save
2714 *-*-rhapsody* | *-*-darwin1.[012])
2715 # On Rhapsody replace the C library is the System framework
2716 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2720 if test "$droppeddeps" = yes; then
2721 if test "$module" = yes; then
2723 echo "*** Warning: libtool could not satisfy all declared inter-library"
2724 echo "*** dependencies of module $libname. Therefore, libtool will create"
2725 echo "*** a static module, that should work as long as the dlopening"
2726 echo "*** application is linked with the -dlopen flag."
2727 if test -z "$global_symbol_pipe"; then
2729 echo "*** However, this would only work if libtool was able to extract symbol"
2730 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2731 echo "*** not find such a program. So, this module is probably useless."
2732 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2734 if test "$build_old_libs" = no; then
2735 oldlibs="$output_objdir/$libname.$libext"
2736 build_libtool_libs=module
2739 build_libtool_libs=no
2742 echo "*** The inter-library dependencies that have been dropped here will be"
2743 echo "*** automatically added whenever a program is linked with this library"
2744 echo "*** or is declared to -dlopen it."
2746 if test $allow_undefined = no; then
2748 echo "*** Since this library must not contain undefined symbols,"
2749 echo "*** because either the platform does not support them or"
2750 echo "*** it was explicitly requested with -no-undefined,"
2751 echo "*** libtool will only create a static version of it."
2752 if test "$build_old_libs" = no; then
2753 oldlibs="$output_objdir/$libname.$libext"
2754 build_libtool_libs=module
2757 build_libtool_libs=no
2762 # Done checking deplibs!
2766 # All the library-specific variables (install_libdir is set above).
2771 # Test again, we may have decided not to build it any more
2772 if test "$build_libtool_libs" = yes; then
2773 if test $hardcode_into_libs = yes; then
2774 # Hardcode the library paths
2777 rpath="$finalize_rpath"
2778 test "$mode" != relink && rpath="$compile_rpath$rpath"
2779 for libdir in $rpath; do
2780 if test -n "$hardcode_libdir_flag_spec"; then
2781 if test -n "$hardcode_libdir_separator"; then
2782 if test -z "$hardcode_libdirs"; then
2783 hardcode_libdirs="$libdir"
2785 # Just accumulate the unique libdirs.
2786 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2787 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2790 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2795 eval flag=\"$hardcode_libdir_flag_spec\"
2796 dep_rpath="$dep_rpath $flag"
2798 elif test -n "$runpath_var"; then
2799 case "$perm_rpath " in
2801 *) perm_rpath="$perm_rpath $libdir" ;;
2805 # Substitute the hardcoded libdirs into the rpath.
2806 if test -n "$hardcode_libdir_separator" &&
2807 test -n "$hardcode_libdirs"; then
2808 libdir="$hardcode_libdirs"
2809 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2811 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2812 # We should set the runpath_var.
2814 for dir in $perm_rpath; do
2817 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2819 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2822 shlibpath="$finalize_shlibpath"
2823 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2824 if test -n "$shlibpath"; then
2825 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2828 # Get the real and link names of the library.
2829 eval library_names=\"$library_names_spec\"
2830 set dummy $library_names
2834 if test -n "$soname_spec"; then
2835 eval soname=\"$soname_spec\"
2839 test -z "$dlname" && dlname=$soname
2841 lib="$output_objdir/$realname"
2844 linknames="$linknames $link"
2847 # Ensure that we have .o objects for linkers which dislike .lo
2848 # (e.g. aix) in case we are running --disable-static
2849 for obj in $libobjs; do
2850 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2851 if test "X$xdir" = "X$obj"; then
2856 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2857 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2858 if test ! -f $xdir/$oldobj; then
2859 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2860 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2864 # Use standard objects if they are pic
2865 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2867 # Prepare the list of exported symbols
2868 if test -z "$export_symbols"; then
2869 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2870 $show "generating symbol list for \`$libname.la'"
2871 export_symbols="$output_objdir/$libname.exp"
2872 $run $rm $export_symbols
2873 eval cmds=\"$export_symbols_cmds\"
2874 save_ifs="$IFS"; IFS='~'
2875 for cmd in $cmds; do
2878 $run eval "$cmd" || exit $?
2881 if test -n "$export_symbols_regex"; then
2882 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2883 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2884 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2885 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2890 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2891 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2894 if test -n "$convenience"; then
2895 if test -n "$whole_archive_flag_spec"; then
2896 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2898 gentop="$output_objdir/${outputname}x"
2899 $show "${rm}r $gentop"
2900 $run ${rm}r "$gentop"
2901 $show "mkdir $gentop"
2902 $run mkdir "$gentop"
2904 if test $status -ne 0 && test ! -d "$gentop"; then
2907 generated="$generated $gentop"
2909 for xlib in $convenience; do
2910 # Extract the objects.
2912 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2913 *) xabs=`pwd`"/$xlib" ;;
2915 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2916 xdir="$gentop/$xlib"
2918 $show "${rm}r $xdir"
2923 if test $status -ne 0 && test ! -d "$xdir"; then
2926 $show "(cd $xdir && $AR x $xabs)"
2927 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2929 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2934 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2935 eval flag=\"$thread_safe_flag_spec\"
2936 linker_flags="$linker_flags $flag"
2939 # Make a backup of the uninstalled library when relinking
2940 if test "$mode" = relink; then
2941 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2944 # Do each of the archive commands.
2945 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2946 eval cmds=\"$archive_expsym_cmds\"
2948 save_deplibs="$deplibs"
2949 for conv in $convenience; do
2951 for test_deplib in $deplibs; do
2952 if test "$test_deplib" != "$conv"; then
2953 tmp_deplibs="$tmp_deplibs $test_deplib"
2956 deplibs="$tmp_deplibs"
2958 eval cmds=\"$archive_cmds\"
2959 deplibs="$save_deplibs"
2961 save_ifs="$IFS"; IFS='~'
2962 for cmd in $cmds; do
2965 $run eval "$cmd" || exit $?
2969 # Restore the uninstalled library and exit
2970 if test "$mode" = relink; then
2971 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2975 # Create links to the real library.
2976 for linkname in $linknames; do
2977 if test "$realname" != "$linkname"; then
2978 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2979 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2983 # If -module or -export-dynamic was specified, set the dlname.
2984 if test "$module" = yes || test "$export_dynamic" = yes; then
2985 # On all known operating systems, these are identical.
2992 if test -n "$deplibs"; then
2993 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
2996 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2997 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3000 if test -n "$rpath"; then
3001 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3004 if test -n "$xrpath"; then
3005 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3008 if test -n "$vinfo"; then
3009 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3012 if test -n "$release"; then
3013 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3018 if test -n "$objs$old_deplibs"; then
3019 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3023 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3031 # Delete the old objects.
3032 $run $rm $obj $libobj
3034 # Objects from convenience libraries. This assumes
3035 # single-version convenience libraries. Whenever we create
3036 # different ones for PIC/non-PIC, this we'll have to duplicate
3040 # reload_cmds runs $LD directly, so let us get rid of
3041 # -Wl from whole_archive_flag_spec
3044 if test -n "$convenience"; then
3045 if test -n "$whole_archive_flag_spec"; then
3046 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3048 gentop="$output_objdir/${obj}x"
3049 $show "${rm}r $gentop"
3050 $run ${rm}r "$gentop"
3051 $show "mkdir $gentop"
3052 $run mkdir "$gentop"
3054 if test $status -ne 0 && test ! -d "$gentop"; then
3057 generated="$generated $gentop"
3059 for xlib in $convenience; do
3060 # Extract the objects.
3062 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3063 *) xabs=`pwd`"/$xlib" ;;
3065 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3066 xdir="$gentop/$xlib"
3068 $show "${rm}r $xdir"
3073 if test $status -ne 0 && test ! -d "$xdir"; then
3076 $show "(cd $xdir && $AR x $xabs)"
3077 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3079 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3084 # Create the old-style object.
3085 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
3088 eval cmds=\"$reload_cmds\"
3089 save_ifs="$IFS"; IFS='~'
3090 for cmd in $cmds; do
3093 $run eval "$cmd" || exit $?
3097 # Exit if we aren't doing a library object file.
3098 if test -z "$libobj"; then
3099 if test -n "$gentop"; then
3100 $show "${rm}r $gentop"
3107 if test "$build_libtool_libs" != yes; then
3108 if test -n "$gentop"; then
3109 $show "${rm}r $gentop"
3113 # Create an invalid libtool object if no PIC, so that we don't
3114 # accidentally link it into a program.
3115 $show "echo timestamp > $libobj"
3116 $run eval "echo timestamp > $libobj" || exit $?
3120 if test -n "$pic_flag" || test "$pic_mode" != default; then
3121 # Only do commands if we really have different PIC objects.
3122 reload_objs="$libobjs $reload_conv_objs"
3124 eval cmds=\"$reload_cmds\"
3125 save_ifs="$IFS"; IFS='~'
3126 for cmd in $cmds; do
3129 $run eval "$cmd" || exit $?
3133 # Just create a symlink.
3136 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3137 if test "X$xdir" = "X$libobj"; then
3142 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3143 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3144 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3145 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3148 if test -n "$gentop"; then
3149 $show "${rm}r $gentop"
3158 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3160 if test -n "$vinfo"; then
3161 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3164 if test -n "$release"; then
3165 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3168 if test "$preload" = yes; then
3169 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3170 test "$dlopen_self_static" = unknown; then
3171 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3176 *-*-rhapsody* | *-*-darwin1.[012])
3177 # On Rhapsody replace the C library is the System framework
3178 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3179 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3182 # Don't allow lazy linking, it breaks C++ global constructors
3183 compile_command="$compile_command ${wl}-bind_at_load"
3184 finalize_command="$finalize_command ${wl}-bind_at_load"
3190 compile_command="$compile_command $compile_deplibs"
3191 finalize_command="$finalize_command $finalize_deplibs"
3193 if test -n "$rpath$xrpath"; then
3194 # If the user specified any rpath flags, then add them.
3195 for libdir in $rpath $xrpath; do
3196 # This is the magic to use -rpath.
3197 case "$finalize_rpath " in
3199 *) finalize_rpath="$finalize_rpath $libdir" ;;
3204 # Now hardcode the library paths
3207 for libdir in $compile_rpath $finalize_rpath; do
3208 if test -n "$hardcode_libdir_flag_spec"; then
3209 if test -n "$hardcode_libdir_separator"; then
3210 if test -z "$hardcode_libdirs"; then
3211 hardcode_libdirs="$libdir"
3213 # Just accumulate the unique libdirs.
3214 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3215 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3218 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3223 eval flag=\"$hardcode_libdir_flag_spec\"
3224 rpath="$rpath $flag"
3226 elif test -n "$runpath_var"; then
3227 case "$perm_rpath " in
3229 *) perm_rpath="$perm_rpath $libdir" ;;
3233 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3234 case :$dllsearchpath: in
3236 *) dllsearchpath="$dllsearchpath:$libdir";;
3241 # Substitute the hardcoded libdirs into the rpath.
3242 if test -n "$hardcode_libdir_separator" &&
3243 test -n "$hardcode_libdirs"; then
3244 libdir="$hardcode_libdirs"
3245 eval rpath=\" $hardcode_libdir_flag_spec\"
3247 compile_rpath="$rpath"
3251 for libdir in $finalize_rpath; do
3252 if test -n "$hardcode_libdir_flag_spec"; then
3253 if test -n "$hardcode_libdir_separator"; then
3254 if test -z "$hardcode_libdirs"; then
3255 hardcode_libdirs="$libdir"
3257 # Just accumulate the unique libdirs.
3258 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3259 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3262 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3267 eval flag=\"$hardcode_libdir_flag_spec\"
3268 rpath="$rpath $flag"
3270 elif test -n "$runpath_var"; then
3271 case "$finalize_perm_rpath " in
3273 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3277 # Substitute the hardcoded libdirs into the rpath.
3278 if test -n "$hardcode_libdir_separator" &&
3279 test -n "$hardcode_libdirs"; then
3280 libdir="$hardcode_libdirs"
3281 eval rpath=\" $hardcode_libdir_flag_spec\"
3283 finalize_rpath="$rpath"
3285 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3286 # Transform all the library objects into standard objects.
3287 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3288 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3292 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3293 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3294 dlsyms="${outputname}S.c"
3296 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3300 if test -n "$dlsyms"; then
3304 # Discover the nlist of each of the dlfiles.
3305 nlist="$output_objdir/${outputname}.nm"
3307 $show "$rm $nlist ${nlist}S ${nlist}T"
3308 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3310 # Parse the name list into a source file.
3311 $show "creating $output_objdir/$dlsyms"
3313 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3314 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3315 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3321 /* Prevent the only kind of declaration conflicts we can make. */
3322 #define lt_preloaded_symbols some_other_symbol
3324 /* External symbol declarations for the compiler. */\
3327 if test "$dlself" = yes; then
3328 $show "generating symbol list for \`$output'"
3330 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3332 # Add our own program objects to the symbol list.
3333 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3334 for arg in $progfiles; do
3335 $show "extracting global C symbols from \`$arg'"
3336 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3339 if test -n "$exclude_expsyms"; then
3340 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3341 $run eval '$mv "$nlist"T "$nlist"'
3344 if test -n "$export_symbols_regex"; then
3345 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3346 $run eval '$mv "$nlist"T "$nlist"'
3349 # Prepare the list of exported symbols
3350 if test -z "$export_symbols"; then
3351 export_symbols="$output_objdir/$output.exp"
3352 $run $rm $export_symbols
3353 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3355 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3356 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3357 $run eval 'mv "$nlist"T "$nlist"'
3361 for arg in $dlprefiles; do
3362 $show "extracting global C symbols from \`$arg'"
3363 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3364 $run eval 'echo ": $name " >> "$nlist"'
3365 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3368 if test -z "$run"; then
3369 # Make sure we have at least an empty file.
3370 test -f "$nlist" || : > "$nlist"
3372 if test -n "$exclude_expsyms"; then
3373 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3374 $mv "$nlist"T "$nlist"
3377 # Try sorting and uniquifying the output.
3378 if grep -v "^: " < "$nlist" |
3379 if sort -k 3 </dev/null >/dev/null 2>&1; then
3384 uniq > "$nlist"S; then
3387 grep -v "^: " < "$nlist" > "$nlist"S
3390 if test -f "$nlist"S; then
3391 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3393 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3396 $echo >> "$output_objdir/$dlsyms" "\
3398 #undef lt_preloaded_symbols
3400 #if defined (__STDC__) && __STDC__
3401 # define lt_ptr void *
3403 # define lt_ptr char *
3407 /* The mapping between symbol names and symbols. */
3412 lt_preloaded_symbols[] =
3416 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3418 $echo >> "$output_objdir/$dlsyms" "\
3422 /* This works around a problem in FreeBSD linker */
3423 #ifdef FREEBSD_WORKAROUND
3424 static const void *lt_preloaded_setup() {
3425 return lt_preloaded_symbols;
3435 pic_flag_for_symtable=
3437 # compiling the symbol table file with pic_flag works around
3438 # a FreeBSD bug that causes programs to crash when -lm is
3439 # linked before any other PIC object. But we must not use
3440 # pic_flag when linking with -static. The problem exists in
3441 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3442 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3443 case "$compile_command " in
3445 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3448 case "$compile_command " in
3450 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3454 # Now compile the dynamic symbol file.
3455 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3456 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3458 # Clean up the generated files.
3459 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3460 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3462 # Transform the symbol file into the correct name.
3463 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3464 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3467 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3472 # We keep going just in case the user didn't refer to
3473 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3474 # really was required.
3476 # Nullify the symbol file.
3477 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3478 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3481 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3482 # Replace the output file specification.
3483 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3484 link_command="$compile_command$compile_rpath"
3486 # We have no uninstalled library dependencies, so finalize right now.
3487 $show "$link_command"
3488 $run eval "$link_command"
3491 # Delete the generated files.
3492 if test -n "$dlsyms"; then
3493 $show "$rm $output_objdir/${outputname}S.${objext}"
3494 $run $rm "$output_objdir/${outputname}S.${objext}"
3500 if test -n "$shlibpath_var"; then
3501 # We should set the shlibpath_var
3503 for dir in $temp_rpath; do
3505 [\\/]* | [A-Za-z]:[\\/]*)
3510 # Relative path: add a thisdir entry.
3511 rpath="$rpath\$thisdir/$dir:"
3518 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3519 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3521 if test -n "$finalize_shlibpath"; then
3522 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3527 if test -n "$runpath_var"; then
3528 if test -n "$perm_rpath"; then
3529 # We should set the runpath_var.
3531 for dir in $perm_rpath; do
3534 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3536 if test -n "$finalize_perm_rpath"; then
3537 # We should set the runpath_var.
3539 for dir in $finalize_perm_rpath; do
3542 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3546 if test "$no_install" = yes; then
3547 # We don't need to create a wrapper script.
3548 link_command="$compile_var$compile_command$compile_rpath"
3549 # Replace the output file specification.
3550 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3551 # Delete the old output file.
3553 # Link the executable and exit
3554 $show "$link_command"
3555 $run eval "$link_command" || exit $?
3559 if test "$hardcode_action" = relink; then
3560 # Fast installation is not supported
3561 link_command="$compile_var$compile_command$compile_rpath"
3562 relink_command="$finalize_var$finalize_command$finalize_rpath"
3564 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3565 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3567 if test "$fast_install" != no; then
3568 link_command="$finalize_var$compile_command$finalize_rpath"
3569 if test "$fast_install" = yes; then
3570 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3572 # fast_install is set to needless
3576 link_command="$compile_var$compile_command$compile_rpath"
3577 relink_command="$finalize_var$finalize_command$finalize_rpath"
3581 # Replace the output file specification.
3582 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3584 # Delete the old output files.
3585 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3587 $show "$link_command"
3588 $run eval "$link_command" || exit $?
3590 # Now create the wrapper script.
3591 $show "creating $output"
3593 # Quote the relink command for shipping.
3594 if test -n "$relink_command"; then
3595 # Preserve any variables that may affect compiler behavior
3596 for var in $variables_saved_for_relink; do
3597 if eval test -z \"\${$var+set}\"; then
3598 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3599 elif eval var_value=\$$var; test -z "$var_value"; then
3600 relink_command="$var=; export $var; $relink_command"
3602 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3603 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3606 relink_command="(cd `pwd`; $relink_command)"
3607 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3610 # Quote $echo for shipping.
3611 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3613 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3614 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3616 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3618 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3621 # Only actually do things if our run command is non-null.
3622 if test -z "$run"; then
3623 # win32 will think the script is a binary if it has
3624 # a .exe suffix, so we strip it off here.
3626 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3628 # test for cygwin because mv fails w/o .exe extensions
3630 *cygwin*) exeext=.exe ;;
3634 trap "$rm $output; exit 1" 1 2 15
3639 # $output - temporary wrapper script for $objdir/$outputname
3640 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3642 # The $output program cannot be directly executed until all the libtool
3643 # libraries that it depends on are installed.
3645 # This wrapper script should never be moved out of the build directory.
3646 # If it is, it will not operate correctly.
3648 # Sed substitution that helps us do robust quoting. It backslashifies
3649 # metacharacters that are still active within double-quoted strings.
3650 Xsed="${SED}"' -e 1s/^X//'
3651 sed_quote_subst='$sed_quote_subst'
3653 # The HP-UX ksh and POSIX shell print the target directory to stdout
3655 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3657 relink_command=\"$relink_command\"
3659 # This environment variable determines our operation mode.
3660 if test \"\$libtool_install_magic\" = \"$magic\"; then
3661 # install mode needs the following variable:
3662 notinst_deplibs='$notinst_deplibs'
3664 # When we are sourced in execute mode, \$file and \$echo are already set.
3665 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3668 # Make sure echo works.
3669 if test \"X\$1\" = X--no-reexec; then
3670 # Discard the --no-reexec flag, and continue.
3672 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3673 # Yippee, \$echo works!
3676 # Restart under the correct shell, and then maybe \$echo will work.
3677 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3683 # Find the directory that this script lives in.
3684 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3685 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3687 # Follow symbolic links until we get to the real thisdir.
3688 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3689 while test -n \"\$file\"; do
3690 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3692 # If there was a directory component, then change thisdir.
3693 if test \"x\$destdir\" != \"x\$file\"; then
3694 case \"\$destdir\" in
3695 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3696 *) thisdir=\"\$thisdir/\$destdir\" ;;
3700 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3701 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3704 # Try to get the absolute directory name.
3705 absdir=\`cd \"\$thisdir\" && pwd\`
3706 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3709 if test "$fast_install" = yes; then
3711 program=lt-'$outputname'$exeext
3712 progdir=\"\$thisdir/$objdir\"
3714 if test ! -f \"\$progdir/\$program\" || \\
3715 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3716 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3718 file=\"\$\$-\$program\"
3720 if test ! -d \"\$progdir\"; then
3721 $mkdir \"\$progdir\"
3723 $rm \"\$progdir/\$file\"
3728 # relink executable if necessary
3729 if test -n \"\$relink_command\"; then
3730 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3732 $echo \"\$relink_command_output\" >&2
3733 $rm \"\$progdir/\$file\"
3738 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3739 { $rm \"\$progdir/\$program\";
3740 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3741 $rm \"\$progdir/\$file\"
3745 program='$outputname'
3746 progdir=\"\$thisdir/$objdir\"
3752 if test -f \"\$progdir/\$program\"; then"
3754 # Export our shlibpath_var if we have one.
3755 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3757 # Add our own library path to $shlibpath_var
3758 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3760 # Some systems cannot cope with colon-terminated $shlibpath_var
3761 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3762 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3764 export $shlibpath_var
3768 # fixup the dll searchpath if we need to.
3769 if test -n "$dllsearchpath"; then
3771 # Add the dll search path components to the executable PATH
3772 PATH=$dllsearchpath:\$PATH
3777 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3778 # Run the actual program with our arguments.
3781 # win32 systems need to use the prog path for dll
3783 *-*-cygwin* | *-*-pw32*)
3785 exec \$progdir/\$program \${1+\"\$@\"}
3789 # Backslashes separate directories on plain windows
3790 *-*-mingw | *-*-os2*)
3792 exec \$progdir\\\\\$program \${1+\"\$@\"}
3798 # Export the path to the program.
3799 PATH=\"\$progdir:\$PATH\"
3802 exec \$program \${1+\"\$@\"}
3807 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3811 # The program doesn't exist.
3812 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3813 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3814 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3825 # See if we need to build an old-fashioned archive.
3826 for oldlib in $oldlibs; do
3828 if test "$build_libtool_libs" = convenience; then
3829 oldobjs="$libobjs_save"
3830 addlibs="$convenience"
3831 build_libtool_libs=no
3833 if test "$build_libtool_libs" = module; then
3834 oldobjs="$libobjs_save"
3835 build_libtool_libs=no
3837 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3839 addlibs="$old_convenience"
3842 if test -n "$addlibs"; then
3843 gentop="$output_objdir/${outputname}x"
3844 $show "${rm}r $gentop"
3845 $run ${rm}r "$gentop"
3846 $show "mkdir $gentop"
3847 $run mkdir "$gentop"
3849 if test $status -ne 0 && test ! -d "$gentop"; then
3852 generated="$generated $gentop"
3854 # Add in members from convenience archives.
3855 for xlib in $addlibs; do
3856 # Extract the objects.
3858 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3859 *) xabs=`pwd`"/$xlib" ;;
3861 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3862 xdir="$gentop/$xlib"
3864 $show "${rm}r $xdir"
3869 if test $status -ne 0 && test ! -d "$xdir"; then
3872 $show "(cd $xdir && $AR x $xabs)"
3873 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3875 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3879 # Do each command in the archive commands.
3880 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3881 eval cmds=\"$old_archive_from_new_cmds\"
3883 # Ensure that we have .o objects in place in case we decided
3884 # not to build a shared library, and have fallen back to building
3885 # static libs even though --disable-static was passed!
3886 for oldobj in $oldobjs; do
3887 if test ! -f $oldobj; then
3888 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3889 if test "X$xdir" = "X$oldobj"; then
3894 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3895 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3896 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3897 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3901 eval cmds=\"$old_archive_cmds\"
3903 save_ifs="$IFS"; IFS='~'
3904 for cmd in $cmds; do
3907 $run eval "$cmd" || exit $?
3912 if test -n "$generated"; then
3913 $show "${rm}r$generated"
3914 $run ${rm}r$generated
3917 # Now create the libtool archive.
3921 test "$build_old_libs" = yes && old_library="$libname.$libext"
3922 $show "creating $output"
3924 # Preserve any variables that may affect compiler behavior
3925 for var in $variables_saved_for_relink; do
3926 if eval test -z \"\${$var+set}\"; then
3927 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3928 elif eval var_value=\$$var; test -z "$var_value"; then
3929 relink_command="$var=; export $var; $relink_command"
3931 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3932 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3935 # Quote the link command for shipping.
3936 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3937 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3939 # Only create the output if not a dry run.
3940 if test -z "$run"; then
3941 for installed in no yes; do
3942 if test "$installed" = yes; then
3943 if test -z "$install_libdir"; then
3946 output="$output_objdir/$outputname"i
3947 # Replace all uninstalled libtool libraries with the installed ones
3949 for deplib in $dependency_libs; do
3952 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3953 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3954 if test -z "$libdir"; then
3955 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3958 newdependency_libs="$newdependency_libs $libdir/$name"
3960 *) newdependency_libs="$newdependency_libs $deplib" ;;
3963 dependency_libs="$newdependency_libs"
3965 for lib in $dlfiles; do
3966 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3967 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3968 if test -z "$libdir"; then
3969 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3972 newdlfiles="$newdlfiles $libdir/$name"
3974 dlfiles="$newdlfiles"
3976 for lib in $dlprefiles; do
3977 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3978 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3979 if test -z "$libdir"; then
3980 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3983 newdlprefiles="$newdlprefiles $libdir/$name"
3985 dlprefiles="$newdlprefiles"
3988 # place dlname in correct position for cygwin
3990 case $host,$output,$installed,$module,$dlname in
3991 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
3994 # $outputname - a libtool library file
3995 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3997 # Please DO NOT delete this file!
3998 # It is necessary for linking the library.
4000 # The name that we can dlopen(3).
4003 # Names of this library.
4004 library_names='$library_names'
4006 # The name of the static archive.
4007 old_library='$old_library'
4009 # Libraries that this one depends upon.
4010 dependency_libs='$dependency_libs'
4012 # Version information for $libname.
4017 # Is this an already installed library?
4018 installed=$installed
4020 # Files to dlopen/dlpreopen
4022 dlpreopen='$dlprefiles'
4024 # Directory that this library needs to be installed in:
4025 libdir='$install_libdir'"
4026 if test "$installed" = no && test $need_relink = yes; then
4028 relink_command=\"$relink_command\""
4033 # Do a symbolic link so that the libtool archive can be found in
4034 # LD_LIBRARY_PATH before the program is installed.
4035 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4036 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4042 # libtool install mode
4044 modename="$modename: install"
4046 # There may be an optional sh(1) argument at the beginning of
4047 # install_prog (especially on Windows NT).
4048 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4049 # Allow the use of GNU shtool's install command.
4050 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4051 # Aesthetically quote it.
4052 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4054 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4058 install_prog="$arg "
4066 # The real first argument should be the name of the installation program.
4067 # Aesthetically quote it.
4068 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4070 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4074 install_prog="$install_prog$arg"
4076 # We need to accept at least all the BSD install flags.
4086 if test -n "$dest"; then
4087 files="$files $dest"
4105 # If the previous option needed an argument, then skip it.
4106 if test -n "$prev"; then
4115 # Aesthetically quote the argument.
4116 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4118 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4122 install_prog="$install_prog $arg"
4125 if test -z "$install_prog"; then
4126 $echo "$modename: you must specify an install program" 1>&2
4131 if test -n "$prev"; then
4132 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4137 if test -z "$files"; then
4138 if test -z "$dest"; then
4139 $echo "$modename: no file or destination specified" 1>&2
4141 $echo "$modename: you must specify a destination" 1>&2
4147 # Strip any trailing slash from the destination.
4148 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4150 # Check to see that the destination is a directory.
4151 test -d "$dest" && isdir=yes
4152 if test "$isdir" = yes; then
4156 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4157 test "X$destdir" = "X$dest" && destdir=.
4158 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4160 # Not a directory, so check to see that there is only one file specified.
4162 if test $# -gt 2; then
4163 $echo "$modename: \`$dest' is not a directory" 1>&2
4169 [\\/]* | [A-Za-z]:[\\/]*) ;;
4171 for file in $files; do
4175 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4184 # This variable tells wrapper scripts just to set variables rather
4185 # than running their programs.
4186 libtool_install_magic="$magic"
4191 for file in $files; do
4193 # Do each installation.
4196 # Do the static libraries later.
4197 staticlibs="$staticlibs $file"
4201 # Check to see that this really is a libtool archive.
4202 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4204 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4212 # If there is no directory component, then add one.
4214 */* | *\\*) . $file ;;
4218 # Add the libdir to current_libdirs if it is the destination.
4219 if test "X$destdir" = "X$libdir"; then
4220 case "$current_libdirs " in
4222 *) current_libdirs="$current_libdirs $libdir" ;;
4225 # Note the libdir as a future libdir.
4226 case "$future_libdirs " in
4228 *) future_libdirs="$future_libdirs $libdir" ;;
4232 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4233 test "X$dir" = "X$file/" && dir=
4236 if test -n "$relink_command"; then
4237 $echo "$modename: warning: relinking \`$file'" 1>&2
4238 $show "$relink_command"
4239 if $run eval "$relink_command"; then :
4241 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4246 # See the names of the shared library.
4247 set dummy $library_names
4248 if test -n "$2"; then
4254 test -n "$relink_command" && srcname="$realname"T
4256 # Install the shared library and build the symlinks.
4257 $show "$install_prog $dir/$srcname $destdir/$realname"
4258 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4259 if test -n "$stripme" && test -n "$striplib"; then
4260 $show "$striplib $destdir/$realname"
4261 $run eval "$striplib $destdir/$realname" || exit $?
4264 if test $# -gt 0; then
4265 # Delete the old symlinks, and create new ones.
4268 if test "$linkname" != "$realname"; then
4269 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4270 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4275 # Do each command in the postinstall commands.
4276 lib="$destdir/$realname"
4277 eval cmds=\"$postinstall_cmds\"
4278 save_ifs="$IFS"; IFS='~'
4279 for cmd in $cmds; do
4282 $run eval "$cmd" || exit $?
4287 # Install the pseudo-library for information purposes.
4288 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4289 instname="$dir/$name"i
4290 $show "$install_prog $instname $destdir/$name"
4291 $run eval "$install_prog $instname $destdir/$name" || exit $?
4293 # Maybe install the static library, too.
4294 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4298 # Install (i.e. copy) a libtool object.
4300 # Figure out destination file name, if it wasn't already specified.
4301 if test -n "$destname"; then
4302 destfile="$destdir/$destname"
4304 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4305 destfile="$destdir/$destfile"
4308 # Deduce the name of the destination old-style object file.
4311 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4314 staticdest="$destfile"
4318 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4324 # Install the libtool object if requested.
4325 if test -n "$destfile"; then
4326 $show "$install_prog $file $destfile"
4327 $run eval "$install_prog $file $destfile" || exit $?
4330 # Install the old object if enabled.
4331 if test "$build_old_libs" = yes; then
4332 # Deduce the name of the old-style object file.
4333 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4335 $show "$install_prog $staticobj $staticdest"
4336 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4342 # Figure out destination file name, if it wasn't already specified.
4343 if test -n "$destname"; then
4344 destfile="$destdir/$destname"
4346 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4347 destfile="$destdir/$destfile"
4350 # Do a test to see if this is really a libtool program.
4353 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4359 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4363 # If there is no directory component, then add one.
4365 */* | *\\*) . $wrapper ;;
4369 # Check the variables that should have been set.
4370 if test -z "$notinst_deplibs"; then
4371 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4376 for lib in $notinst_deplibs; do
4377 # Check to see that each library is installed.
4379 if test -f "$lib"; then
4380 # If there is no directory component, then add one.
4382 */* | *\\*) . $lib ;;
4386 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4387 if test -n "$libdir" && test ! -f "$libfile"; then
4388 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4394 # If there is no directory component, then add one.
4396 */* | *\\*) . $wrapper ;;
4401 if test "$fast_install" = no && test -n "$relink_command"; then
4402 if test "$finalize" = yes && test -z "$run"; then
4404 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4405 tmpdir="$tmpdir/libtool-$$"
4406 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4408 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4411 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4412 outputname="$tmpdir/$file"
4413 # Replace the output file specification.
4414 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4416 $show "$relink_command"
4417 if $run eval "$relink_command"; then :
4419 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4425 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4428 # Install the binary that we compiled earlier.
4429 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4433 # remove .exe since cygwin /usr/bin/install will append another
4435 case $install_prog,$host in
4436 /usr/bin/install*,*cygwin*)
4437 case $file:$destfile in
4442 destfile=$destfile.exe
4445 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4450 $show "$install_prog$stripme $file $destfile"
4451 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4452 test -n "$outputname" && ${rm}r "$tmpdir"
4457 for file in $staticlibs; do
4458 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4460 # Set up the ranlib parameters.
4461 oldlib="$destdir/$name"
4463 $show "$install_prog $file $oldlib"
4464 $run eval "$install_prog \$file \$oldlib" || exit $?
4466 if test -n "$stripme" && test -n "$striplib"; then
4467 $show "$old_striplib $oldlib"
4468 $run eval "$old_striplib $oldlib" || exit $?
4471 # Do each command in the postinstall commands.
4472 eval cmds=\"$old_postinstall_cmds\"
4473 save_ifs="$IFS"; IFS='~'
4474 for cmd in $cmds; do
4477 $run eval "$cmd" || exit $?
4482 if test -n "$future_libdirs"; then
4483 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4486 if test -n "$current_libdirs"; then
4487 # Maybe just do a dry run.
4488 test -n "$run" && current_libdirs=" -n$current_libdirs"
4489 exec_cmd='$SHELL $0 --finish$current_libdirs'
4495 # libtool finish mode
4497 modename="$modename: finish"
4501 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4504 libdirs="$libdirs $dir"
4507 for libdir in $libdirs; do
4508 if test -n "$finish_cmds"; then
4509 # Do each command in the finish commands.
4510 eval cmds=\"$finish_cmds\"
4511 save_ifs="$IFS"; IFS='~'
4512 for cmd in $cmds; do
4515 $run eval "$cmd" || admincmds="$admincmds
4520 if test -n "$finish_eval"; then
4521 # Do the single finish_eval.
4522 eval cmds=\"$finish_eval\"
4523 $run eval "$cmds" || admincmds="$admincmds
4529 # Exit here if they wanted silent mode.
4530 test "$show" = ":" && exit 0
4532 echo "----------------------------------------------------------------------"
4533 echo "Libraries have been installed in:"
4534 for libdir in $libdirs; do
4538 echo "If you ever happen to want to link against installed libraries"
4539 echo "in a given directory, LIBDIR, you must either use libtool, and"
4540 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4541 echo "flag during linking and do at least one of the following:"
4542 if test -n "$shlibpath_var"; then
4543 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4544 echo " during execution"
4546 if test -n "$runpath_var"; then
4547 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4548 echo " during linking"
4550 if test -n "$hardcode_libdir_flag_spec"; then
4552 eval flag=\"$hardcode_libdir_flag_spec\"
4554 echo " - use the \`$flag' linker flag"
4556 if test -n "$admincmds"; then
4557 echo " - have your system administrator run these commands:$admincmds"
4559 if test -f /etc/ld.so.conf; then
4560 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4563 echo "See any operating system documentation about shared libraries for"
4564 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4565 echo "----------------------------------------------------------------------"
4569 # libtool execute mode
4571 modename="$modename: execute"
4573 # The first argument is the command name.
4575 if test -z "$cmd"; then
4576 $echo "$modename: you must specify a COMMAND" 1>&2
4581 # Handle -dlopen flags immediately.
4582 for file in $execute_dlfiles; do
4583 if test ! -f "$file"; then
4584 $echo "$modename: \`$file' is not a file" 1>&2
4592 # Check to see that this really is a libtool archive.
4593 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4595 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4600 # Read the libtool library.
4604 # If there is no directory component, then add one.
4606 */* | *\\*) . $file ;;
4610 # Skip this library if it cannot be dlopened.
4611 if test -z "$dlname"; then
4612 # Warn if it was a shared library.
4613 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4617 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4618 test "X$dir" = "X$file" && dir=.
4620 if test -f "$dir/$objdir/$dlname"; then
4623 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4629 # Just add the directory containing the .lo file.
4630 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4631 test "X$dir" = "X$file" && dir=.
4635 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4640 # Get the absolute pathname.
4641 absdir=`cd "$dir" && pwd`
4642 test -n "$absdir" && dir="$absdir"
4644 # Now add the directory to shlibpath_var.
4645 if eval "test -z \"\$$shlibpath_var\""; then
4646 eval "$shlibpath_var=\"\$dir\""
4648 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4652 # This variable tells wrapper scripts just to set shlibpath_var
4653 # rather than running their programs.
4654 libtool_execute_magic="$magic"
4656 # Check if any of the arguments is a wrapper script.
4663 # Do a test to see if this is really a libtool program.
4664 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4665 # If there is no directory component, then add one.
4667 */* | *\\*) . $file ;;
4671 # Transform arg to wrapped name.
4672 file="$progdir/$program"
4676 # Quote arguments (to preserve shell metacharacters).
4677 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4678 args="$args \"$file\""
4681 if test -z "$run"; then
4682 if test -n "$shlibpath_var"; then
4683 # Export the shlibpath_var.
4684 eval "export $shlibpath_var"
4687 # Restore saved enviroment variables
4688 if test "${save_LC_ALL+set}" = set; then
4689 LC_ALL="$save_LC_ALL"; export LC_ALL
4691 if test "${save_LANG+set}" = set; then
4692 LANG="$save_LANG"; export LANG
4695 # Now prepare to actually exec the command.
4696 exec_cmd="\$cmd$args"
4698 # Display what would be done.
4699 if test -n "$shlibpath_var"; then
4700 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4701 $echo "export $shlibpath_var"
4708 # libtool clean and uninstall mode
4710 modename="$modename: $mode"
4716 # This variable tells wrapper scripts just to set variables rather
4717 # than running their programs.
4718 libtool_install_magic="$magic"
4723 -f) rm="$rm $arg"; rmforce=yes ;;
4724 -*) rm="$rm $arg" ;;
4725 *) files="$files $arg" ;;
4729 if test -z "$rm"; then
4730 $echo "$modename: you must specify an RM program" 1>&2
4737 for file in $files; do
4738 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4739 if test "X$dir" = "X$file"; then
4743 objdir="$dir/$objdir"
4745 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4746 test $mode = uninstall && objdir="$dir"
4748 # Remember objdir for removal later, being careful to avoid duplicates
4749 if test $mode = clean; then
4752 *) rmdirs="$rmdirs $objdir" ;;
4756 # Don't error if the file doesn't exist and rm -f was used.
4757 if (test -L "$file") >/dev/null 2>&1 \
4758 || (test -h "$file") >/dev/null 2>&1 \
4759 || test -f "$file"; then
4761 elif test -d "$file"; then
4764 elif test "$rmforce" = yes; then
4772 # Possibly a libtool archive, so verify it.
4773 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4776 # Delete the libtool libraries and symlinks.
4777 for n in $library_names; do
4778 rmfiles="$rmfiles $objdir/$n"
4780 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4781 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4783 if test $mode = uninstall; then
4784 if test -n "$library_names"; then
4785 # Do each command in the postuninstall commands.
4786 eval cmds=\"$postuninstall_cmds\"
4787 save_ifs="$IFS"; IFS='~'
4788 for cmd in $cmds; do
4792 if test $? != 0 && test "$rmforce" != yes; then
4799 if test -n "$old_library"; then
4800 # Do each command in the old_postuninstall commands.
4801 eval cmds=\"$old_postuninstall_cmds\"
4802 save_ifs="$IFS"; IFS='~'
4803 for cmd in $cmds; do
4807 if test $? != 0 && test "$rmforce" != yes; then
4813 # FIXME: should reinstall the best remaining shared library.
4819 if test "$build_old_libs" = yes; then
4820 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4821 rmfiles="$rmfiles $dir/$oldobj"
4826 # Do a test to see if this is a libtool program.
4827 if test $mode = clean &&
4828 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4832 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4833 if test "$fast_install" = yes && test -n "$relink_command"; then
4834 rmfiles="$rmfiles $objdir/lt-$name"
4839 $show "$rm $rmfiles"
4840 $run $rm $rmfiles || exit_status=1
4843 # Try to remove the ${objdir}s in the directories where we deleted files
4844 for dir in $rmdirs; do
4845 if test -d "$dir"; then
4847 $run rmdir $dir >/dev/null 2>&1
4855 $echo "$modename: you must specify a MODE" 1>&2
4856 $echo "$generic_help" 1>&2
4861 if test -z "$exec_cmd"; then
4862 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4863 $echo "$generic_help" 1>&2
4866 fi # test -z "$show_help"
4868 if test -n "$exec_cmd"; then
4873 # We need to display help for each of the modes.
4876 "Usage: $modename [OPTION]... [MODE-ARG]...
4878 Provide generalized library-building support services.
4880 --config show all configuration variables
4881 --debug enable verbose shell tracing
4882 -n, --dry-run display commands without modifying any files
4883 --features display basic configuration information and exit
4884 --finish same as \`--mode=finish'
4885 --help display this help message and exit
4886 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4887 --quiet same as \`--silent'
4888 --silent don't print informational messages
4889 --version print version information
4891 MODE must be one of the following:
4893 clean remove files from the build directory
4894 compile compile a source file into a libtool object
4895 execute automatically set library path, then run a program
4896 finish complete the installation of libtool libraries
4897 install install libraries or executables
4898 link create a library or an executable
4899 uninstall remove libraries from an installed directory
4901 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4902 a more detailed description of MODE."
4908 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4910 Remove files from the build directory.
4912 RM is the name of the program to use to delete files associated with each FILE
4913 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4916 If FILE is a libtool library, object or program, all the files associated
4917 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4922 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4924 Compile a source file into a libtool library object.
4926 This mode accepts the following additional options:
4928 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4929 -prefer-pic try to building PIC objects only
4930 -prefer-non-pic try to building non-PIC objects only
4931 -static always build a \`.o' file suitable for static linking
4933 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4934 from the given SOURCEFILE.
4936 The output file name is determined by removing the directory component from
4937 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4938 library object suffix, \`.lo'."
4943 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4945 Automatically set library path, then run a program.
4947 This mode accepts the following additional options:
4949 -dlopen FILE add the directory containing FILE to the library path
4951 This mode sets the library path environment variable according to \`-dlopen'
4954 If any of the ARGS are libtool executable wrappers, then they are translated
4955 into their corresponding uninstalled binary, and any of their required library
4956 directories are added to the library path.
4958 Then, COMMAND is executed, with ARGS as arguments."
4963 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4965 Complete the installation of libtool libraries.
4967 Each LIBDIR is a directory that contains libtool libraries.
4969 The commands that this mode executes may require superuser privileges. Use
4970 the \`--dry-run' option if you just want to see what would be executed."
4975 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4977 Install executables or libraries.
4979 INSTALL-COMMAND is the installation command. The first component should be
4980 either the \`install' or \`cp' program.
4982 The rest of the components are interpreted as arguments to that command (only
4983 BSD-compatible install options are recognized)."
4988 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
4990 Link object files or libraries together to form another library, or to
4991 create an executable program.
4993 LINK-COMMAND is a command using the C compiler that you would use to create
4994 a program from several object files.
4996 The following components of LINK-COMMAND are treated specially:
4998 -all-static do not do any dynamic linking at all
4999 -avoid-version do not add a version suffix if possible
5000 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5001 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5002 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5003 -export-symbols SYMFILE
5004 try to export only the symbols listed in SYMFILE
5005 -export-symbols-regex REGEX
5006 try to export only the symbols matching REGEX
5007 -LLIBDIR search LIBDIR for required installed libraries
5008 -lNAME OUTPUT-FILE requires the installed library libNAME
5009 -module build a library that can dlopened
5010 -no-fast-install disable the fast-install mode
5011 -no-install link a not-installable executable
5012 -no-undefined declare that a library does not refer to external symbols
5013 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5014 -release RELEASE specify package release information
5015 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5016 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5017 -static do not do any dynamic linking of libtool libraries
5018 -version-info CURRENT[:REVISION[:AGE]]
5019 specify library version info [each variable defaults to 0]
5021 All other options (arguments beginning with \`-') are ignored.
5023 Every other argument is treated as a filename. Files ending in \`.la' are
5024 treated as uninstalled libtool libraries, other files are standard or library
5027 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5028 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5029 required, except when creating a convenience library.
5031 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5032 using \`ar' and \`ranlib', or on Windows using \`lib'.
5034 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5035 is created, otherwise an executable program is created."
5040 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5042 Remove libraries from an installation directory.
5044 RM is the name of the program to use to delete files associated with each FILE
5045 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5048 If FILE is a libtool library, all the files associated with it are deleted.
5049 Otherwise, only FILE itself is deleted using RM."
5053 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5060 $echo "Try \`$modename --help' for more information about other modes."