1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # Check that we have a working $echo.
28 if test "X$1" = X--no-reexec; then
29 # Discard the --no-reexec flag, and continue.
31 elif test "X$1" = X--fallback-echo; then
32 # Avoid inline document here, it may be left over
34 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35 # Yippee, $echo works!
38 # Restart under the correct shell, and then maybe $echo will work.
39 exec $SHELL "$0" --no-reexec ${1+"$@"}
42 if test "X$1" = X--fallback-echo; then
43 # used as fallback echo
51 # define SED for historic ltconfig's generated by Libtool 1.3
52 test -z "$SED" && SED=sed
54 # The name of this program.
55 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
62 TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
65 help="Try \`$progname --help' for more information."
66 magic="%%%MAGIC variable%%%"
71 # Sed substitution that helps us do robust quoting. It backslashifies
72 # metacharacters that are still active within double-quoted strings.
73 Xsed="${SED}"' -e 1s/^X//'
74 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
75 # test EBCDIC or ASCII
76 case `echo A|od -x` in
77 *[Cc]1*) # EBCDIC based system
78 SP2NL="tr '\100' '\n'"
79 NL2SP="tr '\r\n' '\100\100'"
81 *) # Assume ASCII based system
82 SP2NL="tr '\040' '\012'"
83 NL2SP="tr '\015\012' '\040\040'"
88 # Only set LANG and LC_ALL to C if already set.
89 # These must not be set unconditionally because not all systems understand
90 # e.g. LANG=C (notably SCO).
91 # We save the old values to restore during execute mode.
92 if test "${LC_ALL+set}" = set; then
93 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
95 if test "${LANG+set}" = set; then
96 save_LANG="$LANG"; LANG=C; export LANG
99 # Make sure IFS has a sensible default
102 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103 echo "$modename: not configured to build any kind of library" 1>&2
104 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
117 lo2o="s/\\.lo\$/.${objext}/"
118 o2lo="s/\\.${objext}\$/.lo/"
120 # Parse our command line options once, thoroughly.
127 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
131 # If the previous option needs an argument, assign it.
132 if test -n "$prev"; then
135 execute_dlfiles="$execute_dlfiles $arg"
147 # Have we seen a non-optional argument yet?
154 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
159 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
164 echo "$progname: enabling shell trace mode"
174 if test "$build_libtool_libs" = yes; then
175 echo "enable shared libraries"
177 echo "disable shared libraries"
179 if test "$build_old_libs" = yes; then
180 echo "enable static libraries"
182 echo "disable static libraries"
187 --finish) mode="finish" ;;
189 --mode) prevopt="--mode" prev=mode ;;
190 --mode=*) mode="$optarg" ;;
192 --preserve-dup-deps) duplicate_deps="yes" ;;
204 $echo "$modename: unrecognized option \`$arg'" 1>&2
216 if test -n "$prevopt"; then
217 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
222 # Mandrake: (gc) It's bad to link C++ code with GCC, so we need to use the compiler name if provided
223 if test "$mode" = link && test -n "$archive_cmds" && test -x "/usr/bin/perl"; then
225 *cc | *++ | gcc* | *-gcc* | egcs*)
226 archive_cmds=`echo $archive_cmds | perl -pe 's/^\S+\s+//'`
227 archive_cmds="$nonopt $archive_cmds"
228 archive_expsym_cmds=`echo $archive_expsym_cmds | perl -pe 's/^\S+\s+//'`
229 archive_expsym_cmds="$nonopt $archive_expsym_cmds"
233 # If this variable is set in any of the actions, the command in it
234 # will be execed at the end. This prevents here-documents from being
235 # left over by shells.
238 if test -z "$show_help"; then
240 # Infer the operation mode.
241 if test -z "$mode"; then
243 *cc | *++ | gcc* | *-gcc* | xlc*)
255 *db | *dbx | *strace | *truss)
265 # If we have no mode, but dlfiles were specified, then do execute mode.
266 test -n "$execute_dlfiles" && mode=execute
268 # Just use the default operation mode.
269 if test -z "$mode"; then
270 if test -n "$nonopt"; then
271 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
273 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
280 # Only execute mode is allowed to have -dlopen flags.
281 if test -n "$execute_dlfiles" && test "$mode" != execute; then
282 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
287 # Change the help message to a mode-specific one.
289 help="Try \`$modename --help --mode=$mode' for more information."
291 # These modes are in order of execution frequency so that they run quickly.
293 # libtool compile mode
295 modename="$modename: compile"
296 # Get the compilation command and the source file.
309 # Aesthetically quote the previous argument.
311 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
314 # Double-quote args containing other shell metacharacters.
315 # Many Bourne shells cannot handle close brackets correctly
316 # in scan sets, so we specify it separately.
317 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
322 # Add the previous argument to base_compile.
323 if test -z "$base_compile"; then
324 base_compile="$lastarg"
326 base_compile="$base_compile $lastarg"
332 # Accept any command-line options.
335 if test "$user_target" != "no"; then
336 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
363 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
365 save_ifs="$IFS"; IFS=','
369 # Double-quote args containing other shell metacharacters.
370 # Many Bourne shells cannot handle close brackets correctly
371 # in scan sets, so we specify it separately.
373 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
377 lastarg="$lastarg $arg"
380 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
382 # Add the arguments to base_compile.
383 if test -z "$base_compile"; then
384 base_compile="$lastarg"
386 base_compile="$base_compile $lastarg"
394 # The next one is the -o target name
399 # We got the output file
406 # Accept the current argument as the source file.
410 # Aesthetically quote the previous argument.
412 # Backslashify any backslashes, double quotes, and dollar signs.
413 # These are the only characters that are still specially
414 # interpreted inside of double-quoted scrings.
415 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
417 # Double-quote args containing other shell metacharacters.
418 # Many Bourne shells cannot handle close brackets correctly
419 # in scan sets, so we specify it separately.
421 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
422 lastarg="\"$lastarg\""
426 # Add the previous argument to base_compile.
427 if test -z "$base_compile"; then
428 base_compile="$lastarg"
430 base_compile="$base_compile $lastarg"
438 # Get the name of the library object.
439 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
442 $echo "$modename: you must specify a target with \`-o'" 1>&2
447 # Recognize several different file suffixes.
448 # If the user specifies -o file.o, it is replaced with file.lo
463 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
466 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
468 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
473 if test -z "$base_compile"; then
474 $echo "$modename: you must specify a compilation command" 1>&2
479 # Delete any leftover library objects.
480 if test "$build_old_libs" = yes; then
481 removelist="$obj $libobj"
487 trap "$run $rm $removelist; exit 1" 1 2 15
489 # On Cygwin there's no "real" PIC flag so we must build both object types
491 cygwin* | mingw* | pw32* | os2*)
495 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
496 # non-PIC code in shared libraries is not supported
500 # Calculate the filename of the output object if compiler does
501 # not support -o with -c
502 if test "$compiler_c_o" = no; then
503 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
504 lockfile="$output_obj.lock"
505 removelist="$removelist $output_obj $lockfile"
506 trap "$run $rm $removelist; exit 1" 1 2 15
512 # Lock this critical section if it is needed
513 # We use this script file to make the link, it avoids creating a new file
514 if test "$need_locks" = yes; then
515 until $run ln "$0" "$lockfile" 2>/dev/null; do
516 $show "Waiting for $lockfile to be removed"
519 elif test "$need_locks" = warn; then
520 if test -f "$lockfile"; then
522 *** ERROR, $lockfile exists and contains:
523 `cat $lockfile 2>/dev/null`
525 This indicates that another process is trying to use the same
526 temporary object file, and libtool could not work around it because
527 your compiler does not support \`-c' and \`-o' together. If you
528 repeat this compilation, it may succeed, by chance, but you had better
529 avoid parallel builds (make -j) in this platform, or get a better
535 echo $srcfile > "$lockfile"
538 if test -n "$fix_srcfile_path"; then
539 eval srcfile=\"$fix_srcfile_path\"
542 # Only build a PIC object if we are building libtool libraries.
543 if test "$build_libtool_libs" = yes; then
544 # Without this assignment, base_compile gets emptied.
545 fbsd_hideous_sh_bug=$base_compile
547 if test "$pic_mode" != no; then
548 # All platforms use -DPIC, to notify preprocessed assembler code.
549 command="$base_compile $srcfile $pic_flag -DPIC"
551 # Don't build PIC code
552 command="$base_compile $srcfile"
554 if test "$build_old_libs" = yes; then
556 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
557 if test "X$dir" = "X$libobj"; then
562 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
564 if test -d "$dir"; then
571 if test $status -ne 0 && test ! -d $dir; then
576 if test "$compiler_o_lo" = yes; then
578 command="$command -o $output_obj"
579 elif test "$compiler_c_o" = yes; then
581 command="$command -o $output_obj"
584 $run $rm "$output_obj"
586 if $run eval "$command"; then :
588 test -n "$output_obj" && $run $rm $removelist
592 if test "$need_locks" = warn &&
593 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
595 *** ERROR, $lockfile contains:
596 `cat $lockfile 2>/dev/null`
598 but it should contain:
601 This indicates that another process is trying to use the same
602 temporary object file, and libtool could not work around it because
603 your compiler does not support \`-c' and \`-o' together. If you
604 repeat this compilation, it may succeed, by chance, but you had better
605 avoid parallel builds (make -j) in this platform, or get a better
612 # Just move the object if needed, then go on to compile the next one
613 if test x"$output_obj" != x"$libobj"; then
614 $show "$mv $output_obj $libobj"
615 if $run $mv $output_obj $libobj; then :
623 # If we have no pic_flag, then copy the object into place and finish.
624 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
625 test "$build_old_libs" = yes; then
626 # Rename the .lo from within objdir to obj
627 if test -f $obj; then
632 $show "$mv $libobj $obj"
633 if $run $mv $libobj $obj; then :
640 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
641 if test "X$xdir" = "X$obj"; then
646 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
647 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
648 # Now arrange that obj and lo_libobj become the same file
649 $show "(cd $xdir && $LN_S $baseobj $libobj)"
650 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
651 # Unlock the critical section if it was locked
652 if test "$need_locks" != no; then
663 # Allow error messages only from the first compilation.
664 suppress_output=' >/dev/null 2>&1'
667 # Only build a position-dependent object if we build old libraries.
668 if test "$build_old_libs" = yes; then
669 if test "$pic_mode" != yes; then
670 # Don't build PIC code
671 command="$base_compile $srcfile"
673 # All platforms use -DPIC, to notify preprocessed assembler code.
674 command="$base_compile $srcfile $pic_flag -DPIC"
676 if test "$compiler_c_o" = yes; then
677 command="$command -o $obj"
681 # Suppress compiler output if we already did a PIC compilation.
682 command="$command$suppress_output"
683 $run $rm "$output_obj"
685 if $run eval "$command"; then :
691 if test "$need_locks" = warn &&
692 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
694 *** ERROR, $lockfile contains:
695 `cat $lockfile 2>/dev/null`
697 but it should contain:
700 This indicates that another process is trying to use the same
701 temporary object file, and libtool could not work around it because
702 your compiler does not support \`-c' and \`-o' together. If you
703 repeat this compilation, it may succeed, by chance, but you had better
704 avoid parallel builds (make -j) in this platform, or get a better
711 # Just move the object if needed
712 if test x"$output_obj" != x"$obj"; then
713 $show "$mv $output_obj $obj"
714 if $run $mv $output_obj $obj; then :
722 # Create an invalid libtool object if no PIC, so that we do not
723 # accidentally link it into a program.
724 if test "$build_libtool_libs" != yes; then
725 $show "echo timestamp > $libobj"
726 $run eval "echo timestamp > \$libobj" || exit $?
728 # Move the .lo from within objdir
729 $show "$mv $libobj $lo_libobj"
730 if $run $mv $libobj $lo_libobj; then :
739 # Unlock the critical section if it was locked
740 if test "$need_locks" != no; then
749 modename="$modename: link"
751 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
752 # It is impossible to link a dll without this setting, and
753 # we shouldn't force the makefile maintainer to figure out
754 # which system we are compiling for in order to pass an extra
755 # flag for every libtool invokation.
758 # FIXME: Unfortunately, there are problems with the above when trying
759 # to make a dll which has undefined symbols, in which case not
760 # even a static library is built. For now, we need to specify
761 # -no-undefined on the libtool link line when we can be certain
762 # that all symbols are satisfied, otherwise we get a static library.
769 libtool_args="$nonopt"
770 compile_command="$nonopt"
771 finalize_command="$nonopt"
784 lib_search_path=`pwd`
793 export_symbols_regex=
800 prefer_static_libs=no
812 # We need to know -static, to get the right output filenames.
816 -all-static | -static)
817 if test "X$arg" = "X-all-static"; then
818 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
819 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
821 if test -n "$link_static_flag"; then
822 dlopen_self=$dlopen_self_static
825 if test -z "$pic_flag" && test -n "$link_static_flag"; then
826 dlopen_self=$dlopen_self_static
829 build_libtool_libs=no
831 prefer_static_libs=yes
837 # See if our shared archives depend on static archives.
838 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
840 # Go through the arguments, transforming them on the way.
841 while test $# -gt 0; do
845 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
846 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
850 libtool_args="$libtool_args $qarg"
852 # If the previous option needs an argument, assign it.
853 if test -n "$prev"; then
856 compile_command="$compile_command @OUTPUT@"
857 finalize_command="$finalize_command @OUTPUT@"
863 if test "$preload" = no; then
864 # Add the symbol object into the linking commands.
865 compile_command="$compile_command @SYMFILE@"
866 finalize_command="$finalize_command @SYMFILE@"
870 *.la | *.lo) ;; # We handle these cases below.
872 if test "$dlself" = no; then
880 if test "$prev" = dlprefiles; then
882 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
892 if test "$prev" = dlfiles; then
893 dlfiles="$dlfiles $arg"
895 dlprefiles="$dlprefiles $arg"
903 export_symbols="$arg"
904 if test ! -f "$arg"; then
905 $echo "$modename: symbol file \`$arg' does not exist"
912 export_symbols_regex="$arg"
917 inst_prefix_dir="$arg"
927 # We need an absolute path.
929 [\\/]* | [A-Za-z]:[\\/]*) ;;
931 $echo "$modename: only absolute run-paths are allowed" 1>&2
935 if test "$prev" = rpath; then
938 *) rpath="$rpath $arg" ;;
943 *) xrpath="$xrpath $arg" ;;
950 compiler_flags="$compiler_flags $qarg"
952 compile_command="$compile_command $qarg"
953 finalize_command="$finalize_command $qarg"
957 linker_flags="$linker_flags $qarg"
958 compiler_flags="$compiler_flags $wl$qarg"
960 compile_command="$compile_command $wl$qarg"
961 finalize_command="$finalize_command $wl$qarg"
965 eval "$prev=\"\$arg\""
976 if test -n "$link_static_flag"; then
977 compile_command="$compile_command $link_static_flag"
978 finalize_command="$finalize_command $link_static_flag"
984 # FIXME: remove this flag sometime in the future.
985 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1009 -export-symbols | -export-symbols-regex)
1010 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1011 $echo "$modename: more than one -exported-symbols argument is not allowed"
1014 if test "X$arg" = "X-export-symbols"; then
1027 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1028 # so, if we see these flags be careful not to treat them like -L
1030 case $with_gcc/$host in
1031 no/*-*-irix* | no/*-*-nonstopux*)
1032 compile_command="$compile_command $arg"
1033 finalize_command="$finalize_command $arg"
1040 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1041 # We need an absolute path.
1043 [\\/]* | [A-Za-z]:[\\/]*) ;;
1045 absdir=`cd "$dir" && pwd`
1046 if test -z "$absdir"; then
1047 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1056 deplibs="$deplibs -L$dir"
1057 lib_search_path="$lib_search_path $dir"
1061 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1062 case :$dllsearchpath: in
1064 *) dllsearchpath="$dllsearchpath:$dir";;
1072 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1074 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1075 # These systems don't actually have a C or math library (as such)
1078 *-*-mingw* | *-*-os2*)
1079 # These systems don't actually have a C library (as such)
1080 test "X$arg" = "X-lc" && continue
1082 *-*-openbsd* | *-*-freebsd*)
1083 # Do not include libc due to us having libc/libc_r.
1084 test "X$arg" = "X-lc" && continue
1087 elif test "X$arg" = "X-lc_r"; then
1089 *-*-openbsd* | *-*-freebsd*)
1090 # Do not include libc_r directly, use -pthread flag.
1095 deplibs="$deplibs $arg"
1111 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1112 # The PATH hackery in wrapper scripts is required on Windows
1113 # in order for the loader to find any dlls it needs.
1114 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1115 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1118 *) no_install=yes ;;
1146 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1147 # We need an absolute path.
1149 [\\/]* | [A-Za-z]:[\\/]*) ;;
1151 $echo "$modename: only absolute run-paths are allowed" 1>&2
1157 *) xrpath="$xrpath $dir" ;;
1163 # The effects of -static are defined in a previous loop.
1164 # We used to do the same as -all-static on platforms that
1165 # didn't have a PIC flag, but the assumption that the effects
1166 # would be equivalent was wrong. It would break on at least
1167 # Digital Unix and AIX.
1182 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1184 save_ifs="$IFS"; IFS=','
1185 for flag in $args; do
1188 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1193 compiler_flags="$compiler_flags $flag"
1196 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1200 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1202 save_ifs="$IFS"; IFS=','
1203 for flag in $args; do
1206 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211 compiler_flags="$compiler_flags $wl$flag"
1212 linker_flags="$linker_flags $flag"
1215 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1228 # Some other compiler flag.
1230 # Unknown arguments in both finalize_command and compile_command need
1231 # to be aesthetically quoted because they are evaled later.
1232 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1234 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1241 # A library or standard object.
1242 if test "$prev" = dlfiles; then
1243 # This file was specified with -dlopen.
1244 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1245 dlfiles="$dlfiles $arg"
1249 # If libtool objects are unsupported, then we need to preload.
1254 if test "$prev" = dlprefiles; then
1255 # Preload the old-style object.
1256 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1260 *.lo) libobjs="$libobjs $arg" ;;
1261 *) objs="$objs $arg" ;;
1268 deplibs="$deplibs $arg"
1269 old_deplibs="$old_deplibs $arg"
1274 # A libtool-controlled library.
1276 if test "$prev" = dlfiles; then
1277 # This library was specified with -dlopen.
1278 dlfiles="$dlfiles $arg"
1280 elif test "$prev" = dlprefiles; then
1281 # The library was specified with -dlpreopen.
1282 dlprefiles="$dlprefiles $arg"
1285 deplibs="$deplibs $arg"
1290 # Some other compiler argument.
1292 # Unknown arguments in both finalize_command and compile_command need
1293 # to be aesthetically quoted because they are evaled later.
1294 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1296 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1303 # Now actually substitute the argument into the commands.
1304 if test -n "$arg"; then
1305 compile_command="$compile_command $arg"
1306 finalize_command="$finalize_command $arg"
1308 done # argument parsing loop
1310 if test -n "$prev"; then
1311 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1316 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1317 eval arg=\"$export_dynamic_flag_spec\"
1318 compile_command="$compile_command $arg"
1319 finalize_command="$finalize_command $arg"
1322 # calculate the name of the file, without its directory
1323 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1324 libobjs_save="$libobjs"
1326 if test -n "$shlibpath_var"; then
1327 # get the directories listed in $shlibpath_var
1328 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1332 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1333 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1335 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1336 if test "X$output_objdir" = "X$output"; then
1337 output_objdir="$objdir"
1339 output_objdir="$output_objdir/$objdir"
1341 # Create the object directory.
1342 if test ! -d $output_objdir; then
1343 $show "$mkdir $output_objdir"
1344 $run $mkdir $output_objdir
1346 if test $status -ne 0 && test ! -d $output_objdir; then
1351 # Determine the type of output
1354 $echo "$modename: you must specify an output file" 1>&2
1358 *.$libext) linkmode=oldlib ;;
1359 *.lo | *.$objext) linkmode=obj ;;
1360 *.la) linkmode=lib ;;
1361 *) linkmode=prog ;; # Anything else should be a program.
1366 # Find all interdependent deplibs by searching for libraries
1367 # that are linked more than once (e.g. -la -lb -la)
1368 for deplib in $deplibs; do
1369 if test "X$duplicate_deps" = "Xyes" ; then
1371 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1374 libs="$libs $deplib"
1379 need_relink=no # whether we're linking any uninstalled libtool libraries
1380 notinst_deplibs= # not-installed libtool libraries
1381 notinst_path= # paths that contain not-installed libtool libraries
1385 for file in $dlfiles $dlprefiles; do
1389 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1401 passes="conv scan dlopen dlpreopen link"
1406 for pass in $passes; do
1407 if test $linkmode = prog; then
1408 # Determine which files to process
1412 save_deplibs="$deplibs" # Collect dlpreopened libraries
1415 dlpreopen) libs="$dlprefiles" ;;
1416 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1419 for deplib in $libs; do
1424 if test $linkmode = oldlib && test $linkmode = obj; then
1425 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1428 if test $pass = conv; then
1429 deplibs="$deplib $deplibs"
1432 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1433 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1434 # Search the libtool library
1435 lib="$searchdir/lib${name}.la"
1436 if test -f "$lib"; then
1441 if test "$found" != yes; then
1442 # deplib doesn't seem to be a libtool library
1443 if test "$linkmode,$pass" = "prog,link"; then
1444 compile_deplibs="$deplib $compile_deplibs"
1445 finalize_deplibs="$deplib $finalize_deplibs"
1447 deplibs="$deplib $deplibs"
1448 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1456 deplibs="$deplib $deplibs"
1457 test $pass = conv && continue
1458 newdependency_libs="$deplib $newdependency_libs"
1459 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1462 if test $pass = conv; then
1463 deplibs="$deplib $deplibs"
1466 if test $pass = scan; then
1467 deplibs="$deplib $deplibs"
1468 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1470 compile_deplibs="$deplib $compile_deplibs"
1471 finalize_deplibs="$deplib $finalize_deplibs"
1475 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1481 if test $pass = link; then
1482 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1483 # Make sure the xrpath contains only unique directories.
1486 *) xrpath="$xrpath $dir" ;;
1489 deplibs="$deplib $deplibs"
1492 *.la) lib="$deplib" ;;
1494 if test $pass = conv; then
1495 deplibs="$deplib $deplibs"
1500 if test "$deplibs_check_method" != pass_all; then
1502 echo "*** Warning: Trying to link with static lib archive $deplib."
1503 echo "*** I have the capability to make that library automatically link in when"
1504 echo "*** you link to this library. But I can only do this if you have a"
1505 echo "*** shared version of the library, which you do not appear to have"
1506 echo "*** because the file extensions .$libext of this argument makes me believe"
1507 echo "*** that it is just a static archive that I should not used here."
1510 echo "*** Warning: Linking the shared library $output against the"
1511 echo "*** static library $deplib is not portable!"
1512 deplibs="$deplib $deplibs"
1517 if test $pass != link; then
1518 deplibs="$deplib $deplibs"
1520 compile_deplibs="$deplib $compile_deplibs"
1521 finalize_deplibs="$deplib $finalize_deplibs"
1528 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1529 # If there is no dlopen support or we're linking statically,
1530 # we need to preload.
1531 newdlprefiles="$newdlprefiles $deplib"
1532 compile_deplibs="$deplib $compile_deplibs"
1533 finalize_deplibs="$deplib $finalize_deplibs"
1535 newdlfiles="$newdlfiles $deplib"
1544 if test $found = yes || test -f "$lib"; then :
1546 $echo "$modename: cannot find the library \`$lib'" 1>&2
1550 # Check to see that this really is a libtool archive.
1551 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1553 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1557 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1558 test "X$ladir" = "X$lib" && ladir="."
1566 # If the library was installed with an old release of libtool,
1567 # it will not redefine variable installed.
1572 */* | *\\*) . $lib ;;
1576 if test "$linkmode,$pass" = "lib,link" ||
1577 test "$linkmode,$pass" = "prog,scan" ||
1578 { test $linkmode = oldlib && test $linkmode = obj; }; then
1579 # Add dl[pre]opened files of deplib
1580 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1581 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1584 if test $pass = conv; then
1585 # Only check for convenience libraries
1586 deplibs="$lib $deplibs"
1587 if test -z "$libdir"; then
1588 if test -z "$old_library"; then
1589 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1592 # It is a libtool convenience library, so add in its objects.
1593 convenience="$convenience $ladir/$objdir/$old_library"
1594 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1596 for deplib in $dependency_libs; do
1597 deplibs="$deplib $deplibs"
1598 if test "X$duplicate_deps" = "Xyes" ; then
1599 case "$tmp_libs " in
1600 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1603 tmp_libs="$tmp_libs $deplib"
1605 elif test $linkmode != prog && test $linkmode != lib; then
1606 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1612 # Get the name of the library we link against.
1614 for l in $old_library $library_names; do
1617 if test -z "$linklib"; then
1618 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1622 # This library was specified with -dlopen.
1623 if test $pass = dlopen; then
1624 if test -z "$libdir"; then
1625 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1628 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1629 # If there is no dlname, no dlopen support or we're linking
1630 # statically, we need to preload.
1631 dlprefiles="$dlprefiles $lib"
1633 newdlfiles="$newdlfiles $lib"
1638 # We need an absolute path.
1640 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1642 abs_ladir=`cd "$ladir" && pwd`
1643 if test -z "$abs_ladir"; then
1644 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1645 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1650 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1652 # Find the relevant object directory and library name.
1653 if test "X$installed" = Xyes; then
1654 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1655 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1664 dir="$ladir/$objdir"
1665 absdir="$abs_ladir/$objdir"
1666 # Remove this search path later
1667 notinst_path="$notinst_path $abs_ladir"
1668 fi # $installed = yes
1669 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1671 # This library was specified with -dlpreopen.
1672 if test $pass = dlpreopen; then
1673 if test -z "$libdir"; then
1674 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1677 # Prefer using a static library (so that no silly _DYNAMIC symbols
1678 # are required to link).
1679 if test -n "$old_library"; then
1680 newdlprefiles="$newdlprefiles $dir/$old_library"
1681 # Otherwise, use the dlname, so that lt_dlopen finds it.
1682 elif test -n "$dlname"; then
1683 newdlprefiles="$newdlprefiles $dir/$dlname"
1685 newdlprefiles="$newdlprefiles $dir/$linklib"
1687 fi # $pass = dlpreopen
1689 if test -z "$libdir"; then
1690 # Link the convenience library
1691 if test $linkmode = lib; then
1692 deplibs="$dir/$old_library $deplibs"
1693 elif test "$linkmode,$pass" = "prog,link"; then
1694 compile_deplibs="$dir/$old_library $compile_deplibs"
1695 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1697 deplibs="$lib $deplibs"
1702 if test $linkmode = prog && test $pass != link; then
1703 newlib_search_path="$newlib_search_path $ladir"
1704 deplibs="$lib $deplibs"
1707 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1708 test "$build_libtool_libs" = no; then
1713 for deplib in $dependency_libs; do
1715 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1717 # Need to link against all dependency_libs?
1718 if test $linkalldeplibs = yes; then
1719 deplibs="$deplib $deplibs"
1721 # Need to hardcode shared library paths
1722 # or/and link against static libraries
1723 newdependency_libs="$deplib $newdependency_libs"
1725 if test "X$duplicate_deps" = "Xyes" ; then
1726 case "$tmp_libs " in
1727 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1730 tmp_libs="$tmp_libs $deplib"
1733 fi # $linkmode = prog...
1735 link_static=no # Whether the deplib will be linked statically
1736 if test -n "$library_names" &&
1737 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1738 # Link against this shared library
1740 if test "$linkmode,$pass" = "prog,link" ||
1741 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1742 # Hardcode the library path.
1743 # Skip directories that are in the system default run-time
1745 case " $sys_lib_dlsearch_path " in
1748 case "$compile_rpath " in
1750 *) compile_rpath="$compile_rpath $absdir"
1754 case " $sys_lib_dlsearch_path " in
1757 case "$finalize_rpath " in
1759 *) finalize_rpath="$finalize_rpath $libdir"
1763 if test $linkmode = prog; then
1764 # We need to hardcode the library path
1765 if test -n "$shlibpath_var"; then
1766 # Make sure the rpath contains only unique directories.
1767 case "$temp_rpath " in
1770 *) temp_rpath="$temp_rpath $dir" ;;
1774 fi # $linkmode,$pass = prog,link...
1776 if test "$alldeplibs" = yes &&
1777 { test "$deplibs_check_method" = pass_all ||
1778 { test "$build_libtool_libs" = yes &&
1779 test -n "$library_names"; }; }; then
1780 # We only need to search for static libraries
1784 if test "$installed" = no; then
1785 notinst_deplibs="$notinst_deplibs $lib"
1789 if test -n "$old_archive_from_expsyms_cmds"; then
1790 # figure out the soname
1791 set dummy $library_names
1794 libname=`eval \\$echo \"$libname_spec\"`
1795 # use dlname if we got it. it's perfectly good, no?
1796 if test -n "$dlname"; then
1798 elif test -n "$soname_spec"; then
1802 major=`expr $current - $age`
1806 eval soname=\"$soname_spec\"
1811 # Make a new name for the extract_expsyms_cmds to use
1813 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1814 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1816 # If the library has no export list, then create one now
1817 if test -f "$output_objdir/$soname-def"; then :
1819 $show "extracting exported symbol list from \`$soname'"
1820 save_ifs="$IFS"; IFS='~'
1821 eval cmds=\"$extract_expsyms_cmds\"
1822 for cmd in $cmds; do
1825 $run eval "$cmd" || exit $?
1831 if test -f "$output_objdir/$newlib"; then :; else
1832 $show "generating import library for \`$soname'"
1833 save_ifs="$IFS"; IFS='~'
1834 eval cmds=\"$old_archive_from_expsyms_cmds\"
1835 for cmd in $cmds; do
1838 $run eval "$cmd" || exit $?
1842 # make sure the library variables are pointing to the new library
1845 fi # test -n $old_archive_from_expsyms_cmds
1847 if test $linkmode = prog || test "$mode" != relink; then
1852 case $hardcode_action in
1853 immediate | unsupported)
1854 if test "$hardcode_direct" = no; then
1856 elif test "$hardcode_minus_L" = no; then
1858 *-*-sunos*) add_shlibpath="$dir" ;;
1862 elif test "$hardcode_shlibpath_var" = no; then
1863 add_shlibpath="$dir"
1870 if test "$hardcode_direct" = yes; then
1872 elif test "$hardcode_minus_L" = yes; then
1875 elif test "$hardcode_shlibpath_var" = yes; then
1876 add_shlibpath="$dir"
1885 if test "$lib_linked" != yes; then
1886 $echo "$modename: configuration error: unsupported hardcode properties"
1890 if test -n "$add_shlibpath"; then
1891 case :$compile_shlibpath: in
1892 *":$add_shlibpath:"*) ;;
1893 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1896 if test $linkmode = prog; then
1897 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1898 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1900 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1901 test -n "$add" && deplibs="$add $deplibs"
1902 if test "$hardcode_direct" != yes && \
1903 test "$hardcode_minus_L" != yes && \
1904 test "$hardcode_shlibpath_var" = yes; then
1905 case :$finalize_shlibpath: in
1907 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1913 if test $linkmode = prog || test "$mode" = relink; then
1917 # Finalize command for both is simple: just hardcode it.
1918 if test "$hardcode_direct" = yes; then
1919 add="$libdir/$linklib"
1920 elif test "$hardcode_minus_L" = yes; then
1921 # Try looking first in the location we're being installed to.
1923 if test -n "$inst_prefix_dir"; then
1926 add_dir="-L$inst_prefix_dir$libdir"
1930 add_dir="$add_dir -L$libdir"
1932 elif test "$hardcode_shlibpath_var" = yes; then
1933 case :$finalize_shlibpath: in
1935 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1939 # We cannot seem to hardcode it, guess we'll fake it.
1940 # Try looking first in the location we're being installed to.
1942 if test -n "$inst_prefix_dir"; then
1945 add_dir="-L$inst_prefix_dir$libdir"
1949 add_dir="$add_dir -L$libdir"
1953 if test $linkmode = prog; then
1954 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1955 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1957 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1958 test -n "$add" && deplibs="$add $deplibs"
1961 elif test $linkmode = prog; then
1962 if test "$alldeplibs" = yes &&
1963 { test "$deplibs_check_method" = pass_all ||
1964 { test "$build_libtool_libs" = yes &&
1965 test -n "$library_names"; }; }; then
1966 # We only need to search for static libraries
1970 # Try to link the static library
1971 # Here we assume that one of hardcode_direct or hardcode_minus_L
1972 # is not unsupported. This is valid on all known static and
1974 if test "$hardcode_direct" != unsupported; then
1975 test -n "$old_library" && linklib="$old_library"
1976 compile_deplibs="$dir/$linklib $compile_deplibs"
1977 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1979 compile_deplibs="-l$name -L$dir $compile_deplibs"
1980 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1982 elif test "$build_libtool_libs" = yes; then
1983 # Not a shared library
1984 if test "$deplibs_check_method" != pass_all; then
1985 # We're trying link a shared library against a static one
1986 # but the system doesn't support it.
1988 # Just print a warning and add the library to dependency_libs so
1989 # that the program can be linked against the static library.
1991 echo "*** Warning: This system can not link to static lib archive $lib."
1992 echo "*** I have the capability to make that library automatically link in when"
1993 echo "*** you link to this library. But I can only do this if you have a"
1994 echo "*** shared version of the library, which you do not appear to have."
1995 if test "$module" = yes; then
1996 echo "*** But as you try to build a module library, libtool will still create "
1997 echo "*** a static module, that should work as long as the dlopening application"
1998 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1999 if test -z "$global_symbol_pipe"; then
2001 echo "*** However, this would only work if libtool was able to extract symbol"
2002 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2003 echo "*** not find such a program. So, this module is probably useless."
2004 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2006 if test "$build_old_libs" = no; then
2007 build_libtool_libs=module
2010 build_libtool_libs=no
2014 convenience="$convenience $dir/$old_library"
2015 old_convenience="$old_convenience $dir/$old_library"
2016 deplibs="$dir/$old_library $deplibs"
2019 fi # link shared/static library?
2021 if test $linkmode = lib; then
2022 if test -n "$dependency_libs" &&
2023 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2024 test $link_static = yes; }; then
2025 # Extract -R from dependency_libs
2027 for libdir in $dependency_libs; do
2029 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2031 *" $temp_xrpath "*) ;;
2032 *) xrpath="$xrpath $temp_xrpath";;
2034 *) temp_deplibs="$temp_deplibs $libdir";;
2037 dependency_libs="$temp_deplibs"
2040 newlib_search_path="$newlib_search_path $absdir"
2041 # Link against this library
2042 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2043 # ... and its dependency_libs
2045 for deplib in $dependency_libs; do
2046 newdependency_libs="$deplib $newdependency_libs"
2047 if test "X$duplicate_deps" = "Xyes" ; then
2048 case "$tmp_libs " in
2049 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2052 tmp_libs="$tmp_libs $deplib"
2055 if test $link_all_deplibs != no; then
2056 # Add the search paths of all dependency libraries
2057 for deplib in $dependency_libs; do
2059 -L*) path="$deplib" ;;
2061 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2062 test "X$dir" = "X$deplib" && dir="."
2063 # We need an absolute path.
2065 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2067 absdir=`cd "$dir" && pwd`
2068 if test -z "$absdir"; then
2069 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2074 if grep "^installed=no" $deplib > /dev/null; then
2075 path="-L$absdir/$objdir"
2077 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2078 if test -z "$libdir"; then
2079 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2082 if test "$absdir" != "$libdir"; then
2083 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2090 case " $deplibs " in
2092 *) deplibs="$deplibs $path" ;;
2095 fi # link_all_deplibs != no
2097 done # for deplib in $libs
2098 if test $pass = dlpreopen; then
2099 # Link the dlpreopened libraries before other libraries
2100 for deplib in $save_deplibs; do
2101 deplibs="$deplib $deplibs"
2104 if test $pass != dlopen; then
2105 test $pass != scan && dependency_libs="$newdependency_libs"
2106 if test $pass != conv; then
2107 # Make sure lib_search_path contains only unique directories.
2109 for dir in $newlib_search_path; do
2110 case "$lib_search_path " in
2112 *) lib_search_path="$lib_search_path $dir" ;;
2118 if test "$linkmode,$pass" != "prog,link"; then
2121 vars="compile_deplibs finalize_deplibs"
2123 for var in $vars dependency_libs; do
2124 # Add libraries to $var in reverse order
2125 eval tmp_libs=\"\$$var\"
2127 for deplib in $tmp_libs; do
2129 -L*) new_libs="$deplib $new_libs" ;;
2131 case " $specialdeplibs " in
2132 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2134 case " $new_libs " in
2136 *) new_libs="$deplib $new_libs" ;;
2144 for deplib in $new_libs; do
2147 case " $tmp_libs " in
2149 *) tmp_libs="$tmp_libs $deplib" ;;
2152 *) tmp_libs="$tmp_libs $deplib" ;;
2155 eval $var=\"$tmp_libs\"
2158 if test "$pass" = "conv" &&
2159 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2160 libs="$deplibs" # reset libs
2164 if test $linkmode = prog; then
2165 dlfiles="$newdlfiles"
2166 dlprefiles="$newdlprefiles"
2171 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2172 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2175 if test -n "$rpath"; then
2176 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2179 if test -n "$xrpath"; then
2180 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2183 if test -n "$vinfo"; then
2184 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2187 if test -n "$release"; then
2188 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2191 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2192 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2195 # Now set the variables for building old libraries.
2196 build_libtool_libs=no
2198 objs="$objs$old_deplibs"
2202 # Make sure we only generate libraries of the form `libNAME.la'.
2205 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2206 eval libname=\"$libname_spec\"
2209 if test "$module" = no; then
2210 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2214 if test "$need_lib_prefix" != no; then
2215 # Add the "lib" prefix for modules if required
2216 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2217 eval libname=\"$libname_spec\"
2219 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2224 if test -n "$objs"; then
2225 if test "$deplibs_check_method" != pass_all; then
2226 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2230 echo "*** Warning: Linking the shared library $output against the non-libtool"
2231 echo "*** objects $objs is not portable!"
2232 libobjs="$libobjs $objs"
2236 if test "$dlself" != no; then
2237 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2241 if test $# -gt 2; then
2242 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2247 if test -z "$rpath"; then
2248 if test "$build_libtool_libs" = yes; then
2249 # Building a libtool convenience library.
2251 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2252 build_libtool_libs=convenience
2256 if test -n "$vinfo"; then
2257 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2260 if test -n "$release"; then
2261 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2265 # Parse the version information argument.
2266 save_ifs="$IFS"; IFS=':'
2267 set dummy $vinfo 0 0 0
2270 if test -n "$8"; then
2271 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2280 # Check that each of the things are valid numbers.
2284 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2285 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2293 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2294 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2302 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2303 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2308 if test $age -gt $current; then
2309 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2310 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2314 # Calculate the version variables.
2318 case $version_type in
2322 # Like Linux, but with the current version available in
2323 # verstring for coding it into the library header
2324 major=.`expr $current - $age`
2325 versuffix="$major.$age.$revision"
2326 # Darwin ld doesn't like 0 for these options...
2327 minor_current=`expr $current + 1`
2328 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2333 versuffix=".$current.$revision";
2338 versuffix=".$current";
2342 major=`expr $current - $age + 1`
2344 case $version_type in
2345 nonstopux) verstring_prefix=nonstopux ;;
2346 *) verstring_prefix=sgi ;;
2348 verstring="$verstring_prefix$major.$revision"
2350 # Add in all the interfaces that we are compatible with.
2352 while test $loop != 0; do
2353 iface=`expr $revision - $loop`
2354 loop=`expr $loop - 1`
2355 verstring="$verstring_prefix$major.$iface:$verstring"
2358 # Before this point, $major must not contain `.'.
2360 versuffix="$major.$revision"
2364 major=.`expr $current - $age`
2365 versuffix="$major.$age.$revision"
2369 major=.`expr $current - $age`
2370 versuffix=".$current.$age.$revision"
2371 verstring="$current.$age.$revision"
2373 # Add in all the interfaces that we are compatible with.
2375 while test $loop != 0; do
2376 iface=`expr $current - $loop`
2377 loop=`expr $loop - 1`
2378 verstring="$verstring:${iface}.0"
2381 # Make executables depend on our current version.
2382 verstring="$verstring:${current}.0"
2387 versuffix=".$current.$revision"
2391 # Use '-' rather than '.', since we only want one
2392 # extension on DOS 8.3 filesystems.
2393 major=`expr $current - $age`
2398 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2399 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2404 # Clear the version info if we defaulted, and they specified a release.
2405 if test -z "$vinfo" && test -n "$release"; then
2408 case $version_type in
2410 # we can't check for "0.0" in archive_cmds due to quoting
2411 # problems, so we reset it completely
2418 if test "$need_version" = no; then
2425 # Remove version info from name if versioning should be avoided
2426 if test "$avoid_version" = yes && test "$need_version" = no; then
2432 # Check to see if the archive will have undefined symbols.
2433 if test "$allow_undefined" = yes; then
2434 if test "$allow_undefined_flag" = unsupported; then
2435 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2436 build_libtool_libs=no
2440 # Don't allow undefined symbols.
2441 allow_undefined_flag="$no_undefined_flag"
2445 if test "$mode" != relink; then
2446 # Remove our outputs.
2447 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2448 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2451 # Now set the variables for building old libraries.
2452 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2453 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2455 # Transform .lo files to .o files.
2456 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2459 # Eliminate all temporary directories.
2460 for path in $notinst_path; do
2461 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2462 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2463 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2466 if test -n "$xrpath"; then
2467 # If the user specified any rpath flags, then add them.
2469 for libdir in $xrpath; do
2470 temp_xrpath="$temp_xrpath -R$libdir"
2471 case "$finalize_rpath " in
2473 *) finalize_rpath="$finalize_rpath $libdir" ;;
2476 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2477 dependency_libs="$temp_xrpath $dependency_libs"
2481 # Make sure dlfiles contains only unique files that won't be dlpreopened
2482 old_dlfiles="$dlfiles"
2484 for lib in $old_dlfiles; do
2485 case " $dlprefiles $dlfiles " in
2487 *) dlfiles="$dlfiles $lib" ;;
2491 # Make sure dlprefiles contains only unique files
2492 old_dlprefiles="$dlprefiles"
2494 for lib in $old_dlprefiles; do
2495 case "$dlprefiles " in
2497 *) dlprefiles="$dlprefiles $lib" ;;
2501 if test "$build_libtool_libs" = yes; then
2502 if test -n "$rpath"; then
2504 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2505 # these systems don't actually have a c library (as such)!
2507 *-*-rhapsody* | *-*-darwin1.[012])
2508 # Rhapsody C library is in the System framework
2509 deplibs="$deplibs -framework System"
2512 # Don't link with libc until the a.out ld.so is fixed.
2514 *-*-openbsd* | *-*-freebsd*)
2515 # Do not include libc due to us having libc/libc_r.
2518 # Add libc to deplibs on all other systems if necessary.
2519 if test $build_libtool_need_lc = "yes"; then
2520 deplibs="$deplibs -lc"
2526 # Transform deplibs into only deplibs that can be linked in shared.
2528 libname_save=$libname
2529 release_save=$release
2530 versuffix_save=$versuffix
2532 # I'm not sure if I'm treating the release correctly. I think
2533 # release should show up in the -l (ie -lgmp5) so we don't want to
2534 # add it in twice. Is that correct?
2540 case $deplibs_check_method in
2542 # Don't check for shared/static. Everything works.
2543 # This might be a little naive. We might want to check
2544 # whether the library exists or not. But this is on
2545 # osf3 & osf4 and I'm not really sure... Just
2546 # implementing what was already the behaviour.
2550 # This code stresses the "libraries are programs" paradigm to its
2551 # limits. Maybe even breaks it. We compile a program, linking it
2552 # against the deplibs as a proxy for the library. Then we can check
2553 # whether they linked in statically or dynamically with ldd.
2555 cat > conftest.c <<EOF
2556 int main() { return 0; }
2559 $CC -o conftest conftest.c $deplibs
2560 if test $? -eq 0 ; then
2561 ldd_output=`ldd conftest`
2562 for i in $deplibs; do
2563 name="`expr $i : '-l\(.*\)'`"
2564 # If $name is empty we are operating on a -L argument.
2565 if test -n "$name" && test "$name" != "0"; then
2566 libname=`eval \\$echo \"$libname_spec\"`
2567 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2568 set dummy $deplib_matches
2570 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2571 newdeplibs="$newdeplibs $i"
2575 echo "*** Warning: dynamic linker does not accept needed library $i."
2576 echo "*** I have the capability to make that library automatically link in when"
2577 echo "*** you link to this library. But I can only do this if you have a"
2578 echo "*** shared version of the library, which I believe you do not have"
2579 echo "*** because a test_compile did reveal that the linker did not use it for"
2580 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2583 newdeplibs="$newdeplibs $i"
2587 # Error occured in the first compile. Let's try to salvage
2588 # the situation: Compile a separate program for each library.
2589 for i in $deplibs; do
2590 name="`expr $i : '-l\(.*\)'`"
2591 # If $name is empty we are operating on a -L argument.
2592 if test -n "$name" && test "$name" != "0"; then
2594 $CC -o conftest conftest.c $i
2596 if test $? -eq 0 ; then
2597 ldd_output=`ldd conftest`
2598 libname=`eval \\$echo \"$libname_spec\"`
2599 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2600 set dummy $deplib_matches
2602 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2603 newdeplibs="$newdeplibs $i"
2607 echo "*** Warning: dynamic linker does not accept needed library $i."
2608 echo "*** I have the capability to make that library automatically link in when"
2609 echo "*** you link to this library. But I can only do this if you have a"
2610 echo "*** shared version of the library, which you do not appear to have"
2611 echo "*** because a test_compile did reveal that the linker did not use this one"
2612 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2617 echo "*** Warning! Library $i is needed by this library but I was not able to"
2618 echo "*** make it link in! You will probably need to install it or some"
2619 echo "*** library that it depends on before this library will be fully"
2620 echo "*** functional. Installing it before continuing would be even better."
2623 newdeplibs="$newdeplibs $i"
2629 set dummy $deplibs_check_method
2630 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2631 for a_deplib in $deplibs; do
2632 name="`expr $a_deplib : '-l\(.*\)'`"
2633 # If $name is empty we are operating on a -L argument.
2634 if test -n "$name" && test "$name" != "0"; then
2635 libname=`eval \\$echo \"$libname_spec\"`
2636 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2637 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2638 for potent_lib in $potential_libs; do
2639 # Follow soft links.
2640 if ls -lLd "$potent_lib" 2>/dev/null \
2641 | grep " -> " >/dev/null; then
2644 # The statement above tries to avoid entering an
2645 # endless loop below, in case of cyclic links.
2646 # We might still enter an endless loop, since a link
2647 # loop can be closed while we follow links,
2649 potlib="$potent_lib"
2650 while test -h "$potlib" 2>/dev/null; do
2651 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2653 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2654 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2657 # It is ok to link against an archive when
2658 # building a shared library.
2659 if $AR -t $potlib > /dev/null 2>&1; then
2660 newdeplibs="$newdeplibs $a_deplib"
2664 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2666 | egrep "$file_magic_regex" > /dev/null; then
2667 newdeplibs="$newdeplibs $a_deplib"
2673 if test -n "$a_deplib" ; then
2676 echo "*** Warning: linker path does not have real file for library $a_deplib."
2677 echo "*** I have the capability to make that library automatically link in when"
2678 echo "*** you link to this library. But I can only do this if you have a"
2679 echo "*** shared version of the library, which you do not appear to have"
2680 echo "*** because I did check the linker path looking for a file starting"
2681 if test -z "$potlib" ; then
2682 echo "*** with $libname but no candidates were found. (...for file magic test)"
2684 echo "*** with $libname and none of the candidates passed a file format test"
2685 echo "*** using a file magic. Last file checked: $potlib"
2689 # Add a -L argument.
2690 newdeplibs="$newdeplibs $a_deplib"
2692 done # Gone through all deplibs.
2695 set dummy $deplibs_check_method
2696 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2697 for a_deplib in $deplibs; do
2698 name="`expr $a_deplib : '-l\(.*\)'`"
2699 # If $name is empty we are operating on a -L argument.
2700 if test -n "$name" && test "$name" != "0"; then
2701 libname=`eval \\$echo \"$libname_spec\"`
2702 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2703 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2704 for potent_lib in $potential_libs; do
2705 potlib="$potent_lib" # see symlink-check below in file_magic test
2706 if eval echo \"$potent_lib\" 2>/dev/null \
2708 | egrep "$match_pattern_regex" > /dev/null; then
2709 newdeplibs="$newdeplibs $a_deplib"
2715 if test -n "$a_deplib" ; then
2718 echo "*** Warning: linker path does not have real file for library $a_deplib."
2719 echo "*** I have the capability to make that library automatically link in when"
2720 echo "*** you link to this library. But I can only do this if you have a"
2721 echo "*** shared version of the library, which you do not appear to have"
2722 echo "*** because I did check the linker path looking for a file starting"
2723 if test -z "$potlib" ; then
2724 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2726 echo "*** with $libname and none of the candidates passed a file format test"
2727 echo "*** using a regex pattern. Last file checked: $potlib"
2731 # Add a -L argument.
2732 newdeplibs="$newdeplibs $a_deplib"
2734 done # Gone through all deplibs.
2738 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2739 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2740 grep . >/dev/null; then
2742 if test "X$deplibs_check_method" = "Xnone"; then
2743 echo "*** Warning: inter-library dependencies are not supported in this platform."
2745 echo "*** Warning: inter-library dependencies are not known to be supported."
2747 echo "*** All declared inter-library dependencies are being dropped."
2752 versuffix=$versuffix_save
2754 release=$release_save
2755 libname=$libname_save
2759 *-*-rhapsody* | *-*-darwin1.[012])
2760 # On Rhapsody replace the C library is the System framework
2761 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2765 if test "$droppeddeps" = yes; then
2766 if test "$module" = yes; then
2768 echo "*** Warning: libtool could not satisfy all declared inter-library"
2769 echo "*** dependencies of module $libname. Therefore, libtool will create"
2770 echo "*** a static module, that should work as long as the dlopening"
2771 echo "*** application is linked with the -dlopen flag."
2772 if test -z "$global_symbol_pipe"; then
2774 echo "*** However, this would only work if libtool was able to extract symbol"
2775 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2776 echo "*** not find such a program. So, this module is probably useless."
2777 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2779 if test "$build_old_libs" = no; then
2780 oldlibs="$output_objdir/$libname.$libext"
2781 build_libtool_libs=module
2784 build_libtool_libs=no
2787 echo "*** The inter-library dependencies that have been dropped here will be"
2788 echo "*** automatically added whenever a program is linked with this library"
2789 echo "*** or is declared to -dlopen it."
2791 if test $allow_undefined = no; then
2793 echo "*** Since this library must not contain undefined symbols,"
2794 echo "*** because either the platform does not support them or"
2795 echo "*** it was explicitly requested with -no-undefined,"
2796 echo "*** libtool will only create a static version of it."
2797 if test "$build_old_libs" = no; then
2798 oldlibs="$output_objdir/$libname.$libext"
2799 build_libtool_libs=module
2802 build_libtool_libs=no
2807 # Done checking deplibs!
2811 # All the library-specific variables (install_libdir is set above).
2816 # Test again, we may have decided not to build it any more
2817 if test "$build_libtool_libs" = yes; then
2818 if test $hardcode_into_libs = yes; then
2819 # Hardcode the library paths
2822 rpath="$finalize_rpath"
2823 test "$mode" != relink && rpath="$compile_rpath$rpath"
2824 for libdir in $rpath; do
2825 if test -n "$hardcode_libdir_flag_spec"; then
2826 if test -n "$hardcode_libdir_separator"; then
2827 if test -z "$hardcode_libdirs"; then
2828 hardcode_libdirs="$libdir"
2830 # Just accumulate the unique libdirs.
2831 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2832 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2835 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2840 eval flag=\"$hardcode_libdir_flag_spec\"
2841 dep_rpath="$dep_rpath $flag"
2843 elif test -n "$runpath_var"; then
2844 case "$perm_rpath " in
2846 *) perm_rpath="$perm_rpath $libdir" ;;
2850 # Substitute the hardcoded libdirs into the rpath.
2851 if test -n "$hardcode_libdir_separator" &&
2852 test -n "$hardcode_libdirs"; then
2853 libdir="$hardcode_libdirs"
2854 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2856 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2857 # We should set the runpath_var.
2859 for dir in $perm_rpath; do
2862 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2864 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2867 shlibpath="$finalize_shlibpath"
2868 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2869 if test -n "$shlibpath"; then
2870 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2873 # Get the real and link names of the library.
2874 eval library_names=\"$library_names_spec\"
2875 set dummy $library_names
2879 if test -n "$soname_spec"; then
2880 eval soname=\"$soname_spec\"
2884 test -z "$dlname" && dlname=$soname
2886 lib="$output_objdir/$realname"
2889 linknames="$linknames $link"
2892 # Ensure that we have .o objects for linkers which dislike .lo
2893 # (e.g. aix) in case we are running --disable-static
2894 for obj in $libobjs; do
2895 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2896 if test "X$xdir" = "X$obj"; then
2901 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2902 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2903 if test ! -f $xdir/$oldobj; then
2904 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2905 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2909 # Use standard objects if they are pic
2910 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2912 # Prepare the list of exported symbols
2913 if test -z "$export_symbols"; then
2914 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2915 $show "generating symbol list for \`$libname.la'"
2916 export_symbols="$output_objdir/$libname.exp"
2917 $run $rm $export_symbols
2918 eval cmds=\"$export_symbols_cmds\"
2919 save_ifs="$IFS"; IFS='~'
2920 for cmd in $cmds; do
2923 $run eval "$cmd" || exit $?
2926 if test -n "$export_symbols_regex"; then
2927 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2928 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2929 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2930 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2935 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2936 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2939 if test -n "$convenience"; then
2940 if test -n "$whole_archive_flag_spec"; then
2941 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2943 gentop="$output_objdir/${outputname}x"
2944 $show "${rm}r $gentop"
2945 $run ${rm}r "$gentop"
2946 $show "mkdir $gentop"
2947 $run mkdir "$gentop"
2949 if test $status -ne 0 && test ! -d "$gentop"; then
2952 generated="$generated $gentop"
2954 for xlib in $convenience; do
2955 # Extract the objects.
2957 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2958 *) xabs=`pwd`"/$xlib" ;;
2960 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2961 xdir="$gentop/$xlib"
2963 $show "${rm}r $xdir"
2968 if test $status -ne 0 && test ! -d "$xdir"; then
2971 $show "(cd $xdir && $AR x $xabs)"
2972 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2974 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2979 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2980 eval flag=\"$thread_safe_flag_spec\"
2981 linker_flags="$linker_flags $flag"
2984 # Make a backup of the uninstalled library when relinking
2985 if test "$mode" = relink; then
2986 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2989 # Do each of the archive commands.
2990 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2991 eval cmds=\"$archive_expsym_cmds\"
2993 save_deplibs="$deplibs"
2994 for conv in $convenience; do
2996 for test_deplib in $deplibs; do
2997 if test "$test_deplib" != "$conv"; then
2998 tmp_deplibs="$tmp_deplibs $test_deplib"
3001 deplibs="$tmp_deplibs"
3003 eval cmds=\"$archive_cmds\"
3004 deplibs="$save_deplibs"
3006 save_ifs="$IFS"; IFS='~'
3007 for cmd in $cmds; do
3010 $run eval "$cmd" || exit $?
3014 # Restore the uninstalled library and exit
3015 if test "$mode" = relink; then
3016 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3020 # Create links to the real library.
3021 for linkname in $linknames; do
3022 if test "$realname" != "$linkname"; then
3023 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3024 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3028 # If -module or -export-dynamic was specified, set the dlname.
3029 if test "$module" = yes || test "$export_dynamic" = yes; then
3030 # On all known operating systems, these are identical.
3037 if test -n "$deplibs"; then
3038 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3041 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3042 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3045 if test -n "$rpath"; then
3046 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3049 if test -n "$xrpath"; then
3050 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3053 if test -n "$vinfo"; then
3054 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3057 if test -n "$release"; then
3058 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3063 if test -n "$objs$old_deplibs"; then
3064 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3068 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3076 # Delete the old objects.
3077 $run $rm $obj $libobj
3079 # Objects from convenience libraries. This assumes
3080 # single-version convenience libraries. Whenever we create
3081 # different ones for PIC/non-PIC, this we'll have to duplicate
3085 # reload_cmds runs $LD directly, so let us get rid of
3086 # -Wl from whole_archive_flag_spec
3089 if test -n "$convenience"; then
3090 if test -n "$whole_archive_flag_spec"; then
3091 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3093 gentop="$output_objdir/${obj}x"
3094 $show "${rm}r $gentop"
3095 $run ${rm}r "$gentop"
3096 $show "mkdir $gentop"
3097 $run mkdir "$gentop"
3099 if test $status -ne 0 && test ! -d "$gentop"; then
3102 generated="$generated $gentop"
3104 for xlib in $convenience; do
3105 # Extract the objects.
3107 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3108 *) xabs=`pwd`"/$xlib" ;;
3110 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3111 xdir="$gentop/$xlib"
3113 $show "${rm}r $xdir"
3118 if test $status -ne 0 && test ! -d "$xdir"; then
3121 $show "(cd $xdir && $AR x $xabs)"
3122 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3124 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3129 # Create the old-style object.
3130 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
3133 eval cmds=\"$reload_cmds\"
3134 save_ifs="$IFS"; IFS='~'
3135 for cmd in $cmds; do
3138 $run eval "$cmd" || exit $?
3142 # Exit if we aren't doing a library object file.
3143 if test -z "$libobj"; then
3144 if test -n "$gentop"; then
3145 $show "${rm}r $gentop"
3152 if test "$build_libtool_libs" != yes; then
3153 if test -n "$gentop"; then
3154 $show "${rm}r $gentop"
3158 # Create an invalid libtool object if no PIC, so that we don't
3159 # accidentally link it into a program.
3160 $show "echo timestamp > $libobj"
3161 $run eval "echo timestamp > $libobj" || exit $?
3165 if test -n "$pic_flag" || test "$pic_mode" != default; then
3166 # Only do commands if we really have different PIC objects.
3167 reload_objs="$libobjs $reload_conv_objs"
3169 eval cmds=\"$reload_cmds\"
3170 save_ifs="$IFS"; IFS='~'
3171 for cmd in $cmds; do
3174 $run eval "$cmd" || exit $?
3178 # Just create a symlink.
3181 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3182 if test "X$xdir" = "X$libobj"; then
3187 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3188 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3189 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3190 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3193 if test -n "$gentop"; then
3194 $show "${rm}r $gentop"
3203 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3205 if test -n "$vinfo"; then
3206 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3209 if test -n "$release"; then
3210 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3213 if test "$preload" = yes; then
3214 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3215 test "$dlopen_self_static" = unknown; then
3216 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3221 *-*-rhapsody* | *-*-darwin1.[012])
3222 # On Rhapsody replace the C library is the System framework
3223 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3224 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3227 # Don't allow lazy linking, it breaks C++ global constructors
3228 compile_command="$compile_command ${wl}-bind_at_load"
3229 finalize_command="$finalize_command ${wl}-bind_at_load"
3235 compile_command="$compile_command $compile_deplibs"
3236 finalize_command="$finalize_command $finalize_deplibs"
3238 if test -n "$rpath$xrpath"; then
3239 # If the user specified any rpath flags, then add them.
3240 for libdir in $rpath $xrpath; do
3241 # This is the magic to use -rpath.
3242 case "$finalize_rpath " in
3244 *) finalize_rpath="$finalize_rpath $libdir" ;;
3249 # Now hardcode the library paths
3252 for libdir in $compile_rpath $finalize_rpath; do
3253 if test -n "$hardcode_libdir_flag_spec"; then
3254 if test -n "$hardcode_libdir_separator"; then
3255 if test -z "$hardcode_libdirs"; then
3256 hardcode_libdirs="$libdir"
3258 # Just accumulate the unique libdirs.
3259 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3260 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3263 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3268 eval flag=\"$hardcode_libdir_flag_spec\"
3269 rpath="$rpath $flag"
3271 elif test -n "$runpath_var"; then
3272 case "$perm_rpath " in
3274 *) perm_rpath="$perm_rpath $libdir" ;;
3278 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3279 case :$dllsearchpath: in
3281 *) dllsearchpath="$dllsearchpath:$libdir";;
3286 # Substitute the hardcoded libdirs into the rpath.
3287 if test -n "$hardcode_libdir_separator" &&
3288 test -n "$hardcode_libdirs"; then
3289 libdir="$hardcode_libdirs"
3290 eval rpath=\" $hardcode_libdir_flag_spec\"
3292 compile_rpath="$rpath"
3296 for libdir in $finalize_rpath; do
3297 if test -n "$hardcode_libdir_flag_spec"; then
3298 if test -n "$hardcode_libdir_separator"; then
3299 if test -z "$hardcode_libdirs"; then
3300 hardcode_libdirs="$libdir"
3302 # Just accumulate the unique libdirs.
3303 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3304 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3307 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3312 eval flag=\"$hardcode_libdir_flag_spec\"
3313 rpath="$rpath $flag"
3315 elif test -n "$runpath_var"; then
3316 case "$finalize_perm_rpath " in
3318 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3322 # Substitute the hardcoded libdirs into the rpath.
3323 if test -n "$hardcode_libdir_separator" &&
3324 test -n "$hardcode_libdirs"; then
3325 libdir="$hardcode_libdirs"
3326 eval rpath=\" $hardcode_libdir_flag_spec\"
3328 finalize_rpath="$rpath"
3330 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3331 # Transform all the library objects into standard objects.
3332 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3333 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3337 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3338 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3339 dlsyms="${outputname}S.c"
3341 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3345 if test -n "$dlsyms"; then
3349 # Discover the nlist of each of the dlfiles.
3350 nlist="$output_objdir/${outputname}.nm"
3352 $show "$rm $nlist ${nlist}S ${nlist}T"
3353 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3355 # Parse the name list into a source file.
3356 $show "creating $output_objdir/$dlsyms"
3358 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3359 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3360 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3366 /* Prevent the only kind of declaration conflicts we can make. */
3367 #define lt_preloaded_symbols some_other_symbol
3369 /* External symbol declarations for the compiler. */\
3372 if test "$dlself" = yes; then
3373 $show "generating symbol list for \`$output'"
3375 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3377 # Add our own program objects to the symbol list.
3378 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3379 for arg in $progfiles; do
3380 $show "extracting global C symbols from \`$arg'"
3381 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3384 if test -n "$exclude_expsyms"; then
3385 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3386 $run eval '$mv "$nlist"T "$nlist"'
3389 if test -n "$export_symbols_regex"; then
3390 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3391 $run eval '$mv "$nlist"T "$nlist"'
3394 # Prepare the list of exported symbols
3395 if test -z "$export_symbols"; then
3396 export_symbols="$output_objdir/$output.exp"
3397 $run $rm $export_symbols
3398 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3400 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3401 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3402 $run eval 'mv "$nlist"T "$nlist"'
3406 for arg in $dlprefiles; do
3407 $show "extracting global C symbols from \`$arg'"
3408 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3409 $run eval 'echo ": $name " >> "$nlist"'
3410 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3413 if test -z "$run"; then
3414 # Make sure we have at least an empty file.
3415 test -f "$nlist" || : > "$nlist"
3417 if test -n "$exclude_expsyms"; then
3418 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3419 $mv "$nlist"T "$nlist"
3422 # Try sorting and uniquifying the output.
3423 if grep -v "^: " < "$nlist" |
3424 if sort -k 3 </dev/null >/dev/null 2>&1; then
3429 uniq > "$nlist"S; then
3432 grep -v "^: " < "$nlist" > "$nlist"S
3435 if test -f "$nlist"S; then
3436 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3438 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3441 $echo >> "$output_objdir/$dlsyms" "\
3443 #undef lt_preloaded_symbols
3445 #if defined (__STDC__) && __STDC__
3446 # define lt_ptr void *
3448 # define lt_ptr char *
3452 /* The mapping between symbol names and symbols. */
3457 lt_preloaded_symbols[] =
3461 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3463 $echo >> "$output_objdir/$dlsyms" "\
3467 /* This works around a problem in FreeBSD linker */
3468 #ifdef FREEBSD_WORKAROUND
3469 static const void *lt_preloaded_setup() {
3470 return lt_preloaded_symbols;
3480 pic_flag_for_symtable=
3482 # compiling the symbol table file with pic_flag works around
3483 # a FreeBSD bug that causes programs to crash when -lm is
3484 # linked before any other PIC object. But we must not use
3485 # pic_flag when linking with -static. The problem exists in
3486 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3487 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3488 case "$compile_command " in
3490 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3493 case "$compile_command " in
3495 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3499 # Now compile the dynamic symbol file.
3500 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3501 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3503 # Clean up the generated files.
3504 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3505 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3507 # Transform the symbol file into the correct name.
3508 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3509 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3512 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3517 # We keep going just in case the user didn't refer to
3518 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3519 # really was required.
3521 # Nullify the symbol file.
3522 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3523 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3526 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3527 # Replace the output file specification.
3528 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3529 link_command="$compile_command$compile_rpath"
3531 # We have no uninstalled library dependencies, so finalize right now.
3532 $show "$link_command"
3533 $run eval "$link_command"
3536 # Delete the generated files.
3537 if test -n "$dlsyms"; then
3538 $show "$rm $output_objdir/${outputname}S.${objext}"
3539 $run $rm "$output_objdir/${outputname}S.${objext}"
3545 if test -n "$shlibpath_var"; then
3546 # We should set the shlibpath_var
3548 for dir in $temp_rpath; do
3550 [\\/]* | [A-Za-z]:[\\/]*)
3555 # Relative path: add a thisdir entry.
3556 rpath="$rpath\$thisdir/$dir:"
3563 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3564 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3566 if test -n "$finalize_shlibpath"; then
3567 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3572 if test -n "$runpath_var"; then
3573 if test -n "$perm_rpath"; then
3574 # We should set the runpath_var.
3576 for dir in $perm_rpath; do
3579 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3581 if test -n "$finalize_perm_rpath"; then
3582 # We should set the runpath_var.
3584 for dir in $finalize_perm_rpath; do
3587 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3591 if test "$no_install" = yes; then
3592 # We don't need to create a wrapper script.
3593 link_command="$compile_var$compile_command$compile_rpath"
3594 # Replace the output file specification.
3595 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3596 # Delete the old output file.
3598 # Link the executable and exit
3599 $show "$link_command"
3600 $run eval "$link_command" || exit $?
3604 if test "$hardcode_action" = relink; then
3605 # Fast installation is not supported
3606 link_command="$compile_var$compile_command$compile_rpath"
3607 relink_command="$finalize_var$finalize_command$finalize_rpath"
3609 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3610 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3612 if test "$fast_install" != no; then
3613 link_command="$finalize_var$compile_command$finalize_rpath"
3614 if test "$fast_install" = yes; then
3615 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3617 # fast_install is set to needless
3621 link_command="$compile_var$compile_command$compile_rpath"
3622 relink_command="$finalize_var$finalize_command$finalize_rpath"
3626 # Replace the output file specification.
3627 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3629 # Delete the old output files.
3630 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3632 $show "$link_command"
3633 $run eval "$link_command" || exit $?
3635 # Now create the wrapper script.
3636 $show "creating $output"
3638 # Quote the relink command for shipping.
3639 if test -n "$relink_command"; then
3640 # Preserve any variables that may affect compiler behavior
3641 for var in $variables_saved_for_relink; do
3642 if eval test -z \"\${$var+set}\"; then
3643 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3644 elif eval var_value=\$$var; test -z "$var_value"; then
3645 relink_command="$var=; export $var; $relink_command"
3647 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3648 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3651 relink_command="(cd `pwd`; $relink_command)"
3652 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3655 # Quote $echo for shipping.
3656 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3658 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3659 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3661 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3663 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3666 # Only actually do things if our run command is non-null.
3667 if test -z "$run"; then
3668 # win32 will think the script is a binary if it has
3669 # a .exe suffix, so we strip it off here.
3671 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3673 # test for cygwin because mv fails w/o .exe extensions
3675 *cygwin*) exeext=.exe ;;
3679 trap "$rm $output; exit 1" 1 2 15
3684 # $output - temporary wrapper script for $objdir/$outputname
3685 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3687 # The $output program cannot be directly executed until all the libtool
3688 # libraries that it depends on are installed.
3690 # This wrapper script should never be moved out of the build directory.
3691 # If it is, it will not operate correctly.
3693 # Sed substitution that helps us do robust quoting. It backslashifies
3694 # metacharacters that are still active within double-quoted strings.
3695 Xsed="${SED}"' -e 1s/^X//'
3696 sed_quote_subst='$sed_quote_subst'
3698 # The HP-UX ksh and POSIX shell print the target directory to stdout
3700 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3702 relink_command=\"$relink_command\"
3704 # This environment variable determines our operation mode.
3705 if test \"\$libtool_install_magic\" = \"$magic\"; then
3706 # install mode needs the following variable:
3707 notinst_deplibs='$notinst_deplibs'
3709 # When we are sourced in execute mode, \$file and \$echo are already set.
3710 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3713 # Make sure echo works.
3714 if test \"X\$1\" = X--no-reexec; then
3715 # Discard the --no-reexec flag, and continue.
3717 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3718 # Yippee, \$echo works!
3721 # Restart under the correct shell, and then maybe \$echo will work.
3722 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3728 # Find the directory that this script lives in.
3729 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3730 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3732 # Follow symbolic links until we get to the real thisdir.
3733 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3734 while test -n \"\$file\"; do
3735 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3737 # If there was a directory component, then change thisdir.
3738 if test \"x\$destdir\" != \"x\$file\"; then
3739 case \"\$destdir\" in
3740 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3741 *) thisdir=\"\$thisdir/\$destdir\" ;;
3745 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3746 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3749 # Try to get the absolute directory name.
3750 absdir=\`cd \"\$thisdir\" && pwd\`
3751 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3754 if test "$fast_install" = yes; then
3756 program=lt-'$outputname'$exeext
3757 progdir=\"\$thisdir/$objdir\"
3759 if test ! -f \"\$progdir/\$program\" || \\
3760 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3761 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3763 file=\"\$\$-\$program\"
3765 if test ! -d \"\$progdir\"; then
3766 $mkdir \"\$progdir\"
3768 $rm \"\$progdir/\$file\"
3773 # relink executable if necessary
3774 if test -n \"\$relink_command\"; then
3775 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3777 $echo \"\$relink_command_output\" >&2
3778 $rm \"\$progdir/\$file\"
3783 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3784 { $rm \"\$progdir/\$program\";
3785 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3786 $rm \"\$progdir/\$file\"
3790 program='$outputname'
3791 progdir=\"\$thisdir/$objdir\"
3797 if test -f \"\$progdir/\$program\"; then"
3799 # Export our shlibpath_var if we have one.
3800 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3802 # Add our own library path to $shlibpath_var
3803 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3805 # Some systems cannot cope with colon-terminated $shlibpath_var
3806 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3807 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3809 export $shlibpath_var
3813 # fixup the dll searchpath if we need to.
3814 if test -n "$dllsearchpath"; then
3816 # Add the dll search path components to the executable PATH
3817 PATH=$dllsearchpath:\$PATH
3822 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3823 # Run the actual program with our arguments.
3826 # win32 systems need to use the prog path for dll
3828 *-*-cygwin* | *-*-pw32*)
3830 exec \$progdir/\$program \${1+\"\$@\"}
3834 # Backslashes separate directories on plain windows
3835 *-*-mingw | *-*-os2*)
3837 exec \$progdir\\\\\$program \${1+\"\$@\"}
3843 # Export the path to the program.
3844 PATH=\"\$progdir:\$PATH\"
3847 exec \$program \${1+\"\$@\"}
3852 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3856 # The program doesn't exist.
3857 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3858 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3859 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3870 # See if we need to build an old-fashioned archive.
3871 for oldlib in $oldlibs; do
3873 if test "$build_libtool_libs" = convenience; then
3874 oldobjs="$libobjs_save"
3875 addlibs="$convenience"
3876 build_libtool_libs=no
3878 if test "$build_libtool_libs" = module; then
3879 oldobjs="$libobjs_save"
3880 build_libtool_libs=no
3882 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3884 addlibs="$old_convenience"
3887 if test -n "$addlibs"; then
3888 gentop="$output_objdir/${outputname}x"
3889 $show "${rm}r $gentop"
3890 $run ${rm}r "$gentop"
3891 $show "mkdir $gentop"
3892 $run mkdir "$gentop"
3894 if test $status -ne 0 && test ! -d "$gentop"; then
3897 generated="$generated $gentop"
3899 # Add in members from convenience archives.
3900 for xlib in $addlibs; do
3901 # Extract the objects.
3903 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3904 *) xabs=`pwd`"/$xlib" ;;
3906 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3907 xdir="$gentop/$xlib"
3909 $show "${rm}r $xdir"
3914 if test $status -ne 0 && test ! -d "$xdir"; then
3917 $show "(cd $xdir && $AR x $xabs)"
3918 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3920 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3924 # Do each command in the archive commands.
3925 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3926 eval cmds=\"$old_archive_from_new_cmds\"
3928 # Ensure that we have .o objects in place in case we decided
3929 # not to build a shared library, and have fallen back to building
3930 # static libs even though --disable-static was passed!
3931 for oldobj in $oldobjs; do
3932 if test ! -f $oldobj; then
3933 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3934 if test "X$xdir" = "X$oldobj"; then
3939 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3940 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3941 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3942 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3946 eval cmds=\"$old_archive_cmds\"
3948 save_ifs="$IFS"; IFS='~'
3949 for cmd in $cmds; do
3952 $run eval "$cmd" || exit $?
3957 if test -n "$generated"; then
3958 $show "${rm}r$generated"
3959 $run ${rm}r$generated
3962 # Now create the libtool archive.
3966 test "$build_old_libs" = yes && old_library="$libname.$libext"
3967 $show "creating $output"
3969 # Preserve any variables that may affect compiler behavior
3970 for var in $variables_saved_for_relink; do
3971 if eval test -z \"\${$var+set}\"; then
3972 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3973 elif eval var_value=\$$var; test -z "$var_value"; then
3974 relink_command="$var=; export $var; $relink_command"
3976 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3977 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3980 # Quote the link command for shipping.
3981 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3982 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3984 # Only create the output if not a dry run.
3985 if test -z "$run"; then
3986 for installed in no yes; do
3987 if test "$installed" = yes; then
3988 if test -z "$install_libdir"; then
3991 output="$output_objdir/$outputname"i
3992 # Replace all uninstalled libtool libraries with the installed ones
3994 for deplib in $dependency_libs; do
3997 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3998 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3999 if test -z "$libdir"; then
4000 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4003 # We do not want portage's install root ($D) present. Check only for
4004 # this if the .la is being installed.
4005 if test "$installed" = yes && test "$D"; then
4006 eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
4008 mynewdependency_lib="$libdir/$name"
4010 # Do not add duplicates
4011 if test "$mynewdependency_lib"; then
4012 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
4013 newdependency_libs="$newdependency_libs $mynewdependency_lib"
4018 if test "$installed" = yes; then
4019 # Rather use S=WORKDIR if our version of portage supports it.
4020 # This is because some ebuild (gcc) do not use $S as buildroot.
4021 if test "$PWORKDIR"; then
4024 # We do not want portage's build root ($S) present.
4025 if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
4026 mynewdependency_lib=""
4027 # We do not want portage's install root ($D) present.
4028 elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
4029 eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
4031 mynewdependency_lib="$deplib"
4034 mynewdependency_lib="$deplib"
4036 # Do not add duplicates
4037 if test "$mynewdependency_lib"; then
4038 if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
4039 newdependency_libs="$newdependency_libs $mynewdependency_lib"
4045 dependency_libs="$newdependency_libs"
4047 for lib in $dlfiles; do
4048 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4049 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4050 if test -z "$libdir"; then
4051 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4054 newdlfiles="$newdlfiles $libdir/$name"
4056 dlfiles="$newdlfiles"
4058 for lib in $dlprefiles; do
4059 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4060 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4061 if test -z "$libdir"; then
4062 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4065 newdlprefiles="$newdlprefiles $libdir/$name"
4067 dlprefiles="$newdlprefiles"
4070 # place dlname in correct position for cygwin
4072 case $host,$output,$installed,$module,$dlname in
4073 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4075 # Do not add duplicates
4076 if test "$installed" = yes && test "$D"; then
4077 install_libdir="`echo "$install_libdir" |sed -e "s:$D::g" -e 's://:/:g'`"
4080 # $outputname - a libtool library file
4081 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4083 # Please DO NOT delete this file!
4084 # It is necessary for linking the library.
4086 # The name that we can dlopen(3).
4089 # Names of this library.
4090 library_names='$library_names'
4092 # The name of the static archive.
4093 old_library='$old_library'
4095 # Libraries that this one depends upon.
4096 dependency_libs='$dependency_libs'
4098 # Version information for $libname.
4103 # Is this an already installed library?
4104 installed=$installed
4106 # Files to dlopen/dlpreopen
4108 dlpreopen='$dlprefiles'
4110 # Directory that this library needs to be installed in:
4111 libdir='$install_libdir'"
4112 if test "$installed" = no && test $need_relink = yes; then
4114 relink_command=\"$relink_command\""
4119 # Do a symbolic link so that the libtool archive can be found in
4120 # LD_LIBRARY_PATH before the program is installed.
4121 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4122 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4128 # libtool install mode
4130 modename="$modename: install"
4132 # There may be an optional sh(1) argument at the beginning of
4133 # install_prog (especially on Windows NT).
4134 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4135 # Allow the use of GNU shtool's install command.
4136 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4137 # Aesthetically quote it.
4138 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4140 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4144 install_prog="$arg "
4152 # The real first argument should be the name of the installation program.
4153 # Aesthetically quote it.
4154 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4156 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4160 install_prog="$install_prog$arg"
4162 # We need to accept at least all the BSD install flags.
4172 if test -n "$dest"; then
4173 files="$files $dest"
4191 # If the previous option needed an argument, then skip it.
4192 if test -n "$prev"; then
4201 # Aesthetically quote the argument.
4202 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4204 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4208 install_prog="$install_prog $arg"
4211 if test -z "$install_prog"; then
4212 $echo "$modename: you must specify an install program" 1>&2
4217 if test -n "$prev"; then
4218 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4223 if test -z "$files"; then
4224 if test -z "$dest"; then
4225 $echo "$modename: no file or destination specified" 1>&2
4227 $echo "$modename: you must specify a destination" 1>&2
4233 # Strip any trailing slash from the destination.
4234 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4236 # Check to see that the destination is a directory.
4237 test -d "$dest" && isdir=yes
4238 if test "$isdir" = yes; then
4242 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4243 test "X$destdir" = "X$dest" && destdir=.
4244 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4246 # Not a directory, so check to see that there is only one file specified.
4248 if test $# -gt 2; then
4249 $echo "$modename: \`$dest' is not a directory" 1>&2
4255 [\\/]* | [A-Za-z]:[\\/]*) ;;
4257 for file in $files; do
4261 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4270 # This variable tells wrapper scripts just to set variables rather
4271 # than running their programs.
4272 libtool_install_magic="$magic"
4277 for file in $files; do
4279 # Do each installation.
4282 # Do the static libraries later.
4283 staticlibs="$staticlibs $file"
4287 # Check to see that this really is a libtool archive.
4288 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4290 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4298 # If there is no directory component, then add one.
4300 */* | *\\*) . $file ;;
4304 # Add the libdir to current_libdirs if it is the destination.
4305 if test "X$destdir" = "X$libdir"; then
4306 case "$current_libdirs " in
4308 *) current_libdirs="$current_libdirs $libdir" ;;
4311 # Note the libdir as a future libdir.
4312 case "$future_libdirs " in
4314 *) future_libdirs="$future_libdirs $libdir" ;;
4318 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4319 test "X$dir" = "X$file/" && dir=
4322 if test -n "$relink_command"; then
4323 # Determine the prefix the user has applied to our future dir.
4324 inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4326 # Don't allow the user to place us outside of our expected
4327 # location b/c this prevents finding dependent libraries that
4328 # are installed to the same prefix.
4329 if test "$inst_prefix_dir" = "$destdir"; then
4330 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4334 if test -n "$inst_prefix_dir"; then
4335 # Stick the inst_prefix_dir data into the link command.
4336 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4338 relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4341 $echo "$modename: warning: relinking \`$file'" 1>&2
4342 $show "$relink_command"
4343 if $run eval "$relink_command"; then :
4345 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4350 # See the names of the shared library.
4351 set dummy $library_names
4352 if test -n "$2"; then
4358 test -n "$relink_command" && srcname="$realname"T
4360 # Install the shared library and build the symlinks.
4361 $show "$install_prog $dir/$srcname $destdir/$realname"
4362 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4363 if test -n "$stripme" && test -n "$striplib"; then
4364 $show "$striplib $destdir/$realname"
4365 $run eval "$striplib $destdir/$realname" || exit $?
4368 if test $# -gt 0; then
4369 # Delete the old symlinks, and create new ones.
4372 if test "$linkname" != "$realname"; then
4373 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4374 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4379 # Do each command in the postinstall commands.
4380 lib="$destdir/$realname"
4381 eval cmds=\"$postinstall_cmds\"
4382 save_ifs="$IFS"; IFS='~'
4383 for cmd in $cmds; do
4386 $run eval "$cmd" || exit $?
4391 # Install the pseudo-library for information purposes.
4392 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4393 instname="$dir/$name"i
4394 $show "$install_prog $instname $destdir/$name"
4395 $run eval "$install_prog $instname $destdir/$name" || exit $?
4397 # Maybe install the static library, too.
4398 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4402 # Install (i.e. copy) a libtool object.
4404 # Figure out destination file name, if it wasn't already specified.
4405 if test -n "$destname"; then
4406 destfile="$destdir/$destname"
4408 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4409 destfile="$destdir/$destfile"
4412 # Deduce the name of the destination old-style object file.
4415 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4418 staticdest="$destfile"
4422 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4428 # Install the libtool object if requested.
4429 if test -n "$destfile"; then
4430 $show "$install_prog $file $destfile"
4431 $run eval "$install_prog $file $destfile" || exit $?
4434 # Install the old object if enabled.
4435 if test "$build_old_libs" = yes; then
4436 # Deduce the name of the old-style object file.
4437 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4439 $show "$install_prog $staticobj $staticdest"
4440 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4446 # Figure out destination file name, if it wasn't already specified.
4447 if test -n "$destname"; then
4448 destfile="$destdir/$destname"
4450 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4451 destfile="$destdir/$destfile"
4454 # Do a test to see if this is really a libtool program.
4457 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4463 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4467 # If there is no directory component, then add one.
4469 */* | *\\*) . $wrapper ;;
4473 # Check the variables that should have been set.
4474 if test -z "$notinst_deplibs"; then
4475 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4480 for lib in $notinst_deplibs; do
4481 # Check to see that each library is installed.
4483 if test -f "$lib"; then
4484 # If there is no directory component, then add one.
4486 */* | *\\*) . $lib ;;
4490 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4491 if test -n "$libdir" && test ! -f "$libfile"; then
4492 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4498 # If there is no directory component, then add one.
4500 */* | *\\*) . $wrapper ;;
4505 if test "$fast_install" = no && test -n "$relink_command"; then
4506 if test "$finalize" = yes && test -z "$run"; then
4508 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4509 tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4510 if test $? = 0 ; then :
4512 tmpdir="$tmpdir/libtool-$$"
4514 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4516 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4519 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4520 outputname="$tmpdir/$file"
4521 # Replace the output file specification.
4522 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4524 $show "$relink_command"
4525 if $run eval "$relink_command"; then :
4527 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4533 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4536 # Install the binary that we compiled earlier.
4537 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4541 # remove .exe since cygwin /usr/bin/install will append another
4543 case $install_prog,$host in
4544 /usr/bin/install*,*cygwin*)
4545 case $file:$destfile in
4550 destfile=$destfile.exe
4553 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4558 $show "$install_prog$stripme $file $destfile"
4559 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4560 test -n "$outputname" && ${rm}r "$tmpdir"
4565 for file in $staticlibs; do
4566 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4568 # Set up the ranlib parameters.
4569 oldlib="$destdir/$name"
4571 $show "$install_prog $file $oldlib"
4572 $run eval "$install_prog \$file \$oldlib" || exit $?
4574 if test -n "$stripme" && test -n "$striplib"; then
4575 $show "$old_striplib $oldlib"
4576 $run eval "$old_striplib $oldlib" || exit $?
4579 # Do each command in the postinstall commands.
4580 eval cmds=\"$old_postinstall_cmds\"
4581 save_ifs="$IFS"; IFS='~'
4582 for cmd in $cmds; do
4585 $run eval "$cmd" || exit $?
4590 if test -n "$future_libdirs"; then
4591 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4594 if test -n "$current_libdirs"; then
4595 # Maybe just do a dry run.
4596 test -n "$run" && current_libdirs=" -n$current_libdirs"
4597 exec_cmd='$SHELL $0 --finish$current_libdirs'
4603 # libtool finish mode
4605 modename="$modename: finish"
4609 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4612 libdirs="$libdirs $dir"
4615 for libdir in $libdirs; do
4616 if test -n "$finish_cmds"; then
4617 # Do each command in the finish commands.
4618 eval cmds=\"$finish_cmds\"
4619 save_ifs="$IFS"; IFS='~'
4620 for cmd in $cmds; do
4623 $run eval "$cmd" || admincmds="$admincmds
4628 if test -n "$finish_eval"; then
4629 # Do the single finish_eval.
4630 eval cmds=\"$finish_eval\"
4631 $run eval "$cmds" || admincmds="$admincmds
4637 # Exit here if they wanted silent mode.
4638 test "$show" = ":" && exit 0
4640 echo "----------------------------------------------------------------------"
4641 echo "Libraries have been installed in:"
4642 for libdir in $libdirs; do
4646 echo "If you ever happen to want to link against installed libraries"
4647 echo "in a given directory, LIBDIR, you must either use libtool, and"
4648 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4649 echo "flag during linking and do at least one of the following:"
4650 if test -n "$shlibpath_var"; then
4651 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4652 echo " during execution"
4654 if test -n "$runpath_var"; then
4655 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4656 echo " during linking"
4658 if test -n "$hardcode_libdir_flag_spec"; then
4660 eval flag=\"$hardcode_libdir_flag_spec\"
4662 echo " - use the \`$flag' linker flag"
4664 if test -n "$admincmds"; then
4665 echo " - have your system administrator run these commands:$admincmds"
4667 if test -f /etc/ld.so.conf; then
4668 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4671 echo "See any operating system documentation about shared libraries for"
4672 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4673 echo "----------------------------------------------------------------------"
4677 # libtool execute mode
4679 modename="$modename: execute"
4681 # The first argument is the command name.
4683 if test -z "$cmd"; then
4684 $echo "$modename: you must specify a COMMAND" 1>&2
4689 # Handle -dlopen flags immediately.
4690 for file in $execute_dlfiles; do
4691 if test ! -f "$file"; then
4692 $echo "$modename: \`$file' is not a file" 1>&2
4700 # Check to see that this really is a libtool archive.
4701 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4703 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4708 # Read the libtool library.
4712 # If there is no directory component, then add one.
4714 */* | *\\*) . $file ;;
4718 # Skip this library if it cannot be dlopened.
4719 if test -z "$dlname"; then
4720 # Warn if it was a shared library.
4721 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4725 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4726 test "X$dir" = "X$file" && dir=.
4728 if test -f "$dir/$objdir/$dlname"; then
4731 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4737 # Just add the directory containing the .lo file.
4738 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4739 test "X$dir" = "X$file" && dir=.
4743 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4748 # Get the absolute pathname.
4749 absdir=`cd "$dir" && pwd`
4750 test -n "$absdir" && dir="$absdir"
4752 # Now add the directory to shlibpath_var.
4753 if eval "test -z \"\$$shlibpath_var\""; then
4754 eval "$shlibpath_var=\"\$dir\""
4756 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4760 # This variable tells wrapper scripts just to set shlibpath_var
4761 # rather than running their programs.
4762 libtool_execute_magic="$magic"
4764 # Check if any of the arguments is a wrapper script.
4771 # Do a test to see if this is really a libtool program.
4772 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4773 # If there is no directory component, then add one.
4775 */* | *\\*) . $file ;;
4779 # Transform arg to wrapped name.
4780 file="$progdir/$program"
4784 # Quote arguments (to preserve shell metacharacters).
4785 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4786 args="$args \"$file\""
4789 if test -z "$run"; then
4790 if test -n "$shlibpath_var"; then
4791 # Export the shlibpath_var.
4792 eval "export $shlibpath_var"
4795 # Restore saved enviroment variables
4796 if test "${save_LC_ALL+set}" = set; then
4797 LC_ALL="$save_LC_ALL"; export LC_ALL
4799 if test "${save_LANG+set}" = set; then
4800 LANG="$save_LANG"; export LANG
4803 # Now prepare to actually exec the command.
4804 exec_cmd="\$cmd$args"
4806 # Display what would be done.
4807 if test -n "$shlibpath_var"; then
4808 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4809 $echo "export $shlibpath_var"
4816 # libtool clean and uninstall mode
4818 modename="$modename: $mode"
4824 # This variable tells wrapper scripts just to set variables rather
4825 # than running their programs.
4826 libtool_install_magic="$magic"
4831 -f) rm="$rm $arg"; rmforce=yes ;;
4832 -*) rm="$rm $arg" ;;
4833 *) files="$files $arg" ;;
4837 if test -z "$rm"; then
4838 $echo "$modename: you must specify an RM program" 1>&2
4845 for file in $files; do
4846 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4847 if test "X$dir" = "X$file"; then
4851 objdir="$dir/$objdir"
4853 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4854 test $mode = uninstall && objdir="$dir"
4856 # Remember objdir for removal later, being careful to avoid duplicates
4857 if test $mode = clean; then
4860 *) rmdirs="$rmdirs $objdir" ;;
4864 # Don't error if the file doesn't exist and rm -f was used.
4865 if (test -L "$file") >/dev/null 2>&1 \
4866 || (test -h "$file") >/dev/null 2>&1 \
4867 || test -f "$file"; then
4869 elif test -d "$file"; then
4872 elif test "$rmforce" = yes; then
4880 # Possibly a libtool archive, so verify it.
4881 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4884 # Delete the libtool libraries and symlinks.
4885 for n in $library_names; do
4886 rmfiles="$rmfiles $objdir/$n"
4888 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4889 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4891 if test $mode = uninstall; then
4892 if test -n "$library_names"; then
4893 # Do each command in the postuninstall commands.
4894 eval cmds=\"$postuninstall_cmds\"
4895 save_ifs="$IFS"; IFS='~'
4896 for cmd in $cmds; do
4900 if test $? != 0 && test "$rmforce" != yes; then
4907 if test -n "$old_library"; then
4908 # Do each command in the old_postuninstall commands.
4909 eval cmds=\"$old_postuninstall_cmds\"
4910 save_ifs="$IFS"; IFS='~'
4911 for cmd in $cmds; do
4915 if test $? != 0 && test "$rmforce" != yes; then
4921 # FIXME: should reinstall the best remaining shared library.
4927 if test "$build_old_libs" = yes; then
4928 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4929 rmfiles="$rmfiles $dir/$oldobj"
4934 # Do a test to see if this is a libtool program.
4935 if test $mode = clean &&
4936 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4940 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4941 if test "$fast_install" = yes && test -n "$relink_command"; then
4942 rmfiles="$rmfiles $objdir/lt-$name"
4947 $show "$rm $rmfiles"
4948 $run $rm $rmfiles || exit_status=1
4951 # Try to remove the ${objdir}s in the directories where we deleted files
4952 for dir in $rmdirs; do
4953 if test -d "$dir"; then
4955 $run rmdir $dir >/dev/null 2>&1
4963 $echo "$modename: you must specify a MODE" 1>&2
4964 $echo "$generic_help" 1>&2
4969 if test -z "$exec_cmd"; then
4970 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4971 $echo "$generic_help" 1>&2
4974 fi # test -z "$show_help"
4976 if test -n "$exec_cmd"; then
4981 # We need to display help for each of the modes.
4984 "Usage: $modename [OPTION]... [MODE-ARG]...
4986 Provide generalized library-building support services.
4988 --config show all configuration variables
4989 --debug enable verbose shell tracing
4990 -n, --dry-run display commands without modifying any files
4991 --features display basic configuration information and exit
4992 --finish same as \`--mode=finish'
4993 --help display this help message and exit
4994 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4995 --quiet same as \`--silent'
4996 --silent don't print informational messages
4997 --version print version information
4999 MODE must be one of the following:
5001 clean remove files from the build directory
5002 compile compile a source file into a libtool object
5003 execute automatically set library path, then run a program
5004 finish complete the installation of libtool libraries
5005 install install libraries or executables
5006 link create a library or an executable
5007 uninstall remove libraries from an installed directory
5009 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
5010 a more detailed description of MODE."
5016 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5018 Remove files from the build directory.
5020 RM is the name of the program to use to delete files associated with each FILE
5021 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5024 If FILE is a libtool library, object or program, all the files associated
5025 with it are deleted. Otherwise, only FILE itself is deleted using RM."
5030 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5032 Compile a source file into a libtool library object.
5034 This mode accepts the following additional options:
5036 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
5037 -prefer-pic try to building PIC objects only
5038 -prefer-non-pic try to building non-PIC objects only
5039 -static always build a \`.o' file suitable for static linking
5041 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5042 from the given SOURCEFILE.
5044 The output file name is determined by removing the directory component from
5045 SOURCEFILE, then substituting the C source code suffix \`.c' with the
5046 library object suffix, \`.lo'."
5051 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5053 Automatically set library path, then run a program.
5055 This mode accepts the following additional options:
5057 -dlopen FILE add the directory containing FILE to the library path
5059 This mode sets the library path environment variable according to \`-dlopen'
5062 If any of the ARGS are libtool executable wrappers, then they are translated
5063 into their corresponding uninstalled binary, and any of their required library
5064 directories are added to the library path.
5066 Then, COMMAND is executed, with ARGS as arguments."
5071 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5073 Complete the installation of libtool libraries.
5075 Each LIBDIR is a directory that contains libtool libraries.
5077 The commands that this mode executes may require superuser privileges. Use
5078 the \`--dry-run' option if you just want to see what would be executed."
5083 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5085 Install executables or libraries.
5087 INSTALL-COMMAND is the installation command. The first component should be
5088 either the \`install' or \`cp' program.
5090 The rest of the components are interpreted as arguments to that command (only
5091 BSD-compatible install options are recognized)."
5096 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5098 Link object files or libraries together to form another library, or to
5099 create an executable program.
5101 LINK-COMMAND is a command using the C compiler that you would use to create
5102 a program from several object files.
5104 The following components of LINK-COMMAND are treated specially:
5106 -all-static do not do any dynamic linking at all
5107 -avoid-version do not add a version suffix if possible
5108 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5109 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5110 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5111 -export-symbols SYMFILE
5112 try to export only the symbols listed in SYMFILE
5113 -export-symbols-regex REGEX
5114 try to export only the symbols matching REGEX
5115 -LLIBDIR search LIBDIR for required installed libraries
5116 -lNAME OUTPUT-FILE requires the installed library libNAME
5117 -module build a library that can dlopened
5118 -no-fast-install disable the fast-install mode
5119 -no-install link a not-installable executable
5120 -no-undefined declare that a library does not refer to external symbols
5121 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5122 -release RELEASE specify package release information
5123 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5124 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5125 -static do not do any dynamic linking of libtool libraries
5126 -version-info CURRENT[:REVISION[:AGE]]
5127 specify library version info [each variable defaults to 0]
5129 All other options (arguments beginning with \`-') are ignored.
5131 Every other argument is treated as a filename. Files ending in \`.la' are
5132 treated as uninstalled libtool libraries, other files are standard or library
5135 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5136 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5137 required, except when creating a convenience library.
5139 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5140 using \`ar' and \`ranlib', or on Windows using \`lib'.
5142 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5143 is created, otherwise an executable program is created."
5148 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5150 Remove libraries from an installation directory.
5152 RM is the name of the program to use to delete files associated with each FILE
5153 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5156 If FILE is a libtool library, all the files associated with it are deleted.
5157 Otherwise, only FILE itself is deleted using RM."
5161 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5168 $echo "Try \`$modename --help' for more information about other modes."