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 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`
46 VERSION="1.5.24 Debian 1.5.24-1"
47 TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
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.
116 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
125 # Make sure IFS has a sensible default
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147 lo2o="s/\\.lo\$/.${objext}/"
148 o2lo="s/\\.${objext}\$/.lo/"
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
162 my_template="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir="${my_template}-$$"
169 # If mktemp works, use that first and foremost
170 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask=`umask`
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" || {
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189 $echo "X$my_tmpdir" | $Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
201 win32_libid_type="unknown"
202 win32_fileres=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library*) # definitely import
205 win32_libid_type="x86 archive import"
207 *ar\ archive*) # could be an import, or static
208 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210 win32_nmres=`eval $NM -f posix -A $1 | \
219 import*) win32_libid_type="x86 archive import";;
220 *) win32_libid_type="x86 archive static";;
225 win32_libid_type="x86 DLL"
227 *executable*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel*)
230 win32_libid_type="x86 DLL"
235 $echo $win32_libid_type
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
247 if test -n "$available_tags" && test -z "$tagname"; then
251 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 CC_quoted="$CC_quoted $arg"
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
270 # Double-quote args containing other shell metacharacters.
272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
276 CC_quoted="$CC_quoted $arg"
279 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
280 # The compiler in the base compile command matches
281 # the one in the tagged configuration.
282 # Assume this is the tagged configuration we want.
289 # If $tagname still isn't set, then no tagged configuration
290 # was found and let the user know that the "--tag" command
291 # line option must be used.
292 if test -z "$tagname"; then
293 $echo "$modename: unable to infer tagged configuration"
294 $echo "$modename: specify a tag with \`--tag'" 1>&2
297 # $echo "$modename: using $tagname tagged configuration"
305 # func_extract_an_archive dir oldlib
306 func_extract_an_archive ()
308 f_ex_an_ar_dir="$1"; shift
309 f_ex_an_ar_oldlib="$1"
311 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
312 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
313 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
316 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
321 # func_extract_archives gentop oldlib ...
322 func_extract_archives ()
324 my_gentop="$1"; shift
332 $show "${rm}r $my_gentop"
333 $run ${rm}r "$my_gentop"
334 $show "$mkdir $my_gentop"
335 $run $mkdir "$my_gentop"
337 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
341 for my_xlib in $my_oldlibs; do
342 # Extract the objects.
344 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
345 *) my_xabs=`pwd`"/$my_xlib" ;;
347 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
350 case " $extracted_archives " in
352 extracted_serial=`expr $extracted_serial + 1`
353 my_xlib_u=lt$extracted_serial-$my_xlib ;;
357 extracted_archives="$extracted_archives $my_xlib_u"
358 my_xdir="$my_gentop/$my_xlib_u"
360 $show "${rm}r $my_xdir"
361 $run ${rm}r "$my_xdir"
362 $show "$mkdir $my_xdir"
363 $run $mkdir "$my_xdir"
365 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
370 $show "Extracting $my_xabs"
371 # Do not bother doing anything if just a dry run
372 if test -z "$run"; then
373 darwin_orig_dir=`pwd`
374 cd $my_xdir || exit $?
375 darwin_archive=$my_xabs
377 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
378 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
379 if test -n "$darwin_arches"; then
380 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
382 $show "$darwin_base_archive has multiple architectures $darwin_arches"
383 for darwin_arch in $darwin_arches ; do
384 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
385 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
386 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
387 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
389 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
390 done # $darwin_arches
391 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
392 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
395 for darwin_file in $darwin_filelist; do
396 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
397 lipo -create -output "$darwin_file" $darwin_files
398 done # $darwin_filelist
400 cd "$darwin_orig_dir"
402 cd "$darwin_orig_dir"
403 func_extract_an_archive "$my_xdir" "$my_xabs"
408 func_extract_an_archive "$my_xdir" "$my_xabs"
411 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
413 func_extract_archives_result="$my_oldobjs"
415 # End of Shell function definitions
416 #####################################
419 eval std_shrext=\"$shrext_cmds\"
423 # Parse our command line options once, thoroughly.
424 while test "$#" -gt 0
430 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
434 # If the previous option needs an argument, assign it.
435 if test -n "$prev"; then
438 execute_dlfiles="$execute_dlfiles $arg"
442 preserve_args="${preserve_args}=$arg"
444 # Check whether tagname contains only valid characters
447 $echo "$progname: invalid tag name: $tagname" 1>&2
454 # Don't test for the "default" C tag, as we know, it's there, but
455 # not specially marked.
458 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
459 taglist="$taglist $tagname"
460 # Evaluate the configuration.
461 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
463 $echo "$progname: ignoring unknown tag $tagname" 1>&2
478 # Have we seen a non-optional argument yet?
486 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
488 Copyright (C) 2007 Free Software Foundation, Inc.
489 This is free software; see the source for copying conditions. There is NO
490 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
495 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
496 # Now print the configurations for the tags.
497 for tagname in $taglist; do
498 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
504 $echo "$progname: enabling shell trace mode"
506 preserve_args="$preserve_args $arg"
515 if test "$build_libtool_libs" = yes; then
516 $echo "enable shared libraries"
518 $echo "disable shared libraries"
520 if test "$build_old_libs" = yes; then
521 $echo "enable static libraries"
523 $echo "disable static libraries"
528 --finish) mode="finish" ;;
530 --mode) prevopt="--mode" prev=mode ;;
531 --mode=*) mode="$optarg" ;;
533 --preserve-dup-deps) duplicate_deps="yes" ;;
537 preserve_args="$preserve_args $arg"
543 preserve_args="$preserve_args --tag"
546 set tag "$optarg" ${1+"$@"}
549 preserve_args="$preserve_args --tag"
558 $echo "$modename: unrecognized option \`$arg'" 1>&2
570 if test -n "$prevopt"; then
571 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
576 case $disable_libs in
580 build_libtool_libs=no
584 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
588 # If this variable is set in any of the actions, the command in it
589 # will be execed at the end. This prevents here-documents from being
590 # left over by shells.
593 if test -z "$show_help"; then
595 # Infer the operation mode.
596 if test -z "$mode"; then
597 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
598 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
600 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
612 *db | *dbx | *strace | *truss)
622 # If we have no mode, but dlfiles were specified, then do execute mode.
623 test -n "$execute_dlfiles" && mode=execute
625 # Just use the default operation mode.
626 if test -z "$mode"; then
627 if test -n "$nonopt"; then
628 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
630 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637 # Only execute mode is allowed to have -dlopen flags.
638 if test -n "$execute_dlfiles" && test "$mode" != execute; then
639 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
644 # Change the help message to a mode-specific one.
646 help="Try \`$modename --help --mode=$mode' for more information."
648 # These modes are in order of execution frequency so that they run quickly.
650 # libtool compile mode
652 modename="$modename: compile"
653 # Get the compilation command and the source file.
655 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
666 # do not "continue". Instead, add this to base_compile
678 # Accept any command-line options.
681 if test -n "$libobj" ; then
682 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689 -static | -prefer-pic | -prefer-non-pic)
700 arg_mode=arg # the next one goes into the "base_compile" arg list
701 continue # The current "srcfile" will either be retained or
702 ;; # replaced later. I would guess that would be a bug.
705 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
707 save_ifs="$IFS"; IFS=','
711 # Double-quote args containing other shell metacharacters.
712 # Many Bourne shells cannot handle close brackets correctly
713 # in scan sets, so we specify it separately.
715 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
719 lastarg="$lastarg $arg"
722 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
724 # Add the arguments to base_compile.
725 base_compile="$base_compile $lastarg"
730 # Accept the current argument as the source file.
731 # The previous "srcfile" becomes the current argument.
738 esac # case $arg_mode
740 # Aesthetically quote the previous argument.
741 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
744 # Double-quote args containing other shell metacharacters.
745 # Many Bourne shells cannot handle close brackets correctly
746 # in scan sets, and some SunOS ksh mistreat backslash-escaping
747 # in scan sets (worked around with variable expansion),
748 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
749 # at all, so we specify them separately.
750 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
751 lastarg="\"$lastarg\""
755 base_compile="$base_compile $lastarg"
760 $echo "$modename: you must specify an argument for -Xcompile"
764 $echo "$modename: you must specify a target with \`-o'" 1>&2
768 # Get the name of the library object.
769 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
773 # Recognize several different file suffixes.
774 # If the user specifies -o file.o, it is replaced with file.lo
784 *.class) xform=class ;;
787 *.[fF][09]?) xform=[fF][09]. ;;
789 *.java) xform=java ;;
793 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
796 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
798 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
803 func_infer_tag $base_compile
805 for arg in $later; do
824 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
826 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827 qlibobj="\"$qlibobj\"" ;;
829 test "X$libobj" != "X$qlibobj" \
830 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
831 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
832 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
833 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
834 if test "X$xdir" = "X$obj"; then
839 lobj=${xdir}$objdir/$objname
841 if test -z "$base_compile"; then
842 $echo "$modename: you must specify a compilation command" 1>&2
847 # Delete any leftover library objects.
848 if test "$build_old_libs" = yes; then
849 removelist="$obj $lobj $libobj ${libobj}T"
851 removelist="$lobj $libobj ${libobj}T"
855 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
857 # On Cygwin there's no "real" PIC flag so we must build both object types
859 cygwin* | mingw* | pw32* | os2*)
863 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
864 # non-PIC code in shared libraries is not supported
868 # Calculate the filename of the output object if compiler does
869 # not support -o with -c
870 if test "$compiler_c_o" = no; then
871 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
872 lockfile="$output_obj.lock"
873 removelist="$removelist $output_obj $lockfile"
874 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
881 # Lock this critical section if it is needed
882 # We use this script file to make the link, it avoids creating a new file
883 if test "$need_locks" = yes; then
884 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
885 $show "Waiting for $lockfile to be removed"
888 elif test "$need_locks" = warn; then
889 if test -f "$lockfile"; then
891 *** ERROR, $lockfile exists and contains:
892 `cat $lockfile 2>/dev/null`
894 This indicates that another process is trying to use the same
895 temporary object file, and libtool could not work around it because
896 your compiler does not support \`-c' and \`-o' together. If you
897 repeat this compilation, it may succeed, by chance, but you had better
898 avoid parallel builds (make -j) in this platform, or get a better
904 $echo "$srcfile" > "$lockfile"
907 if test -n "$fix_srcfile_path"; then
908 eval srcfile=\"$fix_srcfile_path\"
910 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
912 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
913 qsrcfile="\"$qsrcfile\"" ;;
916 $run $rm "$libobj" "${libobj}T"
918 # Create a libtool object file (analogous to a ".la" file),
919 # but don't create it if we're doing a dry run.
920 test -z "$run" && cat > ${libobj}T <<EOF
921 # $libobj - a libtool object file
922 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
924 # Please DO NOT delete this file!
925 # It is necessary for linking the library.
927 # Name of the PIC object.
930 # Only build a PIC object if we are building libtool libraries.
931 if test "$build_libtool_libs" = yes; then
932 # Without this assignment, base_compile gets emptied.
933 fbsd_hideous_sh_bug=$base_compile
935 if test "$pic_mode" != no; then
936 command="$base_compile $qsrcfile $pic_flag"
938 # Don't build PIC code
939 command="$base_compile $qsrcfile"
942 if test ! -d "${xdir}$objdir"; then
943 $show "$mkdir ${xdir}$objdir"
944 $run $mkdir ${xdir}$objdir
946 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
951 if test -z "$output_obj"; then
952 # Place PIC objects in $objdir
953 command="$command -o $lobj"
956 $run $rm "$lobj" "$output_obj"
959 if $run eval "$command"; then :
961 test -n "$output_obj" && $run $rm $removelist
965 if test "$need_locks" = warn &&
966 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
968 *** ERROR, $lockfile contains:
969 `cat $lockfile 2>/dev/null`
971 but it should contain:
974 This indicates that another process is trying to use the same
975 temporary object file, and libtool could not work around it because
976 your compiler does not support \`-c' and \`-o' together. If you
977 repeat this compilation, it may succeed, by chance, but you had better
978 avoid parallel builds (make -j) in this platform, or get a better
985 # Just move the object if needed, then go on to compile the next one
986 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
987 $show "$mv $output_obj $lobj"
988 if $run $mv $output_obj $lobj; then :
996 # Append the name of the PIC object to the libtool object file.
997 test -z "$run" && cat >> ${libobj}T <<EOF
998 pic_object='$objdir/$objname'
1002 # Allow error messages only from the first compilation.
1003 if test "$suppress_opt" = yes; then
1004 suppress_output=' >/dev/null 2>&1'
1007 # No PIC object so indicate it doesn't exist in the libtool
1009 test -z "$run" && cat >> ${libobj}T <<EOF
1015 # Only build a position-dependent object if we build old libraries.
1016 if test "$build_old_libs" = yes; then
1017 if test "$pic_mode" != yes; then
1018 # Don't build PIC code
1019 command="$base_compile $qsrcfile"
1021 command="$base_compile $qsrcfile $pic_flag"
1023 if test "$compiler_c_o" = yes; then
1024 command="$command -o $obj"
1027 # Suppress compiler output if we already did a PIC compilation.
1028 command="$command$suppress_output"
1029 $run $rm "$obj" "$output_obj"
1031 if $run eval "$command"; then :
1033 $run $rm $removelist
1037 if test "$need_locks" = warn &&
1038 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1040 *** ERROR, $lockfile contains:
1041 `cat $lockfile 2>/dev/null`
1043 but it should contain:
1046 This indicates that another process is trying to use the same
1047 temporary object file, and libtool could not work around it because
1048 your compiler does not support \`-c' and \`-o' together. If you
1049 repeat this compilation, it may succeed, by chance, but you had better
1050 avoid parallel builds (make -j) in this platform, or get a better
1053 $run $rm $removelist
1057 # Just move the object if needed
1058 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1059 $show "$mv $output_obj $obj"
1060 if $run $mv $output_obj $obj; then :
1063 $run $rm $removelist
1068 # Append the name of the non-PIC object the libtool object file.
1069 # Only append if the libtool object file exists.
1070 test -z "$run" && cat >> ${libobj}T <<EOF
1071 # Name of the non-PIC object.
1072 non_pic_object='$objname'
1076 # Append the name of the non-PIC object the libtool object file.
1077 # Only append if the libtool object file exists.
1078 test -z "$run" && cat >> ${libobj}T <<EOF
1079 # Name of the non-PIC object.
1085 $run $mv "${libobj}T" "${libobj}"
1087 # Unlock the critical section if it was locked
1088 if test "$need_locks" != no; then
1089 $run $rm "$lockfile"
1097 modename="$modename: link"
1099 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1100 # It is impossible to link a dll without this setting, and
1101 # we shouldn't force the makefile maintainer to figure out
1102 # which system we are compiling for in order to pass an extra
1103 # flag for every libtool invocation.
1104 # allow_undefined=no
1106 # FIXME: Unfortunately, there are problems with the above when trying
1107 # to make a dll which has undefined symbols, in which case not
1108 # even a static library is built. For now, we need to specify
1109 # -no-undefined on the libtool link line when we can be certain
1110 # that all symbols are satisfied, otherwise we get a static library.
1117 libtool_args="$nonopt"
1118 base_compile="$nonopt $@"
1119 compile_command="$nonopt"
1120 finalize_command="$nonopt"
1133 lib_search_path=`pwd`
1142 export_symbols_regex=
1150 notinst_path= # paths that contain not-installed libtool libraries
1151 precious_files_regex=
1152 prefer_static_libs=no
1165 func_infer_tag $base_compile
1167 # We need to know -static, to get the right output filenames.
1171 -all-static | -static | -static-libtool-libs)
1174 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1175 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1177 if test -n "$link_static_flag"; then
1178 dlopen_self=$dlopen_self_static
1180 prefer_static_libs=yes
1183 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1184 dlopen_self=$dlopen_self_static
1186 prefer_static_libs=built
1188 -static-libtool-libs)
1189 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1190 dlopen_self=$dlopen_self_static
1192 prefer_static_libs=yes
1195 build_libtool_libs=no
1202 # See if our shared archives depend on static archives.
1203 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1205 # Go through the arguments, transforming them on the way.
1206 while test "$#" -gt 0; do
1210 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1215 libtool_args="$libtool_args $qarg"
1217 # If the previous option needs an argument, assign it.
1218 if test -n "$prev"; then
1221 compile_command="$compile_command @OUTPUT@"
1222 finalize_command="$finalize_command @OUTPUT@"
1228 if test "$preload" = no; then
1229 # Add the symbol object into the linking commands.
1230 compile_command="$compile_command @SYMFILE@"
1231 finalize_command="$finalize_command @SYMFILE@"
1235 *.la | *.lo) ;; # We handle these cases below.
1237 if test "$dlself" = no; then
1245 if test "$prev" = dlprefiles; then
1247 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1257 if test "$prev" = dlfiles; then
1258 dlfiles="$dlfiles $arg"
1260 dlprefiles="$dlprefiles $arg"
1268 export_symbols="$arg"
1269 if test ! -f "$arg"; then
1270 $echo "$modename: symbol file \`$arg' does not exist"
1277 export_symbols_regex="$arg"
1282 inst_prefix_dir="$arg"
1287 precious_files_regex="$arg"
1297 if test -f "$arg"; then
1300 for fil in `cat $save_arg`
1302 # moreargs="$moreargs $fil"
1304 # A libtool-controlled object.
1306 # Check to see that this really is a libtool object.
1307 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1312 # If there is no directory component, then add one.
1314 */* | *\\*) . $arg ;;
1318 if test -z "$pic_object" || \
1319 test -z "$non_pic_object" ||
1320 test "$pic_object" = none && \
1321 test "$non_pic_object" = none; then
1322 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1326 # Extract subdirectory from the argument.
1327 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1328 if test "X$xdir" = "X$arg"; then
1334 if test "$pic_object" != none; then
1335 # Prepend the subdirectory the object is found in.
1336 pic_object="$xdir$pic_object"
1338 if test "$prev" = dlfiles; then
1339 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1340 dlfiles="$dlfiles $pic_object"
1344 # If libtool objects are unsupported, then we need to preload.
1349 # CHECK ME: I think I busted this. -Ossama
1350 if test "$prev" = dlprefiles; then
1351 # Preload the old-style object.
1352 dlprefiles="$dlprefiles $pic_object"
1357 libobjs="$libobjs $pic_object"
1362 if test "$non_pic_object" != none; then
1363 # Prepend the subdirectory the object is found in.
1364 non_pic_object="$xdir$non_pic_object"
1366 # A standard non-PIC object
1367 non_pic_objects="$non_pic_objects $non_pic_object"
1368 if test -z "$pic_object" || test "$pic_object" = none ; then
1369 arg="$non_pic_object"
1372 # If the PIC object exists, use it instead.
1373 # $xdir was prepended to $pic_object above.
1374 non_pic_object="$pic_object"
1375 non_pic_objects="$non_pic_objects $non_pic_object"
1378 # Only an error if not doing a dry-run.
1379 if test -z "$run"; then
1380 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1385 # Extract subdirectory from the argument.
1386 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1387 if test "X$xdir" = "X$arg"; then
1393 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1394 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1395 libobjs="$libobjs $pic_object"
1396 non_pic_objects="$non_pic_objects $non_pic_object"
1401 $echo "$modename: link input file \`$save_arg' does not exist"
1409 # We need an absolute path.
1411 [\\/]* | [A-Za-z]:[\\/]*) ;;
1413 $echo "$modename: only absolute run-paths are allowed" 1>&2
1417 if test "$prev" = rpath; then
1420 *) rpath="$rpath $arg" ;;
1425 *) xrpath="$xrpath $arg" ;;
1432 compiler_flags="$compiler_flags $qarg"
1434 compile_command="$compile_command $qarg"
1435 finalize_command="$finalize_command $qarg"
1439 linker_flags="$linker_flags $qarg"
1440 compiler_flags="$compiler_flags $wl$qarg"
1442 compile_command="$compile_command $wl$qarg"
1443 finalize_command="$finalize_command $wl$qarg"
1447 linker_flags="$linker_flags $qarg"
1448 compiler_flags="$compiler_flags $qarg"
1450 compile_command="$compile_command $qarg"
1451 finalize_command="$finalize_command $qarg"
1459 darwin_framework|darwin_framework_skip)
1460 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1461 compile_command="$compile_command $arg"
1462 finalize_command="$finalize_command $arg"
1467 eval "$prev=\"\$arg\""
1472 fi # test -n "$prev"
1478 if test -n "$link_static_flag"; then
1479 compile_command="$compile_command $link_static_flag"
1480 finalize_command="$finalize_command $link_static_flag"
1486 # FIXME: remove this flag sometime in the future.
1487 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1511 -export-symbols | -export-symbols-regex)
1512 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1513 $echo "$modename: more than one -exported-symbols argument is not allowed"
1516 if test "X$arg" = "X-export-symbols"; then
1524 -framework|-arch|-isysroot)
1526 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1527 prev=darwin_framework_skip ;;
1528 *) compiler_flags="$compiler_flags $arg"
1529 prev=darwin_framework ;;
1531 compile_command="$compile_command $arg"
1532 finalize_command="$finalize_command $arg"
1541 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1542 # so, if we see these flags be careful not to treat them like -L
1544 case $with_gcc/$host in
1545 no/*-*-irix* | /*-*-irix*)
1546 compile_command="$compile_command $arg"
1547 finalize_command="$finalize_command $arg"
1554 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1555 # We need an absolute path.
1557 [\\/]* | [A-Za-z]:[\\/]*) ;;
1559 absdir=`cd "$dir" && pwd`
1560 if test -z "$absdir"; then
1561 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1563 notinst_path="$notinst_path $dir"
1571 deplibs="$deplibs -L$dir"
1572 lib_search_path="$lib_search_path $dir"
1576 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1577 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1578 case :$dllsearchpath: in
1580 *) dllsearchpath="$dllsearchpath:$dir";;
1582 case :$dllsearchpath: in
1583 *":$testbindir:"*) ;;
1584 *) dllsearchpath="$dllsearchpath:$testbindir";;
1592 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1594 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1595 # These systems don't actually have a C or math library (as such)
1599 # These systems don't actually have a C library (as such)
1600 test "X$arg" = "X-lc" && continue
1602 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1603 # Do not include libc due to us having libc/libc_r.
1604 test "X$arg" = "X-lc" && continue
1606 *-*-rhapsody* | *-*-darwin1.[012])
1607 # Rhapsody C and math libraries are in the System framework
1608 deplibs="$deplibs -framework System"
1611 *-*-sco3.2v5* | *-*-sco5v6*)
1612 # Causes problems with __ctype
1613 test "X$arg" = "X-lc" && continue
1615 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1616 # Compiler inserts libc in the correct place for threads to work
1617 test "X$arg" = "X-lc" && continue
1620 elif test "X$arg" = "X-lc_r"; then
1622 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1623 # Do not include libc_r directly, use -pthread flag.
1628 deplibs="$deplibs $arg"
1632 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1633 # classes, name mangling, and exception handling.
1635 compile_command="$compile_command $arg"
1636 compiler_flags="$compiler_flags $arg"
1637 finalize_command="$finalize_command $arg"
1642 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1643 compiler_flags="$compiler_flags $arg"
1644 compile_command="$compile_command $arg"
1645 finalize_command="$finalize_command $arg"
1654 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1655 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1656 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1657 # +DA*, +DD* enable 64-bit mode on the HP compiler
1658 # -q* pass through compiler args for the IBM compiler
1659 # -m* pass through architecture-specific compiler args for GCC
1660 # -m*, -t[45]*, -txscale* pass through architecture-specific
1661 # compiler args for GCC
1662 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1663 # -F/path gives path to uninstalled frameworks, gcc on darwin
1664 # @file GCC response files
1665 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1666 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1668 # Unknown arguments in both finalize_command and compile_command need
1669 # to be aesthetically quoted because they are evaled later.
1670 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1672 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1676 compile_command="$compile_command $arg"
1677 finalize_command="$finalize_command $arg"
1678 compiler_flags="$compiler_flags $arg"
1694 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1695 # The PATH hackery in wrapper scripts is required on Windows
1696 # and Darwin in order for the loader to find any dlls it needs.
1697 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1698 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1701 *) no_install=yes ;;
1718 -precious-files-regex)
1739 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1740 # We need an absolute path.
1742 [\\/]* | [A-Za-z]:[\\/]*) ;;
1744 $echo "$modename: only absolute run-paths are allowed" 1>&2
1750 *) xrpath="$xrpath $dir" ;;
1755 -static | -static-libtool-libs)
1756 # The effects of -static are defined in a previous loop.
1757 # We used to do the same as -all-static on platforms that
1758 # didn't have a PIC flag, but the assumption that the effects
1759 # would be equivalent was wrong. It would break on at least
1760 # Digital Unix and AIX.
1780 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1782 save_ifs="$IFS"; IFS=','
1783 for flag in $args; do
1786 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1791 compiler_flags="$compiler_flags $flag"
1794 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1798 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1800 save_ifs="$IFS"; IFS=','
1801 for flag in $args; do
1804 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1809 compiler_flags="$compiler_flags $wl$flag"
1810 linker_flags="$linker_flags $flag"
1813 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1831 # Some other compiler flag.
1833 # Unknown arguments in both finalize_command and compile_command need
1834 # to be aesthetically quoted because they are evaled later.
1835 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1837 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1844 # A standard object.
1849 # A libtool-controlled object.
1851 # Check to see that this really is a libtool object.
1852 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1857 # If there is no directory component, then add one.
1859 */* | *\\*) . $arg ;;
1863 if test -z "$pic_object" || \
1864 test -z "$non_pic_object" ||
1865 test "$pic_object" = none && \
1866 test "$non_pic_object" = none; then
1867 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1871 # Extract subdirectory from the argument.
1872 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1873 if test "X$xdir" = "X$arg"; then
1879 if test "$pic_object" != none; then
1880 # Prepend the subdirectory the object is found in.
1881 pic_object="$xdir$pic_object"
1883 if test "$prev" = dlfiles; then
1884 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1885 dlfiles="$dlfiles $pic_object"
1889 # If libtool objects are unsupported, then we need to preload.
1894 # CHECK ME: I think I busted this. -Ossama
1895 if test "$prev" = dlprefiles; then
1896 # Preload the old-style object.
1897 dlprefiles="$dlprefiles $pic_object"
1902 libobjs="$libobjs $pic_object"
1907 if test "$non_pic_object" != none; then
1908 # Prepend the subdirectory the object is found in.
1909 non_pic_object="$xdir$non_pic_object"
1911 # A standard non-PIC object
1912 non_pic_objects="$non_pic_objects $non_pic_object"
1913 if test -z "$pic_object" || test "$pic_object" = none ; then
1914 arg="$non_pic_object"
1917 # If the PIC object exists, use it instead.
1918 # $xdir was prepended to $pic_object above.
1919 non_pic_object="$pic_object"
1920 non_pic_objects="$non_pic_objects $non_pic_object"
1923 # Only an error if not doing a dry-run.
1924 if test -z "$run"; then
1925 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1930 # Extract subdirectory from the argument.
1931 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1932 if test "X$xdir" = "X$arg"; then
1938 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1939 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1940 libobjs="$libobjs $pic_object"
1941 non_pic_objects="$non_pic_objects $non_pic_object"
1948 deplibs="$deplibs $arg"
1949 old_deplibs="$old_deplibs $arg"
1954 # A libtool-controlled library.
1956 if test "$prev" = dlfiles; then
1957 # This library was specified with -dlopen.
1958 dlfiles="$dlfiles $arg"
1960 elif test "$prev" = dlprefiles; then
1961 # The library was specified with -dlpreopen.
1962 dlprefiles="$dlprefiles $arg"
1965 deplibs="$deplibs $arg"
1970 # Some other compiler argument.
1972 # Unknown arguments in both finalize_command and compile_command need
1973 # to be aesthetically quoted because they are evaled later.
1974 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1976 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1983 # Now actually substitute the argument into the commands.
1984 if test -n "$arg"; then
1985 compile_command="$compile_command $arg"
1986 finalize_command="$finalize_command $arg"
1988 done # argument parsing loop
1990 if test -n "$prev"; then
1991 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1996 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1997 eval arg=\"$export_dynamic_flag_spec\"
1998 compile_command="$compile_command $arg"
1999 finalize_command="$finalize_command $arg"
2003 # calculate the name of the file, without its directory
2004 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2005 libobjs_save="$libobjs"
2007 if test -n "$shlibpath_var"; then
2008 # get the directories listed in $shlibpath_var
2009 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2013 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2014 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2016 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2017 if test "X$output_objdir" = "X$output"; then
2018 output_objdir="$objdir"
2020 output_objdir="$output_objdir/$objdir"
2022 # Create the object directory.
2023 if test ! -d "$output_objdir"; then
2024 $show "$mkdir $output_objdir"
2025 $run $mkdir $output_objdir
2027 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2032 # Determine the type of output
2035 $echo "$modename: you must specify an output file" 1>&2
2039 *.$libext) linkmode=oldlib ;;
2040 *.lo | *.$objext) linkmode=obj ;;
2041 *.la) linkmode=lib ;;
2042 *) linkmode=prog ;; # Anything else should be a program.
2046 *cygwin* | *mingw* | *pw32*)
2047 # don't eliminate duplications in $postdeps and $predeps
2048 duplicate_compiler_generated_deps=yes
2051 duplicate_compiler_generated_deps=$duplicate_deps
2057 # Find all interdependent deplibs by searching for libraries
2058 # that are linked more than once (e.g. -la -lb -la)
2059 for deplib in $deplibs; do
2060 if test "X$duplicate_deps" = "Xyes" ; then
2062 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2065 libs="$libs $deplib"
2068 if test "$linkmode" = lib; then
2069 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2071 # Compute libraries that are listed more than once in $predeps
2072 # $postdeps and mark them as special (i.e., whose duplicates are
2073 # not to be eliminated).
2075 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2076 for pre_post_dep in $predeps $postdeps; do
2077 case "$pre_post_deps " in
2078 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2080 pre_post_deps="$pre_post_deps $pre_post_dep"
2089 need_relink=no # whether we're linking any uninstalled libtool libraries
2090 notinst_deplibs= # not-installed libtool libraries
2094 for file in $dlfiles $dlprefiles; do
2098 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2110 passes="conv scan dlopen dlpreopen link"
2115 for pass in $passes; do
2116 if test "$linkmode,$pass" = "lib,link" ||
2117 test "$linkmode,$pass" = "prog,scan"; then
2121 if test "$linkmode" = prog; then
2123 dlopen) libs="$dlfiles" ;;
2124 dlpreopen) libs="$dlprefiles" ;;
2126 libs="$deplibs %DEPLIBS%"
2127 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
2131 if test "$pass" = dlopen; then
2132 # Collect dlpreopened libraries
2133 save_deplibs="$deplibs"
2136 for deplib in $libs; do
2140 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2141 if test "$linkmode,$pass" = "prog,link"; then
2142 compile_deplibs="$deplib $compile_deplibs"
2143 finalize_deplibs="$deplib $finalize_deplibs"
2145 compiler_flags="$compiler_flags $deplib"
2150 if test "$linkmode" != lib && test "$linkmode" != prog; then
2151 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2154 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2155 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2156 for search_ext in .la $std_shrext .so .a; do
2157 # Search the libtool library
2158 lib="$searchdir/lib${name}${search_ext}"
2159 if test -f "$lib"; then
2160 if test "$search_ext" = ".la"; then
2169 if test "$found" != yes; then
2170 # deplib doesn't seem to be a libtool library
2171 if test "$linkmode,$pass" = "prog,link"; then
2172 compile_deplibs="$deplib $compile_deplibs"
2173 finalize_deplibs="$deplib $finalize_deplibs"
2175 deplibs="$deplib $deplibs"
2176 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2179 else # deplib is a libtool library
2180 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2181 # We need to do some special things here, and not later.
2182 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2183 case " $predeps $postdeps " in
2185 if (${SED} -e '2q' $lib |
2186 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2190 */* | *\\*) . $lib ;;
2193 for l in $old_library $library_names; do
2196 if test "X$ll" = "X$old_library" ; then # only static version available
2198 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2199 test "X$ladir" = "X$lib" && ladir="."
2200 lib=$ladir/$old_library
2201 if test "$linkmode,$pass" = "prog,link"; then
2202 compile_deplibs="$deplib $compile_deplibs"
2203 finalize_deplibs="$deplib $finalize_deplibs"
2205 deplibs="$deplib $deplibs"
2206 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2220 deplibs="$deplib $deplibs"
2221 test "$pass" = conv && continue
2222 newdependency_libs="$deplib $newdependency_libs"
2223 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2226 if test "$pass" = conv; then
2227 deplibs="$deplib $deplibs"
2230 if test "$pass" = scan; then
2231 deplibs="$deplib $deplibs"
2233 compile_deplibs="$deplib $compile_deplibs"
2234 finalize_deplibs="$deplib $finalize_deplibs"
2236 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2239 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2245 if test "$pass" = link; then
2246 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2247 # Make sure the xrpath contains only unique directories.
2250 *) xrpath="$xrpath $dir" ;;
2253 deplibs="$deplib $deplibs"
2256 *.la) lib="$deplib" ;;
2258 if test "$pass" = conv; then
2259 deplibs="$deplib $deplibs"
2265 case $deplibs_check_method in
2267 set dummy $deplibs_check_method
2268 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2269 if eval $echo \"$deplib\" 2>/dev/null \
2271 | $EGREP "$match_pattern_regex" > /dev/null; then
2279 if test "$valid_a_lib" != yes; then
2281 $echo "*** Warning: Trying to link with static lib archive $deplib."
2282 $echo "*** I have the capability to make that library automatically link in when"
2283 $echo "*** you link to this library. But I can only do this if you have a"
2284 $echo "*** shared version of the library, which you do not appear to have"
2285 $echo "*** because the file extensions .$libext of this argument makes me believe"
2286 $echo "*** that it is just a static archive that I should not used here."
2289 $echo "*** Warning: Linking the shared library $output against the"
2290 $echo "*** static library $deplib is not portable!"
2291 deplibs="$deplib $deplibs"
2296 if test "$pass" != link; then
2297 deplibs="$deplib $deplibs"
2299 compile_deplibs="$deplib $compile_deplibs"
2300 finalize_deplibs="$deplib $finalize_deplibs"
2307 if test "$pass" = conv; then
2308 deplibs="$deplib $deplibs"
2309 elif test "$linkmode" = prog; then
2310 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2311 # If there is no dlopen support or we're linking statically,
2312 # we need to preload.
2313 newdlprefiles="$newdlprefiles $deplib"
2314 compile_deplibs="$deplib $compile_deplibs"
2315 finalize_deplibs="$deplib $finalize_deplibs"
2317 newdlfiles="$newdlfiles $deplib"
2327 if test "$found" = yes || test -f "$lib"; then :
2329 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2333 # Check to see that this really is a libtool archive.
2334 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2336 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2340 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2341 test "X$ladir" = "X$lib" && ladir="."
2349 # If the library was installed with an old release of libtool,
2350 # it will not redefine variables installed, or shouldnotlink
2358 */* | *\\*) . $lib ;;
2362 if test "$linkmode,$pass" = "lib,link" ||
2363 test "$linkmode,$pass" = "prog,scan" ||
2364 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2365 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2366 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2369 if test "$pass" = conv; then
2370 # Only check for convenience libraries
2371 deplibs="$lib $deplibs"
2372 if test -z "$libdir"; then
2373 if test -z "$old_library"; then
2374 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2377 # It is a libtool convenience library, so add in its objects.
2378 convenience="$convenience $ladir/$objdir/$old_library"
2379 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2381 for deplib in $dependency_libs; do
2382 deplibs="$deplib $deplibs"
2383 if test "X$duplicate_deps" = "Xyes" ; then
2384 case "$tmp_libs " in
2385 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2388 tmp_libs="$tmp_libs $deplib"
2390 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2391 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2398 # Get the name of the library we link against.
2400 for l in $old_library $library_names; do
2403 if test -z "$linklib"; then
2404 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2408 # This library was specified with -dlopen.
2409 if test "$pass" = dlopen; then
2410 if test -z "$libdir"; then
2411 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2414 if test -z "$dlname" ||
2415 test "$dlopen_support" != yes ||
2416 test "$build_libtool_libs" = no; then
2417 # If there is no dlname, no dlopen support or we're linking
2418 # statically, we need to preload. We also need to preload any
2419 # dependent libraries so libltdl's deplib preloader doesn't
2420 # bomb out in the load deplibs phase.
2421 dlprefiles="$dlprefiles $lib $dependency_libs"
2423 newdlfiles="$newdlfiles $lib"
2428 # We need an absolute path.
2430 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2432 abs_ladir=`cd "$ladir" && pwd`
2433 if test -z "$abs_ladir"; then
2434 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2435 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2440 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2442 # Find the relevant object directory and library name.
2443 if test "X$installed" = Xyes; then
2444 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2445 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2453 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2455 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2458 # Remove this search path later
2459 notinst_path="$notinst_path $abs_ladir"
2461 dir="$ladir/$objdir"
2462 absdir="$abs_ladir/$objdir"
2463 # Remove this search path later
2464 notinst_path="$notinst_path $abs_ladir"
2466 fi # $installed = yes
2467 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2469 # This library was specified with -dlpreopen.
2470 if test "$pass" = dlpreopen; then
2471 if test -z "$libdir"; then
2472 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2475 # Prefer using a static library (so that no silly _DYNAMIC symbols
2476 # are required to link).
2477 if test -n "$old_library"; then
2478 newdlprefiles="$newdlprefiles $dir/$old_library"
2479 # Otherwise, use the dlname, so that lt_dlopen finds it.
2480 elif test -n "$dlname"; then
2481 newdlprefiles="$newdlprefiles $dir/$dlname"
2483 newdlprefiles="$newdlprefiles $dir/$linklib"
2485 fi # $pass = dlpreopen
2487 if test -z "$libdir"; then
2488 # Link the convenience library
2489 if test "$linkmode" = lib; then
2490 deplibs="$dir/$old_library $deplibs"
2491 elif test "$linkmode,$pass" = "prog,link"; then
2492 compile_deplibs="$dir/$old_library $compile_deplibs"
2493 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2495 deplibs="$lib $deplibs" # used for prog,scan pass
2501 if test "$linkmode" = prog && test "$pass" != link; then
2502 newlib_search_path="$newlib_search_path $ladir"
2503 deplibs="$lib $deplibs"
2506 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2507 test "$build_libtool_libs" = no; then
2512 for deplib in $dependency_libs; do
2514 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2516 # Need to link against all dependency_libs?
2517 if test "$linkalldeplibs" = yes; then
2518 deplibs="$deplib $deplibs"
2520 # Need to hardcode shared library paths
2521 # or/and link against static libraries
2522 newdependency_libs="$deplib $newdependency_libs"
2524 if test "X$duplicate_deps" = "Xyes" ; then
2525 case "$tmp_libs " in
2526 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2529 tmp_libs="$tmp_libs $deplib"
2532 fi # $linkmode = prog...
2534 if test "$linkmode,$pass" = "prog,link"; then
2535 if test -n "$library_names" &&
2536 { { test "$prefer_static_libs" = no ||
2537 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2538 test -z "$old_library"; }; then
2539 # We need to hardcode the library path
2540 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2541 # Make sure the rpath contains only unique directories.
2542 case "$temp_rpath " in
2545 *) temp_rpath="$temp_rpath $absdir" ;;
2549 # Hardcode the library path.
2550 # Skip directories that are in the system default run-time
2552 case " $sys_lib_dlsearch_path " in
2555 case "$compile_rpath " in
2557 *) compile_rpath="$compile_rpath $absdir"
2561 case " $sys_lib_dlsearch_path " in
2564 case "$finalize_rpath " in
2566 *) finalize_rpath="$finalize_rpath $libdir"
2570 fi # $linkmode,$pass = prog,link...
2572 if test "$alldeplibs" = yes &&
2573 { test "$deplibs_check_method" = pass_all ||
2574 { test "$build_libtool_libs" = yes &&
2575 test -n "$library_names"; }; }; then
2576 # We only need to search for static libraries
2581 link_static=no # Whether the deplib will be linked statically
2582 use_static_libs=$prefer_static_libs
2583 if test "$use_static_libs" = built && test "$installed" = yes ; then
2586 if test -n "$library_names" &&
2587 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2588 if test "$installed" = no; then
2589 notinst_deplibs="$notinst_deplibs $lib"
2592 # This is a shared library
2594 # Warn about portability, can't link against -module's on
2595 # some systems (darwin)
2596 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2598 if test "$linkmode" = prog; then
2599 $echo "*** Warning: Linking the executable $output against the loadable module"
2601 $echo "*** Warning: Linking the shared library $output against the loadable module"
2603 $echo "*** $linklib is not portable!"
2605 if test "$linkmode" = lib &&
2606 test "$hardcode_into_libs" = yes; then
2607 # Hardcode the library path.
2608 # Skip directories that are in the system default run-time
2610 case " $sys_lib_dlsearch_path " in
2613 case "$compile_rpath " in
2615 *) compile_rpath="$compile_rpath $absdir"
2619 case " $sys_lib_dlsearch_path " in
2622 case "$finalize_rpath " in
2624 *) finalize_rpath="$finalize_rpath $libdir"
2630 if test -n "$old_archive_from_expsyms_cmds"; then
2631 # figure out the soname
2632 set dummy $library_names
2635 libname=`eval \\$echo \"$libname_spec\"`
2636 # use dlname if we got it. it's perfectly good, no?
2637 if test -n "$dlname"; then
2639 elif test -n "$soname_spec"; then
2643 major=`expr $current - $age`
2647 eval soname=\"$soname_spec\"
2652 # Make a new name for the extract_expsyms_cmds to use
2654 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2655 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2657 # If the library has no export list, then create one now
2658 if test -f "$output_objdir/$soname-def"; then :
2660 $show "extracting exported symbol list from \`$soname'"
2661 save_ifs="$IFS"; IFS='~'
2662 cmds=$extract_expsyms_cmds
2663 for cmd in $cmds; do
2667 $run eval "$cmd" || exit $?
2673 if test -f "$output_objdir/$newlib"; then :; else
2674 $show "generating import library for \`$soname'"
2675 save_ifs="$IFS"; IFS='~'
2676 cmds=$old_archive_from_expsyms_cmds
2677 for cmd in $cmds; do
2681 $run eval "$cmd" || exit $?
2685 # make sure the library variables are pointing to the new library
2688 fi # test -n "$old_archive_from_expsyms_cmds"
2690 if test "$linkmode" = prog || test "$mode" != relink; then
2695 case $hardcode_action in
2696 immediate | unsupported)
2697 if test "$hardcode_direct" = no; then
2700 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2701 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2702 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2703 *-*-unixware7*) add_dir="-L$dir" ;;
2705 # if the lib is a module then we can not link against
2706 # it, someone is ignoring the new warnings I added
2707 if /usr/bin/file -L $add 2> /dev/null |
2708 $EGREP ": [^:]* bundle" >/dev/null ; then
2709 $echo "** Warning, lib $linklib is a module, not a shared library"
2710 if test -z "$old_library" ; then
2712 $echo "** And there doesn't seem to be a static archive available"
2713 $echo "** The link will probably fail, sorry"
2715 add="$dir/$old_library"
2719 elif test "$hardcode_minus_L" = no; then
2721 *-*-sunos*) add_shlibpath="$dir" ;;
2725 elif test "$hardcode_shlibpath_var" = no; then
2726 add_shlibpath="$dir"
2733 if test "$hardcode_direct" = yes; then
2735 elif test "$hardcode_minus_L" = yes; then
2737 # Try looking first in the location we're being installed to.
2738 if test -n "$inst_prefix_dir"; then
2741 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2746 elif test "$hardcode_shlibpath_var" = yes; then
2747 add_shlibpath="$dir"
2756 if test "$lib_linked" != yes; then
2757 $echo "$modename: configuration error: unsupported hardcode properties"
2761 if test -n "$add_shlibpath"; then
2762 case :$compile_shlibpath: in
2763 *":$add_shlibpath:"*) ;;
2764 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2767 if test "$linkmode" = prog; then
2768 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2769 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2771 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2772 test -n "$add" && deplibs="$add $deplibs"
2773 if test "$hardcode_direct" != yes && \
2774 test "$hardcode_minus_L" != yes && \
2775 test "$hardcode_shlibpath_var" = yes; then
2776 case :$finalize_shlibpath: in
2778 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2784 if test "$linkmode" = prog || test "$mode" = relink; then
2788 # Finalize command for both is simple: just hardcode it.
2789 if test "$hardcode_direct" = yes; then
2790 add="$libdir/$linklib"
2791 elif test "$hardcode_minus_L" = yes; then
2794 elif test "$hardcode_shlibpath_var" = yes; then
2795 case :$finalize_shlibpath: in
2797 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2800 elif test "$hardcode_automatic" = yes; then
2801 if test -n "$inst_prefix_dir" &&
2802 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2803 add="$inst_prefix_dir$libdir/$linklib"
2805 add="$libdir/$linklib"
2808 # We cannot seem to hardcode it, guess we'll fake it.
2810 # Try looking first in the location we're being installed to.
2811 if test -n "$inst_prefix_dir"; then
2814 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2821 if test "$linkmode" = prog; then
2822 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2823 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2825 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2826 test -n "$add" && deplibs="$add $deplibs"
2829 elif test "$linkmode" = prog; then
2830 # Here we assume that one of hardcode_direct or hardcode_minus_L
2831 # is not unsupported. This is valid on all known static and
2833 if test "$hardcode_direct" != unsupported; then
2834 test -n "$old_library" && linklib="$old_library"
2835 compile_deplibs="$dir/$linklib $compile_deplibs"
2836 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2838 compile_deplibs="-l$name -L$dir $compile_deplibs"
2839 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2841 elif test "$build_libtool_libs" = yes; then
2842 # Not a shared library
2843 if test "$deplibs_check_method" != pass_all; then
2844 # We're trying link a shared library against a static one
2845 # but the system doesn't support it.
2847 # Just print a warning and add the library to dependency_libs so
2848 # that the program can be linked against the static library.
2850 $echo "*** Warning: This system can not link to static lib archive $lib."
2851 $echo "*** I have the capability to make that library automatically link in when"
2852 $echo "*** you link to this library. But I can only do this if you have a"
2853 $echo "*** shared version of the library, which you do not appear to have."
2854 if test "$module" = yes; then
2855 $echo "*** But as you try to build a module library, libtool will still create "
2856 $echo "*** a static module, that should work as long as the dlopening application"
2857 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2858 if test -z "$global_symbol_pipe"; then
2860 $echo "*** However, this would only work if libtool was able to extract symbol"
2861 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2862 $echo "*** not find such a program. So, this module is probably useless."
2863 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2865 if test "$build_old_libs" = no; then
2866 build_libtool_libs=module
2869 build_libtool_libs=no
2873 deplibs="$dir/$old_library $deplibs"
2876 fi # link shared/static library?
2878 if test "$linkmode" = lib; then
2879 if test -n "$dependency_libs" &&
2880 { test "$hardcode_into_libs" != yes ||
2881 test "$build_old_libs" = yes ||
2882 test "$link_static" = yes; }; then
2883 # Extract -R from dependency_libs
2885 for libdir in $dependency_libs; do
2887 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2889 *" $temp_xrpath "*) ;;
2890 *) xrpath="$xrpath $temp_xrpath";;
2892 *) temp_deplibs="$temp_deplibs $libdir";;
2895 dependency_libs="$temp_deplibs"
2898 newlib_search_path="$newlib_search_path $absdir"
2899 # Link against this library
2900 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2901 # ... and its dependency_libs
2903 for deplib in $dependency_libs; do
2904 newdependency_libs="$deplib $newdependency_libs"
2905 if test "X$duplicate_deps" = "Xyes" ; then
2906 case "$tmp_libs " in
2907 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2910 tmp_libs="$tmp_libs $deplib"
2913 if test "$link_all_deplibs" != no; then
2914 # Add the search paths of all dependency libraries
2915 for deplib in $dependency_libs; do
2917 -L*) path="$deplib" ;;
2919 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2920 test "X$dir" = "X$deplib" && dir="."
2921 # We need an absolute path.
2923 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2925 absdir=`cd "$dir" && pwd`
2926 if test -z "$absdir"; then
2927 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2932 if grep "^installed=no" $deplib > /dev/null; then
2933 path="$absdir/$objdir"
2935 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2936 if test -z "$libdir"; then
2937 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2940 if test "$absdir" != "$libdir"; then
2941 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2948 # we do not want to link against static libs,
2949 # but need to link against shared
2950 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2951 if test -n "$deplibrary_names" ; then
2952 for tmp in $deplibrary_names ; do
2955 if test -f "$path/$depdepl" ; then
2956 depdepl="$path/$depdepl"
2958 # do not add paths which are already there
2959 case " $newlib_search_path " in
2961 *) newlib_search_path="$newlib_search_path $path";;
2974 # Again, we only want to link against shared libraries
2975 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2976 for tmp in $newlib_search_path ; do
2977 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2978 eval depdepl="$tmp/lib$tmp_libs.dylib"
2989 case " $deplibs " in
2991 *) deplibs="$path $deplibs" ;;
2993 case " $deplibs " in
2995 *) deplibs="$depdepl $deplibs" ;;
2998 fi # link_all_deplibs != no
3000 done # for deplib in $libs
3001 dependency_libs="$newdependency_libs"
3002 if test "$pass" = dlpreopen; then
3003 # Link the dlpreopened libraries before other libraries
3004 for deplib in $save_deplibs; do
3005 deplibs="$deplib $deplibs"
3008 if test "$pass" != dlopen; then
3009 if test "$pass" != conv; then
3010 # Make sure lib_search_path contains only unique directories.
3012 for dir in $newlib_search_path; do
3013 case "$lib_search_path " in
3015 *) lib_search_path="$lib_search_path $dir" ;;
3021 if test "$linkmode,$pass" != "prog,link"; then
3024 vars="compile_deplibs finalize_deplibs"
3026 for var in $vars dependency_libs; do
3027 # Add libraries to $var in reverse order
3028 eval tmp_libs=\"\$$var\"
3030 for deplib in $tmp_libs; do
3031 # FIXME: Pedantically, this is the right thing to do, so
3032 # that some nasty dependency loop isn't accidentally
3034 #new_libs="$deplib $new_libs"
3035 # Pragmatically, this seems to cause very few problems in
3038 -L*) new_libs="$deplib $new_libs" ;;
3041 # And here is the reason: when a library appears more
3042 # than once as an explicit dependence of a library, or
3043 # is implicitly linked in more than once by the
3044 # compiler, it is considered special, and multiple
3045 # occurrences thereof are not removed. Compare this
3046 # with having the same library being listed as a
3047 # dependency of multiple other libraries: in this case,
3048 # we know (pedantically, we assume) the library does not
3049 # need to be listed more than once, so we keep only the
3050 # last copy. This is not always right, but it is rare
3051 # enough that we require users that really mean to play
3052 # such unportable linking tricks to link the library
3053 # using -Wl,-lname, so that libtool does not consider it
3054 # for duplicate removal.
3055 case " $specialdeplibs " in
3056 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3058 case " $new_libs " in
3060 *) new_libs="$deplib $new_libs" ;;
3068 for deplib in $new_libs; do
3071 case " $tmp_libs " in
3073 *) tmp_libs="$tmp_libs $deplib" ;;
3076 *) tmp_libs="$tmp_libs $deplib" ;;
3079 eval $var=\"$tmp_libs\"
3082 # Last step: remove runtime libs from dependency_libs
3083 # (they stay in deplibs)
3085 for i in $dependency_libs ; do
3086 case " $predeps $postdeps $compiler_lib_search_path " in
3091 if test -n "$i" ; then
3092 tmp_libs="$tmp_libs $i"
3095 dependency_libs=$tmp_libs
3097 if test "$linkmode" = prog; then
3098 dlfiles="$newdlfiles"
3099 dlprefiles="$newdlprefiles"
3104 if test -n "$deplibs"; then
3105 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3108 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3109 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3112 if test -n "$rpath"; then
3113 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3116 if test -n "$xrpath"; then
3117 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3120 if test -n "$vinfo"; then
3121 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3124 if test -n "$release"; then
3125 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3128 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3129 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3132 # Now set the variables for building old libraries.
3133 build_libtool_libs=no
3135 objs="$objs$old_deplibs"
3139 # Make sure we only generate libraries of the form `libNAME.la'.
3142 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3143 eval shared_ext=\"$shrext_cmds\"
3144 eval libname=\"$libname_spec\"
3147 if test "$module" = no; then
3148 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3152 if test "$need_lib_prefix" != no; then
3153 # Add the "lib" prefix for modules if required
3154 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3155 eval shared_ext=\"$shrext_cmds\"
3156 eval libname=\"$libname_spec\"
3158 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3163 if test -n "$objs"; then
3164 if test "$deplibs_check_method" != pass_all; then
3165 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3169 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3170 $echo "*** objects $objs is not portable!"
3171 libobjs="$libobjs $objs"
3175 if test "$dlself" != no; then
3176 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3180 if test "$#" -gt 2; then
3181 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3186 if test -z "$rpath"; then
3187 if test "$build_libtool_libs" = yes; then
3188 # Building a libtool convenience library.
3189 # Some compilers have problems with a `.al' extension so
3190 # convenience libraries should have the same extension an
3191 # archive normally would.
3192 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3193 build_libtool_libs=convenience
3197 if test -n "$vinfo"; then
3198 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3201 if test -n "$release"; then
3202 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3206 # Parse the version information argument.
3207 save_ifs="$IFS"; IFS=':'
3208 set dummy $vinfo 0 0 0
3211 if test -n "$8"; then
3212 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3217 # convert absolute version numbers to libtool ages
3218 # this retains compatibility with .la files and attempts
3219 # to make the code below a bit more comprehensible
3221 case $vinfo_number in
3225 number_revision="$4"
3227 # There are really only two kinds -- those that
3228 # use the current revision as the major version
3229 # and those that subtract age and use age as
3230 # a minor version. But, then there is irix
3231 # which has an extra 1 added just for fun
3233 case $version_type in
3234 darwin|linux|osf|windows|none)
3235 current=`expr $number_major + $number_minor`
3237 revision="$number_revision"
3239 freebsd-aout|freebsd-elf|sunos)
3240 current="$number_major"
3241 revision="$number_minor"
3245 current=`expr $number_major + $number_minor`
3247 revision="$number_minor"
3248 lt_irix_increment=no
3251 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3252 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3264 # Check that each of the things are valid numbers.
3266 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]) ;;
3268 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3269 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3275 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]) ;;
3277 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3278 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3284 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]) ;;
3286 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3292 if test "$age" -gt "$current"; then
3293 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3294 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3298 # Calculate the version variables.
3302 case $version_type in
3306 # Like Linux, but with the current version available in
3307 # verstring for coding it into the library header
3308 major=.`expr $current - $age`
3309 versuffix="$major.$age.$revision"
3310 # Darwin ld doesn't like 0 for these options...
3311 minor_current=`expr $current + 1`
3312 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3313 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3318 versuffix=".$current.$revision";
3323 versuffix=".$current";
3327 if test "X$lt_irix_increment" = "Xno"; then
3328 major=`expr $current - $age`
3330 major=`expr $current - $age + 1`
3332 case $version_type in
3333 nonstopux) verstring_prefix=nonstopux ;;
3334 *) verstring_prefix=sgi ;;
3336 verstring="$verstring_prefix$major.$revision"
3338 # Add in all the interfaces that we are compatible with.
3340 while test "$loop" -ne 0; do
3341 iface=`expr $revision - $loop`
3342 loop=`expr $loop - 1`
3343 verstring="$verstring_prefix$major.$iface:$verstring"
3346 # Before this point, $major must not contain `.'.
3348 versuffix="$major.$revision"
3352 major=.`expr $current - $age`
3353 versuffix="$major.$age.$revision"
3357 major=.`expr $current - $age`
3358 versuffix=".$current.$age.$revision"
3359 verstring="$current.$age.$revision"
3361 # Add in all the interfaces that we are compatible with.
3363 while test "$loop" -ne 0; do
3364 iface=`expr $current - $loop`
3365 loop=`expr $loop - 1`
3366 verstring="$verstring:${iface}.0"
3369 # Make executables depend on our current version.
3370 verstring="$verstring:${current}.0"
3375 versuffix=".$current.$revision"
3379 # Use '-' rather than '.', since we only want one
3380 # extension on DOS 8.3 filesystems.
3381 major=`expr $current - $age`
3386 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3387 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3392 # Clear the version info if we defaulted, and they specified a release.
3393 if test -z "$vinfo" && test -n "$release"; then
3395 case $version_type in
3397 # we can't check for "0.0" in archive_cmds due to quoting
3398 # problems, so we reset it completely
3405 if test "$need_version" = no; then
3412 # Remove version info from name if versioning should be avoided
3413 if test "$avoid_version" = yes && test "$need_version" = no; then
3419 # Check to see if the archive will have undefined symbols.
3420 if test "$allow_undefined" = yes; then
3421 if test "$allow_undefined_flag" = unsupported; then
3422 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3423 build_libtool_libs=no
3427 # Don't allow undefined symbols.
3428 allow_undefined_flag="$no_undefined_flag"
3432 if test "$mode" != relink; then
3433 # Remove our outputs, but don't remove object files since they
3434 # may have been created when compiling PIC objects.
3436 tempremovelist=`$echo "$output_objdir/*"`
3437 for p in $tempremovelist; do
3441 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3442 if test "X$precious_files_regex" != "X"; then
3443 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3448 removelist="$removelist $p"
3453 if test -n "$removelist"; then
3454 $show "${rm}r $removelist"
3455 $run ${rm}r $removelist
3459 # Now set the variables for building old libraries.
3460 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3461 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3463 # Transform .lo files to .o files.
3464 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3467 # Eliminate all temporary directories.
3468 #for path in $notinst_path; do
3469 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3470 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3471 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3474 if test -n "$xrpath"; then
3475 # If the user specified any rpath flags, then add them.
3477 for libdir in $xrpath; do
3478 temp_xrpath="$temp_xrpath -R$libdir"
3479 case "$finalize_rpath " in
3481 *) finalize_rpath="$finalize_rpath $libdir" ;;
3484 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3485 dependency_libs="$temp_xrpath $dependency_libs"
3489 # Make sure dlfiles contains only unique files that won't be dlpreopened
3490 old_dlfiles="$dlfiles"
3492 for lib in $old_dlfiles; do
3493 case " $dlprefiles $dlfiles " in
3495 *) dlfiles="$dlfiles $lib" ;;
3499 # Make sure dlprefiles contains only unique files
3500 old_dlprefiles="$dlprefiles"
3502 for lib in $old_dlprefiles; do
3503 case "$dlprefiles " in
3505 *) dlprefiles="$dlprefiles $lib" ;;
3509 if test "$build_libtool_libs" = yes; then
3510 if test -n "$rpath"; then
3512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3513 # these systems don't actually have a c library (as such)!
3515 *-*-rhapsody* | *-*-darwin1.[012])
3516 # Rhapsody C library is in the System framework
3517 deplibs="$deplibs -framework System"
3520 # Don't link with libc until the a.out ld.so is fixed.
3522 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3523 # Do not include libc due to us having libc/libc_r.
3525 *-*-sco3.2v5* | *-*-sco5v6*)
3526 # Causes problems with __ctype
3528 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3529 # Compiler inserts libc in the correct place for threads to work
3532 # Add libc to deplibs on all other systems if necessary.
3533 if test "$build_libtool_need_lc" = "yes"; then
3534 deplibs="$deplibs -lc"
3540 # Transform deplibs into only deplibs that can be linked in shared.
3542 libname_save=$libname
3543 release_save=$release
3544 versuffix_save=$versuffix
3546 # I'm not sure if I'm treating the release correctly. I think
3547 # release should show up in the -l (ie -lgmp5) so we don't want to
3548 # add it in twice. Is that correct?
3554 case $deplibs_check_method in
3556 # Don't check for shared/static. Everything works.
3557 # This might be a little naive. We might want to check
3558 # whether the library exists or not. But this is on
3559 # osf3 & osf4 and I'm not really sure... Just
3560 # implementing what was already the behavior.
3564 # This code stresses the "libraries are programs" paradigm to its
3565 # limits. Maybe even breaks it. We compile a program, linking it
3566 # against the deplibs as a proxy for the library. Then we can check
3567 # whether they linked in statically or dynamically with ldd.
3569 cat > conftest.c <<EOF
3570 int main() { return 0; }
3573 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3574 ldd_output=`ldd conftest`
3575 for i in $deplibs; do
3576 name=`expr $i : '-l\(.*\)'`
3577 # If $name is empty we are operating on a -L argument.
3578 if test "$name" != "" && test "$name" != "0"; then
3579 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3580 case " $predeps $postdeps " in
3582 newdeplibs="$newdeplibs $i"
3587 if test -n "$i" ; then
3588 libname=`eval \\$echo \"$libname_spec\"`
3589 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3590 set dummy $deplib_matches
3592 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3593 newdeplibs="$newdeplibs $i"
3597 $echo "*** Warning: dynamic linker does not accept needed library $i."
3598 $echo "*** I have the capability to make that library automatically link in when"
3599 $echo "*** you link to this library. But I can only do this if you have a"
3600 $echo "*** shared version of the library, which I believe you do not have"
3601 $echo "*** because a test_compile did reveal that the linker did not use it for"
3602 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3606 newdeplibs="$newdeplibs $i"
3610 # Error occurred in the first compile. Let's try to salvage
3611 # the situation: Compile a separate program for each library.
3612 for i in $deplibs; do
3613 name=`expr $i : '-l\(.*\)'`
3614 # If $name is empty we are operating on a -L argument.
3615 if test "$name" != "" && test "$name" != "0"; then
3617 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3618 ldd_output=`ldd conftest`
3619 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3620 case " $predeps $postdeps " in
3622 newdeplibs="$newdeplibs $i"
3627 if test -n "$i" ; then
3628 libname=`eval \\$echo \"$libname_spec\"`
3629 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3630 set dummy $deplib_matches
3632 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3633 newdeplibs="$newdeplibs $i"
3637 $echo "*** Warning: dynamic linker does not accept needed library $i."
3638 $echo "*** I have the capability to make that library automatically link in when"
3639 $echo "*** you link to this library. But I can only do this if you have a"
3640 $echo "*** shared version of the library, which you do not appear to have"
3641 $echo "*** because a test_compile did reveal that the linker did not use this one"
3642 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3648 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3649 $echo "*** make it link in! You will probably need to install it or some"
3650 $echo "*** library that it depends on before this library will be fully"
3651 $echo "*** functional. Installing it before continuing would be even better."
3654 newdeplibs="$newdeplibs $i"
3660 set dummy $deplibs_check_method
3661 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3662 for a_deplib in $deplibs; do
3663 name=`expr $a_deplib : '-l\(.*\)'`
3664 # If $name is empty we are operating on a -L argument.
3665 if test "$name" != "" && test "$name" != "0"; then
3666 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3667 case " $predeps $postdeps " in
3669 newdeplibs="$newdeplibs $a_deplib"
3674 if test -n "$a_deplib" ; then
3675 libname=`eval \\$echo \"$libname_spec\"`
3676 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3677 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3678 for potent_lib in $potential_libs; do
3679 # Follow soft links.
3680 if ls -lLd "$potent_lib" 2>/dev/null \
3681 | grep " -> " >/dev/null; then
3684 # The statement above tries to avoid entering an
3685 # endless loop below, in case of cyclic links.
3686 # We might still enter an endless loop, since a link
3687 # loop can be closed while we follow links,
3689 potlib="$potent_lib"
3690 while test -h "$potlib" 2>/dev/null; do
3691 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3693 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3694 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3697 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3699 | $EGREP "$file_magic_regex" > /dev/null; then
3700 newdeplibs="$newdeplibs $a_deplib"
3707 if test -n "$a_deplib" ; then
3710 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3711 $echo "*** I have the capability to make that library automatically link in when"
3712 $echo "*** you link to this library. But I can only do this if you have a"
3713 $echo "*** shared version of the library, which you do not appear to have"
3714 $echo "*** because I did check the linker path looking for a file starting"
3715 if test -z "$potlib" ; then
3716 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3718 $echo "*** with $libname and none of the candidates passed a file format test"
3719 $echo "*** using a file magic. Last file checked: $potlib"
3723 # Add a -L argument.
3724 newdeplibs="$newdeplibs $a_deplib"
3726 done # Gone through all deplibs.
3729 set dummy $deplibs_check_method
3730 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3731 for a_deplib in $deplibs; do
3732 name=`expr $a_deplib : '-l\(.*\)'`
3733 # If $name is empty we are operating on a -L argument.
3734 if test -n "$name" && test "$name" != "0"; then
3735 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3736 case " $predeps $postdeps " in
3738 newdeplibs="$newdeplibs $a_deplib"
3743 if test -n "$a_deplib" ; then
3744 libname=`eval \\$echo \"$libname_spec\"`
3745 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3746 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3747 for potent_lib in $potential_libs; do
3748 potlib="$potent_lib" # see symlink-check above in file_magic test
3749 if eval $echo \"$potent_lib\" 2>/dev/null \
3751 | $EGREP "$match_pattern_regex" > /dev/null; then
3752 newdeplibs="$newdeplibs $a_deplib"
3759 if test -n "$a_deplib" ; then
3762 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3763 $echo "*** I have the capability to make that library automatically link in when"
3764 $echo "*** you link to this library. But I can only do this if you have a"
3765 $echo "*** shared version of the library, which you do not appear to have"
3766 $echo "*** because I did check the linker path looking for a file starting"
3767 if test -z "$potlib" ; then
3768 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3770 $echo "*** with $libname and none of the candidates passed a file format test"
3771 $echo "*** using a regex pattern. Last file checked: $potlib"
3775 # Add a -L argument.
3776 newdeplibs="$newdeplibs $a_deplib"
3778 done # Gone through all deplibs.
3782 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3783 -e 's/ -[LR][^ ]*//g'`
3784 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3785 for i in $predeps $postdeps ; do
3786 # can't use Xsed below, because $i might contain '/'
3787 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3790 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3791 | grep . >/dev/null; then
3793 if test "X$deplibs_check_method" = "Xnone"; then
3794 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3796 $echo "*** Warning: inter-library dependencies are not known to be supported."
3798 $echo "*** All declared inter-library dependencies are being dropped."
3803 versuffix=$versuffix_save
3805 release=$release_save
3806 libname=$libname_save
3810 *-*-rhapsody* | *-*-darwin1.[012])
3811 # On Rhapsody replace the C library is the System framework
3812 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3816 if test "$droppeddeps" = yes; then
3817 if test "$module" = yes; then
3819 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3820 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3821 $echo "*** a static module, that should work as long as the dlopening"
3822 $echo "*** application is linked with the -dlopen flag."
3823 if test -z "$global_symbol_pipe"; then
3825 $echo "*** However, this would only work if libtool was able to extract symbol"
3826 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3827 $echo "*** not find such a program. So, this module is probably useless."
3828 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3830 if test "$build_old_libs" = no; then
3831 oldlibs="$output_objdir/$libname.$libext"
3832 build_libtool_libs=module
3835 build_libtool_libs=no
3838 $echo "*** The inter-library dependencies that have been dropped here will be"
3839 $echo "*** automatically added whenever a program is linked with this library"
3840 $echo "*** or is declared to -dlopen it."
3842 if test "$allow_undefined" = no; then
3844 $echo "*** Since this library must not contain undefined symbols,"
3845 $echo "*** because either the platform does not support them or"
3846 $echo "*** it was explicitly requested with -no-undefined,"
3847 $echo "*** libtool will only create a static version of it."
3848 if test "$build_old_libs" = no; then
3849 oldlibs="$output_objdir/$libname.$libext"
3850 build_libtool_libs=module
3853 build_libtool_libs=no
3858 # Done checking deplibs!
3863 # move library search paths that coincide with paths to not yet
3864 # installed libraries to the beginning of the library search list
3866 for path in $notinst_path; do
3867 case " $new_libs " in
3868 *" -L$path/$objdir "*) ;;
3870 case " $deplibs " in
3871 *" -L$path/$objdir "*)
3872 new_libs="$new_libs -L$path/$objdir" ;;
3877 for deplib in $deplibs; do
3880 case " $new_libs " in
3882 *) new_libs="$new_libs $deplib" ;;
3885 *) new_libs="$new_libs $deplib" ;;
3891 # All the library-specific variables (install_libdir is set above).
3896 # Test again, we may have decided not to build it any more
3897 if test "$build_libtool_libs" = yes; then
3898 if test "$hardcode_into_libs" = yes; then
3899 # Hardcode the library paths
3902 rpath="$finalize_rpath"
3903 test "$mode" != relink && rpath="$compile_rpath$rpath"
3904 for libdir in $rpath; do
3905 if test -n "$hardcode_libdir_flag_spec"; then
3906 if test -n "$hardcode_libdir_separator"; then
3907 if test -z "$hardcode_libdirs"; then
3908 hardcode_libdirs="$libdir"
3910 # Just accumulate the unique libdirs.
3911 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3912 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3915 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3920 eval flag=\"$hardcode_libdir_flag_spec\"
3921 dep_rpath="$dep_rpath $flag"
3923 elif test -n "$runpath_var"; then
3924 case "$perm_rpath " in
3926 *) perm_rpath="$perm_rpath $libdir" ;;
3930 # Substitute the hardcoded libdirs into the rpath.
3931 if test -n "$hardcode_libdir_separator" &&
3932 test -n "$hardcode_libdirs"; then
3933 libdir="$hardcode_libdirs"
3934 if test -n "$hardcode_libdir_flag_spec_ld"; then
3935 case $archive_cmds in
3936 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3937 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3940 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3943 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3944 # We should set the runpath_var.
3946 for dir in $perm_rpath; do
3949 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3951 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3954 shlibpath="$finalize_shlibpath"
3955 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3956 if test -n "$shlibpath"; then
3957 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3960 # Get the real and link names of the library.
3961 eval shared_ext=\"$shrext_cmds\"
3962 eval library_names=\"$library_names_spec\"
3963 set dummy $library_names
3967 if test -n "$soname_spec"; then
3968 eval soname=\"$soname_spec\"
3972 if test -z "$dlname"; then
3976 lib="$output_objdir/$realname"
3980 linknames="$linknames $link"
3983 # Use standard objects if they are pic
3984 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3986 # Prepare the list of exported symbols
3987 if test -z "$export_symbols"; then
3988 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3989 $show "generating symbol list for \`$libname.la'"
3990 export_symbols="$output_objdir/$libname.exp"
3991 $run $rm $export_symbols
3992 cmds=$export_symbols_cmds
3993 save_ifs="$IFS"; IFS='~'
3994 for cmd in $cmds; do
3997 if len=`expr "X$cmd" : ".*"` &&
3998 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4000 $run eval "$cmd" || exit $?
4001 skipped_export=false
4003 # The command line is too long to execute in one step.
4004 $show "using reloadable object file for export list..."
4006 # Break out early, otherwise skipped_export may be
4007 # set to false by a later but shorter cmd.
4012 if test -n "$export_symbols_regex"; then
4013 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4014 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4015 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4016 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4021 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4022 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4026 for test_deplib in $deplibs; do
4027 case " $convenience " in
4028 *" $test_deplib "*) ;;
4030 tmp_deplibs="$tmp_deplibs $test_deplib"
4034 deplibs="$tmp_deplibs"
4036 if test -n "$convenience"; then
4037 if test -n "$whole_archive_flag_spec"; then
4038 save_libobjs=$libobjs
4039 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4041 gentop="$output_objdir/${outputname}x"
4042 generated="$generated $gentop"
4044 func_extract_archives $gentop $convenience
4045 libobjs="$libobjs $func_extract_archives_result"
4049 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4050 eval flag=\"$thread_safe_flag_spec\"
4051 linker_flags="$linker_flags $flag"
4054 # Make a backup of the uninstalled library when relinking
4055 if test "$mode" = relink; then
4056 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4059 # Do each of the archive commands.
4060 if test "$module" = yes && test -n "$module_cmds" ; then
4061 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4062 eval test_cmds=\"$module_expsym_cmds\"
4063 cmds=$module_expsym_cmds
4065 eval test_cmds=\"$module_cmds\"
4069 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4070 eval test_cmds=\"$archive_expsym_cmds\"
4071 cmds=$archive_expsym_cmds
4073 eval test_cmds=\"$archive_cmds\"
4078 if test "X$skipped_export" != "X:" &&
4079 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4080 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4083 # The command line is too long to link in one step, link piecewise.
4084 $echo "creating reloadable object files..."
4086 # Save the value of $output and $libobjs because we want to
4087 # use them later. If we have whole_archive_flag_spec, we
4088 # want to use save_libobjs as it was before
4089 # whole_archive_flag_spec was expanded, because we can't
4090 # assume the linker understands whole_archive_flag_spec.
4091 # This may have to be revisited, in case too many
4092 # convenience libraries get linked in and end up exceeding
4094 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4095 save_libobjs=$libobjs
4098 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4100 # Clear the reloadable object creation command queue and
4101 # initialize k to one.
4108 output=$output_objdir/$output_la-${k}.$objext
4109 # Loop over the list of objects to be linked.
4110 for obj in $save_libobjs
4112 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4113 if test "X$objlist" = X ||
4114 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4115 test "$len" -le "$max_cmd_len"; }; then
4116 objlist="$objlist $obj"
4118 # The command $test_cmds is almost too long, add a
4119 # command to the queue.
4120 if test "$k" -eq 1 ; then
4121 # The first file doesn't have a previous command to add.
4122 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4124 # All subsequent reloadable object files will link in
4125 # the last one created.
4126 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4128 last_robj=$output_objdir/$output_la-${k}.$objext
4130 output=$output_objdir/$output_la-${k}.$objext
4135 # Handle the remaining objects by creating one last
4136 # reloadable object file. All subsequent reloadable object
4137 # files will link in the last one created.
4138 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4139 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4141 if ${skipped_export-false}; then
4142 $show "generating symbol list for \`$libname.la'"
4143 export_symbols="$output_objdir/$libname.exp"
4144 $run $rm $export_symbols
4146 # Append the command to create the export file.
4147 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4150 # Set up a command to remove the reloadable object files
4151 # after they are used.
4153 while test "$i" -lt "$k"
4156 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4159 $echo "creating a temporary reloadable object file: $output"
4161 # Loop through the commands generated above and execute them.
4162 save_ifs="$IFS"; IFS='~'
4163 for cmd in $concat_cmds; do
4166 $run eval "$cmd" || exit $?
4171 # Restore the value of output.
4174 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4175 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4177 # Expand the library linking commands again to reset the
4178 # value of $libobjs for piecewise linking.
4180 # Do each of the archive commands.
4181 if test "$module" = yes && test -n "$module_cmds" ; then
4182 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4183 cmds=$module_expsym_cmds
4188 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4189 cmds=$archive_expsym_cmds
4195 # Append the command to remove the reloadable object files
4196 # to the just-reset $cmds.
4197 eval cmds=\"\$cmds~\$rm $delfiles\"
4199 save_ifs="$IFS"; IFS='~'
4200 for cmd in $cmds; do
4204 $run eval "$cmd" || {
4207 # Restore the uninstalled library and exit
4208 if test "$mode" = relink; then
4209 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4217 # Restore the uninstalled library and exit
4218 if test "$mode" = relink; then
4219 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4221 if test -n "$convenience"; then
4222 if test -z "$whole_archive_flag_spec"; then
4223 $show "${rm}r $gentop"
4224 $run ${rm}r "$gentop"
4231 # Create links to the real library.
4232 for linkname in $linknames; do
4233 if test "$realname" != "$linkname"; then
4234 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4235 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4239 # If -module or -export-dynamic was specified, set the dlname.
4240 if test "$module" = yes || test "$export_dynamic" = yes; then
4241 # On all known operating systems, these are identical.
4248 if test -n "$deplibs"; then
4249 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4252 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4253 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4256 if test -n "$rpath"; then
4257 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4260 if test -n "$xrpath"; then
4261 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4264 if test -n "$vinfo"; then
4265 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4268 if test -n "$release"; then
4269 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4274 if test -n "$objs$old_deplibs"; then
4275 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4279 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4287 # Delete the old objects.
4288 $run $rm $obj $libobj
4290 # Objects from convenience libraries. This assumes
4291 # single-version convenience libraries. Whenever we create
4292 # different ones for PIC/non-PIC, this we'll have to duplicate
4296 # reload_cmds runs $LD directly, so let us get rid of
4297 # -Wl from whole_archive_flag_spec and hope we can get by with
4298 # turning comma into space..
4301 if test -n "$convenience"; then
4302 if test -n "$whole_archive_flag_spec"; then
4303 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4304 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4306 gentop="$output_objdir/${obj}x"
4307 generated="$generated $gentop"
4309 func_extract_archives $gentop $convenience
4310 reload_conv_objs="$reload_objs $func_extract_archives_result"
4314 # Create the old-style object.
4315 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4319 save_ifs="$IFS"; IFS='~'
4320 for cmd in $cmds; do
4324 $run eval "$cmd" || exit $?
4328 # Exit if we aren't doing a library object file.
4329 if test -z "$libobj"; then
4330 if test -n "$gentop"; then
4331 $show "${rm}r $gentop"
4338 if test "$build_libtool_libs" != yes; then
4339 if test -n "$gentop"; then
4340 $show "${rm}r $gentop"
4344 # Create an invalid libtool object if no PIC, so that we don't
4345 # accidentally link it into a program.
4346 # $show "echo timestamp > $libobj"
4347 # $run eval "echo timestamp > $libobj" || exit $?
4351 if test -n "$pic_flag" || test "$pic_mode" != default; then
4352 # Only do commands if we really have different PIC objects.
4353 reload_objs="$libobjs $reload_conv_objs"
4356 save_ifs="$IFS"; IFS='~'
4357 for cmd in $cmds; do
4361 $run eval "$cmd" || exit $?
4366 if test -n "$gentop"; then
4367 $show "${rm}r $gentop"
4376 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4378 if test -n "$vinfo"; then
4379 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4382 if test -n "$release"; then
4383 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4386 if test "$preload" = yes; then
4387 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4388 test "$dlopen_self_static" = unknown; then
4389 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4394 *-*-rhapsody* | *-*-darwin1.[012])
4395 # On Rhapsody replace the C library is the System framework
4396 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4397 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4403 # Don't allow lazy linking, it breaks C++ global constructors
4404 if test "$tagname" = CXX ; then
4405 compile_command="$compile_command ${wl}-bind_at_load"
4406 finalize_command="$finalize_command ${wl}-bind_at_load"
4412 # move library search paths that coincide with paths to not yet
4413 # installed libraries to the beginning of the library search list
4415 for path in $notinst_path; do
4416 case " $new_libs " in
4417 *" -L$path/$objdir "*) ;;
4419 case " $compile_deplibs " in
4420 *" -L$path/$objdir "*)
4421 new_libs="$new_libs -L$path/$objdir" ;;
4426 for deplib in $compile_deplibs; do
4429 case " $new_libs " in
4431 *) new_libs="$new_libs $deplib" ;;
4434 *) new_libs="$new_libs $deplib" ;;
4437 compile_deplibs="$new_libs"
4440 compile_command="$compile_command $compile_deplibs"
4441 finalize_command="$finalize_command $finalize_deplibs"
4443 if test -n "$rpath$xrpath"; then
4444 # If the user specified any rpath flags, then add them.
4445 for libdir in $rpath $xrpath; do
4446 # This is the magic to use -rpath.
4447 case "$finalize_rpath " in
4449 *) finalize_rpath="$finalize_rpath $libdir" ;;
4454 # Now hardcode the library paths
4457 for libdir in $compile_rpath $finalize_rpath; do
4458 if test -n "$hardcode_libdir_flag_spec"; then
4459 if test -n "$hardcode_libdir_separator"; then
4460 if test -z "$hardcode_libdirs"; then
4461 hardcode_libdirs="$libdir"
4463 # Just accumulate the unique libdirs.
4464 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4465 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4468 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4473 eval flag=\"$hardcode_libdir_flag_spec\"
4474 rpath="$rpath $flag"
4476 elif test -n "$runpath_var"; then
4477 case "$perm_rpath " in
4479 *) perm_rpath="$perm_rpath $libdir" ;;
4483 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4484 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4485 case :$dllsearchpath: in
4487 *) dllsearchpath="$dllsearchpath:$libdir";;
4489 case :$dllsearchpath: in
4490 *":$testbindir:"*) ;;
4491 *) dllsearchpath="$dllsearchpath:$testbindir";;
4496 # Substitute the hardcoded libdirs into the rpath.
4497 if test -n "$hardcode_libdir_separator" &&
4498 test -n "$hardcode_libdirs"; then
4499 libdir="$hardcode_libdirs"
4500 eval rpath=\" $hardcode_libdir_flag_spec\"
4502 compile_rpath="$rpath"
4506 for libdir in $finalize_rpath; do
4507 if test -n "$hardcode_libdir_flag_spec"; then
4508 if test -n "$hardcode_libdir_separator"; then
4509 if test -z "$hardcode_libdirs"; then
4510 hardcode_libdirs="$libdir"
4512 # Just accumulate the unique libdirs.
4513 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4514 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4517 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4522 eval flag=\"$hardcode_libdir_flag_spec\"
4523 rpath="$rpath $flag"
4525 elif test -n "$runpath_var"; then
4526 case "$finalize_perm_rpath " in
4528 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4532 # Substitute the hardcoded libdirs into the rpath.
4533 if test -n "$hardcode_libdir_separator" &&
4534 test -n "$hardcode_libdirs"; then
4535 libdir="$hardcode_libdirs"
4536 eval rpath=\" $hardcode_libdir_flag_spec\"
4538 finalize_rpath="$rpath"
4540 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4541 # Transform all the library objects into standard objects.
4542 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4543 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4547 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4548 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4549 dlsyms="${outputname}S.c"
4551 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4555 if test -n "$dlsyms"; then
4559 # Discover the nlist of each of the dlfiles.
4560 nlist="$output_objdir/${outputname}.nm"
4562 $show "$rm $nlist ${nlist}S ${nlist}T"
4563 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4565 # Parse the name list into a source file.
4566 $show "creating $output_objdir/$dlsyms"
4568 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4569 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4570 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4576 /* Prevent the only kind of declaration conflicts we can make. */
4577 #define lt_preloaded_symbols some_other_symbol
4579 /* External symbol declarations for the compiler. */\
4582 if test "$dlself" = yes; then
4583 $show "generating symbol list for \`$output'"
4585 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4587 # Add our own program objects to the symbol list.
4588 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4589 for arg in $progfiles; do
4590 $show "extracting global C symbols from \`$arg'"
4591 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4594 if test -n "$exclude_expsyms"; then
4595 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4596 $run eval '$mv "$nlist"T "$nlist"'
4599 if test -n "$export_symbols_regex"; then
4600 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4601 $run eval '$mv "$nlist"T "$nlist"'
4604 # Prepare the list of exported symbols
4605 if test -z "$export_symbols"; then
4606 export_symbols="$output_objdir/$outputname.exp"
4607 $run $rm $export_symbols
4608 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4610 *cygwin* | *mingw* )
4611 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4612 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4616 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4617 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4618 $run eval 'mv "$nlist"T "$nlist"'
4620 *cygwin* | *mingw* )
4621 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4622 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4628 for arg in $dlprefiles; do
4629 $show "extracting global C symbols from \`$arg'"
4630 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4631 $run eval '$echo ": $name " >> "$nlist"'
4632 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4635 if test -z "$run"; then
4636 # Make sure we have at least an empty file.
4637 test -f "$nlist" || : > "$nlist"
4639 if test -n "$exclude_expsyms"; then
4640 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4641 $mv "$nlist"T "$nlist"
4644 # Try sorting and uniquifying the output.
4645 if grep -v "^: " < "$nlist" |
4646 if sort -k 3 </dev/null >/dev/null 2>&1; then
4651 uniq > "$nlist"S; then
4654 grep -v "^: " < "$nlist" > "$nlist"S
4657 if test -f "$nlist"S; then
4658 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4660 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4663 $echo >> "$output_objdir/$dlsyms" "\
4665 #undef lt_preloaded_symbols
4667 #if defined (__STDC__) && __STDC__
4668 # define lt_ptr void *
4670 # define lt_ptr char *
4674 /* The mapping between symbol names and symbols. */
4678 *cygwin* | *mingw* )
4679 $echo >> "$output_objdir/$dlsyms" "\
4680 /* DATA imports from DLLs on WIN32 can't be const, because
4681 runtime relocations are performed -- see ld's documentation
4687 $echo >> "$output_objdir/$dlsyms" "\
4694 $echo >> "$output_objdir/$dlsyms" "\
4698 lt_preloaded_symbols[] =
4702 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4704 $echo >> "$output_objdir/$dlsyms" "\
4708 /* This works around a problem in FreeBSD linker */
4709 #ifdef FREEBSD_WORKAROUND
4710 static const void *lt_preloaded_setup() {
4711 return lt_preloaded_symbols;
4721 pic_flag_for_symtable=
4723 # compiling the symbol table file with pic_flag works around
4724 # a FreeBSD bug that causes programs to crash when -lm is
4725 # linked before any other PIC object. But we must not use
4726 # pic_flag when linking with -static. The problem exists in
4727 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4728 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4729 case "$compile_command " in
4731 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4734 case "$compile_command " in
4736 *) pic_flag_for_symtable=" $pic_flag";;
4740 # Now compile the dynamic symbol file.
4741 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4742 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4744 # Clean up the generated files.
4745 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4746 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4748 # Transform the symbol file into the correct name.
4750 *cygwin* | *mingw* )
4751 if test -f "$output_objdir/${outputname}.def" ; then
4752 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4753 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4755 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4756 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4760 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4761 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4766 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4771 # We keep going just in case the user didn't refer to
4772 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4773 # really was required.
4775 # Nullify the symbol file.
4776 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4777 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4780 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4781 # Replace the output file specification.
4782 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4783 link_command="$compile_command$compile_rpath"
4785 # We have no uninstalled library dependencies, so finalize right now.
4786 $show "$link_command"
4787 $run eval "$link_command"
4790 # Delete the generated files.
4791 if test -n "$dlsyms"; then
4792 $show "$rm $output_objdir/${outputname}S.${objext}"
4793 $run $rm "$output_objdir/${outputname}S.${objext}"
4799 if test -n "$shlibpath_var"; then
4800 # We should set the shlibpath_var
4802 for dir in $temp_rpath; do
4804 [\\/]* | [A-Za-z]:[\\/]*)
4809 # Relative path: add a thisdir entry.
4810 rpath="$rpath\$thisdir/$dir:"
4817 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4818 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4820 if test -n "$finalize_shlibpath"; then
4821 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4826 if test -n "$runpath_var"; then
4827 if test -n "$perm_rpath"; then
4828 # We should set the runpath_var.
4830 for dir in $perm_rpath; do
4833 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4835 if test -n "$finalize_perm_rpath"; then
4836 # We should set the runpath_var.
4838 for dir in $finalize_perm_rpath; do
4841 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4845 if test "$no_install" = yes; then
4846 # We don't need to create a wrapper script.
4847 link_command="$compile_var$compile_command$compile_rpath"
4848 # Replace the output file specification.
4849 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4850 # Delete the old output file.
4852 # Link the executable and exit
4853 $show "$link_command"
4854 $run eval "$link_command" || exit $?
4858 if test "$hardcode_action" = relink; then
4859 # Fast installation is not supported
4860 link_command="$compile_var$compile_command$compile_rpath"
4861 relink_command="$finalize_var$finalize_command$finalize_rpath"
4863 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4864 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4866 if test "$fast_install" != no; then
4867 link_command="$finalize_var$compile_command$finalize_rpath"
4868 if test "$fast_install" = yes; then
4869 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4871 # fast_install is set to needless
4875 link_command="$compile_var$compile_command$compile_rpath"
4876 relink_command="$finalize_var$finalize_command$finalize_rpath"
4880 # Replace the output file specification.
4881 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4883 # Delete the old output files.
4884 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4886 $show "$link_command"
4887 $run eval "$link_command" || exit $?
4889 # Now create the wrapper script.
4890 $show "creating $output"
4892 # Quote the relink command for shipping.
4893 if test -n "$relink_command"; then
4894 # Preserve any variables that may affect compiler behavior
4895 for var in $variables_saved_for_relink; do
4896 if eval test -z \"\${$var+set}\"; then
4897 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4898 elif eval var_value=\$$var; test -z "$var_value"; then
4899 relink_command="$var=; export $var; $relink_command"
4901 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4902 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4905 relink_command="(cd `pwd`; $relink_command)"
4906 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4909 # Quote $echo for shipping.
4910 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4912 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4913 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4915 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4917 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4920 # Only actually do things if our run command is non-null.
4921 if test -z "$run"; then
4922 # win32 will think the script is a binary if it has
4923 # a .exe suffix, so we strip it off here.
4925 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4927 # test for cygwin because mv fails w/o .exe extensions
4931 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4935 *cygwin* | *mingw* )
4936 output_name=`basename $output`
4937 output_path=`dirname $output`
4938 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4939 cwrapper="$output_path/$output_name.exe"
4940 $rm $cwrappersource $cwrapper
4941 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4943 cat > $cwrappersource <<EOF
4945 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4946 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4948 The $output program cannot be directly executed until all the libtool
4949 libraries that it depends on are installed.
4951 This wrapper executable should never be moved out of the build directory.
4952 If it is, it will not operate correctly.
4954 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4955 but could eventually absorb all of the scripts functionality and
4956 exec $objdir/$outputname directly.
4959 cat >> $cwrappersource<<"EOF"
4968 #include <sys/stat.h>
4970 #if defined(PATH_MAX)
4971 # define LT_PATHMAX PATH_MAX
4972 #elif defined(MAXPATHLEN)
4973 # define LT_PATHMAX MAXPATHLEN
4975 # define LT_PATHMAX 1024
4978 #ifndef DIR_SEPARATOR
4979 # define DIR_SEPARATOR '/'
4980 # define PATH_SEPARATOR ':'
4983 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4985 # define HAVE_DOS_BASED_FILE_SYSTEM
4986 # ifndef DIR_SEPARATOR_2
4987 # define DIR_SEPARATOR_2 '\\'
4989 # ifndef PATH_SEPARATOR_2
4990 # define PATH_SEPARATOR_2 ';'
4994 #ifndef DIR_SEPARATOR_2
4995 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4996 #else /* DIR_SEPARATOR_2 */
4997 # define IS_DIR_SEPARATOR(ch) \
4998 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4999 #endif /* DIR_SEPARATOR_2 */
5001 #ifndef PATH_SEPARATOR_2
5002 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5003 #else /* PATH_SEPARATOR_2 */
5004 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5005 #endif /* PATH_SEPARATOR_2 */
5007 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5008 #define XFREE(stale) do { \
5009 if (stale) { free ((void *) stale); stale = 0; } \
5012 /* -DDEBUG is fairly common in CFLAGS. */
5014 #if defined DEBUGWRAPPER
5015 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5017 # define DEBUG(format, ...)
5020 const char *program_name = NULL;
5022 void * xmalloc (size_t num);
5023 char * xstrdup (const char *string);
5024 const char * base_name (const char *name);
5025 char * find_executable(const char *wrapper);
5026 int check_executable(const char *path);
5027 char * strendzap(char *str, const char *pat);
5028 void lt_fatal (const char *message, ...);
5031 main (int argc, char *argv[])
5036 program_name = (char *) xstrdup (base_name (argv[0]));
5037 DEBUG("(main) argv[0] : %s\n",argv[0]);
5038 DEBUG("(main) program_name : %s\n",program_name);
5039 newargz = XMALLOC(char *, argc+2);
5042 cat >> $cwrappersource <<EOF
5043 newargz[0] = (char *) xstrdup("$SHELL");
5046 cat >> $cwrappersource <<"EOF"
5047 newargz[1] = find_executable(argv[0]);
5048 if (newargz[1] == NULL)
5049 lt_fatal("Couldn't find %s", argv[0]);
5050 DEBUG("(main) found exe at : %s\n",newargz[1]);
5051 /* we know the script has the same name, without the .exe */
5052 /* so make sure newargz[1] doesn't end in .exe */
5053 strendzap(newargz[1],".exe");
5054 for (i = 1; i < argc; i++)
5055 newargz[i+1] = xstrdup(argv[i]);
5056 newargz[argc+1] = NULL;
5058 for (i=0; i<argc+1; i++)
5060 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5068 cat >> $cwrappersource <<EOF
5069 execv("$SHELL",(char const **)newargz);
5073 cat >> $cwrappersource <<EOF
5074 execv("$SHELL",newargz);
5079 cat >> $cwrappersource <<"EOF"
5084 xmalloc (size_t num)
5086 void * p = (void *) malloc (num);
5088 lt_fatal ("Memory exhausted");
5094 xstrdup (const char *string)
5096 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5101 base_name (const char *name)
5105 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5106 /* Skip over the disk name in MSDOS pathnames. */
5107 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5111 for (base = name; *name; name++)
5112 if (IS_DIR_SEPARATOR (*name))
5118 check_executable(const char * path)
5122 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5123 if ((!path) || (!*path))
5126 if ((stat (path, &st) >= 0) &&
5128 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5129 #if defined (S_IXOTH)
5130 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5132 #if defined (S_IXGRP)
5133 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5135 ((st.st_mode & S_IXUSR) == S_IXUSR))
5142 /* Searches for the full path of the wrapper. Returns
5143 newly allocated full path name if found, NULL otherwise */
5145 find_executable (const char* wrapper)
5150 /* static buffer for getcwd */
5151 char tmp[LT_PATHMAX + 1];
5155 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5157 if ((wrapper == NULL) || (*wrapper == '\0'))
5160 /* Absolute path? */
5161 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5162 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5164 concat_name = xstrdup (wrapper);
5165 if (check_executable(concat_name))
5172 if (IS_DIR_SEPARATOR (wrapper[0]))
5174 concat_name = xstrdup (wrapper);
5175 if (check_executable(concat_name))
5179 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5183 for (p = wrapper; *p; p++)
5191 /* no slashes; search PATH */
5192 const char* path = getenv ("PATH");
5195 for (p = path; *p; p = p_next)
5199 for (q = p; *q; q++)
5200 if (IS_PATH_SEPARATOR(*q))
5203 p_next = (*q == '\0' ? q : q + 1);
5206 /* empty path: current directory */
5207 if (getcwd (tmp, LT_PATHMAX) == NULL)
5208 lt_fatal ("getcwd failed");
5209 tmp_len = strlen(tmp);
5210 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5211 memcpy (concat_name, tmp, tmp_len);
5212 concat_name[tmp_len] = '/';
5213 strcpy (concat_name + tmp_len + 1, wrapper);
5217 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5218 memcpy (concat_name, p, p_len);
5219 concat_name[p_len] = '/';
5220 strcpy (concat_name + p_len + 1, wrapper);
5222 if (check_executable(concat_name))
5227 /* not found in PATH; assume curdir */
5229 /* Relative path | not found in path: prepend cwd */
5230 if (getcwd (tmp, LT_PATHMAX) == NULL)
5231 lt_fatal ("getcwd failed");
5232 tmp_len = strlen(tmp);
5233 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5234 memcpy (concat_name, tmp, tmp_len);
5235 concat_name[tmp_len] = '/';
5236 strcpy (concat_name + tmp_len + 1, wrapper);
5238 if (check_executable(concat_name))
5245 strendzap(char *str, const char *pat)
5249 assert(str != NULL);
5250 assert(pat != NULL);
5253 patlen = strlen(pat);
5257 str += len - patlen;
5258 if (strcmp(str, pat) == 0)
5265 lt_error_core (int exit_status, const char * mode,
5266 const char * message, va_list ap)
5268 fprintf (stderr, "%s: %s: ", program_name, mode);
5269 vfprintf (stderr, message, ap);
5270 fprintf (stderr, ".\n");
5272 if (exit_status >= 0)
5277 lt_fatal (const char *message, ...)
5280 va_start (ap, message);
5281 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5285 # we should really use a build-platform specific compiler
5286 # here, but OTOH, the wrappers (shell script and this C one)
5287 # are only useful if you want to execute the "real" binary.
5288 # Since the "real" binary is built for $host, then this
5289 # wrapper might as well be built for $host, too.
5290 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5294 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5299 # $output - temporary wrapper script for $objdir/$outputname
5300 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5302 # The $output program cannot be directly executed until all the libtool
5303 # libraries that it depends on are installed.
5305 # This wrapper script should never be moved out of the build directory.
5306 # If it is, it will not operate correctly.
5308 # Sed substitution that helps us do robust quoting. It backslashifies
5309 # metacharacters that are still active within double-quoted strings.
5310 Xsed='${SED} -e 1s/^X//'
5311 sed_quote_subst='$sed_quote_subst'
5313 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5314 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5317 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5318 # is contrary to our usage. Disable this feature.
5319 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5320 setopt NO_GLOB_SUBST
5322 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5324 BIN_SH=xpg4; export BIN_SH # for Tru64
5325 DUALCASE=1; export DUALCASE # for MKS sh
5327 # The HP-UX ksh and POSIX shell print the target directory to stdout
5329 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5331 relink_command=\"$relink_command\"
5333 # This environment variable determines our operation mode.
5334 if test \"\$libtool_install_magic\" = \"$magic\"; then
5335 # install mode needs the following variable:
5336 notinst_deplibs='$notinst_deplibs'
5338 # When we are sourced in execute mode, \$file and \$echo are already set.
5339 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5342 # Make sure echo works.
5343 if test \"X\$1\" = X--no-reexec; then
5344 # Discard the --no-reexec flag, and continue.
5346 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5347 # Yippee, \$echo works!
5350 # Restart under the correct shell, and then maybe \$echo will work.
5351 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5357 # Find the directory that this script lives in.
5358 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5359 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5361 # Follow symbolic links until we get to the real thisdir.
5362 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5363 while test -n \"\$file\"; do
5364 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5366 # If there was a directory component, then change thisdir.
5367 if test \"x\$destdir\" != \"x\$file\"; then
5368 case \"\$destdir\" in
5369 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5370 *) thisdir=\"\$thisdir/\$destdir\" ;;
5374 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5375 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5378 # Try to get the absolute directory name.
5379 absdir=\`cd \"\$thisdir\" && pwd\`
5380 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5383 if test "$fast_install" = yes; then
5385 program=lt-'$outputname'$exeext
5386 progdir=\"\$thisdir/$objdir\"
5388 if test ! -f \"\$progdir/\$program\" || \\
5389 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5390 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5392 file=\"\$\$-\$program\"
5394 if test ! -d \"\$progdir\"; then
5395 $mkdir \"\$progdir\"
5397 $rm \"\$progdir/\$file\"
5402 # relink executable if necessary
5403 if test -n \"\$relink_command\"; then
5404 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5406 $echo \"\$relink_command_output\" >&2
5407 $rm \"\$progdir/\$file\"
5412 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5413 { $rm \"\$progdir/\$program\";
5414 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5415 $rm \"\$progdir/\$file\"
5419 program='$outputname'
5420 progdir=\"\$thisdir/$objdir\"
5426 if test -f \"\$progdir/\$program\"; then"
5428 # Export our shlibpath_var if we have one.
5429 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5431 # Add our own library path to $shlibpath_var
5432 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5434 # Some systems cannot cope with colon-terminated $shlibpath_var
5435 # The second colon is a workaround for a bug in BeOS R4 sed
5436 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5438 export $shlibpath_var
5442 # fixup the dll searchpath if we need to.
5443 if test -n "$dllsearchpath"; then
5445 # Add the dll search path components to the executable PATH
5446 PATH=$dllsearchpath:\$PATH
5451 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5452 # Run the actual program with our arguments.
5455 # Backslashes separate directories on plain windows
5456 *-*-mingw | *-*-os2*)
5458 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5464 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5469 \$echo \"\$0: cannot exec \$program \$*\"
5473 # The program doesn't exist.
5474 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5475 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5476 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5487 # See if we need to build an old-fashioned archive.
5488 for oldlib in $oldlibs; do
5490 if test "$build_libtool_libs" = convenience; then
5491 oldobjs="$libobjs_save"
5492 addlibs="$convenience"
5493 build_libtool_libs=no
5495 if test "$build_libtool_libs" = module; then
5496 oldobjs="$libobjs_save"
5497 build_libtool_libs=no
5499 oldobjs="$old_deplibs $non_pic_objects"
5501 addlibs="$old_convenience"
5504 if test -n "$addlibs"; then
5505 gentop="$output_objdir/${outputname}x"
5506 generated="$generated $gentop"
5508 func_extract_archives $gentop $addlibs
5509 oldobjs="$oldobjs $func_extract_archives_result"
5512 # Do each command in the archive commands.
5513 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5514 cmds=$old_archive_from_new_cmds
5516 # POSIX demands no paths to be encoded in archives. We have
5517 # to avoid creating archives with duplicate basenames if we
5518 # might have to extract them afterwards, e.g., when creating a
5519 # static archive out of a convenience library, or when linking
5520 # the entirety of a libtool archive into another (currently
5521 # not supported by libtool).
5522 if (for obj in $oldobjs
5524 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5525 done | sort | sort -uc >/dev/null 2>&1); then
5528 $echo "copying selected object files to avoid basename conflicts..."
5530 if test -z "$gentop"; then
5531 gentop="$output_objdir/${outputname}x"
5532 generated="$generated $gentop"
5534 $show "${rm}r $gentop"
5535 $run ${rm}r "$gentop"
5536 $show "$mkdir $gentop"
5537 $run $mkdir "$gentop"
5539 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5544 save_oldobjs=$oldobjs
5547 for obj in $save_oldobjs
5549 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5550 case " $oldobjs " in
5551 " ") oldobjs=$obj ;;
5554 # Make sure we don't pick an alternate name that also
5556 newobj=lt$counter-$objbase
5557 counter=`expr $counter + 1`
5558 case " $oldobjs " in
5559 *[\ /]"$newobj "*) ;;
5560 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5563 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5564 $run ln "$obj" "$gentop/$newobj" ||
5565 $run cp "$obj" "$gentop/$newobj"
5566 oldobjs="$oldobjs $gentop/$newobj"
5568 *) oldobjs="$oldobjs $obj" ;;
5573 eval cmds=\"$old_archive_cmds\"
5575 if len=`expr "X$cmds" : ".*"` &&
5576 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5577 cmds=$old_archive_cmds
5579 # the command line is too long to link in one step, link in parts
5580 $echo "using piecewise archive linking..."
5585 save_oldobjs=$oldobjs
5587 # Is there a better way of finding the last object in the list?
5588 for obj in $save_oldobjs
5592 for obj in $save_oldobjs
5594 oldobjs="$objlist $obj"
5595 objlist="$objlist $obj"
5596 eval test_cmds=\"$old_archive_cmds\"
5597 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5598 test "$len" -le "$max_cmd_len"; then
5601 # the above command should be used before it gets too long
5603 if test "$obj" = "$last_oldobj" ; then
5606 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5607 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5613 if test "X$oldobjs" = "X" ; then
5614 eval cmds=\"\$concat_cmds\"
5616 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5620 save_ifs="$IFS"; IFS='~'
5621 for cmd in $cmds; do
5625 $run eval "$cmd" || exit $?
5630 if test -n "$generated"; then
5631 $show "${rm}r$generated"
5632 $run ${rm}r$generated
5635 # Now create the libtool archive.
5639 test "$build_old_libs" = yes && old_library="$libname.$libext"
5640 $show "creating $output"
5642 # Preserve any variables that may affect compiler behavior
5643 for var in $variables_saved_for_relink; do
5644 if eval test -z \"\${$var+set}\"; then
5645 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5646 elif eval var_value=\$$var; test -z "$var_value"; then
5647 relink_command="$var=; export $var; $relink_command"
5649 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5650 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5653 # Quote the link command for shipping.
5654 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5655 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5656 if test "$hardcode_automatic" = yes ; then
5661 # Only create the output if not a dry run.
5662 if test -z "$run"; then
5663 for installed in no yes; do
5664 if test "$installed" = yes; then
5665 if test -z "$install_libdir"; then
5668 output="$output_objdir/$outputname"i
5669 # Replace all uninstalled libtool libraries with the installed ones
5671 for deplib in $dependency_libs; do
5674 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5675 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5676 if test -z "$libdir"; then
5677 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5680 newdependency_libs="$newdependency_libs $libdir/$name"
5682 *) newdependency_libs="$newdependency_libs $deplib" ;;
5685 dependency_libs="$newdependency_libs"
5687 for lib in $dlfiles; do
5688 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5689 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5690 if test -z "$libdir"; then
5691 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5694 newdlfiles="$newdlfiles $libdir/$name"
5696 dlfiles="$newdlfiles"
5698 for lib in $dlprefiles; do
5699 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5700 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5701 if test -z "$libdir"; then
5702 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5705 newdlprefiles="$newdlprefiles $libdir/$name"
5707 dlprefiles="$newdlprefiles"
5710 for lib in $dlfiles; do
5712 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5713 *) abs=`pwd`"/$lib" ;;
5715 newdlfiles="$newdlfiles $abs"
5717 dlfiles="$newdlfiles"
5719 for lib in $dlprefiles; do
5721 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5722 *) abs=`pwd`"/$lib" ;;
5724 newdlprefiles="$newdlprefiles $abs"
5726 dlprefiles="$newdlprefiles"
5729 # place dlname in correct position for cygwin
5731 case $host,$output,$installed,$module,$dlname in
5732 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5735 # $outputname - a libtool library file
5736 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5738 # Please DO NOT delete this file!
5739 # It is necessary for linking the library.
5741 # The name that we can dlopen(3).
5744 # Names of this library.
5745 library_names='$library_names'
5747 # The name of the static archive.
5748 old_library='$old_library'
5750 # Libraries that this one depends upon.
5751 dependency_libs='$dependency_libs'
5753 # Version information for $libname.
5758 # Is this an already installed library?
5759 installed=$installed
5761 # Should we warn about portability when linking against -modules?
5762 shouldnotlink=$module
5764 # Files to dlopen/dlpreopen
5766 dlpreopen='$dlprefiles'
5768 # Directory that this library needs to be installed in:
5769 libdir='$install_libdir'"
5770 if test "$installed" = no && test "$need_relink" = yes; then
5772 relink_command=\"$relink_command\""
5777 # Do a symbolic link so that the libtool archive can be found in
5778 # LD_LIBRARY_PATH before the program is installed.
5779 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5780 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5786 # libtool install mode
5788 modename="$modename: install"
5790 # There may be an optional sh(1) argument at the beginning of
5791 # install_prog (especially on Windows NT).
5792 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5793 # Allow the use of GNU shtool's install command.
5794 $echo "X$nonopt" | grep shtool > /dev/null; then
5795 # Aesthetically quote it.
5796 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5798 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5802 install_prog="$arg "
5810 # The real first argument should be the name of the installation program.
5811 # Aesthetically quote it.
5812 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5814 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5818 install_prog="$install_prog$arg"
5820 # We need to accept at least all the BSD install flags.
5830 if test -n "$dest"; then
5831 files="$files $dest"
5839 case " $install_prog " in
5844 -g | -m | -o) prev=$arg ;;
5852 # If the previous option needed an argument, then skip it.
5853 if test -n "$prev"; then
5862 # Aesthetically quote the argument.
5863 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5865 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5869 install_prog="$install_prog $arg"
5872 if test -z "$install_prog"; then
5873 $echo "$modename: you must specify an install program" 1>&2
5878 if test -n "$prev"; then
5879 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5884 if test -z "$files"; then
5885 if test -z "$dest"; then
5886 $echo "$modename: no file or destination specified" 1>&2
5888 $echo "$modename: you must specify a destination" 1>&2
5894 # Strip any trailing slash from the destination.
5895 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5897 # Check to see that the destination is a directory.
5898 test -d "$dest" && isdir=yes
5899 if test "$isdir" = yes; then
5903 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5904 test "X$destdir" = "X$dest" && destdir=.
5905 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5907 # Not a directory, so check to see that there is only one file specified.
5909 if test "$#" -gt 2; then
5910 $echo "$modename: \`$dest' is not a directory" 1>&2
5916 [\\/]* | [A-Za-z]:[\\/]*) ;;
5918 for file in $files; do
5922 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5931 # This variable tells wrapper scripts just to set variables rather
5932 # than running their programs.
5933 libtool_install_magic="$magic"
5938 for file in $files; do
5940 # Do each installation.
5943 # Do the static libraries later.
5944 staticlibs="$staticlibs $file"
5948 # Check to see that this really is a libtool archive.
5949 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5951 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5959 # If there is no directory component, then add one.
5961 */* | *\\*) . $file ;;
5965 # Add the libdir to current_libdirs if it is the destination.
5966 if test "X$destdir" = "X$libdir"; then
5967 case "$current_libdirs " in
5969 *) current_libdirs="$current_libdirs $libdir" ;;
5972 # Note the libdir as a future libdir.
5973 case "$future_libdirs " in
5975 *) future_libdirs="$future_libdirs $libdir" ;;
5979 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5980 test "X$dir" = "X$file/" && dir=
5983 if test -n "$relink_command"; then
5984 # Determine the prefix the user has applied to our future dir.
5985 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5987 # Don't allow the user to place us outside of our expected
5988 # location b/c this prevents finding dependent libraries that
5989 # are installed to the same prefix.
5990 # At present, this check doesn't affect windows .dll's that
5991 # are installed into $libdir/../bin (currently, that works fine)
5992 # but it's something to keep an eye on.
5993 if test "$inst_prefix_dir" = "$destdir"; then
5994 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5998 if test -n "$inst_prefix_dir"; then
5999 # Stick the inst_prefix_dir data into the link command.
6000 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6002 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6005 $echo "$modename: warning: relinking \`$file'" 1>&2
6006 $show "$relink_command"
6007 if $run eval "$relink_command"; then :
6009 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6014 # See the names of the shared library.
6015 set dummy $library_names
6016 if test -n "$2"; then
6022 test -n "$relink_command" && srcname="$realname"T
6024 # Install the shared library and build the symlinks.
6025 $show "$install_prog $dir/$srcname $destdir/$realname"
6026 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6027 if test -n "$stripme" && test -n "$striplib"; then
6028 $show "$striplib $destdir/$realname"
6029 $run eval "$striplib $destdir/$realname" || exit $?
6032 if test "$#" -gt 0; then
6033 # Delete the old symlinks, and create new ones.
6034 # Try `ln -sf' first, because the `ln' binary might depend on
6035 # the symlink we replace! Solaris /bin/ln does not understand -f,
6036 # so we also need to try rm && ln -s.
6039 if test "$linkname" != "$realname"; then
6040 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6041 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6046 # Do each command in the postinstall commands.
6047 lib="$destdir/$realname"
6048 cmds=$postinstall_cmds
6049 save_ifs="$IFS"; IFS='~'
6050 for cmd in $cmds; do
6054 $run eval "$cmd" || {
6057 # Restore the uninstalled library and exit
6058 if test "$mode" = relink; then
6059 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6068 # Install the pseudo-library for information purposes.
6069 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 instname="$dir/$name"i
6071 $show "$install_prog $instname $destdir/$name"
6072 $run eval "$install_prog $instname $destdir/$name" || exit $?
6074 # Maybe install the static library, too.
6075 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6079 # Install (i.e. copy) a libtool object.
6081 # Figure out destination file name, if it wasn't already specified.
6082 if test -n "$destname"; then
6083 destfile="$destdir/$destname"
6085 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6086 destfile="$destdir/$destfile"
6089 # Deduce the name of the destination old-style object file.
6092 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6095 staticdest="$destfile"
6099 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6105 # Install the libtool object if requested.
6106 if test -n "$destfile"; then
6107 $show "$install_prog $file $destfile"
6108 $run eval "$install_prog $file $destfile" || exit $?
6111 # Install the old object if enabled.
6112 if test "$build_old_libs" = yes; then
6113 # Deduce the name of the old-style object file.
6114 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6116 $show "$install_prog $staticobj $staticdest"
6117 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6123 # Figure out destination file name, if it wasn't already specified.
6124 if test -n "$destname"; then
6125 destfile="$destdir/$destname"
6127 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6128 destfile="$destdir/$destfile"
6131 # If the file is missing, and there is a .exe on the end, strip it
6132 # because it is most likely a libtool script we actually want to
6137 if test ! -f "$file"; then
6138 file=`$echo $file|${SED} 's,.exe$,,'`
6144 # Do a test to see if this is really a libtool program.
6147 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6153 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6157 # Note that it is not necessary on cygwin/mingw to append a dot to
6158 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6159 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6160 # `FILE.' does not work on cygwin managed mounts.
6162 # If there is no directory component, then add one.
6164 */* | *\\*) . ${wrapper} ;;
6165 *) . ./${wrapper} ;;
6168 # Check the variables that should have been set.
6169 if test -z "$notinst_deplibs"; then
6170 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6175 for lib in $notinst_deplibs; do
6176 # Check to see that each library is installed.
6178 if test -f "$lib"; then
6179 # If there is no directory component, then add one.
6181 */* | *\\*) . $lib ;;
6185 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6186 if test -n "$libdir" && test ! -f "$libfile"; then
6187 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6193 # Note that it is not necessary on cygwin/mingw to append a dot to
6194 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6195 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6196 # `FILE.' does not work on cygwin managed mounts.
6198 # If there is no directory component, then add one.
6200 */* | *\\*) . ${wrapper} ;;
6201 *) . ./${wrapper} ;;
6205 if test "$fast_install" = no && test -n "$relink_command"; then
6206 if test "$finalize" = yes && test -z "$run"; then
6207 tmpdir=`func_mktempdir`
6208 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6209 outputname="$tmpdir/$file"
6210 # Replace the output file specification.
6211 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6213 $show "$relink_command"
6214 if $run eval "$relink_command"; then :
6216 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6222 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6225 # Install the binary that we compiled earlier.
6226 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6230 # remove .exe since cygwin /usr/bin/install will append another
6232 case $install_prog,$host in
6233 */usr/bin/install*,*cygwin*)
6234 case $file:$destfile in
6239 destfile=$destfile.exe
6242 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6247 $show "$install_prog$stripme $file $destfile"
6248 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6249 test -n "$outputname" && ${rm}r "$tmpdir"
6254 for file in $staticlibs; do
6255 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6257 # Set up the ranlib parameters.
6258 oldlib="$destdir/$name"
6260 $show "$install_prog $file $oldlib"
6261 $run eval "$install_prog \$file \$oldlib" || exit $?
6263 if test -n "$stripme" && test -n "$old_striplib"; then
6264 $show "$old_striplib $oldlib"
6265 $run eval "$old_striplib $oldlib" || exit $?
6268 # Do each command in the postinstall commands.
6269 cmds=$old_postinstall_cmds
6270 save_ifs="$IFS"; IFS='~'
6271 for cmd in $cmds; do
6275 $run eval "$cmd" || exit $?
6280 if test -n "$future_libdirs"; then
6281 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6284 if test -n "$current_libdirs"; then
6285 # Maybe just do a dry run.
6286 test -n "$run" && current_libdirs=" -n$current_libdirs"
6287 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6293 # libtool finish mode
6295 modename="$modename: finish"
6299 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6302 libdirs="$libdirs $dir"
6305 for libdir in $libdirs; do
6306 if test -n "$finish_cmds"; then
6307 # Do each command in the finish commands.
6309 save_ifs="$IFS"; IFS='~'
6310 for cmd in $cmds; do
6314 $run eval "$cmd" || admincmds="$admincmds
6319 if test -n "$finish_eval"; then
6320 # Do the single finish_eval.
6321 eval cmds=\"$finish_eval\"
6322 $run eval "$cmds" || admincmds="$admincmds
6328 # Exit here if they wanted silent mode.
6329 test "$show" = : && exit $EXIT_SUCCESS
6331 $echo "X----------------------------------------------------------------------" | $Xsed
6332 $echo "Libraries have been installed in:"
6333 for libdir in $libdirs; do
6337 $echo "If you ever happen to want to link against installed libraries"
6338 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6339 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6340 $echo "flag during linking and do at least one of the following:"
6341 if test -n "$shlibpath_var"; then
6342 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6343 $echo " during execution"
6345 if test -n "$runpath_var"; then
6346 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6347 $echo " during linking"
6349 if test -n "$hardcode_libdir_flag_spec"; then
6351 eval flag=\"$hardcode_libdir_flag_spec\"
6353 $echo " - use the \`$flag' linker flag"
6355 if test -n "$admincmds"; then
6356 $echo " - have your system administrator run these commands:$admincmds"
6358 if test -f /etc/ld.so.conf; then
6359 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6362 $echo "See any operating system documentation about shared libraries for"
6363 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6364 $echo "X----------------------------------------------------------------------" | $Xsed
6368 # libtool execute mode
6370 modename="$modename: execute"
6372 # The first argument is the command name.
6374 if test -z "$cmd"; then
6375 $echo "$modename: you must specify a COMMAND" 1>&2
6380 # Handle -dlopen flags immediately.
6381 for file in $execute_dlfiles; do
6382 if test ! -f "$file"; then
6383 $echo "$modename: \`$file' is not a file" 1>&2
6391 # Check to see that this really is a libtool archive.
6392 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6394 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6399 # Read the libtool library.
6403 # If there is no directory component, then add one.
6405 */* | *\\*) . $file ;;
6409 # Skip this library if it cannot be dlopened.
6410 if test -z "$dlname"; then
6411 # Warn if it was a shared library.
6412 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6416 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6417 test "X$dir" = "X$file" && dir=.
6419 if test -f "$dir/$objdir/$dlname"; then
6422 if test ! -f "$dir/$dlname"; then
6423 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6430 # Just add the directory containing the .lo file.
6431 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6432 test "X$dir" = "X$file" && dir=.
6436 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6441 # Get the absolute pathname.
6442 absdir=`cd "$dir" && pwd`
6443 test -n "$absdir" && dir="$absdir"
6445 # Now add the directory to shlibpath_var.
6446 if eval "test -z \"\$$shlibpath_var\""; then
6447 eval "$shlibpath_var=\"\$dir\""
6449 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6453 # This variable tells wrapper scripts just to set shlibpath_var
6454 # rather than running their programs.
6455 libtool_execute_magic="$magic"
6457 # Check if any of the arguments is a wrapper script.
6464 # Do a test to see if this is really a libtool program.
6465 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6466 # If there is no directory component, then add one.
6468 */* | *\\*) . $file ;;
6472 # Transform arg to wrapped name.
6473 file="$progdir/$program"
6477 # Quote arguments (to preserve shell metacharacters).
6478 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6479 args="$args \"$file\""
6482 if test -z "$run"; then
6483 if test -n "$shlibpath_var"; then
6484 # Export the shlibpath_var.
6485 eval "export $shlibpath_var"
6488 # Restore saved environment variables
6489 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6491 eval "if test \"\${save_$lt_var+set}\" = set; then
6492 $lt_var=\$save_$lt_var; export $lt_var
6496 # Now prepare to actually exec the command.
6497 exec_cmd="\$cmd$args"
6499 # Display what would be done.
6500 if test -n "$shlibpath_var"; then
6501 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6502 $echo "export $shlibpath_var"
6509 # libtool clean and uninstall mode
6511 modename="$modename: $mode"
6517 # This variable tells wrapper scripts just to set variables rather
6518 # than running their programs.
6519 libtool_install_magic="$magic"
6524 -f) rm="$rm $arg"; rmforce=yes ;;
6525 -*) rm="$rm $arg" ;;
6526 *) files="$files $arg" ;;
6530 if test -z "$rm"; then
6531 $echo "$modename: you must specify an RM program" 1>&2
6538 origobjdir="$objdir"
6539 for file in $files; do
6540 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6541 if test "X$dir" = "X$file"; then
6543 objdir="$origobjdir"
6545 objdir="$dir/$origobjdir"
6547 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6548 test "$mode" = uninstall && objdir="$dir"
6550 # Remember objdir for removal later, being careful to avoid duplicates
6551 if test "$mode" = clean; then
6554 *) rmdirs="$rmdirs $objdir" ;;
6558 # Don't error if the file doesn't exist and rm -f was used.
6559 if (test -L "$file") >/dev/null 2>&1 \
6560 || (test -h "$file") >/dev/null 2>&1 \
6561 || test -f "$file"; then
6563 elif test -d "$file"; then
6566 elif test "$rmforce" = yes; then
6574 # Possibly a libtool archive, so verify it.
6575 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6578 # Delete the libtool libraries and symlinks.
6579 for n in $library_names; do
6580 rmfiles="$rmfiles $objdir/$n"
6582 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6586 case " $library_names " in
6587 # " " in the beginning catches empty $dlname
6589 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6591 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6594 if test -n "$library_names"; then
6595 # Do each command in the postuninstall commands.
6596 cmds=$postuninstall_cmds
6597 save_ifs="$IFS"; IFS='~'
6598 for cmd in $cmds; do
6603 if test "$?" -ne 0 && test "$rmforce" != yes; then
6610 if test -n "$old_library"; then
6611 # Do each command in the old_postuninstall commands.
6612 cmds=$old_postuninstall_cmds
6613 save_ifs="$IFS"; IFS='~'
6614 for cmd in $cmds; do
6619 if test "$?" -ne 0 && test "$rmforce" != yes; then
6625 # FIXME: should reinstall the best remaining shared library.
6632 # Possibly a libtool object, so verify it.
6633 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6638 # Add PIC object to the list of files to remove.
6639 if test -n "$pic_object" \
6640 && test "$pic_object" != none; then
6641 rmfiles="$rmfiles $dir/$pic_object"
6644 # Add non-PIC object to the list of files to remove.
6645 if test -n "$non_pic_object" \
6646 && test "$non_pic_object" != none; then
6647 rmfiles="$rmfiles $dir/$non_pic_object"
6653 if test "$mode" = clean ; then
6657 file=`$echo $file|${SED} 's,.exe$,,'`
6658 noexename=`$echo $name|${SED} 's,.exe$,,'`
6659 # $file with .exe has already been added to rmfiles,
6660 # add $file without .exe
6661 rmfiles="$rmfiles $file"
6664 # Do a test to see if this is a libtool program.
6665 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6669 # note $name still contains .exe if it was in $file originally
6670 # as does the version of $file that was added into $rmfiles
6671 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6672 if test "$fast_install" = yes && test -n "$relink_command"; then
6673 rmfiles="$rmfiles $objdir/lt-$name"
6675 if test "X$noexename" != "X$name" ; then
6676 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6682 $show "$rm $rmfiles"
6683 $run $rm $rmfiles || exit_status=1
6685 objdir="$origobjdir"
6687 # Try to remove the ${objdir}s in the directories where we deleted files
6688 for dir in $rmdirs; do
6689 if test -d "$dir"; then
6691 $run rmdir $dir >/dev/null 2>&1
6699 $echo "$modename: you must specify a MODE" 1>&2
6700 $echo "$generic_help" 1>&2
6705 if test -z "$exec_cmd"; then
6706 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6707 $echo "$generic_help" 1>&2
6710 fi # test -z "$show_help"
6712 if test -n "$exec_cmd"; then
6717 # We need to display help for each of the modes.
6720 "Usage: $modename [OPTION]... [MODE-ARG]...
6722 Provide generalized library-building support services.
6724 --config show all configuration variables
6725 --debug enable verbose shell tracing
6726 -n, --dry-run display commands without modifying any files
6727 --features display basic configuration information and exit
6728 --finish same as \`--mode=finish'
6729 --help display this help message and exit
6730 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6731 --quiet same as \`--silent'
6732 --silent don't print informational messages
6733 --tag=TAG use configuration variables from tag TAG
6734 --version print version information
6736 MODE must be one of the following:
6738 clean remove files from the build directory
6739 compile compile a source file into a libtool object
6740 execute automatically set library path, then run a program
6741 finish complete the installation of libtool libraries
6742 install install libraries or executables
6743 link create a library or an executable
6744 uninstall remove libraries from an installed directory
6746 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6747 a more detailed description of MODE.
6749 Report bugs to <bug-libtool@gnu.org>."
6755 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6757 Remove files from the build directory.
6759 RM is the name of the program to use to delete files associated with each FILE
6760 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6763 If FILE is a libtool library, object or program, all the files associated
6764 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6769 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6771 Compile a source file into a libtool library object.
6773 This mode accepts the following additional options:
6775 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6776 -prefer-pic try to building PIC objects only
6777 -prefer-non-pic try to building non-PIC objects only
6778 -static always build a \`.o' file suitable for static linking
6780 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6781 from the given SOURCEFILE.
6783 The output file name is determined by removing the directory component from
6784 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6785 library object suffix, \`.lo'."
6790 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6792 Automatically set library path, then run a program.
6794 This mode accepts the following additional options:
6796 -dlopen FILE add the directory containing FILE to the library path
6798 This mode sets the library path environment variable according to \`-dlopen'
6801 If any of the ARGS are libtool executable wrappers, then they are translated
6802 into their corresponding uninstalled binary, and any of their required library
6803 directories are added to the library path.
6805 Then, COMMAND is executed, with ARGS as arguments."
6810 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6812 Complete the installation of libtool libraries.
6814 Each LIBDIR is a directory that contains libtool libraries.
6816 The commands that this mode executes may require superuser privileges. Use
6817 the \`--dry-run' option if you just want to see what would be executed."
6822 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6824 Install executables or libraries.
6826 INSTALL-COMMAND is the installation command. The first component should be
6827 either the \`install' or \`cp' program.
6829 The rest of the components are interpreted as arguments to that command (only
6830 BSD-compatible install options are recognized)."
6835 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6837 Link object files or libraries together to form another library, or to
6838 create an executable program.
6840 LINK-COMMAND is a command using the C compiler that you would use to create
6841 a program from several object files.
6843 The following components of LINK-COMMAND are treated specially:
6845 -all-static do not do any dynamic linking at all
6846 -avoid-version do not add a version suffix if possible
6847 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6848 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6849 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6850 -export-symbols SYMFILE
6851 try to export only the symbols listed in SYMFILE
6852 -export-symbols-regex REGEX
6853 try to export only the symbols matching REGEX
6854 -LLIBDIR search LIBDIR for required installed libraries
6855 -lNAME OUTPUT-FILE requires the installed library libNAME
6856 -module build a library that can dlopened
6857 -no-fast-install disable the fast-install mode
6858 -no-install link a not-installable executable
6859 -no-undefined declare that a library does not refer to external symbols
6860 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6861 -objectlist FILE Use a list of object files found in FILE to specify objects
6862 -precious-files-regex REGEX
6863 don't remove output files matching REGEX
6864 -release RELEASE specify package release information
6865 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6866 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6867 -static do not do any dynamic linking of uninstalled libtool libraries
6868 -static-libtool-libs
6869 do not do any dynamic linking of libtool libraries
6870 -version-info CURRENT[:REVISION[:AGE]]
6871 specify library version info [each variable defaults to 0]
6873 All other options (arguments beginning with \`-') are ignored.
6875 Every other argument is treated as a filename. Files ending in \`.la' are
6876 treated as uninstalled libtool libraries, other files are standard or library
6879 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6880 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6881 required, except when creating a convenience library.
6883 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6884 using \`ar' and \`ranlib', or on Windows using \`lib'.
6886 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6887 is created, otherwise an executable program is created."
6892 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6894 Remove libraries from an installation directory.
6896 RM is the name of the program to use to delete files associated with each FILE
6897 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6900 If FILE is a libtool library, all the files associated with it are deleted.
6901 Otherwise, only FILE itself is deleted using RM."
6905 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6912 $echo "Try \`$modename --help' for more information about other modes."
6916 # The TAGs below are defined such that we never get into a situation
6917 # in which we disable both kinds of libraries. Given conflicting
6918 # choices, we go for a static library, that is the most portable,
6919 # since we can't tell whether shared libraries were disabled because
6920 # the user asked for that or because the platform doesn't support
6921 # them. This is particularly important on AIX, because we don't
6922 # support having both static and shared libraries enabled at the same
6923 # time on that platform, so we default to a shared-only configuration.
6924 # If a disable-shared tag is given, we'll fallback to a static-only
6925 # configuration. But we'll never go from static-only to shared-only.
6927 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6929 # ### END LIBTOOL TAG CONFIG: disable-shared
6931 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6933 # ### END LIBTOOL TAG CONFIG: disable-static