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.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
47 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
49 # See if we are running on zsh, and set the options which allow our
50 # commands through without removal of \ escapes.
51 if test -n "${ZSH_VERSION+set}" ; then
55 # Check that we have a working $echo.
56 if test "X$1" = X--no-reexec; then
57 # Discard the --no-reexec flag, and continue.
59 elif test "X$1" = X--fallback-echo; then
60 # Avoid inline document here, it may be left over
62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63 # Yippee, $echo works!
66 # Restart under the correct shell, and then maybe $echo will work.
67 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
70 if test "X$1" = X--fallback-echo; then
71 # used as fallback echo
80 help="Try \`$progname --help' for more information."
81 magic="%%%MAGIC variable%%%"
86 # Sed substitution that helps us do robust quoting. It backslashifies
87 # metacharacters that are still active within double-quoted strings.
88 Xsed="${SED}"' -e 1s/^X//'
89 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90 # test EBCDIC or ASCII
91 case `echo X|tr X '\101'` in
92 A) # ASCII based system
93 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
95 NL2SP='tr \015\012 \040\040'
97 *) # EBCDIC based system
99 NL2SP='tr \r\n \100\100'
104 # Only set LANG and LC_ALL to C if already set.
105 # These must not be set unconditionally because not all systems understand
106 # e.g. LANG=C (notably SCO).
107 # We save the old values to restore during execute mode.
108 if test "${LC_ALL+set}" = set; then
109 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
111 if test "${LANG+set}" = set; then
112 save_LANG="$LANG"; LANG=C; export LANG
115 # Make sure IFS has a sensible default
120 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121 $echo "$modename: not configured to build any kind of library" 1>&2
122 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
137 lo2o="s/\\.lo\$/.${objext}/"
138 o2lo="s/\\.${objext}\$/.lo/"
140 #####################################
141 # Shell function definitions:
142 # This seems to be the best place for them
144 # func_mktempdir [string]
145 # Make a temporary directory that won't clash with other running
146 # libtool processes, and avoids race conditions if possible. If
147 # given, STRING is the basename for that directory.
150 my_template="${TMPDIR-/tmp}/${1-$progname}"
152 if test "$run" = ":"; then
153 # Return a directory name, but don't create it in dry-run mode
154 my_tmpdir="${my_template}-$$"
157 # If mktemp works, use that first and foremost
158 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
160 if test ! -d "$my_tmpdir"; then
161 # Failing that, at least try and use $RANDOM to avoid a race
162 my_tmpdir="${my_template}-${RANDOM-0}$$"
164 save_mktempdir_umask=`umask`
167 umask $save_mktempdir_umask
170 # If we're not in dry-run mode, bomb out on failure
171 test -d "$my_tmpdir" || {
172 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
177 $echo "X$my_tmpdir" | $Xsed
181 # func_win32_libid arg
182 # return the library type of file 'arg'
184 # Need a lot of goo to handle *both* DLLs and import libs
185 # Has to be a shell function in order to 'eat' the argument
186 # that is supplied when $file_magic_command is called.
189 win32_libid_type="unknown"
190 win32_fileres=`file -L $1 2>/dev/null`
191 case $win32_fileres in
192 *ar\ archive\ import\ library*) # definitely import
193 win32_libid_type="x86 archive import"
195 *ar\ archive*) # could be an import, or static
196 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
197 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
198 win32_nmres=`eval $NM -f posix -A $1 | \
199 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
201 import*) win32_libid_type="x86 archive import";;
202 *) win32_libid_type="x86 archive static";;
207 win32_libid_type="x86 DLL"
209 *executable*) # but shell scripts are "executable" too...
210 case $win32_fileres in
211 *MS\ Windows\ PE\ Intel*)
212 win32_libid_type="x86 DLL"
217 $echo $win32_libid_type
222 # Infer tagged configuration to use if any are available and
223 # if one wasn't chosen via the "--tag" command line option.
224 # Only attempt this if the compiler in the base compile
225 # command doesn't match the default compiler.
226 # arg is usually of the form 'gcc ...'
229 # FreeBSD-specific: where we install compilers with non-standard names
230 tag_compilers_CC="*cc cc* *gcc gcc*"
231 tag_compilers_CXX="*c++ c++* *g++ g++*"
232 base_compiler=`set -- "$@"; echo $1`
234 # If $tagname isn't set, then try to infer if the default "CC" tag applies
235 if test -z "$tagname"; then
236 for zp in $tag_compilers_CC; do
237 case $base_compiler in
238 $zp) tagname="CC"; break;;
243 if test -n "$available_tags" && test -z "$tagname"; then
247 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
251 CC_quoted="$CC_quoted $arg"
254 # Blanks in the command may have been stripped by the calling shell,
255 # but not from the CC environment variable when configure was run.
256 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
257 # Blanks at the start of $base_compile will cause this to fail
258 # if we don't check for them as well.
260 for z in $available_tags; do
261 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
262 # Evaluate the configuration.
263 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
266 # Double-quote args containing other shell metacharacters.
268 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
272 CC_quoted="$CC_quoted $arg"
275 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
276 # The compiler in the base compile command matches
277 # the one in the tagged configuration.
278 # Assume this is the tagged configuration we want.
284 # FreeBSD-specific: try compilers based on inferred tag
285 if test -z "$tagname"; then
286 eval "tag_compilers=\$tag_compilers_${z}"
287 if test -n "$tag_compilers"; then
288 for zp in $tag_compilers; do
289 case $base_compiler in
290 $zp) tagname=$z; break;;
293 if test -n "$tagname"; then
300 # If $tagname still isn't set, then no tagged configuration
301 # was found and let the user know that the "--tag" command
302 # line option must be used.
303 if test -z "$tagname"; then
304 $echo "$modename: unable to infer tagged configuration"
305 $echo "$modename: specify a tag with \`--tag'" 1>&2
308 # $echo "$modename: using $tagname tagged configuration"
316 # func_extract_an_archive dir oldlib
317 func_extract_an_archive ()
319 f_ex_an_ar_dir="$1"; shift
320 f_ex_an_ar_oldlib="$1"
322 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
323 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
324 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
327 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
332 # func_extract_archives gentop oldlib ...
333 func_extract_archives ()
335 my_gentop="$1"; shift
343 $show "${rm}r $my_gentop"
344 $run ${rm}r "$my_gentop"
345 $show "$mkdir $my_gentop"
346 $run $mkdir "$my_gentop"
348 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
352 for my_xlib in $my_oldlibs; do
353 # Extract the objects.
355 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
356 *) my_xabs=`pwd`"/$my_xlib" ;;
358 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
359 my_xdir="$my_gentop/$my_xlib"
361 $show "${rm}r $my_xdir"
362 $run ${rm}r "$my_xdir"
363 $show "$mkdir $my_xdir"
364 $run $mkdir "$my_xdir"
366 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
371 $show "Extracting $my_xabs"
372 # Do not bother doing anything if just a dry run
373 if test -z "$run"; then
374 darwin_orig_dir=`pwd`
375 cd $my_xdir || exit $?
376 darwin_archive=$my_xabs
378 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
379 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
380 if test -n "$darwin_arches"; then
381 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
383 $show "$darwin_base_archive has multiple architectures $darwin_arches"
384 for darwin_arch in $darwin_arches ; do
385 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
386 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
387 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
388 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
390 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
391 done # $darwin_arches
392 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
393 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
396 for darwin_file in $darwin_filelist; do
397 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
398 lipo -create -output "$darwin_file" $darwin_files
399 done # $darwin_filelist
401 cd "$darwin_orig_dir"
403 cd "$darwin_orig_dir"
404 func_extract_an_archive "$my_xdir" "$my_xabs"
409 func_extract_an_archive "$my_xdir" "$my_xabs"
412 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
414 func_extract_archives_result="$my_oldobjs"
416 # End of Shell function definitions
417 #####################################
420 eval std_shrext=\"$shrext_cmds\"
424 # Parse our command line options once, thoroughly.
425 while test "$#" -gt 0
431 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
435 # If the previous option needs an argument, assign it.
436 if test -n "$prev"; then
439 execute_dlfiles="$execute_dlfiles $arg"
443 preserve_args="${preserve_args}=$arg"
445 # Check whether tagname contains only valid characters
448 $echo "$progname: invalid tag name: $tagname" 1>&2
455 # Don't test for the "default" C tag, as we know, it's there, but
456 # not specially marked.
459 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
460 taglist="$taglist $tagname"
461 # Evaluate the configuration.
462 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
464 $echo "$progname: ignoring unknown tag $tagname" 1>&2
479 # Have we seen a non-optional argument yet?
486 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
488 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
489 $echo "This is free software; see the source for copying conditions. There is NO"
490 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
495 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
496 # Now print the configurations for the tags.
497 for tagname in $taglist; do
498 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
504 $echo "$progname: enabling shell trace mode"
506 preserve_args="$preserve_args $arg"
515 if test "$build_libtool_libs" = yes; then
516 $echo "enable shared libraries"
518 $echo "disable shared libraries"
520 if test "$build_old_libs" = yes; then
521 $echo "enable static libraries"
523 $echo "disable static libraries"
528 --finish) mode="finish" ;;
530 --mode) prevopt="--mode" prev=mode ;;
531 --mode=*) mode="$optarg" ;;
533 --preserve-dup-deps) duplicate_deps="yes" ;;
537 preserve_args="$preserve_args $arg"
543 preserve_args="$preserve_args --tag"
546 set tag "$optarg" ${1+"$@"}
549 preserve_args="$preserve_args --tag"
558 $echo "$modename: unrecognized option \`$arg'" 1>&2
570 if test -n "$prevopt"; then
571 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
576 case $disable_libs in
580 build_libtool_libs=no
584 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
588 # If this variable is set in any of the actions, the command in it
589 # will be execed at the end. This prevents here-documents from being
590 # left over by shells.
593 if test -z "$show_help"; then
595 # Infer the operation mode.
596 if test -z "$mode"; then
597 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
598 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
600 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
612 *db | *dbx | *strace | *truss)
622 # If we have no mode, but dlfiles were specified, then do execute mode.
623 test -n "$execute_dlfiles" && mode=execute
625 # Just use the default operation mode.
626 if test -z "$mode"; then
627 if test -n "$nonopt"; then
628 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
630 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637 # Only execute mode is allowed to have -dlopen flags.
638 if test -n "$execute_dlfiles" && test "$mode" != execute; then
639 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
644 # Change the help message to a mode-specific one.
646 help="Try \`$modename --help --mode=$mode' for more information."
648 # These modes are in order of execution frequency so that they run quickly.
650 # libtool compile mode
652 modename="$modename: compile"
653 # Get the compilation command and the source file.
655 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
666 # do not "continue". Instead, add this to base_compile
678 # Accept any command-line options.
681 if test -n "$libobj" ; then
682 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689 -static | -prefer-pic | -prefer-non-pic)
700 arg_mode=arg # the next one goes into the "base_compile" arg list
701 continue # The current "srcfile" will either be retained or
702 ;; # replaced later. I would guess that would be a bug.
705 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
707 save_ifs="$IFS"; IFS=','
711 # Double-quote args containing other shell metacharacters.
712 # Many Bourne shells cannot handle close brackets correctly
713 # in scan sets, so we specify it separately.
715 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
719 lastarg="$lastarg $arg"
722 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
724 # Add the arguments to base_compile.
725 base_compile="$base_compile $lastarg"
730 # Accept the current argument as the source file.
731 # The previous "srcfile" becomes the current argument.
738 esac # case $arg_mode
740 # Aesthetically quote the previous argument.
741 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
744 # Double-quote args containing other shell metacharacters.
745 # Many Bourne shells cannot handle close brackets correctly
746 # in scan sets, and some SunOS ksh mistreat backslash-escaping
747 # in scan sets (worked around with variable expansion),
748 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
749 # at all, so we specify them separately.
750 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
751 lastarg="\"$lastarg\""
755 base_compile="$base_compile $lastarg"
760 $echo "$modename: you must specify an argument for -Xcompile"
764 $echo "$modename: you must specify a target with \`-o'" 1>&2
768 # Get the name of the library object.
769 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
773 # Recognize several different file suffixes.
774 # If the user specifies -o file.o, it is replaced with file.lo
784 *.class) xform=class ;;
789 *.java) xform=java ;;
792 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
795 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
797 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
802 func_infer_tag $base_compile
804 for arg in $later; do
823 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
825 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
826 qlibobj="\"$qlibobj\"" ;;
828 test "X$libobj" != "X$qlibobj" \
829 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
830 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
831 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
832 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
833 if test "X$xdir" = "X$obj"; then
838 lobj=${xdir}$objdir/$objname
840 if test -z "$base_compile"; then
841 $echo "$modename: you must specify a compilation command" 1>&2
846 # Delete any leftover library objects.
847 if test "$build_old_libs" = yes; then
848 removelist="$obj $lobj $libobj ${libobj}T"
850 removelist="$lobj $libobj ${libobj}T"
854 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
856 # On Cygwin there's no "real" PIC flag so we must build both object types
858 cygwin* | mingw* | pw32* | os2*)
862 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
863 # non-PIC code in shared libraries is not supported
867 # Calculate the filename of the output object if compiler does
868 # not support -o with -c
869 if test "$compiler_c_o" = no; then
870 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
871 lockfile="$output_obj.lock"
872 removelist="$removelist $output_obj $lockfile"
873 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
880 # Lock this critical section if it is needed
881 # We use this script file to make the link, it avoids creating a new file
882 if test "$need_locks" = yes; then
883 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
884 $show "Waiting for $lockfile to be removed"
887 elif test "$need_locks" = warn; then
888 if test -f "$lockfile"; then
890 *** ERROR, $lockfile exists and contains:
891 `cat $lockfile 2>/dev/null`
893 This indicates that another process is trying to use the same
894 temporary object file, and libtool could not work around it because
895 your compiler does not support \`-c' and \`-o' together. If you
896 repeat this compilation, it may succeed, by chance, but you had better
897 avoid parallel builds (make -j) in this platform, or get a better
903 $echo "$srcfile" > "$lockfile"
906 if test -n "$fix_srcfile_path"; then
907 eval srcfile=\"$fix_srcfile_path\"
909 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
911 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
912 qsrcfile="\"$qsrcfile\"" ;;
915 $run $rm "$libobj" "${libobj}T"
917 # Create a libtool object file (analogous to a ".la" file),
918 # but don't create it if we're doing a dry run.
919 test -z "$run" && cat > ${libobj}T <<EOF
920 # $libobj - a libtool object file
921 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
923 # Please DO NOT delete this file!
924 # It is necessary for linking the library.
926 # Name of the PIC object.
929 # Only build a PIC object if we are building libtool libraries.
930 if test "$build_libtool_libs" = yes; then
931 # Without this assignment, base_compile gets emptied.
932 fbsd_hideous_sh_bug=$base_compile
934 if test "$pic_mode" != no; then
935 command="$base_compile $qsrcfile $pic_flag"
937 # Don't build PIC code
938 command="$base_compile $qsrcfile"
941 if test ! -d "${xdir}$objdir"; then
942 $show "$mkdir ${xdir}$objdir"
943 $run $mkdir ${xdir}$objdir
945 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
950 if test -z "$output_obj"; then
951 # Place PIC objects in $objdir
952 command="$command -o $lobj"
955 $run $rm "$lobj" "$output_obj"
958 if $run eval "$command"; then :
960 test -n "$output_obj" && $run $rm $removelist
964 if test "$need_locks" = warn &&
965 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
967 *** ERROR, $lockfile contains:
968 `cat $lockfile 2>/dev/null`
970 but it should contain:
973 This indicates that another process is trying to use the same
974 temporary object file, and libtool could not work around it because
975 your compiler does not support \`-c' and \`-o' together. If you
976 repeat this compilation, it may succeed, by chance, but you had better
977 avoid parallel builds (make -j) in this platform, or get a better
984 # Just move the object if needed, then go on to compile the next one
985 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
986 $show "$mv $output_obj $lobj"
987 if $run $mv $output_obj $lobj; then :
995 # Append the name of the PIC object to the libtool object file.
996 test -z "$run" && cat >> ${libobj}T <<EOF
997 pic_object='$objdir/$objname'
1001 # Allow error messages only from the first compilation.
1002 if test "$suppress_opt" = yes; then
1003 suppress_output=' >/dev/null 2>&1'
1006 # No PIC object so indicate it doesn't exist in the libtool
1008 test -z "$run" && cat >> ${libobj}T <<EOF
1014 # Only build a position-dependent object if we build old libraries.
1015 if test "$build_old_libs" = yes; then
1016 if test "$pic_mode" != yes; then
1017 # Don't build PIC code
1018 command="$base_compile $qsrcfile"
1020 command="$base_compile $qsrcfile $pic_flag"
1022 if test "$compiler_c_o" = yes; then
1023 command="$command -o $obj"
1026 # Suppress compiler output if we already did a PIC compilation.
1027 command="$command$suppress_output"
1028 $run $rm "$obj" "$output_obj"
1030 if $run eval "$command"; then :
1032 $run $rm $removelist
1036 if test "$need_locks" = warn &&
1037 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1039 *** ERROR, $lockfile contains:
1040 `cat $lockfile 2>/dev/null`
1042 but it should contain:
1045 This indicates that another process is trying to use the same
1046 temporary object file, and libtool could not work around it because
1047 your compiler does not support \`-c' and \`-o' together. If you
1048 repeat this compilation, it may succeed, by chance, but you had better
1049 avoid parallel builds (make -j) in this platform, or get a better
1052 $run $rm $removelist
1056 # Just move the object if needed
1057 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1058 $show "$mv $output_obj $obj"
1059 if $run $mv $output_obj $obj; then :
1062 $run $rm $removelist
1067 # Append the name of the non-PIC object the libtool object file.
1068 # Only append if the libtool object file exists.
1069 test -z "$run" && cat >> ${libobj}T <<EOF
1070 # Name of the non-PIC object.
1071 non_pic_object='$objname'
1075 # Append the name of the non-PIC object the libtool object file.
1076 # Only append if the libtool object file exists.
1077 test -z "$run" && cat >> ${libobj}T <<EOF
1078 # Name of the non-PIC object.
1084 $run $mv "${libobj}T" "${libobj}"
1086 # Unlock the critical section if it was locked
1087 if test "$need_locks" != no; then
1088 $run $rm "$lockfile"
1096 modename="$modename: link"
1098 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1099 # It is impossible to link a dll without this setting, and
1100 # we shouldn't force the makefile maintainer to figure out
1101 # which system we are compiling for in order to pass an extra
1102 # flag for every libtool invocation.
1103 # allow_undefined=no
1105 # FIXME: Unfortunately, there are problems with the above when trying
1106 # to make a dll which has undefined symbols, in which case not
1107 # even a static library is built. For now, we need to specify
1108 # -no-undefined on the libtool link line when we can be certain
1109 # that all symbols are satisfied, otherwise we get a static library.
1116 libtool_args="$nonopt"
1117 base_compile="$nonopt $@"
1118 compile_command="$nonopt"
1119 finalize_command="$nonopt"
1132 lib_search_path=`pwd`
1141 export_symbols_regex=
1149 notinst_path= # paths that contain not-installed libtool libraries
1150 precious_files_regex=
1151 prefer_static_libs=no
1164 func_infer_tag $base_compile
1166 # We need to know -static, to get the right output filenames.
1170 -all-static | -static)
1171 if test "X$arg" = "X-all-static"; then
1172 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1173 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1175 if test -n "$link_static_flag"; then
1176 dlopen_self=$dlopen_self_static
1178 prefer_static_libs=yes
1180 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1181 dlopen_self=$dlopen_self_static
1183 prefer_static_libs=built
1185 build_libtool_libs=no
1192 # See if our shared archives depend on static archives.
1193 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1195 # Go through the arguments, transforming them on the way.
1196 while test "$#" -gt 0; do
1200 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1201 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1205 libtool_args="$libtool_args $qarg"
1207 # If the previous option needs an argument, assign it.
1208 if test -n "$prev"; then
1211 compile_command="$compile_command @OUTPUT@"
1212 finalize_command="$finalize_command @OUTPUT@"
1218 if test "$preload" = no; then
1219 # Add the symbol object into the linking commands.
1220 compile_command="$compile_command @SYMFILE@"
1221 finalize_command="$finalize_command @SYMFILE@"
1225 *.la | *.lo) ;; # We handle these cases below.
1227 if test "$dlself" = no; then
1235 if test "$prev" = dlprefiles; then
1237 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1247 if test "$prev" = dlfiles; then
1248 dlfiles="$dlfiles $arg"
1250 dlprefiles="$dlprefiles $arg"
1258 export_symbols="$arg"
1259 if test ! -f "$arg"; then
1260 $echo "$modename: symbol file \`$arg' does not exist"
1267 export_symbols_regex="$arg"
1272 inst_prefix_dir="$arg"
1277 precious_files_regex="$arg"
1287 if test -f "$arg"; then
1290 for fil in `cat $save_arg`
1292 # moreargs="$moreargs $fil"
1294 # A libtool-controlled object.
1296 # Check to see that this really is a libtool object.
1297 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1302 # If there is no directory component, then add one.
1304 */* | *\\*) . $arg ;;
1308 if test -z "$pic_object" || \
1309 test -z "$non_pic_object" ||
1310 test "$pic_object" = none && \
1311 test "$non_pic_object" = none; then
1312 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1316 # Extract subdirectory from the argument.
1317 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1318 if test "X$xdir" = "X$arg"; then
1324 if test "$pic_object" != none; then
1325 # Prepend the subdirectory the object is found in.
1326 pic_object="$xdir$pic_object"
1328 if test "$prev" = dlfiles; then
1329 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1330 dlfiles="$dlfiles $pic_object"
1334 # If libtool objects are unsupported, then we need to preload.
1339 # CHECK ME: I think I busted this. -Ossama
1340 if test "$prev" = dlprefiles; then
1341 # Preload the old-style object.
1342 dlprefiles="$dlprefiles $pic_object"
1347 libobjs="$libobjs $pic_object"
1352 if test "$non_pic_object" != none; then
1353 # Prepend the subdirectory the object is found in.
1354 non_pic_object="$xdir$non_pic_object"
1356 # A standard non-PIC object
1357 non_pic_objects="$non_pic_objects $non_pic_object"
1358 if test -z "$pic_object" || test "$pic_object" = none ; then
1359 arg="$non_pic_object"
1362 # If the PIC object exists, use it instead.
1363 # $xdir was prepended to $pic_object above.
1364 non_pic_object="$pic_object"
1365 non_pic_objects="$non_pic_objects $non_pic_object"
1368 # Only an error if not doing a dry-run.
1369 if test -z "$run"; then
1370 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1375 # Extract subdirectory from the argument.
1376 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1377 if test "X$xdir" = "X$arg"; then
1383 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1384 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1385 libobjs="$libobjs $pic_object"
1386 non_pic_objects="$non_pic_objects $non_pic_object"
1391 $echo "$modename: link input file \`$save_arg' does not exist"
1399 # We need an absolute path.
1401 [\\/]* | [A-Za-z]:[\\/]*) ;;
1403 $echo "$modename: only absolute run-paths are allowed" 1>&2
1407 if test "$prev" = rpath; then
1410 *) rpath="$rpath $arg" ;;
1415 *) xrpath="$xrpath $arg" ;;
1422 compiler_flags="$compiler_flags $qarg"
1424 compile_command="$compile_command $qarg"
1425 finalize_command="$finalize_command $qarg"
1429 linker_flags="$linker_flags $qarg"
1430 compiler_flags="$compiler_flags $wl$qarg"
1432 compile_command="$compile_command $wl$qarg"
1433 finalize_command="$finalize_command $wl$qarg"
1437 linker_flags="$linker_flags $qarg"
1438 compiler_flags="$compiler_flags $qarg"
1440 compile_command="$compile_command $qarg"
1441 finalize_command="$finalize_command $qarg"
1449 darwin_framework|darwin_framework_skip)
1450 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1451 compile_command="$compile_command $arg"
1452 finalize_command="$finalize_command $arg"
1457 eval "$prev=\"\$arg\""
1462 fi # test -n "$prev"
1468 if test -n "$link_static_flag"; then
1469 compile_command="$compile_command $link_static_flag"
1470 finalize_command="$finalize_command $link_static_flag"
1476 # FIXME: remove this flag sometime in the future.
1477 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1501 -export-symbols | -export-symbols-regex)
1502 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1503 $echo "$modename: more than one -exported-symbols argument is not allowed"
1506 if test "X$arg" = "X-export-symbols"; then
1514 -framework|-arch|-isysroot)
1516 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1517 prev=darwin_framework_skip ;;
1518 *) compiler_flags="$compiler_flags $arg"
1519 prev=darwin_framework ;;
1521 compile_command="$compile_command $arg"
1522 finalize_command="$finalize_command $arg"
1531 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1532 # so, if we see these flags be careful not to treat them like -L
1534 case $with_gcc/$host in
1535 no/*-*-irix* | /*-*-irix*)
1536 compile_command="$compile_command $arg"
1537 finalize_command="$finalize_command $arg"
1544 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1545 # We need an absolute path.
1547 [\\/]* | [A-Za-z]:[\\/]*) ;;
1549 absdir=`cd "$dir" && pwd`
1550 if test -z "$absdir"; then
1551 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1553 notinst_path="$notinst_path $dir"
1561 deplibs="$deplibs -L$dir"
1562 lib_search_path="$lib_search_path $dir"
1566 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1567 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1568 case :$dllsearchpath: in
1570 *) dllsearchpath="$dllsearchpath:$dir";;
1572 case :$dllsearchpath: in
1573 *":$testbindir:"*) ;;
1574 *) dllsearchpath="$dllsearchpath:$testbindir";;
1582 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1585 # These systems don't actually have a C or math library (as such)
1589 # These systems don't actually have a C library (as such)
1590 test "X$arg" = "X-lc" && continue
1592 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1593 # Do not include libc due to us having libc/libc_r.
1594 test "X$arg" = "X-lc" && continue
1596 *-*-rhapsody* | *-*-darwin1.[012])
1597 # Rhapsody C and math libraries are in the System framework
1598 deplibs="$deplibs -framework System"
1601 *-*-sco3.2v5* | *-*-sco5v6*)
1602 # Causes problems with __ctype
1603 test "X$arg" = "X-lc" && continue
1605 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1606 # Compiler inserts libc in the correct place for threads to work
1607 test "X$arg" = "X-lc" && continue
1610 elif test "X$arg" = "X-lc_r"; then
1612 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1613 # Do not include libc_r directly, use -pthread flag.
1618 deplibs="$deplibs $arg"
1622 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1623 # classes, name mangling, and exception handling.
1625 compile_command="$compile_command $arg"
1626 compiler_flags="$compiler_flags $arg"
1627 finalize_command="$finalize_command $arg"
1632 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1633 compiler_flags="$compiler_flags $arg"
1634 compile_command="$compile_command $arg"
1635 finalize_command="$finalize_command $arg"
1636 deplibs="$deplibs $arg"
1645 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1646 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1647 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1648 # +DA*, +DD* enable 64-bit mode on the HP compiler
1649 # -q* pass through compiler args for the IBM compiler
1650 # -m* pass through architecture-specific compiler args for GCC
1651 # -m*, -t[45]*, -txscale* pass through architecture-specific
1652 # compiler args for GCC
1653 # -pg pass through profiling flag for GCC
1654 # @file GCC response files
1655 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1656 -t[45]*|-txscale*|@*)
1658 # Unknown arguments in both finalize_command and compile_command need
1659 # to be aesthetically quoted because they are evaled later.
1660 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1662 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1666 compile_command="$compile_command $arg"
1667 finalize_command="$finalize_command $arg"
1668 compiler_flags="$compiler_flags $arg"
1684 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1685 # The PATH hackery in wrapper scripts is required on Windows
1686 # in order for the loader to find any dlls it needs.
1687 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1688 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1691 *) no_install=yes ;;
1708 -precious-files-regex)
1729 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1730 # We need an absolute path.
1732 [\\/]* | [A-Za-z]:[\\/]*) ;;
1734 $echo "$modename: only absolute run-paths are allowed" 1>&2
1740 *) xrpath="$xrpath $dir" ;;
1746 # The effects of -static are defined in a previous loop.
1747 # We used to do the same as -all-static on platforms that
1748 # didn't have a PIC flag, but the assumption that the effects
1749 # would be equivalent was wrong. It would break on at least
1750 # Digital Unix and AIX.
1770 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1772 save_ifs="$IFS"; IFS=','
1773 for flag in $args; do
1776 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1781 compiler_flags="$compiler_flags $flag"
1784 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1788 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1790 save_ifs="$IFS"; IFS=','
1791 for flag in $args; do
1794 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1799 compiler_flags="$compiler_flags $wl$flag"
1800 linker_flags="$linker_flags $flag"
1803 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1821 # Some other compiler flag.
1823 # Unknown arguments in both finalize_command and compile_command need
1824 # to be aesthetically quoted because they are evaled later.
1825 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1827 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1834 # A standard object.
1839 # A libtool-controlled object.
1841 # Check to see that this really is a libtool object.
1842 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1847 # If there is no directory component, then add one.
1849 */* | *\\*) . $arg ;;
1853 if test -z "$pic_object" || \
1854 test -z "$non_pic_object" ||
1855 test "$pic_object" = none && \
1856 test "$non_pic_object" = none; then
1857 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1861 # Extract subdirectory from the argument.
1862 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1863 if test "X$xdir" = "X$arg"; then
1869 if test "$pic_object" != none; then
1870 # Prepend the subdirectory the object is found in.
1871 pic_object="$xdir$pic_object"
1873 if test "$prev" = dlfiles; then
1874 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1875 dlfiles="$dlfiles $pic_object"
1879 # If libtool objects are unsupported, then we need to preload.
1884 # CHECK ME: I think I busted this. -Ossama
1885 if test "$prev" = dlprefiles; then
1886 # Preload the old-style object.
1887 dlprefiles="$dlprefiles $pic_object"
1892 libobjs="$libobjs $pic_object"
1897 if test "$non_pic_object" != none; then
1898 # Prepend the subdirectory the object is found in.
1899 non_pic_object="$xdir$non_pic_object"
1901 # A standard non-PIC object
1902 non_pic_objects="$non_pic_objects $non_pic_object"
1903 if test -z "$pic_object" || test "$pic_object" = none ; then
1904 arg="$non_pic_object"
1907 # If the PIC object exists, use it instead.
1908 # $xdir was prepended to $pic_object above.
1909 non_pic_object="$pic_object"
1910 non_pic_objects="$non_pic_objects $non_pic_object"
1913 # Only an error if not doing a dry-run.
1914 if test -z "$run"; then
1915 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1920 # Extract subdirectory from the argument.
1921 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1922 if test "X$xdir" = "X$arg"; then
1928 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1929 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1930 libobjs="$libobjs $pic_object"
1931 non_pic_objects="$non_pic_objects $non_pic_object"
1938 deplibs="$deplibs $arg"
1939 old_deplibs="$old_deplibs $arg"
1944 # A libtool-controlled library.
1946 if test "$prev" = dlfiles; then
1947 # This library was specified with -dlopen.
1948 dlfiles="$dlfiles $arg"
1950 elif test "$prev" = dlprefiles; then
1951 # The library was specified with -dlpreopen.
1952 dlprefiles="$dlprefiles $arg"
1955 deplibs="$deplibs $arg"
1960 # Some other compiler argument.
1962 # Unknown arguments in both finalize_command and compile_command need
1963 # to be aesthetically quoted because they are evaled later.
1964 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1966 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1973 # Now actually substitute the argument into the commands.
1974 if test -n "$arg"; then
1975 compile_command="$compile_command $arg"
1976 finalize_command="$finalize_command $arg"
1978 done # argument parsing loop
1980 if test -n "$prev"; then
1981 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1986 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1987 eval arg=\"$export_dynamic_flag_spec\"
1988 compile_command="$compile_command $arg"
1989 finalize_command="$finalize_command $arg"
1993 # calculate the name of the file, without its directory
1994 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1995 libobjs_save="$libobjs"
1997 if test -n "$shlibpath_var"; then
1998 # get the directories listed in $shlibpath_var
1999 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2003 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2004 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2006 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2007 if test "X$output_objdir" = "X$output"; then
2008 output_objdir="$objdir"
2010 output_objdir="$output_objdir/$objdir"
2012 # Create the object directory.
2013 if test ! -d "$output_objdir"; then
2014 $show "$mkdir $output_objdir"
2015 $run $mkdir $output_objdir
2017 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2022 # Determine the type of output
2025 $echo "$modename: you must specify an output file" 1>&2
2029 *.$libext) linkmode=oldlib ;;
2030 *.lo | *.$objext) linkmode=obj ;;
2031 *.la) linkmode=lib ;;
2032 *) linkmode=prog ;; # Anything else should be a program.
2036 *cygwin* | *mingw* | *pw32*)
2037 # don't eliminate duplications in $postdeps and $predeps
2038 duplicate_compiler_generated_deps=yes
2041 duplicate_compiler_generated_deps=$duplicate_deps
2047 # Find all interdependent deplibs by searching for libraries
2048 # that are linked more than once (e.g. -la -lb -la)
2049 for deplib in $deplibs; do
2050 if test "X$duplicate_deps" = "Xyes" ; then
2052 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2055 libs="$libs $deplib"
2058 if test "$linkmode" = lib; then
2059 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2061 # Compute libraries that are listed more than once in $predeps
2062 # $postdeps and mark them as special (i.e., whose duplicates are
2063 # not to be eliminated).
2065 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2066 for pre_post_dep in $predeps $postdeps; do
2067 case "$pre_post_deps " in
2068 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2070 pre_post_deps="$pre_post_deps $pre_post_dep"
2079 need_relink=no # whether we're linking any uninstalled libtool libraries
2080 notinst_deplibs= # not-installed libtool libraries
2084 for file in $dlfiles $dlprefiles; do
2088 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2100 passes="conv scan dlopen dlpreopen link"
2105 for pass in $passes; do
2106 if test "$linkmode,$pass" = "lib,link" ||
2107 test "$linkmode,$pass" = "prog,scan"; then
2111 if test "$linkmode" = prog; then
2113 dlopen) libs="$dlfiles" ;;
2114 dlpreopen) libs="$dlprefiles" ;;
2115 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2118 if test "$pass" = dlopen; then
2119 # Collect dlpreopened libraries
2120 save_deplibs="$deplibs"
2123 for deplib in $libs; do
2127 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2128 if test "$linkmode,$pass" = "prog,link"; then
2129 compile_deplibs="$deplib $compile_deplibs"
2130 finalize_deplibs="$deplib $finalize_deplibs"
2132 compiler_flags="$compiler_flags $deplib"
2137 deplibs="$deplib $deplibs"
2138 test "$pass" = conv && continue
2139 newdependency_libs="$deplib $newdependency_libs"
2142 if test "$pass" = conv; then
2143 deplibs="$deplib $deplibs"
2146 if test "$pass" = scan; then
2147 deplibs="$deplib $deplibs"
2149 compile_deplibs="$deplib $compile_deplibs"
2150 finalize_deplibs="$deplib $finalize_deplibs"
2160 if test "$linkmode" != lib && test "$linkmode" != prog; then
2161 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2164 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2165 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2166 for search_ext in .la $std_shrext .so .a; do
2167 # Search the libtool library
2168 lib="$searchdir/lib${name}${search_ext}"
2169 if test -f "$lib"; then
2170 if test "$search_ext" = ".la"; then
2179 if test "$found" != yes; then
2180 # deplib doesn't seem to be a libtool library
2181 if test "$linkmode,$pass" = "prog,link"; then
2182 compile_deplibs="$deplib $compile_deplibs"
2183 finalize_deplibs="$deplib $finalize_deplibs"
2185 deplibs="$deplib $deplibs"
2186 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2189 else # deplib is a libtool library
2190 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2191 # We need to do some special things here, and not later.
2192 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2193 case " $predeps $postdeps " in
2195 if (${SED} -e '2q' $lib |
2196 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2200 */* | *\\*) . $lib ;;
2203 for l in $old_library $library_names; do
2206 if test "X$ll" = "X$old_library" ; then # only static version available
2208 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2209 test "X$ladir" = "X$lib" && ladir="."
2210 lib=$ladir/$old_library
2211 if test "$linkmode,$pass" = "prog,link"; then
2212 compile_deplibs="$deplib $compile_deplibs"
2213 finalize_deplibs="$deplib $finalize_deplibs"
2215 deplibs="$deplib $deplibs"
2216 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2230 deplibs="$deplib $deplibs"
2231 test "$pass" = conv && continue
2232 newdependency_libs="$deplib $newdependency_libs"
2233 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2236 if test "$pass" = conv; then
2237 deplibs="$deplib $deplibs"
2240 if test "$pass" = scan; then
2241 deplibs="$deplib $deplibs"
2243 compile_deplibs="$deplib $compile_deplibs"
2244 finalize_deplibs="$deplib $finalize_deplibs"
2246 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2249 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2255 if test "$pass" = link; then
2256 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2257 # Make sure the xrpath contains only unique directories.
2260 *) xrpath="$xrpath $dir" ;;
2263 deplibs="$deplib $deplibs"
2266 *.la) lib="$deplib" ;;
2268 if test "$pass" = conv; then
2269 deplibs="$deplib $deplibs"
2275 case $deplibs_check_method in
2277 set dummy $deplibs_check_method
2278 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2279 if eval $echo \"$deplib\" 2>/dev/null \
2281 | $EGREP "$match_pattern_regex" > /dev/null; then
2289 if test "$valid_a_lib" != yes; then
2291 $echo "*** Warning: Trying to link with static lib archive $deplib."
2292 $echo "*** I have the capability to make that library automatically link in when"
2293 $echo "*** you link to this library. But I can only do this if you have a"
2294 $echo "*** shared version of the library, which you do not appear to have"
2295 $echo "*** because the file extensions .$libext of this argument makes me believe"
2296 $echo "*** that it is just a static archive that I should not used here."
2299 $echo "*** Warning: Linking the shared library $output against the"
2300 $echo "*** static library $deplib is not portable!"
2301 deplibs="$deplib $deplibs"
2306 if test "$pass" != link; then
2307 deplibs="$deplib $deplibs"
2309 compile_deplibs="$deplib $compile_deplibs"
2310 finalize_deplibs="$deplib $finalize_deplibs"
2317 if test "$pass" = conv; then
2318 deplibs="$deplib $deplibs"
2319 elif test "$linkmode" = prog; then
2320 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2321 # If there is no dlopen support or we're linking statically,
2322 # we need to preload.
2323 newdlprefiles="$newdlprefiles $deplib"
2324 compile_deplibs="$deplib $compile_deplibs"
2325 finalize_deplibs="$deplib $finalize_deplibs"
2327 newdlfiles="$newdlfiles $deplib"
2337 if test "$found" = yes || test -f "$lib"; then :
2339 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2343 # Check to see that this really is a libtool archive.
2344 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2346 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2350 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2351 test "X$ladir" = "X$lib" && ladir="."
2359 # If the library was installed with an old release of libtool,
2360 # it will not redefine variables installed, or shouldnotlink
2368 */* | *\\*) . $lib ;;
2372 if test "$linkmode,$pass" = "lib,link" ||
2373 test "$linkmode,$pass" = "prog,scan" ||
2374 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2375 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2376 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2379 if test "$pass" = conv; then
2380 # Only check for convenience libraries
2381 deplibs="$lib $deplibs"
2382 if test -z "$libdir"; then
2383 if test -z "$old_library"; then
2384 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2387 # It is a libtool convenience library, so add in its objects.
2388 convenience="$convenience $ladir/$objdir/$old_library"
2389 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2391 for deplib in $dependency_libs; do
2392 deplibs="$deplib $deplibs"
2393 if test "X$duplicate_deps" = "Xyes" ; then
2394 case "$tmp_libs " in
2395 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2398 tmp_libs="$tmp_libs $deplib"
2400 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2401 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2408 # Get the name of the library we link against.
2410 for l in $old_library $library_names; do
2413 if test -z "$linklib"; then
2414 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2418 # This library was specified with -dlopen.
2419 if test "$pass" = dlopen; then
2420 if test -z "$libdir"; then
2421 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2424 if test -z "$dlname" ||
2425 test "$dlopen_support" != yes ||
2426 test "$build_libtool_libs" = no; then
2427 # If there is no dlname, no dlopen support or we're linking
2428 # statically, we need to preload. We also need to preload any
2429 # dependent libraries so libltdl's deplib preloader doesn't
2430 # bomb out in the load deplibs phase.
2431 dlprefiles="$dlprefiles $lib $dependency_libs"
2433 newdlfiles="$newdlfiles $lib"
2438 # We need an absolute path.
2440 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2442 abs_ladir=`cd "$ladir" && pwd`
2443 if test -z "$abs_ladir"; then
2444 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2445 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2450 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2452 # Find the relevant object directory and library name.
2453 if test "X$installed" = Xyes; then
2454 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2455 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2463 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2465 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2468 # Remove this search path later
2469 notinst_path="$notinst_path $abs_ladir"
2471 dir="$ladir/$objdir"
2472 absdir="$abs_ladir/$objdir"
2473 # Remove this search path later
2474 notinst_path="$notinst_path $abs_ladir"
2476 fi # $installed = yes
2477 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2479 # This library was specified with -dlpreopen.
2480 if test "$pass" = dlpreopen; then
2481 if test -z "$libdir"; then
2482 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2485 # Prefer using a static library (so that no silly _DYNAMIC symbols
2486 # are required to link).
2487 if test -n "$old_library"; then
2488 newdlprefiles="$newdlprefiles $dir/$old_library"
2489 # Otherwise, use the dlname, so that lt_dlopen finds it.
2490 elif test -n "$dlname"; then
2491 newdlprefiles="$newdlprefiles $dir/$dlname"
2493 newdlprefiles="$newdlprefiles $dir/$linklib"
2495 fi # $pass = dlpreopen
2497 if test -z "$libdir"; then
2498 # Link the convenience library
2499 if test "$linkmode" = lib; then
2500 deplibs="$dir/$old_library $deplibs"
2501 elif test "$linkmode,$pass" = "prog,link"; then
2502 compile_deplibs="$dir/$old_library $compile_deplibs"
2503 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2505 deplibs="$lib $deplibs" # used for prog,scan pass
2511 if test "$linkmode" = prog && test "$pass" != link; then
2512 newlib_search_path="$newlib_search_path $ladir"
2513 deplibs="$lib $deplibs"
2516 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2517 test "$build_libtool_libs" = no; then
2522 for deplib in $dependency_libs; do
2524 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2526 # Need to link against all dependency_libs?
2527 if test "$linkalldeplibs" = yes; then
2528 deplibs="$deplib $deplibs"
2530 # Need to hardcode shared library paths
2531 # or/and link against static libraries
2532 newdependency_libs="$deplib $newdependency_libs"
2534 if test "X$duplicate_deps" = "Xyes" ; then
2535 case "$tmp_libs " in
2536 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2539 tmp_libs="$tmp_libs $deplib"
2542 fi # $linkmode = prog...
2544 if test "$linkmode,$pass" = "prog,link"; then
2545 if test -n "$library_names" &&
2546 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2547 # We need to hardcode the library path
2548 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2549 # Make sure the rpath contains only unique directories.
2550 case "$temp_rpath " in
2553 *) temp_rpath="$temp_rpath $absdir" ;;
2557 # Hardcode the library path.
2558 # Skip directories that are in the system default run-time
2560 case " $sys_lib_dlsearch_path " in
2563 case "$compile_rpath " in
2565 *) compile_rpath="$compile_rpath $absdir"
2569 case " $sys_lib_dlsearch_path " in
2572 case "$finalize_rpath " in
2574 *) finalize_rpath="$finalize_rpath $libdir"
2578 fi # $linkmode,$pass = prog,link...
2580 if test "$alldeplibs" = yes &&
2581 { test "$deplibs_check_method" = pass_all ||
2582 { test "$build_libtool_libs" = yes &&
2583 test -n "$library_names"; }; }; then
2584 # We only need to search for static libraries
2589 link_static=no # Whether the deplib will be linked statically
2590 use_static_libs=$prefer_static_libs
2591 if test "$use_static_libs" = built && test "$installed" = yes ; then
2594 if test -n "$library_names" &&
2595 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2596 if test "$installed" = no; then
2597 notinst_deplibs="$notinst_deplibs $lib"
2600 # This is a shared library
2602 # Warn about portability, can't link against -module's on
2603 # some systems (darwin)
2604 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2606 if test "$linkmode" = prog; then
2607 $echo "*** Warning: Linking the executable $output against the loadable module"
2609 $echo "*** Warning: Linking the shared library $output against the loadable module"
2611 $echo "*** $linklib is not portable!"
2613 if test "$linkmode" = lib &&
2614 test "$hardcode_into_libs" = yes; then
2615 # Hardcode the library path.
2616 # Skip directories that are in the system default run-time
2618 case " $sys_lib_dlsearch_path " in
2621 case "$compile_rpath " in
2623 *) compile_rpath="$compile_rpath $absdir"
2627 case " $sys_lib_dlsearch_path " in
2630 case "$finalize_rpath " in
2632 *) finalize_rpath="$finalize_rpath $libdir"
2638 if test -n "$old_archive_from_expsyms_cmds"; then
2639 # figure out the soname
2640 set dummy $library_names
2643 libname=`eval \\$echo \"$libname_spec\"`
2644 # use dlname if we got it. it's perfectly good, no?
2645 if test -n "$dlname"; then
2647 elif test -n "$soname_spec"; then
2651 major=`expr $current - $age`
2655 eval soname=\"$soname_spec\"
2660 # Make a new name for the extract_expsyms_cmds to use
2662 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2663 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2665 # If the library has no export list, then create one now
2666 if test -f "$output_objdir/$soname-def"; then :
2668 $show "extracting exported symbol list from \`$soname'"
2669 save_ifs="$IFS"; IFS='~'
2670 cmds=$extract_expsyms_cmds
2671 for cmd in $cmds; do
2675 $run eval "$cmd" || exit $?
2681 if test -f "$output_objdir/$newlib"; then :; else
2682 $show "generating import library for \`$soname'"
2683 save_ifs="$IFS"; IFS='~'
2684 cmds=$old_archive_from_expsyms_cmds
2685 for cmd in $cmds; do
2689 $run eval "$cmd" || exit $?
2693 # make sure the library variables are pointing to the new library
2696 fi # test -n "$old_archive_from_expsyms_cmds"
2698 if test "$linkmode" = prog || test "$mode" != relink; then
2703 case $hardcode_action in
2704 immediate | unsupported)
2705 if test "$hardcode_direct" = no; then
2708 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2709 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2710 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2711 *-*-unixware7*) add_dir="-L$dir" ;;
2713 # if the lib is a module then we can not link against
2714 # it, someone is ignoring the new warnings I added
2715 if /usr/bin/file -L $add 2> /dev/null |
2716 $EGREP ": [^:]* bundle" >/dev/null ; then
2717 $echo "** Warning, lib $linklib is a module, not a shared library"
2718 if test -z "$old_library" ; then
2720 $echo "** And there doesn't seem to be a static archive available"
2721 $echo "** The link will probably fail, sorry"
2723 add="$dir/$old_library"
2727 elif test "$hardcode_minus_L" = no; then
2729 *-*-sunos*) add_shlibpath="$dir" ;;
2733 elif test "$hardcode_shlibpath_var" = no; then
2734 add_shlibpath="$dir"
2741 if test "$hardcode_direct" = yes; then
2743 elif test "$hardcode_minus_L" = yes; then
2745 # Try looking first in the location we're being installed to.
2746 if test -n "$inst_prefix_dir"; then
2749 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2754 elif test "$hardcode_shlibpath_var" = yes; then
2755 add_shlibpath="$dir"
2764 if test "$lib_linked" != yes; then
2765 $echo "$modename: configuration error: unsupported hardcode properties"
2769 if test -n "$add_shlibpath"; then
2770 case :$compile_shlibpath: in
2771 *":$add_shlibpath:"*) ;;
2772 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2775 if test "$linkmode" = prog; then
2776 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2777 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2779 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2780 test -n "$add" && deplibs="$add $deplibs"
2781 if test "$hardcode_direct" != yes && \
2782 test "$hardcode_minus_L" != yes && \
2783 test "$hardcode_shlibpath_var" = yes; then
2784 case :$finalize_shlibpath: in
2786 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2792 if test "$linkmode" = prog || test "$mode" = relink; then
2796 # Finalize command for both is simple: just hardcode it.
2797 if test "$hardcode_direct" = yes; then
2798 add="$libdir/$linklib"
2799 elif test "$hardcode_minus_L" = yes; then
2802 elif test "$hardcode_shlibpath_var" = yes; then
2803 case :$finalize_shlibpath: in
2805 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2808 elif test "$hardcode_automatic" = yes; then
2809 if test -n "$inst_prefix_dir" &&
2810 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2811 add="$inst_prefix_dir$libdir/$linklib"
2813 add="$libdir/$linklib"
2816 # We cannot seem to hardcode it, guess we'll fake it.
2818 # Try looking first in the location we're being installed to.
2819 if test -n "$inst_prefix_dir"; then
2822 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2829 if test "$linkmode" = prog; then
2830 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2831 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2833 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2834 test -n "$add" && deplibs="$add $deplibs"
2837 elif test "$linkmode" = prog; then
2838 # Here we assume that one of hardcode_direct or hardcode_minus_L
2839 # is not unsupported. This is valid on all known static and
2841 if test "$hardcode_direct" != unsupported; then
2842 test -n "$old_library" && linklib="$old_library"
2843 compile_deplibs="$dir/$linklib $compile_deplibs"
2844 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2846 compile_deplibs="-l$name -L$dir $compile_deplibs"
2847 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2849 elif test "$build_libtool_libs" = yes; then
2850 # Not a shared library
2851 if test "$deplibs_check_method" != pass_all; then
2852 # We're trying link a shared library against a static one
2853 # but the system doesn't support it.
2855 # Just print a warning and add the library to dependency_libs so
2856 # that the program can be linked against the static library.
2858 $echo "*** Warning: This system can not link to static lib archive $lib."
2859 $echo "*** I have the capability to make that library automatically link in when"
2860 $echo "*** you link to this library. But I can only do this if you have a"
2861 $echo "*** shared version of the library, which you do not appear to have."
2862 if test "$module" = yes; then
2863 $echo "*** But as you try to build a module library, libtool will still create "
2864 $echo "*** a static module, that should work as long as the dlopening application"
2865 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2866 if test -z "$global_symbol_pipe"; then
2868 $echo "*** However, this would only work if libtool was able to extract symbol"
2869 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2870 $echo "*** not find such a program. So, this module is probably useless."
2871 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2873 if test "$build_old_libs" = no; then
2874 build_libtool_libs=module
2877 build_libtool_libs=no
2881 deplibs="$dir/$old_library $deplibs"
2884 fi # link shared/static library?
2886 if test "$linkmode" = lib; then
2887 if test -n "$dependency_libs" &&
2888 { test "$hardcode_into_libs" != yes ||
2889 test "$build_old_libs" = yes ||
2890 test "$link_static" = yes; }; then
2891 # Extract -R from dependency_libs
2893 for libdir in $dependency_libs; do
2895 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2897 *" $temp_xrpath "*) ;;
2898 *) xrpath="$xrpath $temp_xrpath";;
2900 *) temp_deplibs="$temp_deplibs $libdir";;
2903 dependency_libs="$temp_deplibs"
2906 newlib_search_path="$newlib_search_path $absdir"
2907 # Link against this library
2908 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2909 # ... and its dependency_libs
2911 for deplib in $dependency_libs; do
2912 newdependency_libs="$deplib $newdependency_libs"
2913 if test "X$duplicate_deps" = "Xyes" ; then
2914 case "$tmp_libs " in
2915 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2918 tmp_libs="$tmp_libs $deplib"
2921 if test "$link_all_deplibs" != no; then
2922 # Add the search paths of all dependency libraries
2923 for deplib in $dependency_libs; do
2925 -L*) path="$deplib" ;;
2927 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2928 test "X$dir" = "X$deplib" && dir="."
2929 # We need an absolute path.
2931 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2933 absdir=`cd "$dir" && pwd`
2934 if test -z "$absdir"; then
2935 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2940 if grep "^installed=no" $deplib > /dev/null; then
2941 path="$absdir/$objdir"
2943 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2944 if test -z "$libdir"; then
2945 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2948 if test "$absdir" != "$libdir"; then
2949 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2956 # we do not want to link against static libs,
2957 # but need to link against shared
2958 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2959 if test -n "$deplibrary_names" ; then
2960 for tmp in $deplibrary_names ; do
2963 if test -f "$path/$depdepl" ; then
2964 depdepl="$path/$depdepl"
2966 # do not add paths which are already there
2967 case " $newlib_search_path " in
2969 *) newlib_search_path="$newlib_search_path $path";;
2982 # Again, we only want to link against shared libraries
2983 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2984 for tmp in $newlib_search_path ; do
2985 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2986 eval depdepl="$tmp/lib$tmp_libs.dylib"
2997 case " $deplibs " in
2999 *) deplibs="$path $deplibs" ;;
3001 case " $deplibs " in
3003 *) deplibs="$depdepl $deplibs" ;;
3006 fi # link_all_deplibs != no
3008 done # for deplib in $libs
3009 dependency_libs="$newdependency_libs"
3010 if test "$pass" = dlpreopen; then
3011 # Link the dlpreopened libraries before other libraries
3012 for deplib in $save_deplibs; do
3013 deplibs="$deplib $deplibs"
3016 if test "$pass" != dlopen; then
3017 if test "$pass" != conv; then
3018 # Make sure lib_search_path contains only unique directories.
3020 for dir in $newlib_search_path; do
3021 case "$lib_search_path " in
3023 *) lib_search_path="$lib_search_path $dir" ;;
3029 if test "$linkmode,$pass" != "prog,link"; then
3032 vars="compile_deplibs finalize_deplibs"
3034 for var in $vars dependency_libs; do
3035 # Add libraries to $var in reverse order
3036 eval tmp_libs=\"\$$var\"
3038 for deplib in $tmp_libs; do
3039 # FIXME: Pedantically, this is the right thing to do, so
3040 # that some nasty dependency loop isn't accidentally
3042 #new_libs="$deplib $new_libs"
3043 # Pragmatically, this seems to cause very few problems in
3046 -L*) new_libs="$deplib $new_libs" ;;
3049 # And here is the reason: when a library appears more
3050 # than once as an explicit dependence of a library, or
3051 # is implicitly linked in more than once by the
3052 # compiler, it is considered special, and multiple
3053 # occurrences thereof are not removed. Compare this
3054 # with having the same library being listed as a
3055 # dependency of multiple other libraries: in this case,
3056 # we know (pedantically, we assume) the library does not
3057 # need to be listed more than once, so we keep only the
3058 # last copy. This is not always right, but it is rare
3059 # enough that we require users that really mean to play
3060 # such unportable linking tricks to link the library
3061 # using -Wl,-lname, so that libtool does not consider it
3062 # for duplicate removal.
3063 case " $specialdeplibs " in
3064 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3066 case " $new_libs " in
3068 *) new_libs="$deplib $new_libs" ;;
3076 for deplib in $new_libs; do
3079 case " $tmp_libs " in
3081 *) tmp_libs="$tmp_libs $deplib" ;;
3084 *) tmp_libs="$tmp_libs $deplib" ;;
3087 eval $var=\"$tmp_libs\"
3090 # Last step: remove runtime libs from dependency_libs
3091 # (they stay in deplibs)
3093 for i in $dependency_libs ; do
3094 case " $predeps $postdeps $compiler_lib_search_path " in
3099 if test -n "$i" ; then
3100 tmp_libs="$tmp_libs $i"
3103 dependency_libs=$tmp_libs
3105 if test "$linkmode" = prog; then
3106 dlfiles="$newdlfiles"
3107 dlprefiles="$newdlprefiles"
3112 if test -n "$deplibs"; then
3113 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3116 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3117 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3120 if test -n "$rpath"; then
3121 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3124 if test -n "$xrpath"; then
3125 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3128 if test -n "$vinfo"; then
3129 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3132 if test -n "$release"; then
3133 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3136 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3137 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3140 # Now set the variables for building old libraries.
3141 build_libtool_libs=no
3143 objs="$objs$old_deplibs"
3147 # Make sure we only generate libraries of the form `libNAME.la'.
3150 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3151 eval shared_ext=\"$shrext_cmds\"
3152 eval libname=\"$libname_spec\"
3155 if test "$module" = no; then
3156 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3160 if test "$need_lib_prefix" != no; then
3161 # Add the "lib" prefix for modules if required
3162 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3163 eval shared_ext=\"$shrext_cmds\"
3164 eval libname=\"$libname_spec\"
3166 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3171 if test -n "$objs"; then
3172 if test "$deplibs_check_method" != pass_all; then
3173 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3177 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3178 $echo "*** objects $objs is not portable!"
3179 libobjs="$libobjs $objs"
3183 if test "$dlself" != no; then
3184 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3188 if test "$#" -gt 2; then
3189 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3194 if test -z "$rpath"; then
3195 if test "$build_libtool_libs" = yes; then
3196 # Building a libtool convenience library.
3197 # Some compilers have problems with a `.al' extension so
3198 # convenience libraries should have the same extension an
3199 # archive normally would.
3200 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3201 build_libtool_libs=convenience
3205 if test -n "$vinfo"; then
3206 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3209 if test -n "$release"; then
3210 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3214 # Parse the version information argument.
3215 save_ifs="$IFS"; IFS=':'
3216 set dummy $vinfo 0 0 0
3219 if test -n "$8"; then
3220 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3225 # convert absolute version numbers to libtool ages
3226 # this retains compatibility with .la files and attempts
3227 # to make the code below a bit more comprehensible
3229 case $vinfo_number in
3233 number_revision="$4"
3235 # There are really only two kinds -- those that
3236 # use the current revision as the major version
3237 # and those that subtract age and use age as
3238 # a minor version. But, then there is irix
3239 # which has an extra 1 added just for fun
3241 case $version_type in
3242 darwin|linux|osf|windows)
3243 current=`expr $number_major + $number_minor`
3245 revision="$number_revision"
3247 freebsd-aout|freebsd-elf|sunos)
3248 current="$number_major"
3249 revision="$number_minor"
3253 current=`expr $number_major + $number_minor - 1`
3255 revision="$number_minor"
3266 # Check that each of the things are valid numbers.
3268 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]) ;;
3270 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3271 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3277 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]) ;;
3279 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3280 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3286 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]) ;;
3288 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3289 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3294 if test "$age" -gt "$current"; then
3295 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3296 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3300 # Calculate the version variables.
3304 case $version_type in
3308 # Like Linux, but with the current version available in
3309 # verstring for coding it into the library header
3310 major=.`expr $current - $age`
3311 versuffix="$major.$age.$revision"
3312 # Darwin ld doesn't like 0 for these options...
3313 minor_current=`expr $current + 1`
3314 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3319 versuffix=".$current.$revision";
3324 versuffix=".$current";
3328 major=`expr $current - $age + 1`
3330 case $version_type in
3331 nonstopux) verstring_prefix=nonstopux ;;
3332 *) verstring_prefix=sgi ;;
3334 verstring="$verstring_prefix$major.$revision"
3336 # Add in all the interfaces that we are compatible with.
3338 while test "$loop" -ne 0; do
3339 iface=`expr $revision - $loop`
3340 loop=`expr $loop - 1`
3341 verstring="$verstring_prefix$major.$iface:$verstring"
3344 # Before this point, $major must not contain `.'.
3346 versuffix="$major.$revision"
3350 major=.`expr $current - $age`
3351 versuffix="$major.$age.$revision"
3355 major=.`expr $current - $age`
3356 versuffix=".$current.$age.$revision"
3357 verstring="$current.$age.$revision"
3359 # Add in all the interfaces that we are compatible with.
3361 while test "$loop" -ne 0; do
3362 iface=`expr $current - $loop`
3363 loop=`expr $loop - 1`
3364 verstring="$verstring:${iface}.0"
3367 # Make executables depend on our current version.
3368 verstring="$verstring:${current}.0"
3373 versuffix=".$current.$revision"
3377 # Use '-' rather than '.', since we only want one
3378 # extension on DOS 8.3 filesystems.
3379 major=`expr $current - $age`
3384 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3385 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3390 # Clear the version info if we defaulted, and they specified a release.
3391 if test -z "$vinfo" && test -n "$release"; then
3393 case $version_type in
3395 # we can't check for "0.0" in archive_cmds due to quoting
3396 # problems, so we reset it completely
3403 if test "$need_version" = no; then
3410 # Remove version info from name if versioning should be avoided
3411 if test "$avoid_version" = yes && test "$need_version" = no; then
3417 # Check to see if the archive will have undefined symbols.
3418 if test "$allow_undefined" = yes; then
3419 if test "$allow_undefined_flag" = unsupported; then
3420 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3421 build_libtool_libs=no
3425 # Don't allow undefined symbols.
3426 allow_undefined_flag="$no_undefined_flag"
3430 if test "$mode" != relink; then
3431 # Remove our outputs, but don't remove object files since they
3432 # may have been created when compiling PIC objects.
3434 tempremovelist=`$echo "$output_objdir/*"`
3435 for p in $tempremovelist; do
3439 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3440 if test "X$precious_files_regex" != "X"; then
3441 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3446 removelist="$removelist $p"
3451 if test -n "$removelist"; then
3452 $show "${rm}r $removelist"
3453 $run ${rm}r $removelist
3457 # Now set the variables for building old libraries.
3458 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3459 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3461 # Transform .lo files to .o files.
3462 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3465 # Eliminate all temporary directories.
3466 for path in $notinst_path; do
3467 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3468 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3469 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3472 if test -n "$xrpath"; then
3473 # If the user specified any rpath flags, then add them.
3475 for libdir in $xrpath; do
3476 temp_xrpath="$temp_xrpath -R$libdir"
3477 case "$finalize_rpath " in
3479 *) finalize_rpath="$finalize_rpath $libdir" ;;
3482 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3483 dependency_libs="$temp_xrpath $dependency_libs"
3487 # Make sure dlfiles contains only unique files that won't be dlpreopened
3488 old_dlfiles="$dlfiles"
3490 for lib in $old_dlfiles; do
3491 case " $dlprefiles $dlfiles " in
3493 *) dlfiles="$dlfiles $lib" ;;
3497 # Make sure dlprefiles contains only unique files
3498 old_dlprefiles="$dlprefiles"
3500 for lib in $old_dlprefiles; do
3501 case "$dlprefiles " in
3503 *) dlprefiles="$dlprefiles $lib" ;;
3507 if test "$build_libtool_libs" = yes; then
3508 if test -n "$rpath"; then
3510 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3511 # these systems don't actually have a c library (as such)!
3513 *-*-rhapsody* | *-*-darwin1.[012])
3514 # Rhapsody C library is in the System framework
3515 deplibs="$deplibs -framework System"
3518 # Don't link with libc until the a.out ld.so is fixed.
3520 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3521 # Do not include libc due to us having libc/libc_r.
3523 *-*-sco3.2v5* | *-*-sco5v6*)
3524 # Causes problems with __ctype
3526 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3527 # Compiler inserts libc in the correct place for threads to work
3530 # Add libc to deplibs on all other systems if necessary.
3531 if test "$build_libtool_need_lc" = "yes"; then
3532 deplibs="$deplibs -lc"
3538 # Transform deplibs into only deplibs that can be linked in shared.
3540 libname_save=$libname
3541 release_save=$release
3542 versuffix_save=$versuffix
3544 # I'm not sure if I'm treating the release correctly. I think
3545 # release should show up in the -l (ie -lgmp5) so we don't want to
3546 # add it in twice. Is that correct?
3552 case $deplibs_check_method in
3554 # Don't check for shared/static. Everything works.
3555 # This might be a little naive. We might want to check
3556 # whether the library exists or not. But this is on
3557 # osf3 & osf4 and I'm not really sure... Just
3558 # implementing what was already the behavior.
3562 # This code stresses the "libraries are programs" paradigm to its
3563 # limits. Maybe even breaks it. We compile a program, linking it
3564 # against the deplibs as a proxy for the library. Then we can check
3565 # whether they linked in statically or dynamically with ldd.
3567 cat > conftest.c <<EOF
3568 int main() { return 0; }
3571 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3572 if test "$?" -eq 0 ; then
3573 ldd_output=`ldd conftest`
3574 for i in $deplibs; do
3575 name=`expr $i : '-l\(.*\)'`
3576 # If $name is empty we are operating on a -L argument.
3577 if test "$name" != "" && test "$name" -ne "0"; then
3578 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3579 case " $predeps $postdeps " in
3581 newdeplibs="$newdeplibs $i"
3586 if test -n "$i" ; then
3587 libname=`eval \\$echo \"$libname_spec\"`
3588 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3589 set dummy $deplib_matches
3591 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3592 newdeplibs="$newdeplibs $i"
3596 $echo "*** Warning: dynamic linker does not accept needed library $i."
3597 $echo "*** I have the capability to make that library automatically link in when"
3598 $echo "*** you link to this library. But I can only do this if you have a"
3599 $echo "*** shared version of the library, which I believe you do not have"
3600 $echo "*** because a test_compile did reveal that the linker did not use it for"
3601 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3605 newdeplibs="$newdeplibs $i"
3609 # Error occurred in the first compile. Let's try to salvage
3610 # the situation: Compile a separate program for each library.
3611 for i in $deplibs; do
3612 name=`expr $i : '-l\(.*\)'`
3613 # If $name is empty we are operating on a -L argument.
3614 if test "$name" != "" && test "$name" != "0"; then
3616 $LTCC $LTCFLAGS -o conftest conftest.c $i
3618 if test "$?" -eq 0 ; then
3619 ldd_output=`ldd conftest`
3620 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3621 case " $predeps $postdeps " in
3623 newdeplibs="$newdeplibs $i"
3628 if test -n "$i" ; then
3629 libname=`eval \\$echo \"$libname_spec\"`
3630 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3631 set dummy $deplib_matches
3633 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3634 newdeplibs="$newdeplibs $i"
3638 $echo "*** Warning: dynamic linker does not accept needed library $i."
3639 $echo "*** I have the capability to make that library automatically link in when"
3640 $echo "*** you link to this library. But I can only do this if you have a"
3641 $echo "*** shared version of the library, which you do not appear to have"
3642 $echo "*** because a test_compile did reveal that the linker did not use this one"
3643 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3649 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3650 $echo "*** make it link in! You will probably need to install it or some"
3651 $echo "*** library that it depends on before this library will be fully"
3652 $echo "*** functional. Installing it before continuing would be even better."
3655 newdeplibs="$newdeplibs $i"
3661 set dummy $deplibs_check_method
3662 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3663 for a_deplib in $deplibs; do
3664 name=`expr $a_deplib : '-l\(.*\)'`
3665 # If $name is empty we are operating on a -L argument.
3666 if test "$name" != "" && test "$name" != "0"; then
3667 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3668 case " $predeps $postdeps " in
3670 newdeplibs="$newdeplibs $a_deplib"
3675 if test -n "$a_deplib" ; then
3676 libname=`eval \\$echo \"$libname_spec\"`
3677 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3678 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3679 for potent_lib in $potential_libs; do
3680 # Follow soft links.
3681 if ls -lLd "$potent_lib" 2>/dev/null \
3682 | grep " -> " >/dev/null; then
3685 # The statement above tries to avoid entering an
3686 # endless loop below, in case of cyclic links.
3687 # We might still enter an endless loop, since a link
3688 # loop can be closed while we follow links,
3690 potlib="$potent_lib"
3691 while test -h "$potlib" 2>/dev/null; do
3692 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3694 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3695 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3698 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3700 | $EGREP "$file_magic_regex" > /dev/null; then
3701 newdeplibs="$newdeplibs $a_deplib"
3708 if test -n "$a_deplib" ; then
3711 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3712 $echo "*** I have the capability to make that library automatically link in when"
3713 $echo "*** you link to this library. But I can only do this if you have a"
3714 $echo "*** shared version of the library, which you do not appear to have"
3715 $echo "*** because I did check the linker path looking for a file starting"
3716 if test -z "$potlib" ; then
3717 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3719 $echo "*** with $libname and none of the candidates passed a file format test"
3720 $echo "*** using a file magic. Last file checked: $potlib"
3724 # Add a -L argument.
3725 newdeplibs="$newdeplibs $a_deplib"
3727 done # Gone through all deplibs.
3730 set dummy $deplibs_check_method
3731 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3732 for a_deplib in $deplibs; do
3733 name=`expr $a_deplib : '-l\(.*\)'`
3734 # If $name is empty we are operating on a -L argument.
3735 if test -n "$name" && test "$name" != "0"; then
3736 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3737 case " $predeps $postdeps " in
3739 newdeplibs="$newdeplibs $a_deplib"
3744 if test -n "$a_deplib" ; then
3745 libname=`eval \\$echo \"$libname_spec\"`
3746 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3747 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3748 for potent_lib in $potential_libs; do
3749 potlib="$potent_lib" # see symlink-check above in file_magic test
3750 if eval $echo \"$potent_lib\" 2>/dev/null \
3752 | $EGREP "$match_pattern_regex" > /dev/null; then
3753 newdeplibs="$newdeplibs $a_deplib"
3760 if test -n "$a_deplib" ; then
3763 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3764 $echo "*** I have the capability to make that library automatically link in when"
3765 $echo "*** you link to this library. But I can only do this if you have a"
3766 $echo "*** shared version of the library, which you do not appear to have"
3767 $echo "*** because I did check the linker path looking for a file starting"
3768 if test -z "$potlib" ; then
3769 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3771 $echo "*** with $libname and none of the candidates passed a file format test"
3772 $echo "*** using a regex pattern. Last file checked: $potlib"
3776 # Add a -L argument.
3777 newdeplibs="$newdeplibs $a_deplib"
3779 done # Gone through all deplibs.
3783 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3784 -e 's/ -[LR][^ ]*//g'`
3785 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3786 for i in $predeps $postdeps ; do
3787 # can't use Xsed below, because $i might contain '/'
3788 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3791 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3792 | grep . >/dev/null; then
3794 if test "X$deplibs_check_method" = "Xnone"; then
3795 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3797 $echo "*** Warning: inter-library dependencies are not known to be supported."
3799 $echo "*** All declared inter-library dependencies are being dropped."
3804 versuffix=$versuffix_save
3806 release=$release_save
3807 libname=$libname_save
3811 *-*-rhapsody* | *-*-darwin1.[012])
3812 # On Rhapsody replace the C library is the System framework
3813 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3817 if test "$droppeddeps" = yes; then
3818 if test "$module" = yes; then
3820 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3821 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3822 $echo "*** a static module, that should work as long as the dlopening"
3823 $echo "*** application is linked with the -dlopen flag."
3824 if test -z "$global_symbol_pipe"; then
3826 $echo "*** However, this would only work if libtool was able to extract symbol"
3827 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3828 $echo "*** not find such a program. So, this module is probably useless."
3829 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3831 if test "$build_old_libs" = no; then
3832 oldlibs="$output_objdir/$libname.$libext"
3833 build_libtool_libs=module
3836 build_libtool_libs=no
3839 $echo "*** The inter-library dependencies that have been dropped here will be"
3840 $echo "*** automatically added whenever a program is linked with this library"
3841 $echo "*** or is declared to -dlopen it."
3843 if test "$allow_undefined" = no; then
3845 $echo "*** Since this library must not contain undefined symbols,"
3846 $echo "*** because either the platform does not support them or"
3847 $echo "*** it was explicitly requested with -no-undefined,"
3848 $echo "*** libtool will only create a static version of it."
3849 if test "$build_old_libs" = no; then
3850 oldlibs="$output_objdir/$libname.$libext"
3851 build_libtool_libs=module
3854 build_libtool_libs=no
3859 # Done checking deplibs!
3864 # move library search paths that coincide with paths to not yet
3865 # installed libraries to the beginning of the library search list
3867 for path in $notinst_path; do
3868 case " $new_libs " in
3869 *" -L$path/$objdir "*) ;;
3871 case " $deplibs " in
3872 *" -L$path/$objdir "*)
3873 new_libs="$new_libs -L$path/$objdir" ;;
3878 for deplib in $deplibs; do
3881 case " $new_libs " in
3883 *) new_libs="$new_libs $deplib" ;;
3886 *) new_libs="$new_libs $deplib" ;;
3892 # All the library-specific variables (install_libdir is set above).
3897 # Test again, we may have decided not to build it any more
3898 if test "$build_libtool_libs" = yes; then
3899 if test "$hardcode_into_libs" = yes; then
3900 # Hardcode the library paths
3903 rpath="$finalize_rpath"
3904 test "$mode" != relink && rpath="$compile_rpath$rpath"
3905 for libdir in $rpath; do
3906 if test -n "$hardcode_libdir_flag_spec"; then
3907 if test -n "$hardcode_libdir_separator"; then
3908 if test -z "$hardcode_libdirs"; then
3909 hardcode_libdirs="$libdir"
3911 # Just accumulate the unique libdirs.
3912 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3913 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3916 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3921 eval flag=\"$hardcode_libdir_flag_spec\"
3922 dep_rpath="$dep_rpath $flag"
3924 elif test -n "$runpath_var"; then
3925 case "$perm_rpath " in
3927 *) perm_rpath="$perm_rpath $libdir" ;;
3931 # Substitute the hardcoded libdirs into the rpath.
3932 if test -n "$hardcode_libdir_separator" &&
3933 test -n "$hardcode_libdirs"; then
3934 libdir="$hardcode_libdirs"
3935 if test -n "$hardcode_libdir_flag_spec_ld"; then
3936 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3938 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3941 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3942 # We should set the runpath_var.
3944 for dir in $perm_rpath; do
3947 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3949 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3952 shlibpath="$finalize_shlibpath"
3953 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3954 if test -n "$shlibpath"; then
3955 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3958 # Get the real and link names of the library.
3959 eval shared_ext=\"$shrext_cmds\"
3960 eval library_names=\"$library_names_spec\"
3961 set dummy $library_names
3965 if test -n "$soname_spec"; then
3966 eval soname=\"$soname_spec\"
3970 if test -z "$dlname"; then
3974 lib="$output_objdir/$realname"
3978 linknames="$linknames $link"
3981 # Use standard objects if they are pic
3982 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3984 # Prepare the list of exported symbols
3985 if test -z "$export_symbols"; then
3986 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3987 $show "generating symbol list for \`$libname.la'"
3988 export_symbols="$output_objdir/$libname.exp"
3989 $run $rm $export_symbols
3990 cmds=$export_symbols_cmds
3991 save_ifs="$IFS"; IFS='~'
3992 for cmd in $cmds; do
3995 if len=`expr "X$cmd" : ".*"` &&
3996 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3998 $run eval "$cmd" || exit $?
3999 skipped_export=false
4001 # The command line is too long to execute in one step.
4002 $show "using reloadable object file for export list..."
4004 # Break out early, otherwise skipped_export may be
4005 # set to false by a later but shorter cmd.
4010 if test -n "$export_symbols_regex"; then
4011 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4012 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4013 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4014 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4019 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4020 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4024 for test_deplib in $deplibs; do
4025 case " $convenience " in
4026 *" $test_deplib "*) ;;
4028 tmp_deplibs="$tmp_deplibs $test_deplib"
4032 deplibs="$tmp_deplibs"
4034 if test -n "$convenience"; then
4035 if test -n "$whole_archive_flag_spec"; then
4036 save_libobjs=$libobjs
4037 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4039 gentop="$output_objdir/${outputname}x"
4040 generated="$generated $gentop"
4042 func_extract_archives $gentop $convenience
4043 libobjs="$libobjs $func_extract_archives_result"
4047 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4048 eval flag=\"$thread_safe_flag_spec\"
4049 linker_flags="$linker_flags $flag"
4052 # Make a backup of the uninstalled library when relinking
4053 if test "$mode" = relink; then
4054 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4057 # Do each of the archive commands.
4058 if test "$module" = yes && test -n "$module_cmds" ; then
4059 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4060 eval test_cmds=\"$module_expsym_cmds\"
4061 cmds=$module_expsym_cmds
4063 eval test_cmds=\"$module_cmds\"
4067 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4068 eval test_cmds=\"$archive_expsym_cmds\"
4069 cmds=$archive_expsym_cmds
4071 eval test_cmds=\"$archive_cmds\"
4076 if test "X$skipped_export" != "X:" &&
4077 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4078 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4081 # The command line is too long to link in one step, link piecewise.
4082 $echo "creating reloadable object files..."
4084 # Save the value of $output and $libobjs because we want to
4085 # use them later. If we have whole_archive_flag_spec, we
4086 # want to use save_libobjs as it was before
4087 # whole_archive_flag_spec was expanded, because we can't
4088 # assume the linker understands whole_archive_flag_spec.
4089 # This may have to be revisited, in case too many
4090 # convenience libraries get linked in and end up exceeding
4092 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4093 save_libobjs=$libobjs
4096 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4098 # Clear the reloadable object creation command queue and
4099 # initialize k to one.
4106 output=$output_objdir/$output_la-${k}.$objext
4107 # Loop over the list of objects to be linked.
4108 for obj in $save_libobjs
4110 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4111 if test "X$objlist" = X ||
4112 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4113 test "$len" -le "$max_cmd_len"; }; then
4114 objlist="$objlist $obj"
4116 # The command $test_cmds is almost too long, add a
4117 # command to the queue.
4118 if test "$k" -eq 1 ; then
4119 # The first file doesn't have a previous command to add.
4120 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4122 # All subsequent reloadable object files will link in
4123 # the last one created.
4124 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4126 last_robj=$output_objdir/$output_la-${k}.$objext
4128 output=$output_objdir/$output_la-${k}.$objext
4133 # Handle the remaining objects by creating one last
4134 # reloadable object file. All subsequent reloadable object
4135 # files will link in the last one created.
4136 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4137 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4139 if ${skipped_export-false}; then
4140 $show "generating symbol list for \`$libname.la'"
4141 export_symbols="$output_objdir/$libname.exp"
4142 $run $rm $export_symbols
4144 # Append the command to create the export file.
4145 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4148 # Set up a command to remove the reloadable object files
4149 # after they are used.
4151 while test "$i" -lt "$k"
4154 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4157 $echo "creating a temporary reloadable object file: $output"
4159 # Loop through the commands generated above and execute them.
4160 save_ifs="$IFS"; IFS='~'
4161 for cmd in $concat_cmds; do
4164 $run eval "$cmd" || exit $?
4169 # Restore the value of output.
4172 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4173 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4175 # Expand the library linking commands again to reset the
4176 # value of $libobjs for piecewise linking.
4178 # Do each of the archive commands.
4179 if test "$module" = yes && test -n "$module_cmds" ; then
4180 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4181 cmds=$module_expsym_cmds
4186 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4187 cmds=$archive_expsym_cmds
4193 # Append the command to remove the reloadable object files
4194 # to the just-reset $cmds.
4195 eval cmds=\"\$cmds~\$rm $delfiles\"
4197 save_ifs="$IFS"; IFS='~'
4198 for cmd in $cmds; do
4202 $run eval "$cmd" || {
4205 # Restore the uninstalled library and exit
4206 if test "$mode" = relink; then
4207 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4215 # Restore the uninstalled library and exit
4216 if test "$mode" = relink; then
4217 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4219 if test -n "$convenience"; then
4220 if test -z "$whole_archive_flag_spec"; then
4221 $show "${rm}r $gentop"
4222 $run ${rm}r "$gentop"
4229 # Create links to the real library.
4230 for linkname in $linknames; do
4231 if test "$realname" != "$linkname"; then
4232 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4233 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4237 # If -module or -export-dynamic was specified, set the dlname.
4238 if test "$module" = yes || test "$export_dynamic" = yes; then
4239 # On all known operating systems, these are identical.
4246 if test -n "$deplibs"; then
4247 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4250 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4251 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4254 if test -n "$rpath"; then
4255 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4258 if test -n "$xrpath"; then
4259 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4262 if test -n "$vinfo"; then
4263 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4266 if test -n "$release"; then
4267 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4272 if test -n "$objs$old_deplibs"; then
4273 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4277 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4285 # Delete the old objects.
4286 $run $rm $obj $libobj
4288 # Objects from convenience libraries. This assumes
4289 # single-version convenience libraries. Whenever we create
4290 # different ones for PIC/non-PIC, this we'll have to duplicate
4294 # reload_cmds runs $LD directly, so let us get rid of
4295 # -Wl from whole_archive_flag_spec
4298 if test -n "$convenience"; then
4299 if test -n "$whole_archive_flag_spec"; then
4300 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4302 gentop="$output_objdir/${obj}x"
4303 generated="$generated $gentop"
4305 func_extract_archives $gentop $convenience
4306 reload_conv_objs="$reload_objs $func_extract_archives_result"
4310 # Create the old-style object.
4311 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
4315 save_ifs="$IFS"; IFS='~'
4316 for cmd in $cmds; do
4320 $run eval "$cmd" || exit $?
4324 # Exit if we aren't doing a library object file.
4325 if test -z "$libobj"; then
4326 if test -n "$gentop"; then
4327 $show "${rm}r $gentop"
4334 if test "$build_libtool_libs" != yes; then
4335 if test -n "$gentop"; then
4336 $show "${rm}r $gentop"
4340 # Create an invalid libtool object if no PIC, so that we don't
4341 # accidentally link it into a program.
4342 # $show "echo timestamp > $libobj"
4343 # $run eval "echo timestamp > $libobj" || exit $?
4347 if test -n "$pic_flag" || test "$pic_mode" != default; then
4348 # Only do commands if we really have different PIC objects.
4349 reload_objs="$libobjs $reload_conv_objs"
4352 save_ifs="$IFS"; IFS='~'
4353 for cmd in $cmds; do
4357 $run eval "$cmd" || exit $?
4362 if test -n "$gentop"; then
4363 $show "${rm}r $gentop"
4372 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4374 if test -n "$vinfo"; then
4375 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4378 if test -n "$release"; then
4379 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4382 if test "$preload" = yes; then
4383 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4384 test "$dlopen_self_static" = unknown; then
4385 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4390 *-*-rhapsody* | *-*-darwin1.[012])
4391 # On Rhapsody replace the C library is the System framework
4392 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4393 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4399 # Don't allow lazy linking, it breaks C++ global constructors
4400 if test "$tagname" = CXX ; then
4401 compile_command="$compile_command ${wl}-bind_at_load"
4402 finalize_command="$finalize_command ${wl}-bind_at_load"
4408 # move library search paths that coincide with paths to not yet
4409 # installed libraries to the beginning of the library search list
4411 for path in $notinst_path; do
4412 case " $new_libs " in
4413 *" -L$path/$objdir "*) ;;
4415 case " $compile_deplibs " in
4416 *" -L$path/$objdir "*)
4417 new_libs="$new_libs -L$path/$objdir" ;;
4422 for deplib in $compile_deplibs; do
4425 case " $new_libs " in
4427 *) new_libs="$new_libs $deplib" ;;
4430 *) new_libs="$new_libs $deplib" ;;
4433 compile_deplibs="$new_libs"
4436 compile_command="$compile_command $compile_deplibs"
4437 finalize_command="$finalize_command $finalize_deplibs"
4439 if test -n "$rpath$xrpath"; then
4440 # If the user specified any rpath flags, then add them.
4441 for libdir in $rpath $xrpath; do
4442 # This is the magic to use -rpath.
4443 case "$finalize_rpath " in
4445 *) finalize_rpath="$finalize_rpath $libdir" ;;
4450 # Now hardcode the library paths
4453 for libdir in $compile_rpath $finalize_rpath; do
4454 if test -n "$hardcode_libdir_flag_spec"; then
4455 if test -n "$hardcode_libdir_separator"; then
4456 if test -z "$hardcode_libdirs"; then
4457 hardcode_libdirs="$libdir"
4459 # Just accumulate the unique libdirs.
4460 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4461 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4464 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4469 eval flag=\"$hardcode_libdir_flag_spec\"
4470 rpath="$rpath $flag"
4472 elif test -n "$runpath_var"; then
4473 case "$perm_rpath " in
4475 *) perm_rpath="$perm_rpath $libdir" ;;
4479 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4480 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4481 case :$dllsearchpath: in
4483 *) dllsearchpath="$dllsearchpath:$libdir";;
4485 case :$dllsearchpath: in
4486 *":$testbindir:"*) ;;
4487 *) dllsearchpath="$dllsearchpath:$testbindir";;
4492 # Substitute the hardcoded libdirs into the rpath.
4493 if test -n "$hardcode_libdir_separator" &&
4494 test -n "$hardcode_libdirs"; then
4495 libdir="$hardcode_libdirs"
4496 eval rpath=\" $hardcode_libdir_flag_spec\"
4498 compile_rpath="$rpath"
4502 for libdir in $finalize_rpath; do
4503 if test -n "$hardcode_libdir_flag_spec"; then
4504 if test -n "$hardcode_libdir_separator"; then
4505 if test -z "$hardcode_libdirs"; then
4506 hardcode_libdirs="$libdir"
4508 # Just accumulate the unique libdirs.
4509 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4510 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4513 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4518 eval flag=\"$hardcode_libdir_flag_spec\"
4519 rpath="$rpath $flag"
4521 elif test -n "$runpath_var"; then
4522 case "$finalize_perm_rpath " in
4524 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4528 # Substitute the hardcoded libdirs into the rpath.
4529 if test -n "$hardcode_libdir_separator" &&
4530 test -n "$hardcode_libdirs"; then
4531 libdir="$hardcode_libdirs"
4532 eval rpath=\" $hardcode_libdir_flag_spec\"
4534 finalize_rpath="$rpath"
4536 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4537 # Transform all the library objects into standard objects.
4538 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4539 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4543 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4544 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4545 dlsyms="${outputname}S.c"
4547 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4551 if test -n "$dlsyms"; then
4555 # Discover the nlist of each of the dlfiles.
4556 nlist="$output_objdir/${outputname}.nm"
4558 $show "$rm $nlist ${nlist}S ${nlist}T"
4559 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4561 # Parse the name list into a source file.
4562 $show "creating $output_objdir/$dlsyms"
4564 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4565 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4566 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4572 /* Prevent the only kind of declaration conflicts we can make. */
4573 #define lt_preloaded_symbols some_other_symbol
4575 /* External symbol declarations for the compiler. */\
4578 if test "$dlself" = yes; then
4579 $show "generating symbol list for \`$output'"
4581 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4583 # Add our own program objects to the symbol list.
4584 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4585 for arg in $progfiles; do
4586 $show "extracting global C symbols from \`$arg'"
4587 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4590 if test -n "$exclude_expsyms"; then
4591 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4592 $run eval '$mv "$nlist"T "$nlist"'
4595 if test -n "$export_symbols_regex"; then
4596 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4597 $run eval '$mv "$nlist"T "$nlist"'
4600 # Prepare the list of exported symbols
4601 if test -z "$export_symbols"; then
4602 export_symbols="$output_objdir/$outputname.exp"
4603 $run $rm $export_symbols
4604 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4606 *cygwin* | *mingw* )
4607 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4608 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4612 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4613 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4614 $run eval 'mv "$nlist"T "$nlist"'
4616 *cygwin* | *mingw* )
4617 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4618 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4624 for arg in $dlprefiles; do
4625 $show "extracting global C symbols from \`$arg'"
4626 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4627 $run eval '$echo ": $name " >> "$nlist"'
4628 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4631 if test -z "$run"; then
4632 # Make sure we have at least an empty file.
4633 test -f "$nlist" || : > "$nlist"
4635 if test -n "$exclude_expsyms"; then
4636 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4637 $mv "$nlist"T "$nlist"
4640 # Try sorting and uniquifying the output.
4641 if grep -v "^: " < "$nlist" |
4642 if sort -k 3 </dev/null >/dev/null 2>&1; then
4647 uniq > "$nlist"S; then
4650 grep -v "^: " < "$nlist" > "$nlist"S
4653 if test -f "$nlist"S; then
4654 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4656 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4659 $echo >> "$output_objdir/$dlsyms" "\
4661 #undef lt_preloaded_symbols
4663 #if defined (__STDC__) && __STDC__
4664 # define lt_ptr void *
4666 # define lt_ptr char *
4670 /* The mapping between symbol names and symbols. */
4674 *cygwin* | *mingw* )
4675 $echo >> "$output_objdir/$dlsyms" "\
4676 /* DATA imports from DLLs on WIN32 can't be const, because
4677 runtime relocations are performed -- see ld's documentation
4683 $echo >> "$output_objdir/$dlsyms" "\
4690 $echo >> "$output_objdir/$dlsyms" "\
4694 lt_preloaded_symbols[] =
4698 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4700 $echo >> "$output_objdir/$dlsyms" "\
4704 /* This works around a problem in FreeBSD linker */
4705 #ifdef FREEBSD_WORKAROUND
4706 static const void *lt_preloaded_setup() {
4707 return lt_preloaded_symbols;
4717 pic_flag_for_symtable=
4719 # compiling the symbol table file with pic_flag works around
4720 # a FreeBSD bug that causes programs to crash when -lm is
4721 # linked before any other PIC object. But we must not use
4722 # pic_flag when linking with -static. The problem exists in
4723 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4724 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4725 case "$compile_command " in
4727 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4730 case "$compile_command " in
4732 *) pic_flag_for_symtable=" $pic_flag";;
4736 # Now compile the dynamic symbol file.
4737 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4738 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4740 # Clean up the generated files.
4741 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4742 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4744 # Transform the symbol file into the correct name.
4746 *cygwin* | *mingw* )
4747 if test -f "$output_objdir/${outputname}.def" ; then
4748 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4749 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4751 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4752 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4756 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4757 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4762 # FreeBSD doesn't need this...
4765 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4770 # We keep going just in case the user didn't refer to
4771 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4772 # really was required.
4774 # Nullify the symbol file.
4775 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4776 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4779 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4780 # Replace the output file specification.
4781 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4782 link_command="$compile_command$compile_rpath"
4784 # We have no uninstalled library dependencies, so finalize right now.
4785 $show "$link_command"
4786 $run eval "$link_command"
4789 # Delete the generated files.
4790 if test -n "$dlsyms"; then
4791 $show "$rm $output_objdir/${outputname}S.${objext}"
4792 $run $rm "$output_objdir/${outputname}S.${objext}"
4798 if test -n "$shlibpath_var"; then
4799 # We should set the shlibpath_var
4801 for dir in $temp_rpath; do
4803 [\\/]* | [A-Za-z]:[\\/]*)
4808 # Relative path: add a thisdir entry.
4809 rpath="$rpath\$thisdir/$dir:"
4816 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4817 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4819 if test -n "$finalize_shlibpath"; then
4820 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4825 if test -n "$runpath_var"; then
4826 if test -n "$perm_rpath"; then
4827 # We should set the runpath_var.
4829 for dir in $perm_rpath; do
4832 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4834 if test -n "$finalize_perm_rpath"; then
4835 # We should set the runpath_var.
4837 for dir in $finalize_perm_rpath; do
4840 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4844 if test "$no_install" = yes; then
4845 # We don't need to create a wrapper script.
4846 link_command="$compile_var$compile_command$compile_rpath"
4847 # Replace the output file specification.
4848 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4849 # Delete the old output file.
4851 # Link the executable and exit
4852 $show "$link_command"
4853 $run eval "$link_command" || exit $?
4857 if test "$hardcode_action" = relink; then
4858 # Fast installation is not supported
4859 link_command="$compile_var$compile_command$compile_rpath"
4860 relink_command="$finalize_var$finalize_command$finalize_rpath"
4862 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4863 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4865 if test "$fast_install" != no; then
4866 link_command="$finalize_var$compile_command$finalize_rpath"
4867 if test "$fast_install" = yes; then
4868 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4870 # fast_install is set to needless
4874 link_command="$compile_var$compile_command$compile_rpath"
4875 relink_command="$finalize_var$finalize_command$finalize_rpath"
4879 # Replace the output file specification.
4880 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4882 # Delete the old output files.
4883 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4885 $show "$link_command"
4886 $run eval "$link_command" || exit $?
4888 # Now create the wrapper script.
4889 $show "creating $output"
4891 # Quote the relink command for shipping.
4892 if test -n "$relink_command"; then
4893 # Preserve any variables that may affect compiler behavior
4894 for var in $variables_saved_for_relink; do
4895 if eval test -z \"\${$var+set}\"; then
4896 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4897 elif eval var_value=\$$var; test -z "$var_value"; then
4898 relink_command="$var=; export $var; $relink_command"
4900 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4901 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4904 relink_command="(cd `pwd`; $relink_command)"
4905 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4908 # Quote $echo for shipping.
4909 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4911 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4912 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4914 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4916 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4919 # Only actually do things if our run command is non-null.
4920 if test -z "$run"; then
4921 # win32 will think the script is a binary if it has
4922 # a .exe suffix, so we strip it off here.
4924 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4926 # test for cygwin because mv fails w/o .exe extensions
4930 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4934 *cygwin* | *mingw* )
4935 output_name=`basename $output`
4936 output_path=`dirname $output`
4937 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4938 cwrapper="$output_path/$output_name.exe"
4939 $rm $cwrappersource $cwrapper
4940 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4942 cat > $cwrappersource <<EOF
4944 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4945 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4947 The $output program cannot be directly executed until all the libtool
4948 libraries that it depends on are installed.
4950 This wrapper executable should never be moved out of the build directory.
4951 If it is, it will not operate correctly.
4953 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4954 but could eventually absorb all of the scripts functionality and
4955 exec $objdir/$outputname directly.
4958 cat >> $cwrappersource<<"EOF"
4967 #include <sys/stat.h>
4969 #if defined(PATH_MAX)
4970 # define LT_PATHMAX PATH_MAX
4971 #elif defined(MAXPATHLEN)
4972 # define LT_PATHMAX MAXPATHLEN
4974 # define LT_PATHMAX 1024
4977 #ifndef DIR_SEPARATOR
4978 # define DIR_SEPARATOR '/'
4979 # define PATH_SEPARATOR ':'
4982 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4984 # define HAVE_DOS_BASED_FILE_SYSTEM
4985 # ifndef DIR_SEPARATOR_2
4986 # define DIR_SEPARATOR_2 '\\'
4988 # ifndef PATH_SEPARATOR_2
4989 # define PATH_SEPARATOR_2 ';'
4993 #ifndef DIR_SEPARATOR_2
4994 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4995 #else /* DIR_SEPARATOR_2 */
4996 # define IS_DIR_SEPARATOR(ch) \
4997 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4998 #endif /* DIR_SEPARATOR_2 */
5000 #ifndef PATH_SEPARATOR_2
5001 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5002 #else /* PATH_SEPARATOR_2 */
5003 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5004 #endif /* PATH_SEPARATOR_2 */
5006 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5007 #define XFREE(stale) do { \
5008 if (stale) { free ((void *) stale); stale = 0; } \
5011 /* -DDEBUG is fairly common in CFLAGS. */
5013 #if defined DEBUGWRAPPER
5014 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5016 # define DEBUG(format, ...)
5019 const char *program_name = NULL;
5021 void * xmalloc (size_t num);
5022 char * xstrdup (const char *string);
5023 const char * base_name (const char *name);
5024 char * find_executable(const char *wrapper);
5025 int check_executable(const char *path);
5026 char * strendzap(char *str, const char *pat);
5027 void lt_fatal (const char *message, ...);
5030 main (int argc, char *argv[])
5035 program_name = (char *) xstrdup (base_name (argv[0]));
5036 DEBUG("(main) argv[0] : %s\n",argv[0]);
5037 DEBUG("(main) program_name : %s\n",program_name);
5038 newargz = XMALLOC(char *, argc+2);
5041 cat >> $cwrappersource <<EOF
5042 newargz[0] = (char *) xstrdup("$SHELL");
5045 cat >> $cwrappersource <<"EOF"
5046 newargz[1] = find_executable(argv[0]);
5047 if (newargz[1] == NULL)
5048 lt_fatal("Couldn't find %s", argv[0]);
5049 DEBUG("(main) found exe at : %s\n",newargz[1]);
5050 /* we know the script has the same name, without the .exe */
5051 /* so make sure newargz[1] doesn't end in .exe */
5052 strendzap(newargz[1],".exe");
5053 for (i = 1; i < argc; i++)
5054 newargz[i+1] = xstrdup(argv[i]);
5055 newargz[argc+1] = NULL;
5057 for (i=0; i<argc+1; i++)
5059 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5067 cat >> $cwrappersource <<EOF
5068 execv("$SHELL",(char const **)newargz);
5072 cat >> $cwrappersource <<EOF
5073 execv("$SHELL",newargz);
5078 cat >> $cwrappersource <<"EOF"
5083 xmalloc (size_t num)
5085 void * p = (void *) malloc (num);
5087 lt_fatal ("Memory exhausted");
5093 xstrdup (const char *string)
5095 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5100 base_name (const char *name)
5104 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5105 /* Skip over the disk name in MSDOS pathnames. */
5106 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5110 for (base = name; *name; name++)
5111 if (IS_DIR_SEPARATOR (*name))
5117 check_executable(const char * path)
5121 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5122 if ((!path) || (!*path))
5125 if ((stat (path, &st) >= 0) &&
5127 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5128 #if defined (S_IXOTH)
5129 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5131 #if defined (S_IXGRP)
5132 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5134 ((st.st_mode & S_IXUSR) == S_IXUSR))
5141 /* Searches for the full path of the wrapper. Returns
5142 newly allocated full path name if found, NULL otherwise */
5144 find_executable (const char* wrapper)
5149 /* static buffer for getcwd */
5150 char tmp[LT_PATHMAX + 1];
5154 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5156 if ((wrapper == NULL) || (*wrapper == '\0'))
5159 /* Absolute path? */
5160 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5161 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5163 concat_name = xstrdup (wrapper);
5164 if (check_executable(concat_name))
5171 if (IS_DIR_SEPARATOR (wrapper[0]))
5173 concat_name = xstrdup (wrapper);
5174 if (check_executable(concat_name))
5178 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5182 for (p = wrapper; *p; p++)
5190 /* no slashes; search PATH */
5191 const char* path = getenv ("PATH");
5194 for (p = path; *p; p = p_next)
5198 for (q = p; *q; q++)
5199 if (IS_PATH_SEPARATOR(*q))
5202 p_next = (*q == '\0' ? q : q + 1);
5205 /* empty path: current directory */
5206 if (getcwd (tmp, LT_PATHMAX) == NULL)
5207 lt_fatal ("getcwd failed");
5208 tmp_len = strlen(tmp);
5209 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5210 memcpy (concat_name, tmp, tmp_len);
5211 concat_name[tmp_len] = '/';
5212 strcpy (concat_name + tmp_len + 1, wrapper);
5216 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5217 memcpy (concat_name, p, p_len);
5218 concat_name[p_len] = '/';
5219 strcpy (concat_name + p_len + 1, wrapper);
5221 if (check_executable(concat_name))
5226 /* not found in PATH; assume curdir */
5228 /* Relative path | not found in path: prepend cwd */
5229 if (getcwd (tmp, LT_PATHMAX) == NULL)
5230 lt_fatal ("getcwd failed");
5231 tmp_len = strlen(tmp);
5232 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5233 memcpy (concat_name, tmp, tmp_len);
5234 concat_name[tmp_len] = '/';
5235 strcpy (concat_name + tmp_len + 1, wrapper);
5237 if (check_executable(concat_name))
5244 strendzap(char *str, const char *pat)
5248 assert(str != NULL);
5249 assert(pat != NULL);
5252 patlen = strlen(pat);
5256 str += len - patlen;
5257 if (strcmp(str, pat) == 0)
5264 lt_error_core (int exit_status, const char * mode,
5265 const char * message, va_list ap)
5267 fprintf (stderr, "%s: %s: ", program_name, mode);
5268 vfprintf (stderr, message, ap);
5269 fprintf (stderr, ".\n");
5271 if (exit_status >= 0)
5276 lt_fatal (const char *message, ...)
5279 va_start (ap, message);
5280 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5284 # we should really use a build-platform specific compiler
5285 # here, but OTOH, the wrappers (shell script and this C one)
5286 # are only useful if you want to execute the "real" binary.
5287 # Since the "real" binary is built for $host, then this
5288 # wrapper might as well be built for $host, too.
5289 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5293 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5298 # $output - temporary wrapper script for $objdir/$outputname
5299 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5301 # The $output program cannot be directly executed until all the libtool
5302 # libraries that it depends on are installed.
5304 # This wrapper script should never be moved out of the build directory.
5305 # If it is, it will not operate correctly.
5307 # Sed substitution that helps us do robust quoting. It backslashifies
5308 # metacharacters that are still active within double-quoted strings.
5309 Xsed='${SED} -e 1s/^X//'
5310 sed_quote_subst='$sed_quote_subst'
5312 # The HP-UX ksh and POSIX shell print the target directory to stdout
5314 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5316 relink_command=\"$relink_command\"
5318 # This environment variable determines our operation mode.
5319 if test \"\$libtool_install_magic\" = \"$magic\"; then
5320 # install mode needs the following variable:
5321 notinst_deplibs='$notinst_deplibs'
5323 # When we are sourced in execute mode, \$file and \$echo are already set.
5324 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5327 # Make sure echo works.
5328 if test \"X\$1\" = X--no-reexec; then
5329 # Discard the --no-reexec flag, and continue.
5331 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5332 # Yippee, \$echo works!
5335 # Restart under the correct shell, and then maybe \$echo will work.
5336 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5342 # Find the directory that this script lives in.
5343 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5344 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5346 # Follow symbolic links until we get to the real thisdir.
5347 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5348 while test -n \"\$file\"; do
5349 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5351 # If there was a directory component, then change thisdir.
5352 if test \"x\$destdir\" != \"x\$file\"; then
5353 case \"\$destdir\" in
5354 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5355 *) thisdir=\"\$thisdir/\$destdir\" ;;
5359 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5360 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5363 # Try to get the absolute directory name.
5364 absdir=\`cd \"\$thisdir\" && pwd\`
5365 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5368 if test "$fast_install" = yes; then
5370 program=lt-'$outputname'$exeext
5371 progdir=\"\$thisdir/$objdir\"
5373 if test ! -f \"\$progdir/\$program\" || \\
5374 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5375 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5377 file=\"\$\$-\$program\"
5379 if test ! -d \"\$progdir\"; then
5380 $mkdir \"\$progdir\"
5382 $rm \"\$progdir/\$file\"
5387 # relink executable if necessary
5388 if test -n \"\$relink_command\"; then
5389 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5391 $echo \"\$relink_command_output\" >&2
5392 $rm \"\$progdir/\$file\"
5397 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5398 { $rm \"\$progdir/\$program\";
5399 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5400 $rm \"\$progdir/\$file\"
5404 program='$outputname'
5405 progdir=\"\$thisdir/$objdir\"
5411 if test -f \"\$progdir/\$program\"; then"
5413 # Export our shlibpath_var if we have one.
5414 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5416 # Add our own library path to $shlibpath_var
5417 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5419 # Some systems cannot cope with colon-terminated $shlibpath_var
5420 # The second colon is a workaround for a bug in BeOS R4 sed
5421 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5423 export $shlibpath_var
5427 # fixup the dll searchpath if we need to.
5428 if test -n "$dllsearchpath"; then
5430 # Add the dll search path components to the executable PATH
5431 PATH=$dllsearchpath:\$PATH
5436 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5437 # Run the actual program with our arguments.
5440 # Backslashes separate directories on plain windows
5441 *-*-mingw | *-*-os2*)
5443 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5449 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5454 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5458 # The program doesn't exist.
5459 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5460 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5461 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5472 # See if we need to build an old-fashioned archive.
5473 for oldlib in $oldlibs; do
5475 if test "$build_libtool_libs" = convenience; then
5476 oldobjs="$libobjs_save"
5477 addlibs="$convenience"
5478 build_libtool_libs=no
5480 if test "$build_libtool_libs" = module; then
5481 oldobjs="$libobjs_save"
5482 build_libtool_libs=no
5484 oldobjs="$old_deplibs $non_pic_objects"
5486 addlibs="$old_convenience"
5489 if test -n "$addlibs"; then
5490 gentop="$output_objdir/${outputname}x"
5491 generated="$generated $gentop"
5493 func_extract_archives $gentop $addlibs
5494 oldobjs="$oldobjs $func_extract_archives_result"
5497 # Do each command in the archive commands.
5498 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5499 cmds=$old_archive_from_new_cmds
5501 # POSIX demands no paths to be encoded in archives. We have
5502 # to avoid creating archives with duplicate basenames if we
5503 # might have to extract them afterwards, e.g., when creating a
5504 # static archive out of a convenience library, or when linking
5505 # the entirety of a libtool archive into another (currently
5506 # not supported by libtool).
5507 if (for obj in $oldobjs
5509 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5510 done | sort | sort -uc >/dev/null 2>&1); then
5513 $echo "copying selected object files to avoid basename conflicts..."
5515 if test -z "$gentop"; then
5516 gentop="$output_objdir/${outputname}x"
5517 generated="$generated $gentop"
5519 $show "${rm}r $gentop"
5520 $run ${rm}r "$gentop"
5521 $show "$mkdir $gentop"
5522 $run $mkdir "$gentop"
5524 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5529 save_oldobjs=$oldobjs
5532 for obj in $save_oldobjs
5534 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5535 case " $oldobjs " in
5536 " ") oldobjs=$obj ;;
5539 # Make sure we don't pick an alternate name that also
5541 newobj=lt$counter-$objbase
5542 counter=`expr $counter + 1`
5543 case " $oldobjs " in
5544 *[\ /]"$newobj "*) ;;
5545 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5548 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5549 $run ln "$obj" "$gentop/$newobj" ||
5550 $run cp "$obj" "$gentop/$newobj"
5551 oldobjs="$oldobjs $gentop/$newobj"
5553 *) oldobjs="$oldobjs $obj" ;;
5558 eval cmds=\"$old_archive_cmds\"
5560 if len=`expr "X$cmds" : ".*"` &&
5561 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5562 cmds=$old_archive_cmds
5564 # the command line is too long to link in one step, link in parts
5565 $echo "using piecewise archive linking..."
5570 save_oldobjs=$oldobjs
5572 # Is there a better way of finding the last object in the list?
5573 for obj in $save_oldobjs
5577 for obj in $save_oldobjs
5579 oldobjs="$objlist $obj"
5580 objlist="$objlist $obj"
5581 eval test_cmds=\"$old_archive_cmds\"
5582 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5583 test "$len" -le "$max_cmd_len"; then
5586 # the above command should be used before it gets too long
5588 if test "$obj" = "$last_oldobj" ; then
5591 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5592 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5598 if test "X$oldobjs" = "X" ; then
5599 eval cmds=\"\$concat_cmds\"
5601 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5605 save_ifs="$IFS"; IFS='~'
5606 for cmd in $cmds; do
5610 $run eval "$cmd" || exit $?
5615 if test -n "$generated"; then
5616 $show "${rm}r$generated"
5617 $run ${rm}r$generated
5620 # Now create the libtool archive.
5624 test "$build_old_libs" = yes && old_library="$libname.$libext"
5625 $show "creating $output"
5627 # Preserve any variables that may affect compiler behavior
5628 for var in $variables_saved_for_relink; do
5629 if eval test -z \"\${$var+set}\"; then
5630 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5631 elif eval var_value=\$$var; test -z "$var_value"; then
5632 relink_command="$var=; export $var; $relink_command"
5634 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5635 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5638 # Quote the link command for shipping.
5639 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5640 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5641 if test "$hardcode_automatic" = yes ; then
5646 # Only create the output if not a dry run.
5647 if test -z "$run"; then
5648 for installed in no yes; do
5649 if test "$installed" = yes; then
5650 if test -z "$install_libdir"; then
5653 output="$output_objdir/$outputname"i
5654 # Replace all uninstalled libtool libraries with the installed ones
5656 for deplib in $dependency_libs; do
5659 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5660 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5661 if test -z "$libdir"; then
5662 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5665 newdependency_libs="$newdependency_libs $libdir/$name"
5667 *) newdependency_libs="$newdependency_libs $deplib" ;;
5670 dependency_libs="$newdependency_libs"
5672 for lib in $dlfiles; do
5673 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5674 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5675 if test -z "$libdir"; then
5676 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5679 newdlfiles="$newdlfiles $libdir/$name"
5681 dlfiles="$newdlfiles"
5683 for lib in $dlprefiles; do
5684 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5685 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5686 if test -z "$libdir"; then
5687 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5690 newdlprefiles="$newdlprefiles $libdir/$name"
5692 dlprefiles="$newdlprefiles"
5695 for lib in $dlfiles; do
5697 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5698 *) abs=`pwd`"/$lib" ;;
5700 newdlfiles="$newdlfiles $abs"
5702 dlfiles="$newdlfiles"
5704 for lib in $dlprefiles; do
5706 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5707 *) abs=`pwd`"/$lib" ;;
5709 newdlprefiles="$newdlprefiles $abs"
5711 dlprefiles="$newdlprefiles"
5714 # place dlname in correct position for cygwin
5716 case $host,$output,$installed,$module,$dlname in
5717 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5720 # $outputname - a libtool library file
5721 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5723 # Please DO NOT delete this file!
5724 # It is necessary for linking the library.
5726 # The name that we can dlopen(3).
5729 # Names of this library.
5730 library_names='$library_names'
5732 # The name of the static archive.
5733 old_library='$old_library'
5735 # Libraries that this one depends upon.
5736 dependency_libs='$dependency_libs'
5738 # Version information for $libname.
5743 # Is this an already installed library?
5744 installed=$installed
5746 # Should we warn about portability when linking against -modules?
5747 shouldnotlink=$module
5749 # Files to dlopen/dlpreopen
5751 dlpreopen='$dlprefiles'
5753 # Directory that this library needs to be installed in:
5754 libdir='$install_libdir'"
5755 if test "$installed" = no && test "$need_relink" = yes; then
5757 relink_command=\"$relink_command\""
5762 # Do a symbolic link so that the libtool archive can be found in
5763 # LD_LIBRARY_PATH before the program is installed.
5764 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5765 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5771 # libtool install mode
5773 modename="$modename: install"
5775 # There may be an optional sh(1) argument at the beginning of
5776 # install_prog (especially on Windows NT).
5777 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5778 # Allow the use of GNU shtool's install command.
5779 $echo "X$nonopt" | grep shtool > /dev/null; then
5780 # Aesthetically quote it.
5781 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5783 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5787 install_prog="$arg "
5795 # The real first argument should be the name of the installation program.
5796 # Aesthetically quote it.
5797 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5799 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5803 install_prog="$install_prog$arg"
5805 # We need to accept at least all the BSD install flags.
5815 if test -n "$dest"; then
5816 files="$files $dest"
5824 case " $install_prog " in
5829 -g | -m | -o) prev=$arg ;;
5837 # If the previous option needed an argument, then skip it.
5838 if test -n "$prev"; then
5847 # Aesthetically quote the argument.
5848 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5850 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5854 install_prog="$install_prog $arg"
5857 if test -z "$install_prog"; then
5858 $echo "$modename: you must specify an install program" 1>&2
5863 if test -n "$prev"; then
5864 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5869 if test -z "$files"; then
5870 if test -z "$dest"; then
5871 $echo "$modename: no file or destination specified" 1>&2
5873 $echo "$modename: you must specify a destination" 1>&2
5879 # Strip any trailing slash from the destination.
5880 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5882 # Check to see that the destination is a directory.
5883 test -d "$dest" && isdir=yes
5884 if test "$isdir" = yes; then
5888 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5889 test "X$destdir" = "X$dest" && destdir=.
5890 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5892 # Not a directory, so check to see that there is only one file specified.
5894 if test "$#" -gt 2; then
5895 $echo "$modename: \`$dest' is not a directory" 1>&2
5901 [\\/]* | [A-Za-z]:[\\/]*) ;;
5903 for file in $files; do
5907 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5916 # This variable tells wrapper scripts just to set variables rather
5917 # than running their programs.
5918 libtool_install_magic="$magic"
5923 for file in $files; do
5925 # Do each installation.
5928 # Do the static libraries later.
5929 staticlibs="$staticlibs $file"
5933 # Check to see that this really is a libtool archive.
5934 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5936 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5944 # If there is no directory component, then add one.
5946 */* | *\\*) . $file ;;
5950 # Add the libdir to current_libdirs if it is the destination.
5951 if test "X$destdir" = "X$libdir"; then
5952 case "$current_libdirs " in
5954 *) current_libdirs="$current_libdirs $libdir" ;;
5957 # Note the libdir as a future libdir.
5958 case "$future_libdirs " in
5960 *) future_libdirs="$future_libdirs $libdir" ;;
5964 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5965 test "X$dir" = "X$file/" && dir=
5968 if test -n "$relink_command"; then
5969 # Determine the prefix the user has applied to our future dir.
5970 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5972 # Don't allow the user to place us outside of our expected
5973 # location b/c this prevents finding dependent libraries that
5974 # are installed to the same prefix.
5975 # At present, this check doesn't affect windows .dll's that
5976 # are installed into $libdir/../bin (currently, that works fine)
5977 # but it's something to keep an eye on.
5978 if test "$inst_prefix_dir" = "$destdir"; then
5979 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5983 if test -n "$inst_prefix_dir"; then
5984 # Stick the inst_prefix_dir data into the link command.
5985 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5987 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5990 $echo "$modename: warning: relinking \`$file'" 1>&2
5991 $show "$relink_command"
5992 if $run eval "$relink_command"; then :
5994 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5999 # See the names of the shared library.
6000 set dummy $library_names
6001 if test -n "$2"; then
6007 test -n "$relink_command" && srcname="$realname"T
6009 # Install the shared library and build the symlinks.
6010 $show "$install_prog $dir/$srcname $destdir/$realname"
6011 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6012 if test -n "$stripme" && test -n "$striplib"; then
6013 $show "$striplib $destdir/$realname"
6014 $run eval "$striplib $destdir/$realname" || exit $?
6017 if test "$#" -gt 0; then
6018 # Delete the old symlinks, and create new ones.
6019 # Try `ln -sf' first, because the `ln' binary might depend on
6020 # the symlink we replace! Solaris /bin/ln does not understand -f,
6021 # so we also need to try rm && ln -s.
6024 if test "$linkname" != "$realname"; then
6025 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6026 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6031 # Do each command in the postinstall commands.
6032 lib="$destdir/$realname"
6033 cmds=$postinstall_cmds
6034 save_ifs="$IFS"; IFS='~'
6035 for cmd in $cmds; do
6039 $run eval "$cmd" || {
6042 # Restore the uninstalled library and exit
6043 if test "$mode" = relink; then
6044 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6053 # Install the pseudo-library for information purposes.
6054 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6055 instname="$dir/$name"i
6056 $show "$install_prog $instname $destdir/$name"
6057 $run eval "$install_prog $instname $destdir/$name" || exit $?
6059 # Maybe install the static library, too.
6060 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6064 # Install (i.e. copy) a libtool object.
6066 # Figure out destination file name, if it wasn't already specified.
6067 if test -n "$destname"; then
6068 destfile="$destdir/$destname"
6070 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6071 destfile="$destdir/$destfile"
6074 # Deduce the name of the destination old-style object file.
6077 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6080 staticdest="$destfile"
6084 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6090 # Install the libtool object if requested.
6091 if test -n "$destfile"; then
6092 $show "$install_prog $file $destfile"
6093 $run eval "$install_prog $file $destfile" || exit $?
6096 # Install the old object if enabled.
6097 if test "$build_old_libs" = yes; then
6098 # Deduce the name of the old-style object file.
6099 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6101 $show "$install_prog $staticobj $staticdest"
6102 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6108 # Figure out destination file name, if it wasn't already specified.
6109 if test -n "$destname"; then
6110 destfile="$destdir/$destname"
6112 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6113 destfile="$destdir/$destfile"
6116 # If the file is missing, and there is a .exe on the end, strip it
6117 # because it is most likely a libtool script we actually want to
6122 if test ! -f "$file"; then
6123 file=`$echo $file|${SED} 's,.exe$,,'`
6129 # Do a test to see if this is really a libtool program.
6132 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6138 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6142 # Note that it is not necessary on cygwin/mingw to append a dot to
6143 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6144 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6145 # `FILE.' does not work on cygwin managed mounts.
6147 # If there is no directory component, then add one.
6149 */* | *\\*) . ${wrapper} ;;
6150 *) . ./${wrapper} ;;
6153 # Check the variables that should have been set.
6154 if test -z "$notinst_deplibs"; then
6155 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6160 for lib in $notinst_deplibs; do
6161 # Check to see that each library is installed.
6163 if test -f "$lib"; then
6164 # If there is no directory component, then add one.
6166 */* | *\\*) . $lib ;;
6170 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6171 if test -n "$libdir" && test ! -f "$libfile"; then
6172 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6178 # Note that it is not necessary on cygwin/mingw to append a dot to
6179 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6180 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6181 # `FILE.' does not work on cygwin managed mounts.
6183 # If there is no directory component, then add one.
6185 */* | *\\*) . ${wrapper} ;;
6186 *) . ./${wrapper} ;;
6190 if test "$fast_install" = no && test -n "$relink_command"; then
6191 if test "$finalize" = yes && test -z "$run"; then
6192 tmpdir=`func_mktempdir`
6193 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6194 outputname="$tmpdir/$file"
6195 # Replace the output file specification.
6196 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6198 $show "$relink_command"
6199 if $run eval "$relink_command"; then :
6201 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6207 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6210 # Install the binary that we compiled earlier.
6211 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6215 # remove .exe since cygwin /usr/bin/install will append another
6217 case $install_prog,$host in
6218 */usr/bin/install*,*cygwin*)
6219 case $file:$destfile in
6224 destfile=$destfile.exe
6227 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6232 $show "$install_prog$stripme $file $destfile"
6233 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6234 test -n "$outputname" && ${rm}r "$tmpdir"
6239 for file in $staticlibs; do
6240 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6242 # Set up the ranlib parameters.
6243 oldlib="$destdir/$name"
6245 $show "$install_prog $file $oldlib"
6246 $run eval "$install_prog \$file \$oldlib" || exit $?
6248 if test -n "$stripme" && test -n "$old_striplib"; then
6249 $show "$old_striplib $oldlib"
6250 $run eval "$old_striplib $oldlib" || exit $?
6253 # Do each command in the postinstall commands.
6254 cmds=$old_postinstall_cmds
6255 save_ifs="$IFS"; IFS='~'
6256 for cmd in $cmds; do
6260 $run eval "$cmd" || exit $?
6265 if test -n "$future_libdirs"; then
6266 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6269 if test -n "$current_libdirs"; then
6270 # Maybe just do a dry run.
6271 test -n "$run" && current_libdirs=" -n$current_libdirs"
6272 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6278 # libtool finish mode
6280 modename="$modename: finish"
6284 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6287 libdirs="$libdirs $dir"
6290 for libdir in $libdirs; do
6291 if test -n "$finish_cmds"; then
6292 # Do each command in the finish commands.
6294 save_ifs="$IFS"; IFS='~'
6295 for cmd in $cmds; do
6299 $run eval "$cmd" || admincmds="$admincmds
6304 if test -n "$finish_eval"; then
6305 # Do the single finish_eval.
6306 eval cmds=\"$finish_eval\"
6307 $run eval "$cmds" || admincmds="$admincmds
6313 # Exit here if they wanted silent mode.
6314 test "$show" = : && exit $EXIT_SUCCESS
6316 $echo "X----------------------------------------------------------------------" | $Xsed
6317 $echo "Libraries have been installed in:"
6318 for libdir in $libdirs; do
6322 $echo "If you ever happen to want to link against installed libraries"
6323 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6324 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6325 $echo "flag during linking and do at least one of the following:"
6326 if test -n "$shlibpath_var"; then
6327 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6328 $echo " during execution"
6330 if test -n "$runpath_var"; then
6331 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6332 $echo " during linking"
6334 if test -n "$hardcode_libdir_flag_spec"; then
6336 eval flag=\"$hardcode_libdir_flag_spec\"
6338 $echo " - use the \`$flag' linker flag"
6340 if test -n "$admincmds"; then
6341 $echo " - have your system administrator run these commands:$admincmds"
6343 if test -f /etc/ld.so.conf; then
6344 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6347 $echo "See any operating system documentation about shared libraries for"
6348 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6349 $echo "X----------------------------------------------------------------------" | $Xsed
6353 # libtool execute mode
6355 modename="$modename: execute"
6357 # The first argument is the command name.
6359 if test -z "$cmd"; then
6360 $echo "$modename: you must specify a COMMAND" 1>&2
6365 # Handle -dlopen flags immediately.
6366 for file in $execute_dlfiles; do
6367 if test ! -f "$file"; then
6368 $echo "$modename: \`$file' is not a file" 1>&2
6376 # Check to see that this really is a libtool archive.
6377 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6379 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6384 # Read the libtool library.
6388 # If there is no directory component, then add one.
6390 */* | *\\*) . $file ;;
6394 # Skip this library if it cannot be dlopened.
6395 if test -z "$dlname"; then
6396 # Warn if it was a shared library.
6397 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6401 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6402 test "X$dir" = "X$file" && dir=.
6404 if test -f "$dir/$objdir/$dlname"; then
6407 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6413 # Just add the directory containing the .lo file.
6414 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6415 test "X$dir" = "X$file" && dir=.
6419 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6424 # Get the absolute pathname.
6425 absdir=`cd "$dir" && pwd`
6426 test -n "$absdir" && dir="$absdir"
6428 # Now add the directory to shlibpath_var.
6429 if eval "test -z \"\$$shlibpath_var\""; then
6430 eval "$shlibpath_var=\"\$dir\""
6432 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6436 # This variable tells wrapper scripts just to set shlibpath_var
6437 # rather than running their programs.
6438 libtool_execute_magic="$magic"
6440 # Check if any of the arguments is a wrapper script.
6447 # Do a test to see if this is really a libtool program.
6448 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6449 # If there is no directory component, then add one.
6451 */* | *\\*) . $file ;;
6455 # Transform arg to wrapped name.
6456 file="$progdir/$program"
6460 # Quote arguments (to preserve shell metacharacters).
6461 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6462 args="$args \"$file\""
6465 if test -z "$run"; then
6466 if test -n "$shlibpath_var"; then
6467 # Export the shlibpath_var.
6468 eval "export $shlibpath_var"
6471 # Restore saved environment variables
6472 if test "${save_LC_ALL+set}" = set; then
6473 LC_ALL="$save_LC_ALL"; export LC_ALL
6475 if test "${save_LANG+set}" = set; then
6476 LANG="$save_LANG"; export LANG
6479 # Now prepare to actually exec the command.
6480 exec_cmd="\$cmd$args"
6482 # Display what would be done.
6483 if test -n "$shlibpath_var"; then
6484 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6485 $echo "export $shlibpath_var"
6492 # libtool clean and uninstall mode
6494 modename="$modename: $mode"
6500 # This variable tells wrapper scripts just to set variables rather
6501 # than running their programs.
6502 libtool_install_magic="$magic"
6507 -f) rm="$rm $arg"; rmforce=yes ;;
6508 -*) rm="$rm $arg" ;;
6509 *) files="$files $arg" ;;
6513 if test -z "$rm"; then
6514 $echo "$modename: you must specify an RM program" 1>&2
6521 origobjdir="$objdir"
6522 for file in $files; do
6523 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6524 if test "X$dir" = "X$file"; then
6526 objdir="$origobjdir"
6528 objdir="$dir/$origobjdir"
6530 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6531 test "$mode" = uninstall && objdir="$dir"
6533 # Remember objdir for removal later, being careful to avoid duplicates
6534 if test "$mode" = clean; then
6537 *) rmdirs="$rmdirs $objdir" ;;
6541 # Don't error if the file doesn't exist and rm -f was used.
6542 if (test -L "$file") >/dev/null 2>&1 \
6543 || (test -h "$file") >/dev/null 2>&1 \
6544 || test -f "$file"; then
6546 elif test -d "$file"; then
6549 elif test "$rmforce" = yes; then
6557 # Possibly a libtool archive, so verify it.
6558 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6561 # Delete the libtool libraries and symlinks.
6562 for n in $library_names; do
6563 rmfiles="$rmfiles $objdir/$n"
6565 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6569 case " $library_names " in
6570 # " " in the beginning catches empty $dlname
6572 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6574 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6577 if test -n "$library_names"; then
6578 # Do each command in the postuninstall commands.
6579 cmds=$postuninstall_cmds
6580 save_ifs="$IFS"; IFS='~'
6581 for cmd in $cmds; do
6586 if test "$?" -ne 0 && test "$rmforce" != yes; then
6593 if test -n "$old_library"; then
6594 # Do each command in the old_postuninstall commands.
6595 cmds=$old_postuninstall_cmds
6596 save_ifs="$IFS"; IFS='~'
6597 for cmd in $cmds; do
6602 if test "$?" -ne 0 && test "$rmforce" != yes; then
6608 # FIXME: should reinstall the best remaining shared library.
6615 # Possibly a libtool object, so verify it.
6616 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6621 # Add PIC object to the list of files to remove.
6622 if test -n "$pic_object" \
6623 && test "$pic_object" != none; then
6624 rmfiles="$rmfiles $dir/$pic_object"
6627 # Add non-PIC object to the list of files to remove.
6628 if test -n "$non_pic_object" \
6629 && test "$non_pic_object" != none; then
6630 rmfiles="$rmfiles $dir/$non_pic_object"
6636 if test "$mode" = clean ; then
6640 file=`$echo $file|${SED} 's,.exe$,,'`
6641 noexename=`$echo $name|${SED} 's,.exe$,,'`
6642 # $file with .exe has already been added to rmfiles,
6643 # add $file without .exe
6644 rmfiles="$rmfiles $file"
6647 # Do a test to see if this is a libtool program.
6648 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6652 # note $name still contains .exe if it was in $file originally
6653 # as does the version of $file that was added into $rmfiles
6654 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6655 if test "$fast_install" = yes && test -n "$relink_command"; then
6656 rmfiles="$rmfiles $objdir/lt-$name"
6658 if test "X$noexename" != "X$name" ; then
6659 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6665 $show "$rm $rmfiles"
6666 $run $rm $rmfiles || exit_status=1
6668 objdir="$origobjdir"
6670 # Try to remove the ${objdir}s in the directories where we deleted files
6671 for dir in $rmdirs; do
6672 if test -d "$dir"; then
6674 $run rmdir $dir >/dev/null 2>&1
6682 $echo "$modename: you must specify a MODE" 1>&2
6683 $echo "$generic_help" 1>&2
6688 if test -z "$exec_cmd"; then
6689 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6690 $echo "$generic_help" 1>&2
6693 fi # test -z "$show_help"
6695 if test -n "$exec_cmd"; then
6700 # We need to display help for each of the modes.
6703 "Usage: $modename [OPTION]... [MODE-ARG]...
6705 Provide generalized library-building support services.
6707 --config show all configuration variables
6708 --debug enable verbose shell tracing
6709 -n, --dry-run display commands without modifying any files
6710 --features display basic configuration information and exit
6711 --finish same as \`--mode=finish'
6712 --help display this help message and exit
6713 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6714 --quiet same as \`--silent'
6715 --silent don't print informational messages
6716 --tag=TAG use configuration variables from tag TAG
6717 --version print version information
6719 MODE must be one of the following:
6721 clean remove files from the build directory
6722 compile compile a source file into a libtool object
6723 execute automatically set library path, then run a program
6724 finish complete the installation of libtool libraries
6725 install install libraries or executables
6726 link create a library or an executable
6727 uninstall remove libraries from an installed directory
6729 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6730 a more detailed description of MODE.
6732 Report bugs to <bug-libtool@gnu.org>."
6738 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6740 Remove files from the build directory.
6742 RM is the name of the program to use to delete files associated with each FILE
6743 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6746 If FILE is a libtool library, object or program, all the files associated
6747 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6752 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6754 Compile a source file into a libtool library object.
6756 This mode accepts the following additional options:
6758 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6759 -prefer-pic try to building PIC objects only
6760 -prefer-non-pic try to building non-PIC objects only
6761 -static always build a \`.o' file suitable for static linking
6763 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6764 from the given SOURCEFILE.
6766 The output file name is determined by removing the directory component from
6767 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6768 library object suffix, \`.lo'."
6773 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6775 Automatically set library path, then run a program.
6777 This mode accepts the following additional options:
6779 -dlopen FILE add the directory containing FILE to the library path
6781 This mode sets the library path environment variable according to \`-dlopen'
6784 If any of the ARGS are libtool executable wrappers, then they are translated
6785 into their corresponding uninstalled binary, and any of their required library
6786 directories are added to the library path.
6788 Then, COMMAND is executed, with ARGS as arguments."
6793 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6795 Complete the installation of libtool libraries.
6797 Each LIBDIR is a directory that contains libtool libraries.
6799 The commands that this mode executes may require superuser privileges. Use
6800 the \`--dry-run' option if you just want to see what would be executed."
6805 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6807 Install executables or libraries.
6809 INSTALL-COMMAND is the installation command. The first component should be
6810 either the \`install' or \`cp' program.
6812 The rest of the components are interpreted as arguments to that command (only
6813 BSD-compatible install options are recognized)."
6818 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6820 Link object files or libraries together to form another library, or to
6821 create an executable program.
6823 LINK-COMMAND is a command using the C compiler that you would use to create
6824 a program from several object files.
6826 The following components of LINK-COMMAND are treated specially:
6828 -all-static do not do any dynamic linking at all
6829 -avoid-version do not add a version suffix if possible
6830 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6831 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6832 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6833 -export-symbols SYMFILE
6834 try to export only the symbols listed in SYMFILE
6835 -export-symbols-regex REGEX
6836 try to export only the symbols matching REGEX
6837 -LLIBDIR search LIBDIR for required installed libraries
6838 -lNAME OUTPUT-FILE requires the installed library libNAME
6839 -module build a library that can dlopened
6840 -no-fast-install disable the fast-install mode
6841 -no-install link a not-installable executable
6842 -no-undefined declare that a library does not refer to external symbols
6843 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6844 -objectlist FILE Use a list of object files found in FILE to specify objects
6845 -precious-files-regex REGEX
6846 don't remove output files matching REGEX
6847 -release RELEASE specify package release information
6848 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6849 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6850 -static do not do any dynamic linking of libtool libraries
6851 -version-info CURRENT[:REVISION[:AGE]]
6852 specify library version info [each variable defaults to 0]
6854 All other options (arguments beginning with \`-') are ignored.
6856 Every other argument is treated as a filename. Files ending in \`.la' are
6857 treated as uninstalled libtool libraries, other files are standard or library
6860 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6861 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6862 required, except when creating a convenience library.
6864 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6865 using \`ar' and \`ranlib', or on Windows using \`lib'.
6867 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6868 is created, otherwise an executable program is created."
6873 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6875 Remove libraries from an installation directory.
6877 RM is the name of the program to use to delete files associated with each FILE
6878 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6881 If FILE is a libtool library, all the files associated with it are deleted.
6882 Otherwise, only FILE itself is deleted using RM."
6886 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6893 $echo "Try \`$modename --help' for more information about other modes."
6897 # The TAGs below are defined such that we never get into a situation
6898 # in which we disable both kinds of libraries. Given conflicting
6899 # choices, we go for a static library, that is the most portable,
6900 # since we can't tell whether shared libraries were disabled because
6901 # the user asked for that or because the platform doesn't support
6902 # them. This is particularly important on AIX, because we don't
6903 # support having both static and shared libraries enabled at the same
6904 # time on that platform, so we default to a shared-only configuration.
6905 # If a disable-shared tag is given, we'll fallback to a static-only
6906 # configuration. But we'll never go from static-only to shared-only.
6908 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6910 # ### END LIBTOOL TAG CONFIG: disable-shared
6912 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6914 # ### END LIBTOOL TAG CONFIG: disable-static