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
5 # 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.
27 # This file is distributed with OpenLDAP Software, which contains a
28 # configuration script generated by Autoconf, and is distributable
29 # under the same distributions terms as OpenLDAP inself.
31 ## Copyright 1998-2007 The OpenLDAP Foundation.
32 ## All rights reserved.
34 ## Redistribution and use in source and binary forms, with or without
35 ## modification, are permitted only as authorized by the OpenLDAP
38 ## A copy of this license is available in the file LICENSE in the
39 ## top-level directory of the distribution or, alternatively, at
40 ## <http://www.OpenLDAP.org/license.html>.
44 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
45 # is ksh but when the shell is invoked as "sh" and the current value of
46 # the _XPG environment variable is not equal to 1 (one), the special
47 # positional parameter $0, within a function call, is the name of the
51 # The name of this program:
52 progname=`echo "$progpath" | $SED $basename`
61 VERSION=1.5.22-OpenLDAP
62 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
64 # See if we are running on zsh, and set the options which allow our
65 # commands through without removal of \ escapes.
66 if test -n "${ZSH_VERSION+set}" ; then
70 # Check that we have a working $echo.
71 if test "X$1" = X--no-reexec; then
72 # Discard the --no-reexec flag, and continue.
74 elif test "X$1" = X--fallback-echo; then
75 # Avoid inline document here, it may be left over
77 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
78 # Yippee, $echo works!
81 # Restart under the correct shell, and then maybe $echo will work.
82 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
85 if test "X$1" = X--fallback-echo; then
86 # used as fallback echo
95 help="Try \`$progname --help' for more information."
96 magic="%%%MAGIC variable%%%"
101 # Sed substitution that helps us do robust quoting. It backslashifies
102 # metacharacters that are still active within double-quoted strings.
103 Xsed="${SED}"' -e 1s/^X//'
104 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
105 # test EBCDIC or ASCII
106 case `echo X|tr X '\101'` in
107 A) # ASCII based system
108 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
110 NL2SP='tr \015\012 \040\040'
112 *) # EBCDIC based system
114 NL2SP='tr \r\n \100\100'
119 # Only set LANG and LC_ALL to C if already set.
120 # These must not be set unconditionally because not all systems understand
121 # e.g. LANG=C (notably SCO).
122 # We save the old values to restore during execute mode.
123 if test "${LC_ALL+set}" = set; then
124 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
126 if test "${LANG+set}" = set; then
127 save_LANG="$LANG"; LANG=C; export LANG
130 # Make sure IFS has a sensible default
135 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
136 $echo "$modename: not configured to build any kind of library" 1>&2
137 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
152 lo2o="s/\\.lo\$/.${objext}/"
153 o2lo="s/\\.${objext}\$/.lo/"
155 #####################################
156 # Shell function definitions:
157 # This seems to be the best place for them
159 # func_mktempdir [string]
160 # Make a temporary directory that won't clash with other running
161 # libtool processes, and avoids race conditions if possible. If
162 # given, STRING is the basename for that directory.
165 my_template="${TMPDIR-/tmp}/${1-$progname}"
167 if test "$run" = ":"; then
168 # Return a directory name, but don't create it in dry-run mode
169 my_tmpdir="${my_template}-$$"
172 # If mktemp works, use that first and foremost
173 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
175 if test ! -d "$my_tmpdir"; then
176 # Failing that, at least try and use $RANDOM to avoid a race
177 my_tmpdir="${my_template}-${RANDOM-0}$$"
179 save_mktempdir_umask=`umask`
182 umask $save_mktempdir_umask
185 # If we're not in dry-run mode, bomb out on failure
186 test -d "$my_tmpdir" || {
187 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
192 $echo "X$my_tmpdir" | $Xsed
196 # func_win32_libid arg
197 # return the library type of file 'arg'
199 # Need a lot of goo to handle *both* DLLs and import libs
200 # Has to be a shell function in order to 'eat' the argument
201 # that is supplied when $file_magic_command is called.
204 win32_libid_type="unknown"
205 win32_fileres=`file -L $1 2>/dev/null`
206 case $win32_fileres in
207 *ar\ archive\ import\ library*) # definitely import
208 win32_libid_type="x86 archive import"
210 *ar\ archive*) # could be an import, or static
211 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
212 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
213 win32_nmres=`eval $NM -f posix -A $1 | \
214 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
216 import*) win32_libid_type="x86 archive import";;
217 *) win32_libid_type="x86 archive static";;
222 win32_libid_type="x86 DLL"
224 *executable*) # but shell scripts are "executable" too...
225 case $win32_fileres in
226 *MS\ Windows\ PE\ Intel*)
227 win32_libid_type="x86 DLL"
232 $echo $win32_libid_type
237 # Infer tagged configuration to use if any are available and
238 # if one wasn't chosen via the "--tag" command line option.
239 # Only attempt this if the compiler in the base compile
240 # command doesn't match the default compiler.
241 # arg is usually of the form 'gcc ...'
244 # FreeBSD-specific: where we install compilers with non-standard names
245 tag_compilers_CC="*cc cc* *gcc gcc*"
246 tag_compilers_CXX="*c++ c++* *g++ g++*"
247 base_compiler=`set -- "$@"; echo $1`
249 # If $tagname isn't set, then try to infer if the default "CC" tag applies
250 if test -z "$tagname"; then
251 for zp in $tag_compilers_CC; do
252 case $base_compiler in
253 $zp) tagname="CC"; break;;
258 if test -n "$available_tags" && test -z "$tagname"; then
262 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
266 CC_quoted="$CC_quoted $arg"
269 # Blanks in the command may have been stripped by the calling shell,
270 # but not from the CC environment variable when configure was run.
271 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
272 # Blanks at the start of $base_compile will cause this to fail
273 # if we don't check for them as well.
275 for z in $available_tags; do
276 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
277 # Evaluate the configuration.
278 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
281 # Double-quote args containing other shell metacharacters.
283 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
287 CC_quoted="$CC_quoted $arg"
290 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
291 # The compiler in the base compile command matches
292 # the one in the tagged configuration.
293 # Assume this is the tagged configuration we want.
299 # FreeBSD-specific: try compilers based on inferred tag
300 if test -z "$tagname"; then
301 eval "tag_compilers=\$tag_compilers_${z}"
302 if test -n "$tag_compilers"; then
303 for zp in $tag_compilers; do
304 case $base_compiler in
305 $zp) tagname=$z; break;;
308 if test -n "$tagname"; then
315 # If $tagname still isn't set, then no tagged configuration
316 # was found and let the user know that the "--tag" command
317 # line option must be used.
318 if test -z "$tagname"; then
319 $echo "$modename: unable to infer tagged configuration"
320 $echo "$modename: specify a tag with \`--tag'" 1>&2
323 # $echo "$modename: using $tagname tagged configuration"
331 # func_extract_an_archive dir oldlib
332 func_extract_an_archive ()
334 f_ex_an_ar_dir="$1"; shift
335 f_ex_an_ar_oldlib="$1"
337 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
338 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
339 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
342 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
347 # func_extract_archives gentop oldlib ...
348 func_extract_archives ()
350 my_gentop="$1"; shift
358 $show "${rm}r $my_gentop"
359 $run ${rm}r "$my_gentop"
360 $show "$mkdir $my_gentop"
361 $run $mkdir "$my_gentop"
363 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
367 for my_xlib in $my_oldlibs; do
368 # Extract the objects.
370 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
371 *) my_xabs=`pwd`"/$my_xlib" ;;
373 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
374 my_xdir="$my_gentop/$my_xlib"
376 $show "${rm}r $my_xdir"
377 $run ${rm}r "$my_xdir"
378 $show "$mkdir $my_xdir"
379 $run $mkdir "$my_xdir"
381 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
386 $show "Extracting $my_xabs"
387 # Do not bother doing anything if just a dry run
388 if test -z "$run"; then
389 darwin_orig_dir=`pwd`
390 cd $my_xdir || exit $?
391 darwin_archive=$my_xabs
393 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
394 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
395 if test -n "$darwin_arches"; then
396 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
398 $show "$darwin_base_archive has multiple architectures $darwin_arches"
399 for darwin_arch in $darwin_arches ; do
400 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
401 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
402 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
403 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
405 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
406 done # $darwin_arches
407 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
408 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
411 for darwin_file in $darwin_filelist; do
412 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
413 lipo -create -output "$darwin_file" $darwin_files
414 done # $darwin_filelist
416 cd "$darwin_orig_dir"
418 cd "$darwin_orig_dir"
419 func_extract_an_archive "$my_xdir" "$my_xabs"
424 func_extract_an_archive "$my_xdir" "$my_xabs"
427 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
429 func_extract_archives_result="$my_oldobjs"
431 # End of Shell function definitions
432 #####################################
435 eval std_shrext=\"$shrext_cmds\"
439 # Parse our command line options once, thoroughly.
440 while test "$#" -gt 0
446 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
450 # If the previous option needs an argument, assign it.
451 if test -n "$prev"; then
454 execute_dlfiles="$execute_dlfiles $arg"
458 preserve_args="${preserve_args}=$arg"
460 # Check whether tagname contains only valid characters
463 $echo "$progname: invalid tag name: $tagname" 1>&2
470 # Don't test for the "default" C tag, as we know, it's there, but
471 # not specially marked.
474 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
475 taglist="$taglist $tagname"
476 # Evaluate the configuration.
477 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
479 $echo "$progname: ignoring unknown tag $tagname" 1>&2
494 # Have we seen a non-optional argument yet?
501 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
503 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
504 $echo "This is free software; see the source for copying conditions. There is NO"
505 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
510 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
511 # Now print the configurations for the tags.
512 for tagname in $taglist; do
513 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
519 $echo "$progname: enabling shell trace mode"
521 preserve_args="$preserve_args $arg"
530 if test "$build_libtool_libs" = yes; then
531 $echo "enable shared libraries"
533 $echo "disable shared libraries"
535 if test "$build_old_libs" = yes; then
536 $echo "enable static libraries"
538 $echo "disable static libraries"
543 --finish) mode="finish" ;;
545 --mode) prevopt="--mode" prev=mode ;;
546 --mode=*) mode="$optarg" ;;
548 --preserve-dup-deps) duplicate_deps="yes" ;;
552 preserve_args="$preserve_args $arg"
558 preserve_args="$preserve_args --tag"
561 set tag "$optarg" ${1+"$@"}
564 preserve_args="$preserve_args --tag"
573 $echo "$modename: unrecognized option \`$arg'" 1>&2
585 if test -n "$prevopt"; then
586 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
591 case $disable_libs in
595 build_libtool_libs=no
599 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
603 # If this variable is set in any of the actions, the command in it
604 # will be execed at the end. This prevents here-documents from being
605 # left over by shells.
608 if test -z "$show_help"; then
610 # Infer the operation mode.
611 if test -z "$mode"; then
612 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
613 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
615 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
627 *db | *dbx | *strace | *truss)
637 # If we have no mode, but dlfiles were specified, then do execute mode.
638 test -n "$execute_dlfiles" && mode=execute
640 # Just use the default operation mode.
641 if test -z "$mode"; then
642 if test -n "$nonopt"; then
643 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
645 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
652 # Only execute mode is allowed to have -dlopen flags.
653 if test -n "$execute_dlfiles" && test "$mode" != execute; then
654 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
659 # Change the help message to a mode-specific one.
661 help="Try \`$modename --help --mode=$mode' for more information."
663 # These modes are in order of execution frequency so that they run quickly.
665 # libtool compile mode
667 modename="$modename: compile"
668 # Get the compilation command and the source file.
670 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
681 # do not "continue". Instead, add this to base_compile
693 # Accept any command-line options.
696 if test -n "$libobj" ; then
697 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
704 -static | -prefer-pic | -prefer-non-pic)
715 arg_mode=arg # the next one goes into the "base_compile" arg list
716 continue # The current "srcfile" will either be retained or
717 ;; # replaced later. I would guess that would be a bug.
720 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
722 save_ifs="$IFS"; IFS=','
726 # Double-quote args containing other shell metacharacters.
727 # Many Bourne shells cannot handle close brackets correctly
728 # in scan sets, so we specify it separately.
730 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
734 lastarg="$lastarg $arg"
737 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
739 # Add the arguments to base_compile.
740 base_compile="$base_compile $lastarg"
745 # Accept the current argument as the source file.
746 # The previous "srcfile" becomes the current argument.
753 esac # case $arg_mode
755 # Aesthetically quote the previous argument.
756 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
759 # Double-quote args containing other shell metacharacters.
760 # Many Bourne shells cannot handle close brackets correctly
761 # in scan sets, and some SunOS ksh mistreat backslash-escaping
762 # in scan sets (worked around with variable expansion),
763 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
764 # at all, so we specify them separately.
765 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
766 lastarg="\"$lastarg\""
770 base_compile="$base_compile $lastarg"
775 $echo "$modename: you must specify an argument for -Xcompile"
779 $echo "$modename: you must specify a target with \`-o'" 1>&2
783 # Get the name of the library object.
784 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
788 # Recognize several different file suffixes.
789 # If the user specifies -o file.o, it is replaced with file.lo
799 *.class) xform=class ;;
804 *.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 "$progpath" "$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)
1186 if test "X$arg" = "X-all-static"; then
1187 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1188 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1190 if test -n "$link_static_flag"; then
1191 dlopen_self=$dlopen_self_static
1193 prefer_static_libs=yes
1195 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1196 dlopen_self=$dlopen_self_static
1198 prefer_static_libs=built
1200 build_libtool_libs=no
1207 # See if our shared archives depend on static archives.
1208 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1210 # Go through the arguments, transforming them on the way.
1211 while test "$#" -gt 0; do
1215 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1216 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220 libtool_args="$libtool_args $qarg"
1222 # If the previous option needs an argument, assign it.
1223 if test -n "$prev"; then
1226 compile_command="$compile_command @OUTPUT@"
1227 finalize_command="$finalize_command @OUTPUT@"
1233 if test "$preload" = no; then
1234 # Add the symbol object into the linking commands.
1235 compile_command="$compile_command @SYMFILE@"
1236 finalize_command="$finalize_command @SYMFILE@"
1240 *.la | *.lo) ;; # We handle these cases below.
1242 if test "$dlself" = no; then
1250 if test "$prev" = dlprefiles; then
1252 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1262 if test "$prev" = dlfiles; then
1263 dlfiles="$dlfiles $arg"
1265 dlprefiles="$dlprefiles $arg"
1273 export_symbols="$arg"
1274 if test ! -f "$arg"; then
1275 $echo "$modename: symbol file \`$arg' does not exist"
1282 export_symbols_regex="$arg"
1287 inst_prefix_dir="$arg"
1292 precious_files_regex="$arg"
1302 if test -f "$arg"; then
1305 for fil in `cat $save_arg`
1307 # moreargs="$moreargs $fil"
1309 # A libtool-controlled object.
1311 # Check to see that this really is a libtool object.
1312 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1317 # If there is no directory component, then add one.
1319 */* | *\\*) . $arg ;;
1323 if test -z "$pic_object" || \
1324 test -z "$non_pic_object" ||
1325 test "$pic_object" = none && \
1326 test "$non_pic_object" = none; then
1327 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331 # Extract subdirectory from the argument.
1332 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1333 if test "X$xdir" = "X$arg"; then
1339 if test "$pic_object" != none; then
1340 # Prepend the subdirectory the object is found in.
1341 pic_object="$xdir$pic_object"
1343 if test "$prev" = dlfiles; then
1344 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1345 dlfiles="$dlfiles $pic_object"
1349 # If libtool objects are unsupported, then we need to preload.
1354 # CHECK ME: I think I busted this. -Ossama
1355 if test "$prev" = dlprefiles; then
1356 # Preload the old-style object.
1357 dlprefiles="$dlprefiles $pic_object"
1362 libobjs="$libobjs $pic_object"
1367 if test "$non_pic_object" != none; then
1368 # Prepend the subdirectory the object is found in.
1369 non_pic_object="$xdir$non_pic_object"
1371 # A standard non-PIC object
1372 non_pic_objects="$non_pic_objects $non_pic_object"
1373 if test -z "$pic_object" || test "$pic_object" = none ; then
1374 arg="$non_pic_object"
1377 # If the PIC object exists, use it instead.
1378 # $xdir was prepended to $pic_object above.
1379 non_pic_object="$pic_object"
1380 non_pic_objects="$non_pic_objects $non_pic_object"
1383 # Only an error if not doing a dry-run.
1384 if test -z "$run"; then
1385 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1390 # Extract subdirectory from the argument.
1391 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1392 if test "X$xdir" = "X$arg"; then
1398 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1399 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1400 libobjs="$libobjs $pic_object"
1401 non_pic_objects="$non_pic_objects $non_pic_object"
1406 $echo "$modename: link input file \`$save_arg' does not exist"
1414 # We need an absolute path.
1416 [\\/]* | [A-Za-z]:[\\/]*) ;;
1418 $echo "$modename: only absolute run-paths are allowed" 1>&2
1422 if test "$prev" = rpath; then
1425 *) rpath="$rpath $arg" ;;
1430 *) xrpath="$xrpath $arg" ;;
1437 compiler_flags="$compiler_flags $qarg"
1439 compile_command="$compile_command $qarg"
1440 finalize_command="$finalize_command $qarg"
1444 linker_flags="$linker_flags $qarg"
1445 compiler_flags="$compiler_flags $wl$qarg"
1447 compile_command="$compile_command $wl$qarg"
1448 finalize_command="$finalize_command $wl$qarg"
1452 linker_flags="$linker_flags $qarg"
1453 compiler_flags="$compiler_flags $qarg"
1455 compile_command="$compile_command $qarg"
1456 finalize_command="$finalize_command $qarg"
1464 darwin_framework|darwin_framework_skip)
1465 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1466 compile_command="$compile_command $arg"
1467 finalize_command="$finalize_command $arg"
1472 eval "$prev=\"\$arg\""
1477 fi # test -n "$prev"
1483 if test -n "$link_static_flag"; then
1484 compile_command="$compile_command $link_static_flag"
1485 finalize_command="$finalize_command $link_static_flag"
1491 # FIXME: remove this flag sometime in the future.
1492 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1516 -export-symbols | -export-symbols-regex)
1517 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1518 $echo "$modename: more than one -exported-symbols argument is not allowed"
1521 if test "X$arg" = "X-export-symbols"; then
1529 -framework|-arch|-isysroot)
1531 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1532 prev=darwin_framework_skip ;;
1533 *) compiler_flags="$compiler_flags $arg"
1534 prev=darwin_framework ;;
1536 compile_command="$compile_command $arg"
1537 finalize_command="$finalize_command $arg"
1546 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1547 # so, if we see these flags be careful not to treat them like -L
1549 case $with_gcc/$host in
1550 no/*-*-irix* | /*-*-irix*)
1551 compile_command="$compile_command $arg"
1552 finalize_command="$finalize_command $arg"
1559 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1560 # We need an absolute path.
1562 [\\/]* | [A-Za-z]:[\\/]*) ;;
1564 absdir=`cd "$dir" && pwd`
1565 if test -z "$absdir"; then
1566 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1568 notinst_path="$notinst_path $dir"
1576 deplibs="$deplibs -L$dir"
1577 lib_search_path="$lib_search_path $dir"
1581 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1582 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1583 case :$dllsearchpath: in
1585 *) dllsearchpath="$dllsearchpath:$dir";;
1587 case :$dllsearchpath: in
1588 *":$testbindir:"*) ;;
1589 *) dllsearchpath="$dllsearchpath:$testbindir";;
1597 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1599 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1600 # These systems don't actually have a C or math library (as such)
1604 # These systems don't actually have a C library (as such)
1605 test "X$arg" = "X-lc" && continue
1607 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1608 # Do not include libc due to us having libc/libc_r.
1609 test "X$arg" = "X-lc" && continue
1611 *-*-rhapsody* | *-*-darwin1.[012])
1612 # Rhapsody C and math libraries are in the System framework
1613 deplibs="$deplibs -framework System"
1616 *-*-sco3.2v5* | *-*-sco5v6*)
1617 # Causes problems with __ctype
1618 test "X$arg" = "X-lc" && continue
1620 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1621 # Compiler inserts libc in the correct place for threads to work
1622 test "X$arg" = "X-lc" && continue
1625 elif test "X$arg" = "X-lc_r"; then
1627 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1628 # Do not include libc_r directly, use -pthread flag.
1633 deplibs="$deplibs $arg"
1637 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1638 # classes, name mangling, and exception handling.
1640 compile_command="$compile_command $arg"
1641 compiler_flags="$compiler_flags $arg"
1642 finalize_command="$finalize_command $arg"
1647 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1648 compiler_flags="$compiler_flags $arg"
1649 compile_command="$compile_command $arg"
1650 finalize_command="$finalize_command $arg"
1651 deplibs="$deplibs $arg"
1660 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1661 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1662 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1663 # +DA*, +DD* enable 64-bit mode on the HP compiler
1664 # -q* pass through compiler args for the IBM compiler
1665 # -m* pass through architecture-specific compiler args for GCC
1666 # -m*, -t[45]*, -txscale* pass through architecture-specific
1667 # compiler args for GCC
1668 # -pg pass through profiling flag for GCC
1669 # @file GCC response files
1670 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1671 -t[45]*|-txscale*|@*)
1673 # Unknown arguments in both finalize_command and compile_command need
1674 # to be aesthetically quoted because they are evaled later.
1675 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1677 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1681 compile_command="$compile_command $arg"
1682 finalize_command="$finalize_command $arg"
1683 compiler_flags="$compiler_flags $arg"
1699 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1700 # The PATH hackery in wrapper scripts is required on Windows
1701 # in order for the loader to find any dlls it needs.
1702 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1703 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1706 *) no_install=yes ;;
1723 -precious-files-regex)
1744 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1745 # We need an absolute path.
1747 [\\/]* | [A-Za-z]:[\\/]*) ;;
1749 $echo "$modename: only absolute run-paths are allowed" 1>&2
1755 *) xrpath="$xrpath $dir" ;;
1761 # The effects of -static are defined in a previous loop.
1762 # We used to do the same as -all-static on platforms that
1763 # didn't have a PIC flag, but the assumption that the effects
1764 # would be equivalent was wrong. It would break on at least
1765 # Digital Unix and AIX.
1785 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1787 save_ifs="$IFS"; IFS=','
1788 for flag in $args; do
1791 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1796 compiler_flags="$compiler_flags $flag"
1799 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1803 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1805 save_ifs="$IFS"; IFS=','
1806 for flag in $args; do
1809 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1814 compiler_flags="$compiler_flags $wl$flag"
1815 linker_flags="$linker_flags $flag"
1818 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1836 # Some other compiler flag.
1838 # Unknown arguments in both finalize_command and compile_command need
1839 # to be aesthetically quoted because they are evaled later.
1840 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1842 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1849 # A standard object.
1854 # A libtool-controlled object.
1856 # Check to see that this really is a libtool object.
1857 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1862 # If there is no directory component, then add one.
1864 */* | *\\*) . $arg ;;
1868 if test -z "$pic_object" || \
1869 test -z "$non_pic_object" ||
1870 test "$pic_object" = none && \
1871 test "$non_pic_object" = none; then
1872 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1876 # Extract subdirectory from the argument.
1877 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1878 if test "X$xdir" = "X$arg"; then
1884 if test "$pic_object" != none; then
1885 # Prepend the subdirectory the object is found in.
1886 pic_object="$xdir$pic_object"
1888 if test "$prev" = dlfiles; then
1889 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1890 dlfiles="$dlfiles $pic_object"
1894 # If libtool objects are unsupported, then we need to preload.
1899 # CHECK ME: I think I busted this. -Ossama
1900 if test "$prev" = dlprefiles; then
1901 # Preload the old-style object.
1902 dlprefiles="$dlprefiles $pic_object"
1907 libobjs="$libobjs $pic_object"
1912 if test "$non_pic_object" != none; then
1913 # Prepend the subdirectory the object is found in.
1914 non_pic_object="$xdir$non_pic_object"
1916 # A standard non-PIC object
1917 non_pic_objects="$non_pic_objects $non_pic_object"
1918 if test -z "$pic_object" || test "$pic_object" = none ; then
1919 arg="$non_pic_object"
1922 # If the PIC object exists, use it instead.
1923 # $xdir was prepended to $pic_object above.
1924 non_pic_object="$pic_object"
1925 non_pic_objects="$non_pic_objects $non_pic_object"
1928 # Only an error if not doing a dry-run.
1929 if test -z "$run"; then
1930 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1935 # Extract subdirectory from the argument.
1936 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1937 if test "X$xdir" = "X$arg"; then
1943 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1944 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1945 libobjs="$libobjs $pic_object"
1946 non_pic_objects="$non_pic_objects $non_pic_object"
1953 deplibs="$deplibs $arg"
1954 old_deplibs="$old_deplibs $arg"
1959 # A libtool-controlled library.
1961 if test "$prev" = dlfiles; then
1962 # This library was specified with -dlopen.
1963 dlfiles="$dlfiles $arg"
1965 elif test "$prev" = dlprefiles; then
1966 # The library was specified with -dlpreopen.
1967 dlprefiles="$dlprefiles $arg"
1970 deplibs="$deplibs $arg"
1975 # Some other compiler argument.
1977 # Unknown arguments in both finalize_command and compile_command need
1978 # to be aesthetically quoted because they are evaled later.
1979 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1981 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1988 # Now actually substitute the argument into the commands.
1989 if test -n "$arg"; then
1990 compile_command="$compile_command $arg"
1991 finalize_command="$finalize_command $arg"
1993 done # argument parsing loop
1995 if test -n "$prev"; then
1996 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2001 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2002 eval arg=\"$export_dynamic_flag_spec\"
2003 compile_command="$compile_command $arg"
2004 finalize_command="$finalize_command $arg"
2008 # calculate the name of the file, without its directory
2009 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2010 libobjs_save="$libobjs"
2012 if test -n "$shlibpath_var"; then
2013 # get the directories listed in $shlibpath_var
2014 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2018 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2019 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2021 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2022 if test "X$output_objdir" = "X$output"; then
2023 output_objdir="$objdir"
2025 output_objdir="$output_objdir/$objdir"
2027 # Create the object directory.
2028 if test ! -d "$output_objdir"; then
2029 $show "$mkdir $output_objdir"
2030 $run $mkdir $output_objdir
2032 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2037 # Determine the type of output
2040 $echo "$modename: you must specify an output file" 1>&2
2044 *.$libext) linkmode=oldlib ;;
2045 *.lo | *.$objext) linkmode=obj ;;
2046 *.la) linkmode=lib ;;
2047 *) linkmode=prog ;; # Anything else should be a program.
2051 *cygwin* | *mingw* | *pw32*)
2052 # don't eliminate duplications in $postdeps and $predeps
2053 duplicate_compiler_generated_deps=yes
2056 duplicate_compiler_generated_deps=$duplicate_deps
2062 # Find all interdependent deplibs by searching for libraries
2063 # that are linked more than once (e.g. -la -lb -la)
2064 for deplib in $deplibs; do
2065 if test "X$duplicate_deps" = "Xyes" ; then
2067 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2070 libs="$libs $deplib"
2073 if test "$linkmode" = lib; then
2074 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2076 # Compute libraries that are listed more than once in $predeps
2077 # $postdeps and mark them as special (i.e., whose duplicates are
2078 # not to be eliminated).
2080 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2081 for pre_post_dep in $predeps $postdeps; do
2082 case "$pre_post_deps " in
2083 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2085 pre_post_deps="$pre_post_deps $pre_post_dep"
2094 need_relink=no # whether we're linking any uninstalled libtool libraries
2095 notinst_deplibs= # not-installed libtool libraries
2099 for file in $dlfiles $dlprefiles; do
2103 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2115 passes="conv scan dlopen dlpreopen link"
2120 for pass in $passes; do
2121 if test "$linkmode,$pass" = "lib,link" ||
2122 test "$linkmode,$pass" = "prog,scan"; then
2126 if test "$linkmode" = prog; then
2128 dlopen) libs="$dlfiles" ;;
2129 dlpreopen) libs="$dlprefiles" ;;
2130 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2133 if test "$pass" = dlopen; then
2134 # Collect dlpreopened libraries
2135 save_deplibs="$deplibs"
2138 for deplib in $libs; do
2142 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2143 if test "$linkmode,$pass" = "prog,link"; then
2144 compile_deplibs="$deplib $compile_deplibs"
2145 finalize_deplibs="$deplib $finalize_deplibs"
2147 compiler_flags="$compiler_flags $deplib"
2152 deplibs="$deplib $deplibs"
2153 test "$pass" = conv && continue
2154 newdependency_libs="$deplib $newdependency_libs"
2157 if test "$pass" = conv; then
2158 deplibs="$deplib $deplibs"
2161 if test "$pass" = scan; then
2162 deplibs="$deplib $deplibs"
2164 compile_deplibs="$deplib $compile_deplibs"
2165 finalize_deplibs="$deplib $finalize_deplibs"
2175 if test "$linkmode" != lib && test "$linkmode" != prog; then
2176 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2179 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2180 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2181 for search_ext in .la $std_shrext .so .a; do
2182 # Search the libtool library
2183 lib="$searchdir/lib${name}${search_ext}"
2184 if test -f "$lib"; then
2185 if test "$search_ext" = ".la"; then
2194 if test "$found" != yes; then
2195 # deplib doesn't seem to be a libtool library
2196 if test "$linkmode,$pass" = "prog,link"; then
2197 compile_deplibs="$deplib $compile_deplibs"
2198 finalize_deplibs="$deplib $finalize_deplibs"
2200 deplibs="$deplib $deplibs"
2201 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2204 else # deplib is a libtool library
2205 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2206 # We need to do some special things here, and not later.
2207 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2208 case " $predeps $postdeps " in
2210 if (${SED} -e '2q' $lib |
2211 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2215 */* | *\\*) . $lib ;;
2218 for l in $old_library $library_names; do
2221 if test "X$ll" = "X$old_library" ; then # only static version available
2223 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2224 test "X$ladir" = "X$lib" && ladir="."
2225 lib=$ladir/$old_library
2226 if test "$linkmode,$pass" = "prog,link"; then
2227 compile_deplibs="$deplib $compile_deplibs"
2228 finalize_deplibs="$deplib $finalize_deplibs"
2230 deplibs="$deplib $deplibs"
2231 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2245 deplibs="$deplib $deplibs"
2246 test "$pass" = conv && continue
2247 newdependency_libs="$deplib $newdependency_libs"
2248 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2251 if test "$pass" = conv; then
2252 deplibs="$deplib $deplibs"
2255 if test "$pass" = scan; then
2256 deplibs="$deplib $deplibs"
2258 compile_deplibs="$deplib $compile_deplibs"
2259 finalize_deplibs="$deplib $finalize_deplibs"
2261 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2264 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2270 if test "$pass" = link; then
2271 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2272 # Make sure the xrpath contains only unique directories.
2275 *) xrpath="$xrpath $dir" ;;
2278 deplibs="$deplib $deplibs"
2281 *.la) lib="$deplib" ;;
2283 if test "$pass" = conv; then
2284 deplibs="$deplib $deplibs"
2290 case $deplibs_check_method in
2292 set dummy $deplibs_check_method
2293 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2294 if eval $echo \"$deplib\" 2>/dev/null \
2296 | $EGREP "$match_pattern_regex" > /dev/null; then
2304 if test "$valid_a_lib" != yes; then
2306 $echo "*** Warning: Trying to link with static lib archive $deplib."
2307 $echo "*** I have the capability to make that library automatically link in when"
2308 $echo "*** you link to this library. But I can only do this if you have a"
2309 $echo "*** shared version of the library, which you do not appear to have"
2310 $echo "*** because the file extensions .$libext of this argument makes me believe"
2311 $echo "*** that it is just a static archive that I should not used here."
2314 $echo "*** Warning: Linking the shared library $output against the"
2315 $echo "*** static library $deplib is not portable!"
2316 deplibs="$deplib $deplibs"
2321 if test "$pass" != link; then
2322 deplibs="$deplib $deplibs"
2324 compile_deplibs="$deplib $compile_deplibs"
2325 finalize_deplibs="$deplib $finalize_deplibs"
2332 if test "$pass" = conv; then
2333 deplibs="$deplib $deplibs"
2334 elif test "$linkmode" = prog; then
2335 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2336 # If there is no dlopen support or we're linking statically,
2337 # we need to preload.
2338 newdlprefiles="$newdlprefiles $deplib"
2339 compile_deplibs="$deplib $compile_deplibs"
2340 finalize_deplibs="$deplib $finalize_deplibs"
2342 newdlfiles="$newdlfiles $deplib"
2352 if test "$found" = yes || test -f "$lib"; then :
2354 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2358 # Check to see that this really is a libtool archive.
2359 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2361 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2365 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2366 test "X$ladir" = "X$lib" && ladir="."
2374 # If the library was installed with an old release of libtool,
2375 # it will not redefine variables installed, or shouldnotlink
2383 */* | *\\*) . $lib ;;
2387 if test "$linkmode,$pass" = "lib,link" ||
2388 test "$linkmode,$pass" = "prog,scan" ||
2389 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2390 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2391 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2394 if test "$pass" = conv; then
2395 # Only check for convenience libraries
2396 deplibs="$lib $deplibs"
2397 if test -z "$libdir"; then
2398 if test -z "$old_library"; then
2399 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2402 # It is a libtool convenience library, so add in its objects.
2403 convenience="$convenience $ladir/$objdir/$old_library"
2404 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2406 for deplib in $dependency_libs; do
2407 deplibs="$deplib $deplibs"
2408 if test "X$duplicate_deps" = "Xyes" ; then
2409 case "$tmp_libs " in
2410 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2413 tmp_libs="$tmp_libs $deplib"
2415 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2416 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2423 # Get the name of the library we link against.
2425 for l in $old_library $library_names; do
2428 if test -z "$linklib"; then
2429 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2433 # This library was specified with -dlopen.
2434 if test "$pass" = dlopen; then
2435 if test -z "$libdir"; then
2436 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2439 if test -z "$dlname" ||
2440 test "$dlopen_support" != yes ||
2441 test "$build_libtool_libs" = no; then
2442 # If there is no dlname, no dlopen support or we're linking
2443 # statically, we need to preload. We also need to preload any
2444 # dependent libraries so libltdl's deplib preloader doesn't
2445 # bomb out in the load deplibs phase.
2446 dlprefiles="$dlprefiles $lib $dependency_libs"
2448 newdlfiles="$newdlfiles $lib"
2453 # We need an absolute path.
2455 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2457 abs_ladir=`cd "$ladir" && pwd`
2458 if test -z "$abs_ladir"; then
2459 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2460 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2465 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2467 # Find the relevant object directory and library name.
2468 if test "X$installed" = Xyes; then
2469 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2470 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2478 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2480 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2483 # Remove this search path later
2484 notinst_path="$notinst_path $abs_ladir"
2486 dir="$ladir/$objdir"
2487 absdir="$abs_ladir/$objdir"
2488 # Remove this search path later
2489 notinst_path="$notinst_path $abs_ladir"
2491 fi # $installed = yes
2492 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2494 # This library was specified with -dlpreopen.
2495 if test "$pass" = dlpreopen; then
2496 if test -z "$libdir"; then
2497 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2500 # Prefer using a static library (so that no silly _DYNAMIC symbols
2501 # are required to link).
2502 if test -n "$old_library"; then
2503 newdlprefiles="$newdlprefiles $dir/$old_library"
2504 # Otherwise, use the dlname, so that lt_dlopen finds it.
2505 elif test -n "$dlname"; then
2506 newdlprefiles="$newdlprefiles $dir/$dlname"
2508 newdlprefiles="$newdlprefiles $dir/$linklib"
2510 fi # $pass = dlpreopen
2512 if test -z "$libdir"; then
2513 # Link the convenience library
2514 if test "$linkmode" = lib; then
2515 deplibs="$dir/$old_library $deplibs"
2516 elif test "$linkmode,$pass" = "prog,link"; then
2517 compile_deplibs="$dir/$old_library $compile_deplibs"
2518 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2520 deplibs="$lib $deplibs" # used for prog,scan pass
2526 if test "$linkmode" = prog && test "$pass" != link; then
2527 newlib_search_path="$newlib_search_path $ladir"
2528 deplibs="$lib $deplibs"
2531 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2532 test "$build_libtool_libs" = no; then
2537 for deplib in $dependency_libs; do
2539 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2541 # Need to link against all dependency_libs?
2542 if test "$linkalldeplibs" = yes; then
2543 deplibs="$deplib $deplibs"
2545 # Need to hardcode shared library paths
2546 # or/and link against static libraries
2547 newdependency_libs="$deplib $newdependency_libs"
2549 if test "X$duplicate_deps" = "Xyes" ; then
2550 case "$tmp_libs " in
2551 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2554 tmp_libs="$tmp_libs $deplib"
2557 fi # $linkmode = prog...
2559 if test "$linkmode,$pass" = "prog,link"; then
2560 if test -n "$library_names" &&
2561 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2562 # We need to hardcode the library path
2563 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2564 # Make sure the rpath contains only unique directories.
2565 case "$temp_rpath " in
2568 *) temp_rpath="$temp_rpath $absdir" ;;
2572 # Hardcode the library path.
2573 # Skip directories that are in the system default run-time
2575 case " $sys_lib_dlsearch_path " in
2578 case "$compile_rpath " in
2580 *) compile_rpath="$compile_rpath $absdir"
2584 case " $sys_lib_dlsearch_path " in
2587 case "$finalize_rpath " in
2589 *) finalize_rpath="$finalize_rpath $libdir"
2593 fi # $linkmode,$pass = prog,link...
2595 if test "$alldeplibs" = yes &&
2596 { test "$deplibs_check_method" = pass_all ||
2597 { test "$build_libtool_libs" = yes &&
2598 test -n "$library_names"; }; }; then
2599 # We only need to search for static libraries
2604 link_static=no # Whether the deplib will be linked statically
2605 use_static_libs=$prefer_static_libs
2606 if test "$use_static_libs" = built && test "$installed" = yes ; then
2609 if test -n "$library_names" &&
2610 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2611 if test "$installed" = no; then
2612 notinst_deplibs="$notinst_deplibs $lib"
2615 # This is a shared library
2617 # Warn about portability, can't link against -module's on
2618 # some systems (darwin)
2619 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2621 if test "$linkmode" = prog; then
2622 $echo "*** Warning: Linking the executable $output against the loadable module"
2624 $echo "*** Warning: Linking the shared library $output against the loadable module"
2626 $echo "*** $linklib is not portable!"
2628 if test "$linkmode" = lib &&
2629 test "$hardcode_into_libs" = yes; then
2630 # Hardcode the library path.
2631 # Skip directories that are in the system default run-time
2633 case " $sys_lib_dlsearch_path " in
2636 case "$compile_rpath " in
2638 *) compile_rpath="$compile_rpath $absdir"
2642 case " $sys_lib_dlsearch_path " in
2645 case "$finalize_rpath " in
2647 *) finalize_rpath="$finalize_rpath $libdir"
2653 if test -n "$old_archive_from_expsyms_cmds"; then
2654 # figure out the soname
2655 set dummy $library_names
2658 libname=`eval \\$echo \"$libname_spec\"`
2659 # use dlname if we got it. it's perfectly good, no?
2660 if test -n "$dlname"; then
2662 elif test -n "$soname_spec"; then
2666 major=`expr $current - $age`
2670 eval soname=\"$soname_spec\"
2675 # Make a new name for the extract_expsyms_cmds to use
2677 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2678 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2680 # If the library has no export list, then create one now
2681 if test -f "$output_objdir/$soname-def"; then :
2683 $show "extracting exported symbol list from \`$soname'"
2684 save_ifs="$IFS"; IFS='~'
2685 cmds=$extract_expsyms_cmds
2686 for cmd in $cmds; do
2690 $run eval "$cmd" || exit $?
2696 if test -f "$output_objdir/$newlib"; then :; else
2697 $show "generating import library for \`$soname'"
2698 save_ifs="$IFS"; IFS='~'
2699 cmds=$old_archive_from_expsyms_cmds
2700 for cmd in $cmds; do
2704 $run eval "$cmd" || exit $?
2708 # make sure the library variables are pointing to the new library
2711 fi # test -n "$old_archive_from_expsyms_cmds"
2713 if test "$linkmode" = prog || test "$mode" != relink; then
2718 case $hardcode_action in
2719 immediate | unsupported)
2720 if test "$hardcode_direct" = no; then
2723 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2724 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2725 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2726 *-*-unixware7*) add_dir="-L$dir" ;;
2728 # if the lib is a module then we can not link against
2729 # it, someone is ignoring the new warnings I added
2730 if /usr/bin/file -L $add 2> /dev/null |
2731 $EGREP ": [^:]* bundle" >/dev/null ; then
2732 $echo "** Warning, lib $linklib is a module, not a shared library"
2733 if test -z "$old_library" ; then
2735 $echo "** And there doesn't seem to be a static archive available"
2736 $echo "** The link will probably fail, sorry"
2738 add="$dir/$old_library"
2742 elif test "$hardcode_minus_L" = no; then
2744 *-*-sunos*) add_shlibpath="$dir" ;;
2748 elif test "$hardcode_shlibpath_var" = no; then
2749 add_shlibpath="$dir"
2756 if test "$hardcode_direct" = yes; then
2758 elif test "$hardcode_minus_L" = yes; then
2760 # Try looking first in the location we're being installed to.
2761 if test -n "$inst_prefix_dir"; then
2764 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2769 elif test "$hardcode_shlibpath_var" = yes; then
2770 add_shlibpath="$dir"
2779 if test "$lib_linked" != yes; then
2780 $echo "$modename: configuration error: unsupported hardcode properties"
2784 if test -n "$add_shlibpath"; then
2785 case :$compile_shlibpath: in
2786 *":$add_shlibpath:"*) ;;
2787 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2790 if test "$linkmode" = prog; then
2791 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2792 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2794 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2795 test -n "$add" && deplibs="$add $deplibs"
2796 if test "$hardcode_direct" != yes && \
2797 test "$hardcode_minus_L" != yes && \
2798 test "$hardcode_shlibpath_var" = yes; then
2799 case :$finalize_shlibpath: in
2801 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2807 if test "$linkmode" = prog || test "$mode" = relink; then
2811 # Finalize command for both is simple: just hardcode it.
2812 if test "$hardcode_direct" = yes; then
2813 add="$libdir/$linklib"
2814 elif test "$hardcode_minus_L" = yes; then
2817 elif test "$hardcode_shlibpath_var" = yes; then
2818 case :$finalize_shlibpath: in
2820 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2823 elif test "$hardcode_automatic" = yes; then
2824 if test -n "$inst_prefix_dir" &&
2825 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2826 add="$inst_prefix_dir$libdir/$linklib"
2828 add="$libdir/$linklib"
2831 # We cannot seem to hardcode it, guess we'll fake it.
2833 # Try looking first in the location we're being installed to.
2834 if test -n "$inst_prefix_dir"; then
2837 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2844 if test "$linkmode" = prog; then
2845 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2846 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2848 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2849 test -n "$add" && deplibs="$add $deplibs"
2852 elif test "$linkmode" = prog; then
2853 # Here we assume that one of hardcode_direct or hardcode_minus_L
2854 # is not unsupported. This is valid on all known static and
2856 if test "$hardcode_direct" != unsupported; then
2857 test -n "$old_library" && linklib="$old_library"
2858 compile_deplibs="$dir/$linklib $compile_deplibs"
2859 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2861 compile_deplibs="-l$name -L$dir $compile_deplibs"
2862 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2864 elif test "$build_libtool_libs" = yes; then
2865 # Not a shared library
2866 if test "$deplibs_check_method" != pass_all; then
2867 # We're trying link a shared library against a static one
2868 # but the system doesn't support it.
2870 # Just print a warning and add the library to dependency_libs so
2871 # that the program can be linked against the static library.
2873 $echo "*** Warning: This system can not link to static lib archive $lib."
2874 $echo "*** I have the capability to make that library automatically link in when"
2875 $echo "*** you link to this library. But I can only do this if you have a"
2876 $echo "*** shared version of the library, which you do not appear to have."
2877 if test "$module" = yes; then
2878 $echo "*** But as you try to build a module library, libtool will still create "
2879 $echo "*** a static module, that should work as long as the dlopening application"
2880 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2881 if test -z "$global_symbol_pipe"; then
2883 $echo "*** However, this would only work if libtool was able to extract symbol"
2884 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2885 $echo "*** not find such a program. So, this module is probably useless."
2886 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2888 if test "$build_old_libs" = no; then
2889 build_libtool_libs=module
2892 build_libtool_libs=no
2896 deplibs="$dir/$old_library $deplibs"
2899 fi # link shared/static library?
2901 if test "$linkmode" = lib; then
2902 if test -n "$dependency_libs" &&
2903 { test "$hardcode_into_libs" != yes ||
2904 test "$build_old_libs" = yes ||
2905 test "$link_static" = yes; }; then
2906 # Extract -R from dependency_libs
2908 for libdir in $dependency_libs; do
2910 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2912 *" $temp_xrpath "*) ;;
2913 *) xrpath="$xrpath $temp_xrpath";;
2915 *) temp_deplibs="$temp_deplibs $libdir";;
2918 dependency_libs="$temp_deplibs"
2921 newlib_search_path="$newlib_search_path $absdir"
2922 # Link against this library
2923 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2924 # ... and its dependency_libs
2926 for deplib in $dependency_libs; do
2927 newdependency_libs="$deplib $newdependency_libs"
2928 if test "X$duplicate_deps" = "Xyes" ; then
2929 case "$tmp_libs " in
2930 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2933 tmp_libs="$tmp_libs $deplib"
2936 if test "$link_all_deplibs" != no; then
2937 # Add the search paths of all dependency libraries
2938 for deplib in $dependency_libs; do
2940 -L*) path="$deplib" ;;
2942 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2943 test "X$dir" = "X$deplib" && dir="."
2944 # We need an absolute path.
2946 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2948 absdir=`cd "$dir" && pwd`
2949 if test -z "$absdir"; then
2950 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2955 if grep "^installed=no" $deplib > /dev/null; then
2956 path="$absdir/$objdir"
2958 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2959 if test -z "$libdir"; then
2960 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2963 if test "$absdir" != "$libdir"; then
2964 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2971 # we do not want to link against static libs,
2972 # but need to link against shared
2973 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2974 if test -n "$deplibrary_names" ; then
2975 for tmp in $deplibrary_names ; do
2978 if test -f "$path/$depdepl" ; then
2979 depdepl="$path/$depdepl"
2981 # do not add paths which are already there
2982 case " $newlib_search_path " in
2984 *) newlib_search_path="$newlib_search_path $path";;
2997 # Again, we only want to link against shared libraries
2998 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2999 for tmp in $newlib_search_path ; do
3000 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3001 eval depdepl="$tmp/lib$tmp_libs.dylib"
3012 case " $deplibs " in
3014 *) deplibs="$path $deplibs" ;;
3016 case " $deplibs " in
3018 *) deplibs="$depdepl $deplibs" ;;
3021 fi # link_all_deplibs != no
3023 done # for deplib in $libs
3024 dependency_libs="$newdependency_libs"
3025 if test "$pass" = dlpreopen; then
3026 # Link the dlpreopened libraries before other libraries
3027 for deplib in $save_deplibs; do
3028 deplibs="$deplib $deplibs"
3031 if test "$pass" != dlopen; then
3032 if test "$pass" != conv; then
3033 # Make sure lib_search_path contains only unique directories.
3035 for dir in $newlib_search_path; do
3036 case "$lib_search_path " in
3038 *) lib_search_path="$lib_search_path $dir" ;;
3044 if test "$linkmode,$pass" != "prog,link"; then
3047 vars="compile_deplibs finalize_deplibs"
3049 for var in $vars dependency_libs; do
3050 # Add libraries to $var in reverse order
3051 eval tmp_libs=\"\$$var\"
3053 for deplib in $tmp_libs; do
3054 # FIXME: Pedantically, this is the right thing to do, so
3055 # that some nasty dependency loop isn't accidentally
3057 #new_libs="$deplib $new_libs"
3058 # Pragmatically, this seems to cause very few problems in
3061 -L*) new_libs="$deplib $new_libs" ;;
3064 # And here is the reason: when a library appears more
3065 # than once as an explicit dependence of a library, or
3066 # is implicitly linked in more than once by the
3067 # compiler, it is considered special, and multiple
3068 # occurrences thereof are not removed. Compare this
3069 # with having the same library being listed as a
3070 # dependency of multiple other libraries: in this case,
3071 # we know (pedantically, we assume) the library does not
3072 # need to be listed more than once, so we keep only the
3073 # last copy. This is not always right, but it is rare
3074 # enough that we require users that really mean to play
3075 # such unportable linking tricks to link the library
3076 # using -Wl,-lname, so that libtool does not consider it
3077 # for duplicate removal.
3078 case " $specialdeplibs " in
3079 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3081 case " $new_libs " in
3083 *) new_libs="$deplib $new_libs" ;;
3091 for deplib in $new_libs; do
3094 case " $tmp_libs " in
3096 *) tmp_libs="$tmp_libs $deplib" ;;
3099 *) tmp_libs="$tmp_libs $deplib" ;;
3102 eval $var=\"$tmp_libs\"
3105 # Last step: remove runtime libs from dependency_libs
3106 # (they stay in deplibs)
3108 for i in $dependency_libs ; do
3109 case " $predeps $postdeps $compiler_lib_search_path " in
3114 if test -n "$i" ; then
3115 tmp_libs="$tmp_libs $i"
3118 dependency_libs=$tmp_libs
3120 if test "$linkmode" = prog; then
3121 dlfiles="$newdlfiles"
3122 dlprefiles="$newdlprefiles"
3127 if test -n "$deplibs"; then
3128 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3131 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3132 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3135 if test -n "$rpath"; then
3136 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3139 if test -n "$xrpath"; then
3140 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3143 if test -n "$vinfo"; then
3144 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3147 if test -n "$release"; then
3148 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3151 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3152 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3155 # Now set the variables for building old libraries.
3156 build_libtool_libs=no
3158 objs="$objs$old_deplibs"
3162 # Make sure we only generate libraries of the form `libNAME.la'.
3165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3166 eval shared_ext=\"$shrext_cmds\"
3167 eval libname=\"$libname_spec\"
3170 if test "$module" = no; then
3171 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3175 if test "$need_lib_prefix" != no; then
3176 # Add the "lib" prefix for modules if required
3177 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3178 eval shared_ext=\"$shrext_cmds\"
3179 eval libname=\"$libname_spec\"
3181 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3186 if test -n "$objs"; then
3187 if test "$deplibs_check_method" != pass_all; then
3188 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3192 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3193 $echo "*** objects $objs is not portable!"
3194 libobjs="$libobjs $objs"
3198 if test "$dlself" != no; then
3199 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3203 if test "$#" -gt 2; then
3204 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3209 if test -z "$rpath"; then
3210 if test "$build_libtool_libs" = yes; then
3211 # Building a libtool convenience library.
3212 # Some compilers have problems with a `.al' extension so
3213 # convenience libraries should have the same extension an
3214 # archive normally would.
3215 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3216 build_libtool_libs=convenience
3220 if test -n "$vinfo"; then
3221 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3224 if test -n "$release"; then
3225 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3229 # Parse the version information argument.
3230 save_ifs="$IFS"; IFS=':'
3231 set dummy $vinfo 0 0 0
3234 if test -n "$8"; then
3235 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3240 # convert absolute version numbers to libtool ages
3241 # this retains compatibility with .la files and attempts
3242 # to make the code below a bit more comprehensible
3244 case $vinfo_number in
3248 number_revision="$4"
3250 # There are really only two kinds -- those that
3251 # use the current revision as the major version
3252 # and those that subtract age and use age as
3253 # a minor version. But, then there is irix
3254 # which has an extra 1 added just for fun
3256 case $version_type in
3257 darwin|linux|osf|windows)
3258 current=`expr $number_major + $number_minor`
3260 revision="$number_revision"
3262 freebsd-aout|freebsd-elf|sunos)
3263 current="$number_major"
3264 revision="$number_minor"
3268 current=`expr $number_major + $number_minor - 1`
3270 revision="$number_minor"
3281 # Check that each of the things are valid numbers.
3283 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]) ;;
3285 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3286 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3292 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]) ;;
3294 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3295 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3301 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]) ;;
3303 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3304 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3309 if test "$age" -gt "$current"; then
3310 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3311 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3315 # Calculate the version variables.
3319 case $version_type in
3323 # Like Linux, but with the current version available in
3324 # verstring for coding it into the library header
3325 major=.`expr $current - $age`
3326 versuffix="$major.$age.$revision"
3327 # Darwin ld doesn't like 0 for these options...
3328 minor_current=`expr $current + 1`
3329 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3334 versuffix=".$current.$revision";
3339 versuffix=".$current";
3343 major=`expr $current - $age + 1`
3345 case $version_type in
3346 nonstopux) verstring_prefix=nonstopux ;;
3347 *) verstring_prefix=sgi ;;
3349 verstring="$verstring_prefix$major.$revision"
3351 # Add in all the interfaces that we are compatible with.
3353 while test "$loop" -ne 0; do
3354 iface=`expr $revision - $loop`
3355 loop=`expr $loop - 1`
3356 verstring="$verstring_prefix$major.$iface:$verstring"
3359 # Before this point, $major must not contain `.'.
3361 versuffix="$major.$revision"
3365 major=.`expr $current - $age`
3366 versuffix="$major.$age.$revision"
3370 major=.`expr $current - $age`
3371 versuffix=".$current.$age.$revision"
3372 verstring="$current.$age.$revision"
3374 # Add in all the interfaces that we are compatible with.
3376 while test "$loop" -ne 0; do
3377 iface=`expr $current - $loop`
3378 loop=`expr $loop - 1`
3379 verstring="$verstring:${iface}.0"
3382 # Make executables depend on our current version.
3383 verstring="$verstring:${current}.0"
3388 versuffix=".$current.$revision"
3392 # Use '-' rather than '.', since we only want one
3393 # extension on DOS 8.3 filesystems.
3394 major=`expr $current - $age`
3399 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3400 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3405 # Clear the version info if we defaulted, and they specified a release.
3406 if test -z "$vinfo" && test -n "$release"; then
3408 case $version_type in
3410 # we can't check for "0.0" in archive_cmds due to quoting
3411 # problems, so we reset it completely
3418 if test "$need_version" = no; then
3425 # Remove version info from name if versioning should be avoided
3426 if test "$avoid_version" = yes && test "$need_version" = no; then
3432 # Check to see if the archive will have undefined symbols.
3433 if test "$allow_undefined" = yes; then
3434 if test "$allow_undefined_flag" = unsupported; then
3435 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3436 build_libtool_libs=no
3440 # Don't allow undefined symbols.
3441 allow_undefined_flag="$no_undefined_flag"
3445 if test "$mode" != relink; then
3446 # Remove our outputs, but don't remove object files since they
3447 # may have been created when compiling PIC objects.
3449 tempremovelist=`$echo "$output_objdir/*"`
3450 for p in $tempremovelist; do
3454 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3455 if test "X$precious_files_regex" != "X"; then
3456 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3461 removelist="$removelist $p"
3466 if test -n "$removelist"; then
3467 $show "${rm}r $removelist"
3468 $run ${rm}r $removelist
3472 # Now set the variables for building old libraries.
3473 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3474 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3476 # Transform .lo files to .o files.
3477 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3480 # Eliminate all temporary directories.
3481 for path in $notinst_path; do
3482 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3483 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3484 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3487 if test -n "$xrpath"; then
3488 # If the user specified any rpath flags, then add them.
3490 for libdir in $xrpath; do
3491 temp_xrpath="$temp_xrpath -R$libdir"
3492 case "$finalize_rpath " in
3494 *) finalize_rpath="$finalize_rpath $libdir" ;;
3497 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3498 dependency_libs="$temp_xrpath $dependency_libs"
3502 # Make sure dlfiles contains only unique files that won't be dlpreopened
3503 old_dlfiles="$dlfiles"
3505 for lib in $old_dlfiles; do
3506 case " $dlprefiles $dlfiles " in
3508 *) dlfiles="$dlfiles $lib" ;;
3512 # Make sure dlprefiles contains only unique files
3513 old_dlprefiles="$dlprefiles"
3515 for lib in $old_dlprefiles; do
3516 case "$dlprefiles " in
3518 *) dlprefiles="$dlprefiles $lib" ;;
3522 if test "$build_libtool_libs" = yes; then
3523 if test -n "$rpath"; then
3525 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3526 # these systems don't actually have a c library (as such)!
3528 *-*-rhapsody* | *-*-darwin1.[012])
3529 # Rhapsody C library is in the System framework
3530 deplibs="$deplibs -framework System"
3533 # Don't link with libc until the a.out ld.so is fixed.
3535 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3536 # Do not include libc due to us having libc/libc_r.
3538 *-*-sco3.2v5* | *-*-sco5v6*)
3539 # Causes problems with __ctype
3541 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3542 # Compiler inserts libc in the correct place for threads to work
3545 # Add libc to deplibs on all other systems if necessary.
3546 if test "$build_libtool_need_lc" = "yes"; then
3547 deplibs="$deplibs -lc"
3553 # Transform deplibs into only deplibs that can be linked in shared.
3555 libname_save=$libname
3556 release_save=$release
3557 versuffix_save=$versuffix
3559 # I'm not sure if I'm treating the release correctly. I think
3560 # release should show up in the -l (ie -lgmp5) so we don't want to
3561 # add it in twice. Is that correct?
3567 case $deplibs_check_method in
3569 # Don't check for shared/static. Everything works.
3570 # This might be a little naive. We might want to check
3571 # whether the library exists or not. But this is on
3572 # osf3 & osf4 and I'm not really sure... Just
3573 # implementing what was already the behavior.
3577 # This code stresses the "libraries are programs" paradigm to its
3578 # limits. Maybe even breaks it. We compile a program, linking it
3579 # against the deplibs as a proxy for the library. Then we can check
3580 # whether they linked in statically or dynamically with ldd.
3582 cat > conftest.c <<EOF
3583 int main() { return 0; }
3586 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3587 if test "$?" -eq 0 ; then
3588 ldd_output=`ldd conftest`
3589 for i in $deplibs; do
3590 name=`expr $i : '-l\(.*\)'`
3591 # If $name is empty we are operating on a -L argument.
3592 if test "$name" != "" && test "$name" -ne "0"; then
3593 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3594 case " $predeps $postdeps " in
3596 newdeplibs="$newdeplibs $i"
3601 if test -n "$i" ; then
3602 libname=`eval \\$echo \"$libname_spec\"`
3603 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3604 set dummy $deplib_matches
3606 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3607 newdeplibs="$newdeplibs $i"
3611 $echo "*** Warning: dynamic linker does not accept needed library $i."
3612 $echo "*** I have the capability to make that library automatically link in when"
3613 $echo "*** you link to this library. But I can only do this if you have a"
3614 $echo "*** shared version of the library, which I believe you do not have"
3615 $echo "*** because a test_compile did reveal that the linker did not use it for"
3616 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3620 newdeplibs="$newdeplibs $i"
3624 # Error occurred in the first compile. Let's try to salvage
3625 # the situation: Compile a separate program for each library.
3626 for i in $deplibs; do
3627 name=`expr $i : '-l\(.*\)'`
3628 # If $name is empty we are operating on a -L argument.
3629 if test "$name" != "" && test "$name" != "0"; then
3631 $LTCC $LTCFLAGS -o conftest conftest.c $i
3633 if test "$?" -eq 0 ; then
3634 ldd_output=`ldd conftest`
3635 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3636 case " $predeps $postdeps " in
3638 newdeplibs="$newdeplibs $i"
3643 if test -n "$i" ; then
3644 libname=`eval \\$echo \"$libname_spec\"`
3645 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3646 set dummy $deplib_matches
3648 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3649 newdeplibs="$newdeplibs $i"
3653 $echo "*** Warning: dynamic linker does not accept needed library $i."
3654 $echo "*** I have the capability to make that library automatically link in when"
3655 $echo "*** you link to this library. But I can only do this if you have a"
3656 $echo "*** shared version of the library, which you do not appear to have"
3657 $echo "*** because a test_compile did reveal that the linker did not use this one"
3658 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3664 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3665 $echo "*** make it link in! You will probably need to install it or some"
3666 $echo "*** library that it depends on before this library will be fully"
3667 $echo "*** functional. Installing it before continuing would be even better."
3670 newdeplibs="$newdeplibs $i"
3676 set dummy $deplibs_check_method
3677 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3678 for a_deplib in $deplibs; do
3679 name=`expr $a_deplib : '-l\(.*\)'`
3680 # If $name is empty we are operating on a -L argument.
3681 if test "$name" != "" && test "$name" != "0"; then
3682 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3683 case " $predeps $postdeps " in
3685 newdeplibs="$newdeplibs $a_deplib"
3690 if test -n "$a_deplib" ; then
3691 libname=`eval \\$echo \"$libname_spec\"`
3692 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3693 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3694 for potent_lib in $potential_libs; do
3695 # Follow soft links.
3696 if ls -lLd "$potent_lib" 2>/dev/null \
3697 | grep " -> " >/dev/null; then
3700 # The statement above tries to avoid entering an
3701 # endless loop below, in case of cyclic links.
3702 # We might still enter an endless loop, since a link
3703 # loop can be closed while we follow links,
3705 potlib="$potent_lib"
3706 while test -h "$potlib" 2>/dev/null; do
3707 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3709 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3710 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3713 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3715 | $EGREP "$file_magic_regex" > /dev/null; then
3716 newdeplibs="$newdeplibs $a_deplib"
3723 if test -n "$a_deplib" ; then
3726 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3727 $echo "*** I have the capability to make that library automatically link in when"
3728 $echo "*** you link to this library. But I can only do this if you have a"
3729 $echo "*** shared version of the library, which you do not appear to have"
3730 $echo "*** because I did check the linker path looking for a file starting"
3731 if test -z "$potlib" ; then
3732 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3734 $echo "*** with $libname and none of the candidates passed a file format test"
3735 $echo "*** using a file magic. Last file checked: $potlib"
3739 # Add a -L argument.
3740 newdeplibs="$newdeplibs $a_deplib"
3742 done # Gone through all deplibs.
3745 set dummy $deplibs_check_method
3746 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3747 for a_deplib in $deplibs; do
3748 name=`expr $a_deplib : '-l\(.*\)'`
3749 # If $name is empty we are operating on a -L argument.
3750 if test -n "$name" && test "$name" != "0"; then
3751 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3752 case " $predeps $postdeps " in
3754 newdeplibs="$newdeplibs $a_deplib"
3759 if test -n "$a_deplib" ; then
3760 libname=`eval \\$echo \"$libname_spec\"`
3761 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3762 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3763 for potent_lib in $potential_libs; do
3764 potlib="$potent_lib" # see symlink-check above in file_magic test
3765 if eval $echo \"$potent_lib\" 2>/dev/null \
3767 | $EGREP "$match_pattern_regex" > /dev/null; then
3768 newdeplibs="$newdeplibs $a_deplib"
3775 if test -n "$a_deplib" ; then
3778 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3779 $echo "*** I have the capability to make that library automatically link in when"
3780 $echo "*** you link to this library. But I can only do this if you have a"
3781 $echo "*** shared version of the library, which you do not appear to have"
3782 $echo "*** because I did check the linker path looking for a file starting"
3783 if test -z "$potlib" ; then
3784 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3786 $echo "*** with $libname and none of the candidates passed a file format test"
3787 $echo "*** using a regex pattern. Last file checked: $potlib"
3791 # Add a -L argument.
3792 newdeplibs="$newdeplibs $a_deplib"
3794 done # Gone through all deplibs.
3798 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3799 -e 's/ -[LR][^ ]*//g'`
3800 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3801 for i in $predeps $postdeps ; do
3802 # can't use Xsed below, because $i might contain '/'
3803 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3806 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3807 | grep . >/dev/null; then
3809 if test "X$deplibs_check_method" = "Xnone"; then
3810 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3812 $echo "*** Warning: inter-library dependencies are not known to be supported."
3814 $echo "*** All declared inter-library dependencies are being dropped."
3819 versuffix=$versuffix_save
3821 release=$release_save
3822 libname=$libname_save
3826 *-*-rhapsody* | *-*-darwin1.[012])
3827 # On Rhapsody replace the C library is the System framework
3828 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3832 if test "$droppeddeps" = yes; then
3833 if test "$module" = yes; then
3835 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3836 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3837 $echo "*** a static module, that should work as long as the dlopening"
3838 $echo "*** application is linked with the -dlopen flag."
3839 if test -z "$global_symbol_pipe"; then
3841 $echo "*** However, this would only work if libtool was able to extract symbol"
3842 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3843 $echo "*** not find such a program. So, this module is probably useless."
3844 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3846 if test "$build_old_libs" = no; then
3847 oldlibs="$output_objdir/$libname.$libext"
3848 build_libtool_libs=module
3851 build_libtool_libs=no
3854 $echo "*** The inter-library dependencies that have been dropped here will be"
3855 $echo "*** automatically added whenever a program is linked with this library"
3856 $echo "*** or is declared to -dlopen it."
3858 if test "$allow_undefined" = no; then
3860 $echo "*** Since this library must not contain undefined symbols,"
3861 $echo "*** because either the platform does not support them or"
3862 $echo "*** it was explicitly requested with -no-undefined,"
3863 $echo "*** libtool will only create a static version of it."
3864 if test "$build_old_libs" = no; then
3865 oldlibs="$output_objdir/$libname.$libext"
3866 build_libtool_libs=module
3869 build_libtool_libs=no
3874 # Done checking deplibs!
3879 # move library search paths that coincide with paths to not yet
3880 # installed libraries to the beginning of the library search list
3882 for path in $notinst_path; do
3883 case " $new_libs " in
3884 *" -L$path/$objdir "*) ;;
3886 case " $deplibs " in
3887 *" -L$path/$objdir "*)
3888 new_libs="$new_libs -L$path/$objdir" ;;
3893 for deplib in $deplibs; do
3896 case " $new_libs " in
3898 *) new_libs="$new_libs $deplib" ;;
3901 *) new_libs="$new_libs $deplib" ;;
3907 # All the library-specific variables (install_libdir is set above).
3912 # Test again, we may have decided not to build it any more
3913 if test "$build_libtool_libs" = yes; then
3914 if test "$hardcode_into_libs" = yes; then
3915 # Hardcode the library paths
3918 rpath="$finalize_rpath"
3919 test "$mode" != relink && rpath="$compile_rpath$rpath"
3920 for libdir in $rpath; do
3921 if test -n "$hardcode_libdir_flag_spec"; then
3922 if test -n "$hardcode_libdir_separator"; then
3923 if test -z "$hardcode_libdirs"; then
3924 hardcode_libdirs="$libdir"
3926 # Just accumulate the unique libdirs.
3927 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3928 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3931 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3936 eval flag=\"$hardcode_libdir_flag_spec\"
3937 dep_rpath="$dep_rpath $flag"
3939 elif test -n "$runpath_var"; then
3940 case "$perm_rpath " in
3942 *) perm_rpath="$perm_rpath $libdir" ;;
3946 # Substitute the hardcoded libdirs into the rpath.
3947 if test -n "$hardcode_libdir_separator" &&
3948 test -n "$hardcode_libdirs"; then
3949 libdir="$hardcode_libdirs"
3950 if test -n "$hardcode_libdir_flag_spec_ld"; then
3951 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3953 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3956 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3957 # We should set the runpath_var.
3959 for dir in $perm_rpath; do
3962 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3964 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3967 shlibpath="$finalize_shlibpath"
3968 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3969 if test -n "$shlibpath"; then
3970 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3973 # Get the real and link names of the library.
3974 eval shared_ext=\"$shrext_cmds\"
3975 eval library_names=\"$library_names_spec\"
3976 set dummy $library_names
3980 if test -n "$soname_spec"; then
3981 eval soname=\"$soname_spec\"
3985 if test -z "$dlname"; then
3989 lib="$output_objdir/$realname"
3993 linknames="$linknames $link"
3996 # Use standard objects if they are pic
3997 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3999 # Prepare the list of exported symbols
4000 if test -z "$export_symbols"; then
4001 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4002 $show "generating symbol list for \`$libname.la'"
4003 export_symbols="$output_objdir/$libname.exp"
4004 $run $rm $export_symbols
4005 cmds=$export_symbols_cmds
4006 save_ifs="$IFS"; IFS='~'
4007 for cmd in $cmds; do
4010 if len=`expr "X$cmd" : ".*"` &&
4011 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4013 $run eval "$cmd" || exit $?
4014 skipped_export=false
4016 # The command line is too long to execute in one step.
4017 $show "using reloadable object file for export list..."
4019 # Break out early, otherwise skipped_export may be
4020 # set to false by a later but shorter cmd.
4025 if test -n "$export_symbols_regex"; then
4026 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4027 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4028 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4029 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4034 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4035 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4039 for test_deplib in $deplibs; do
4040 case " $convenience " in
4041 *" $test_deplib "*) ;;
4043 tmp_deplibs="$tmp_deplibs $test_deplib"
4047 deplibs="$tmp_deplibs"
4049 if test -n "$convenience"; then
4050 if test -n "$whole_archive_flag_spec"; then
4051 save_libobjs=$libobjs
4052 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4054 gentop="$output_objdir/${outputname}x"
4055 generated="$generated $gentop"
4057 func_extract_archives $gentop $convenience
4058 libobjs="$libobjs $func_extract_archives_result"
4062 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4063 eval flag=\"$thread_safe_flag_spec\"
4064 linker_flags="$linker_flags $flag"
4067 # Make a backup of the uninstalled library when relinking
4068 if test "$mode" = relink; then
4069 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4072 # Do each of the archive commands.
4073 if test "$module" = yes && test -n "$module_cmds" ; then
4074 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4075 eval test_cmds=\"$module_expsym_cmds\"
4076 cmds=$module_expsym_cmds
4078 eval test_cmds=\"$module_cmds\"
4082 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4083 eval test_cmds=\"$archive_expsym_cmds\"
4084 cmds=$archive_expsym_cmds
4086 eval test_cmds=\"$archive_cmds\"
4091 if test "X$skipped_export" != "X:" &&
4092 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4093 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4096 # The command line is too long to link in one step, link piecewise.
4097 $echo "creating reloadable object files..."
4099 # Save the value of $output and $libobjs because we want to
4100 # use them later. If we have whole_archive_flag_spec, we
4101 # want to use save_libobjs as it was before
4102 # whole_archive_flag_spec was expanded, because we can't
4103 # assume the linker understands whole_archive_flag_spec.
4104 # This may have to be revisited, in case too many
4105 # convenience libraries get linked in and end up exceeding
4107 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4108 save_libobjs=$libobjs
4111 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4113 # Clear the reloadable object creation command queue and
4114 # initialize k to one.
4121 output=$output_objdir/$output_la-${k}.$objext
4122 # Loop over the list of objects to be linked.
4123 for obj in $save_libobjs
4125 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4126 if test "X$objlist" = X ||
4127 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4128 test "$len" -le "$max_cmd_len"; }; then
4129 objlist="$objlist $obj"
4131 # The command $test_cmds is almost too long, add a
4132 # command to the queue.
4133 if test "$k" -eq 1 ; then
4134 # The first file doesn't have a previous command to add.
4135 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4137 # All subsequent reloadable object files will link in
4138 # the last one created.
4139 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4141 last_robj=$output_objdir/$output_la-${k}.$objext
4143 output=$output_objdir/$output_la-${k}.$objext
4148 # Handle the remaining objects by creating one last
4149 # reloadable object file. All subsequent reloadable object
4150 # files will link in the last one created.
4151 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4152 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4154 if ${skipped_export-false}; then
4155 $show "generating symbol list for \`$libname.la'"
4156 export_symbols="$output_objdir/$libname.exp"
4157 $run $rm $export_symbols
4159 # Append the command to create the export file.
4160 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4163 # Set up a command to remove the reloadable object files
4164 # after they are used.
4166 while test "$i" -lt "$k"
4169 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4172 $echo "creating a temporary reloadable object file: $output"
4174 # Loop through the commands generated above and execute them.
4175 save_ifs="$IFS"; IFS='~'
4176 for cmd in $concat_cmds; do
4179 $run eval "$cmd" || exit $?
4184 # Restore the value of output.
4187 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4188 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4190 # Expand the library linking commands again to reset the
4191 # value of $libobjs for piecewise linking.
4193 # Do each of the archive commands.
4194 if test "$module" = yes && test -n "$module_cmds" ; then
4195 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4196 cmds=$module_expsym_cmds
4201 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4202 cmds=$archive_expsym_cmds
4208 # Append the command to remove the reloadable object files
4209 # to the just-reset $cmds.
4210 eval cmds=\"\$cmds~\$rm $delfiles\"
4212 save_ifs="$IFS"; IFS='~'
4213 for cmd in $cmds; do
4217 $run eval "$cmd" || {
4220 # Restore the uninstalled library and exit
4221 if test "$mode" = relink; then
4222 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4230 # Restore the uninstalled library and exit
4231 if test "$mode" = relink; then
4232 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4234 if test -n "$convenience"; then
4235 if test -z "$whole_archive_flag_spec"; then
4236 $show "${rm}r $gentop"
4237 $run ${rm}r "$gentop"
4244 # Create links to the real library.
4245 for linkname in $linknames; do
4246 if test "$realname" != "$linkname"; then
4247 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4248 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4252 # If -module or -export-dynamic was specified, set the dlname.
4253 if test "$module" = yes || test "$export_dynamic" = yes; then
4254 # On all known operating systems, these are identical.
4261 if test -n "$deplibs"; then
4262 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4265 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4266 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4269 if test -n "$rpath"; then
4270 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4273 if test -n "$xrpath"; then
4274 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4277 if test -n "$vinfo"; then
4278 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4281 if test -n "$release"; then
4282 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4287 if test -n "$objs$old_deplibs"; then
4288 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4292 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4300 # Delete the old objects.
4301 $run $rm $obj $libobj
4303 # Objects from convenience libraries. This assumes
4304 # single-version convenience libraries. Whenever we create
4305 # different ones for PIC/non-PIC, this we'll have to duplicate
4309 # reload_cmds runs $LD directly, so let us get rid of
4310 # -Wl from whole_archive_flag_spec
4313 if test -n "$convenience"; then
4314 if test -n "$whole_archive_flag_spec"; then
4315 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4317 gentop="$output_objdir/${obj}x"
4318 generated="$generated $gentop"
4320 func_extract_archives $gentop $convenience
4321 reload_conv_objs="$reload_objs $func_extract_archives_result"
4325 # Create the old-style object.
4326 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
4330 save_ifs="$IFS"; IFS='~'
4331 for cmd in $cmds; do
4335 $run eval "$cmd" || exit $?
4339 # Exit if we aren't doing a library object file.
4340 if test -z "$libobj"; then
4341 if test -n "$gentop"; then
4342 $show "${rm}r $gentop"
4349 if test "$build_libtool_libs" != yes; then
4350 if test -n "$gentop"; then
4351 $show "${rm}r $gentop"
4355 # Create an invalid libtool object if no PIC, so that we don't
4356 # accidentally link it into a program.
4357 # $show "echo timestamp > $libobj"
4358 # $run eval "echo timestamp > $libobj" || exit $?
4362 if test -n "$pic_flag" || test "$pic_mode" != default; then
4363 # Only do commands if we really have different PIC objects.
4364 reload_objs="$libobjs $reload_conv_objs"
4367 save_ifs="$IFS"; IFS='~'
4368 for cmd in $cmds; do
4372 $run eval "$cmd" || exit $?
4377 if test -n "$gentop"; then
4378 $show "${rm}r $gentop"
4387 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4389 if test -n "$vinfo"; then
4390 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4393 if test -n "$release"; then
4394 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4397 if test "$preload" = yes; then
4398 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4399 test "$dlopen_self_static" = unknown; then
4400 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4405 *-*-rhapsody* | *-*-darwin1.[012])
4406 # On Rhapsody replace the C library is the System framework
4407 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4408 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4414 # Don't allow lazy linking, it breaks C++ global constructors
4415 if test "$tagname" = CXX ; then
4416 compile_command="$compile_command ${wl}-bind_at_load"
4417 finalize_command="$finalize_command ${wl}-bind_at_load"
4423 # move library search paths that coincide with paths to not yet
4424 # installed libraries to the beginning of the library search list
4426 for path in $notinst_path; do
4427 case " $new_libs " in
4428 *" -L$path/$objdir "*) ;;
4430 case " $compile_deplibs " in
4431 *" -L$path/$objdir "*)
4432 new_libs="$new_libs -L$path/$objdir" ;;
4437 for deplib in $compile_deplibs; do
4440 case " $new_libs " in
4442 *) new_libs="$new_libs $deplib" ;;
4445 *) new_libs="$new_libs $deplib" ;;
4448 compile_deplibs="$new_libs"
4451 compile_command="$compile_command $compile_deplibs"
4452 finalize_command="$finalize_command $finalize_deplibs"
4454 if test -n "$rpath$xrpath"; then
4455 # If the user specified any rpath flags, then add them.
4456 for libdir in $rpath $xrpath; do
4457 # This is the magic to use -rpath.
4458 case "$finalize_rpath " in
4460 *) finalize_rpath="$finalize_rpath $libdir" ;;
4465 # Now hardcode the library paths
4468 for libdir in $compile_rpath $finalize_rpath; do
4469 if test -n "$hardcode_libdir_flag_spec"; then
4470 if test -n "$hardcode_libdir_separator"; then
4471 if test -z "$hardcode_libdirs"; then
4472 hardcode_libdirs="$libdir"
4474 # Just accumulate the unique libdirs.
4475 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4476 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4479 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4484 eval flag=\"$hardcode_libdir_flag_spec\"
4485 rpath="$rpath $flag"
4487 elif test -n "$runpath_var"; then
4488 case "$perm_rpath " in
4490 *) perm_rpath="$perm_rpath $libdir" ;;
4494 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4495 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4496 case :$dllsearchpath: in
4498 *) dllsearchpath="$dllsearchpath:$libdir";;
4500 case :$dllsearchpath: in
4501 *":$testbindir:"*) ;;
4502 *) dllsearchpath="$dllsearchpath:$testbindir";;
4507 # Substitute the hardcoded libdirs into the rpath.
4508 if test -n "$hardcode_libdir_separator" &&
4509 test -n "$hardcode_libdirs"; then
4510 libdir="$hardcode_libdirs"
4511 eval rpath=\" $hardcode_libdir_flag_spec\"
4513 compile_rpath="$rpath"
4517 for libdir in $finalize_rpath; do
4518 if test -n "$hardcode_libdir_flag_spec"; then
4519 if test -n "$hardcode_libdir_separator"; then
4520 if test -z "$hardcode_libdirs"; then
4521 hardcode_libdirs="$libdir"
4523 # Just accumulate the unique libdirs.
4524 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4525 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4528 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4533 eval flag=\"$hardcode_libdir_flag_spec\"
4534 rpath="$rpath $flag"
4536 elif test -n "$runpath_var"; then
4537 case "$finalize_perm_rpath " in
4539 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4543 # Substitute the hardcoded libdirs into the rpath.
4544 if test -n "$hardcode_libdir_separator" &&
4545 test -n "$hardcode_libdirs"; then
4546 libdir="$hardcode_libdirs"
4547 eval rpath=\" $hardcode_libdir_flag_spec\"
4549 finalize_rpath="$rpath"
4551 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4552 # Transform all the library objects into standard objects.
4553 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4554 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4558 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4559 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4560 dlsyms="${outputname}S.c"
4562 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4566 if test -n "$dlsyms"; then
4570 # Discover the nlist of each of the dlfiles.
4571 nlist="$output_objdir/${outputname}.nm"
4573 $show "$rm $nlist ${nlist}S ${nlist}T"
4574 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4576 # Parse the name list into a source file.
4577 $show "creating $output_objdir/$dlsyms"
4579 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4580 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4581 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4587 /* Prevent the only kind of declaration conflicts we can make. */
4588 #define lt_preloaded_symbols some_other_symbol
4590 /* External symbol declarations for the compiler. */\
4593 if test "$dlself" = yes; then
4594 $show "generating symbol list for \`$output'"
4596 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4598 # Add our own program objects to the symbol list.
4599 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4600 for arg in $progfiles; do
4601 $show "extracting global C symbols from \`$arg'"
4602 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4605 if test -n "$exclude_expsyms"; then
4606 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4607 $run eval '$mv "$nlist"T "$nlist"'
4610 if test -n "$export_symbols_regex"; then
4611 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4612 $run eval '$mv "$nlist"T "$nlist"'
4615 # Prepare the list of exported symbols
4616 if test -z "$export_symbols"; then
4617 export_symbols="$output_objdir/$outputname.exp"
4618 $run $rm $export_symbols
4619 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4621 *cygwin* | *mingw* )
4622 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4623 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4627 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4628 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4629 $run eval 'mv "$nlist"T "$nlist"'
4631 *cygwin* | *mingw* )
4632 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4633 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4639 for arg in $dlprefiles; do
4640 $show "extracting global C symbols from \`$arg'"
4641 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4642 $run eval '$echo ": $name " >> "$nlist"'
4643 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4646 if test -z "$run"; then
4647 # Make sure we have at least an empty file.
4648 test -f "$nlist" || : > "$nlist"
4650 if test -n "$exclude_expsyms"; then
4651 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4652 $mv "$nlist"T "$nlist"
4655 # Try sorting and uniquifying the output.
4656 if grep -v "^: " < "$nlist" |
4657 if sort -k 3 </dev/null >/dev/null 2>&1; then
4662 uniq > "$nlist"S; then
4665 grep -v "^: " < "$nlist" > "$nlist"S
4668 if test -f "$nlist"S; then
4669 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4671 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4674 $echo >> "$output_objdir/$dlsyms" "\
4676 #undef lt_preloaded_symbols
4678 #if defined (__STDC__) && __STDC__
4679 # define lt_ptr void *
4681 # define lt_ptr char *
4685 /* The mapping between symbol names and symbols. */
4689 *cygwin* | *mingw* )
4690 $echo >> "$output_objdir/$dlsyms" "\
4691 /* DATA imports from DLLs on WIN32 can't be const, because
4692 runtime relocations are performed -- see ld's documentation
4698 $echo >> "$output_objdir/$dlsyms" "\
4705 $echo >> "$output_objdir/$dlsyms" "\
4709 lt_preloaded_symbols[] =
4713 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4715 $echo >> "$output_objdir/$dlsyms" "\
4719 /* This works around a problem in FreeBSD linker */
4720 #ifdef FREEBSD_WORKAROUND
4721 static const void *lt_preloaded_setup() {
4722 return lt_preloaded_symbols;
4732 pic_flag_for_symtable=
4734 # compiling the symbol table file with pic_flag works around
4735 # a FreeBSD bug that causes programs to crash when -lm is
4736 # linked before any other PIC object. But we must not use
4737 # pic_flag when linking with -static. The problem exists in
4738 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4739 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4740 case "$compile_command " in
4742 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4745 case "$compile_command " in
4747 *) pic_flag_for_symtable=" $pic_flag";;
4751 # Now compile the dynamic symbol file.
4752 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4753 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4755 # Clean up the generated files.
4756 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4757 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4759 # Transform the symbol file into the correct name.
4761 *cygwin* | *mingw* )
4762 if test -f "$output_objdir/${outputname}.def" ; then
4763 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4764 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4766 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4767 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4771 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4772 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4777 # FreeBSD doesn't need this...
4780 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4785 # We keep going just in case the user didn't refer to
4786 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4787 # really was required.
4789 # Nullify the symbol file.
4790 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4791 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4794 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4795 # Replace the output file specification.
4796 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4797 link_command="$compile_command$compile_rpath"
4799 # We have no uninstalled library dependencies, so finalize right now.
4800 $show "$link_command"
4801 $run eval "$link_command"
4804 # Delete the generated files.
4805 if test -n "$dlsyms"; then
4806 $show "$rm $output_objdir/${outputname}S.${objext}"
4807 $run $rm "$output_objdir/${outputname}S.${objext}"
4813 if test -n "$shlibpath_var"; then
4814 # We should set the shlibpath_var
4816 for dir in $temp_rpath; do
4818 [\\/]* | [A-Za-z]:[\\/]*)
4823 # Relative path: add a thisdir entry.
4824 rpath="$rpath\$thisdir/$dir:"
4831 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4832 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4834 if test -n "$finalize_shlibpath"; then
4835 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4840 if test -n "$runpath_var"; then
4841 if test -n "$perm_rpath"; then
4842 # We should set the runpath_var.
4844 for dir in $perm_rpath; do
4847 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4849 if test -n "$finalize_perm_rpath"; then
4850 # We should set the runpath_var.
4852 for dir in $finalize_perm_rpath; do
4855 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4859 if test "$no_install" = yes; then
4860 # We don't need to create a wrapper script.
4861 link_command="$compile_var$compile_command$compile_rpath"
4862 # Replace the output file specification.
4863 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4864 # Delete the old output file.
4866 # Link the executable and exit
4867 $show "$link_command"
4868 $run eval "$link_command" || exit $?
4872 if test "$hardcode_action" = relink; then
4873 # Fast installation is not supported
4874 link_command="$compile_var$compile_command$compile_rpath"
4875 relink_command="$finalize_var$finalize_command$finalize_rpath"
4877 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4878 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4880 if test "$fast_install" != no; then
4881 link_command="$finalize_var$compile_command$finalize_rpath"
4882 if test "$fast_install" = yes; then
4883 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4885 # fast_install is set to needless
4889 link_command="$compile_var$compile_command$compile_rpath"
4890 relink_command="$finalize_var$finalize_command$finalize_rpath"
4894 # Replace the output file specification.
4895 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4897 # Delete the old output files.
4898 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4900 $show "$link_command"
4901 $run eval "$link_command" || exit $?
4903 # Now create the wrapper script.
4904 $show "creating $output"
4906 # Quote the relink command for shipping.
4907 if test -n "$relink_command"; then
4908 # Preserve any variables that may affect compiler behavior
4909 for var in $variables_saved_for_relink; do
4910 if eval test -z \"\${$var+set}\"; then
4911 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4912 elif eval var_value=\$$var; test -z "$var_value"; then
4913 relink_command="$var=; export $var; $relink_command"
4915 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4916 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4919 relink_command="(cd `pwd`; $relink_command)"
4920 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4923 # Quote $echo for shipping.
4924 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4926 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4927 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4929 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4931 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4934 # Only actually do things if our run command is non-null.
4935 if test -z "$run"; then
4936 # win32 will think the script is a binary if it has
4937 # a .exe suffix, so we strip it off here.
4939 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4941 # test for cygwin because mv fails w/o .exe extensions
4945 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4949 *cygwin* | *mingw* )
4950 output_name=`basename $output`
4951 output_path=`dirname $output`
4952 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4953 cwrapper="$output_path/$output_name.exe"
4954 $rm $cwrappersource $cwrapper
4955 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4957 cat > $cwrappersource <<EOF
4959 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4960 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4962 The $output program cannot be directly executed until all the libtool
4963 libraries that it depends on are installed.
4965 This wrapper executable should never be moved out of the build directory.
4966 If it is, it will not operate correctly.
4968 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4969 but could eventually absorb all of the scripts functionality and
4970 exec $objdir/$outputname directly.
4973 cat >> $cwrappersource<<"EOF"
4982 #include <sys/stat.h>
4984 #if defined(PATH_MAX)
4985 # define LT_PATHMAX PATH_MAX
4986 #elif defined(MAXPATHLEN)
4987 # define LT_PATHMAX MAXPATHLEN
4989 # define LT_PATHMAX 1024
4992 #ifndef DIR_SEPARATOR
4993 # define DIR_SEPARATOR '/'
4994 # define PATH_SEPARATOR ':'
4997 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4999 # define HAVE_DOS_BASED_FILE_SYSTEM
5000 # ifndef DIR_SEPARATOR_2
5001 # define DIR_SEPARATOR_2 '\\'
5003 # ifndef PATH_SEPARATOR_2
5004 # define PATH_SEPARATOR_2 ';'
5008 #ifndef DIR_SEPARATOR_2
5009 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5010 #else /* DIR_SEPARATOR_2 */
5011 # define IS_DIR_SEPARATOR(ch) \
5012 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5013 #endif /* DIR_SEPARATOR_2 */
5015 #ifndef PATH_SEPARATOR_2
5016 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5017 #else /* PATH_SEPARATOR_2 */
5018 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5019 #endif /* PATH_SEPARATOR_2 */
5021 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5022 #define XFREE(stale) do { \
5023 if (stale) { free ((void *) stale); stale = 0; } \
5026 /* -DDEBUG is fairly common in CFLAGS. */
5028 #if defined DEBUGWRAPPER
5029 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5031 # define DEBUG(format, ...)
5034 const char *program_name = NULL;
5036 void * xmalloc (size_t num);
5037 char * xstrdup (const char *string);
5038 const char * base_name (const char *name);
5039 char * find_executable(const char *wrapper);
5040 int check_executable(const char *path);
5041 char * strendzap(char *str, const char *pat);
5042 void lt_fatal (const char *message, ...);
5045 main (int argc, char *argv[])
5050 program_name = (char *) xstrdup (base_name (argv[0]));
5051 DEBUG("(main) argv[0] : %s\n",argv[0]);
5052 DEBUG("(main) program_name : %s\n",program_name);
5053 newargz = XMALLOC(char *, argc+2);
5056 cat >> $cwrappersource <<EOF
5057 newargz[0] = (char *) xstrdup("$SHELL");
5060 cat >> $cwrappersource <<"EOF"
5061 newargz[1] = find_executable(argv[0]);
5062 if (newargz[1] == NULL)
5063 lt_fatal("Couldn't find %s", argv[0]);
5064 DEBUG("(main) found exe at : %s\n",newargz[1]);
5065 /* we know the script has the same name, without the .exe */
5066 /* so make sure newargz[1] doesn't end in .exe */
5067 strendzap(newargz[1],".exe");
5068 for (i = 1; i < argc; i++)
5069 newargz[i+1] = xstrdup(argv[i]);
5070 newargz[argc+1] = NULL;
5072 for (i=0; i<argc+1; i++)
5074 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5082 cat >> $cwrappersource <<EOF
5083 execv("$SHELL",(char const **)newargz);
5087 cat >> $cwrappersource <<EOF
5088 execv("$SHELL",newargz);
5093 cat >> $cwrappersource <<"EOF"
5098 xmalloc (size_t num)
5100 void * p = (void *) malloc (num);
5102 lt_fatal ("Memory exhausted");
5108 xstrdup (const char *string)
5110 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5115 base_name (const char *name)
5119 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5120 /* Skip over the disk name in MSDOS pathnames. */
5121 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5125 for (base = name; *name; name++)
5126 if (IS_DIR_SEPARATOR (*name))
5132 check_executable(const char * path)
5136 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5137 if ((!path) || (!*path))
5140 if ((stat (path, &st) >= 0) &&
5142 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5143 #if defined (S_IXOTH)
5144 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5146 #if defined (S_IXGRP)
5147 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5149 ((st.st_mode & S_IXUSR) == S_IXUSR))
5156 /* Searches for the full path of the wrapper. Returns
5157 newly allocated full path name if found, NULL otherwise */
5159 find_executable (const char* wrapper)
5164 /* static buffer for getcwd */
5165 char tmp[LT_PATHMAX + 1];
5169 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5171 if ((wrapper == NULL) || (*wrapper == '\0'))
5174 /* Absolute path? */
5175 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5176 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5178 concat_name = xstrdup (wrapper);
5179 if (check_executable(concat_name))
5186 if (IS_DIR_SEPARATOR (wrapper[0]))
5188 concat_name = xstrdup (wrapper);
5189 if (check_executable(concat_name))
5193 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5197 for (p = wrapper; *p; p++)
5205 /* no slashes; search PATH */
5206 const char* path = getenv ("PATH");
5209 for (p = path; *p; p = p_next)
5213 for (q = p; *q; q++)
5214 if (IS_PATH_SEPARATOR(*q))
5217 p_next = (*q == '\0' ? q : q + 1);
5220 /* empty path: current directory */
5221 if (getcwd (tmp, LT_PATHMAX) == NULL)
5222 lt_fatal ("getcwd failed");
5223 tmp_len = strlen(tmp);
5224 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5225 memcpy (concat_name, tmp, tmp_len);
5226 concat_name[tmp_len] = '/';
5227 strcpy (concat_name + tmp_len + 1, wrapper);
5231 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5232 memcpy (concat_name, p, p_len);
5233 concat_name[p_len] = '/';
5234 strcpy (concat_name + p_len + 1, wrapper);
5236 if (check_executable(concat_name))
5241 /* not found in PATH; assume curdir */
5243 /* Relative path | not found in path: prepend cwd */
5244 if (getcwd (tmp, LT_PATHMAX) == NULL)
5245 lt_fatal ("getcwd failed");
5246 tmp_len = strlen(tmp);
5247 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5248 memcpy (concat_name, tmp, tmp_len);
5249 concat_name[tmp_len] = '/';
5250 strcpy (concat_name + tmp_len + 1, wrapper);
5252 if (check_executable(concat_name))
5259 strendzap(char *str, const char *pat)
5263 assert(str != NULL);
5264 assert(pat != NULL);
5267 patlen = strlen(pat);
5271 str += len - patlen;
5272 if (strcmp(str, pat) == 0)
5279 lt_error_core (int exit_status, const char * mode,
5280 const char * message, va_list ap)
5282 fprintf (stderr, "%s: %s: ", program_name, mode);
5283 vfprintf (stderr, message, ap);
5284 fprintf (stderr, ".\n");
5286 if (exit_status >= 0)
5291 lt_fatal (const char *message, ...)
5294 va_start (ap, message);
5295 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5299 # we should really use a build-platform specific compiler
5300 # here, but OTOH, the wrappers (shell script and this C one)
5301 # are only useful if you want to execute the "real" binary.
5302 # Since the "real" binary is built for $host, then this
5303 # wrapper might as well be built for $host, too.
5304 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5308 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5313 # $output - temporary wrapper script for $objdir/$outputname
5314 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5316 # The $output program cannot be directly executed until all the libtool
5317 # libraries that it depends on are installed.
5319 # This wrapper script should never be moved out of the build directory.
5320 # If it is, it will not operate correctly.
5322 # Sed substitution that helps us do robust quoting. It backslashifies
5323 # metacharacters that are still active within double-quoted strings.
5324 Xsed='${SED} -e 1s/^X//'
5325 sed_quote_subst='$sed_quote_subst'
5327 # The HP-UX ksh and POSIX shell print the target directory to stdout
5329 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5331 relink_command=\"$relink_command\"
5333 # This environment variable determines our operation mode.
5334 if test \"\$libtool_install_magic\" = \"$magic\"; then
5335 # install mode needs the following variable:
5336 notinst_deplibs='$notinst_deplibs'
5338 # When we are sourced in execute mode, \$file and \$echo are already set.
5339 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5342 # Make sure echo works.
5343 if test \"X\$1\" = X--no-reexec; then
5344 # Discard the --no-reexec flag, and continue.
5346 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5347 # Yippee, \$echo works!
5350 # Restart under the correct shell, and then maybe \$echo will work.
5351 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5357 # Find the directory that this script lives in.
5358 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5359 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5361 # Follow symbolic links until we get to the real thisdir.
5362 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5363 while test -n \"\$file\"; do
5364 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5366 # If there was a directory component, then change thisdir.
5367 if test \"x\$destdir\" != \"x\$file\"; then
5368 case \"\$destdir\" in
5369 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5370 *) thisdir=\"\$thisdir/\$destdir\" ;;
5374 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5375 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5378 # Try to get the absolute directory name.
5379 absdir=\`cd \"\$thisdir\" && pwd\`
5380 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5383 if test "$fast_install" = yes; then
5385 program=lt-'$outputname'$exeext
5386 progdir=\"\$thisdir/$objdir\"
5388 if test ! -f \"\$progdir/\$program\" || \\
5389 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5390 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5392 file=\"\$\$-\$program\"
5394 if test ! -d \"\$progdir\"; then
5395 $mkdir \"\$progdir\"
5397 $rm \"\$progdir/\$file\"
5402 # relink executable if necessary
5403 if test -n \"\$relink_command\"; then
5404 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5406 $echo \"\$relink_command_output\" >&2
5407 $rm \"\$progdir/\$file\"
5412 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5413 { $rm \"\$progdir/\$program\";
5414 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5415 $rm \"\$progdir/\$file\"
5419 program='$outputname'
5420 progdir=\"\$thisdir/$objdir\"
5426 if test -f \"\$progdir/\$program\"; then"
5428 # Export our shlibpath_var if we have one.
5429 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5431 # Add our own library path to $shlibpath_var
5432 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5434 # Some systems cannot cope with colon-terminated $shlibpath_var
5435 # The second colon is a workaround for a bug in BeOS R4 sed
5436 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5438 export $shlibpath_var
5442 # fixup the dll searchpath if we need to.
5443 if test -n "$dllsearchpath"; then
5445 # Add the dll search path components to the executable PATH
5446 PATH=$dllsearchpath:\$PATH
5451 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5452 # Run the actual program with our arguments.
5455 # Backslashes separate directories on plain windows
5456 *-*-mingw | *-*-os2*)
5458 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5464 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5469 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5473 # The program doesn't exist.
5474 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5475 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5476 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5487 # See if we need to build an old-fashioned archive.
5488 for oldlib in $oldlibs; do
5490 if test "$build_libtool_libs" = convenience; then
5491 oldobjs="$libobjs_save"
5492 addlibs="$convenience"
5493 build_libtool_libs=no
5495 if test "$build_libtool_libs" = module; then
5496 oldobjs="$libobjs_save"
5497 build_libtool_libs=no
5499 oldobjs="$old_deplibs $non_pic_objects"
5501 addlibs="$old_convenience"
5504 if test -n "$addlibs"; then
5505 gentop="$output_objdir/${outputname}x"
5506 generated="$generated $gentop"
5508 func_extract_archives $gentop $addlibs
5509 oldobjs="$oldobjs $func_extract_archives_result"
5512 # Do each command in the archive commands.
5513 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5514 cmds=$old_archive_from_new_cmds
5516 # POSIX demands no paths to be encoded in archives. We have
5517 # to avoid creating archives with duplicate basenames if we
5518 # might have to extract them afterwards, e.g., when creating a
5519 # static archive out of a convenience library, or when linking
5520 # the entirety of a libtool archive into another (currently
5521 # not supported by libtool).
5522 if (for obj in $oldobjs
5524 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5525 done | sort | sort -uc >/dev/null 2>&1); then
5528 $echo "copying selected object files to avoid basename conflicts..."
5530 if test -z "$gentop"; then
5531 gentop="$output_objdir/${outputname}x"
5532 generated="$generated $gentop"
5534 $show "${rm}r $gentop"
5535 $run ${rm}r "$gentop"
5536 $show "$mkdir $gentop"
5537 $run $mkdir "$gentop"
5539 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5544 save_oldobjs=$oldobjs
5547 for obj in $save_oldobjs
5549 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5550 case " $oldobjs " in
5551 " ") oldobjs=$obj ;;
5554 # Make sure we don't pick an alternate name that also
5556 newobj=lt$counter-$objbase
5557 counter=`expr $counter + 1`
5558 case " $oldobjs " in
5559 *[\ /]"$newobj "*) ;;
5560 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5563 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5564 $run ln "$obj" "$gentop/$newobj" ||
5565 $run cp "$obj" "$gentop/$newobj"
5566 oldobjs="$oldobjs $gentop/$newobj"
5568 *) oldobjs="$oldobjs $obj" ;;
5573 eval cmds=\"$old_archive_cmds\"
5575 if len=`expr "X$cmds" : ".*"` &&
5576 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5577 cmds=$old_archive_cmds
5579 # the command line is too long to link in one step, link in parts
5580 $echo "using piecewise archive linking..."
5585 save_oldobjs=$oldobjs
5587 # Is there a better way of finding the last object in the list?
5588 for obj in $save_oldobjs
5592 for obj in $save_oldobjs
5594 oldobjs="$objlist $obj"
5595 objlist="$objlist $obj"
5596 eval test_cmds=\"$old_archive_cmds\"
5597 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5598 test "$len" -le "$max_cmd_len"; then
5601 # the above command should be used before it gets too long
5603 if test "$obj" = "$last_oldobj" ; then
5606 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5607 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5613 if test "X$oldobjs" = "X" ; then
5614 eval cmds=\"\$concat_cmds\"
5616 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5620 save_ifs="$IFS"; IFS='~'
5621 for cmd in $cmds; do
5625 $run eval "$cmd" || exit $?
5630 if test -n "$generated"; then
5631 $show "${rm}r$generated"
5632 $run ${rm}r$generated
5635 # Now create the libtool archive.
5639 test "$build_old_libs" = yes && old_library="$libname.$libext"
5640 $show "creating $output"
5642 # Preserve any variables that may affect compiler behavior
5643 for var in $variables_saved_for_relink; do
5644 if eval test -z \"\${$var+set}\"; then
5645 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5646 elif eval var_value=\$$var; test -z "$var_value"; then
5647 relink_command="$var=; export $var; $relink_command"
5649 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5650 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5653 # Quote the link command for shipping.
5654 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5655 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5656 if test "$hardcode_automatic" = yes ; then
5661 # Only create the output if not a dry run.
5662 if test -z "$run"; then
5663 for installed in no yes; do
5664 if test "$installed" = yes; then
5665 if test -z "$install_libdir"; then
5668 output="$output_objdir/$outputname"i
5669 # Replace all uninstalled libtool libraries with the installed ones
5671 for deplib in $dependency_libs; do
5674 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5675 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5676 if test -z "$libdir"; then
5677 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5680 newdependency_libs="$newdependency_libs $libdir/$name"
5682 *) newdependency_libs="$newdependency_libs $deplib" ;;
5685 dependency_libs="$newdependency_libs"
5687 for lib in $dlfiles; do
5688 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5689 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5690 if test -z "$libdir"; then
5691 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5694 newdlfiles="$newdlfiles $libdir/$name"
5696 dlfiles="$newdlfiles"
5698 for lib in $dlprefiles; do
5699 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5700 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5701 if test -z "$libdir"; then
5702 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5705 newdlprefiles="$newdlprefiles $libdir/$name"
5707 dlprefiles="$newdlprefiles"
5710 for lib in $dlfiles; do
5712 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5713 *) abs=`pwd`"/$lib" ;;
5715 newdlfiles="$newdlfiles $abs"
5717 dlfiles="$newdlfiles"
5719 for lib in $dlprefiles; do
5721 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5722 *) abs=`pwd`"/$lib" ;;
5724 newdlprefiles="$newdlprefiles $abs"
5726 dlprefiles="$newdlprefiles"
5729 # place dlname in correct position for cygwin
5731 case $host,$output,$installed,$module,$dlname in
5732 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5735 # $outputname - a libtool library file
5736 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5738 # Please DO NOT delete this file!
5739 # It is necessary for linking the library.
5741 # The name that we can dlopen(3).
5744 # Names of this library.
5745 library_names='$library_names'
5747 # The name of the static archive.
5748 old_library='$old_library'
5750 # Libraries that this one depends upon.
5751 dependency_libs='$dependency_libs'
5753 # Version information for $libname.
5758 # Is this an already installed library?
5759 installed=$installed
5761 # Should we warn about portability when linking against -modules?
5762 shouldnotlink=$module
5764 # Files to dlopen/dlpreopen
5766 dlpreopen='$dlprefiles'
5768 # Directory that this library needs to be installed in:
5769 libdir='$install_libdir'"
5770 if test "$installed" = no && test "$need_relink" = yes; then
5772 relink_command=\"$relink_command\""
5777 # Do a symbolic link so that the libtool archive can be found in
5778 # LD_LIBRARY_PATH before the program is installed.
5779 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5780 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5786 # libtool install mode
5788 modename="$modename: install"
5790 # There may be an optional sh(1) argument at the beginning of
5791 # install_prog (especially on Windows NT).
5792 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5793 # Allow the use of GNU shtool's install command.
5794 $echo "X$nonopt" | grep shtool > /dev/null; then
5795 # Aesthetically quote it.
5796 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5798 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5802 install_prog="$arg "
5810 # The real first argument should be the name of the installation program.
5811 # Aesthetically quote it.
5812 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5814 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5818 install_prog="$install_prog$arg"
5820 # We need to accept at least all the BSD install flags.
5830 if test -n "$dest"; then
5831 files="$files $dest"
5839 case " $install_prog " in
5844 -g | -m | -o) prev=$arg ;;
5852 # If the previous option needed an argument, then skip it.
5853 if test -n "$prev"; then
5862 # Aesthetically quote the argument.
5863 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5865 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5869 install_prog="$install_prog $arg"
5872 if test -z "$install_prog"; then
5873 $echo "$modename: you must specify an install program" 1>&2
5878 if test -n "$prev"; then
5879 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5884 if test -z "$files"; then
5885 if test -z "$dest"; then
5886 $echo "$modename: no file or destination specified" 1>&2
5888 $echo "$modename: you must specify a destination" 1>&2
5894 # Strip any trailing slash from the destination.
5895 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5897 # Check to see that the destination is a directory.
5898 test -d "$dest" && isdir=yes
5899 if test "$isdir" = yes; then
5903 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5904 test "X$destdir" = "X$dest" && destdir=.
5905 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5907 # Not a directory, so check to see that there is only one file specified.
5909 if test "$#" -gt 2; then
5910 $echo "$modename: \`$dest' is not a directory" 1>&2
5916 [\\/]* | [A-Za-z]:[\\/]*) ;;
5918 for file in $files; do
5922 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5931 # This variable tells wrapper scripts just to set variables rather
5932 # than running their programs.
5933 libtool_install_magic="$magic"
5938 for file in $files; do
5940 # Do each installation.
5943 # Do the static libraries later.
5944 staticlibs="$staticlibs $file"
5948 # Check to see that this really is a libtool archive.
5949 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5951 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5959 # If there is no directory component, then add one.
5961 */* | *\\*) . $file ;;
5965 # Add the libdir to current_libdirs if it is the destination.
5966 if test "X$destdir" = "X$libdir"; then
5967 case "$current_libdirs " in
5969 *) current_libdirs="$current_libdirs $libdir" ;;
5972 # Note the libdir as a future libdir.
5973 case "$future_libdirs " in
5975 *) future_libdirs="$future_libdirs $libdir" ;;
5979 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5980 test "X$dir" = "X$file/" && dir=
5983 if test -n "$relink_command"; then
5984 # Determine the prefix the user has applied to our future dir.
5985 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5987 # Don't allow the user to place us outside of our expected
5988 # location b/c this prevents finding dependent libraries that
5989 # are installed to the same prefix.
5990 # At present, this check doesn't affect windows .dll's that
5991 # are installed into $libdir/../bin (currently, that works fine)
5992 # but it's something to keep an eye on.
5993 if test "$inst_prefix_dir" = "$destdir"; then
5994 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5998 if test -n "$inst_prefix_dir"; then
5999 # Stick the inst_prefix_dir data into the link command.
6000 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
6002 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
6005 $echo "$modename: warning: relinking \`$file'" 1>&2
6006 $show "$relink_command"
6007 if $run eval "$relink_command"; then :
6009 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6014 # See the names of the shared library.
6015 set dummy $library_names
6016 if test -n "$2"; then
6022 test -n "$relink_command" && srcname="$realname"T
6024 # Install the shared library and build the symlinks.
6025 $show "$install_prog $dir/$srcname $destdir/$realname"
6026 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6027 if test -n "$stripme" && test -n "$striplib"; then
6028 $show "$striplib $destdir/$realname"
6029 $run eval "$striplib $destdir/$realname" || exit $?
6032 if test "$#" -gt 0; then
6033 # Delete the old symlinks, and create new ones.
6034 # Try `ln -sf' first, because the `ln' binary might depend on
6035 # the symlink we replace! Solaris /bin/ln does not understand -f,
6036 # so we also need to try rm && ln -s.
6039 if test "$linkname" != "$realname"; then
6040 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6041 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6046 # Do each command in the postinstall commands.
6047 lib="$destdir/$realname"
6048 cmds=$postinstall_cmds
6049 save_ifs="$IFS"; IFS='~'
6050 for cmd in $cmds; do
6054 $run eval "$cmd" || {
6057 # Restore the uninstalled library and exit
6058 if test "$mode" = relink; then
6059 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6068 # Install the pseudo-library for information purposes.
6069 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 instname="$dir/$name"i
6071 $show "$install_prog $instname $destdir/$name"
6072 $run eval "$install_prog $instname $destdir/$name" || exit $?
6074 # Maybe install the static library, too.
6075 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6079 # Install (i.e. copy) a libtool object.
6081 # Figure out destination file name, if it wasn't already specified.
6082 if test -n "$destname"; then
6083 destfile="$destdir/$destname"
6085 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6086 destfile="$destdir/$destfile"
6089 # Deduce the name of the destination old-style object file.
6092 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6095 staticdest="$destfile"
6099 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6105 # Install the libtool object if requested.
6106 if test -n "$destfile"; then
6107 $show "$install_prog $file $destfile"
6108 $run eval "$install_prog $file $destfile" || exit $?
6111 # Install the old object if enabled.
6112 if test "$build_old_libs" = yes; then
6113 # Deduce the name of the old-style object file.
6114 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6116 $show "$install_prog $staticobj $staticdest"
6117 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6123 # Figure out destination file name, if it wasn't already specified.
6124 if test -n "$destname"; then
6125 destfile="$destdir/$destname"
6127 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6128 destfile="$destdir/$destfile"
6131 # If the file is missing, and there is a .exe on the end, strip it
6132 # because it is most likely a libtool script we actually want to
6137 if test ! -f "$file"; then
6138 file=`$echo $file|${SED} 's,.exe$,,'`
6144 # Do a test to see if this is really a libtool program.
6147 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6153 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6157 # Note that it is not necessary on cygwin/mingw to append a dot to
6158 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6159 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6160 # `FILE.' does not work on cygwin managed mounts.
6162 # If there is no directory component, then add one.
6164 */* | *\\*) . ${wrapper} ;;
6165 *) . ./${wrapper} ;;
6168 # Check the variables that should have been set.
6169 if test -z "$notinst_deplibs"; then
6170 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6175 for lib in $notinst_deplibs; do
6176 # Check to see that each library is installed.
6178 if test -f "$lib"; then
6179 # If there is no directory component, then add one.
6181 */* | *\\*) . $lib ;;
6185 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6186 if test -n "$libdir" && test ! -f "$libfile"; then
6187 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6193 # Note that it is not necessary on cygwin/mingw to append a dot to
6194 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6195 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6196 # `FILE.' does not work on cygwin managed mounts.
6198 # If there is no directory component, then add one.
6200 */* | *\\*) . ${wrapper} ;;
6201 *) . ./${wrapper} ;;
6205 if test "$fast_install" = no && test -n "$relink_command"; then
6206 if test "$finalize" = yes && test -z "$run"; then
6207 tmpdir=`func_mktempdir`
6208 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6209 outputname="$tmpdir/$file"
6210 # Replace the output file specification.
6211 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6213 $show "$relink_command"
6214 if $run eval "$relink_command"; then :
6216 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6222 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6225 # Install the binary that we compiled earlier.
6226 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6230 # remove .exe since cygwin /usr/bin/install will append another
6232 case $install_prog,$host in
6233 */usr/bin/install*,*cygwin*)
6234 case $file:$destfile in
6239 destfile=$destfile.exe
6242 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6247 $show "$install_prog$stripme $file $destfile"
6248 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6249 test -n "$outputname" && ${rm}r "$tmpdir"
6254 for file in $staticlibs; do
6255 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6257 # Set up the ranlib parameters.
6258 oldlib="$destdir/$name"
6260 $show "$install_prog $file $oldlib"
6261 $run eval "$install_prog \$file \$oldlib" || exit $?
6263 if test -n "$stripme" && test -n "$old_striplib"; then
6264 $show "$old_striplib $oldlib"
6265 $run eval "$old_striplib $oldlib" || exit $?
6268 # Do each command in the postinstall commands.
6269 cmds=$old_postinstall_cmds
6270 save_ifs="$IFS"; IFS='~'
6271 for cmd in $cmds; do
6275 $run eval "$cmd" || exit $?
6280 if test -n "$future_libdirs"; then
6281 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6284 if test -n "$current_libdirs"; then
6285 # Maybe just do a dry run.
6286 test -n "$run" && current_libdirs=" -n$current_libdirs"
6287 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6293 # libtool finish mode
6295 modename="$modename: finish"
6299 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6302 libdirs="$libdirs $dir"
6305 for libdir in $libdirs; do
6306 if test -n "$finish_cmds"; then
6307 # Do each command in the finish commands.
6309 save_ifs="$IFS"; IFS='~'
6310 for cmd in $cmds; do
6314 $run eval "$cmd" || admincmds="$admincmds
6319 if test -n "$finish_eval"; then
6320 # Do the single finish_eval.
6321 eval cmds=\"$finish_eval\"
6322 $run eval "$cmds" || admincmds="$admincmds
6328 # Exit here if they wanted silent mode.
6329 test "$show" = : && exit $EXIT_SUCCESS
6331 $echo "X----------------------------------------------------------------------" | $Xsed
6332 $echo "Libraries have been installed in:"
6333 for libdir in $libdirs; do
6337 $echo "If you ever happen to want to link against installed libraries"
6338 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6339 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6340 $echo "flag during linking and do at least one of the following:"
6341 if test -n "$shlibpath_var"; then
6342 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6343 $echo " during execution"
6345 if test -n "$runpath_var"; then
6346 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6347 $echo " during linking"
6349 if test -n "$hardcode_libdir_flag_spec"; then
6351 eval flag=\"$hardcode_libdir_flag_spec\"
6353 $echo " - use the \`$flag' linker flag"
6355 if test -n "$admincmds"; then
6356 $echo " - have your system administrator run these commands:$admincmds"
6358 if test -f /etc/ld.so.conf; then
6359 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6362 $echo "See any operating system documentation about shared libraries for"
6363 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6364 $echo "X----------------------------------------------------------------------" | $Xsed
6368 # libtool execute mode
6370 modename="$modename: execute"
6372 # The first argument is the command name.
6374 if test -z "$cmd"; then
6375 $echo "$modename: you must specify a COMMAND" 1>&2
6380 # Handle -dlopen flags immediately.
6381 for file in $execute_dlfiles; do
6382 if test ! -f "$file"; then
6383 $echo "$modename: \`$file' is not a file" 1>&2
6391 # Check to see that this really is a libtool archive.
6392 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6394 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6399 # Read the libtool library.
6403 # If there is no directory component, then add one.
6405 */* | *\\*) . $file ;;
6409 # Skip this library if it cannot be dlopened.
6410 if test -z "$dlname"; then
6411 # Warn if it was a shared library.
6412 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6416 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6417 test "X$dir" = "X$file" && dir=.
6419 if test -f "$dir/$objdir/$dlname"; then
6422 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6428 # Just add the directory containing the .lo file.
6429 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6430 test "X$dir" = "X$file" && dir=.
6434 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6439 # Get the absolute pathname.
6440 absdir=`cd "$dir" && pwd`
6441 test -n "$absdir" && dir="$absdir"
6443 # Now add the directory to shlibpath_var.
6444 if eval "test -z \"\$$shlibpath_var\""; then
6445 eval "$shlibpath_var=\"\$dir\""
6447 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6451 # This variable tells wrapper scripts just to set shlibpath_var
6452 # rather than running their programs.
6453 libtool_execute_magic="$magic"
6455 # Check if any of the arguments is a wrapper script.
6462 # Do a test to see if this is really a libtool program.
6463 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6464 # If there is no directory component, then add one.
6466 */* | *\\*) . $file ;;
6470 # Transform arg to wrapped name.
6471 file="$progdir/$program"
6475 # Quote arguments (to preserve shell metacharacters).
6476 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6477 args="$args \"$file\""
6480 if test -z "$run"; then
6481 if test -n "$shlibpath_var"; then
6482 # Export the shlibpath_var.
6483 eval "export $shlibpath_var"
6486 # Restore saved environment variables
6487 if test "${save_LC_ALL+set}" = set; then
6488 LC_ALL="$save_LC_ALL"; export LC_ALL
6490 if test "${save_LANG+set}" = set; then
6491 LANG="$save_LANG"; export LANG
6494 # Now prepare to actually exec the command.
6495 exec_cmd="\$cmd$args"
6497 # Display what would be done.
6498 if test -n "$shlibpath_var"; then
6499 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6500 $echo "export $shlibpath_var"
6507 # libtool clean and uninstall mode
6509 modename="$modename: $mode"
6515 # This variable tells wrapper scripts just to set variables rather
6516 # than running their programs.
6517 libtool_install_magic="$magic"
6522 -f) rm="$rm $arg"; rmforce=yes ;;
6523 -*) rm="$rm $arg" ;;
6524 *) files="$files $arg" ;;
6528 if test -z "$rm"; then
6529 $echo "$modename: you must specify an RM program" 1>&2
6536 origobjdir="$objdir"
6537 for file in $files; do
6538 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6539 if test "X$dir" = "X$file"; then
6541 objdir="$origobjdir"
6543 objdir="$dir/$origobjdir"
6545 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6546 test "$mode" = uninstall && objdir="$dir"
6548 # Remember objdir for removal later, being careful to avoid duplicates
6549 if test "$mode" = clean; then
6552 *) rmdirs="$rmdirs $objdir" ;;
6556 # Don't error if the file doesn't exist and rm -f was used.
6557 if (test -L "$file") >/dev/null 2>&1 \
6558 || (test -h "$file") >/dev/null 2>&1 \
6559 || test -f "$file"; then
6561 elif test -d "$file"; then
6564 elif test "$rmforce" = yes; then
6572 # Possibly a libtool archive, so verify it.
6573 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6576 # Delete the libtool libraries and symlinks.
6577 for n in $library_names; do
6578 rmfiles="$rmfiles $objdir/$n"
6580 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6584 case " $library_names " in
6585 # " " in the beginning catches empty $dlname
6587 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6589 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6592 if test -n "$library_names"; then
6593 # Do each command in the postuninstall commands.
6594 cmds=$postuninstall_cmds
6595 save_ifs="$IFS"; IFS='~'
6596 for cmd in $cmds; do
6601 if test "$?" -ne 0 && test "$rmforce" != yes; then
6608 if test -n "$old_library"; then
6609 # Do each command in the old_postuninstall commands.
6610 cmds=$old_postuninstall_cmds
6611 save_ifs="$IFS"; IFS='~'
6612 for cmd in $cmds; do
6617 if test "$?" -ne 0 && test "$rmforce" != yes; then
6623 # FIXME: should reinstall the best remaining shared library.
6630 # Possibly a libtool object, so verify it.
6631 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6636 # Add PIC object to the list of files to remove.
6637 if test -n "$pic_object" \
6638 && test "$pic_object" != none; then
6639 rmfiles="$rmfiles $dir/$pic_object"
6642 # Add non-PIC object to the list of files to remove.
6643 if test -n "$non_pic_object" \
6644 && test "$non_pic_object" != none; then
6645 rmfiles="$rmfiles $dir/$non_pic_object"
6651 if test "$mode" = clean ; then
6655 file=`$echo $file|${SED} 's,.exe$,,'`
6656 noexename=`$echo $name|${SED} 's,.exe$,,'`
6657 # $file with .exe has already been added to rmfiles,
6658 # add $file without .exe
6659 rmfiles="$rmfiles $file"
6662 # Do a test to see if this is a libtool program.
6663 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6667 # note $name still contains .exe if it was in $file originally
6668 # as does the version of $file that was added into $rmfiles
6669 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6670 if test "$fast_install" = yes && test -n "$relink_command"; then
6671 rmfiles="$rmfiles $objdir/lt-$name"
6673 if test "X$noexename" != "X$name" ; then
6674 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6680 $show "$rm $rmfiles"
6681 $run $rm $rmfiles || exit_status=1
6683 objdir="$origobjdir"
6685 # Try to remove the ${objdir}s in the directories where we deleted files
6686 for dir in $rmdirs; do
6687 if test -d "$dir"; then
6689 $run rmdir $dir >/dev/null 2>&1
6697 $echo "$modename: you must specify a MODE" 1>&2
6698 $echo "$generic_help" 1>&2
6703 if test -z "$exec_cmd"; then
6704 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6705 $echo "$generic_help" 1>&2
6708 fi # test -z "$show_help"
6710 if test -n "$exec_cmd"; then
6715 # We need to display help for each of the modes.
6718 "Usage: $modename [OPTION]... [MODE-ARG]...
6720 Provide generalized library-building support services.
6722 --config show all configuration variables
6723 --debug enable verbose shell tracing
6724 -n, --dry-run display commands without modifying any files
6725 --features display basic configuration information and exit
6726 --finish same as \`--mode=finish'
6727 --help display this help message and exit
6728 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6729 --quiet same as \`--silent'
6730 --silent don't print informational messages
6731 --tag=TAG use configuration variables from tag TAG
6732 --version print version information
6734 MODE must be one of the following:
6736 clean remove files from the build directory
6737 compile compile a source file into a libtool object
6738 execute automatically set library path, then run a program
6739 finish complete the installation of libtool libraries
6740 install install libraries or executables
6741 link create a library or an executable
6742 uninstall remove libraries from an installed directory
6744 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6745 a more detailed description of MODE.
6747 Report bugs to <bug-libtool@gnu.org>."
6753 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6755 Remove files from the build directory.
6757 RM is the name of the program to use to delete files associated with each FILE
6758 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6761 If FILE is a libtool library, object or program, all the files associated
6762 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6767 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6769 Compile a source file into a libtool library object.
6771 This mode accepts the following additional options:
6773 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6774 -prefer-pic try to building PIC objects only
6775 -prefer-non-pic try to building non-PIC objects only
6776 -static always build a \`.o' file suitable for static linking
6778 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6779 from the given SOURCEFILE.
6781 The output file name is determined by removing the directory component from
6782 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6783 library object suffix, \`.lo'."
6788 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6790 Automatically set library path, then run a program.
6792 This mode accepts the following additional options:
6794 -dlopen FILE add the directory containing FILE to the library path
6796 This mode sets the library path environment variable according to \`-dlopen'
6799 If any of the ARGS are libtool executable wrappers, then they are translated
6800 into their corresponding uninstalled binary, and any of their required library
6801 directories are added to the library path.
6803 Then, COMMAND is executed, with ARGS as arguments."
6808 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6810 Complete the installation of libtool libraries.
6812 Each LIBDIR is a directory that contains libtool libraries.
6814 The commands that this mode executes may require superuser privileges. Use
6815 the \`--dry-run' option if you just want to see what would be executed."
6820 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6822 Install executables or libraries.
6824 INSTALL-COMMAND is the installation command. The first component should be
6825 either the \`install' or \`cp' program.
6827 The rest of the components are interpreted as arguments to that command (only
6828 BSD-compatible install options are recognized)."
6833 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6835 Link object files or libraries together to form another library, or to
6836 create an executable program.
6838 LINK-COMMAND is a command using the C compiler that you would use to create
6839 a program from several object files.
6841 The following components of LINK-COMMAND are treated specially:
6843 -all-static do not do any dynamic linking at all
6844 -avoid-version do not add a version suffix if possible
6845 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6846 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6847 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6848 -export-symbols SYMFILE
6849 try to export only the symbols listed in SYMFILE
6850 -export-symbols-regex REGEX
6851 try to export only the symbols matching REGEX
6852 -LLIBDIR search LIBDIR for required installed libraries
6853 -lNAME OUTPUT-FILE requires the installed library libNAME
6854 -module build a library that can dlopened
6855 -no-fast-install disable the fast-install mode
6856 -no-install link a not-installable executable
6857 -no-undefined declare that a library does not refer to external symbols
6858 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6859 -objectlist FILE Use a list of object files found in FILE to specify objects
6860 -precious-files-regex REGEX
6861 don't remove output files matching REGEX
6862 -release RELEASE specify package release information
6863 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6864 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6865 -static do not do any dynamic linking of libtool libraries
6866 -version-info CURRENT[:REVISION[:AGE]]
6867 specify library version info [each variable defaults to 0]
6869 All other options (arguments beginning with \`-') are ignored.
6871 Every other argument is treated as a filename. Files ending in \`.la' are
6872 treated as uninstalled libtool libraries, other files are standard or library
6875 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6876 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6877 required, except when creating a convenience library.
6879 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6880 using \`ar' and \`ranlib', or on Windows using \`lib'.
6882 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6883 is created, otherwise an executable program is created."
6888 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6890 Remove libraries from an installation directory.
6892 RM is the name of the program to use to delete files associated with each FILE
6893 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6896 If FILE is a libtool library, all the files associated with it are deleted.
6897 Otherwise, only FILE itself is deleted using RM."
6901 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6908 $echo "Try \`$modename --help' for more information about other modes."
6912 # The TAGs below are defined such that we never get into a situation
6913 # in which we disable both kinds of libraries. Given conflicting
6914 # choices, we go for a static library, that is the most portable,
6915 # since we can't tell whether shared libraries were disabled because
6916 # the user asked for that or because the platform doesn't support
6917 # them. This is particularly important on AIX, because we don't
6918 # support having both static and shared libraries enabled at the same
6919 # time on that platform, so we default to a shared-only configuration.
6920 # If a disable-shared tag is given, we'll fallback to a static-only
6921 # configuration. But we'll never go from static-only to shared-only.
6923 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6925 # ### END LIBTOOL TAG CONFIG: disable-shared
6927 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6929 # ### END LIBTOOL TAG CONFIG: disable-static