1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 # This file is distributed with OpenLDAP Software, which contains a
28 # configuration script generated by Autoconf, and is distributable
29 # under the same distributions terms as OpenLDAP inself.
31 ## Copyright 1998-2003 The OpenLDAP Foundation.
32 ## All rights reserved.
34 ## Redistribution and use in source and binary forms, with or without
35 ## modification, are permitted only as authorized by the OpenLDAP
38 ## A copy of this license is available in the file LICENSE in the
39 ## top-level directory of the distribution or, alternatively, at
40 ## <http://www.OpenLDAP.org/license.html>.
42 # Check that we have a working $echo.
43 if test "X$1" = X--no-reexec; then
44 # Discard the --no-reexec flag, and continue.
46 elif test "X$1" = X--fallback-echo; then
47 # Avoid inline document here, it may be left over
49 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
50 # Yippee, $echo works!
53 # Restart under the correct shell, and then maybe $echo will work.
54 exec $SHELL "$0" --no-reexec ${1+"$@"}
57 if test "X$1" = X--fallback-echo; then
58 # used as fallback echo
66 # The name of this program.
67 progname=`$echo "$0" | ${SED} 's%^.*/%%'`
73 VERSION=1.4.3-OpenLDAP
77 help="Try \`$progname --help' for more information."
78 magic="%%%MAGIC variable%%%"
83 # Sed substitution that helps us do robust quoting. It backslashifies
84 # metacharacters that are still active within double-quoted strings.
85 Xsed="${SED}"' -e 1s/^X//'
86 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
87 # test EBCDIC or ASCII
88 case `echo A|od -x` in
89 *[Cc]1*) # EBCDIC based system
90 SP2NL="tr '\100' '\n'"
91 NL2SP="tr '\r\n' '\100\100'"
93 *) # Assume ASCII based system
94 SP2NL="tr '\040' '\012'"
95 NL2SP="tr '\015\012' '\040\040'"
100 # Only set LANG and LC_ALL to C if already set.
101 # These must not be set unconditionally because not all systems understand
102 # e.g. LANG=C (notably SCO).
103 # We save the old values to restore during execute mode.
104 if test "${LC_ALL+set}" = set; then
105 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
107 if test "${LANG+set}" = set; then
108 save_LANG="$LANG"; LANG=C; export LANG
111 # Make sure IFS has a sensible default
114 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
115 echo "$modename: not configured to build any kind of library" 1>&2
116 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
129 lo2o="s/\\.lo\$/.${objext}/"
130 o2lo="s/\\.${objext}\$/.lo/"
132 # Parse our command line options once, thoroughly.
139 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
143 # If the previous option needs an argument, assign it.
144 if test -n "$prev"; then
147 execute_dlfiles="$execute_dlfiles $arg"
159 # Have we seen a non-optional argument yet?
166 echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
171 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
176 echo "$progname: enabling shell trace mode"
186 if test "$build_libtool_libs" = yes; then
187 echo "enable shared libraries"
189 echo "disable shared libraries"
191 if test "$build_old_libs" = yes; then
192 echo "enable static libraries"
194 echo "disable static libraries"
199 --finish) mode="finish" ;;
201 --mode) prevopt="--mode" prev=mode ;;
202 --mode=*) mode="$optarg" ;;
204 --preserve-dup-deps) duplicate_deps="yes" ;;
216 $echo "$modename: unrecognized option \`$arg'" 1>&2
228 if test -n "$prevopt"; then
229 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
234 # If this variable is set in any of the actions, the command in it
235 # will be execed at the end. This prevents here-documents from being
236 # left over by shells.
239 if test -z "$show_help"; then
241 # Infer the operation mode.
242 if test -z "$mode"; then
244 *cc | *++ | gcc* | *-gcc* | xlc*)
256 *db | *dbx | *strace | *truss)
266 # If we have no mode, but dlfiles were specified, then do execute mode.
267 test -n "$execute_dlfiles" && mode=execute
269 # Just use the default operation mode.
270 if test -z "$mode"; then
271 if test -n "$nonopt"; then
272 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
274 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
281 # Only execute mode is allowed to have -dlopen flags.
282 if test -n "$execute_dlfiles" && test "$mode" != execute; then
283 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
288 # Change the help message to a mode-specific one.
290 help="Try \`$modename --help --mode=$mode' for more information."
292 # These modes are in order of execution frequency so that they run quickly.
294 # libtool compile mode
296 modename="$modename: compile"
297 # Get the compilation command and the source file.
310 # Aesthetically quote the previous argument.
312 lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
315 # Double-quote args containing other shell metacharacters.
316 # Many Bourne shells cannot handle close brackets correctly
317 # in scan sets, so we specify it separately.
318 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
323 # Add the previous argument to base_compile.
324 if test -z "$base_compile"; then
325 base_compile="$lastarg"
327 base_compile="$base_compile $lastarg"
333 # Accept any command-line options.
336 if test "$user_target" != "no"; then
337 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
364 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
366 save_ifs="$IFS"; IFS=','
370 # Double-quote args containing other shell metacharacters.
371 # Many Bourne shells cannot handle close brackets correctly
372 # in scan sets, so we specify it separately.
374 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
378 lastarg="$lastarg $arg"
381 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
383 # Add the arguments to base_compile.
384 if test -z "$base_compile"; then
385 base_compile="$lastarg"
387 base_compile="$base_compile $lastarg"
395 # The next one is the -o target name
400 # We got the output file
407 # Accept the current argument as the source file.
411 # Aesthetically quote the previous argument.
413 # Backslashify any backslashes, double quotes, and dollar signs.
414 # These are the only characters that are still specially
415 # interpreted inside of double-quoted scrings.
416 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
418 # Double-quote args containing other shell metacharacters.
419 # Many Bourne shells cannot handle close brackets correctly
420 # in scan sets, so we specify it separately.
422 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
423 lastarg="\"$lastarg\""
427 # Add the previous argument to base_compile.
428 if test -z "$base_compile"; then
429 base_compile="$lastarg"
431 base_compile="$base_compile $lastarg"
439 # Get the name of the library object.
440 libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
443 $echo "$modename: you must specify a target with \`-o'" 1>&2
448 # Recognize several different file suffixes.
449 # If the user specifies -o file.o, it is replaced with file.lo
464 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
467 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
469 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
474 if test -z "$base_compile"; then
475 $echo "$modename: you must specify a compilation command" 1>&2
480 # Delete any leftover library objects.
481 if test "$build_old_libs" = yes; then
482 removelist="$obj $libobj"
488 trap "$run $rm $removelist; exit 1" 1 2 15
490 # On Cygwin there's no "real" PIC flag so we must build both object types
492 cygwin* | mingw* | pw32* | os2*)
496 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
497 # non-PIC code in shared libraries is not supported
501 # Calculate the filename of the output object if compiler does
502 # not support -o with -c
503 if test "$compiler_c_o" = no; then
504 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
505 lockfile="$output_obj.lock"
506 removelist="$removelist $output_obj $lockfile"
507 trap "$run $rm $removelist; exit 1" 1 2 15
513 # Lock this critical section if it is needed
514 # We use this script file to make the link, it avoids creating a new file
515 if test "$need_locks" = yes; then
516 until $run ln "$0" "$lockfile" 2>/dev/null; do
517 $show "Waiting for $lockfile to be removed"
520 elif test "$need_locks" = warn; then
521 if test -f "$lockfile"; then
523 *** ERROR, $lockfile exists and contains:
524 `cat $lockfile 2>/dev/null`
526 This indicates that another process is trying to use the same
527 temporary object file, and libtool could not work around it because
528 your compiler does not support \`-c' and \`-o' together. If you
529 repeat this compilation, it may succeed, by chance, but you had better
530 avoid parallel builds (make -j) in this platform, or get a better
536 echo $srcfile > "$lockfile"
539 if test -n "$fix_srcfile_path"; then
540 eval srcfile=\"$fix_srcfile_path\"
543 # Only build a PIC object if we are building libtool libraries.
544 if test "$build_libtool_libs" = yes; then
545 # Without this assignment, base_compile gets emptied.
546 fbsd_hideous_sh_bug=$base_compile
548 if test "$pic_mode" != no; then
549 # All platforms use -DPIC, to notify preprocessed assembler code.
550 command="$base_compile $srcfile $pic_flag -DPIC"
552 # Don't build PIC code
553 command="$base_compile $srcfile"
555 if test "$build_old_libs" = yes; then
557 dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
558 if test "X$dir" = "X$libobj"; then
563 libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
565 if test -d "$dir"; then
572 if test $status -ne 0 && test ! -d $dir; then
577 if test "$compiler_o_lo" = yes; then
579 command="$command -o $output_obj"
580 elif test "$compiler_c_o" = yes; then
582 command="$command -o $output_obj"
585 $run $rm "$output_obj"
587 if $run eval "$command"; then :
589 test -n "$output_obj" && $run $rm $removelist
593 if test "$need_locks" = warn &&
594 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
596 *** ERROR, $lockfile contains:
597 `cat $lockfile 2>/dev/null`
599 but it should contain:
602 This indicates that another process is trying to use the same
603 temporary object file, and libtool could not work around it because
604 your compiler does not support \`-c' and \`-o' together. If you
605 repeat this compilation, it may succeed, by chance, but you had better
606 avoid parallel builds (make -j) in this platform, or get a better
613 # Just move the object if needed, then go on to compile the next one
614 if test x"$output_obj" != x"$libobj"; then
615 $show "$mv $output_obj $libobj"
616 if $run $mv $output_obj $libobj; then :
624 # If we have no pic_flag, then copy the object into place and finish.
625 if (test -z "$pic_flag" || test "$pic_mode" != default) &&
626 test "$build_old_libs" = yes; then
627 # Rename the .lo from within objdir to obj
628 if test -f $obj; then
633 $show "$mv $libobj $obj"
634 if $run $mv $libobj $obj; then :
641 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
642 if test "X$xdir" = "X$obj"; then
647 baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
648 libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
649 # Now arrange that obj and lo_libobj become the same file
650 $show "(cd $xdir && $LN_S $baseobj $libobj)"
651 if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
652 # Unlock the critical section if it was locked
653 if test "$need_locks" != no; then
664 # Allow error messages only from the first compilation.
665 suppress_output=' >/dev/null 2>&1'
668 # Only build a position-dependent object if we build old libraries.
669 if test "$build_old_libs" = yes; then
670 if test "$pic_mode" != yes; then
671 # Don't build PIC code
672 command="$base_compile $srcfile"
674 # All platforms use -DPIC, to notify preprocessed assembler code.
675 command="$base_compile $srcfile $pic_flag -DPIC"
677 if test "$compiler_c_o" = yes; then
678 command="$command -o $obj"
682 # Suppress compiler output if we already did a PIC compilation.
683 command="$command$suppress_output"
684 $run $rm "$output_obj"
686 if $run eval "$command"; then :
692 if test "$need_locks" = warn &&
693 test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
695 *** ERROR, $lockfile contains:
696 `cat $lockfile 2>/dev/null`
698 but it should contain:
701 This indicates that another process is trying to use the same
702 temporary object file, and libtool could not work around it because
703 your compiler does not support \`-c' and \`-o' together. If you
704 repeat this compilation, it may succeed, by chance, but you had better
705 avoid parallel builds (make -j) in this platform, or get a better
712 # Just move the object if needed
713 if test x"$output_obj" != x"$obj"; then
714 $show "$mv $output_obj $obj"
715 if $run $mv $output_obj $obj; then :
723 # Create an invalid libtool object if no PIC, so that we do not
724 # accidentally link it into a program.
725 if test "$build_libtool_libs" != yes; then
726 $show "echo timestamp > $libobj"
727 $run eval "echo timestamp > \$libobj" || exit $?
729 # Move the .lo from within objdir
730 $show "$mv $libobj $lo_libobj"
731 if $run $mv $libobj $lo_libobj; then :
740 # Unlock the critical section if it was locked
741 if test "$need_locks" != no; then
750 modename="$modename: link"
752 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
753 # It is impossible to link a dll without this setting, and
754 # we shouldn't force the makefile maintainer to figure out
755 # which system we are compiling for in order to pass an extra
756 # flag for every libtool invokation.
759 # FIXME: Unfortunately, there are problems with the above when trying
760 # to make a dll which has undefined symbols, in which case not
761 # even a static library is built. For now, we need to specify
762 # -no-undefined on the libtool link line when we can be certain
763 # that all symbols are satisfied, otherwise we get a static library.
770 libtool_args="$nonopt"
771 compile_command="$nonopt"
772 finalize_command="$nonopt"
785 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"
922 # We need an absolute path.
924 [\\/]* | [A-Za-z]:[\\/]*) ;;
926 $echo "$modename: only absolute run-paths are allowed" 1>&2
930 if test "$prev" = rpath; then
933 *) rpath="$rpath $arg" ;;
938 *) xrpath="$xrpath $arg" ;;
945 compiler_flags="$compiler_flags $qarg"
947 compile_command="$compile_command $qarg"
948 finalize_command="$finalize_command $qarg"
952 linker_flags="$linker_flags $qarg"
953 compiler_flags="$compiler_flags $wl$qarg"
955 compile_command="$compile_command $wl$qarg"
956 finalize_command="$finalize_command $wl$qarg"
960 eval "$prev=\"\$arg\""
971 if test -n "$link_static_flag"; then
972 compile_command="$compile_command $link_static_flag"
973 finalize_command="$finalize_command $link_static_flag"
979 # FIXME: remove this flag sometime in the future.
980 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1004 -export-symbols | -export-symbols-regex)
1005 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1006 $echo "$modename: more than one -exported-symbols argument is not allowed"
1009 if test "X$arg" = "X-export-symbols"; then
1017 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1018 # so, if we see these flags be careful not to treat them like -L
1020 case $with_gcc/$host in
1021 no/*-*-irix* | no/*-*-nonstopux*)
1022 compile_command="$compile_command $arg"
1023 finalize_command="$finalize_command $arg"
1030 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1031 # We need an absolute path.
1033 [\\/]* | [A-Za-z]:[\\/]*) ;;
1035 absdir=`cd "$dir" && pwd`
1036 if test -z "$absdir"; then
1037 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1046 deplibs="$deplibs -L$dir"
1047 lib_search_path="$lib_search_path $dir"
1051 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1052 case :$dllsearchpath: in
1054 *) dllsearchpath="$dllsearchpath:$dir";;
1062 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1064 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1065 # These systems don't actually have a C or math library (as such)
1068 *-*-mingw* | *-*-os2*)
1069 # These systems don't actually have a C library (as such)
1070 test "X$arg" = "X-lc" && continue
1072 *-*-openbsd* | *-*-freebsd*)
1073 # Do not include libc due to us having libc/libc_r.
1074 test "X$arg" = "X-lc" && continue
1077 elif test "X$arg" = "X-lc_r"; then
1079 *-*-openbsd* | *-*-freebsd*)
1080 # Do not include libc_r directly, use -pthread flag.
1085 deplibs="$deplibs $arg"
1101 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1102 # The PATH hackery in wrapper scripts is required on Windows
1103 # in order for the loader to find any dlls it needs.
1104 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1105 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1108 *) no_install=yes ;;
1136 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1137 # We need an absolute path.
1139 [\\/]* | [A-Za-z]:[\\/]*) ;;
1141 $echo "$modename: only absolute run-paths are allowed" 1>&2
1147 *) xrpath="$xrpath $dir" ;;
1153 # The effects of -static are defined in a previous loop.
1154 # We used to do the same as -all-static on platforms that
1155 # didn't have a PIC flag, but the assumption that the effects
1156 # would be equivalent was wrong. It would break on at least
1157 # Digital Unix and AIX.
1172 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1174 save_ifs="$IFS"; IFS=','
1175 for flag in $args; do
1178 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1183 compiler_flags="$compiler_flags $flag"
1186 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1190 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1192 save_ifs="$IFS"; IFS=','
1193 for flag in $args; do
1196 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1201 compiler_flags="$compiler_flags $wl$flag"
1202 linker_flags="$linker_flags $flag"
1205 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1218 # Some other compiler flag.
1220 # Unknown arguments in both finalize_command and compile_command need
1221 # to be aesthetically quoted because they are evaled later.
1222 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1224 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1231 # A library or standard object.
1232 if test "$prev" = dlfiles; then
1233 # This file was specified with -dlopen.
1234 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1235 dlfiles="$dlfiles $arg"
1239 # If libtool objects are unsupported, then we need to preload.
1244 if test "$prev" = dlprefiles; then
1245 # Preload the old-style object.
1246 dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1250 *.lo) libobjs="$libobjs $arg" ;;
1251 *) objs="$objs $arg" ;;
1258 deplibs="$deplibs $arg"
1259 old_deplibs="$old_deplibs $arg"
1264 # A libtool-controlled library.
1266 if test "$prev" = dlfiles; then
1267 # This library was specified with -dlopen.
1268 dlfiles="$dlfiles $arg"
1270 elif test "$prev" = dlprefiles; then
1271 # The library was specified with -dlpreopen.
1272 dlprefiles="$dlprefiles $arg"
1275 deplibs="$deplibs $arg"
1280 # Some other compiler argument.
1282 # Unknown arguments in both finalize_command and compile_command need
1283 # to be aesthetically quoted because they are evaled later.
1284 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1286 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1293 # Now actually substitute the argument into the commands.
1294 if test -n "$arg"; then
1295 compile_command="$compile_command $arg"
1296 finalize_command="$finalize_command $arg"
1298 done # argument parsing loop
1300 if test -n "$prev"; then
1301 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1306 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1307 eval arg=\"$export_dynamic_flag_spec\"
1308 compile_command="$compile_command $arg"
1309 finalize_command="$finalize_command $arg"
1312 # calculate the name of the file, without its directory
1313 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1314 libobjs_save="$libobjs"
1316 if test -n "$shlibpath_var"; then
1317 # get the directories listed in $shlibpath_var
1318 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1322 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1323 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1325 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1326 if test "X$output_objdir" = "X$output"; then
1327 output_objdir="$objdir"
1329 output_objdir="$output_objdir/$objdir"
1331 # Create the object directory.
1332 if test ! -d $output_objdir; then
1333 $show "$mkdir $output_objdir"
1334 $run $mkdir $output_objdir
1336 if test $status -ne 0 && test ! -d $output_objdir; then
1341 # Determine the type of output
1344 $echo "$modename: you must specify an output file" 1>&2
1348 *.$libext) linkmode=oldlib ;;
1349 *.lo | *.$objext) linkmode=obj ;;
1350 *.la) linkmode=lib ;;
1351 *) linkmode=prog ;; # Anything else should be a program.
1356 # Find all interdependent deplibs by searching for libraries
1357 # that are linked more than once (e.g. -la -lb -la)
1358 for deplib in $deplibs; do
1359 if test "X$duplicate_deps" = "Xyes" ; then
1361 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1364 libs="$libs $deplib"
1369 need_relink=no # whether we're linking any uninstalled libtool libraries
1370 notinst_deplibs= # not-installed libtool libraries
1371 notinst_path= # paths that contain not-installed libtool libraries
1375 for file in $dlfiles $dlprefiles; do
1379 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1391 passes="conv scan dlopen dlpreopen link"
1396 for pass in $passes; do
1397 if test $linkmode = prog; then
1398 # Determine which files to process
1402 save_deplibs="$deplibs" # Collect dlpreopened libraries
1405 dlpreopen) libs="$dlprefiles" ;;
1406 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1409 for deplib in $libs; do
1414 if test $linkmode = oldlib && test $linkmode = obj; then
1415 $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1418 if test $pass = conv; then
1419 deplibs="$deplib $deplibs"
1422 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1423 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1424 # Search the libtool library
1425 lib="$searchdir/lib${name}.la"
1426 if test -f "$lib"; then
1431 if test "$found" != yes; then
1432 # deplib doesn't seem to be a libtool library
1433 if test "$linkmode,$pass" = "prog,link"; then
1434 compile_deplibs="$deplib $compile_deplibs"
1435 finalize_deplibs="$deplib $finalize_deplibs"
1437 deplibs="$deplib $deplibs"
1438 test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1446 deplibs="$deplib $deplibs"
1447 test $pass = conv && continue
1448 newdependency_libs="$deplib $newdependency_libs"
1449 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1452 if test $pass = conv; then
1453 deplibs="$deplib $deplibs"
1456 if test $pass = scan; then
1457 deplibs="$deplib $deplibs"
1458 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1460 compile_deplibs="$deplib $compile_deplibs"
1461 finalize_deplibs="$deplib $finalize_deplibs"
1465 $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1471 if test $pass = link; then
1472 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1473 # Make sure the xrpath contains only unique directories.
1476 *) xrpath="$xrpath $dir" ;;
1479 deplibs="$deplib $deplibs"
1482 *.la) lib="$deplib" ;;
1484 if test $pass = conv; then
1485 deplibs="$deplib $deplibs"
1490 if test "$deplibs_check_method" != pass_all; then
1492 echo "*** Warning: Trying to link with static lib archive $deplib."
1493 echo "*** I have the capability to make that library automatically link in when"
1494 echo "*** you link to this library. But I can only do this if you have a"
1495 echo "*** shared version of the library, which you do not appear to have"
1496 echo "*** because the file extensions .$libext of this argument makes me believe"
1497 echo "*** that it is just a static archive that I should not used here."
1500 echo "*** Warning: Linking the shared library $output against the"
1501 echo "*** static library $deplib is not portable!"
1502 deplibs="$deplib $deplibs"
1507 if test $pass != link; then
1508 deplibs="$deplib $deplibs"
1510 compile_deplibs="$deplib $compile_deplibs"
1511 finalize_deplibs="$deplib $finalize_deplibs"
1518 if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1519 # If there is no dlopen support or we're linking statically,
1520 # we need to preload.
1521 newdlprefiles="$newdlprefiles $deplib"
1522 compile_deplibs="$deplib $compile_deplibs"
1523 finalize_deplibs="$deplib $finalize_deplibs"
1525 newdlfiles="$newdlfiles $deplib"
1534 if test $found = yes || test -f "$lib"; then :
1536 $echo "$modename: cannot find the library \`$lib'" 1>&2
1540 # Check to see that this really is a libtool archive.
1541 if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1543 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1547 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1548 test "X$ladir" = "X$lib" && ladir="."
1556 # If the library was installed with an old release of libtool,
1557 # it will not redefine variable installed.
1562 */* | *\\*) . $lib ;;
1566 if test "$linkmode,$pass" = "lib,link" ||
1567 test "$linkmode,$pass" = "prog,scan" ||
1568 { test $linkmode = oldlib && test $linkmode = obj; }; then
1569 # Add dl[pre]opened files of deplib
1570 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1571 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1574 if test $pass = conv; then
1575 # Only check for convenience libraries
1576 deplibs="$lib $deplibs"
1577 if test -z "$libdir"; then
1578 if test -z "$old_library"; then
1579 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1582 # It is a libtool convenience library, so add in its objects.
1583 convenience="$convenience $ladir/$objdir/$old_library"
1584 old_convenience="$old_convenience $ladir/$objdir/$old_library"
1586 for deplib in $dependency_libs; do
1587 deplibs="$deplib $deplibs"
1588 if test "X$duplicate_deps" = "Xyes" ; then
1589 case "$tmp_libs " in
1590 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1593 tmp_libs="$tmp_libs $deplib"
1595 elif test $linkmode != prog && test $linkmode != lib; then
1596 $echo "$modename: \`$lib' is not a convenience library" 1>&2
1602 # Get the name of the library we link against.
1604 for l in $old_library $library_names; do
1607 if test -z "$linklib"; then
1608 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1612 # This library was specified with -dlopen.
1613 if test $pass = dlopen; then
1614 if test -z "$libdir"; then
1615 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1618 if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1619 # If there is no dlname, no dlopen support or we're linking
1620 # statically, we need to preload.
1621 dlprefiles="$dlprefiles $lib"
1623 newdlfiles="$newdlfiles $lib"
1628 # We need an absolute path.
1630 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1632 abs_ladir=`cd "$ladir" && pwd`
1633 if test -z "$abs_ladir"; then
1634 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1635 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1640 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1642 # Find the relevant object directory and library name.
1643 if test "X$installed" = Xyes; then
1644 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1645 $echo "$modename: warning: library \`$lib' was moved." 1>&2
1654 dir="$ladir/$objdir"
1655 absdir="$abs_ladir/$objdir"
1656 # Remove this search path later
1657 notinst_path="$notinst_path $abs_ladir"
1658 fi # $installed = yes
1659 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1661 # This library was specified with -dlpreopen.
1662 if test $pass = dlpreopen; then
1663 if test -z "$libdir"; then
1664 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1667 # Prefer using a static library (so that no silly _DYNAMIC symbols
1668 # are required to link).
1669 if test -n "$old_library"; then
1670 newdlprefiles="$newdlprefiles $dir/$old_library"
1671 # Otherwise, use the dlname, so that lt_dlopen finds it.
1672 elif test -n "$dlname"; then
1673 newdlprefiles="$newdlprefiles $dir/$dlname"
1675 newdlprefiles="$newdlprefiles $dir/$linklib"
1677 fi # $pass = dlpreopen
1679 if test -z "$libdir"; then
1680 # Link the convenience library
1681 if test $linkmode = lib; then
1682 deplibs="$dir/$old_library $deplibs"
1683 elif test "$linkmode,$pass" = "prog,link"; then
1684 compile_deplibs="$dir/$old_library $compile_deplibs"
1685 finalize_deplibs="$dir/$old_library $finalize_deplibs"
1687 deplibs="$lib $deplibs"
1692 if test $linkmode = prog && test $pass != link; then
1693 newlib_search_path="$newlib_search_path $ladir"
1694 deplibs="$lib $deplibs"
1697 if test "$link_all_deplibs" != no || test -z "$library_names" ||
1698 test "$build_libtool_libs" = no; then
1703 for deplib in $dependency_libs; do
1705 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1707 # Need to link against all dependency_libs?
1708 if test $linkalldeplibs = yes; then
1709 deplibs="$deplib $deplibs"
1711 # Need to hardcode shared library paths
1712 # or/and link against static libraries
1713 newdependency_libs="$deplib $newdependency_libs"
1715 if test "X$duplicate_deps" = "Xyes" ; then
1716 case "$tmp_libs " in
1717 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1720 tmp_libs="$tmp_libs $deplib"
1723 fi # $linkmode = prog...
1725 link_static=no # Whether the deplib will be linked statically
1726 if test -n "$library_names" &&
1727 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1728 # Link against this shared library
1730 if test "$linkmode,$pass" = "prog,link" ||
1731 { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1732 # Hardcode the library path.
1733 # Skip directories that are in the system default run-time
1735 case " $sys_lib_dlsearch_path " in
1738 case "$compile_rpath " in
1740 *) compile_rpath="$compile_rpath $absdir"
1744 case " $sys_lib_dlsearch_path " in
1747 case "$finalize_rpath " in
1749 *) finalize_rpath="$finalize_rpath $libdir"
1753 if test $linkmode = prog; then
1754 # We need to hardcode the library path
1755 if test -n "$shlibpath_var"; then
1756 # Make sure the rpath contains only unique directories.
1757 case "$temp_rpath " in
1760 *) temp_rpath="$temp_rpath $dir" ;;
1764 fi # $linkmode,$pass = prog,link...
1766 if test "$alldeplibs" = yes &&
1767 { test "$deplibs_check_method" = pass_all ||
1768 { test "$build_libtool_libs" = yes &&
1769 test -n "$library_names"; }; }; then
1770 # We only need to search for static libraries
1774 if test "$installed" = no; then
1775 notinst_deplibs="$notinst_deplibs $lib"
1779 if test -n "$old_archive_from_expsyms_cmds"; then
1780 # figure out the soname
1781 set dummy $library_names
1784 libname=`eval \\$echo \"$libname_spec\"`
1785 # use dlname if we got it. it's perfectly good, no?
1786 if test -n "$dlname"; then
1788 elif test -n "$soname_spec"; then
1792 major=`expr $current - $age`
1796 eval soname=\"$soname_spec\"
1801 # Make a new name for the extract_expsyms_cmds to use
1803 soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1804 newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1806 # If the library has no export list, then create one now
1807 if test -f "$output_objdir/$soname-def"; then :
1809 $show "extracting exported symbol list from \`$soname'"
1810 save_ifs="$IFS"; IFS='~'
1811 eval cmds=\"$extract_expsyms_cmds\"
1812 for cmd in $cmds; do
1815 $run eval "$cmd" || exit $?
1821 if test -f "$output_objdir/$newlib"; then :; else
1822 $show "generating import library for \`$soname'"
1823 save_ifs="$IFS"; IFS='~'
1824 eval cmds=\"$old_archive_from_expsyms_cmds\"
1825 for cmd in $cmds; do
1828 $run eval "$cmd" || exit $?
1832 # make sure the library variables are pointing to the new library
1835 fi # test -n $old_archive_from_expsyms_cmds
1837 if test $linkmode = prog || test "$mode" != relink; then
1842 case $hardcode_action in
1843 immediate | unsupported)
1844 if test "$hardcode_direct" = no; then
1846 elif test "$hardcode_minus_L" = no; then
1848 *-*-sunos*) add_shlibpath="$dir" ;;
1852 elif test "$hardcode_shlibpath_var" = no; then
1853 add_shlibpath="$dir"
1860 if test "$hardcode_direct" = yes; then
1862 elif test "$hardcode_minus_L" = yes; then
1865 elif test "$hardcode_shlibpath_var" = yes; then
1866 add_shlibpath="$dir"
1875 if test "$lib_linked" != yes; then
1876 $echo "$modename: configuration error: unsupported hardcode properties"
1880 if test -n "$add_shlibpath"; then
1881 case :$compile_shlibpath: in
1882 *":$add_shlibpath:"*) ;;
1883 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1886 if test $linkmode = prog; then
1887 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1888 test -n "$add" && compile_deplibs="$add $compile_deplibs"
1890 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1891 test -n "$add" && deplibs="$add $deplibs"
1892 if test "$hardcode_direct" != yes && \
1893 test "$hardcode_minus_L" != yes && \
1894 test "$hardcode_shlibpath_var" = yes; then
1895 case :$finalize_shlibpath: in
1897 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1903 if test $linkmode = prog || test "$mode" = relink; then
1907 # Finalize command for both is simple: just hardcode it.
1908 if test "$hardcode_direct" = yes; then
1909 add="$libdir/$linklib"
1910 elif test "$hardcode_minus_L" = yes; then
1913 elif test "$hardcode_shlibpath_var" = yes; then
1914 case :$finalize_shlibpath: in
1916 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1920 # We cannot seem to hardcode it, guess we'll fake it.
1922 test -d "$ladir/.libs" && add_dir="-L$ladir/.libs $add_dir"
1926 if test $linkmode = prog; then
1927 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1928 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1930 test -n "$add_dir" && deplibs="$add_dir $deplibs"
1931 test -n "$add" && deplibs="$add $deplibs"
1934 elif test $linkmode = prog; then
1935 if test "$alldeplibs" = yes &&
1936 { test "$deplibs_check_method" = pass_all ||
1937 { test "$build_libtool_libs" = yes &&
1938 test -n "$library_names"; }; }; then
1939 # We only need to search for static libraries
1943 # Try to link the static library
1944 # Here we assume that one of hardcode_direct or hardcode_minus_L
1945 # is not unsupported. This is valid on all known static and
1947 if test "$hardcode_direct" != unsupported; then
1948 test -n "$old_library" && linklib="$old_library"
1949 compile_deplibs="$dir/$linklib $compile_deplibs"
1950 finalize_deplibs="$dir/$linklib $finalize_deplibs"
1952 compile_deplibs="-l$name -L$dir $compile_deplibs"
1953 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1955 elif test "$build_libtool_libs" = yes; then
1956 # Not a shared library
1957 if test "$deplibs_check_method" != pass_all; then
1958 # We're trying link a shared library against a static one
1959 # but the system doesn't support it.
1961 # Just print a warning and add the library to dependency_libs so
1962 # that the program can be linked against the static library.
1964 echo "*** Warning: This system can not link to static lib archive $lib."
1965 echo "*** I have the capability to make that library automatically link in when"
1966 echo "*** you link to this library. But I can only do this if you have a"
1967 echo "*** shared version of the library, which you do not appear to have."
1968 if test "$module" = yes; then
1969 echo "*** But as you try to build a module library, libtool will still create "
1970 echo "*** a static module, that should work as long as the dlopening application"
1971 echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1972 if test -z "$global_symbol_pipe"; then
1974 echo "*** However, this would only work if libtool was able to extract symbol"
1975 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1976 echo "*** not find such a program. So, this module is probably useless."
1977 echo "*** \`nm' from GNU binutils and a full rebuild may help."
1979 if test "$build_old_libs" = no; then
1980 build_libtool_libs=module
1983 build_libtool_libs=no
1987 convenience="$convenience $dir/$old_library"
1988 old_convenience="$old_convenience $dir/$old_library"
1989 deplibs="$dir/$old_library $deplibs"
1992 fi # link shared/static library?
1994 if test $linkmode = lib; then
1995 if test -n "$dependency_libs" &&
1996 { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
1997 test $link_static = yes; }; then
1998 # Extract -R from dependency_libs
2000 for libdir in $dependency_libs; do
2002 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2004 *" $temp_xrpath "*) ;;
2005 *) xrpath="$xrpath $temp_xrpath";;
2007 *) temp_deplibs="$temp_deplibs $libdir";;
2010 dependency_libs="$temp_deplibs"
2013 newlib_search_path="$newlib_search_path $absdir"
2014 # Link against this library
2015 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2016 # ... and its dependency_libs
2018 for deplib in $dependency_libs; do
2019 newdependency_libs="$deplib $newdependency_libs"
2020 if test "X$duplicate_deps" = "Xyes" ; then
2021 case "$tmp_libs " in
2022 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2025 tmp_libs="$tmp_libs $deplib"
2028 if test $link_all_deplibs != no; then
2029 # Add the search paths of all dependency libraries
2030 for deplib in $dependency_libs; do
2032 -L*) path="$deplib" ;;
2034 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2035 test "X$dir" = "X$deplib" && dir="."
2036 # We need an absolute path.
2038 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2040 absdir=`cd "$dir" && pwd`
2041 if test -z "$absdir"; then
2042 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2047 if grep "^installed=no" $deplib > /dev/null; then
2048 path="-L$absdir/$objdir"
2050 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2051 if test -z "$libdir"; then
2052 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2055 if test "$absdir" != "$libdir"; then
2056 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2063 case " $deplibs " in
2065 *) deplibs="$deplibs $path" ;;
2068 fi # link_all_deplibs != no
2070 done # for deplib in $libs
2071 if test $pass = dlpreopen; then
2072 # Link the dlpreopened libraries before other libraries
2073 for deplib in $save_deplibs; do
2074 deplibs="$deplib $deplibs"
2077 if test $pass != dlopen; then
2078 test $pass != scan && dependency_libs="$newdependency_libs"
2079 if test $pass != conv; then
2080 # Make sure lib_search_path contains only unique directories.
2082 for dir in $newlib_search_path; do
2083 case "$lib_search_path " in
2085 *) lib_search_path="$lib_search_path $dir" ;;
2091 if test "$linkmode,$pass" != "prog,link"; then
2094 vars="compile_deplibs finalize_deplibs"
2096 for var in $vars dependency_libs; do
2097 # Add libraries to $var in reverse order
2098 eval tmp_libs=\"\$$var\"
2100 for deplib in $tmp_libs; do
2102 -L*) new_libs="$deplib $new_libs" ;;
2104 case " $specialdeplibs " in
2105 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2107 case " $new_libs " in
2109 *) new_libs="$deplib $new_libs" ;;
2117 for deplib in $new_libs; do
2120 case " $tmp_libs " in
2122 *) tmp_libs="$tmp_libs $deplib" ;;
2125 *) tmp_libs="$tmp_libs $deplib" ;;
2128 eval $var=\"$tmp_libs\"
2131 if test "$pass" = "conv" &&
2132 { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2133 libs="$deplibs" # reset libs
2137 if test $linkmode = prog; then
2138 dlfiles="$newdlfiles"
2139 dlprefiles="$newdlprefiles"
2144 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2145 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2148 if test -n "$rpath"; then
2149 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2152 if test -n "$xrpath"; then
2153 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2156 if test -n "$vinfo"; then
2157 $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2160 if test -n "$release"; then
2161 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2164 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2165 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2168 # Now set the variables for building old libraries.
2169 build_libtool_libs=no
2171 objs="$objs$old_deplibs"
2175 # Make sure we only generate libraries of the form `libNAME.la'.
2178 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2179 eval libname=\"$libname_spec\"
2182 if test "$module" = no; then
2183 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2187 if test "$need_lib_prefix" != no; then
2188 # Add the "lib" prefix for modules if required
2189 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2190 eval libname=\"$libname_spec\"
2192 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2197 if test -n "$objs"; then
2198 if test "$deplibs_check_method" != pass_all; then
2199 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2203 echo "*** Warning: Linking the shared library $output against the non-libtool"
2204 echo "*** objects $objs is not portable!"
2205 libobjs="$libobjs $objs"
2209 if test "$dlself" != no; then
2210 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2214 if test $# -gt 2; then
2215 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2220 if test -z "$rpath"; then
2221 if test "$build_libtool_libs" = yes; then
2222 # Building a libtool convenience library.
2224 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2225 build_libtool_libs=convenience
2229 if test -n "$vinfo"; then
2230 $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2233 if test -n "$release"; then
2234 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2238 # Parse the version information argument.
2239 save_ifs="$IFS"; IFS=':'
2240 set dummy $vinfo 0 0 0
2243 if test -n "$8"; then
2244 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2253 # Check that each of the things are valid numbers.
2255 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2257 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2258 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2264 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2266 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2267 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2273 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2275 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2276 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2281 if test $age -gt $current; then
2282 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2283 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2287 # Calculate the version variables.
2291 case $version_type in
2295 # Like Linux, but with the current version available in
2296 # verstring for coding it into the library header
2297 major=.`expr $current - $age`
2298 versuffix="$major.$age.$revision"
2299 # Darwin ld doesn't like 0 for these options...
2300 minor_current=`expr $current + 1`
2301 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2306 versuffix=".$current.$revision";
2311 versuffix=".$current";
2315 major=`expr $current - $age + 1`
2317 case $version_type in
2318 nonstopux) verstring_prefix=nonstopux ;;
2319 *) verstring_prefix=sgi ;;
2321 verstring="$verstring_prefix$major.$revision"
2323 # Add in all the interfaces that we are compatible with.
2325 while test $loop != 0; do
2326 iface=`expr $revision - $loop`
2327 loop=`expr $loop - 1`
2328 verstring="$verstring_prefix$major.$iface:$verstring"
2331 # Before this point, $major must not contain `.'.
2333 versuffix="$major.$revision"
2337 major=.`expr $current - $age`
2338 versuffix="$major.$age.$revision"
2342 major=.`expr $current - $age`
2343 versuffix=".$current.$age.$revision"
2344 verstring="$current.$age.$revision"
2346 # Add in all the interfaces that we are compatible with.
2348 while test $loop != 0; do
2349 iface=`expr $current - $loop`
2350 loop=`expr $loop - 1`
2351 verstring="$verstring:${iface}.0"
2354 # Make executables depend on our current version.
2355 verstring="$verstring:${current}.0"
2360 versuffix=".$current.$revision"
2364 # Use '-' rather than '.', since we only want one
2365 # extension on DOS 8.3 filesystems.
2366 major=`expr $current - $age`
2371 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2372 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2377 # Clear the version info if we defaulted, and they specified a release.
2378 if test -z "$vinfo" && test -n "$release"; then
2381 case $version_type in
2383 # we can't check for "0.0" in archive_cmds due to quoting
2384 # problems, so we reset it completely
2391 if test "$need_version" = no; then
2398 # Remove version info from name if versioning should be avoided
2399 if test "$avoid_version" = yes && test "$need_version" = no; then
2405 # Check to see if the archive will have undefined symbols.
2406 if test "$allow_undefined" = yes; then
2407 if test "$allow_undefined_flag" = unsupported; then
2408 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2409 build_libtool_libs=no
2413 # Don't allow undefined symbols.
2414 allow_undefined_flag="$no_undefined_flag"
2418 if test "$mode" != relink; then
2419 # Remove our outputs.
2420 $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2421 $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2424 # Now set the variables for building old libraries.
2425 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2426 oldlibs="$oldlibs $output_objdir/$libname.$libext"
2428 # Transform .lo files to .o files.
2429 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2432 # Eliminate all temporary directories.
2433 for path in $notinst_path; do
2434 lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2435 deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2436 dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2439 if test -n "$xrpath"; then
2440 # If the user specified any rpath flags, then add them.
2442 for libdir in $xrpath; do
2443 temp_xrpath="$temp_xrpath -R$libdir"
2444 case "$finalize_rpath " in
2446 *) finalize_rpath="$finalize_rpath $libdir" ;;
2449 if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2450 dependency_libs="$temp_xrpath $dependency_libs"
2454 # Make sure dlfiles contains only unique files that won't be dlpreopened
2455 old_dlfiles="$dlfiles"
2457 for lib in $old_dlfiles; do
2458 case " $dlprefiles $dlfiles " in
2460 *) dlfiles="$dlfiles $lib" ;;
2464 # Make sure dlprefiles contains only unique files
2465 old_dlprefiles="$dlprefiles"
2467 for lib in $old_dlprefiles; do
2468 case "$dlprefiles " in
2470 *) dlprefiles="$dlprefiles $lib" ;;
2474 if test "$build_libtool_libs" = yes; then
2475 if test -n "$rpath"; then
2477 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2478 # these systems don't actually have a c library (as such)!
2480 *-*-rhapsody* | *-*-darwin1.[012])
2481 # Rhapsody C library is in the System framework
2482 deplibs="$deplibs -framework System"
2485 # Don't link with libc until the a.out ld.so is fixed.
2487 *-*-openbsd* | *-*-freebsd*)
2488 # Do not include libc due to us having libc/libc_r.
2491 # Add libc to deplibs on all other systems if necessary.
2492 if test $build_libtool_need_lc = "yes"; then
2493 deplibs="$deplibs -lc"
2499 # Transform deplibs into only deplibs that can be linked in shared.
2501 libname_save=$libname
2502 release_save=$release
2503 versuffix_save=$versuffix
2505 # I'm not sure if I'm treating the release correctly. I think
2506 # release should show up in the -l (ie -lgmp5) so we don't want to
2507 # add it in twice. Is that correct?
2513 case $deplibs_check_method in
2515 # Don't check for shared/static. Everything works.
2516 # This might be a little naive. We might want to check
2517 # whether the library exists or not. But this is on
2518 # osf3 & osf4 and I'm not really sure... Just
2519 # implementing what was already the behaviour.
2523 # This code stresses the "libraries are programs" paradigm to its
2524 # limits. Maybe even breaks it. We compile a program, linking it
2525 # against the deplibs as a proxy for the library. Then we can check
2526 # whether they linked in statically or dynamically with ldd.
2528 cat > conftest.c <<EOF
2529 int main() { return 0; }
2532 $CC -o conftest conftest.c $deplibs
2533 if test $? -eq 0 ; then
2534 ldd_output=`ldd conftest`
2535 for i in $deplibs; do
2536 name="`expr $i : '-l\(.*\)'`"
2537 # If $name is empty we are operating on a -L argument.
2538 if test -n "$name" && test "$name" != "0"; then
2539 libname=`eval \\$echo \"$libname_spec\"`
2540 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2541 set dummy $deplib_matches
2543 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2544 newdeplibs="$newdeplibs $i"
2548 echo "*** Warning: dynamic linker does not accept needed library $i."
2549 echo "*** I have the capability to make that library automatically link in when"
2550 echo "*** you link to this library. But I can only do this if you have a"
2551 echo "*** shared version of the library, which I believe you do not have"
2552 echo "*** because a test_compile did reveal that the linker did not use it for"
2553 echo "*** its dynamic dependency list that programs get resolved with at runtime."
2556 newdeplibs="$newdeplibs $i"
2560 # Error occured in the first compile. Let's try to salvage
2561 # the situation: Compile a separate program for each library.
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
2567 $CC -o conftest conftest.c $i
2569 if test $? -eq 0 ; then
2570 ldd_output=`ldd conftest`
2571 libname=`eval \\$echo \"$libname_spec\"`
2572 deplib_matches=`eval \\$echo \"$library_names_spec\"`
2573 set dummy $deplib_matches
2575 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2576 newdeplibs="$newdeplibs $i"
2580 echo "*** Warning: dynamic linker does not accept needed library $i."
2581 echo "*** I have the capability to make that library automatically link in when"
2582 echo "*** you link to this library. But I can only do this if you have a"
2583 echo "*** shared version of the library, which you do not appear to have"
2584 echo "*** because a test_compile did reveal that the linker did not use this one"
2585 echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2590 echo "*** Warning! Library $i is needed by this library but I was not able to"
2591 echo "*** make it link in! You will probably need to install it or some"
2592 echo "*** library that it depends on before this library will be fully"
2593 echo "*** functional. Installing it before continuing would be even better."
2596 newdeplibs="$newdeplibs $i"
2602 set dummy $deplibs_check_method
2603 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2604 for a_deplib in $deplibs; do
2605 name="`expr $a_deplib : '-l\(.*\)'`"
2606 # If $name is empty we are operating on a -L argument.
2607 if test -n "$name" && test "$name" != "0"; then
2608 libname=`eval \\$echo \"$libname_spec\"`
2609 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2610 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2611 for potent_lib in $potential_libs; do
2612 # Follow soft links.
2613 if ls -lLd "$potent_lib" 2>/dev/null \
2614 | grep " -> " >/dev/null; then
2617 # The statement above tries to avoid entering an
2618 # endless loop below, in case of cyclic links.
2619 # We might still enter an endless loop, since a link
2620 # loop can be closed while we follow links,
2622 potlib="$potent_lib"
2623 while test -h "$potlib" 2>/dev/null; do
2624 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2626 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2627 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2630 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2632 | egrep "$file_magic_regex" > /dev/null; then
2633 newdeplibs="$newdeplibs $a_deplib"
2639 if test -n "$a_deplib" ; then
2642 echo "*** Warning: linker path does not have real file for library $a_deplib."
2643 echo "*** I have the capability to make that library automatically link in when"
2644 echo "*** you link to this library. But I can only do this if you have a"
2645 echo "*** shared version of the library, which you do not appear to have"
2646 echo "*** because I did check the linker path looking for a file starting"
2647 if test -z "$potlib" ; then
2648 echo "*** with $libname but no candidates were found. (...for file magic test)"
2650 echo "*** with $libname and none of the candidates passed a file format test"
2651 echo "*** using a file magic. Last file checked: $potlib"
2655 # Add a -L argument.
2656 newdeplibs="$newdeplibs $a_deplib"
2658 done # Gone through all deplibs.
2661 set dummy $deplibs_check_method
2662 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2663 for a_deplib in $deplibs; do
2664 name="`expr $a_deplib : '-l\(.*\)'`"
2665 # If $name is empty we are operating on a -L argument.
2666 if test -n "$name" && test "$name" != "0"; then
2667 libname=`eval \\$echo \"$libname_spec\"`
2668 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2669 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2670 for potent_lib in $potential_libs; do
2671 potlib="$potent_lib" # see symlink-check below in file_magic test
2672 if eval echo \"$potent_lib\" 2>/dev/null \
2674 | egrep "$match_pattern_regex" > /dev/null; then
2675 newdeplibs="$newdeplibs $a_deplib"
2681 if test -n "$a_deplib" ; then
2684 echo "*** Warning: linker path does not have real file for library $a_deplib."
2685 echo "*** I have the capability to make that library automatically link in when"
2686 echo "*** you link to this library. But I can only do this if you have a"
2687 echo "*** shared version of the library, which you do not appear to have"
2688 echo "*** because I did check the linker path looking for a file starting"
2689 if test -z "$potlib" ; then
2690 echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2692 echo "*** with $libname and none of the candidates passed a file format test"
2693 echo "*** using a regex pattern. Last file checked: $potlib"
2697 # Add a -L argument.
2698 newdeplibs="$newdeplibs $a_deplib"
2700 done # Gone through all deplibs.
2704 if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2705 -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
2706 grep . >/dev/null; then
2708 if test "X$deplibs_check_method" = "Xnone"; then
2709 echo "*** Warning: inter-library dependencies are not supported in this platform."
2711 echo "*** Warning: inter-library dependencies are not known to be supported."
2713 echo "*** All declared inter-library dependencies are being dropped."
2718 versuffix=$versuffix_save
2720 release=$release_save
2721 libname=$libname_save
2725 *-*-rhapsody* | *-*-darwin1.[012])
2726 # On Rhapsody replace the C library is the System framework
2727 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2731 if test "$droppeddeps" = yes; then
2732 if test "$module" = yes; then
2734 echo "*** Warning: libtool could not satisfy all declared inter-library"
2735 echo "*** dependencies of module $libname. Therefore, libtool will create"
2736 echo "*** a static module, that should work as long as the dlopening"
2737 echo "*** application is linked with the -dlopen flag."
2738 if test -z "$global_symbol_pipe"; then
2740 echo "*** However, this would only work if libtool was able to extract symbol"
2741 echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2742 echo "*** not find such a program. So, this module is probably useless."
2743 echo "*** \`nm' from GNU binutils and a full rebuild may help."
2745 if test "$build_old_libs" = no; then
2746 oldlibs="$output_objdir/$libname.$libext"
2747 build_libtool_libs=module
2750 build_libtool_libs=no
2753 echo "*** The inter-library dependencies that have been dropped here will be"
2754 echo "*** automatically added whenever a program is linked with this library"
2755 echo "*** or is declared to -dlopen it."
2757 if test $allow_undefined = no; then
2759 echo "*** Since this library must not contain undefined symbols,"
2760 echo "*** because either the platform does not support them or"
2761 echo "*** it was explicitly requested with -no-undefined,"
2762 echo "*** libtool will only create a static version of it."
2763 if test "$build_old_libs" = no; then
2764 oldlibs="$output_objdir/$libname.$libext"
2765 build_libtool_libs=module
2768 build_libtool_libs=no
2773 # Done checking deplibs!
2777 # All the library-specific variables (install_libdir is set above).
2782 # Test again, we may have decided not to build it any more
2783 if test "$build_libtool_libs" = yes; then
2784 if test $hardcode_into_libs = yes; then
2785 # Hardcode the library paths
2788 rpath="$finalize_rpath"
2789 test "$mode" != relink && rpath="$compile_rpath$rpath"
2790 for libdir in $rpath; do
2791 if test -n "$hardcode_libdir_flag_spec"; then
2792 if test -n "$hardcode_libdir_separator"; then
2793 if test -z "$hardcode_libdirs"; then
2794 hardcode_libdirs="$libdir"
2796 # Just accumulate the unique libdirs.
2797 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2798 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2801 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2806 eval flag=\"$hardcode_libdir_flag_spec\"
2807 dep_rpath="$dep_rpath $flag"
2809 elif test -n "$runpath_var"; then
2810 case "$perm_rpath " in
2812 *) perm_rpath="$perm_rpath $libdir" ;;
2816 # Substitute the hardcoded libdirs into the rpath.
2817 if test -n "$hardcode_libdir_separator" &&
2818 test -n "$hardcode_libdirs"; then
2819 libdir="$hardcode_libdirs"
2820 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2822 if test -n "$runpath_var" && test -n "$perm_rpath"; then
2823 # We should set the runpath_var.
2825 for dir in $perm_rpath; do
2828 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2830 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2833 shlibpath="$finalize_shlibpath"
2834 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2835 if test -n "$shlibpath"; then
2836 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2839 # Get the real and link names of the library.
2840 eval library_names=\"$library_names_spec\"
2841 set dummy $library_names
2845 if test -n "$soname_spec"; then
2846 eval soname=\"$soname_spec\"
2850 test -z "$dlname" && dlname=$soname
2852 lib="$output_objdir/$realname"
2855 linknames="$linknames $link"
2858 # Ensure that we have .o objects for linkers which dislike .lo
2859 # (e.g. aix) in case we are running --disable-static
2860 for obj in $libobjs; do
2861 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2862 if test "X$xdir" = "X$obj"; then
2867 baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2868 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2869 if test ! -f $xdir/$oldobj; then
2870 $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2871 $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2875 # Use standard objects if they are pic
2876 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2878 # Prepare the list of exported symbols
2879 if test -z "$export_symbols"; then
2880 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2881 $show "generating symbol list for \`$libname.la'"
2882 export_symbols="$output_objdir/$libname.exp"
2883 $run $rm $export_symbols
2884 eval cmds=\"$export_symbols_cmds\"
2885 save_ifs="$IFS"; IFS='~'
2886 for cmd in $cmds; do
2889 $run eval "$cmd" || exit $?
2892 if test -n "$export_symbols_regex"; then
2893 $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2894 $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2895 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2896 $run eval '$mv "${export_symbols}T" "$export_symbols"'
2901 if test -n "$export_symbols" && test -n "$include_expsyms"; then
2902 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2905 if test -n "$convenience"; then
2906 if test -n "$whole_archive_flag_spec"; then
2907 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2909 gentop="$output_objdir/${outputname}x"
2910 $show "${rm}r $gentop"
2911 $run ${rm}r "$gentop"
2912 $show "mkdir $gentop"
2913 $run mkdir "$gentop"
2915 if test $status -ne 0 && test ! -d "$gentop"; then
2918 generated="$generated $gentop"
2920 for xlib in $convenience; do
2921 # Extract the objects.
2923 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2924 *) xabs=`pwd`"/$xlib" ;;
2926 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2927 xdir="$gentop/$xlib"
2929 $show "${rm}r $xdir"
2934 if test $status -ne 0 && test ! -d "$xdir"; then
2937 $show "(cd $xdir && $AR x $xabs)"
2938 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2940 libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2945 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2946 eval flag=\"$thread_safe_flag_spec\"
2947 linker_flags="$linker_flags $flag"
2950 # Make a backup of the uninstalled library when relinking
2951 if test "$mode" = relink; then
2952 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2955 # Do each of the archive commands.
2956 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2957 eval cmds=\"$archive_expsym_cmds\"
2959 save_deplibs="$deplibs"
2960 for conv in $convenience; do
2962 for test_deplib in $deplibs; do
2963 if test "$test_deplib" != "$conv"; then
2964 tmp_deplibs="$tmp_deplibs $test_deplib"
2967 deplibs="$tmp_deplibs"
2969 eval cmds=\"$archive_cmds\"
2970 deplibs="$save_deplibs"
2972 save_ifs="$IFS"; IFS='~'
2973 for cmd in $cmds; do
2976 $run eval "$cmd" || exit $?
2980 # Restore the uninstalled library and exit
2981 if test "$mode" = relink; then
2982 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2986 # Create links to the real library.
2987 for linkname in $linknames; do
2988 if test "$realname" != "$linkname"; then
2989 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
2990 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
2994 # If -module or -export-dynamic was specified, set the dlname.
2995 if test "$module" = yes || test "$export_dynamic" = yes; then
2996 # On all known operating systems, these are identical.
3003 if test -n "$deplibs"; then
3004 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3007 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3008 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3011 if test -n "$rpath"; then
3012 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3015 if test -n "$xrpath"; then
3016 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3019 if test -n "$vinfo"; then
3020 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3023 if test -n "$release"; then
3024 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3029 if test -n "$objs$old_deplibs"; then
3030 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3034 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3042 # Delete the old objects.
3043 $run $rm $obj $libobj
3045 # Objects from convenience libraries. This assumes
3046 # single-version convenience libraries. Whenever we create
3047 # different ones for PIC/non-PIC, this we'll have to duplicate
3051 # reload_cmds runs $LD directly, so let us get rid of
3052 # -Wl from whole_archive_flag_spec
3055 if test -n "$convenience"; then
3056 if test -n "$whole_archive_flag_spec"; then
3057 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3059 gentop="$output_objdir/${obj}x"
3060 $show "${rm}r $gentop"
3061 $run ${rm}r "$gentop"
3062 $show "mkdir $gentop"
3063 $run mkdir "$gentop"
3065 if test $status -ne 0 && test ! -d "$gentop"; then
3068 generated="$generated $gentop"
3070 for xlib in $convenience; do
3071 # Extract the objects.
3073 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3074 *) xabs=`pwd`"/$xlib" ;;
3076 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3077 xdir="$gentop/$xlib"
3079 $show "${rm}r $xdir"
3084 if test $status -ne 0 && test ! -d "$xdir"; then
3087 $show "(cd $xdir && $AR x $xabs)"
3088 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3090 reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3095 # Create the old-style object.
3096 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
3099 eval cmds=\"$reload_cmds\"
3100 save_ifs="$IFS"; IFS='~'
3101 for cmd in $cmds; do
3104 $run eval "$cmd" || exit $?
3108 # Exit if we aren't doing a library object file.
3109 if test -z "$libobj"; then
3110 if test -n "$gentop"; then
3111 $show "${rm}r $gentop"
3118 if test "$build_libtool_libs" != yes; then
3119 if test -n "$gentop"; then
3120 $show "${rm}r $gentop"
3124 # Create an invalid libtool object if no PIC, so that we don't
3125 # accidentally link it into a program.
3126 $show "echo timestamp > $libobj"
3127 $run eval "echo timestamp > $libobj" || exit $?
3131 if test -n "$pic_flag" || test "$pic_mode" != default; then
3132 # Only do commands if we really have different PIC objects.
3133 reload_objs="$libobjs $reload_conv_objs"
3135 eval cmds=\"$reload_cmds\"
3136 save_ifs="$IFS"; IFS='~'
3137 for cmd in $cmds; do
3140 $run eval "$cmd" || exit $?
3144 # Just create a symlink.
3147 xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3148 if test "X$xdir" = "X$libobj"; then
3153 baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3154 oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3155 $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3156 $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3159 if test -n "$gentop"; then
3160 $show "${rm}r $gentop"
3169 *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3171 if test -n "$vinfo"; then
3172 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3175 if test -n "$release"; then
3176 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3179 if test "$preload" = yes; then
3180 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3181 test "$dlopen_self_static" = unknown; then
3182 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3187 *-*-rhapsody* | *-*-darwin1.[012])
3188 # On Rhapsody replace the C library is the System framework
3189 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3190 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3193 # Don't allow lazy linking, it breaks C++ global constructors
3194 compile_command="$compile_command ${wl}-bind_at_load"
3195 finalize_command="$finalize_command ${wl}-bind_at_load"
3201 compile_command="$compile_command $compile_deplibs"
3202 finalize_command="$finalize_command $finalize_deplibs"
3204 if test -n "$rpath$xrpath"; then
3205 # If the user specified any rpath flags, then add them.
3206 for libdir in $rpath $xrpath; do
3207 # This is the magic to use -rpath.
3208 case "$finalize_rpath " in
3210 *) finalize_rpath="$finalize_rpath $libdir" ;;
3215 # Now hardcode the library paths
3218 for libdir in $compile_rpath $finalize_rpath; do
3219 if test -n "$hardcode_libdir_flag_spec"; then
3220 if test -n "$hardcode_libdir_separator"; then
3221 if test -z "$hardcode_libdirs"; then
3222 hardcode_libdirs="$libdir"
3224 # Just accumulate the unique libdirs.
3225 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3226 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3229 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3234 eval flag=\"$hardcode_libdir_flag_spec\"
3235 rpath="$rpath $flag"
3237 elif test -n "$runpath_var"; then
3238 case "$perm_rpath " in
3240 *) perm_rpath="$perm_rpath $libdir" ;;
3244 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3245 case :$dllsearchpath: in
3247 *) dllsearchpath="$dllsearchpath:$libdir";;
3252 # Substitute the hardcoded libdirs into the rpath.
3253 if test -n "$hardcode_libdir_separator" &&
3254 test -n "$hardcode_libdirs"; then
3255 libdir="$hardcode_libdirs"
3256 eval rpath=\" $hardcode_libdir_flag_spec\"
3258 compile_rpath="$rpath"
3262 for libdir in $finalize_rpath; do
3263 if test -n "$hardcode_libdir_flag_spec"; then
3264 if test -n "$hardcode_libdir_separator"; then
3265 if test -z "$hardcode_libdirs"; then
3266 hardcode_libdirs="$libdir"
3268 # Just accumulate the unique libdirs.
3269 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3270 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3273 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3278 eval flag=\"$hardcode_libdir_flag_spec\"
3279 rpath="$rpath $flag"
3281 elif test -n "$runpath_var"; then
3282 case "$finalize_perm_rpath " in
3284 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3288 # Substitute the hardcoded libdirs into the rpath.
3289 if test -n "$hardcode_libdir_separator" &&
3290 test -n "$hardcode_libdirs"; then
3291 libdir="$hardcode_libdirs"
3292 eval rpath=\" $hardcode_libdir_flag_spec\"
3294 finalize_rpath="$rpath"
3296 if test -n "$libobjs" && test "$build_old_libs" = yes; then
3297 # Transform all the library objects into standard objects.
3298 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3299 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3303 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3304 if test -n "$NM" && test -n "$global_symbol_pipe"; then
3305 dlsyms="${outputname}S.c"
3307 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3311 if test -n "$dlsyms"; then
3315 # Discover the nlist of each of the dlfiles.
3316 nlist="$output_objdir/${outputname}.nm"
3318 $show "$rm $nlist ${nlist}S ${nlist}T"
3319 $run $rm "$nlist" "${nlist}S" "${nlist}T"
3321 # Parse the name list into a source file.
3322 $show "creating $output_objdir/$dlsyms"
3324 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3325 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3326 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3332 /* Prevent the only kind of declaration conflicts we can make. */
3333 #define lt_preloaded_symbols some_other_symbol
3335 /* External symbol declarations for the compiler. */\
3338 if test "$dlself" = yes; then
3339 $show "generating symbol list for \`$output'"
3341 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3343 # Add our own program objects to the symbol list.
3344 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3345 for arg in $progfiles; do
3346 $show "extracting global C symbols from \`$arg'"
3347 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3350 if test -n "$exclude_expsyms"; then
3351 $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3352 $run eval '$mv "$nlist"T "$nlist"'
3355 if test -n "$export_symbols_regex"; then
3356 $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3357 $run eval '$mv "$nlist"T "$nlist"'
3360 # Prepare the list of exported symbols
3361 if test -z "$export_symbols"; then
3362 export_symbols="$output_objdir/$output.exp"
3363 $run $rm $export_symbols
3364 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3366 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3367 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3368 $run eval 'mv "$nlist"T "$nlist"'
3372 for arg in $dlprefiles; do
3373 $show "extracting global C symbols from \`$arg'"
3374 name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3375 $run eval 'echo ": $name " >> "$nlist"'
3376 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3379 if test -z "$run"; then
3380 # Make sure we have at least an empty file.
3381 test -f "$nlist" || : > "$nlist"
3383 if test -n "$exclude_expsyms"; then
3384 egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3385 $mv "$nlist"T "$nlist"
3388 # Try sorting and uniquifying the output.
3389 if grep -v "^: " < "$nlist" |
3390 if sort -k 3 </dev/null >/dev/null 2>&1; then
3395 uniq > "$nlist"S; then
3398 grep -v "^: " < "$nlist" > "$nlist"S
3401 if test -f "$nlist"S; then
3402 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3404 echo '/* NONE */' >> "$output_objdir/$dlsyms"
3407 $echo >> "$output_objdir/$dlsyms" "\
3409 #undef lt_preloaded_symbols
3411 #if defined (__STDC__) && __STDC__
3412 # define lt_ptr void *
3414 # define lt_ptr char *
3418 /* The mapping between symbol names and symbols. */
3423 lt_preloaded_symbols[] =
3427 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3429 $echo >> "$output_objdir/$dlsyms" "\
3433 /* This works around a problem in FreeBSD linker */
3434 #ifdef FREEBSD_WORKAROUND
3435 static const void *lt_preloaded_setup() {
3436 return lt_preloaded_symbols;
3446 pic_flag_for_symtable=
3448 # compiling the symbol table file with pic_flag works around
3449 # a FreeBSD bug that causes programs to crash when -lm is
3450 # linked before any other PIC object. But we must not use
3451 # pic_flag when linking with -static. The problem exists in
3452 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3453 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3454 case "$compile_command " in
3456 *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3459 case "$compile_command " in
3461 *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3465 # Now compile the dynamic symbol file.
3466 $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3467 $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3469 # Clean up the generated files.
3470 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3471 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3473 # Transform the symbol file into the correct name.
3474 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3475 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3478 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3483 # We keep going just in case the user didn't refer to
3484 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
3485 # really was required.
3487 # Nullify the symbol file.
3488 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3489 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3492 if test $need_relink = no || test "$build_libtool_libs" != yes; then
3493 # Replace the output file specification.
3494 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3495 link_command="$compile_command$compile_rpath"
3497 # We have no uninstalled library dependencies, so finalize right now.
3498 $show "$link_command"
3499 $run eval "$link_command"
3502 # Delete the generated files.
3503 if test -n "$dlsyms"; then
3504 $show "$rm $output_objdir/${outputname}S.${objext}"
3505 $run $rm "$output_objdir/${outputname}S.${objext}"
3511 if test -n "$shlibpath_var"; then
3512 # We should set the shlibpath_var
3514 for dir in $temp_rpath; do
3516 [\\/]* | [A-Za-z]:[\\/]*)
3521 # Relative path: add a thisdir entry.
3522 rpath="$rpath\$thisdir/$dir:"
3529 if test -n "$compile_shlibpath$finalize_shlibpath"; then
3530 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3532 if test -n "$finalize_shlibpath"; then
3533 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3538 if test -n "$runpath_var"; then
3539 if test -n "$perm_rpath"; then
3540 # We should set the runpath_var.
3542 for dir in $perm_rpath; do
3545 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3547 if test -n "$finalize_perm_rpath"; then
3548 # We should set the runpath_var.
3550 for dir in $finalize_perm_rpath; do
3553 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3557 if test "$no_install" = yes; then
3558 # We don't need to create a wrapper script.
3559 link_command="$compile_var$compile_command$compile_rpath"
3560 # Replace the output file specification.
3561 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3562 # Delete the old output file.
3564 # Link the executable and exit
3565 $show "$link_command"
3566 $run eval "$link_command" || exit $?
3570 if test "$hardcode_action" = relink; then
3571 # Fast installation is not supported
3572 link_command="$compile_var$compile_command$compile_rpath"
3573 relink_command="$finalize_var$finalize_command$finalize_rpath"
3575 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3576 $echo "$modename: \`$output' will be relinked during installation" 1>&2
3578 if test "$fast_install" != no; then
3579 link_command="$finalize_var$compile_command$finalize_rpath"
3580 if test "$fast_install" = yes; then
3581 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3583 # fast_install is set to needless
3587 link_command="$compile_var$compile_command$compile_rpath"
3588 relink_command="$finalize_var$finalize_command$finalize_rpath"
3592 # Replace the output file specification.
3593 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3595 # Delete the old output files.
3596 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3598 $show "$link_command"
3599 $run eval "$link_command" || exit $?
3601 # Now create the wrapper script.
3602 $show "creating $output"
3604 # Quote the relink command for shipping.
3605 if test -n "$relink_command"; then
3606 # Preserve any variables that may affect compiler behavior
3607 for var in $variables_saved_for_relink; do
3608 if eval test -z \"\${$var+set}\"; then
3609 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3610 elif eval var_value=\$$var; test -z "$var_value"; then
3611 relink_command="$var=; export $var; $relink_command"
3613 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3614 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3617 relink_command="(cd `pwd`; $relink_command)"
3618 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3621 # Quote $echo for shipping.
3622 if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3624 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3625 *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3627 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3629 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3632 # Only actually do things if our run command is non-null.
3633 if test -z "$run"; then
3634 # win32 will think the script is a binary if it has
3635 # a .exe suffix, so we strip it off here.
3637 *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3639 # test for cygwin because mv fails w/o .exe extensions
3641 *cygwin*) exeext=.exe ;;
3645 trap "$rm $output; exit 1" 1 2 15
3650 # $output - temporary wrapper script for $objdir/$outputname
3651 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3653 # The $output program cannot be directly executed until all the libtool
3654 # libraries that it depends on are installed.
3656 # This wrapper script should never be moved out of the build directory.
3657 # If it is, it will not operate correctly.
3659 # Sed substitution that helps us do robust quoting. It backslashifies
3660 # metacharacters that are still active within double-quoted strings.
3661 Xsed="${SED}"' -e 1s/^X//'
3662 sed_quote_subst='$sed_quote_subst'
3664 # The HP-UX ksh and POSIX shell print the target directory to stdout
3666 if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3668 relink_command=\"$relink_command\"
3670 # This environment variable determines our operation mode.
3671 if test \"\$libtool_install_magic\" = \"$magic\"; then
3672 # install mode needs the following variable:
3673 notinst_deplibs='$notinst_deplibs'
3675 # When we are sourced in execute mode, \$file and \$echo are already set.
3676 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3679 # Make sure echo works.
3680 if test \"X\$1\" = X--no-reexec; then
3681 # Discard the --no-reexec flag, and continue.
3683 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3684 # Yippee, \$echo works!
3687 # Restart under the correct shell, and then maybe \$echo will work.
3688 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3694 # Find the directory that this script lives in.
3695 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3696 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3698 # Follow symbolic links until we get to the real thisdir.
3699 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3700 while test -n \"\$file\"; do
3701 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3703 # If there was a directory component, then change thisdir.
3704 if test \"x\$destdir\" != \"x\$file\"; then
3705 case \"\$destdir\" in
3706 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3707 *) thisdir=\"\$thisdir/\$destdir\" ;;
3711 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3712 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3715 # Try to get the absolute directory name.
3716 absdir=\`cd \"\$thisdir\" && pwd\`
3717 test -n \"\$absdir\" && thisdir=\"\$absdir\"
3720 if test "$fast_install" = yes; then
3722 program=lt-'$outputname'$exeext
3723 progdir=\"\$thisdir/$objdir\"
3725 if test ! -f \"\$progdir/\$program\" || \\
3726 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3727 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3729 file=\"\$\$-\$program\"
3731 if test ! -d \"\$progdir\"; then
3732 $mkdir \"\$progdir\"
3734 $rm \"\$progdir/\$file\"
3739 # relink executable if necessary
3740 if test -n \"\$relink_command\"; then
3741 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3743 $echo \"\$relink_command_output\" >&2
3744 $rm \"\$progdir/\$file\"
3749 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3750 { $rm \"\$progdir/\$program\";
3751 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3752 $rm \"\$progdir/\$file\"
3756 program='$outputname'
3757 progdir=\"\$thisdir/$objdir\"
3763 if test -f \"\$progdir/\$program\"; then"
3765 # Export our shlibpath_var if we have one.
3766 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3768 # Add our own library path to $shlibpath_var
3769 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3771 # Some systems cannot cope with colon-terminated $shlibpath_var
3772 # The second colon is a workaround for a bug in BeOS R4 ${SED}
3773 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3775 export $shlibpath_var
3779 # fixup the dll searchpath if we need to.
3780 if test -n "$dllsearchpath"; then
3782 # Add the dll search path components to the executable PATH
3783 PATH=$dllsearchpath:\$PATH
3788 if test \"\$libtool_execute_magic\" != \"$magic\"; then
3789 # Run the actual program with our arguments.
3792 # win32 systems need to use the prog path for dll
3794 *-*-cygwin* | *-*-pw32*)
3796 exec \$progdir/\$program \${1+\"\$@\"}
3800 # Backslashes separate directories on plain windows
3801 *-*-mingw | *-*-os2*)
3803 exec \$progdir\\\\\$program \${1+\"\$@\"}
3809 # Export the path to the program.
3810 PATH=\"\$progdir:\$PATH\"
3813 exec \$program \${1+\"\$@\"}
3818 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3822 # The program doesn't exist.
3823 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3824 \$echo \"This script is just a wrapper for \$program.\" 1>&2
3825 echo \"See the $PACKAGE documentation for more information.\" 1>&2
3836 # See if we need to build an old-fashioned archive.
3837 for oldlib in $oldlibs; do
3839 if test "$build_libtool_libs" = convenience; then
3840 oldobjs="$libobjs_save"
3841 addlibs="$convenience"
3842 build_libtool_libs=no
3844 if test "$build_libtool_libs" = module; then
3845 oldobjs="$libobjs_save"
3846 build_libtool_libs=no
3848 oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3850 addlibs="$old_convenience"
3853 if test -n "$addlibs"; then
3854 gentop="$output_objdir/${outputname}x"
3855 $show "${rm}r $gentop"
3856 $run ${rm}r "$gentop"
3857 $show "mkdir $gentop"
3858 $run mkdir "$gentop"
3860 if test $status -ne 0 && test ! -d "$gentop"; then
3863 generated="$generated $gentop"
3865 # Add in members from convenience archives.
3866 for xlib in $addlibs; do
3867 # Extract the objects.
3869 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3870 *) xabs=`pwd`"/$xlib" ;;
3872 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3873 xdir="$gentop/$xlib"
3875 $show "${rm}r $xdir"
3880 if test $status -ne 0 && test ! -d "$xdir"; then
3883 $show "(cd $xdir && $AR x $xabs)"
3884 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3886 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3890 # Do each command in the archive commands.
3891 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3892 eval cmds=\"$old_archive_from_new_cmds\"
3894 # Ensure that we have .o objects in place in case we decided
3895 # not to build a shared library, and have fallen back to building
3896 # static libs even though --disable-static was passed!
3897 for oldobj in $oldobjs; do
3898 if test ! -f $oldobj; then
3899 xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3900 if test "X$xdir" = "X$oldobj"; then
3905 baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3906 obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3907 $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3908 $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3912 eval cmds=\"$old_archive_cmds\"
3914 save_ifs="$IFS"; IFS='~'
3915 for cmd in $cmds; do
3918 $run eval "$cmd" || exit $?
3923 if test -n "$generated"; then
3924 $show "${rm}r$generated"
3925 $run ${rm}r$generated
3928 # Now create the libtool archive.
3932 test "$build_old_libs" = yes && old_library="$libname.$libext"
3933 $show "creating $output"
3935 # Preserve any variables that may affect compiler behavior
3936 for var in $variables_saved_for_relink; do
3937 if eval test -z \"\${$var+set}\"; then
3938 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3939 elif eval var_value=\$$var; test -z "$var_value"; then
3940 relink_command="$var=; export $var; $relink_command"
3942 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3943 relink_command="$var=\"$var_value\"; export $var; $relink_command"
3946 # Quote the link command for shipping.
3947 relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
3948 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3950 # Only create the output if not a dry run.
3951 if test -z "$run"; then
3952 for installed in no yes; do
3953 if test "$installed" = yes; then
3954 if test -z "$install_libdir"; then
3957 output="$output_objdir/$outputname"i
3958 # Replace all uninstalled libtool libraries with the installed ones
3960 for deplib in $dependency_libs; do
3963 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3964 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3965 if test -z "$libdir"; then
3966 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3969 newdependency_libs="$newdependency_libs $libdir/$name"
3971 *) newdependency_libs="$newdependency_libs $deplib" ;;
3974 dependency_libs="$newdependency_libs"
3976 for lib in $dlfiles; do
3977 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3978 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3979 if test -z "$libdir"; then
3980 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3983 newdlfiles="$newdlfiles $libdir/$name"
3985 dlfiles="$newdlfiles"
3987 for lib in $dlprefiles; do
3988 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3989 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3990 if test -z "$libdir"; then
3991 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3994 newdlprefiles="$newdlprefiles $libdir/$name"
3996 dlprefiles="$newdlprefiles"
3999 # place dlname in correct position for cygwin
4001 case $host,$output,$installed,$module,$dlname in
4002 *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4005 # $outputname - a libtool library file
4006 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4008 # Please DO NOT delete this file!
4009 # It is necessary for linking the library.
4011 # The name that we can dlopen(3).
4014 # Names of this library.
4015 library_names='$library_names'
4017 # The name of the static archive.
4018 old_library='$old_library'
4020 # Libraries that this one depends upon.
4021 dependency_libs='$dependency_libs'
4023 # Version information for $libname.
4028 # Is this an already installed library?
4029 installed=$installed
4031 # Files to dlopen/dlpreopen
4033 dlpreopen='$dlprefiles'
4035 # Directory that this library needs to be installed in:
4036 libdir='$install_libdir'"
4037 if test "$installed" = no && test $need_relink = yes; then
4039 relink_command=\"$relink_command\""
4044 # Do a symbolic link so that the libtool archive can be found in
4045 # LD_LIBRARY_PATH before the program is installed.
4046 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4047 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4053 # libtool install mode
4055 modename="$modename: install"
4057 # There may be an optional sh(1) argument at the beginning of
4058 # install_prog (especially on Windows NT).
4059 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4060 # Allow the use of GNU shtool's install command.
4061 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4062 # Aesthetically quote it.
4063 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4065 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4069 install_prog="$arg "
4077 # The real first argument should be the name of the installation program.
4078 # Aesthetically quote it.
4079 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4081 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4085 install_prog="$install_prog$arg"
4087 # We need to accept at least all the BSD install flags.
4097 if test -n "$dest"; then
4098 files="$files $dest"
4116 # If the previous option needed an argument, then skip it.
4117 if test -n "$prev"; then
4126 # Aesthetically quote the argument.
4127 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4129 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*)
4133 install_prog="$install_prog $arg"
4136 if test -z "$install_prog"; then
4137 $echo "$modename: you must specify an install program" 1>&2
4142 if test -n "$prev"; then
4143 $echo "$modename: the \`$prev' option requires an argument" 1>&2
4148 if test -z "$files"; then
4149 if test -z "$dest"; then
4150 $echo "$modename: no file or destination specified" 1>&2
4152 $echo "$modename: you must specify a destination" 1>&2
4158 # Strip any trailing slash from the destination.
4159 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4161 # Check to see that the destination is a directory.
4162 test -d "$dest" && isdir=yes
4163 if test "$isdir" = yes; then
4167 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4168 test "X$destdir" = "X$dest" && destdir=.
4169 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4171 # Not a directory, so check to see that there is only one file specified.
4173 if test $# -gt 2; then
4174 $echo "$modename: \`$dest' is not a directory" 1>&2
4180 [\\/]* | [A-Za-z]:[\\/]*) ;;
4182 for file in $files; do
4186 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4195 # This variable tells wrapper scripts just to set variables rather
4196 # than running their programs.
4197 libtool_install_magic="$magic"
4202 for file in $files; do
4204 # Do each installation.
4207 # Do the static libraries later.
4208 staticlibs="$staticlibs $file"
4212 # Check to see that this really is a libtool archive.
4213 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4215 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4223 # If there is no directory component, then add one.
4225 */* | *\\*) . $file ;;
4229 # Add the libdir to current_libdirs if it is the destination.
4230 if test "X$destdir" = "X$libdir"; then
4231 case "$current_libdirs " in
4233 *) current_libdirs="$current_libdirs $libdir" ;;
4236 # Note the libdir as a future libdir.
4237 case "$future_libdirs " in
4239 *) future_libdirs="$future_libdirs $libdir" ;;
4243 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4244 test "X$dir" = "X$file/" && dir=
4247 if test -n "$relink_command"; then
4248 $echo "$modename: warning: relinking \`$file'" 1>&2
4249 $show "$relink_command"
4250 if $run eval "$relink_command"; then :
4252 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4257 # See the names of the shared library.
4258 set dummy $library_names
4259 if test -n "$2"; then
4265 test -n "$relink_command" && srcname="$realname"T
4267 # Install the shared library and build the symlinks.
4268 $show "$install_prog $dir/$srcname $destdir/$realname"
4269 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4270 if test -n "$stripme" && test -n "$striplib"; then
4271 $show "$striplib $destdir/$realname"
4272 $run eval "$striplib $destdir/$realname" || exit $?
4275 if test $# -gt 0; then
4276 # Delete the old symlinks, and create new ones.
4279 if test "$linkname" != "$realname"; then
4280 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4281 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4286 # Do each command in the postinstall commands.
4287 lib="$destdir/$realname"
4288 eval cmds=\"$postinstall_cmds\"
4289 save_ifs="$IFS"; IFS='~'
4290 for cmd in $cmds; do
4293 $run eval "$cmd" || exit $?
4298 # Install the pseudo-library for information purposes.
4299 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4300 instname="$dir/$name"i
4301 $show "$install_prog $instname $destdir/$name"
4302 $run eval "$install_prog $instname $destdir/$name" || exit $?
4304 # Maybe install the static library, too.
4305 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4309 # Install (i.e. copy) a libtool object.
4311 # Figure out destination file name, if it wasn't already specified.
4312 if test -n "$destname"; then
4313 destfile="$destdir/$destname"
4315 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4316 destfile="$destdir/$destfile"
4319 # Deduce the name of the destination old-style object file.
4322 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4325 staticdest="$destfile"
4329 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4335 # Install the libtool object if requested.
4336 if test -n "$destfile"; then
4337 $show "$install_prog $file $destfile"
4338 $run eval "$install_prog $file $destfile" || exit $?
4341 # Install the old object if enabled.
4342 if test "$build_old_libs" = yes; then
4343 # Deduce the name of the old-style object file.
4344 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4346 $show "$install_prog $staticobj $staticdest"
4347 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4353 # Figure out destination file name, if it wasn't already specified.
4354 if test -n "$destname"; then
4355 destfile="$destdir/$destname"
4357 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4358 destfile="$destdir/$destfile"
4361 # Do a test to see if this is really a libtool program.
4364 wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4370 if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4374 # If there is no directory component, then add one.
4376 */* | *\\*) . $wrapper ;;
4380 # Check the variables that should have been set.
4381 if test -z "$notinst_deplibs"; then
4382 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4387 for lib in $notinst_deplibs; do
4388 # Check to see that each library is installed.
4390 if test -f "$lib"; then
4391 # If there is no directory component, then add one.
4393 */* | *\\*) . $lib ;;
4397 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4398 if test -n "$libdir" && test ! -f "$libfile"; then
4399 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4405 # If there is no directory component, then add one.
4407 */* | *\\*) . $wrapper ;;
4412 if test "$fast_install" = no && test -n "$relink_command"; then
4413 if test "$finalize" = yes && test -z "$run"; then
4415 test -n "$TMPDIR" && tmpdir="$TMPDIR"
4416 tmpdir="$tmpdir/libtool-$$"
4417 if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4419 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4422 file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4423 outputname="$tmpdir/$file"
4424 # Replace the output file specification.
4425 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4427 $show "$relink_command"
4428 if $run eval "$relink_command"; then :
4430 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4436 $echo "$modename: warning: cannot relink \`$file'" 1>&2
4439 # Install the binary that we compiled earlier.
4440 file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4444 # remove .exe since cygwin /usr/bin/install will append another
4446 case $install_prog,$host in
4447 /usr/bin/install*,*cygwin*)
4448 case $file:$destfile in
4453 destfile=$destfile.exe
4456 destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4461 $show "$install_prog$stripme $file $destfile"
4462 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4463 test -n "$outputname" && ${rm}r "$tmpdir"
4468 for file in $staticlibs; do
4469 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4471 # Set up the ranlib parameters.
4472 oldlib="$destdir/$name"
4474 $show "$install_prog $file $oldlib"
4475 $run eval "$install_prog \$file \$oldlib" || exit $?
4477 if test -n "$stripme" && test -n "$striplib"; then
4478 $show "$old_striplib $oldlib"
4479 $run eval "$old_striplib $oldlib" || exit $?
4482 # Do each command in the postinstall commands.
4483 eval cmds=\"$old_postinstall_cmds\"
4484 save_ifs="$IFS"; IFS='~'
4485 for cmd in $cmds; do
4488 $run eval "$cmd" || exit $?
4493 if test -n "$future_libdirs"; then
4494 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4497 if test -n "$current_libdirs"; then
4498 # Maybe just do a dry run.
4499 test -n "$run" && current_libdirs=" -n$current_libdirs"
4500 exec_cmd='$SHELL $0 --finish$current_libdirs'
4506 # libtool finish mode
4508 modename="$modename: finish"
4512 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4515 libdirs="$libdirs $dir"
4518 for libdir in $libdirs; do
4519 if test -n "$finish_cmds"; then
4520 # Do each command in the finish commands.
4521 eval cmds=\"$finish_cmds\"
4522 save_ifs="$IFS"; IFS='~'
4523 for cmd in $cmds; do
4526 $run eval "$cmd" || admincmds="$admincmds
4531 if test -n "$finish_eval"; then
4532 # Do the single finish_eval.
4533 eval cmds=\"$finish_eval\"
4534 $run eval "$cmds" || admincmds="$admincmds
4540 # Exit here if they wanted silent mode.
4541 test "$show" = ":" && exit 0
4543 echo "----------------------------------------------------------------------"
4544 echo "Libraries have been installed in:"
4545 for libdir in $libdirs; do
4549 echo "If you ever happen to want to link against installed libraries"
4550 echo "in a given directory, LIBDIR, you must either use libtool, and"
4551 echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4552 echo "flag during linking and do at least one of the following:"
4553 if test -n "$shlibpath_var"; then
4554 echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
4555 echo " during execution"
4557 if test -n "$runpath_var"; then
4558 echo " - add LIBDIR to the \`$runpath_var' environment variable"
4559 echo " during linking"
4561 if test -n "$hardcode_libdir_flag_spec"; then
4563 eval flag=\"$hardcode_libdir_flag_spec\"
4565 echo " - use the \`$flag' linker flag"
4567 if test -n "$admincmds"; then
4568 echo " - have your system administrator run these commands:$admincmds"
4570 if test -f /etc/ld.so.conf; then
4571 echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4574 echo "See any operating system documentation about shared libraries for"
4575 echo "more information, such as the ld(1) and ld.so(8) manual pages."
4576 echo "----------------------------------------------------------------------"
4580 # libtool execute mode
4582 modename="$modename: execute"
4584 # The first argument is the command name.
4586 if test -z "$cmd"; then
4587 $echo "$modename: you must specify a COMMAND" 1>&2
4592 # Handle -dlopen flags immediately.
4593 for file in $execute_dlfiles; do
4594 if test ! -f "$file"; then
4595 $echo "$modename: \`$file' is not a file" 1>&2
4603 # Check to see that this really is a libtool archive.
4604 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4606 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4611 # Read the libtool library.
4615 # If there is no directory component, then add one.
4617 */* | *\\*) . $file ;;
4621 # Skip this library if it cannot be dlopened.
4622 if test -z "$dlname"; then
4623 # Warn if it was a shared library.
4624 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4628 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4629 test "X$dir" = "X$file" && dir=.
4631 if test -f "$dir/$objdir/$dlname"; then
4634 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4640 # Just add the directory containing the .lo file.
4641 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4642 test "X$dir" = "X$file" && dir=.
4646 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4651 # Get the absolute pathname.
4652 absdir=`cd "$dir" && pwd`
4653 test -n "$absdir" && dir="$absdir"
4655 # Now add the directory to shlibpath_var.
4656 if eval "test -z \"\$$shlibpath_var\""; then
4657 eval "$shlibpath_var=\"\$dir\""
4659 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4663 # This variable tells wrapper scripts just to set shlibpath_var
4664 # rather than running their programs.
4665 libtool_execute_magic="$magic"
4667 # Check if any of the arguments is a wrapper script.
4674 # Do a test to see if this is really a libtool program.
4675 if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4676 # If there is no directory component, then add one.
4678 */* | *\\*) . $file ;;
4682 # Transform arg to wrapped name.
4683 file="$progdir/$program"
4687 # Quote arguments (to preserve shell metacharacters).
4688 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4689 args="$args \"$file\""
4692 if test -z "$run"; then
4693 if test -n "$shlibpath_var"; then
4694 # Export the shlibpath_var.
4695 eval "export $shlibpath_var"
4698 # Restore saved enviroment variables
4699 if test "${save_LC_ALL+set}" = set; then
4700 LC_ALL="$save_LC_ALL"; export LC_ALL
4702 if test "${save_LANG+set}" = set; then
4703 LANG="$save_LANG"; export LANG
4706 # Now prepare to actually exec the command.
4707 exec_cmd="\$cmd$args"
4709 # Display what would be done.
4710 if test -n "$shlibpath_var"; then
4711 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4712 $echo "export $shlibpath_var"
4719 # libtool clean and uninstall mode
4721 modename="$modename: $mode"
4727 # This variable tells wrapper scripts just to set variables rather
4728 # than running their programs.
4729 libtool_install_magic="$magic"
4734 -f) rm="$rm $arg"; rmforce=yes ;;
4735 -*) rm="$rm $arg" ;;
4736 *) files="$files $arg" ;;
4740 if test -z "$rm"; then
4741 $echo "$modename: you must specify an RM program" 1>&2
4748 for file in $files; do
4749 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4750 if test "X$dir" = "X$file"; then
4754 objdir="$dir/$objdir"
4756 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4757 test $mode = uninstall && objdir="$dir"
4759 # Remember objdir for removal later, being careful to avoid duplicates
4760 if test $mode = clean; then
4763 *) rmdirs="$rmdirs $objdir" ;;
4767 # Don't error if the file doesn't exist and rm -f was used.
4768 if (test -L "$file") >/dev/null 2>&1 \
4769 || (test -h "$file") >/dev/null 2>&1 \
4770 || test -f "$file"; then
4772 elif test -d "$file"; then
4775 elif test "$rmforce" = yes; then
4783 # Possibly a libtool archive, so verify it.
4784 if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4787 # Delete the libtool libraries and symlinks.
4788 for n in $library_names; do
4789 rmfiles="$rmfiles $objdir/$n"
4791 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4792 test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4794 if test $mode = uninstall; then
4795 if test -n "$library_names"; then
4796 # Do each command in the postuninstall commands.
4797 eval cmds=\"$postuninstall_cmds\"
4798 save_ifs="$IFS"; IFS='~'
4799 for cmd in $cmds; do
4803 if test $? != 0 && test "$rmforce" != yes; then
4810 if test -n "$old_library"; then
4811 # Do each command in the old_postuninstall commands.
4812 eval cmds=\"$old_postuninstall_cmds\"
4813 save_ifs="$IFS"; IFS='~'
4814 for cmd in $cmds; do
4818 if test $? != 0 && test "$rmforce" != yes; then
4824 # FIXME: should reinstall the best remaining shared library.
4830 if test "$build_old_libs" = yes; then
4831 oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4832 rmfiles="$rmfiles $dir/$oldobj"
4837 # Do a test to see if this is a libtool program.
4838 if test $mode = clean &&
4839 (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4843 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4844 if test "$fast_install" = yes && test -n "$relink_command"; then
4845 rmfiles="$rmfiles $objdir/lt-$name"
4850 $show "$rm $rmfiles"
4851 $run $rm $rmfiles || exit_status=1
4854 # Try to remove the ${objdir}s in the directories where we deleted files
4855 for dir in $rmdirs; do
4856 if test -d "$dir"; then
4858 $run rmdir $dir >/dev/null 2>&1
4866 $echo "$modename: you must specify a MODE" 1>&2
4867 $echo "$generic_help" 1>&2
4872 if test -z "$exec_cmd"; then
4873 $echo "$modename: invalid operation mode \`$mode'" 1>&2
4874 $echo "$generic_help" 1>&2
4877 fi # test -z "$show_help"
4879 if test -n "$exec_cmd"; then
4884 # We need to display help for each of the modes.
4887 "Usage: $modename [OPTION]... [MODE-ARG]...
4889 Provide generalized library-building support services.
4891 --config show all configuration variables
4892 --debug enable verbose shell tracing
4893 -n, --dry-run display commands without modifying any files
4894 --features display basic configuration information and exit
4895 --finish same as \`--mode=finish'
4896 --help display this help message and exit
4897 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
4898 --quiet same as \`--silent'
4899 --silent don't print informational messages
4900 --version print version information
4902 MODE must be one of the following:
4904 clean remove files from the build directory
4905 compile compile a source file into a libtool object
4906 execute automatically set library path, then run a program
4907 finish complete the installation of libtool libraries
4908 install install libraries or executables
4909 link create a library or an executable
4910 uninstall remove libraries from an installed directory
4912 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
4913 a more detailed description of MODE."
4919 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4921 Remove files from the build directory.
4923 RM is the name of the program to use to delete files associated with each FILE
4924 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
4927 If FILE is a libtool library, object or program, all the files associated
4928 with it are deleted. Otherwise, only FILE itself is deleted using RM."
4933 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4935 Compile a source file into a libtool library object.
4937 This mode accepts the following additional options:
4939 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
4940 -prefer-pic try to building PIC objects only
4941 -prefer-non-pic try to building non-PIC objects only
4942 -static always build a \`.o' file suitable for static linking
4944 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4945 from the given SOURCEFILE.
4947 The output file name is determined by removing the directory component from
4948 SOURCEFILE, then substituting the C source code suffix \`.c' with the
4949 library object suffix, \`.lo'."
4954 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4956 Automatically set library path, then run a program.
4958 This mode accepts the following additional options:
4960 -dlopen FILE add the directory containing FILE to the library path
4962 This mode sets the library path environment variable according to \`-dlopen'
4965 If any of the ARGS are libtool executable wrappers, then they are translated
4966 into their corresponding uninstalled binary, and any of their required library
4967 directories are added to the library path.
4969 Then, COMMAND is executed, with ARGS as arguments."
4974 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
4976 Complete the installation of libtool libraries.
4978 Each LIBDIR is a directory that contains libtool libraries.
4980 The commands that this mode executes may require superuser privileges. Use
4981 the \`--dry-run' option if you just want to see what would be executed."
4986 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
4988 Install executables or libraries.
4990 INSTALL-COMMAND is the installation command. The first component should be
4991 either the \`install' or \`cp' program.
4993 The rest of the components are interpreted as arguments to that command (only
4994 BSD-compatible install options are recognized)."
4999 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5001 Link object files or libraries together to form another library, or to
5002 create an executable program.
5004 LINK-COMMAND is a command using the C compiler that you would use to create
5005 a program from several object files.
5007 The following components of LINK-COMMAND are treated specially:
5009 -all-static do not do any dynamic linking at all
5010 -avoid-version do not add a version suffix if possible
5011 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
5012 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
5013 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5014 -export-symbols SYMFILE
5015 try to export only the symbols listed in SYMFILE
5016 -export-symbols-regex REGEX
5017 try to export only the symbols matching REGEX
5018 -LLIBDIR search LIBDIR for required installed libraries
5019 -lNAME OUTPUT-FILE requires the installed library libNAME
5020 -module build a library that can dlopened
5021 -no-fast-install disable the fast-install mode
5022 -no-install link a not-installable executable
5023 -no-undefined declare that a library does not refer to external symbols
5024 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
5025 -release RELEASE specify package release information
5026 -rpath LIBDIR the created library will eventually be installed in LIBDIR
5027 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
5028 -static do not do any dynamic linking of libtool libraries
5029 -version-info CURRENT[:REVISION[:AGE]]
5030 specify library version info [each variable defaults to 0]
5032 All other options (arguments beginning with \`-') are ignored.
5034 Every other argument is treated as a filename. Files ending in \`.la' are
5035 treated as uninstalled libtool libraries, other files are standard or library
5038 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5039 only library objects (\`.lo' files) may be specified, and \`-rpath' is
5040 required, except when creating a convenience library.
5042 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5043 using \`ar' and \`ranlib', or on Windows using \`lib'.
5045 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5046 is created, otherwise an executable program is created."
5051 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5053 Remove libraries from an installation directory.
5055 RM is the name of the program to use to delete files associated with each FILE
5056 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
5059 If FILE is a libtool library, all the files associated with it are deleted.
5060 Otherwise, only FILE itself is deleted using RM."
5064 $echo "$modename: invalid operation mode \`$mode'" 1>&2
5071 $echo "Try \`$modename --help' for more information about other modes."