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, 2003, 2004
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.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
50 # Check that we have a working $echo.
51 if test "X$1" = X--no-reexec; then
52 # Discard the --no-reexec flag, and continue.
54 elif test "X$1" = X--fallback-echo; then
55 # Avoid inline document here, it may be left over
57 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
58 # Yippee, $echo works!
61 # Restart under the correct shell, and then maybe $echo will work.
62 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
65 if test "X$1" = X--fallback-echo; then
66 # used as fallback echo
75 help="Try \`$progname --help' for more information."
76 magic="%%%MAGIC variable%%%"
81 # Sed substitution that helps us do robust quoting. It backslashifies
82 # metacharacters that are still active within double-quoted strings.
83 Xsed="${SED}"' -e 1s/^X//'
84 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
85 # test EBCDIC or ASCII
86 case `echo A|tr A '\301'` in
87 A) # EBCDIC based system
88 SP2NL="tr '\100' '\n'"
89 NL2SP="tr '\r\n' '\100\100'"
91 *) # Assume ASCII based system
92 SP2NL="tr '\040' '\012'"
93 NL2SP="tr '\015\012' '\040\040'"
98 # Only set LANG and LC_ALL to C if already set.
99 # These must not be set unconditionally because not all systems understand
100 # e.g. LANG=C (notably SCO).
101 # We save the old values to restore during execute mode.
102 if test "${LC_ALL+set}" = set; then
103 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
105 if test "${LANG+set}" = set; then
106 save_LANG="$LANG"; LANG=C; export LANG
109 # Make sure IFS has a sensible default
113 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
114 $echo "$modename: not configured to build any kind of library" 1>&2
115 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
128 lo2o="s/\\.lo\$/.${objext}/"
129 o2lo="s/\\.${objext}\$/.lo/"
131 #####################################
132 # Shell function definitions:
133 # This seems to be the best place for them
135 # func_win32_libid arg
136 # return the library type of file 'arg'
138 # Need a lot of goo to handle *both* DLLs and import libs
139 # Has to be a shell function in order to 'eat' the argument
140 # that is supplied when $file_magic_command is called.
141 func_win32_libid () {
142 win32_libid_type="unknown"
143 win32_fileres=`file -L $1 2>/dev/null`
144 case $win32_fileres in
145 *ar\ archive\ import\ library*) # definitely import
146 win32_libid_type="x86 archive import"
148 *ar\ archive*) # could be an import, or static
149 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
150 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
151 win32_nmres=`eval $NM -f posix -A $1 | \
152 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
153 if test "X$win32_nmres" = "Ximport" ; then
154 win32_libid_type="x86 archive import"
156 win32_libid_type="x86 archive static"
161 win32_libid_type="x86 DLL"
163 *executable*) # but shell scripts are "executable" too...
164 case $win32_fileres in
165 *MS\ Windows\ PE\ Intel*)
166 win32_libid_type="x86 DLL"
171 $echo $win32_libid_type
176 # Infer tagged configuration to use if any are available and
177 # if one wasn't chosen via the "--tag" command line option.
178 # Only attempt this if the compiler in the base compile
179 # command doesn't match the default compiler.
180 # arg is usually of the form 'gcc ...'
182 if test -n "$available_tags" && test -z "$tagname"; then
186 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
190 CC_quoted="$CC_quoted $arg"
193 # Blanks in the command may have been stripped by the calling shell,
194 # but not from the CC environment variable when configure was run.
195 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
196 # Blanks at the start of $base_compile will cause this to fail
197 # if we don't check for them as well.
199 for z in $available_tags; do
200 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
201 # Evaluate the configuration.
202 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
205 # Double-quote args containing other shell metacharacters.
207 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
211 CC_quoted="$CC_quoted $arg"
214 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
215 # The compiler in the base compile command matches
216 # the one in the tagged configuration.
217 # Assume this is the tagged configuration we want.
224 # If $tagname still isn't set, then no tagged configuration
225 # was found and let the user know that the "--tag" command
226 # line option must be used.
227 if test -z "$tagname"; then
228 $echo "$modename: unable to infer tagged configuration"
229 $echo "$modename: specify a tag with \`--tag'" 1>&2
232 # $echo "$modename: using $tagname tagged configuration"
238 # End of Shell function definitions
239 #####################################
242 eval std_shrext=\"$shrext_cmds\"
244 # Parse our command line options once, thoroughly.
245 while test "$#" -gt 0
251 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
255 # If the previous option needs an argument, assign it.
256 if test -n "$prev"; then
259 execute_dlfiles="$execute_dlfiles $arg"
263 preserve_args="${preserve_args}=$arg"
265 # Check whether tagname contains only valid characters
268 $echo "$progname: invalid tag name: $tagname" 1>&2
275 # Don't test for the "default" C tag, as we know, it's there, but
276 # not specially marked.
279 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
280 taglist="$taglist $tagname"
281 # Evaluate the configuration.
282 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
284 $echo "$progname: ignoring unknown tag $tagname" 1>&2
299 # Have we seen a non-optional argument yet?
306 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
308 $echo "Copyright (C) 2003 Free Software Foundation, Inc."
309 $echo "This is free software; see the source for copying conditions. There is NO"
310 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
315 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
316 # Now print the configurations for the tags.
317 for tagname in $taglist; do
318 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
324 $echo "$progname: enabling shell trace mode"
326 preserve_args="$preserve_args $arg"
335 if test "$build_libtool_libs" = yes; then
336 $echo "enable shared libraries"
338 $echo "disable shared libraries"
340 if test "$build_old_libs" = yes; then
341 $echo "enable static libraries"
343 $echo "disable static libraries"
348 --finish) mode="finish" ;;
350 --mode) prevopt="--mode" prev=mode ;;
351 --mode=*) mode="$optarg" ;;
353 --preserve-dup-deps) duplicate_deps="yes" ;;
357 preserve_args="$preserve_args $arg"
360 --tag) prevopt="--tag" prev=tag ;;
362 set tag "$optarg" ${1+"$@"}
365 preserve_args="$preserve_args --tag"
374 $echo "$modename: unrecognized option \`$arg'" 1>&2
386 if test -n "$prevopt"; then
387 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
392 # If this variable is set in any of the actions, the command in it
393 # will be execed at the end. This prevents here-documents from being
394 # left over by shells.
397 if test -z "$show_help"; then
399 # Infer the operation mode.
400 if test -z "$mode"; then
401 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
402 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
404 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
416 *db | *dbx | *strace | *truss)
426 # If we have no mode, but dlfiles were specified, then do execute mode.
427 test -n "$execute_dlfiles" && mode=execute
429 # Just use the default operation mode.
430 if test -z "$mode"; then
431 if test -n "$nonopt"; then
432 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
434 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
441 # Only execute mode is allowed to have -dlopen flags.
442 if test -n "$execute_dlfiles" && test "$mode" != execute; then
443 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
448 # Change the help message to a mode-specific one.
450 help="Try \`$modename --help --mode=$mode' for more information."
452 # These modes are in order of execution frequency so that they run quickly.
454 # libtool compile mode
456 modename="$modename: compile"
457 # Get the compilation command and the source file.
459 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
470 # do not "continue". Instead, add this to base_compile
482 # Accept any command-line options.
485 if test -n "$libobj" ; then
486 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
493 -static | -prefer-pic | -prefer-non-pic)
504 arg_mode=arg # the next one goes into the "base_compile" arg list
505 continue # The current "srcfile" will either be retained or
506 ;; # replaced later. I would guess that would be a bug.
509 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
511 save_ifs="$IFS"; IFS=','
515 # Double-quote args containing other shell metacharacters.
516 # Many Bourne shells cannot handle close brackets correctly
517 # in scan sets, so we specify it separately.
519 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
523 lastarg="$lastarg $arg"
526 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
528 # Add the arguments to base_compile.
529 base_compile="$base_compile $lastarg"
534 # Accept the current argument as the source file.
535 # The previous "srcfile" becomes the current argument.
542 esac # case $arg_mode
544 # Aesthetically quote the previous argument.
545 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
548 # Double-quote args containing other shell metacharacters.
549 # Many Bourne shells cannot handle close brackets correctly
550 # in scan sets, so we specify it separately.
551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
552 lastarg="\"$lastarg\""
556 base_compile="$base_compile $lastarg"
561 $echo "$modename: you must specify an argument for -Xcompile"
565 $echo "$modename: you must specify a target with \`-o'" 1>&2
569 # Get the name of the library object.
570 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
574 # Recognize several different file suffixes.
575 # If the user specifies -o file.o, it is replaced with file.lo
585 *.class) xform=class ;;
590 *.java) xform=java ;;
593 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
596 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
598 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
603 func_infer_tag $base_compile
605 for arg in $later; do
624 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
625 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
626 if test "X$xdir" = "X$obj"; then
631 lobj=${xdir}$objdir/$objname
633 if test -z "$base_compile"; then
634 $echo "$modename: you must specify a compilation command" 1>&2
639 # Delete any leftover library objects.
640 if test "$build_old_libs" = yes; then
641 removelist="$obj $lobj $libobj ${libobj}T"
643 removelist="$lobj $libobj ${libobj}T"
647 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
649 # On Cygwin there's no "real" PIC flag so we must build both object types
651 cygwin* | mingw* | pw32* | os2*)
655 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
656 # non-PIC code in shared libraries is not supported
660 # Calculate the filename of the output object if compiler does
661 # not support -o with -c
662 if test "$compiler_c_o" = no; then
663 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
664 lockfile="$output_obj.lock"
665 removelist="$removelist $output_obj $lockfile"
666 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
673 # Lock this critical section if it is needed
674 # We use this script file to make the link, it avoids creating a new file
675 if test "$need_locks" = yes; then
676 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
677 $show "Waiting for $lockfile to be removed"
680 elif test "$need_locks" = warn; then
681 if test -f "$lockfile"; then
683 *** ERROR, $lockfile exists and contains:
684 `cat $lockfile 2>/dev/null`
686 This indicates that another process is trying to use the same
687 temporary object file, and libtool could not work around it because
688 your compiler does not support \`-c' and \`-o' together. If you
689 repeat this compilation, it may succeed, by chance, but you had better
690 avoid parallel builds (make -j) in this platform, or get a better
696 $echo $srcfile > "$lockfile"
699 if test -n "$fix_srcfile_path"; then
700 eval srcfile=\"$fix_srcfile_path\"
703 $run $rm "$libobj" "${libobj}T"
705 # Create a libtool object file (analogous to a ".la" file),
706 # but don't create it if we're doing a dry run.
707 test -z "$run" && cat > ${libobj}T <<EOF
708 # $libobj - a libtool object file
709 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
711 # Please DO NOT delete this file!
712 # It is necessary for linking the library.
714 # Name of the PIC object.
717 # Only build a PIC object if we are building libtool libraries.
718 if test "$build_libtool_libs" = yes; then
719 # Without this assignment, base_compile gets emptied.
720 fbsd_hideous_sh_bug=$base_compile
722 if test "$pic_mode" != no; then
723 command="$base_compile $srcfile $pic_flag"
725 # Don't build PIC code
726 command="$base_compile $srcfile"
729 if test ! -d "${xdir}$objdir"; then
730 $show "$mkdir ${xdir}$objdir"
731 $run $mkdir ${xdir}$objdir
733 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
738 if test -z "$output_obj"; then
739 # Place PIC objects in $objdir
740 command="$command -o $lobj"
743 $run $rm "$lobj" "$output_obj"
746 if $run eval "$command"; then :
748 test -n "$output_obj" && $run $rm $removelist
752 if test "$need_locks" = warn &&
753 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
755 *** ERROR, $lockfile contains:
756 `cat $lockfile 2>/dev/null`
758 but it should contain:
761 This indicates that another process is trying to use the same
762 temporary object file, and libtool could not work around it because
763 your compiler does not support \`-c' and \`-o' together. If you
764 repeat this compilation, it may succeed, by chance, but you had better
765 avoid parallel builds (make -j) in this platform, or get a better
772 # Just move the object if needed, then go on to compile the next one
773 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
774 $show "$mv $output_obj $lobj"
775 if $run $mv $output_obj $lobj; then :
783 # Append the name of the PIC object to the libtool object file.
784 test -z "$run" && cat >> ${libobj}T <<EOF
785 pic_object='$objdir/$objname'
789 # Allow error messages only from the first compilation.
790 if test "$suppress_opt" = yes; then
791 suppress_output=' >/dev/null 2>&1'
794 # No PIC object so indicate it doesn't exist in the libtool
796 test -z "$run" && cat >> ${libobj}T <<EOF
802 # Only build a position-dependent object if we build old libraries.
803 if test "$build_old_libs" = yes; then
804 if test "$pic_mode" != yes; then
805 # Don't build PIC code
806 command="$base_compile $srcfile"
808 command="$base_compile $srcfile $pic_flag"
810 if test "$compiler_c_o" = yes; then
811 command="$command -o $obj"
814 # Suppress compiler output if we already did a PIC compilation.
815 command="$command$suppress_output"
816 $run $rm "$obj" "$output_obj"
818 if $run eval "$command"; then :
824 if test "$need_locks" = warn &&
825 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
827 *** ERROR, $lockfile contains:
828 `cat $lockfile 2>/dev/null`
830 but it should contain:
833 This indicates that another process is trying to use the same
834 temporary object file, and libtool could not work around it because
835 your compiler does not support \`-c' and \`-o' together. If you
836 repeat this compilation, it may succeed, by chance, but you had better
837 avoid parallel builds (make -j) in this platform, or get a better
844 # Just move the object if needed
845 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
846 $show "$mv $output_obj $obj"
847 if $run $mv $output_obj $obj; then :
855 # Append the name of the non-PIC object the libtool object file.
856 # Only append if the libtool object file exists.
857 test -z "$run" && cat >> ${libobj}T <<EOF
858 # Name of the non-PIC object.
859 non_pic_object='$objname'
863 # Append the name of the non-PIC object the libtool object file.
864 # Only append if the libtool object file exists.
865 test -z "$run" && cat >> ${libobj}T <<EOF
866 # Name of the non-PIC object.
872 $run $mv "${libobj}T" "${libobj}"
874 # Unlock the critical section if it was locked
875 if test "$need_locks" != no; then
884 modename="$modename: link"
886 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
887 # It is impossible to link a dll without this setting, and
888 # we shouldn't force the makefile maintainer to figure out
889 # which system we are compiling for in order to pass an extra
890 # flag for every libtool invocation.
893 # FIXME: Unfortunately, there are problems with the above when trying
894 # to make a dll which has undefined symbols, in which case not
895 # even a static library is built. For now, we need to specify
896 # -no-undefined on the libtool link line when we can be certain
897 # that all symbols are satisfied, otherwise we get a static library.
904 libtool_args="$nonopt"
905 base_compile="$nonopt $@"
906 compile_command="$nonopt"
907 finalize_command="$nonopt"
920 lib_search_path=`pwd`
929 export_symbols_regex=
937 precious_files_regex=
938 prefer_static_libs=no
951 func_infer_tag $base_compile
953 # We need to know -static, to get the right output filenames.
957 -all-static | -static)
958 if test "X$arg" = "X-all-static"; then
959 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
960 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
962 if test -n "$link_static_flag"; then
963 dlopen_self=$dlopen_self_static
966 if test -z "$pic_flag" && test -n "$link_static_flag"; then
967 dlopen_self=$dlopen_self_static
970 build_libtool_libs=no
972 prefer_static_libs=yes
978 # See if our shared archives depend on static archives.
979 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
981 # Go through the arguments, transforming them on the way.
982 while test "$#" -gt 0; do
986 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
987 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
991 libtool_args="$libtool_args $qarg"
993 # If the previous option needs an argument, assign it.
994 if test -n "$prev"; then
997 compile_command="$compile_command @OUTPUT@"
998 finalize_command="$finalize_command @OUTPUT@"
1004 if test "$preload" = no; then
1005 # Add the symbol object into the linking commands.
1006 compile_command="$compile_command @SYMFILE@"
1007 finalize_command="$finalize_command @SYMFILE@"
1011 *.la | *.lo) ;; # We handle these cases below.
1013 if test "$dlself" = no; then
1021 if test "$prev" = dlprefiles; then
1023 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1033 if test "$prev" = dlfiles; then
1034 dlfiles="$dlfiles $arg"
1036 dlprefiles="$dlprefiles $arg"
1044 export_symbols="$arg"
1045 if test ! -f "$arg"; then
1046 $echo "$modename: symbol file \`$arg' does not exist"
1053 export_symbols_regex="$arg"
1058 inst_prefix_dir="$arg"
1063 precious_files_regex="$arg"
1073 if test -f "$arg"; then
1076 for fil in `cat $save_arg`
1078 # moreargs="$moreargs $fil"
1080 # A libtool-controlled object.
1082 # Check to see that this really is a libtool object.
1083 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1088 # If there is no directory component, then add one.
1090 */* | *\\*) . $arg ;;
1094 if test -z "$pic_object" || \
1095 test -z "$non_pic_object" ||
1096 test "$pic_object" = none && \
1097 test "$non_pic_object" = none; then
1098 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1102 # Extract subdirectory from the argument.
1103 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1104 if test "X$xdir" = "X$arg"; then
1110 if test "$pic_object" != none; then
1111 # Prepend the subdirectory the object is found in.
1112 pic_object="$xdir$pic_object"
1114 if test "$prev" = dlfiles; then
1115 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1116 dlfiles="$dlfiles $pic_object"
1120 # If libtool objects are unsupported, then we need to preload.
1125 # CHECK ME: I think I busted this. -Ossama
1126 if test "$prev" = dlprefiles; then
1127 # Preload the old-style object.
1128 dlprefiles="$dlprefiles $pic_object"
1133 libobjs="$libobjs $pic_object"
1138 if test "$non_pic_object" != none; then
1139 # Prepend the subdirectory the object is found in.
1140 non_pic_object="$xdir$non_pic_object"
1142 # A standard non-PIC object
1143 non_pic_objects="$non_pic_objects $non_pic_object"
1144 if test -z "$pic_object" || test "$pic_object" = none ; then
1145 arg="$non_pic_object"
1149 # Only an error if not doing a dry-run.
1150 if test -z "$run"; then
1151 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1156 # Extract subdirectory from the argument.
1157 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1158 if test "X$xdir" = "X$arg"; then
1164 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1165 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1166 libobjs="$libobjs $pic_object"
1167 non_pic_objects="$non_pic_objects $non_pic_object"
1172 $echo "$modename: link input file \`$save_arg' does not exist"
1180 # We need an absolute path.
1182 [\\/]* | [A-Za-z]:[\\/]*) ;;
1184 $echo "$modename: only absolute run-paths are allowed" 1>&2
1188 if test "$prev" = rpath; then
1191 *) rpath="$rpath $arg" ;;
1196 *) xrpath="$xrpath $arg" ;;
1203 compiler_flags="$compiler_flags $qarg"
1205 compile_command="$compile_command $qarg"
1206 finalize_command="$finalize_command $qarg"
1210 linker_flags="$linker_flags $qarg"
1211 compiler_flags="$compiler_flags $wl$qarg"
1213 compile_command="$compile_command $wl$qarg"
1214 finalize_command="$finalize_command $wl$qarg"
1218 linker_flags="$linker_flags $qarg"
1219 compiler_flags="$compiler_flags $qarg"
1221 compile_command="$compile_command $qarg"
1222 finalize_command="$finalize_command $qarg"
1231 eval "$prev=\"\$arg\""
1236 fi # test -n "$prev"
1242 if test -n "$link_static_flag"; then
1243 compile_command="$compile_command $link_static_flag"
1244 finalize_command="$finalize_command $link_static_flag"
1250 # FIXME: remove this flag sometime in the future.
1251 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1275 -export-symbols | -export-symbols-regex)
1276 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1277 $echo "$modename: more than one -exported-symbols argument is not allowed"
1280 if test "X$arg" = "X-export-symbols"; then
1293 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1294 # so, if we see these flags be careful not to treat them like -L
1296 case $with_gcc/$host in
1297 no/*-*-irix* | /*-*-irix*)
1298 compile_command="$compile_command $arg"
1299 finalize_command="$finalize_command $arg"
1306 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1307 # We need an absolute path.
1309 [\\/]* | [A-Za-z]:[\\/]*) ;;
1311 absdir=`cd "$dir" && pwd`
1312 if test -z "$absdir"; then
1313 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1322 deplibs="$deplibs -L$dir"
1323 lib_search_path="$lib_search_path $dir"
1327 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1328 case :$dllsearchpath: in
1330 *) dllsearchpath="$dllsearchpath:$dir";;
1338 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1340 *-*-cygwin* | *-*-pw32* | *-*-beos*)
1341 # These systems don't actually have a C or math library (as such)
1344 *-*-mingw* | *-*-os2*)
1345 # These systems don't actually have a C library (as such)
1346 test "X$arg" = "X-lc" && continue
1348 *-*-openbsd* | *-*-freebsd*)
1349 # Do not include libc due to us having libc/libc_r.
1350 test "X$arg" = "X-lc" && continue
1352 *-*-rhapsody* | *-*-darwin1.[012])
1353 # Rhapsody C and math libraries are in the System framework
1354 deplibs="$deplibs -framework System"
1357 elif test "X$arg" = "X-lc_r"; then
1359 *-*-openbsd* | *-*-freebsd*)
1360 # Do not include libc_r directly, use -pthread flag.
1365 deplibs="$deplibs $arg"
1369 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1370 deplibs="$deplibs $arg"
1379 # gcc -m* arguments should be passed to the linker via $compiler_flags
1380 # in order to pass architecture information to the linker
1381 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1382 # but this is not reliable with gcc because gcc may use -mfoo to
1383 # select a different linker, different libraries, etc, while
1384 # -Wl,-mfoo simply passes -mfoo to the linker.
1386 # Unknown arguments in both finalize_command and compile_command need
1387 # to be aesthetically quoted because they are evaled later.
1388 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1390 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1394 compile_command="$compile_command $arg"
1395 finalize_command="$finalize_command $arg"
1396 if test "$with_gcc" = "yes" ; then
1397 compiler_flags="$compiler_flags $arg"
1414 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1415 # The PATH hackery in wrapper scripts is required on Windows
1416 # in order for the loader to find any dlls it needs.
1417 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1418 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1421 *) no_install=yes ;;
1438 -precious-files-regex)
1459 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1460 # We need an absolute path.
1462 [\\/]* | [A-Za-z]:[\\/]*) ;;
1464 $echo "$modename: only absolute run-paths are allowed" 1>&2
1470 *) xrpath="$xrpath $dir" ;;
1476 # The effects of -static are defined in a previous loop.
1477 # We used to do the same as -all-static on platforms that
1478 # didn't have a PIC flag, but the assumption that the effects
1479 # would be equivalent was wrong. It would break on at least
1480 # Digital Unix and AIX.
1500 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1502 save_ifs="$IFS"; IFS=','
1503 for flag in $args; do
1506 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1511 compiler_flags="$compiler_flags $flag"
1514 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1518 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1520 save_ifs="$IFS"; IFS=','
1521 for flag in $args; do
1524 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1529 compiler_flags="$compiler_flags $wl$flag"
1530 linker_flags="$linker_flags $flag"
1533 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1551 # Some other compiler flag.
1553 # Unknown arguments in both finalize_command and compile_command need
1554 # to be aesthetically quoted because they are evaled later.
1555 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1557 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1564 # A standard object.
1569 # A libtool-controlled object.
1571 # Check to see that this really is a libtool object.
1572 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1577 # If there is no directory component, then add one.
1579 */* | *\\*) . $arg ;;
1583 if test -z "$pic_object" || \
1584 test -z "$non_pic_object" ||
1585 test "$pic_object" = none && \
1586 test "$non_pic_object" = none; then
1587 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1591 # Extract subdirectory from the argument.
1592 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1593 if test "X$xdir" = "X$arg"; then
1599 if test "$pic_object" != none; then
1600 # Prepend the subdirectory the object is found in.
1601 pic_object="$xdir$pic_object"
1603 if test "$prev" = dlfiles; then
1604 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1605 dlfiles="$dlfiles $pic_object"
1609 # If libtool objects are unsupported, then we need to preload.
1614 # CHECK ME: I think I busted this. -Ossama
1615 if test "$prev" = dlprefiles; then
1616 # Preload the old-style object.
1617 dlprefiles="$dlprefiles $pic_object"
1622 libobjs="$libobjs $pic_object"
1627 if test "$non_pic_object" != none; then
1628 # Prepend the subdirectory the object is found in.
1629 non_pic_object="$xdir$non_pic_object"
1631 # A standard non-PIC object
1632 non_pic_objects="$non_pic_objects $non_pic_object"
1633 if test -z "$pic_object" || test "$pic_object" = none ; then
1634 arg="$non_pic_object"
1638 # Only an error if not doing a dry-run.
1639 if test -z "$run"; then
1640 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1645 # Extract subdirectory from the argument.
1646 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1647 if test "X$xdir" = "X$arg"; then
1653 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1654 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1655 libobjs="$libobjs $pic_object"
1656 non_pic_objects="$non_pic_objects $non_pic_object"
1663 deplibs="$deplibs $arg"
1664 old_deplibs="$old_deplibs $arg"
1669 # A libtool-controlled library.
1671 if test "$prev" = dlfiles; then
1672 # This library was specified with -dlopen.
1673 dlfiles="$dlfiles $arg"
1675 elif test "$prev" = dlprefiles; then
1676 # The library was specified with -dlpreopen.
1677 dlprefiles="$dlprefiles $arg"
1680 deplibs="$deplibs $arg"
1685 # Some other compiler argument.
1687 # Unknown arguments in both finalize_command and compile_command need
1688 # to be aesthetically quoted because they are evaled later.
1689 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1691 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1698 # Now actually substitute the argument into the commands.
1699 if test -n "$arg"; then
1700 compile_command="$compile_command $arg"
1701 finalize_command="$finalize_command $arg"
1703 done # argument parsing loop
1705 if test -n "$prev"; then
1706 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1711 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1712 eval arg=\"$export_dynamic_flag_spec\"
1713 compile_command="$compile_command $arg"
1714 finalize_command="$finalize_command $arg"
1718 # calculate the name of the file, without its directory
1719 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1720 libobjs_save="$libobjs"
1722 if test -n "$shlibpath_var"; then
1723 # get the directories listed in $shlibpath_var
1724 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1728 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1729 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1731 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1732 if test "X$output_objdir" = "X$output"; then
1733 output_objdir="$objdir"
1735 output_objdir="$output_objdir/$objdir"
1737 # Create the object directory.
1738 if test ! -d "$output_objdir"; then
1739 $show "$mkdir $output_objdir"
1740 $run $mkdir $output_objdir
1742 if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1747 # Determine the type of output
1750 $echo "$modename: you must specify an output file" 1>&2
1754 *.$libext) linkmode=oldlib ;;
1755 *.lo | *.$objext) linkmode=obj ;;
1756 *.la) linkmode=lib ;;
1757 *) linkmode=prog ;; # Anything else should be a program.
1761 *cygwin* | *mingw* | *pw32*)
1762 # don't eliminate duplications in $postdeps and $predeps
1763 duplicate_compiler_generated_deps=yes
1766 duplicate_compiler_generated_deps=$duplicate_deps
1772 # Find all interdependent deplibs by searching for libraries
1773 # that are linked more than once (e.g. -la -lb -la)
1774 for deplib in $deplibs; do
1775 if test "X$duplicate_deps" = "Xyes" ; then
1777 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1780 libs="$libs $deplib"
1783 if test "$linkmode" = lib; then
1784 libs="$predeps $libs $compiler_lib_search_path $postdeps"
1786 # Compute libraries that are listed more than once in $predeps
1787 # $postdeps and mark them as special (i.e., whose duplicates are
1788 # not to be eliminated).
1790 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1791 for pre_post_dep in $predeps $postdeps; do
1792 case "$pre_post_deps " in
1793 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1795 pre_post_deps="$pre_post_deps $pre_post_dep"
1804 need_relink=no # whether we're linking any uninstalled libtool libraries
1805 notinst_deplibs= # not-installed libtool libraries
1806 notinst_path= # paths that contain not-installed libtool libraries
1810 for file in $dlfiles $dlprefiles; do
1814 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1826 passes="conv scan dlopen dlpreopen link"
1831 for pass in $passes; do
1832 if test "$linkmode,$pass" = "lib,link" ||
1833 test "$linkmode,$pass" = "prog,scan"; then
1837 if test "$linkmode" = prog; then
1839 dlopen) libs="$dlfiles" ;;
1840 dlpreopen) libs="$dlprefiles" ;;
1842 libs="$deplibs %DEPLIBS%"
1843 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
1847 if test "$pass" = dlopen; then
1848 # Collect dlpreopened libraries
1849 save_deplibs="$deplibs"
1852 for deplib in $libs; do
1856 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1857 if test "$linkmode,$pass" = "prog,link"; then
1858 compile_deplibs="$deplib $compile_deplibs"
1859 finalize_deplibs="$deplib $finalize_deplibs"
1861 deplibs="$deplib $deplibs"
1866 if test "$linkmode" != lib && test "$linkmode" != prog; then
1867 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1870 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1871 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1872 for search_ext in .la $std_shrext .so .a; do
1873 # Search the libtool library
1874 lib="$searchdir/lib${name}${search_ext}"
1875 if test -f "$lib"; then
1876 if test "$search_ext" = ".la"; then
1885 if test "$found" != yes; then
1886 # deplib doesn't seem to be a libtool library
1887 if test "$linkmode,$pass" = "prog,link"; then
1888 compile_deplibs="$deplib $compile_deplibs"
1889 finalize_deplibs="$deplib $finalize_deplibs"
1891 deplibs="$deplib $deplibs"
1892 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1895 else # deplib is a libtool library
1896 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1897 # We need to do some special things here, and not later.
1898 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1899 case " $predeps $postdeps " in
1901 if (${SED} -e '2q' $lib |
1902 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1906 */* | *\\*) . $lib ;;
1909 for l in $old_library $library_names; do
1912 if test "X$ll" = "X$old_library" ; then # only static version available
1914 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1915 test "X$ladir" = "X$lib" && ladir="."
1916 lib=$ladir/$old_library
1917 if test "$linkmode,$pass" = "prog,link"; then
1918 compile_deplibs="$deplib $compile_deplibs"
1919 finalize_deplibs="$deplib $finalize_deplibs"
1921 deplibs="$deplib $deplibs"
1922 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1936 deplibs="$deplib $deplibs"
1937 test "$pass" = conv && continue
1938 newdependency_libs="$deplib $newdependency_libs"
1939 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1942 if test "$pass" = conv; then
1943 deplibs="$deplib $deplibs"
1946 if test "$pass" = scan; then
1947 deplibs="$deplib $deplibs"
1949 compile_deplibs="$deplib $compile_deplibs"
1950 finalize_deplibs="$deplib $finalize_deplibs"
1952 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1955 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1961 if test "$pass" = link; then
1962 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1963 # Make sure the xrpath contains only unique directories.
1966 *) xrpath="$xrpath $dir" ;;
1969 deplibs="$deplib $deplibs"
1972 *.la) lib="$deplib" ;;
1974 if test "$pass" = conv; then
1975 deplibs="$deplib $deplibs"
1980 if test "$deplibs_check_method" != pass_all; then
1982 $echo "*** Warning: Trying to link with static lib archive $deplib."
1983 $echo "*** I have the capability to make that library automatically link in when"
1984 $echo "*** you link to this library. But I can only do this if you have a"
1985 $echo "*** shared version of the library, which you do not appear to have"
1986 $echo "*** because the file extensions .$libext of this argument makes me believe"
1987 $echo "*** that it is just a static archive that I should not used here."
1990 $echo "*** Warning: Linking the shared library $output against the"
1991 $echo "*** static library $deplib is not portable!"
1992 deplibs="$deplib $deplibs"
1997 if test "$pass" != link; then
1998 deplibs="$deplib $deplibs"
2000 compile_deplibs="$deplib $compile_deplibs"
2001 finalize_deplibs="$deplib $finalize_deplibs"
2008 if test "$pass" = conv; then
2009 deplibs="$deplib $deplibs"
2010 elif test "$linkmode" = prog; then
2011 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2012 # If there is no dlopen support or we're linking statically,
2013 # we need to preload.
2014 newdlprefiles="$newdlprefiles $deplib"
2015 compile_deplibs="$deplib $compile_deplibs"
2016 finalize_deplibs="$deplib $finalize_deplibs"
2018 newdlfiles="$newdlfiles $deplib"
2028 if test "$found" = yes || test -f "$lib"; then :
2030 $echo "$modename: cannot find the library \`$lib'" 1>&2
2034 # Check to see that this really is a libtool archive.
2035 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2037 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2041 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2042 test "X$ladir" = "X$lib" && ladir="."
2050 # If the library was installed with an old release of libtool,
2051 # it will not redefine variables installed, or shouldnotlink
2057 */* | *\\*) . $lib ;;
2061 if test "$linkmode,$pass" = "lib,link" ||
2062 test "$linkmode,$pass" = "prog,scan" ||
2063 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2064 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2065 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2068 if test "$pass" = conv; then
2069 # Only check for convenience libraries
2070 deplibs="$lib $deplibs"
2071 if test -z "$libdir"; then
2072 if test -z "$old_library"; then
2073 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2076 # It is a libtool convenience library, so add in its objects.
2077 convenience="$convenience $ladir/$objdir/$old_library"
2078 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2080 for deplib in $dependency_libs; do
2081 deplibs="$deplib $deplibs"
2082 if test "X$duplicate_deps" = "Xyes" ; then
2083 case "$tmp_libs " in
2084 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2087 tmp_libs="$tmp_libs $deplib"
2089 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2090 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2097 # Get the name of the library we link against.
2099 for l in $old_library $library_names; do
2102 if test -z "$linklib"; then
2103 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2107 # This library was specified with -dlopen.
2108 if test "$pass" = dlopen; then
2109 if test -z "$libdir"; then
2110 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2113 if test -z "$dlname" ||
2114 test "$dlopen_support" != yes ||
2115 test "$build_libtool_libs" = no; then
2116 # If there is no dlname, no dlopen support or we're linking
2117 # statically, we need to preload. We also need to preload any
2118 # dependent libraries so libltdl's deplib preloader doesn't
2119 # bomb out in the load deplibs phase.
2120 dlprefiles="$dlprefiles $lib $dependency_libs"
2122 newdlfiles="$newdlfiles $lib"
2127 # We need an absolute path.
2129 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2131 abs_ladir=`cd "$ladir" && pwd`
2132 if test -z "$abs_ladir"; then
2133 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2134 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2139 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2141 # Find the relevant object directory and library name.
2142 if test "X$installed" = Xyes; then
2143 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2144 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2153 dir="$ladir/$objdir"
2154 absdir="$abs_ladir/$objdir"
2155 # Remove this search path later
2156 notinst_path="$notinst_path $abs_ladir"
2157 fi # $installed = yes
2158 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2160 # This library was specified with -dlpreopen.
2161 if test "$pass" = dlpreopen; then
2162 if test -z "$libdir"; then
2163 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2166 # Prefer using a static library (so that no silly _DYNAMIC symbols
2167 # are required to link).
2168 if test -n "$old_library"; then
2169 newdlprefiles="$newdlprefiles $dir/$old_library"
2170 # Otherwise, use the dlname, so that lt_dlopen finds it.
2171 elif test -n "$dlname"; then
2172 newdlprefiles="$newdlprefiles $dir/$dlname"
2174 newdlprefiles="$newdlprefiles $dir/$linklib"
2176 fi # $pass = dlpreopen
2178 if test -z "$libdir"; then
2179 # Link the convenience library
2180 if test "$linkmode" = lib; then
2181 deplibs="$dir/$old_library $deplibs"
2182 elif test "$linkmode,$pass" = "prog,link"; then
2183 compile_deplibs="$dir/$old_library $compile_deplibs"
2184 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2186 deplibs="$lib $deplibs" # used for prog,scan pass
2192 if test "$linkmode" = prog && test "$pass" != link; then
2193 newlib_search_path="$newlib_search_path $ladir"
2194 deplibs="$lib $deplibs"
2197 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2198 test "$build_libtool_libs" = no; then
2203 for deplib in $dependency_libs; do
2205 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2207 # Need to link against all dependency_libs?
2208 if test "$linkalldeplibs" = yes; then
2209 deplibs="$deplib $deplibs"
2211 # Need to hardcode shared library paths
2212 # or/and link against static libraries
2213 newdependency_libs="$deplib $newdependency_libs"
2215 if test "X$duplicate_deps" = "Xyes" ; then
2216 case "$tmp_libs " in
2217 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2220 tmp_libs="$tmp_libs $deplib"
2223 fi # $linkmode = prog...
2225 if test "$linkmode,$pass" = "prog,link"; then
2226 if test -n "$library_names" &&
2227 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2228 # We need to hardcode the library path
2229 if test -n "$shlibpath_var"; then
2230 # Make sure the rpath contains only unique directories.
2231 case "$temp_rpath " in
2234 *) temp_rpath="$temp_rpath $dir" ;;
2238 # Hardcode the library path.
2239 # Skip directories that are in the system default run-time
2241 case " $sys_lib_dlsearch_path " in
2244 case "$compile_rpath " in
2246 *) compile_rpath="$compile_rpath $absdir"
2250 case " $sys_lib_dlsearch_path " in
2253 case "$finalize_rpath " in
2255 *) finalize_rpath="$finalize_rpath $libdir"
2259 fi # $linkmode,$pass = prog,link...
2261 if test "$alldeplibs" = yes &&
2262 { test "$deplibs_check_method" = pass_all ||
2263 { test "$build_libtool_libs" = yes &&
2264 test -n "$library_names"; }; }; then
2265 # We only need to search for static libraries
2270 link_static=no # Whether the deplib will be linked statically
2271 if test -n "$library_names" &&
2272 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2273 if test "$installed" = no; then
2274 notinst_deplibs="$notinst_deplibs $lib"
2277 # This is a shared library
2279 # Warn about portability, can't link against -module's on
2280 # some systems (darwin)
2281 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2283 if test "$linkmode" = prog; then
2284 $echo "*** Warning: Linking the executable $output against the loadable module"
2286 $echo "*** Warning: Linking the shared library $output against the loadable module"
2288 $echo "*** $linklib is not portable!"
2290 if test "$linkmode" = lib &&
2291 test "$hardcode_into_libs" = yes; then
2292 # Hardcode the library path.
2293 # Skip directories that are in the system default run-time
2295 case " $sys_lib_dlsearch_path " in
2298 case "$compile_rpath " in
2300 *) compile_rpath="$compile_rpath $absdir"
2304 case " $sys_lib_dlsearch_path " in
2307 case "$finalize_rpath " in
2309 *) finalize_rpath="$finalize_rpath $libdir"
2315 if test -n "$old_archive_from_expsyms_cmds"; then
2316 # figure out the soname
2317 set dummy $library_names
2320 libname=`eval \\$echo \"$libname_spec\"`
2321 # use dlname if we got it. it's perfectly good, no?
2322 if test -n "$dlname"; then
2324 elif test -n "$soname_spec"; then
2328 major=`expr $current - $age`
2332 eval soname=\"$soname_spec\"
2337 # Make a new name for the extract_expsyms_cmds to use
2339 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2340 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2342 # If the library has no export list, then create one now
2343 if test -f "$output_objdir/$soname-def"; then :
2345 $show "extracting exported symbol list from \`$soname'"
2346 save_ifs="$IFS"; IFS='~'
2347 cmds=$extract_expsyms_cmds
2348 for cmd in $cmds; do
2352 $run eval "$cmd" || exit $?
2358 if test -f "$output_objdir/$newlib"; then :; else
2359 $show "generating import library for \`$soname'"
2360 save_ifs="$IFS"; IFS='~'
2361 cmds=$old_archive_from_expsyms_cmds
2362 for cmd in $cmds; do
2366 $run eval "$cmd" || exit $?
2370 # make sure the library variables are pointing to the new library
2373 fi # test -n "$old_archive_from_expsyms_cmds"
2375 if test "$linkmode" = prog || test "$mode" != relink; then
2380 case $hardcode_action in
2381 immediate | unsupported)
2382 if test "$hardcode_direct" = no; then
2385 *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2387 # if the lib is a module then we can not link against
2388 # it, someone is ignoring the new warnings I added
2389 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2390 $echo "** Warning, lib $linklib is a module, not a shared library"
2391 if test -z "$old_library" ; then
2393 $echo "** And there doesn't seem to be a static archive available"
2394 $echo "** The link will probably fail, sorry"
2396 add="$dir/$old_library"
2400 elif test "$hardcode_minus_L" = no; then
2402 *-*-sunos*) add_shlibpath="$dir" ;;
2406 elif test "$hardcode_shlibpath_var" = no; then
2407 add_shlibpath="$dir"
2414 if test "$hardcode_direct" = yes; then
2416 elif test "$hardcode_minus_L" = yes; then
2418 # Try looking first in the location we're being installed to.
2419 if test -n "$inst_prefix_dir"; then
2422 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2427 elif test "$hardcode_shlibpath_var" = yes; then
2428 add_shlibpath="$dir"
2437 if test "$lib_linked" != yes; then
2438 $echo "$modename: configuration error: unsupported hardcode properties"
2442 if test -n "$add_shlibpath"; then
2443 case :$compile_shlibpath: in
2444 *":$add_shlibpath:"*) ;;
2445 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2448 if test "$linkmode" = prog; then
2449 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2450 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2452 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2453 test -n "$add" && deplibs="$add $deplibs"
2454 if test "$hardcode_direct" != yes && \
2455 test "$hardcode_minus_L" != yes && \
2456 test "$hardcode_shlibpath_var" = yes; then
2457 case :$finalize_shlibpath: in
2459 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2465 if test "$linkmode" = prog || test "$mode" = relink; then
2469 # Finalize command for both is simple: just hardcode it.
2470 if test "$hardcode_direct" = yes; then
2471 add="$libdir/$linklib"
2472 elif test "$hardcode_minus_L" = yes; then
2475 elif test "$hardcode_shlibpath_var" = yes; then
2476 case :$finalize_shlibpath: in
2478 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2481 elif test "$hardcode_automatic" = yes; then
2482 if test -n "$inst_prefix_dir" &&
2483 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2484 add="$inst_prefix_dir$libdir/$linklib"
2486 add="$libdir/$linklib"
2489 # We cannot seem to hardcode it, guess we'll fake it.
2491 # Try looking first in the location we're being installed to.
2492 if test -n "$inst_prefix_dir"; then
2495 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2502 if test "$linkmode" = prog; then
2503 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2504 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2506 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2507 test -n "$add" && deplibs="$add $deplibs"
2510 elif test "$linkmode" = prog; then
2511 # Here we assume that one of hardcode_direct or hardcode_minus_L
2512 # is not unsupported. This is valid on all known static and
2514 if test "$hardcode_direct" != unsupported; then
2515 test -n "$old_library" && linklib="$old_library"
2516 compile_deplibs="$dir/$linklib $compile_deplibs"
2517 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2519 compile_deplibs="-l$name -L$dir $compile_deplibs"
2520 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2522 elif test "$build_libtool_libs" = yes; then
2523 # Not a shared library
2524 if test "$deplibs_check_method" != pass_all; then
2525 # We're trying link a shared library against a static one
2526 # but the system doesn't support it.
2528 # Just print a warning and add the library to dependency_libs so
2529 # that the program can be linked against the static library.
2531 $echo "*** Warning: This system can not link to static lib archive $lib."
2532 $echo "*** I have the capability to make that library automatically link in when"
2533 $echo "*** you link to this library. But I can only do this if you have a"
2534 $echo "*** shared version of the library, which you do not appear to have."
2535 if test "$module" = yes; then
2536 $echo "*** But as you try to build a module library, libtool will still create "
2537 $echo "*** a static module, that should work as long as the dlopening application"
2538 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2539 if test -z "$global_symbol_pipe"; then
2541 $echo "*** However, this would only work if libtool was able to extract symbol"
2542 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2543 $echo "*** not find such a program. So, this module is probably useless."
2544 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2546 if test "$build_old_libs" = no; then
2547 build_libtool_libs=module
2550 build_libtool_libs=no
2554 convenience="$convenience $dir/$old_library"
2555 old_convenience="$old_convenience $dir/$old_library"
2556 deplibs="$dir/$old_library $deplibs"
2559 fi # link shared/static library?
2561 if test "$linkmode" = lib; then
2562 if test -n "$dependency_libs" &&
2563 { test "$hardcode_into_libs" != yes ||
2564 test "$build_old_libs" = yes ||
2565 test "$link_static" = yes; }; then
2566 # Extract -R from dependency_libs
2568 for libdir in $dependency_libs; do
2570 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2572 *" $temp_xrpath "*) ;;
2573 *) xrpath="$xrpath $temp_xrpath";;
2575 *) temp_deplibs="$temp_deplibs $libdir";;
2578 dependency_libs="$temp_deplibs"
2581 newlib_search_path="$newlib_search_path $absdir"
2582 # Link against this library
2583 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2584 # ... and its dependency_libs
2586 for deplib in $dependency_libs; do
2587 newdependency_libs="$deplib $newdependency_libs"
2588 if test "X$duplicate_deps" = "Xyes" ; then
2589 case "$tmp_libs " in
2590 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2593 tmp_libs="$tmp_libs $deplib"
2596 if test "$link_all_deplibs" != no; then
2597 # Add the search paths of all dependency libraries
2598 for deplib in $dependency_libs; do
2600 -L*) path="$deplib" ;;
2602 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2603 test "X$dir" = "X$deplib" && dir="."
2604 # We need an absolute path.
2606 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2608 absdir=`cd "$dir" && pwd`
2609 if test -z "$absdir"; then
2610 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2615 if grep "^installed=no" $deplib > /dev/null; then
2616 path="$absdir/$objdir"
2618 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2619 if test -z "$libdir"; then
2620 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2623 if test "$absdir" != "$libdir"; then
2624 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2631 # we do not want to link against static libs,
2632 # but need to link against shared
2633 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2634 if test -n "$deplibrary_names" ; then
2635 for tmp in $deplibrary_names ; do
2638 if test -f "$path/$depdepl" ; then
2639 depdepl="$path/$depdepl"
2641 # do not add paths which are already there
2642 case " $newlib_search_path " in
2644 *) newlib_search_path="$newlib_search_path $path";;
2657 # Again, we only want to link against shared libraries
2658 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2659 for tmp in $newlib_search_path ; do
2660 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2661 eval depdepl="$tmp/lib$tmp_libs.dylib"
2672 case " $deplibs " in
2674 *) deplibs="$depdepl $deplibs" ;;
2676 case " $deplibs " in
2678 *) deplibs="$deplibs $path" ;;
2681 fi # link_all_deplibs != no
2683 done # for deplib in $libs
2684 dependency_libs="$newdependency_libs"
2685 if test "$pass" = dlpreopen; then
2686 # Link the dlpreopened libraries before other libraries
2687 for deplib in $save_deplibs; do
2688 deplibs="$deplib $deplibs"
2691 if test "$pass" != dlopen; then
2692 if test "$pass" != conv; then
2693 # Make sure lib_search_path contains only unique directories.
2695 for dir in $newlib_search_path; do
2696 case "$lib_search_path " in
2698 *) lib_search_path="$lib_search_path $dir" ;;
2704 if test "$linkmode,$pass" != "prog,link"; then
2707 vars="compile_deplibs finalize_deplibs"
2709 for var in $vars dependency_libs; do
2710 # Add libraries to $var in reverse order
2711 eval tmp_libs=\"\$$var\"
2713 for deplib in $tmp_libs; do
2714 # FIXME: Pedantically, this is the right thing to do, so
2715 # that some nasty dependency loop isn't accidentally
2717 #new_libs="$deplib $new_libs"
2718 # Pragmatically, this seems to cause very few problems in
2721 -L*) new_libs="$deplib $new_libs" ;;
2724 # And here is the reason: when a library appears more
2725 # than once as an explicit dependence of a library, or
2726 # is implicitly linked in more than once by the
2727 # compiler, it is considered special, and multiple
2728 # occurrences thereof are not removed. Compare this
2729 # with having the same library being listed as a
2730 # dependency of multiple other libraries: in this case,
2731 # we know (pedantically, we assume) the library does not
2732 # need to be listed more than once, so we keep only the
2733 # last copy. This is not always right, but it is rare
2734 # enough that we require users that really mean to play
2735 # such unportable linking tricks to link the library
2736 # using -Wl,-lname, so that libtool does not consider it
2737 # for duplicate removal.
2738 case " $specialdeplibs " in
2739 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2741 case " $new_libs " in
2743 *) new_libs="$deplib $new_libs" ;;
2751 for deplib in $new_libs; do
2754 case " $tmp_libs " in
2756 *) tmp_libs="$tmp_libs $deplib" ;;
2759 *) tmp_libs="$tmp_libs $deplib" ;;
2762 eval $var=\"$tmp_libs\"
2765 # Last step: remove runtime libs from dependency_libs
2766 # (they stay in deplibs)
2768 for i in $dependency_libs ; do
2769 case " $predeps $postdeps $compiler_lib_search_path " in
2774 if test -n "$i" ; then
2775 tmp_libs="$tmp_libs $i"
2778 dependency_libs=$tmp_libs
2780 if test "$linkmode" = prog; then
2781 dlfiles="$newdlfiles"
2782 dlprefiles="$newdlprefiles"
2787 if test -n "$deplibs"; then
2788 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2791 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2792 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2795 if test -n "$rpath"; then
2796 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2799 if test -n "$xrpath"; then
2800 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2803 if test -n "$vinfo"; then
2804 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2807 if test -n "$release"; then
2808 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2811 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2812 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2815 # Now set the variables for building old libraries.
2816 build_libtool_libs=no
2818 objs="$objs$old_deplibs"
2822 # Make sure we only generate libraries of the form `libNAME.la'.
2825 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2826 eval shared_ext=\"$shrext_cmds\"
2827 eval libname=\"$libname_spec\"
2830 if test "$module" = no; then
2831 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2835 if test "$need_lib_prefix" != no; then
2836 # Add the "lib" prefix for modules if required
2837 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2838 eval shared_ext=\"$shrext_cmds\"
2839 eval libname=\"$libname_spec\"
2841 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2846 if test -n "$objs"; then
2847 if test "$deplibs_check_method" != pass_all; then
2848 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2852 $echo "*** Warning: Linking the shared library $output against the non-libtool"
2853 $echo "*** objects $objs is not portable!"
2854 libobjs="$libobjs $objs"
2858 if test "$dlself" != no; then
2859 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2863 if test "$#" -gt 2; then
2864 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2869 if test -z "$rpath"; then
2870 if test "$build_libtool_libs" = yes; then
2871 # Building a libtool convenience library.
2872 # Some compilers have problems with a `.al' extension so
2873 # convenience libraries should have the same extension an
2874 # archive normally would.
2875 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2876 build_libtool_libs=convenience
2880 if test -n "$vinfo"; then
2881 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2884 if test -n "$release"; then
2885 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2889 # Parse the version information argument.
2890 save_ifs="$IFS"; IFS=':'
2891 set dummy $vinfo 0 0 0
2894 if test -n "$8"; then
2895 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2900 # convert absolute version numbers to libtool ages
2901 # this retains compatibility with .la files and attempts
2902 # to make the code below a bit more comprehensible
2904 case $vinfo_number in
2908 number_revision="$4"
2910 # There are really only two kinds -- those that
2911 # use the current revision as the major version
2912 # and those that subtract age and use age as
2913 # a minor version. But, then there is irix
2914 # which has an extra 1 added just for fun
2916 case $version_type in
2917 darwin|linux|osf|windows)
2918 current=`expr $number_major + $number_minor`
2920 revision="$number_revision"
2922 freebsd-aout|freebsd-elf|sunos)
2923 current="$number_major"
2924 revision="$number_minor"
2928 current=`expr $number_major + $number_minor - 1`
2930 revision="$number_minor"
2933 $echo "$modename: unknown library version type \`$version_type'" 1>&2
2934 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
2946 # Check that each of the things are valid numbers.
2948 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2950 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2951 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2957 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2959 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2960 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2966 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
2968 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2969 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2974 if test "$age" -gt "$current"; then
2975 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2976 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2980 # Calculate the version variables.
2984 case $version_type in
2988 # Like Linux, but with the current version available in
2989 # verstring for coding it into the library header
2990 major=.`expr $current - $age`
2991 versuffix="$major.$age.$revision"
2992 # Darwin ld doesn't like 0 for these options...
2993 minor_current=`expr $current + 1`
2994 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2999 versuffix=".$current.$revision";
3004 versuffix=".$current";
3008 major=`expr $current - $age + 1`
3010 case $version_type in
3011 nonstopux) verstring_prefix=nonstopux ;;
3012 *) verstring_prefix=sgi ;;
3014 verstring="$verstring_prefix$major.$revision"
3016 # Add in all the interfaces that we are compatible with.
3018 while test "$loop" -ne 0; do
3019 iface=`expr $revision - $loop`
3020 loop=`expr $loop - 1`
3021 verstring="$verstring_prefix$major.$iface:$verstring"
3024 # Before this point, $major must not contain `.'.
3026 versuffix="$major.$revision"
3030 major=.`expr $current - $age`
3031 versuffix="$major.$age.$revision"
3035 major=.`expr $current - $age`
3036 versuffix=".$current.$age.$revision"
3037 verstring="$current.$age.$revision"
3039 # Add in all the interfaces that we are compatible with.
3041 while test "$loop" -ne 0; do
3042 iface=`expr $current - $loop`
3043 loop=`expr $loop - 1`
3044 verstring="$verstring:${iface}.0"
3047 # Make executables depend on our current version.
3048 verstring="$verstring:${current}.0"
3053 versuffix=".$current.$revision"
3057 # Use '-' rather than '.', since we only want one
3058 # extension on DOS 8.3 filesystems.
3059 major=`expr $current - $age`
3064 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3065 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3070 # Clear the version info if we defaulted, and they specified a release.
3071 if test -z "$vinfo" && test -n "$release"; then
3073 case $version_type in
3075 # we can't check for "0.0" in archive_cmds due to quoting
3076 # problems, so we reset it completely
3083 if test "$need_version" = no; then
3090 # Remove version info from name if versioning should be avoided
3091 if test "$avoid_version" = yes && test "$need_version" = no; then
3097 # Check to see if the archive will have undefined symbols.
3098 if test "$allow_undefined" = yes; then
3099 if test "$allow_undefined_flag" = unsupported; then
3100 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3101 build_libtool_libs=no
3105 # Don't allow undefined symbols.
3106 allow_undefined_flag="$no_undefined_flag"
3110 if test "$mode" != relink; then
3111 # Remove our outputs, but don't remove object files since they
3112 # may have been created when compiling PIC objects.
3114 tempremovelist=`$echo "$output_objdir/*"`
3115 for p in $tempremovelist; do
3119 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3120 if test "X$precious_files_regex" != "X"; then
3121 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3126 removelist="$removelist $p"
3131 if test -n "$removelist"; then
3132 $show "${rm}r $removelist"
3133 $run ${rm}r $removelist
3137 # Now set the variables for building old libraries.
3138 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3139 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3141 # Transform .lo files to .o files.
3142 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3145 # Eliminate all temporary directories.
3146 for path in $notinst_path; do
3147 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3148 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3149 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3152 if test -n "$xrpath"; then
3153 # If the user specified any rpath flags, then add them.
3155 for libdir in $xrpath; do
3156 temp_xrpath="$temp_xrpath -R$libdir"
3157 case "$finalize_rpath " in
3159 *) finalize_rpath="$finalize_rpath $libdir" ;;
3162 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3163 dependency_libs="$temp_xrpath $dependency_libs"
3167 # Make sure dlfiles contains only unique files that won't be dlpreopened
3168 old_dlfiles="$dlfiles"
3170 for lib in $old_dlfiles; do
3171 case " $dlprefiles $dlfiles " in
3173 *) dlfiles="$dlfiles $lib" ;;
3177 # Make sure dlprefiles contains only unique files
3178 old_dlprefiles="$dlprefiles"
3180 for lib in $old_dlprefiles; do
3181 case "$dlprefiles " in
3183 *) dlprefiles="$dlprefiles $lib" ;;
3187 if test "$build_libtool_libs" = yes; then
3188 if test -n "$rpath"; then
3190 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3191 # these systems don't actually have a c library (as such)!
3193 *-*-rhapsody* | *-*-darwin1.[012])
3194 # Rhapsody C library is in the System framework
3195 deplibs="$deplibs -framework System"
3198 # Don't link with libc until the a.out ld.so is fixed.
3200 *-*-openbsd* | *-*-freebsd*)
3201 # Do not include libc due to us having libc/libc_r.
3202 test "X$arg" = "X-lc" && continue
3205 # Add libc to deplibs on all other systems if necessary.
3206 if test "$build_libtool_need_lc" = "yes"; then
3207 deplibs="$deplibs -lc"
3213 # Transform deplibs into only deplibs that can be linked in shared.
3215 libname_save=$libname
3216 release_save=$release
3217 versuffix_save=$versuffix
3219 # I'm not sure if I'm treating the release correctly. I think
3220 # release should show up in the -l (ie -lgmp5) so we don't want to
3221 # add it in twice. Is that correct?
3227 case $deplibs_check_method in
3229 # Don't check for shared/static. Everything works.
3230 # This might be a little naive. We might want to check
3231 # whether the library exists or not. But this is on
3232 # osf3 & osf4 and I'm not really sure... Just
3233 # implementing what was already the behavior.
3237 # This code stresses the "libraries are programs" paradigm to its
3238 # limits. Maybe even breaks it. We compile a program, linking it
3239 # against the deplibs as a proxy for the library. Then we can check
3240 # whether they linked in statically or dynamically with ldd.
3242 cat > conftest.c <<EOF
3243 int main() { return 0; }
3246 $LTCC -o conftest conftest.c $deplibs
3247 if test "$?" -eq 0 ; then
3248 ldd_output=`ldd conftest`
3249 for i in $deplibs; do
3250 name="`expr $i : '-l\(.*\)'`"
3251 # If $name is empty we are operating on a -L argument.
3252 if test "$name" != "" && test "$name" -ne "0"; then
3253 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3254 case " $predeps $postdeps " in
3256 newdeplibs="$newdeplibs $i"
3261 if test -n "$i" ; then
3262 libname=`eval \\$echo \"$libname_spec\"`
3263 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3264 set dummy $deplib_matches
3266 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3267 newdeplibs="$newdeplibs $i"
3271 $echo "*** Warning: dynamic linker does not accept needed library $i."
3272 $echo "*** I have the capability to make that library automatically link in when"
3273 $echo "*** you link to this library. But I can only do this if you have a"
3274 $echo "*** shared version of the library, which I believe you do not have"
3275 $echo "*** because a test_compile did reveal that the linker did not use it for"
3276 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3280 newdeplibs="$newdeplibs $i"
3284 # Error occurred in the first compile. Let's try to salvage
3285 # the situation: Compile a separate program for each library.
3286 for i in $deplibs; do
3287 name="`expr $i : '-l\(.*\)'`"
3288 # If $name is empty we are operating on a -L argument.
3289 if test "$name" != "" && test "$name" != "0"; then
3291 $LTCC -o conftest conftest.c $i
3293 if test "$?" -eq 0 ; then
3294 ldd_output=`ldd conftest`
3295 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3296 case " $predeps $postdeps " in
3298 newdeplibs="$newdeplibs $i"
3303 if test -n "$i" ; then
3304 libname=`eval \\$echo \"$libname_spec\"`
3305 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3306 set dummy $deplib_matches
3308 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3309 newdeplibs="$newdeplibs $i"
3313 $echo "*** Warning: dynamic linker does not accept needed library $i."
3314 $echo "*** I have the capability to make that library automatically link in when"
3315 $echo "*** you link to this library. But I can only do this if you have a"
3316 $echo "*** shared version of the library, which you do not appear to have"
3317 $echo "*** because a test_compile did reveal that the linker did not use this one"
3318 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3324 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3325 $echo "*** make it link in! You will probably need to install it or some"
3326 $echo "*** library that it depends on before this library will be fully"
3327 $echo "*** functional. Installing it before continuing would be even better."
3330 newdeplibs="$newdeplibs $i"
3336 set dummy $deplibs_check_method
3337 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3338 for a_deplib in $deplibs; do
3339 name="`expr $a_deplib : '-l\(.*\)'`"
3340 # If $name is empty we are operating on a -L argument.
3341 if test "$name" != "" && test "$name" != "0"; then
3342 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3343 case " $predeps $postdeps " in
3345 newdeplibs="$newdeplibs $a_deplib"
3350 if test -n "$a_deplib" ; then
3351 libname=`eval \\$echo \"$libname_spec\"`
3352 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3353 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3354 for potent_lib in $potential_libs; do
3355 # Follow soft links.
3356 if ls -lLd "$potent_lib" 2>/dev/null \
3357 | grep " -> " >/dev/null; then
3360 # The statement above tries to avoid entering an
3361 # endless loop below, in case of cyclic links.
3362 # We might still enter an endless loop, since a link
3363 # loop can be closed while we follow links,
3365 potlib="$potent_lib"
3366 while test -h "$potlib" 2>/dev/null; do
3367 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3369 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3370 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3373 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3375 | $EGREP "$file_magic_regex" > /dev/null; then
3376 newdeplibs="$newdeplibs $a_deplib"
3383 if test -n "$a_deplib" ; then
3386 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3387 $echo "*** I have the capability to make that library automatically link in when"
3388 $echo "*** you link to this library. But I can only do this if you have a"
3389 $echo "*** shared version of the library, which you do not appear to have"
3390 $echo "*** because I did check the linker path looking for a file starting"
3391 if test -z "$potlib" ; then
3392 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3394 $echo "*** with $libname and none of the candidates passed a file format test"
3395 $echo "*** using a file magic. Last file checked: $potlib"
3399 # Add a -L argument.
3400 newdeplibs="$newdeplibs $a_deplib"
3402 done # Gone through all deplibs.
3405 set dummy $deplibs_check_method
3406 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3407 for a_deplib in $deplibs; do
3408 name="`expr $a_deplib : '-l\(.*\)'`"
3409 # If $name is empty we are operating on a -L argument.
3410 if test -n "$name" && test "$name" != "0"; then
3411 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3412 case " $predeps $postdeps " in
3414 newdeplibs="$newdeplibs $a_deplib"
3419 if test -n "$a_deplib" ; then
3420 libname=`eval \\$echo \"$libname_spec\"`
3421 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3422 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3423 for potent_lib in $potential_libs; do
3424 potlib="$potent_lib" # see symlink-check above in file_magic test
3425 if eval $echo \"$potent_lib\" 2>/dev/null \
3427 | $EGREP "$match_pattern_regex" > /dev/null; then
3428 newdeplibs="$newdeplibs $a_deplib"
3435 if test -n "$a_deplib" ; then
3438 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3439 $echo "*** I have the capability to make that library automatically link in when"
3440 $echo "*** you link to this library. But I can only do this if you have a"
3441 $echo "*** shared version of the library, which you do not appear to have"
3442 $echo "*** because I did check the linker path looking for a file starting"
3443 if test -z "$potlib" ; then
3444 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3446 $echo "*** with $libname and none of the candidates passed a file format test"
3447 $echo "*** using a regex pattern. Last file checked: $potlib"
3451 # Add a -L argument.
3452 newdeplibs="$newdeplibs $a_deplib"
3454 done # Gone through all deplibs.
3458 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3459 -e 's/ -[LR][^ ]*//g'`
3460 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3461 for i in $predeps $postdeps ; do
3462 # can't use Xsed below, because $i might contain '/'
3463 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3466 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3467 | grep . >/dev/null; then
3469 if test "X$deplibs_check_method" = "Xnone"; then
3470 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3472 $echo "*** Warning: inter-library dependencies are not known to be supported."
3474 $echo "*** All declared inter-library dependencies are being dropped."
3479 versuffix=$versuffix_save
3481 release=$release_save
3482 libname=$libname_save
3486 *-*-rhapsody* | *-*-darwin1.[012])
3487 # On Rhapsody replace the C library is the System framework
3488 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3492 if test "$droppeddeps" = yes; then
3493 if test "$module" = yes; then
3495 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3496 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3497 $echo "*** a static module, that should work as long as the dlopening"
3498 $echo "*** application is linked with the -dlopen flag."
3499 if test -z "$global_symbol_pipe"; then
3501 $echo "*** However, this would only work if libtool was able to extract symbol"
3502 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3503 $echo "*** not find such a program. So, this module is probably useless."
3504 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3506 if test "$build_old_libs" = no; then
3507 oldlibs="$output_objdir/$libname.$libext"
3508 build_libtool_libs=module
3511 build_libtool_libs=no
3514 $echo "*** The inter-library dependencies that have been dropped here will be"
3515 $echo "*** automatically added whenever a program is linked with this library"
3516 $echo "*** or is declared to -dlopen it."
3518 if test "$allow_undefined" = no; then
3520 $echo "*** Since this library must not contain undefined symbols,"
3521 $echo "*** because either the platform does not support them or"
3522 $echo "*** it was explicitly requested with -no-undefined,"
3523 $echo "*** libtool will only create a static version of it."
3524 if test "$build_old_libs" = no; then
3525 oldlibs="$output_objdir/$libname.$libext"
3526 build_libtool_libs=module
3529 build_libtool_libs=no
3534 # Done checking deplibs!
3538 # All the library-specific variables (install_libdir is set above).
3543 # Test again, we may have decided not to build it any more
3544 if test "$build_libtool_libs" = yes; then
3545 if test "$hardcode_into_libs" = yes; then
3546 # Hardcode the library paths
3549 rpath="$finalize_rpath"
3550 test "$mode" != relink && rpath="$compile_rpath$rpath"
3551 for libdir in $rpath; do
3552 if test -n "$hardcode_libdir_flag_spec"; then
3553 if test -n "$hardcode_libdir_separator"; then
3554 if test -z "$hardcode_libdirs"; then
3555 hardcode_libdirs="$libdir"
3557 # Just accumulate the unique libdirs.
3558 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3559 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3562 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3567 eval flag=\"$hardcode_libdir_flag_spec\"
3568 dep_rpath="$dep_rpath $flag"
3570 elif test -n "$runpath_var"; then
3571 case "$perm_rpath " in
3573 *) perm_rpath="$perm_rpath $libdir" ;;
3577 # Substitute the hardcoded libdirs into the rpath.
3578 if test -n "$hardcode_libdir_separator" &&
3579 test -n "$hardcode_libdirs"; then
3580 libdir="$hardcode_libdirs"
3581 if test -n "$hardcode_libdir_flag_spec_ld"; then
3582 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3584 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3587 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3588 # We should set the runpath_var.
3590 for dir in $perm_rpath; do
3593 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3595 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3598 shlibpath="$finalize_shlibpath"
3599 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3600 if test -n "$shlibpath"; then
3601 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3604 # Get the real and link names of the library.
3605 eval shared_ext=\"$shrext_cmds\"
3606 eval library_names=\"$library_names_spec\"
3607 set dummy $library_names
3611 if test -n "$soname_spec"; then
3612 eval soname=\"$soname_spec\"
3616 if test -z "$dlname"; then
3620 lib="$output_objdir/$realname"
3623 linknames="$linknames $link"
3626 # Use standard objects if they are pic
3627 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3629 # Prepare the list of exported symbols
3630 if test -z "$export_symbols"; then
3631 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3632 $show "generating symbol list for \`$libname.la'"
3633 export_symbols="$output_objdir/$libname.exp"
3634 $run $rm $export_symbols
3635 cmds=$export_symbols_cmds
3636 save_ifs="$IFS"; IFS='~'
3637 for cmd in $cmds; do
3640 if len=`expr "X$cmd" : ".*"` &&
3641 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3643 $run eval "$cmd" || exit $?
3644 skipped_export=false
3646 # The command line is too long to execute in one step.
3647 $show "using reloadable object file for export list..."
3652 if test -n "$export_symbols_regex"; then
3653 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3654 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3655 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3656 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3661 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3662 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3666 for test_deplib in $deplibs; do
3667 case " $convenience " in
3668 *" $test_deplib "*) ;;
3670 tmp_deplibs="$tmp_deplibs $test_deplib"
3674 deplibs="$tmp_deplibs"
3676 if test -n "$convenience"; then
3677 if test -n "$whole_archive_flag_spec"; then
3678 save_libobjs=$libobjs
3679 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3681 gentop="$output_objdir/${outputname}x"
3682 $show "${rm}r $gentop"
3683 $run ${rm}r "$gentop"
3684 $show "$mkdir $gentop"
3685 $run $mkdir "$gentop"
3687 if test "$status" -ne 0 && test ! -d "$gentop"; then
3690 generated="$generated $gentop"
3692 for xlib in $convenience; do
3693 # Extract the objects.
3695 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3696 *) xabs=`pwd`"/$xlib" ;;
3698 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3699 xdir="$gentop/$xlib"
3701 $show "${rm}r $xdir"
3703 $show "$mkdir $xdir"
3706 if test "$status" -ne 0 && test ! -d "$xdir"; then
3709 # We will extract separately just the conflicting names and we will no
3710 # longer touch any unique names. It is faster to leave these extract
3711 # automatically by $AR in one run.
3712 $show "(cd $xdir && $AR x $xabs)"
3713 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3714 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3717 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3718 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3719 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3722 while test "$i" -le "$count"
3724 # Put our $i before any first dot (extension)
3725 # Never overwrite any file
3727 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3729 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3731 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3732 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3738 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3743 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3744 eval flag=\"$thread_safe_flag_spec\"
3745 linker_flags="$linker_flags $flag"
3748 # Make a backup of the uninstalled library when relinking
3749 if test "$mode" = relink; then
3750 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3753 # Do each of the archive commands.
3754 if test "$module" = yes && test -n "$module_cmds" ; then
3755 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3756 eval test_cmds=\"$module_expsym_cmds\"
3757 cmds=$module_expsym_cmds
3759 eval test_cmds=\"$module_cmds\"
3763 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3764 eval test_cmds=\"$archive_expsym_cmds\"
3765 cmds=$archive_expsym_cmds
3767 eval test_cmds=\"$archive_cmds\"
3772 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3773 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3776 # The command line is too long to link in one step, link piecewise.
3777 $echo "creating reloadable object files..."
3779 # Save the value of $output and $libobjs because we want to
3780 # use them later. If we have whole_archive_flag_spec, we
3781 # want to use save_libobjs as it was before
3782 # whole_archive_flag_spec was expanded, because we can't
3783 # assume the linker understands whole_archive_flag_spec.
3784 # This may have to be revisited, in case too many
3785 # convenience libraries get linked in and end up exceeding
3787 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3788 save_libobjs=$libobjs
3792 # Clear the reloadable object creation command queue and
3793 # initialize k to one.
3800 output=$output_objdir/$save_output-${k}.$objext
3801 # Loop over the list of objects to be linked.
3802 for obj in $save_libobjs
3804 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3805 if test "X$objlist" = X ||
3806 { len=`expr "X$test_cmds" : ".*"` &&
3807 test "$len" -le "$max_cmd_len"; }; then
3808 objlist="$objlist $obj"
3810 # The command $test_cmds is almost too long, add a
3811 # command to the queue.
3812 if test "$k" -eq 1 ; then
3813 # The first file doesn't have a previous command to add.
3814 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3816 # All subsequent reloadable object files will link in
3817 # the last one created.
3818 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3820 last_robj=$output_objdir/$save_output-${k}.$objext
3822 output=$output_objdir/$save_output-${k}.$objext
3827 # Handle the remaining objects by creating one last
3828 # reloadable object file. All subsequent reloadable object
3829 # files will link in the last one created.
3830 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3831 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3833 if ${skipped_export-false}; then
3834 $show "generating symbol list for \`$libname.la'"
3835 export_symbols="$output_objdir/$libname.exp"
3836 $run $rm $export_symbols
3838 # Append the command to create the export file.
3839 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3842 # Set up a command to remove the reloadale object files
3843 # after they are used.
3845 while test "$i" -lt "$k"
3848 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3851 $echo "creating a temporary reloadable object file: $output"
3853 # Loop through the commands generated above and execute them.
3854 save_ifs="$IFS"; IFS='~'
3855 for cmd in $concat_cmds; do
3858 $run eval "$cmd" || exit $?
3863 # Restore the value of output.
3866 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3867 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3869 # Expand the library linking commands again to reset the
3870 # value of $libobjs for piecewise linking.
3872 # Do each of the archive commands.
3873 if test "$module" = yes && test -n "$module_cmds" ; then
3874 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3875 cmds=$module_expsym_cmds
3880 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3881 cmds=$archive_expsym_cmds
3887 # Append the command to remove the reloadable object files
3888 # to the just-reset $cmds.
3889 eval cmds=\"\$cmds~\$rm $delfiles\"
3891 save_ifs="$IFS"; IFS='~'
3892 for cmd in $cmds; do
3896 $run eval "$cmd" || exit $?
3900 # Restore the uninstalled library and exit
3901 if test "$mode" = relink; then
3902 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3906 # Create links to the real library.
3907 for linkname in $linknames; do
3908 if test "$realname" != "$linkname"; then
3909 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3910 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3914 # If -module or -export-dynamic was specified, set the dlname.
3915 if test "$module" = yes || test "$export_dynamic" = yes; then
3916 # On all known operating systems, these are identical.
3923 if test -n "$deplibs"; then
3924 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3927 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3928 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3931 if test -n "$rpath"; then
3932 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3935 if test -n "$xrpath"; then
3936 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3939 if test -n "$vinfo"; then
3940 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3943 if test -n "$release"; then
3944 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3949 if test -n "$objs$old_deplibs"; then
3950 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3954 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3962 # Delete the old objects.
3963 $run $rm $obj $libobj
3965 # Objects from convenience libraries. This assumes
3966 # single-version convenience libraries. Whenever we create
3967 # different ones for PIC/non-PIC, this we'll have to duplicate
3971 # reload_cmds runs $LD directly, so let us get rid of
3972 # -Wl from whole_archive_flag_spec
3975 if test -n "$convenience"; then
3976 if test -n "$whole_archive_flag_spec"; then
3977 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3979 gentop="$output_objdir/${obj}x"
3980 $show "${rm}r $gentop"
3981 $run ${rm}r "$gentop"
3982 $show "$mkdir $gentop"
3983 $run $mkdir "$gentop"
3985 if test "$status" -ne 0 && test ! -d "$gentop"; then
3988 generated="$generated $gentop"
3990 for xlib in $convenience; do
3991 # Extract the objects.
3993 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3994 *) xabs=`pwd`"/$xlib" ;;
3996 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3997 xdir="$gentop/$xlib"
3999 $show "${rm}r $xdir"
4001 $show "$mkdir $xdir"
4004 if test "$status" -ne 0 && test ! -d "$xdir"; then
4007 # We will extract separately just the conflicting names and we will no
4008 # longer touch any unique names. It is faster to leave these extract
4009 # automatically by $AR in one run.
4010 $show "(cd $xdir && $AR x $xabs)"
4011 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4012 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4015 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4016 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4017 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4020 while test "$i" -le "$count"
4022 # Put our $i before any first dot (extension)
4023 # Never overwrite any file
4025 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4027 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4029 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4030 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4036 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4041 # Create the old-style object.
4042 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
4046 save_ifs="$IFS"; IFS='~'
4047 for cmd in $cmds; do
4051 $run eval "$cmd" || exit $?
4055 # Exit if we aren't doing a library object file.
4056 if test -z "$libobj"; then
4057 if test -n "$gentop"; then
4058 $show "${rm}r $gentop"
4065 if test "$build_libtool_libs" != yes; then
4066 if test -n "$gentop"; then
4067 $show "${rm}r $gentop"
4071 # Create an invalid libtool object if no PIC, so that we don't
4072 # accidentally link it into a program.
4073 # $show "echo timestamp > $libobj"
4074 # $run eval "echo timestamp > $libobj" || exit $?
4078 if test -n "$pic_flag" || test "$pic_mode" != default; then
4079 # Only do commands if we really have different PIC objects.
4080 reload_objs="$libobjs $reload_conv_objs"
4083 save_ifs="$IFS"; IFS='~'
4084 for cmd in $cmds; do
4088 $run eval "$cmd" || exit $?
4093 if test -n "$gentop"; then
4094 $show "${rm}r $gentop"
4103 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4105 if test -n "$vinfo"; then
4106 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4109 if test -n "$release"; then
4110 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4113 if test "$preload" = yes; then
4114 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4115 test "$dlopen_self_static" = unknown; then
4116 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4121 *-*-rhapsody* | *-*-darwin1.[012])
4122 # On Rhapsody replace the C library is the System framework
4123 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4124 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4130 # Don't allow lazy linking, it breaks C++ global constructors
4131 if test "$tagname" = CXX ; then
4132 compile_command="$compile_command ${wl}-bind_at_load"
4133 finalize_command="$finalize_command ${wl}-bind_at_load"
4138 compile_command="$compile_command $compile_deplibs"
4139 finalize_command="$finalize_command $finalize_deplibs"
4141 if test -n "$rpath$xrpath"; then
4142 # If the user specified any rpath flags, then add them.
4143 for libdir in $rpath $xrpath; do
4144 # This is the magic to use -rpath.
4145 case "$finalize_rpath " in
4147 *) finalize_rpath="$finalize_rpath $libdir" ;;