1 Description: update ltmain.sh and aclocal.m4
2 Author: gregor herrmann <gregoa@debian.org>
3 Last-Update: 2010-05-25
4 Bugs-Debian: http://bugs.debian.org/375634
9 # ltmain.sh - Provide generalized library-building support services.
10 # NOTE: Changing this file will not affect anything until you rerun configure.
12 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
13 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
14 # Free Software Foundation, Inc.
15 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
31 +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
32 +# is ksh but when the shell is invoked as "sh" and the current value of
33 +# the _XPG environment variable is not equal to 1 (one), the special
34 +# positional parameter $0, within a function call, is the name of the
38 +# The name of this program:
39 +progname=`echo "$progpath" | $SED $basename`
48 +VERSION="1.5.22 Debian 1.5.22-4"
49 +TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
51 +# See if we are running on zsh, and set the options which allow our
52 +# commands through without removal of \ escapes.
53 +if test -n "${ZSH_VERSION+set}" ; then
54 + setopt NO_GLOB_SUBST
57 # Check that we have a working $echo.
58 if test "X$1" = X--no-reexec; then
59 # Discard the --no-reexec flag, and continue.
63 # Restart under the correct shell, and then maybe $echo will work.
64 - exec $SHELL "$0" --no-reexec ${1+"$@"}
65 + exec $SHELL "$progpath" --no-reexec ${1+"$@"}
68 if test "X$1" = X--fallback-echo; then
77 -# The name of this program.
78 -progname=`$echo "$0" | sed 's%^.*/%%'`
85 -TIMESTAMP=" (1.922.2.53 2001/09/11 03:18:52)"
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
92 # Sed substitution that helps us do robust quoting. It backslashifies
93 # metacharacters that are still active within double-quoted strings.
94 -Xsed='sed -e 1s/^X//'
95 +Xsed="${SED}"' -e 1s/^X//'
96 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 -NL2SP='tr \015\012 \040\040'
99 +# test EBCDIC or ASCII
100 +case `echo X|tr X '\101'` in
101 + A) # ASCII based system
102 + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 + SP2NL='tr \040 \012'
104 + NL2SP='tr \015\012 \040\040'
106 + *) # EBCDIC based system
108 + NL2SP='tr \r\n \100\100'
113 # Only set LANG and LC_ALL to C if already set.
117 # Make sure IFS has a sensible default
123 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
124 - echo "$modename: not configured to build any kind of library" 1>&2
125 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
127 + $echo "$modename: not configured to build any kind of library" 1>&2
128 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
133 @@ -102,11 +132,268 @@
139 lo2o="s/\\.lo\$/.${objext}/"
140 o2lo="s/\\.${objext}\$/.lo/"
142 +#####################################
143 +# Shell function definitions:
144 +# This seems to be the best place for them
146 +# func_mktempdir [string]
147 +# Make a temporary directory that won't clash with other running
148 +# libtool processes, and avoids race conditions if possible. If
149 +# given, STRING is the basename for that directory.
152 + my_template="${TMPDIR-/tmp}/${1-$progname}"
154 + if test "$run" = ":"; then
155 + # Return a directory name, but don't create it in dry-run mode
156 + my_tmpdir="${my_template}-$$"
159 + # If mktemp works, use that first and foremost
160 + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
162 + if test ! -d "$my_tmpdir"; then
163 + # Failing that, at least try and use $RANDOM to avoid a race
164 + my_tmpdir="${my_template}-${RANDOM-0}$$"
166 + save_mktempdir_umask=`umask`
168 + $mkdir "$my_tmpdir"
169 + umask $save_mktempdir_umask
172 + # If we're not in dry-run mode, bomb out on failure
173 + test -d "$my_tmpdir" || {
174 + $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
179 + $echo "X$my_tmpdir" | $Xsed
183 +# func_win32_libid arg
184 +# return the library type of file 'arg'
186 +# Need a lot of goo to handle *both* DLLs and import libs
187 +# Has to be a shell function in order to 'eat' the argument
188 +# that is supplied when $file_magic_command is called.
191 + win32_libid_type="unknown"
192 + win32_fileres=`file -L $1 2>/dev/null`
193 + case $win32_fileres in
194 + *ar\ archive\ import\ library*) # definitely import
195 + win32_libid_type="x86 archive import"
197 + *ar\ archive*) # could be an import, or static
198 + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
199 + $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
200 + win32_nmres=`eval $NM -f posix -A $1 | \
201 + $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
202 + case $win32_nmres in
203 + import*) win32_libid_type="x86 archive import";;
204 + *) win32_libid_type="x86 archive static";;
209 + win32_libid_type="x86 DLL"
211 + *executable*) # but shell scripts are "executable" too...
212 + case $win32_fileres in
213 + *MS\ Windows\ PE\ Intel*)
214 + win32_libid_type="x86 DLL"
219 + $echo $win32_libid_type
223 +# func_infer_tag arg
224 +# Infer tagged configuration to use if any are available and
225 +# if one wasn't chosen via the "--tag" command line option.
226 +# Only attempt this if the compiler in the base compile
227 +# command doesn't match the default compiler.
228 +# arg is usually of the form 'gcc ...'
231 + if test -n "$available_tags" && test -z "$tagname"; then
235 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
239 + CC_quoted="$CC_quoted $arg"
242 + # Blanks in the command may have been stripped by the calling shell,
243 + # but not from the CC environment variable when configure was run.
244 + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
245 + # Blanks at the start of $base_compile will cause this to fail
246 + # if we don't check for them as well.
248 + for z in $available_tags; do
249 + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
250 + # Evaluate the configuration.
251 + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
254 + # Double-quote args containing other shell metacharacters.
256 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
260 + CC_quoted="$CC_quoted $arg"
263 + " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
264 + # The compiler in the base compile command matches
265 + # the one in the tagged configuration.
266 + # Assume this is the tagged configuration we want.
273 + # If $tagname still isn't set, then no tagged configuration
274 + # was found and let the user know that the "--tag" command
275 + # line option must be used.
276 + if test -z "$tagname"; then
277 + $echo "$modename: unable to infer tagged configuration"
278 + $echo "$modename: specify a tag with \`--tag'" 1>&2
281 +# $echo "$modename: using $tagname tagged configuration"
289 +# func_extract_an_archive dir oldlib
290 +func_extract_an_archive ()
292 + f_ex_an_ar_dir="$1"; shift
293 + f_ex_an_ar_oldlib="$1"
295 + $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
296 + $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
297 + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
300 + $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
305 +# func_extract_archives gentop oldlib ...
306 +func_extract_archives ()
308 + my_gentop="$1"; shift
309 + my_oldlibs=${1+"$@"}
316 + $show "${rm}r $my_gentop"
317 + $run ${rm}r "$my_gentop"
318 + $show "$mkdir $my_gentop"
319 + $run $mkdir "$my_gentop"
321 + if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
325 + for my_xlib in $my_oldlibs; do
326 + # Extract the objects.
328 + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
329 + *) my_xabs=`pwd`"/$my_xlib" ;;
331 + my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
332 + my_xdir="$my_gentop/$my_xlib"
334 + $show "${rm}r $my_xdir"
335 + $run ${rm}r "$my_xdir"
336 + $show "$mkdir $my_xdir"
337 + $run $mkdir "$my_xdir"
339 + if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
344 + $show "Extracting $my_xabs"
345 + # Do not bother doing anything if just a dry run
346 + if test -z "$run"; then
347 + darwin_orig_dir=`pwd`
348 + cd $my_xdir || exit $?
349 + darwin_archive=$my_xabs
350 + darwin_curdir=`pwd`
351 + darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
352 + darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
353 + if test -n "$darwin_arches"; then
354 + darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
356 + $show "$darwin_base_archive has multiple architectures $darwin_arches"
357 + for darwin_arch in $darwin_arches ; do
358 + mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359 + lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
360 + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
361 + func_extract_an_archive "`pwd`" "${darwin_base_archive}"
362 + cd "$darwin_curdir"
363 + $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
364 + done # $darwin_arches
365 + ## Okay now we have a bunch of thin objects, gotta fatten them up :)
366 + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
369 + for darwin_file in $darwin_filelist; do
370 + darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
371 + lipo -create -output "$darwin_file" $darwin_files
372 + done # $darwin_filelist
374 + cd "$darwin_orig_dir"
376 + cd "$darwin_orig_dir"
377 + func_extract_an_archive "$my_xdir" "$my_xabs"
378 + fi # $darwin_arches
382 + func_extract_an_archive "$my_xdir" "$my_xabs"
385 + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
387 + func_extract_archives_result="$my_oldobjs"
389 +# End of Shell function definitions
390 +#####################################
393 +eval std_shrext=\"$shrext_cmds\"
397 # Parse our command line options once, thoroughly.
399 +while test "$#" -gt 0
405 execute_dlfiles="$execute_dlfiles $arg"
409 + preserve_args="${preserve_args}=$arg"
411 + # Check whether tagname contains only valid characters
413 + *[!-_A-Za-z0-9,/]*)
414 + $echo "$progname: invalid tag name: $tagname" 1>&2
421 + # Don't test for the "default" C tag, as we know, it's there, but
422 + # not specially marked.
425 + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
426 + taglist="$taglist $tagname"
427 + # Evaluate the configuration.
428 + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
430 + $echo "$progname: ignoring unknown tag $tagname" 1>&2
438 @@ -139,18 +454,27 @@
442 - echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
444 + $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
446 + $echo "Copyright (C) 2005 Free Software Foundation, Inc."
447 + $echo "This is free software; see the source for copying conditions. There is NO"
448 + $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
453 - sed -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
455 + ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
456 + # Now print the configurations for the tags.
457 + for tagname in $taglist; do
458 + ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
464 - echo "$progname: enabling shell trace mode"
465 + $echo "$progname: enabling shell trace mode"
467 + preserve_args="$preserve_args $arg"
471 @@ -158,18 +482,18 @@
476 + $echo "host: $host"
477 if test "$build_libtool_libs" = yes; then
478 - echo "enable shared libraries"
479 + $echo "enable shared libraries"
481 - echo "disable shared libraries"
482 + $echo "disable shared libraries"
484 if test "$build_old_libs" = yes; then
485 - echo "enable static libraries"
486 + $echo "enable static libraries"
488 - echo "disable static libraries"
489 + $echo "disable static libraries"
495 --finish) mode="finish" ;;
497 --mode) prevopt="--mode" prev=mode ;;
498 --mode=*) mode="$optarg" ;;
500 + --preserve-dup-deps) duplicate_deps="yes" ;;
504 + preserve_args="$preserve_args $arg"
510 + preserve_args="$preserve_args --tag"
513 + set tag "$optarg" ${1+"$@"}
516 + preserve_args="$preserve_args --tag"
522 $echo "$modename: unrecognized option \`$arg'" 1>&2
530 if test -n "$prevopt"; then
531 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
537 +case $disable_libs in
541 + build_libtool_libs=no
545 + build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
549 # If this variable is set in any of the actions, the command in it
550 # will be execed at the end. This prevents here-documents from being
551 # left over by shells.
554 # Infer the operation mode.
555 if test -z "$mode"; then
556 + $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
557 + $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
559 - *cc | *++ | gcc* | *-gcc*)
560 + *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
565 if test -n "$execute_dlfiles" && test "$mode" != execute; then
566 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
572 # Change the help message to a mode-specific one.
573 @@ -270,158 +623,127 @@
574 modename="$modename: compile"
575 # Get the compilation command and the source file.
580 + srcfile="$nonopt" # always keep a non-empty value in "srcfile"
593 - # Aesthetically quote the previous argument.
595 - lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
598 - # Double-quote args containing other shell metacharacters.
599 - # Many Bourne shells cannot handle close brackets correctly
600 - # in scan sets, so we specify it separately.
601 - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
606 - # Add the previous argument to base_compile.
607 - if test -z "$base_compile"; then
608 - base_compile="$lastarg"
610 - base_compile="$base_compile $lastarg"
616 - # Accept any command-line options.
619 - if test "$user_target" != "no"; then
620 - $echo "$modename: you cannot specify \`-o' more than once" 1>&2
626 + # do not "continue". Instead, add this to base_compile
644 + # Accept any command-line options.
647 + if test -n "$libobj" ; then
648 + $echo "$modename: you cannot specify \`-o' more than once" 1>&2
659 + -static | -prefer-pic | -prefer-non-pic)
660 + later="$later $arg"
674 - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
676 - save_ifs="$IFS"; IFS=','
677 - for arg in $args; do
680 + arg_mode=arg # the next one goes into the "base_compile" arg list
681 + continue # The current "srcfile" will either be retained or
682 + ;; # replaced later. I would guess that would be a bug.
685 + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
687 + save_ifs="$IFS"; IFS=','
688 + for arg in $args; do
691 - # Double-quote args containing other shell metacharacters.
692 - # Many Bourne shells cannot handle close brackets correctly
693 - # in scan sets, so we specify it separately.
695 - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
699 - lastarg="$lastarg $arg"
702 - lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
703 + # Double-quote args containing other shell metacharacters.
704 + # Many Bourne shells cannot handle close brackets correctly
705 + # in scan sets, so we specify it separately.
707 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
711 + lastarg="$lastarg $arg"
714 + lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
716 - # Add the arguments to base_compile.
717 - if test -z "$base_compile"; then
718 - base_compile="$lastarg"
720 + # Add the arguments to base_compile.
721 base_compile="$base_compile $lastarg"
729 - case $user_target in
731 - # The next one is the -o target name
736 - # We got the output file
741 + # Accept the current argument as the source file.
742 + # The previous "srcfile" becomes the current argument.
751 - # Accept the current argument as the source file.
754 + esac # case $arg_mode
756 # Aesthetically quote the previous argument.
758 - # Backslashify any backslashes, double quotes, and dollar signs.
759 - # These are the only characters that are still specially
760 - # interpreted inside of double-quoted scrings.
761 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
764 # Double-quote args containing other shell metacharacters.
765 # Many Bourne shells cannot handle close brackets correctly
766 - # in scan sets, so we specify it separately.
768 + # in scan sets, and some SunOS ksh mistreat backslash-escaping
769 + # in scan sets (worked around with variable expansion),
770 + # and furthermore cannot handle '|' '&' '(' ')' in scan sets
771 + # at all, so we specify them separately.
772 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
773 lastarg="\"$lastarg\""
777 - # Add the previous argument to base_compile.
778 - if test -z "$base_compile"; then
779 - base_compile="$lastarg"
781 - base_compile="$base_compile $lastarg"
784 + base_compile="$base_compile $lastarg"
787 - case $user_target in
791 + $echo "$modename: you must specify an argument for -Xcompile"
795 - # Get the name of the library object.
796 - libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
798 + $echo "$modename: you must specify a target with \`-o'" 1>&2
802 - $echo "$modename: you must specify a target with \`-o'" 1>&2
804 + # Get the name of the library object.
805 + [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
809 # Recognize several different file suffixes.
810 # If the user specifies -o file.o, it is replaced with file.lo
812 + xform='[cCFSifmso]'
816 @@ -429,10 +751,13 @@
821 + *.class) xform=class ;;
826 + *.java) xform=java ;;
829 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
830 @@ -441,25 +766,63 @@
831 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
833 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
839 + func_infer_tag $base_compile
841 + for arg in $later; do
860 + qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
862 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
863 + qlibobj="\"$qlibobj\"" ;;
865 + test "X$libobj" != "X$qlibobj" \
866 + && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
867 + && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
868 + objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
869 + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
870 + if test "X$xdir" = "X$obj"; then
875 + lobj=${xdir}$objdir/$objname
877 if test -z "$base_compile"; then
878 $echo "$modename: you must specify a compilation command" 1>&2
884 # Delete any leftover library objects.
885 if test "$build_old_libs" = yes; then
886 - removelist="$obj $libobj"
887 + removelist="$obj $lobj $libobj ${libobj}T"
889 - removelist="$libobj"
890 + removelist="$lobj $libobj ${libobj}T"
894 - trap "$run $rm $removelist; exit 1" 1 2 15
895 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
897 # On Cygwin there's no "real" PIC flag so we must build both object types
903 - if test $pic_mode = no && test "$deplibs_check_method" != pass_all; then
904 + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
905 # non-PIC code in shared libraries is not supported
909 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
910 lockfile="$output_obj.lock"
911 removelist="$removelist $output_obj $lockfile"
912 - trap "$run $rm $removelist; exit 1" 1 2 15
913 + trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
919 @@ -487,13 +851,13 @@
920 # Lock this critical section if it is needed
921 # We use this script file to make the link, it avoids creating a new file
922 if test "$need_locks" = yes; then
923 - until $run ln "$0" "$lockfile" 2>/dev/null; do
924 + until $run ln "$progpath" "$lockfile" 2>/dev/null; do
925 $show "Waiting for $lockfile to be removed"
928 elif test "$need_locks" = warn; then
929 if test -f "$lockfile"; then
932 *** ERROR, $lockfile exists and contains:
933 `cat $lockfile 2>/dev/null`
935 @@ -505,14 +869,33 @@
942 - echo $srcfile > "$lockfile"
943 + $echo "$srcfile" > "$lockfile"
946 if test -n "$fix_srcfile_path"; then
947 eval srcfile=\"$fix_srcfile_path\"
949 + qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
951 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
952 + qsrcfile="\"$qsrcfile\"" ;;
955 + $run $rm "$libobj" "${libobj}T"
957 + # Create a libtool object file (analogous to a ".la" file),
958 + # but don't create it if we're doing a dry run.
959 + test -z "$run" && cat > ${libobj}T <<EOF
960 +# $libobj - a libtool object file
961 +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
963 +# Please DO NOT delete this file!
964 +# It is necessary for linking the library.
966 +# Name of the PIC object.
969 # Only build a PIC object if we are building libtool libraries.
970 if test "$build_libtool_libs" = yes; then
971 @@ -520,53 +903,38 @@
972 fbsd_hideous_sh_bug=$base_compile
974 if test "$pic_mode" != no; then
975 - # All platforms use -DPIC, to notify preprocessed assembler code.
976 - command="$base_compile $srcfile $pic_flag -DPIC"
977 + command="$base_compile $qsrcfile $pic_flag"
979 # Don't build PIC code
980 - command="$base_compile $srcfile"
981 + command="$base_compile $qsrcfile"
983 - if test "$build_old_libs" = yes; then
984 - lo_libobj="$libobj"
985 - dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
986 - if test "X$dir" = "X$libobj"; then
991 - libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
993 - if test -d "$dir"; then
994 - $show "$rm $libobj"
997 - $show "$mkdir $dir"
1000 - if test $status -ne 0 && test ! -d $dir; then
1003 + if test ! -d "${xdir}$objdir"; then
1004 + $show "$mkdir ${xdir}$objdir"
1005 + $run $mkdir ${xdir}$objdir
1007 + if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
1011 - if test "$compiler_o_lo" = yes; then
1012 - output_obj="$libobj"
1013 - command="$command -o $output_obj"
1014 - elif test "$compiler_c_o" = yes; then
1016 - command="$command -o $output_obj"
1018 + if test -z "$output_obj"; then
1019 + # Place PIC objects in $objdir
1020 + command="$command -o $lobj"
1023 - $run $rm "$output_obj"
1024 + $run $rm "$lobj" "$output_obj"
1027 if $run eval "$command"; then :
1029 test -n "$output_obj" && $run $rm $removelist
1031 + exit $EXIT_FAILURE
1034 if test "$need_locks" = warn &&
1035 - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
1037 + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1039 *** ERROR, $lockfile contains:
1040 `cat $lockfile 2>/dev/null`
1042 @@ -581,13 +949,13 @@
1045 $run $rm $removelist
1047 + exit $EXIT_FAILURE
1050 # Just move the object if needed, then go on to compile the next one
1051 - if test x"$output_obj" != x"$libobj"; then
1052 - $show "$mv $output_obj $libobj"
1053 - if $run $mv $output_obj $libobj; then :
1054 + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1055 + $show "$mv $output_obj $lobj"
1056 + if $run $mv $output_obj $lobj; then :
1059 $run $rm $removelist
1060 @@ -595,77 +963,50 @@
1064 - # If we have no pic_flag, then copy the object into place and finish.
1065 - if (test -z "$pic_flag" || test "$pic_mode" != default) &&
1066 - test "$build_old_libs" = yes; then
1067 - # Rename the .lo from within objdir to obj
1068 - if test -f $obj; then
1072 + # Append the name of the PIC object to the libtool object file.
1073 + test -z "$run" && cat >> ${libobj}T <<EOF
1074 +pic_object='$objdir/$objname'
1076 - $show "$mv $libobj $obj"
1077 - if $run $mv $libobj $obj; then :
1080 - $run $rm $removelist
1085 - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
1086 - if test "X$xdir" = "X$obj"; then
1091 - baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
1092 - libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
1093 - # Now arrange that obj and lo_libobj become the same file
1094 - $show "(cd $xdir && $LN_S $baseobj $libobj)"
1095 - if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
1096 - # Unlock the critical section if it was locked
1097 - if test "$need_locks" != no; then
1098 - $run $rm "$lockfile"
1103 - $run $rm $removelist
1106 + # Allow error messages only from the first compilation.
1107 + if test "$suppress_opt" = yes; then
1108 + suppress_output=' >/dev/null 2>&1'
1111 + # No PIC object so indicate it doesn't exist in the libtool
1113 + test -z "$run" && cat >> ${libobj}T <<EOF
1116 - # Allow error messages only from the first compilation.
1117 - suppress_output=' >/dev/null 2>&1'
1121 # Only build a position-dependent object if we build old libraries.
1122 if test "$build_old_libs" = yes; then
1123 if test "$pic_mode" != yes; then
1124 # Don't build PIC code
1125 - command="$base_compile $srcfile"
1126 + command="$base_compile $qsrcfile"
1128 - # All platforms use -DPIC, to notify preprocessed assembler code.
1129 - command="$base_compile $srcfile $pic_flag -DPIC"
1130 + command="$base_compile $qsrcfile $pic_flag"
1132 if test "$compiler_c_o" = yes; then
1133 command="$command -o $obj"
1137 # Suppress compiler output if we already did a PIC compilation.
1138 command="$command$suppress_output"
1139 - $run $rm "$output_obj"
1140 + $run $rm "$obj" "$output_obj"
1142 if $run eval "$command"; then :
1144 $run $rm $removelist
1146 + exit $EXIT_FAILURE
1149 if test "$need_locks" = warn &&
1150 - test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
1152 + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1154 *** ERROR, $lockfile contains:
1155 `cat $lockfile 2>/dev/null`
1157 @@ -680,11 +1021,11 @@
1160 $run $rm $removelist
1162 + exit $EXIT_FAILURE
1165 # Just move the object if needed
1166 - if test x"$output_obj" != x"$obj"; then
1167 + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1168 $show "$mv $output_obj $obj"
1169 if $run $mv $output_obj $obj; then :
1171 @@ -694,29 +1035,31 @@
1175 - # Create an invalid libtool object if no PIC, so that we do not
1176 - # accidentally link it into a program.
1177 - if test "$build_libtool_libs" != yes; then
1178 - $show "echo timestamp > $libobj"
1179 - $run eval "echo timestamp > \$libobj" || exit $?
1181 - # Move the .lo from within objdir
1182 - $show "$mv $libobj $lo_libobj"
1183 - if $run $mv $libobj $lo_libobj; then :
1186 - $run $rm $removelist
1190 + # Append the name of the non-PIC object the libtool object file.
1191 + # Only append if the libtool object file exists.
1192 + test -z "$run" && cat >> ${libobj}T <<EOF
1193 +# Name of the non-PIC object.
1194 +non_pic_object='$objname'
1198 + # Append the name of the non-PIC object the libtool object file.
1199 + # Only append if the libtool object file exists.
1200 + test -z "$run" && cat >> ${libobj}T <<EOF
1201 +# Name of the non-PIC object.
1202 +non_pic_object=none
1207 + $run $mv "${libobj}T" "${libobj}"
1209 # Unlock the critical section if it was locked
1210 if test "$need_locks" != no; then
1211 $run $rm "$lockfile"
1215 + exit $EXIT_SUCCESS
1219 @@ -727,7 +1070,7 @@
1220 # It is impossible to link a dll without this setting, and
1221 # we shouldn't force the makefile maintainer to figure out
1222 # which system we are compiling for in order to pass an extra
1223 - # flag for every libtool invokation.
1224 + # flag for every libtool invocation.
1225 # allow_undefined=no
1227 # FIXME: Unfortunately, there are problems with the above when trying
1228 @@ -742,6 +1085,7 @@
1231 libtool_args="$nonopt"
1232 + base_compile="$nonopt $@"
1233 compile_command="$nonopt"
1234 finalize_command="$nonopt"
1236 @@ -757,6 +1101,7 @@
1239 lib_search_path=`pwd`
1244 @@ -771,6 +1116,9 @@
1249 + notinst_path= # paths that contain not-installed libtool libraries
1250 + precious_files_regex=
1251 prefer_static_libs=no
1254 @@ -782,6 +1130,9 @@
1260 + func_infer_tag $base_compile
1262 # We need to know -static, to get the right output filenames.
1264 @@ -795,14 +1146,15 @@
1265 if test -n "$link_static_flag"; then
1266 dlopen_self=$dlopen_self_static
1268 + prefer_static_libs=yes
1270 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1271 dlopen_self=$dlopen_self_static
1273 + prefer_static_libs=built
1275 build_libtool_libs=no
1277 - prefer_static_libs=yes
1281 @@ -812,7 +1164,7 @@
1282 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1284 # Go through the arguments, transforming them on the way.
1285 - while test $# -gt 0; do
1286 + while test "$#" -gt 0; do
1290 @@ -877,7 +1229,7 @@
1291 export_symbols="$arg"
1292 if test ! -f "$arg"; then
1293 $echo "$modename: symbol file \`$arg' does not exist"
1295 + exit $EXIT_FAILURE
1299 @@ -887,18 +1239,140 @@
1304 + inst_prefix_dir="$arg"
1309 + precious_files_regex="$arg"
1319 + if test -f "$arg"; then
1322 + for fil in `cat $save_arg`
1324 +# moreargs="$moreargs $fil"
1326 + # A libtool-controlled object.
1328 + # Check to see that this really is a libtool object.
1329 + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1333 + # Read the .lo file
1334 + # If there is no directory component, then add one.
1336 + */* | *\\*) . $arg ;;
1340 + if test -z "$pic_object" || \
1341 + test -z "$non_pic_object" ||
1342 + test "$pic_object" = none && \
1343 + test "$non_pic_object" = none; then
1344 + $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1345 + exit $EXIT_FAILURE
1348 + # Extract subdirectory from the argument.
1349 + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1350 + if test "X$xdir" = "X$arg"; then
1356 + if test "$pic_object" != none; then
1357 + # Prepend the subdirectory the object is found in.
1358 + pic_object="$xdir$pic_object"
1360 + if test "$prev" = dlfiles; then
1361 + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1362 + dlfiles="$dlfiles $pic_object"
1366 + # If libtool objects are unsupported, then we need to preload.
1371 + # CHECK ME: I think I busted this. -Ossama
1372 + if test "$prev" = dlprefiles; then
1373 + # Preload the old-style object.
1374 + dlprefiles="$dlprefiles $pic_object"
1379 + libobjs="$libobjs $pic_object"
1384 + if test "$non_pic_object" != none; then
1385 + # Prepend the subdirectory the object is found in.
1386 + non_pic_object="$xdir$non_pic_object"
1388 + # A standard non-PIC object
1389 + non_pic_objects="$non_pic_objects $non_pic_object"
1390 + if test -z "$pic_object" || test "$pic_object" = none ; then
1391 + arg="$non_pic_object"
1394 + # If the PIC object exists, use it instead.
1395 + # $xdir was prepended to $pic_object above.
1396 + non_pic_object="$pic_object"
1397 + non_pic_objects="$non_pic_objects $non_pic_object"
1400 + # Only an error if not doing a dry-run.
1401 + if test -z "$run"; then
1402 + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1403 + exit $EXIT_FAILURE
1407 + # Extract subdirectory from the argument.
1408 + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1409 + if test "X$xdir" = "X$arg"; then
1415 + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1416 + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1417 + libobjs="$libobjs $pic_object"
1418 + non_pic_objects="$non_pic_objects $non_pic_object"
1423 + $echo "$modename: link input file \`$save_arg' does not exist"
1424 + exit $EXIT_FAILURE
1431 # We need an absolute path.
1433 [\\/]* | [A-Za-z]:[\\/]*) ;;
1435 $echo "$modename: only absolute run-paths are allowed" 1>&2
1437 + exit $EXIT_FAILURE
1440 if test "$prev" = rpath; then
1441 @@ -930,13 +1404,33 @@
1442 finalize_command="$finalize_command $wl$qarg"
1446 + linker_flags="$linker_flags $qarg"
1447 + compiler_flags="$compiler_flags $qarg"
1449 + compile_command="$compile_command $qarg"
1450 + finalize_command="$finalize_command $qarg"
1454 + shrext_cmds="$arg"
1458 + darwin_framework|darwin_framework_skip)
1459 + test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1460 + compile_command="$compile_command $arg"
1461 + finalize_command="$finalize_command $arg"
1466 eval "$prev=\"\$arg\""
1471 - fi # test -n $prev
1472 + fi # test -n "$prev"
1476 @@ -978,7 +1472,7 @@
1477 -export-symbols | -export-symbols-regex)
1478 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1479 $echo "$modename: more than one -exported-symbols argument is not allowed"
1481 + exit $EXIT_FAILURE
1483 if test "X$arg" = "X-export-symbols"; then
1485 @@ -988,11 +1482,28 @@
1489 + -framework|-arch|-isysroot)
1491 + *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1492 + prev=darwin_framework_skip ;;
1493 + *) compiler_flags="$compiler_flags $arg"
1494 + prev=darwin_framework ;;
1496 + compile_command="$compile_command $arg"
1497 + finalize_command="$finalize_command $arg"
1506 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1507 # so, if we see these flags be careful not to treat them like -L
1509 case $with_gcc/$host in
1511 + no/*-*-irix* | /*-*-irix*)
1512 compile_command="$compile_command $arg"
1513 finalize_command="$finalize_command $arg"
1515 @@ -1009,7 +1520,8 @@
1516 absdir=`cd "$dir" && pwd`
1517 if test -z "$absdir"; then
1518 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1521 + notinst_path="$notinst_path $dir"
1525 @@ -1023,10 +1535,15 @@
1528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1529 + testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1530 case :$dllsearchpath: in
1532 *) dllsearchpath="$dllsearchpath:$dir";;
1534 + case :$dllsearchpath: in
1535 + *":$testbindir:"*) ;;
1536 + *) dllsearchpath="$dllsearchpath:$testbindir";;
1541 @@ -1035,36 +1552,98 @@
1543 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1545 - *-*-cygwin* | *-*-pw32* | *-*-beos*)
1546 + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1547 # These systems don't actually have a C or math library (as such)
1550 - *-*-mingw* | *-*-os2*)
1552 # These systems don't actually have a C library (as such)
1553 test "X$arg" = "X-lc" && continue
1556 + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1557 # Do not include libc due to us having libc/libc_r.
1558 test "X$arg" = "X-lc" && continue
1561 - elif test "X$arg" = "X-lc_r"; then
1564 - # Do not include libc_r directly, use -pthread flag.
1565 + *-*-rhapsody* | *-*-darwin1.[012])
1566 + # Rhapsody C and math libraries are in the System framework
1567 + deplibs="$deplibs -framework System"
1570 + *-*-sco3.2v5* | *-*-sco5v6*)
1571 + # Causes problems with __ctype
1572 + test "X$arg" = "X-lc" && continue
1574 + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1575 + # Compiler inserts libc in the correct place for threads to work
1576 + test "X$arg" = "X-lc" && continue
1579 + elif test "X$arg" = "X-lc_r"; then
1581 + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1582 + # Do not include libc_r directly, use -pthread flag.
1587 deplibs="$deplibs $arg"
1591 + # Tru64 UNIX uses -model [arg] to determine the layout of C++
1592 + # classes, name mangling, and exception handling.
1594 + compile_command="$compile_command $arg"
1595 + compiler_flags="$compiler_flags $arg"
1596 + finalize_command="$finalize_command $arg"
1601 + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1602 + compiler_flags="$compiler_flags $arg"
1603 + compile_command="$compile_command $arg"
1604 + finalize_command="$finalize_command $arg"
1613 + # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1614 + # -r[0-9][0-9]* specifies the processor on the SGI compiler
1615 + # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1616 + # +DA*, +DD* enable 64-bit mode on the HP compiler
1617 + # -q* pass through compiler args for the IBM compiler
1618 + # -m* pass through architecture-specific compiler args for GCC
1619 + # -m*, -t[45]*, -txscale* pass through architecture-specific
1620 + # compiler args for GCC
1621 + # -pg pass through profiling flag for GCC
1622 + # @file GCC response files
1623 + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1624 + -t[45]*|-txscale*|@*)
1626 + # Unknown arguments in both finalize_command and compile_command need
1627 + # to be aesthetically quoted because they are evaled later.
1628 + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1630 + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1634 + compile_command="$compile_command $arg"
1635 + finalize_command="$finalize_command $arg"
1636 + compiler_flags="$compiler_flags $arg"
1648 @@ -1089,8 +1668,18 @@
1659 + -precious-files-regex)
1660 + prev=precious_regex
1667 @@ -1113,7 +1702,7 @@
1668 [\\/]* | [A-Za-z]:[\\/]*) ;;
1670 $echo "$modename: only absolute run-paths are allowed" 1>&2
1672 + exit $EXIT_FAILURE
1676 @@ -1141,6 +1730,11 @@
1687 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1688 @@ -1189,6 +1783,11 @@
1697 # Some other compiler flag.
1699 # Unknown arguments in both finalize_command and compile_command need
1700 @@ -1201,29 +1800,106 @@
1705 - # A library or standard object.
1706 - if test "$prev" = dlfiles; then
1707 - # This file was specified with -dlopen.
1708 - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1709 - dlfiles="$dlfiles $arg"
1713 - # If libtool objects are unsupported, then we need to preload.
1718 + # A standard object.
1722 - if test "$prev" = dlprefiles; then
1723 - # Preload the old-style object.
1724 - dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1728 + # A libtool-controlled object.
1730 + # Check to see that this really is a libtool object.
1731 + if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1735 + # Read the .lo file
1736 + # If there is no directory component, then add one.
1738 - *.lo) libobjs="$libobjs $arg" ;;
1739 - *) objs="$objs $arg" ;;
1740 + */* | *\\*) . $arg ;;
1744 + if test -z "$pic_object" || \
1745 + test -z "$non_pic_object" ||
1746 + test "$pic_object" = none && \
1747 + test "$non_pic_object" = none; then
1748 + $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1749 + exit $EXIT_FAILURE
1752 + # Extract subdirectory from the argument.
1753 + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1754 + if test "X$xdir" = "X$arg"; then
1760 + if test "$pic_object" != none; then
1761 + # Prepend the subdirectory the object is found in.
1762 + pic_object="$xdir$pic_object"
1764 + if test "$prev" = dlfiles; then
1765 + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1766 + dlfiles="$dlfiles $pic_object"
1770 + # If libtool objects are unsupported, then we need to preload.
1775 + # CHECK ME: I think I busted this. -Ossama
1776 + if test "$prev" = dlprefiles; then
1777 + # Preload the old-style object.
1778 + dlprefiles="$dlprefiles $pic_object"
1783 + libobjs="$libobjs $pic_object"
1788 + if test "$non_pic_object" != none; then
1789 + # Prepend the subdirectory the object is found in.
1790 + non_pic_object="$xdir$non_pic_object"
1792 + # A standard non-PIC object
1793 + non_pic_objects="$non_pic_objects $non_pic_object"
1794 + if test -z "$pic_object" || test "$pic_object" = none ; then
1795 + arg="$non_pic_object"
1798 + # If the PIC object exists, use it instead.
1799 + # $xdir was prepended to $pic_object above.
1800 + non_pic_object="$pic_object"
1801 + non_pic_objects="$non_pic_objects $non_pic_object"
1804 + # Only an error if not doing a dry-run.
1805 + if test -z "$run"; then
1806 + $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1807 + exit $EXIT_FAILURE
1811 + # Extract subdirectory from the argument.
1812 + xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1813 + if test "X$xdir" = "X$arg"; then
1819 + pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1820 + non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1821 + libobjs="$libobjs $pic_object"
1822 + non_pic_objects="$non_pic_objects $non_pic_object"
1827 @@ -1274,7 +1950,7 @@
1828 if test -n "$prev"; then
1829 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1832 + exit $EXIT_FAILURE
1835 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1836 @@ -1283,6 +1959,7 @@
1837 finalize_command="$finalize_command $arg"
1841 # calculate the name of the file, without its directory
1842 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1843 libobjs_save="$libobjs"
1844 @@ -1303,12 +1980,12 @@
1845 output_objdir="$output_objdir/$objdir"
1847 # Create the object directory.
1848 - if test ! -d $output_objdir; then
1849 + if test ! -d "$output_objdir"; then
1850 $show "$mkdir $output_objdir"
1851 $run $mkdir $output_objdir
1853 - if test $status -ne 0 && test ! -d $output_objdir; then
1856 + if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1861 @@ -1317,7 +1994,7 @@
1863 $echo "$modename: you must specify an output file" 1>&2
1866 + exit $EXIT_FAILURE
1868 *.$libext) linkmode=oldlib ;;
1869 *.lo | *.$objext) linkmode=obj ;;
1870 @@ -1325,22 +2002,52 @@
1871 *) linkmode=prog ;; # Anything else should be a program.
1875 + *cygwin* | *mingw* | *pw32*)
1876 + # don't eliminate duplications in $postdeps and $predeps
1877 + duplicate_compiler_generated_deps=yes
1880 + duplicate_compiler_generated_deps=$duplicate_deps
1886 # Find all interdependent deplibs by searching for libraries
1887 # that are linked more than once (e.g. -la -lb -la)
1888 for deplib in $deplibs; do
1890 - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1892 + if test "X$duplicate_deps" = "Xyes" ; then
1894 + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1897 libs="$libs $deplib"
1900 + if test "$linkmode" = lib; then
1901 + libs="$predeps $libs $compiler_lib_search_path $postdeps"
1903 + # Compute libraries that are listed more than once in $predeps
1904 + # $postdeps and mark them as special (i.e., whose duplicates are
1905 + # not to be eliminated).
1907 + if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1908 + for pre_post_dep in $predeps $postdeps; do
1909 + case "$pre_post_deps " in
1910 + *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1912 + pre_post_deps="$pre_post_deps $pre_post_dep"
1921 need_relink=no # whether we're linking any uninstalled libtool libraries
1922 notinst_deplibs= # not-installed libtool libraries
1923 - notinst_path= # paths that contain not-installed libtool libraries
1927 @@ -1349,7 +2056,7 @@
1930 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1932 + exit $EXIT_FAILURE
1936 @@ -1366,39 +2073,58 @@
1939 for pass in $passes; do
1940 - if test $linkmode = prog; then
1941 - # Determine which files to process
1942 + if test "$linkmode,$pass" = "lib,link" ||
1943 + test "$linkmode,$pass" = "prog,scan"; then
1947 + if test "$linkmode" = prog; then
1951 - save_deplibs="$deplibs" # Collect dlpreopened libraries
1954 + dlopen) libs="$dlfiles" ;;
1955 dlpreopen) libs="$dlprefiles" ;;
1956 - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1958 + libs="$deplibs %DEPLIBS%"
1959 + test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
1963 + if test "$pass" = dlopen; then
1964 + # Collect dlpreopened libraries
1965 + save_deplibs="$deplibs"
1968 for deplib in $libs; do
1973 - if test $linkmode = oldlib && test $linkmode = obj; then
1974 - $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1976 + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1977 + if test "$linkmode,$pass" = "prog,link"; then
1978 + compile_deplibs="$deplib $compile_deplibs"
1979 + finalize_deplibs="$deplib $finalize_deplibs"
1981 + compiler_flags="$compiler_flags $deplib"
1983 - if test $pass = conv; then
1984 - deplibs="$deplib $deplibs"
1988 + if test "$linkmode" != lib && test "$linkmode" != prog; then
1989 + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1992 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1993 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1994 - # Search the libtool library
1995 - lib="$searchdir/lib${name}.la"
1996 - if test -f "$lib"; then
2000 + for search_ext in .la $std_shrext .so .a; do
2001 + # Search the libtool library
2002 + lib="$searchdir/lib${name}${search_ext}"
2003 + if test -f "$lib"; then
2004 + if test "$search_ext" = ".la"; then
2013 if test "$found" != yes; then
2014 # deplib doesn't seem to be a libtool library
2015 @@ -1407,40 +2133,76 @@
2016 finalize_deplibs="$deplib $finalize_deplibs"
2018 deplibs="$deplib $deplibs"
2019 - test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
2020 + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2023 + else # deplib is a libtool library
2024 + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2025 + # We need to do some special things here, and not later.
2026 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2027 + case " $predeps $postdeps " in
2029 + if (${SED} -e '2q' $lib |
2030 + grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2034 + */* | *\\*) . $lib ;;
2037 + for l in $old_library $library_names; do
2040 + if test "X$ll" = "X$old_library" ; then # only static version available
2042 + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2043 + test "X$ladir" = "X$lib" && ladir="."
2044 + lib=$ladir/$old_library
2045 + if test "$linkmode,$pass" = "prog,link"; then
2046 + compile_deplibs="$deplib $compile_deplibs"
2047 + finalize_deplibs="$deplib $finalize_deplibs"
2049 + deplibs="$deplib $deplibs"
2050 + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2064 deplibs="$deplib $deplibs"
2065 - test $pass = conv && continue
2066 + test "$pass" = conv && continue
2067 newdependency_libs="$deplib $newdependency_libs"
2068 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2071 - if test $pass = conv; then
2072 + if test "$pass" = conv; then
2073 deplibs="$deplib $deplibs"
2076 - if test $pass = scan; then
2077 + if test "$pass" = scan; then
2078 deplibs="$deplib $deplibs"
2079 - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2081 compile_deplibs="$deplib $compile_deplibs"
2082 finalize_deplibs="$deplib $finalize_deplibs"
2084 + newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2087 - $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
2088 + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2094 - if test $pass = link; then
2095 + if test "$pass" = link; then
2096 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2097 # Make sure the xrpath contains only unique directories.
2099 @@ -1453,28 +2215,45 @@
2101 *.la) lib="$deplib" ;;
2103 - if test $pass = conv; then
2104 + if test "$pass" = conv; then
2105 deplibs="$deplib $deplibs"
2110 - if test "$deplibs_check_method" != pass_all; then
2112 - echo "*** Warning: This library needs some functionality provided by $deplib."
2113 - echo "*** I have the capability to make that library automatically link in when"
2114 - echo "*** you link to this library. But I can only do this if you have a"
2115 - echo "*** shared version of the library, which you do not appear to have."
2117 + case $deplibs_check_method in
2119 + set dummy $deplibs_check_method
2120 + match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2121 + if eval $echo \"$deplib\" 2>/dev/null \
2123 + | $EGREP "$match_pattern_regex" > /dev/null; then
2131 + if test "$valid_a_lib" != yes; then
2133 + $echo "*** Warning: Trying to link with static lib archive $deplib."
2134 + $echo "*** I have the capability to make that library automatically link in when"
2135 + $echo "*** you link to this library. But I can only do this if you have a"
2136 + $echo "*** shared version of the library, which you do not appear to have"
2137 + $echo "*** because the file extensions .$libext of this argument makes me believe"
2138 + $echo "*** that it is just a static archive that I should not used here."
2141 - echo "*** Warning: Linking the shared library $output against the"
2142 - echo "*** static library $deplib is not portable!"
2144 + $echo "*** Warning: Linking the shared library $output against the"
2145 + $echo "*** static library $deplib is not portable!"
2146 deplibs="$deplib $deplibs"
2151 - if test $pass != link; then
2152 + if test "$pass" != link; then
2153 deplibs="$deplib $deplibs"
2155 compile_deplibs="$deplib $compile_deplibs"
2156 @@ -1485,14 +2264,18 @@
2160 - if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2161 - # If there is no dlopen support or we're linking statically,
2162 - # we need to preload.
2163 - newdlprefiles="$newdlprefiles $deplib"
2164 - compile_deplibs="$deplib $compile_deplibs"
2165 - finalize_deplibs="$deplib $finalize_deplibs"
2167 - newdlfiles="$newdlfiles $deplib"
2168 + if test "$pass" = conv; then
2169 + deplibs="$deplib $deplibs"
2170 + elif test "$linkmode" = prog; then
2171 + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2172 + # If there is no dlopen support or we're linking statically,
2173 + # we need to preload.
2174 + newdlprefiles="$newdlprefiles $deplib"
2175 + compile_deplibs="$deplib $compile_deplibs"
2176 + finalize_deplibs="$deplib $finalize_deplibs"
2178 + newdlfiles="$newdlfiles $deplib"
2183 @@ -1501,17 +2284,17 @@
2187 - if test $found = yes || test -f "$lib"; then :
2188 + if test "$found" = yes || test -f "$lib"; then :
2190 - $echo "$modename: cannot find the library \`$lib'" 1>&2
2192 + $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2193 + exit $EXIT_FAILURE
2196 # Check to see that this really is a libtool archive.
2197 - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2198 + if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2200 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2202 + exit $EXIT_FAILURE
2205 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2206 @@ -1524,8 +2307,11 @@
2209 # If the library was installed with an old release of libtool,
2210 - # it will not redefine variable installed.
2211 + # it will not redefine variables installed, or shouldnotlink
2219 @@ -1535,19 +2321,18 @@
2221 if test "$linkmode,$pass" = "lib,link" ||
2222 test "$linkmode,$pass" = "prog,scan" ||
2223 - { test $linkmode = oldlib && test $linkmode = obj; }; then
2224 - # Add dl[pre]opened files of deplib
2225 + { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2226 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2227 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2230 - if test $pass = conv; then
2231 + if test "$pass" = conv; then
2232 # Only check for convenience libraries
2233 deplibs="$lib $deplibs"
2234 if test -z "$libdir"; then
2235 if test -z "$old_library"; then
2236 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2238 + exit $EXIT_FAILURE
2240 # It is a libtool convenience library, so add in its objects.
2241 convenience="$convenience $ladir/$objdir/$old_library"
2242 @@ -1555,18 +2340,21 @@
2244 for deplib in $dependency_libs; do
2245 deplibs="$deplib $deplibs"
2246 - case "$tmp_libs " in
2247 - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2249 + if test "X$duplicate_deps" = "Xyes" ; then
2250 + case "$tmp_libs " in
2251 + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2254 tmp_libs="$tmp_libs $deplib"
2256 - elif test $linkmode != prog && test $linkmode != lib; then
2257 + elif test "$linkmode" != prog && test "$linkmode" != lib; then
2258 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2260 + exit $EXIT_FAILURE
2266 # Get the name of the library we link against.
2268 for l in $old_library $library_names; do
2269 @@ -1574,19 +2362,23 @@
2271 if test -z "$linklib"; then
2272 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2274 + exit $EXIT_FAILURE
2277 # This library was specified with -dlopen.
2278 - if test $pass = dlopen; then
2279 + if test "$pass" = dlopen; then
2280 if test -z "$libdir"; then
2281 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2283 + exit $EXIT_FAILURE
2285 - if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2286 + if test -z "$dlname" ||
2287 + test "$dlopen_support" != yes ||
2288 + test "$build_libtool_libs" = no; then
2289 # If there is no dlname, no dlopen support or we're linking
2290 - # statically, we need to preload.
2291 - dlprefiles="$dlprefiles $lib"
2292 + # statically, we need to preload. We also need to preload any
2293 + # dependent libraries so libltdl's deplib preloader doesn't
2294 + # bomb out in the load deplibs phase.
2295 + dlprefiles="$dlprefiles $lib $dependency_libs"
2297 newdlfiles="$newdlfiles $lib"
2299 @@ -1618,19 +2410,27 @@
2303 + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2305 - dir="$ladir/$objdir"
2306 - absdir="$abs_ladir/$objdir"
2307 - # Remove this search path later
2308 - notinst_path="$notinst_path $abs_ladir"
2309 + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2311 + absdir="$abs_ladir"
2312 + # Remove this search path later
2313 + notinst_path="$notinst_path $abs_ladir"
2315 + dir="$ladir/$objdir"
2316 + absdir="$abs_ladir/$objdir"
2317 + # Remove this search path later
2318 + notinst_path="$notinst_path $abs_ladir"
2320 fi # $installed = yes
2321 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2323 # This library was specified with -dlpreopen.
2324 - if test $pass = dlpreopen; then
2325 + if test "$pass" = dlpreopen; then
2326 if test -z "$libdir"; then
2327 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2329 + exit $EXIT_FAILURE
2331 # Prefer using a static library (so that no silly _DYNAMIC symbols
2332 # are required to link).
2333 @@ -1646,18 +2446,19 @@
2335 if test -z "$libdir"; then
2336 # Link the convenience library
2337 - if test $linkmode = lib; then
2338 + if test "$linkmode" = lib; then
2339 deplibs="$dir/$old_library $deplibs"
2340 elif test "$linkmode,$pass" = "prog,link"; then
2341 compile_deplibs="$dir/$old_library $compile_deplibs"
2342 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2344 - deplibs="$lib $deplibs"
2345 + deplibs="$lib $deplibs" # used for prog,scan pass
2350 - if test $linkmode = prog && test $pass != link; then
2352 + if test "$linkmode" = prog && test "$pass" != link; then
2353 newlib_search_path="$newlib_search_path $ladir"
2354 deplibs="$lib $deplibs"
2356 @@ -1673,28 +2474,36 @@
2357 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2359 # Need to link against all dependency_libs?
2360 - if test $linkalldeplibs = yes; then
2361 + if test "$linkalldeplibs" = yes; then
2362 deplibs="$deplib $deplibs"
2364 # Need to hardcode shared library paths
2365 # or/and link against static libraries
2366 newdependency_libs="$deplib $newdependency_libs"
2368 - case "$tmp_libs " in
2369 - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2371 + if test "X$duplicate_deps" = "Xyes" ; then
2372 + case "$tmp_libs " in
2373 + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2376 tmp_libs="$tmp_libs $deplib"
2379 fi # $linkmode = prog...
2381 - link_static=no # Whether the deplib will be linked statically
2382 - if test -n "$library_names" &&
2383 - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2384 - # Link against this shared library
2385 + if test "$linkmode,$pass" = "prog,link"; then
2386 + if test -n "$library_names" &&
2387 + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2388 + # We need to hardcode the library path
2389 + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2390 + # Make sure the rpath contains only unique directories.
2391 + case "$temp_rpath " in
2394 + *) temp_rpath="$temp_rpath $absdir" ;;
2398 - if test "$linkmode,$pass" = "prog,link" ||
2399 - { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
2400 # Hardcode the library path.
2401 # Skip directories that are in the system default run-time
2403 @@ -1716,17 +2525,6 @@
2407 - if test $linkmode = prog; then
2408 - # We need to hardcode the library path
2409 - if test -n "$shlibpath_var"; then
2410 - # Make sure the rpath contains only unique directories.
2411 - case "$temp_rpath " in
2414 - *) temp_rpath="$temp_rpath $dir" ;;
2418 fi # $linkmode,$pass = prog,link...
2420 if test "$alldeplibs" = yes &&
2421 @@ -1736,11 +2534,56 @@
2422 # We only need to search for static libraries
2427 + link_static=no # Whether the deplib will be linked statically
2428 + use_static_libs=$prefer_static_libs
2429 + if test "$use_static_libs" = built && test "$installed" = yes ; then
2430 + use_static_libs=no
2432 + if test -n "$library_names" &&
2433 + { test "$use_static_libs" = no || test -z "$old_library"; }; then
2434 if test "$installed" = no; then
2435 notinst_deplibs="$notinst_deplibs $lib"
2438 + # This is a shared library
2440 + # Warn about portability, can't link against -module's on
2441 + # some systems (darwin)
2442 + if test "$shouldnotlink" = yes && test "$pass" = link ; then
2444 + if test "$linkmode" = prog; then
2445 + $echo "*** Warning: Linking the executable $output against the loadable module"
2447 + $echo "*** Warning: Linking the shared library $output against the loadable module"
2449 + $echo "*** $linklib is not portable!"
2451 + if test "$linkmode" = lib &&
2452 + test "$hardcode_into_libs" = yes; then
2453 + # Hardcode the library path.
2454 + # Skip directories that are in the system default run-time
2456 + case " $sys_lib_dlsearch_path " in
2459 + case "$compile_rpath " in
2461 + *) compile_rpath="$compile_rpath $absdir"
2465 + case " $sys_lib_dlsearch_path " in
2468 + case "$finalize_rpath " in
2470 + *) finalize_rpath="$finalize_rpath $libdir"
2476 if test -n "$old_archive_from_expsyms_cmds"; then
2477 # figure out the soname
2478 @@ -1754,7 +2597,7 @@
2479 elif test -n "$soname_spec"; then
2483 + *cygwin* | mingw*)
2484 major=`expr $current - $age`
2487 @@ -1766,17 +2609,18 @@
2489 # Make a new name for the extract_expsyms_cmds to use
2491 - soname=`echo $soroot | sed -e 's/^.*\///'`
2492 - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a"
2493 + soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2494 + newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2496 # If the library has no export list, then create one now
2497 if test -f "$output_objdir/$soname-def"; then :
2499 $show "extracting exported symbol list from \`$soname'"
2500 save_ifs="$IFS"; IFS='~'
2501 - eval cmds=\"$extract_expsyms_cmds\"
2502 + cmds=$extract_expsyms_cmds
2503 for cmd in $cmds; do
2507 $run eval "$cmd" || exit $?
2509 @@ -1787,9 +2631,10 @@
2510 if test -f "$output_objdir/$newlib"; then :; else
2511 $show "generating import library for \`$soname'"
2512 save_ifs="$IFS"; IFS='~'
2513 - eval cmds=\"$old_archive_from_expsyms_cmds\"
2514 + cmds=$old_archive_from_expsyms_cmds
2515 for cmd in $cmds; do
2519 $run eval "$cmd" || exit $?
2521 @@ -1798,9 +2643,9 @@
2522 # make sure the library variables are pointing to the new library
2525 - fi # test -n $old_archive_from_expsyms_cmds
2526 + fi # test -n "$old_archive_from_expsyms_cmds"
2528 - if test $linkmode = prog || test "$mode" != relink; then
2529 + if test "$linkmode" = prog || test "$mode" != relink; then
2533 @@ -1809,6 +2654,26 @@
2534 immediate | unsupported)
2535 if test "$hardcode_direct" = no; then
2538 + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2539 + *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2540 + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2541 + *-*-unixware7*) add_dir="-L$dir" ;;
2543 + # if the lib is a module then we can not link against
2544 + # it, someone is ignoring the new warnings I added
2545 + if /usr/bin/file -L $add 2> /dev/null |
2546 + $EGREP ": [^:]* bundle" >/dev/null ; then
2547 + $echo "** Warning, lib $linklib is a module, not a shared library"
2548 + if test -z "$old_library" ; then
2550 + $echo "** And there doesn't seem to be a static archive available"
2551 + $echo "** The link will probably fail, sorry"
2553 + add="$dir/$old_library"
2557 elif test "$hardcode_minus_L" = no; then
2559 *-*-sunos*) add_shlibpath="$dir" ;;
2560 @@ -1827,6 +2692,14 @@
2562 elif test "$hardcode_minus_L" = yes; then
2564 + # Try looking first in the location we're being installed to.
2565 + if test -n "$inst_prefix_dir"; then
2568 + add_dir="$add_dir -L$inst_prefix_dir$libdir"
2573 elif test "$hardcode_shlibpath_var" = yes; then
2574 add_shlibpath="$dir"
2575 @@ -1840,7 +2713,7 @@
2577 if test "$lib_linked" != yes; then
2578 $echo "$modename: configuration error: unsupported hardcode properties"
2580 + exit $EXIT_FAILURE
2583 if test -n "$add_shlibpath"; then
2584 @@ -1849,7 +2722,7 @@
2585 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2588 - if test $linkmode = prog; then
2589 + if test "$linkmode" = prog; then
2590 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2591 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2593 @@ -1866,7 +2739,7 @@
2597 - if test $linkmode = prog || test "$mode" = relink; then
2598 + if test "$linkmode" = prog || test "$mode" = relink; then
2602 @@ -1882,13 +2755,28 @@
2603 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2606 + elif test "$hardcode_automatic" = yes; then
2607 + if test -n "$inst_prefix_dir" &&
2608 + test -f "$inst_prefix_dir$libdir/$linklib" ; then
2609 + add="$inst_prefix_dir$libdir/$linklib"
2611 + add="$libdir/$linklib"
2614 # We cannot seem to hardcode it, guess we'll fake it.
2616 + # Try looking first in the location we're being installed to.
2617 + if test -n "$inst_prefix_dir"; then
2620 + add_dir="$add_dir -L$inst_prefix_dir$libdir"
2627 - if test $linkmode = prog; then
2628 + if test "$linkmode" = prog; then
2629 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2630 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2632 @@ -1896,16 +2784,7 @@
2633 test -n "$add" && deplibs="$add $deplibs"
2636 - elif test $linkmode = prog; then
2637 - if test "$alldeplibs" = yes &&
2638 - { test "$deplibs_check_method" = pass_all ||
2639 - { test "$build_libtool_libs" = yes &&
2640 - test -n "$library_names"; }; }; then
2641 - # We only need to search for static libraries
2645 - # Try to link the static library
2646 + elif test "$linkmode" = prog; then
2647 # Here we assume that one of hardcode_direct or hardcode_minus_L
2648 # is not unsupported. This is valid on all known static and
2650 @@ -1925,20 +2804,21 @@
2652 # Just print a warning and add the library to dependency_libs so
2653 # that the program can be linked against the static library.
2655 - echo "*** Warning: This library needs some functionality provided by $lib."
2656 - echo "*** I have the capability to make that library automatically link in when"
2657 - echo "*** you link to this library. But I can only do this if you have a"
2658 - echo "*** shared version of the library, which you do not appear to have."
2660 + $echo "*** Warning: This system can not link to static lib archive $lib."
2661 + $echo "*** I have the capability to make that library automatically link in when"
2662 + $echo "*** you link to this library. But I can only do this if you have a"
2663 + $echo "*** shared version of the library, which you do not appear to have."
2664 if test "$module" = yes; then
2665 - echo "*** Therefore, libtool will create a static module, that should work "
2666 - echo "*** as long as the dlopening application is linked with the -dlopen flag."
2667 + $echo "*** But as you try to build a module library, libtool will still create "
2668 + $echo "*** a static module, that should work as long as the dlopening application"
2669 + $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2670 if test -z "$global_symbol_pipe"; then
2672 - echo "*** However, this would only work if libtool was able to extract symbol"
2673 - echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2674 - echo "*** not find such a program. So, this module is probably useless."
2675 - echo "*** \`nm' from GNU binutils and a full rebuild may help."
2677 + $echo "*** However, this would only work if libtool was able to extract symbol"
2678 + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2679 + $echo "*** not find such a program. So, this module is probably useless."
2680 + $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2682 if test "$build_old_libs" = no; then
2683 build_libtool_libs=module
2684 @@ -1948,17 +2828,16 @@
2688 - convenience="$convenience $dir/$old_library"
2689 - old_convenience="$old_convenience $dir/$old_library"
2690 deplibs="$dir/$old_library $deplibs"
2693 fi # link shared/static library?
2695 - if test $linkmode = lib; then
2696 + if test "$linkmode" = lib; then
2697 if test -n "$dependency_libs" &&
2698 - { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2699 - test $link_static = yes; }; then
2700 + { test "$hardcode_into_libs" != yes ||
2701 + test "$build_old_libs" = yes ||
2702 + test "$link_static" = yes; }; then
2703 # Extract -R from dependency_libs
2705 for libdir in $dependency_libs; do
2706 @@ -1981,13 +2860,15 @@
2708 for deplib in $dependency_libs; do
2709 newdependency_libs="$deplib $newdependency_libs"
2710 - case "$tmp_libs " in
2711 - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2713 + if test "X$duplicate_deps" = "Xyes" ; then
2714 + case "$tmp_libs " in
2715 + *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2718 tmp_libs="$tmp_libs $deplib"
2721 - if test $link_all_deplibs != no; then
2722 + if test "$link_all_deplibs" != no; then
2723 # Add the search paths of all dependency libraries
2724 for deplib in $dependency_libs; do
2726 @@ -2007,38 +2888,83 @@
2729 if grep "^installed=no" $deplib > /dev/null; then
2730 - path="-L$absdir/$objdir"
2731 + path="$absdir/$objdir"
2733 - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2734 + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2735 if test -z "$libdir"; then
2736 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2738 + exit $EXIT_FAILURE
2740 if test "$absdir" != "$libdir"; then
2741 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2749 + # we do not want to link against static libs,
2750 + # but need to link against shared
2751 + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2752 + if test -n "$deplibrary_names" ; then
2753 + for tmp in $deplibrary_names ; do
2756 + if test -f "$path/$depdepl" ; then
2757 + depdepl="$path/$depdepl"
2759 + # do not add paths which are already there
2760 + case " $newlib_search_path " in
2762 + *) newlib_search_path="$newlib_search_path $path";;
2775 + # Again, we only want to link against shared libraries
2776 + eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2777 + for tmp in $newlib_search_path ; do
2778 + if test -f "$tmp/lib$tmp_libs.dylib" ; then
2779 + eval depdepl="$tmp/lib$tmp_libs.dylib"
2790 case " $deplibs " in
2792 - *) deplibs="$deplibs $path" ;;
2793 + *) deplibs="$path $deplibs" ;;
2795 + case " $deplibs " in
2796 + *" $depdepl "*) ;;
2797 + *) deplibs="$depdepl $deplibs" ;;
2800 fi # link_all_deplibs != no
2802 done # for deplib in $libs
2803 - if test $pass = dlpreopen; then
2804 + dependency_libs="$newdependency_libs"
2805 + if test "$pass" = dlpreopen; then
2806 # Link the dlpreopened libraries before other libraries
2807 for deplib in $save_deplibs; do
2808 deplibs="$deplib $deplibs"
2811 - if test $pass != dlopen; then
2812 - test $pass != scan && dependency_libs="$newdependency_libs"
2813 - if test $pass != conv; then
2814 + if test "$pass" != dlopen; then
2815 + if test "$pass" != conv; then
2816 # Make sure lib_search_path contains only unique directories.
2818 for dir in $newlib_search_path; do
2819 @@ -2060,9 +2986,30 @@
2820 eval tmp_libs=\"\$$var\"
2822 for deplib in $tmp_libs; do
2823 + # FIXME: Pedantically, this is the right thing to do, so
2824 + # that some nasty dependency loop isn't accidentally
2826 + #new_libs="$deplib $new_libs"
2827 + # Pragmatically, this seems to cause very few problems in
2830 -L*) new_libs="$deplib $new_libs" ;;
2833 + # And here is the reason: when a library appears more
2834 + # than once as an explicit dependence of a library, or
2835 + # is implicitly linked in more than once by the
2836 + # compiler, it is considered special, and multiple
2837 + # occurrences thereof are not removed. Compare this
2838 + # with having the same library being listed as a
2839 + # dependency of multiple other libraries: in this case,
2840 + # we know (pedantically, we assume) the library does not
2841 + # need to be listed more than once, so we keep only the
2842 + # last copy. This is not always right, but it is rare
2843 + # enough that we require users that really mean to play
2844 + # such unportable linking tricks to link the library
2845 + # using -Wl,-lname, so that libtool does not consider it
2846 + # for duplicate removal.
2847 case " $specialdeplibs " in
2848 *" $deplib "*) new_libs="$deplib $new_libs" ;;
2850 @@ -2090,19 +3037,32 @@
2851 eval $var=\"$tmp_libs\"
2854 - if test "$pass" = "conv" &&
2855 - { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2856 - libs="$deplibs" # reset libs
2859 + # Last step: remove runtime libs from dependency_libs
2860 + # (they stay in deplibs)
2862 + for i in $dependency_libs ; do
2863 + case " $predeps $postdeps $compiler_lib_search_path " in
2868 + if test -n "$i" ; then
2869 + tmp_libs="$tmp_libs $i"
2872 + dependency_libs=$tmp_libs
2874 - if test $linkmode = prog; then
2875 + if test "$linkmode" = prog; then
2876 dlfiles="$newdlfiles"
2877 dlprefiles="$newdlprefiles"
2882 + if test -n "$deplibs"; then
2883 + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2886 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2887 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2889 @@ -2116,7 +3076,7 @@
2892 if test -n "$vinfo"; then
2893 - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2894 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2897 if test -n "$release"; then
2898 @@ -2138,17 +3098,19 @@
2901 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2902 + eval shared_ext=\"$shrext_cmds\"
2903 eval libname=\"$libname_spec\"
2906 if test "$module" = no; then
2907 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2910 + exit $EXIT_FAILURE
2912 if test "$need_lib_prefix" != no; then
2913 # Add the "lib" prefix for modules if required
2914 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2915 + eval shared_ext=\"$shrext_cmds\"
2916 eval libname=\"$libname_spec\"
2918 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2919 @@ -2159,11 +3121,11 @@
2920 if test -n "$objs"; then
2921 if test "$deplibs_check_method" != pass_all; then
2922 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2924 + exit $EXIT_FAILURE
2927 - echo "*** Warning: Linking the shared library $output against the non-libtool"
2928 - echo "*** objects $objs is not portable!"
2930 + $echo "*** Warning: Linking the shared library $output against the non-libtool"
2931 + $echo "*** objects $objs is not portable!"
2932 libobjs="$libobjs $objs"
2935 @@ -2173,7 +3135,7 @@
2939 - if test $# -gt 2; then
2940 + if test "$#" -gt 2; then
2941 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2944 @@ -2182,14 +3144,16 @@
2945 if test -z "$rpath"; then
2946 if test "$build_libtool_libs" = yes; then
2947 # Building a libtool convenience library.
2949 + # Some compilers have problems with a `.al' extension so
2950 + # convenience libraries should have the same extension an
2951 + # archive normally would.
2952 oldlibs="$output_objdir/$libname.$libext $oldlibs"
2953 build_libtool_libs=convenience
2957 if test -n "$vinfo"; then
2958 - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2959 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2962 if test -n "$release"; then
2963 @@ -2205,45 +3169,87 @@
2964 if test -n "$8"; then
2965 $echo "$modename: too many parameters to \`-version-info'" 1>&2
2968 + exit $EXIT_FAILURE
2974 + # convert absolute version numbers to libtool ages
2975 + # this retains compatibility with .la files and attempts
2976 + # to make the code below a bit more comprehensible
2978 + case $vinfo_number in
2982 + number_revision="$4"
2984 + # There are really only two kinds -- those that
2985 + # use the current revision as the major version
2986 + # and those that subtract age and use age as
2987 + # a minor version. But, then there is irix
2988 + # which has an extra 1 added just for fun
2990 + case $version_type in
2991 + darwin|linux|osf|windows)
2992 + current=`expr $number_major + $number_minor`
2993 + age="$number_minor"
2994 + revision="$number_revision"
2996 + freebsd-aout|freebsd-elf|sunos)
2997 + current="$number_major"
2998 + revision="$number_minor"
3002 + current=`expr $number_major + $number_minor - 1`
3003 + age="$number_minor"
3004 + revision="$number_minor"
3007 + $echo "$modename: unknown library version type \`$version_type'" 1>&2
3008 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3009 + exit $EXIT_FAILURE
3020 # Check that each of the things are valid numbers.
3022 - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3023 + 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]) ;;
3025 - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3026 + $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3027 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3029 + exit $EXIT_FAILURE
3034 - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3035 + 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]) ;;
3037 - $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3038 + $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3039 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3041 + exit $EXIT_FAILURE
3046 - 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3047 + 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]) ;;
3049 - $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3050 + $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3051 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3053 + exit $EXIT_FAILURE
3057 - if test $age -gt $current; then
3058 + if test "$age" -gt "$current"; then
3059 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3060 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3062 + exit $EXIT_FAILURE
3065 # Calculate the version variables.
3066 @@ -2260,7 +3266,7 @@
3067 versuffix="$major.$age.$revision"
3068 # Darwin ld doesn't like 0 for these options...
3069 minor_current=`expr $current + 1`
3070 - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3071 + verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3075 @@ -2273,16 +3279,21 @@
3076 versuffix=".$current";
3081 major=`expr $current - $age + 1`
3082 - verstring="sgi$major.$revision"
3084 + case $version_type in
3085 + nonstopux) verstring_prefix=nonstopux ;;
3086 + *) verstring_prefix=sgi ;;
3088 + verstring="$verstring_prefix$major.$revision"
3090 # Add in all the interfaces that we are compatible with.
3092 - while test $loop != 0; do
3093 + while test "$loop" -ne 0; do
3094 iface=`expr $revision - $loop`
3095 loop=`expr $loop - 1`
3096 - verstring="sgi$major.$iface:$verstring"
3097 + verstring="$verstring_prefix$major.$iface:$verstring"
3100 # Before this point, $major must not contain `.'.
3101 @@ -2296,13 +3307,13 @@
3105 - major=`expr $current - $age`
3106 + major=.`expr $current - $age`
3107 versuffix=".$current.$age.$revision"
3108 verstring="$current.$age.$revision"
3110 # Add in all the interfaces that we are compatible with.
3112 - while test $loop != 0; do
3113 + while test "$loop" -ne 0; do
3114 iface=`expr $current - $loop`
3115 loop=`expr $loop - 1`
3116 verstring="$verstring:${iface}.0"
3117 @@ -2326,20 +3337,19 @@
3120 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3121 - echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3123 + $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3124 + exit $EXIT_FAILURE
3128 # Clear the version info if we defaulted, and they specified a release.
3129 if test -z "$vinfo" && test -n "$release"; then
3132 case $version_type in
3134 # we can't check for "0.0" in archive_cmds due to quoting
3135 # problems, so we reset it completely
3141 @@ -2373,9 +3383,30 @@
3144 if test "$mode" != relink; then
3145 - # Remove our outputs.
3146 - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
3147 - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
3148 + # Remove our outputs, but don't remove object files since they
3149 + # may have been created when compiling PIC objects.
3151 + tempremovelist=`$echo "$output_objdir/*"`
3152 + for p in $tempremovelist; do
3156 + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3157 + if test "X$precious_files_regex" != "X"; then
3158 + if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3163 + removelist="$removelist $p"
3168 + if test -n "$removelist"; then
3169 + $show "${rm}r $removelist"
3170 + $run ${rm}r $removelist
3174 # Now set the variables for building old libraries.
3175 @@ -2388,9 +3419,9 @@
3177 # Eliminate all temporary directories.
3178 for path in $notinst_path; do
3179 - lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'`
3180 - deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'`
3181 - dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'`
3182 + lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3183 + deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3184 + dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3187 if test -n "$xrpath"; then
3188 @@ -2403,7 +3434,7 @@
3189 *) finalize_rpath="$finalize_rpath $libdir" ;;
3192 - if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
3193 + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3194 dependency_libs="$temp_xrpath $dependency_libs"
3197 @@ -2441,12 +3472,18 @@
3199 # Don't link with libc until the a.out ld.so is fixed.
3202 + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3203 # Do not include libc due to us having libc/libc_r.
3206 + *-*-sco3.2v5* | *-*-sco5v6*)
3207 + # Causes problems with __ctype
3209 + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3210 + # Compiler inserts libc in the correct place for threads to work
3213 # Add libc to deplibs on all other systems if necessary.
3214 - if test $build_libtool_need_lc = "yes"; then
3215 + if test "$build_libtool_need_lc" = "yes"; then
3216 deplibs="$deplibs -lc"
3219 @@ -2473,7 +3510,7 @@
3220 # This might be a little naive. We might want to check
3221 # whether the library exists or not. But this is on
3222 # osf3 & osf4 and I'm not really sure... Just
3223 - # implementing what was already the behaviour.
3224 + # implementing what was already the behavior.
3228 @@ -2486,64 +3523,88 @@
3229 int main() { return 0; }
3232 - $CC -o conftest conftest.c $deplibs
3233 - if test $? -eq 0 ; then
3234 + $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3235 + if test "$?" -eq 0 ; then
3236 ldd_output=`ldd conftest`
3237 for i in $deplibs; do
3238 - name="`expr $i : '-l\(.*\)'`"
3239 + name=`expr $i : '-l\(.*\)'`
3240 # If $name is empty we are operating on a -L argument.
3241 - if test -n "$name" && test "$name" != "0"; then
3242 - libname=`eval \\$echo \"$libname_spec\"`
3243 - deplib_matches=`eval \\$echo \"$library_names_spec\"`
3244 - set dummy $deplib_matches
3246 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3247 - newdeplibs="$newdeplibs $i"
3251 - echo "*** Warning: This library needs some functionality provided by $i."
3252 - echo "*** I have the capability to make that library automatically link in when"
3253 - echo "*** you link to this library. But I can only do this if you have a"
3254 - echo "*** shared version of the library, which you do not appear to have."
3255 + if test "$name" != "" && test "$name" -ne "0"; then
3256 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3257 + case " $predeps $postdeps " in
3259 + newdeplibs="$newdeplibs $i"
3264 + if test -n "$i" ; then
3265 + libname=`eval \\$echo \"$libname_spec\"`
3266 + deplib_matches=`eval \\$echo \"$library_names_spec\"`
3267 + set dummy $deplib_matches
3269 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3270 + newdeplibs="$newdeplibs $i"
3274 + $echo "*** Warning: dynamic linker does not accept needed library $i."
3275 + $echo "*** I have the capability to make that library automatically link in when"
3276 + $echo "*** you link to this library. But I can only do this if you have a"
3277 + $echo "*** shared version of the library, which I believe you do not have"
3278 + $echo "*** because a test_compile did reveal that the linker did not use it for"
3279 + $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3283 newdeplibs="$newdeplibs $i"
3287 - # Error occured in the first compile. Let's try to salvage the situation:
3288 - # Compile a seperate program for each library.
3289 + # Error occurred in the first compile. Let's try to salvage
3290 + # the situation: Compile a separate program for each library.
3291 for i in $deplibs; do
3292 - name="`expr $i : '-l\(.*\)'`"
3293 - # If $name is empty we are operating on a -L argument.
3294 - if test -n "$name" && test "$name" != "0"; then
3295 + name=`expr $i : '-l\(.*\)'`
3296 + # If $name is empty we are operating on a -L argument.
3297 + if test "$name" != "" && test "$name" != "0"; then
3299 - $CC -o conftest conftest.c $i
3300 + $LTCC $LTCFLAGS -o conftest conftest.c $i
3302 - if test $? -eq 0 ; then
3303 + if test "$?" -eq 0 ; then
3304 ldd_output=`ldd conftest`
3305 - libname=`eval \\$echo \"$libname_spec\"`
3306 - deplib_matches=`eval \\$echo \"$library_names_spec\"`
3307 - set dummy $deplib_matches
3309 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3310 - newdeplibs="$newdeplibs $i"
3314 - echo "*** Warning: This library needs some functionality provided by $i."
3315 - echo "*** I have the capability to make that library automatically link in when"
3316 - echo "*** you link to this library. But I can only do this if you have a"
3317 - echo "*** shared version of the library, which you do not appear to have."
3318 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3319 + case " $predeps $postdeps " in
3321 + newdeplibs="$newdeplibs $i"
3326 + if test -n "$i" ; then
3327 + libname=`eval \\$echo \"$libname_spec\"`
3328 + deplib_matches=`eval \\$echo \"$library_names_spec\"`
3329 + set dummy $deplib_matches
3331 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3332 + newdeplibs="$newdeplibs $i"
3336 + $echo "*** Warning: dynamic linker does not accept needed library $i."
3337 + $echo "*** I have the capability to make that library automatically link in when"
3338 + $echo "*** you link to this library. But I can only do this if you have a"
3339 + $echo "*** shared version of the library, which you do not appear to have"
3340 + $echo "*** because a test_compile did reveal that the linker did not use this one"
3341 + $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3347 - echo "*** Warning! Library $i is needed by this library but I was not able to"
3348 - echo "*** make it link in! You will probably need to install it or some"
3349 - echo "*** library that it depends on before this library will be fully"
3350 - echo "*** functional. Installing it before continuing would be even better."
3352 + $echo "*** Warning! Library $i is needed by this library but I was not able to"
3353 + $echo "*** make it link in! You will probably need to install it or some"
3354 + $echo "*** library that it depends on before this library will be fully"
3355 + $echo "*** functional. Installing it before continuing would be even better."
3358 newdeplibs="$newdeplibs $i"
3359 @@ -2555,13 +3616,22 @@
3360 set dummy $deplibs_check_method
3361 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3362 for a_deplib in $deplibs; do
3363 - name="`expr $a_deplib : '-l\(.*\)'`"
3364 + name=`expr $a_deplib : '-l\(.*\)'`
3365 # If $name is empty we are operating on a -L argument.
3366 - if test -n "$name" && test "$name" != "0"; then
3367 - libname=`eval \\$echo \"$libname_spec\"`
3368 - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3369 - potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3370 - for potent_lib in $potential_libs; do
3371 + if test "$name" != "" && test "$name" != "0"; then
3372 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3373 + case " $predeps $postdeps " in
3375 + newdeplibs="$newdeplibs $a_deplib"
3380 + if test -n "$a_deplib" ; then
3381 + libname=`eval \\$echo \"$libname_spec\"`
3382 + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3383 + potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3384 + for potent_lib in $potential_libs; do
3385 # Follow soft links.
3386 if ls -lLd "$potent_lib" 2>/dev/null \
3387 | grep " -> " >/dev/null; then
3388 @@ -2574,28 +3644,36 @@
3390 potlib="$potent_lib"
3391 while test -h "$potlib" 2>/dev/null; do
3392 - potliblink=`ls -ld $potlib | sed 's/.* -> //'`
3393 + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3395 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3396 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3399 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3401 - | egrep "$file_magic_regex" > /dev/null; then
3403 + | $EGREP "$file_magic_regex" > /dev/null; then
3404 newdeplibs="$newdeplibs $a_deplib"
3413 if test -n "$a_deplib" ; then
3416 - echo "*** Warning: This library needs some functionality provided by $a_deplib."
3417 - echo "*** I have the capability to make that library automatically link in when"
3418 - echo "*** you link to this library. But I can only do this if you have a"
3419 - echo "*** shared version of the library, which you do not appear to have."
3421 + $echo "*** Warning: linker path does not have real file for library $a_deplib."
3422 + $echo "*** I have the capability to make that library automatically link in when"
3423 + $echo "*** you link to this library. But I can only do this if you have a"
3424 + $echo "*** shared version of the library, which you do not appear to have"
3425 + $echo "*** because I did check the linker path looking for a file starting"
3426 + if test -z "$potlib" ; then
3427 + $echo "*** with $libname but no candidates were found. (...for file magic test)"
3429 + $echo "*** with $libname and none of the candidates passed a file format test"
3430 + $echo "*** using a file magic. Last file checked: $potlib"
3434 # Add a -L argument.
3435 @@ -2607,29 +3685,47 @@
3436 set dummy $deplibs_check_method
3437 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3438 for a_deplib in $deplibs; do
3439 - name="`expr $a_deplib : '-l\(.*\)'`"
3440 + name=`expr $a_deplib : '-l\(.*\)'`
3441 # If $name is empty we are operating on a -L argument.
3442 if test -n "$name" && test "$name" != "0"; then
3443 - libname=`eval \\$echo \"$libname_spec\"`
3444 - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3445 - potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3446 - for potent_lib in $potential_libs; do
3447 - if eval echo \"$potent_lib\" 2>/dev/null \
3449 - | egrep "$match_pattern_regex" > /dev/null; then
3450 - newdeplibs="$newdeplibs $a_deplib"
3454 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3455 + case " $predeps $postdeps " in
3457 + newdeplibs="$newdeplibs $a_deplib"
3462 + if test -n "$a_deplib" ; then
3463 + libname=`eval \\$echo \"$libname_spec\"`
3464 + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3465 + potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3466 + for potent_lib in $potential_libs; do
3467 + potlib="$potent_lib" # see symlink-check above in file_magic test
3468 + if eval $echo \"$potent_lib\" 2>/dev/null \
3470 + | $EGREP "$match_pattern_regex" > /dev/null; then
3471 + newdeplibs="$newdeplibs $a_deplib"
3479 if test -n "$a_deplib" ; then
3482 - echo "*** Warning: This library needs some functionality provided by $a_deplib."
3483 - echo "*** I have the capability to make that library automatically link in when"
3484 - echo "*** you link to this library. But I can only do this if you have a"
3485 - echo "*** shared version of the library, which you do not appear to have."
3487 + $echo "*** Warning: linker path does not have real file for library $a_deplib."
3488 + $echo "*** I have the capability to make that library automatically link in when"
3489 + $echo "*** you link to this library. But I can only do this if you have a"
3490 + $echo "*** shared version of the library, which you do not appear to have"
3491 + $echo "*** because I did check the linker path looking for a file starting"
3492 + if test -z "$potlib" ; then
3493 + $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3495 + $echo "*** with $libname and none of the candidates passed a file format test"
3496 + $echo "*** using a regex pattern. Last file checked: $potlib"
3500 # Add a -L argument.
3501 @@ -2639,16 +3735,23 @@
3505 - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3506 - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' |
3507 - grep . >/dev/null; then
3509 + tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3510 + -e 's/ -[LR][^ ]*//g'`
3511 + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3512 + for i in $predeps $postdeps ; do
3513 + # can't use Xsed below, because $i might contain '/'
3514 + tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3517 + if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3518 + | grep . >/dev/null; then
3520 if test "X$deplibs_check_method" = "Xnone"; then
3521 - echo "*** Warning: inter-library dependencies are not supported in this platform."
3522 + $echo "*** Warning: inter-library dependencies are not supported in this platform."
3524 - echo "*** Warning: inter-library dependencies are not known to be supported."
3525 + $echo "*** Warning: inter-library dependencies are not known to be supported."
3527 - echo "*** All declared inter-library dependencies are being dropped."
3528 + $echo "*** All declared inter-library dependencies are being dropped."
3532 @@ -2668,17 +3771,17 @@
3534 if test "$droppeddeps" = yes; then
3535 if test "$module" = yes; then
3537 - echo "*** Warning: libtool could not satisfy all declared inter-library"
3538 - echo "*** dependencies of module $libname. Therefore, libtool will create"
3539 - echo "*** a static module, that should work as long as the dlopening"
3540 - echo "*** application is linked with the -dlopen flag."
3542 + $echo "*** Warning: libtool could not satisfy all declared inter-library"
3543 + $echo "*** dependencies of module $libname. Therefore, libtool will create"
3544 + $echo "*** a static module, that should work as long as the dlopening"
3545 + $echo "*** application is linked with the -dlopen flag."
3546 if test -z "$global_symbol_pipe"; then
3548 - echo "*** However, this would only work if libtool was able to extract symbol"
3549 - echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3550 - echo "*** not find such a program. So, this module is probably useless."
3551 - echo "*** \`nm' from GNU binutils and a full rebuild may help."
3553 + $echo "*** However, this would only work if libtool was able to extract symbol"
3554 + $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3555 + $echo "*** not find such a program. So, this module is probably useless."
3556 + $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3558 if test "$build_old_libs" = no; then
3559 oldlibs="$output_objdir/$libname.$libext"
3560 @@ -2688,16 +3791,16 @@
3561 build_libtool_libs=no
3564 - echo "*** The inter-library dependencies that have been dropped here will be"
3565 - echo "*** automatically added whenever a program is linked with this library"
3566 - echo "*** or is declared to -dlopen it."
3568 - if test $allow_undefined = no; then
3570 - echo "*** Since this library must not contain undefined symbols,"
3571 - echo "*** because either the platform does not support them or"
3572 - echo "*** it was explicitly requested with -no-undefined,"
3573 - echo "*** libtool will only create a static version of it."
3574 + $echo "*** The inter-library dependencies that have been dropped here will be"
3575 + $echo "*** automatically added whenever a program is linked with this library"
3576 + $echo "*** or is declared to -dlopen it."
3578 + if test "$allow_undefined" = no; then
3580 + $echo "*** Since this library must not contain undefined symbols,"
3581 + $echo "*** because either the platform does not support them or"
3582 + $echo "*** it was explicitly requested with -no-undefined,"
3583 + $echo "*** libtool will only create a static version of it."
3584 if test "$build_old_libs" = no; then
3585 oldlibs="$output_objdir/$libname.$libext"
3586 build_libtool_libs=module
3587 @@ -2712,6 +3815,35 @@
3592 + # move library search paths that coincide with paths to not yet
3593 + # installed libraries to the beginning of the library search list
3595 + for path in $notinst_path; do
3596 + case " $new_libs " in
3597 + *" -L$path/$objdir "*) ;;
3599 + case " $deplibs " in
3600 + *" -L$path/$objdir "*)
3601 + new_libs="$new_libs -L$path/$objdir" ;;
3606 + for deplib in $deplibs; do
3609 + case " $new_libs " in
3611 + *) new_libs="$new_libs $deplib" ;;
3614 + *) new_libs="$new_libs $deplib" ;;
3617 + deplibs="$new_libs"
3620 # All the library-specific variables (install_libdir is set above).
3623 @@ -2719,7 +3851,7 @@
3625 # Test again, we may have decided not to build it any more
3626 if test "$build_libtool_libs" = yes; then
3627 - if test $hardcode_into_libs = yes; then
3628 + if test "$hardcode_into_libs" = yes; then
3629 # Hardcode the library paths
3632 @@ -2755,7 +3887,11 @@
3633 if test -n "$hardcode_libdir_separator" &&
3634 test -n "$hardcode_libdirs"; then
3635 libdir="$hardcode_libdirs"
3636 - eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3637 + if test -n "$hardcode_libdir_flag_spec_ld"; then
3638 + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3640 + eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3643 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3644 # We should set the runpath_var.
3645 @@ -2775,6 +3911,7 @@
3648 # Get the real and link names of the library.
3649 + eval shared_ext=\"$shrext_cmds\"
3650 eval library_names=\"$library_names_spec\"
3651 set dummy $library_names
3653 @@ -2785,31 +3922,17 @@
3657 - test -z "$dlname" && dlname=$soname
3658 + if test -z "$dlname"; then
3662 lib="$output_objdir/$realname"
3666 linknames="$linknames $link"
3669 - # Ensure that we have .o objects for linkers which dislike .lo
3670 - # (e.g. aix) in case we are running --disable-static
3671 - for obj in $libobjs; do
3672 - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
3673 - if test "X$xdir" = "X$obj"; then
3678 - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
3679 - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3680 - if test ! -f $xdir/$oldobj; then
3681 - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
3682 - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
3686 # Use standard objects if they are pic
3687 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3689 @@ -2819,17 +3942,29 @@
3690 $show "generating symbol list for \`$libname.la'"
3691 export_symbols="$output_objdir/$libname.exp"
3692 $run $rm $export_symbols
3693 - eval cmds=\"$export_symbols_cmds\"
3694 + cmds=$export_symbols_cmds
3695 save_ifs="$IFS"; IFS='~'
3696 for cmd in $cmds; do
3699 - $run eval "$cmd" || exit $?
3701 + if len=`expr "X$cmd" : ".*"` &&
3702 + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3704 + $run eval "$cmd" || exit $?
3705 + skipped_export=false
3707 + # The command line is too long to execute in one step.
3708 + $show "using reloadable object file for export list..."
3710 + # Break out early, otherwise skipped_export may be
3711 + # set to false by a later but shorter cmd.
3716 if test -n "$export_symbols_regex"; then
3717 - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3718 - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3719 + $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3720 + $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3721 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3722 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3724 @@ -2840,43 +3975,27 @@
3725 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3729 + for test_deplib in $deplibs; do
3730 + case " $convenience " in
3731 + *" $test_deplib "*) ;;
3733 + tmp_deplibs="$tmp_deplibs $test_deplib"
3737 + deplibs="$tmp_deplibs"
3739 if test -n "$convenience"; then
3740 if test -n "$whole_archive_flag_spec"; then
3741 + save_libobjs=$libobjs
3742 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3744 gentop="$output_objdir/${outputname}x"
3745 - $show "${rm}r $gentop"
3746 - $run ${rm}r "$gentop"
3747 - $show "mkdir $gentop"
3748 - $run mkdir "$gentop"
3750 - if test $status -ne 0 && test ! -d "$gentop"; then
3753 generated="$generated $gentop"
3755 - for xlib in $convenience; do
3756 - # Extract the objects.
3758 - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3759 - *) xabs=`pwd`"/$xlib" ;;
3761 - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3762 - xdir="$gentop/$xlib"
3764 - $show "${rm}r $xdir"
3765 - $run ${rm}r "$xdir"
3766 - $show "mkdir $xdir"
3767 - $run mkdir "$xdir"
3769 - if test $status -ne 0 && test ! -d "$xdir"; then
3772 - $show "(cd $xdir && $AR x $xabs)"
3773 - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3775 - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3777 + func_extract_archives $gentop $convenience
3778 + libobjs="$libobjs $func_extract_archives_result"
3782 @@ -2891,23 +4010,175 @@
3785 # Do each of the archive commands.
3786 + if test "$module" = yes && test -n "$module_cmds" ; then
3787 + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3788 + eval test_cmds=\"$module_expsym_cmds\"
3789 + cmds=$module_expsym_cmds
3791 + eval test_cmds=\"$module_cmds\"
3795 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3796 - eval cmds=\"$archive_expsym_cmds\"
3797 + eval test_cmds=\"$archive_expsym_cmds\"
3798 + cmds=$archive_expsym_cmds
3800 + eval test_cmds=\"$archive_cmds\"
3801 + cmds=$archive_cmds
3805 + if test "X$skipped_export" != "X:" &&
3806 + len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3807 + test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3810 - eval cmds=\"$archive_cmds\"
3811 + # The command line is too long to link in one step, link piecewise.
3812 + $echo "creating reloadable object files..."
3814 + # Save the value of $output and $libobjs because we want to
3815 + # use them later. If we have whole_archive_flag_spec, we
3816 + # want to use save_libobjs as it was before
3817 + # whole_archive_flag_spec was expanded, because we can't
3818 + # assume the linker understands whole_archive_flag_spec.
3819 + # This may have to be revisited, in case too many
3820 + # convenience libraries get linked in and end up exceeding
3822 + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3823 + save_libobjs=$libobjs
3825 + save_output=$output
3826 + output_la=`$echo "X$output" | $Xsed -e "$basename"`
3828 + # Clear the reloadable object creation command queue and
3829 + # initialize k to one.
3836 + output=$output_objdir/$output_la-${k}.$objext
3837 + # Loop over the list of objects to be linked.
3838 + for obj in $save_libobjs
3840 + eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3841 + if test "X$objlist" = X ||
3842 + { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3843 + test "$len" -le "$max_cmd_len"; }; then
3844 + objlist="$objlist $obj"
3846 + # The command $test_cmds is almost too long, add a
3847 + # command to the queue.
3848 + if test "$k" -eq 1 ; then
3849 + # The first file doesn't have a previous command to add.
3850 + eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3852 + # All subsequent reloadable object files will link in
3853 + # the last one created.
3854 + eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3856 + last_robj=$output_objdir/$output_la-${k}.$objext
3858 + output=$output_objdir/$output_la-${k}.$objext
3863 + # Handle the remaining objects by creating one last
3864 + # reloadable object file. All subsequent reloadable object
3865 + # files will link in the last one created.
3866 + test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3867 + eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3869 + if ${skipped_export-false}; then
3870 + $show "generating symbol list for \`$libname.la'"
3871 + export_symbols="$output_objdir/$libname.exp"
3872 + $run $rm $export_symbols
3874 + # Append the command to create the export file.
3875 + eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3878 + # Set up a command to remove the reloadable object files
3879 + # after they are used.
3881 + while test "$i" -lt "$k"
3884 + delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3887 + $echo "creating a temporary reloadable object file: $output"
3889 + # Loop through the commands generated above and execute them.
3890 + save_ifs="$IFS"; IFS='~'
3891 + for cmd in $concat_cmds; do
3894 + $run eval "$cmd" || exit $?
3899 + # Restore the value of output.
3900 + output=$save_output
3902 + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3903 + eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3905 + # Expand the library linking commands again to reset the
3906 + # value of $libobjs for piecewise linking.
3908 + # Do each of the archive commands.
3909 + if test "$module" = yes && test -n "$module_cmds" ; then
3910 + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3911 + cmds=$module_expsym_cmds
3916 + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3917 + cmds=$archive_expsym_cmds
3919 + cmds=$archive_cmds
3923 + # Append the command to remove the reloadable object files
3924 + # to the just-reset $cmds.
3925 + eval cmds=\"\$cmds~\$rm $delfiles\"
3927 save_ifs="$IFS"; IFS='~'
3928 for cmd in $cmds; do
3932 - $run eval "$cmd" || exit $?
3933 + $run eval "$cmd" || {
3936 + # Restore the uninstalled library and exit
3937 + if test "$mode" = relink; then
3938 + $run eval '(cd $outp