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.456 2007/06/24 02:25:32)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60 BIN_SH=xpg4; export BIN_SH # for Tru64
61 DUALCASE=1; export DUALCASE # for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed="${SED}"' -e 1s/^X//'
97 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
116 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
125 # Make sure IFS has a sensible default
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147 lo2o="s/\\.lo\$/.${objext}/"
148 o2lo="s/\\.${objext}\$/.lo/"
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
162 my_template="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir="${my_template}-$$"
169 # If mktemp works, use that first and foremost
170 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask=`umask`
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" || {
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189 $echo "X$my_tmpdir" | $Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
201 win32_libid_type="unknown"
202 win32_fileres=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library*) # definitely import
205 win32_libid_type="x86 archive import"
207 *ar\ archive*) # could be an import, or static
208 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210 win32_nmres=`eval $NM -f posix -A $1 | \
219 import*) win32_libid_type="x86 archive import";;
220 *) win32_libid_type="x86 archive static";;
225 win32_libid_type="x86 DLL"
227 *executable*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel*)
230 win32_libid_type="x86 DLL"
235 $echo $win32_libid_type
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
247 if test -n "$available_tags" && test -z "$tagname"; then
251 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 CC_quoted="$CC_quoted $arg"
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
270 # Double-quote args containing other shell metacharacters.
272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
276 CC_quoted="$CC_quoted $arg"
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* | *-*-darwin*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # and Darwin 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`
3258 revision="$number_minor"
3259 lt_irix_increment=no
3270 # Check that each of the things are valid numbers.
3272 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]) ;;
3274 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3275 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3281 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]) ;;
3283 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3284 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3290 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]) ;;
3292 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3293 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3298 if test "$age" -gt "$current"; then
3299 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3300 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3304 # Calculate the version variables.
3308 case $version_type in
3312 # Like Linux, but with the current version available in
3313 # verstring for coding it into the library header
3314 major=.`expr $current - $age`
3315 versuffix="$major.$age.$revision"
3316 # Darwin ld doesn't like 0 for these options...
3317 minor_current=`expr $current + 1`
3318 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3319 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3324 versuffix=".$current.$revision";
3329 versuffix=".$current";
3333 if test "X$lt_irix_increment" = "Xno"; then
3334 major=`expr $current - $age`
3336 major=`expr $current - $age + 1`
3338 case $version_type in
3339 nonstopux) verstring_prefix=nonstopux ;;
3340 *) verstring_prefix=sgi ;;
3342 verstring="$verstring_prefix$major.$revision"
3344 # Add in all the interfaces that we are compatible with.
3346 while test "$loop" -ne 0; do
3347 iface=`expr $revision - $loop`
3348 loop=`expr $loop - 1`
3349 verstring="$verstring_prefix$major.$iface:$verstring"
3352 # Before this point, $major must not contain `.'.
3354 versuffix="$major.$revision"
3358 major=.`expr $current - $age`
3359 versuffix="$major.$age.$revision"
3363 major=.`expr $current - $age`
3364 versuffix=".$current.$age.$revision"
3365 verstring="$current.$age.$revision"
3367 # Add in all the interfaces that we are compatible with.
3369 while test "$loop" -ne 0; do
3370 iface=`expr $current - $loop`
3371 loop=`expr $loop - 1`
3372 verstring="$verstring:${iface}.0"
3375 # Make executables depend on our current version.
3376 verstring="$verstring:${current}.0"
3381 versuffix=".$current.$revision"
3385 # Use '-' rather than '.', since we only want one
3386 # extension on DOS 8.3 filesystems.
3387 major=`expr $current - $age`
3392 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3393 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3398 # Clear the version info if we defaulted, and they specified a release.
3399 if test -z "$vinfo" && test -n "$release"; then
3401 case $version_type in
3403 # we can't check for "0.0" in archive_cmds due to quoting
3404 # problems, so we reset it completely
3411 if test "$need_version" = no; then
3418 # Remove version info from name if versioning should be avoided
3419 if test "$avoid_version" = yes && test "$need_version" = no; then
3425 # Check to see if the archive will have undefined symbols.
3426 if test "$allow_undefined" = yes; then
3427 if test "$allow_undefined_flag" = unsupported; then
3428 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3429 build_libtool_libs=no
3433 # Don't allow undefined symbols.
3434 allow_undefined_flag="$no_undefined_flag"
3438 if test "$mode" != relink; then
3439 # Remove our outputs, but don't remove object files since they
3440 # may have been created when compiling PIC objects.
3442 tempremovelist=`$echo "$output_objdir/*"`
3443 for p in $tempremovelist; do
3447 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3448 if test "X$precious_files_regex" != "X"; then
3449 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3454 removelist="$removelist $p"
3459 if test -n "$removelist"; then
3460 $show "${rm}r $removelist"
3461 $run ${rm}r $removelist
3465 # Now set the variables for building old libraries.
3466 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3467 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3469 # Transform .lo files to .o files.
3470 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3473 # Eliminate all temporary directories.
3474 #for path in $notinst_path; do
3475 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3476 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3477 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3480 if test -n "$xrpath"; then
3481 # If the user specified any rpath flags, then add them.
3483 for libdir in $xrpath; do
3484 temp_xrpath="$temp_xrpath -R$libdir"
3485 case "$finalize_rpath " in
3487 *) finalize_rpath="$finalize_rpath $libdir" ;;
3490 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3491 dependency_libs="$temp_xrpath $dependency_libs"
3495 # Make sure dlfiles contains only unique files that won't be dlpreopened
3496 old_dlfiles="$dlfiles"
3498 for lib in $old_dlfiles; do
3499 case " $dlprefiles $dlfiles " in
3501 *) dlfiles="$dlfiles $lib" ;;
3505 # Make sure dlprefiles contains only unique files
3506 old_dlprefiles="$dlprefiles"
3508 for lib in $old_dlprefiles; do
3509 case "$dlprefiles " in
3511 *) dlprefiles="$dlprefiles $lib" ;;
3515 if test "$build_libtool_libs" = yes; then
3516 if test -n "$rpath"; then
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3519 # these systems don't actually have a c library (as such)!
3521 *-*-rhapsody* | *-*-darwin1.[012])
3522 # Rhapsody C library is in the System framework
3523 deplibs="$deplibs -framework System"
3526 # Don't link with libc until the a.out ld.so is fixed.
3528 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3529 # Do not include libc due to us having libc/libc_r.
3531 *-*-sco3.2v5* | *-*-sco5v6*)
3532 # Causes problems with __ctype
3534 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3535 # Compiler inserts libc in the correct place for threads to work
3538 # Add libc to deplibs on all other systems if necessary.
3539 if test "$build_libtool_need_lc" = "yes"; then
3540 deplibs="$deplibs -lc"
3546 # Transform deplibs into only deplibs that can be linked in shared.
3548 libname_save=$libname
3549 release_save=$release
3550 versuffix_save=$versuffix
3552 # I'm not sure if I'm treating the release correctly. I think
3553 # release should show up in the -l (ie -lgmp5) so we don't want to
3554 # add it in twice. Is that correct?
3560 case $deplibs_check_method in
3562 # Don't check for shared/static. Everything works.
3563 # This might be a little naive. We might want to check
3564 # whether the library exists or not. But this is on
3565 # osf3 & osf4 and I'm not really sure... Just
3566 # implementing what was already the behavior.
3570 # This code stresses the "libraries are programs" paradigm to its
3571 # limits. Maybe even breaks it. We compile a program, linking it
3572 # against the deplibs as a proxy for the library. Then we can check
3573 # whether they linked in statically or dynamically with ldd.
3575 cat > conftest.c <<EOF
3576 int main() { return 0; }
3579 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3580 ldd_output=`ldd conftest`
3581 for i in $deplibs; do
3582 name=`expr $i : '-l\(.*\)'`
3583 # If $name is empty we are operating on a -L argument.
3584 if test "$name" != "" && test "$name" != "0"; then
3585 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3586 case " $predeps $postdeps " in
3588 newdeplibs="$newdeplibs $i"
3593 if test -n "$i" ; then
3594 libname=`eval \\$echo \"$libname_spec\"`
3595 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3596 set dummy $deplib_matches
3598 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3599 newdeplibs="$newdeplibs $i"
3603 $echo "*** Warning: dynamic linker does not accept needed library $i."
3604 $echo "*** I have the capability to make that library automatically link in when"
3605 $echo "*** you link to this library. But I can only do this if you have a"
3606 $echo "*** shared version of the library, which I believe you do not have"
3607 $echo "*** because a test_compile did reveal that the linker did not use it for"
3608 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3612 newdeplibs="$newdeplibs $i"
3616 # Error occurred in the first compile. Let's try to salvage
3617 # the situation: Compile a separate program for each library.
3618 for i in $deplibs; do
3619 name=`expr $i : '-l\(.*\)'`
3620 # If $name is empty we are operating on a -L argument.
3621 if test "$name" != "" && test "$name" != "0"; then
3623 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3624 ldd_output=`ldd conftest`
3625 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3626 case " $predeps $postdeps " in
3628 newdeplibs="$newdeplibs $i"
3633 if test -n "$i" ; then
3634 libname=`eval \\$echo \"$libname_spec\"`
3635 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3636 set dummy $deplib_matches
3638 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3639 newdeplibs="$newdeplibs $i"
3643 $echo "*** Warning: dynamic linker does not accept needed library $i."
3644 $echo "*** I have the capability to make that library automatically link in when"
3645 $echo "*** you link to this library. But I can only do this if you have a"
3646 $echo "*** shared version of the library, which you do not appear to have"
3647 $echo "*** because a test_compile did reveal that the linker did not use this one"
3648 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3654 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3655 $echo "*** make it link in! You will probably need to install it or some"
3656 $echo "*** library that it depends on before this library will be fully"
3657 $echo "*** functional. Installing it before continuing would be even better."
3660 newdeplibs="$newdeplibs $i"
3666 set dummy $deplibs_check_method
3667 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3668 for a_deplib in $deplibs; do
3669 name=`expr $a_deplib : '-l\(.*\)'`
3670 # If $name is empty we are operating on a -L argument.
3671 if test "$name" != "" && test "$name" != "0"; then
3672 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3673 case " $predeps $postdeps " in
3675 newdeplibs="$newdeplibs $a_deplib"
3680 if test -n "$a_deplib" ; then
3681 libname=`eval \\$echo \"$libname_spec\"`
3682 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3683 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3684 for potent_lib in $potential_libs; do
3685 # Follow soft links.
3686 if ls -lLd "$potent_lib" 2>/dev/null \
3687 | grep " -> " >/dev/null; then
3690 # The statement above tries to avoid entering an
3691 # endless loop below, in case of cyclic links.
3692 # We might still enter an endless loop, since a link
3693 # loop can be closed while we follow links,
3695 potlib="$potent_lib"
3696 while test -h "$potlib" 2>/dev/null; do
3697 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3699 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3700 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3703 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3705 | $EGREP "$file_magic_regex" > /dev/null; then
3706 newdeplibs="$newdeplibs $a_deplib"
3713 if test -n "$a_deplib" ; then
3716 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3717 $echo "*** I have the capability to make that library automatically link in when"
3718 $echo "*** you link to this library. But I can only do this if you have a"
3719 $echo "*** shared version of the library, which you do not appear to have"
3720 $echo "*** because I did check the linker path looking for a file starting"
3721 if test -z "$potlib" ; then
3722 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3724 $echo "*** with $libname and none of the candidates passed a file format test"
3725 $echo "*** using a file magic. Last file checked: $potlib"
3729 # Add a -L argument.
3730 newdeplibs="$newdeplibs $a_deplib"
3732 done # Gone through all deplibs.
3735 set dummy $deplibs_check_method
3736 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3737 for a_deplib in $deplibs; do
3738 name=`expr $a_deplib : '-l\(.*\)'`
3739 # If $name is empty we are operating on a -L argument.
3740 if test -n "$name" && test "$name" != "0"; then
3741 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3742 case " $predeps $postdeps " in
3744 newdeplibs="$newdeplibs $a_deplib"
3749 if test -n "$a_deplib" ; then
3750 libname=`eval \\$echo \"$libname_spec\"`
3751 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3752 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3753 for potent_lib in $potential_libs; do
3754 potlib="$potent_lib" # see symlink-check above in file_magic test
3755 if eval $echo \"$potent_lib\" 2>/dev/null \
3757 | $EGREP "$match_pattern_regex" > /dev/null; then
3758 newdeplibs="$newdeplibs $a_deplib"
3765 if test -n "$a_deplib" ; then
3768 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3769 $echo "*** I have the capability to make that library automatically link in when"
3770 $echo "*** you link to this library. But I can only do this if you have a"
3771 $echo "*** shared version of the library, which you do not appear to have"
3772 $echo "*** because I did check the linker path looking for a file starting"
3773 if test -z "$potlib" ; then
3774 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3776 $echo "*** with $libname and none of the candidates passed a file format test"
3777 $echo "*** using a regex pattern. Last file checked: $potlib"
3781 # Add a -L argument.
3782 newdeplibs="$newdeplibs $a_deplib"
3784 done # Gone through all deplibs.
3788 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3789 -e 's/ -[LR][^ ]*//g'`
3790 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3791 for i in $predeps $postdeps ; do
3792 # can't use Xsed below, because $i might contain '/'
3793 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3796 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3797 | grep . >/dev/null; then
3799 if test "X$deplibs_check_method" = "Xnone"; then
3800 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3802 $echo "*** Warning: inter-library dependencies are not known to be supported."
3804 $echo "*** All declared inter-library dependencies are being dropped."
3809 versuffix=$versuffix_save
3811 release=$release_save
3812 libname=$libname_save
3816 *-*-rhapsody* | *-*-darwin1.[012])
3817 # On Rhapsody replace the C library is the System framework
3818 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3822 if test "$droppeddeps" = yes; then
3823 if test "$module" = yes; then
3825 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3826 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3827 $echo "*** a static module, that should work as long as the dlopening"
3828 $echo "*** application is linked with the -dlopen flag."
3829 if test -z "$global_symbol_pipe"; then
3831 $echo "*** However, this would only work if libtool was able to extract symbol"
3832 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3833 $echo "*** not find such a program. So, this module is probably useless."
3834 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3836 if test "$build_old_libs" = no; then
3837 oldlibs="$output_objdir/$libname.$libext"
3838 build_libtool_libs=module
3841 build_libtool_libs=no
3844 $echo "*** The inter-library dependencies that have been dropped here will be"
3845 $echo "*** automatically added whenever a program is linked with this library"
3846 $echo "*** or is declared to -dlopen it."
3848 if test "$allow_undefined" = no; then
3850 $echo "*** Since this library must not contain undefined symbols,"
3851 $echo "*** because either the platform does not support them or"
3852 $echo "*** it was explicitly requested with -no-undefined,"
3853 $echo "*** libtool will only create a static version of it."
3854 if test "$build_old_libs" = no; then
3855 oldlibs="$output_objdir/$libname.$libext"
3856 build_libtool_libs=module
3859 build_libtool_libs=no
3864 # Done checking deplibs!
3869 # move library search paths that coincide with paths to not yet
3870 # installed libraries to the beginning of the library search list
3872 for path in $notinst_path; do
3873 case " $new_libs " in
3874 *" -L$path/$objdir "*) ;;
3876 case " $deplibs " in
3877 *" -L$path/$objdir "*)
3878 new_libs="$new_libs -L$path/$objdir" ;;
3883 for deplib in $deplibs; do
3886 case " $new_libs " in
3888 *) new_libs="$new_libs $deplib" ;;
3891 *) new_libs="$new_libs $deplib" ;;
3897 # All the library-specific variables (install_libdir is set above).
3902 # Test again, we may have decided not to build it any more
3903 if test "$build_libtool_libs" = yes; then
3904 if test "$hardcode_into_libs" = yes; then
3905 # Hardcode the library paths
3908 rpath="$finalize_rpath"
3909 test "$mode" != relink && rpath="$compile_rpath$rpath"
3910 for libdir in $rpath; do
3911 if test -n "$hardcode_libdir_flag_spec"; then
3912 if test -n "$hardcode_libdir_separator"; then
3913 if test -z "$hardcode_libdirs"; then
3914 hardcode_libdirs="$libdir"
3916 # Just accumulate the unique libdirs.
3917 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3918 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3921 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3926 eval flag=\"$hardcode_libdir_flag_spec\"
3927 dep_rpath="$dep_rpath $flag"
3929 elif test -n "$runpath_var"; then
3930 case "$perm_rpath " in
3932 *) perm_rpath="$perm_rpath $libdir" ;;
3936 # Substitute the hardcoded libdirs into the rpath.
3937 if test -n "$hardcode_libdir_separator" &&
3938 test -n "$hardcode_libdirs"; then
3939 libdir="$hardcode_libdirs"
3940 if test -n "$hardcode_libdir_flag_spec_ld"; then
3941 case $archive_cmds in
3942 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3943 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3946 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3949 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3950 # We should set the runpath_var.
3952 for dir in $perm_rpath; do
3955 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3957 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3960 shlibpath="$finalize_shlibpath"
3961 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3962 if test -n "$shlibpath"; then
3963 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3966 # Get the real and link names of the library.
3967 eval shared_ext=\"$shrext_cmds\"
3968 eval library_names=\"$library_names_spec\"
3969 set dummy $library_names
3973 if test -n "$soname_spec"; then
3974 eval soname=\"$soname_spec\"
3978 if test -z "$dlname"; then
3982 lib="$output_objdir/$realname"
3986 linknames="$linknames $link"
3989 # Use standard objects if they are pic
3990 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3992 # Prepare the list of exported symbols
3993 if test -z "$export_symbols"; then
3994 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3995 $show "generating symbol list for \`$libname.la'"
3996 export_symbols="$output_objdir/$libname.exp"
3997 $run $rm $export_symbols
3998 cmds=$export_symbols_cmds
3999 save_ifs="$IFS"; IFS='~'
4000 for cmd in $cmds; do
4003 if len=`expr "X$cmd" : ".*"` &&
4004 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4006 $run eval "$cmd" || exit $?
4007 skipped_export=false
4009 # The command line is too long to execute in one step.
4010 $show "using reloadable object file for export list..."
4012 # Break out early, otherwise skipped_export may be
4013 # set to false by a later but shorter cmd.
4018 if test -n "$export_symbols_regex"; then
4019 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4020 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4021 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4022 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4027 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4028 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4032 for test_deplib in $deplibs; do
4033 case " $convenience " in
4034 *" $test_deplib "*) ;;
4036 tmp_deplibs="$tmp_deplibs $test_deplib"
4040 deplibs="$tmp_deplibs"
4042 if test -n "$convenience"; then
4043 if test -n "$whole_archive_flag_spec"; then
4044 save_libobjs=$libobjs
4045 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4047 gentop="$output_objdir/${outputname}x"
4048 generated="$generated $gentop"
4050 func_extract_archives $gentop $convenience
4051 libobjs="$libobjs $func_extract_archives_result"
4055 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4056 eval flag=\"$thread_safe_flag_spec\"
4057 linker_flags="$linker_flags $flag"
4060 # Make a backup of the uninstalled library when relinking
4061 if test "$mode" = relink; then
4062 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4065 # Do each of the archive commands.
4066 if test "$module" = yes && test -n "$module_cmds" ; then
4067 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4068 eval test_cmds=\"$module_expsym_cmds\"
4069 cmds=$module_expsym_cmds
4071 eval test_cmds=\"$module_cmds\"
4075 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4076 eval test_cmds=\"$archive_expsym_cmds\"
4077 cmds=$archive_expsym_cmds
4079 eval test_cmds=\"$archive_cmds\"
4084 if test "X$skipped_export" != "X:" &&
4085 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4086 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4089 # The command line is too long to link in one step, link piecewise.
4090 $echo "creating reloadable object files..."
4092 # Save the value of $output and $libobjs because we want to
4093 # use them later. If we have whole_archive_flag_spec, we
4094 # want to use save_libobjs as it was before
4095 # whole_archive_flag_spec was expanded, because we can't
4096 # assume the linker understands whole_archive_flag_spec.
4097 # This may have to be revisited, in case too many
4098 # convenience libraries get linked in and end up exceeding
4100 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4101 save_libobjs=$libobjs
4104 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4106 # Clear the reloadable object creation command queue and
4107 # initialize k to one.
4114 output=$output_objdir/$output_la-${k}.$objext
4115 # Loop over the list of objects to be linked.
4116 for obj in $save_libobjs
4118 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4119 if test "X$objlist" = X ||
4120 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4121 test "$len" -le "$max_cmd_len"; }; then
4122 objlist="$objlist $obj"
4124 # The command $test_cmds is almost too long, add a
4125 # command to the queue.
4126 if test "$k" -eq 1 ; then
4127 # The first file doesn't have a previous command to add.
4128 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4130 # All subsequent reloadable object files will link in
4131 # the last one created.
4132 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4134 last_robj=$output_objdir/$output_la-${k}.$objext
4136 output=$output_objdir/$output_la-${k}.$objext
4141 # Handle the remaining objects by creating one last
4142 # reloadable object file. All subsequent reloadable object
4143 # files will link in the last one created.
4144 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4145 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4147 if ${skipped_export-false}; then
4148 $show "generating symbol list for \`$libname.la'"
4149 export_symbols="$output_objdir/$libname.exp"
4150 $run $rm $export_symbols
4152 # Append the command to create the export file.
4153 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4156 # Set up a command to remove the reloadable object files
4157 # after they are used.
4159 while test "$i" -lt "$k"
4162 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4165 $echo "creating a temporary reloadable object file: $output"
4167 # Loop through the commands generated above and execute them.
4168 save_ifs="$IFS"; IFS='~'
4169 for cmd in $concat_cmds; do
4172 $run eval "$cmd" || exit $?
4177 # Restore the value of output.
4180 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4181 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4183 # Expand the library linking commands again to reset the
4184 # value of $libobjs for piecewise linking.
4186 # Do each of the archive commands.
4187 if test "$module" = yes && test -n "$module_cmds" ; then
4188 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4189 cmds=$module_expsym_cmds
4194 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4195 cmds=$archive_expsym_cmds
4201 # Append the command to remove the reloadable object files
4202 # to the just-reset $cmds.
4203 eval cmds=\"\$cmds~\$rm $delfiles\"
4205 save_ifs="$IFS"; IFS='~'
4206 for cmd in $cmds; do
4210 $run eval "$cmd" || {
4213 # Restore the uninstalled library and exit
4214 if test "$mode" = relink; then
4215 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4223 # Restore the uninstalled library and exit
4224 if test "$mode" = relink; then
4225 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4227 if test -n "$convenience"; then
4228 if test -z "$whole_archive_flag_spec"; then
4229 $show "${rm}r $gentop"
4230 $run ${rm}r "$gentop"
4237 # Create links to the real library.
4238 for linkname in $linknames; do
4239 if test "$realname" != "$linkname"; then
4240 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4241 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4245 # If -module or -export-dynamic was specified, set the dlname.
4246 if test "$module" = yes || test "$export_dynamic" = yes; then
4247 # On all known operating systems, these are identical.
4254 if test -n "$deplibs"; then
4255 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4258 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4259 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4262 if test -n "$rpath"; then
4263 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4266 if test -n "$xrpath"; then
4267 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4270 if test -n "$vinfo"; then
4271 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4274 if test -n "$release"; then
4275 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4280 if test -n "$objs$old_deplibs"; then
4281 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4285 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4293 # Delete the old objects.
4294 $run $rm $obj $libobj
4296 # Objects from convenience libraries. This assumes
4297 # single-version convenience libraries. Whenever we create
4298 # different ones for PIC/non-PIC, this we'll have to duplicate
4302 # reload_cmds runs $LD directly, so let us get rid of
4303 # -Wl from whole_archive_flag_spec and hope we can get by with
4304 # turning comma into space..
4307 if test -n "$convenience"; then
4308 if test -n "$whole_archive_flag_spec"; then
4309 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4310 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4312 gentop="$output_objdir/${obj}x"
4313 generated="$generated $gentop"
4315 func_extract_archives $gentop $convenience
4316 reload_conv_objs="$reload_objs $func_extract_archives_result"
4320 # Create the old-style object.
4321 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
4325 save_ifs="$IFS"; IFS='~'
4326 for cmd in $cmds; do
4330 $run eval "$cmd" || exit $?
4334 # Exit if we aren't doing a library object file.
4335 if test -z "$libobj"; then
4336 if test -n "$gentop"; then
4337 $show "${rm}r $gentop"
4344 if test "$build_libtool_libs" != yes; then
4345 if test -n "$gentop"; then
4346 $show "${rm}r $gentop"
4350 # Create an invalid libtool object if no PIC, so that we don't
4351 # accidentally link it into a program.
4352 # $show "echo timestamp > $libobj"
4353 # $run eval "echo timestamp > $libobj" || exit $?
4357 if test -n "$pic_flag" || test "$pic_mode" != default; then
4358 # Only do commands if we really have different PIC objects.
4359 reload_objs="$libobjs $reload_conv_objs"
4362 save_ifs="$IFS"; IFS='~'
4363 for cmd in $cmds; do
4367 $run eval "$cmd" || exit $?
4372 if test -n "$gentop"; then
4373 $show "${rm}r $gentop"
4382 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4384 if test -n "$vinfo"; then
4385 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4388 if test -n "$release"; then
4389 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4392 if test "$preload" = yes; then
4393 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4394 test "$dlopen_self_static" = unknown; then
4395 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4400 *-*-rhapsody* | *-*-darwin1.[012])
4401 # On Rhapsody replace the C library is the System framework
4402 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4403 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4409 # Don't allow lazy linking, it breaks C++ global constructors
4410 if test "$tagname" = CXX ; then
4411 compile_command="$compile_command ${wl}-bind_at_load"
4412 finalize_command="$finalize_command ${wl}-bind_at_load"
4418 # move library search paths that coincide with paths to not yet
4419 # installed libraries to the beginning of the library search list
4421 for path in $notinst_path; do
4422 case " $new_libs " in
4423 *" -L$path/$objdir "*) ;;
4425 case " $compile_deplibs " in
4426 *" -L$path/$objdir "*)
4427 new_libs="$new_libs -L$path/$objdir" ;;
4432 for deplib in $compile_deplibs; do
4435 case " $new_libs " in
4437 *) new_libs="$new_libs $deplib" ;;
4440 *) new_libs="$new_libs $deplib" ;;
4443 compile_deplibs="$new_libs"
4446 compile_command="$compile_command $compile_deplibs"
4447 finalize_command="$finalize_command $finalize_deplibs"
4449 if test -n "$rpath$xrpath"; then
4450 # If the user specified any rpath flags, then add them.
4451 for libdir in $rpath $xrpath; do
4452 # This is the magic to use -rpath.
4453 case "$finalize_rpath " in
4455 *) finalize_rpath="$finalize_rpath $libdir" ;;
4460 # Now hardcode the library paths
4463 for libdir in $compile_rpath $finalize_rpath; do
4464 if test -n "$hardcode_libdir_flag_spec"; then
4465 if test -n "$hardcode_libdir_separator"; then
4466 if test -z "$hardcode_libdirs"; then
4467 hardcode_libdirs="$libdir"
4469 # Just accumulate the unique libdirs.
4470 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4471 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4474 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4479 eval flag=\"$hardcode_libdir_flag_spec\"
4480 rpath="$rpath $flag"
4482 elif test -n "$runpath_var"; then
4483 case "$perm_rpath " in
4485 *) perm_rpath="$perm_rpath $libdir" ;;
4489 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4490 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4491 case :$dllsearchpath: in
4493 *) dllsearchpath="$dllsearchpath:$libdir";;
4495 case :$dllsearchpath: in
4496 *":$testbindir:"*) ;;
4497 *) dllsearchpath="$dllsearchpath:$testbindir";;
4502 # Substitute the hardcoded libdirs into the rpath.
4503 if test -n "$hardcode_libdir_separator" &&
4504 test -n "$hardcode_libdirs"; then
4505 libdir="$hardcode_libdirs"
4506 eval rpath=\" $hardcode_libdir_flag_spec\"
4508 compile_rpath="$rpath"
4512 for libdir in $finalize_rpath; do
4513 if test -n "$hardcode_libdir_flag_spec"; then
4514 if test -n "$hardcode_libdir_separator"; then
4515 if test -z "$hardcode_libdirs"; then
4516 hardcode_libdirs="$libdir"
4518 # Just accumulate the unique libdirs.
4519 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4520 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4523 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4528 eval flag=\"$hardcode_libdir_flag_spec\"
4529 rpath="$rpath $flag"
4531 elif test -n "$runpath_var"; then
4532 case "$finalize_perm_rpath " in
4534 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4538 # Substitute the hardcoded libdirs into the rpath.
4539 if test -n "$hardcode_libdir_separator" &&
4540 test -n "$hardcode_libdirs"; then
4541 libdir="$hardcode_libdirs"
4542 eval rpath=\" $hardcode_libdir_flag_spec\"
4544 finalize_rpath="$rpath"
4546 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4547 # Transform all the library objects into standard objects.
4548 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4549 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4553 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4554 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4555 dlsyms="${outputname}S.c"
4557 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4561 if test -n "$dlsyms"; then
4565 # Discover the nlist of each of the dlfiles.
4566 nlist="$output_objdir/${outputname}.nm"
4568 $show "$rm $nlist ${nlist}S ${nlist}T"
4569 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4571 # Parse the name list into a source file.
4572 $show "creating $output_objdir/$dlsyms"
4574 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4575 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4576 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4582 /* Prevent the only kind of declaration conflicts we can make. */
4583 #define lt_preloaded_symbols some_other_symbol
4585 /* External symbol declarations for the compiler. */\
4588 if test "$dlself" = yes; then
4589 $show "generating symbol list for \`$output'"
4591 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4593 # Add our own program objects to the symbol list.
4594 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4595 for arg in $progfiles; do
4596 $show "extracting global C symbols from \`$arg'"
4597 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4600 if test -n "$exclude_expsyms"; then
4601 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4602 $run eval '$mv "$nlist"T "$nlist"'
4605 if test -n "$export_symbols_regex"; then
4606 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4607 $run eval '$mv "$nlist"T "$nlist"'
4610 # Prepare the list of exported symbols
4611 if test -z "$export_symbols"; then
4612 export_symbols="$output_objdir/$outputname.exp"
4613 $run $rm $export_symbols
4614 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4616 *cygwin* | *mingw* )
4617 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4618 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4622 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4623 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4624 $run eval 'mv "$nlist"T "$nlist"'
4626 *cygwin* | *mingw* )
4627 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4628 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4634 for arg in $dlprefiles; do
4635 $show "extracting global C symbols from \`$arg'"
4636 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4637 $run eval '$echo ": $name " >> "$nlist"'
4638 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4641 if test -z "$run"; then
4642 # Make sure we have at least an empty file.
4643 test -f "$nlist" || : > "$nlist"
4645 if test -n "$exclude_expsyms"; then
4646 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4647 $mv "$nlist"T "$nlist"
4650 # Try sorting and uniquifying the output.
4651 if grep -v "^: " < "$nlist" |
4652 if sort -k 3 </dev/null >/dev/null 2>&1; then
4657 uniq > "$nlist"S; then
4660 grep -v "^: " < "$nlist" > "$nlist"S
4663 if test -f "$nlist"S; then
4664 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4666 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4669 $echo >> "$output_objdir/$dlsyms" "\
4671 #undef lt_preloaded_symbols
4673 #if defined (__STDC__) && __STDC__
4674 # define lt_ptr void *
4676 # define lt_ptr char *
4680 /* The mapping between symbol names and symbols. */
4684 *cygwin* | *mingw* )
4685 $echo >> "$output_objdir/$dlsyms" "\
4686 /* DATA imports from DLLs on WIN32 can't be const, because
4687 runtime relocations are performed -- see ld's documentation
4693 $echo >> "$output_objdir/$dlsyms" "\
4700 $echo >> "$output_objdir/$dlsyms" "\
4704 lt_preloaded_symbols[] =
4708 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4710 $echo >> "$output_objdir/$dlsyms" "\
4714 /* This works around a problem in FreeBSD linker */
4715 #ifdef FREEBSD_WORKAROUND
4716 static const void *lt_preloaded_setup() {
4717 return lt_preloaded_symbols;
4727 pic_flag_for_symtable=
4729 # compiling the symbol table file with pic_flag works around
4730 # a FreeBSD bug that causes programs to crash when -lm is
4731 # linked before any other PIC object. But we must not use
4732 # pic_flag when linking with -static. The problem exists in
4733 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4734 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4735 case "$compile_command " in
4737 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4740 case "$compile_command " in
4742 *) pic_flag_for_symtable=" $pic_flag";;
4746 # Now compile the dynamic symbol file.
4747 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4748 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4750 # Clean up the generated files.
4751 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4752 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4754 # Transform the symbol file into the correct name.
4756 *cygwin* | *mingw* )
4757 if test -f "$output_objdir/${outputname}.def" ; then
4758 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4759 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $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`
4766 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4767 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4777 # We keep going just in case the user didn't refer to
4778 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4779 # really was required.
4781 # Nullify the symbol file.
4782 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4783 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4786 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4787 # Replace the output file specification.
4788 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4789 link_command="$compile_command$compile_rpath"
4791 # We have no uninstalled library dependencies, so finalize right now.
4792 $show "$link_command"
4793 $run eval "$link_command"
4796 # Delete the generated files.
4797 if test -n "$dlsyms"; then
4798 $show "$rm $output_objdir/${outputname}S.${objext}"
4799 $run $rm "$output_objdir/${outputname}S.${objext}"
4805 if test -n "$shlibpath_var"; then
4806 # We should set the shlibpath_var
4808 for dir in $temp_rpath; do
4810 [\\/]* | [A-Za-z]:[\\/]*)
4815 # Relative path: add a thisdir entry.
4816 rpath="$rpath\$thisdir/$dir:"
4823 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4824 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4826 if test -n "$finalize_shlibpath"; then
4827 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4832 if test -n "$runpath_var"; then
4833 if test -n "$perm_rpath"; then
4834 # We should set the runpath_var.
4836 for dir in $perm_rpath; do
4839 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4841 if test -n "$finalize_perm_rpath"; then
4842 # We should set the runpath_var.
4844 for dir in $finalize_perm_rpath; do
4847 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4851 if test "$no_install" = yes; then
4852 # We don't need to create a wrapper script.
4853 link_command="$compile_var$compile_command$compile_rpath"
4854 # Replace the output file specification.
4855 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4856 # Delete the old output file.
4858 # Link the executable and exit
4859 $show "$link_command"
4860 $run eval "$link_command" || exit $?
4864 if test "$hardcode_action" = relink; then
4865 # Fast installation is not supported
4866 link_command="$compile_var$compile_command$compile_rpath"
4867 relink_command="$finalize_var$finalize_command$finalize_rpath"
4869 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4870 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4872 if test "$fast_install" != no; then
4873 link_command="$finalize_var$compile_command$finalize_rpath"
4874 if test "$fast_install" = yes; then
4875 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4877 # fast_install is set to needless
4881 link_command="$compile_var$compile_command$compile_rpath"
4882 relink_command="$finalize_var$finalize_command$finalize_rpath"
4886 # Replace the output file specification.
4887 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4889 # Delete the old output files.
4890 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4892 $show "$link_command"
4893 $run eval "$link_command" || exit $?
4895 # Now create the wrapper script.
4896 $show "creating $output"
4898 # Quote the relink command for shipping.
4899 if test -n "$relink_command"; then
4900 # Preserve any variables that may affect compiler behavior
4901 for var in $variables_saved_for_relink; do
4902 if eval test -z \"\${$var+set}\"; then
4903 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4904 elif eval var_value=\$$var; test -z "$var_value"; then
4905 relink_command="$var=; export $var; $relink_command"
4907 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4908 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4911 relink_command="(cd `pwd`; $relink_command)"
4912 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4915 # Quote $echo for shipping.
4916 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4918 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4919 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4921 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4923 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4926 # Only actually do things if our run command is non-null.
4927 if test -z "$run"; then
4928 # win32 will think the script is a binary if it has
4929 # a .exe suffix, so we strip it off here.
4931 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4933 # test for cygwin because mv fails w/o .exe extensions
4937 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4941 *cygwin* | *mingw* )
4942 output_name=`basename $output`
4943 output_path=`dirname $output`
4944 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4945 cwrapper="$output_path/$output_name.exe"
4946 $rm $cwrappersource $cwrapper
4947 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4949 cat > $cwrappersource <<EOF
4951 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4952 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4954 The $output program cannot be directly executed until all the libtool
4955 libraries that it depends on are installed.
4957 This wrapper executable should never be moved out of the build directory.
4958 If it is, it will not operate correctly.
4960 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4961 but could eventually absorb all of the scripts functionality and
4962 exec $objdir/$outputname directly.
4965 cat >> $cwrappersource<<"EOF"
4974 #include <sys/stat.h>
4976 #if defined(PATH_MAX)
4977 # define LT_PATHMAX PATH_MAX
4978 #elif defined(MAXPATHLEN)
4979 # define LT_PATHMAX MAXPATHLEN
4981 # define LT_PATHMAX 1024
4984 #ifndef DIR_SEPARATOR
4985 # define DIR_SEPARATOR '/'
4986 # define PATH_SEPARATOR ':'
4989 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4991 # define HAVE_DOS_BASED_FILE_SYSTEM
4992 # ifndef DIR_SEPARATOR_2
4993 # define DIR_SEPARATOR_2 '\\'
4995 # ifndef PATH_SEPARATOR_2
4996 # define PATH_SEPARATOR_2 ';'
5000 #ifndef DIR_SEPARATOR_2
5001 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5002 #else /* DIR_SEPARATOR_2 */
5003 # define IS_DIR_SEPARATOR(ch) \
5004 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5005 #endif /* DIR_SEPARATOR_2 */
5007 #ifndef PATH_SEPARATOR_2
5008 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5009 #else /* PATH_SEPARATOR_2 */
5010 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5011 #endif /* PATH_SEPARATOR_2 */
5013 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5014 #define XFREE(stale) do { \
5015 if (stale) { free ((void *) stale); stale = 0; } \
5018 /* -DDEBUG is fairly common in CFLAGS. */
5020 #if defined DEBUGWRAPPER
5021 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5023 # define DEBUG(format, ...)
5026 const char *program_name = NULL;
5028 void * xmalloc (size_t num);
5029 char * xstrdup (const char *string);
5030 const char * base_name (const char *name);
5031 char * find_executable(const char *wrapper);
5032 int check_executable(const char *path);
5033 char * strendzap(char *str, const char *pat);
5034 void lt_fatal (const char *message, ...);
5037 main (int argc, char *argv[])
5042 program_name = (char *) xstrdup (base_name (argv[0]));
5043 DEBUG("(main) argv[0] : %s\n",argv[0]);
5044 DEBUG("(main) program_name : %s\n",program_name);
5045 newargz = XMALLOC(char *, argc+2);
5048 cat >> $cwrappersource <<EOF
5049 newargz[0] = (char *) xstrdup("$SHELL");
5052 cat >> $cwrappersource <<"EOF"
5053 newargz[1] = find_executable(argv[0]);
5054 if (newargz[1] == NULL)
5055 lt_fatal("Couldn't find %s", argv[0]);
5056 DEBUG("(main) found exe at : %s\n",newargz[1]);
5057 /* we know the script has the same name, without the .exe */
5058 /* so make sure newargz[1] doesn't end in .exe */
5059 strendzap(newargz[1],".exe");
5060 for (i = 1; i < argc; i++)
5061 newargz[i+1] = xstrdup(argv[i]);
5062 newargz[argc+1] = NULL;
5064 for (i=0; i<argc+1; i++)
5066 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5074 cat >> $cwrappersource <<EOF
5075 execv("$SHELL",(char const **)newargz);
5079 cat >> $cwrappersource <<EOF
5080 execv("$SHELL",newargz);
5085 cat >> $cwrappersource <<"EOF"
5090 xmalloc (size_t num)
5092 void * p = (void *) malloc (num);
5094 lt_fatal ("Memory exhausted");
5100 xstrdup (const char *string)
5102 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5107 base_name (const char *name)
5111 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5112 /* Skip over the disk name in MSDOS pathnames. */
5113 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5117 for (base = name; *name; name++)
5118 if (IS_DIR_SEPARATOR (*name))
5124 check_executable(const char * path)
5128 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5129 if ((!path) || (!*path))
5132 if ((stat (path, &st) >= 0) &&
5134 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5135 #if defined (S_IXOTH)
5136 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5138 #if defined (S_IXGRP)
5139 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5141 ((st.st_mode & S_IXUSR) == S_IXUSR))
5148 /* Searches for the full path of the wrapper. Returns
5149 newly allocated full path name if found, NULL otherwise */
5151 find_executable (const char* wrapper)
5156 /* static buffer for getcwd */
5157 char tmp[LT_PATHMAX + 1];
5161 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5163 if ((wrapper == NULL) || (*wrapper == '\0'))
5166 /* Absolute path? */
5167 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5168 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5170 concat_name = xstrdup (wrapper);
5171 if (check_executable(concat_name))
5178 if (IS_DIR_SEPARATOR (wrapper[0]))
5180 concat_name = xstrdup (wrapper);
5181 if (check_executable(concat_name))
5185 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5189 for (p = wrapper; *p; p++)
5197 /* no slashes; search PATH */
5198 const char* path = getenv ("PATH");
5201 for (p = path; *p; p = p_next)
5205 for (q = p; *q; q++)
5206 if (IS_PATH_SEPARATOR(*q))
5209 p_next = (*q == '\0' ? q : q + 1);
5212 /* empty path: current directory */
5213 if (getcwd (tmp, LT_PATHMAX) == NULL)
5214 lt_fatal ("getcwd failed");
5215 tmp_len = strlen(tmp);
5216 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5217 memcpy (concat_name, tmp, tmp_len);
5218 concat_name[tmp_len] = '/';
5219 strcpy (concat_name + tmp_len + 1, wrapper);
5223 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5224 memcpy (concat_name, p, p_len);
5225 concat_name[p_len] = '/';
5226 strcpy (concat_name + p_len + 1, wrapper);
5228 if (check_executable(concat_name))
5233 /* not found in PATH; assume curdir */
5235 /* Relative path | not found in path: prepend cwd */
5236 if (getcwd (tmp, LT_PATHMAX) == NULL)
5237 lt_fatal ("getcwd failed");
5238 tmp_len = strlen(tmp);
5239 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5240 memcpy (concat_name, tmp, tmp_len);
5241 concat_name[tmp_len] = '/';
5242 strcpy (concat_name + tmp_len + 1, wrapper);
5244 if (check_executable(concat_name))
5251 strendzap(char *str, const char *pat)
5255 assert(str != NULL);
5256 assert(pat != NULL);
5259 patlen = strlen(pat);
5263 str += len - patlen;
5264 if (strcmp(str, pat) == 0)
5271 lt_error_core (int exit_status, const char * mode,
5272 const char * message, va_list ap)
5274 fprintf (stderr, "%s: %s: ", program_name, mode);
5275 vfprintf (stderr, message, ap);
5276 fprintf (stderr, ".\n");
5278 if (exit_status >= 0)
5283 lt_fatal (const char *message, ...)
5286 va_start (ap, message);
5287 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5291 # we should really use a build-platform specific compiler
5292 # here, but OTOH, the wrappers (shell script and this C one)
5293 # are only useful if you want to execute the "real" binary.
5294 # Since the "real" binary is built for $host, then this
5295 # wrapper might as well be built for $host, too.
5296 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5300 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5305 # $output - temporary wrapper script for $objdir/$outputname
5306 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5308 # The $output program cannot be directly executed until all the libtool
5309 # libraries that it depends on are installed.
5311 # This wrapper script should never be moved out of the build directory.
5312 # If it is, it will not operate correctly.
5314 # Sed substitution that helps us do robust quoting. It backslashifies
5315 # metacharacters that are still active within double-quoted strings.
5316 Xsed='${SED} -e 1s/^X//'
5317 sed_quote_subst='$sed_quote_subst'
5319 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5320 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5323 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5324 # is contrary to our usage. Disable this feature.
5325 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5326 setopt NO_GLOB_SUBST
5328 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5330 BIN_SH=xpg4; export BIN_SH # for Tru64
5331 DUALCASE=1; export DUALCASE # for MKS sh
5333 # The HP-UX ksh and POSIX shell print the target directory to stdout
5335 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5337 relink_command=\"$relink_command\"
5339 # This environment variable determines our operation mode.
5340 if test \"\$libtool_install_magic\" = \"$magic\"; then
5341 # install mode needs the following variable:
5342 notinst_deplibs='$notinst_deplibs'
5344 # When we are sourced in execute mode, \$file and \$echo are already set.
5345 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5348 # Make sure echo works.
5349 if test \"X\$1\" = X--no-reexec; then
5350 # Discard the --no-reexec flag, and continue.
5352 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5353 # Yippee, \$echo works!
5356 # Restart under the correct shell, and then maybe \$echo will work.
5357 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5363 # Find the directory that this script lives in.
5364 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5365 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5367 # Follow symbolic links until we get to the real thisdir.
5368 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5369 while test -n \"\$file\"; do
5370 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5372 # If there was a directory component, then change thisdir.
5373 if test \"x\$destdir\" != \"x\$file\"; then
5374 case \"\$destdir\" in
5375 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5376 *) thisdir=\"\$thisdir/\$destdir\" ;;
5380 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5381 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5384 # Try to get the absolute directory name.
5385 absdir=\`cd \"\$thisdir\" && pwd\`
5386 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5389 if test "$fast_install" = yes; then
5391 program=lt-'$outputname'$exeext
5392 progdir=\"\$thisdir/$objdir\"
5394 if test ! -f \"\$progdir/\$program\" || \\
5395 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5396 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5398 file=\"\$\$-\$program\"
5400 if test ! -d \"\$progdir\"; then
5401 $mkdir \"\$progdir\"
5403 $rm \"\$progdir/\$file\"
5408 # relink executable if necessary
5409 if test -n \"\$relink_command\"; then
5410 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5412 $echo \"\$relink_command_output\" >&2
5413 $rm \"\$progdir/\$file\"
5418 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5419 { $rm \"\$progdir/\$program\";
5420 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5421 $rm \"\$progdir/\$file\"
5425 program='$outputname'
5426 progdir=\"\$thisdir/$objdir\"
5432 if test -f \"\$progdir/\$program\"; then"
5434 # Export our shlibpath_var if we have one.
5435 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5437 # Add our own library path to $shlibpath_var
5438 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5440 # Some systems cannot cope with colon-terminated $shlibpath_var
5441 # The second colon is a workaround for a bug in BeOS R4 sed
5442 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5444 export $shlibpath_var
5448 # fixup the dll searchpath if we need to.
5449 if test -n "$dllsearchpath"; then
5451 # Add the dll search path components to the executable PATH
5452 PATH=$dllsearchpath:\$PATH
5457 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5458 # Run the actual program with our arguments.
5460 # Make sure env LD_LIBRARY_PATH does not mess us up
5461 if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5462 export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5466 # Backslashes separate directories on plain windows
5467 *-*-mingw | *-*-os2*)
5469 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5475 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5480 \$echo \"\$0: cannot exec \$program \$*\"
5484 # The program doesn't exist.
5485 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5486 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5487 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5498 # See if we need to build an old-fashioned archive.
5499 for oldlib in $oldlibs; do
5501 if test "$build_libtool_libs" = convenience; then
5502 oldobjs="$libobjs_save"
5503 addlibs="$convenience"
5504 build_libtool_libs=no
5506 if test "$build_libtool_libs" = module; then
5507 oldobjs="$libobjs_save"
5508 build_libtool_libs=no
5510 oldobjs="$old_deplibs $non_pic_objects"
5512 addlibs="$old_convenience"
5515 if test -n "$addlibs"; then
5516 gentop="$output_objdir/${outputname}x"
5517 generated="$generated $gentop"
5519 func_extract_archives $gentop $addlibs
5520 oldobjs="$oldobjs $func_extract_archives_result"
5523 # Do each command in the archive commands.
5524 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5525 cmds=$old_archive_from_new_cmds
5527 # POSIX demands no paths to be encoded in archives. We have
5528 # to avoid creating archives with duplicate basenames if we
5529 # might have to extract them afterwards, e.g., when creating a
5530 # static archive out of a convenience library, or when linking
5531 # the entirety of a libtool archive into another (currently
5532 # not supported by libtool).
5533 if (for obj in $oldobjs
5535 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5536 done | sort | sort -uc >/dev/null 2>&1); then
5539 $echo "copying selected object files to avoid basename conflicts..."
5541 if test -z "$gentop"; then
5542 gentop="$output_objdir/${outputname}x"
5543 generated="$generated $gentop"
5545 $show "${rm}r $gentop"
5546 $run ${rm}r "$gentop"
5547 $show "$mkdir $gentop"
5548 $run $mkdir "$gentop"
5550 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5555 save_oldobjs=$oldobjs
5558 for obj in $save_oldobjs
5560 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5561 case " $oldobjs " in
5562 " ") oldobjs=$obj ;;
5565 # Make sure we don't pick an alternate name that also
5567 newobj=lt$counter-$objbase
5568 counter=`expr $counter + 1`
5569 case " $oldobjs " in
5570 *[\ /]"$newobj "*) ;;
5571 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5574 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5575 $run ln "$obj" "$gentop/$newobj" ||
5576 $run cp "$obj" "$gentop/$newobj"
5577 oldobjs="$oldobjs $gentop/$newobj"
5579 *) oldobjs="$oldobjs $obj" ;;
5584 eval cmds=\"$old_archive_cmds\"
5586 if len=`expr "X$cmds" : ".*"` &&
5587 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5588 cmds=$old_archive_cmds
5590 # the command line is too long to link in one step, link in parts
5591 $echo "using piecewise archive linking..."
5596 save_oldobjs=$oldobjs
5598 # Is there a better way of finding the last object in the list?
5599 for obj in $save_oldobjs
5603 for obj in $save_oldobjs
5605 oldobjs="$objlist $obj"
5606 objlist="$objlist $obj"
5607 eval test_cmds=\"$old_archive_cmds\"
5608 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5609 test "$len" -le "$max_cmd_len"; then
5612 # the above command should be used before it gets too long
5614 if test "$obj" = "$last_oldobj" ; then
5617 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5618 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5624 if test "X$oldobjs" = "X" ; then
5625 eval cmds=\"\$concat_cmds\"
5627 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5631 save_ifs="$IFS"; IFS='~'
5632 for cmd in $cmds; do
5636 $run eval "$cmd" || exit $?
5641 if test -n "$generated"; then
5642 $show "${rm}r$generated"
5643 $run ${rm}r$generated
5646 # Now create the libtool archive.
5650 test "$build_old_libs" = yes && old_library="$libname.$libext"
5651 $show "creating $output"
5653 # Preserve any variables that may affect compiler behavior
5654 for var in $variables_saved_for_relink; do
5655 if eval test -z \"\${$var+set}\"; then
5656 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5657 elif eval var_value=\$$var; test -z "$var_value"; then
5658 relink_command="$var=; export $var; $relink_command"
5660 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5661 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5664 # Quote the link command for shipping.
5665 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5666 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5667 if test "$hardcode_automatic" = yes ; then
5672 # Only create the output if not a dry run.
5673 if test -z "$run"; then
5674 for installed in no yes; do
5675 if test "$installed" = yes; then
5676 if test -z "$install_libdir"; then
5679 output="$output_objdir/$outputname"i
5680 # Replace all uninstalled libtool libraries with the installed ones
5682 for deplib in $dependency_libs; do
5685 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5686 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5687 if test -z "$libdir"; then
5688 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5691 if test "X$EGREP" = X ; then
5694 # We do not want portage's install root ($D) present. Check only for
5695 # this if the .la is being installed.
5696 if test "$installed" = yes && test "$D"; then
5697 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5699 mynewdependency_lib="$libdir/$name"
5701 # Do not add duplicates
5702 if test "$mynewdependency_lib"; then
5703 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5704 if test -z "$my_little_ninja_foo_1"; then
5705 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5710 if test "$installed" = yes; then
5711 # Rather use S=WORKDIR if our version of portage supports it.
5712 # This is because some ebuild (gcc) do not use $S as buildroot.
5713 if test "$PWORKDIR"; then
5716 # We do not want portage's build root ($S) present.
5717 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5718 # We do not want portage's install root ($D) present.
5719 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5720 if test -n "$my_little_ninja_foo_2" && test "$S"; then
5721 mynewdependency_lib=""
5722 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5723 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5725 mynewdependency_lib="$deplib"
5728 mynewdependency_lib="$deplib"
5730 # Do not add duplicates
5731 if test "$mynewdependency_lib"; then
5732 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5733 if test -z "$my_little_ninja_foo_4"; then
5734 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5740 dependency_libs="$newdependency_libs"
5742 for lib in $dlfiles; do
5743 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5744 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5745 if test -z "$libdir"; then
5746 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5749 newdlfiles="$newdlfiles $libdir/$name"
5751 dlfiles="$newdlfiles"
5753 for lib in $dlprefiles; do
5754 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5755 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5756 if test -z "$libdir"; then
5757 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5760 newdlprefiles="$newdlprefiles $libdir/$name"
5762 dlprefiles="$newdlprefiles"
5765 for lib in $dlfiles; do
5767 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5768 *) abs=`pwd`"/$lib" ;;
5770 newdlfiles="$newdlfiles $abs"
5772 dlfiles="$newdlfiles"
5774 for lib in $dlprefiles; do
5776 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5777 *) abs=`pwd`"/$lib" ;;
5779 newdlprefiles="$newdlprefiles $abs"
5781 dlprefiles="$newdlprefiles"
5784 # place dlname in correct position for cygwin
5786 case $host,$output,$installed,$module,$dlname in
5787 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5789 # Do not add duplicates
5790 if test "$installed" = yes && test "$D"; then
5791 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5794 # $outputname - a libtool library file
5795 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5797 # Please DO NOT delete this file!
5798 # It is necessary for linking the library.
5800 # The name that we can dlopen(3).
5803 # Names of this library.
5804 library_names='$library_names'
5806 # The name of the static archive.
5807 old_library='$old_library'
5809 # Libraries that this one depends upon.
5810 dependency_libs='$dependency_libs'
5812 # Version information for $libname.
5817 # Is this an already installed library?
5818 installed=$installed
5820 # Should we warn about portability when linking against -modules?
5821 shouldnotlink=$module
5823 # Files to dlopen/dlpreopen
5825 dlpreopen='$dlprefiles'
5827 # Directory that this library needs to be installed in:
5828 libdir='$install_libdir'"
5829 if test "$installed" = no && test "$need_relink" = yes; then
5831 relink_command=\"$relink_command\""
5836 # Do a symbolic link so that the libtool archive can be found in
5837 # LD_LIBRARY_PATH before the program is installed.
5838 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5839 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5845 # libtool install mode
5847 modename="$modename: install"
5849 # There may be an optional sh(1) argument at the beginning of
5850 # install_prog (especially on Windows NT).
5851 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5852 # Allow the use of GNU shtool's install command.
5853 $echo "X$nonopt" | grep shtool > /dev/null; then
5854 # Aesthetically quote it.
5855 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5857 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5861 install_prog="$arg "
5869 # The real first argument should be the name of the installation program.
5870 # Aesthetically quote it.
5871 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5873 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5877 install_prog="$install_prog$arg"
5879 # We need to accept at least all the BSD install flags.
5889 if test -n "$dest"; then
5890 files="$files $dest"
5898 case " $install_prog " in
5903 -g | -m | -o) prev=$arg ;;
5911 # If the previous option needed an argument, then skip it.
5912 if test -n "$prev"; then
5921 # Aesthetically quote the argument.
5922 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5924 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5928 install_prog="$install_prog $arg"
5931 if test -z "$install_prog"; then
5932 $echo "$modename: you must specify an install program" 1>&2
5937 if test -n "$prev"; then
5938 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5943 if test -z "$files"; then
5944 if test -z "$dest"; then
5945 $echo "$modename: no file or destination specified" 1>&2
5947 $echo "$modename: you must specify a destination" 1>&2
5953 # Strip any trailing slash from the destination.
5954 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5956 # Check to see that the destination is a directory.
5957 test -d "$dest" && isdir=yes
5958 if test "$isdir" = yes; then
5962 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5963 test "X$destdir" = "X$dest" && destdir=.
5964 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5966 # Not a directory, so check to see that there is only one file specified.
5968 if test "$#" -gt 2; then
5969 $echo "$modename: \`$dest' is not a directory" 1>&2
5975 [\\/]* | [A-Za-z]:[\\/]*) ;;
5977 for file in $files; do
5981 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5990 # This variable tells wrapper scripts just to set variables rather
5991 # than running their programs.
5992 libtool_install_magic="$magic"
5997 for file in $files; do
5999 # Do each installation.
6002 # Do the static libraries later.
6003 staticlibs="$staticlibs $file"
6007 # Check to see that this really is a libtool archive.
6008 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6010 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6018 # If there is no directory component, then add one.
6020 */* | *\\*) . $file ;;
6024 # Add the libdir to current_libdirs if it is the destination.
6025 if test "X$destdir" = "X$libdir"; then
6026 case "$current_libdirs " in
6028 *) current_libdirs="$current_libdirs $libdir" ;;
6031 # Note the libdir as a future libdir.
6032 case "$future_libdirs " in
6034 *) future_libdirs="$future_libdirs $libdir" ;;
6038 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6039 test "X$dir" = "X$file/" && dir=
6042 if test -n "$relink_command"; then
6043 # Determine the prefix the user has applied to our future dir.
6044 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6046 # Don't allow the user to place us outside of our expected
6047 # location b/c this prevents finding dependent libraries that
6048 # are installed to the same prefix.
6049 # At present, this check doesn't affect windows .dll's that
6050 # are installed into $libdir/../bin (currently, that works fine)
6051 # but it's something to keep an eye on.
6052 if test "$inst_prefix_dir" = "$destdir"; then
6053 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6057 if test -n "$inst_prefix_dir"; then
6058 # Stick the inst_prefix_dir data into the link command.
6059 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6061 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6064 $echo "$modename: warning: relinking \`$file'" 1>&2
6065 $show "$relink_command"
6066 if $run eval "$relink_command"; then :
6068 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6073 # See the names of the shared library.
6074 set dummy $library_names
6075 if test -n "$2"; then
6081 test -n "$relink_command" && srcname="$realname"T
6083 # Install the shared library and build the symlinks.
6084 $show "$install_prog $dir/$srcname $destdir/$realname"
6085 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6086 if test -n "$stripme" && test -n "$striplib"; then
6087 $show "$striplib $destdir/$realname"
6088 $run eval "$striplib $destdir/$realname" || exit $?
6091 if test "$#" -gt 0; then
6092 # Delete the old symlinks, and create new ones.
6093 # Try `ln -sf' first, because the `ln' binary might depend on
6094 # the symlink we replace! Solaris /bin/ln does not understand -f,
6095 # so we also need to try rm && ln -s.
6098 if test "$linkname" != "$realname"; then
6099 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6100 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6105 # Do each command in the postinstall commands.
6106 lib="$destdir/$realname"
6107 cmds=$postinstall_cmds
6108 save_ifs="$IFS"; IFS='~'
6109 for cmd in $cmds; do
6113 $run eval "$cmd" || {
6116 # Restore the uninstalled library and exit
6117 if test "$mode" = relink; then
6118 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6127 # Install the pseudo-library for information purposes.
6128 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6129 instname="$dir/$name"i
6130 $show "$install_prog $instname $destdir/$name"
6131 $run eval "$install_prog $instname $destdir/$name" || exit $?
6133 # Maybe install the static library, too.
6134 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6138 # Install (i.e. copy) a libtool object.
6140 # Figure out destination file name, if it wasn't already specified.
6141 if test -n "$destname"; then
6142 destfile="$destdir/$destname"
6144 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6145 destfile="$destdir/$destfile"
6148 # Deduce the name of the destination old-style object file.
6151 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6154 staticdest="$destfile"
6158 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6164 # Install the libtool object if requested.
6165 if test -n "$destfile"; then
6166 $show "$install_prog $file $destfile"
6167 $run eval "$install_prog $file $destfile" || exit $?
6170 # Install the old object if enabled.
6171 if test "$build_old_libs" = yes; then
6172 # Deduce the name of the old-style object file.
6173 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6175 $show "$install_prog $staticobj $staticdest"
6176 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6182 # Figure out destination file name, if it wasn't already specified.
6183 if test -n "$destname"; then
6184 destfile="$destdir/$destname"
6186 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6187 destfile="$destdir/$destfile"
6190 # If the file is missing, and there is a .exe on the end, strip it
6191 # because it is most likely a libtool script we actually want to
6196 if test ! -f "$file"; then
6197 file=`$echo $file|${SED} 's,.exe$,,'`
6203 # Do a test to see if this is really a libtool program.
6206 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6212 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6216 # Note that it is not necessary on cygwin/mingw to append a dot to
6217 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6218 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6219 # `FILE.' does not work on cygwin managed mounts.
6221 # If there is no directory component, then add one.
6223 */* | *\\*) . ${wrapper} ;;
6224 *) . ./${wrapper} ;;
6227 # Check the variables that should have been set.
6228 if test -z "$notinst_deplibs"; then
6229 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6234 for lib in $notinst_deplibs; do
6235 # Check to see that each library is installed.
6237 if test -f "$lib"; then
6238 # If there is no directory component, then add one.
6240 */* | *\\*) . $lib ;;
6244 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6245 if test -n "$libdir" && test ! -f "$libfile"; then
6246 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6252 # Note that it is not necessary on cygwin/mingw to append a dot to
6253 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6254 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6255 # `FILE.' does not work on cygwin managed mounts.
6257 # If there is no directory component, then add one.
6259 */* | *\\*) . ${wrapper} ;;
6260 *) . ./${wrapper} ;;
6264 if test "$fast_install" = no && test -n "$relink_command"; then
6265 if test "$finalize" = yes && test -z "$run"; then
6266 tmpdir=`func_mktempdir`
6267 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6268 outputname="$tmpdir/$file"
6269 # Replace the output file specification.
6270 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6272 $show "$relink_command"
6273 if $run eval "$relink_command"; then :
6275 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6281 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6284 # Install the binary that we compiled earlier.
6285 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6289 # remove .exe since cygwin /usr/bin/install will append another
6291 case $install_prog,$host in
6292 */usr/bin/install*,*cygwin*)
6293 case $file:$destfile in
6298 destfile=$destfile.exe
6301 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6306 $show "$install_prog$stripme $file $destfile"
6307 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6308 test -n "$outputname" && ${rm}r "$tmpdir"
6313 for file in $staticlibs; do
6314 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6316 # Set up the ranlib parameters.
6317 oldlib="$destdir/$name"
6319 $show "$install_prog $file $oldlib"
6320 $run eval "$install_prog \$file \$oldlib" || exit $?
6322 if test -n "$stripme" && test -n "$old_striplib"; then
6323 $show "$old_striplib $oldlib"
6324 $run eval "$old_striplib $oldlib" || exit $?
6327 # Do each command in the postinstall commands.
6328 cmds=$old_postinstall_cmds
6329 save_ifs="$IFS"; IFS='~'
6330 for cmd in $cmds; do
6334 $run eval "$cmd" || exit $?
6339 if test -n "$future_libdirs"; then
6340 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6343 if test -n "$current_libdirs"; then
6344 # Maybe just do a dry run.
6345 test -n "$run" && current_libdirs=" -n$current_libdirs"
6346 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6352 # libtool finish mode
6354 modename="$modename: finish"
6358 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6361 libdirs="$libdirs $dir"
6364 for libdir in $libdirs; do
6365 if test -n "$finish_cmds"; then
6366 # Do each command in the finish commands.
6368 save_ifs="$IFS"; IFS='~'
6369 for cmd in $cmds; do
6373 $run eval "$cmd" || admincmds="$admincmds
6378 if test -n "$finish_eval"; then
6379 # Do the single finish_eval.
6380 eval cmds=\"$finish_eval\"
6381 $run eval "$cmds" || admincmds="$admincmds
6387 # Exit here if they wanted silent mode.
6388 test "$show" = : && exit $EXIT_SUCCESS
6390 $echo "X----------------------------------------------------------------------" | $Xsed
6391 $echo "Libraries have been installed in:"
6392 for libdir in $libdirs; do
6396 $echo "If you ever happen to want to link against installed libraries"
6397 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6398 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6399 $echo "flag during linking and do at least one of the following:"
6400 if test -n "$shlibpath_var"; then
6401 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6402 $echo " during execution"
6404 if test -n "$runpath_var"; then
6405 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6406 $echo " during linking"
6408 if test -n "$hardcode_libdir_flag_spec"; then
6410 eval flag=\"$hardcode_libdir_flag_spec\"
6412 $echo " - use the \`$flag' linker flag"
6414 if test -n "$admincmds"; then
6415 $echo " - have your system administrator run these commands:$admincmds"
6417 if test -f /etc/ld.so.conf; then
6418 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6421 $echo "See any operating system documentation about shared libraries for"
6422 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6423 $echo "X----------------------------------------------------------------------" | $Xsed
6427 # libtool execute mode
6429 modename="$modename: execute"
6431 # The first argument is the command name.
6433 if test -z "$cmd"; then
6434 $echo "$modename: you must specify a COMMAND" 1>&2
6439 # Handle -dlopen flags immediately.
6440 for file in $execute_dlfiles; do
6441 if test ! -f "$file"; then
6442 $echo "$modename: \`$file' is not a file" 1>&2
6450 # Check to see that this really is a libtool archive.
6451 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6453 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6458 # Read the libtool library.
6462 # If there is no directory component, then add one.
6464 */* | *\\*) . $file ;;
6468 # Skip this library if it cannot be dlopened.
6469 if test -z "$dlname"; then
6470 # Warn if it was a shared library.
6471 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6475 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6476 test "X$dir" = "X$file" && dir=.
6478 if test -f "$dir/$objdir/$dlname"; then
6481 if test ! -f "$dir/$dlname"; then
6482 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6489 # Just add the directory containing the .lo file.
6490 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6491 test "X$dir" = "X$file" && dir=.
6495 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6500 # Get the absolute pathname.
6501 absdir=`cd "$dir" && pwd`
6502 test -n "$absdir" && dir="$absdir"
6504 # Now add the directory to shlibpath_var.
6505 if eval "test -z \"\$$shlibpath_var\""; then
6506 eval "$shlibpath_var=\"\$dir\""
6508 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6512 # This variable tells wrapper scripts just to set shlibpath_var
6513 # rather than running their programs.
6514 libtool_execute_magic="$magic"
6516 # Check if any of the arguments is a wrapper script.
6523 # Do a test to see if this is really a libtool program.
6524 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6525 # If there is no directory component, then add one.
6527 */* | *\\*) . $file ;;
6531 # Transform arg to wrapped name.
6532 file="$progdir/$program"
6536 # Quote arguments (to preserve shell metacharacters).
6537 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6538 args="$args \"$file\""
6541 if test -z "$run"; then
6542 if test -n "$shlibpath_var"; then
6543 # Export the shlibpath_var.
6544 eval "export $shlibpath_var"
6547 # Restore saved environment variables
6548 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6550 eval "if test \"\${save_$lt_var+set}\" = set; then
6551 $lt_var=\$save_$lt_var; export $lt_var
6555 # Now prepare to actually exec the command.
6556 exec_cmd="\$cmd$args"
6558 # Display what would be done.
6559 if test -n "$shlibpath_var"; then
6560 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6561 $echo "export $shlibpath_var"
6568 # libtool clean and uninstall mode
6570 modename="$modename: $mode"
6576 # This variable tells wrapper scripts just to set variables rather
6577 # than running their programs.
6578 libtool_install_magic="$magic"
6583 -f) rm="$rm $arg"; rmforce=yes ;;
6584 -*) rm="$rm $arg" ;;
6585 *) files="$files $arg" ;;
6589 if test -z "$rm"; then
6590 $echo "$modename: you must specify an RM program" 1>&2
6597 origobjdir="$objdir"
6598 for file in $files; do
6599 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6600 if test "X$dir" = "X$file"; then
6602 objdir="$origobjdir"
6604 objdir="$dir/$origobjdir"
6606 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6607 test "$mode" = uninstall && objdir="$dir"
6609 # Remember objdir for removal later, being careful to avoid duplicates
6610 if test "$mode" = clean; then
6613 *) rmdirs="$rmdirs $objdir" ;;
6617 # Don't error if the file doesn't exist and rm -f was used.
6618 if (test -L "$file") >/dev/null 2>&1 \
6619 || (test -h "$file") >/dev/null 2>&1 \
6620 || test -f "$file"; then
6622 elif test -d "$file"; then
6625 elif test "$rmforce" = yes; then
6633 # Possibly a libtool archive, so verify it.
6634 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6637 # Delete the libtool libraries and symlinks.
6638 for n in $library_names; do
6639 rmfiles="$rmfiles $objdir/$n"
6641 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6645 case " $library_names " in
6646 # " " in the beginning catches empty $dlname
6648 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6650 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6653 if test -n "$library_names"; then
6654 # Do each command in the postuninstall commands.
6655 cmds=$postuninstall_cmds
6656 save_ifs="$IFS"; IFS='~'
6657 for cmd in $cmds; do
6662 if test "$?" -ne 0 && test "$rmforce" != yes; then
6669 if test -n "$old_library"; then
6670 # Do each command in the old_postuninstall commands.
6671 cmds=$old_postuninstall_cmds
6672 save_ifs="$IFS"; IFS='~'
6673 for cmd in $cmds; do
6678 if test "$?" -ne 0 && test "$rmforce" != yes; then
6684 # FIXME: should reinstall the best remaining shared library.
6691 # Possibly a libtool object, so verify it.
6692 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6697 # Add PIC object to the list of files to remove.
6698 if test -n "$pic_object" \
6699 && test "$pic_object" != none; then
6700 rmfiles="$rmfiles $dir/$pic_object"
6703 # Add non-PIC object to the list of files to remove.
6704 if test -n "$non_pic_object" \
6705 && test "$non_pic_object" != none; then
6706 rmfiles="$rmfiles $dir/$non_pic_object"
6712 if test "$mode" = clean ; then
6716 file=`$echo $file|${SED} 's,.exe$,,'`
6717 noexename=`$echo $name|${SED} 's,.exe$,,'`
6718 # $file with .exe has already been added to rmfiles,
6719 # add $file without .exe
6720 rmfiles="$rmfiles $file"
6723 # Do a test to see if this is a libtool program.
6724 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6728 # note $name still contains .exe if it was in $file originally
6729 # as does the version of $file that was added into $rmfiles
6730 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6731 if test "$fast_install" = yes && test -n "$relink_command"; then
6732 rmfiles="$rmfiles $objdir/lt-$name"
6734 if test "X$noexename" != "X$name" ; then
6735 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6741 $show "$rm $rmfiles"
6742 $run $rm $rmfiles || exit_status=1
6744 objdir="$origobjdir"
6746 # Try to remove the ${objdir}s in the directories where we deleted files
6747 for dir in $rmdirs; do
6748 if test -d "$dir"; then
6750 $run rmdir $dir >/dev/null 2>&1
6758 $echo "$modename: you must specify a MODE" 1>&2
6759 $echo "$generic_help" 1>&2
6764 if test -z "$exec_cmd"; then
6765 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6766 $echo "$generic_help" 1>&2
6769 fi # test -z "$show_help"
6771 if test -n "$exec_cmd"; then
6776 # We need to display help for each of the modes.
6779 "Usage: $modename [OPTION]... [MODE-ARG]...
6781 Provide generalized library-building support services.
6783 --config show all configuration variables
6784 --debug enable verbose shell tracing
6785 -n, --dry-run display commands without modifying any files
6786 --features display basic configuration information and exit
6787 --finish same as \`--mode=finish'
6788 --help display this help message and exit
6789 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6790 --quiet same as \`--silent'
6791 --silent don't print informational messages
6792 --tag=TAG use configuration variables from tag TAG
6793 --version print version information
6795 MODE must be one of the following:
6797 clean remove files from the build directory
6798 compile compile a source file into a libtool object
6799 execute automatically set library path, then run a program
6800 finish complete the installation of libtool libraries
6801 install install libraries or executables
6802 link create a library or an executable
6803 uninstall remove libraries from an installed directory
6805 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6806 a more detailed description of MODE.
6808 Report bugs to <bug-libtool@gnu.org>."
6814 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6816 Remove files from the build directory.
6818 RM is the name of the program to use to delete files associated with each FILE
6819 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6822 If FILE is a libtool library, object or program, all the files associated
6823 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6828 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6830 Compile a source file into a libtool library object.
6832 This mode accepts the following additional options:
6834 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6835 -prefer-pic try to building PIC objects only
6836 -prefer-non-pic try to building non-PIC objects only
6837 -static always build a \`.o' file suitable for static linking
6839 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6840 from the given SOURCEFILE.
6842 The output file name is determined by removing the directory component from
6843 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6844 library object suffix, \`.lo'."
6849 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6851 Automatically set library path, then run a program.
6853 This mode accepts the following additional options:
6855 -dlopen FILE add the directory containing FILE to the library path
6857 This mode sets the library path environment variable according to \`-dlopen'
6860 If any of the ARGS are libtool executable wrappers, then they are translated
6861 into their corresponding uninstalled binary, and any of their required library
6862 directories are added to the library path.
6864 Then, COMMAND is executed, with ARGS as arguments."
6869 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6871 Complete the installation of libtool libraries.
6873 Each LIBDIR is a directory that contains libtool libraries.
6875 The commands that this mode executes may require superuser privileges. Use
6876 the \`--dry-run' option if you just want to see what would be executed."
6881 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6883 Install executables or libraries.
6885 INSTALL-COMMAND is the installation command. The first component should be
6886 either the \`install' or \`cp' program.
6888 The rest of the components are interpreted as arguments to that command (only
6889 BSD-compatible install options are recognized)."
6894 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6896 Link object files or libraries together to form another library, or to
6897 create an executable program.
6899 LINK-COMMAND is a command using the C compiler that you would use to create
6900 a program from several object files.
6902 The following components of LINK-COMMAND are treated specially:
6904 -all-static do not do any dynamic linking at all
6905 -avoid-version do not add a version suffix if possible
6906 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6907 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6908 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6909 -export-symbols SYMFILE
6910 try to export only the symbols listed in SYMFILE
6911 -export-symbols-regex REGEX
6912 try to export only the symbols matching REGEX
6913 -LLIBDIR search LIBDIR for required installed libraries
6914 -lNAME OUTPUT-FILE requires the installed library libNAME
6915 -module build a library that can dlopened
6916 -no-fast-install disable the fast-install mode
6917 -no-install link a not-installable executable
6918 -no-undefined declare that a library does not refer to external symbols
6919 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6920 -objectlist FILE Use a list of object files found in FILE to specify objects
6921 -precious-files-regex REGEX
6922 don't remove output files matching REGEX
6923 -release RELEASE specify package release information
6924 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6925 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6926 -static do not do any dynamic linking of uninstalled libtool libraries
6927 -static-libtool-libs
6928 do not do any dynamic linking of libtool libraries
6929 -version-info CURRENT[:REVISION[:AGE]]
6930 specify library version info [each variable defaults to 0]
6932 All other options (arguments beginning with \`-') are ignored.
6934 Every other argument is treated as a filename. Files ending in \`.la' are
6935 treated as uninstalled libtool libraries, other files are standard or library
6938 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6939 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6940 required, except when creating a convenience library.
6942 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6943 using \`ar' and \`ranlib', or on Windows using \`lib'.
6945 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6946 is created, otherwise an executable program is created."
6951 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6953 Remove libraries from an installation directory.
6955 RM is the name of the program to use to delete files associated with each FILE
6956 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6959 If FILE is a libtool library, all the files associated with it are deleted.
6960 Otherwise, only FILE itself is deleted using RM."
6964 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6971 $echo "Try \`$modename --help' for more information about other modes."
6975 # The TAGs below are defined such that we never get into a situation
6976 # in which we disable both kinds of libraries. Given conflicting
6977 # choices, we go for a static library, that is the most portable,
6978 # since we can't tell whether shared libraries were disabled because
6979 # the user asked for that or because the platform doesn't support
6980 # them. This is particularly important on AIX, because we don't
6981 # support having both static and shared libraries enabled at the same
6982 # time on that platform, so we default to a shared-only configuration.
6983 # If a disable-shared tag is given, we'll fallback to a static-only
6984 # configuration. But we'll never go from static-only to shared-only.
6986 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6988 # ### END LIBTOOL TAG CONFIG: disable-shared
6990 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6992 # ### END LIBTOOL TAG CONFIG: disable-static