1 # NOTE(csilvers): This file (ltmain.sh) is taken from
2 # http://ftp.gnu.org/gnu/libtool/libtool-1.5.22.tar.gz
3 # with the following patch applied:
4 # http://www.marcuscom.com/downloads/patch-ltmain.sh
6 # ltmain.sh - Provide generalized library-building support services.
7 # NOTE: Changing this file will not affect anything until you rerun configure.
9 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
10 # Free Software Foundation, Inc.
11 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful, but
19 # WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 # General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
34 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
35 # is ksh but when the shell is invoked as "sh" and the current value of
36 # the _XPG environment variable is not equal to 1 (one), the special
37 # positional parameter $0, within a function call, is the name of the
41 # The name of this program:
42 progname=`echo "$progpath" | $SED $basename`
52 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
54 # See if we are running on zsh, and set the options which allow our
55 # commands through without removal of \ escapes.
56 if test -n "${ZSH_VERSION+set}" ; then
60 # Check that we have a working $echo.
61 if test "X$1" = X--no-reexec; then
62 # Discard the --no-reexec flag, and continue.
64 elif test "X$1" = X--fallback-echo; then
65 # Avoid inline document here, it may be left over
67 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
68 # Yippee, $echo works!
71 # Restart under the correct shell, and then maybe $echo will work.
72 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
75 if test "X$1" = X--fallback-echo; then
76 # used as fallback echo
85 help="Try \`$progname --help' for more information."
86 magic="%%%MAGIC variable%%%"
91 # Sed substitution that helps us do robust quoting. It backslashifies
92 # metacharacters that are still active within double-quoted strings.
93 Xsed="${SED}"' -e 1s/^X//'
94 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
95 # test EBCDIC or ASCII
96 case `echo X|tr X '\101'` in
97 A) # ASCII based system
98 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
100 NL2SP='tr \015\012 \040\040'
102 *) # EBCDIC based system
104 NL2SP='tr \r\n \100\100'
109 # Only set LANG and LC_ALL to C if already set.
110 # These must not be set unconditionally because not all systems understand
111 # e.g. LANG=C (notably SCO).
112 # We save the old values to restore during execute mode.
113 if test "${LC_ALL+set}" = set; then
114 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
116 if test "${LANG+set}" = set; then
117 save_LANG="$LANG"; LANG=C; export LANG
120 # Make sure IFS has a sensible default
125 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
126 $echo "$modename: not configured to build any kind of library" 1>&2
127 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
142 lo2o="s/\\.lo\$/.${objext}/"
143 o2lo="s/\\.${objext}\$/.lo/"
145 #####################################
146 # Shell function definitions:
147 # This seems to be the best place for them
149 # func_mktempdir [string]
150 # Make a temporary directory that won't clash with other running
151 # libtool processes, and avoids race conditions if possible. If
152 # given, STRING is the basename for that directory.
155 my_template="${TMPDIR-/tmp}/${1-$progname}"
157 if test "$run" = ":"; then
158 # Return a directory name, but don't create it in dry-run mode
159 my_tmpdir="${my_template}-$$"
162 # If mktemp works, use that first and foremost
163 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
165 if test ! -d "$my_tmpdir"; then
166 # Failing that, at least try and use $RANDOM to avoid a race
167 my_tmpdir="${my_template}-${RANDOM-0}$$"
169 save_mktempdir_umask=`umask`
172 umask $save_mktempdir_umask
175 # If we're not in dry-run mode, bomb out on failure
176 test -d "$my_tmpdir" || {
177 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
182 $echo "X$my_tmpdir" | $Xsed
186 # func_win32_libid arg
187 # return the library type of file 'arg'
189 # Need a lot of goo to handle *both* DLLs and import libs
190 # Has to be a shell function in order to 'eat' the argument
191 # that is supplied when $file_magic_command is called.
194 win32_libid_type="unknown"
195 win32_fileres=`file -L $1 2>/dev/null`
196 case $win32_fileres in
197 *ar\ archive\ import\ library*) # definitely import
198 win32_libid_type="x86 archive import"
200 *ar\ archive*) # could be an import, or static
201 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
202 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
203 win32_nmres=`eval $NM -f posix -A $1 | \
204 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
206 import*) win32_libid_type="x86 archive import";;
207 *) win32_libid_type="x86 archive static";;
212 win32_libid_type="x86 DLL"
214 *executable*) # but shell scripts are "executable" too...
215 case $win32_fileres in
216 *MS\ Windows\ PE\ Intel*)
217 win32_libid_type="x86 DLL"
222 $echo $win32_libid_type
227 # Infer tagged configuration to use if any are available and
228 # if one wasn't chosen via the "--tag" command line option.
229 # Only attempt this if the compiler in the base compile
230 # command doesn't match the default compiler.
231 # arg is usually of the form 'gcc ...'
234 if test -n "$available_tags" && test -z "$tagname"; then
238 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
242 CC_quoted="$CC_quoted $arg"
245 # Blanks in the command may have been stripped by the calling shell,
246 # but not from the CC environment variable when configure was run.
247 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
248 # Blanks at the start of $base_compile will cause this to fail
249 # if we don't check for them as well.
251 for z in $available_tags; do
252 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
253 # Evaluate the configuration.
254 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
257 # Double-quote args containing other shell metacharacters.
259 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
263 CC_quoted="$CC_quoted $arg"
266 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
267 # The compiler in the base compile command matches
268 # the one in the tagged configuration.
269 # Assume this is the tagged configuration we want.
276 # If $tagname still isn't set, then no tagged configuration
277 # was found and let the user know that the "--tag" command
278 # line option must be used.
279 if test -z "$tagname"; then
280 $echo "$modename: unable to infer tagged configuration"
281 $echo "$modename: specify a tag with \`--tag'" 1>&2
284 # $echo "$modename: using $tagname tagged configuration"
292 # func_extract_an_archive dir oldlib
293 func_extract_an_archive ()
295 f_ex_an_ar_dir="$1"; shift
296 f_ex_an_ar_oldlib="$1"
298 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
299 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
300 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
303 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
308 # func_extract_archives gentop oldlib ...
309 func_extract_archives ()
311 my_gentop="$1"; shift
319 $show "${rm}r $my_gentop"
320 $run ${rm}r "$my_gentop"
321 $show "$mkdir $my_gentop"
322 $run $mkdir "$my_gentop"
324 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
328 for my_xlib in $my_oldlibs; do
329 # Extract the objects.
331 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
332 *) my_xabs=`pwd`"/$my_xlib" ;;
334 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
335 my_xdir="$my_gentop/$my_xlib"
337 $show "${rm}r $my_xdir"
338 $run ${rm}r "$my_xdir"
339 $show "$mkdir $my_xdir"
340 $run $mkdir "$my_xdir"
342 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
347 $show "Extracting $my_xabs"
348 # Do not bother doing anything if just a dry run
349 if test -z "$run"; then
350 darwin_orig_dir=`pwd`
351 cd $my_xdir || exit $?
352 darwin_archive=$my_xabs
354 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
355 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
356 if test -n "$darwin_arches"; then
357 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
359 $show "$darwin_base_archive has multiple architectures $darwin_arches"
360 for darwin_arch in $darwin_arches ; do
361 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
362 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
363 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
364 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
366 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
367 done # $darwin_arches
368 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
369 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
372 for darwin_file in $darwin_filelist; do
373 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
374 lipo -create -output "$darwin_file" $darwin_files
375 done # $darwin_filelist
377 cd "$darwin_orig_dir"
379 cd "$darwin_orig_dir"
380 func_extract_an_archive "$my_xdir" "$my_xabs"
385 func_extract_an_archive "$my_xdir" "$my_xabs"
388 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
390 func_extract_archives_result="$my_oldobjs"
392 # End of Shell function definitions
393 #####################################
396 eval std_shrext=\"$shrext_cmds\"
400 # Parse our command line options once, thoroughly.
401 while test "$#" -gt 0
407 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
411 # If the previous option needs an argument, assign it.
412 if test -n "$prev"; then
415 execute_dlfiles="$execute_dlfiles $arg"
419 preserve_args="${preserve_args}=$arg"
421 # Check whether tagname contains only valid characters
424 $echo "$progname: invalid tag name: $tagname" 1>&2
431 # Don't test for the "default" C tag, as we know, it's there, but
432 # not specially marked.
435 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
436 taglist="$taglist $tagname"
437 # Evaluate the configuration.
438 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
440 $echo "$progname: ignoring unknown tag $tagname" 1>&2
455 # Have we seen a non-optional argument yet?
462 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
464 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
465 $echo "This is free software; see the source for copying conditions. There is NO"
466 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
471 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
472 # Now print the configurations for the tags.
473 for tagname in $taglist; do
474 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
480 $echo "$progname: enabling shell trace mode"
482 preserve_args="$preserve_args $arg"
491 if test "$build_libtool_libs" = yes; then
492 $echo "enable shared libraries"
494 $echo "disable shared libraries"
496 if test "$build_old_libs" = yes; then
497 $echo "enable static libraries"
499 $echo "disable static libraries"
504 --finish) mode="finish" ;;
506 --mode) prevopt="--mode" prev=mode ;;
507 --mode=*) mode="$optarg" ;;
509 --preserve-dup-deps) duplicate_deps="yes" ;;
513 preserve_args="$preserve_args $arg"
519 preserve_args="$preserve_args --tag"
522 set tag "$optarg" ${1+"$@"}
525 preserve_args="$preserve_args --tag"
534 $echo "$modename: unrecognized option \`$arg'" 1>&2
546 if test -n "$prevopt"; then
547 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
552 case $disable_libs in
556 build_libtool_libs=no
560 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
564 # If this variable is set in any of the actions, the command in it
565 # will be execed at the end. This prevents here-documents from being
566 # left over by shells.
569 if test -z "$show_help"; then
571 # Infer the operation mode.
572 if test -z "$mode"; then
573 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
574 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
576 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
588 *db | *dbx | *strace | *truss)
598 # If we have no mode, but dlfiles were specified, then do execute mode.
599 test -n "$execute_dlfiles" && mode=execute
601 # Just use the default operation mode.
602 if test -z "$mode"; then
603 if test -n "$nonopt"; then
604 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
606 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
613 # Only execute mode is allowed to have -dlopen flags.
614 if test -n "$execute_dlfiles" && test "$mode" != execute; then
615 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
620 # Change the help message to a mode-specific one.
622 help="Try \`$modename --help --mode=$mode' for more information."
624 # These modes are in order of execution frequency so that they run quickly.
626 # libtool compile mode
628 modename="$modename: compile"
629 # Get the compilation command and the source file.
631 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
642 # do not "continue". Instead, add this to base_compile
654 # Accept any command-line options.
657 if test -n "$libobj" ; then
658 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
665 -static | -prefer-pic | -prefer-non-pic)
676 arg_mode=arg # the next one goes into the "base_compile" arg list
677 continue # The current "srcfile" will either be retained or
678 ;; # replaced later. I would guess that would be a bug.
681 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
683 save_ifs="$IFS"; IFS=','
687 # Double-quote args containing other shell metacharacters.
688 # Many Bourne shells cannot handle close brackets correctly
689 # in scan sets, so we specify it separately.
691 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
695 lastarg="$lastarg $arg"
698 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
700 # Add the arguments to base_compile.
701 base_compile="$base_compile $lastarg"
706 # Accept the current argument as the source file.
707 # The previous "srcfile" becomes the current argument.
714 esac # case $arg_mode
716 # Aesthetically quote the previous argument.
717 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
720 # Double-quote args containing other shell metacharacters.
721 # Many Bourne shells cannot handle close brackets correctly
722 # in scan sets, and some SunOS ksh mistreat backslash-escaping
723 # in scan sets (worked around with variable expansion),
724 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
725 # at all, so we specify them separately.
726 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
727 lastarg="\"$lastarg\""
731 base_compile="$base_compile $lastarg"
736 $echo "$modename: you must specify an argument for -Xcompile"
740 $echo "$modename: you must specify a target with \`-o'" 1>&2
744 # Get the name of the library object.
745 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
749 # Recognize several different file suffixes.
750 # If the user specifies -o file.o, it is replaced with file.lo
760 *.class) xform=class ;;
765 *.java) xform=java ;;
768 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
771 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
773 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
778 func_infer_tag $base_compile
780 for arg in $later; do
799 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
801 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
802 qlibobj="\"$qlibobj\"" ;;
804 test "X$libobj" != "X$qlibobj" \
805 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
806 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
807 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
808 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
809 if test "X$xdir" = "X$obj"; then
814 lobj=${xdir}$objdir/$objname
816 if test -z "$base_compile"; then
817 $echo "$modename: you must specify a compilation command" 1>&2
822 # Delete any leftover library objects.
823 if test "$build_old_libs" = yes; then
824 removelist="$obj $lobj $libobj ${libobj}T"
826 removelist="$lobj $libobj ${libobj}T"
830 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
832 # On Cygwin there's no "real" PIC flag so we must build both object types
834 cygwin* | mingw* | pw32* | os2*)
838 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
839 # non-PIC code in shared libraries is not supported
843 # Calculate the filename of the output object if compiler does
844 # not support -o with -c
845 if test "$compiler_c_o" = no; then
846 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
847 lockfile="$output_obj.lock"
848 removelist="$removelist $output_obj $lockfile"
849 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
856 # Lock this critical section if it is needed
857 # We use this script file to make the link, it avoids creating a new file
858 if test "$need_locks" = yes; then
859 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
860 $show "Waiting for $lockfile to be removed"
863 elif test "$need_locks" = warn; then
864 if test -f "$lockfile"; then
866 *** ERROR, $lockfile exists and contains:
867 `cat $lockfile 2>/dev/null`
869 This indicates that another process is trying to use the same
870 temporary object file, and libtool could not work around it because
871 your compiler does not support \`-c' and \`-o' together. If you
872 repeat this compilation, it may succeed, by chance, but you had better
873 avoid parallel builds (make -j) in this platform, or get a better
879 $echo "$srcfile" > "$lockfile"
882 if test -n "$fix_srcfile_path"; then
883 eval srcfile=\"$fix_srcfile_path\"
885 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
887 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
888 qsrcfile="\"$qsrcfile\"" ;;
891 $run $rm "$libobj" "${libobj}T"
893 # Create a libtool object file (analogous to a ".la" file),
894 # but don't create it if we're doing a dry run.
895 test -z "$run" && cat > ${libobj}T <<EOF
896 # $libobj - a libtool object file
897 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
899 # Please DO NOT delete this file!
900 # It is necessary for linking the library.
902 # Name of the PIC object.
905 # Only build a PIC object if we are building libtool libraries.
906 if test "$build_libtool_libs" = yes; then
907 # Without this assignment, base_compile gets emptied.
908 fbsd_hideous_sh_bug=$base_compile
910 if test "$pic_mode" != no; then
911 command="$base_compile $qsrcfile $pic_flag"
913 # Don't build PIC code
914 command="$base_compile $qsrcfile"
917 if test ! -d "${xdir}$objdir"; then
918 $show "$mkdir ${xdir}$objdir"
919 $run $mkdir ${xdir}$objdir
921 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
926 if test -z "$output_obj"; then
927 # Place PIC objects in $objdir
928 command="$command -o $lobj"
931 $run $rm "$lobj" "$output_obj"
934 if $run eval "$command"; then :
936 test -n "$output_obj" && $run $rm $removelist
940 if test "$need_locks" = warn &&
941 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
943 *** ERROR, $lockfile contains:
944 `cat $lockfile 2>/dev/null`
946 but it should contain:
949 This indicates that another process is trying to use the same
950 temporary object file, and libtool could not work around it because
951 your compiler does not support \`-c' and \`-o' together. If you
952 repeat this compilation, it may succeed, by chance, but you had better
953 avoid parallel builds (make -j) in this platform, or get a better
960 # Just move the object if needed, then go on to compile the next one
961 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
962 $show "$mv $output_obj $lobj"
963 if $run $mv $output_obj $lobj; then :
971 # Append the name of the PIC object to the libtool object file.
972 test -z "$run" && cat >> ${libobj}T <<EOF
973 pic_object='$objdir/$objname'
977 # Allow error messages only from the first compilation.
978 if test "$suppress_opt" = yes; then
979 suppress_output=' >/dev/null 2>&1'
982 # No PIC object so indicate it doesn't exist in the libtool
984 test -z "$run" && cat >> ${libobj}T <<EOF
990 # Only build a position-dependent object if we build old libraries.
991 if test "$build_old_libs" = yes; then
992 if test "$pic_mode" != yes; then
993 # Don't build PIC code
994 command="$base_compile $qsrcfile"
996 command="$base_compile $qsrcfile $pic_flag"
998 if test "$compiler_c_o" = yes; then
999 command="$command -o $obj"
1002 # Suppress compiler output if we already did a PIC compilation.
1003 command="$command$suppress_output"
1004 $run $rm "$obj" "$output_obj"
1006 if $run eval "$command"; then :
1008 $run $rm $removelist
1012 if test "$need_locks" = warn &&
1013 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1015 *** ERROR, $lockfile contains:
1016 `cat $lockfile 2>/dev/null`
1018 but it should contain:
1021 This indicates that another process is trying to use the same
1022 temporary object file, and libtool could not work around it because
1023 your compiler does not support \`-c' and \`-o' together. If you
1024 repeat this compilation, it may succeed, by chance, but you had better
1025 avoid parallel builds (make -j) in this platform, or get a better
1028 $run $rm $removelist
1032 # Just move the object if needed
1033 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1034 $show "$mv $output_obj $obj"
1035 if $run $mv $output_obj $obj; then :
1038 $run $rm $removelist
1043 # Append the name of the non-PIC object the libtool object file.
1044 # Only append if the libtool object file exists.
1045 test -z "$run" && cat >> ${libobj}T <<EOF
1046 # Name of the non-PIC object.
1047 non_pic_object='$objname'
1051 # Append the name of the non-PIC object the libtool object file.
1052 # Only append if the libtool object file exists.
1053 test -z "$run" && cat >> ${libobj}T <<EOF
1054 # Name of the non-PIC object.
1060 $run $mv "${libobj}T" "${libobj}"
1062 # Unlock the critical section if it was locked
1063 if test "$need_locks" != no; then
1064 $run $rm "$lockfile"
1072 modename="$modename: link"
1074 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1075 # It is impossible to link a dll without this setting, and
1076 # we shouldn't force the makefile maintainer to figure out
1077 # which system we are compiling for in order to pass an extra
1078 # flag for every libtool invocation.
1079 # allow_undefined=no
1081 # FIXME: Unfortunately, there are problems with the above when trying
1082 # to make a dll which has undefined symbols, in which case not
1083 # even a static library is built. For now, we need to specify
1084 # -no-undefined on the libtool link line when we can be certain
1085 # that all symbols are satisfied, otherwise we get a static library.
1092 libtool_args="$nonopt"
1093 base_compile="$nonopt $@"
1094 compile_command="$nonopt"
1095 finalize_command="$nonopt"
1108 lib_search_path=`pwd`
1117 export_symbols_regex=
1125 notinst_path= # paths that contain not-installed libtool libraries
1126 precious_files_regex=
1127 prefer_static_libs=no
1140 func_infer_tag $base_compile
1142 # We need to know -static, to get the right output filenames.
1146 -all-static | -static)
1147 if test "X$arg" = "X-all-static"; then
1148 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1149 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1151 if test -n "$link_static_flag"; then
1152 dlopen_self=$dlopen_self_static
1154 prefer_static_libs=yes
1156 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1157 dlopen_self=$dlopen_self_static
1159 prefer_static_libs=built
1161 build_libtool_libs=no
1168 # See if our shared archives depend on static archives.
1169 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1171 # Go through the arguments, transforming them on the way.
1172 while test "$#" -gt 0; do
1176 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1177 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1181 libtool_args="$libtool_args $qarg"
1183 # If the previous option needs an argument, assign it.
1184 if test -n "$prev"; then
1187 compile_command="$compile_command @OUTPUT@"
1188 finalize_command="$finalize_command @OUTPUT@"
1194 if test "$preload" = no; then
1195 # Add the symbol object into the linking commands.
1196 compile_command="$compile_command @SYMFILE@"
1197 finalize_command="$finalize_command @SYMFILE@"
1201 *.la | *.lo) ;; # We handle these cases below.
1203 if test "$dlself" = no; then
1211 if test "$prev" = dlprefiles; then
1213 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1223 if test "$prev" = dlfiles; then
1224 dlfiles="$dlfiles $arg"
1226 dlprefiles="$dlprefiles $arg"
1234 export_symbols="$arg"
1235 if test ! -f "$arg"; then
1236 $echo "$modename: symbol file \`$arg' does not exist"
1243 export_symbols_regex="$arg"
1248 inst_prefix_dir="$arg"
1253 precious_files_regex="$arg"
1263 if test -f "$arg"; then
1266 for fil in `cat $save_arg`
1268 # moreargs="$moreargs $fil"
1270 # A libtool-controlled object.
1272 # Check to see that this really is a libtool object.
1273 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1278 # If there is no directory component, then add one.
1280 */* | *\\*) . $arg ;;
1284 if test -z "$pic_object" || \
1285 test -z "$non_pic_object" ||
1286 test "$pic_object" = none && \
1287 test "$non_pic_object" = none; then
1288 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1292 # Extract subdirectory from the argument.
1293 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1294 if test "X$xdir" = "X$arg"; then
1300 if test "$pic_object" != none; then
1301 # Prepend the subdirectory the object is found in.
1302 pic_object="$xdir$pic_object"
1304 if test "$prev" = dlfiles; then
1305 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1306 dlfiles="$dlfiles $pic_object"
1310 # If libtool objects are unsupported, then we need to preload.
1315 # CHECK ME: I think I busted this. -Ossama
1316 if test "$prev" = dlprefiles; then
1317 # Preload the old-style object.
1318 dlprefiles="$dlprefiles $pic_object"
1323 libobjs="$libobjs $pic_object"
1328 if test "$non_pic_object" != none; then
1329 # Prepend the subdirectory the object is found in.
1330 non_pic_object="$xdir$non_pic_object"
1332 # A standard non-PIC object
1333 non_pic_objects="$non_pic_objects $non_pic_object"
1334 if test -z "$pic_object" || test "$pic_object" = none ; then
1335 arg="$non_pic_object"
1338 # If the PIC object exists, use it instead.
1339 # $xdir was prepended to $pic_object above.
1340 non_pic_object="$pic_object"
1341 non_pic_objects="$non_pic_objects $non_pic_object"
1344 # Only an error if not doing a dry-run.
1345 if test -z "$run"; then
1346 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1351 # Extract subdirectory from the argument.
1352 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1353 if test "X$xdir" = "X$arg"; then
1359 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1360 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1361 libobjs="$libobjs $pic_object"
1362 non_pic_objects="$non_pic_objects $non_pic_object"
1367 $echo "$modename: link input file \`$save_arg' does not exist"
1375 # We need an absolute path.
1377 [\\/]* | [A-Za-z]:[\\/]*) ;;
1379 $echo "$modename: only absolute run-paths are allowed" 1>&2
1383 if test "$prev" = rpath; then
1386 *) rpath="$rpath $arg" ;;
1391 *) xrpath="$xrpath $arg" ;;
1398 compiler_flags="$compiler_flags $qarg"
1400 compile_command="$compile_command $qarg"
1401 finalize_command="$finalize_command $qarg"
1405 linker_flags="$linker_flags $qarg"
1406 compiler_flags="$compiler_flags $wl$qarg"
1408 compile_command="$compile_command $wl$qarg"
1409 finalize_command="$finalize_command $wl$qarg"
1413 linker_flags="$linker_flags $qarg"
1414 compiler_flags="$compiler_flags $qarg"
1416 compile_command="$compile_command $qarg"
1417 finalize_command="$finalize_command $qarg"
1425 darwin_framework|darwin_framework_skip)
1426 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1427 compile_command="$compile_command $arg"
1428 finalize_command="$finalize_command $arg"
1433 eval "$prev=\"\$arg\""
1438 fi # test -n "$prev"
1444 if test -n "$link_static_flag"; then
1445 compile_command="$compile_command $link_static_flag"
1446 finalize_command="$finalize_command $link_static_flag"
1452 # FIXME: remove this flag sometime in the future.
1453 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1477 -export-symbols | -export-symbols-regex)
1478 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1479 $echo "$modename: more than one -exported-symbols argument is not allowed"
1482 if test "X$arg" = "X-export-symbols"; then
1490 -framework|-arch|-isysroot)
1492 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1493 prev=darwin_framework_skip ;;
1494 *) compiler_flags="$compiler_flags $arg"
1495 prev=darwin_framework ;;
1497 compile_command="$compile_command $arg"
1498 finalize_command="$finalize_command $arg"
1507 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1508 # so, if we see these flags be careful not to treat them like -L
1510 case $with_gcc/$host in
1511 no/*-*-irix* | /*-*-irix*)
1512 compile_command="$compile_command $arg"
1513 finalize_command="$finalize_command $arg"
1520 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1521 # We need an absolute path.
1523 [\\/]* | [A-Za-z]:[\\/]*) ;;
1525 absdir=`cd "$dir" && pwd`
1526 if test -z "$absdir"; then
1527 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1529 notinst_path="$notinst_path $dir"
1537 deplibs="$deplibs -L$dir"
1538 lib_search_path="$lib_search_path $dir"
1542 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1543 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1544 case :$dllsearchpath: in
1546 *) dllsearchpath="$dllsearchpath:$dir";;
1548 case :$dllsearchpath: in
1549 *":$testbindir:"*) ;;
1550 *) dllsearchpath="$dllsearchpath:$testbindir";;
1558 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1560 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1561 # These systems don't actually have a C or math library (as such)
1565 # These systems don't actually have a C library (as such)
1566 test "X$arg" = "X-lc" && continue
1568 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1569 # Do not include libc due to us having libc/libc_r.
1570 test "X$arg" = "X-lc" && continue
1572 *-*-rhapsody* | *-*-darwin1.[012])
1573 # Rhapsody C and math libraries are in the System framework
1574 deplibs="$deplibs -framework System"
1577 *-*-sco3.2v5* | *-*-sco5v6*)
1578 # Causes problems with __ctype
1579 test "X$arg" = "X-lc" && continue
1581 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1582 # Compiler inserts libc in the correct place for threads to work
1583 test "X$arg" = "X-lc" && continue
1586 elif test "X$arg" = "X-lc_r"; then
1588 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1589 # Do not include libc_r directly, use -pthread flag.
1594 deplibs="$deplibs $arg"
1598 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1599 # classes, name mangling, and exception handling.
1601 compile_command="$compile_command $arg"
1602 compiler_flags="$compiler_flags $arg"
1603 finalize_command="$finalize_command $arg"
1608 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1609 compiler_flags="$compiler_flags $arg"
1610 compile_command="$compile_command $arg"
1611 finalize_command="$finalize_command $arg"
1612 deplibs="$deplibs $arg"
1620 # Do not build the useless static library
1627 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1628 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1629 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1630 # +DA*, +DD* enable 64-bit mode on the HP compiler
1631 # -q* pass through compiler args for the IBM compiler
1632 # -m* pass through architecture-specific compiler args for GCC
1633 # -m*, -t[45]*, -txscale* pass through architecture-specific
1634 # compiler args for GCC
1635 # -pg pass through profiling flag for GCC
1636 # @file GCC response files
1637 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1638 -t[45]*|-txscale*|@*)
1640 # Unknown arguments in both finalize_command and compile_command need
1641 # to be aesthetically quoted because they are evaled later.
1642 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1644 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1648 compile_command="$compile_command $arg"
1649 finalize_command="$finalize_command $arg"
1650 compiler_flags="$compiler_flags $arg"
1666 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1667 # The PATH hackery in wrapper scripts is required on Windows
1668 # in order for the loader to find any dlls it needs.
1669 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1670 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1673 *) no_install=yes ;;
1690 -precious-files-regex)
1711 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1712 # We need an absolute path.
1714 [\\/]* | [A-Za-z]:[\\/]*) ;;
1716 $echo "$modename: only absolute run-paths are allowed" 1>&2
1722 *) xrpath="$xrpath $dir" ;;
1728 # The effects of -static are defined in a previous loop.
1729 # We used to do the same as -all-static on platforms that
1730 # didn't have a PIC flag, but the assumption that the effects
1731 # would be equivalent was wrong. It would break on at least
1732 # Digital Unix and AIX.
1752 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1754 save_ifs="$IFS"; IFS=','
1755 for flag in $args; do
1758 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1763 compiler_flags="$compiler_flags $flag"
1766 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1770 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1772 save_ifs="$IFS"; IFS=','
1773 for flag in $args; do
1776 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1781 compiler_flags="$compiler_flags $wl$flag"
1782 linker_flags="$linker_flags $flag"
1785 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1803 # Some other compiler flag.
1805 # Unknown arguments in both finalize_command and compile_command need
1806 # to be aesthetically quoted because they are evaled later.
1807 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1809 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1816 # A standard object.
1821 # A libtool-controlled object.
1823 # Check to see that this really is a libtool object.
1824 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1829 # If there is no directory component, then add one.
1831 */* | *\\*) . $arg ;;
1835 if test -z "$pic_object" || \
1836 test -z "$non_pic_object" ||
1837 test "$pic_object" = none && \
1838 test "$non_pic_object" = none; then
1839 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1843 # Extract subdirectory from the argument.
1844 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1845 if test "X$xdir" = "X$arg"; then
1851 if test "$pic_object" != none; then
1852 # Prepend the subdirectory the object is found in.
1853 pic_object="$xdir$pic_object"
1855 if test "$prev" = dlfiles; then
1856 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1857 dlfiles="$dlfiles $pic_object"
1861 # If libtool objects are unsupported, then we need to preload.
1866 # CHECK ME: I think I busted this. -Ossama
1867 if test "$prev" = dlprefiles; then
1868 # Preload the old-style object.
1869 dlprefiles="$dlprefiles $pic_object"
1874 libobjs="$libobjs $pic_object"
1879 if test "$non_pic_object" != none; then
1880 # Prepend the subdirectory the object is found in.
1881 non_pic_object="$xdir$non_pic_object"
1883 # A standard non-PIC object
1884 non_pic_objects="$non_pic_objects $non_pic_object"
1885 if test -z "$pic_object" || test "$pic_object" = none ; then
1886 arg="$non_pic_object"
1889 # If the PIC object exists, use it instead.
1890 # $xdir was prepended to $pic_object above.
1891 non_pic_object="$pic_object"
1892 non_pic_objects="$non_pic_objects $non_pic_object"
1895 # Only an error if not doing a dry-run.
1896 if test -z "$run"; then
1897 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1902 # Extract subdirectory from the argument.
1903 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1904 if test "X$xdir" = "X$arg"; then
1910 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1911 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1912 libobjs="$libobjs $pic_object"
1913 non_pic_objects="$non_pic_objects $non_pic_object"
1920 deplibs="$deplibs $arg"
1921 old_deplibs="$old_deplibs $arg"
1926 # A libtool-controlled library.
1928 if test "$prev" = dlfiles; then
1929 # This library was specified with -dlopen.
1930 dlfiles="$dlfiles $arg"
1932 elif test "$prev" = dlprefiles; then
1933 # The library was specified with -dlpreopen.
1934 dlprefiles="$dlprefiles $arg"
1937 deplibs="$deplibs $arg"
1942 # Some other compiler argument.
1944 # Unknown arguments in both finalize_command and compile_command need
1945 # to be aesthetically quoted because they are evaled later.
1946 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1948 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1955 # Now actually substitute the argument into the commands.
1956 if test -n "$arg"; then
1957 compile_command="$compile_command $arg"
1958 finalize_command="$finalize_command $arg"
1960 done # argument parsing loop
1962 if test -n "$prev"; then
1963 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1968 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1969 eval arg=\"$export_dynamic_flag_spec\"
1970 compile_command="$compile_command $arg"
1971 finalize_command="$finalize_command $arg"
1975 # calculate the name of the file, without its directory
1976 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1977 libobjs_save="$libobjs"
1979 if test -n "$shlibpath_var"; then
1980 # get the directories listed in $shlibpath_var
1981 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1985 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1986 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1988 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1989 if test "X$output_objdir" = "X$output"; then
1990 output_objdir="$objdir"
1992 output_objdir="$output_objdir/$objdir"
1994 # Create the object directory.
1995 if test ! -d "$output_objdir"; then
1996 $show "$mkdir $output_objdir"
1997 $run $mkdir $output_objdir
1999 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2004 # Determine the type of output
2007 $echo "$modename: you must specify an output file" 1>&2
2011 *.$libext) linkmode=oldlib ;;
2012 *.lo | *.$objext) linkmode=obj ;;
2013 *.la) linkmode=lib ;;
2014 *) linkmode=prog ;; # Anything else should be a program.
2018 *cygwin* | *mingw* | *pw32*)
2019 # don't eliminate duplications in $postdeps and $predeps
2020 duplicate_compiler_generated_deps=yes
2023 duplicate_compiler_generated_deps=$duplicate_deps
2029 # Find all interdependent deplibs by searching for libraries
2030 # that are linked more than once (e.g. -la -lb -la)
2031 for deplib in $deplibs; do
2032 if test "X$duplicate_deps" = "Xyes" ; then
2034 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2037 libs="$libs $deplib"
2040 if test "$linkmode" = lib; then
2041 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2043 # Compute libraries that are listed more than once in $predeps
2044 # $postdeps and mark them as special (i.e., whose duplicates are
2045 # not to be eliminated).
2047 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2048 for pre_post_dep in $predeps $postdeps; do
2049 case "$pre_post_deps " in
2050 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2052 pre_post_deps="$pre_post_deps $pre_post_dep"
2061 need_relink=no # whether we're linking any uninstalled libtool libraries
2062 notinst_deplibs= # not-installed libtool libraries
2066 for file in $dlfiles $dlprefiles; do
2070 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2082 passes="conv scan dlopen dlpreopen link"
2087 for pass in $passes; do
2088 if test "$linkmode,$pass" = "lib,link" ||
2089 test "$linkmode,$pass" = "prog,scan"; then
2093 if test "$linkmode" = prog; then
2095 dlopen) libs="$dlfiles" ;;
2096 dlpreopen) libs="$dlprefiles" ;;
2097 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2100 if test "$pass" = dlopen; then
2101 # Collect dlpreopened libraries
2102 save_deplibs="$deplibs"
2105 for deplib in $libs; do
2109 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2110 if test "$linkmode,$pass" = "prog,link"; then
2111 compile_deplibs="$deplib $compile_deplibs"
2112 finalize_deplibs="$deplib $finalize_deplibs"
2114 compiler_flags="$compiler_flags $deplib"
2119 deplibs="$deplib $deplibs"
2120 test "$pass" = conv && continue
2121 newdependency_libs="$deplib $newdependency_libs"
2124 if test "$pass" = conv; then
2125 deplibs="$deplib $deplibs"
2128 if test "$pass" = scan; then
2129 deplibs="$deplib $deplibs"
2131 compile_deplibs="$deplib $compile_deplibs"
2132 finalize_deplibs="$deplib $finalize_deplibs"
2142 if test "$linkmode" != lib && test "$linkmode" != prog; then
2143 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2146 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2147 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2148 for search_ext in .la $std_shrext .so .a; do
2149 # Search the libtool library
2150 lib="$searchdir/lib${name}${search_ext}"
2151 if test -f "$lib"; then
2152 if test "$search_ext" = ".la"; then
2161 if test "$found" != yes; then
2162 # deplib doesn't seem to be a libtool library
2163 if test "$linkmode,$pass" = "prog,link"; then
2164 compile_deplibs="$deplib $compile_deplibs"
2165 finalize_deplibs="$deplib $finalize_deplibs"
2167 deplibs="$deplib $deplibs"
2168 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2171 else # deplib is a libtool library
2172 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2173 # We need to do some special things here, and not later.
2174 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2175 case " $predeps $postdeps " in
2177 if (${SED} -e '2q' $lib |
2178 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2182 */* | *\\*) . $lib ;;
2185 for l in $old_library $library_names; do
2188 if test "X$ll" = "X$old_library" ; then # only static version available
2190 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2191 test "X$ladir" = "X$lib" && ladir="."
2192 lib=$ladir/$old_library
2193 if test "$linkmode,$pass" = "prog,link"; then
2194 compile_deplibs="$deplib $compile_deplibs"
2195 finalize_deplibs="$deplib $finalize_deplibs"
2197 deplibs="$deplib $deplibs"
2198 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2212 deplibs="$deplib $deplibs"
2213 test "$pass" = conv && continue
2214 newdependency_libs="$deplib $newdependency_libs"
2215 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2218 if test "$pass" = conv; then
2219 deplibs="$deplib $deplibs"
2222 if test "$pass" = scan; then
2223 deplibs="$deplib $deplibs"
2225 compile_deplibs="$deplib $compile_deplibs"
2226 finalize_deplibs="$deplib $finalize_deplibs"
2228 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2231 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2237 if test "$pass" = link; then
2238 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2239 # Make sure the xrpath contains only unique directories.
2242 *) xrpath="$xrpath $dir" ;;
2245 deplibs="$deplib $deplibs"
2248 *.la) lib="$deplib" ;;
2250 if test "$pass" = conv; then
2251 deplibs="$deplib $deplibs"
2257 case $deplibs_check_method in
2259 set dummy $deplibs_check_method
2260 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2261 if eval $echo \"$deplib\" 2>/dev/null \
2263 | $EGREP "$match_pattern_regex" > /dev/null; then
2271 if test "$valid_a_lib" != yes; then
2273 $echo "*** Warning: Trying to link with static lib archive $deplib."
2274 $echo "*** I have the capability to make that library automatically link in when"
2275 $echo "*** you link to this library. But I can only do this if you have a"
2276 $echo "*** shared version of the library, which you do not appear to have"
2277 $echo "*** because the file extensions .$libext of this argument makes me believe"
2278 $echo "*** that it is just a static archive that I should not used here."
2281 $echo "*** Warning: Linking the shared library $output against the"
2282 $echo "*** static library $deplib is not portable!"
2283 deplibs="$deplib $deplibs"
2288 if test "$pass" != link; then
2289 deplibs="$deplib $deplibs"
2291 compile_deplibs="$deplib $compile_deplibs"
2292 finalize_deplibs="$deplib $finalize_deplibs"
2299 if test "$pass" = conv; then
2300 deplibs="$deplib $deplibs"
2301 elif test "$linkmode" = prog; then
2302 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2303 # If there is no dlopen support or we're linking statically,
2304 # we need to preload.
2305 newdlprefiles="$newdlprefiles $deplib"
2306 compile_deplibs="$deplib $compile_deplibs"
2307 finalize_deplibs="$deplib $finalize_deplibs"
2309 newdlfiles="$newdlfiles $deplib"
2319 if test "$found" = yes || test -f "$lib"; then :
2321 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2325 # Check to see that this really is a libtool archive.
2326 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2328 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2332 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2333 test "X$ladir" = "X$lib" && ladir="."
2341 # If the library was installed with an old release of libtool,
2342 # it will not redefine variables installed, or shouldnotlink
2350 */* | *\\*) . $lib ;;
2354 if test "$linkmode,$pass" = "lib,link" ||
2355 test "$linkmode,$pass" = "prog,scan" ||
2356 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2357 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2358 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2361 if test "$pass" = conv; then
2362 # Only check for convenience libraries
2363 deplibs="$lib $deplibs"
2364 if test -z "$libdir"; then
2365 if test -z "$old_library"; then
2366 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2369 # It is a libtool convenience library, so add in its objects.
2370 convenience="$convenience $ladir/$objdir/$old_library"
2371 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2373 for deplib in $dependency_libs; do
2374 deplibs="$deplib $deplibs"
2375 if test "X$duplicate_deps" = "Xyes" ; then
2376 case "$tmp_libs " in
2377 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2380 tmp_libs="$tmp_libs $deplib"
2382 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2383 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2390 # Get the name of the library we link against.
2392 for l in $old_library $library_names; do
2395 if test -z "$linklib"; then
2396 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2400 # This library was specified with -dlopen.
2401 if test "$pass" = dlopen; then
2402 if test -z "$libdir"; then
2403 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2406 if test -z "$dlname" ||
2407 test "$dlopen_support" != yes ||
2408 test "$build_libtool_libs" = no; then
2409 # If there is no dlname, no dlopen support or we're linking
2410 # statically, we need to preload. We also need to preload any
2411 # dependent libraries so libltdl's deplib preloader doesn't
2412 # bomb out in the load deplibs phase.
2413 dlprefiles="$dlprefiles $lib $dependency_libs"
2415 newdlfiles="$newdlfiles $lib"
2420 # We need an absolute path.
2422 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2424 abs_ladir=`cd "$ladir" && pwd`
2425 if test -z "$abs_ladir"; then
2426 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2427 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2432 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2434 # Find the relevant object directory and library name.
2435 if test "X$installed" = Xyes; then
2436 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2437 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2445 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2447 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2450 # Remove this search path later
2451 notinst_path="$notinst_path $abs_ladir"
2453 dir="$ladir/$objdir"
2454 absdir="$abs_ladir/$objdir"
2455 # Remove this search path later
2456 notinst_path="$notinst_path $abs_ladir"
2458 fi # $installed = yes
2459 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2461 # This library was specified with -dlpreopen.
2462 if test "$pass" = dlpreopen; then
2463 if test -z "$libdir"; then
2464 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2467 # Prefer using a static library (so that no silly _DYNAMIC symbols
2468 # are required to link).
2469 if test -n "$old_library"; then
2470 newdlprefiles="$newdlprefiles $dir/$old_library"
2471 # Otherwise, use the dlname, so that lt_dlopen finds it.
2472 elif test -n "$dlname"; then
2473 newdlprefiles="$newdlprefiles $dir/$dlname"
2475 newdlprefiles="$newdlprefiles $dir/$linklib"
2477 fi # $pass = dlpreopen
2479 if test -z "$libdir"; then
2480 # Link the convenience library
2481 if test "$linkmode" = lib; then
2482 deplibs="$dir/$old_library $deplibs"
2483 elif test "$linkmode,$pass" = "prog,link"; then
2484 compile_deplibs="$dir/$old_library $compile_deplibs"
2485 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2487 deplibs="$lib $deplibs" # used for prog,scan pass
2493 if test "$linkmode" = prog && test "$pass" != link; then
2494 newlib_search_path="$newlib_search_path $ladir"
2495 deplibs="$lib $deplibs"
2498 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2499 test "$build_libtool_libs" = no; then
2504 for deplib in $dependency_libs; do
2506 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2508 # Need to link against all dependency_libs?
2509 if test "$linkalldeplibs" = yes; then
2510 deplibs="$deplib $deplibs"
2512 # Need to hardcode shared library paths
2513 # or/and link against static libraries
2514 newdependency_libs="$deplib $newdependency_libs"
2516 if test "X$duplicate_deps" = "Xyes" ; then
2517 case "$tmp_libs " in
2518 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2521 tmp_libs="$tmp_libs $deplib"
2524 fi # $linkmode = prog...
2526 if test "$linkmode,$pass" = "prog,link"; then
2527 if test -n "$library_names" &&
2528 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2529 # We need to hardcode the library path
2530 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2531 # Make sure the rpath contains only unique directories.
2532 case "$temp_rpath " in
2535 *) temp_rpath="$temp_rpath $absdir" ;;
2539 # Hardcode the library path.
2540 # Skip directories that are in the system default run-time
2542 case " $sys_lib_dlsearch_path " in
2545 case "$compile_rpath " in
2547 *) compile_rpath="$compile_rpath $absdir"
2551 case " $sys_lib_dlsearch_path " in
2554 case "$finalize_rpath " in
2556 *) finalize_rpath="$finalize_rpath $libdir"
2560 fi # $linkmode,$pass = prog,link...
2562 if test "$alldeplibs" = yes &&
2563 { test "$deplibs_check_method" = pass_all ||
2564 { test "$build_libtool_libs" = yes &&
2565 test -n "$library_names"; }; }; then
2566 # We only need to search for static libraries
2571 link_static=no # Whether the deplib will be linked statically
2572 use_static_libs=$prefer_static_libs
2573 if test "$use_static_libs" = built && test "$installed" = yes ; then
2576 if test -n "$library_names" &&
2577 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2578 if test "$installed" = no; then
2579 notinst_deplibs="$notinst_deplibs $lib"
2582 # This is a shared library
2584 # Warn about portability, can't link against -module's on
2585 # some systems (darwin)
2586 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2588 if test "$linkmode" = prog; then
2589 $echo "*** Warning: Linking the executable $output against the loadable module"
2591 $echo "*** Warning: Linking the shared library $output against the loadable module"
2593 $echo "*** $linklib is not portable!"
2595 if test "$linkmode" = lib &&
2596 test "$hardcode_into_libs" = yes; then
2597 # Hardcode the library path.
2598 # Skip directories that are in the system default run-time
2600 case " $sys_lib_dlsearch_path " in
2603 case "$compile_rpath " in
2605 *) compile_rpath="$compile_rpath $absdir"
2609 case " $sys_lib_dlsearch_path " in
2612 case "$finalize_rpath " in
2614 *) finalize_rpath="$finalize_rpath $libdir"
2620 if test -n "$old_archive_from_expsyms_cmds"; then
2621 # figure out the soname
2622 set dummy $library_names
2625 libname=`eval \\$echo \"$libname_spec\"`
2626 # use dlname if we got it. it's perfectly good, no?
2627 if test -n "$dlname"; then
2629 elif test -n "$soname_spec"; then
2633 major=`expr $current - $age`
2637 eval soname=\"$soname_spec\"
2642 # Make a new name for the extract_expsyms_cmds to use
2644 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2645 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2647 # If the library has no export list, then create one now
2648 if test -f "$output_objdir/$soname-def"; then :
2650 $show "extracting exported symbol list from \`$soname'"
2651 save_ifs="$IFS"; IFS='~'
2652 cmds=$extract_expsyms_cmds
2653 for cmd in $cmds; do
2657 $run eval "$cmd" || exit $?
2663 if test -f "$output_objdir/$newlib"; then :; else
2664 $show "generating import library for \`$soname'"
2665 save_ifs="$IFS"; IFS='~'
2666 cmds=$old_archive_from_expsyms_cmds
2667 for cmd in $cmds; do
2671 $run eval "$cmd" || exit $?
2675 # make sure the library variables are pointing to the new library
2678 fi # test -n "$old_archive_from_expsyms_cmds"
2680 if test "$linkmode" = prog || test "$mode" != relink; then
2685 case $hardcode_action in
2686 immediate | unsupported)
2687 if test "$hardcode_direct" = no; then
2690 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2691 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2692 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2693 *-*-unixware7*) add_dir="-L$dir" ;;
2695 # if the lib is a module then we can not link against
2696 # it, someone is ignoring the new warnings I added
2697 if /usr/bin/file -L $add 2> /dev/null |
2698 $EGREP ": [^:]* bundle" >/dev/null ; then
2699 $echo "** Warning, lib $linklib is a module, not a shared library"
2700 if test -z "$old_library" ; then
2702 $echo "** And there doesn't seem to be a static archive available"
2703 $echo "** The link will probably fail, sorry"
2705 add="$dir/$old_library"
2709 elif test "$hardcode_minus_L" = no; then
2711 *-*-sunos*) add_shlibpath="$dir" ;;
2715 elif test "$hardcode_shlibpath_var" = no; then
2716 add_shlibpath="$dir"
2723 if test "$hardcode_direct" = yes; then
2725 elif test "$hardcode_minus_L" = yes; then
2727 # Try looking first in the location we're being installed to.
2728 if test -n "$inst_prefix_dir"; then
2731 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2736 elif test "$hardcode_shlibpath_var" = yes; then
2737 add_shlibpath="$dir"
2746 if test "$lib_linked" != yes; then
2747 $echo "$modename: configuration error: unsupported hardcode properties"
2751 if test -n "$add_shlibpath"; then
2752 case :$compile_shlibpath: in
2753 *":$add_shlibpath:"*) ;;
2754 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2757 if test "$linkmode" = prog; then
2758 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2759 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2761 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2762 test -n "$add" && deplibs="$add $deplibs"
2763 if test "$hardcode_direct" != yes && \
2764 test "$hardcode_minus_L" != yes && \
2765 test "$hardcode_shlibpath_var" = yes; then
2766 case :$finalize_shlibpath: in
2768 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2774 if test "$linkmode" = prog || test "$mode" = relink; then
2778 # Finalize command for both is simple: just hardcode it.
2779 if test "$hardcode_direct" = yes; then
2780 add="$libdir/$linklib"
2781 elif test "$hardcode_minus_L" = yes; then
2784 elif test "$hardcode_shlibpath_var" = yes; then
2785 case :$finalize_shlibpath: in
2787 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2790 elif test "$hardcode_automatic" = yes; then
2791 if test -n "$inst_prefix_dir" &&
2792 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2793 add="$inst_prefix_dir$libdir/$linklib"
2795 add="$libdir/$linklib"
2798 # We cannot seem to hardcode it, guess we'll fake it.
2800 # Try looking first in the location we're being installed to.
2801 if test -n "$inst_prefix_dir"; then
2804 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2811 if test "$linkmode" = prog; then
2812 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2813 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2815 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2816 test -n "$add" && deplibs="$add $deplibs"
2819 elif test "$linkmode" = prog; then
2820 # Here we assume that one of hardcode_direct or hardcode_minus_L
2821 # is not unsupported. This is valid on all known static and
2823 if test "$hardcode_direct" != unsupported; then
2824 test -n "$old_library" && linklib="$old_library"
2825 compile_deplibs="$dir/$linklib $compile_deplibs"
2826 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2828 compile_deplibs="-l$name -L$dir $compile_deplibs"
2829 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2831 elif test "$build_libtool_libs" = yes; then
2832 # Not a shared library
2833 if test "$deplibs_check_method" != pass_all; then
2834 # We're trying link a shared library against a static one
2835 # but the system doesn't support it.
2837 # Just print a warning and add the library to dependency_libs so
2838 # that the program can be linked against the static library.
2840 $echo "*** Warning: This system can not link to static lib archive $lib."
2841 $echo "*** I have the capability to make that library automatically link in when"
2842 $echo "*** you link to this library. But I can only do this if you have a"
2843 $echo "*** shared version of the library, which you do not appear to have."
2844 if test "$module" = yes; then
2845 $echo "*** But as you try to build a module library, libtool will still create "
2846 $echo "*** a static module, that should work as long as the dlopening application"
2847 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2848 if test -z "$global_symbol_pipe"; then
2850 $echo "*** However, this would only work if libtool was able to extract symbol"
2851 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2852 $echo "*** not find such a program. So, this module is probably useless."
2853 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2855 if test "$build_old_libs" = no; then
2856 build_libtool_libs=module
2859 build_libtool_libs=no
2863 deplibs="$dir/$old_library $deplibs"
2866 fi # link shared/static library?
2868 if test "$linkmode" = lib; then
2869 if test -n "$dependency_libs" &&
2870 { test "$hardcode_into_libs" != yes ||
2871 test "$build_old_libs" = yes ||
2872 test "$link_static" = yes; }; then
2873 # Extract -R from dependency_libs
2875 for libdir in $dependency_libs; do
2877 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2879 *" $temp_xrpath "*) ;;
2880 *) xrpath="$xrpath $temp_xrpath";;
2882 *) temp_deplibs="$temp_deplibs $libdir";;
2885 dependency_libs="$temp_deplibs"
2888 newlib_search_path="$newlib_search_path $absdir"
2889 # Link against this library
2890 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2891 # ... and its dependency_libs
2893 for deplib in $dependency_libs; do
2894 newdependency_libs="$deplib $newdependency_libs"
2895 if test "X$duplicate_deps" = "Xyes" ; then
2896 case "$tmp_libs " in
2897 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2900 tmp_libs="$tmp_libs $deplib"
2903 if test "$link_all_deplibs" != no; then
2904 # Add the search paths of all dependency libraries
2905 for deplib in $dependency_libs; do
2907 -L*) path="$deplib" ;;
2909 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2910 test "X$dir" = "X$deplib" && dir="."
2911 # We need an absolute path.
2913 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2915 absdir=`cd "$dir" && pwd`
2916 if test -z "$absdir"; then
2917 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2922 if grep "^installed=no" $deplib > /dev/null; then
2923 path="$absdir/$objdir"
2925 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2926 if test -z "$libdir"; then
2927 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2930 if test "$absdir" != "$libdir"; then
2931 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2938 # we do not want to link against static libs,
2939 # but need to link against shared
2940 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2941 if test -n "$deplibrary_names" ; then
2942 for tmp in $deplibrary_names ; do
2945 if test -f "$path/$depdepl" ; then
2946 depdepl="$path/$depdepl"
2948 # do not add paths which are already there
2949 case " $newlib_search_path " in
2951 *) newlib_search_path="$newlib_search_path $path";;
2964 # Again, we only want to link against shared libraries
2965 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2966 for tmp in $newlib_search_path ; do
2967 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2968 eval depdepl="$tmp/lib$tmp_libs.dylib"
2979 case " $deplibs " in
2981 *) deplibs="$path $deplibs" ;;
2983 case " $deplibs " in
2985 *) deplibs="$depdepl $deplibs" ;;
2988 fi # link_all_deplibs != no
2990 done # for deplib in $libs
2991 dependency_libs="$newdependency_libs"
2992 if test "$pass" = dlpreopen; then
2993 # Link the dlpreopened libraries before other libraries
2994 for deplib in $save_deplibs; do
2995 deplibs="$deplib $deplibs"
2998 if test "$pass" != dlopen; then
2999 if test "$pass" != conv; then
3000 # Make sure lib_search_path contains only unique directories.
3002 for dir in $newlib_search_path; do
3003 case "$lib_search_path " in
3005 *) lib_search_path="$lib_search_path $dir" ;;
3011 if test "$linkmode,$pass" != "prog,link"; then
3014 vars="compile_deplibs finalize_deplibs"
3016 for var in $vars dependency_libs; do
3017 # Add libraries to $var in reverse order
3018 eval tmp_libs=\"\$$var\"
3020 for deplib in $tmp_libs; do
3021 # FIXME: Pedantically, this is the right thing to do, so
3022 # that some nasty dependency loop isn't accidentally
3024 #new_libs="$deplib $new_libs"
3025 # Pragmatically, this seems to cause very few problems in
3028 -L*) new_libs="$deplib $new_libs" ;;
3031 # And here is the reason: when a library appears more
3032 # than once as an explicit dependence of a library, or
3033 # is implicitly linked in more than once by the
3034 # compiler, it is considered special, and multiple
3035 # occurrences thereof are not removed. Compare this
3036 # with having the same library being listed as a
3037 # dependency of multiple other libraries: in this case,
3038 # we know (pedantically, we assume) the library does not
3039 # need to be listed more than once, so we keep only the
3040 # last copy. This is not always right, but it is rare
3041 # enough that we require users that really mean to play
3042 # such unportable linking tricks to link the library
3043 # using -Wl,-lname, so that libtool does not consider it
3044 # for duplicate removal.
3045 case " $specialdeplibs " in
3046 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3048 case " $new_libs " in
3050 *) new_libs="$deplib $new_libs" ;;
3058 for deplib in $new_libs; do
3061 case " $tmp_libs " in
3063 *) tmp_libs="$tmp_libs $deplib" ;;
3066 *) tmp_libs="$tmp_libs $deplib" ;;
3069 eval $var=\"$tmp_libs\"
3072 # Last step: remove runtime libs from dependency_libs
3073 # (they stay in deplibs)
3075 for i in $dependency_libs ; do
3076 case " $predeps $postdeps $compiler_lib_search_path " in
3081 if test -n "$i" ; then
3082 tmp_libs="$tmp_libs $i"
3085 dependency_libs=$tmp_libs
3087 if test "$linkmode" = prog; then
3088 dlfiles="$newdlfiles"
3089 dlprefiles="$newdlprefiles"
3094 if test -n "$deplibs"; then
3095 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3098 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3099 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3102 if test -n "$rpath"; then
3103 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3106 if test -n "$xrpath"; then
3107 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3110 if test -n "$vinfo"; then
3111 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3114 if test -n "$release"; then
3115 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3118 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3119 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3122 # Now set the variables for building old libraries.
3123 build_libtool_libs=no
3125 objs="$objs$old_deplibs"
3129 # Make sure we only generate libraries of the form `libNAME.la'.
3132 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3133 eval shared_ext=\"$shrext_cmds\"
3134 eval libname=\"$libname_spec\"
3137 if test "$module" = no; then
3138 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3142 if test "$need_lib_prefix" != no; then
3143 # Add the "lib" prefix for modules if required
3144 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3145 eval shared_ext=\"$shrext_cmds\"
3146 eval libname=\"$libname_spec\"
3148 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3153 if test -n "$objs"; then
3154 if test "$deplibs_check_method" != pass_all; then
3155 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3159 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3160 $echo "*** objects $objs is not portable!"
3161 libobjs="$libobjs $objs"
3165 if test "$dlself" != no; then
3166 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3170 if test "$#" -gt 2; then
3171 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3176 if test -z "$rpath"; then
3177 if test "$build_libtool_libs" = yes; then
3178 # Building a libtool convenience library.
3179 # Some compilers have problems with a `.al' extension so
3180 # convenience libraries should have the same extension an
3181 # archive normally would.
3182 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3183 build_libtool_libs=convenience
3187 if test -n "$vinfo"; then
3188 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3191 if test -n "$release"; then
3192 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3196 # Parse the version information argument.
3197 save_ifs="$IFS"; IFS=':'
3198 set dummy $vinfo 0 0 0
3201 if test -n "$8"; then
3202 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3207 # convert absolute version numbers to libtool ages
3208 # this retains compatibility with .la files and attempts
3209 # to make the code below a bit more comprehensible
3211 case $vinfo_number in
3215 number_revision="$4"
3217 # There are really only two kinds -- those that
3218 # use the current revision as the major version
3219 # and those that subtract age and use age as
3220 # a minor version. But, then there is irix
3221 # which has an extra 1 added just for fun
3223 case $version_type in
3224 darwin|linux|osf|windows)
3225 current=`expr $number_major + $number_minor`
3227 revision="$number_revision"
3229 freebsd-aout|freebsd-elf|sunos)
3230 current="$number_major"
3231 revision="$number_minor"
3235 current=`expr $number_major + $number_minor - 1`
3237 revision="$number_minor"
3248 # Check that each of the things are valid numbers.
3250 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]) ;;
3252 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3253 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3259 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]) ;;
3261 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3262 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
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: AGE \`$age' must be a nonnegative integer" 1>&2
3271 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3276 if test "$age" -gt "$current"; then
3277 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3278 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3282 # Calculate the version variables.
3286 case $version_type in
3290 # Like Linux, but with the current version available in
3291 # verstring for coding it into the library header
3292 major=.`expr $current - $age`
3293 versuffix="$major.$age.$revision"
3294 # Darwin ld doesn't like 0 for these options...
3295 minor_current=`expr $current + 1`
3296 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3301 versuffix=".$current.$revision";
3306 versuffix=".$current";
3310 major=`expr $current - $age + 1`
3312 case $version_type in
3313 nonstopux) verstring_prefix=nonstopux ;;
3314 *) verstring_prefix=sgi ;;
3316 verstring="$verstring_prefix$major.$revision"
3318 # Add in all the interfaces that we are compatible with.
3320 while test "$loop" -ne 0; do
3321 iface=`expr $revision - $loop`
3322 loop=`expr $loop - 1`
3323 verstring="$verstring_prefix$major.$iface:$verstring"
3326 # Before this point, $major must not contain `.'.
3328 versuffix="$major.$revision"
3332 major=.`expr $current - $age`
3333 versuffix="$major.$age.$revision"
3337 major=.`expr $current - $age`
3338 versuffix=".$current.$age.$revision"
3339 verstring="$current.$age.$revision"
3341 # Add in all the interfaces that we are compatible with.
3343 while test "$loop" -ne 0; do
3344 iface=`expr $current - $loop`
3345 loop=`expr $loop - 1`
3346 verstring="$verstring:${iface}.0"
3349 # Make executables depend on our current version.
3350 verstring="$verstring:${current}.0"
3355 versuffix=".$current.$revision"
3359 # Use '-' rather than '.', since we only want one
3360 # extension on DOS 8.3 filesystems.
3361 major=`expr $current - $age`
3366 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3367 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3372 # Clear the version info if we defaulted, and they specified a release.
3373 if test -z "$vinfo" && test -n "$release"; then
3375 case $version_type in
3377 # we can't check for "0.0" in archive_cmds due to quoting
3378 # problems, so we reset it completely
3385 if test "$need_version" = no; then
3392 # Remove version info from name if versioning should be avoided
3393 if test "$avoid_version" = yes && test "$need_version" = no; then
3399 # Check to see if the archive will have undefined symbols.
3400 if test "$allow_undefined" = yes; then
3401 if test "$allow_undefined_flag" = unsupported; then
3402 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3403 build_libtool_libs=no
3407 # Don't allow undefined symbols.
3408 allow_undefined_flag="$no_undefined_flag"
3412 if test "$mode" != relink; then
3413 # Remove our outputs, but don't remove object files since they
3414 # may have been created when compiling PIC objects.
3416 tempremovelist=`$echo "$output_objdir/*"`
3417 for p in $tempremovelist; do
3421 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3422 if test "X$precious_files_regex" != "X"; then
3423 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3428 removelist="$removelist $p"
3433 if test -n "$removelist"; then
3434 $show "${rm}r $removelist"
3435 $run ${rm}r $removelist
3439 # Now set the variables for building old libraries.
3440 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3441 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3443 # Transform .lo files to .o files.
3444 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3447 # Eliminate all temporary directories.
3448 for path in $notinst_path; do
3449 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3450 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3451 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3454 if test -n "$xrpath"; then
3455 # If the user specified any rpath flags, then add them.
3457 for libdir in $xrpath; do
3458 temp_xrpath="$temp_xrpath -R$libdir"
3459 case "$finalize_rpath " in
3461 *) finalize_rpath="$finalize_rpath $libdir" ;;
3464 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3465 dependency_libs="$temp_xrpath $dependency_libs"
3469 # Make sure dlfiles contains only unique files that won't be dlpreopened
3470 old_dlfiles="$dlfiles"
3472 for lib in $old_dlfiles; do
3473 case " $dlprefiles $dlfiles " in
3475 *) dlfiles="$dlfiles $lib" ;;
3479 # Make sure dlprefiles contains only unique files
3480 old_dlprefiles="$dlprefiles"
3482 for lib in $old_dlprefiles; do
3483 case "$dlprefiles " in
3485 *) dlprefiles="$dlprefiles $lib" ;;
3489 if test "$build_libtool_libs" = yes; then
3490 if test -n "$rpath"; then
3492 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3493 # these systems don't actually have a c library (as such)!
3495 *-*-rhapsody* | *-*-darwin1.[012])
3496 # Rhapsody C library is in the System framework
3497 deplibs="$deplibs -framework System"
3500 # Don't link with libc until the a.out ld.so is fixed.
3502 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3503 # Do not include libc due to us having libc/libc_r.
3505 *-*-sco3.2v5* | *-*-sco5v6*)
3506 # Causes problems with __ctype
3508 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3509 # Compiler inserts libc in the correct place for threads to work
3512 # Add libc to deplibs on all other systems if necessary.
3513 if test "$build_libtool_need_lc" = "yes"; then
3514 deplibs="$deplibs -lc"
3520 # Transform deplibs into only deplibs that can be linked in shared.
3522 libname_save=$libname
3523 release_save=$release
3524 versuffix_save=$versuffix
3526 # I'm not sure if I'm treating the release correctly. I think
3527 # release should show up in the -l (ie -lgmp5) so we don't want to
3528 # add it in twice. Is that correct?
3534 case $deplibs_check_method in
3536 # Don't check for shared/static. Everything works.
3537 # This might be a little naive. We might want to check
3538 # whether the library exists or not. But this is on
3539 # osf3 & osf4 and I'm not really sure... Just
3540 # implementing what was already the behavior.
3544 # This code stresses the "libraries are programs" paradigm to its
3545 # limits. Maybe even breaks it. We compile a program, linking it
3546 # against the deplibs as a proxy for the library. Then we can check
3547 # whether they linked in statically or dynamically with ldd.
3549 cat > conftest.c <<EOF
3550 int main() { return 0; }
3553 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3554 if test "$?" -eq 0 ; then
3555 ldd_output=`ldd conftest`
3556 for i in $deplibs; do
3557 name=`expr $i : '-l\(.*\)'`
3558 # If $name is empty we are operating on a -L argument.
3559 if test "$name" != "" && test "$name" -ne "0"; then
3560 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3561 case " $predeps $postdeps " in
3563 newdeplibs="$newdeplibs $i"
3568 if test -n "$i" ; then
3569 libname=`eval \\$echo \"$libname_spec\"`
3570 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3571 set dummy $deplib_matches
3573 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3574 newdeplibs="$newdeplibs $i"
3578 $echo "*** Warning: dynamic linker does not accept needed library $i."
3579 $echo "*** I have the capability to make that library automatically link in when"
3580 $echo "*** you link to this library. But I can only do this if you have a"
3581 $echo "*** shared version of the library, which I believe you do not have"
3582 $echo "*** because a test_compile did reveal that the linker did not use it for"
3583 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3587 newdeplibs="$newdeplibs $i"
3591 # Error occurred in the first compile. Let's try to salvage
3592 # the situation: Compile a separate program for each library.
3593 for i in $deplibs; do
3594 name=`expr $i : '-l\(.*\)'`
3595 # If $name is empty we are operating on a -L argument.
3596 if test "$name" != "" && test "$name" != "0"; then
3598 $LTCC $LTCFLAGS -o conftest conftest.c $i
3600 if test "$?" -eq 0 ; then
3601 ldd_output=`ldd conftest`
3602 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3603 case " $predeps $postdeps " in
3605 newdeplibs="$newdeplibs $i"
3610 if test -n "$i" ; then
3611 libname=`eval \\$echo \"$libname_spec\"`
3612 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3613 set dummy $deplib_matches
3615 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3616 newdeplibs="$newdeplibs $i"
3620 $echo "*** Warning: dynamic linker does not accept needed library $i."
3621 $echo "*** I have the capability to make that library automatically link in when"
3622 $echo "*** you link to this library. But I can only do this if you have a"
3623 $echo "*** shared version of the library, which you do not appear to have"
3624 $echo "*** because a test_compile did reveal that the linker did not use this one"
3625 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3631 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3632 $echo "*** make it link in! You will probably need to install it or some"
3633 $echo "*** library that it depends on before this library will be fully"
3634 $echo "*** functional. Installing it before continuing would be even better."
3637 newdeplibs="$newdeplibs $i"
3643 set dummy $deplibs_check_method
3644 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3645 for a_deplib in $deplibs; do
3646 name=`expr $a_deplib : '-l\(.*\)'`
3647 # If $name is empty we are operating on a -L argument.
3648 if test "$name" != "" && test "$name" != "0"; then
3649 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3650 case " $predeps $postdeps " in
3652 newdeplibs="$newdeplibs $a_deplib"
3657 if test -n "$a_deplib" ; then
3658 libname=`eval \\$echo \"$libname_spec\"`
3659 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3660 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3661 for potent_lib in $potential_libs; do
3662 # Follow soft links.
3663 if ls -lLd "$potent_lib" 2>/dev/null \
3664 | grep " -> " >/dev/null; then
3667 # The statement above tries to avoid entering an
3668 # endless loop below, in case of cyclic links.
3669 # We might still enter an endless loop, since a link
3670 # loop can be closed while we follow links,
3672 potlib="$potent_lib"
3673 while test -h "$potlib" 2>/dev/null; do
3674 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3676 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3677 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3680 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3682 | $EGREP "$file_magic_regex" > /dev/null; then
3683 newdeplibs="$newdeplibs $a_deplib"
3690 if test -n "$a_deplib" ; then
3693 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3694 $echo "*** I have the capability to make that library automatically link in when"
3695 $echo "*** you link to this library. But I can only do this if you have a"
3696 $echo "*** shared version of the library, which you do not appear to have"
3697 $echo "*** because I did check the linker path looking for a file starting"
3698 if test -z "$potlib" ; then
3699 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3701 $echo "*** with $libname and none of the candidates passed a file format test"
3702 $echo "*** using a file magic. Last file checked: $potlib"
3706 # Add a -L argument.
3707 newdeplibs="$newdeplibs $a_deplib"
3709 done # Gone through all deplibs.
3712 set dummy $deplibs_check_method
3713 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3714 for a_deplib in $deplibs; do
3715 name=`expr $a_deplib : '-l\(.*\)'`
3716 # If $name is empty we are operating on a -L argument.
3717 if test -n "$name" && test "$name" != "0"; then
3718 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3719 case " $predeps $postdeps " in
3721 newdeplibs="$newdeplibs $a_deplib"
3726 if test -n "$a_deplib" ; then
3727 libname=`eval \\$echo \"$libname_spec\"`
3728 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3729 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3730 for potent_lib in $potential_libs; do
3731 potlib="$potent_lib" # see symlink-check above in file_magic test
3732 if eval $echo \"$potent_lib\" 2>/dev/null \
3734 | $EGREP "$match_pattern_regex" > /dev/null; then
3735 newdeplibs="$newdeplibs $a_deplib"
3742 if test -n "$a_deplib" ; then
3745 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3746 $echo "*** I have the capability to make that library automatically link in when"
3747 $echo "*** you link to this library. But I can only do this if you have a"
3748 $echo "*** shared version of the library, which you do not appear to have"
3749 $echo "*** because I did check the linker path looking for a file starting"
3750 if test -z "$potlib" ; then
3751 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3753 $echo "*** with $libname and none of the candidates passed a file format test"
3754 $echo "*** using a regex pattern. Last file checked: $potlib"
3758 # Add a -L argument.
3759 newdeplibs="$newdeplibs $a_deplib"
3761 done # Gone through all deplibs.
3765 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3766 -e 's/ -[LR][^ ]*//g'`
3767 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3768 for i in $predeps $postdeps ; do
3769 # can't use Xsed below, because $i might contain '/'
3770 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3773 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3774 | grep . >/dev/null; then
3776 if test "X$deplibs_check_method" = "Xnone"; then
3777 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3779 $echo "*** Warning: inter-library dependencies are not known to be supported."
3781 $echo "*** All declared inter-library dependencies are being dropped."
3786 versuffix=$versuffix_save
3788 release=$release_save
3789 libname=$libname_save
3793 *-*-rhapsody* | *-*-darwin1.[012])
3794 # On Rhapsody replace the C library is the System framework
3795 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3799 if test "$droppeddeps" = yes; then
3800 if test "$module" = yes; then
3802 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3803 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3804 $echo "*** a static module, that should work as long as the dlopening"
3805 $echo "*** application is linked with the -dlopen flag."
3806 if test -z "$global_symbol_pipe"; then
3808 $echo "*** However, this would only work if libtool was able to extract symbol"
3809 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3810 $echo "*** not find such a program. So, this module is probably useless."
3811 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3813 if test "$build_old_libs" = no; then
3814 oldlibs="$output_objdir/$libname.$libext"
3815 build_libtool_libs=module
3818 build_libtool_libs=no
3821 $echo "*** The inter-library dependencies that have been dropped here will be"
3822 $echo "*** automatically added whenever a program is linked with this library"
3823 $echo "*** or is declared to -dlopen it."
3825 if test "$allow_undefined" = no; then
3827 $echo "*** Since this library must not contain undefined symbols,"
3828 $echo "*** because either the platform does not support them or"
3829 $echo "*** it was explicitly requested with -no-undefined,"
3830 $echo "*** libtool will only create a static version of it."
3831 if test "$build_old_libs" = no; then
3832 oldlibs="$output_objdir/$libname.$libext"
3833 build_libtool_libs=module
3836 build_libtool_libs=no
3841 # Done checking deplibs!
3846 # move library search paths that coincide with paths to not yet
3847 # installed libraries to the beginning of the library search list
3849 for path in $notinst_path; do
3850 case " $new_libs " in
3851 *" -L$path/$objdir "*) ;;
3853 case " $deplibs " in
3854 *" -L$path/$objdir "*)
3855 new_libs="$new_libs -L$path/$objdir" ;;
3860 for deplib in $deplibs; do
3863 case " $new_libs " in
3865 *) new_libs="$new_libs $deplib" ;;
3868 *) new_libs="$new_libs $deplib" ;;
3874 # All the library-specific variables (install_libdir is set above).
3879 # Test again, we may have decided not to build it any more
3880 if test "$build_libtool_libs" = yes; then
3881 if test "$hardcode_into_libs" = yes; then
3882 # Hardcode the library paths
3885 rpath="$finalize_rpath"
3886 test "$mode" != relink && rpath="$compile_rpath$rpath"
3887 for libdir in $rpath; do
3888 if test -n "$hardcode_libdir_flag_spec"; then
3889 if test -n "$hardcode_libdir_separator"; then
3890 if test -z "$hardcode_libdirs"; then
3891 hardcode_libdirs="$libdir"
3893 # Just accumulate the unique libdirs.
3894 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3895 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3898 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3903 eval flag=\"$hardcode_libdir_flag_spec\"
3904 dep_rpath="$dep_rpath $flag"
3906 elif test -n "$runpath_var"; then
3907 case "$perm_rpath " in
3909 *) perm_rpath="$perm_rpath $libdir" ;;
3913 # Substitute the hardcoded libdirs into the rpath.
3914 if test -n "$hardcode_libdir_separator" &&
3915 test -n "$hardcode_libdirs"; then
3916 libdir="$hardcode_libdirs"
3917 if test -n "$hardcode_libdir_flag_spec_ld"; then
3918 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3920 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3923 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3924 # We should set the runpath_var.
3926 for dir in $perm_rpath; do
3929 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3931 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3934 shlibpath="$finalize_shlibpath"
3935 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3936 if test -n "$shlibpath"; then
3937 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3940 # Get the real and link names of the library.
3941 eval shared_ext=\"$shrext_cmds\"
3942 eval library_names=\"$library_names_spec\"
3943 set dummy $library_names
3947 if test -n "$soname_spec"; then
3948 eval soname=\"$soname_spec\"
3952 if test -z "$dlname"; then
3956 lib="$output_objdir/$realname"
3960 linknames="$linknames $link"
3963 # Use standard objects if they are pic
3964 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3966 # Prepare the list of exported symbols
3967 if test -z "$export_symbols"; then
3968 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3969 $show "generating symbol list for \`$libname.la'"
3970 export_symbols="$output_objdir/$libname.exp"
3971 $run $rm $export_symbols
3972 cmds=$export_symbols_cmds
3973 save_ifs="$IFS"; IFS='~'
3974 for cmd in $cmds; do
3977 if len=`expr "X$cmd" : ".*"` &&
3978 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3980 $run eval "$cmd" || exit $?
3981 skipped_export=false
3983 # The command line is too long to execute in one step.
3984 $show "using reloadable object file for export list..."
3986 # Break out early, otherwise skipped_export may be
3987 # set to false by a later but shorter cmd.
3992 if test -n "$export_symbols_regex"; then
3993 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3994 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3995 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3996 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4001 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4002 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4006 for test_deplib in $deplibs; do
4007 case " $convenience " in
4008 *" $test_deplib "*) ;;
4010 tmp_deplibs="$tmp_deplibs $test_deplib"
4014 deplibs="$tmp_deplibs"
4016 if test -n "$convenience"; then
4017 if test -n "$whole_archive_flag_spec"; then
4018 save_libobjs=$libobjs
4019 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4021 gentop="$output_objdir/${outputname}x"
4022 generated="$generated $gentop"
4024 func_extract_archives $gentop $convenience
4025 libobjs="$libobjs $func_extract_archives_result"
4029 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4030 eval flag=\"$thread_safe_flag_spec\"
4031 linker_flags="$linker_flags $flag"
4034 # Make a backup of the uninstalled library when relinking
4035 if test "$mode" = relink; then
4036 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4039 # Do each of the archive commands.
4040 if test "$module" = yes && test -n "$module_cmds" ; then
4041 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4042 eval test_cmds=\"$module_expsym_cmds\"
4043 cmds=$module_expsym_cmds
4045 eval test_cmds=\"$module_cmds\"
4049 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4050 eval test_cmds=\"$archive_expsym_cmds\"
4051 cmds=$archive_expsym_cmds
4053 eval test_cmds=\"$archive_cmds\"
4058 if test "X$skipped_export" != "X:" &&
4059 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4060 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4063 # The command line is too long to link in one step, link piecewise.
4064 $echo "creating reloadable object files..."
4066 # Save the value of $output and $libobjs because we want to
4067 # use them later. If we have whole_archive_flag_spec, we
4068 # want to use save_libobjs as it was before
4069 # whole_archive_flag_spec was expanded, because we can't
4070 # assume the linker understands whole_archive_flag_spec.
4071 # This may have to be revisited, in case too many
4072 # convenience libraries get linked in and end up exceeding
4074 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4075 save_libobjs=$libobjs
4078 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4080 # Clear the reloadable object creation command queue and
4081 # initialize k to one.
4088 output=$output_objdir/$output_la-${k}.$objext
4089 # Loop over the list of objects to be linked.
4090 for obj in $save_libobjs
4092 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4093 if test "X$objlist" = X ||
4094 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4095 test "$len" -le "$max_cmd_len"; }; then
4096 objlist="$objlist $obj"
4098 # The command $test_cmds is almost too long, add a
4099 # command to the queue.
4100 if test "$k" -eq 1 ; then
4101 # The first file doesn't have a previous command to add.
4102 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4104 # All subsequent reloadable object files will link in
4105 # the last one created.
4106 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4108 last_robj=$output_objdir/$output_la-${k}.$objext
4110 output=$output_objdir/$output_la-${k}.$objext
4115 # Handle the remaining objects by creating one last
4116 # reloadable object file. All subsequent reloadable object
4117 # files will link in the last one created.
4118 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4119 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4121 if ${skipped_export-false}; then
4122 $show "generating symbol list for \`$libname.la'"
4123 export_symbols="$output_objdir/$libname.exp"
4124 $run $rm $export_symbols
4126 # Append the command to create the export file.
4127 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4130 # Set up a command to remove the reloadable object files
4131 # after they are used.
4133 while test "$i" -lt "$k"
4136 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4139 $echo "creating a temporary reloadable object file: $output"
4141 # Loop through the commands generated above and execute them.
4142 save_ifs="$IFS"; IFS='~'
4143 for cmd in $concat_cmds; do
4146 $run eval "$cmd" || exit $?
4151 # Restore the value of output.
4154 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4155 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4157 # Expand the library linking commands again to reset the
4158 # value of $libobjs for piecewise linking.
4160 # Do each of the archive commands.
4161 if test "$module" = yes && test -n "$module_cmds" ; then
4162 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4163 cmds=$module_expsym_cmds
4168 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4169 cmds=$archive_expsym_cmds
4175 # Append the command to remove the reloadable object files
4176 # to the just-reset $cmds.
4177 eval cmds=\"\$cmds~\$rm $delfiles\"
4179 save_ifs="$IFS"; IFS='~'
4180 for cmd in $cmds; do
4184 $run eval "$cmd" || {
4187 # Restore the uninstalled library and exit
4188 if test "$mode" = relink; then
4189 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4197 # Restore the uninstalled library and exit
4198 if test "$mode" = relink; then
4199 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4201 if test -n "$convenience"; then
4202 if test -z "$whole_archive_flag_spec"; then
4203 $show "${rm}r $gentop"
4204 $run ${rm}r "$gentop"
4211 # Create links to the real library.
4212 for linkname in $linknames; do
4213 if test "$realname" != "$linkname"; then
4214 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4215 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4219 # If -module or -export-dynamic was specified, set the dlname.
4220 if test "$module" = yes || test "$export_dynamic" = yes; then
4221 # On all known operating systems, these are identical.
4228 if test -n "$deplibs"; then
4229 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4232 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4233 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4236 if test -n "$rpath"; then
4237 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4240 if test -n "$xrpath"; then
4241 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4244 if test -n "$vinfo"; then
4245 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4248 if test -n "$release"; then
4249 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4254 if test -n "$objs$old_deplibs"; then
4255 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4259 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4267 # Delete the old objects.
4268 $run $rm $obj $libobj
4270 # Objects from convenience libraries. This assumes
4271 # single-version convenience libraries. Whenever we create
4272 # different ones for PIC/non-PIC, this we'll have to duplicate
4276 # reload_cmds runs $LD directly, so let us get rid of
4277 # -Wl from whole_archive_flag_spec
4280 if test -n "$convenience"; then
4281 if test -n "$whole_archive_flag_spec"; then
4282 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4284 gentop="$output_objdir/${obj}x"
4285 generated="$generated $gentop"
4287 func_extract_archives $gentop $convenience
4288 reload_conv_objs="$reload_objs $func_extract_archives_result"
4292 # Create the old-style object.
4293 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
4297 save_ifs="$IFS"; IFS='~'
4298 for cmd in $cmds; do
4302 $run eval "$cmd" || exit $?
4306 # Exit if we aren't doing a library object file.
4307 if test -z "$libobj"; then
4308 if test -n "$gentop"; then
4309 $show "${rm}r $gentop"
4316 if test "$build_libtool_libs" != yes; then
4317 if test -n "$gentop"; then
4318 $show "${rm}r $gentop"
4322 # Create an invalid libtool object if no PIC, so that we don't
4323 # accidentally link it into a program.
4324 # $show "echo timestamp > $libobj"
4325 # $run eval "echo timestamp > $libobj" || exit $?
4329 if test -n "$pic_flag" || test "$pic_mode" != default; then
4330 # Only do commands if we really have different PIC objects.
4331 reload_objs="$libobjs $reload_conv_objs"
4334 save_ifs="$IFS"; IFS='~'
4335 for cmd in $cmds; do
4339 $run eval "$cmd" || exit $?
4344 if test -n "$gentop"; then
4345 $show "${rm}r $gentop"
4354 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4356 if test -n "$vinfo"; then
4357 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4360 if test -n "$release"; then
4361 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4364 if test "$preload" = yes; then
4365 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4366 test "$dlopen_self_static" = unknown; then
4367 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4372 *-*-rhapsody* | *-*-darwin1.[012])
4373 # On Rhapsody replace the C library is the System framework
4374 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4375 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4381 # Don't allow lazy linking, it breaks C++ global constructors
4382 if test "$tagname" = CXX ; then
4383 compile_command="$compile_command ${wl}-bind_at_load"
4384 finalize_command="$finalize_command ${wl}-bind_at_load"
4390 # move library search paths that coincide with paths to not yet
4391 # installed libraries to the beginning of the library search list
4393 for path in $notinst_path; do
4394 case " $new_libs " in
4395 *" -L$path/$objdir "*) ;;
4397 case " $compile_deplibs " in
4398 *" -L$path/$objdir "*)
4399 new_libs="$new_libs -L$path/$objdir" ;;
4404 for deplib in $compile_deplibs; do
4407 case " $new_libs " in
4409 *) new_libs="$new_libs $deplib" ;;
4412 *) new_libs="$new_libs $deplib" ;;
4415 compile_deplibs="$new_libs"
4418 compile_command="$compile_command $compile_deplibs"
4419 finalize_command="$finalize_command $finalize_deplibs"
4421 if test -n "$rpath$xrpath"; then
4422 # If the user specified any rpath flags, then add them.
4423 for libdir in $rpath $xrpath; do
4424 # This is the magic to use -rpath.
4425 case "$finalize_rpath " in
4427 *) finalize_rpath="$finalize_rpath $libdir" ;;
4432 # Now hardcode the library paths
4435 for libdir in $compile_rpath $finalize_rpath; do
4436 if test -n "$hardcode_libdir_flag_spec"; then
4437 if test -n "$hardcode_libdir_separator"; then
4438 if test -z "$hardcode_libdirs"; then
4439 hardcode_libdirs="$libdir"
4441 # Just accumulate the unique libdirs.
4442 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4443 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4446 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4451 eval flag=\"$hardcode_libdir_flag_spec\"
4452 rpath="$rpath $flag"
4454 elif test -n "$runpath_var"; then
4455 case "$perm_rpath " in
4457 *) perm_rpath="$perm_rpath $libdir" ;;
4461 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4462 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4463 case :$dllsearchpath: in
4465 *) dllsearchpath="$dllsearchpath:$libdir";;
4467 case :$dllsearchpath: in
4468 *":$testbindir:"*) ;;
4469 *) dllsearchpath="$dllsearchpath:$testbindir";;
4474 # Substitute the hardcoded libdirs into the rpath.
4475 if test -n "$hardcode_libdir_separator" &&
4476 test -n "$hardcode_libdirs"; then
4477 libdir="$hardcode_libdirs"
4478 eval rpath=\" $hardcode_libdir_flag_spec\"
4480 compile_rpath="$rpath"
4484 for libdir in $finalize_rpath; do
4485 if test -n "$hardcode_libdir_flag_spec"; then
4486 if test -n "$hardcode_libdir_separator"; then
4487 if test -z "$hardcode_libdirs"; then
4488 hardcode_libdirs="$libdir"
4490 # Just accumulate the unique libdirs.
4491 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4492 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4495 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4500 eval flag=\"$hardcode_libdir_flag_spec\"
4501 rpath="$rpath $flag"
4503 elif test -n "$runpath_var"; then
4504 case "$finalize_perm_rpath " in
4506 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4510 # Substitute the hardcoded libdirs into the rpath.
4511 if test -n "$hardcode_libdir_separator" &&
4512 test -n "$hardcode_libdirs"; then
4513 libdir="$hardcode_libdirs"
4514 eval rpath=\" $hardcode_libdir_flag_spec\"
4516 finalize_rpath="$rpath"
4518 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4519 # Transform all the library objects into standard objects.
4520 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4521 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4525 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4526 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4527 dlsyms="${outputname}S.c"
4529 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4533 if test -n "$dlsyms"; then
4537 # Discover the nlist of each of the dlfiles.
4538 nlist="$output_objdir/${outputname}.nm"
4540 $show "$rm $nlist ${nlist}S ${nlist}T"
4541 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4543 # Parse the name list into a source file.
4544 $show "creating $output_objdir/$dlsyms"
4546 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4547 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4548 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4554 /* Prevent the only kind of declaration conflicts we can make. */
4555 #define lt_preloaded_symbols some_other_symbol
4557 /* External symbol declarations for the compiler. */\
4560 if test "$dlself" = yes; then
4561 $show "generating symbol list for \`$output'"
4563 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4565 # Add our own program objects to the symbol list.
4566 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4567 for arg in $progfiles; do
4568 $show "extracting global C symbols from \`$arg'"
4569 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4572 if test -n "$exclude_expsyms"; then
4573 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4574 $run eval '$mv "$nlist"T "$nlist"'
4577 if test -n "$export_symbols_regex"; then
4578 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4579 $run eval '$mv "$nlist"T "$nlist"'
4582 # Prepare the list of exported symbols
4583 if test -z "$export_symbols"; then
4584 export_symbols="$output_objdir/$outputname.exp"
4585 $run $rm $export_symbols
4586 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4588 *cygwin* | *mingw* )
4589 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4590 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4594 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4595 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4596 $run eval 'mv "$nlist"T "$nlist"'
4598 *cygwin* | *mingw* )
4599 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4600 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4606 for arg in $dlprefiles; do
4607 $show "extracting global C symbols from \`$arg'"
4608 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4609 $run eval '$echo ": $name " >> "$nlist"'
4610 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4613 if test -z "$run"; then
4614 # Make sure we have at least an empty file.
4615 test -f "$nlist" || : > "$nlist"
4617 if test -n "$exclude_expsyms"; then
4618 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4619 $mv "$nlist"T "$nlist"
4622 # Try sorting and uniquifying the output.
4623 if grep -v "^: " < "$nlist" |
4624 if sort -k 3 </dev/null >/dev/null 2>&1; then
4629 uniq > "$nlist"S; then
4632 grep -v "^: " < "$nlist" > "$nlist"S
4635 if test -f "$nlist"S; then
4636 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4638 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4641 $echo >> "$output_objdir/$dlsyms" "\
4643 #undef lt_preloaded_symbols
4645 #if defined (__STDC__) && __STDC__
4646 # define lt_ptr void *
4648 # define lt_ptr char *
4652 /* The mapping between symbol names and symbols. */
4656 *cygwin* | *mingw* )
4657 $echo >> "$output_objdir/$dlsyms" "\
4658 /* DATA imports from DLLs on WIN32 can't be const, because
4659 runtime relocations are performed -- see ld's documentation
4665 $echo >> "$output_objdir/$dlsyms" "\
4672 $echo >> "$output_objdir/$dlsyms" "\
4676 lt_preloaded_symbols[] =
4680 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4682 $echo >> "$output_objdir/$dlsyms" "\
4686 /* This works around a problem in FreeBSD linker */
4687 #ifdef FREEBSD_WORKAROUND
4688 static const void *lt_preloaded_setup() {
4689 return lt_preloaded_symbols;
4699 pic_flag_for_symtable=
4701 # compiling the symbol table file with pic_flag works around
4702 # a FreeBSD bug that causes programs to crash when -lm is
4703 # linked before any other PIC object. But we must not use
4704 # pic_flag when linking with -static. The problem exists in
4705 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4706 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4707 case "$compile_command " in
4709 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4712 case "$compile_command " in
4714 *) pic_flag_for_symtable=" $pic_flag";;
4718 # Now compile the dynamic symbol file.
4719 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4720 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4722 # Clean up the generated files.
4723 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4724 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4726 # Transform the symbol file into the correct name.
4728 *cygwin* | *mingw* )
4729 if test -f "$output_objdir/${outputname}.def" ; then
4730 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4731 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4733 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4734 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4738 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4739 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4744 # FreeBSD doesn't need this...
4747 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4752 # We keep going just in case the user didn't refer to
4753 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4754 # really was required.
4756 # Nullify the symbol file.
4757 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4758 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4761 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4762 # Replace the output file specification.
4763 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4764 link_command="$compile_command$compile_rpath"
4766 # We have no uninstalled library dependencies, so finalize right now.
4767 $show "$link_command"
4768 $run eval "$link_command"
4771 # Delete the generated files.
4772 if test -n "$dlsyms"; then
4773 $show "$rm $output_objdir/${outputname}S.${objext}"
4774 $run $rm "$output_objdir/${outputname}S.${objext}"
4780 if test -n "$shlibpath_var"; then
4781 # We should set the shlibpath_var
4783 for dir in $temp_rpath; do
4785 [\\/]* | [A-Za-z]:[\\/]*)
4790 # Relative path: add a thisdir entry.
4791 rpath="$rpath\$thisdir/$dir:"
4798 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4799 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4801 if test -n "$finalize_shlibpath"; then
4802 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4807 if test -n "$runpath_var"; then
4808 if test -n "$perm_rpath"; then
4809 # We should set the runpath_var.
4811 for dir in $perm_rpath; do
4814 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4816 if test -n "$finalize_perm_rpath"; then
4817 # We should set the runpath_var.
4819 for dir in $finalize_perm_rpath; do
4822 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4826 if test "$no_install" = yes; then
4827 # We don't need to create a wrapper script.
4828 link_command="$compile_var$compile_command$compile_rpath"
4829 # Replace the output file specification.
4830 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4831 # Delete the old output file.
4833 # Link the executable and exit
4834 $show "$link_command"
4835 $run eval "$link_command" || exit $?
4839 if test "$hardcode_action" = relink; then
4840 # Fast installation is not supported
4841 link_command="$compile_var$compile_command$compile_rpath"
4842 relink_command="$finalize_var$finalize_command$finalize_rpath"
4844 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4845 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4847 if test "$fast_install" != no; then
4848 link_command="$finalize_var$compile_command$finalize_rpath"
4849 if test "$fast_install" = yes; then
4850 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4852 # fast_install is set to needless
4856 link_command="$compile_var$compile_command$compile_rpath"
4857 relink_command="$finalize_var$finalize_command$finalize_rpath"
4861 # Replace the output file specification.
4862 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4864 # Delete the old output files.
4865 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4867 $show "$link_command"
4868 $run eval "$link_command" || exit $?
4870 # Now create the wrapper script.
4871 $show "creating $output"
4873 # Quote the relink command for shipping.
4874 if test -n "$relink_command"; then
4875 # Preserve any variables that may affect compiler behavior
4876 for var in $variables_saved_for_relink; do
4877 if eval test -z \"\${$var+set}\"; then
4878 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4879 elif eval var_value=\$$var; test -z "$var_value"; then
4880 relink_command="$var=; export $var; $relink_command"
4882 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4883 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4886 relink_command="(cd `pwd`; $relink_command)"
4887 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4890 # Quote $echo for shipping.
4891 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4893 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4894 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4896 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4898 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4901 # Only actually do things if our run command is non-null.
4902 if test -z "$run"; then
4903 # win32 will think the script is a binary if it has
4904 # a .exe suffix, so we strip it off here.
4906 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4908 # test for cygwin because mv fails w/o .exe extensions
4912 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4916 *cygwin* | *mingw* )
4917 output_name=`basename $output`
4918 output_path=`dirname $output`
4919 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4920 cwrapper="$output_path/$output_name.exe"
4921 $rm $cwrappersource $cwrapper
4922 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4924 cat > $cwrappersource <<EOF
4926 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4927 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4929 The $output program cannot be directly executed until all the libtool
4930 libraries that it depends on are installed.
4932 This wrapper executable should never be moved out of the build directory.
4933 If it is, it will not operate correctly.
4935 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4936 but could eventually absorb all of the scripts functionality and
4937 exec $objdir/$outputname directly.
4940 cat >> $cwrappersource<<"EOF"
4949 #include <sys/stat.h>
4951 #if defined(PATH_MAX)
4952 # define LT_PATHMAX PATH_MAX
4953 #elif defined(MAXPATHLEN)
4954 # define LT_PATHMAX MAXPATHLEN
4956 # define LT_PATHMAX 1024
4959 #ifndef DIR_SEPARATOR
4960 # define DIR_SEPARATOR '/'
4961 # define PATH_SEPARATOR ':'
4964 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4966 # define HAVE_DOS_BASED_FILE_SYSTEM
4967 # ifndef DIR_SEPARATOR_2
4968 # define DIR_SEPARATOR_2 '\\'
4970 # ifndef PATH_SEPARATOR_2
4971 # define PATH_SEPARATOR_2 ';'
4975 #ifndef DIR_SEPARATOR_2
4976 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4977 #else /* DIR_SEPARATOR_2 */
4978 # define IS_DIR_SEPARATOR(ch) \
4979 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4980 #endif /* DIR_SEPARATOR_2 */
4982 #ifndef PATH_SEPARATOR_2
4983 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4984 #else /* PATH_SEPARATOR_2 */
4985 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4986 #endif /* PATH_SEPARATOR_2 */
4988 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4989 #define XFREE(stale) do { \
4990 if (stale) { free ((void *) stale); stale = 0; } \
4993 /* -DDEBUG is fairly common in CFLAGS. */
4995 #if defined DEBUGWRAPPER
4996 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4998 # define DEBUG(format, ...)
5001 const char *program_name = NULL;
5003 void * xmalloc (size_t num);
5004 char * xstrdup (const char *string);
5005 const char * base_name (const char *name);
5006 char * find_executable(const char *wrapper);
5007 int check_executable(const char *path);
5008 char * strendzap(char *str, const char *pat);
5009 void lt_fatal (const char *message, ...);
5012 main (int argc, char *argv[])
5017 program_name = (char *) xstrdup (base_name (argv[0]));
5018 DEBUG("(main) argv[0] : %s\n",argv[0]);
5019 DEBUG("(main) program_name : %s\n",program_name);
5020 newargz = XMALLOC(char *, argc+2);
5023 cat >> $cwrappersource <<EOF
5024 newargz[0] = (char *) xstrdup("$SHELL");
5027 cat >> $cwrappersource <<"EOF"
5028 newargz[1] = find_executable(argv[0]);
5029 if (newargz[1] == NULL)
5030 lt_fatal("Couldn't find %s", argv[0]);
5031 DEBUG("(main) found exe at : %s\n",newargz[1]);
5032 /* we know the script has the same name, without the .exe */
5033 /* so make sure newargz[1] doesn't end in .exe */
5034 strendzap(newargz[1],".exe");
5035 for (i = 1; i < argc; i++)
5036 newargz[i+1] = xstrdup(argv[i]);
5037 newargz[argc+1] = NULL;
5039 for (i=0; i<argc+1; i++)
5041 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5049 cat >> $cwrappersource <<EOF
5050 execv("$SHELL",(char const **)newargz);
5054 cat >> $cwrappersource <<EOF
5055 execv("$SHELL",newargz);
5060 cat >> $cwrappersource <<"EOF"
5065 xmalloc (size_t num)
5067 void * p = (void *) malloc (num);
5069 lt_fatal ("Memory exhausted");
5075 xstrdup (const char *string)
5077 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5082 base_name (const char *name)
5086 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5087 /* Skip over the disk name in MSDOS pathnames. */
5088 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5092 for (base = name; *name; name++)
5093 if (IS_DIR_SEPARATOR (*name))
5099 check_executable(const char * path)
5103 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5104 if ((!path) || (!*path))
5107 if ((stat (path, &st) >= 0) &&
5109 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5110 #if defined (S_IXOTH)
5111 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5113 #if defined (S_IXGRP)
5114 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5116 ((st.st_mode & S_IXUSR) == S_IXUSR))
5123 /* Searches for the full path of the wrapper. Returns
5124 newly allocated full path name if found, NULL otherwise */
5126 find_executable (const char* wrapper)
5131 /* static buffer for getcwd */
5132 char tmp[LT_PATHMAX + 1];
5136 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5138 if ((wrapper == NULL) || (*wrapper == '\0'))
5141 /* Absolute path? */
5142 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5143 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5145 concat_name = xstrdup (wrapper);
5146 if (check_executable(concat_name))
5153 if (IS_DIR_SEPARATOR (wrapper[0]))
5155 concat_name = xstrdup (wrapper);
5156 if (check_executable(concat_name))
5160 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5164 for (p = wrapper; *p; p++)
5172 /* no slashes; search PATH */
5173 const char* path = getenv ("PATH");
5176 for (p = path; *p; p = p_next)
5180 for (q = p; *q; q++)
5181 if (IS_PATH_SEPARATOR(*q))
5184 p_next = (*q == '\0' ? q : q + 1);
5187 /* empty path: current directory */
5188 if (getcwd (tmp, LT_PATHMAX) == NULL)
5189 lt_fatal ("getcwd failed");
5190 tmp_len = strlen(tmp);
5191 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5192 memcpy (concat_name, tmp, tmp_len);
5193 concat_name[tmp_len] = '/';
5194 strcpy (concat_name + tmp_len + 1, wrapper);
5198 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5199 memcpy (concat_name, p, p_len);
5200 concat_name[p_len] = '/';
5201 strcpy (concat_name + p_len + 1, wrapper);
5203 if (check_executable(concat_name))
5208 /* not found in PATH; assume curdir */
5210 /* Relative path | not found in path: prepend cwd */
5211 if (getcwd (tmp, LT_PATHMAX) == NULL)
5212 lt_fatal ("getcwd failed");
5213 tmp_len = strlen(tmp);
5214 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5215 memcpy (concat_name, tmp, tmp_len);
5216 concat_name[tmp_len] = '/';
5217 strcpy (concat_name + tmp_len + 1, wrapper);
5219 if (check_executable(concat_name))
5226 strendzap(char *str, const char *pat)
5230 assert(str != NULL);
5231 assert(pat != NULL);
5234 patlen = strlen(pat);
5238 str += len - patlen;
5239 if (strcmp(str, pat) == 0)
5246 lt_error_core (int exit_status, const char * mode,
5247 const char * message, va_list ap)
5249 fprintf (stderr, "%s: %s: ", program_name, mode);
5250 vfprintf (stderr, message, ap);
5251 fprintf (stderr, ".\n");
5253 if (exit_status >= 0)
5258 lt_fatal (const char *message, ...)
5261 va_start (ap, message);
5262 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5266 # we should really use a build-platform specific compiler
5267 # here, but OTOH, the wrappers (shell script and this C one)
5268 # are only useful if you want to execute the "real" binary.
5269 # Since the "real" binary is built for $host, then this
5270 # wrapper might as well be built for $host, too.
5271 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5275 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5280 # $output - temporary wrapper script for $objdir/$outputname
5281 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5283 # The $output program cannot be directly executed until all the libtool
5284 # libraries that it depends on are installed.
5286 # This wrapper script should never be moved out of the build directory.
5287 # If it is, it will not operate correctly.
5289 # Sed substitution that helps us do robust quoting. It backslashifies
5290 # metacharacters that are still active within double-quoted strings.
5291 Xsed='${SED} -e 1s/^X//'
5292 sed_quote_subst='$sed_quote_subst'
5294 # The HP-UX ksh and POSIX shell print the target directory to stdout
5296 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5298 relink_command=\"$relink_command\"
5300 # This environment variable determines our operation mode.
5301 if test \"\$libtool_install_magic\" = \"$magic\"; then
5302 # install mode needs the following variable:
5303 notinst_deplibs='$notinst_deplibs'
5305 # When we are sourced in execute mode, \$file and \$echo are already set.
5306 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5309 # Make sure echo works.
5310 if test \"X\$1\" = X--no-reexec; then
5311 # Discard the --no-reexec flag, and continue.
5313 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5314 # Yippee, \$echo works!
5317 # Restart under the correct shell, and then maybe \$echo will work.
5318 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5324 # Find the directory that this script lives in.
5325 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5326 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5328 # Follow symbolic links until we get to the real thisdir.
5329 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5330 while test -n \"\$file\"; do
5331 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5333 # If there was a directory component, then change thisdir.
5334 if test \"x\$destdir\" != \"x\$file\"; then
5335 case \"\$destdir\" in
5336 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5337 *) thisdir=\"\$thisdir/\$destdir\" ;;
5341 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5342 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5345 # Try to get the absolute directory name.
5346 absdir=\`cd \"\$thisdir\" && pwd\`
5347 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5350 if test "$fast_install" = yes; then
5352 program=lt-'$outputname'$exeext
5353 progdir=\"\$thisdir/$objdir\"
5355 if test ! -f \"\$progdir/\$program\" || \\
5356 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5357 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5359 file=\"\$\$-\$program\"
5361 if test ! -d \"\$progdir\"; then
5362 $mkdir \"\$progdir\"
5364 $rm \"\$progdir/\$file\"
5369 # relink executable if necessary
5370 if test -n \"\$relink_command\"; then
5371 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5373 $echo \"\$relink_command_output\" >&2
5374 $rm \"\$progdir/\$file\"
5379 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5380 { $rm \"\$progdir/\$program\";
5381 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5382 $rm \"\$progdir/\$file\"
5386 program='$outputname'
5387 progdir=\"\$thisdir/$objdir\"
5393 if test -f \"\$progdir/\$program\"; then"
5395 # Export our shlibpath_var if we have one.
5396 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5398 # Add our own library path to $shlibpath_var
5399 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5401 # Some systems cannot cope with colon-terminated $shlibpath_var
5402 # The second colon is a workaround for a bug in BeOS R4 sed
5403 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5405 export $shlibpath_var
5409 # fixup the dll searchpath if we need to.
5410 if test -n "$dllsearchpath"; then
5412 # Add the dll search path components to the executable PATH
5413 PATH=$dllsearchpath:\$PATH
5418 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5419 # Run the actual program with our arguments.
5422 # Backslashes separate directories on plain windows
5423 *-*-mingw | *-*-os2*)
5425 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5431 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5436 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5440 # The program doesn't exist.
5441 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5442 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5443 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5454 # See if we need to build an old-fashioned archive.
5455 for oldlib in $oldlibs; do
5457 if test "$build_libtool_libs" = convenience; then
5458 oldobjs="$libobjs_save"
5459 addlibs="$convenience"
5460 build_libtool_libs=no
5462 if test "$build_libtool_libs" = module; then
5463 oldobjs="$libobjs_save"
5464 build_libtool_libs=no
5466 oldobjs="$old_deplibs $non_pic_objects"
5468 addlibs="$old_convenience"
5471 if test -n "$addlibs"; then
5472 gentop="$output_objdir/${outputname}x"
5473 generated="$generated $gentop"
5475 func_extract_archives $gentop $addlibs
5476 oldobjs="$oldobjs $func_extract_archives_result"
5479 # Do each command in the archive commands.
5480 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5481 cmds=$old_archive_from_new_cmds
5483 # POSIX demands no paths to be encoded in archives. We have
5484 # to avoid creating archives with duplicate basenames if we
5485 # might have to extract them afterwards, e.g., when creating a
5486 # static archive out of a convenience library, or when linking
5487 # the entirety of a libtool archive into another (currently
5488 # not supported by libtool).
5489 if (for obj in $oldobjs
5491 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5492 done | sort | sort -uc >/dev/null 2>&1); then
5495 $echo "copying selected object files to avoid basename conflicts..."
5497 if test -z "$gentop"; then
5498 gentop="$output_objdir/${outputname}x"
5499 generated="$generated $gentop"
5501 $show "${rm}r $gentop"
5502 $run ${rm}r "$gentop"
5503 $show "$mkdir $gentop"
5504 $run $mkdir "$gentop"
5506 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5511 save_oldobjs=$oldobjs
5514 for obj in $save_oldobjs
5516 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5517 case " $oldobjs " in
5518 " ") oldobjs=$obj ;;
5521 # Make sure we don't pick an alternate name that also
5523 newobj=lt$counter-$objbase
5524 counter=`expr $counter + 1`
5525 case " $oldobjs " in
5526 *[\ /]"$newobj "*) ;;
5527 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5530 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5531 $run ln "$obj" "$gentop/$newobj" ||
5532 $run cp "$obj" "$gentop/$newobj"
5533 oldobjs="$oldobjs $gentop/$newobj"
5535 *) oldobjs="$oldobjs $obj" ;;
5540 eval cmds=\"$old_archive_cmds\"
5542 if len=`expr "X$cmds" : ".*"` &&
5543 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5544 cmds=$old_archive_cmds
5546 # the command line is too long to link in one step, link in parts
5547 $echo "using piecewise archive linking..."
5552 save_oldobjs=$oldobjs
5554 # Is there a better way of finding the last object in the list?
5555 for obj in $save_oldobjs
5559 for obj in $save_oldobjs
5561 oldobjs="$objlist $obj"
5562 objlist="$objlist $obj"
5563 eval test_cmds=\"$old_archive_cmds\"
5564 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5565 test "$len" -le "$max_cmd_len"; then
5568 # the above command should be used before it gets too long
5570 if test "$obj" = "$last_oldobj" ; then
5573 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5574 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5580 if test "X$oldobjs" = "X" ; then
5581 eval cmds=\"\$concat_cmds\"
5583 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5587 save_ifs="$IFS"; IFS='~'
5588 for cmd in $cmds; do
5592 $run eval "$cmd" || exit $?
5597 if test -n "$generated"; then
5598 $show "${rm}r$generated"
5599 $run ${rm}r$generated
5602 # Now create the libtool archive.
5606 test "$build_old_libs" = yes && old_library="$libname.$libext"
5607 $show "creating $output"
5609 # Preserve any variables that may affect compiler behavior
5610 for var in $variables_saved_for_relink; do
5611 if eval test -z \"\${$var+set}\"; then
5612 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5613 elif eval var_value=\$$var; test -z "$var_value"; then
5614 relink_command="$var=; export $var; $relink_command"
5616 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5617 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5620 # Quote the link command for shipping.
5621 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5622 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5623 if test "$hardcode_automatic" = yes ; then
5628 # Only create the output if not a dry run.
5629 if test -z "$run"; then
5630 for installed in no yes; do
5631 if test "$installed" = yes; then
5632 if test -z "$install_libdir"; then
5635 output="$output_objdir/$outputname"i
5636 # Replace all uninstalled libtool libraries with the installed ones
5638 for deplib in $dependency_libs; do
5641 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5642 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5643 if test -z "$libdir"; then
5644 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5647 newdependency_libs="$newdependency_libs $libdir/$name"
5649 *) newdependency_libs="$newdependency_libs $deplib" ;;
5652 dependency_libs="$newdependency_libs"
5654 for lib in $dlfiles; do
5655 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5656 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5657 if test -z "$libdir"; then
5658 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5661 newdlfiles="$newdlfiles $libdir/$name"
5663 dlfiles="$newdlfiles"
5665 for lib in $dlprefiles; do
5666 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5667 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5668 if test -z "$libdir"; then
5669 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5672 newdlprefiles="$newdlprefiles $libdir/$name"
5674 dlprefiles="$newdlprefiles"
5677 for lib in $dlfiles; do
5679 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5680 *) abs=`pwd`"/$lib" ;;
5682 newdlfiles="$newdlfiles $abs"
5684 dlfiles="$newdlfiles"
5686 for lib in $dlprefiles; do
5688 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5689 *) abs=`pwd`"/$lib" ;;
5691 newdlprefiles="$newdlprefiles $abs"
5693 dlprefiles="$newdlprefiles"
5696 # place dlname in correct position for cygwin
5698 case $host,$output,$installed,$module,$dlname in
5699 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5702 # $outputname - a libtool library file
5703 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5705 # Please DO NOT delete this file!
5706 # It is necessary for linking the library.
5708 # The name that we can dlopen(3).
5711 # Names of this library.
5712 library_names='$library_names'
5714 # The name of the static archive.
5715 old_library='$old_library'
5717 # Libraries that this one depends upon.
5718 dependency_libs='$dependency_libs'
5720 # Version information for $libname.
5725 # Is this an already installed library?
5726 installed=$installed
5728 # Should we warn about portability when linking against -modules?
5729 shouldnotlink=$module
5731 # Files to dlopen/dlpreopen
5733 dlpreopen='$dlprefiles'
5735 # Directory that this library needs to be installed in:
5736 libdir='$install_libdir'"
5737 if test "$installed" = no && test "$need_relink" = yes; then
5739 relink_command=\"$relink_command\""
5744 # Do a symbolic link so that the libtool archive can be found in
5745 # LD_LIBRARY_PATH before the program is installed.
5746 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5747 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5753 # libtool install mode
5755 modename="$modename: install"
5757 # There may be an optional sh(1) argument at the beginning of
5758 # install_prog (especially on Windows NT).
5759 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5760 # Allow the use of GNU shtool's install command.
5761 $echo "X$nonopt" | grep shtool > /dev/null; then
5762 # Aesthetically quote it.
5763 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5765 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5769 install_prog="$arg "
5777 # The real first argument should be the name of the installation program.
5778 # Aesthetically quote it.
5779 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5781 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5785 install_prog="$install_prog$arg"
5787 # We need to accept at least all the BSD install flags.
5797 if test -n "$dest"; then
5798 files="$files $dest"
5806 case " $install_prog " in
5811 -g | -m | -o) prev=$arg ;;
5819 # If the previous option needed an argument, then skip it.
5820 if test -n "$prev"; then
5829 # Aesthetically quote the argument.
5830 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5832 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5836 install_prog="$install_prog $arg"
5839 if test -z "$install_prog"; then
5840 $echo "$modename: you must specify an install program" 1>&2
5845 if test -n "$prev"; then
5846 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5851 if test -z "$files"; then
5852 if test -z "$dest"; then
5853 $echo "$modename: no file or destination specified" 1>&2
5855 $echo "$modename: you must specify a destination" 1>&2
5861 # Strip any trailing slash from the destination.
5862 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5864 # Check to see that the destination is a directory.
5865 test -d "$dest" && isdir=yes
5866 if test "$isdir" = yes; then
5870 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5871 test "X$destdir" = "X$dest" && destdir=.
5872 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5874 # Not a directory, so check to see that there is only one file specified.
5876 if test "$#" -gt 2; then
5877 $echo "$modename: \`$dest' is not a directory" 1>&2
5883 [\\/]* | [A-Za-z]:[\\/]*) ;;
5885 for file in $files; do
5889 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5898 # This variable tells wrapper scripts just to set variables rather
5899 # than running their programs.
5900 libtool_install_magic="$magic"
5905 for file in $files; do
5907 # Do each installation.
5910 # Do the static libraries later.
5911 staticlibs="$staticlibs $file"
5915 # Check to see that this really is a libtool archive.
5916 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5918 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5926 # If there is no directory component, then add one.
5928 */* | *\\*) . $file ;;
5932 # Add the libdir to current_libdirs if it is the destination.
5933 if test "X$destdir" = "X$libdir"; then
5934 case "$current_libdirs " in
5936 *) current_libdirs="$current_libdirs $libdir" ;;
5939 # Note the libdir as a future libdir.
5940 case "$future_libdirs " in
5942 *) future_libdirs="$future_libdirs $libdir" ;;
5946 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5947 test "X$dir" = "X$file/" && dir=
5950 if test -n "$relink_command"; then
5951 # Determine the prefix the user has applied to our future dir.
5952 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5954 # Don't allow the user to place us outside of our expected
5955 # location b/c this prevents finding dependent libraries that
5956 # are installed to the same prefix.
5957 # At present, this check doesn't affect windows .dll's that
5958 # are installed into $libdir/../bin (currently, that works fine)
5959 # but it's something to keep an eye on.
5960 if test "$inst_prefix_dir" = "$destdir"; then
5961 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5965 if test -n "$inst_prefix_dir"; then
5966 # Stick the inst_prefix_dir data into the link command.
5967 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5969 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5972 $echo "$modename: warning: relinking \`$file'" 1>&2
5973 $show "$relink_command"
5974 if $run eval "$relink_command"; then :
5976 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5981 # See the names of the shared library.
5982 set dummy $library_names
5983 if test -n "$2"; then
5989 test -n "$relink_command" && srcname="$realname"T
5991 # Install the shared library and build the symlinks.
5992 $show "$install_prog $dir/$srcname $destdir/$realname"
5993 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5994 if test -n "$stripme" && test -n "$striplib"; then
5995 $show "$striplib $destdir/$realname"
5996 $run eval "$striplib $destdir/$realname" || exit $?
5999 if test "$#" -gt 0; then
6000 # Delete the old symlinks, and create new ones.
6001 # Try `ln -sf' first, because the `ln' binary might depend on
6002 # the symlink we replace! Solaris /bin/ln does not understand -f,
6003 # so we also need to try rm && ln -s.
6006 if test "$linkname" != "$realname"; then
6007 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6008 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6013 # Do each command in the postinstall commands.
6014 lib="$destdir/$realname"
6015 cmds=$postinstall_cmds
6016 save_ifs="$IFS"; IFS='~'
6017 for cmd in $cmds; do
6021 $run eval "$cmd" || {
6024 # Restore the uninstalled library and exit
6025 if test "$mode" = relink; then
6026 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6035 # Install the pseudo-library for information purposes.
6038 # Do not install the useless pseudo-library
6041 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6042 instname="$dir/$name"i
6043 $show "$install_prog $instname $destdir/$name"
6044 $run eval "$install_prog $instname $destdir/$name" || exit $?
6048 # Maybe install the static library, too.
6049 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6053 # Install (i.e. copy) a libtool object.
6055 # Figure out destination file name, if it wasn't already specified.
6056 if test -n "$destname"; then
6057 destfile="$destdir/$destname"
6059 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6060 destfile="$destdir/$destfile"
6063 # Deduce the name of the destination old-style object file.
6066 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6069 staticdest="$destfile"
6073 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6079 # Install the libtool object if requested.
6080 if test -n "$destfile"; then
6081 $show "$install_prog $file $destfile"
6082 $run eval "$install_prog $file $destfile" || exit $?
6085 # Install the old object if enabled.
6086 if test "$build_old_libs" = yes; then
6087 # Deduce the name of the old-style object file.
6088 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6090 $show "$install_prog $staticobj $staticdest"
6091 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6097 # Figure out destination file name, if it wasn't already specified.
6098 if test -n "$destname"; then
6099 destfile="$destdir/$destname"
6101 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6102 destfile="$destdir/$destfile"
6105 # If the file is missing, and there is a .exe on the end, strip it
6106 # because it is most likely a libtool script we actually want to
6111 if test ! -f "$file"; then
6112 file=`$echo $file|${SED} 's,.exe$,,'`
6118 # Do a test to see if this is really a libtool program.
6121 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6127 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6131 # Note that it is not necessary on cygwin/mingw to append a dot to
6132 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6133 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6134 # `FILE.' does not work on cygwin managed mounts.
6136 # If there is no directory component, then add one.
6138 */* | *\\*) . ${wrapper} ;;
6139 *) . ./${wrapper} ;;
6142 # Check the variables that should have been set.
6143 if test -z "$notinst_deplibs"; then
6144 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6149 for lib in $notinst_deplibs; do
6150 # Check to see that each library is installed.
6152 if test -f "$lib"; then
6153 # If there is no directory component, then add one.
6155 */* | *\\*) . $lib ;;
6159 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6160 if test -n "$libdir" && test ! -f "$libfile"; then
6161 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6167 # Note that it is not necessary on cygwin/mingw to append a dot to
6168 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6169 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6170 # `FILE.' does not work on cygwin managed mounts.
6172 # If there is no directory component, then add one.
6174 */* | *\\*) . ${wrapper} ;;
6175 *) . ./${wrapper} ;;
6179 if test "$fast_install" = no && test -n "$relink_command"; then
6180 if test "$finalize" = yes && test -z "$run"; then
6181 tmpdir=`func_mktempdir`
6182 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6183 outputname="$tmpdir/$file"
6184 # Replace the output file specification.
6185 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6187 $show "$relink_command"
6188 if $run eval "$relink_command"; then :
6190 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6196 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6199 # Install the binary that we compiled earlier.
6200 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6204 # remove .exe since cygwin /usr/bin/install will append another
6206 case $install_prog,$host in
6207 */usr/bin/install*,*cygwin*)
6208 case $file:$destfile in
6213 destfile=$destfile.exe
6216 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6221 $show "$install_prog$stripme $file $destfile"
6222 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6223 test -n "$outputname" && ${rm}r "$tmpdir"
6228 for file in $staticlibs; do
6229 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6231 # Set up the ranlib parameters.
6232 oldlib="$destdir/$name"
6234 $show "$install_prog $file $oldlib"
6235 $run eval "$install_prog \$file \$oldlib" || exit $?
6237 if test -n "$stripme" && test -n "$old_striplib"; then
6238 $show "$old_striplib $oldlib"
6239 $run eval "$old_striplib $oldlib" || exit $?
6242 # Do each command in the postinstall commands.
6243 cmds=$old_postinstall_cmds
6244 save_ifs="$IFS"; IFS='~'
6245 for cmd in $cmds; do
6249 $run eval "$cmd" || exit $?
6254 if test -n "$future_libdirs"; then
6255 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6258 if test -n "$current_libdirs"; then
6259 # Maybe just do a dry run.
6260 test -n "$run" && current_libdirs=" -n$current_libdirs"
6261 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6267 # libtool finish mode
6269 modename="$modename: finish"
6273 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6276 libdirs="$libdirs $dir"
6279 for libdir in $libdirs; do
6280 if test -n "$finish_cmds"; then
6281 # Do each command in the finish commands.
6283 save_ifs="$IFS"; IFS='~'
6284 for cmd in $cmds; do
6288 $run eval "$cmd" || admincmds="$admincmds
6293 if test -n "$finish_eval"; then
6294 # Do the single finish_eval.
6295 eval cmds=\"$finish_eval\"
6296 $run eval "$cmds" || admincmds="$admincmds
6302 # Exit here if they wanted silent mode.
6303 test "$show" = : && exit $EXIT_SUCCESS
6305 $echo "X----------------------------------------------------------------------" | $Xsed
6306 $echo "Libraries have been installed in:"
6307 for libdir in $libdirs; do
6311 $echo "If you ever happen to want to link against installed libraries"
6312 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6313 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6314 $echo "flag during linking and do at least one of the following:"
6315 if test -n "$shlibpath_var"; then
6316 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6317 $echo " during execution"
6319 if test -n "$runpath_var"; then
6320 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6321 $echo " during linking"
6323 if test -n "$hardcode_libdir_flag_spec"; then
6325 eval flag=\"$hardcode_libdir_flag_spec\"
6327 $echo " - use the \`$flag' linker flag"
6329 if test -n "$admincmds"; then
6330 $echo " - have your system administrator run these commands:$admincmds"
6332 if test -f /etc/ld.so.conf; then
6333 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6336 $echo "See any operating system documentation about shared libraries for"
6337 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6338 $echo "X----------------------------------------------------------------------" | $Xsed
6342 # libtool execute mode
6344 modename="$modename: execute"
6346 # The first argument is the command name.
6348 if test -z "$cmd"; then
6349 $echo "$modename: you must specify a COMMAND" 1>&2
6354 # Handle -dlopen flags immediately.
6355 for file in $execute_dlfiles; do
6356 if test ! -f "$file"; then
6357 $echo "$modename: \`$file' is not a file" 1>&2
6365 # Check to see that this really is a libtool archive.
6366 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6368 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6373 # Read the libtool library.
6377 # If there is no directory component, then add one.
6379 */* | *\\*) . $file ;;
6383 # Skip this library if it cannot be dlopened.
6384 if test -z "$dlname"; then
6385 # Warn if it was a shared library.
6386 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6390 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6391 test "X$dir" = "X$file" && dir=.
6393 if test -f "$dir/$objdir/$dlname"; then
6396 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6402 # Just add the directory containing the .lo file.
6403 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6404 test "X$dir" = "X$file" && dir=.
6408 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6413 # Get the absolute pathname.
6414 absdir=`cd "$dir" && pwd`
6415 test -n "$absdir" && dir="$absdir"
6417 # Now add the directory to shlibpath_var.
6418 if eval "test -z \"\$$shlibpath_var\""; then
6419 eval "$shlibpath_var=\"\$dir\""
6421 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6425 # This variable tells wrapper scripts just to set shlibpath_var
6426 # rather than running their programs.
6427 libtool_execute_magic="$magic"
6429 # Check if any of the arguments is a wrapper script.
6436 # Do a test to see if this is really a libtool program.
6437 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6438 # If there is no directory component, then add one.
6440 */* | *\\*) . $file ;;
6444 # Transform arg to wrapped name.
6445 file="$progdir/$program"
6449 # Quote arguments (to preserve shell metacharacters).
6450 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6451 args="$args \"$file\""
6454 if test -z "$run"; then
6455 if test -n "$shlibpath_var"; then
6456 # Export the shlibpath_var.
6457 eval "export $shlibpath_var"
6460 # Restore saved environment variables
6461 if test "${save_LC_ALL+set}" = set; then
6462 LC_ALL="$save_LC_ALL"; export LC_ALL
6464 if test "${save_LANG+set}" = set; then
6465 LANG="$save_LANG"; export LANG
6468 # Now prepare to actually exec the command.
6469 exec_cmd="\$cmd$args"
6471 # Display what would be done.
6472 if test -n "$shlibpath_var"; then
6473 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6474 $echo "export $shlibpath_var"
6481 # libtool clean and uninstall mode
6483 modename="$modename: $mode"
6489 # This variable tells wrapper scripts just to set variables rather
6490 # than running their programs.
6491 libtool_install_magic="$magic"
6496 -f) rm="$rm $arg"; rmforce=yes ;;
6497 -*) rm="$rm $arg" ;;
6498 *) files="$files $arg" ;;
6502 if test -z "$rm"; then
6503 $echo "$modename: you must specify an RM program" 1>&2
6510 origobjdir="$objdir"
6511 for file in $files; do
6512 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6513 if test "X$dir" = "X$file"; then
6515 objdir="$origobjdir"
6517 objdir="$dir/$origobjdir"
6519 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6520 test "$mode" = uninstall && objdir="$dir"
6522 # Remember objdir for removal later, being careful to avoid duplicates
6523 if test "$mode" = clean; then
6526 *) rmdirs="$rmdirs $objdir" ;;
6530 # Don't error if the file doesn't exist and rm -f was used.
6531 if (test -L "$file") >/dev/null 2>&1 \
6532 || (test -h "$file") >/dev/null 2>&1 \
6533 || test -f "$file"; then
6535 elif test -d "$file"; then
6538 elif test "$rmforce" = yes; then
6546 # Possibly a libtool archive, so verify it.
6547 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6550 # Delete the libtool libraries and symlinks.
6551 for n in $library_names; do
6552 rmfiles="$rmfiles $objdir/$n"
6554 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6558 case " $library_names " in
6559 # " " in the beginning catches empty $dlname
6561 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6563 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6566 if test -n "$library_names"; then
6567 # Do each command in the postuninstall commands.
6568 cmds=$postuninstall_cmds
6569 save_ifs="$IFS"; IFS='~'
6570 for cmd in $cmds; do
6575 if test "$?" -ne 0 && test "$rmforce" != yes; then
6582 if test -n "$old_library"; then
6583 # Do each command in the old_postuninstall commands.
6584 cmds=$old_postuninstall_cmds
6585 save_ifs="$IFS"; IFS='~'
6586 for cmd in $cmds; do
6591 if test "$?" -ne 0 && test "$rmforce" != yes; then
6597 # FIXME: should reinstall the best remaining shared library.
6604 # Possibly a libtool object, so verify it.
6605 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6610 # Add PIC object to the list of files to remove.
6611 if test -n "$pic_object" \
6612 && test "$pic_object" != none; then
6613 rmfiles="$rmfiles $dir/$pic_object"
6616 # Add non-PIC object to the list of files to remove.
6617 if test -n "$non_pic_object" \
6618 && test "$non_pic_object" != none; then
6619 rmfiles="$rmfiles $dir/$non_pic_object"
6625 if test "$mode" = clean ; then
6629 file=`$echo $file|${SED} 's,.exe$,,'`
6630 noexename=`$echo $name|${SED} 's,.exe$,,'`
6631 # $file with .exe has already been added to rmfiles,
6632 # add $file without .exe
6633 rmfiles="$rmfiles $file"
6636 # Do a test to see if this is a libtool program.
6637 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6641 # note $name still contains .exe if it was in $file originally
6642 # as does the version of $file that was added into $rmfiles
6643 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6644 if test "$fast_install" = yes && test -n "$relink_command"; then
6645 rmfiles="$rmfiles $objdir/lt-$name"
6647 if test "X$noexename" != "X$name" ; then
6648 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6654 $show "$rm $rmfiles"
6655 $run $rm $rmfiles || exit_status=1
6657 objdir="$origobjdir"
6659 # Try to remove the ${objdir}s in the directories where we deleted files
6660 for dir in $rmdirs; do
6661 if test -d "$dir"; then
6663 $run rmdir $dir >/dev/null 2>&1
6671 $echo "$modename: you must specify a MODE" 1>&2
6672 $echo "$generic_help" 1>&2
6677 if test -z "$exec_cmd"; then
6678 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6679 $echo "$generic_help" 1>&2
6682 fi # test -z "$show_help"
6684 if test -n "$exec_cmd"; then
6689 # We need to display help for each of the modes.
6692 "Usage: $modename [OPTION]... [MODE-ARG]...
6694 Provide generalized library-building support services.
6696 --config show all configuration variables
6697 --debug enable verbose shell tracing
6698 -n, --dry-run display commands without modifying any files
6699 --features display basic configuration information and exit
6700 --finish same as \`--mode=finish'
6701 --help display this help message and exit
6702 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6703 --quiet same as \`--silent'
6704 --silent don't print informational messages
6705 --tag=TAG use configuration variables from tag TAG
6706 --version print version information
6708 MODE must be one of the following:
6710 clean remove files from the build directory
6711 compile compile a source file into a libtool object
6712 execute automatically set library path, then run a program
6713 finish complete the installation of libtool libraries
6714 install install libraries or executables
6715 link create a library or an executable
6716 uninstall remove libraries from an installed directory
6718 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6719 a more detailed description of MODE.
6721 Report bugs to <bug-libtool@gnu.org>."
6727 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6729 Remove files from the build directory.
6731 RM is the name of the program to use to delete files associated with each FILE
6732 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6735 If FILE is a libtool library, object or program, all the files associated
6736 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6741 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6743 Compile a source file into a libtool library object.
6745 This mode accepts the following additional options:
6747 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6748 -prefer-pic try to building PIC objects only
6749 -prefer-non-pic try to building non-PIC objects only
6750 -static always build a \`.o' file suitable for static linking
6752 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6753 from the given SOURCEFILE.
6755 The output file name is determined by removing the directory component from
6756 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6757 library object suffix, \`.lo'."
6762 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6764 Automatically set library path, then run a program.
6766 This mode accepts the following additional options:
6768 -dlopen FILE add the directory containing FILE to the library path
6770 This mode sets the library path environment variable according to \`-dlopen'
6773 If any of the ARGS are libtool executable wrappers, then they are translated
6774 into their corresponding uninstalled binary, and any of their required library
6775 directories are added to the library path.
6777 Then, COMMAND is executed, with ARGS as arguments."
6782 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6784 Complete the installation of libtool libraries.
6786 Each LIBDIR is a directory that contains libtool libraries.
6788 The commands that this mode executes may require superuser privileges. Use
6789 the \`--dry-run' option if you just want to see what would be executed."
6794 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6796 Install executables or libraries.
6798 INSTALL-COMMAND is the installation command. The first component should be
6799 either the \`install' or \`cp' program.
6801 The rest of the components are interpreted as arguments to that command (only
6802 BSD-compatible install options are recognized)."
6807 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6809 Link object files or libraries together to form another library, or to
6810 create an executable program.
6812 LINK-COMMAND is a command using the C compiler that you would use to create
6813 a program from several object files.
6815 The following components of LINK-COMMAND are treated specially:
6817 -all-static do not do any dynamic linking at all
6818 -avoid-version do not add a version suffix if possible
6819 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6820 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6821 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6822 -export-symbols SYMFILE
6823 try to export only the symbols listed in SYMFILE
6824 -export-symbols-regex REGEX
6825 try to export only the symbols matching REGEX
6826 -LLIBDIR search LIBDIR for required installed libraries
6827 -lNAME OUTPUT-FILE requires the installed library libNAME
6828 -module build a library that can dlopened
6829 -no-fast-install disable the fast-install mode
6830 -no-install link a not-installable executable
6831 -no-undefined declare that a library does not refer to external symbols
6832 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6833 -objectlist FILE Use a list of object files found in FILE to specify objects
6834 -precious-files-regex REGEX
6835 don't remove output files matching REGEX
6836 -release RELEASE specify package release information
6837 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6838 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6839 -static do not do any dynamic linking of libtool libraries
6840 -version-info CURRENT[:REVISION[:AGE]]
6841 specify library version info [each variable defaults to 0]
6843 All other options (arguments beginning with \`-') are ignored.
6845 Every other argument is treated as a filename. Files ending in \`.la' are
6846 treated as uninstalled libtool libraries, other files are standard or library
6849 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6850 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6851 required, except when creating a convenience library.
6853 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6854 using \`ar' and \`ranlib', or on Windows using \`lib'.
6856 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6857 is created, otherwise an executable program is created."
6862 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6864 Remove libraries from an installation directory.
6866 RM is the name of the program to use to delete files associated with each FILE
6867 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6870 If FILE is a libtool library, all the files associated with it are deleted.
6871 Otherwise, only FILE itself is deleted using RM."
6875 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6882 $echo "Try \`$modename --help' for more information about other modes."
6886 # The TAGs below are defined such that we never get into a situation
6887 # in which we disable both kinds of libraries. Given conflicting
6888 # choices, we go for a static library, that is the most portable,
6889 # since we can't tell whether shared libraries were disabled because
6890 # the user asked for that or because the platform doesn't support
6891 # them. This is particularly important on AIX, because we don't
6892 # support having both static and shared libraries enabled at the same
6893 # time on that platform, so we default to a shared-only configuration.
6894 # If a disable-shared tag is given, we'll fallback to a static-only
6895 # configuration. But we'll never go from static-only to shared-only.
6897 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6899 # ### END LIBTOOL TAG CONFIG: disable-shared
6901 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6903 # ### END LIBTOOL TAG CONFIG: disable-static