1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007, 2008 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
117 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119 eval "if test \"\${$lt_var+set}\" = set; then
120 save_$lt_var=\$$lt_var
121 lt_env=\"$lt_var=\$$lt_var \$lt_env\"
127 if test -n "$lt_env"; then
131 # Make sure IFS has a sensible default
136 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137 $echo "$modename: not configured to build any kind of library" 1>&2
138 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
153 lo2o="s/\\.lo\$/.${objext}/"
154 o2lo="s/\\.${objext}\$/.lo/"
158 #####################################
159 # Shell function definitions:
160 # This seems to be the best place for them
162 # func_mktempdir [string]
163 # Make a temporary directory that won't clash with other running
164 # libtool processes, and avoids race conditions if possible. If
165 # given, STRING is the basename for that directory.
168 my_template="${TMPDIR-/tmp}/${1-$progname}"
170 if test "$run" = ":"; then
171 # Return a directory name, but don't create it in dry-run mode
172 my_tmpdir="${my_template}-$$"
175 # If mktemp works, use that first and foremost
176 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178 if test ! -d "$my_tmpdir"; then
179 # Failing that, at least try and use $RANDOM to avoid a race
180 my_tmpdir="${my_template}-${RANDOM-0}$$"
182 save_mktempdir_umask=`umask`
185 umask $save_mktempdir_umask
188 # If we're not in dry-run mode, bomb out on failure
189 test -d "$my_tmpdir" || {
190 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195 $echo "X$my_tmpdir" | $Xsed
199 # func_win32_libid arg
200 # return the library type of file 'arg'
202 # Need a lot of goo to handle *both* DLLs and import libs
203 # Has to be a shell function in order to 'eat' the argument
204 # that is supplied when $file_magic_command is called.
207 win32_libid_type="unknown"
208 win32_fileres=`file -L $1 2>/dev/null`
209 case $win32_fileres in
210 *ar\ archive\ import\ library*) # definitely import
211 win32_libid_type="x86 archive import"
213 *ar\ archive*) # could be an import, or static
214 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216 win32_nmres=`eval $NM -f posix -A $1 | \
225 import*) win32_libid_type="x86 archive import";;
226 *) win32_libid_type="x86 archive static";;
231 win32_libid_type="x86 DLL"
233 *executable*) # but shell scripts are "executable" too...
234 case $win32_fileres in
235 *MS\ Windows\ PE\ Intel*)
236 win32_libid_type="x86 DLL"
241 $echo $win32_libid_type
246 # Infer tagged configuration to use if any are available and
247 # if one wasn't chosen via the "--tag" command line option.
248 # Only attempt this if the compiler in the base compile
249 # command doesn't match the default compiler.
250 # arg is usually of the form 'gcc ...'
253 if test -n "$available_tags" && test -z "$tagname"; then
257 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
261 CC_quoted="$CC_quoted $arg"
264 # Blanks in the command may have been stripped by the calling shell,
265 # but not from the CC environment variable when configure was run.
266 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267 # Blanks at the start of $base_compile will cause this to fail
268 # if we don't check for them as well.
270 for z in $available_tags; do
271 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272 # Evaluate the configuration.
273 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
276 # Double-quote args containing other shell metacharacters.
278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
282 CC_quoted="$CC_quoted $arg"
284 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
285 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
286 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
287 extendcc=${host}-${CC}
288 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
289 # (Gentoo-specific hack because we always export $CHOST)
290 mungedcc=${CHOST-${host}}-${trimedcc}
292 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
293 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
296 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
297 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
298 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
299 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
300 # The compiler in the base compile command matches
301 # the one in the tagged configuration.
302 # Assume this is the tagged configuration we want.
309 # If $tagname still isn't set, then no tagged configuration
310 # was found and let the user know that the "--tag" command
311 # line option must be used.
312 if test -z "$tagname"; then
313 $echo "$modename: unable to infer tagged configuration"
314 $echo "$modename: specify a tag with \`--tag'" 1>&2
317 # $echo "$modename: using $tagname tagged configuration"
325 # func_extract_an_archive dir oldlib
326 func_extract_an_archive ()
328 f_ex_an_ar_dir="$1"; shift
329 f_ex_an_ar_oldlib="$1"
331 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
332 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
333 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
336 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
341 # func_extract_archives gentop oldlib ...
342 func_extract_archives ()
344 my_gentop="$1"; shift
352 $show "${rm}r $my_gentop"
353 $run ${rm}r "$my_gentop"
354 $show "$mkdir $my_gentop"
355 $run $mkdir "$my_gentop"
357 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
361 for my_xlib in $my_oldlibs; do
362 # Extract the objects.
364 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
365 *) my_xabs=`pwd`"/$my_xlib" ;;
367 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
370 case " $extracted_archives " in
372 extracted_serial=`expr $extracted_serial + 1`
373 my_xlib_u=lt$extracted_serial-$my_xlib ;;
377 extracted_archives="$extracted_archives $my_xlib_u"
378 my_xdir="$my_gentop/$my_xlib_u"
380 $show "${rm}r $my_xdir"
381 $run ${rm}r "$my_xdir"
382 $show "$mkdir $my_xdir"
383 $run $mkdir "$my_xdir"
385 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
390 $show "Extracting $my_xabs"
391 # Do not bother doing anything if just a dry run
392 if test -z "$run"; then
393 darwin_orig_dir=`pwd`
394 cd $my_xdir || exit $?
395 darwin_archive=$my_xabs
397 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
398 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
399 if test -n "$darwin_arches"; then
400 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
402 $show "$darwin_base_archive has multiple architectures $darwin_arches"
403 for darwin_arch in $darwin_arches ; do
404 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
405 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
406 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
407 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
409 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
410 done # $darwin_arches
411 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
412 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
415 for darwin_file in $darwin_filelist; do
416 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
417 lipo -create -output "$darwin_file" $darwin_files
418 done # $darwin_filelist
420 cd "$darwin_orig_dir"
422 cd "$darwin_orig_dir"
423 func_extract_an_archive "$my_xdir" "$my_xabs"
428 func_extract_an_archive "$my_xdir" "$my_xabs"
431 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
433 func_extract_archives_result="$my_oldobjs"
435 # End of Shell function definitions
436 #####################################
439 eval std_shrext=\"$shrext_cmds\"
443 # Parse our command line options once, thoroughly.
444 while test "$#" -gt 0
450 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
454 # If the previous option needs an argument, assign it.
455 if test -n "$prev"; then
458 execute_dlfiles="$execute_dlfiles $arg"
462 preserve_args="${preserve_args}=$arg"
464 # Check whether tagname contains only valid characters
467 $echo "$progname: invalid tag name: $tagname" 1>&2
474 # Don't test for the "default" C tag, as we know, it's there, but
475 # not specially marked.
478 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
479 taglist="$taglist $tagname"
480 # Evaluate the configuration.
481 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
483 $echo "$progname: ignoring unknown tag $tagname" 1>&2
498 # Have we seen a non-optional argument yet?
506 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
508 Copyright (C) 2008 Free Software Foundation, Inc.
509 This is free software; see the source for copying conditions. There is NO
510 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
515 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
516 # Now print the configurations for the tags.
517 for tagname in $taglist; do
518 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
524 $echo "$progname: enabling shell trace mode"
526 preserve_args="$preserve_args $arg"
535 if test "$build_libtool_libs" = yes; then
536 $echo "enable shared libraries"
538 $echo "disable shared libraries"
540 if test "$build_old_libs" = yes; then
541 $echo "enable static libraries"
543 $echo "disable static libraries"
548 --finish) mode="finish" ;;
550 --mode) prevopt="--mode" prev=mode ;;
551 --mode=*) mode="$optarg" ;;
553 --preserve-dup-deps) duplicate_deps="yes" ;;
557 preserve_args="$preserve_args $arg"
563 preserve_args="$preserve_args --tag"
566 set tag "$optarg" ${1+"$@"}
569 preserve_args="$preserve_args --tag"
578 $echo "$modename: unrecognized option \`$arg'" 1>&2
590 if test -n "$prevopt"; then
591 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
596 case $disable_libs in
600 build_libtool_libs=no
604 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
608 # If this variable is set in any of the actions, the command in it
609 # will be execed at the end. This prevents here-documents from being
610 # left over by shells.
613 if test -z "$show_help"; then
615 # Infer the operation mode.
616 if test -z "$mode"; then
617 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
618 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
620 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
632 *db | *dbx | *strace | *truss)
642 # If we have no mode, but dlfiles were specified, then do execute mode.
643 test -n "$execute_dlfiles" && mode=execute
645 # Just use the default operation mode.
646 if test -z "$mode"; then
647 if test -n "$nonopt"; then
648 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
650 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
657 # Only execute mode is allowed to have -dlopen flags.
658 if test -n "$execute_dlfiles" && test "$mode" != execute; then
659 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
664 # Change the help message to a mode-specific one.
666 help="Try \`$modename --help --mode=$mode' for more information."
668 # These modes are in order of execution frequency so that they run quickly.
670 # libtool compile mode
672 modename="$modename: compile"
673 # Get the compilation command and the source file.
675 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
686 # do not "continue". Instead, add this to base_compile
698 # Accept any command-line options.
701 if test -n "$libobj" ; then
702 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
709 -static | -prefer-pic | -prefer-non-pic)
720 arg_mode=arg # the next one goes into the "base_compile" arg list
721 continue # The current "srcfile" will either be retained or
722 ;; # replaced later. I would guess that would be a bug.
725 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
727 save_ifs="$IFS"; IFS=','
731 # Double-quote args containing other shell metacharacters.
732 # Many Bourne shells cannot handle close brackets correctly
733 # in scan sets, so we specify it separately.
735 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
739 lastarg="$lastarg $arg"
742 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
744 # Add the arguments to base_compile.
745 base_compile="$base_compile $lastarg"
750 # Accept the current argument as the source file.
751 # The previous "srcfile" becomes the current argument.
758 esac # case $arg_mode
760 # Aesthetically quote the previous argument.
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, and some SunOS ksh mistreat backslash-escaping
767 # in scan sets (worked around with variable expansion),
768 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
769 # at all, so we specify them separately.
770 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
771 lastarg="\"$lastarg\""
775 base_compile="$base_compile $lastarg"
780 $echo "$modename: you must specify an argument for -Xcompile"
784 $echo "$modename: you must specify a target with \`-o'" 1>&2
788 # Get the name of the library object.
789 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
793 # Recognize several different file suffixes.
794 # If the user specifies -o file.o, it is replaced with file.lo
804 *.class) xform=class ;;
807 *.[fF][09]?) xform=[fF][09]. ;;
809 *.java) xform=java ;;
814 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
817 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
819 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
824 func_infer_tag $base_compile
826 for arg in $later; do
845 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
847 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
848 qlibobj="\"$qlibobj\"" ;;
850 test "X$libobj" != "X$qlibobj" \
851 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
852 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
853 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
854 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
855 if test "X$xdir" = "X$obj"; then
860 lobj=${xdir}$objdir/$objname
862 if test -z "$base_compile"; then
863 $echo "$modename: you must specify a compilation command" 1>&2
868 # Delete any leftover library objects.
869 if test "$build_old_libs" = yes; then
870 removelist="$obj $lobj $libobj ${libobj}T"
872 removelist="$lobj $libobj ${libobj}T"
876 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
878 # On Cygwin there's no "real" PIC flag so we must build both object types
880 cygwin* | mingw* | pw32* | os2*)
884 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
885 # non-PIC code in shared libraries is not supported
889 # Calculate the filename of the output object if compiler does
890 # not support -o with -c
891 if test "$compiler_c_o" = no; then
892 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
893 lockfile="$output_obj.lock"
894 removelist="$removelist $output_obj $lockfile"
895 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
902 # Lock this critical section if it is needed
903 # We use this script file to make the link, it avoids creating a new file
904 if test "$need_locks" = yes; then
905 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
906 $show "Waiting for $lockfile to be removed"
909 elif test "$need_locks" = warn; then
910 if test -f "$lockfile"; then
912 *** ERROR, $lockfile exists and contains:
913 `cat $lockfile 2>/dev/null`
915 This indicates that another process is trying to use the same
916 temporary object file, and libtool could not work around it because
917 your compiler does not support \`-c' and \`-o' together. If you
918 repeat this compilation, it may succeed, by chance, but you had better
919 avoid parallel builds (make -j) in this platform, or get a better
925 $echo "$srcfile" > "$lockfile"
928 if test -n "$fix_srcfile_path"; then
929 eval srcfile=\"$fix_srcfile_path\"
931 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
933 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
934 qsrcfile="\"$qsrcfile\"" ;;
937 $run $rm "$libobj" "${libobj}T"
939 # Create a libtool object file (analogous to a ".la" file),
940 # but don't create it if we're doing a dry run.
941 test -z "$run" && cat > ${libobj}T <<EOF
942 # $libobj - a libtool object file
943 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
945 # Please DO NOT delete this file!
946 # It is necessary for linking the library.
948 # Name of the PIC object.
951 # Only build a PIC object if we are building libtool libraries.
952 if test "$build_libtool_libs" = yes; then
953 # Without this assignment, base_compile gets emptied.
954 fbsd_hideous_sh_bug=$base_compile
956 if test "$pic_mode" != no; then
957 command="$base_compile $qsrcfile $pic_flag"
959 # Don't build PIC code
960 command="$base_compile $qsrcfile"
963 if test ! -d "${xdir}$objdir"; then
964 $show "$mkdir ${xdir}$objdir"
965 $run $mkdir ${xdir}$objdir
967 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
972 if test -z "$output_obj"; then
973 # Place PIC objects in $objdir
974 command="$command -o $lobj"
977 $run $rm "$lobj" "$output_obj"
980 if $run eval $lt_env "$command"; then :
982 test -n "$output_obj" && $run $rm $removelist
986 if test "$need_locks" = warn &&
987 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
989 *** ERROR, $lockfile contains:
990 `cat $lockfile 2>/dev/null`
992 but it should contain:
995 This indicates that another process is trying to use the same
996 temporary object file, and libtool could not work around it because
997 your compiler does not support \`-c' and \`-o' together. If you
998 repeat this compilation, it may succeed, by chance, but you had better
999 avoid parallel builds (make -j) in this platform, or get a better
1002 $run $rm $removelist
1006 # Just move the object if needed, then go on to compile the next one
1007 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1008 $show "$mv $output_obj $lobj"
1009 if $run $mv $output_obj $lobj; then :
1012 $run $rm $removelist
1017 # Append the name of the PIC object to the libtool object file.
1018 test -z "$run" && cat >> ${libobj}T <<EOF
1019 pic_object='$objdir/$objname'
1023 # Allow error messages only from the first compilation.
1024 if test "$suppress_opt" = yes; then
1025 suppress_output=' >/dev/null 2>&1'
1028 # No PIC object so indicate it doesn't exist in the libtool
1030 test -z "$run" && cat >> ${libobj}T <<EOF
1036 # Only build a position-dependent object if we build old libraries.
1037 if test "$build_old_libs" = yes; then
1038 if test "$pic_mode" != yes; then
1039 # Don't build PIC code
1040 command="$base_compile $qsrcfile"
1042 command="$base_compile $qsrcfile $pic_flag"
1044 if test "$compiler_c_o" = yes; then
1045 command="$command -o $obj"
1048 # Suppress compiler output if we already did a PIC compilation.
1049 command="$command$suppress_output"
1050 $run $rm "$obj" "$output_obj"
1052 if $run eval $lt_env "$command"; then :
1054 $run $rm $removelist
1058 if test "$need_locks" = warn &&
1059 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1061 *** ERROR, $lockfile contains:
1062 `cat $lockfile 2>/dev/null`
1064 but it should contain:
1067 This indicates that another process is trying to use the same
1068 temporary object file, and libtool could not work around it because
1069 your compiler does not support \`-c' and \`-o' together. If you
1070 repeat this compilation, it may succeed, by chance, but you had better
1071 avoid parallel builds (make -j) in this platform, or get a better
1074 $run $rm $removelist
1078 # Just move the object if needed
1079 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1080 $show "$mv $output_obj $obj"
1081 if $run $mv $output_obj $obj; then :
1084 $run $rm $removelist
1089 # Append the name of the non-PIC object the libtool object file.
1090 # Only append if the libtool object file exists.
1091 test -z "$run" && cat >> ${libobj}T <<EOF
1092 # Name of the non-PIC object.
1093 non_pic_object='$objname'
1097 # Append the name of the non-PIC object the libtool object file.
1098 # Only append if the libtool object file exists.
1099 test -z "$run" && cat >> ${libobj}T <<EOF
1100 # Name of the non-PIC object.
1106 $run $mv "${libobj}T" "${libobj}"
1108 # Unlock the critical section if it was locked
1109 if test "$need_locks" != no; then
1110 $run $rm "$lockfile"
1118 modename="$modename: link"
1120 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1121 # It is impossible to link a dll without this setting, and
1122 # we shouldn't force the makefile maintainer to figure out
1123 # which system we are compiling for in order to pass an extra
1124 # flag for every libtool invocation.
1125 # allow_undefined=no
1127 # FIXME: Unfortunately, there are problems with the above when trying
1128 # to make a dll which has undefined symbols, in which case not
1129 # even a static library is built. For now, we need to specify
1130 # -no-undefined on the libtool link line when we can be certain
1131 # that all symbols are satisfied, otherwise we get a static library.
1138 libtool_args="$nonopt"
1139 base_compile="$nonopt $@"
1140 compile_command="$nonopt"
1141 finalize_command="$nonopt"
1154 lib_search_path=`pwd`
1163 export_symbols_regex=
1171 notinst_path= # paths that contain not-installed libtool libraries
1172 precious_files_regex=
1173 prefer_static_libs=no
1185 single_module="${wl}-single_module"
1187 func_infer_tag $base_compile
1189 # We need to know -static, to get the right output filenames.
1193 -all-static | -static | -static-libtool-libs)
1196 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1197 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1199 if test -n "$link_static_flag"; then
1200 dlopen_self=$dlopen_self_static
1202 prefer_static_libs=yes
1205 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1206 dlopen_self=$dlopen_self_static
1208 prefer_static_libs=built
1210 -static-libtool-libs)
1211 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1212 dlopen_self=$dlopen_self_static
1214 prefer_static_libs=yes
1217 build_libtool_libs=no
1224 # See if our shared archives depend on static archives.
1225 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1227 # Go through the arguments, transforming them on the way.
1228 while test "$#" -gt 0; do
1232 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1233 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1237 libtool_args="$libtool_args $qarg"
1239 # If the previous option needs an argument, assign it.
1240 if test -n "$prev"; then
1243 compile_command="$compile_command @OUTPUT@"
1244 finalize_command="$finalize_command @OUTPUT@"
1250 if test "$preload" = no; then
1251 # Add the symbol object into the linking commands.
1252 compile_command="$compile_command @SYMFILE@"
1253 finalize_command="$finalize_command @SYMFILE@"
1257 *.la | *.lo) ;; # We handle these cases below.
1259 if test "$dlself" = no; then
1267 if test "$prev" = dlprefiles; then
1269 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1279 if test "$prev" = dlfiles; then
1280 dlfiles="$dlfiles $arg"
1282 dlprefiles="$dlprefiles $arg"
1290 export_symbols="$arg"
1291 if test ! -f "$arg"; then
1292 $echo "$modename: symbol file \`$arg' does not exist"
1299 export_symbols_regex="$arg"
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
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
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
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"
1431 # We need an absolute path.
1433 [\\/]* | [A-Za-z]:[\\/]*) ;;
1435 $echo "$modename: only absolute run-paths are allowed" 1>&2
1439 if test "$prev" = rpath; then
1442 *) rpath="$rpath $arg" ;;
1447 *) xrpath="$xrpath $arg" ;;
1454 compiler_flags="$compiler_flags $qarg"
1456 compile_command="$compile_command $qarg"
1457 finalize_command="$finalize_command $qarg"
1461 linker_flags="$linker_flags $qarg"
1462 compiler_flags="$compiler_flags $wl$qarg"
1464 compile_command="$compile_command $wl$qarg"
1465 finalize_command="$finalize_command $wl$qarg"
1469 linker_flags="$linker_flags $qarg"
1470 compiler_flags="$compiler_flags $qarg"
1472 compile_command="$compile_command $qarg"
1473 finalize_command="$finalize_command $qarg"
1481 darwin_framework|darwin_framework_skip)
1482 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1483 compile_command="$compile_command $arg"
1484 finalize_command="$finalize_command $arg"
1489 eval "$prev=\"\$arg\""
1494 fi # test -n "$prev"
1500 if test -n "$link_static_flag"; then
1501 compile_command="$compile_command $link_static_flag"
1502 finalize_command="$finalize_command $link_static_flag"
1508 # FIXME: remove this flag sometime in the future.
1509 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1533 -export-symbols | -export-symbols-regex)
1534 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1535 $echo "$modename: more than one -exported-symbols argument is not allowed"
1538 if test "X$arg" = "X-export-symbols"; then
1546 -framework|-arch|-isysroot)
1548 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1549 prev=darwin_framework_skip ;;
1550 *) compiler_flags="$compiler_flags $arg"
1551 prev=darwin_framework ;;
1553 compile_command="$compile_command $arg"
1554 finalize_command="$finalize_command $arg"
1563 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1564 # so, if we see these flags be careful not to treat them like -L
1566 case $with_gcc/$host in
1567 no/*-*-irix* | /*-*-irix*)
1568 compile_command="$compile_command $arg"
1569 finalize_command="$finalize_command $arg"
1576 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1577 # We need an absolute path.
1579 [\\/]* | [A-Za-z]:[\\/]*) ;;
1581 absdir=`cd "$dir" && pwd`
1582 if test -z "$absdir"; then
1583 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1585 notinst_path="$notinst_path $dir"
1593 deplibs="$deplibs -L$dir"
1594 lib_search_path="$lib_search_path $dir"
1598 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1599 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1600 case :$dllsearchpath: in
1602 *) dllsearchpath="$dllsearchpath:$dir";;
1604 case :$dllsearchpath: in
1605 *":$testbindir:"*) ;;
1606 *) dllsearchpath="$dllsearchpath:$testbindir";;
1614 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1616 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1617 # These systems don't actually have a C or math library (as such)
1621 # These systems don't actually have a C library (as such)
1622 test "X$arg" = "X-lc" && continue
1624 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1625 # Do not include libc due to us having libc/libc_r.
1626 test "X$arg" = "X-lc" && continue
1628 *-*-rhapsody* | *-*-darwin1.[012])
1629 # Rhapsody C and math libraries are in the System framework
1630 deplibs="$deplibs -framework System"
1633 *-*-sco3.2v5* | *-*-sco5v6*)
1634 # Causes problems with __ctype
1635 test "X$arg" = "X-lc" && continue
1637 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1638 # Compiler inserts libc in the correct place for threads to work
1639 test "X$arg" = "X-lc" && continue
1642 elif test "X$arg" = "X-lc_r"; then
1644 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1645 # Do not include libc_r directly, use -pthread flag.
1650 deplibs="$deplibs $arg"
1654 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1655 # classes, name mangling, and exception handling.
1657 compile_command="$compile_command $arg"
1658 compiler_flags="$compiler_flags $arg"
1659 finalize_command="$finalize_command $arg"
1664 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1665 compiler_flags="$compiler_flags $arg"
1666 compile_command="$compile_command $arg"
1667 finalize_command="$finalize_command $arg"
1672 single_module="${wl}-multi_module"
1681 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1682 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1683 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1684 # +DA*, +DD* enable 64-bit mode on the HP compiler
1685 # -q* pass through compiler args for the IBM compiler
1686 # -m* pass through architecture-specific compiler args for GCC
1687 # -m*, -t[45]*, -txscale* pass through architecture-specific
1688 # compiler args for GCC
1689 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1690 # -F/path gives path to uninstalled frameworks, gcc on darwin
1691 # @file GCC response files
1692 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1693 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1695 # Unknown arguments in both finalize_command and compile_command need
1696 # to be aesthetically quoted because they are evaled later.
1697 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1699 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1703 compile_command="$compile_command $arg"
1704 finalize_command="$finalize_command $arg"
1705 compiler_flags="$compiler_flags $arg"
1721 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1722 # The PATH hackery in wrapper scripts is required on Windows
1723 # and Darwin in order for the loader to find any dlls it needs.
1724 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1725 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1728 *) no_install=yes ;;
1745 -precious-files-regex)
1766 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1767 # We need an absolute path.
1769 [\\/]* | [A-Za-z]:[\\/]*) ;;
1771 $echo "$modename: only absolute run-paths are allowed" 1>&2
1777 *) xrpath="$xrpath $dir" ;;
1782 -static | -static-libtool-libs)
1783 # The effects of -static are defined in a previous loop.
1784 # We used to do the same as -all-static on platforms that
1785 # didn't have a PIC flag, but the assumption that the effects
1786 # would be equivalent was wrong. It would break on at least
1787 # Digital Unix and AIX.
1807 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1809 save_ifs="$IFS"; IFS=','
1810 for flag in $args; do
1813 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1818 compiler_flags="$compiler_flags $flag"
1821 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1825 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1827 save_ifs="$IFS"; IFS=','
1828 for flag in $args; do
1831 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1836 compiler_flags="$compiler_flags $wl$flag"
1837 linker_flags="$linker_flags $flag"
1840 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1858 # Some other compiler flag.
1860 # Unknown arguments in both finalize_command and compile_command need
1861 # to be aesthetically quoted because they are evaled later.
1862 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1864 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1871 # A standard object.
1876 # A libtool-controlled object.
1878 # Check to see that this really is a libtool object.
1879 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1884 # If there is no directory component, then add one.
1886 */* | *\\*) . $arg ;;
1890 if test -z "$pic_object" || \
1891 test -z "$non_pic_object" ||
1892 test "$pic_object" = none && \
1893 test "$non_pic_object" = none; then
1894 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1898 # Extract subdirectory from the argument.
1899 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1900 if test "X$xdir" = "X$arg"; then
1906 if test "$pic_object" != none; then
1907 # Prepend the subdirectory the object is found in.
1908 pic_object="$xdir$pic_object"
1910 if test "$prev" = dlfiles; then
1911 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1912 dlfiles="$dlfiles $pic_object"
1916 # If libtool objects are unsupported, then we need to preload.
1921 # CHECK ME: I think I busted this. -Ossama
1922 if test "$prev" = dlprefiles; then
1923 # Preload the old-style object.
1924 dlprefiles="$dlprefiles $pic_object"
1929 libobjs="$libobjs $pic_object"
1934 if test "$non_pic_object" != none; then
1935 # Prepend the subdirectory the object is found in.
1936 non_pic_object="$xdir$non_pic_object"
1938 # A standard non-PIC object
1939 non_pic_objects="$non_pic_objects $non_pic_object"
1940 if test -z "$pic_object" || test "$pic_object" = none ; then
1941 arg="$non_pic_object"
1944 # If the PIC object exists, use it instead.
1945 # $xdir was prepended to $pic_object above.
1946 non_pic_object="$pic_object"
1947 non_pic_objects="$non_pic_objects $non_pic_object"
1950 # Only an error if not doing a dry-run.
1951 if test -z "$run"; then
1952 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1957 # Extract subdirectory from the argument.
1958 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1959 if test "X$xdir" = "X$arg"; then
1965 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1966 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1967 libobjs="$libobjs $pic_object"
1968 non_pic_objects="$non_pic_objects $non_pic_object"
1975 deplibs="$deplibs $arg"
1976 old_deplibs="$old_deplibs $arg"
1981 # A libtool-controlled library.
1983 if test "$prev" = dlfiles; then
1984 # This library was specified with -dlopen.
1985 dlfiles="$dlfiles $arg"
1987 elif test "$prev" = dlprefiles; then
1988 # The library was specified with -dlpreopen.
1989 dlprefiles="$dlprefiles $arg"
1992 deplibs="$deplibs $arg"
1997 # Some other compiler argument.
1999 # Unknown arguments in both finalize_command and compile_command need
2000 # to be aesthetically quoted because they are evaled later.
2001 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2003 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2010 # Now actually substitute the argument into the commands.
2011 if test -n "$arg"; then
2012 compile_command="$compile_command $arg"
2013 finalize_command="$finalize_command $arg"
2015 done # argument parsing loop
2017 if test -n "$prev"; then
2018 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2023 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2024 eval arg=\"$export_dynamic_flag_spec\"
2025 compile_command="$compile_command $arg"
2026 finalize_command="$finalize_command $arg"
2030 # calculate the name of the file, without its directory
2031 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2032 libobjs_save="$libobjs"
2034 if test -n "$shlibpath_var"; then
2035 # get the directories listed in $shlibpath_var
2036 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2040 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2041 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2043 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2044 if test "X$output_objdir" = "X$output"; then
2045 output_objdir="$objdir"
2047 output_objdir="$output_objdir/$objdir"
2049 # Create the object directory.
2050 if test ! -d "$output_objdir"; then
2051 $show "$mkdir $output_objdir"
2052 $run $mkdir $output_objdir
2054 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2059 # Determine the type of output
2062 $echo "$modename: you must specify an output file" 1>&2
2066 *.$libext) linkmode=oldlib ;;
2067 *.lo | *.$objext) linkmode=obj ;;
2068 *.la) linkmode=lib ;;
2069 *) linkmode=prog ;; # Anything else should be a program.
2073 *cygwin* | *mingw* | *pw32*)
2074 # don't eliminate duplications in $postdeps and $predeps
2075 duplicate_compiler_generated_deps=yes
2078 duplicate_compiler_generated_deps=$duplicate_deps
2084 # Find all interdependent deplibs by searching for libraries
2085 # that are linked more than once (e.g. -la -lb -la)
2086 for deplib in $deplibs; do
2087 if test "X$duplicate_deps" = "Xyes" ; then
2089 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2092 libs="$libs $deplib"
2095 if test "$linkmode" = lib; then
2096 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2098 # Compute libraries that are listed more than once in $predeps
2099 # $postdeps and mark them as special (i.e., whose duplicates are
2100 # not to be eliminated).
2102 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2103 for pre_post_dep in $predeps $postdeps; do
2104 case "$pre_post_deps " in
2105 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2107 pre_post_deps="$pre_post_deps $pre_post_dep"
2116 need_relink=no # whether we're linking any uninstalled libtool libraries
2117 notinst_deplibs= # not-installed libtool libraries
2121 for file in $dlfiles $dlprefiles; do
2125 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2137 passes="conv scan dlopen dlpreopen link"
2142 for pass in $passes; do
2143 if test "$linkmode,$pass" = "lib,link" ||
2144 test "$linkmode,$pass" = "prog,scan"; then
2148 if test "$linkmode" = prog; then
2150 dlopen) libs="$dlfiles" ;;
2151 dlpreopen) libs="$dlprefiles" ;;
2152 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2155 if test "$pass" = dlopen; then
2156 # Collect dlpreopened libraries
2157 save_deplibs="$deplibs"
2160 for deplib in $libs; do
2164 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2165 if test "$linkmode,$pass" = "prog,link"; then
2166 compile_deplibs="$deplib $compile_deplibs"
2167 finalize_deplibs="$deplib $finalize_deplibs"
2169 compiler_flags="$compiler_flags $deplib"
2174 if test "$linkmode" != lib && test "$linkmode" != prog; then
2175 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2178 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2179 if test "$linkmode" = lib; then
2180 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2182 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2184 for searchdir in $searchdirs; do
2185 for search_ext in .la $std_shrext .so .a; do
2186 # Search the libtool library
2187 lib="$searchdir/lib${name}${search_ext}"
2188 if test -f "$lib"; then
2189 if test "$search_ext" = ".la"; then
2198 if test "$found" != yes; then
2199 # deplib doesn't seem to be a libtool library
2200 if test "$linkmode,$pass" = "prog,link"; then
2201 compile_deplibs="$deplib $compile_deplibs"
2202 finalize_deplibs="$deplib $finalize_deplibs"
2204 deplibs="$deplib $deplibs"
2205 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2208 else # deplib is a libtool library
2209 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2210 # We need to do some special things here, and not later.
2211 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2212 case " $predeps $postdeps " in
2214 if (${SED} -e '2q' $lib |
2215 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2219 */* | *\\*) . $lib ;;
2222 for l in $old_library $library_names; do
2225 if test "X$ll" = "X$old_library" ; then # only static version available
2227 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2228 test "X$ladir" = "X$lib" && ladir="."
2229 lib=$ladir/$old_library
2230 if test "$linkmode,$pass" = "prog,link"; then
2231 compile_deplibs="$deplib $compile_deplibs"
2232 finalize_deplibs="$deplib $finalize_deplibs"
2234 deplibs="$deplib $deplibs"
2235 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2249 deplibs="$deplib $deplibs"
2250 test "$pass" = conv && continue
2251 newdependency_libs="$deplib $newdependency_libs"
2252 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2255 if test "$pass" = conv; then
2256 deplibs="$deplib $deplibs"
2259 if test "$pass" = scan; then
2260 deplibs="$deplib $deplibs"
2262 compile_deplibs="$deplib $compile_deplibs"
2263 finalize_deplibs="$deplib $finalize_deplibs"
2265 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2268 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2274 if test "$pass" = link; then
2275 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2276 # Make sure the xrpath contains only unique directories.
2279 *) xrpath="$xrpath $dir" ;;
2282 deplibs="$deplib $deplibs"
2285 *.la) lib="$deplib" ;;
2287 if test "$pass" = conv; then
2288 deplibs="$deplib $deplibs"
2294 case $deplibs_check_method in
2296 set dummy $deplibs_check_method
2297 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2298 if eval $echo \"$deplib\" 2>/dev/null \
2300 | $EGREP "$match_pattern_regex" > /dev/null; then
2308 if test "$valid_a_lib" != yes; then
2310 $echo "*** Warning: Trying to link with static lib archive $deplib."
2311 $echo "*** I have the capability to make that library automatically link in when"
2312 $echo "*** you link to this library. But I can only do this if you have a"
2313 $echo "*** shared version of the library, which you do not appear to have"
2314 $echo "*** because the file extensions .$libext of this argument makes me believe"
2315 $echo "*** that it is just a static archive that I should not used here."
2318 $echo "*** Warning: Linking the shared library $output against the"
2319 $echo "*** static library $deplib is not portable!"
2320 deplibs="$deplib $deplibs"
2325 if test "$pass" != link; then
2326 deplibs="$deplib $deplibs"
2328 compile_deplibs="$deplib $compile_deplibs"
2329 finalize_deplibs="$deplib $finalize_deplibs"
2336 if test "$pass" = conv; then
2337 deplibs="$deplib $deplibs"
2338 elif test "$linkmode" = prog; then
2339 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2340 # If there is no dlopen support or we're linking statically,
2341 # we need to preload.
2342 newdlprefiles="$newdlprefiles $deplib"
2343 compile_deplibs="$deplib $compile_deplibs"
2344 finalize_deplibs="$deplib $finalize_deplibs"
2346 newdlfiles="$newdlfiles $deplib"
2356 if test "$found" = yes || test -f "$lib"; then :
2358 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2362 # Check to see that this really is a libtool archive.
2363 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2365 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2369 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2370 test "X$ladir" = "X$lib" && ladir="."
2378 # If the library was installed with an old release of libtool,
2379 # it will not redefine variables installed, or shouldnotlink
2387 */* | *\\*) . $lib ;;
2391 if test "$linkmode,$pass" = "lib,link" ||
2392 test "$linkmode,$pass" = "prog,scan" ||
2393 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2394 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2395 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2398 if test "$pass" = conv; then
2399 # Only check for convenience libraries
2400 deplibs="$lib $deplibs"
2401 if test -z "$libdir"; then
2402 if test -z "$old_library"; then
2403 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2406 # It is a libtool convenience library, so add in its objects.
2407 convenience="$convenience $ladir/$objdir/$old_library"
2408 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2410 for deplib in $dependency_libs; do
2411 deplibs="$deplib $deplibs"
2412 if test "X$duplicate_deps" = "Xyes" ; then
2413 case "$tmp_libs " in
2414 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2417 tmp_libs="$tmp_libs $deplib"
2419 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2420 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2427 # Get the name of the library we link against.
2429 for l in $old_library $library_names; do
2432 if test -z "$linklib"; then
2433 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2437 # This library was specified with -dlopen.
2438 if test "$pass" = dlopen; then
2439 if test -z "$libdir"; then
2440 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2443 if test -z "$dlname" ||
2444 test "$dlopen_support" != yes ||
2445 test "$build_libtool_libs" = no; then
2446 # If there is no dlname, no dlopen support or we're linking
2447 # statically, we need to preload. We also need to preload any
2448 # dependent libraries so libltdl's deplib preloader doesn't
2449 # bomb out in the load deplibs phase.
2450 dlprefiles="$dlprefiles $lib $dependency_libs"
2452 newdlfiles="$newdlfiles $lib"
2457 # We need an absolute path.
2459 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2461 abs_ladir=`cd "$ladir" && pwd`
2462 if test -z "$abs_ladir"; then
2463 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2464 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2469 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2471 # Find the relevant object directory and library name.
2472 if test "X$installed" = Xyes; then
2473 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2474 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2482 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2484 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2487 # Remove this search path later
2488 notinst_path="$notinst_path $abs_ladir"
2490 dir="$ladir/$objdir"
2491 absdir="$abs_ladir/$objdir"
2492 # Remove this search path later
2493 notinst_path="$notinst_path $abs_ladir"
2495 fi # $installed = yes
2496 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2498 # This library was specified with -dlpreopen.
2499 if test "$pass" = dlpreopen; then
2500 if test -z "$libdir"; then
2501 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2504 # Prefer using a static library (so that no silly _DYNAMIC symbols
2505 # are required to link).
2506 if test -n "$old_library"; then
2507 newdlprefiles="$newdlprefiles $dir/$old_library"
2508 # Otherwise, use the dlname, so that lt_dlopen finds it.
2509 elif test -n "$dlname"; then
2510 newdlprefiles="$newdlprefiles $dir/$dlname"
2512 newdlprefiles="$newdlprefiles $dir/$linklib"
2514 fi # $pass = dlpreopen
2516 if test -z "$libdir"; then
2517 # Link the convenience library
2518 if test "$linkmode" = lib; then
2519 deplibs="$dir/$old_library $deplibs"
2520 elif test "$linkmode,$pass" = "prog,link"; then
2521 compile_deplibs="$dir/$old_library $compile_deplibs"
2522 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2524 deplibs="$lib $deplibs" # used for prog,scan pass
2530 if test "$linkmode" = prog && test "$pass" != link; then
2531 newlib_search_path="$newlib_search_path $ladir"
2532 deplibs="$lib $deplibs"
2535 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2536 test "$build_libtool_libs" = no; then
2541 for deplib in $dependency_libs; do
2543 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2545 # Need to link against all dependency_libs?
2546 if test "$linkalldeplibs" = yes; then
2547 deplibs="$deplib $deplibs"
2549 # Need to hardcode shared library paths
2550 # or/and link against static libraries
2551 newdependency_libs="$deplib $newdependency_libs"
2553 if test "X$duplicate_deps" = "Xyes" ; then
2554 case "$tmp_libs " in
2555 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2558 tmp_libs="$tmp_libs $deplib"
2561 fi # $linkmode = prog...
2563 if test "$linkmode,$pass" = "prog,link"; then
2564 if test -n "$library_names" &&
2565 { { test "$prefer_static_libs" = no ||
2566 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2567 test -z "$old_library"; }; then
2568 # We need to hardcode the library path
2569 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2570 # Make sure the rpath contains only unique directories.
2571 case "$temp_rpath " in
2574 *) temp_rpath="$temp_rpath $absdir" ;;
2578 # Hardcode the library path.
2579 # Skip directories that are in the system default run-time
2581 case " $sys_lib_dlsearch_path " in
2584 case "$compile_rpath " in
2586 *) compile_rpath="$compile_rpath $absdir"
2590 case " $sys_lib_dlsearch_path " in
2593 case "$finalize_rpath " in
2595 *) finalize_rpath="$finalize_rpath $libdir"
2599 fi # $linkmode,$pass = prog,link...
2601 if test "$alldeplibs" = yes &&
2602 { test "$deplibs_check_method" = pass_all ||
2603 { test "$build_libtool_libs" = yes &&
2604 test -n "$library_names"; }; }; then
2605 # We only need to search for static libraries
2610 link_static=no # Whether the deplib will be linked statically
2611 use_static_libs=$prefer_static_libs
2612 if test "$use_static_libs" = built && test "$installed" = yes ; then
2615 if test -n "$library_names" &&
2616 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2617 if test "$installed" = no; then
2618 notinst_deplibs="$notinst_deplibs $lib"
2621 # This is a shared library
2623 # Warn about portability, can't link against -module's on
2624 # some systems (darwin)
2625 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2627 if test "$linkmode" = prog; then
2628 $echo "*** Warning: Linking the executable $output against the loadable module"
2630 $echo "*** Warning: Linking the shared library $output against the loadable module"
2632 $echo "*** $linklib is not portable!"
2634 if test "$linkmode" = lib &&
2635 test "$hardcode_into_libs" = yes; then
2636 # Hardcode the library path.
2637 # Skip directories that are in the system default run-time
2639 case " $sys_lib_dlsearch_path " in
2642 case "$compile_rpath " in
2644 *) compile_rpath="$compile_rpath $absdir"
2648 case " $sys_lib_dlsearch_path " in
2651 case "$finalize_rpath " in
2653 *) finalize_rpath="$finalize_rpath $libdir"
2659 if test -n "$old_archive_from_expsyms_cmds"; then
2660 # figure out the soname
2661 set dummy $library_names
2664 libname=`eval \\$echo \"$libname_spec\"`
2665 # use dlname if we got it. it's perfectly good, no?
2666 if test -n "$dlname"; then
2668 elif test -n "$soname_spec"; then
2672 major=`expr $current - $age`
2676 eval soname=\"$soname_spec\"
2681 # Make a new name for the extract_expsyms_cmds to use
2683 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2684 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2686 # If the library has no export list, then create one now
2687 if test -f "$output_objdir/$soname-def"; then :
2689 $show "extracting exported symbol list from \`$soname'"
2690 save_ifs="$IFS"; IFS='~'
2691 cmds=$extract_expsyms_cmds
2692 for cmd in $cmds; do
2696 $run eval "$cmd" || exit $?
2702 if test -f "$output_objdir/$newlib"; then :; else
2703 $show "generating import library for \`$soname'"
2704 save_ifs="$IFS"; IFS='~'
2705 cmds=$old_archive_from_expsyms_cmds
2706 for cmd in $cmds; do
2710 $run eval "$cmd" || exit $?
2714 # make sure the library variables are pointing to the new library
2717 fi # test -n "$old_archive_from_expsyms_cmds"
2719 if test "$linkmode" = prog || test "$mode" != relink; then
2724 case $hardcode_action in
2725 immediate | unsupported)
2726 if test "$hardcode_direct" = no; then
2729 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2730 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2731 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2732 *-*-unixware7*) add_dir="-L$dir" ;;
2734 # if the lib is a module then we can not link against
2735 # it, someone is ignoring the new warnings I added
2736 if /usr/bin/file -L $add 2> /dev/null |
2737 $EGREP ": [^:]* bundle" >/dev/null ; then
2738 $echo "** Warning, lib $linklib is a module, not a shared library"
2739 if test -z "$old_library" ; then
2741 $echo "** And there doesn't seem to be a static archive available"
2742 $echo "** The link will probably fail, sorry"
2744 add="$dir/$old_library"
2748 elif test "$hardcode_minus_L" = no; then
2750 *-*-sunos*) add_shlibpath="$dir" ;;
2754 elif test "$hardcode_shlibpath_var" = no; then
2755 add_shlibpath="$dir"
2762 if test "$hardcode_direct" = yes; then
2764 elif test "$hardcode_minus_L" = yes; then
2766 # Try looking first in the location we're being installed to.
2767 if test -n "$inst_prefix_dir"; then
2770 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2775 elif test "$hardcode_shlibpath_var" = yes; then
2776 add_shlibpath="$dir"
2785 if test "$lib_linked" != yes; then
2786 $echo "$modename: configuration error: unsupported hardcode properties"
2790 if test -n "$add_shlibpath"; then
2791 case :$compile_shlibpath: in
2792 *":$add_shlibpath:"*) ;;
2793 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2796 if test "$linkmode" = prog; then
2797 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2798 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2800 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2801 test -n "$add" && deplibs="$add $deplibs"
2802 if test "$hardcode_direct" != yes && \
2803 test "$hardcode_minus_L" != yes && \
2804 test "$hardcode_shlibpath_var" = yes; then
2805 case :$finalize_shlibpath: in
2807 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2813 if test "$linkmode" = prog || test "$mode" = relink; then
2817 # Finalize command for both is simple: just hardcode it.
2818 if test "$hardcode_direct" = yes; then
2819 add="$libdir/$linklib"
2820 elif test "$hardcode_minus_L" = yes; then
2823 elif test "$hardcode_shlibpath_var" = yes; then
2824 case :$finalize_shlibpath: in
2826 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2829 elif test "$hardcode_automatic" = yes; then
2830 if test -n "$inst_prefix_dir" &&
2831 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2832 add="$inst_prefix_dir$libdir/$linklib"
2834 add="$libdir/$linklib"
2837 # We cannot seem to hardcode it, guess we'll fake it.
2839 # Try looking first in the location we're being installed to.
2840 if test -n "$inst_prefix_dir"; then
2843 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2850 if test "$linkmode" = prog; then
2851 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2852 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2854 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2855 test -n "$add" && deplibs="$add $deplibs"
2858 elif test "$linkmode" = prog; then
2859 # Here we assume that one of hardcode_direct or hardcode_minus_L
2860 # is not unsupported. This is valid on all known static and
2862 if test "$hardcode_direct" != unsupported; then
2863 test -n "$old_library" && linklib="$old_library"
2864 compile_deplibs="$dir/$linklib $compile_deplibs"
2865 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2867 compile_deplibs="-l$name -L$dir $compile_deplibs"
2868 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2870 elif test "$build_libtool_libs" = yes; then
2871 # Not a shared library
2872 if test "$deplibs_check_method" != pass_all; then
2873 # We're trying link a shared library against a static one
2874 # but the system doesn't support it.
2876 # Just print a warning and add the library to dependency_libs so
2877 # that the program can be linked against the static library.
2879 $echo "*** Warning: This system can not link to static lib archive $lib."
2880 $echo "*** I have the capability to make that library automatically link in when"
2881 $echo "*** you link to this library. But I can only do this if you have a"
2882 $echo "*** shared version of the library, which you do not appear to have."
2883 if test "$module" = yes; then
2884 $echo "*** But as you try to build a module library, libtool will still create "
2885 $echo "*** a static module, that should work as long as the dlopening application"
2886 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2887 if test -z "$global_symbol_pipe"; then
2889 $echo "*** However, this would only work if libtool was able to extract symbol"
2890 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2891 $echo "*** not find such a program. So, this module is probably useless."
2892 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2894 if test "$build_old_libs" = no; then
2895 build_libtool_libs=module
2898 build_libtool_libs=no
2902 deplibs="$dir/$old_library $deplibs"
2905 fi # link shared/static library?
2907 if test "$linkmode" = lib; then
2908 if test -n "$dependency_libs" &&
2909 { test "$hardcode_into_libs" != yes ||
2910 test "$build_old_libs" = yes ||
2911 test "$link_static" = yes; }; then
2912 # Extract -R from dependency_libs
2914 for libdir in $dependency_libs; do
2916 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2918 *" $temp_xrpath "*) ;;
2919 *) xrpath="$xrpath $temp_xrpath";;
2921 *) temp_deplibs="$temp_deplibs $libdir";;
2924 dependency_libs="$temp_deplibs"
2927 newlib_search_path="$newlib_search_path $absdir"
2928 # Link against this library
2929 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2930 # ... and its dependency_libs
2932 for deplib in $dependency_libs; do
2933 newdependency_libs="$deplib $newdependency_libs"
2934 if test "X$duplicate_deps" = "Xyes" ; then
2935 case "$tmp_libs " in
2936 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2939 tmp_libs="$tmp_libs $deplib"
2942 if test "$link_all_deplibs" != no; then
2943 # Add the search paths of all dependency libraries
2944 for deplib in $dependency_libs; do
2946 -L*) path="$deplib" ;;
2948 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2949 test "X$dir" = "X$deplib" && dir="."
2950 # We need an absolute path.
2952 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2954 absdir=`cd "$dir" && pwd`
2955 if test -z "$absdir"; then
2956 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2961 if grep "^installed=no" $deplib > /dev/null; then
2962 path="$absdir/$objdir"
2964 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2965 if test -z "$libdir"; then
2966 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2969 if test "$absdir" != "$libdir"; then
2970 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2977 # we do not want to link against static libs,
2978 # but need to link against shared
2979 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2980 eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2981 if test -n "$deplibrary_names" ; then
2982 for tmp in $deplibrary_names ; do
2985 if test -f "$deplibdir/$depdepl" ; then
2986 depdepl="$deplibdir/$depdepl"
2987 elif test -f "$path/$depdepl" ; then
2988 depdepl="$path/$depdepl"
2990 # Can't find it, oh well...
2993 # do not add paths which are already there
2994 case " $newlib_search_path " in
2996 *) newlib_search_path="$newlib_search_path $path";;
3009 # Again, we only want to link against shared libraries
3010 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3011 for tmp in $newlib_search_path ; do
3012 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3013 eval depdepl="$tmp/lib$tmp_libs.dylib"
3024 case " $deplibs " in
3026 *) deplibs="$path $deplibs" ;;
3028 case " $deplibs " in
3030 *) deplibs="$depdepl $deplibs" ;;
3033 fi # link_all_deplibs != no
3035 done # for deplib in $libs
3036 dependency_libs="$newdependency_libs"
3037 if test "$pass" = dlpreopen; then
3038 # Link the dlpreopened libraries before other libraries
3039 for deplib in $save_deplibs; do
3040 deplibs="$deplib $deplibs"
3043 if test "$pass" != dlopen; then
3044 if test "$pass" != conv; then
3045 # Make sure lib_search_path contains only unique directories.
3047 for dir in $newlib_search_path; do
3048 case "$lib_search_path " in
3050 *) lib_search_path="$lib_search_path $dir" ;;
3056 if test "$linkmode,$pass" != "prog,link"; then
3059 vars="compile_deplibs finalize_deplibs"
3061 for var in $vars dependency_libs; do
3062 # Add libraries to $var in reverse order
3063 eval tmp_libs=\"\$$var\"
3065 for deplib in $tmp_libs; do
3066 # FIXME: Pedantically, this is the right thing to do, so
3067 # that some nasty dependency loop isn't accidentally
3069 #new_libs="$deplib $new_libs"
3070 # Pragmatically, this seems to cause very few problems in
3073 -L*) new_libs="$deplib $new_libs" ;;
3076 # And here is the reason: when a library appears more
3077 # than once as an explicit dependence of a library, or
3078 # is implicitly linked in more than once by the
3079 # compiler, it is considered special, and multiple
3080 # occurrences thereof are not removed. Compare this
3081 # with having the same library being listed as a
3082 # dependency of multiple other libraries: in this case,
3083 # we know (pedantically, we assume) the library does not
3084 # need to be listed more than once, so we keep only the
3085 # last copy. This is not always right, but it is rare
3086 # enough that we require users that really mean to play
3087 # such unportable linking tricks to link the library
3088 # using -Wl,-lname, so that libtool does not consider it
3089 # for duplicate removal.
3090 case " $specialdeplibs " in
3091 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3093 case " $new_libs " in
3095 *) new_libs="$deplib $new_libs" ;;
3103 for deplib in $new_libs; do
3106 case " $tmp_libs " in
3108 *) tmp_libs="$tmp_libs $deplib" ;;
3111 *) tmp_libs="$tmp_libs $deplib" ;;
3114 eval $var=\"$tmp_libs\"
3117 # Last step: remove runtime libs from dependency_libs
3118 # (they stay in deplibs)
3120 for i in $dependency_libs ; do
3121 case " $predeps $postdeps $compiler_lib_search_path " in
3126 if test -n "$i" ; then
3127 tmp_libs="$tmp_libs $i"
3130 dependency_libs=$tmp_libs
3132 if test "$linkmode" = prog; then
3133 dlfiles="$newdlfiles"
3134 dlprefiles="$newdlprefiles"
3141 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3144 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3145 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3148 if test -n "$rpath"; then
3149 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3152 if test -n "$xrpath"; then
3153 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3156 if test -n "$vinfo"; then
3157 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3160 if test -n "$release"; then
3161 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3164 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3165 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3168 # Now set the variables for building old libraries.
3169 build_libtool_libs=no
3171 objs="$objs$old_deplibs"
3175 # Make sure we only generate libraries of the form `libNAME.la'.
3178 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3179 eval shared_ext=\"$shrext_cmds\"
3180 eval libname=\"$libname_spec\"
3183 if test "$module" = no; then
3184 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3188 if test "$need_lib_prefix" != no; then
3189 # Add the "lib" prefix for modules if required
3190 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3191 eval shared_ext=\"$shrext_cmds\"
3192 eval libname=\"$libname_spec\"
3194 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3199 if test -n "$objs"; then
3200 if test "$deplibs_check_method" != pass_all; then
3201 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3205 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3206 $echo "*** objects $objs is not portable!"
3207 libobjs="$libobjs $objs"
3211 if test "$dlself" != no; then
3212 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3216 if test "$#" -gt 2; then
3217 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3222 if test -z "$rpath"; then
3223 if test "$build_libtool_libs" = yes; then
3224 # Building a libtool convenience library.
3225 # Some compilers have problems with a `.al' extension so
3226 # convenience libraries should have the same extension an
3227 # archive normally would.
3228 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3229 build_libtool_libs=convenience
3233 if test -n "$vinfo"; then
3234 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3237 if test -n "$release"; then
3238 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3242 # Parse the version information argument.
3243 save_ifs="$IFS"; IFS=':'
3244 set dummy $vinfo 0 0 0
3247 if test -n "$8"; then
3248 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3253 # convert absolute version numbers to libtool ages
3254 # this retains compatibility with .la files and attempts
3255 # to make the code below a bit more comprehensible
3257 case $vinfo_number in
3261 number_revision="$4"
3263 # There are really only two kinds -- those that
3264 # use the current revision as the major version
3265 # and those that subtract age and use age as
3266 # a minor version. But, then there is irix
3267 # which has an extra 1 added just for fun
3269 case $version_type in
3270 darwin|linux|osf|windows|none)
3271 current=`expr $number_major + $number_minor`
3273 revision="$number_revision"
3275 freebsd-aout|freebsd-elf|sunos)
3276 current="$number_major"
3277 revision="$number_minor"
3281 current=`expr $number_major + $number_minor`
3283 revision="$number_minor"
3284 lt_irix_increment=no
3295 # Check that each of the things are valid numbers.
3297 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]) ;;
3299 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3300 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3306 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]) ;;
3308 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3309 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3315 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]) ;;
3317 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3318 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3323 if test "$age" -gt "$current"; then
3324 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3325 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3329 # Calculate the version variables.
3333 case $version_type in
3337 # Like Linux, but with the current version available in
3338 # verstring for coding it into the library header
3339 major=.`expr $current - $age`
3340 versuffix="$major.$age.$revision"
3341 # Darwin ld doesn't like 0 for these options...
3342 minor_current=`expr $current + 1`
3343 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3344 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3349 versuffix=".$current.$revision";
3354 versuffix=".$current";
3358 if test "X$lt_irix_increment" = "Xno"; then
3359 major=`expr $current - $age`
3361 major=`expr $current - $age + 1`
3363 case $version_type in
3364 nonstopux) verstring_prefix=nonstopux ;;
3365 *) verstring_prefix=sgi ;;
3367 verstring="$verstring_prefix$major.$revision"
3369 # Add in all the interfaces that we are compatible with.
3371 while test "$loop" -ne 0; do
3372 iface=`expr $revision - $loop`
3373 loop=`expr $loop - 1`
3374 verstring="$verstring_prefix$major.$iface:$verstring"
3377 # Before this point, $major must not contain `.'.
3379 versuffix="$major.$revision"
3383 major=.`expr $current - $age`
3384 versuffix="$major.$age.$revision"
3388 major=.`expr $current - $age`
3389 versuffix=".$current.$age.$revision"
3390 verstring="$current.$age.$revision"
3392 # Add in all the interfaces that we are compatible with.
3394 while test "$loop" -ne 0; do
3395 iface=`expr $current - $loop`
3396 loop=`expr $loop - 1`
3397 verstring="$verstring:${iface}.0"
3400 # Make executables depend on our current version.
3401 verstring="$verstring:${current}.0"
3406 versuffix=".$current.$revision"
3410 # Use '-' rather than '.', since we only want one
3411 # extension on DOS 8.3 filesystems.
3412 major=`expr $current - $age`
3417 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3418 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3423 # Clear the version info if we defaulted, and they specified a release.
3424 if test -z "$vinfo" && test -n "$release"; then
3426 case $version_type in
3428 # we can't check for "0.0" in archive_cmds due to quoting
3429 # problems, so we reset it completely
3436 if test "$need_version" = no; then
3443 # Remove version info from name if versioning should be avoided
3444 if test "$avoid_version" = yes && test "$need_version" = no; then
3450 # Check to see if the archive will have undefined symbols.
3451 if test "$allow_undefined" = yes; then
3452 if test "$allow_undefined_flag" = unsupported; then
3453 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3454 build_libtool_libs=no
3458 # Don't allow undefined symbols.
3459 allow_undefined_flag="$no_undefined_flag"
3463 if test "$mode" != relink; then
3464 # Remove our outputs, but don't remove object files since they
3465 # may have been created when compiling PIC objects.
3467 tempremovelist=`$echo "$output_objdir/*"`
3468 for p in $tempremovelist; do
3472 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3473 if test "X$precious_files_regex" != "X"; then
3474 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3479 removelist="$removelist $p"
3484 if test -n "$removelist"; then
3485 $show "${rm}r $removelist"
3486 $run ${rm}r $removelist
3490 # Now set the variables for building old libraries.
3491 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3492 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3494 # Transform .lo files to .o files.
3495 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3498 # Eliminate all temporary directories.
3499 #for path in $notinst_path; do
3500 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3501 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3502 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3505 if test -n "$xrpath"; then
3506 # If the user specified any rpath flags, then add them.
3508 for libdir in $xrpath; do
3509 temp_xrpath="$temp_xrpath -R$libdir"
3510 case "$finalize_rpath " in
3512 *) finalize_rpath="$finalize_rpath $libdir" ;;
3515 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3516 dependency_libs="$temp_xrpath $dependency_libs"
3520 # Make sure dlfiles contains only unique files that won't be dlpreopened
3521 old_dlfiles="$dlfiles"
3523 for lib in $old_dlfiles; do
3524 case " $dlprefiles $dlfiles " in
3526 *) dlfiles="$dlfiles $lib" ;;
3530 # Make sure dlprefiles contains only unique files
3531 old_dlprefiles="$dlprefiles"
3533 for lib in $old_dlprefiles; do
3534 case "$dlprefiles " in
3536 *) dlprefiles="$dlprefiles $lib" ;;
3540 if test "$build_libtool_libs" = yes; then
3541 if test -n "$rpath"; then
3543 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3544 # these systems don't actually have a c library (as such)!
3546 *-*-rhapsody* | *-*-darwin1.[012])
3547 # Rhapsody C library is in the System framework
3548 deplibs="$deplibs -framework System"
3551 # Don't link with libc until the a.out ld.so is fixed.
3553 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3554 # Do not include libc due to us having libc/libc_r.
3556 *-*-sco3.2v5* | *-*-sco5v6*)
3557 # Causes problems with __ctype
3559 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3560 # Compiler inserts libc in the correct place for threads to work
3563 # Add libc to deplibs on all other systems if necessary.
3564 if test "$build_libtool_need_lc" = "yes"; then
3565 deplibs="$deplibs -lc"
3571 # Transform deplibs into only deplibs that can be linked in shared.
3573 libname_save=$libname
3574 release_save=$release
3575 versuffix_save=$versuffix
3577 # I'm not sure if I'm treating the release correctly. I think
3578 # release should show up in the -l (ie -lgmp5) so we don't want to
3579 # add it in twice. Is that correct?
3585 case $deplibs_check_method in
3587 # Don't check for shared/static. Everything works.
3588 # This might be a little naive. We might want to check
3589 # whether the library exists or not. But this is on
3590 # osf3 & osf4 and I'm not really sure... Just
3591 # implementing what was already the behavior.
3595 # This code stresses the "libraries are programs" paradigm to its
3596 # limits. Maybe even breaks it. We compile a program, linking it
3597 # against the deplibs as a proxy for the library. Then we can check
3598 # whether they linked in statically or dynamically with ldd.
3600 cat > conftest.c <<EOF
3601 int main() { return 0; }
3604 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3605 ldd_output=`ldd conftest`
3606 for i in $deplibs; do
3607 name=`expr $i : '-l\(.*\)'`
3608 # If $name is empty we are operating on a -L argument.
3609 if test "$name" != "" && test "$name" != "0"; then
3610 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3611 case " $predeps $postdeps " in
3613 newdeplibs="$newdeplibs $i"
3618 if test -n "$i" ; then
3619 libname=`eval \\$echo \"$libname_spec\"`
3620 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3621 set dummy $deplib_matches
3623 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3624 newdeplibs="$newdeplibs $i"
3628 $echo "*** Warning: dynamic linker does not accept needed library $i."
3629 $echo "*** I have the capability to make that library automatically link in when"
3630 $echo "*** you link to this library. But I can only do this if you have a"
3631 $echo "*** shared version of the library, which I believe you do not have"
3632 $echo "*** because a test_compile did reveal that the linker did not use it for"