1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.437 2007/02/17 09:08:45)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
116 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
125 # Make sure IFS has a sensible default
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147 lo2o="s/\\.lo\$/.${objext}/"
148 o2lo="s/\\.${objext}\$/.lo/"
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
162 my_template="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir="${my_template}-$$"
169 # If mktemp works, use that first and foremost
170 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask=`umask`
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" || {
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189 $echo "X$my_tmpdir" | $Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
201 win32_libid_type="unknown"
202 win32_fileres=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library*) # definitely import
205 win32_libid_type="x86 archive import"
207 *ar\ archive*) # could be an import, or static
208 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210 win32_nmres=`eval $NM -f posix -A $1 | \
219 import*) win32_libid_type="x86 archive import";;
220 *) win32_libid_type="x86 archive static";;
225 win32_libid_type="x86 DLL"
227 *executable*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel*)
230 win32_libid_type="x86 DLL"
235 $echo $win32_libid_type
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
247 if test -n "$available_tags" && test -z "$tagname"; then
251 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 CC_quoted="$CC_quoted $arg"
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
270 # Double-quote args containing other shell metacharacters.
272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
276 CC_quoted="$CC_quoted $arg"
278 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
279 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
280 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
281 extendcc=${host}-${CC}
282 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
283 # (Gentoo-specific hack because we always export $CHOST)
284 mungedcc=${CHOST-${host}}-${trimedcc}
286 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
287 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
290 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
291 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
292 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
293 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
294 # The compiler in the base compile command matches
295 # the one in the tagged configuration.
296 # Assume this is the tagged configuration we want.
303 # If $tagname still isn't set, then no tagged configuration
304 # was found and let the user know that the "--tag" command
305 # line option must be used.
306 if test -z "$tagname"; then
307 $echo "$modename: unable to infer tagged configuration"
308 $echo "$modename: specify a tag with \`--tag'" 1>&2
311 # $echo "$modename: using $tagname tagged configuration"
319 # func_extract_an_archive dir oldlib
320 func_extract_an_archive ()
322 f_ex_an_ar_dir="$1"; shift
323 f_ex_an_ar_oldlib="$1"
325 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
326 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
327 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
330 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
335 # func_extract_archives gentop oldlib ...
336 func_extract_archives ()
338 my_gentop="$1"; shift
346 $show "${rm}r $my_gentop"
347 $run ${rm}r "$my_gentop"
348 $show "$mkdir $my_gentop"
349 $run $mkdir "$my_gentop"
351 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
355 for my_xlib in $my_oldlibs; do
356 # Extract the objects.
358 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
359 *) my_xabs=`pwd`"/$my_xlib" ;;
361 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
364 case " $extracted_archives " in
366 extracted_serial=`expr $extracted_serial + 1`
367 my_xlib_u=lt$extracted_serial-$my_xlib ;;
371 extracted_archives="$extracted_archives $my_xlib_u"
372 my_xdir="$my_gentop/$my_xlib_u"
374 $show "${rm}r $my_xdir"
375 $run ${rm}r "$my_xdir"
376 $show "$mkdir $my_xdir"
377 $run $mkdir "$my_xdir"
379 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
384 $show "Extracting $my_xabs"
385 # Do not bother doing anything if just a dry run
386 if test -z "$run"; then
387 darwin_orig_dir=`pwd`
388 cd $my_xdir || exit $?
389 darwin_archive=$my_xabs
391 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
392 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
393 if test -n "$darwin_arches"; then
394 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
396 $show "$darwin_base_archive has multiple architectures $darwin_arches"
397 for darwin_arch in $darwin_arches ; do
398 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
399 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
400 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
401 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
403 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
404 done # $darwin_arches
405 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
406 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
409 for darwin_file in $darwin_filelist; do
410 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
411 lipo -create -output "$darwin_file" $darwin_files
412 done # $darwin_filelist
414 cd "$darwin_orig_dir"
416 cd "$darwin_orig_dir"
417 func_extract_an_archive "$my_xdir" "$my_xabs"
422 func_extract_an_archive "$my_xdir" "$my_xabs"
425 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
427 func_extract_archives_result="$my_oldobjs"
429 # End of Shell function definitions
430 #####################################
433 eval std_shrext=\"$shrext_cmds\"
437 # Parse our command line options once, thoroughly.
438 while test "$#" -gt 0
444 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
448 # If the previous option needs an argument, assign it.
449 if test -n "$prev"; then
452 execute_dlfiles="$execute_dlfiles $arg"
456 preserve_args="${preserve_args}=$arg"
458 # Check whether tagname contains only valid characters
461 $echo "$progname: invalid tag name: $tagname" 1>&2
468 # Don't test for the "default" C tag, as we know, it's there, but
469 # not specially marked.
472 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
473 taglist="$taglist $tagname"
474 # Evaluate the configuration.
475 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
477 $echo "$progname: ignoring unknown tag $tagname" 1>&2
492 # Have we seen a non-optional argument yet?
500 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
502 Copyright (C) 2007 Free Software Foundation, Inc.
503 This is free software; see the source for copying conditions. There is NO
504 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
509 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
510 # Now print the configurations for the tags.
511 for tagname in $taglist; do
512 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
518 $echo "$progname: enabling shell trace mode"
520 preserve_args="$preserve_args $arg"
529 if test "$build_libtool_libs" = yes; then
530 $echo "enable shared libraries"
532 $echo "disable shared libraries"
534 if test "$build_old_libs" = yes; then
535 $echo "enable static libraries"
537 $echo "disable static libraries"
542 --finish) mode="finish" ;;
544 --mode) prevopt="--mode" prev=mode ;;
545 --mode=*) mode="$optarg" ;;
547 --preserve-dup-deps) duplicate_deps="yes" ;;
551 preserve_args="$preserve_args $arg"
557 preserve_args="$preserve_args --tag"
560 set tag "$optarg" ${1+"$@"}
563 preserve_args="$preserve_args --tag"
572 $echo "$modename: unrecognized option \`$arg'" 1>&2
584 if test -n "$prevopt"; then
585 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
590 case $disable_libs in
594 build_libtool_libs=no
598 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
602 # If this variable is set in any of the actions, the command in it
603 # will be execed at the end. This prevents here-documents from being
604 # left over by shells.
607 if test -z "$show_help"; then
609 # Infer the operation mode.
610 if test -z "$mode"; then
611 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
612 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
614 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
626 *db | *dbx | *strace | *truss)
636 # If we have no mode, but dlfiles were specified, then do execute mode.
637 test -n "$execute_dlfiles" && mode=execute
639 # Just use the default operation mode.
640 if test -z "$mode"; then
641 if test -n "$nonopt"; then
642 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
644 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
651 # Only execute mode is allowed to have -dlopen flags.
652 if test -n "$execute_dlfiles" && test "$mode" != execute; then
653 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
658 # Change the help message to a mode-specific one.
660 help="Try \`$modename --help --mode=$mode' for more information."
662 # These modes are in order of execution frequency so that they run quickly.
664 # libtool compile mode
666 modename="$modename: compile"
667 # Get the compilation command and the source file.
669 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
680 # do not "continue". Instead, add this to base_compile
692 # Accept any command-line options.
695 if test -n "$libobj" ; then
696 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
703 -static | -prefer-pic | -prefer-non-pic)
714 arg_mode=arg # the next one goes into the "base_compile" arg list
715 continue # The current "srcfile" will either be retained or
716 ;; # replaced later. I would guess that would be a bug.
719 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
721 save_ifs="$IFS"; IFS=','
725 # Double-quote args containing other shell metacharacters.
726 # Many Bourne shells cannot handle close brackets correctly
727 # in scan sets, so we specify it separately.
729 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
733 lastarg="$lastarg $arg"
736 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
738 # Add the arguments to base_compile.
739 base_compile="$base_compile $lastarg"
744 # Accept the current argument as the source file.
745 # The previous "srcfile" becomes the current argument.
752 esac # case $arg_mode
754 # Aesthetically quote the previous argument.
755 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
758 # Double-quote args containing other shell metacharacters.
759 # Many Bourne shells cannot handle close brackets correctly
760 # in scan sets, and some SunOS ksh mistreat backslash-escaping
761 # in scan sets (worked around with variable expansion),
762 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
763 # at all, so we specify them separately.
764 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
765 lastarg="\"$lastarg\""
769 base_compile="$base_compile $lastarg"
774 $echo "$modename: you must specify an argument for -Xcompile"
778 $echo "$modename: you must specify a target with \`-o'" 1>&2
782 # Get the name of the library object.
783 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
787 # Recognize several different file suffixes.
788 # If the user specifies -o file.o, it is replaced with file.lo
798 *.class) xform=class ;;
801 *.[fF][09]?) xform=[fF][09]. ;;
803 *.java) xform=java ;;
807 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
810 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
812 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
817 func_infer_tag $base_compile
819 for arg in $later; do
838 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
840 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
841 qlibobj="\"$qlibobj\"" ;;
843 test "X$libobj" != "X$qlibobj" \
844 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
845 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
846 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
847 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
848 if test "X$xdir" = "X$obj"; then
853 lobj=${xdir}$objdir/$objname
855 if test -z "$base_compile"; then
856 $echo "$modename: you must specify a compilation command" 1>&2
861 # Delete any leftover library objects.
862 if test "$build_old_libs" = yes; then
863 removelist="$obj $lobj $libobj ${libobj}T"
865 removelist="$lobj $libobj ${libobj}T"
869 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
871 # On Cygwin there's no "real" PIC flag so we must build both object types
873 cygwin* | mingw* | pw32* | os2*)
877 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
878 # non-PIC code in shared libraries is not supported
882 # Calculate the filename of the output object if compiler does
883 # not support -o with -c
884 if test "$compiler_c_o" = no; then
885 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
886 lockfile="$output_obj.lock"
887 removelist="$removelist $output_obj $lockfile"
888 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
895 # Lock this critical section if it is needed
896 # We use this script file to make the link, it avoids creating a new file
897 if test "$need_locks" = yes; then
898 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
899 $show "Waiting for $lockfile to be removed"
902 elif test "$need_locks" = warn; then
903 if test -f "$lockfile"; then
905 *** ERROR, $lockfile exists and contains:
906 `cat $lockfile 2>/dev/null`
908 This indicates that another process is trying to use the same
909 temporary object file, and libtool could not work around it because
910 your compiler does not support \`-c' and \`-o' together. If you
911 repeat this compilation, it may succeed, by chance, but you had better
912 avoid parallel builds (make -j) in this platform, or get a better
918 $echo "$srcfile" > "$lockfile"
921 if test -n "$fix_srcfile_path"; then
922 eval srcfile=\"$fix_srcfile_path\"
924 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
926 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
927 qsrcfile="\"$qsrcfile\"" ;;
930 $run $rm "$libobj" "${libobj}T"
932 # Create a libtool object file (analogous to a ".la" file),
933 # but don't create it if we're doing a dry run.
934 test -z "$run" && cat > ${libobj}T <<EOF
935 # $libobj - a libtool object file
936 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
938 # Please DO NOT delete this file!
939 # It is necessary for linking the library.
941 # Name of the PIC object.
944 # Only build a PIC object if we are building libtool libraries.
945 if test "$build_libtool_libs" = yes; then
946 # Without this assignment, base_compile gets emptied.
947 fbsd_hideous_sh_bug=$base_compile
949 if test "$pic_mode" != no; then
950 command="$base_compile $qsrcfile $pic_flag"
952 # Don't build PIC code
953 command="$base_compile $qsrcfile"
956 if test ! -d "${xdir}$objdir"; then
957 $show "$mkdir ${xdir}$objdir"
958 $run $mkdir ${xdir}$objdir
960 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
965 if test -z "$output_obj"; then
966 # Place PIC objects in $objdir
967 command="$command -o $lobj"
970 $run $rm "$lobj" "$output_obj"
973 if $run eval "$command"; then :
975 test -n "$output_obj" && $run $rm $removelist
979 if test "$need_locks" = warn &&
980 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
982 *** ERROR, $lockfile contains:
983 `cat $lockfile 2>/dev/null`
985 but it should contain:
988 This indicates that another process is trying to use the same
989 temporary object file, and libtool could not work around it because
990 your compiler does not support \`-c' and \`-o' together. If you
991 repeat this compilation, it may succeed, by chance, but you had better
992 avoid parallel builds (make -j) in this platform, or get a better
999 # Just move the object if needed, then go on to compile the next one
1000 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1001 $show "$mv $output_obj $lobj"
1002 if $run $mv $output_obj $lobj; then :
1005 $run $rm $removelist
1010 # Append the name of the PIC object to the libtool object file.
1011 test -z "$run" && cat >> ${libobj}T <<EOF
1012 pic_object='$objdir/$objname'
1016 # Allow error messages only from the first compilation.
1017 if test "$suppress_opt" = yes; then
1018 suppress_output=' >/dev/null 2>&1'
1021 # No PIC object so indicate it doesn't exist in the libtool
1023 test -z "$run" && cat >> ${libobj}T <<EOF
1029 # Only build a position-dependent object if we build old libraries.
1030 if test "$build_old_libs" = yes; then
1031 if test "$pic_mode" != yes; then
1032 # Don't build PIC code
1033 command="$base_compile $qsrcfile"
1035 command="$base_compile $qsrcfile $pic_flag"
1037 if test "$compiler_c_o" = yes; then
1038 command="$command -o $obj"
1041 # Suppress compiler output if we already did a PIC compilation.
1042 command="$command$suppress_output"
1043 $run $rm "$obj" "$output_obj"
1045 if $run eval "$command"; then :
1047 $run $rm $removelist
1051 if test "$need_locks" = warn &&
1052 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1054 *** ERROR, $lockfile contains:
1055 `cat $lockfile 2>/dev/null`
1057 but it should contain:
1060 This indicates that another process is trying to use the same
1061 temporary object file, and libtool could not work around it because
1062 your compiler does not support \`-c' and \`-o' together. If you
1063 repeat this compilation, it may succeed, by chance, but you had better
1064 avoid parallel builds (make -j) in this platform, or get a better
1067 $run $rm $removelist
1071 # Just move the object if needed
1072 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1073 $show "$mv $output_obj $obj"
1074 if $run $mv $output_obj $obj; then :
1077 $run $rm $removelist
1082 # Append the name of the non-PIC object the libtool object file.
1083 # Only append if the libtool object file exists.
1084 test -z "$run" && cat >> ${libobj}T <<EOF
1085 # Name of the non-PIC object.
1086 non_pic_object='$objname'
1090 # Append the name of the non-PIC object the libtool object file.
1091 # Only append if the libtool object file exists.
1092 test -z "$run" && cat >> ${libobj}T <<EOF
1093 # Name of the non-PIC object.
1099 $run $mv "${libobj}T" "${libobj}"
1101 # Unlock the critical section if it was locked
1102 if test "$need_locks" != no; then
1103 $run $rm "$lockfile"
1111 modename="$modename: link"
1113 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1114 # It is impossible to link a dll without this setting, and
1115 # we shouldn't force the makefile maintainer to figure out
1116 # which system we are compiling for in order to pass an extra
1117 # flag for every libtool invocation.
1118 # allow_undefined=no
1120 # FIXME: Unfortunately, there are problems with the above when trying
1121 # to make a dll which has undefined symbols, in which case not
1122 # even a static library is built. For now, we need to specify
1123 # -no-undefined on the libtool link line when we can be certain
1124 # that all symbols are satisfied, otherwise we get a static library.
1131 libtool_args="$nonopt"
1132 base_compile="$nonopt $@"
1133 compile_command="$nonopt"
1134 finalize_command="$nonopt"
1147 lib_search_path=`pwd`
1156 export_symbols_regex=
1164 notinst_path= # paths that contain not-installed libtool libraries
1165 precious_files_regex=
1166 prefer_static_libs=no
1179 func_infer_tag $base_compile
1181 # We need to know -static, to get the right output filenames.
1185 -all-static | -static | -static-libtool-libs)
1188 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1189 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1191 if test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1194 prefer_static_libs=yes
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1200 prefer_static_libs=built
1202 -static-libtool-libs)
1203 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1204 dlopen_self=$dlopen_self_static
1206 prefer_static_libs=yes
1209 build_libtool_libs=no
1216 # See if our shared archives depend on static archives.
1217 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1219 # Go through the arguments, transforming them on the way.
1220 while test "$#" -gt 0; do
1224 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1225 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1229 libtool_args="$libtool_args $qarg"
1231 # If the previous option needs an argument, assign it.
1232 if test -n "$prev"; then
1235 compile_command="$compile_command @OUTPUT@"
1236 finalize_command="$finalize_command @OUTPUT@"
1242 if test "$preload" = no; then
1243 # Add the symbol object into the linking commands.
1244 compile_command="$compile_command @SYMFILE@"
1245 finalize_command="$finalize_command @SYMFILE@"
1249 *.la | *.lo) ;; # We handle these cases below.
1251 if test "$dlself" = no; then
1259 if test "$prev" = dlprefiles; then
1261 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1271 if test "$prev" = dlfiles; then
1272 dlfiles="$dlfiles $arg"
1274 dlprefiles="$dlprefiles $arg"
1282 export_symbols="$arg"
1283 if test ! -f "$arg"; then
1284 $echo "$modename: symbol file \`$arg' does not exist"
1291 export_symbols_regex="$arg"
1296 inst_prefix_dir="$arg"
1301 precious_files_regex="$arg"
1311 if test -f "$arg"; then
1314 for fil in `cat $save_arg`
1316 # moreargs="$moreargs $fil"
1318 # A libtool-controlled object.
1320 # Check to see that this really is a libtool object.
1321 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1326 # If there is no directory component, then add one.
1328 */* | *\\*) . $arg ;;
1332 if test -z "$pic_object" || \
1333 test -z "$non_pic_object" ||
1334 test "$pic_object" = none && \
1335 test "$non_pic_object" = none; then
1336 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1340 # Extract subdirectory from the argument.
1341 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1342 if test "X$xdir" = "X$arg"; then
1348 if test "$pic_object" != none; then
1349 # Prepend the subdirectory the object is found in.
1350 pic_object="$xdir$pic_object"
1352 if test "$prev" = dlfiles; then
1353 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1354 dlfiles="$dlfiles $pic_object"
1358 # If libtool objects are unsupported, then we need to preload.
1363 # CHECK ME: I think I busted this. -Ossama
1364 if test "$prev" = dlprefiles; then
1365 # Preload the old-style object.
1366 dlprefiles="$dlprefiles $pic_object"
1371 libobjs="$libobjs $pic_object"
1376 if test "$non_pic_object" != none; then
1377 # Prepend the subdirectory the object is found in.
1378 non_pic_object="$xdir$non_pic_object"
1380 # A standard non-PIC object
1381 non_pic_objects="$non_pic_objects $non_pic_object"
1382 if test -z "$pic_object" || test "$pic_object" = none ; then
1383 arg="$non_pic_object"
1386 # If the PIC object exists, use it instead.
1387 # $xdir was prepended to $pic_object above.
1388 non_pic_object="$pic_object"
1389 non_pic_objects="$non_pic_objects $non_pic_object"
1392 # Only an error if not doing a dry-run.
1393 if test -z "$run"; then
1394 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1399 # Extract subdirectory from the argument.
1400 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1401 if test "X$xdir" = "X$arg"; then
1407 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1408 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1409 libobjs="$libobjs $pic_object"
1410 non_pic_objects="$non_pic_objects $non_pic_object"
1415 $echo "$modename: link input file \`$save_arg' does not exist"
1423 # We need an absolute path.
1425 [\\/]* | [A-Za-z]:[\\/]*) ;;
1427 $echo "$modename: only absolute run-paths are allowed" 1>&2
1431 if test "$prev" = rpath; then
1434 *) rpath="$rpath $arg" ;;
1439 *) xrpath="$xrpath $arg" ;;
1446 compiler_flags="$compiler_flags $qarg"
1448 compile_command="$compile_command $qarg"
1449 finalize_command="$finalize_command $qarg"
1453 linker_flags="$linker_flags $qarg"
1454 compiler_flags="$compiler_flags $wl$qarg"
1456 compile_command="$compile_command $wl$qarg"
1457 finalize_command="$finalize_command $wl$qarg"
1461 linker_flags="$linker_flags $qarg"
1462 compiler_flags="$compiler_flags $qarg"
1464 compile_command="$compile_command $qarg"
1465 finalize_command="$finalize_command $qarg"
1473 darwin_framework|darwin_framework_skip)
1474 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1475 compile_command="$compile_command $arg"
1476 finalize_command="$finalize_command $arg"
1481 eval "$prev=\"\$arg\""
1486 fi # test -n "$prev"
1492 if test -n "$link_static_flag"; then
1493 compile_command="$compile_command $link_static_flag"
1494 finalize_command="$finalize_command $link_static_flag"
1500 # FIXME: remove this flag sometime in the future.
1501 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1525 -export-symbols | -export-symbols-regex)
1526 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1527 $echo "$modename: more than one -exported-symbols argument is not allowed"
1530 if test "X$arg" = "X-export-symbols"; then
1538 -framework|-arch|-isysroot)
1540 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1541 prev=darwin_framework_skip ;;
1542 *) compiler_flags="$compiler_flags $arg"
1543 prev=darwin_framework ;;
1545 compile_command="$compile_command $arg"
1546 finalize_command="$finalize_command $arg"
1555 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1556 # so, if we see these flags be careful not to treat them like -L
1558 case $with_gcc/$host in
1559 no/*-*-irix* | /*-*-irix*)
1560 compile_command="$compile_command $arg"
1561 finalize_command="$finalize_command $arg"
1568 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1569 # We need an absolute path.
1571 [\\/]* | [A-Za-z]:[\\/]*) ;;
1573 absdir=`cd "$dir" && pwd`
1574 if test -z "$absdir"; then
1575 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1577 notinst_path="$notinst_path $dir"
1585 deplibs="$deplibs -L$dir"
1586 lib_search_path="$lib_search_path $dir"
1590 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1591 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1592 case :$dllsearchpath: in
1594 *) dllsearchpath="$dllsearchpath:$dir";;
1596 case :$dllsearchpath: in
1597 *":$testbindir:"*) ;;
1598 *) dllsearchpath="$dllsearchpath:$testbindir";;
1606 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1609 # These systems don't actually have a C or math library (as such)
1613 # These systems don't actually have a C library (as such)
1614 test "X$arg" = "X-lc" && continue
1616 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1617 # Do not include libc due to us having libc/libc_r.
1618 test "X$arg" = "X-lc" && continue
1620 *-*-rhapsody* | *-*-darwin1.[012])
1621 # Rhapsody C and math libraries are in the System framework
1622 deplibs="$deplibs -framework System"
1625 *-*-sco3.2v5* | *-*-sco5v6*)
1626 # Causes problems with __ctype
1627 test "X$arg" = "X-lc" && continue
1629 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1630 # Compiler inserts libc in the correct place for threads to work
1631 test "X$arg" = "X-lc" && continue
1634 elif test "X$arg" = "X-lc_r"; then
1636 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1637 # Do not include libc_r directly, use -pthread flag.
1642 deplibs="$deplibs $arg"
1646 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1647 # classes, name mangling, and exception handling.
1649 compile_command="$compile_command $arg"
1650 compiler_flags="$compiler_flags $arg"
1651 finalize_command="$finalize_command $arg"
1656 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1657 compiler_flags="$compiler_flags $arg"
1658 compile_command="$compile_command $arg"
1659 finalize_command="$finalize_command $arg"
1668 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671 # +DA*, +DD* enable 64-bit mode on the HP compiler
1672 # -q* pass through compiler args for the IBM compiler
1673 # -m* pass through architecture-specific compiler args for GCC
1674 # -m*, -t[45]*, -txscale* pass through architecture-specific
1675 # compiler args for GCC
1676 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677 # -F/path gives path to uninstalled frameworks, gcc on darwin
1678 # @file GCC response files
1679 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1682 # Unknown arguments in both finalize_command and compile_command need
1683 # to be aesthetically quoted because they are evaled later.
1684 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1686 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1690 compile_command="$compile_command $arg"
1691 finalize_command="$finalize_command $arg"
1692 compiler_flags="$compiler_flags $arg"
1708 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # in order for the loader to find any dlls it needs.
1711 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1715 *) no_install=yes ;;
1732 -precious-files-regex)
1753 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754 # We need an absolute path.
1756 [\\/]* | [A-Za-z]:[\\/]*) ;;
1758 $echo "$modename: only absolute run-paths are allowed" 1>&2
1764 *) xrpath="$xrpath $dir" ;;
1769 -static | -static-libtool-libs)
1770 # The effects of -static are defined in a previous loop.
1771 # We used to do the same as -all-static on platforms that
1772 # didn't have a PIC flag, but the assumption that the effects
1773 # would be equivalent was wrong. It would break on at least
1774 # Digital Unix and AIX.
1794 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1796 save_ifs="$IFS"; IFS=','
1797 for flag in $args; do
1800 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1805 compiler_flags="$compiler_flags $flag"
1808 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1812 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1814 save_ifs="$IFS"; IFS=','
1815 for flag in $args; do
1818 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1823 compiler_flags="$compiler_flags $wl$flag"
1824 linker_flags="$linker_flags $flag"
1827 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1845 # Some other compiler flag.
1847 # Unknown arguments in both finalize_command and compile_command need
1848 # to be aesthetically quoted because they are evaled later.
1849 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1851 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1858 # A standard object.
1863 # A libtool-controlled object.
1865 # Check to see that this really is a libtool object.
1866 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1871 # If there is no directory component, then add one.
1873 */* | *\\*) . $arg ;;
1877 if test -z "$pic_object" || \
1878 test -z "$non_pic_object" ||
1879 test "$pic_object" = none && \
1880 test "$non_pic_object" = none; then
1881 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1885 # Extract subdirectory from the argument.
1886 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$xdir" = "X$arg"; then
1893 if test "$pic_object" != none; then
1894 # Prepend the subdirectory the object is found in.
1895 pic_object="$xdir$pic_object"
1897 if test "$prev" = dlfiles; then
1898 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899 dlfiles="$dlfiles $pic_object"
1903 # If libtool objects are unsupported, then we need to preload.
1908 # CHECK ME: I think I busted this. -Ossama
1909 if test "$prev" = dlprefiles; then
1910 # Preload the old-style object.
1911 dlprefiles="$dlprefiles $pic_object"
1916 libobjs="$libobjs $pic_object"
1921 if test "$non_pic_object" != none; then
1922 # Prepend the subdirectory the object is found in.
1923 non_pic_object="$xdir$non_pic_object"
1925 # A standard non-PIC object
1926 non_pic_objects="$non_pic_objects $non_pic_object"
1927 if test -z "$pic_object" || test "$pic_object" = none ; then
1928 arg="$non_pic_object"
1931 # If the PIC object exists, use it instead.
1932 # $xdir was prepended to $pic_object above.
1933 non_pic_object="$pic_object"
1934 non_pic_objects="$non_pic_objects $non_pic_object"
1937 # Only an error if not doing a dry-run.
1938 if test -z "$run"; then
1939 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1944 # Extract subdirectory from the argument.
1945 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946 if test "X$xdir" = "X$arg"; then
1952 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954 libobjs="$libobjs $pic_object"
1955 non_pic_objects="$non_pic_objects $non_pic_object"
1962 deplibs="$deplibs $arg"
1963 old_deplibs="$old_deplibs $arg"
1968 # A libtool-controlled library.
1970 if test "$prev" = dlfiles; then
1971 # This library was specified with -dlopen.
1972 dlfiles="$dlfiles $arg"
1974 elif test "$prev" = dlprefiles; then
1975 # The library was specified with -dlpreopen.
1976 dlprefiles="$dlprefiles $arg"
1979 deplibs="$deplibs $arg"
1984 # Some other compiler argument.
1986 # Unknown arguments in both finalize_command and compile_command need
1987 # to be aesthetically quoted because they are evaled later.
1988 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1990 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1997 # Now actually substitute the argument into the commands.
1998 if test -n "$arg"; then
1999 compile_command="$compile_command $arg"
2000 finalize_command="$finalize_command $arg"
2002 done # argument parsing loop
2004 if test -n "$prev"; then
2005 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2010 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011 eval arg=\"$export_dynamic_flag_spec\"
2012 compile_command="$compile_command $arg"
2013 finalize_command="$finalize_command $arg"
2017 # calculate the name of the file, without its directory
2018 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019 libobjs_save="$libobjs"
2021 if test -n "$shlibpath_var"; then
2022 # get the directories listed in $shlibpath_var
2023 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2027 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2030 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031 if test "X$output_objdir" = "X$output"; then
2032 output_objdir="$objdir"
2034 output_objdir="$output_objdir/$objdir"
2036 # Create the object directory.
2037 if test ! -d "$output_objdir"; then
2038 $show "$mkdir $output_objdir"
2039 $run $mkdir $output_objdir
2041 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2046 # Determine the type of output
2049 $echo "$modename: you must specify an output file" 1>&2
2053 *.$libext) linkmode=oldlib ;;
2054 *.lo | *.$objext) linkmode=obj ;;
2055 *.la) linkmode=lib ;;
2056 *) linkmode=prog ;; # Anything else should be a program.
2060 *cygwin* | *mingw* | *pw32*)
2061 # don't eliminate duplications in $postdeps and $predeps
2062 duplicate_compiler_generated_deps=yes
2065 duplicate_compiler_generated_deps=$duplicate_deps
2071 # Find all interdependent deplibs by searching for libraries
2072 # that are linked more than once (e.g. -la -lb -la)
2073 for deplib in $deplibs; do
2074 if test "X$duplicate_deps" = "Xyes" ; then
2076 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2079 libs="$libs $deplib"
2082 if test "$linkmode" = lib; then
2083 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2085 # Compute libraries that are listed more than once in $predeps
2086 # $postdeps and mark them as special (i.e., whose duplicates are
2087 # not to be eliminated).
2089 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090 for pre_post_dep in $predeps $postdeps; do
2091 case "$pre_post_deps " in
2092 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2094 pre_post_deps="$pre_post_deps $pre_post_dep"
2103 need_relink=no # whether we're linking any uninstalled libtool libraries
2104 notinst_deplibs= # not-installed libtool libraries
2108 for file in $dlfiles $dlprefiles; do
2112 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2124 passes="conv scan dlopen dlpreopen link"
2129 for pass in $passes; do
2130 if test "$linkmode,$pass" = "lib,link" ||
2131 test "$linkmode,$pass" = "prog,scan"; then
2135 if test "$linkmode" = prog; then
2137 dlopen) libs="$dlfiles" ;;
2138 dlpreopen) libs="$dlprefiles" ;;
2139 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2142 if test "$pass" = dlopen; then
2143 # Collect dlpreopened libraries
2144 save_deplibs="$deplibs"
2147 for deplib in $libs; do
2151 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152 if test "$linkmode,$pass" = "prog,link"; then
2153 compile_deplibs="$deplib $compile_deplibs"
2154 finalize_deplibs="$deplib $finalize_deplibs"
2156 compiler_flags="$compiler_flags $deplib"
2161 if test "$linkmode" != lib && test "$linkmode" != prog; then
2162 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2165 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2167 for search_ext in .la $std_shrext .so .a; do
2168 # Search the libtool library
2169 lib="$searchdir/lib${name}${search_ext}"
2170 if test -f "$lib"; then
2171 if test "$search_ext" = ".la"; then
2180 if test "$found" != yes; then
2181 # deplib doesn't seem to be a libtool library
2182 if test "$linkmode,$pass" = "prog,link"; then
2183 compile_deplibs="$deplib $compile_deplibs"
2184 finalize_deplibs="$deplib $finalize_deplibs"
2186 deplibs="$deplib $deplibs"
2187 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2190 else # deplib is a libtool library
2191 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2192 # We need to do some special things here, and not later.
2193 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2194 case " $predeps $postdeps " in
2196 if (${SED} -e '2q' $lib |
2197 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2201 */* | *\\*) . $lib ;;
2204 for l in $old_library $library_names; do
2207 if test "X$ll" = "X$old_library" ; then # only static version available
2209 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2210 test "X$ladir" = "X$lib" && ladir="."
2211 lib=$ladir/$old_library
2212 if test "$linkmode,$pass" = "prog,link"; then
2213 compile_deplibs="$deplib $compile_deplibs"
2214 finalize_deplibs="$deplib $finalize_deplibs"
2216 deplibs="$deplib $deplibs"
2217 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2231 deplibs="$deplib $deplibs"
2232 test "$pass" = conv && continue
2233 newdependency_libs="$deplib $newdependency_libs"
2234 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2237 if test "$pass" = conv; then
2238 deplibs="$deplib $deplibs"
2241 if test "$pass" = scan; then
2242 deplibs="$deplib $deplibs"
2244 compile_deplibs="$deplib $compile_deplibs"
2245 finalize_deplibs="$deplib $finalize_deplibs"
2247 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2250 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2256 if test "$pass" = link; then
2257 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2258 # Make sure the xrpath contains only unique directories.
2261 *) xrpath="$xrpath $dir" ;;
2264 deplibs="$deplib $deplibs"
2267 *.la) lib="$deplib" ;;
2269 if test "$pass" = conv; then
2270 deplibs="$deplib $deplibs"
2276 case $deplibs_check_method in
2278 set dummy $deplibs_check_method
2279 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2280 if eval $echo \"$deplib\" 2>/dev/null \
2282 | $EGREP "$match_pattern_regex" > /dev/null; then
2290 if test "$valid_a_lib" != yes; then
2292 $echo "*** Warning: Trying to link with static lib archive $deplib."
2293 $echo "*** I have the capability to make that library automatically link in when"
2294 $echo "*** you link to this library. But I can only do this if you have a"
2295 $echo "*** shared version of the library, which you do not appear to have"
2296 $echo "*** because the file extensions .$libext of this argument makes me believe"
2297 $echo "*** that it is just a static archive that I should not used here."
2300 $echo "*** Warning: Linking the shared library $output against the"
2301 $echo "*** static library $deplib is not portable!"
2302 deplibs="$deplib $deplibs"
2307 if test "$pass" != link; then
2308 deplibs="$deplib $deplibs"
2310 compile_deplibs="$deplib $compile_deplibs"
2311 finalize_deplibs="$deplib $finalize_deplibs"
2318 if test "$pass" = conv; then
2319 deplibs="$deplib $deplibs"
2320 elif test "$linkmode" = prog; then
2321 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2322 # If there is no dlopen support or we're linking statically,
2323 # we need to preload.
2324 newdlprefiles="$newdlprefiles $deplib"
2325 compile_deplibs="$deplib $compile_deplibs"
2326 finalize_deplibs="$deplib $finalize_deplibs"
2328 newdlfiles="$newdlfiles $deplib"
2338 if test "$found" = yes || test -f "$lib"; then :
2340 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2344 # Check to see that this really is a libtool archive.
2345 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2347 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2351 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2352 test "X$ladir" = "X$lib" && ladir="."
2360 # If the library was installed with an old release of libtool,
2361 # it will not redefine variables installed, or shouldnotlink
2369 */* | *\\*) . $lib ;;
2373 if test "$linkmode,$pass" = "lib,link" ||
2374 test "$linkmode,$pass" = "prog,scan" ||
2375 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2376 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2377 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2380 if test "$pass" = conv; then
2381 # Only check for convenience libraries
2382 deplibs="$lib $deplibs"
2383 if test -z "$libdir"; then
2384 if test -z "$old_library"; then
2385 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2388 # It is a libtool convenience library, so add in its objects.
2389 convenience="$convenience $ladir/$objdir/$old_library"
2390 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2392 for deplib in $dependency_libs; do
2393 deplibs="$deplib $deplibs"
2394 if test "X$duplicate_deps" = "Xyes" ; then
2395 case "$tmp_libs " in
2396 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2399 tmp_libs="$tmp_libs $deplib"
2401 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2402 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2409 # Get the name of the library we link against.
2411 for l in $old_library $library_names; do
2414 if test -z "$linklib"; then
2415 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2419 # This library was specified with -dlopen.
2420 if test "$pass" = dlopen; then
2421 if test -z "$libdir"; then
2422 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2425 if test -z "$dlname" ||
2426 test "$dlopen_support" != yes ||
2427 test "$build_libtool_libs" = no; then
2428 # If there is no dlname, no dlopen support or we're linking
2429 # statically, we need to preload. We also need to preload any
2430 # dependent libraries so libltdl's deplib preloader doesn't
2431 # bomb out in the load deplibs phase.
2432 dlprefiles="$dlprefiles $lib $dependency_libs"
2434 newdlfiles="$newdlfiles $lib"
2439 # We need an absolute path.
2441 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2443 abs_ladir=`cd "$ladir" && pwd`
2444 if test -z "$abs_ladir"; then
2445 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2446 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2451 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2453 # Find the relevant object directory and library name.
2454 if test "X$installed" = Xyes; then
2455 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2456 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2464 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2466 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2469 # Remove this search path later
2470 notinst_path="$notinst_path $abs_ladir"
2472 dir="$ladir/$objdir"
2473 absdir="$abs_ladir/$objdir"
2474 # Remove this search path later
2475 notinst_path="$notinst_path $abs_ladir"
2477 fi # $installed = yes
2478 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2480 # This library was specified with -dlpreopen.
2481 if test "$pass" = dlpreopen; then
2482 if test -z "$libdir"; then
2483 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2486 # Prefer using a static library (so that no silly _DYNAMIC symbols
2487 # are required to link).
2488 if test -n "$old_library"; then
2489 newdlprefiles="$newdlprefiles $dir/$old_library"
2490 # Otherwise, use the dlname, so that lt_dlopen finds it.
2491 elif test -n "$dlname"; then
2492 newdlprefiles="$newdlprefiles $dir/$dlname"
2494 newdlprefiles="$newdlprefiles $dir/$linklib"
2496 fi # $pass = dlpreopen
2498 if test -z "$libdir"; then
2499 # Link the convenience library
2500 if test "$linkmode" = lib; then
2501 deplibs="$dir/$old_library $deplibs"
2502 elif test "$linkmode,$pass" = "prog,link"; then
2503 compile_deplibs="$dir/$old_library $compile_deplibs"
2504 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2506 deplibs="$lib $deplibs" # used for prog,scan pass
2512 if test "$linkmode" = prog && test "$pass" != link; then
2513 newlib_search_path="$newlib_search_path $ladir"
2514 deplibs="$lib $deplibs"
2517 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2518 test "$build_libtool_libs" = no; then
2523 for deplib in $dependency_libs; do
2525 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2527 # Need to link against all dependency_libs?
2528 if test "$linkalldeplibs" = yes; then
2529 deplibs="$deplib $deplibs"
2531 # Need to hardcode shared library paths
2532 # or/and link against static libraries
2533 newdependency_libs="$deplib $newdependency_libs"
2535 if test "X$duplicate_deps" = "Xyes" ; then
2536 case "$tmp_libs " in
2537 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2540 tmp_libs="$tmp_libs $deplib"
2543 fi # $linkmode = prog...
2545 if test "$linkmode,$pass" = "prog,link"; then
2546 if test -n "$library_names" &&
2547 { { test "$prefer_static_libs" = no ||
2548 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2549 test -z "$old_library"; }; then
2550 # We need to hardcode the library path
2551 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2552 # Make sure the rpath contains only unique directories.
2553 case "$temp_rpath " in
2556 *) temp_rpath="$temp_rpath $absdir" ;;
2560 # Hardcode the library path.
2561 # Skip directories that are in the system default run-time
2563 case " $sys_lib_dlsearch_path " in
2566 case "$compile_rpath " in
2568 *) compile_rpath="$compile_rpath $absdir"
2572 case " $sys_lib_dlsearch_path " in
2575 case "$finalize_rpath " in
2577 *) finalize_rpath="$finalize_rpath $libdir"
2581 fi # $linkmode,$pass = prog,link...
2583 if test "$alldeplibs" = yes &&
2584 { test "$deplibs_check_method" = pass_all ||
2585 { test "$build_libtool_libs" = yes &&
2586 test -n "$library_names"; }; }; then
2587 # We only need to search for static libraries
2592 link_static=no # Whether the deplib will be linked statically
2593 use_static_libs=$prefer_static_libs
2594 if test "$use_static_libs" = built && test "$installed" = yes ; then
2597 if test -n "$library_names" &&
2598 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2599 if test "$installed" = no; then
2600 notinst_deplibs="$notinst_deplibs $lib"
2603 # This is a shared library
2605 # Warn about portability, can't link against -module's on
2606 # some systems (darwin)
2607 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2609 if test "$linkmode" = prog; then
2610 $echo "*** Warning: Linking the executable $output against the loadable module"
2612 $echo "*** Warning: Linking the shared library $output against the loadable module"
2614 $echo "*** $linklib is not portable!"
2616 if test "$linkmode" = lib &&
2617 test "$hardcode_into_libs" = yes; then
2618 # Hardcode the library path.
2619 # Skip directories that are in the system default run-time
2621 case " $sys_lib_dlsearch_path " in
2624 case "$compile_rpath " in
2626 *) compile_rpath="$compile_rpath $absdir"
2630 case " $sys_lib_dlsearch_path " in
2633 case "$finalize_rpath " in
2635 *) finalize_rpath="$finalize_rpath $libdir"
2641 if test -n "$old_archive_from_expsyms_cmds"; then
2642 # figure out the soname
2643 set dummy $library_names
2646 libname=`eval \\$echo \"$libname_spec\"`
2647 # use dlname if we got it. it's perfectly good, no?
2648 if test -n "$dlname"; then
2650 elif test -n "$soname_spec"; then
2654 major=`expr $current - $age`
2658 eval soname=\"$soname_spec\"
2663 # Make a new name for the extract_expsyms_cmds to use
2665 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2666 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2668 # If the library has no export list, then create one now
2669 if test -f "$output_objdir/$soname-def"; then :
2671 $show "extracting exported symbol list from \`$soname'"
2672 save_ifs="$IFS"; IFS='~'
2673 cmds=$extract_expsyms_cmds
2674 for cmd in $cmds; do
2678 $run eval "$cmd" || exit $?
2684 if test -f "$output_objdir/$newlib"; then :; else
2685 $show "generating import library for \`$soname'"
2686 save_ifs="$IFS"; IFS='~'
2687 cmds=$old_archive_from_expsyms_cmds
2688 for cmd in $cmds; do
2692 $run eval "$cmd" || exit $?
2696 # make sure the library variables are pointing to the new library
2699 fi # test -n "$old_archive_from_expsyms_cmds"
2701 if test "$linkmode" = prog || test "$mode" != relink; then
2706 case $hardcode_action in
2707 immediate | unsupported)
2708 if test "$hardcode_direct" = no; then
2711 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2712 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2713 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2714 *-*-unixware7*) add_dir="-L$dir" ;;
2716 # if the lib is a module then we can not link against
2717 # it, someone is ignoring the new warnings I added
2718 if /usr/bin/file -L $add 2> /dev/null |
2719 $EGREP ": [^:]* bundle" >/dev/null ; then
2720 $echo "** Warning, lib $linklib is a module, not a shared library"
2721 if test -z "$old_library" ; then
2723 $echo "** And there doesn't seem to be a static archive available"
2724 $echo "** The link will probably fail, sorry"
2726 add="$dir/$old_library"
2730 elif test "$hardcode_minus_L" = no; then
2732 *-*-sunos*) add_shlibpath="$dir" ;;
2736 elif test "$hardcode_shlibpath_var" = no; then
2737 add_shlibpath="$dir"
2744 if test "$hardcode_direct" = yes; then
2746 elif test "$hardcode_minus_L" = yes; then
2748 # Try looking first in the location we're being installed to.
2749 if test -n "$inst_prefix_dir"; then
2752 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2757 elif test "$hardcode_shlibpath_var" = yes; then
2758 add_shlibpath="$dir"
2767 if test "$lib_linked" != yes; then
2768 $echo "$modename: configuration error: unsupported hardcode properties"
2772 if test -n "$add_shlibpath"; then
2773 case :$compile_shlibpath: in
2774 *":$add_shlibpath:"*) ;;
2775 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2778 if test "$linkmode" = prog; then
2779 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2780 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2782 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2783 test -n "$add" && deplibs="$add $deplibs"
2784 if test "$hardcode_direct" != yes && \
2785 test "$hardcode_minus_L" != yes && \
2786 test "$hardcode_shlibpath_var" = yes; then
2787 case :$finalize_shlibpath: in
2789 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2795 if test "$linkmode" = prog || test "$mode" = relink; then
2799 # Finalize command for both is simple: just hardcode it.
2800 if test "$hardcode_direct" = yes; then
2801 add="$libdir/$linklib"
2802 elif test "$hardcode_minus_L" = yes; then
2805 elif test "$hardcode_shlibpath_var" = yes; then
2806 case :$finalize_shlibpath: in
2808 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2811 elif test "$hardcode_automatic" = yes; then
2812 if test -n "$inst_prefix_dir" &&
2813 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2814 add="$inst_prefix_dir$libdir/$linklib"
2816 add="$libdir/$linklib"
2819 # We cannot seem to hardcode it, guess we'll fake it.
2821 # Try looking first in the location we're being installed to.
2822 if test -n "$inst_prefix_dir"; then
2825 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2832 if test "$linkmode" = prog; then
2833 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2834 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2836 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2837 test -n "$add" && deplibs="$add $deplibs"
2840 elif test "$linkmode" = prog; then
2841 # Here we assume that one of hardcode_direct or hardcode_minus_L
2842 # is not unsupported. This is valid on all known static and
2844 if test "$hardcode_direct" != unsupported; then
2845 test -n "$old_library" && linklib="$old_library"
2846 compile_deplibs="$dir/$linklib $compile_deplibs"
2847 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2849 compile_deplibs="-l$name -L$dir $compile_deplibs"
2850 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2852 elif test "$build_libtool_libs" = yes; then
2853 # Not a shared library
2854 if test "$deplibs_check_method" != pass_all; then
2855 # We're trying link a shared library against a static one
2856 # but the system doesn't support it.
2858 # Just print a warning and add the library to dependency_libs so
2859 # that the program can be linked against the static library.
2861 $echo "*** Warning: This system can not link to static lib archive $lib."
2862 $echo "*** I have the capability to make that library automatically link in when"
2863 $echo "*** you link to this library. But I can only do this if you have a"
2864 $echo "*** shared version of the library, which you do not appear to have."
2865 if test "$module" = yes; then
2866 $echo "*** But as you try to build a module library, libtool will still create "
2867 $echo "*** a static module, that should work as long as the dlopening application"
2868 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2869 if test -z "$global_symbol_pipe"; then
2871 $echo "*** However, this would only work if libtool was able to extract symbol"
2872 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2873 $echo "*** not find such a program. So, this module is probably useless."
2874 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2876 if test "$build_old_libs" = no; then
2877 build_libtool_libs=module
2880 build_libtool_libs=no
2884 deplibs="$dir/$old_library $deplibs"
2887 fi # link shared/static library?
2889 if test "$linkmode" = lib; then
2890 if test -n "$dependency_libs" &&
2891 { test "$hardcode_into_libs" != yes ||
2892 test "$build_old_libs" = yes ||
2893 test "$link_static" = yes; }; then
2894 # Extract -R from dependency_libs
2896 for libdir in $dependency_libs; do
2898 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2900 *" $temp_xrpath "*) ;;
2901 *) xrpath="$xrpath $temp_xrpath";;
2903 *) temp_deplibs="$temp_deplibs $libdir";;
2906 dependency_libs="$temp_deplibs"
2909 newlib_search_path="$newlib_search_path $absdir"
2910 # Link against this library
2911 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2912 # ... and its dependency_libs
2914 for deplib in $dependency_libs; do
2915 newdependency_libs="$deplib $newdependency_libs"
2916 if test "X$duplicate_deps" = "Xyes" ; then
2917 case "$tmp_libs " in
2918 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2921 tmp_libs="$tmp_libs $deplib"
2924 if test "$link_all_deplibs" != no; then
2925 # Add the search paths of all dependency libraries
2926 for deplib in $dependency_libs; do
2928 -L*) path="$deplib" ;;
2930 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2931 test "X$dir" = "X$deplib" && dir="."
2932 # We need an absolute path.
2934 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2936 absdir=`cd "$dir" && pwd`
2937 if test -z "$absdir"; then
2938 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2943 if grep "^installed=no" $deplib > /dev/null; then
2944 path="$absdir/$objdir"
2946 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2947 if test -z "$libdir"; then
2948 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2951 if test "$absdir" != "$libdir"; then
2952 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2959 # we do not want to link against static libs,
2960 # but need to link against shared
2961 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2962 if test -n "$deplibrary_names" ; then
2963 for tmp in $deplibrary_names ; do
2966 if test -f "$path/$depdepl" ; then
2967 depdepl="$path/$depdepl"
2969 # do not add paths which are already there
2970 case " $newlib_search_path " in
2972 *) newlib_search_path="$newlib_search_path $path";;
2985 # Again, we only want to link against shared libraries
2986 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2987 for tmp in $newlib_search_path ; do
2988 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2989 eval depdepl="$tmp/lib$tmp_libs.dylib"
3000 case " $deplibs " in
3002 *) deplibs="$path $deplibs" ;;
3004 case " $deplibs " in
3006 *) deplibs="$depdepl $deplibs" ;;
3009 fi # link_all_deplibs != no
3011 done # for deplib in $libs
3012 dependency_libs="$newdependency_libs"
3013 if test "$pass" = dlpreopen; then
3014 # Link the dlpreopened libraries before other libraries
3015 for deplib in $save_deplibs; do
3016 deplibs="$deplib $deplibs"
3019 if test "$pass" != dlopen; then
3020 if test "$pass" != conv; then
3021 # Make sure lib_search_path contains only unique directories.
3023 for dir in $newlib_search_path; do
3024 case "$lib_search_path " in
3026 *) lib_search_path="$lib_search_path $dir" ;;
3032 if test "$linkmode,$pass" != "prog,link"; then
3035 vars="compile_deplibs finalize_deplibs"
3037 for var in $vars dependency_libs; do
3038 # Add libraries to $var in reverse order
3039 eval tmp_libs=\"\$$var\"
3041 for deplib in $tmp_libs; do
3042 # FIXME: Pedantically, this is the right thing to do, so
3043 # that some nasty dependency loop isn't accidentally
3045 #new_libs="$deplib $new_libs"
3046 # Pragmatically, this seems to cause very few problems in
3049 -L*) new_libs="$deplib $new_libs" ;;
3052 # And here is the reason: when a library appears more
3053 # than once as an explicit dependence of a library, or
3054 # is implicitly linked in more than once by the
3055 # compiler, it is considered special, and multiple
3056 # occurrences thereof are not removed. Compare this
3057 # with having the same library being listed as a
3058 # dependency of multiple other libraries: in this case,
3059 # we know (pedantically, we assume) the library does not
3060 # need to be listed more than once, so we keep only the
3061 # last copy. This is not always right, but it is rare
3062 # enough that we require users that really mean to play
3063 # such unportable linking tricks to link the library
3064 # using -Wl,-lname, so that libtool does not consider it
3065 # for duplicate removal.
3066 case " $specialdeplibs " in
3067 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3069 case " $new_libs " in
3071 *) new_libs="$deplib $new_libs" ;;
3079 for deplib in $new_libs; do
3082 case " $tmp_libs " in
3084 *) tmp_libs="$tmp_libs $deplib" ;;
3087 *) tmp_libs="$tmp_libs $deplib" ;;
3090 eval $var=\"$tmp_libs\"
3093 # Last step: remove runtime libs from dependency_libs
3094 # (they stay in deplibs)
3096 for i in $dependency_libs ; do
3097 case " $predeps $postdeps $compiler_lib_search_path " in
3102 if test -n "$i" ; then
3103 tmp_libs="$tmp_libs $i"
3106 dependency_libs=$tmp_libs
3108 if test "$linkmode" = prog; then
3109 dlfiles="$newdlfiles"
3110 dlprefiles="$newdlprefiles"
3115 if test -n "$deplibs"; then
3116 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3119 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3120 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3123 if test -n "$rpath"; then
3124 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3127 if test -n "$xrpath"; then
3128 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3131 if test -n "$vinfo"; then
3132 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3135 if test -n "$release"; then
3136 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3139 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3140 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3143 # Now set the variables for building old libraries.
3144 build_libtool_libs=no
3146 objs="$objs$old_deplibs"
3150 # Make sure we only generate libraries of the form `libNAME.la'.
3153 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3154 eval shared_ext=\"$shrext_cmds\"
3155 eval libname=\"$libname_spec\"
3158 if test "$module" = no; then
3159 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3163 if test "$need_lib_prefix" != no; then
3164 # Add the "lib" prefix for modules if required
3165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3166 eval shared_ext=\"$shrext_cmds\"
3167 eval libname=\"$libname_spec\"
3169 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3174 if test -n "$objs"; then
3175 if test "$deplibs_check_method" != pass_all; then
3176 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3180 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3181 $echo "*** objects $objs is not portable!"
3182 libobjs="$libobjs $objs"
3186 if test "$dlself" != no; then
3187 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3191 if test "$#" -gt 2; then
3192 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3197 if test -z "$rpath"; then
3198 if test "$build_libtool_libs" = yes; then
3199 # Building a libtool convenience library.
3200 # Some compilers have problems with a `.al' extension so
3201 # convenience libraries should have the same extension an
3202 # archive normally would.
3203 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3204 build_libtool_libs=convenience
3208 if test -n "$vinfo"; then
3209 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3212 if test -n "$release"; then
3213 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3217 # Parse the version information argument.
3218 save_ifs="$IFS"; IFS=':'
3219 set dummy $vinfo 0 0 0
3222 if test -n "$8"; then
3223 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3228 # convert absolute version numbers to libtool ages
3229 # this retains compatibility with .la files and attempts
3230 # to make the code below a bit more comprehensible
3232 case $vinfo_number in
3236 number_revision="$4"
3238 # There are really only two kinds -- those that
3239 # use the current revision as the major version
3240 # and those that subtract age and use age as
3241 # a minor version. But, then there is irix
3242 # which has an extra 1 added just for fun
3244 case $version_type in
3245 darwin|linux|osf|windows|none)
3246 current=`expr $number_major + $number_minor`
3248 revision="$number_revision"
3250 freebsd-aout|freebsd-elf|sunos)
3251 current="$number_major"
3252 revision="$number_minor"
3256 current=`expr $number_major + $number_minor - 1`
3258 revision="$number_minor"
3269 # Check that each of the things are valid numbers.
3271 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]) ;;
3273 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3274 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3280 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]) ;;
3282 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3283 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3289 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]) ;;
3291 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3292 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3297 if test "$age" -gt "$current"; then
3298 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3299 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3303 # Calculate the version variables.
3307 case $version_type in
3311 # Like Linux, but with the current version available in
3312 # verstring for coding it into the library header
3313 major=.`expr $current - $age`
3314 versuffix="$major.$age.$revision"
3315 # Darwin ld doesn't like 0 for these options...
3316 minor_current=`expr $current + 1`
3317 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3322 versuffix=".$current.$revision";
3327 versuffix=".$current";
3331 major=`expr $current - $age + 1`
3333 case $version_type in
3334 nonstopux) verstring_prefix=nonstopux ;;
3335 *) verstring_prefix=sgi ;;
3337 verstring="$verstring_prefix$major.$revision"
3339 # Add in all the interfaces that we are compatible with.
3341 while test "$loop" -ne 0; do
3342 iface=`expr $revision - $loop`
3343 loop=`expr $loop - 1`
3344 verstring="$verstring_prefix$major.$iface:$verstring"
3347 # Before this point, $major must not contain `.'.
3349 versuffix="$major.$revision"
3353 major=.`expr $current - $age`
3354 versuffix="$major.$age.$revision"
3358 major=.`expr $current - $age`
3359 versuffix=".$current.$age.$revision"
3360 verstring="$current.$age.$revision"
3362 # Add in all the interfaces that we are compatible with.
3364 while test "$loop" -ne 0; do
3365 iface=`expr $current - $loop`
3366 loop=`expr $loop - 1`
3367 verstring="$verstring:${iface}.0"
3370 # Make executables depend on our current version.
3371 verstring="$verstring:${current}.0"
3376 versuffix=".$current.$revision"
3380 # Use '-' rather than '.', since we only want one
3381 # extension on DOS 8.3 filesystems.
3382 major=`expr $current - $age`
3387 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3388 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3393 # Clear the version info if we defaulted, and they specified a release.
3394 if test -z "$vinfo" && test -n "$release"; then
3396 case $version_type in
3398 # we can't check for "0.0" in archive_cmds due to quoting
3399 # problems, so we reset it completely
3406 if test "$need_version" = no; then
3413 # Remove version info from name if versioning should be avoided
3414 if test "$avoid_version" = yes && test "$need_version" = no; then
3420 # Check to see if the archive will have undefined symbols.
3421 if test "$allow_undefined" = yes; then
3422 if test "$allow_undefined_flag" = unsupported; then
3423 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3424 build_libtool_libs=no
3428 # Don't allow undefined symbols.
3429 allow_undefined_flag="$no_undefined_flag"
3433 if test "$mode" != relink; then
3434 # Remove our outputs, but don't remove object files since they
3435 # may have been created when compiling PIC objects.
3437 tempremovelist=`$echo "$output_objdir/*"`
3438 for p in $tempremovelist; do
3442 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3443 if test "X$precious_files_regex" != "X"; then
3444 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3449 removelist="$removelist $p"
3454 if test -n "$removelist"; then
3455 $show "${rm}r $removelist"
3456 $run ${rm}r $removelist
3460 # Now set the variables for building old libraries.
3461 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3462 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3464 # Transform .lo files to .o files.
3465 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3468 # Eliminate all temporary directories.
3469 #for path in $notinst_path; do
3470 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3471 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3472 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3475 if test -n "$xrpath"; then
3476 # If the user specified any rpath flags, then add them.
3478 for libdir in $xrpath; do
3479 temp_xrpath="$temp_xrpath -R$libdir"
3480 case "$finalize_rpath " in
3482 *) finalize_rpath="$finalize_rpath $libdir" ;;
3485 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3486 dependency_libs="$temp_xrpath $dependency_libs"
3490 # Make sure dlfiles contains only unique files that won't be dlpreopened
3491 old_dlfiles="$dlfiles"
3493 for lib in $old_dlfiles; do
3494 case " $dlprefiles $dlfiles " in
3496 *) dlfiles="$dlfiles $lib" ;;
3500 # Make sure dlprefiles contains only unique files
3501 old_dlprefiles="$dlprefiles"
3503 for lib in $old_dlprefiles; do
3504 case "$dlprefiles " in
3506 *) dlprefiles="$dlprefiles $lib" ;;
3510 if test "$build_libtool_libs" = yes; then
3511 if test -n "$rpath"; then
3513 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3514 # these systems don't actually have a c library (as such)!
3516 *-*-rhapsody* | *-*-darwin1.[012])
3517 # Rhapsody C library is in the System framework
3518 deplibs="$deplibs -framework System"
3521 # Don't link with libc until the a.out ld.so is fixed.
3523 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3524 # Do not include libc due to us having libc/libc_r.
3526 *-*-sco3.2v5* | *-*-sco5v6*)
3527 # Causes problems with __ctype
3529 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3530 # Compiler inserts libc in the correct place for threads to work
3533 # Add libc to deplibs on all other systems if necessary.
3534 if test "$build_libtool_need_lc" = "yes"; then
3535 deplibs="$deplibs -lc"
3541 # Transform deplibs into only deplibs that can be linked in shared.
3543 libname_save=$libname
3544 release_save=$release
3545 versuffix_save=$versuffix
3547 # I'm not sure if I'm treating the release correctly. I think
3548 # release should show up in the -l (ie -lgmp5) so we don't want to
3549 # add it in twice. Is that correct?
3555 case $deplibs_check_method in
3557 # Don't check for shared/static. Everything works.
3558 # This might be a little naive. We might want to check
3559 # whether the library exists or not. But this is on
3560 # osf3 & osf4 and I'm not really sure... Just
3561 # implementing what was already the behavior.
3565 # This code stresses the "libraries are programs" paradigm to its
3566 # limits. Maybe even breaks it. We compile a program, linking it
3567 # against the deplibs as a proxy for the library. Then we can check
3568 # whether they linked in statically or dynamically with ldd.
3570 cat > conftest.c <<EOF
3571 int main() { return 0; }
3574 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3575 ldd_output=`ldd conftest`
3576 for i in $deplibs; do
3577 name=`expr $i : '-l\(.*\)'`
3578 # If $name is empty we are operating on a -L argument.
3579 if test "$name" != "" && test "$name" != "0"; then
3580 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3581 case " $predeps $postdeps " in
3583 newdeplibs="$newdeplibs $i"
3588 if test -n "$i" ; then
3589 libname=`eval \\$echo \"$libname_spec\"`
3590 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3591 set dummy $deplib_matches
3593 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3594 newdeplibs="$newdeplibs $i"
3598 $echo "*** Warning: dynamic linker does not accept needed library $i."
3599 $echo "*** I have the capability to make that library automatically link in when"
3600 $echo "*** you link to this library. But I can only do this if you have a"
3601 $echo "*** shared version of the library, which I believe you do not have"
3602 $echo "*** because a test_compile did reveal that the linker did not use it for"
3603 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3607 newdeplibs="$newdeplibs $i"
3611 # Error occurred in the first compile. Let's try to salvage
3612 # the situation: Compile a separate program for each library.
3613 for i in $deplibs; do
3614 name=`expr $i : '-l\(.*\)'`
3615 # If $name is empty we are operating on a -L argument.
3616 if test "$name" != "" && test "$name" != "0"; then
3618 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3619 ldd_output=`ldd conftest`
3620 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3621 case " $predeps $postdeps " in
3623 newdeplibs="$newdeplibs $i"
3628 if test -n "$i" ; then
3629 libname=`eval \\$echo \"$libname_spec\"`
3630 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3631 set dummy $deplib_matches
3633 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3634 newdeplibs="$newdeplibs $i"
3638 $echo "*** Warning: dynamic linker does not accept needed library $i."
3639 $echo "*** I have the capability to make that library automatically link in when"
3640 $echo "*** you link to this library. But I can only do this if you have a"
3641 $echo "*** shared version of the library, which you do not appear to have"
3642 $echo "*** because a test_compile did reveal that the linker did not use this one"
3643 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3649 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3650 $echo "*** make it link in! You will probably need to install it or some"
3651 $echo "*** library that it depends on before this library will be fully"
3652 $echo "*** functional. Installing it before continuing would be even better."
3655 newdeplibs="$newdeplibs $i"
3661 set dummy $deplibs_check_method
3662 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3663 for a_deplib in $deplibs; do
3664 name=`expr $a_deplib : '-l\(.*\)'`
3665 # If $name is empty we are operating on a -L argument.
3666 if test "$name" != "" && test "$name" != "0"; then
3667 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3668 case " $predeps $postdeps " in
3670 newdeplibs="$newdeplibs $a_deplib"
3675 if test -n "$a_deplib" ; then
3676 libname=`eval \\$echo \"$libname_spec\"`
3677 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3678 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3679 for potent_lib in $potential_libs; do
3680 # Follow soft links.
3681 if ls -lLd "$potent_lib" 2>/dev/null \
3682 | grep " -> " >/dev/null; then
3685 # The statement above tries to avoid entering an
3686 # endless loop below, in case of cyclic links.
3687 # We might still enter an endless loop, since a link
3688 # loop can be closed while we follow links,
3690 potlib="$potent_lib"
3691 while test -h "$potlib" 2>/dev/null; do
3692 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3694 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3695 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3698 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3700 | $EGREP "$file_magic_regex" > /dev/null; then
3701 newdeplibs="$newdeplibs $a_deplib"
3708 if test -n "$a_deplib" ; then
3711 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3712 $echo "*** I have the capability to make that library automatically link in when"
3713 $echo "*** you link to this library. But I can only do this if you have a"
3714 $echo "*** shared version of the library, which you do not appear to have"
3715 $echo "*** because I did check the linker path looking for a file starting"
3716 if test -z "$potlib" ; then
3717 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3719 $echo "*** with $libname and none of the candidates passed a file format test"
3720 $echo "*** using a file magic. Last file checked: $potlib"
3724 # Add a -L argument.
3725 newdeplibs="$newdeplibs $a_deplib"
3727 done # Gone through all deplibs.
3730 set dummy $deplibs_check_method
3731 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3732 for a_deplib in $deplibs; do
3733 name=`expr $a_deplib : '-l\(.*\)'`
3734 # If $name is empty we are operating on a -L argument.
3735 if test -n "$name" && test "$name" != "0"; then
3736 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3737 case " $predeps $postdeps " in
3739 newdeplibs="$newdeplibs $a_deplib"
3744 if test -n "$a_deplib" ; then
3745 libname=`eval \\$echo \"$libname_spec\"`
3746 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3747 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3748 for potent_lib in $potential_libs; do
3749 potlib="$potent_lib" # see symlink-check above in file_magic test
3750 if eval $echo \"$potent_lib\" 2>/dev/null \
3752 | $EGREP "$match_pattern_regex" > /dev/null; then
3753 newdeplibs="$newdeplibs $a_deplib"
3760 if test -n "$a_deplib" ; then
3763 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3764 $echo "*** I have the capability to make that library automatically link in when"
3765 $echo "*** you link to this library. But I can only do this if you have a"
3766 $echo "*** shared version of the library, which you do not appear to have"
3767 $echo "*** because I did check the linker path looking for a file starting"
3768 if test -z "$potlib" ; then
3769 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3771 $echo "*** with $libname and none of the candidates passed a file format test"
3772 $echo "*** using a regex pattern. Last file checked: $potlib"
3776 # Add a -L argument.
3777 newdeplibs="$newdeplibs $a_deplib"
3779 done # Gone through all deplibs.
3783 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3784 -e 's/ -[LR][^ ]*//g'`
3785 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3786 for i in $predeps $postdeps ; do
3787 # can't use Xsed below, because $i might contain '/'
3788 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3791 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3792 | grep . >/dev/null; then
3794 if test "X$deplibs_check_method" = "Xnone"; then
3795 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3797 $echo "*** Warning: inter-library dependencies are not known to be supported."
3799 $echo "*** All declared inter-library dependencies are being dropped."
3804 versuffix=$versuffix_save
3806 release=$release_save
3807 libname=$libname_save
3811 *-*-rhapsody* | *-*-darwin1.[012])
3812 # On Rhapsody replace the C library is the System framework
3813 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3817 if test "$droppeddeps" = yes; then
3818 if test "$module" = yes; then
3820 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3821 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3822 $echo "*** a static module, that should work as long as the dlopening"
3823 $echo "*** application is linked with the -dlopen flag."
3824 if test -z "$global_symbol_pipe"; then
3826 $echo "*** However, this would only work if libtool was able to extract symbol"
3827 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3828 $echo "*** not find such a program. So, this module is probably useless."
3829 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3831 if test "$build_old_libs" = no; then
3832 oldlibs="$output_objdir/$libname.$libext"
3833 build_libtool_libs=module
3836 build_libtool_libs=no
3839 $echo "*** The inter-library dependencies that have been dropped here will be"
3840 $echo "*** automatically added whenever a program is linked with this library"
3841 $echo "*** or is declared to -dlopen it."
3843 if test "$allow_undefined" = no; then
3845 $echo "*** Since this library must not contain undefined symbols,"
3846 $echo "*** because either the platform does not support them or"
3847 $echo "*** it was explicitly requested with -no-undefined,"
3848 $echo "*** libtool will only create a static version of it."
3849 if test "$build_old_libs" = no; then
3850 oldlibs="$output_objdir/$libname.$libext"
3851 build_libtool_libs=module
3854 build_libtool_libs=no
3859 # Done checking deplibs!
3864 # move library search paths that coincide with paths to not yet
3865 # installed libraries to the beginning of the library search list
3867 for path in $notinst_path; do
3868 case " $new_libs " in
3869 *" -L$path/$objdir "*) ;;
3871 case " $deplibs " in
3872 *" -L$path/$objdir "*)
3873 new_libs="$new_libs -L$path/$objdir" ;;
3878 for deplib in $deplibs; do
3881 case " $new_libs " in
3883 *) new_libs="$new_libs $deplib" ;;
3886 *) new_libs="$new_libs $deplib" ;;
3892 # All the library-specific variables (install_libdir is set above).
3897 # Test again, we may have decided not to build it any more
3898 if test "$build_libtool_libs" = yes; then
3899 if test "$hardcode_into_libs" = yes; then
3900 # Hardcode the library paths
3903 rpath="$finalize_rpath"
3904 test "$mode" != relink && rpath="$compile_rpath$rpath"
3905 for libdir in $rpath; do
3906 if test -n "$hardcode_libdir_flag_spec"; then
3907 if test -n "$hardcode_libdir_separator"; then
3908 if test -z "$hardcode_libdirs"; then
3909 hardcode_libdirs="$libdir"
3911 # Just accumulate the unique libdirs.
3912 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3913 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3916 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3921 eval flag=\"$hardcode_libdir_flag_spec\"
3922 dep_rpath="$dep_rpath $flag"
3924 elif test -n "$runpath_var"; then
3925 case "$perm_rpath " in
3927 *) perm_rpath="$perm_rpath $libdir" ;;
3931 # Substitute the hardcoded libdirs into the rpath.
3932 if test -n "$hardcode_libdir_separator" &&
3933 test -n "$hardcode_libdirs"; then
3934 libdir="$hardcode_libdirs"
3935 if test -n "$hardcode_libdir_flag_spec_ld"; then
3936 case $archive_cmds in
3937 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3938 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3941 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3944 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3945 # We should set the runpath_var.
3947 for dir in $perm_rpath; do
3950 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3952 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3955 shlibpath="$finalize_shlibpath"
3956 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3957 if test -n "$shlibpath"; then
3958 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3961 # Get the real and link names of the library.
3962 eval shared_ext=\"$shrext_cmds\"
3963 eval library_names=\"$library_names_spec\"
3964 set dummy $library_names
3968 if test -n "$soname_spec"; then
3969 eval soname=\"$soname_spec\"
3973 if test -z "$dlname"; then
3977 lib="$output_objdir/$realname"
3981 linknames="$linknames $link"
3984 # Use standard objects if they are pic
3985 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3987 # Prepare the list of exported symbols
3988 if test -z "$export_symbols"; then
3989 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3990 $show "generating symbol list for \`$libname.la'"
3991 export_symbols="$output_objdir/$libname.exp"
3992 $run $rm $export_symbols
3993 cmds=$export_symbols_cmds
3994 save_ifs="$IFS"; IFS='~'
3995 for cmd in $cmds; do
3998 if len=`expr "X$cmd" : ".*"` &&
3999 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4001 $run eval "$cmd" || exit $?
4002 skipped_export=false
4004 # The command line is too long to execute in one step.
4005 $show "using reloadable object file for export list..."
4007 # Break out early, otherwise skipped_export may be
4008 # set to false by a later but shorter cmd.
4013 if test -n "$export_symbols_regex"; then
4014 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4015 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4016 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4017 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4022 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4023 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4027 for test_deplib in $deplibs; do
4028 case " $convenience " in
4029 *" $test_deplib "*) ;;
4031 tmp_deplibs="$tmp_deplibs $test_deplib"
4035 deplibs="$tmp_deplibs"
4037 if test -n "$convenience"; then
4038 if test -n "$whole_archive_flag_spec"; then
4039 save_libobjs=$libobjs
4040 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4042 gentop="$output_objdir/${outputname}x"
4043 generated="$generated $gentop"
4045 func_extract_archives $gentop $convenience
4046 libobjs="$libobjs $func_extract_archives_result"
4050 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4051 eval flag=\"$thread_safe_flag_spec\"
4052 linker_flags="$linker_flags $flag"
4055 # Make a backup of the uninstalled library when relinking
4056 if test "$mode" = relink; then
4057 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4060 # Do each of the archive commands.
4061 if test "$module" = yes && test -n "$module_cmds" ; then
4062 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4063 eval test_cmds=\"$module_expsym_cmds\"
4064 cmds=$module_expsym_cmds
4066 eval test_cmds=\"$module_cmds\"
4070 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4071 eval test_cmds=\"$archive_expsym_cmds\"
4072 cmds=$archive_expsym_cmds
4074 eval test_cmds=\"$archive_cmds\"
4079 if test "X$skipped_export" != "X:" &&
4080 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4081 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4084 # The command line is too long to link in one step, link piecewise.
4085 $echo "creating reloadable object files..."
4087 # Save the value of $output and $libobjs because we want to
4088 # use them later. If we have whole_archive_flag_spec, we
4089 # want to use save_libobjs as it was before
4090 # whole_archive_flag_spec was expanded, because we can't
4091 # assume the linker understands whole_archive_flag_spec.
4092 # This may have to be revisited, in case too many
4093 # convenience libraries get linked in and end up exceeding
4095 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4096 save_libobjs=$libobjs
4099 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4101 # Clear the reloadable object creation command queue and
4102 # initialize k to one.
4109 output=$output_objdir/$output_la-${k}.$objext
4110 # Loop over the list of objects to be linked.
4111 for obj in $save_libobjs
4113 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4114 if test "X$objlist" = X ||
4115 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4116 test "$len" -le "$max_cmd_len"; }; then
4117 objlist="$objlist $obj"
4119 # The command $test_cmds is almost too long, add a
4120 # command to the queue.
4121 if test "$k" -eq 1 ; then
4122 # The first file doesn't have a previous command to add.
4123 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4125 # All subsequent reloadable object files will link in
4126 # the last one created.
4127 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4129 last_robj=$output_objdir/$output_la-${k}.$objext
4131 output=$output_objdir/$output_la-${k}.$objext
4136 # Handle the remaining objects by creating one last
4137 # reloadable object file. All subsequent reloadable object
4138 # files will link in the last one created.
4139 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4140 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4142 if ${skipped_export-false}; then
4143 $show "generating symbol list for \`$libname.la'"
4144 export_symbols="$output_objdir/$libname.exp"
4145 $run $rm $export_symbols
4147 # Append the command to create the export file.
4148 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4151 # Set up a command to remove the reloadable object files
4152 # after they are used.
4154 while test "$i" -lt "$k"
4157 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4160 $echo "creating a temporary reloadable object file: $output"
4162 # Loop through the commands generated above and execute them.
4163 save_ifs="$IFS"; IFS='~'
4164 for cmd in $concat_cmds; do
4167 $run eval "$cmd" || exit $?
4172 # Restore the value of output.
4175 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4176 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4178 # Expand the library linking commands again to reset the
4179 # value of $libobjs for piecewise linking.
4181 # Do each of the archive commands.
4182 if test "$module" = yes && test -n "$module_cmds" ; then
4183 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4184 cmds=$module_expsym_cmds
4189 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4190 cmds=$archive_expsym_cmds
4196 # Append the command to remove the reloadable object files
4197 # to the just-reset $cmds.
4198 eval cmds=\"\$cmds~\$rm $delfiles\"
4200 save_ifs="$IFS"; IFS='~'
4201 for cmd in $cmds; do
4205 $run eval "$cmd" || {
4208 # Restore the uninstalled library and exit
4209 if test "$mode" = relink; then
4210 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4218 # Restore the uninstalled library and exit
4219 if test "$mode" = relink; then
4220 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4222 if test -n "$convenience"; then
4223 if test -z "$whole_archive_flag_spec"; then
4224 $show "${rm}r $gentop"
4225 $run ${rm}r "$gentop"
4232 # Create links to the real library.
4233 for linkname in $linknames; do
4234 if test "$realname" != "$linkname"; then
4235 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4236 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4240 # If -module or -export-dynamic was specified, set the dlname.
4241 if test "$module" = yes || test "$export_dynamic" = yes; then
4242 # On all known operating systems, these are identical.
4249 if test -n "$deplibs"; then
4250 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4253 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4254 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4257 if test -n "$rpath"; then
4258 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4261 if test -n "$xrpath"; then
4262 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4265 if test -n "$vinfo"; then
4266 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4269 if test -n "$release"; then
4270 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4275 if test -n "$objs$old_deplibs"; then
4276 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4280 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4288 # Delete the old objects.
4289 $run $rm $obj $libobj
4291 # Objects from convenience libraries. This assumes
4292 # single-version convenience libraries. Whenever we create
4293 # different ones for PIC/non-PIC, this we'll have to duplicate
4297 # reload_cmds runs $LD directly, so let us get rid of
4298 # -Wl from whole_archive_flag_spec and hope we can get by with
4299 # turning comma into space..
4302 if test -n "$convenience"; then
4303 if test -n "$whole_archive_flag_spec"; then
4304 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4305 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4307 gentop="$output_objdir/${obj}x"
4308 generated="$generated $gentop"
4310 func_extract_archives $gentop $convenience
4311 reload_conv_objs="$reload_objs $func_extract_archives_result"
4315 # Create the old-style object.
4316 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
4320 save_ifs="$IFS"; IFS='~'
4321 for cmd in $cmds; do
4325 $run eval "$cmd" || exit $?
4329 # Exit if we aren't doing a library object file.
4330 if test -z "$libobj"; then
4331 if test -n "$gentop"; then
4332 $show "${rm}r $gentop"
4339 if test "$build_libtool_libs" != yes; then
4340 if test -n "$gentop"; then
4341 $show "${rm}r $gentop"
4345 # Create an invalid libtool object if no PIC, so that we don't
4346 # accidentally link it into a program.
4347 # $show "echo timestamp > $libobj"
4348 # $run eval "echo timestamp > $libobj" || exit $?
4352 if test -n "$pic_flag" || test "$pic_mode" != default; then
4353 # Only do commands if we really have different PIC objects.
4354 reload_objs="$libobjs $reload_conv_objs"
4357 save_ifs="$IFS"; IFS='~'
4358 for cmd in $cmds; do
4362 $run eval "$cmd" || exit $?
4367 if test -n "$gentop"; then
4368 $show "${rm}r $gentop"
4377 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4379 if test -n "$vinfo"; then
4380 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4383 if test -n "$release"; then
4384 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4387 if test "$preload" = yes; then
4388 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4389 test "$dlopen_self_static" = unknown; then
4390 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4395 *-*-rhapsody* | *-*-darwin1.[012])
4396 # On Rhapsody replace the C library is the System framework
4397 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4398 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4404 # Don't allow lazy linking, it breaks C++ global constructors
4405 if test "$tagname" = CXX ; then
4406 compile_command="$compile_command ${wl}-bind_at_load"
4407 finalize_command="$finalize_command ${wl}-bind_at_load"
4413 # move library search paths that coincide with paths to not yet
4414 # installed libraries to the beginning of the library search list
4416 for path in $notinst_path; do
4417 case " $new_libs " in
4418 *" -L$path/$objdir "*) ;;
4420 case " $compile_deplibs " in
4421 *" -L$path/$objdir "*)
4422 new_libs="$new_libs -L$path/$objdir" ;;
4427 for deplib in $compile_deplibs; do
4430 case " $new_libs " in
4432 *) new_libs="$new_libs $deplib" ;;
4435 *) new_libs="$new_libs $deplib" ;;
4438 compile_deplibs="$new_libs"
4441 compile_command="$compile_command $compile_deplibs"
4442 finalize_command="$finalize_command $finalize_deplibs"
4444 if test -n "$rpath$xrpath"; then
4445 # If the user specified any rpath flags, then add them.
4446 for libdir in $rpath $xrpath; do
4447 # This is the magic to use -rpath.
4448 case "$finalize_rpath " in
4450 *) finalize_rpath="$finalize_rpath $libdir" ;;
4455 # Now hardcode the library paths
4458 for libdir in $compile_rpath $finalize_rpath; do
4459 if test -n "$hardcode_libdir_flag_spec"; then
4460 if test -n "$hardcode_libdir_separator"; then
4461 if test -z "$hardcode_libdirs"; then
4462 hardcode_libdirs="$libdir"
4464 # Just accumulate the unique libdirs.
4465 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4466 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4469 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4474 eval flag=\"$hardcode_libdir_flag_spec\"
4475 rpath="$rpath $flag"
4477 elif test -n "$runpath_var"; then
4478 case "$perm_rpath " in
4480 *) perm_rpath="$perm_rpath $libdir" ;;
4484 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4485 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4486 case :$dllsearchpath: in
4488 *) dllsearchpath="$dllsearchpath:$libdir";;
4490 case :$dllsearchpath: in
4491 *":$testbindir:"*) ;;
4492 *) dllsearchpath="$dllsearchpath:$testbindir";;
4497 # Substitute the hardcoded libdirs into the rpath.
4498 if test -n "$hardcode_libdir_separator" &&
4499 test -n "$hardcode_libdirs"; then
4500 libdir="$hardcode_libdirs"
4501 eval rpath=\" $hardcode_libdir_flag_spec\"
4503 compile_rpath="$rpath"
4507 for libdir in $finalize_rpath; do
4508 if test -n "$hardcode_libdir_flag_spec"; then
4509 if test -n "$hardcode_libdir_separator"; then
4510 if test -z "$hardcode_libdirs"; then
4511 hardcode_libdirs="$libdir"
4513 # Just accumulate the unique libdirs.
4514 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4515 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4518 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4523 eval flag=\"$hardcode_libdir_flag_spec\"
4524 rpath="$rpath $flag"
4526 elif test -n "$runpath_var"; then
4527 case "$finalize_perm_rpath " in
4529 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4533 # Substitute the hardcoded libdirs into the rpath.
4534 if test -n "$hardcode_libdir_separator" &&
4535 test -n "$hardcode_libdirs"; then
4536 libdir="$hardcode_libdirs"
4537 eval rpath=\" $hardcode_libdir_flag_spec\"
4539 finalize_rpath="$rpath"
4541 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4542 # Transform all the library objects into standard objects.
4543 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4544 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4548 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4549 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4550 dlsyms="${outputname}S.c"
4552 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4556 if test -n "$dlsyms"; then
4560 # Discover the nlist of each of the dlfiles.
4561 nlist="$output_objdir/${outputname}.nm"
4563 $show "$rm $nlist ${nlist}S ${nlist}T"
4564 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4566 # Parse the name list into a source file.
4567 $show "creating $output_objdir/$dlsyms"
4569 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4570 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4571 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4577 /* Prevent the only kind of declaration conflicts we can make. */
4578 #define lt_preloaded_symbols some_other_symbol
4580 /* External symbol declarations for the compiler. */\
4583 if test "$dlself" = yes; then
4584 $show "generating symbol list for \`$output'"
4586 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4588 # Add our own program objects to the symbol list.
4589 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4590 for arg in $progfiles; do
4591 $show "extracting global C symbols from \`$arg'"
4592 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4595 if test -n "$exclude_expsyms"; then
4596 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4597 $run eval '$mv "$nlist"T "$nlist"'
4600 if test -n "$export_symbols_regex"; then
4601 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4602 $run eval '$mv "$nlist"T "$nlist"'
4605 # Prepare the list of exported symbols
4606 if test -z "$export_symbols"; then
4607 export_symbols="$output_objdir/$outputname.exp"
4608 $run $rm $export_symbols
4609 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4611 *cygwin* | *mingw* )
4612 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4613 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4617 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4618 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4619 $run eval 'mv "$nlist"T "$nlist"'
4621 *cygwin* | *mingw* )
4622 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4623 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4629 for arg in $dlprefiles; do
4630 $show "extracting global C symbols from \`$arg'"
4631 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4632 $run eval '$echo ": $name " >> "$nlist"'
4633 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4636 if test -z "$run"; then
4637 # Make sure we have at least an empty file.
4638 test -f "$nlist" || : > "$nlist"
4640 if test -n "$exclude_expsyms"; then
4641 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4642 $mv "$nlist"T "$nlist"
4645 # Try sorting and uniquifying the output.
4646 if grep -v "^: " < "$nlist" |
4647 if sort -k 3 </dev/null >/dev/null 2>&1; then
4652 uniq > "$nlist"S; then
4655 grep -v "^: " < "$nlist" > "$nlist"S
4658 if test -f "$nlist"S; then
4659 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4661 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4664 $echo >> "$output_objdir/$dlsyms" "\
4666 #undef lt_preloaded_symbols
4668 #if defined (__STDC__) && __STDC__
4669 # define lt_ptr void *
4671 # define lt_ptr char *
4675 /* The mapping between symbol names and symbols. */
4679 *cygwin* | *mingw* )
4680 $echo >> "$output_objdir/$dlsyms" "\
4681 /* DATA imports from DLLs on WIN32 can't be const, because
4682 runtime relocations are performed -- see ld's documentation
4688 $echo >> "$output_objdir/$dlsyms" "\
4695 $echo >> "$output_objdir/$dlsyms" "\
4699 lt_preloaded_symbols[] =
4703 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4705 $echo >> "$output_objdir/$dlsyms" "\
4709 /* This works around a problem in FreeBSD linker */
4710 #ifdef FREEBSD_WORKAROUND
4711 static const void *lt_preloaded_setup() {
4712 return lt_preloaded_symbols;
4722 pic_flag_for_symtable=
4724 # compiling the symbol table file with pic_flag works around
4725 # a FreeBSD bug that causes programs to crash when -lm is
4726 # linked before any other PIC object. But we must not use
4727 # pic_flag when linking with -static. The problem exists in
4728 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4729 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4730 case "$compile_command " in
4732 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4735 case "$compile_command " in
4737 *) pic_flag_for_symtable=" $pic_flag";;
4741 # Now compile the dynamic symbol file.
4742 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4743 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4745 # Clean up the generated files.
4746 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4747 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4749 # Transform the symbol file into the correct name.
4751 *cygwin* | *mingw* )
4752 if test -f "$output_objdir/${outputname}.def" ; then
4753 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4754 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4756 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4757 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4761 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4762 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4767 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4772 # We keep going just in case the user didn't refer to
4773 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4774 # really was required.
4776 # Nullify the symbol file.
4777 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4778 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4781 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4782 # Replace the output file specification.
4783 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4784 link_command="$compile_command$compile_rpath"
4786 # We have no uninstalled library dependencies, so finalize right now.
4787 $show "$link_command"
4788 $run eval "$link_command"
4791 # Delete the generated files.
4792 if test -n "$dlsyms"; then
4793 $show "$rm $output_objdir/${outputname}S.${objext}"
4794 $run $rm "$output_objdir/${outputname}S.${objext}"
4800 if test -n "$shlibpath_var"; then
4801 # We should set the shlibpath_var
4803 for dir in $temp_rpath; do
4805 [\\/]* | [A-Za-z]:[\\/]*)
4810 # Relative path: add a thisdir entry.
4811 rpath="$rpath\$thisdir/$dir:"
4818 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4819 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4821 if test -n "$finalize_shlibpath"; then
4822 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4827 if test -n "$runpath_var"; then
4828 if test -n "$perm_rpath"; then
4829 # We should set the runpath_var.
4831 for dir in $perm_rpath; do
4834 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4836 if test -n "$finalize_perm_rpath"; then
4837 # We should set the runpath_var.
4839 for dir in $finalize_perm_rpath; do
4842 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4846 if test "$no_install" = yes; then
4847 # We don't need to create a wrapper script.
4848 link_command="$compile_var$compile_command$compile_rpath"
4849 # Replace the output file specification.
4850 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4851 # Delete the old output file.
4853 # Link the executable and exit
4854 $show "$link_command"
4855 $run eval "$link_command" || exit $?
4859 if test "$hardcode_action" = relink; then
4860 # Fast installation is not supported
4861 link_command="$compile_var$compile_command$compile_rpath"
4862 relink_command="$finalize_var$finalize_command$finalize_rpath"
4864 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4865 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4867 if test "$fast_install" != no; then
4868 link_command="$finalize_var$compile_command$finalize_rpath"
4869 if test "$fast_install" = yes; then
4870 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4872 # fast_install is set to needless
4876 link_command="$compile_var$compile_command$compile_rpath"
4877 relink_command="$finalize_var$finalize_command$finalize_rpath"
4881 # Replace the output file specification.
4882 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4884 # Delete the old output files.
4885 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4887 $show "$link_command"
4888 $run eval "$link_command" || exit $?
4890 # Now create the wrapper script.
4891 $show "creating $output"
4893 # Quote the relink command for shipping.
4894 if test -n "$relink_command"; then
4895 # Preserve any variables that may affect compiler behavior
4896 for var in $variables_saved_for_relink; do
4897 if eval test -z \"\${$var+set}\"; then
4898 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4899 elif eval var_value=\$$var; test -z "$var_value"; then
4900 relink_command="$var=; export $var; $relink_command"
4902 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4903 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4906 relink_command="(cd `pwd`; $relink_command)"
4907 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4910 # Quote $echo for shipping.
4911 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4913 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4914 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4916 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4918 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4921 # Only actually do things if our run command is non-null.
4922 if test -z "$run"; then
4923 # win32 will think the script is a binary if it has
4924 # a .exe suffix, so we strip it off here.
4926 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4928 # test for cygwin because mv fails w/o .exe extensions
4932 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4936 *cygwin* | *mingw* )
4937 output_name=`basename $output`
4938 output_path=`dirname $output`
4939 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4940 cwrapper="$output_path/$output_name.exe"
4941 $rm $cwrappersource $cwrapper
4942 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4944 cat > $cwrappersource <<EOF
4946 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4947 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4949 The $output program cannot be directly executed until all the libtool
4950 libraries that it depends on are installed.
4952 This wrapper executable should never be moved out of the build directory.
4953 If it is, it will not operate correctly.
4955 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4956 but could eventually absorb all of the scripts functionality and
4957 exec $objdir/$outputname directly.
4960 cat >> $cwrappersource<<"EOF"
4969 #include <sys/stat.h>
4971 #if defined(PATH_MAX)
4972 # define LT_PATHMAX PATH_MAX
4973 #elif defined(MAXPATHLEN)
4974 # define LT_PATHMAX MAXPATHLEN
4976 # define LT_PATHMAX 1024
4979 #ifndef DIR_SEPARATOR
4980 # define DIR_SEPARATOR '/'
4981 # define PATH_SEPARATOR ':'
4984 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4986 # define HAVE_DOS_BASED_FILE_SYSTEM
4987 # ifndef DIR_SEPARATOR_2
4988 # define DIR_SEPARATOR_2 '\\'
4990 # ifndef PATH_SEPARATOR_2
4991 # define PATH_SEPARATOR_2 ';'
4995 #ifndef DIR_SEPARATOR_2
4996 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4997 #else /* DIR_SEPARATOR_2 */
4998 # define IS_DIR_SEPARATOR(ch) \
4999 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5000 #endif /* DIR_SEPARATOR_2 */
5002 #ifndef PATH_SEPARATOR_2
5003 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5004 #else /* PATH_SEPARATOR_2 */
5005 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5006 #endif /* PATH_SEPARATOR_2 */
5008 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5009 #define XFREE(stale) do { \
5010 if (stale) { free ((void *) stale); stale = 0; } \
5013 /* -DDEBUG is fairly common in CFLAGS. */
5015 #if defined DEBUGWRAPPER
5016 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5018 # define DEBUG(format, ...)
5021 const char *program_name = NULL;
5023 void * xmalloc (size_t num);
5024 char * xstrdup (const char *string);
5025 const char * base_name (const char *name);
5026 char * find_executable(const char *wrapper);
5027 int check_executable(const char *path);
5028 char * strendzap(char *str, const char *pat);
5029 void lt_fatal (const char *message, ...);
5032 main (int argc, char *argv[])
5037 program_name = (char *) xstrdup (base_name (argv[0]));
5038 DEBUG("(main) argv[0] : %s\n",argv[0]);
5039 DEBUG("(main) program_name : %s\n",program_name);
5040 newargz = XMALLOC(char *, argc+2);
5043 cat >> $cwrappersource <<EOF
5044 newargz[0] = (char *) xstrdup("$SHELL");
5047 cat >> $cwrappersource <<"EOF"
5048 newargz[1] = find_executable(argv[0]);
5049 if (newargz[1] == NULL)
5050 lt_fatal("Couldn't find %s", argv[0]);
5051 DEBUG("(main) found exe at : %s\n",newargz[1]);
5052 /* we know the script has the same name, without the .exe */
5053 /* so make sure newargz[1] doesn't end in .exe */
5054 strendzap(newargz[1],".exe");
5055 for (i = 1; i < argc; i++)
5056 newargz[i+1] = xstrdup(argv[i]);
5057 newargz[argc+1] = NULL;
5059 for (i=0; i<argc+1; i++)
5061 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5069 cat >> $cwrappersource <<EOF
5070 execv("$SHELL",(char const **)newargz);
5074 cat >> $cwrappersource <<EOF
5075 execv("$SHELL",newargz);
5080 cat >> $cwrappersource <<"EOF"
5085 xmalloc (size_t num)
5087 void * p = (void *) malloc (num);
5089 lt_fatal ("Memory exhausted");
5095 xstrdup (const char *string)
5097 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5102 base_name (const char *name)
5106 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5107 /* Skip over the disk name in MSDOS pathnames. */
5108 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5112 for (base = name; *name; name++)
5113 if (IS_DIR_SEPARATOR (*name))
5119 check_executable(const char * path)
5123 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5124 if ((!path) || (!*path))
5127 if ((stat (path, &st) >= 0) &&
5129 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5130 #if defined (S_IXOTH)
5131 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5133 #if defined (S_IXGRP)
5134 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5136 ((st.st_mode & S_IXUSR) == S_IXUSR))
5143 /* Searches for the full path of the wrapper. Returns
5144 newly allocated full path name if found, NULL otherwise */
5146 find_executable (const char* wrapper)
5151 /* static buffer for getcwd */
5152 char tmp[LT_PATHMAX + 1];
5156 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5158 if ((wrapper == NULL) || (*wrapper == '\0'))
5161 /* Absolute path? */
5162 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5163 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5165 concat_name = xstrdup (wrapper);
5166 if (check_executable(concat_name))
5173 if (IS_DIR_SEPARATOR (wrapper[0]))
5175 concat_name = xstrdup (wrapper);
5176 if (check_executable(concat_name))
5180 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5184 for (p = wrapper; *p; p++)
5192 /* no slashes; search PATH */
5193 const char* path = getenv ("PATH");
5196 for (p = path; *p; p = p_next)
5200 for (q = p; *q; q++)
5201 if (IS_PATH_SEPARATOR(*q))
5204 p_next = (*q == '\0' ? q : q + 1);
5207 /* empty path: current directory */
5208 if (getcwd (tmp, LT_PATHMAX) == NULL)
5209 lt_fatal ("getcwd failed");
5210 tmp_len = strlen(tmp);
5211 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5212 memcpy (concat_name, tmp, tmp_len);
5213 concat_name[tmp_len] = '/';
5214 strcpy (concat_name + tmp_len + 1, wrapper);
5218 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5219 memcpy (concat_name, p, p_len);
5220 concat_name[p_len] = '/';
5221 strcpy (concat_name + p_len + 1, wrapper);
5223 if (check_executable(concat_name))
5228 /* not found in PATH; assume curdir */
5230 /* Relative path | not found in path: prepend cwd */
5231 if (getcwd (tmp, LT_PATHMAX) == NULL)
5232 lt_fatal ("getcwd failed");
5233 tmp_len = strlen(tmp);
5234 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5235 memcpy (concat_name, tmp, tmp_len);
5236 concat_name[tmp_len] = '/';
5237 strcpy (concat_name + tmp_len + 1, wrapper);
5239 if (check_executable(concat_name))
5246 strendzap(char *str, const char *pat)
5250 assert(str != NULL);
5251 assert(pat != NULL);
5254 patlen = strlen(pat);
5258 str += len - patlen;
5259 if (strcmp(str, pat) == 0)
5266 lt_error_core (int exit_status, const char * mode,
5267 const char * message, va_list ap)
5269 fprintf (stderr, "%s: %s: ", program_name, mode);
5270 vfprintf (stderr, message, ap);
5271 fprintf (stderr, ".\n");
5273 if (exit_status >= 0)
5278 lt_fatal (const char *message, ...)
5281 va_start (ap, message);
5282 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5286 # we should really use a build-platform specific compiler
5287 # here, but OTOH, the wrappers (shell script and this C one)
5288 # are only useful if you want to execute the "real" binary.
5289 # Since the "real" binary is built for $host, then this
5290 # wrapper might as well be built for $host, too.
5291 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5295 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5300 # $output - temporary wrapper script for $objdir/$outputname
5301 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5303 # The $output program cannot be directly executed until all the libtool
5304 # libraries that it depends on are installed.
5306 # This wrapper script should never be moved out of the build directory.
5307 # If it is, it will not operate correctly.
5309 # Sed substitution that helps us do robust quoting. It backslashifies
5310 # metacharacters that are still active within double-quoted strings.
5311 Xsed='${SED} -e 1s/^X//'
5312 sed_quote_subst='$sed_quote_subst'
5314 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5315 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5318 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5319 # is contrary to our usage. Disable this feature.
5320 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5321 setopt NO_GLOB_SUBST
5323 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5325 BIN_SH=xpg4; export BIN_SH # for Tru64
5326 DUALCASE=1; export DUALCASE # for MKS sh
5328 # The HP-UX ksh and POSIX shell print the target directory to stdout
5330 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5332 relink_command=\"$relink_command\"
5334 # This environment variable determines our operation mode.
5335 if test \"\$libtool_install_magic\" = \"$magic\"; then
5336 # install mode needs the following variable:
5337 notinst_deplibs='$notinst_deplibs'
5339 # When we are sourced in execute mode, \$file and \$echo are already set.
5340 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5343 # Make sure echo works.
5344 if test \"X\$1\" = X--no-reexec; then
5345 # Discard the --no-reexec flag, and continue.
5347 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5348 # Yippee, \$echo works!
5351 # Restart under the correct shell, and then maybe \$echo will work.
5352 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5358 # Find the directory that this script lives in.
5359 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5360 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5362 # Follow symbolic links until we get to the real thisdir.
5363 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5364 while test -n \"\$file\"; do
5365 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5367 # If there was a directory component, then change thisdir.
5368 if test \"x\$destdir\" != \"x\$file\"; then
5369 case \"\$destdir\" in
5370 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5371 *) thisdir=\"\$thisdir/\$destdir\" ;;
5375 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5376 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5379 # Try to get the absolute directory name.
5380 absdir=\`cd \"\$thisdir\" && pwd\`
5381 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5384 if test "$fast_install" = yes; then
5386 program=lt-'$outputname'$exeext
5387 progdir=\"\$thisdir/$objdir\"
5389 if test ! -f \"\$progdir/\$program\" || \\
5390 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5391 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5393 file=\"\$\$-\$program\"
5395 if test ! -d \"\$progdir\"; then
5396 $mkdir \"\$progdir\"
5398 $rm \"\$progdir/\$file\"
5403 # relink executable if necessary
5404 if test -n \"\$relink_command\"; then
5405 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5407 $echo \"\$relink_command_output\" >&2
5408 $rm \"\$progdir/\$file\"
5413 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5414 { $rm \"\$progdir/\$program\";
5415 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5416 $rm \"\$progdir/\$file\"
5420 program='$outputname'
5421 progdir=\"\$thisdir/$objdir\"
5427 if test -f \"\$progdir/\$program\"; then"
5429 # Export our shlibpath_var if we have one.
5430 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5432 # Add our own library path to $shlibpath_var
5433 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5435 # Some systems cannot cope with colon-terminated $shlibpath_var
5436 # The second colon is a workaround for a bug in BeOS R4 sed
5437 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5439 export $shlibpath_var
5443 # fixup the dll searchpath if we need to.
5444 if test -n "$dllsearchpath"; then
5446 # Add the dll search path components to the executable PATH
5447 PATH=$dllsearchpath:\$PATH
5452 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5453 # Run the actual program with our arguments.
5455 # Make sure env LD_LIBRARY_PATH does not mess us up
5456 if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5457 export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5461 # Backslashes separate directories on plain windows
5462 *-*-mingw | *-*-os2*)
5464 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5470 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5475 \$echo \"\$0: cannot exec \$program \$*\"
5479 # The program doesn't exist.
5480 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5481 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5482 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5493 # See if we need to build an old-fashioned archive.
5494 for oldlib in $oldlibs; do
5496 if test "$build_libtool_libs" = convenience; then
5497 oldobjs="$libobjs_save"
5498 addlibs="$convenience"
5499 build_libtool_libs=no
5501 if test "$build_libtool_libs" = module; then
5502 oldobjs="$libobjs_save"
5503 build_libtool_libs=no
5505 oldobjs="$old_deplibs $non_pic_objects"
5507 addlibs="$old_convenience"
5510 if test -n "$addlibs"; then
5511 gentop="$output_objdir/${outputname}x"
5512 generated="$generated $gentop"
5514 func_extract_archives $gentop $addlibs
5515 oldobjs="$oldobjs $func_extract_archives_result"
5518 # Do each command in the archive commands.
5519 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5520 cmds=$old_archive_from_new_cmds
5522 # POSIX demands no paths to be encoded in archives. We have
5523 # to avoid creating archives with duplicate basenames if we
5524 # might have to extract them afterwards, e.g., when creating a
5525 # static archive out of a convenience library, or when linking
5526 # the entirety of a libtool archive into another (currently
5527 # not supported by libtool).
5528 if (for obj in $oldobjs
5530 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5531 done | sort | sort -uc >/dev/null 2>&1); then
5534 $echo "copying selected object files to avoid basename conflicts..."
5536 if test -z "$gentop"; then
5537 gentop="$output_objdir/${outputname}x"
5538 generated="$generated $gentop"
5540 $show "${rm}r $gentop"
5541 $run ${rm}r "$gentop"
5542 $show "$mkdir $gentop"
5543 $run $mkdir "$gentop"
5545 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5550 save_oldobjs=$oldobjs
5553 for obj in $save_oldobjs
5555 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5556 case " $oldobjs " in
5557 " ") oldobjs=$obj ;;
5560 # Make sure we don't pick an alternate name that also
5562 newobj=lt$counter-$objbase
5563 counter=`expr $counter + 1`
5564 case " $oldobjs " in
5565 *[\ /]"$newobj "*) ;;
5566 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5569 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5570 $run ln "$obj" "$gentop/$newobj" ||
5571 $run cp "$obj" "$gentop/$newobj"
5572 oldobjs="$oldobjs $gentop/$newobj"
5574 *) oldobjs="$oldobjs $obj" ;;
5579 eval cmds=\"$old_archive_cmds\"
5581 if len=`expr "X$cmds" : ".*"` &&
5582 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5583 cmds=$old_archive_cmds
5585 # the command line is too long to link in one step, link in parts
5586 $echo "using piecewise archive linking..."
5591 save_oldobjs=$oldobjs
5593 # Is there a better way of finding the last object in the list?
5594 for obj in $save_oldobjs
5598 for obj in $save_oldobjs
5600 oldobjs="$objlist $obj"
5601 objlist="$objlist $obj"
5602 eval test_cmds=\"$old_archive_cmds\"
5603 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5604 test "$len" -le "$max_cmd_len"; then
5607 # the above command should be used before it gets too long
5609 if test "$obj" = "$last_oldobj" ; then
5612 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5613 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5619 if test "X$oldobjs" = "X" ; then
5620 eval cmds=\"\$concat_cmds\"
5622 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5626 save_ifs="$IFS"; IFS='~'
5627 for cmd in $cmds; do
5631 $run eval "$cmd" || exit $?
5636 if test -n "$generated"; then
5637 $show "${rm}r$generated"
5638 $run ${rm}r$generated
5641 # Now create the libtool archive.
5645 test "$build_old_libs" = yes && old_library="$libname.$libext"
5646 $show "creating $output"
5648 # Preserve any variables that may affect compiler behavior
5649 for var in $variables_saved_for_relink; do
5650 if eval test -z \"\${$var+set}\"; then
5651 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5652 elif eval var_value=\$$var; test -z "$var_value"; then
5653 relink_command="$var=; export $var; $relink_command"
5655 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5656 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5659 # Quote the link command for shipping.
5660 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5661 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5662 if test "$hardcode_automatic" = yes ; then
5667 # Only create the output if not a dry run.
5668 if test -z "$run"; then
5669 for installed in no yes; do
5670 if test "$installed" = yes; then
5671 if test -z "$install_libdir"; then
5674 output="$output_objdir/$outputname"i
5675 # Replace all uninstalled libtool libraries with the installed ones
5677 for deplib in $dependency_libs; do
5680 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5681 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5682 if test -z "$libdir"; then
5683 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5686 if test "X$EGREP" = X ; then
5689 # We do not want portage's install root ($D) present. Check only for
5690 # this if the .la is being installed.
5691 if test "$installed" = yes && test "$D"; then
5692 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5694 mynewdependency_lib="$libdir/$name"
5696 # Do not add duplicates
5697 if test "$mynewdependency_lib"; then
5698 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5699 if test -z "$my_little_ninja_foo_1"; then
5700 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5705 if test "$installed" = yes; then
5706 # Rather use S=WORKDIR if our version of portage supports it.
5707 # This is because some ebuild (gcc) do not use $S as buildroot.
5708 if test "$PWORKDIR"; then
5711 # We do not want portage's build root ($S) present.
5712 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5713 # We do not want portage's install root ($D) present.
5714 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5715 if test -n "$my_little_ninja_foo_2" && test "$S"; then
5716 mynewdependency_lib=""
5717 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5718 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5720 mynewdependency_lib="$deplib"
5723 mynewdependency_lib="$deplib"
5725 # Do not add duplicates
5726 if test "$mynewdependency_lib"; then
5727 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5728 if test -z "$my_little_ninja_foo_4"; then
5729 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5735 dependency_libs="$newdependency_libs"
5737 for lib in $dlfiles; do
5738 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5739 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5740 if test -z "$libdir"; then
5741 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5744 newdlfiles="$newdlfiles $libdir/$name"
5746 dlfiles="$newdlfiles"
5748 for lib in $dlprefiles; do
5749 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5750 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5751 if test -z "$libdir"; then
5752 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5755 newdlprefiles="$newdlprefiles $libdir/$name"
5757 dlprefiles="$newdlprefiles"
5760 for lib in $dlfiles; do
5762 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5763 *) abs=`pwd`"/$lib" ;;
5765 newdlfiles="$newdlfiles $abs"
5767 dlfiles="$newdlfiles"
5769 for lib in $dlprefiles; do
5771 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5772 *) abs=`pwd`"/$lib" ;;
5774 newdlprefiles="$newdlprefiles $abs"
5776 dlprefiles="$newdlprefiles"
5779 # place dlname in correct position for cygwin
5781 case $host,$output,$installed,$module,$dlname in
5782 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5784 # Do not add duplicates
5785 if test "$installed" = yes && test "$D"; then
5786 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5789 # $outputname - a libtool library file
5790 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5792 # Please DO NOT delete this file!
5793 # It is necessary for linking the library.
5795 # The name that we can dlopen(3).
5798 # Names of this library.
5799 library_names='$library_names'
5801 # The name of the static archive.
5802 old_library='$old_library'
5804 # Libraries that this one depends upon.
5805 dependency_libs='$dependency_libs'
5807 # Version information for $libname.
5812 # Is this an already installed library?
5813 installed=$installed
5815 # Should we warn about portability when linking against -modules?
5816 shouldnotlink=$module
5818 # Files to dlopen/dlpreopen
5820 dlpreopen='$dlprefiles'
5822 # Directory that this library needs to be installed in:
5823 libdir='$install_libdir'"
5824 if test "$installed" = no && test "$need_relink" = yes; then
5826 relink_command=\"$relink_command\""
5831 # Do a symbolic link so that the libtool archive can be found in
5832 # LD_LIBRARY_PATH before the program is installed.
5833 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5834 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5840 # libtool install mode
5842 modename="$modename: install"
5844 # There may be an optional sh(1) argument at the beginning of
5845 # install_prog (especially on Windows NT).
5846 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5847 # Allow the use of GNU shtool's install command.
5848 $echo "X$nonopt" | grep shtool > /dev/null; then
5849 # Aesthetically quote it.
5850 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5852 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5856 install_prog="$arg "
5864 # The real first argument should be the name of the installation program.
5865 # Aesthetically quote it.
5866 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5868 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5872 install_prog="$install_prog$arg"
5874 # We need to accept at least all the BSD install flags.
5884 if test -n "$dest"; then
5885 files="$files $dest"
5893 case " $install_prog " in
5898 -g | -m | -o) prev=$arg ;;
5906 # If the previous option needed an argument, then skip it.
5907 if test -n "$prev"; then
5916 # Aesthetically quote the argument.
5917 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5919 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5923 install_prog="$install_prog $arg"
5926 if test -z "$install_prog"; then
5927 $echo "$modename: you must specify an install program" 1>&2
5932 if test -n "$prev"; then
5933 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5938 if test -z "$files"; then
5939 if test -z "$dest"; then
5940 $echo "$modename: no file or destination specified" 1>&2
5942 $echo "$modename: you must specify a destination" 1>&2
5948 # Strip any trailing slash from the destination.
5949 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5951 # Check to see that the destination is a directory.
5952 test -d "$dest" && isdir=yes
5953 if test "$isdir" = yes; then
5957 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5958 test "X$destdir" = "X$dest" && destdir=.
5959 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5961 # Not a directory, so check to see that there is only one file specified.
5963 if test "$#" -gt 2; then
5964 $echo "$modename: \`$dest' is not a directory" 1>&2
5970 [\\/]* | [A-Za-z]:[\\/]*) ;;
5972 for file in $files; do
5976 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5985 # This variable tells wrapper scripts just to set variables rather
5986 # than running their programs.
5987 libtool_install_magic="$magic"
5992 for file in $files; do
5994 # Do each installation.
5997 # Do the static libraries later.
5998 staticlibs="$staticlibs $file"
6002 # Check to see that this really is a libtool archive.
6003 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6005 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6013 # If there is no directory component, then add one.
6015 */* | *\\*) . $file ;;
6019 # Add the libdir to current_libdirs if it is the destination.
6020 if test "X$destdir" = "X$libdir"; then
6021 case "$current_libdirs " in
6023 *) current_libdirs="$current_libdirs $libdir" ;;
6026 # Note the libdir as a future libdir.
6027 case "$future_libdirs " in
6029 *) future_libdirs="$future_libdirs $libdir" ;;
6033 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6034 test "X$dir" = "X$file/" && dir=
6037 if test -n "$relink_command"; then
6038 # Determine the prefix the user has applied to our future dir.
6039 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6041 # Don't allow the user to place us outside of our expected
6042 # location b/c this prevents finding dependent libraries that
6043 # are installed to the same prefix.
6044 # At present, this check doesn't affect windows .dll's that
6045 # are installed into $libdir/../bin (currently, that works fine)
6046 # but it's something to keep an eye on.
6047 if test "$inst_prefix_dir" = "$destdir"; then
6048 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6052 if test -n "$inst_prefix_dir"; then
6053 # Stick the inst_prefix_dir data into the link command.
6054 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6056 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6059 $echo "$modename: warning: relinking \`$file'" 1>&2
6060 $show "$relink_command"
6061 if $run eval "$relink_command"; then :
6063 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6068 # See the names of the shared library.
6069 set dummy $library_names
6070 if test -n "$2"; then
6076 test -n "$relink_command" && srcname="$realname"T
6078 # Install the shared library and build the symlinks.
6079 $show "$install_prog $dir/$srcname $destdir/$realname"
6080 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6081 if test -n "$stripme" && test -n "$striplib"; then
6082 $show "$striplib $destdir/$realname"
6083 $run eval "$striplib $destdir/$realname" || exit $?
6086 if test "$#" -gt 0; then
6087 # Delete the old symlinks, and create new ones.
6088 # Try `ln -sf' first, because the `ln' binary might depend on
6089 # the symlink we replace! Solaris /bin/ln does not understand -f,
6090 # so we also need to try rm && ln -s.
6093 if test "$linkname" != "$realname"; then
6094 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6095 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6100 # Do each command in the postinstall commands.
6101 lib="$destdir/$realname"
6102 cmds=$postinstall_cmds
6103 save_ifs="$IFS"; IFS='~'
6104 for cmd in $cmds; do
6108 $run eval "$cmd" || {
6111 # Restore the uninstalled library and exit
6112 if test "$mode" = relink; then
6113 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6122 # Install the pseudo-library for information purposes.
6123 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6124 instname="$dir/$name"i
6125 $show "$install_prog $instname $destdir/$name"
6126 $run eval "$install_prog $instname $destdir/$name" || exit $?
6128 # Maybe install the static library, too.
6129 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6133 # Install (i.e. copy) a libtool object.
6135 # Figure out destination file name, if it wasn't already specified.
6136 if test -n "$destname"; then
6137 destfile="$destdir/$destname"
6139 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6140 destfile="$destdir/$destfile"
6143 # Deduce the name of the destination old-style object file.
6146 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6149 staticdest="$destfile"
6153 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6159 # Install the libtool object if requested.
6160 if test -n "$destfile"; then
6161 $show "$install_prog $file $destfile"
6162 $run eval "$install_prog $file $destfile" || exit $?
6165 # Install the old object if enabled.
6166 if test "$build_old_libs" = yes; then
6167 # Deduce the name of the old-style object file.
6168 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6170 $show "$install_prog $staticobj $staticdest"
6171 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6177 # Figure out destination file name, if it wasn't already specified.
6178 if test -n "$destname"; then
6179 destfile="$destdir/$destname"
6181 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6182 destfile="$destdir/$destfile"
6185 # If the file is missing, and there is a .exe on the end, strip it
6186 # because it is most likely a libtool script we actually want to
6191 if test ! -f "$file"; then
6192 file=`$echo $file|${SED} 's,.exe$,,'`
6198 # Do a test to see if this is really a libtool program.
6201 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6207 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6211 # Note that it is not necessary on cygwin/mingw to append a dot to
6212 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6213 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6214 # `FILE.' does not work on cygwin managed mounts.
6216 # If there is no directory component, then add one.
6218 */* | *\\*) . ${wrapper} ;;
6219 *) . ./${wrapper} ;;
6222 # Check the variables that should have been set.
6223 if test -z "$notinst_deplibs"; then
6224 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6229 for lib in $notinst_deplibs; do
6230 # Check to see that each library is installed.
6232 if test -f "$lib"; then
6233 # If there is no directory component, then add one.
6235 */* | *\\*) . $lib ;;
6239 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6240 if test -n "$libdir" && test ! -f "$libfile"; then
6241 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6247 # Note that it is not necessary on cygwin/mingw to append a dot to
6248 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6249 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6250 # `FILE.' does not work on cygwin managed mounts.
6252 # If there is no directory component, then add one.
6254 */* | *\\*) . ${wrapper} ;;
6255 *) . ./${wrapper} ;;
6259 if test "$fast_install" = no && test -n "$relink_command"; then
6260 if test "$finalize" = yes && test -z "$run"; then
6261 tmpdir=`func_mktempdir`
6262 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6263 outputname="$tmpdir/$file"
6264 # Replace the output file specification.
6265 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6267 $show "$relink_command"
6268 if $run eval "$relink_command"; then :
6270 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6276 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6279 # Install the binary that we compiled earlier.
6280 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6284 # remove .exe since cygwin /usr/bin/install will append another
6286 case $install_prog,$host in
6287 */usr/bin/install*,*cygwin*)
6288 case $file:$destfile in
6293 destfile=$destfile.exe
6296 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6301 $show "$install_prog$stripme $file $destfile"
6302 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6303 test -n "$outputname" && ${rm}r "$tmpdir"
6308 for file in $staticlibs; do
6309 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6311 # Set up the ranlib parameters.
6312 oldlib="$destdir/$name"
6314 $show "$install_prog $file $oldlib"
6315 $run eval "$install_prog \$file \$oldlib" || exit $?
6317 if test -n "$stripme" && test -n "$old_striplib"; then
6318 $show "$old_striplib $oldlib"
6319 $run eval "$old_striplib $oldlib" || exit $?
6322 # Do each command in the postinstall commands.
6323 cmds=$old_postinstall_cmds
6324 save_ifs="$IFS"; IFS='~'
6325 for cmd in $cmds; do
6329 $run eval "$cmd" || exit $?
6334 if test -n "$future_libdirs"; then
6335 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6338 if test -n "$current_libdirs"; then
6339 # Maybe just do a dry run.
6340 test -n "$run" && current_libdirs=" -n$current_libdirs"
6341 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6347 # libtool finish mode
6349 modename="$modename: finish"
6353 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6356 libdirs="$libdirs $dir"
6359 for libdir in $libdirs; do
6360 if test -n "$finish_cmds"; then
6361 # Do each command in the finish commands.
6363 save_ifs="$IFS"; IFS='~'
6364 for cmd in $cmds; do
6368 $run eval "$cmd" || admincmds="$admincmds
6373 if test -n "$finish_eval"; then
6374 # Do the single finish_eval.
6375 eval cmds=\"$finish_eval\"
6376 $run eval "$cmds" || admincmds="$admincmds
6382 # Exit here if they wanted silent mode.
6383 test "$show" = : && exit $EXIT_SUCCESS
6385 $echo "X----------------------------------------------------------------------" | $Xsed
6386 $echo "Libraries have been installed in:"
6387 for libdir in $libdirs; do
6391 $echo "If you ever happen to want to link against installed libraries"
6392 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6393 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6394 $echo "flag during linking and do at least one of the following:"
6395 if test -n "$shlibpath_var"; then
6396 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6397 $echo " during execution"
6399 if test -n "$runpath_var"; then
6400 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6401 $echo " during linking"
6403 if test -n "$hardcode_libdir_flag_spec"; then
6405 eval flag=\"$hardcode_libdir_flag_spec\"
6407 $echo " - use the \`$flag' linker flag"
6409 if test -n "$admincmds"; then
6410 $echo " - have your system administrator run these commands:$admincmds"
6412 if test -f /etc/ld.so.conf; then
6413 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6416 $echo "See any operating system documentation about shared libraries for"
6417 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6418 $echo "X----------------------------------------------------------------------" | $Xsed
6422 # libtool execute mode
6424 modename="$modename: execute"
6426 # The first argument is the command name.
6428 if test -z "$cmd"; then
6429 $echo "$modename: you must specify a COMMAND" 1>&2
6434 # Handle -dlopen flags immediately.
6435 for file in $execute_dlfiles; do
6436 if test ! -f "$file"; then
6437 $echo "$modename: \`$file' is not a file" 1>&2
6445 # Check to see that this really is a libtool archive.
6446 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6448 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6453 # Read the libtool library.
6457 # If there is no directory component, then add one.
6459 */* | *\\*) . $file ;;
6463 # Skip this library if it cannot be dlopened.
6464 if test -z "$dlname"; then
6465 # Warn if it was a shared library.
6466 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6470 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6471 test "X$dir" = "X$file" && dir=.
6473 if test -f "$dir/$objdir/$dlname"; then
6476 if test ! -f "$dir/$dlname"; then
6477 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6484 # Just add the directory containing the .lo file.
6485 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6486 test "X$dir" = "X$file" && dir=.
6490 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6495 # Get the absolute pathname.
6496 absdir=`cd "$dir" && pwd`
6497 test -n "$absdir" && dir="$absdir"
6499 # Now add the directory to shlibpath_var.
6500 if eval "test -z \"\$$shlibpath_var\""; then
6501 eval "$shlibpath_var=\"\$dir\""
6503 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6507 # This variable tells wrapper scripts just to set shlibpath_var
6508 # rather than running their programs.
6509 libtool_execute_magic="$magic"
6511 # Check if any of the arguments is a wrapper script.
6518 # Do a test to see if this is really a libtool program.
6519 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6520 # If there is no directory component, then add one.
6522 */* | *\\*) . $file ;;
6526 # Transform arg to wrapped name.
6527 file="$progdir/$program"
6531 # Quote arguments (to preserve shell metacharacters).
6532 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6533 args="$args \"$file\""
6536 if test -z "$run"; then
6537 if test -n "$shlibpath_var"; then
6538 # Export the shlibpath_var.
6539 eval "export $shlibpath_var"
6542 # Restore saved environment variables
6543 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6545 eval "if test \"\${save_$lt_var+set}\" = set; then
6546 $lt_var=\$save_$lt_var; export $lt_var
6552 # Now prepare to actually exec the command.
6553 exec_cmd="\$cmd$args"
6555 # Display what would be done.
6556 if test -n "$shlibpath_var"; then
6557 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6558 $echo "export $shlibpath_var"
6565 # libtool clean and uninstall mode
6567 modename="$modename: $mode"
6573 # This variable tells wrapper scripts just to set variables rather
6574 # than running their programs.
6575 libtool_install_magic="$magic"
6580 -f) rm="$rm $arg"; rmforce=yes ;;
6581 -*) rm="$rm $arg" ;;
6582 *) files="$files $arg" ;;
6586 if test -z "$rm"; then
6587 $echo "$modename: you must specify an RM program" 1>&2
6594 origobjdir="$objdir"
6595 for file in $files; do
6596 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6597 if test "X$dir" = "X$file"; then
6599 objdir="$origobjdir"
6601 objdir="$dir/$origobjdir"
6603 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6604 test "$mode" = uninstall && objdir="$dir"
6606 # Remember objdir for removal later, being careful to avoid duplicates
6607 if test "$mode" = clean; then
6610 *) rmdirs="$rmdirs $objdir" ;;
6614 # Don't error if the file doesn't exist and rm -f was used.
6615 if (test -L "$file") >/dev/null 2>&1 \
6616 || (test -h "$file") >/dev/null 2>&1 \
6617 || test -f "$file"; then
6619 elif test -d "$file"; then
6622 elif test "$rmforce" = yes; then
6630 # Possibly a libtool archive, so verify it.
6631 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6634 # Delete the libtool libraries and symlinks.
6635 for n in $library_names; do
6636 rmfiles="$rmfiles $objdir/$n"
6638 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6642 case " $library_names " in
6643 # " " in the beginning catches empty $dlname
6645 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6647 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6650 if test -n "$library_names"; then
6651 # Do each command in the postuninstall commands.
6652 cmds=$postuninstall_cmds
6653 save_ifs="$IFS"; IFS='~'
6654 for cmd in $cmds; do
6659 if test "$?" -ne 0 && test "$rmforce" != yes; then
6666 if test -n "$old_library"; then
6667 # Do each command in the old_postuninstall commands.
6668 cmds=$old_postuninstall_cmds
6669 save_ifs="$IFS"; IFS='~'
6670 for cmd in $cmds; do
6675 if test "$?" -ne 0 && test "$rmforce" != yes; then
6681 # FIXME: should reinstall the best remaining shared library.
6688 # Possibly a libtool object, so verify it.
6689 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6694 # Add PIC object to the list of files to remove.
6695 if test -n "$pic_object" \
6696 && test "$pic_object" != none; then
6697 rmfiles="$rmfiles $dir/$pic_object"
6700 # Add non-PIC object to the list of files to remove.
6701 if test -n "$non_pic_object" \
6702 && test "$non_pic_object" != none; then
6703 rmfiles="$rmfiles $dir/$non_pic_object"
6709 if test "$mode" = clean ; then
6713 file=`$echo $file|${SED} 's,.exe$,,'`
6714 noexename=`$echo $name|${SED} 's,.exe$,,'`
6715 # $file with .exe has already been added to rmfiles,
6716 # add $file without .exe
6717 rmfiles="$rmfiles $file"
6720 # Do a test to see if this is a libtool program.
6721 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6725 # note $name still contains .exe if it was in $file originally
6726 # as does the version of $file that was added into $rmfiles
6727 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6728 if test "$fast_install" = yes && test -n "$relink_command"; then
6729 rmfiles="$rmfiles $objdir/lt-$name"
6731 if test "X$noexename" != "X$name" ; then
6732 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6738 $show "$rm $rmfiles"
6739 $run $rm $rmfiles || exit_status=1
6741 objdir="$origobjdir"
6743 # Try to remove the ${objdir}s in the directories where we deleted files
6744 for dir in $rmdirs; do
6745 if test -d "$dir"; then
6747 $run rmdir $dir >/dev/null 2>&1
6755 $echo "$modename: you must specify a MODE" 1>&2
6756 $echo "$generic_help" 1>&2
6761 if test -z "$exec_cmd"; then
6762 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6763 $echo "$generic_help" 1>&2
6766 fi # test -z "$show_help"
6768 if test -n "$exec_cmd"; then
6773 # We need to display help for each of the modes.
6776 "Usage: $modename [OPTION]... [MODE-ARG]...
6778 Provide generalized library-building support services.
6780 --config show all configuration variables
6781 --debug enable verbose shell tracing
6782 -n, --dry-run display commands without modifying any files
6783 --features display basic configuration information and exit
6784 --finish same as \`--mode=finish'
6785 --help display this help message and exit
6786 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6787 --quiet same as \`--silent'
6788 --silent don't print informational messages
6789 --tag=TAG use configuration variables from tag TAG
6790 --version print version information
6792 MODE must be one of the following:
6794 clean remove files from the build directory
6795 compile compile a source file into a libtool object
6796 execute automatically set library path, then run a program
6797 finish complete the installation of libtool libraries
6798 install install libraries or executables
6799 link create a library or an executable
6800 uninstall remove libraries from an installed directory
6802 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6803 a more detailed description of MODE.
6805 Report bugs to <bug-libtool@gnu.org>."
6811 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6813 Remove files from the build directory.
6815 RM is the name of the program to use to delete files associated with each FILE
6816 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6819 If FILE is a libtool library, object or program, all the files associated
6820 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6825 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6827 Compile a source file into a libtool library object.
6829 This mode accepts the following additional options:
6831 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6832 -prefer-pic try to building PIC objects only
6833 -prefer-non-pic try to building non-PIC objects only
6834 -static always build a \`.o' file suitable for static linking
6836 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6837 from the given SOURCEFILE.
6839 The output file name is determined by removing the directory component from
6840 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6841 library object suffix, \`.lo'."
6846 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6848 Automatically set library path, then run a program.
6850 This mode accepts the following additional options:
6852 -dlopen FILE add the directory containing FILE to the library path
6854 This mode sets the library path environment variable according to \`-dlopen'
6857 If any of the ARGS are libtool executable wrappers, then they are translated
6858 into their corresponding uninstalled binary, and any of their required library
6859 directories are added to the library path.
6861 Then, COMMAND is executed, with ARGS as arguments."
6866 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6868 Complete the installation of libtool libraries.
6870 Each LIBDIR is a directory that contains libtool libraries.
6872 The commands that this mode executes may require superuser privileges. Use
6873 the \`--dry-run' option if you just want to see what would be executed."
6878 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6880 Install executables or libraries.
6882 INSTALL-COMMAND is the installation command. The first component should be
6883 either the \`install' or \`cp' program.
6885 The rest of the components are interpreted as arguments to that command (only
6886 BSD-compatible install options are recognized)."
6891 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6893 Link object files or libraries together to form another library, or to
6894 create an executable program.
6896 LINK-COMMAND is a command using the C compiler that you would use to create
6897 a program from several object files.
6899 The following components of LINK-COMMAND are treated specially:
6901 -all-static do not do any dynamic linking at all
6902 -avoid-version do not add a version suffix if possible
6903 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6904 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6905 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6906 -export-symbols SYMFILE
6907 try to export only the symbols listed in SYMFILE
6908 -export-symbols-regex REGEX
6909 try to export only the symbols matching REGEX
6910 -LLIBDIR search LIBDIR for required installed libraries
6911 -lNAME OUTPUT-FILE requires the installed library libNAME
6912 -module build a library that can dlopened
6913 -no-fast-install disable the fast-install mode
6914 -no-install link a not-installable executable
6915 -no-undefined declare that a library does not refer to external symbols
6916 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6917 -objectlist FILE Use a list of object files found in FILE to specify objects
6918 -precious-files-regex REGEX
6919 don't remove output files matching REGEX
6920 -release RELEASE specify package release information
6921 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6922 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6923 -static do not do any dynamic linking of uninstalled libtool libraries
6924 -static-libtool-libs
6925 do not do any dynamic linking of libtool libraries
6926 -version-info CURRENT[:REVISION[:AGE]]
6927 specify library version info [each variable defaults to 0]
6929 All other options (arguments beginning with \`-') are ignored.
6931 Every other argument is treated as a filename. Files ending in \`.la' are
6932 treated as uninstalled libtool libraries, other files are standard or library
6935 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6936 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6937 required, except when creating a convenience library.
6939 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6940 using \`ar' and \`ranlib', or on Windows using \`lib'.
6942 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6943 is created, otherwise an executable program is created."
6948 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6950 Remove libraries from an installation directory.
6952 RM is the name of the program to use to delete files associated with each FILE
6953 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6956 If FILE is a libtool library, all the files associated with it are deleted.
6957 Otherwise, only FILE itself is deleted using RM."
6961 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6968 $echo "Try \`$modename --help' for more information about other modes."
6972 # The TAGs below are defined such that we never get into a situation
6973 # in which we disable both kinds of libraries. Given conflicting
6974 # choices, we go for a static library, that is the most portable,
6975 # since we can't tell whether shared libraries were disabled because
6976 # the user asked for that or because the platform doesn't support
6977 # them. This is particularly important on AIX, because we don't
6978 # support having both static and shared libraries enabled at the same
6979 # time on that platform, so we default to a shared-only configuration.
6980 # If a disable-shared tag is given, we'll fallback to a static-only
6981 # configuration. But we'll never go from static-only to shared-only.
6983 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6985 # ### END LIBTOOL TAG CONFIG: disable-shared
6987 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6989 # ### END LIBTOOL TAG CONFIG: disable-static