1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007, 2008 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
117 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119 eval "if test \"\${$lt_var+set}\" = set; then
120 save_$lt_var=\$$lt_var
121 lt_env=\"$lt_var=\$$lt_var \$lt_env\"
127 if test -n "$lt_env"; then
131 # Make sure IFS has a sensible default
136 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137 $echo "$modename: not configured to build any kind of library" 1>&2
138 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
153 lo2o="s/\\.lo\$/.${objext}/"
154 o2lo="s/\\.${objext}\$/.lo/"
158 #####################################
159 # Shell function definitions:
160 # This seems to be the best place for them
162 # func_mktempdir [string]
163 # Make a temporary directory that won't clash with other running
164 # libtool processes, and avoids race conditions if possible. If
165 # given, STRING is the basename for that directory.
168 my_template="${TMPDIR-/tmp}/${1-$progname}"
170 if test "$run" = ":"; then
171 # Return a directory name, but don't create it in dry-run mode
172 my_tmpdir="${my_template}-$$"
175 # If mktemp works, use that first and foremost
176 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178 if test ! -d "$my_tmpdir"; then
179 # Failing that, at least try and use $RANDOM to avoid a race
180 my_tmpdir="${my_template}-${RANDOM-0}$$"
182 save_mktempdir_umask=`umask`
185 umask $save_mktempdir_umask
188 # If we're not in dry-run mode, bomb out on failure
189 test -d "$my_tmpdir" || {
190 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195 $echo "X$my_tmpdir" | $Xsed
199 # func_win32_libid arg
200 # return the library type of file 'arg'
202 # Need a lot of goo to handle *both* DLLs and import libs
203 # Has to be a shell function in order to 'eat' the argument
204 # that is supplied when $file_magic_command is called.
207 win32_libid_type="unknown"
208 win32_fileres=`file -L $1 2>/dev/null`
209 case $win32_fileres in
210 *ar\ archive\ import\ library*) # definitely import
211 win32_libid_type="x86 archive import"
213 *ar\ archive*) # could be an import, or static
214 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216 win32_nmres=`eval $NM -f posix -A $1 | \
225 import*) win32_libid_type="x86 archive import";;
226 *) win32_libid_type="x86 archive static";;
231 win32_libid_type="x86 DLL"
233 *executable*) # but shell scripts are "executable" too...
234 case $win32_fileres in
235 *MS\ Windows\ PE\ Intel*)
236 win32_libid_type="x86 DLL"
241 $echo $win32_libid_type
246 # Infer tagged configuration to use if any are available and
247 # if one wasn't chosen via the "--tag" command line option.
248 # Only attempt this if the compiler in the base compile
249 # command doesn't match the default compiler.
250 # arg is usually of the form 'gcc ...'
253 if test -n "$available_tags" && test -z "$tagname"; then
257 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
261 CC_quoted="$CC_quoted $arg"
264 # Blanks in the command may have been stripped by the calling shell,
265 # but not from the CC environment variable when configure was run.
266 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267 # Blanks at the start of $base_compile will cause this to fail
268 # if we don't check for them as well.
270 for z in $available_tags; do
271 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272 # Evaluate the configuration.
273 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
276 # Double-quote args containing other shell metacharacters.
278 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
282 CC_quoted="$CC_quoted $arg"
285 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286 # The compiler in the base compile command matches
287 # the one in the tagged configuration.
288 # Assume this is the tagged configuration we want.
295 # If $tagname still isn't set, then no tagged configuration
296 # was found and let the user know that the "--tag" command
297 # line option must be used.
298 if test -z "$tagname"; then
299 $echo "$modename: unable to infer tagged configuration"
300 $echo "$modename: specify a tag with \`--tag'" 1>&2
303 # $echo "$modename: using $tagname tagged configuration"
311 # func_extract_an_archive dir oldlib
312 func_extract_an_archive ()
314 f_ex_an_ar_dir="$1"; shift
315 f_ex_an_ar_oldlib="$1"
317 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
322 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
327 # func_extract_archives gentop oldlib ...
328 func_extract_archives ()
330 my_gentop="$1"; shift
338 $show "${rm}r $my_gentop"
339 $run ${rm}r "$my_gentop"
340 $show "$mkdir $my_gentop"
341 $run $mkdir "$my_gentop"
343 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
347 for my_xlib in $my_oldlibs; do
348 # Extract the objects.
350 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351 *) my_xabs=`pwd`"/$my_xlib" ;;
353 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
356 case " $extracted_archives " in
358 extracted_serial=`expr $extracted_serial + 1`
359 my_xlib_u=lt$extracted_serial-$my_xlib ;;
363 extracted_archives="$extracted_archives $my_xlib_u"
364 my_xdir="$my_gentop/$my_xlib_u"
366 $show "${rm}r $my_xdir"
367 $run ${rm}r "$my_xdir"
368 $show "$mkdir $my_xdir"
369 $run $mkdir "$my_xdir"
371 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
376 $show "Extracting $my_xabs"
377 # Do not bother doing anything if just a dry run
378 if test -z "$run"; then
379 darwin_orig_dir=`pwd`
380 cd $my_xdir || exit $?
381 darwin_archive=$my_xabs
383 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385 if test -n "$darwin_arches"; then
386 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
388 $show "$darwin_base_archive has multiple architectures $darwin_arches"
389 for darwin_arch in $darwin_arches ; do
390 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
395 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396 done # $darwin_arches
397 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
401 for darwin_file in $darwin_filelist; do
402 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403 lipo -create -output "$darwin_file" $darwin_files
404 done # $darwin_filelist
406 cd "$darwin_orig_dir"
408 cd "$darwin_orig_dir"
409 func_extract_an_archive "$my_xdir" "$my_xabs"
414 func_extract_an_archive "$my_xdir" "$my_xabs"
417 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
419 func_extract_archives_result="$my_oldobjs"
421 # End of Shell function definitions
422 #####################################
425 eval std_shrext=\"$shrext_cmds\"
429 # Parse our command line options once, thoroughly.
430 while test "$#" -gt 0
436 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
440 # If the previous option needs an argument, assign it.
441 if test -n "$prev"; then
444 execute_dlfiles="$execute_dlfiles $arg"
448 preserve_args="${preserve_args}=$arg"
450 # Check whether tagname contains only valid characters
453 $echo "$progname: invalid tag name: $tagname" 1>&2
460 # Don't test for the "default" C tag, as we know, it's there, but
461 # not specially marked.
464 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465 taglist="$taglist $tagname"
466 # Evaluate the configuration.
467 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
469 $echo "$progname: ignoring unknown tag $tagname" 1>&2
484 # Have we seen a non-optional argument yet?
492 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
494 Copyright (C) 2008 Free Software Foundation, Inc.
495 This is free software; see the source for copying conditions. There is NO
496 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
501 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502 # Now print the configurations for the tags.
503 for tagname in $taglist; do
504 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
510 $echo "$progname: enabling shell trace mode"
512 preserve_args="$preserve_args $arg"
521 if test "$build_libtool_libs" = yes; then
522 $echo "enable shared libraries"
524 $echo "disable shared libraries"
526 if test "$build_old_libs" = yes; then
527 $echo "enable static libraries"
529 $echo "disable static libraries"
534 --finish) mode="finish" ;;
536 --mode) prevopt="--mode" prev=mode ;;
537 --mode=*) mode="$optarg" ;;
539 --preserve-dup-deps) duplicate_deps="yes" ;;
543 preserve_args="$preserve_args $arg"
549 preserve_args="$preserve_args --tag"
552 set tag "$optarg" ${1+"$@"}
555 preserve_args="$preserve_args --tag"
564 $echo "$modename: unrecognized option \`$arg'" 1>&2
576 if test -n "$prevopt"; then
577 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
582 case $disable_libs in
586 build_libtool_libs=no
590 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
594 # If this variable is set in any of the actions, the command in it
595 # will be execed at the end. This prevents here-documents from being
596 # left over by shells.
599 if test -z "$show_help"; then
601 # Infer the operation mode.
602 if test -z "$mode"; then
603 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
606 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
618 *db | *dbx | *strace | *truss)
628 # If we have no mode, but dlfiles were specified, then do execute mode.
629 test -n "$execute_dlfiles" && mode=execute
631 # Just use the default operation mode.
632 if test -z "$mode"; then
633 if test -n "$nonopt"; then
634 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
636 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
643 # Only execute mode is allowed to have -dlopen flags.
644 if test -n "$execute_dlfiles" && test "$mode" != execute; then
645 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
650 # Change the help message to a mode-specific one.
652 help="Try \`$modename --help --mode=$mode' for more information."
654 # These modes are in order of execution frequency so that they run quickly.
656 # libtool compile mode
658 modename="$modename: compile"
659 # Get the compilation command and the source file.
661 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
672 # do not "continue". Instead, add this to base_compile
684 # Accept any command-line options.
687 if test -n "$libobj" ; then
688 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
695 -static | -prefer-pic | -prefer-non-pic)
706 arg_mode=arg # the next one goes into the "base_compile" arg list
707 continue # The current "srcfile" will either be retained or
708 ;; # replaced later. I would guess that would be a bug.
711 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
713 save_ifs="$IFS"; IFS=','
717 # Double-quote args containing other shell metacharacters.
718 # Many Bourne shells cannot handle close brackets correctly
719 # in scan sets, so we specify it separately.
721 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
725 lastarg="$lastarg $arg"
728 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
730 # Add the arguments to base_compile.
731 base_compile="$base_compile $lastarg"
736 # Accept the current argument as the source file.
737 # The previous "srcfile" becomes the current argument.
744 esac # case $arg_mode
746 # Aesthetically quote the previous argument.
747 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
750 # Double-quote args containing other shell metacharacters.
751 # Many Bourne shells cannot handle close brackets correctly
752 # in scan sets, and some SunOS ksh mistreat backslash-escaping
753 # in scan sets (worked around with variable expansion),
754 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755 # at all, so we specify them separately.
756 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
757 lastarg="\"$lastarg\""
761 base_compile="$base_compile $lastarg"
766 $echo "$modename: you must specify an argument for -Xcompile"
770 $echo "$modename: you must specify a target with \`-o'" 1>&2
774 # Get the name of the library object.
775 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
779 # Recognize several different file suffixes.
780 # If the user specifies -o file.o, it is replaced with file.lo
790 *.class) xform=class ;;
793 *.[fF][09]?) xform=[fF][09]. ;;
795 *.java) xform=java ;;
800 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
803 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
805 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
810 func_infer_tag $base_compile
812 for arg in $later; do
831 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
833 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834 qlibobj="\"$qlibobj\"" ;;
836 test "X$libobj" != "X$qlibobj" \
837 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
838 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841 if test "X$xdir" = "X$obj"; then
846 lobj=${xdir}$objdir/$objname
848 if test -z "$base_compile"; then
849 $echo "$modename: you must specify a compilation command" 1>&2
854 # Delete any leftover library objects.
855 if test "$build_old_libs" = yes; then
856 removelist="$obj $lobj $libobj ${libobj}T"
858 removelist="$lobj $libobj ${libobj}T"
862 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
864 # On Cygwin there's no "real" PIC flag so we must build both object types
866 cygwin* | mingw* | pw32* | os2*)
870 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
871 # non-PIC code in shared libraries is not supported
875 # Calculate the filename of the output object if compiler does
876 # not support -o with -c
877 if test "$compiler_c_o" = no; then
878 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
879 lockfile="$output_obj.lock"
880 removelist="$removelist $output_obj $lockfile"
881 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
888 # Lock this critical section if it is needed
889 # We use this script file to make the link, it avoids creating a new file
890 if test "$need_locks" = yes; then
891 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
892 $show "Waiting for $lockfile to be removed"
895 elif test "$need_locks" = warn; then
896 if test -f "$lockfile"; then
898 *** ERROR, $lockfile exists and contains:
899 `cat $lockfile 2>/dev/null`
901 This indicates that another process is trying to use the same
902 temporary object file, and libtool could not work around it because
903 your compiler does not support \`-c' and \`-o' together. If you
904 repeat this compilation, it may succeed, by chance, but you had better
905 avoid parallel builds (make -j) in this platform, or get a better
911 $echo "$srcfile" > "$lockfile"
914 if test -n "$fix_srcfile_path"; then
915 eval srcfile=\"$fix_srcfile_path\"
917 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
919 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
920 qsrcfile="\"$qsrcfile\"" ;;
923 $run $rm "$libobj" "${libobj}T"
925 # Create a libtool object file (analogous to a ".la" file),
926 # but don't create it if we're doing a dry run.
927 test -z "$run" && cat > ${libobj}T <<EOF
928 # $libobj - a libtool object file
929 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
931 # Please DO NOT delete this file!
932 # It is necessary for linking the library.
934 # Name of the PIC object.
937 # Only build a PIC object if we are building libtool libraries.
938 if test "$build_libtool_libs" = yes; then
939 # Without this assignment, base_compile gets emptied.
940 fbsd_hideous_sh_bug=$base_compile
942 if test "$pic_mode" != no; then
943 command="$base_compile $qsrcfile $pic_flag"
945 # Don't build PIC code
946 command="$base_compile $qsrcfile"
949 if test ! -d "${xdir}$objdir"; then
950 $show "$mkdir ${xdir}$objdir"
951 $run $mkdir ${xdir}$objdir
953 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
958 if test -z "$output_obj"; then
959 # Place PIC objects in $objdir
960 command="$command -o $lobj"
963 $run $rm "$lobj" "$output_obj"
966 if $run eval $lt_env "$command"; then :
968 test -n "$output_obj" && $run $rm $removelist
972 if test "$need_locks" = warn &&
973 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
975 *** ERROR, $lockfile contains:
976 `cat $lockfile 2>/dev/null`
978 but it should contain:
981 This indicates that another process is trying to use the same
982 temporary object file, and libtool could not work around it because
983 your compiler does not support \`-c' and \`-o' together. If you
984 repeat this compilation, it may succeed, by chance, but you had better
985 avoid parallel builds (make -j) in this platform, or get a better
992 # Just move the object if needed, then go on to compile the next one
993 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
994 $show "$mv $output_obj $lobj"
995 if $run $mv $output_obj $lobj; then :
1003 # Append the name of the PIC object to the libtool object file.
1004 test -z "$run" && cat >> ${libobj}T <<EOF
1005 pic_object='$objdir/$objname'
1009 # Allow error messages only from the first compilation.
1010 if test "$suppress_opt" = yes; then
1011 suppress_output=' >/dev/null 2>&1'
1014 # No PIC object so indicate it doesn't exist in the libtool
1016 test -z "$run" && cat >> ${libobj}T <<EOF
1022 # Only build a position-dependent object if we build old libraries.
1023 if test "$build_old_libs" = yes; then
1024 if test "$pic_mode" != yes; then
1025 # Don't build PIC code
1026 command="$base_compile $qsrcfile"
1028 command="$base_compile $qsrcfile $pic_flag"
1030 if test "$compiler_c_o" = yes; then
1031 command="$command -o $obj"
1034 # Suppress compiler output if we already did a PIC compilation.
1035 command="$command$suppress_output"
1036 $run $rm "$obj" "$output_obj"
1038 if $run eval $lt_env "$command"; then :
1040 $run $rm $removelist
1044 if test "$need_locks" = warn &&
1045 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1047 *** ERROR, $lockfile contains:
1048 `cat $lockfile 2>/dev/null`
1050 but it should contain:
1053 This indicates that another process is trying to use the same
1054 temporary object file, and libtool could not work around it because
1055 your compiler does not support \`-c' and \`-o' together. If you
1056 repeat this compilation, it may succeed, by chance, but you had better
1057 avoid parallel builds (make -j) in this platform, or get a better
1060 $run $rm $removelist
1064 # Just move the object if needed
1065 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1066 $show "$mv $output_obj $obj"
1067 if $run $mv $output_obj $obj; then :
1070 $run $rm $removelist
1075 # Append the name of the non-PIC object the libtool object file.
1076 # Only append if the libtool object file exists.
1077 test -z "$run" && cat >> ${libobj}T <<EOF
1078 # Name of the non-PIC object.
1079 non_pic_object='$objname'
1083 # Append the name of the non-PIC object the libtool object file.
1084 # Only append if the libtool object file exists.
1085 test -z "$run" && cat >> ${libobj}T <<EOF
1086 # Name of the non-PIC object.
1092 $run $mv "${libobj}T" "${libobj}"
1094 # Unlock the critical section if it was locked
1095 if test "$need_locks" != no; then
1096 $run $rm "$lockfile"
1104 modename="$modename: link"
1106 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1107 # It is impossible to link a dll without this setting, and
1108 # we shouldn't force the makefile maintainer to figure out
1109 # which system we are compiling for in order to pass an extra
1110 # flag for every libtool invocation.
1111 # allow_undefined=no
1113 # FIXME: Unfortunately, there are problems with the above when trying
1114 # to make a dll which has undefined symbols, in which case not
1115 # even a static library is built. For now, we need to specify
1116 # -no-undefined on the libtool link line when we can be certain
1117 # that all symbols are satisfied, otherwise we get a static library.
1124 libtool_args="$nonopt"
1125 base_compile="$nonopt $@"
1126 compile_command="$nonopt"
1127 finalize_command="$nonopt"
1140 lib_search_path=`pwd`
1149 export_symbols_regex=
1157 notinst_path= # paths that contain not-installed libtool libraries
1158 precious_files_regex=
1159 prefer_static_libs=no
1171 single_module="${wl}-single_module"
1173 func_infer_tag $base_compile
1175 # We need to know -static, to get the right output filenames.
1179 -all-static | -static | -static-libtool-libs)
1182 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1185 if test -n "$link_static_flag"; then
1186 dlopen_self=$dlopen_self_static
1188 prefer_static_libs=yes
1191 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1194 prefer_static_libs=built
1196 -static-libtool-libs)
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1200 prefer_static_libs=yes
1203 build_libtool_libs=no
1210 # See if our shared archives depend on static archives.
1211 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1213 # Go through the arguments, transforming them on the way.
1214 while test "$#" -gt 0; do
1218 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1219 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1223 libtool_args="$libtool_args $qarg"
1225 # If the previous option needs an argument, assign it.
1226 if test -n "$prev"; then
1229 compile_command="$compile_command @OUTPUT@"
1230 finalize_command="$finalize_command @OUTPUT@"
1236 if test "$preload" = no; then
1237 # Add the symbol object into the linking commands.
1238 compile_command="$compile_command @SYMFILE@"
1239 finalize_command="$finalize_command @SYMFILE@"
1243 *.la | *.lo) ;; # We handle these cases below.
1245 if test "$dlself" = no; then
1253 if test "$prev" = dlprefiles; then
1255 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1265 if test "$prev" = dlfiles; then
1266 dlfiles="$dlfiles $arg"
1268 dlprefiles="$dlprefiles $arg"
1276 export_symbols="$arg"
1277 if test ! -f "$arg"; then
1278 $echo "$modename: symbol file \`$arg' does not exist"
1285 export_symbols_regex="$arg"
1290 inst_prefix_dir="$arg"
1295 precious_files_regex="$arg"
1305 if test -f "$arg"; then
1308 for fil in `cat $save_arg`
1310 # moreargs="$moreargs $fil"
1312 # A libtool-controlled object.
1314 # Check to see that this really is a libtool object.
1315 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1320 # If there is no directory component, then add one.
1322 */* | *\\*) . $arg ;;
1326 if test -z "$pic_object" || \
1327 test -z "$non_pic_object" ||
1328 test "$pic_object" = none && \
1329 test "$non_pic_object" = none; then
1330 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1334 # Extract subdirectory from the argument.
1335 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336 if test "X$xdir" = "X$arg"; then
1342 if test "$pic_object" != none; then
1343 # Prepend the subdirectory the object is found in.
1344 pic_object="$xdir$pic_object"
1346 if test "$prev" = dlfiles; then
1347 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348 dlfiles="$dlfiles $pic_object"
1352 # If libtool objects are unsupported, then we need to preload.
1357 # CHECK ME: I think I busted this. -Ossama
1358 if test "$prev" = dlprefiles; then
1359 # Preload the old-style object.
1360 dlprefiles="$dlprefiles $pic_object"
1365 libobjs="$libobjs $pic_object"
1370 if test "$non_pic_object" != none; then
1371 # Prepend the subdirectory the object is found in.
1372 non_pic_object="$xdir$non_pic_object"
1374 # A standard non-PIC object
1375 non_pic_objects="$non_pic_objects $non_pic_object"
1376 if test -z "$pic_object" || test "$pic_object" = none ; then
1377 arg="$non_pic_object"
1380 # If the PIC object exists, use it instead.
1381 # $xdir was prepended to $pic_object above.
1382 non_pic_object="$pic_object"
1383 non_pic_objects="$non_pic_objects $non_pic_object"
1386 # Only an error if not doing a dry-run.
1387 if test -z "$run"; then
1388 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1393 # Extract subdirectory from the argument.
1394 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395 if test "X$xdir" = "X$arg"; then
1401 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403 libobjs="$libobjs $pic_object"
1404 non_pic_objects="$non_pic_objects $non_pic_object"
1409 $echo "$modename: link input file \`$save_arg' does not exist"
1417 # We need an absolute path.
1419 [\\/]* | [A-Za-z]:[\\/]*) ;;
1421 $echo "$modename: only absolute run-paths are allowed" 1>&2
1425 if test "$prev" = rpath; then
1428 *) rpath="$rpath $arg" ;;
1433 *) xrpath="$xrpath $arg" ;;
1440 compiler_flags="$compiler_flags $qarg"
1442 compile_command="$compile_command $qarg"
1443 finalize_command="$finalize_command $qarg"
1447 linker_flags="$linker_flags $qarg"
1448 compiler_flags="$compiler_flags $wl$qarg"
1450 compile_command="$compile_command $wl$qarg"
1451 finalize_command="$finalize_command $wl$qarg"
1455 linker_flags="$linker_flags $qarg"
1456 compiler_flags="$compiler_flags $qarg"
1458 compile_command="$compile_command $qarg"
1459 finalize_command="$finalize_command $qarg"
1467 darwin_framework|darwin_framework_skip)
1468 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469 compile_command="$compile_command $arg"
1470 finalize_command="$finalize_command $arg"
1475 eval "$prev=\"\$arg\""
1480 fi # test -n "$prev"
1486 if test -n "$link_static_flag"; then
1487 compile_command="$compile_command $link_static_flag"
1488 finalize_command="$finalize_command $link_static_flag"
1494 # FIXME: remove this flag sometime in the future.
1495 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1519 -export-symbols | -export-symbols-regex)
1520 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521 $echo "$modename: more than one -exported-symbols argument is not allowed"
1524 if test "X$arg" = "X-export-symbols"; then
1532 -framework|-arch|-isysroot)
1534 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1535 prev=darwin_framework_skip ;;
1536 *) compiler_flags="$compiler_flags $arg"
1537 prev=darwin_framework ;;
1539 compile_command="$compile_command $arg"
1540 finalize_command="$finalize_command $arg"
1549 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550 # so, if we see these flags be careful not to treat them like -L
1552 case $with_gcc/$host in
1553 no/*-*-irix* | /*-*-irix*)
1554 compile_command="$compile_command $arg"
1555 finalize_command="$finalize_command $arg"
1562 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563 # We need an absolute path.
1565 [\\/]* | [A-Za-z]:[\\/]*) ;;
1567 absdir=`cd "$dir" && pwd`
1568 if test -z "$absdir"; then
1569 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1571 notinst_path="$notinst_path $dir"
1579 deplibs="$deplibs -L$dir"
1580 lib_search_path="$lib_search_path $dir"
1584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586 case :$dllsearchpath: in
1588 *) dllsearchpath="$dllsearchpath:$dir";;
1590 case :$dllsearchpath: in
1591 *":$testbindir:"*) ;;
1592 *) dllsearchpath="$dllsearchpath:$testbindir";;
1600 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603 # These systems don't actually have a C or math library (as such)
1607 # These systems don't actually have a C library (as such)
1608 test "X$arg" = "X-lc" && continue
1610 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611 # Do not include libc due to us having libc/libc_r.
1612 test "X$arg" = "X-lc" && continue
1614 *-*-rhapsody* | *-*-darwin1.[012])
1615 # Rhapsody C and math libraries are in the System framework
1616 deplibs="$deplibs -framework System"
1619 *-*-sco3.2v5* | *-*-sco5v6*)
1620 # Causes problems with __ctype
1621 test "X$arg" = "X-lc" && continue
1623 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624 # Compiler inserts libc in the correct place for threads to work
1625 test "X$arg" = "X-lc" && continue
1628 elif test "X$arg" = "X-lc_r"; then
1630 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631 # Do not include libc_r directly, use -pthread flag.
1636 deplibs="$deplibs $arg"
1640 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641 # classes, name mangling, and exception handling.
1643 compile_command="$compile_command $arg"
1644 compiler_flags="$compiler_flags $arg"
1645 finalize_command="$finalize_command $arg"
1650 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651 compiler_flags="$compiler_flags $arg"
1652 compile_command="$compile_command $arg"
1653 finalize_command="$finalize_command $arg"
1658 single_module="${wl}-multi_module"
1667 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1669 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670 # +DA*, +DD* enable 64-bit mode on the HP compiler
1671 # -q* pass through compiler args for the IBM compiler
1672 # -m* pass through architecture-specific compiler args for GCC
1673 # -m*, -t[45]*, -txscale* pass through architecture-specific
1674 # compiler args for GCC
1675 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676 # -F/path gives path to uninstalled frameworks, gcc on darwin
1677 # @file GCC response files
1678 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1681 # Unknown arguments in both finalize_command and compile_command need
1682 # to be aesthetically quoted because they are evaled later.
1683 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1685 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1689 compile_command="$compile_command $arg"
1690 finalize_command="$finalize_command $arg"
1691 compiler_flags="$compiler_flags $arg"
1707 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1708 # The PATH hackery in wrapper scripts is required on Windows
1709 # and Darwin in order for the loader to find any dlls it needs.
1710 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1711 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1714 *) no_install=yes ;;
1731 -precious-files-regex)
1752 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1753 # We need an absolute path.
1755 [\\/]* | [A-Za-z]:[\\/]*) ;;
1757 $echo "$modename: only absolute run-paths are allowed" 1>&2
1763 *) xrpath="$xrpath $dir" ;;
1768 -static | -static-libtool-libs)
1769 # The effects of -static are defined in a previous loop.
1770 # We used to do the same as -all-static on platforms that
1771 # didn't have a PIC flag, but the assumption that the effects
1772 # would be equivalent was wrong. It would break on at least
1773 # Digital Unix and AIX.
1793 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1795 save_ifs="$IFS"; IFS=','
1796 for flag in $args; do
1799 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1804 compiler_flags="$compiler_flags $flag"
1807 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1811 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1813 save_ifs="$IFS"; IFS=','
1814 for flag in $args; do
1817 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1822 compiler_flags="$compiler_flags $wl$flag"
1823 linker_flags="$linker_flags $flag"
1826 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1844 # Some other compiler flag.
1846 # Unknown arguments in both finalize_command and compile_command need
1847 # to be aesthetically quoted because they are evaled later.
1848 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1850 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1857 # A standard object.
1862 # A libtool-controlled object.
1864 # Check to see that this really is a libtool object.
1865 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1870 # If there is no directory component, then add one.
1872 */* | *\\*) . $arg ;;
1876 if test -z "$pic_object" || \
1877 test -z "$non_pic_object" ||
1878 test "$pic_object" = none && \
1879 test "$non_pic_object" = none; then
1880 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1884 # Extract subdirectory from the argument.
1885 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1886 if test "X$xdir" = "X$arg"; then
1892 if test "$pic_object" != none; then
1893 # Prepend the subdirectory the object is found in.
1894 pic_object="$xdir$pic_object"
1896 if test "$prev" = dlfiles; then
1897 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1898 dlfiles="$dlfiles $pic_object"
1902 # If libtool objects are unsupported, then we need to preload.
1907 # CHECK ME: I think I busted this. -Ossama
1908 if test "$prev" = dlprefiles; then
1909 # Preload the old-style object.
1910 dlprefiles="$dlprefiles $pic_object"
1915 libobjs="$libobjs $pic_object"
1920 if test "$non_pic_object" != none; then
1921 # Prepend the subdirectory the object is found in.
1922 non_pic_object="$xdir$non_pic_object"
1924 # A standard non-PIC object
1925 non_pic_objects="$non_pic_objects $non_pic_object"
1926 if test -z "$pic_object" || test "$pic_object" = none ; then
1927 arg="$non_pic_object"
1930 # If the PIC object exists, use it instead.
1931 # $xdir was prepended to $pic_object above.
1932 non_pic_object="$pic_object"
1933 non_pic_objects="$non_pic_objects $non_pic_object"
1936 # Only an error if not doing a dry-run.
1937 if test -z "$run"; then
1938 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1943 # Extract subdirectory from the argument.
1944 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1945 if test "X$xdir" = "X$arg"; then
1951 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1952 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1953 libobjs="$libobjs $pic_object"
1954 non_pic_objects="$non_pic_objects $non_pic_object"
1961 deplibs="$deplibs $arg"
1962 old_deplibs="$old_deplibs $arg"
1967 # A libtool-controlled library.
1969 if test "$prev" = dlfiles; then
1970 # This library was specified with -dlopen.
1971 dlfiles="$dlfiles $arg"
1973 elif test "$prev" = dlprefiles; then
1974 # The library was specified with -dlpreopen.
1975 dlprefiles="$dlprefiles $arg"
1978 deplibs="$deplibs $arg"
1983 # Some other compiler argument.
1985 # Unknown arguments in both finalize_command and compile_command need
1986 # to be aesthetically quoted because they are evaled later.
1987 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1989 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1996 # Now actually substitute the argument into the commands.
1997 if test -n "$arg"; then
1998 compile_command="$compile_command $arg"
1999 finalize_command="$finalize_command $arg"
2001 done # argument parsing loop
2003 if test -n "$prev"; then
2004 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2009 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2010 eval arg=\"$export_dynamic_flag_spec\"
2011 compile_command="$compile_command $arg"
2012 finalize_command="$finalize_command $arg"
2016 # calculate the name of the file, without its directory
2017 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2018 libobjs_save="$libobjs"
2020 if test -n "$shlibpath_var"; then
2021 # get the directories listed in $shlibpath_var
2022 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2026 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2027 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2029 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2030 if test "X$output_objdir" = "X$output"; then
2031 output_objdir="$objdir"
2033 output_objdir="$output_objdir/$objdir"
2035 # Create the object directory.
2036 if test ! -d "$output_objdir"; then
2037 $show "$mkdir $output_objdir"
2038 $run $mkdir $output_objdir
2040 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2045 # Determine the type of output
2048 $echo "$modename: you must specify an output file" 1>&2
2052 *.$libext) linkmode=oldlib ;;
2053 *.lo | *.$objext) linkmode=obj ;;
2054 *.la) linkmode=lib ;;
2055 *) linkmode=prog ;; # Anything else should be a program.
2059 *cygwin* | *mingw* | *pw32*)
2060 # don't eliminate duplications in $postdeps and $predeps
2061 duplicate_compiler_generated_deps=yes
2064 duplicate_compiler_generated_deps=$duplicate_deps
2070 # Find all interdependent deplibs by searching for libraries
2071 # that are linked more than once (e.g. -la -lb -la)
2072 for deplib in $deplibs; do
2073 if test "X$duplicate_deps" = "Xyes" ; then
2075 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2078 libs="$libs $deplib"
2081 if test "$linkmode" = lib; then
2082 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2084 # Compute libraries that are listed more than once in $predeps
2085 # $postdeps and mark them as special (i.e., whose duplicates are
2086 # not to be eliminated).
2088 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2089 for pre_post_dep in $predeps $postdeps; do
2090 case "$pre_post_deps " in
2091 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2093 pre_post_deps="$pre_post_deps $pre_post_dep"
2102 need_relink=no # whether we're linking any uninstalled libtool libraries
2103 notinst_deplibs= # not-installed libtool libraries
2107 for file in $dlfiles $dlprefiles; do
2111 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2123 passes="conv scan dlopen dlpreopen link"
2128 for pass in $passes; do
2129 if test "$linkmode,$pass" = "lib,link" ||
2130 test "$linkmode,$pass" = "prog,scan"; then
2134 if test "$linkmode" = prog; then
2136 dlopen) libs="$dlfiles" ;;
2137 dlpreopen) libs="$dlprefiles" ;;
2138 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2141 if test "$pass" = dlopen; then
2142 # Collect dlpreopened libraries
2143 save_deplibs="$deplibs"
2146 for deplib in $libs; do
2150 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2151 if test "$linkmode,$pass" = "prog,link"; then
2152 compile_deplibs="$deplib $compile_deplibs"
2153 finalize_deplibs="$deplib $finalize_deplibs"
2155 compiler_flags="$compiler_flags $deplib"
2160 if test "$linkmode" != lib && test "$linkmode" != prog; then
2161 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2164 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2165 if test "$linkmode" = lib; then
2166 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2168 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2170 for searchdir in $searchdirs; do
2171 for search_ext in .la $std_shrext .so .a; do
2172 # Search the libtool library
2173 lib="$searchdir/lib${name}${search_ext}"
2174 if test -f "$lib"; then
2175 if test "$search_ext" = ".la"; then
2184 if test "$found" != yes; then
2185 # deplib doesn't seem to be a libtool library
2186 if test "$linkmode,$pass" = "prog,link"; then
2187 compile_deplibs="$deplib $compile_deplibs"
2188 finalize_deplibs="$deplib $finalize_deplibs"
2190 deplibs="$deplib $deplibs"
2191 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2194 else # deplib is a libtool library
2195 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2196 # We need to do some special things here, and not later.
2197 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2198 case " $predeps $postdeps " in
2200 if (${SED} -e '2q' $lib |
2201 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2205 */* | *\\*) . $lib ;;
2208 for l in $old_library $library_names; do
2211 if test "X$ll" = "X$old_library" ; then # only static version available
2213 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2214 test "X$ladir" = "X$lib" && ladir="."
2215 lib=$ladir/$old_library
2216 if test "$linkmode,$pass" = "prog,link"; then
2217 compile_deplibs="$deplib $compile_deplibs"
2218 finalize_deplibs="$deplib $finalize_deplibs"
2220 deplibs="$deplib $deplibs"
2221 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2235 deplibs="$deplib $deplibs"
2236 test "$pass" = conv && continue
2237 newdependency_libs="$deplib $newdependency_libs"
2238 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2241 if test "$pass" = conv; then
2242 deplibs="$deplib $deplibs"
2245 if test "$pass" = scan; then
2246 deplibs="$deplib $deplibs"
2248 compile_deplibs="$deplib $compile_deplibs"
2249 finalize_deplibs="$deplib $finalize_deplibs"
2251 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2254 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2260 if test "$pass" = link; then
2261 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2262 # Make sure the xrpath contains only unique directories.
2265 *) xrpath="$xrpath $dir" ;;
2268 deplibs="$deplib $deplibs"
2271 *.la) lib="$deplib" ;;
2273 if test "$pass" = conv; then
2274 deplibs="$deplib $deplibs"
2280 case $deplibs_check_method in
2282 set dummy $deplibs_check_method
2283 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2284 if eval $echo \"$deplib\" 2>/dev/null \
2286 | $EGREP "$match_pattern_regex" > /dev/null; then
2294 if test "$valid_a_lib" != yes; then
2296 $echo "*** Warning: Trying to link with static lib archive $deplib."
2297 $echo "*** I have the capability to make that library automatically link in when"
2298 $echo "*** you link to this library. But I can only do this if you have a"
2299 $echo "*** shared version of the library, which you do not appear to have"
2300 $echo "*** because the file extensions .$libext of this argument makes me believe"
2301 $echo "*** that it is just a static archive that I should not used here."
2304 $echo "*** Warning: Linking the shared library $output against the"
2305 $echo "*** static library $deplib is not portable!"
2306 deplibs="$deplib $deplibs"
2311 if test "$pass" != link; then
2312 deplibs="$deplib $deplibs"
2314 compile_deplibs="$deplib $compile_deplibs"
2315 finalize_deplibs="$deplib $finalize_deplibs"
2322 if test "$pass" = conv; then
2323 deplibs="$deplib $deplibs"
2324 elif test "$linkmode" = prog; then
2325 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2326 # If there is no dlopen support or we're linking statically,
2327 # we need to preload.
2328 newdlprefiles="$newdlprefiles $deplib"
2329 compile_deplibs="$deplib $compile_deplibs"
2330 finalize_deplibs="$deplib $finalize_deplibs"
2332 newdlfiles="$newdlfiles $deplib"
2342 if test "$found" = yes || test -f "$lib"; then :
2344 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2348 # Check to see that this really is a libtool archive.
2349 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2351 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2355 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2356 test "X$ladir" = "X$lib" && ladir="."
2364 # If the library was installed with an old release of libtool,
2365 # it will not redefine variables installed, or shouldnotlink
2373 */* | *\\*) . $lib ;;
2377 if test "$linkmode,$pass" = "lib,link" ||
2378 test "$linkmode,$pass" = "prog,scan" ||
2379 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2380 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2381 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2384 if test "$pass" = conv; then
2385 # Only check for convenience libraries
2386 deplibs="$lib $deplibs"
2387 if test -z "$libdir"; then
2388 if test -z "$old_library"; then
2389 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2392 # It is a libtool convenience library, so add in its objects.
2393 convenience="$convenience $ladir/$objdir/$old_library"
2394 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2396 for deplib in $dependency_libs; do
2397 deplibs="$deplib $deplibs"
2398 if test "X$duplicate_deps" = "Xyes" ; then
2399 case "$tmp_libs " in
2400 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2403 tmp_libs="$tmp_libs $deplib"
2405 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2406 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2413 # Get the name of the library we link against.
2415 for l in $old_library $library_names; do
2418 if test -z "$linklib"; then
2419 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2423 # This library was specified with -dlopen.
2424 if test "$pass" = dlopen; then
2425 if test -z "$libdir"; then
2426 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2429 if test -z "$dlname" ||
2430 test "$dlopen_support" != yes ||
2431 test "$build_libtool_libs" = no; then
2432 # If there is no dlname, no dlopen support or we're linking
2433 # statically, we need to preload. We also need to preload any
2434 # dependent libraries so libltdl's deplib preloader doesn't
2435 # bomb out in the load deplibs phase.
2436 dlprefiles="$dlprefiles $lib $dependency_libs"
2438 newdlfiles="$newdlfiles $lib"
2443 # We need an absolute path.
2445 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2447 abs_ladir=`cd "$ladir" && pwd`
2448 if test -z "$abs_ladir"; then
2449 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2450 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2455 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2457 # Find the relevant object directory and library name.
2458 if test "X$installed" = Xyes; then
2459 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2460 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2468 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2470 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2473 # Remove this search path later
2474 notinst_path="$notinst_path $abs_ladir"
2476 dir="$ladir/$objdir"
2477 absdir="$abs_ladir/$objdir"
2478 # Remove this search path later
2479 notinst_path="$notinst_path $abs_ladir"
2481 fi # $installed = yes
2482 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2484 # This library was specified with -dlpreopen.
2485 if test "$pass" = dlpreopen; then
2486 if test -z "$libdir"; then
2487 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2490 # Prefer using a static library (so that no silly _DYNAMIC symbols
2491 # are required to link).
2492 if test -n "$old_library"; then
2493 newdlprefiles="$newdlprefiles $dir/$old_library"
2494 # Otherwise, use the dlname, so that lt_dlopen finds it.
2495 elif test -n "$dlname"; then
2496 newdlprefiles="$newdlprefiles $dir/$dlname"
2498 newdlprefiles="$newdlprefiles $dir/$linklib"
2500 fi # $pass = dlpreopen
2502 if test -z "$libdir"; then
2503 # Link the convenience library
2504 if test "$linkmode" = lib; then
2505 deplibs="$dir/$old_library $deplibs"
2506 elif test "$linkmode,$pass" = "prog,link"; then
2507 compile_deplibs="$dir/$old_library $compile_deplibs"
2508 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2510 deplibs="$lib $deplibs" # used for prog,scan pass
2516 if test "$linkmode" = prog && test "$pass" != link; then
2517 newlib_search_path="$newlib_search_path $ladir"
2518 deplibs="$lib $deplibs"
2521 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2522 test "$build_libtool_libs" = no; then
2527 for deplib in $dependency_libs; do
2529 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2531 # Need to link against all dependency_libs?
2532 if test "$linkalldeplibs" = yes; then
2533 deplibs="$deplib $deplibs"
2535 # Need to hardcode shared library paths
2536 # or/and link against static libraries
2537 newdependency_libs="$deplib $newdependency_libs"
2539 if test "X$duplicate_deps" = "Xyes" ; then
2540 case "$tmp_libs " in
2541 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2544 tmp_libs="$tmp_libs $deplib"
2547 fi # $linkmode = prog...
2549 if test "$linkmode,$pass" = "prog,link"; then
2550 if test -n "$library_names" &&
2551 { { test "$prefer_static_libs" = no ||
2552 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2553 test -z "$old_library"; }; then
2554 # We need to hardcode the library path
2555 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2556 # Make sure the rpath contains only unique directories.
2557 case "$temp_rpath " in
2560 *) temp_rpath="$temp_rpath $absdir" ;;
2564 # Hardcode the library path.
2565 # Skip directories that are in the system default run-time
2567 case " $sys_lib_dlsearch_path " in
2570 case "$compile_rpath " in
2572 *) compile_rpath="$compile_rpath $absdir"
2576 case " $sys_lib_dlsearch_path " in
2579 case "$finalize_rpath " in
2581 *) finalize_rpath="$finalize_rpath $libdir"
2585 fi # $linkmode,$pass = prog,link...
2587 if test "$alldeplibs" = yes &&
2588 { test "$deplibs_check_method" = pass_all ||
2589 { test "$build_libtool_libs" = yes &&
2590 test -n "$library_names"; }; }; then
2591 # We only need to search for static libraries
2596 link_static=no # Whether the deplib will be linked statically
2597 use_static_libs=$prefer_static_libs
2598 if test "$use_static_libs" = built && test "$installed" = yes ; then
2601 if test -n "$library_names" &&
2602 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2603 if test "$installed" = no; then
2604 notinst_deplibs="$notinst_deplibs $lib"
2607 # This is a shared library
2609 # Warn about portability, can't link against -module's on
2610 # some systems (darwin)
2611 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2613 if test "$linkmode" = prog; then
2614 $echo "*** Warning: Linking the executable $output against the loadable module"
2616 $echo "*** Warning: Linking the shared library $output against the loadable module"
2618 $echo "*** $linklib is not portable!"
2620 if test "$linkmode" = lib &&
2621 test "$hardcode_into_libs" = yes; then
2622 # Hardcode the library path.
2623 # Skip directories that are in the system default run-time
2625 case " $sys_lib_dlsearch_path " in
2628 case "$compile_rpath " in
2630 *) compile_rpath="$compile_rpath $absdir"
2634 case " $sys_lib_dlsearch_path " in
2637 case "$finalize_rpath " in
2639 *) finalize_rpath="$finalize_rpath $libdir"
2645 if test -n "$old_archive_from_expsyms_cmds"; then
2646 # figure out the soname
2647 set dummy $library_names
2650 libname=`eval \\$echo \"$libname_spec\"`
2651 # use dlname if we got it. it's perfectly good, no?
2652 if test -n "$dlname"; then
2654 elif test -n "$soname_spec"; then
2658 major=`expr $current - $age`
2662 eval soname=\"$soname_spec\"
2667 # Make a new name for the extract_expsyms_cmds to use
2669 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2670 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2672 # If the library has no export list, then create one now
2673 if test -f "$output_objdir/$soname-def"; then :
2675 $show "extracting exported symbol list from \`$soname'"
2676 save_ifs="$IFS"; IFS='~'
2677 cmds=$extract_expsyms_cmds
2678 for cmd in $cmds; do
2682 $run eval "$cmd" || exit $?
2688 if test -f "$output_objdir/$newlib"; then :; else
2689 $show "generating import library for \`$soname'"
2690 save_ifs="$IFS"; IFS='~'
2691 cmds=$old_archive_from_expsyms_cmds
2692 for cmd in $cmds; do
2696 $run eval "$cmd" || exit $?
2700 # make sure the library variables are pointing to the new library
2703 fi # test -n "$old_archive_from_expsyms_cmds"
2705 if test "$linkmode" = prog || test "$mode" != relink; then
2710 case $hardcode_action in
2711 immediate | unsupported)
2712 if test "$hardcode_direct" = no; then
2715 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2716 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2717 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2718 *-*-unixware7*) add_dir="-L$dir" ;;
2720 # if the lib is a module then we can not link against
2721 # it, someone is ignoring the new warnings I added
2722 if /usr/bin/file -L $add 2> /dev/null |
2723 $EGREP ": [^:]* bundle" >/dev/null ; then
2724 $echo "** Warning, lib $linklib is a module, not a shared library"
2725 if test -z "$old_library" ; then
2727 $echo "** And there doesn't seem to be a static archive available"
2728 $echo "** The link will probably fail, sorry"
2730 add="$dir/$old_library"
2734 elif test "$hardcode_minus_L" = no; then
2736 *-*-sunos*) add_shlibpath="$dir" ;;
2740 elif test "$hardcode_shlibpath_var" = no; then
2741 add_shlibpath="$dir"
2748 if test "$hardcode_direct" = yes; then
2750 elif test "$hardcode_minus_L" = yes; then
2752 # Try looking first in the location we're being installed to.
2753 if test -n "$inst_prefix_dir"; then
2756 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2761 elif test "$hardcode_shlibpath_var" = yes; then
2762 add_shlibpath="$dir"
2771 if test "$lib_linked" != yes; then
2772 $echo "$modename: configuration error: unsupported hardcode properties"
2776 if test -n "$add_shlibpath"; then
2777 case :$compile_shlibpath: in
2778 *":$add_shlibpath:"*) ;;
2779 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2782 if test "$linkmode" = prog; then
2783 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2784 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2786 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2787 test -n "$add" && deplibs="$add $deplibs"
2788 if test "$hardcode_direct" != yes && \
2789 test "$hardcode_minus_L" != yes && \
2790 test "$hardcode_shlibpath_var" = yes; then
2791 case :$finalize_shlibpath: in
2793 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2799 if test "$linkmode" = prog || test "$mode" = relink; then
2803 # Finalize command for both is simple: just hardcode it.
2804 if test "$hardcode_direct" = yes; then
2805 add="$libdir/$linklib"
2806 elif test "$hardcode_minus_L" = yes; then
2809 elif test "$hardcode_shlibpath_var" = yes; then
2810 case :$finalize_shlibpath: in
2812 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2815 elif test "$hardcode_automatic" = yes; then
2816 if test -n "$inst_prefix_dir" &&
2817 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2818 add="$inst_prefix_dir$libdir/$linklib"
2820 add="$libdir/$linklib"
2823 # We cannot seem to hardcode it, guess we'll fake it.
2825 # Try looking first in the location we're being installed to.
2826 if test -n "$inst_prefix_dir"; then
2829 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2836 if test "$linkmode" = prog; then
2837 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2838 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2840 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2841 test -n "$add" && deplibs="$add $deplibs"
2844 elif test "$linkmode" = prog; then
2845 # Here we assume that one of hardcode_direct or hardcode_minus_L
2846 # is not unsupported. This is valid on all known static and
2848 if test "$hardcode_direct" != unsupported; then
2849 test -n "$old_library" && linklib="$old_library"
2850 compile_deplibs="$dir/$linklib $compile_deplibs"
2851 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2853 compile_deplibs="-l$name -L$dir $compile_deplibs"
2854 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2856 elif test "$build_libtool_libs" = yes; then
2857 # Not a shared library
2858 if test "$deplibs_check_method" != pass_all; then
2859 # We're trying link a shared library against a static one
2860 # but the system doesn't support it.
2862 # Just print a warning and add the library to dependency_libs so
2863 # that the program can be linked against the static library.
2865 $echo "*** Warning: This system can not link to static lib archive $lib."
2866 $echo "*** I have the capability to make that library automatically link in when"
2867 $echo "*** you link to this library. But I can only do this if you have a"
2868 $echo "*** shared version of the library, which you do not appear to have."
2869 if test "$module" = yes; then
2870 $echo "*** But as you try to build a module library, libtool will still create "
2871 $echo "*** a static module, that should work as long as the dlopening application"
2872 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2873 if test -z "$global_symbol_pipe"; then
2875 $echo "*** However, this would only work if libtool was able to extract symbol"
2876 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2877 $echo "*** not find such a program. So, this module is probably useless."
2878 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2880 if test "$build_old_libs" = no; then
2881 build_libtool_libs=module
2884 build_libtool_libs=no
2888 deplibs="$dir/$old_library $deplibs"
2891 fi # link shared/static library?
2893 if test "$linkmode" = lib; then
2894 if test -n "$dependency_libs" &&
2895 { test "$hardcode_into_libs" != yes ||
2896 test "$build_old_libs" = yes ||
2897 test "$link_static" = yes; }; then
2898 # Extract -R from dependency_libs
2900 for libdir in $dependency_libs; do
2902 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2904 *" $temp_xrpath "*) ;;
2905 *) xrpath="$xrpath $temp_xrpath";;
2907 *) temp_deplibs="$temp_deplibs $libdir";;
2910 dependency_libs="$temp_deplibs"
2913 newlib_search_path="$newlib_search_path $absdir"
2914 # Link against this library
2915 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2916 # ... and its dependency_libs
2918 for deplib in $dependency_libs; do
2919 newdependency_libs="$deplib $newdependency_libs"
2920 if test "X$duplicate_deps" = "Xyes" ; then
2921 case "$tmp_libs " in
2922 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2925 tmp_libs="$tmp_libs $deplib"
2928 if test "$link_all_deplibs" != no; then
2929 # Add the search paths of all dependency libraries
2930 for deplib in $dependency_libs; do
2932 -L*) path="$deplib" ;;
2934 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2935 test "X$dir" = "X$deplib" && dir="."
2936 # We need an absolute path.
2938 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2940 absdir=`cd "$dir" && pwd`
2941 if test -z "$absdir"; then
2942 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2947 if grep "^installed=no" $deplib > /dev/null; then
2948 path="$absdir/$objdir"
2950 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2951 if test -z "$libdir"; then
2952 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2955 if test "$absdir" != "$libdir"; then
2956 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2963 # we do not want to link against static libs,
2964 # but need to link against shared
2965 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2966 eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2967 if test -n "$deplibrary_names" ; then
2968 for tmp in $deplibrary_names ; do
2971 if test -f "$deplibdir/$depdepl" ; then
2972 depdepl="$deplibdir/$depdepl"
2973 elif test -f "$path/$depdepl" ; then
2974 depdepl="$path/$depdepl"
2976 # Can't find it, oh well...
2979 # do not add paths which are already there
2980 case " $newlib_search_path " in
2982 *) newlib_search_path="$newlib_search_path $path";;
2995 # Again, we only want to link against shared libraries
2996 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2997 for tmp in $newlib_search_path ; do
2998 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2999 eval depdepl="$tmp/lib$tmp_libs.dylib"
3010 case " $deplibs " in
3012 *) deplibs="$path $deplibs" ;;
3014 case " $deplibs " in
3016 *) deplibs="$depdepl $deplibs" ;;
3019 fi # link_all_deplibs != no
3021 done # for deplib in $libs
3022 dependency_libs="$newdependency_libs"
3023 if test "$pass" = dlpreopen; then
3024 # Link the dlpreopened libraries before other libraries
3025 for deplib in $save_deplibs; do
3026 deplibs="$deplib $deplibs"
3029 if test "$pass" != dlopen; then
3030 if test "$pass" != conv; then
3031 # Make sure lib_search_path contains only unique directories.
3033 for dir in $newlib_search_path; do
3034 case "$lib_search_path " in
3036 *) lib_search_path="$lib_search_path $dir" ;;
3042 if test "$linkmode,$pass" != "prog,link"; then
3045 vars="compile_deplibs finalize_deplibs"
3047 for var in $vars dependency_libs; do
3048 # Add libraries to $var in reverse order
3049 eval tmp_libs=\"\$$var\"
3051 for deplib in $tmp_libs; do
3052 # FIXME: Pedantically, this is the right thing to do, so
3053 # that some nasty dependency loop isn't accidentally
3055 #new_libs="$deplib $new_libs"
3056 # Pragmatically, this seems to cause very few problems in
3059 -L*) new_libs="$deplib $new_libs" ;;
3062 # And here is the reason: when a library appears more
3063 # than once as an explicit dependence of a library, or
3064 # is implicitly linked in more than once by the
3065 # compiler, it is considered special, and multiple
3066 # occurrences thereof are not removed. Compare this
3067 # with having the same library being listed as a
3068 # dependency of multiple other libraries: in this case,
3069 # we know (pedantically, we assume) the library does not
3070 # need to be listed more than once, so we keep only the
3071 # last copy. This is not always right, but it is rare
3072 # enough that we require users that really mean to play
3073 # such unportable linking tricks to link the library
3074 # using -Wl,-lname, so that libtool does not consider it
3075 # for duplicate removal.
3076 case " $specialdeplibs " in
3077 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3079 case " $new_libs " in
3081 *) new_libs="$deplib $new_libs" ;;
3089 for deplib in $new_libs; do
3092 case " $tmp_libs " in
3094 *) tmp_libs="$tmp_libs $deplib" ;;
3097 *) tmp_libs="$tmp_libs $deplib" ;;
3100 eval $var=\"$tmp_libs\"
3103 # Last step: remove runtime libs from dependency_libs
3104 # (they stay in deplibs)
3106 for i in $dependency_libs ; do
3107 case " $predeps $postdeps $compiler_lib_search_path " in
3112 if test -n "$i" ; then
3113 tmp_libs="$tmp_libs $i"
3116 dependency_libs=$tmp_libs
3118 if test "$linkmode" = prog; then
3119 dlfiles="$newdlfiles"
3120 dlprefiles="$newdlprefiles"
3127 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3130 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3131 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3134 if test -n "$rpath"; then
3135 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3138 if test -n "$xrpath"; then
3139 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3142 if test -n "$vinfo"; then
3143 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3146 if test -n "$release"; then
3147 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3150 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3151 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3154 # Now set the variables for building old libraries.
3155 build_libtool_libs=no
3157 objs="$objs$old_deplibs"
3161 # Make sure we only generate libraries of the form `libNAME.la'.
3164 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3165 eval shared_ext=\"$shrext_cmds\"
3166 eval libname=\"$libname_spec\"
3169 if test "$need_lib_prefix" != no; then
3170 # Add the "lib" prefix for modules if required
3171 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3172 eval shared_ext=\"$shrext_cmds\"
3173 eval libname=\"$libname_spec\"
3175 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3180 if test -n "$objs"; then
3181 if test "$deplibs_check_method" != pass_all; then
3182 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3186 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3187 $echo "*** objects $objs is not portable!"
3188 libobjs="$libobjs $objs"
3192 if test "$dlself" != no; then
3193 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3197 if test "$#" -gt 2; then
3198 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3203 if test -z "$rpath"; then
3204 if test "$build_libtool_libs" = yes; then
3205 # Building a libtool convenience library.
3206 # Some compilers have problems with a `.al' extension so
3207 # convenience libraries should have the same extension an
3208 # archive normally would.
3209 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3210 build_libtool_libs=convenience
3214 if test -n "$vinfo"; then
3215 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3218 if test -n "$release"; then
3219 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3223 # Parse the version information argument.
3224 save_ifs="$IFS"; IFS=':'
3225 set dummy $vinfo 0 0 0
3228 if test -n "$8"; then
3229 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3234 # convert absolute version numbers to libtool ages
3235 # this retains compatibility with .la files and attempts
3236 # to make the code below a bit more comprehensible
3238 case $vinfo_number in
3242 number_revision="$4"
3244 # There are really only two kinds -- those that
3245 # use the current revision as the major version
3246 # and those that subtract age and use age as
3247 # a minor version. But, then there is irix
3248 # which has an extra 1 added just for fun
3250 case $version_type in
3251 darwin|linux|osf|windows|none)
3252 current=`expr $number_major + $number_minor`
3254 revision="$number_revision"
3256 freebsd-aout|freebsd-elf|sunos)
3257 current="$number_major"
3258 revision="$number_minor"
3262 current=`expr $number_major + $number_minor`
3264 revision="$number_minor"
3265 lt_irix_increment=no
3276 # Check that each of the things are valid numbers.
3278 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]) ;;
3280 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3281 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287 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]) ;;
3289 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3290 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3296 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]) ;;
3298 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3299 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3304 if test "$age" -gt "$current"; then
3305 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3306 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3310 # Calculate the version variables.
3314 case $version_type in
3318 # Like Linux, but with the current version available in
3319 # verstring for coding it into the library header
3320 major=.`expr $current - $age`
3321 versuffix="$major.$age.$revision"
3322 # Darwin ld doesn't like 0 for these options...
3323 minor_current=`expr $current + 1`
3324 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3325 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3330 versuffix=".$current.$revision";
3335 versuffix=".$current";
3339 if test "X$lt_irix_increment" = "Xno"; then
3340 major=`expr $current - $age`
3342 major=`expr $current - $age + 1`
3344 case $version_type in
3345 nonstopux) verstring_prefix=nonstopux ;;
3346 *) verstring_prefix=sgi ;;
3348 verstring="$verstring_prefix$major.$revision"
3350 # Add in all the interfaces that we are compatible with.
3352 while test "$loop" -ne 0; do
3353 iface=`expr $revision - $loop`
3354 loop=`expr $loop - 1`
3355 verstring="$verstring_prefix$major.$iface:$verstring"
3358 # Before this point, $major must not contain `.'.
3360 versuffix="$major.$revision"
3364 major=.`expr $current - $age`
3365 versuffix="$major.$age.$revision"
3369 major=.`expr $current - $age`
3370 versuffix=".$current.$age.$revision"
3371 verstring="$current.$age.$revision"
3373 # Add in all the interfaces that we are compatible with.
3375 while test "$loop" -ne 0; do
3376 iface=`expr $current - $loop`
3377 loop=`expr $loop - 1`
3378 verstring="$verstring:${iface}.0"
3381 # Make executables depend on our current version.
3382 verstring="$verstring:${current}.0"
3387 versuffix=".$current.$revision"
3391 # Use '-' rather than '.', since we only want one
3392 # extension on DOS 8.3 filesystems.
3393 major=`expr $current - $age`
3398 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3399 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3404 # Clear the version info if we defaulted, and they specified a release.
3405 if test -z "$vinfo" && test -n "$release"; then
3407 case $version_type in
3409 # we can't check for "0.0" in archive_cmds due to quoting
3410 # problems, so we reset it completely
3417 if test "$need_version" = no; then
3424 # Remove version info from name if versioning should be avoided
3425 if test "$avoid_version" = yes && test "$need_version" = no; then
3431 # Check to see if the archive will have undefined symbols.
3432 if test "$allow_undefined" = yes; then
3433 if test "$allow_undefined_flag" = unsupported; then
3434 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3435 build_libtool_libs=no
3439 # Don't allow undefined symbols.
3440 allow_undefined_flag="$no_undefined_flag"
3444 if test "$mode" != relink; then
3445 # Remove our outputs, but don't remove object files since they
3446 # may have been created when compiling PIC objects.
3448 tempremovelist=`$echo "$output_objdir/*"`
3449 for p in $tempremovelist; do
3453 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3454 if test "X$precious_files_regex" != "X"; then
3455 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3460 removelist="$removelist $p"
3465 if test -n "$removelist"; then
3466 $show "${rm}r $removelist"
3467 $run ${rm}r $removelist
3471 # Now set the variables for building old libraries.
3472 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3473 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3475 # Transform .lo files to .o files.
3476 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3479 # Eliminate all temporary directories.
3480 #for path in $notinst_path; do
3481 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3482 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3483 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3486 if test -n "$xrpath"; then
3487 # If the user specified any rpath flags, then add them.
3489 for libdir in $xrpath; do
3490 temp_xrpath="$temp_xrpath -R$libdir"
3491 case "$finalize_rpath " in
3493 *) finalize_rpath="$finalize_rpath $libdir" ;;
3496 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3497 dependency_libs="$temp_xrpath $dependency_libs"
3501 # Make sure dlfiles contains only unique files that won't be dlpreopened
3502 old_dlfiles="$dlfiles"
3504 for lib in $old_dlfiles; do
3505 case " $dlprefiles $dlfiles " in
3507 *) dlfiles="$dlfiles $lib" ;;
3511 # Make sure dlprefiles contains only unique files
3512 old_dlprefiles="$dlprefiles"
3514 for lib in $old_dlprefiles; do
3515 case "$dlprefiles " in
3517 *) dlprefiles="$dlprefiles $lib" ;;
3521 if test "$build_libtool_libs" = yes; then
3522 if test -n "$rpath"; then
3524 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3525 # these systems don't actually have a c library (as such)!
3527 *-*-rhapsody* | *-*-darwin1.[012])
3528 # Rhapsody C library is in the System framework
3529 deplibs="$deplibs -framework System"
3532 # Don't link with libc until the a.out ld.so is fixed.
3534 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3535 # Do not include libc due to us having libc/libc_r.
3537 *-*-sco3.2v5* | *-*-sco5v6*)
3538 # Causes problems with __ctype
3540 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3541 # Compiler inserts libc in the correct place for threads to work
3544 # Add libc to deplibs on all other systems if necessary.
3545 if test "$build_libtool_need_lc" = "yes"; then
3546 deplibs="$deplibs -lc"
3552 # Transform deplibs into only deplibs that can be linked in shared.
3554 libname_save=$libname
3555 release_save=$release
3556 versuffix_save=$versuffix
3558 # I'm not sure if I'm treating the release correctly. I think
3559 # release should show up in the -l (ie -lgmp5) so we don't want to
3560 # add it in twice. Is that correct?
3566 case $deplibs_check_method in
3568 # Don't check for shared/static. Everything works.
3569 # This might be a little naive. We might want to check
3570 # whether the library exists or not. But this is on
3571 # osf3 & osf4 and I'm not really sure... Just
3572 # implementing what was already the behavior.
3576 # This code stresses the "libraries are programs" paradigm to its
3577 # limits. Maybe even breaks it. We compile a program, linking it
3578 # against the deplibs as a proxy for the library. Then we can check
3579 # whether they linked in statically or dynamically with ldd.
3581 cat > conftest.c <<EOF
3582 int main() { return 0; }
3585 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3586 ldd_output=`ldd conftest`
3587 for i in $deplibs; do
3588 name=`expr $i : '-l\(.*\)'`
3589 # If $name is empty we are operating on a -L argument.
3590 if test "$name" != "" && test "$name" != "0"; then
3591 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3592 case " $predeps $postdeps " in
3594 newdeplibs="$newdeplibs $i"
3599 if test -n "$i" ; then
3600 libname=`eval \\$echo \"$libname_spec\"`
3601 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3602 set dummy $deplib_matches
3604 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3605 newdeplibs="$newdeplibs $i"
3609 $echo "*** Warning: dynamic linker does not accept needed library $i."
3610 $echo "*** I have the capability to make that library automatically link in when"
3611 $echo "*** you link to this library. But I can only do this if you have a"
3612 $echo "*** shared version of the library, which I believe you do not have"
3613 $echo "*** because a test_compile did reveal that the linker did not use it for"
3614 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3618 newdeplibs="$newdeplibs $i"
3622 # Error occurred in the first compile. Let's try to salvage
3623 # the situation: Compile a separate program for each library.
3624 for i in $deplibs; do
3625 name=`expr $i : '-l\(.*\)'`
3626 # If $name is empty we are operating on a -L argument.
3627 if test "$name" != "" && test "$name" != "0"; then
3629 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3630 ldd_output=`ldd conftest`
3631 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3632 case " $predeps $postdeps " in
3634 newdeplibs="$newdeplibs $i"
3639 if test -n "$i" ; then
3640 libname=`eval \\$echo \"$libname_spec\"`
3641 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3642 set dummy $deplib_matches
3644 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3645 newdeplibs="$newdeplibs $i"
3649 $echo "*** Warning: dynamic linker does not accept needed library $i."
3650 $echo "*** I have the capability to make that library automatically link in when"
3651 $echo "*** you link to this library. But I can only do this if you have a"
3652 $echo "*** shared version of the library, which you do not appear to have"
3653 $echo "*** because a test_compile did reveal that the linker did not use this one"
3654 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3660 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3661 $echo "*** make it link in! You will probably need to install it or some"
3662 $echo "*** library that it depends on before this library will be fully"
3663 $echo "*** functional. Installing it before continuing would be even better."
3666 newdeplibs="$newdeplibs $i"
3672 set dummy $deplibs_check_method
3673 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3674 for a_deplib in $deplibs; do
3675 name=`expr $a_deplib : '-l\(.*\)'`
3676 # If $name is empty we are operating on a -L argument.
3677 if test "$name" != "" && test "$name" != "0"; then
3678 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3679 case " $predeps $postdeps " in
3681 newdeplibs="$newdeplibs $a_deplib"
3686 if test -n "$a_deplib" ; then
3687 libname=`eval \\$echo \"$libname_spec\"`
3688 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3689 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3690 for potent_lib in $potential_libs; do
3691 # Follow soft links.
3692 if ls -lLd "$potent_lib" 2>/dev/null \
3693 | grep " -> " >/dev/null; then
3696 # The statement above tries to avoid entering an
3697 # endless loop below, in case of cyclic links.
3698 # We might still enter an endless loop, since a link
3699 # loop can be closed while we follow links,
3701 potlib="$potent_lib"
3702 while test -h "$potlib" 2>/dev/null; do
3703 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3705 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3706 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3709 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3711 | $EGREP "$file_magic_regex" > /dev/null; then
3712 newdeplibs="$newdeplibs $a_deplib"
3719 if test -n "$a_deplib" ; then
3722 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3723 $echo "*** I have the capability to make that library automatically link in when"
3724 $echo "*** you link to this library. But I can only do this if you have a"
3725 $echo "*** shared version of the library, which you do not appear to have"
3726 $echo "*** because I did check the linker path looking for a file starting"
3727 if test -z "$potlib" ; then
3728 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3730 $echo "*** with $libname and none of the candidates passed a file format test"
3731 $echo "*** using a file magic. Last file checked: $potlib"
3735 # Add a -L argument.
3736 newdeplibs="$newdeplibs $a_deplib"
3738 done # Gone through all deplibs.
3741 set dummy $deplibs_check_method
3742 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3743 for a_deplib in $deplibs; do
3744 name=`expr $a_deplib : '-l\(.*\)'`
3745 # If $name is empty we are operating on a -L argument.
3746 if test -n "$name" && test "$name" != "0"; then
3747 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3748 case " $predeps $postdeps " in
3750 newdeplibs="$newdeplibs $a_deplib"
3755 if test -n "$a_deplib" ; then
3756 libname=`eval \\$echo \"$libname_spec\"`
3757 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3758 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3759 for potent_lib in $potential_libs; do
3760 potlib="$potent_lib" # see symlink-check above in file_magic test
3761 if eval $echo \"$potent_lib\" 2>/dev/null \
3763 | $EGREP "$match_pattern_regex" > /dev/null; then
3764 newdeplibs="$newdeplibs $a_deplib"
3771 if test -n "$a_deplib" ; then
3774 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3775 $echo "*** I have the capability to make that library automatically link in when"
3776 $echo "*** you link to this library. But I can only do this if you have a"
3777 $echo "*** shared version of the library, which you do not appear to have"
3778 $echo "*** because I did check the linker path looking for a file starting"
3779 if test -z "$potlib" ; then
3780 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3782 $echo "*** with $libname and none of the candidates passed a file format test"
3783 $echo "*** using a regex pattern. Last file checked: $potlib"
3787 # Add a -L argument.
3788 newdeplibs="$newdeplibs $a_deplib"
3790 done # Gone through all deplibs.
3794 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3795 -e 's/ -[LR][^ ]*//g'`
3796 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3797 for i in $predeps $postdeps ; do
3798 # can't use Xsed below, because $i might contain '/'
3799 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3802 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3803 | grep . >/dev/null; then
3805 if test "X$deplibs_check_method" = "Xnone"; then
3806 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3808 $echo "*** Warning: inter-library dependencies are not known to be supported."
3810 $echo "*** All declared inter-library dependencies are being dropped."
3815 versuffix=$versuffix_save
3817 release=$release_save
3818 libname=$libname_save
3822 *-*-rhapsody* | *-*-darwin1.[012])
3823 # On Rhapsody replace the C library is the System framework
3824 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3828 if test "$droppeddeps" = yes; then
3829 if test "$module" = yes; then
3831 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3832 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3833 $echo "*** a static module, that should work as long as the dlopening"
3834 $echo "*** application is linked with the -dlopen flag."
3835 if test -z "$global_symbol_pipe"; then
3837 $echo "*** However, this would only work if libtool was able to extract symbol"
3838 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3839 $echo "*** not find such a program. So, this module is probably useless."
3840 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3842 if test "$build_old_libs" = no; then
3843 oldlibs="$output_objdir/$libname.$libext"
3844 build_libtool_libs=module
3847 build_libtool_libs=no
3850 $echo "*** The inter-library dependencies that have been dropped here will be"
3851 $echo "*** automatically added whenever a program is linked with this library"
3852 $echo "*** or is declared to -dlopen it."
3854 if test "$allow_undefined" = no; then
3856 $echo "*** Since this library must not contain undefined symbols,"
3857 $echo "*** because either the platform does not support them or"
3858 $echo "*** it was explicitly requested with -no-undefined,"
3859 $echo "*** libtool will only create a static version of it."
3860 if test "$build_old_libs" = no; then
3861 oldlibs="$output_objdir/$libname.$libext"
3862 build_libtool_libs=module
3865 build_libtool_libs=no
3870 # Done checking deplibs!
3875 # move library search paths that coincide with paths to not yet
3876 # installed libraries to the beginning of the library search list
3878 for path in $notinst_path; do
3879 case " $new_libs " in
3880 *" -L$path/$objdir "*) ;;
3882 case " $deplibs " in
3883 *" -L$path/$objdir "*)
3884 new_libs="$new_libs -L$path/$objdir" ;;
3889 for deplib in $deplibs; do
3892 case " $new_libs " in
3894 *) new_libs="$new_libs $deplib" ;;
3897 *) new_libs="$new_libs $deplib" ;;
3903 # All the library-specific variables (install_libdir is set above).
3908 # Test again, we may have decided not to build it any more
3909 if test "$build_libtool_libs" = yes; then
3910 if test "$hardcode_into_libs" = yes; then
3911 # Hardcode the library paths
3914 rpath="$finalize_rpath"
3915 test "$mode" != relink && rpath="$compile_rpath$rpath"
3916 for libdir in $rpath; do
3917 if test -n "$hardcode_libdir_flag_spec"; then
3918 if test -n "$hardcode_libdir_separator"; then
3919 if test -z "$hardcode_libdirs"; then
3920 hardcode_libdirs="$libdir"
3922 # Just accumulate the unique libdirs.
3923 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3924 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3927 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3932 eval flag=\"$hardcode_libdir_flag_spec\"
3933 dep_rpath="$dep_rpath $flag"
3935 elif test -n "$runpath_var"; then
3936 case "$perm_rpath " in
3938 *) perm_rpath="$perm_rpath $libdir" ;;
3942 # Substitute the hardcoded libdirs into the rpath.
3943 if test -n "$hardcode_libdir_separator" &&
3944 test -n "$hardcode_libdirs"; then
3945 libdir="$hardcode_libdirs"
3946 if test -n "$hardcode_libdir_flag_spec_ld"; then
3947 case $archive_cmds in
3948 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3949 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3952 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3955 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3956 # We should set the runpath_var.
3958 for dir in $perm_rpath; do
3961 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3963 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3966 shlibpath="$finalize_shlibpath"
3967 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3968 if test -n "$shlibpath"; then
3969 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3972 # Get the real and link names of the library.
3973 eval shared_ext=\"$shrext_cmds\"
3974 eval library_names=\"$library_names_spec\"
3975 set dummy $library_names
3979 if test -n "$soname_spec"; then
3980 eval soname=\"$soname_spec\"
3984 if test -z "$dlname"; then
3988 lib="$output_objdir/$realname"
3992 linknames="$linknames $link"
3995 # Use standard objects if they are pic
3996 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3998 # Prepare the list of exported symbols
3999 if test -z "$export_symbols"; then
4000 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4001 $show "generating symbol list for \`$libname.la'"
4002 export_symbols="$output_objdir/$libname.exp"
4003 $run $rm $export_symbols
4004 cmds=$export_symbols_cmds
4005 save_ifs="$IFS"; IFS='~'
4006 for cmd in $cmds; do
4009 if len=`expr "X$cmd" : ".*"` &&
4010 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4012 $run eval "$cmd" || exit $?
4013 skipped_export=false
4015 # The command line is too long to execute in one step.
4016 $show "using reloadable object file for export list..."
4018 # Break out early, otherwise skipped_export may be
4019 # set to false by a later but shorter cmd.
4024 if test -n "$export_symbols_regex"; then
4025 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4026 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4027 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4028 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4033 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4034 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4038 for test_deplib in $deplibs; do
4039 case " $convenience " in
4040 *" $test_deplib "*) ;;
4042 tmp_deplibs="$tmp_deplibs $test_deplib"
4046 deplibs="$tmp_deplibs"
4048 if test -n "$convenience"; then
4049 if test -n "$whole_archive_flag_spec"; then
4050 save_libobjs=$libobjs
4051 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4053 gentop="$output_objdir/${outputname}x"
4054 generated="$generated $gentop"
4056 func_extract_archives $gentop $convenience
4057 libobjs="$libobjs $func_extract_archives_result"
4061 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4062 eval flag=\"$thread_safe_flag_spec\"
4063 linker_flags="$linker_flags $flag"
4066 # Make a backup of the uninstalled library when relinking
4067 if test "$mode" = relink; then
4068 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4071 # Do each of the archive commands.
4072 if test "$module" = yes && test -n "$module_cmds" ; then
4073 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4074 eval test_cmds=\"$module_expsym_cmds\"
4075 cmds=$module_expsym_cmds
4077 eval test_cmds=\"$module_cmds\"
4081 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4082 eval test_cmds=\"$archive_expsym_cmds\"
4083 cmds=$archive_expsym_cmds
4085 eval test_cmds=\"$archive_cmds\"
4090 if test "X$skipped_export" != "X:" &&
4091 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4092 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4095 # The command line is too long to link in one step, link piecewise.
4096 $echo "creating reloadable object files..."
4098 # Save the value of $output and $libobjs because we want to
4099 # use them later. If we have whole_archive_flag_spec, we
4100 # want to use save_libobjs as it was before
4101 # whole_archive_flag_spec was expanded, because we can't
4102 # assume the linker understands whole_archive_flag_spec.
4103 # This may have to be revisited, in case too many
4104 # convenience libraries get linked in and end up exceeding
4106 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4107 save_libobjs=$libobjs
4110 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4112 # Clear the reloadable object creation command queue and
4113 # initialize k to one.
4120 output=$output_objdir/$output_la-${k}.$objext
4121 # Loop over the list of objects to be linked.
4122 for obj in $save_libobjs
4124 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4125 if test "X$objlist" = X ||
4126 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4127 test "$len" -le "$max_cmd_len"; }; then
4128 objlist="$objlist $obj"
4130 # The command $test_cmds is almost too long, add a
4131 # command to the queue.
4132 if test "$k" -eq 1 ; then
4133 # The first file doesn't have a previous command to add.
4134 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4136 # All subsequent reloadable object files will link in
4137 # the last one created.
4138 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4140 last_robj=$output_objdir/$output_la-${k}.$objext
4142 output=$output_objdir/$output_la-${k}.$objext
4147 # Handle the remaining objects by creating one last
4148 # reloadable object file. All subsequent reloadable object
4149 # files will link in the last one created.
4150 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4151 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4153 if ${skipped_export-false}; then
4154 $show "generating symbol list for \`$libname.la'"
4155 export_symbols="$output_objdir/$libname.exp"
4156 $run $rm $export_symbols
4158 # Append the command to create the export file.
4159 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4162 # Set up a command to remove the reloadable object files
4163 # after they are used.
4165 while test "$i" -lt "$k"
4168 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4171 $echo "creating a temporary reloadable object file: $output"
4173 # Loop through the commands generated above and execute them.
4174 save_ifs="$IFS"; IFS='~'
4175 for cmd in $concat_cmds; do
4178 $run eval "$cmd" || exit $?
4183 # Restore the value of output.
4186 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4187 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4189 # Expand the library linking commands again to reset the
4190 # value of $libobjs for piecewise linking.
4192 # Do each of the archive commands.
4193 if test "$module" = yes && test -n "$module_cmds" ; then
4194 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4195 cmds=$module_expsym_cmds
4200 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4201 cmds=$archive_expsym_cmds
4207 # Append the command to remove the reloadable object files
4208 # to the just-reset $cmds.
4209 eval cmds=\"\$cmds~\$rm $delfiles\"
4211 save_ifs="$IFS"; IFS='~'
4212 for cmd in $cmds; do
4216 $run eval "$cmd" || {
4219 # Restore the uninstalled library and exit
4220 if test "$mode" = relink; then
4221 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4229 # Restore the uninstalled library and exit
4230 if test "$mode" = relink; then
4231 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4233 if test -n "$convenience"; then
4234 if test -z "$whole_archive_flag_spec"; then
4235 $show "${rm}r $gentop"
4236 $run ${rm}r "$gentop"
4243 # Create links to the real library.
4244 for linkname in $linknames; do
4245 if test "$realname" != "$linkname"; then
4246 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4247 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4251 # If -module or -export-dynamic was specified, set the dlname.
4252 if test "$module" = yes || test "$export_dynamic" = yes; then
4253 # On all known operating systems, these are identical.
4262 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4265 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4266 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4269 if test -n "$rpath"; then
4270 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4273 if test -n "$xrpath"; then
4274 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4277 if test -n "$vinfo"; then
4278 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4281 if test -n "$release"; then
4282 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4287 if test -n "$objs$old_deplibs"; then
4288 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4292 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4300 # Delete the old objects.
4301 $run $rm $obj $libobj
4303 # Objects from convenience libraries. This assumes
4304 # single-version convenience libraries. Whenever we create
4305 # different ones for PIC/non-PIC, this we'll have to duplicate
4309 # reload_cmds runs $LD directly, so let us get rid of
4310 # -Wl from whole_archive_flag_spec and hope we can get by with
4311 # turning comma into space..
4314 if test -n "$convenience"; then
4315 if test -n "$whole_archive_flag_spec"; then
4316 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4317 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4319 gentop="$output_objdir/${obj}x"
4320 generated="$generated $gentop"
4322 func_extract_archives $gentop $convenience
4323 reload_conv_objs="$reload_objs $func_extract_archives_result"
4327 # Create the old-style object.
4328 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
4332 save_ifs="$IFS"; IFS='~'
4333 for cmd in $cmds; do
4337 $run eval "$cmd" || exit $?
4341 # Exit if we aren't doing a library object file.
4342 if test -z "$libobj"; then
4343 if test -n "$gentop"; then
4344 $show "${rm}r $gentop"
4351 if test "$build_libtool_libs" != yes; then
4352 if test -n "$gentop"; then
4353 $show "${rm}r $gentop"
4357 # Create an invalid libtool object if no PIC, so that we don't
4358 # accidentally link it into a program.
4359 # $show "echo timestamp > $libobj"
4360 # $run eval "echo timestamp > $libobj" || exit $?
4364 if test -n "$pic_flag" || test "$pic_mode" != default; then
4365 # Only do commands if we really have different PIC objects.
4366 reload_objs="$libobjs $reload_conv_objs"
4369 save_ifs="$IFS"; IFS='~'
4370 for cmd in $cmds; do
4374 $run eval "$cmd" || exit $?
4379 if test -n "$gentop"; then
4380 $show "${rm}r $gentop"
4389 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4391 if test -n "$vinfo"; then
4392 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4395 if test -n "$release"; then
4396 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4399 if test "$preload" = yes; then
4400 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4401 test "$dlopen_self_static" = unknown; then
4402 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4407 *-*-rhapsody* | *-*-darwin1.[012])
4408 # On Rhapsody replace the C library is the System framework
4409 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4410 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4416 # Don't allow lazy linking, it breaks C++ global constructors
4417 if test "$tagname" = CXX ; then
4418 compile_command="$compile_command ${wl}-bind_at_load"
4419 finalize_command="$finalize_command ${wl}-bind_at_load"
4425 # move library search paths that coincide with paths to not yet
4426 # installed libraries to the beginning of the library search list
4428 for path in $notinst_path; do
4429 case " $new_libs " in
4430 *" -L$path/$objdir "*) ;;
4432 case " $compile_deplibs " in
4433 *" -L$path/$objdir "*)
4434 new_libs="$new_libs -L$path/$objdir" ;;
4439 for deplib in $compile_deplibs; do
4442 case " $new_libs " in
4444 *) new_libs="$new_libs $deplib" ;;
4447 *) new_libs="$new_libs $deplib" ;;
4450 compile_deplibs="$new_libs"
4453 compile_command="$compile_command $compile_deplibs"
4454 finalize_command="$finalize_command $finalize_deplibs"
4456 if test -n "$rpath$xrpath"; then
4457 # If the user specified any rpath flags, then add them.
4458 for libdir in $rpath $xrpath; do
4459 # This is the magic to use -rpath.
4460 case "$finalize_rpath " in
4462 *) finalize_rpath="$finalize_rpath $libdir" ;;
4467 # Now hardcode the library paths
4470 for libdir in $compile_rpath $finalize_rpath; do
4471 if test -n "$hardcode_libdir_flag_spec"; then
4472 if test -n "$hardcode_libdir_separator"; then
4473 if test -z "$hardcode_libdirs"; then
4474 hardcode_libdirs="$libdir"
4476 # Just accumulate the unique libdirs.
4477 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4478 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4481 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4486 eval flag=\"$hardcode_libdir_flag_spec\"
4487 rpath="$rpath $flag"
4489 elif test -n "$runpath_var"; then
4490 case "$perm_rpath " in
4492 *) perm_rpath="$perm_rpath $libdir" ;;
4496 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4497 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4498 case :$dllsearchpath: in
4500 *) dllsearchpath="$dllsearchpath:$libdir";;
4502 case :$dllsearchpath: in
4503 *":$testbindir:"*) ;;
4504 *) dllsearchpath="$dllsearchpath:$testbindir";;
4509 # Substitute the hardcoded libdirs into the rpath.
4510 if test -n "$hardcode_libdir_separator" &&
4511 test -n "$hardcode_libdirs"; then
4512 libdir="$hardcode_libdirs"
4513 eval rpath=\" $hardcode_libdir_flag_spec\"
4515 compile_rpath="$rpath"
4519 for libdir in $finalize_rpath; do
4520 if test -n "$hardcode_libdir_flag_spec"; then
4521 if test -n "$hardcode_libdir_separator"; then
4522 if test -z "$hardcode_libdirs"; then
4523 hardcode_libdirs="$libdir"
4525 # Just accumulate the unique libdirs.
4526 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4527 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4530 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4535 eval flag=\"$hardcode_libdir_flag_spec\"
4536 rpath="$rpath $flag"
4538 elif test -n "$runpath_var"; then
4539 case "$finalize_perm_rpath " in
4541 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4545 # Substitute the hardcoded libdirs into the rpath.
4546 if test -n "$hardcode_libdir_separator" &&
4547 test -n "$hardcode_libdirs"; then
4548 libdir="$hardcode_libdirs"
4549 eval rpath=\" $hardcode_libdir_flag_spec\"
4551 finalize_rpath="$rpath"
4553 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4554 # Transform all the library objects into standard objects.
4555 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4556 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4560 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4561 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4562 dlsyms="${outputname}S.c"
4564 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4568 if test -n "$dlsyms"; then
4572 # Discover the nlist of each of the dlfiles.
4573 nlist="$output_objdir/${outputname}.nm"
4575 $show "$rm $nlist ${nlist}S ${nlist}T"
4576 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4578 # Parse the name list into a source file.
4579 $show "creating $output_objdir/$dlsyms"
4581 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4582 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4583 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4589 /* Prevent the only kind of declaration conflicts we can make. */
4590 #define lt_preloaded_symbols some_other_symbol
4592 /* External symbol declarations for the compiler. */\
4595 if test "$dlself" = yes; then
4596 $show "generating symbol list for \`$output'"
4598 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4600 # Add our own program objects to the symbol list.
4601 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4602 for arg in $progfiles; do
4603 $show "extracting global C symbols from \`$arg'"
4604 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4607 if test -n "$exclude_expsyms"; then
4608 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4609 $run eval '$mv "$nlist"T "$nlist"'
4612 if test -n "$export_symbols_regex"; then
4613 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4614 $run eval '$mv "$nlist"T "$nlist"'
4617 # Prepare the list of exported symbols
4618 if test -z "$export_symbols"; then
4619 export_symbols="$output_objdir/$outputname.exp"
4620 $run $rm $export_symbols
4621 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4623 *cygwin* | *mingw* )
4624 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4625 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4629 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4630 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4631 $run eval 'mv "$nlist"T "$nlist"'
4633 *cygwin* | *mingw* )
4634 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4635 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4641 for arg in $dlprefiles; do
4642 $show "extracting global C symbols from \`$arg'"
4643 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4644 $run eval '$echo ": $name " >> "$nlist"'
4645 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4648 if test -z "$run"; then
4649 # Make sure we have at least an empty file.
4650 test -f "$nlist" || : > "$nlist"
4652 if test -n "$exclude_expsyms"; then
4653 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4654 $mv "$nlist"T "$nlist"
4657 # Try sorting and uniquifying the output.
4658 if grep -v "^: " < "$nlist" |
4659 if sort -k 3 </dev/null >/dev/null 2>&1; then
4664 uniq > "$nlist"S; then
4667 grep -v "^: " < "$nlist" > "$nlist"S
4670 if test -f "$nlist"S; then
4671 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4673 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4676 $echo >> "$output_objdir/$dlsyms" "\
4678 #undef lt_preloaded_symbols
4680 #if defined (__STDC__) && __STDC__
4681 # define lt_ptr void *
4683 # define lt_ptr char *
4687 /* The mapping between symbol names and symbols. */
4691 *cygwin* | *mingw* )
4692 $echo >> "$output_objdir/$dlsyms" "\
4693 /* DATA imports from DLLs on WIN32 can't be const, because
4694 runtime relocations are performed -- see ld's documentation
4700 $echo >> "$output_objdir/$dlsyms" "\
4707 $echo >> "$output_objdir/$dlsyms" "\
4711 lt_preloaded_symbols[] =
4715 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4717 $echo >> "$output_objdir/$dlsyms" "\
4721 /* This works around a problem in FreeBSD linker */
4722 #ifdef FREEBSD_WORKAROUND
4723 static const void *lt_preloaded_setup() {
4724 return lt_preloaded_symbols;
4734 pic_flag_for_symtable=
4736 # compiling the symbol table file with pic_flag works around
4737 # a FreeBSD bug that causes programs to crash when -lm is
4738 # linked before any other PIC object. But we must not use
4739 # pic_flag when linking with -static. The problem exists in
4740 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4741 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4742 case "$compile_command " in
4744 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4747 case "$compile_command " in
4749 *) pic_flag_for_symtable=" $pic_flag";;
4753 # Now compile the dynamic symbol file.
4754 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4755 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4757 # Clean up the generated files.
4758 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4759 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4761 # Transform the symbol file into the correct name.
4763 *cygwin* | *mingw* )
4764 if test -f "$output_objdir/${outputname}.def" ; then
4765 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4766 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4768 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4769 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4773 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4774 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4784 # We keep going just in case the user didn't refer to
4785 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4786 # really was required.
4788 # Nullify the symbol file.
4789 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4790 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4793 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4794 # Replace the output file specification.
4795 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4796 link_command="$compile_command$compile_rpath"
4798 # We have no uninstalled library dependencies, so finalize right now.
4799 $show "$link_command"
4800 $run eval "$link_command"
4803 # Delete the generated files.
4804 if test -n "$dlsyms"; then
4805 $show "$rm $output_objdir/${outputname}S.${objext}"
4806 $run $rm "$output_objdir/${outputname}S.${objext}"
4812 if test -n "$shlibpath_var"; then
4813 # We should set the shlibpath_var
4815 for dir in $temp_rpath; do
4817 [\\/]* | [A-Za-z]:[\\/]*)
4822 # Relative path: add a thisdir entry.
4823 rpath="$rpath\$thisdir/$dir:"
4830 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4831 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4833 if test -n "$finalize_shlibpath"; then
4834 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4839 if test -n "$runpath_var"; then
4840 if test -n "$perm_rpath"; then
4841 # We should set the runpath_var.
4843 for dir in $perm_rpath; do
4846 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4848 if test -n "$finalize_perm_rpath"; then
4849 # We should set the runpath_var.
4851 for dir in $finalize_perm_rpath; do
4854 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4858 if test "$no_install" = yes; then
4859 # We don't need to create a wrapper script.
4860 link_command="$compile_var$compile_command$compile_rpath"
4861 # Replace the output file specification.
4862 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4863 # Delete the old output file.
4865 # Link the executable and exit
4866 $show "$link_command"
4867 $run eval "$link_command" || exit $?
4871 if test "$hardcode_action" = relink; then
4872 # Fast installation is not supported
4873 link_command="$compile_var$compile_command$compile_rpath"
4874 relink_command="$finalize_var$finalize_command$finalize_rpath"
4876 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4877 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4879 if test "$fast_install" != no; then
4880 link_command="$finalize_var$compile_command$finalize_rpath"
4881 if test "$fast_install" = yes; then
4882 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4884 # fast_install is set to needless
4888 link_command="$compile_var$compile_command$compile_rpath"
4889 relink_command="$finalize_var$finalize_command$finalize_rpath"
4893 # Replace the output file specification.
4894 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4896 # Delete the old output files.
4897 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4899 $show "$link_command"
4900 $run eval "$link_command" || exit $?
4902 # Now create the wrapper script.
4903 $show "creating $output"
4905 # Quote the relink command for shipping.
4906 if test -n "$relink_command"; then
4907 # Preserve any variables that may affect compiler behavior
4908 for var in $variables_saved_for_relink; do
4909 if eval test -z \"\${$var+set}\"; then
4910 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4911 elif eval var_value=\$$var; test -z "$var_value"; then
4912 relink_command="$var=; export $var; $relink_command"
4914 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4915 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4918 relink_command="(cd `pwd`; $relink_command)"
4919 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4922 # Quote $echo for shipping.
4923 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4925 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4926 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4928 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4930 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4933 # Only actually do things if our run command is non-null.
4934 if test -z "$run"; then
4935 # win32 will think the script is a binary if it has
4936 # a .exe suffix, so we strip it off here.
4938 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4940 # test for cygwin because mv fails w/o .exe extensions
4944 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4948 *cygwin* | *mingw* )
4949 output_name=`basename $output`
4950 output_path=`dirname $output`
4951 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4952 cwrapper="$output_path/$output_name.exe"
4953 $rm $cwrappersource $cwrapper
4954 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4956 cat > $cwrappersource <<EOF
4958 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4959 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4961 The $output program cannot be directly executed until all the libtool
4962 libraries that it depends on are installed.
4964 This wrapper executable should never be moved out of the build directory.
4965 If it is, it will not operate correctly.
4967 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4968 but could eventually absorb all of the scripts functionality and
4969 exec $objdir/$outputname directly.
4972 cat >> $cwrappersource<<"EOF"
4981 #include <sys/stat.h>
4983 #if defined(PATH_MAX)
4984 # define LT_PATHMAX PATH_MAX
4985 #elif defined(MAXPATHLEN)
4986 # define LT_PATHMAX MAXPATHLEN
4988 # define LT_PATHMAX 1024
4991 #ifndef DIR_SEPARATOR
4992 # define DIR_SEPARATOR '/'
4993 # define PATH_SEPARATOR ':'
4996 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4998 # define HAVE_DOS_BASED_FILE_SYSTEM
4999 # ifndef DIR_SEPARATOR_2
5000 # define DIR_SEPARATOR_2 '\\'
5002 # ifndef PATH_SEPARATOR_2
5003 # define PATH_SEPARATOR_2 ';'
5007 #ifndef DIR_SEPARATOR_2
5008 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5009 #else /* DIR_SEPARATOR_2 */
5010 # define IS_DIR_SEPARATOR(ch) \
5011 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5012 #endif /* DIR_SEPARATOR_2 */
5014 #ifndef PATH_SEPARATOR_2
5015 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5016 #else /* PATH_SEPARATOR_2 */
5017 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5018 #endif /* PATH_SEPARATOR_2 */
5020 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5021 #define XFREE(stale) do { \
5022 if (stale) { free ((void *) stale); stale = 0; } \
5025 /* -DDEBUG is fairly common in CFLAGS. */
5027 #if defined DEBUGWRAPPER
5028 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5030 # define DEBUG(format, ...)
5033 const char *program_name = NULL;
5035 void * xmalloc (size_t num);
5036 char * xstrdup (const char *string);
5037 const char * base_name (const char *name);
5038 char * find_executable(const char *wrapper);
5039 int check_executable(const char *path);
5040 char * strendzap(char *str, const char *pat);
5041 void lt_fatal (const char *message, ...);
5044 main (int argc, char *argv[])
5049 program_name = (char *) xstrdup (base_name (argv[0]));
5050 DEBUG("(main) argv[0] : %s\n",argv[0]);
5051 DEBUG("(main) program_name : %s\n",program_name);
5052 newargz = XMALLOC(char *, argc+2);
5055 cat >> $cwrappersource <<EOF
5056 newargz[0] = (char *) xstrdup("$SHELL");
5059 cat >> $cwrappersource <<"EOF"
5060 newargz[1] = find_executable(argv[0]);
5061 if (newargz[1] == NULL)
5062 lt_fatal("Couldn't find %s", argv[0]);
5063 DEBUG("(main) found exe at : %s\n",newargz[1]);
5064 /* we know the script has the same name, without the .exe */
5065 /* so make sure newargz[1] doesn't end in .exe */
5066 strendzap(newargz[1],".exe");
5067 for (i = 1; i < argc; i++)
5068 newargz[i+1] = xstrdup(argv[i]);
5069 newargz[argc+1] = NULL;
5071 for (i=0; i<argc+1; i++)
5073 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5081 cat >> $cwrappersource <<EOF
5082 execv("$SHELL",(char const **)newargz);
5086 cat >> $cwrappersource <<EOF
5087 execv("$SHELL",newargz);
5092 cat >> $cwrappersource <<"EOF"
5097 xmalloc (size_t num)
5099 void * p = (void *) malloc (num);
5101 lt_fatal ("Memory exhausted");
5107 xstrdup (const char *string)
5109 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5114 base_name (const char *name)
5118 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5119 /* Skip over the disk name in MSDOS pathnames. */
5120 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5124 for (base = name; *name; name++)
5125 if (IS_DIR_SEPARATOR (*name))
5131 check_executable(const char * path)
5135 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5136 if ((!path) || (!*path))
5139 if ((stat (path, &st) >= 0) &&
5141 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5142 #if defined (S_IXOTH)
5143 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5145 #if defined (S_IXGRP)
5146 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5148 ((st.st_mode & S_IXUSR) == S_IXUSR))
5155 /* Searches for the full path of the wrapper. Returns
5156 newly allocated full path name if found, NULL otherwise */
5158 find_executable (const char* wrapper)
5163 /* static buffer for getcwd */
5164 char tmp[LT_PATHMAX + 1];
5168 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5170 if ((wrapper == NULL) || (*wrapper == '\0'))
5173 /* Absolute path? */
5174 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5175 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5177 concat_name = xstrdup (wrapper);
5178 if (check_executable(concat_name))
5185 if (IS_DIR_SEPARATOR (wrapper[0]))
5187 concat_name = xstrdup (wrapper);
5188 if (check_executable(concat_name))
5192 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5196 for (p = wrapper; *p; p++)
5204 /* no slashes; search PATH */
5205 const char* path = getenv ("PATH");
5208 for (p = path; *p; p = p_next)
5212 for (q = p; *q; q++)
5213 if (IS_PATH_SEPARATOR(*q))
5216 p_next = (*q == '\0' ? q : q + 1);
5219 /* empty path: current directory */
5220 if (getcwd (tmp, LT_PATHMAX) == NULL)
5221 lt_fatal ("getcwd failed");
5222 tmp_len = strlen(tmp);
5223 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5224 memcpy (concat_name, tmp, tmp_len);
5225 concat_name[tmp_len] = '/';
5226 strcpy (concat_name + tmp_len + 1, wrapper);
5230 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5231 memcpy (concat_name, p, p_len);
5232 concat_name[p_len] = '/';
5233 strcpy (concat_name + p_len + 1, wrapper);
5235 if (check_executable(concat_name))
5240 /* not found in PATH; assume curdir */
5242 /* Relative path | not found in path: prepend cwd */
5243 if (getcwd (tmp, LT_PATHMAX) == NULL)
5244 lt_fatal ("getcwd failed");
5245 tmp_len = strlen(tmp);
5246 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5247 memcpy (concat_name, tmp, tmp_len);
5248 concat_name[tmp_len] = '/';
5249 strcpy (concat_name + tmp_len + 1, wrapper);
5251 if (check_executable(concat_name))
5258 strendzap(char *str, const char *pat)
5262 assert(str != NULL);
5263 assert(pat != NULL);
5266 patlen = strlen(pat);
5270 str += len - patlen;
5271 if (strcmp(str, pat) == 0)
5278 lt_error_core (int exit_status, const char * mode,
5279 const char * message, va_list ap)
5281 fprintf (stderr, "%s: %s: ", program_name, mode);
5282 vfprintf (stderr, message, ap);
5283 fprintf (stderr, ".\n");
5285 if (exit_status >= 0)
5290 lt_fatal (const char *message, ...)
5293 va_start (ap, message);
5294 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5298 # we should really use a build-platform specific compiler
5299 # here, but OTOH, the wrappers (shell script and this C one)
5300 # are only useful if you want to execute the "real" binary.
5301 # Since the "real" binary is built for $host, then this
5302 # wrapper might as well be built for $host, too.
5303 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5307 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5312 # $output - temporary wrapper script for $objdir/$outputname
5313 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5315 # The $output program cannot be directly executed until all the libtool
5316 # libraries that it depends on are installed.
5318 # This wrapper script should never be moved out of the build directory.
5319 # If it is, it will not operate correctly.
5321 # Sed substitution that helps us do robust quoting. It backslashifies
5322 # metacharacters that are still active within double-quoted strings.
5323 Xsed='${SED} -e 1s/^X//'
5324 sed_quote_subst='$sed_quote_subst'
5326 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5327 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5330 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5331 # is contrary to our usage. Disable this feature.
5332 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5333 setopt NO_GLOB_SUBST
5335 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5337 BIN_SH=xpg4; export BIN_SH # for Tru64
5338 DUALCASE=1; export DUALCASE # for MKS sh
5340 # The HP-UX ksh and POSIX shell print the target directory to stdout
5342 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5344 relink_command=\"$relink_command\"
5346 # This environment variable determines our operation mode.
5347 if test \"\$libtool_install_magic\" = \"$magic\"; then
5348 # install mode needs the following variable:
5349 notinst_deplibs='$notinst_deplibs'
5351 # When we are sourced in execute mode, \$file and \$echo are already set.
5352 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5355 # Make sure echo works.
5356 if test \"X\$1\" = X--no-reexec; then
5357 # Discard the --no-reexec flag, and continue.
5359 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5360 # Yippee, \$echo works!
5363 # Restart under the correct shell, and then maybe \$echo will work.
5364 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5370 # Find the directory that this script lives in.
5371 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5372 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5374 # Follow symbolic links until we get to the real thisdir.
5375 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5376 while test -n \"\$file\"; do
5377 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5379 # If there was a directory component, then change thisdir.
5380 if test \"x\$destdir\" != \"x\$file\"; then
5381 case \"\$destdir\" in
5382 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5383 *) thisdir=\"\$thisdir/\$destdir\" ;;
5387 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5388 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5391 # Try to get the absolute directory name.
5392 absdir=\`cd \"\$thisdir\" && pwd\`
5393 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5396 if test "$fast_install" = yes; then
5398 program=lt-'$outputname'$exeext
5399 progdir=\"\$thisdir/$objdir\"
5401 if test ! -f \"\$progdir/\$program\" || \\
5402 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5403 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5405 file=\"\$\$-\$program\"
5407 if test ! -d \"\$progdir\"; then
5408 $mkdir \"\$progdir\"
5410 $rm \"\$progdir/\$file\"
5415 # relink executable if necessary
5416 if test -n \"\$relink_command\"; then
5417 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5419 $echo \"\$relink_command_output\" >&2
5420 $rm \"\$progdir/\$file\"
5425 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5426 { $rm \"\$progdir/\$program\";
5427 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5428 $rm \"\$progdir/\$file\"
5432 program='$outputname'
5433 progdir=\"\$thisdir/$objdir\"
5439 if test -f \"\$progdir/\$program\"; then"
5441 # Export our shlibpath_var if we have one.
5442 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5444 # Add our own library path to $shlibpath_var
5445 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5447 # Some systems cannot cope with colon-terminated $shlibpath_var
5448 # The second colon is a workaround for a bug in BeOS R4 sed
5449 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5451 export $shlibpath_var
5455 # fixup the dll searchpath if we need to.
5456 if test -n "$dllsearchpath"; then
5458 # Add the dll search path components to the executable PATH
5459 PATH=$dllsearchpath:\$PATH
5464 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5465 # Run the actual program with our arguments.
5468 # Backslashes separate directories on plain windows
5469 *-*-mingw | *-*-os2*)
5471 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5477 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5482 \$echo \"\$0: cannot exec \$program \$*\"
5486 # The program doesn't exist.
5487 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5488 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5489 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5500 # See if we need to build an old-fashioned archive.
5501 for oldlib in $oldlibs; do
5503 if test "$build_libtool_libs" = convenience; then
5504 oldobjs="$libobjs_save"
5505 addlibs="$convenience"
5506 build_libtool_libs=no
5508 if test "$build_libtool_libs" = module; then
5509 oldobjs="$libobjs_save"
5510 build_libtool_libs=no
5512 oldobjs="$old_deplibs $non_pic_objects"
5514 addlibs="$old_convenience"
5517 if test -n "$addlibs"; then
5518 gentop="$output_objdir/${outputname}x"
5519 generated="$generated $gentop"
5521 func_extract_archives $gentop $addlibs
5522 oldobjs="$oldobjs $func_extract_archives_result"
5525 # Do each command in the archive commands.
5526 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5527 cmds=$old_archive_from_new_cmds
5529 # POSIX demands no paths to be encoded in archives. We have
5530 # to avoid creating archives with duplicate basenames if we
5531 # might have to extract them afterwards, e.g., when creating a
5532 # static archive out of a convenience library, or when linking
5533 # the entirety of a libtool archive into another (currently
5534 # not supported by libtool).
5535 if (for obj in $oldobjs
5537 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5538 done | sort | sort -uc >/dev/null 2>&1); then
5541 $echo "copying selected object files to avoid basename conflicts..."
5543 if test -z "$gentop"; then
5544 gentop="$output_objdir/${outputname}x"
5545 generated="$generated $gentop"
5547 $show "${rm}r $gentop"
5548 $run ${rm}r "$gentop"
5549 $show "$mkdir $gentop"
5550 $run $mkdir "$gentop"
5552 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5557 save_oldobjs=$oldobjs
5560 for obj in $save_oldobjs
5562 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5563 case " $oldobjs " in
5564 " ") oldobjs=$obj ;;
5567 # Make sure we don't pick an alternate name that also
5569 newobj=lt$counter-$objbase
5570 counter=`expr $counter + 1`
5571 case " $oldobjs " in
5572 *[\ /]"$newobj "*) ;;
5573 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5576 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5577 $run ln "$obj" "$gentop/$newobj" ||
5578 $run cp "$obj" "$gentop/$newobj"
5579 oldobjs="$oldobjs $gentop/$newobj"
5581 *) oldobjs="$oldobjs $obj" ;;
5586 eval cmds=\"$old_archive_cmds\"
5588 if len=`expr "X$cmds" : ".*"` &&
5589 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5590 cmds=$old_archive_cmds
5592 # the command line is too long to link in one step, link in parts
5593 $echo "using piecewise archive linking..."
5598 save_oldobjs=$oldobjs
5600 # Is there a better way of finding the last object in the list?
5601 for obj in $save_oldobjs
5605 for obj in $save_oldobjs
5607 oldobjs="$objlist $obj"
5608 objlist="$objlist $obj"
5609 eval test_cmds=\"$old_archive_cmds\"
5610 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5611 test "$len" -le "$max_cmd_len"; then
5614 # the above command should be used before it gets too long
5616 if test "$obj" = "$last_oldobj" ; then
5619 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5620 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5626 if test "X$oldobjs" = "X" ; then
5627 eval cmds=\"\$concat_cmds\"
5629 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5633 save_ifs="$IFS"; IFS='~'
5634 for cmd in $cmds; do
5638 $run eval "$cmd" || exit $?
5643 if test -n "$generated"; then
5644 $show "${rm}r$generated"
5645 $run ${rm}r$generated
5648 # Now create the libtool archive.
5652 test "$build_old_libs" = yes && old_library="$libname.$libext"
5653 $show "creating $output"
5655 # Preserve any variables that may affect compiler behavior
5656 for var in $variables_saved_for_relink; do
5657 if eval test -z \"\${$var+set}\"; then
5658 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5659 elif eval var_value=\$$var; test -z "$var_value"; then
5660 relink_command="$var=; export $var; $relink_command"
5662 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5663 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5666 # Quote the link command for shipping.
5667 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5668 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5669 if test "$hardcode_automatic" = yes ; then
5674 # Only create the output if not a dry run.
5675 if test -z "$run"; then
5676 for installed in no yes; do
5677 if test "$installed" = yes; then
5678 if test -z "$install_libdir"; then
5681 output="$output_objdir/$outputname"i
5682 # Replace all uninstalled libtool libraries with the installed ones
5684 for deplib in $dependency_libs; do
5687 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5688 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5689 if test -z "$libdir"; then
5690 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5693 newdependency_libs="$newdependency_libs $libdir/$name"
5695 *) newdependency_libs="$newdependency_libs $deplib" ;;
5698 dependency_libs="$newdependency_libs"
5700 for lib in $dlfiles; do
5701 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5702 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5703 if test -z "$libdir"; then
5704 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5707 newdlfiles="$newdlfiles $libdir/$name"
5709 dlfiles="$newdlfiles"
5711 for lib in $dlprefiles; do
5712 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5713 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5714 if test -z "$libdir"; then
5715 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5718 newdlprefiles="$newdlprefiles $libdir/$name"
5720 dlprefiles="$newdlprefiles"
5723 for lib in $dlfiles; do
5725 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5726 *) abs=`pwd`"/$lib" ;;
5728 newdlfiles="$newdlfiles $abs"
5730 dlfiles="$newdlfiles"
5732 for lib in $dlprefiles; do
5734 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5735 *) abs=`pwd`"/$lib" ;;
5737 newdlprefiles="$newdlprefiles $abs"
5739 dlprefiles="$newdlprefiles"
5742 # place dlname in correct position for cygwin
5744 case $host,$output,$installed,$module,$dlname in
5745 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5748 # $outputname - a libtool library file
5749 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5751 # Please DO NOT delete this file!
5752 # It is necessary for linking the library.
5754 # The name that we can dlopen(3).
5757 # Names of this library.
5758 library_names='$library_names'
5760 # The name of the static archive.
5761 old_library='$old_library'
5763 # Libraries that this one depends upon.
5764 dependency_libs='$dependency_libs'
5766 # Version information for $libname.
5771 # Is this an already installed library?
5772 installed=$installed
5774 # Should we warn about portability when linking against -modules?
5775 shouldnotlink=$module
5777 # Files to dlopen/dlpreopen
5779 dlpreopen='$dlprefiles'
5781 # Directory that this library needs to be installed in:
5782 libdir='$install_libdir'"
5783 if test "$installed" = no && test "$need_relink" = yes; then
5785 relink_command=\"$relink_command\""
5790 # Do a symbolic link so that the libtool archive can be found in
5791 # LD_LIBRARY_PATH before the program is installed.
5792 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5793 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5799 # libtool install mode
5801 modename="$modename: install"
5803 # There may be an optional sh(1) argument at the beginning of
5804 # install_prog (especially on Windows NT).
5805 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5806 # Allow the use of GNU shtool's install command.
5807 $echo "X$nonopt" | grep shtool > /dev/null; then
5808 # Aesthetically quote it.
5809 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5811 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5815 install_prog="$arg "
5823 # The real first argument should be the name of the installation program.
5824 # Aesthetically quote it.
5825 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5827 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5831 install_prog="$install_prog$arg"
5833 # We need to accept at least all the BSD install flags.
5843 if test -n "$dest"; then
5844 files="$files $dest"
5852 case " $install_prog " in
5857 -g | -m | -o) prev=$arg ;;
5865 # If the previous option needed an argument, then skip it.
5866 if test -n "$prev"; then
5875 # Aesthetically quote the argument.
5876 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5878 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5882 install_prog="$install_prog $arg"
5885 if test -z "$install_prog"; then
5886 $echo "$modename: you must specify an install program" 1>&2
5891 if test -n "$prev"; then
5892 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5897 if test -z "$files"; then
5898 if test -z "$dest"; then
5899 $echo "$modename: no file or destination specified" 1>&2
5901 $echo "$modename: you must specify a destination" 1>&2
5907 # Strip any trailing slash from the destination.
5908 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5910 # Check to see that the destination is a directory.
5911 test -d "$dest" && isdir=yes
5912 if test "$isdir" = yes; then
5916 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5917 test "X$destdir" = "X$dest" && destdir=.
5918 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5920 # Not a directory, so check to see that there is only one file specified.
5922 if test "$#" -gt 2; then
5923 $echo "$modename: \`$dest' is not a directory" 1>&2
5929 [\\/]* | [A-Za-z]:[\\/]*) ;;
5931 for file in $files; do
5935 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5944 # This variable tells wrapper scripts just to set variables rather
5945 # than running their programs.
5946 libtool_install_magic="$magic"
5951 for file in $files; do
5953 # Do each installation.
5956 # Do the static libraries later.
5957 staticlibs="$staticlibs $file"
5961 # Check to see that this really is a libtool archive.
5962 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5964 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5972 # If there is no directory component, then add one.
5974 */* | *\\*) . $file ;;
5978 # Add the libdir to current_libdirs if it is the destination.
5979 if test "X$destdir" = "X$libdir"; then
5980 case "$current_libdirs " in
5982 *) current_libdirs="$current_libdirs $libdir" ;;
5985 # Note the libdir as a future libdir.
5986 case "$future_libdirs " in
5988 *) future_libdirs="$future_libdirs $libdir" ;;
5992 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5993 test "X$dir" = "X$file/" && dir=
5996 if test -n "$relink_command"; then
5997 # Determine the prefix the user has applied to our future dir.
5998 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6000 # Don't allow the user to place us outside of our expected
6001 # location b/c this prevents finding dependent libraries that
6002 # are installed to the same prefix.
6003 # At present, this check doesn't affect windows .dll's that
6004 # are installed into $libdir/../bin (currently, that works fine)
6005 # but it's something to keep an eye on.
6006 if test "$inst_prefix_dir" = "$destdir"; then
6007 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6011 if test -n "$inst_prefix_dir"; then
6012 # Stick the inst_prefix_dir data into the link command.
6013 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6015 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6018 $echo "$modename: warning: relinking \`$file'" 1>&2
6019 $show "$relink_command"
6020 if $run eval "$relink_command"; then :
6022 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6027 # See the names of the shared library.
6028 set dummy $library_names
6029 if test -n "$2"; then
6035 test -n "$relink_command" && srcname="$realname"T
6037 # Install the shared library and build the symlinks.
6038 $show "$install_prog $dir/$srcname $destdir/$realname"
6039 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6040 if test -n "$stripme" && test -n "$striplib"; then
6041 $show "$striplib $destdir/$realname"
6042 $run eval "$striplib $destdir/$realname" || exit $?
6045 if test "$#" -gt 0; then
6046 # Delete the old symlinks, and create new ones.
6047 # Try `ln -sf' first, because the `ln' binary might depend on
6048 # the symlink we replace! Solaris /bin/ln does not understand -f,
6049 # so we also need to try rm && ln -s.
6052 if test "$linkname" != "$realname"; then
6053 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6054 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6059 # Do each command in the postinstall commands.
6060 lib="$destdir/$realname"
6061 cmds=$postinstall_cmds
6062 save_ifs="$IFS"; IFS='~'
6063 for cmd in $cmds; do
6067 $run eval "$cmd" || {
6070 # Restore the uninstalled library and exit
6071 if test "$mode" = relink; then
6072 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6081 # Install the pseudo-library for information purposes.
6082 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6083 instname="$dir/$name"i
6084 $show "$install_prog $instname $destdir/$name"
6085 $run eval "$install_prog $instname $destdir/$name" || exit $?
6087 # Maybe install the static library, too.
6088 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6092 # Install (i.e. copy) a libtool object.
6094 # Figure out destination file name, if it wasn't already specified.
6095 if test -n "$destname"; then
6096 destfile="$destdir/$destname"
6098 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6099 destfile="$destdir/$destfile"
6102 # Deduce the name of the destination old-style object file.
6105 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6108 staticdest="$destfile"
6112 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6118 # Install the libtool object if requested.
6119 if test -n "$destfile"; then
6120 $show "$install_prog $file $destfile"
6121 $run eval "$install_prog $file $destfile" || exit $?
6124 # Install the old object if enabled.
6125 if test "$build_old_libs" = yes; then
6126 # Deduce the name of the old-style object file.
6127 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6129 $show "$install_prog $staticobj $staticdest"
6130 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6136 # Figure out destination file name, if it wasn't already specified.
6137 if test -n "$destname"; then
6138 destfile="$destdir/$destname"
6140 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6141 destfile="$destdir/$destfile"
6144 # If the file is missing, and there is a .exe on the end, strip it
6145 # because it is most likely a libtool script we actually want to
6150 if test ! -f "$file"; then
6151 file=`$echo $file|${SED} 's,.exe$,,'`
6157 # Do a test to see if this is really a libtool program.
6160 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6166 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6170 # Note that it is not necessary on cygwin/mingw to append a dot to
6171 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6172 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6173 # `FILE.' does not work on cygwin managed mounts.
6175 # If there is no directory component, then add one.
6177 */* | *\\*) . ${wrapper} ;;
6178 *) . ./${wrapper} ;;
6181 # Check the variables that should have been set.
6182 if test -z "$notinst_deplibs"; then
6183 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6188 for lib in $notinst_deplibs; do
6189 # Check to see that each library is installed.
6191 if test -f "$lib"; then
6192 # If there is no directory component, then add one.
6194 */* | *\\*) . $lib ;;
6198 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6199 if test -n "$libdir" && test ! -f "$libfile"; then
6200 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6206 # Note that it is not necessary on cygwin/mingw to append a dot to
6207 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6208 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6209 # `FILE.' does not work on cygwin managed mounts.
6211 # If there is no directory component, then add one.
6213 */* | *\\*) . ${wrapper} ;;
6214 *) . ./${wrapper} ;;
6218 if test "$fast_install" = no && test -n "$relink_command"; then
6219 if test "$finalize" = yes && test -z "$run"; then
6220 tmpdir=`func_mktempdir`
6221 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6222 outputname="$tmpdir/$file"
6223 # Replace the output file specification.
6224 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6226 $show "$relink_command"
6227 if $run eval "$relink_command"; then :
6229 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6235 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6238 # Install the binary that we compiled earlier.
6239 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6243 # remove .exe since cygwin /usr/bin/install will append another
6245 case $install_prog,$host in
6246 */usr/bin/install*,*cygwin*)
6247 case $file:$destfile in
6252 destfile=$destfile.exe
6255 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6260 $show "$install_prog$stripme $file $destfile"
6261 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6262 test -n "$outputname" && ${rm}r "$tmpdir"
6267 for file in $staticlibs; do
6268 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6270 # Set up the ranlib parameters.
6271 oldlib="$destdir/$name"
6273 $show "$install_prog $file $oldlib"
6274 $run eval "$install_prog \$file \$oldlib" || exit $?
6276 if test -n "$stripme" && test -n "$old_striplib"; then
6277 $show "$old_striplib $oldlib"
6278 $run eval "$old_striplib $oldlib" || exit $?
6281 # Do each command in the postinstall commands.
6282 cmds=$old_postinstall_cmds
6283 save_ifs="$IFS"; IFS='~'
6284 for cmd in $cmds; do
6288 $run eval "$cmd" || exit $?
6296 # libtool finish mode
6298 modename="$modename: finish"
6302 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6305 libdirs="$libdirs $dir"
6308 for libdir in $libdirs; do
6309 if test -n "$finish_cmds"; then
6310 # Do each command in the finish commands.
6312 save_ifs="$IFS"; IFS='~'
6313 for cmd in $cmds; do
6317 $run eval "$cmd" || admincmds="$admincmds
6322 if test -n "$finish_eval"; then
6323 # Do the single finish_eval.
6324 eval cmds=\"$finish_eval\"
6325 $run eval "$cmds" || admincmds="$admincmds
6331 # Exit here if they wanted silent mode.
6332 test "$show" = : && exit $EXIT_SUCCESS
6334 $echo "X----------------------------------------------------------------------" | $Xsed
6335 $echo "Libraries have been installed in:"
6336 for libdir in $libdirs; do
6340 $echo "If you ever happen to want to link against installed libraries"
6341 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6342 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6343 $echo "flag during linking and do at least one of the following:"
6344 if test -n "$shlibpath_var"; then
6345 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6346 $echo " during execution"
6348 if test -n "$runpath_var"; then
6349 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6350 $echo " during linking"
6352 if test -n "$hardcode_libdir_flag_spec"; then
6354 eval flag=\"$hardcode_libdir_flag_spec\"
6356 $echo " - use the \`$flag' linker flag"
6358 if test -n "$admincmds"; then
6359 $echo " - have your system administrator run these commands:$admincmds"
6361 if test -f /etc/ld.so.conf; then
6362 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6365 $echo "See any operating system documentation about shared libraries for"
6366 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6367 $echo "X----------------------------------------------------------------------" | $Xsed
6371 # libtool execute mode
6373 modename="$modename: execute"
6375 # The first argument is the command name.
6377 if test -z "$cmd"; then
6378 $echo "$modename: you must specify a COMMAND" 1>&2
6383 # Handle -dlopen flags immediately.
6384 for file in $execute_dlfiles; do
6385 if test ! -f "$file"; then
6386 $echo "$modename: \`$file' is not a file" 1>&2
6394 # Check to see that this really is a libtool archive.
6395 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6397 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6402 # Read the libtool library.
6406 # If there is no directory component, then add one.
6408 */* | *\\*) . $file ;;
6412 # Skip this library if it cannot be dlopened.
6413 if test -z "$dlname"; then
6414 # Warn if it was a shared library.
6415 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6419 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6420 test "X$dir" = "X$file" && dir=.
6422 if test -f "$dir/$objdir/$dlname"; then
6425 if test ! -f "$dir/$dlname"; then
6426 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6433 # Just add the directory containing the .lo file.
6434 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6435 test "X$dir" = "X$file" && dir=.
6439 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6444 # Get the absolute pathname.
6445 absdir=`cd "$dir" && pwd`
6446 test -n "$absdir" && dir="$absdir"
6448 # Now add the directory to shlibpath_var.
6449 if eval "test -z \"\$$shlibpath_var\""; then
6450 eval "$shlibpath_var=\"\$dir\""
6452 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6456 # This variable tells wrapper scripts just to set shlibpath_var
6457 # rather than running their programs.
6458 libtool_execute_magic="$magic"
6460 # Check if any of the arguments is a wrapper script.
6467 # Do a test to see if this is really a libtool program.
6468 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6469 # If there is no directory component, then add one.
6471 */* | *\\*) . $file ;;
6475 # Transform arg to wrapped name.
6476 file="$progdir/$program"
6480 # Quote arguments (to preserve shell metacharacters).
6481 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6482 args="$args \"$file\""
6485 if test -z "$run"; then
6486 if test -n "$shlibpath_var"; then
6487 # Export the shlibpath_var.
6488 eval "export $shlibpath_var"
6491 # Restore saved environment variables
6492 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6494 eval "if test \"\${save_$lt_var+set}\" = set; then
6495 $lt_var=\$save_$lt_var; export $lt_var
6499 # Now prepare to actually exec the command.
6500 exec_cmd="\$cmd$args"
6502 # Display what would be done.
6503 if test -n "$shlibpath_var"; then
6504 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6505 $echo "export $shlibpath_var"
6512 # libtool clean and uninstall mode
6514 modename="$modename: $mode"
6520 # This variable tells wrapper scripts just to set variables rather
6521 # than running their programs.
6522 libtool_install_magic="$magic"
6527 -f) rm="$rm $arg"; rmforce=yes ;;
6528 -*) rm="$rm $arg" ;;
6529 *) files="$files $arg" ;;
6533 if test -z "$rm"; then
6534 $echo "$modename: you must specify an RM program" 1>&2
6541 origobjdir="$objdir"
6542 for file in $files; do
6543 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6544 if test "X$dir" = "X$file"; then
6546 objdir="$origobjdir"
6548 objdir="$dir/$origobjdir"
6550 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6551 test "$mode" = uninstall && objdir="$dir"
6553 # Remember objdir for removal later, being careful to avoid duplicates
6554 if test "$mode" = clean; then
6557 *) rmdirs="$rmdirs $objdir" ;;
6561 # Don't error if the file doesn't exist and rm -f was used.
6562 if (test -L "$file") >/dev/null 2>&1 \
6563 || (test -h "$file") >/dev/null 2>&1 \
6564 || test -f "$file"; then
6566 elif test -d "$file"; then
6569 elif test "$rmforce" = yes; then
6577 # Possibly a libtool archive, so verify it.
6578 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6581 # Delete the libtool libraries and symlinks.
6582 for n in $library_names; do
6583 rmfiles="$rmfiles $objdir/$n"
6585 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6589 case " $library_names " in
6590 # " " in the beginning catches empty $dlname
6592 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6594 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6597 if test -n "$library_names"; then
6598 # Do each command in the postuninstall commands.
6599 cmds=$postuninstall_cmds
6600 save_ifs="$IFS"; IFS='~'
6601 for cmd in $cmds; do
6606 if test "$?" -ne 0 && test "$rmforce" != yes; then
6613 if test -n "$old_library"; then
6614 # Do each command in the old_postuninstall commands.
6615 cmds=$old_postuninstall_cmds
6616 save_ifs="$IFS"; IFS='~'
6617 for cmd in $cmds; do
6622 if test "$?" -ne 0 && test "$rmforce" != yes; then
6628 # FIXME: should reinstall the best remaining shared library.
6635 # Possibly a libtool object, so verify it.
6636 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6641 # Add PIC object to the list of files to remove.
6642 if test -n "$pic_object" \
6643 && test "$pic_object" != none; then
6644 rmfiles="$rmfiles $dir/$pic_object"
6647 # Add non-PIC object to the list of files to remove.
6648 if test -n "$non_pic_object" \
6649 && test "$non_pic_object" != none; then
6650 rmfiles="$rmfiles $dir/$non_pic_object"
6656 if test "$mode" = clean ; then
6660 file=`$echo $file|${SED} 's,.exe$,,'`
6661 noexename=`$echo $name|${SED} 's,.exe$,,'`
6662 # $file with .exe has already been added to rmfiles,
6663 # add $file without .exe
6664 rmfiles="$rmfiles $file"
6667 # Do a test to see if this is a libtool program.
6668 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6672 # note $name still contains .exe if it was in $file originally
6673 # as does the version of $file that was added into $rmfiles
6674 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6675 if test "$fast_install" = yes && test -n "$relink_command"; then
6676 rmfiles="$rmfiles $objdir/lt-$name"
6678 if test "X$noexename" != "X$name" ; then
6679 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6685 $show "$rm $rmfiles"
6686 $run $rm $rmfiles || exit_status=1
6688 objdir="$origobjdir"
6690 # Try to remove the ${objdir}s in the directories where we deleted files
6691 for dir in $rmdirs; do
6692 if test -d "$dir"; then
6694 $run rmdir $dir >/dev/null 2>&1
6702 $echo "$modename: you must specify a MODE" 1>&2
6703 $echo "$generic_help" 1>&2
6708 if test -z "$exec_cmd"; then
6709 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6710 $echo "$generic_help" 1>&2
6713 fi # test -z "$show_help"
6715 if test -n "$exec_cmd"; then
6720 # We need to display help for each of the modes.
6723 "Usage: $modename [OPTION]... [MODE-ARG]...
6725 Provide generalized library-building support services.
6727 --config show all configuration variables
6728 --debug enable verbose shell tracing
6729 -n, --dry-run display commands without modifying any files
6730 --features display basic configuration information and exit
6731 --finish same as \`--mode=finish'
6732 --help display this help message and exit
6733 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6734 --quiet same as \`--silent'
6735 --silent don't print informational messages
6736 --tag=TAG use configuration variables from tag TAG
6737 --version print version information
6739 MODE must be one of the following:
6741 clean remove files from the build directory
6742 compile compile a source file into a libtool object
6743 execute automatically set library path, then run a program
6744 finish complete the installation of libtool libraries
6745 install install libraries or executables
6746 link create a library or an executable
6747 uninstall remove libraries from an installed directory
6749 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6750 a more detailed description of MODE.
6752 Report bugs to <bug-libtool@gnu.org>."
6758 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6760 Remove files from the build directory.
6762 RM is the name of the program to use to delete files associated with each FILE
6763 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6766 If FILE is a libtool library, object or program, all the files associated
6767 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6772 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6774 Compile a source file into a libtool library object.
6776 This mode accepts the following additional options:
6778 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6779 -prefer-pic try to building PIC objects only
6780 -prefer-non-pic try to building non-PIC objects only
6781 -static always build a \`.o' file suitable for static linking
6783 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6784 from the given SOURCEFILE.
6786 The output file name is determined by removing the directory component from
6787 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6788 library object suffix, \`.lo'."
6793 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6795 Automatically set library path, then run a program.
6797 This mode accepts the following additional options:
6799 -dlopen FILE add the directory containing FILE to the library path
6801 This mode sets the library path environment variable according to \`-dlopen'
6804 If any of the ARGS are libtool executable wrappers, then they are translated
6805 into their corresponding uninstalled binary, and any of their required library
6806 directories are added to the library path.
6808 Then, COMMAND is executed, with ARGS as arguments."
6813 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6815 Complete the installation of libtool libraries.
6817 Each LIBDIR is a directory that contains libtool libraries.
6819 The commands that this mode executes may require superuser privileges. Use
6820 the \`--dry-run' option if you just want to see what would be executed."
6825 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6827 Install executables or libraries.
6829 INSTALL-COMMAND is the installation command. The first component should be
6830 either the \`install' or \`cp' program.
6832 The rest of the components are interpreted as arguments to that command (only
6833 BSD-compatible install options are recognized)."
6838 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6840 Link object files or libraries together to form another library, or to
6841 create an executable program.
6843 LINK-COMMAND is a command using the C compiler that you would use to create
6844 a program from several object files.
6846 The following components of LINK-COMMAND are treated specially:
6848 -all-static do not do any dynamic linking at all
6849 -avoid-version do not add a version suffix if possible
6850 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6851 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6852 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6853 -export-symbols SYMFILE
6854 try to export only the symbols listed in SYMFILE
6855 -export-symbols-regex REGEX
6856 try to export only the symbols matching REGEX
6857 -LLIBDIR search LIBDIR for required installed libraries
6858 -lNAME OUTPUT-FILE requires the installed library libNAME
6859 -module build a library that can dlopened
6860 -no-fast-install disable the fast-install mode
6861 -no-install link a not-installable executable
6862 -no-undefined declare that a library does not refer to external symbols
6863 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6864 -objectlist FILE Use a list of object files found in FILE to specify objects
6865 -precious-files-regex REGEX
6866 don't remove output files matching REGEX
6867 -release RELEASE specify package release information
6868 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6869 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6870 -static do not do any dynamic linking of uninstalled libtool libraries
6871 -static-libtool-libs
6872 do not do any dynamic linking of libtool libraries
6873 -version-info CURRENT[:REVISION[:AGE]]
6874 specify library version info [each variable defaults to 0]
6876 All other options (arguments beginning with \`-') are ignored.
6878 Every other argument is treated as a filename. Files ending in \`.la' are
6879 treated as uninstalled libtool libraries, other files are standard or library
6882 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6883 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6884 required, except when creating a convenience library.
6886 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6887 using \`ar' and \`ranlib', or on Windows using \`lib'.
6889 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6890 is created, otherwise an executable program is created."
6895 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6897 Remove libraries from an installation directory.
6899 RM is the name of the program to use to delete files associated with each FILE
6900 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6903 If FILE is a libtool library, all the files associated with it are deleted.
6904 Otherwise, only FILE itself is deleted using RM."
6908 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6915 $echo "Try \`$modename --help' for more information about other modes."
6919 # The TAGs below are defined such that we never get into a situation
6920 # in which we disable both kinds of libraries. Given conflicting
6921 # choices, we go for a static library, that is the most portable,
6922 # since we can't tell whether shared libraries were disabled because
6923 # the user asked for that or because the platform doesn't support
6924 # them. This is particularly important on AIX, because we don't
6925 # support having both static and shared libraries enabled at the same
6926 # time on that platform, so we default to a shared-only configuration.
6927 # If a disable-shared tag is given, we'll fallback to a static-only
6928 # configuration. But we'll never go from static-only to shared-only.
6930 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6932 # ### END LIBTOOL TAG CONFIG: disable-shared
6934 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6936 # ### END LIBTOOL TAG CONFIG: disable-static