1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname
=`echo "$progpath" | $SED $basename`
47 TIMESTAMP
=" (1.1220.2.456 2007/06/24 02:25:32)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh
) >/dev
/null
2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix
*) set -o posix
;; esac
60 BIN_SH
=xpg4
; export BIN_SH
# for Tru64
61 DUALCASE
=1; export DUALCASE
# for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec
; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo
; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo
; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic
="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed
="${SED}"' -e 1s/^X//'
97 sed_quote_subst
='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A
) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP
='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP
='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
116 for lt_var
in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
125 # Make sure IFS has a sensible default
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147 lo2o
="s/\\.lo\$/.${objext}/"
148 o2lo
="s/\\.${objext}\$/.lo/"
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
162 my_template
="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir
="${my_template}-$$"
169 # If mktemp works, use that first and foremost
170 my_tmpdir
=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir
="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask
=`umask`
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" ||
{
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189 $echo "X$my_tmpdir" |
$Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
201 win32_libid_type
="unknown"
202 win32_fileres
=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library
*) # definitely import
205 win32_libid_type
="x86 archive import"
207 *ar\ archive
*) # could be an import, or static
208 if eval $OBJDUMP -f $1 |
$SED -e '10q' 2>/dev
/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev
/null
; then
210 win32_nmres
=`eval $NM -f posix -A $1 | \
219 import
*) win32_libid_type
="x86 archive import";;
220 *) win32_libid_type
="x86 archive static";;
225 win32_libid_type
="x86 DLL"
227 *executable
*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel
*)
230 win32_libid_type
="x86 DLL"
235 $echo $win32_libid_type
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
247 if test -n "$available_tags" && test -z "$tagname"; then
251 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 CC_quoted
="$CC_quoted $arg"
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z
in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev
/null
; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
270 # Double-quote args containing other shell metacharacters.
272 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
276 CC_quoted
="$CC_quoted $arg"
279 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*)
280 # The compiler in the base compile command matches
281 # the one in the tagged configuration.
282 # Assume this is the tagged configuration we want.
289 # If $tagname still isn't set, then no tagged configuration
290 # was found and let the user know that the "--tag" command
291 # line option must be used.
292 if test -z "$tagname"; then
293 $echo "$modename: unable to infer tagged configuration"
294 $echo "$modename: specify a tag with \`--tag'" 1>&2
297 # $echo "$modename: using $tagname tagged configuration"
305 # func_extract_an_archive dir oldlib
306 func_extract_an_archive
()
308 f_ex_an_ar_dir
="$1"; shift
309 f_ex_an_ar_oldlib
="$1"
311 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
312 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" ||
exit $?
313 if ($AR t
"$f_ex_an_ar_oldlib" |
sort |
sort -uc >/dev
/null
2>&1); then
316 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
321 # func_extract_archives gentop oldlib ...
322 func_extract_archives
()
324 my_gentop
="$1"; shift
332 $show "${rm}r $my_gentop"
333 $run ${rm}r
"$my_gentop"
334 $show "$mkdir $my_gentop"
335 $run $mkdir "$my_gentop"
337 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
341 for my_xlib
in $my_oldlibs; do
342 # Extract the objects.
344 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
="$my_xlib" ;;
345 *) my_xabs
=`pwd`"/$my_xlib" ;;
347 my_xlib
=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
350 case " $extracted_archives " in
352 extracted_serial
=`expr $extracted_serial + 1`
353 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
357 extracted_archives
="$extracted_archives $my_xlib_u"
358 my_xdir
="$my_gentop/$my_xlib_u"
360 $show "${rm}r $my_xdir"
361 $run ${rm}r
"$my_xdir"
362 $show "$mkdir $my_xdir"
363 $run $mkdir "$my_xdir"
365 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
370 $show "Extracting $my_xabs"
371 # Do not bother doing anything if just a dry run
372 if test -z "$run"; then
373 darwin_orig_dir
=`pwd`
374 cd $my_xdir ||
exit $?
375 darwin_archive
=$my_xabs
377 darwin_base_archive
=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
378 darwin_arches
=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
379 if test -n "$darwin_arches"; then
380 darwin_arches
=`echo "$darwin_arches" | $SED -e 's/.*are://'`
382 $show "$darwin_base_archive has multiple architectures $darwin_arches"
383 for darwin_arch
in $darwin_arches ; do
384 mkdir
-p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
385 lipo
-thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
386 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
387 func_extract_an_archive
"`pwd`" "${darwin_base_archive}"
389 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
390 done # $darwin_arches
391 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
392 darwin_filelist
=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
395 for darwin_file
in $darwin_filelist; do
396 darwin_files
=`find unfat-$$ -name $darwin_file -print | $NL2SP`
397 lipo
-create -output "$darwin_file" $darwin_files
398 done # $darwin_filelist
400 cd "$darwin_orig_dir"
402 cd "$darwin_orig_dir"
403 func_extract_an_archive
"$my_xdir" "$my_xabs"
408 func_extract_an_archive
"$my_xdir" "$my_xabs"
411 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
413 func_extract_archives_result
="$my_oldobjs"
415 # End of Shell function definitions
416 #####################################
419 eval std_shrext
=\"$shrext_cmds\"
423 # Parse our command line options once, thoroughly.
424 while test "$#" -gt 0
430 -*=*) optarg
=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
434 # If the previous option needs an argument, assign it.
435 if test -n "$prev"; then
438 execute_dlfiles
="$execute_dlfiles $arg"
442 preserve_args
="${preserve_args}=$arg"
444 # Check whether tagname contains only valid characters
447 $echo "$progname: invalid tag name: $tagname" 1>&2
454 # Don't test for the "default" C tag, as we know, it's there, but
455 # not specially marked.
458 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev
/null
; then
459 taglist
="$taglist $tagname"
460 # Evaluate the configuration.
461 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
463 $echo "$progname: ignoring unknown tag $tagname" 1>&2
478 # Have we seen a non-optional argument yet?
486 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
488 Copyright (C) 2007 Free Software Foundation, Inc.
489 This is free software; see the source for copying conditions. There is NO
490 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
495 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
496 # Now print the configurations for the tags.
497 for tagname
in $taglist; do
498 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
504 $echo "$progname: enabling shell trace mode"
506 preserve_args
="$preserve_args $arg"
515 if test "$build_libtool_libs" = yes; then
516 $echo "enable shared libraries"
518 $echo "disable shared libraries"
520 if test "$build_old_libs" = yes; then
521 $echo "enable static libraries"
523 $echo "disable static libraries"
528 --finish) mode
="finish" ;;
530 --mode) prevopt
="--mode" prev
=mode
;;
531 --mode=*) mode
="$optarg" ;;
533 --preserve-dup-deps) duplicate_deps
="yes" ;;
537 preserve_args
="$preserve_args $arg"
543 preserve_args
="$preserve_args --tag"
546 set tag
"$optarg" ${1+"$@"}
549 preserve_args
="$preserve_args --tag"
558 $echo "$modename: unrecognized option \`$arg'" 1>&2
570 if test -n "$prevopt"; then
571 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
576 case $disable_libs in
580 build_libtool_libs
=no
584 build_old_libs
=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
588 # If this variable is set in any of the actions, the command in it
589 # will be execed at the end. This prevents here-documents from being
590 # left over by shells.
593 if test -z "$show_help"; then
595 # Infer the operation mode.
596 if test -z "$mode"; then
597 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
598 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
600 *cc | cc
* |
*++ | gcc
* |
*-gcc* | g
++* | xlc
*)
612 *db |
*dbx |
*strace |
*truss
)
622 # If we have no mode, but dlfiles were specified, then do execute mode.
623 test -n "$execute_dlfiles" && mode
=execute
625 # Just use the default operation mode.
626 if test -z "$mode"; then
627 if test -n "$nonopt"; then
628 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
630 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637 # Only execute mode is allowed to have -dlopen flags.
638 if test -n "$execute_dlfiles" && test "$mode" != execute
; then
639 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
644 # Change the help message to a mode-specific one.
646 help="Try \`$modename --help --mode=$mode' for more information."
648 # These modes are in order of execution frequency so that they run quickly.
650 # libtool compile mode
652 modename
="$modename: compile"
653 # Get the compilation command and the source file.
655 srcfile
="$nonopt" # always keep a non-empty value in "srcfile"
666 # do not "continue". Instead, add this to base_compile
678 # Accept any command-line options.
681 if test -n "$libobj" ; then
682 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689 -static |
-prefer-pic |
-prefer-non-pic)
700 arg_mode
=arg
# the next one goes into the "base_compile" arg list
701 continue # The current "srcfile" will either be retained or
702 ;; # replaced later. I would guess that would be a bug.
705 args
=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
707 save_ifs
="$IFS"; IFS
=','
711 # Double-quote args containing other shell metacharacters.
712 # Many Bourne shells cannot handle close brackets correctly
713 # in scan sets, so we specify it separately.
715 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
719 lastarg
="$lastarg $arg"
722 lastarg
=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
724 # Add the arguments to base_compile.
725 base_compile
="$base_compile $lastarg"
730 # Accept the current argument as the source file.
731 # The previous "srcfile" becomes the current argument.
738 esac # case $arg_mode
740 # Aesthetically quote the previous argument.
741 lastarg
=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
744 # Double-quote args containing other shell metacharacters.
745 # Many Bourne shells cannot handle close brackets correctly
746 # in scan sets, and some SunOS ksh mistreat backslash-escaping
747 # in scan sets (worked around with variable expansion),
748 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
749 # at all, so we specify them separately.
750 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
751 lastarg
="\"$lastarg\""
755 base_compile
="$base_compile $lastarg"
760 $echo "$modename: you must specify an argument for -Xcompile"
764 $echo "$modename: you must specify a target with \`-o'" 1>&2
768 # Get the name of the library object.
769 [ -z "$libobj" ] && libobj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
773 # Recognize several different file suffixes.
774 # If the user specifies -o file.o, it is replaced with file.lo
784 *.class
) xform
=class
;;
787 *.
[fF
][09]?
) xform
=[fF
][09].
;;
789 *.java
) xform
=java
;;
793 libobj
=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
796 *.lo
) obj
=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
798 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
803 func_infer_tag
$base_compile
805 for arg
in $later; do
824 qlibobj
=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
826 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827 qlibobj
="\"$qlibobj\"" ;;
829 test "X$libobj" != "X$qlibobj" \
830 && $echo "X$libobj" |
grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
831 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
832 objname
=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
833 xdir
=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
834 if test "X$xdir" = "X$obj"; then
839 lobj
=${xdir}$objdir/$objname
841 if test -z "$base_compile"; then
842 $echo "$modename: you must specify a compilation command" 1>&2
847 # Delete any leftover library objects.
848 if test "$build_old_libs" = yes; then
849 removelist
="$obj $lobj $libobj ${libobj}T"
851 removelist
="$lobj $libobj ${libobj}T"
855 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
857 # On Cygwin there's no "real" PIC flag so we must build both object types
859 cygwin
* | mingw
* | pw32
* | os2
*)
863 if test "$pic_mode" = no
&& test "$deplibs_check_method" != pass_all
; then
864 # non-PIC code in shared libraries is not supported
868 # Calculate the filename of the output object if compiler does
869 # not support -o with -c
870 if test "$compiler_c_o" = no
; then
871 output_obj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.
${objext}
872 lockfile
="$output_obj.lock"
873 removelist
="$removelist $output_obj $lockfile"
874 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
881 # Lock this critical section if it is needed
882 # We use this script file to make the link, it avoids creating a new file
883 if test "$need_locks" = yes; then
884 until $run ln "$progpath" "$lockfile" 2>/dev
/null
; do
885 $show "Waiting for $lockfile to be removed"
888 elif test "$need_locks" = warn
; then
889 if test -f "$lockfile"; then
891 *** ERROR, $lockfile exists and contains:
892 `cat $lockfile 2>/dev/null`
894 This indicates that another process is trying to use the same
895 temporary object file, and libtool could not work around it because
896 your compiler does not support \`-c' and \`-o' together. If you
897 repeat this compilation, it may succeed, by chance, but you had better
898 avoid parallel builds (make -j) in this platform, or get a better
904 $echo "$srcfile" > "$lockfile"
907 if test -n "$fix_srcfile_path"; then
908 eval srcfile
=\"$fix_srcfile_path\"
910 qsrcfile
=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
912 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
913 qsrcfile
="\"$qsrcfile\"" ;;
916 $run $rm "$libobj" "${libobj}T"
918 # Create a libtool object file (analogous to a ".la" file),
919 # but don't create it if we're doing a dry run.
920 test -z "$run" && cat > ${libobj}T
<<EOF
921 # $libobj - a libtool object file
922 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
924 # Please DO NOT delete this file!
925 # It is necessary for linking the library.
927 # Name of the PIC object.
930 # Only build a PIC object if we are building libtool libraries.
931 if test "$build_libtool_libs" = yes; then
932 # Without this assignment, base_compile gets emptied.
933 fbsd_hideous_sh_bug
=$base_compile
935 if test "$pic_mode" != no
; then
936 command="$base_compile $qsrcfile $pic_flag"
938 # Don't build PIC code
939 command="$base_compile $qsrcfile"
942 if test ! -d "${xdir}$objdir"; then
943 $show "$mkdir ${xdir}$objdir"
944 $run $mkdir ${xdir}$objdir
946 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
951 if test -z "$output_obj"; then
952 # Place PIC objects in $objdir
953 command="$command -o $lobj"
956 $run $rm "$lobj" "$output_obj"
959 if $run eval "$command"; then :
961 test -n "$output_obj" && $run $rm $removelist
965 if test "$need_locks" = warn
&&
966 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
968 *** ERROR, $lockfile contains:
969 `cat $lockfile 2>/dev/null`
971 but it should contain:
974 This indicates that another process is trying to use the same
975 temporary object file, and libtool could not work around it because
976 your compiler does not support \`-c' and \`-o' together. If you
977 repeat this compilation, it may succeed, by chance, but you had better
978 avoid parallel builds (make -j) in this platform, or get a better
985 # Just move the object if needed, then go on to compile the next one
986 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
987 $show "$mv $output_obj $lobj"
988 if $run $mv $output_obj $lobj; then :
996 # Append the name of the PIC object to the libtool object file.
997 test -z "$run" && cat >> ${libobj}T
<<EOF
998 pic_object='$objdir/$objname'
1002 # Allow error messages only from the first compilation.
1003 if test "$suppress_opt" = yes; then
1004 suppress_output
=' >/dev/null 2>&1'
1007 # No PIC object so indicate it doesn't exist in the libtool
1009 test -z "$run" && cat >> ${libobj}T
<<EOF
1015 # Only build a position-dependent object if we build old libraries.
1016 if test "$build_old_libs" = yes; then
1017 if test "$pic_mode" != yes; then
1018 # Don't build PIC code
1019 command="$base_compile $qsrcfile"
1021 command="$base_compile $qsrcfile $pic_flag"
1023 if test "$compiler_c_o" = yes; then
1024 command="$command -o $obj"
1027 # Suppress compiler output if we already did a PIC compilation.
1028 command="$command$suppress_output"
1029 $run $rm "$obj" "$output_obj"
1031 if $run eval "$command"; then :
1033 $run $rm $removelist
1037 if test "$need_locks" = warn
&&
1038 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1040 *** ERROR, $lockfile contains:
1041 `cat $lockfile 2>/dev/null`
1043 but it should contain:
1046 This indicates that another process is trying to use the same
1047 temporary object file, and libtool could not work around it because
1048 your compiler does not support \`-c' and \`-o' together. If you
1049 repeat this compilation, it may succeed, by chance, but you had better
1050 avoid parallel builds (make -j) in this platform, or get a better
1053 $run $rm $removelist
1057 # Just move the object if needed
1058 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1059 $show "$mv $output_obj $obj"
1060 if $run $mv $output_obj $obj; then :
1063 $run $rm $removelist
1068 # Append the name of the non-PIC object the libtool object file.
1069 # Only append if the libtool object file exists.
1070 test -z "$run" && cat >> ${libobj}T
<<EOF
1071 # Name of the non-PIC object.
1072 non_pic_object='$objname'
1076 # Append the name of the non-PIC object the libtool object file.
1077 # Only append if the libtool object file exists.
1078 test -z "$run" && cat >> ${libobj}T
<<EOF
1079 # Name of the non-PIC object.
1085 $run $mv "${libobj}T" "${libobj}"
1087 # Unlock the critical section if it was locked
1088 if test "$need_locks" != no
; then
1089 $run $rm "$lockfile"
1097 modename
="$modename: link"
1099 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1100 # It is impossible to link a dll without this setting, and
1101 # we shouldn't force the makefile maintainer to figure out
1102 # which system we are compiling for in order to pass an extra
1103 # flag for every libtool invocation.
1104 # allow_undefined=no
1106 # FIXME: Unfortunately, there are problems with the above when trying
1107 # to make a dll which has undefined symbols, in which case not
1108 # even a static library is built. For now, we need to specify
1109 # -no-undefined on the libtool link line when we can be certain
1110 # that all symbols are satisfied, otherwise we get a static library.
1117 libtool_args
="$nonopt"
1118 base_compile
="$nonopt $@"
1119 compile_command
="$nonopt"
1120 finalize_command
="$nonopt"
1133 lib_search_path
=`pwd`
1142 export_symbols_regex
=
1150 notinst_path
= # paths that contain not-installed libtool libraries
1151 precious_files_regex
=
1152 prefer_static_libs
=no
1165 func_infer_tag
$base_compile
1167 # We need to know -static, to get the right output filenames.
1171 -all-static |
-static |
-static-libtool-libs)
1174 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1175 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1177 if test -n "$link_static_flag"; then
1178 dlopen_self
=$dlopen_self_static
1180 prefer_static_libs
=yes
1183 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1184 dlopen_self
=$dlopen_self_static
1186 prefer_static_libs
=built
1188 -static-libtool-libs)
1189 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1190 dlopen_self
=$dlopen_self_static
1192 prefer_static_libs
=yes
1195 build_libtool_libs
=no
1202 # See if our shared archives depend on static archives.
1203 test -n "$old_archive_from_new_cmds" && build_old_libs
=yes
1205 # Go through the arguments, transforming them on the way.
1206 while test "$#" -gt 0; do
1210 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211 qarg
=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1215 libtool_args
="$libtool_args $qarg"
1217 # If the previous option needs an argument, assign it.
1218 if test -n "$prev"; then
1221 compile_command
="$compile_command @OUTPUT@"
1222 finalize_command
="$finalize_command @OUTPUT@"
1228 if test "$preload" = no
; then
1229 # Add the symbol object into the linking commands.
1230 compile_command
="$compile_command @SYMFILE@"
1231 finalize_command
="$finalize_command @SYMFILE@"
1235 *.la |
*.lo
) ;; # We handle these cases below.
1237 if test "$dlself" = no
; then
1245 if test "$prev" = dlprefiles
; then
1247 elif test "$prev" = dlfiles
&& test "$dlopen_self" != yes; then
1257 if test "$prev" = dlfiles
; then
1258 dlfiles
="$dlfiles $arg"
1260 dlprefiles
="$dlprefiles $arg"
1268 export_symbols
="$arg"
1269 if test ! -f "$arg"; then
1270 $echo "$modename: symbol file \`$arg' does not exist"
1277 export_symbols_regex
="$arg"
1282 inst_prefix_dir
="$arg"
1287 precious_files_regex
="$arg"
1297 if test -f "$arg"; then
1300 for fil
in `cat $save_arg`
1302 # moreargs="$moreargs $fil"
1304 # A libtool-controlled object.
1306 # Check to see that this really is a libtool object.
1307 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1312 # If there is no directory component, then add one.
1314 */* |
*\\*) .
$arg ;;
1318 if test -z "$pic_object" || \
1319 test -z "$non_pic_object" ||
1320 test "$pic_object" = none
&& \
1321 test "$non_pic_object" = none
; then
1322 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1326 # Extract subdirectory from the argument.
1327 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1328 if test "X$xdir" = "X$arg"; then
1334 if test "$pic_object" != none
; then
1335 # Prepend the subdirectory the object is found in.
1336 pic_object
="$xdir$pic_object"
1338 if test "$prev" = dlfiles
; then
1339 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1340 dlfiles
="$dlfiles $pic_object"
1344 # If libtool objects are unsupported, then we need to preload.
1349 # CHECK ME: I think I busted this. -Ossama
1350 if test "$prev" = dlprefiles
; then
1351 # Preload the old-style object.
1352 dlprefiles
="$dlprefiles $pic_object"
1357 libobjs
="$libobjs $pic_object"
1362 if test "$non_pic_object" != none
; then
1363 # Prepend the subdirectory the object is found in.
1364 non_pic_object
="$xdir$non_pic_object"
1366 # A standard non-PIC object
1367 non_pic_objects
="$non_pic_objects $non_pic_object"
1368 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1369 arg
="$non_pic_object"
1372 # If the PIC object exists, use it instead.
1373 # $xdir was prepended to $pic_object above.
1374 non_pic_object
="$pic_object"
1375 non_pic_objects
="$non_pic_objects $non_pic_object"
1378 # Only an error if not doing a dry-run.
1379 if test -z "$run"; then
1380 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1385 # Extract subdirectory from the argument.
1386 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1387 if test "X$xdir" = "X$arg"; then
1393 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1394 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1395 libobjs
="$libobjs $pic_object"
1396 non_pic_objects
="$non_pic_objects $non_pic_object"
1401 $echo "$modename: link input file \`$save_arg' does not exist"
1409 # We need an absolute path.
1411 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1413 $echo "$modename: only absolute run-paths are allowed" 1>&2
1417 if test "$prev" = rpath
; then
1420 *) rpath
="$rpath $arg" ;;
1425 *) xrpath
="$xrpath $arg" ;;
1432 compiler_flags
="$compiler_flags $qarg"
1434 compile_command
="$compile_command $qarg"
1435 finalize_command
="$finalize_command $qarg"
1439 linker_flags
="$linker_flags $qarg"
1440 compiler_flags
="$compiler_flags $wl$qarg"
1442 compile_command
="$compile_command $wl$qarg"
1443 finalize_command
="$finalize_command $wl$qarg"
1447 linker_flags
="$linker_flags $qarg"
1448 compiler_flags
="$compiler_flags $qarg"
1450 compile_command
="$compile_command $qarg"
1451 finalize_command
="$finalize_command $qarg"
1459 darwin_framework|darwin_framework_skip
)
1460 test "$prev" = "darwin_framework" && compiler_flags
="$compiler_flags $arg"
1461 compile_command
="$compile_command $arg"
1462 finalize_command
="$finalize_command $arg"
1467 eval "$prev=\"\$arg\""
1472 fi # test -n "$prev"
1478 if test -n "$link_static_flag"; then
1479 compile_command
="$compile_command $link_static_flag"
1480 finalize_command
="$finalize_command $link_static_flag"
1486 # FIXME: remove this flag sometime in the future.
1487 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1511 -export-symbols |
-export-symbols-regex)
1512 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
1513 $echo "$modename: more than one -exported-symbols argument is not allowed"
1516 if test "X$arg" = "X-export-symbols"; then
1524 -framework|
-arch|
-isysroot)
1526 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1527 prev
=darwin_framework_skip
;;
1528 *) compiler_flags
="$compiler_flags $arg"
1529 prev
=darwin_framework
;;
1531 compile_command
="$compile_command $arg"
1532 finalize_command
="$finalize_command $arg"
1541 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1542 # so, if we see these flags be careful not to treat them like -L
1544 case $with_gcc/$host in
1545 no
/*-*-irix* |
/*-*-irix*)
1546 compile_command
="$compile_command $arg"
1547 finalize_command
="$finalize_command $arg"
1554 dir
=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1555 # We need an absolute path.
1557 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1559 absdir
=`cd "$dir" && pwd`
1560 if test -z "$absdir"; then
1561 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1563 notinst_path
="$notinst_path $dir"
1571 deplibs
="$deplibs -L$dir"
1572 lib_search_path
="$lib_search_path $dir"
1576 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1577 testbindir
=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1578 case :$dllsearchpath: in
1580 *) dllsearchpath
="$dllsearchpath:$dir";;
1582 case :$dllsearchpath: in
1583 *":$testbindir:"*) ;;
1584 *) dllsearchpath
="$dllsearchpath:$testbindir";;
1592 if test "X$arg" = "X-lc" ||
test "X$arg" = "X-lm"; then
1594 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-beos*)
1595 # These systems don't actually have a C or math library (as such)
1599 # These systems don't actually have a C library (as such)
1600 test "X$arg" = "X-lc" && continue
1602 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1603 # Do not include libc due to us having libc/libc_r.
1604 test "X$arg" = "X-lc" && continue
1606 *-*-rhapsody* |
*-*-darwin1.
[012])
1607 # Rhapsody C and math libraries are in the System framework
1608 deplibs
="$deplibs -framework System"
1611 *-*-sco3.2v5
* |
*-*-sco5v6*)
1612 # Causes problems with __ctype
1613 test "X$arg" = "X-lc" && continue
1615 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
1616 # Compiler inserts libc in the correct place for threads to work
1617 test "X$arg" = "X-lc" && continue
1620 elif test "X$arg" = "X-lc_r"; then
1622 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1623 # Do not include libc_r directly, use -pthread flag.
1628 deplibs
="$deplibs $arg"
1632 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1633 # classes, name mangling, and exception handling.
1635 compile_command
="$compile_command $arg"
1636 compiler_flags
="$compiler_flags $arg"
1637 finalize_command
="$finalize_command $arg"
1642 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe|
-threads)
1643 compiler_flags
="$compiler_flags $arg"
1644 compile_command
="$compile_command $arg"
1645 finalize_command
="$finalize_command $arg"
1654 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1655 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1656 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1657 # +DA*, +DD* enable 64-bit mode on the HP compiler
1658 # -q* pass through compiler args for the IBM compiler
1659 # -m* pass through architecture-specific compiler args for GCC
1660 # -m*, -t[45]*, -txscale* pass through architecture-specific
1661 # compiler args for GCC
1662 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1663 # -F/path gives path to uninstalled frameworks, gcc on darwin
1664 # @file GCC response files
1665 -64|
-mips[0-9]|
-r[0-9][0-9]*|
-xarch=*|
-xtarget=*|
+DA
*|
+DD
*|
-q*|
-m*| \
1666 -t[45]*|
-txscale*|
-p|
-pg|
--coverage|
-fprofile-*|
-F*|@
*)
1668 # Unknown arguments in both finalize_command and compile_command need
1669 # to be aesthetically quoted because they are evaled later.
1670 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1672 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1676 compile_command
="$compile_command $arg"
1677 finalize_command
="$finalize_command $arg"
1678 compiler_flags
="$compiler_flags $arg"
1694 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-*-darwin*)
1695 # The PATH hackery in wrapper scripts is required on Windows
1696 # and Darwin in order for the loader to find any dlls it needs.
1697 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1698 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1701 *) no_install
=yes ;;
1718 -precious-files-regex)
1739 dir
=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1740 # We need an absolute path.
1742 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1744 $echo "$modename: only absolute run-paths are allowed" 1>&2
1750 *) xrpath
="$xrpath $dir" ;;
1755 -static |
-static-libtool-libs)
1756 # The effects of -static are defined in a previous loop.
1757 # We used to do the same as -all-static on platforms that
1758 # didn't have a PIC flag, but the assumption that the effects
1759 # would be equivalent was wrong. It would break on at least
1760 # Digital Unix and AIX.
1780 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1782 save_ifs
="$IFS"; IFS
=','
1783 for flag
in $args; do
1786 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1791 compiler_flags
="$compiler_flags $flag"
1794 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1798 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1800 save_ifs
="$IFS"; IFS
=','
1801 for flag
in $args; do
1804 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1809 compiler_flags
="$compiler_flags $wl$flag"
1810 linker_flags
="$linker_flags $flag"
1813 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1831 # Some other compiler flag.
1833 # Unknown arguments in both finalize_command and compile_command need
1834 # to be aesthetically quoted because they are evaled later.
1835 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1837 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1844 # A standard object.
1849 # A libtool-controlled object.
1851 # Check to see that this really is a libtool object.
1852 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1857 # If there is no directory component, then add one.
1859 */* |
*\\*) .
$arg ;;
1863 if test -z "$pic_object" || \
1864 test -z "$non_pic_object" ||
1865 test "$pic_object" = none
&& \
1866 test "$non_pic_object" = none
; then
1867 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1871 # Extract subdirectory from the argument.
1872 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1873 if test "X$xdir" = "X$arg"; then
1879 if test "$pic_object" != none
; then
1880 # Prepend the subdirectory the object is found in.
1881 pic_object
="$xdir$pic_object"
1883 if test "$prev" = dlfiles
; then
1884 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1885 dlfiles
="$dlfiles $pic_object"
1889 # If libtool objects are unsupported, then we need to preload.
1894 # CHECK ME: I think I busted this. -Ossama
1895 if test "$prev" = dlprefiles
; then
1896 # Preload the old-style object.
1897 dlprefiles
="$dlprefiles $pic_object"
1902 libobjs
="$libobjs $pic_object"
1907 if test "$non_pic_object" != none
; then
1908 # Prepend the subdirectory the object is found in.
1909 non_pic_object
="$xdir$non_pic_object"
1911 # A standard non-PIC object
1912 non_pic_objects
="$non_pic_objects $non_pic_object"
1913 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1914 arg
="$non_pic_object"
1917 # If the PIC object exists, use it instead.
1918 # $xdir was prepended to $pic_object above.
1919 non_pic_object
="$pic_object"
1920 non_pic_objects
="$non_pic_objects $non_pic_object"
1923 # Only an error if not doing a dry-run.
1924 if test -z "$run"; then
1925 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1930 # Extract subdirectory from the argument.
1931 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1932 if test "X$xdir" = "X$arg"; then
1938 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1939 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1940 libobjs
="$libobjs $pic_object"
1941 non_pic_objects
="$non_pic_objects $non_pic_object"
1948 deplibs
="$deplibs $arg"
1949 old_deplibs
="$old_deplibs $arg"
1954 # A libtool-controlled library.
1956 if test "$prev" = dlfiles
; then
1957 # This library was specified with -dlopen.
1958 dlfiles
="$dlfiles $arg"
1960 elif test "$prev" = dlprefiles
; then
1961 # The library was specified with -dlpreopen.
1962 dlprefiles
="$dlprefiles $arg"
1965 deplibs
="$deplibs $arg"
1970 # Some other compiler argument.
1972 # Unknown arguments in both finalize_command and compile_command need
1973 # to be aesthetically quoted because they are evaled later.
1974 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1976 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1983 # Now actually substitute the argument into the commands.
1984 if test -n "$arg"; then
1985 compile_command
="$compile_command $arg"
1986 finalize_command
="$finalize_command $arg"
1988 done # argument parsing loop
1990 if test -n "$prev"; then
1991 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1996 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1997 eval arg
=\"$export_dynamic_flag_spec\"
1998 compile_command
="$compile_command $arg"
1999 finalize_command
="$finalize_command $arg"
2003 # calculate the name of the file, without its directory
2004 outputname
=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2005 libobjs_save
="$libobjs"
2007 if test -n "$shlibpath_var"; then
2008 # get the directories listed in $shlibpath_var
2009 eval shlib_search_path
=\
`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2013 eval sys_lib_search_path
=\"$sys_lib_search_path_spec\"
2014 eval sys_lib_dlsearch_path
=\"$sys_lib_dlsearch_path_spec\"
2016 output_objdir
=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2017 if test "X$output_objdir" = "X$output"; then
2018 output_objdir
="$objdir"
2020 output_objdir
="$output_objdir/$objdir"
2022 # Create the object directory.
2023 if test ! -d "$output_objdir"; then
2024 $show "$mkdir $output_objdir"
2025 $run $mkdir $output_objdir
2027 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2032 # Determine the type of output
2035 $echo "$modename: you must specify an output file" 1>&2
2039 *.
$libext) linkmode
=oldlib
;;
2040 *.lo |
*.
$objext) linkmode
=obj
;;
2041 *.la
) linkmode
=lib
;;
2042 *) linkmode
=prog
;; # Anything else should be a program.
2046 *cygwin
* |
*mingw
* |
*pw32
*)
2047 # don't eliminate duplications in $postdeps and $predeps
2048 duplicate_compiler_generated_deps
=yes
2051 duplicate_compiler_generated_deps
=$duplicate_deps
2057 # Find all interdependent deplibs by searching for libraries
2058 # that are linked more than once (e.g. -la -lb -la)
2059 for deplib
in $deplibs; do
2060 if test "X$duplicate_deps" = "Xyes" ; then
2062 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2065 libs
="$libs $deplib"
2068 if test "$linkmode" = lib
; then
2069 libs
="$predeps $libs $compiler_lib_search_path $postdeps"
2071 # Compute libraries that are listed more than once in $predeps
2072 # $postdeps and mark them as special (i.e., whose duplicates are
2073 # not to be eliminated).
2075 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2076 for pre_post_dep
in $predeps $postdeps; do
2077 case "$pre_post_deps " in
2078 *" $pre_post_dep "*) specialdeplibs
="$specialdeplibs $pre_post_deps" ;;
2080 pre_post_deps
="$pre_post_deps $pre_post_dep"
2089 need_relink
=no
# whether we're linking any uninstalled libtool libraries
2090 notinst_deplibs
= # not-installed libtool libraries
2094 for file in $dlfiles $dlprefiles; do
2098 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2110 passes
="conv scan dlopen dlpreopen link"
2115 for pass
in $passes; do
2116 if test "$linkmode,$pass" = "lib,link" ||
2117 test "$linkmode,$pass" = "prog,scan"; then
2121 if test "$linkmode" = prog
; then
2123 dlopen
) libs
="$dlfiles" ;;
2124 dlpreopen
) libs
="$dlprefiles" ;;
2125 link
) libs
="$deplibs %DEPLIBS% $dependency_libs" ;;
2128 if test "$pass" = dlopen
; then
2129 # Collect dlpreopened libraries
2130 save_deplibs
="$deplibs"
2133 for deplib
in $libs; do
2137 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe|
-threads)
2138 if test "$linkmode,$pass" = "prog,link"; then
2139 compile_deplibs
="$deplib $compile_deplibs"
2140 finalize_deplibs
="$deplib $finalize_deplibs"
2142 compiler_flags
="$compiler_flags $deplib"
2147 if test "$linkmode" != lib
&& test "$linkmode" != prog
; then
2148 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2151 name
=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2152 for searchdir
in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2153 for search_ext
in .la
$std_shrext .so .a
; do
2154 # Search the libtool library
2155 lib
="$searchdir/lib${name}${search_ext}"
2156 if test -f "$lib"; then
2157 if test "$search_ext" = ".la"; then
2166 if test "$found" != yes; then
2167 # deplib doesn't seem to be a libtool library
2168 if test "$linkmode,$pass" = "prog,link"; then
2169 compile_deplibs
="$deplib $compile_deplibs"
2170 finalize_deplibs
="$deplib $finalize_deplibs"
2172 deplibs
="$deplib $deplibs"
2173 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2176 else # deplib is a libtool library
2177 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2178 # We need to do some special things here, and not later.
2179 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2180 case " $predeps $postdeps " in
2182 if (${SED} -e '2q' $lib |
2183 grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
2187 */* |
*\\*) .
$lib ;;
2190 for l
in $old_library $library_names; do
2193 if test "X$ll" = "X$old_library" ; then # only static version available
2195 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2196 test "X$ladir" = "X$lib" && ladir
="."
2197 lib
=$ladir/$old_library
2198 if test "$linkmode,$pass" = "prog,link"; then
2199 compile_deplibs
="$deplib $compile_deplibs"
2200 finalize_deplibs
="$deplib $finalize_deplibs"
2202 deplibs
="$deplib $deplibs"
2203 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2217 deplibs
="$deplib $deplibs"
2218 test "$pass" = conv
&& continue
2219 newdependency_libs
="$deplib $newdependency_libs"
2220 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2223 if test "$pass" = conv
; then
2224 deplibs
="$deplib $deplibs"
2227 if test "$pass" = scan
; then
2228 deplibs
="$deplib $deplibs"
2230 compile_deplibs
="$deplib $compile_deplibs"
2231 finalize_deplibs
="$deplib $finalize_deplibs"
2233 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2236 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2242 if test "$pass" = link
; then
2243 dir
=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2244 # Make sure the xrpath contains only unique directories.
2247 *) xrpath
="$xrpath $dir" ;;
2250 deplibs
="$deplib $deplibs"
2253 *.la
) lib
="$deplib" ;;
2255 if test "$pass" = conv
; then
2256 deplibs
="$deplib $deplibs"
2262 case $deplibs_check_method in
2264 set dummy
$deplibs_check_method
2265 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2266 if eval $echo \"$deplib\" 2>/dev
/null \
2268 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
2276 if test "$valid_a_lib" != yes; then
2278 $echo "*** Warning: Trying to link with static lib archive $deplib."
2279 $echo "*** I have the capability to make that library automatically link in when"
2280 $echo "*** you link to this library. But I can only do this if you have a"
2281 $echo "*** shared version of the library, which you do not appear to have"
2282 $echo "*** because the file extensions .$libext of this argument makes me believe"
2283 $echo "*** that it is just a static archive that I should not used here."
2286 $echo "*** Warning: Linking the shared library $output against the"
2287 $echo "*** static library $deplib is not portable!"
2288 deplibs
="$deplib $deplibs"
2293 if test "$pass" != link
; then
2294 deplibs
="$deplib $deplibs"
2296 compile_deplibs
="$deplib $compile_deplibs"
2297 finalize_deplibs
="$deplib $finalize_deplibs"
2304 if test "$pass" = conv
; then
2305 deplibs
="$deplib $deplibs"
2306 elif test "$linkmode" = prog
; then
2307 if test "$pass" = dlpreopen ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no
; then
2308 # If there is no dlopen support or we're linking statically,
2309 # we need to preload.
2310 newdlprefiles
="$newdlprefiles $deplib"
2311 compile_deplibs
="$deplib $compile_deplibs"
2312 finalize_deplibs
="$deplib $finalize_deplibs"
2314 newdlfiles
="$newdlfiles $deplib"
2324 if test "$found" = yes ||
test -f "$lib"; then :
2326 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2330 # Check to see that this really is a libtool archive.
2331 if (${SED} -e '2q' $lib |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
2333 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2337 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2338 test "X$ladir" = "X$lib" && ladir
="."
2346 # If the library was installed with an old release of libtool,
2347 # it will not redefine variables installed, or shouldnotlink
2355 */* |
*\\*) .
$lib ;;
2359 if test "$linkmode,$pass" = "lib,link" ||
2360 test "$linkmode,$pass" = "prog,scan" ||
2361 { test "$linkmode" != prog
&& test "$linkmode" != lib
; }; then
2362 test -n "$dlopen" && dlfiles
="$dlfiles $dlopen"
2363 test -n "$dlpreopen" && dlprefiles
="$dlprefiles $dlpreopen"
2366 if test "$pass" = conv
; then
2367 # Only check for convenience libraries
2368 deplibs
="$lib $deplibs"
2369 if test -z "$libdir"; then
2370 if test -z "$old_library"; then
2371 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2374 # It is a libtool convenience library, so add in its objects.
2375 convenience
="$convenience $ladir/$objdir/$old_library"
2376 old_convenience
="$old_convenience $ladir/$objdir/$old_library"
2378 for deplib
in $dependency_libs; do
2379 deplibs
="$deplib $deplibs"
2380 if test "X$duplicate_deps" = "Xyes" ; then
2381 case "$tmp_libs " in
2382 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2385 tmp_libs
="$tmp_libs $deplib"
2387 elif test "$linkmode" != prog
&& test "$linkmode" != lib
; then
2388 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2395 # Get the name of the library we link against.
2397 for l
in $old_library $library_names; do
2400 if test -z "$linklib"; then
2401 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2405 # This library was specified with -dlopen.
2406 if test "$pass" = dlopen
; then
2407 if test -z "$libdir"; then
2408 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2411 if test -z "$dlname" ||
2412 test "$dlopen_support" != yes ||
2413 test "$build_libtool_libs" = no
; then
2414 # If there is no dlname, no dlopen support or we're linking
2415 # statically, we need to preload. We also need to preload any
2416 # dependent libraries so libltdl's deplib preloader doesn't
2417 # bomb out in the load deplibs phase.
2418 dlprefiles
="$dlprefiles $lib $dependency_libs"
2420 newdlfiles
="$newdlfiles $lib"
2425 # We need an absolute path.
2427 [\\/]* |
[A-Za-z
]:[\\/]*) abs_ladir
="$ladir" ;;
2429 abs_ladir
=`cd "$ladir" && pwd`
2430 if test -z "$abs_ladir"; then
2431 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2432 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2437 laname
=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2439 # Find the relevant object directory and library name.
2440 if test "X$installed" = Xyes
; then
2441 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2442 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2450 test "X$hardcode_automatic" = Xyes
&& avoidtemprpath
=yes
2452 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2455 # Remove this search path later
2456 notinst_path
="$notinst_path $abs_ladir"
2458 dir
="$ladir/$objdir"
2459 absdir
="$abs_ladir/$objdir"
2460 # Remove this search path later
2461 notinst_path
="$notinst_path $abs_ladir"
2463 fi # $installed = yes
2464 name
=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2466 # This library was specified with -dlpreopen.
2467 if test "$pass" = dlpreopen
; then
2468 if test -z "$libdir"; then
2469 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2472 # Prefer using a static library (so that no silly _DYNAMIC symbols
2473 # are required to link).
2474 if test -n "$old_library"; then
2475 newdlprefiles
="$newdlprefiles $dir/$old_library"
2476 # Otherwise, use the dlname, so that lt_dlopen finds it.
2477 elif test -n "$dlname"; then
2478 newdlprefiles
="$newdlprefiles $dir/$dlname"
2480 newdlprefiles
="$newdlprefiles $dir/$linklib"
2482 fi # $pass = dlpreopen
2484 if test -z "$libdir"; then
2485 # Link the convenience library
2486 if test "$linkmode" = lib
; then
2487 deplibs
="$dir/$old_library $deplibs"
2488 elif test "$linkmode,$pass" = "prog,link"; then
2489 compile_deplibs
="$dir/$old_library $compile_deplibs"
2490 finalize_deplibs
="$dir/$old_library $finalize_deplibs"
2492 deplibs
="$lib $deplibs" # used for prog,scan pass
2498 if test "$linkmode" = prog
&& test "$pass" != link
; then
2499 newlib_search_path
="$newlib_search_path $ladir"
2500 deplibs
="$lib $deplibs"
2503 if test "$link_all_deplibs" != no ||
test -z "$library_names" ||
2504 test "$build_libtool_libs" = no
; then
2509 for deplib
in $dependency_libs; do
2511 -L*) newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2513 # Need to link against all dependency_libs?
2514 if test "$linkalldeplibs" = yes; then
2515 deplibs
="$deplib $deplibs"
2517 # Need to hardcode shared library paths
2518 # or/and link against static libraries
2519 newdependency_libs
="$deplib $newdependency_libs"
2521 if test "X$duplicate_deps" = "Xyes" ; then
2522 case "$tmp_libs " in
2523 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2526 tmp_libs
="$tmp_libs $deplib"
2529 fi # $linkmode = prog...
2531 if test "$linkmode,$pass" = "prog,link"; then
2532 if test -n "$library_names" &&
2533 { { test "$prefer_static_libs" = no ||
2534 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2535 test -z "$old_library"; }; then
2536 # We need to hardcode the library path
2537 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2538 # Make sure the rpath contains only unique directories.
2539 case "$temp_rpath " in
2542 *) temp_rpath
="$temp_rpath $absdir" ;;
2546 # Hardcode the library path.
2547 # Skip directories that are in the system default run-time
2549 case " $sys_lib_dlsearch_path " in
2552 case "$compile_rpath " in
2554 *) compile_rpath
="$compile_rpath $absdir"
2558 case " $sys_lib_dlsearch_path " in
2561 case "$finalize_rpath " in
2563 *) finalize_rpath
="$finalize_rpath $libdir"
2567 fi # $linkmode,$pass = prog,link...
2569 if test "$alldeplibs" = yes &&
2570 { test "$deplibs_check_method" = pass_all ||
2571 { test "$build_libtool_libs" = yes &&
2572 test -n "$library_names"; }; }; then
2573 # We only need to search for static libraries
2578 link_static
=no
# Whether the deplib will be linked statically
2579 use_static_libs
=$prefer_static_libs
2580 if test "$use_static_libs" = built
&& test "$installed" = yes ; then
2583 if test -n "$library_names" &&
2584 { test "$use_static_libs" = no ||
test -z "$old_library"; }; then
2585 if test "$installed" = no
; then
2586 notinst_deplibs
="$notinst_deplibs $lib"
2589 # This is a shared library
2591 # Warn about portability, can't link against -module's on
2592 # some systems (darwin)
2593 if test "$shouldnotlink" = yes && test "$pass" = link
; then
2595 if test "$linkmode" = prog
; then
2596 $echo "*** Warning: Linking the executable $output against the loadable module"
2598 $echo "*** Warning: Linking the shared library $output against the loadable module"
2600 $echo "*** $linklib is not portable!"
2602 if test "$linkmode" = lib
&&
2603 test "$hardcode_into_libs" = yes; then
2604 # Hardcode the library path.
2605 # Skip directories that are in the system default run-time
2607 case " $sys_lib_dlsearch_path " in
2610 case "$compile_rpath " in
2612 *) compile_rpath
="$compile_rpath $absdir"
2616 case " $sys_lib_dlsearch_path " in
2619 case "$finalize_rpath " in
2621 *) finalize_rpath
="$finalize_rpath $libdir"
2627 if test -n "$old_archive_from_expsyms_cmds"; then
2628 # figure out the soname
2629 set dummy
$library_names
2632 libname
=`eval \\$echo \"$libname_spec\"`
2633 # use dlname if we got it. it's perfectly good, no?
2634 if test -n "$dlname"; then
2636 elif test -n "$soname_spec"; then
2640 major
=`expr $current - $age`
2644 eval soname
=\"$soname_spec\"
2649 # Make a new name for the extract_expsyms_cmds to use
2651 soname
=`$echo $soroot | ${SED} -e 's/^.*\///'`
2652 newlib
="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2654 # If the library has no export list, then create one now
2655 if test -f "$output_objdir/$soname-def"; then :
2657 $show "extracting exported symbol list from \`$soname'"
2658 save_ifs
="$IFS"; IFS
='~'
2659 cmds
=$extract_expsyms_cmds
2660 for cmd
in $cmds; do
2664 $run eval "$cmd" ||
exit $?
2670 if test -f "$output_objdir/$newlib"; then :; else
2671 $show "generating import library for \`$soname'"
2672 save_ifs
="$IFS"; IFS
='~'
2673 cmds
=$old_archive_from_expsyms_cmds
2674 for cmd
in $cmds; do
2678 $run eval "$cmd" ||
exit $?
2682 # make sure the library variables are pointing to the new library
2685 fi # test -n "$old_archive_from_expsyms_cmds"
2687 if test "$linkmode" = prog ||
test "$mode" != relink
; then
2692 case $hardcode_action in
2693 immediate | unsupported
)
2694 if test "$hardcode_direct" = no
; then
2697 *-*-sco3.2v5.0.
[024]*) add_dir
="-L$dir" ;;
2698 *-*-sysv4*uw2
*) add_dir
="-L$dir" ;;
2699 *-*-sysv5OpenUNIX* |
*-*-sysv5UnixWare7.
[01].
[10]* | \
2700 *-*-unixware7*) add_dir
="-L$dir" ;;
2702 # if the lib is a module then we can not link against
2703 # it, someone is ignoring the new warnings I added
2704 if /usr
/bin
/file -L $add 2> /dev
/null |
2705 $EGREP ": [^:]* bundle" >/dev
/null
; then
2706 $echo "** Warning, lib $linklib is a module, not a shared library"
2707 if test -z "$old_library" ; then
2709 $echo "** And there doesn't seem to be a static archive available"
2710 $echo "** The link will probably fail, sorry"
2712 add
="$dir/$old_library"
2716 elif test "$hardcode_minus_L" = no
; then
2718 *-*-sunos*) add_shlibpath
="$dir" ;;
2722 elif test "$hardcode_shlibpath_var" = no
; then
2723 add_shlibpath
="$dir"
2730 if test "$hardcode_direct" = yes; then
2732 elif test "$hardcode_minus_L" = yes; then
2734 # Try looking first in the location we're being installed to.
2735 if test -n "$inst_prefix_dir"; then
2738 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2743 elif test "$hardcode_shlibpath_var" = yes; then
2744 add_shlibpath
="$dir"
2753 if test "$lib_linked" != yes; then
2754 $echo "$modename: configuration error: unsupported hardcode properties"
2758 if test -n "$add_shlibpath"; then
2759 case :$compile_shlibpath: in
2760 *":$add_shlibpath:"*) ;;
2761 *) compile_shlibpath
="$compile_shlibpath$add_shlibpath:" ;;
2764 if test "$linkmode" = prog
; then
2765 test -n "$add_dir" && compile_deplibs
="$add_dir $compile_deplibs"
2766 test -n "$add" && compile_deplibs
="$add $compile_deplibs"
2768 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2769 test -n "$add" && deplibs
="$add $deplibs"
2770 if test "$hardcode_direct" != yes && \
2771 test "$hardcode_minus_L" != yes && \
2772 test "$hardcode_shlibpath_var" = yes; then
2773 case :$finalize_shlibpath: in
2775 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2781 if test "$linkmode" = prog ||
test "$mode" = relink
; then
2785 # Finalize command for both is simple: just hardcode it.
2786 if test "$hardcode_direct" = yes; then
2787 add
="$libdir/$linklib"
2788 elif test "$hardcode_minus_L" = yes; then
2791 elif test "$hardcode_shlibpath_var" = yes; then
2792 case :$finalize_shlibpath: in
2794 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2797 elif test "$hardcode_automatic" = yes; then
2798 if test -n "$inst_prefix_dir" &&
2799 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2800 add
="$inst_prefix_dir$libdir/$linklib"
2802 add
="$libdir/$linklib"
2805 # We cannot seem to hardcode it, guess we'll fake it.
2807 # Try looking first in the location we're being installed to.
2808 if test -n "$inst_prefix_dir"; then
2811 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2818 if test "$linkmode" = prog
; then
2819 test -n "$add_dir" && finalize_deplibs
="$add_dir $finalize_deplibs"
2820 test -n "$add" && finalize_deplibs
="$add $finalize_deplibs"
2822 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2823 test -n "$add" && deplibs
="$add $deplibs"
2826 elif test "$linkmode" = prog
; then
2827 # Here we assume that one of hardcode_direct or hardcode_minus_L
2828 # is not unsupported. This is valid on all known static and
2830 if test "$hardcode_direct" != unsupported
; then
2831 test -n "$old_library" && linklib
="$old_library"
2832 compile_deplibs
="$dir/$linklib $compile_deplibs"
2833 finalize_deplibs
="$dir/$linklib $finalize_deplibs"
2835 compile_deplibs
="-l$name -L$dir $compile_deplibs"
2836 finalize_deplibs
="-l$name -L$dir $finalize_deplibs"
2838 elif test "$build_libtool_libs" = yes; then
2839 # Not a shared library
2840 if test "$deplibs_check_method" != pass_all
; then
2841 # We're trying link a shared library against a static one
2842 # but the system doesn't support it.
2844 # Just print a warning and add the library to dependency_libs so
2845 # that the program can be linked against the static library.
2847 $echo "*** Warning: This system can not link to static lib archive $lib."
2848 $echo "*** I have the capability to make that library automatically link in when"
2849 $echo "*** you link to this library. But I can only do this if you have a"
2850 $echo "*** shared version of the library, which you do not appear to have."
2851 if test "$module" = yes; then
2852 $echo "*** But as you try to build a module library, libtool will still create "
2853 $echo "*** a static module, that should work as long as the dlopening application"
2854 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2855 if test -z "$global_symbol_pipe"; then
2857 $echo "*** However, this would only work if libtool was able to extract symbol"
2858 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2859 $echo "*** not find such a program. So, this module is probably useless."
2860 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2862 if test "$build_old_libs" = no
; then
2863 build_libtool_libs
=module
2866 build_libtool_libs
=no
2870 deplibs
="$dir/$old_library $deplibs"
2873 fi # link shared/static library?
2875 if test "$linkmode" = lib
; then
2876 if test -n "$dependency_libs" &&
2877 { test "$hardcode_into_libs" != yes ||
2878 test "$build_old_libs" = yes ||
2879 test "$link_static" = yes; }; then
2880 # Extract -R from dependency_libs
2882 for libdir
in $dependency_libs; do
2884 -R*) temp_xrpath
=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2886 *" $temp_xrpath "*) ;;
2887 *) xrpath
="$xrpath $temp_xrpath";;
2889 *) temp_deplibs
="$temp_deplibs $libdir";;
2892 dependency_libs
="$temp_deplibs"
2895 newlib_search_path
="$newlib_search_path $absdir"
2896 # Link against this library
2897 test "$link_static" = no
&& newdependency_libs
="$abs_ladir/$laname $newdependency_libs"
2898 # ... and its dependency_libs
2900 for deplib
in $dependency_libs; do
2901 newdependency_libs
="$deplib $newdependency_libs"
2902 if test "X$duplicate_deps" = "Xyes" ; then
2903 case "$tmp_libs " in
2904 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2907 tmp_libs
="$tmp_libs $deplib"
2910 if test "$link_all_deplibs" != no
; then
2911 # Add the search paths of all dependency libraries
2912 for deplib
in $dependency_libs; do
2914 -L*) path
="$deplib" ;;
2916 dir
=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2917 test "X$dir" = "X$deplib" && dir
="."
2918 # We need an absolute path.
2920 [\\/]* |
[A-Za-z
]:[\\/]*) absdir
="$dir" ;;
2922 absdir
=`cd "$dir" && pwd`
2923 if test -z "$absdir"; then
2924 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2929 if grep "^installed=no" $deplib > /dev
/null
; then
2930 path
="$absdir/$objdir"
2932 eval libdir
=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2933 if test -z "$libdir"; then
2934 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2937 if test "$absdir" != "$libdir"; then
2938 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2945 # we do not want to link against static libs,
2946 # but need to link against shared
2947 eval deplibrary_names
=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2948 if test -n "$deplibrary_names" ; then
2949 for tmp
in $deplibrary_names ; do
2952 if test -f "$path/$depdepl" ; then
2953 depdepl
="$path/$depdepl"
2955 # do not add paths which are already there
2956 case " $newlib_search_path " in
2958 *) newlib_search_path
="$newlib_search_path $path";;
2971 # Again, we only want to link against shared libraries
2972 eval tmp_libs
=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2973 for tmp
in $newlib_search_path ; do
2974 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2975 eval depdepl
="$tmp/lib$tmp_libs.dylib"
2986 case " $deplibs " in
2988 *) deplibs
="$path $deplibs" ;;
2990 case " $deplibs " in
2992 *) deplibs
="$depdepl $deplibs" ;;
2995 fi # link_all_deplibs != no
2997 done # for deplib in $libs
2998 dependency_libs
="$newdependency_libs"
2999 if test "$pass" = dlpreopen
; then
3000 # Link the dlpreopened libraries before other libraries
3001 for deplib
in $save_deplibs; do
3002 deplibs
="$deplib $deplibs"
3005 if test "$pass" != dlopen
; then
3006 if test "$pass" != conv
; then
3007 # Make sure lib_search_path contains only unique directories.
3009 for dir
in $newlib_search_path; do
3010 case "$lib_search_path " in
3012 *) lib_search_path
="$lib_search_path $dir" ;;
3018 if test "$linkmode,$pass" != "prog,link"; then
3021 vars
="compile_deplibs finalize_deplibs"
3023 for var
in $vars dependency_libs
; do
3024 # Add libraries to $var in reverse order
3025 eval tmp_libs
=\"\$
$var\"
3027 for deplib
in $tmp_libs; do
3028 # FIXME: Pedantically, this is the right thing to do, so
3029 # that some nasty dependency loop isn't accidentally
3031 #new_libs="$deplib $new_libs"
3032 # Pragmatically, this seems to cause very few problems in
3035 -L*) new_libs
="$deplib $new_libs" ;;
3038 # And here is the reason: when a library appears more
3039 # than once as an explicit dependence of a library, or
3040 # is implicitly linked in more than once by the
3041 # compiler, it is considered special, and multiple
3042 # occurrences thereof are not removed. Compare this
3043 # with having the same library being listed as a
3044 # dependency of multiple other libraries: in this case,
3045 # we know (pedantically, we assume) the library does not
3046 # need to be listed more than once, so we keep only the
3047 # last copy. This is not always right, but it is rare
3048 # enough that we require users that really mean to play
3049 # such unportable linking tricks to link the library
3050 # using -Wl,-lname, so that libtool does not consider it
3051 # for duplicate removal.
3052 case " $specialdeplibs " in
3053 *" $deplib "*) new_libs
="$deplib $new_libs" ;;
3055 case " $new_libs " in
3057 *) new_libs
="$deplib $new_libs" ;;
3065 for deplib
in $new_libs; do
3068 case " $tmp_libs " in
3070 *) tmp_libs
="$tmp_libs $deplib" ;;
3073 *) tmp_libs
="$tmp_libs $deplib" ;;
3076 eval $var=\"$tmp_libs\"
3079 # Last step: remove runtime libs from dependency_libs
3080 # (they stay in deplibs)
3082 for i
in $dependency_libs ; do
3083 case " $predeps $postdeps $compiler_lib_search_path " in
3088 if test -n "$i" ; then
3089 tmp_libs
="$tmp_libs $i"
3092 dependency_libs
=$tmp_libs
3094 if test "$linkmode" = prog
; then
3095 dlfiles
="$newdlfiles"
3096 dlprefiles
="$newdlprefiles"
3101 if test -n "$deplibs"; then
3102 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3105 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
3106 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3109 if test -n "$rpath"; then
3110 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3113 if test -n "$xrpath"; then
3114 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3117 if test -n "$vinfo"; then
3118 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3121 if test -n "$release"; then
3122 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3125 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
3126 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3129 # Now set the variables for building old libraries.
3130 build_libtool_libs
=no
3132 objs
="$objs$old_deplibs"
3136 # Make sure we only generate libraries of the form `libNAME.la'.
3139 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3140 eval shared_ext
=\"$shrext_cmds\"
3141 eval libname
=\"$libname_spec\"
3144 if test "$module" = no
; then
3145 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3149 if test "$need_lib_prefix" != no
; then
3150 # Add the "lib" prefix for modules if required
3151 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3152 eval shared_ext
=\"$shrext_cmds\"
3153 eval libname
=\"$libname_spec\"
3155 libname
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3160 if test -n "$objs"; then
3161 if test "$deplibs_check_method" != pass_all
; then
3162 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3166 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3167 $echo "*** objects $objs is not portable!"
3168 libobjs
="$libobjs $objs"
3172 if test "$dlself" != no
; then
3173 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3177 if test "$#" -gt 2; then
3178 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3183 if test -z "$rpath"; then
3184 if test "$build_libtool_libs" = yes; then
3185 # Building a libtool convenience library.
3186 # Some compilers have problems with a `.al' extension so
3187 # convenience libraries should have the same extension an
3188 # archive normally would.
3189 oldlibs
="$output_objdir/$libname.$libext $oldlibs"
3190 build_libtool_libs
=convenience
3194 if test -n "$vinfo"; then
3195 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3198 if test -n "$release"; then
3199 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3203 # Parse the version information argument.
3204 save_ifs
="$IFS"; IFS
=':'
3205 set dummy
$vinfo 0 0 0
3208 if test -n "$8"; then
3209 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3214 # convert absolute version numbers to libtool ages
3215 # this retains compatibility with .la files and attempts
3216 # to make the code below a bit more comprehensible
3218 case $vinfo_number in
3222 number_revision
="$4"
3224 # There are really only two kinds -- those that
3225 # use the current revision as the major version
3226 # and those that subtract age and use age as
3227 # a minor version. But, then there is irix
3228 # which has an extra 1 added just for fun
3230 case $version_type in
3231 darwin|linux|osf|windows|none
)
3232 current
=`expr $number_major + $number_minor`
3234 revision
="$number_revision"
3236 freebsd-aout|freebsd-elf|sunos
)
3237 current
="$number_major"
3238 revision
="$number_minor"
3242 current
=`expr $number_major + $number_minor`
3244 revision
="$number_minor"
3245 lt_irix_increment
=no
3256 # Check that each of the things are valid numbers.
3258 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]) ;;
3260 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3261 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3267 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]) ;;
3269 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3270 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3276 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]) ;;
3278 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3279 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3284 if test "$age" -gt "$current"; then
3285 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3286 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3290 # Calculate the version variables.
3294 case $version_type in
3298 # Like Linux, but with the current version available in
3299 # verstring for coding it into the library header
3300 major
=.
`expr $current - $age`
3301 versuffix
="$major.$age.$revision"
3302 # Darwin ld doesn't like 0 for these options...
3303 minor_current
=`expr $current + 1`
3304 xlcverstring
="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3305 verstring
="-compatibility_version $minor_current -current_version $minor_current.$revision"
3310 versuffix
=".$current.$revision";
3315 versuffix
=".$current";
3319 if test "X$lt_irix_increment" = "Xno"; then
3320 major
=`expr $current - $age`
3322 major
=`expr $current - $age + 1`
3324 case $version_type in
3325 nonstopux
) verstring_prefix
=nonstopux
;;
3326 *) verstring_prefix
=sgi
;;
3328 verstring
="$verstring_prefix$major.$revision"
3330 # Add in all the interfaces that we are compatible with.
3332 while test "$loop" -ne 0; do
3333 iface
=`expr $revision - $loop`
3334 loop
=`expr $loop - 1`
3335 verstring
="$verstring_prefix$major.$iface:$verstring"
3338 # Before this point, $major must not contain `.'.
3340 versuffix
="$major.$revision"
3344 major
=.
`expr $current - $age`
3345 versuffix
="$major.$age.$revision"
3349 major
=.
`expr $current - $age`
3350 versuffix
=".$current.$age.$revision"
3351 verstring
="$current.$age.$revision"
3353 # Add in all the interfaces that we are compatible with.
3355 while test "$loop" -ne 0; do
3356 iface
=`expr $current - $loop`
3357 loop
=`expr $loop - 1`
3358 verstring
="$verstring:${iface}.0"
3361 # Make executables depend on our current version.
3362 verstring
="$verstring:${current}.0"
3367 versuffix
=".$current.$revision"
3371 # Use '-' rather than '.', since we only want one
3372 # extension on DOS 8.3 filesystems.
3373 major
=`expr $current - $age`
3378 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3379 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3384 # Clear the version info if we defaulted, and they specified a release.
3385 if test -z "$vinfo" && test -n "$release"; then
3387 case $version_type in
3389 # we can't check for "0.0" in archive_cmds due to quoting
3390 # problems, so we reset it completely
3397 if test "$need_version" = no
; then
3404 # Remove version info from name if versioning should be avoided
3405 if test "$avoid_version" = yes && test "$need_version" = no
; then
3411 # Check to see if the archive will have undefined symbols.
3412 if test "$allow_undefined" = yes; then
3413 if test "$allow_undefined_flag" = unsupported
; then
3414 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3415 build_libtool_libs
=no
3419 # Don't allow undefined symbols.
3420 allow_undefined_flag
="$no_undefined_flag"
3424 if test "$mode" != relink
; then
3425 # Remove our outputs, but don't remove object files since they
3426 # may have been created when compiling PIC objects.
3428 tempremovelist
=`$echo "$output_objdir/*"`
3429 for p
in $tempremovelist; do
3433 $output_objdir/$outputname |
$output_objdir/$libname.
* |
$output_objdir/${libname}${release}.
*)
3434 if test "X$precious_files_regex" != "X"; then
3435 if echo $p |
$EGREP -e "$precious_files_regex" >/dev
/null
2>&1
3440 removelist
="$removelist $p"
3445 if test -n "$removelist"; then
3446 $show "${rm}r $removelist"
3447 $run ${rm}r
$removelist
3451 # Now set the variables for building old libraries.
3452 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience
; then
3453 oldlibs
="$oldlibs $output_objdir/$libname.$libext"
3455 # Transform .lo files to .o files.
3456 oldobjs
="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3459 # Eliminate all temporary directories.
3460 #for path in $notinst_path; do
3461 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3462 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3463 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3466 if test -n "$xrpath"; then
3467 # If the user specified any rpath flags, then add them.
3469 for libdir
in $xrpath; do
3470 temp_xrpath
="$temp_xrpath -R$libdir"
3471 case "$finalize_rpath " in
3473 *) finalize_rpath
="$finalize_rpath $libdir" ;;
3476 if test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes; then
3477 dependency_libs
="$temp_xrpath $dependency_libs"
3481 # Make sure dlfiles contains only unique files that won't be dlpreopened
3482 old_dlfiles
="$dlfiles"
3484 for lib
in $old_dlfiles; do
3485 case " $dlprefiles $dlfiles " in
3487 *) dlfiles
="$dlfiles $lib" ;;
3491 # Make sure dlprefiles contains only unique files
3492 old_dlprefiles
="$dlprefiles"
3494 for lib
in $old_dlprefiles; do
3495 case "$dlprefiles " in
3497 *) dlprefiles
="$dlprefiles $lib" ;;
3501 if test "$build_libtool_libs" = yes; then
3502 if test -n "$rpath"; then
3504 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-*-beos*)
3505 # these systems don't actually have a c library (as such)!
3507 *-*-rhapsody* |
*-*-darwin1.
[012])
3508 # Rhapsody C library is in the System framework
3509 deplibs
="$deplibs -framework System"
3512 # Don't link with libc until the a.out ld.so is fixed.
3514 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
3515 # Do not include libc due to us having libc/libc_r.
3517 *-*-sco3.2v5
* |
*-*-sco5v6*)
3518 # Causes problems with __ctype
3520 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
3521 # Compiler inserts libc in the correct place for threads to work
3524 # Add libc to deplibs on all other systems if necessary.
3525 if test "$build_libtool_need_lc" = "yes"; then
3526 deplibs
="$deplibs -lc"
3532 # Transform deplibs into only deplibs that can be linked in shared.
3534 libname_save
=$libname
3535 release_save
=$release
3536 versuffix_save
=$versuffix
3538 # I'm not sure if I'm treating the release correctly. I think
3539 # release should show up in the -l (ie -lgmp5) so we don't want to
3540 # add it in twice. Is that correct?
3546 case $deplibs_check_method in
3548 # Don't check for shared/static. Everything works.
3549 # This might be a little naive. We might want to check
3550 # whether the library exists or not. But this is on
3551 # osf3 & osf4 and I'm not really sure... Just
3552 # implementing what was already the behavior.
3556 # This code stresses the "libraries are programs" paradigm to its
3557 # limits. Maybe even breaks it. We compile a program, linking it
3558 # against the deplibs as a proxy for the library. Then we can check
3559 # whether they linked in statically or dynamically with ldd.
3561 cat > conftest.c
<<EOF
3562 int main() { return 0; }
3565 if $LTCC $LTCFLAGS -o conftest conftest.c
$deplibs; then
3566 ldd_output
=`ldd conftest`
3567 for i
in $deplibs; do
3568 name
=`expr $i : '-l\(.*\)'`
3569 # If $name is empty we are operating on a -L argument.
3570 if test "$name" != "" && test "$name" != "0"; then
3571 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3572 case " $predeps $postdeps " in
3574 newdeplibs
="$newdeplibs $i"
3579 if test -n "$i" ; then
3580 libname
=`eval \\$echo \"$libname_spec\"`
3581 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3582 set dummy
$deplib_matches
3584 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3585 newdeplibs
="$newdeplibs $i"
3589 $echo "*** Warning: dynamic linker does not accept needed library $i."
3590 $echo "*** I have the capability to make that library automatically link in when"
3591 $echo "*** you link to this library. But I can only do this if you have a"
3592 $echo "*** shared version of the library, which I believe you do not have"
3593 $echo "*** because a test_compile did reveal that the linker did not use it for"
3594 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3598 newdeplibs
="$newdeplibs $i"
3602 # Error occurred in the first compile. Let's try to salvage
3603 # the situation: Compile a separate program for each library.
3604 for i
in $deplibs; do
3605 name
=`expr $i : '-l\(.*\)'`
3606 # If $name is empty we are operating on a -L argument.
3607 if test "$name" != "" && test "$name" != "0"; then
3609 if $LTCC $LTCFLAGS -o conftest conftest.c
$i; then
3610 ldd_output
=`ldd conftest`
3611 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3612 case " $predeps $postdeps " in
3614 newdeplibs
="$newdeplibs $i"
3619 if test -n "$i" ; then
3620 libname
=`eval \\$echo \"$libname_spec\"`
3621 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3622 set dummy
$deplib_matches
3624 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3625 newdeplibs
="$newdeplibs $i"
3629 $echo "*** Warning: dynamic linker does not accept needed library $i."
3630 $echo "*** I have the capability to make that library automatically link in when"
3631 $echo "*** you link to this library. But I can only do this if you have a"
3632 $echo "*** shared version of the library, which you do not appear to have"
3633 $echo "*** because a test_compile did reveal that the linker did not use this one"
3634 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3640 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3641 $echo "*** make it link in! You will probably need to install it or some"
3642 $echo "*** library that it depends on before this library will be fully"
3643 $echo "*** functional. Installing it before continuing would be even better."
3646 newdeplibs
="$newdeplibs $i"
3652 set dummy
$deplibs_check_method
3653 file_magic_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3654 for a_deplib
in $deplibs; do
3655 name
=`expr $a_deplib : '-l\(.*\)'`
3656 # If $name is empty we are operating on a -L argument.
3657 if test "$name" != "" && test "$name" != "0"; then
3658 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3659 case " $predeps $postdeps " in
3661 newdeplibs
="$newdeplibs $a_deplib"
3666 if test -n "$a_deplib" ; then
3667 libname
=`eval \\$echo \"$libname_spec\"`
3668 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3669 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3670 for potent_lib
in $potential_libs; do
3671 # Follow soft links.
3672 if ls -lLd "$potent_lib" 2>/dev
/null \
3673 |
grep " -> " >/dev
/null
; then
3676 # The statement above tries to avoid entering an
3677 # endless loop below, in case of cyclic links.
3678 # We might still enter an endless loop, since a link
3679 # loop can be closed while we follow links,
3681 potlib
="$potent_lib"
3682 while test -h "$potlib" 2>/dev
/null
; do
3683 potliblink
=`ls -ld $potlib | ${SED} 's/.* -> //'`
3685 [\\/]* |
[A-Za-z
]:[\\/]*) potlib
="$potliblink";;
3686 *) potlib
=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3689 if eval $file_magic_cmd \"\
$potlib\" 2>/dev
/null \
3691 |
$EGREP "$file_magic_regex" > /dev
/null
; then
3692 newdeplibs
="$newdeplibs $a_deplib"
3699 if test -n "$a_deplib" ; then
3702 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3703 $echo "*** I have the capability to make that library automatically link in when"
3704 $echo "*** you link to this library. But I can only do this if you have a"
3705 $echo "*** shared version of the library, which you do not appear to have"
3706 $echo "*** because I did check the linker path looking for a file starting"
3707 if test -z "$potlib" ; then
3708 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3710 $echo "*** with $libname and none of the candidates passed a file format test"
3711 $echo "*** using a file magic. Last file checked: $potlib"
3715 # Add a -L argument.
3716 newdeplibs
="$newdeplibs $a_deplib"
3718 done # Gone through all deplibs.
3721 set dummy
$deplibs_check_method
3722 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3723 for a_deplib
in $deplibs; do
3724 name
=`expr $a_deplib : '-l\(.*\)'`
3725 # If $name is empty we are operating on a -L argument.
3726 if test -n "$name" && test "$name" != "0"; then
3727 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3728 case " $predeps $postdeps " in
3730 newdeplibs
="$newdeplibs $a_deplib"
3735 if test -n "$a_deplib" ; then
3736 libname
=`eval \\$echo \"$libname_spec\"`
3737 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3738 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3739 for potent_lib
in $potential_libs; do
3740 potlib
="$potent_lib" # see symlink-check above in file_magic test
3741 if eval $echo \"$potent_lib\" 2>/dev
/null \
3743 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
3744 newdeplibs
="$newdeplibs $a_deplib"
3751 if test -n "$a_deplib" ; then
3754 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3755 $echo "*** I have the capability to make that library automatically link in when"
3756 $echo "*** you link to this library. But I can only do this if you have a"
3757 $echo "*** shared version of the library, which you do not appear to have"
3758 $echo "*** because I did check the linker path looking for a file starting"
3759 if test -z "$potlib" ; then
3760 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3762 $echo "*** with $libname and none of the candidates passed a file format test"
3763 $echo "*** using a regex pattern. Last file checked: $potlib"
3767 # Add a -L argument.
3768 newdeplibs
="$newdeplibs $a_deplib"
3770 done # Gone through all deplibs.
3774 tmp_deplibs
=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3775 -e 's/ -[LR][^ ]*//g'`
3776 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3777 for i
in $predeps $postdeps ; do
3778 # can't use Xsed below, because $i might contain '/'
3779 tmp_deplibs
=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3782 if $echo "X $tmp_deplibs" |
$Xsed -e 's/[ ]//g' \
3783 |
grep .
>/dev
/null
; then
3785 if test "X$deplibs_check_method" = "Xnone"; then
3786 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3788 $echo "*** Warning: inter-library dependencies are not known to be supported."
3790 $echo "*** All declared inter-library dependencies are being dropped."
3795 versuffix
=$versuffix_save
3797 release
=$release_save
3798 libname
=$libname_save
3802 *-*-rhapsody* |
*-*-darwin1.
[012])
3803 # On Rhapsody replace the C library is the System framework
3804 newdeplibs
=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3808 if test "$droppeddeps" = yes; then
3809 if test "$module" = yes; then
3811 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3812 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3813 $echo "*** a static module, that should work as long as the dlopening"
3814 $echo "*** application is linked with the -dlopen flag."
3815 if test -z "$global_symbol_pipe"; then
3817 $echo "*** However, this would only work if libtool was able to extract symbol"
3818 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3819 $echo "*** not find such a program. So, this module is probably useless."
3820 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3822 if test "$build_old_libs" = no
; then
3823 oldlibs
="$output_objdir/$libname.$libext"
3824 build_libtool_libs
=module
3827 build_libtool_libs
=no
3830 $echo "*** The inter-library dependencies that have been dropped here will be"
3831 $echo "*** automatically added whenever a program is linked with this library"
3832 $echo "*** or is declared to -dlopen it."
3834 if test "$allow_undefined" = no
; then
3836 $echo "*** Since this library must not contain undefined symbols,"
3837 $echo "*** because either the platform does not support them or"
3838 $echo "*** it was explicitly requested with -no-undefined,"
3839 $echo "*** libtool will only create a static version of it."
3840 if test "$build_old_libs" = no
; then
3841 oldlibs
="$output_objdir/$libname.$libext"
3842 build_libtool_libs
=module
3845 build_libtool_libs
=no
3850 # Done checking deplibs!
3855 # move library search paths that coincide with paths to not yet
3856 # installed libraries to the beginning of the library search list
3858 for path
in $notinst_path; do
3859 case " $new_libs " in
3860 *" -L$path/$objdir "*) ;;
3862 case " $deplibs " in
3863 *" -L$path/$objdir "*)
3864 new_libs
="$new_libs -L$path/$objdir" ;;
3869 for deplib
in $deplibs; do
3872 case " $new_libs " in
3874 *) new_libs
="$new_libs $deplib" ;;
3877 *) new_libs
="$new_libs $deplib" ;;
3883 # All the library-specific variables (install_libdir is set above).
3888 # Test again, we may have decided not to build it any more
3889 if test "$build_libtool_libs" = yes; then
3890 if test "$hardcode_into_libs" = yes; then
3891 # Hardcode the library paths
3894 rpath
="$finalize_rpath"
3895 test "$mode" != relink
&& rpath
="$compile_rpath$rpath"
3896 for libdir
in $rpath; do
3897 if test -n "$hardcode_libdir_flag_spec"; then
3898 if test -n "$hardcode_libdir_separator"; then
3899 if test -z "$hardcode_libdirs"; then
3900 hardcode_libdirs
="$libdir"
3902 # Just accumulate the unique libdirs.
3903 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3904 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3907 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3912 eval flag
=\"$hardcode_libdir_flag_spec\"
3913 dep_rpath
="$dep_rpath $flag"
3915 elif test -n "$runpath_var"; then
3916 case "$perm_rpath " in
3918 *) perm_rpath
="$perm_rpath $libdir" ;;
3922 # Substitute the hardcoded libdirs into the rpath.
3923 if test -n "$hardcode_libdir_separator" &&
3924 test -n "$hardcode_libdirs"; then
3925 libdir
="$hardcode_libdirs"
3926 if test -n "$hardcode_libdir_flag_spec_ld"; then
3927 case $archive_cmds in
3928 *\
$LD*) eval dep_rpath
=\"$hardcode_libdir_flag_spec_ld\" ;;
3929 *) eval dep_rpath
=\"$hardcode_libdir_flag_spec\" ;;
3932 eval dep_rpath
=\"$hardcode_libdir_flag_spec\"
3935 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3936 # We should set the runpath_var.
3938 for dir
in $perm_rpath; do
3941 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3943 test -n "$dep_rpath" && deplibs
="$dep_rpath $deplibs"
3946 shlibpath
="$finalize_shlibpath"
3947 test "$mode" != relink
&& shlibpath
="$compile_shlibpath$shlibpath"
3948 if test -n "$shlibpath"; then
3949 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3952 # Get the real and link names of the library.
3953 eval shared_ext
=\"$shrext_cmds\"
3954 eval library_names
=\"$library_names_spec\"
3955 set dummy
$library_names
3959 if test -n "$soname_spec"; then
3960 eval soname
=\"$soname_spec\"
3964 if test -z "$dlname"; then
3968 lib
="$output_objdir/$realname"
3972 linknames
="$linknames $link"
3975 # Use standard objects if they are pic
3976 test -z "$pic_flag" && libobjs
=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3978 # Prepare the list of exported symbols
3979 if test -z "$export_symbols"; then
3980 if test "$always_export_symbols" = yes ||
test -n "$export_symbols_regex"; then
3981 $show "generating symbol list for \`$libname.la'"
3982 export_symbols
="$output_objdir/$libname.exp"
3983 $run $rm $export_symbols
3984 cmds
=$export_symbols_cmds
3985 save_ifs
="$IFS"; IFS
='~'
3986 for cmd
in $cmds; do
3989 if len
=`expr "X$cmd" : ".*"` &&
3990 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
3992 $run eval "$cmd" ||
exit $?
3993 skipped_export
=false
3995 # The command line is too long to execute in one step.
3996 $show "using reloadable object file for export list..."
3998 # Break out early, otherwise skipped_export may be
3999 # set to false by a later but shorter cmd.
4004 if test -n "$export_symbols_regex"; then
4005 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4006 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4007 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4008 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4013 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4014 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4018 for test_deplib
in $deplibs; do
4019 case " $convenience " in
4020 *" $test_deplib "*) ;;
4022 tmp_deplibs
="$tmp_deplibs $test_deplib"
4026 deplibs
="$tmp_deplibs"
4028 if test -n "$convenience"; then
4029 if test -n "$whole_archive_flag_spec"; then
4030 save_libobjs
=$libobjs
4031 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4033 gentop
="$output_objdir/${outputname}x"
4034 generated
="$generated $gentop"
4036 func_extract_archives
$gentop $convenience
4037 libobjs
="$libobjs $func_extract_archives_result"
4041 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4042 eval flag
=\"$thread_safe_flag_spec\"
4043 linker_flags
="$linker_flags $flag"
4046 # Make a backup of the uninstalled library when relinking
4047 if test "$mode" = relink
; then
4048 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' ||
exit $?
4051 # Do each of the archive commands.
4052 if test "$module" = yes && test -n "$module_cmds" ; then
4053 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4054 eval test_cmds
=\"$module_expsym_cmds\"
4055 cmds
=$module_expsym_cmds
4057 eval test_cmds
=\"$module_cmds\"
4061 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4062 eval test_cmds
=\"$archive_expsym_cmds\"
4063 cmds
=$archive_expsym_cmds
4065 eval test_cmds
=\"$archive_cmds\"
4070 if test "X$skipped_export" != "X:" &&
4071 len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4072 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
4075 # The command line is too long to link in one step, link piecewise.
4076 $echo "creating reloadable object files..."
4078 # Save the value of $output and $libobjs because we want to
4079 # use them later. If we have whole_archive_flag_spec, we
4080 # want to use save_libobjs as it was before
4081 # whole_archive_flag_spec was expanded, because we can't
4082 # assume the linker understands whole_archive_flag_spec.
4083 # This may have to be revisited, in case too many
4084 # convenience libraries get linked in and end up exceeding
4086 if test -z "$convenience" ||
test -z "$whole_archive_flag_spec"; then
4087 save_libobjs
=$libobjs
4090 output_la
=`$echo "X$output" | $Xsed -e "$basename"`
4092 # Clear the reloadable object creation command queue and
4093 # initialize k to one.
4100 output
=$output_objdir/$output_la-${k}.
$objext
4101 # Loop over the list of objects to be linked.
4102 for obj
in $save_libobjs
4104 eval test_cmds
=\"$reload_cmds $objlist $last_robj\"
4105 if test "X$objlist" = X ||
4106 { len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4107 test "$len" -le "$max_cmd_len"; }; then
4108 objlist
="$objlist $obj"
4110 # The command $test_cmds is almost too long, add a
4111 # command to the queue.
4112 if test "$k" -eq 1 ; then
4113 # The first file doesn't have a previous command to add.
4114 eval concat_cmds
=\"$reload_cmds $objlist $last_robj\"
4116 # All subsequent reloadable object files will link in
4117 # the last one created.
4118 eval concat_cmds
=\"\
$concat_cmds~
$reload_cmds $objlist $last_robj\"
4120 last_robj
=$output_objdir/$output_la-${k}.
$objext
4122 output
=$output_objdir/$output_la-${k}.
$objext
4127 # Handle the remaining objects by creating one last
4128 # reloadable object file. All subsequent reloadable object
4129 # files will link in the last one created.
4130 test -z "$concat_cmds" || concat_cmds
=$concat_cmds~
4131 eval concat_cmds
=\"\
${concat_cmds}$reload_cmds $objlist $last_robj\"
4133 if ${skipped_export-false}; then
4134 $show "generating symbol list for \`$libname.la'"
4135 export_symbols
="$output_objdir/$libname.exp"
4136 $run $rm $export_symbols
4138 # Append the command to create the export file.
4139 eval concat_cmds
=\"\
$concat_cmds~
$export_symbols_cmds\"
4142 # Set up a command to remove the reloadable object files
4143 # after they are used.
4145 while test "$i" -lt "$k"
4148 delfiles
="$delfiles $output_objdir/$output_la-${i}.$objext"
4151 $echo "creating a temporary reloadable object file: $output"
4153 # Loop through the commands generated above and execute them.
4154 save_ifs
="$IFS"; IFS
='~'
4155 for cmd
in $concat_cmds; do
4158 $run eval "$cmd" ||
exit $?
4163 # Restore the value of output.
4166 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4167 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4169 # Expand the library linking commands again to reset the
4170 # value of $libobjs for piecewise linking.
4172 # Do each of the archive commands.
4173 if test "$module" = yes && test -n "$module_cmds" ; then
4174 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4175 cmds
=$module_expsym_cmds
4180 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4181 cmds
=$archive_expsym_cmds
4187 # Append the command to remove the reloadable object files
4188 # to the just-reset $cmds.
4189 eval cmds
=\"\
$cmds~\
$rm $delfiles\"
4191 save_ifs
="$IFS"; IFS
='~'
4192 for cmd
in $cmds; do
4196 $run eval "$cmd" ||
{
4199 # Restore the uninstalled library and exit
4200 if test "$mode" = relink
; then
4201 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4209 # Restore the uninstalled library and exit
4210 if test "$mode" = relink
; then
4211 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' ||
exit $?
4213 if test -n "$convenience"; then
4214 if test -z "$whole_archive_flag_spec"; then
4215 $show "${rm}r $gentop"
4216 $run ${rm}r
"$gentop"
4223 # Create links to the real library.
4224 for linkname
in $linknames; do
4225 if test "$realname" != "$linkname"; then
4226 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4227 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' ||
exit $?
4231 # If -module or -export-dynamic was specified, set the dlname.
4232 if test "$module" = yes ||
test "$export_dynamic" = yes; then
4233 # On all known operating systems, these are identical.
4240 if test -n "$deplibs"; then
4241 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4244 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4245 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4248 if test -n "$rpath"; then
4249 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4252 if test -n "$xrpath"; then
4253 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4256 if test -n "$vinfo"; then
4257 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4260 if test -n "$release"; then
4261 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4266 if test -n "$objs$old_deplibs"; then
4267 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4271 obj
=`$echo "X$output" | $Xsed -e "$lo2o"`
4279 # Delete the old objects.
4280 $run $rm $obj $libobj
4282 # Objects from convenience libraries. This assumes
4283 # single-version convenience libraries. Whenever we create
4284 # different ones for PIC/non-PIC, this we'll have to duplicate
4288 # reload_cmds runs $LD directly, so let us get rid of
4289 # -Wl from whole_archive_flag_spec and hope we can get by with
4290 # turning comma into space..
4293 if test -n "$convenience"; then
4294 if test -n "$whole_archive_flag_spec"; then
4295 eval tmp_whole_archive_flags
=\"$whole_archive_flag_spec\"
4296 reload_conv_objs
=$reload_objs\
`$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4298 gentop
="$output_objdir/${obj}x"
4299 generated
="$generated $gentop"
4301 func_extract_archives
$gentop $convenience
4302 reload_conv_objs
="$reload_objs $func_extract_archives_result"
4306 # Create the old-style object.
4307 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
4311 save_ifs
="$IFS"; IFS
='~'
4312 for cmd
in $cmds; do
4316 $run eval "$cmd" ||
exit $?
4320 # Exit if we aren't doing a library object file.
4321 if test -z "$libobj"; then
4322 if test -n "$gentop"; then
4323 $show "${rm}r $gentop"
4330 if test "$build_libtool_libs" != yes; then
4331 if test -n "$gentop"; then
4332 $show "${rm}r $gentop"
4336 # Create an invalid libtool object if no PIC, so that we don't
4337 # accidentally link it into a program.
4338 # $show "echo timestamp > $libobj"
4339 # $run eval "echo timestamp > $libobj" || exit $?
4343 if test -n "$pic_flag" ||
test "$pic_mode" != default
; then
4344 # Only do commands if we really have different PIC objects.
4345 reload_objs
="$libobjs $reload_conv_objs"
4348 save_ifs
="$IFS"; IFS
='~'
4349 for cmd
in $cmds; do
4353 $run eval "$cmd" ||
exit $?
4358 if test -n "$gentop"; then
4359 $show "${rm}r $gentop"
4368 *cygwin
*) output
=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4370 if test -n "$vinfo"; then
4371 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4374 if test -n "$release"; then
4375 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4378 if test "$preload" = yes; then
4379 if test "$dlopen_support" = unknown
&& test "$dlopen_self" = unknown
&&
4380 test "$dlopen_self_static" = unknown
; then
4381 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4386 *-*-rhapsody* |
*-*-darwin1.
[012])
4387 # On Rhapsody replace the C library is the System framework
4388 compile_deplibs
=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4389 finalize_deplibs
=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4395 # Don't allow lazy linking, it breaks C++ global constructors
4396 if test "$tagname" = CXX
; then
4397 compile_command
="$compile_command ${wl}-bind_at_load"
4398 finalize_command
="$finalize_command ${wl}-bind_at_load"
4404 # move library search paths that coincide with paths to not yet
4405 # installed libraries to the beginning of the library search list
4407 for path
in $notinst_path; do
4408 case " $new_libs " in
4409 *" -L$path/$objdir "*) ;;
4411 case " $compile_deplibs " in
4412 *" -L$path/$objdir "*)
4413 new_libs
="$new_libs -L$path/$objdir" ;;
4418 for deplib
in $compile_deplibs; do
4421 case " $new_libs " in
4423 *) new_libs
="$new_libs $deplib" ;;
4426 *) new_libs
="$new_libs $deplib" ;;
4429 compile_deplibs
="$new_libs"
4432 compile_command
="$compile_command $compile_deplibs"
4433 finalize_command
="$finalize_command $finalize_deplibs"
4435 if test -n "$rpath$xrpath"; then
4436 # If the user specified any rpath flags, then add them.
4437 for libdir
in $rpath $xrpath; do
4438 # This is the magic to use -rpath.
4439 case "$finalize_rpath " in
4441 *) finalize_rpath
="$finalize_rpath $libdir" ;;
4446 # Now hardcode the library paths
4449 for libdir
in $compile_rpath $finalize_rpath; do
4450 if test -n "$hardcode_libdir_flag_spec"; then
4451 if test -n "$hardcode_libdir_separator"; then
4452 if test -z "$hardcode_libdirs"; then
4453 hardcode_libdirs
="$libdir"
4455 # Just accumulate the unique libdirs.
4456 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4457 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4460 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4465 eval flag
=\"$hardcode_libdir_flag_spec\"
4466 rpath
="$rpath $flag"
4468 elif test -n "$runpath_var"; then
4469 case "$perm_rpath " in
4471 *) perm_rpath
="$perm_rpath $libdir" ;;
4475 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
4476 testbindir
=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4477 case :$dllsearchpath: in
4479 *) dllsearchpath
="$dllsearchpath:$libdir";;
4481 case :$dllsearchpath: in
4482 *":$testbindir:"*) ;;
4483 *) dllsearchpath
="$dllsearchpath:$testbindir";;
4488 # Substitute the hardcoded libdirs into the rpath.
4489 if test -n "$hardcode_libdir_separator" &&
4490 test -n "$hardcode_libdirs"; then
4491 libdir
="$hardcode_libdirs"
4492 eval rpath
=\" $hardcode_libdir_flag_spec\"
4494 compile_rpath
="$rpath"
4498 for libdir
in $finalize_rpath; do
4499 if test -n "$hardcode_libdir_flag_spec"; then
4500 if test -n "$hardcode_libdir_separator"; then
4501 if test -z "$hardcode_libdirs"; then
4502 hardcode_libdirs
="$libdir"
4504 # Just accumulate the unique libdirs.
4505 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4506 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4509 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4514 eval flag
=\"$hardcode_libdir_flag_spec\"
4515 rpath
="$rpath $flag"
4517 elif test -n "$runpath_var"; then
4518 case "$finalize_perm_rpath " in
4520 *) finalize_perm_rpath
="$finalize_perm_rpath $libdir" ;;
4524 # Substitute the hardcoded libdirs into the rpath.
4525 if test -n "$hardcode_libdir_separator" &&
4526 test -n "$hardcode_libdirs"; then
4527 libdir
="$hardcode_libdirs"
4528 eval rpath
=\" $hardcode_libdir_flag_spec\"
4530 finalize_rpath
="$rpath"
4532 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4533 # Transform all the library objects into standard objects.
4534 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4535 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4539 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4540 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4541 dlsyms
="${outputname}S.c"
4543 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4547 if test -n "$dlsyms"; then
4551 # Discover the nlist of each of the dlfiles.
4552 nlist
="$output_objdir/${outputname}.nm"
4554 $show "$rm $nlist ${nlist}S ${nlist}T"
4555 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4557 # Parse the name list into a source file.
4558 $show "creating $output_objdir/$dlsyms"
4560 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4561 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4562 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4568 /* Prevent the only kind of declaration conflicts we can make. */
4569 #define lt_preloaded_symbols some_other_symbol
4571 /* External symbol declarations for the compiler. */\
4574 if test "$dlself" = yes; then
4575 $show "generating symbol list for \`$output'"
4577 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4579 # Add our own program objects to the symbol list.
4580 progfiles
=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4581 for arg
in $progfiles; do
4582 $show "extracting global C symbols from \`$arg'"
4583 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4586 if test -n "$exclude_expsyms"; then
4587 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4588 $run eval '$mv "$nlist"T "$nlist"'
4591 if test -n "$export_symbols_regex"; then
4592 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4593 $run eval '$mv "$nlist"T "$nlist"'
4596 # Prepare the list of exported symbols
4597 if test -z "$export_symbols"; then
4598 export_symbols
="$output_objdir/$outputname.exp"
4599 $run $rm $export_symbols
4600 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4602 *cygwin
* |
*mingw
* )
4603 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4604 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4608 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4609 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4610 $run eval 'mv "$nlist"T "$nlist"'
4612 *cygwin
* |
*mingw
* )
4613 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4614 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4620 for arg
in $dlprefiles; do
4621 $show "extracting global C symbols from \`$arg'"
4622 name
=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4623 $run eval '$echo ": $name " >> "$nlist"'
4624 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4627 if test -z "$run"; then
4628 # Make sure we have at least an empty file.
4629 test -f "$nlist" ||
: > "$nlist"
4631 if test -n "$exclude_expsyms"; then
4632 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4633 $mv "$nlist"T
"$nlist"
4636 # Try sorting and uniquifying the output.
4637 if grep -v "^: " < "$nlist" |
4638 if sort -k 3 </dev
/null
>/dev
/null
2>&1; then
4643 uniq > "$nlist"S
; then
4646 grep -v "^: " < "$nlist" > "$nlist"S
4649 if test -f "$nlist"S
; then
4650 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4652 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4655 $echo >> "$output_objdir/$dlsyms" "\
4657 #undef lt_preloaded_symbols
4659 #if defined (__STDC__) && __STDC__
4660 # define lt_ptr void *
4662 # define lt_ptr char *
4666 /* The mapping between symbol names and symbols. */
4670 *cygwin
* |
*mingw
* )
4671 $echo >> "$output_objdir/$dlsyms" "\
4672 /* DATA imports from DLLs on WIN32 can't be const, because
4673 runtime relocations are performed -- see ld's documentation
4679 $echo >> "$output_objdir/$dlsyms" "\
4686 $echo >> "$output_objdir/$dlsyms" "\
4690 lt_preloaded_symbols[] =
4694 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4696 $echo >> "$output_objdir/$dlsyms" "\
4700 /* This works around a problem in FreeBSD linker */
4701 #ifdef FREEBSD_WORKAROUND
4702 static const void *lt_preloaded_setup() {
4703 return lt_preloaded_symbols;
4713 pic_flag_for_symtable
=
4715 # compiling the symbol table file with pic_flag works around
4716 # a FreeBSD bug that causes programs to crash when -lm is
4717 # linked before any other PIC object. But we must not use
4718 # pic_flag when linking with -static. The problem exists in
4719 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4720 *-*-freebsd2*|
*-*-freebsd3.0
*|
*-*-freebsdelf3.0
*)
4721 case "$compile_command " in
4723 *) pic_flag_for_symtable
=" $pic_flag -DFREEBSD_WORKAROUND";;
4726 case "$compile_command " in
4728 *) pic_flag_for_symtable
=" $pic_flag";;
4732 # Now compile the dynamic symbol file.
4733 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4734 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' ||
exit $?
4736 # Clean up the generated files.
4737 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4738 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4740 # Transform the symbol file into the correct name.
4742 *cygwin
* |
*mingw
* )
4743 if test -f "$output_objdir/${outputname}.def" ; then
4744 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4745 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4747 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4748 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4752 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4753 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4758 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4763 # We keep going just in case the user didn't refer to
4764 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4765 # really was required.
4767 # Nullify the symbol file.
4768 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4769 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4772 if test "$need_relink" = no ||
test "$build_libtool_libs" != yes; then
4773 # Replace the output file specification.
4774 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4775 link_command
="$compile_command$compile_rpath"
4777 # We have no uninstalled library dependencies, so finalize right now.
4778 $show "$link_command"
4779 $run eval "$link_command"
4782 # Delete the generated files.
4783 if test -n "$dlsyms"; then
4784 $show "$rm $output_objdir/${outputname}S.${objext}"
4785 $run $rm "$output_objdir/${outputname}S.${objext}"
4791 if test -n "$shlibpath_var"; then
4792 # We should set the shlibpath_var
4794 for dir
in $temp_rpath; do
4796 [\\/]* |
[A-Za-z
]:[\\/]*)
4801 # Relative path: add a thisdir entry.
4802 rpath
="$rpath\$thisdir/$dir:"
4809 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4810 compile_command
="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4812 if test -n "$finalize_shlibpath"; then
4813 finalize_command
="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4818 if test -n "$runpath_var"; then
4819 if test -n "$perm_rpath"; then
4820 # We should set the runpath_var.
4822 for dir
in $perm_rpath; do
4825 compile_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4827 if test -n "$finalize_perm_rpath"; then
4828 # We should set the runpath_var.
4830 for dir
in $finalize_perm_rpath; do
4833 finalize_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4837 if test "$no_install" = yes; then
4838 # We don't need to create a wrapper script.
4839 link_command
="$compile_var$compile_command$compile_rpath"
4840 # Replace the output file specification.
4841 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4842 # Delete the old output file.
4844 # Link the executable and exit
4845 $show "$link_command"
4846 $run eval "$link_command" ||
exit $?
4850 if test "$hardcode_action" = relink
; then
4851 # Fast installation is not supported
4852 link_command
="$compile_var$compile_command$compile_rpath"
4853 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4855 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4856 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4858 if test "$fast_install" != no
; then
4859 link_command
="$finalize_var$compile_command$finalize_rpath"
4860 if test "$fast_install" = yes; then
4861 relink_command
=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4863 # fast_install is set to needless
4867 link_command
="$compile_var$compile_command$compile_rpath"
4868 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4872 # Replace the output file specification.
4873 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4875 # Delete the old output files.
4876 $run $rm $output $output_objdir/$outputname $output_objdir/lt-
$outputname
4878 $show "$link_command"
4879 $run eval "$link_command" ||
exit $?
4881 # Now create the wrapper script.
4882 $show "creating $output"
4884 # Quote the relink command for shipping.
4885 if test -n "$relink_command"; then
4886 # Preserve any variables that may affect compiler behavior
4887 for var
in $variables_saved_for_relink; do
4888 if eval test -z \"\
${$var+set}\"; then
4889 relink_command
="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4890 elif eval var_value
=\$
$var; test -z "$var_value"; then
4891 relink_command
="$var=; export $var; $relink_command"
4893 var_value
=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4894 relink_command
="$var=\"$var_value\"; export $var; $relink_command"
4897 relink_command
="(cd `pwd`; $relink_command)"
4898 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4901 # Quote $echo for shipping.
4902 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4904 [\\/]* |
[A-Za-z
]:[\\/]*) qecho
="$SHELL $progpath --fallback-echo";;
4905 *) qecho
="$SHELL `pwd`/$progpath --fallback-echo";;
4907 qecho
=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4909 qecho
=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4912 # Only actually do things if our run command is non-null.
4913 if test -z "$run"; then
4914 # win32 will think the script is a binary if it has
4915 # a .exe suffix, so we strip it off here.
4917 *.exe
) output
=`$echo $output|${SED} 's,.exe$,,'` ;;
4919 # test for cygwin because mv fails w/o .exe extensions
4923 outputname
=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4927 *cygwin
* |
*mingw
* )
4928 output_name
=`basename $output`
4929 output_path
=`dirname $output`
4930 cwrappersource
="$output_path/$objdir/lt-$output_name.c"
4931 cwrapper
="$output_path/$output_name.exe"
4932 $rm $cwrappersource $cwrapper
4933 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4935 cat > $cwrappersource <<EOF
4937 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4938 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4940 The $output program cannot be directly executed until all the libtool
4941 libraries that it depends on are installed.
4943 This wrapper executable should never be moved out of the build directory.
4944 If it is, it will not operate correctly.
4946 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4947 but could eventually absorb all of the scripts functionality and
4948 exec $objdir/$outputname directly.
4951 cat >> $cwrappersource<<"EOF"
4960 #include <sys/stat.h>
4962 #if defined(PATH_MAX)
4963 # define LT_PATHMAX PATH_MAX
4964 #elif defined(MAXPATHLEN)
4965 # define LT_PATHMAX MAXPATHLEN
4967 # define LT_PATHMAX 1024
4970 #ifndef DIR_SEPARATOR
4971 # define DIR_SEPARATOR '/'
4972 # define PATH_SEPARATOR ':'
4975 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4977 # define HAVE_DOS_BASED_FILE_SYSTEM
4978 # ifndef DIR_SEPARATOR_2
4979 # define DIR_SEPARATOR_2 '\\'
4981 # ifndef PATH_SEPARATOR_2
4982 # define PATH_SEPARATOR_2 ';'
4986 #ifndef DIR_SEPARATOR_2
4987 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4988 #else /* DIR_SEPARATOR_2 */
4989 # define IS_DIR_SEPARATOR(ch) \
4990 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4991 #endif /* DIR_SEPARATOR_2 */
4993 #ifndef PATH_SEPARATOR_2
4994 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4995 #else /* PATH_SEPARATOR_2 */
4996 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4997 #endif /* PATH_SEPARATOR_2 */
4999 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5000 #define XFREE(stale) do { \
5001 if (stale) { free ((void *) stale); stale = 0; } \
5004 /* -DDEBUG is fairly common in CFLAGS. */
5006 #if defined DEBUGWRAPPER
5007 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5009 # define DEBUG(format, ...)
5012 const char *program_name = NULL;
5014 void * xmalloc (size_t num);
5015 char * xstrdup (const char *string);
5016 const char * base_name (const char *name);
5017 char * find_executable(const char *wrapper);
5018 int check_executable(const char *path);
5019 char * strendzap(char *str, const char *pat);
5020 void lt_fatal (const char *message, ...);
5023 main (int argc, char *argv[])
5028 program_name = (char *) xstrdup (base_name (argv[0]));
5029 DEBUG("(main) argv[0] : %s\n",argv[0]);
5030 DEBUG("(main) program_name : %s\n",program_name);
5031 newargz = XMALLOC(char *, argc+2);
5034 cat >> $cwrappersource <<EOF
5035 newargz[0] = (char *) xstrdup("$SHELL");
5038 cat >> $cwrappersource <<"EOF"
5039 newargz
[1] = find_executable
(argv
[0]);
5040 if (newargz
[1] == NULL
)
5041 lt_fatal
("Couldn't find %s", argv
[0]);
5042 DEBUG
("(main) found exe at : %s\n",newargz
[1]);
5043 /* we know the
script has the same name
, without the .exe
*/
5044 /* so
make sure newargz
[1] doesn
't end in .exe */
5045 strendzap(newargz[1],".exe");
5046 for (i = 1; i < argc; i++)
5047 newargz[i+1] = xstrdup(argv[i]);
5048 newargz[argc+1] = NULL;
5050 for (i=0; i<argc+1; i++)
5052 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5060 cat >> $cwrappersource <<EOF
5061 execv("$SHELL",(char const **)newargz);
5065 cat >> $cwrappersource <<EOF
5066 execv("$SHELL",newargz);
5071 cat >> $cwrappersource <<"EOF"
5076 xmalloc (size_t num)
5078 void * p = (void *) malloc (num);
5080 lt_fatal ("Memory exhausted");
5086 xstrdup (const char *string)
5088 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5093 base_name (const char *name)
5097 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5098 /* Skip over the disk name in MSDOS pathnames. */
5099 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5103 for (base = name; *name; name++)
5104 if (IS_DIR_SEPARATOR (*name))
5110 check_executable(const char * path)
5114 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5115 if ((!path) || (!*path))
5118 if ((stat (path, &st) >= 0) &&
5120 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5121 #if defined (S_IXOTH)
5122 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5124 #if defined (S_IXGRP)
5125 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5127 ((st.st_mode & S_IXUSR) == S_IXUSR))
5134 /* Searches for the full path of the wrapper. Returns
5135 newly allocated full path name if found, NULL otherwise */
5137 find_executable (const char* wrapper)
5142 /* static buffer for getcwd */
5143 char tmp[LT_PATHMAX + 1];
5147 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5149 if ((wrapper == NULL) || (*wrapper == '\
0'))
5152 /* Absolute path? */
5153 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5154 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5156 concat_name = xstrdup (wrapper);
5157 if (check_executable(concat_name))
5164 if (IS_DIR_SEPARATOR (wrapper[0]))
5166 concat_name = xstrdup (wrapper);
5167 if (check_executable(concat_name))
5171 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5175 for (p = wrapper; *p; p++)
5183 /* no slashes; search PATH */
5184 const char* path = getenv ("PATH");
5187 for (p = path; *p; p = p_next)
5191 for (q = p; *q; q++)
5192 if (IS_PATH_SEPARATOR(*q))
5195 p_next = (*q == '\
0' ? q : q + 1);
5198 /* empty path: current directory */
5199 if (getcwd (tmp, LT_PATHMAX) == NULL)
5200 lt_fatal ("getcwd failed");
5201 tmp_len = strlen(tmp);
5202 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5203 memcpy (concat_name, tmp, tmp_len);
5204 concat_name[tmp_len] = '/';
5205 strcpy (concat_name + tmp_len + 1, wrapper);
5209 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5210 memcpy (concat_name, p, p_len);
5211 concat_name[p_len] = '/';
5212 strcpy (concat_name + p_len + 1, wrapper);
5214 if (check_executable(concat_name))
5219 /* not found in PATH; assume curdir */
5221 /* Relative path | not found in path: prepend cwd */
5222 if (getcwd (tmp, LT_PATHMAX) == NULL)
5223 lt_fatal ("getcwd failed");
5224 tmp_len = strlen(tmp);
5225 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5226 memcpy (concat_name, tmp, tmp_len);
5227 concat_name[tmp_len] = '/';
5228 strcpy (concat_name + tmp_len + 1, wrapper);
5230 if (check_executable(concat_name))
5237 strendzap(char *str, const char *pat)
5241 assert(str != NULL);
5242 assert(pat != NULL);
5245 patlen = strlen(pat);
5249 str += len - patlen;
5250 if (strcmp(str, pat) == 0)
5257 lt_error_core (int exit_status, const char * mode,
5258 const char * message, va_list ap)
5260 fprintf (stderr, "%s: %s: ", program_name, mode);
5261 vfprintf (stderr, message, ap);
5262 fprintf (stderr, ".\n");
5264 if (exit_status >= 0)
5269 lt_fatal (const char *message, ...)
5272 va_start (ap, message);
5273 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5277 # we should really use a build-platform specific compiler
5278 # here, but OTOH, the wrappers (shell script and this C one)
5279 # are only useful if you want to execute the "real" binary.
5280 # Since the "real" binary is built for $host, then this
5281 # wrapper might as well be built for $host, too.
5282 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5286 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5291 # $output - temporary wrapper script for $objdir/$outputname
5292 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5294 # The $output program cannot be directly executed until all the libtool
5295 # libraries that it depends on are installed.
5297 # This wrapper script should never be moved out of the build directory.
5298 # If it is, it will not operate correctly.
5300 # Sed substitution that helps us do robust quoting. It backslashifies
5301 # metacharacters that are still active within double-quoted strings.
5302 Xsed='${SED} -e 1s
/^X
//'
5303 sed_quote_subst='$sed_quote_subst'
5305 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5306 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5309 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5310 # is contrary to our usage. Disable this feature.
5311 alias -g '\
${1+\"\$@\"}'='\"\$@
\"'
5312 setopt NO_GLOB_SUBST
5314 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5316 BIN_SH=xpg4; export BIN_SH # for Tru64
5317 DUALCASE=1; export DUALCASE # for MKS sh
5319 # The HP-UX ksh and POSIX shell print the target directory to stdout
5321 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5323 relink_command=\"$relink_command\"
5325 # This environment variable determines our operation mode.
5326 if test \"\$libtool_install_magic\" = \"$magic\"; then
5327 # install mode needs the following variable:
5328 notinst_deplibs='$notinst_deplibs'
5330 # When we are sourced in execute mode, \$file and \$echo are already set.
5331 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5334 # Make sure echo works.
5335 if test \"X\$1\" = X--no-reexec; then
5336 # Discard the --no-reexec flag, and continue.
5338 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X
\t'; then
5339 # Yippee, \$echo works!
5342 # Restart under the correct shell, and then maybe \$echo will work.
5343 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5349 # Find the directory that this script lives in.
5350 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*$
%%'\`
5351 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5353 # Follow symbolic links until we get to the real thisdir.
5354 file=\`ls -ld \"\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5355 while test -n \"\$file\"; do
5356 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*\$
%%'\`
5358 # If there was a directory component, then change thisdir.
5359 if test \"x\$destdir\" != \"x\$file\"; then
5360 case \"\$destdir\" in
5361 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5362 *) thisdir=\"\$thisdir/\$destdir\" ;;
5366 file=\`\$echo \"X\$file\" | \$Xsed -e 's
%^.
*/%%'\`
5367 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5370 # Try to get the absolute directory name.
5371 absdir=\`cd \"\$thisdir\" && pwd\`
5372 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5375 if test "$fast_install" = yes; then
5377 program=lt-'$outputname'$exeext
5378 progdir=\"\$thisdir/$objdir\"
5380 if test ! -f \"\$progdir/\$program\" || \\
5381 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5382 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5384 file=\"\$\$-\$program\"
5386 if test ! -d \"\$progdir\"; then
5387 $mkdir \"\$progdir\"
5389 $rm \"\$progdir/\$file\"
5394 # relink executable if necessary
5395 if test -n \"\$relink_command\"; then
5396 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5398 $echo \"\$relink_command_output\" >&2
5399 $rm \"\$progdir/\$file\"
5404 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5405 { $rm \"\$progdir/\$program\";
5406 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5407 $rm \"\$progdir/\$file\"
5411 program='$outputname'
5412 progdir=\"\$thisdir/$objdir\"
5418 if test -f \"\$progdir/\$program\"; then"
5420 # Export our shlibpath_var if we have one.
5421 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5423 # Add our own library path to $shlibpath_var
5424 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5426 # Some systems cannot cope with colon-terminated $shlibpath_var
5427 # The second colon is a workaround for a bug in BeOS R4 sed
5428 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's
/::*\$
//'\`
5430 export $shlibpath_var
5434 # fixup the dll searchpath if we need to.
5435 if test -n "$dllsearchpath"; then
5437 # Add the dll search path components to the executable PATH
5438 PATH=$dllsearchpath:\$PATH
5443 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5444 # Run the actual program with our arguments.
5447 # Backslashes separate directories on plain windows
5448 *-*-mingw | *-*-os2*)
5450 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5456 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5461 \$echo \"\$0: cannot exec \$program \$*\"
5465 # The program doesn't exist.
5466 \
$echo \"\
$0: error
: \\\
`\$progdir/\$program' does not exist\" 1>&2
5467 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5468 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5479 # See if we need to build an old-fashioned archive.
5480 for oldlib in $oldlibs; do
5482 if test "$build_libtool_libs" = convenience; then
5483 oldobjs="$libobjs_save"
5484 addlibs="$convenience"
5485 build_libtool_libs=no
5487 if test "$build_libtool_libs" = module; then
5488 oldobjs="$libobjs_save"
5489 build_libtool_libs=no
5491 oldobjs="$old_deplibs $non_pic_objects"
5493 addlibs="$old_convenience"
5496 if test -n "$addlibs"; then
5497 gentop="$output_objdir/${outputname}x"
5498 generated="$generated $gentop"
5500 func_extract_archives $gentop $addlibs
5501 oldobjs="$oldobjs $func_extract_archives_result"
5504 # Do each command in the archive commands.
5505 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5506 cmds=$old_archive_from_new_cmds
5508 # POSIX demands no paths to be encoded in archives. We have
5509 # to avoid creating archives with duplicate basenames if we
5510 # might have to extract them afterwards, e.g., when creating a
5511 # static archive out of a convenience library, or when linking
5512 # the entirety of a libtool archive into another (currently
5513 # not supported by libtool).
5514 if (for obj in $oldobjs
5516 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5517 done | sort | sort -uc >/dev/null 2>&1); then
5520 $echo "copying selected object files to avoid basename conflicts..."
5522 if test -z "$gentop"; then
5523 gentop="$output_objdir/${outputname}x"
5524 generated="$generated $gentop"
5526 $show "${rm}r $gentop"
5527 $run ${rm}r "$gentop"
5528 $show "$mkdir $gentop"
5529 $run $mkdir "$gentop"
5531 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5536 save_oldobjs=$oldobjs
5539 for obj in $save_oldobjs
5541 objbase=`$echo "X$obj" |
$Xsed -e 's%^.*/%%'`
5542 case " $oldobjs " in
5543 " ") oldobjs=$obj ;;
5546 # Make sure we don't pick an alternate name that also
5548 newobj=lt$counter-$objbase
5549 counter=`expr $counter + 1`
5550 case " $oldobjs " in
5551 *[\ /]"$newobj "*) ;;
5552 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5555 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5556 $run ln "$obj" "$gentop/$newobj" ||
5557 $run cp "$obj" "$gentop/$newobj"
5558 oldobjs="$oldobjs $gentop/$newobj"
5560 *) oldobjs="$oldobjs $obj" ;;
5565 eval cmds=\"$old_archive_cmds\"
5567 if len=`expr "X$cmds" : ".*"` &&
5568 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5569 cmds=$old_archive_cmds
5571 # the command line is too long to link in one step, link in parts
5572 $echo "using piecewise archive linking..."
5577 save_oldobjs=$oldobjs
5579 # Is there a better way of finding the last object in the list?
5580 for obj in $save_oldobjs
5584 for obj in $save_oldobjs
5586 oldobjs="$objlist $obj"
5587 objlist="$objlist $obj"
5588 eval test_cmds=\"$old_archive_cmds\"
5589 if len=`expr "X$test_cmds" : ".*" 2>/dev
/null
` &&
5590 test "$len" -le "$max_cmd_len"; then
5593 # the above command should be used before it gets too long
5595 if test "$obj" = "$last_oldobj" ; then
5598 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5599 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5605 if test "X$oldobjs" = "X" ; then
5606 eval cmds=\"\$concat_cmds\"
5608 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5612 save_ifs="$IFS"; IFS='~'
5613 for cmd in $cmds; do
5617 $run eval "$cmd" || exit $?
5622 if test -n "$generated"; then
5623 $show "${rm}r$generated"
5624 $run ${rm}r$generated
5627 # Now create the libtool archive.
5631 test "$build_old_libs" = yes && old_library="$libname.$libext"
5632 $show "creating $output"
5634 # Preserve any variables that may affect compiler behavior
5635 for var in $variables_saved_for_relink; do
5636 if eval test -z \"\${$var+set}\"; then
5637 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5638 elif eval var_value=\$$var; test -z "$var_value"; then
5639 relink_command="$var=; export $var; $relink_command"
5641 var_value=`$echo "X$var_value" |
$Xsed -e "$sed_quote_subst"`
5642 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5645 # Quote the link command for shipping.
5646 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5647 relink_command=`$echo "X$relink_command" |
$SP2NL |
$Xsed -e "$sed_quote_subst" |
$NL2SP`
5648 if test "$hardcode_automatic" = yes ; then
5653 # Only create the output if not a dry run.
5654 if test -z "$run"; then
5655 for installed in no yes; do
5656 if test "$installed" = yes; then
5657 if test -z "$install_libdir"; then
5660 output="$output_objdir/$outputname"i
5661 # Replace all uninstalled libtool libraries with the installed ones
5663 for deplib in $dependency_libs; do
5666 name=`$echo "X$deplib" |
$Xsed -e 's%^.*/%%'`
5667 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5668 if test -z "$libdir"; then
5669 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5672 newdependency_libs="$newdependency_libs $libdir/$name"
5674 *) newdependency_libs="$newdependency_libs $deplib" ;;
5677 dependency_libs="$newdependency_libs"
5679 for lib in $dlfiles; do
5680 name=`$echo "X$lib" | $Xsed -e 's
%^.
*/%%'`
5681 eval libdir=`${SED} -n -e 's
/^libdir
=\
(.
*\
)$
/\
1/p
' $lib`
5682 if test -z "$libdir"; then
5683 $echo "$modename: \`$lib' is not a valid libtool archive
" 1>&2
5686 newdlfiles="$newdlfiles $libdir/$name"
5688 dlfiles="$newdlfiles"
5690 for lib in $dlprefiles; do
5691 name=`$echo "X
$lib" | $Xsed -e 's%^.*/%%'`
5692 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5693 if test -z "$libdir"; then
5694 $echo "$modename: \
`$lib' is not a valid libtool archive" 1>&2
5697 newdlprefiles="$newdlprefiles $libdir/$name"
5699 dlprefiles="$newdlprefiles"
5702 for lib in $dlfiles; do
5704 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5705 *) abs=`pwd`"/$lib" ;;
5707 newdlfiles="$newdlfiles $abs"
5709 dlfiles="$newdlfiles"
5711 for lib in $dlprefiles; do
5713 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5714 *) abs=`pwd`"/$lib" ;;
5716 newdlprefiles="$newdlprefiles $abs"
5718 dlprefiles="$newdlprefiles"
5721 # place dlname in correct position for cygwin
5723 case $host,$output,$installed,$module,$dlname in
5724 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5727 # $outputname - a libtool library file
5728 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5730 # Please DO NOT delete this file!
5731 # It is necessary for linking the library.
5733 # The name that we can dlopen(3).
5736 # Names of this library.
5737 library_names='$library_names'
5739 # The name of the static archive.
5740 old_library='$old_library'
5742 # Libraries that this one depends upon.
5743 dependency_libs='$dependency_libs'
5745 # Version information for $libname.
5750 # Is this an already installed library?
5751 installed=$installed
5753 # Should we warn about portability when linking against -modules?
5754 shouldnotlink=$module
5756 # Files to dlopen/dlpreopen
5758 dlpreopen='$dlprefiles'
5760 # Directory that this library needs to be installed in:
5761 libdir='$install_libdir'"
5762 if test "$installed" = no && test "$need_relink" = yes; then
5764 relink_command=\"$relink_command\""
5769 # Do a symbolic link so that the libtool archive can be found in
5770 # LD_LIBRARY_PATH before the program is installed.
5771 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5772 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5778 # libtool install mode
5780 modename="$modename: install"
5782 # There may be an optional sh(1) argument at the beginning of
5783 # install_prog (especially on Windows NT).
5784 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5785 # Allow the use of GNU shtool's install command.
5786 $echo "X$nonopt" | grep shtool > /dev/null; then
5787 # Aesthetically quote it.
5788 arg=`$echo "X$nonopt" |
$Xsed -e "$sed_quote_subst"`
5790 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5794 install_prog="$arg "
5802 # The real first argument should be the name of the installation program.
5803 # Aesthetically quote it.
5804 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5806 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5810 install_prog="$install_prog$arg"
5812 # We need to accept at least all the BSD install flags.
5822 if test -n "$dest"; then
5823 files="$files $dest"
5831 case " $install_prog " in
5836 -g | -m | -o) prev=$arg ;;
5844 # If the previous option needed an argument, then skip it.
5845 if test -n "$prev"; then
5854 # Aesthetically quote the argument.
5855 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5857 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5861 install_prog="$install_prog $arg"
5864 if test -z "$install_prog"; then
5865 $echo "$modename: you must specify an install program" 1>&2
5870 if test -n "$prev"; then
5871 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5876 if test -z "$files"; then
5877 if test -z "$dest"; then
5878 $echo "$modename: no file or destination specified" 1>&2
5880 $echo "$modename: you must specify a destination" 1>&2
5886 # Strip any trailing slash from the destination.
5887 dest=`$echo "X$dest" | $Xsed -e 's
%/$
%%'`
5889 # Check to see that the destination is a directory.
5890 test -d "$dest" && isdir=yes
5891 if test "$isdir" = yes; then
5895 destdir=`$echo "X$dest" | $Xsed -e 's
%/[^
/]*$
%%'`
5896 test "X$destdir" = "X$dest" && destdir=.
5897 destname=`$echo "X$dest" | $Xsed -e 's
%^.
*/%%'`
5899 # Not a directory, so check to see that there is only one file specified.
5901 if test "$#" -gt 2; then
5902 $echo "$modename: \`$dest' is not a directory
" 1>&2
5908 [\\/]* | [A-Za-z]:[\\/]*) ;;
5910 for file in $files; do
5914 $echo "$modename: \
`$destdir' must be an absolute directory name" 1>&2
5923 # This variable tells wrapper scripts just to set variables rather
5924 # than running their programs.
5925 libtool_install_magic="$magic"
5930 for file in $files; do
5932 # Do each installation.
5935 # Do the static libraries later.
5936 staticlibs="$staticlibs $file"
5940 # Check to see that this really is a libtool archive.
5941 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5943 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5951 # If there is no directory component, then add one.
5953 */* | *\\*) . $file ;;
5957 # Add the libdir to current_libdirs if it is the destination.
5958 if test "X$destdir" = "X$libdir"; then
5959 case "$current_libdirs " in
5961 *) current_libdirs="$current_libdirs $libdir" ;;
5964 # Note the libdir as a future libdir.
5965 case "$future_libdirs " in
5967 *) future_libdirs="$future_libdirs $libdir" ;;
5971 dir=`$echo "X$file" | $Xsed -e 's
%/[^
/]*$
%%'`/
5972 test "X$dir" = "X$file/" && dir=
5975 if test -n "$relink_command"; then
5976 # Determine the prefix the user has applied to our future dir.
5977 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5979 # Don't allow the user to place us outside of our expected
5980 # location b/c this prevents finding dependent libraries that
5981 # are installed to the same prefix.
5982 # At present, this check doesn't affect windows .dll's that
5983 # are installed into $libdir/../bin (currently, that works fine)
5984 # but it's something to keep an eye on.
5985 if test "$inst_prefix_dir" = "$destdir"; then
5986 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5990 if test -n "$inst_prefix_dir"; then
5991 # Stick the inst_prefix_dir data into the link command.
5992 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5994 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5997 $echo "$modename: warning: relinking \`$file'" 1>&2
5998 $show "$relink_command"
5999 if $run eval "$relink_command"; then :
6001 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6006 # See the names of the shared library.
6007 set dummy
$library_names
6008 if test -n "$2"; then
6014 test -n "$relink_command" && srcname
="$realname"T
6016 # Install the shared library and build the symlinks.
6017 $show "$install_prog $dir/$srcname $destdir/$realname"
6018 $run eval "$install_prog $dir/$srcname $destdir/$realname" ||
exit $?
6019 if test -n "$stripme" && test -n "$striplib"; then
6020 $show "$striplib $destdir/$realname"
6021 $run eval "$striplib $destdir/$realname" ||
exit $?
6024 if test "$#" -gt 0; then
6025 # Delete the old symlinks, and create new ones.
6026 # Try `ln -sf' first, because the `ln' binary might depend on
6027 # the symlink we replace! Solaris /bin/ln does not understand -f,
6028 # so we also need to try rm && ln -s.
6031 if test "$linkname" != "$realname"; then
6032 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6033 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6038 # Do each command in the postinstall commands.
6039 lib
="$destdir/$realname"
6040 cmds
=$postinstall_cmds
6041 save_ifs
="$IFS"; IFS
='~'
6042 for cmd
in $cmds; do
6046 $run eval "$cmd" ||
{
6049 # Restore the uninstalled library and exit
6050 if test "$mode" = relink
; then
6051 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6060 # Install the pseudo-library for information purposes.
6061 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6062 instname
="$dir/$name"i
6063 $show "$install_prog $instname $destdir/$name"
6064 $run eval "$install_prog $instname $destdir/$name" ||
exit $?
6066 # Maybe install the static library, too.
6067 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
6071 # Install (i.e. copy) a libtool object.
6073 # Figure out destination file name, if it wasn't already specified.
6074 if test -n "$destname"; then
6075 destfile
="$destdir/$destname"
6077 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6078 destfile
="$destdir/$destfile"
6081 # Deduce the name of the destination old-style object file.
6084 staticdest
=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6087 staticdest
="$destfile"
6091 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6097 # Install the libtool object if requested.
6098 if test -n "$destfile"; then
6099 $show "$install_prog $file $destfile"
6100 $run eval "$install_prog $file $destfile" ||
exit $?
6103 # Install the old object if enabled.
6104 if test "$build_old_libs" = yes; then
6105 # Deduce the name of the old-style object file.
6106 staticobj
=`$echo "X$file" | $Xsed -e "$lo2o"`
6108 $show "$install_prog $staticobj $staticdest"
6109 $run eval "$install_prog \$staticobj \$staticdest" ||
exit $?
6115 # Figure out destination file name, if it wasn't already specified.
6116 if test -n "$destname"; then
6117 destfile
="$destdir/$destname"
6119 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6120 destfile
="$destdir/$destfile"
6123 # If the file is missing, and there is a .exe on the end, strip it
6124 # because it is most likely a libtool script we actually want to
6129 if test ! -f "$file"; then
6130 file=`$echo $file|${SED} 's,.exe$,,'`
6136 # Do a test to see if this is really a libtool program.
6139 wrapper
=`$echo $file | ${SED} -e 's,.exe$,,'`
6145 if (${SED} -e '4q' $wrapper |
grep "^# Generated by .*$PACKAGE")>/dev
/null
2>&1; then
6149 # Note that it is not necessary on cygwin/mingw to append a dot to
6150 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6151 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6152 # `FILE.' does not work on cygwin managed mounts.
6154 # If there is no directory component, then add one.
6156 */* |
*\\*) .
${wrapper} ;;
6157 *) . .
/${wrapper} ;;
6160 # Check the variables that should have been set.
6161 if test -z "$notinst_deplibs"; then
6162 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6167 for lib
in $notinst_deplibs; do
6168 # Check to see that each library is installed.
6170 if test -f "$lib"; then
6171 # If there is no directory component, then add one.
6173 */* |
*\\*) .
$lib ;;
6177 libfile
="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6178 if test -n "$libdir" && test ! -f "$libfile"; then
6179 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6185 # Note that it is not necessary on cygwin/mingw to append a dot to
6186 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6187 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6188 # `FILE.' does not work on cygwin managed mounts.
6190 # If there is no directory component, then add one.
6192 */* |
*\\*) .
${wrapper} ;;
6193 *) . .
/${wrapper} ;;
6197 if test "$fast_install" = no
&& test -n "$relink_command"; then
6198 if test "$finalize" = yes && test -z "$run"; then
6199 tmpdir
=`func_mktempdir`
6200 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6201 outputname
="$tmpdir/$file"
6202 # Replace the output file specification.
6203 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6205 $show "$relink_command"
6206 if $run eval "$relink_command"; then :
6208 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6214 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6217 # Install the binary that we compiled earlier.
6218 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6222 # remove .exe since cygwin /usr/bin/install will append another
6224 case $install_prog,$host in
6225 */usr
/bin
/install*,*cygwin
*)
6226 case $file:$destfile in
6231 destfile
=$destfile.exe
6234 destfile
=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6239 $show "$install_prog$stripme $file $destfile"
6240 $run eval "$install_prog\$stripme \$file \$destfile" ||
exit $?
6241 test -n "$outputname" && ${rm}r
"$tmpdir"
6246 for file in $staticlibs; do
6247 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6249 # Set up the ranlib parameters.
6250 oldlib
="$destdir/$name"
6252 $show "$install_prog $file $oldlib"
6253 $run eval "$install_prog \$file \$oldlib" ||
exit $?
6255 if test -n "$stripme" && test -n "$old_striplib"; then
6256 $show "$old_striplib $oldlib"
6257 $run eval "$old_striplib $oldlib" ||
exit $?
6260 # Do each command in the postinstall commands.
6261 cmds
=$old_postinstall_cmds
6262 save_ifs
="$IFS"; IFS
='~'
6263 for cmd
in $cmds; do
6267 $run eval "$cmd" ||
exit $?
6272 if test -n "$future_libdirs"; then
6273 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6276 if test -n "$current_libdirs"; then
6277 # Maybe just do a dry run.
6278 test -n "$run" && current_libdirs
=" -n$current_libdirs"
6279 exec_cmd
='$SHELL $progpath $preserve_args --finish$current_libdirs'
6285 # libtool finish mode
6287 modename
="$modename: finish"
6291 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6294 libdirs
="$libdirs $dir"
6297 for libdir
in $libdirs; do
6298 if test -n "$finish_cmds"; then
6299 # Do each command in the finish commands.
6301 save_ifs
="$IFS"; IFS
='~'
6302 for cmd
in $cmds; do
6306 $run eval "$cmd" || admincmds
="$admincmds
6311 if test -n "$finish_eval"; then
6312 # Do the single finish_eval.
6313 eval cmds
=\"$finish_eval\"
6314 $run eval "$cmds" || admincmds
="$admincmds
6320 # Exit here if they wanted silent mode.
6321 test "$show" = : && exit $EXIT_SUCCESS
6323 $echo "X----------------------------------------------------------------------" |
$Xsed
6324 $echo "Libraries have been installed in:"
6325 for libdir
in $libdirs; do
6329 $echo "If you ever happen to want to link against installed libraries"
6330 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6331 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6332 $echo "flag during linking and do at least one of the following:"
6333 if test -n "$shlibpath_var"; then
6334 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6335 $echo " during execution"
6337 if test -n "$runpath_var"; then
6338 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6339 $echo " during linking"
6341 if test -n "$hardcode_libdir_flag_spec"; then
6343 eval flag
=\"$hardcode_libdir_flag_spec\"
6345 $echo " - use the \`$flag' linker flag"
6347 if test -n "$admincmds"; then
6348 $echo " - have your system administrator run these commands:$admincmds"
6350 if test -f /etc
/ld.so.conf
; then
6351 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6354 $echo "See any operating system documentation about shared libraries for"
6355 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6356 $echo "X----------------------------------------------------------------------" |
$Xsed
6360 # libtool execute mode
6362 modename
="$modename: execute"
6364 # The first argument is the command name.
6366 if test -z "$cmd"; then
6367 $echo "$modename: you must specify a COMMAND" 1>&2
6372 # Handle -dlopen flags immediately.
6373 for file in $execute_dlfiles; do
6374 if test ! -f "$file"; then
6375 $echo "$modename: \`$file' is not a file" 1>&2
6383 # Check to see that this really is a libtool archive.
6384 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
6386 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6391 # Read the libtool library.
6395 # If there is no directory component, then add one.
6397 */* |
*\\*) .
$file ;;
6401 # Skip this library if it cannot be dlopened.
6402 if test -z "$dlname"; then
6403 # Warn if it was a shared library.
6404 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6408 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6409 test "X$dir" = "X$file" && dir
=.
6411 if test -f "$dir/$objdir/$dlname"; then
6414 if test ! -f "$dir/$dlname"; then
6415 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6422 # Just add the directory containing the .lo file.
6423 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6424 test "X$dir" = "X$file" && dir
=.
6428 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6433 # Get the absolute pathname.
6434 absdir
=`cd "$dir" && pwd`
6435 test -n "$absdir" && dir
="$absdir"
6437 # Now add the directory to shlibpath_var.
6438 if eval "test -z \"\$$shlibpath_var\""; then
6439 eval "$shlibpath_var=\"\$dir\""
6441 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6445 # This variable tells wrapper scripts just to set shlibpath_var
6446 # rather than running their programs.
6447 libtool_execute_magic
="$magic"
6449 # Check if any of the arguments is a wrapper script.
6456 # Do a test to see if this is really a libtool program.
6457 if (${SED} -e '4q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6458 # If there is no directory component, then add one.
6460 */* |
*\\*) .
$file ;;
6464 # Transform arg to wrapped name.
6465 file="$progdir/$program"
6469 # Quote arguments (to preserve shell metacharacters).
6470 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6471 args
="$args \"$file\""
6474 if test -z "$run"; then
6475 if test -n "$shlibpath_var"; then
6476 # Export the shlibpath_var.
6477 eval "export $shlibpath_var"
6480 # Restore saved environment variables
6481 for lt_var
in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6483 eval "if test \"\${save_$lt_var+set}\" = set; then
6484 $lt_var=\$save_$lt_var; export $lt_var
6488 # Now prepare to actually exec the command.
6489 exec_cmd
="\$cmd$args"
6491 # Display what would be done.
6492 if test -n "$shlibpath_var"; then
6493 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6494 $echo "export $shlibpath_var"
6501 # libtool clean and uninstall mode
6503 modename
="$modename: $mode"
6509 # This variable tells wrapper scripts just to set variables rather
6510 # than running their programs.
6511 libtool_install_magic
="$magic"
6516 -f) rm="$rm $arg"; rmforce
=yes ;;
6517 -*) rm="$rm $arg" ;;
6518 *) files
="$files $arg" ;;
6522 if test -z "$rm"; then
6523 $echo "$modename: you must specify an RM program" 1>&2
6530 origobjdir
="$objdir"
6531 for file in $files; do
6532 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6533 if test "X$dir" = "X$file"; then
6535 objdir
="$origobjdir"
6537 objdir
="$dir/$origobjdir"
6539 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6540 test "$mode" = uninstall
&& objdir
="$dir"
6542 # Remember objdir for removal later, being careful to avoid duplicates
6543 if test "$mode" = clean
; then
6546 *) rmdirs
="$rmdirs $objdir" ;;
6550 # Don't error if the file doesn't exist and rm -f was used.
6551 if (test -L "$file") >/dev
/null
2>&1 \
6552 ||
(test -h "$file") >/dev
/null
2>&1 \
6553 ||
test -f "$file"; then
6555 elif test -d "$file"; then
6558 elif test "$rmforce" = yes; then
6566 # Possibly a libtool archive, so verify it.
6567 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6570 # Delete the libtool libraries and symlinks.
6571 for n
in $library_names; do
6572 rmfiles
="$rmfiles $objdir/$n"
6574 test -n "$old_library" && rmfiles
="$rmfiles $objdir/$old_library"
6578 case " $library_names " in
6579 # " " in the beginning catches empty $dlname
6581 *) rmfiles
="$rmfiles $objdir/$dlname" ;;
6583 test -n "$libdir" && rmfiles
="$rmfiles $objdir/$name $objdir/${name}i"
6586 if test -n "$library_names"; then
6587 # Do each command in the postuninstall commands.
6588 cmds
=$postuninstall_cmds
6589 save_ifs
="$IFS"; IFS
='~'
6590 for cmd
in $cmds; do
6595 if test "$?" -ne 0 && test "$rmforce" != yes; then
6602 if test -n "$old_library"; then
6603 # Do each command in the old_postuninstall commands.
6604 cmds
=$old_postuninstall_cmds
6605 save_ifs
="$IFS"; IFS
='~'
6606 for cmd
in $cmds; do
6611 if test "$?" -ne 0 && test "$rmforce" != yes; then
6617 # FIXME: should reinstall the best remaining shared library.
6624 # Possibly a libtool object, so verify it.
6625 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6630 # Add PIC object to the list of files to remove.
6631 if test -n "$pic_object" \
6632 && test "$pic_object" != none
; then
6633 rmfiles
="$rmfiles $dir/$pic_object"
6636 # Add non-PIC object to the list of files to remove.
6637 if test -n "$non_pic_object" \
6638 && test "$non_pic_object" != none
; then
6639 rmfiles
="$rmfiles $dir/$non_pic_object"
6645 if test "$mode" = clean
; then
6649 file=`$echo $file|${SED} 's,.exe$,,'`
6650 noexename
=`$echo $name|${SED} 's,.exe$,,'`
6651 # $file with .exe has already been added to rmfiles,
6652 # add $file without .exe
6653 rmfiles
="$rmfiles $file"
6656 # Do a test to see if this is a libtool program.
6657 if (${SED} -e '4q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6661 # note $name still contains .exe if it was in $file originally
6662 # as does the version of $file that was added into $rmfiles
6663 rmfiles
="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6664 if test "$fast_install" = yes && test -n "$relink_command"; then
6665 rmfiles
="$rmfiles $objdir/lt-$name"
6667 if test "X$noexename" != "X$name" ; then
6668 rmfiles
="$rmfiles $objdir/lt-${noexename}.c"
6674 $show "$rm $rmfiles"
6675 $run $rm $rmfiles || exit_status
=1
6677 objdir
="$origobjdir"
6679 # Try to remove the ${objdir}s in the directories where we deleted files
6680 for dir
in $rmdirs; do
6681 if test -d "$dir"; then
6683 $run rmdir $dir >/dev
/null
2>&1
6691 $echo "$modename: you must specify a MODE" 1>&2
6692 $echo "$generic_help" 1>&2
6697 if test -z "$exec_cmd"; then
6698 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6699 $echo "$generic_help" 1>&2
6702 fi # test -z "$show_help"
6704 if test -n "$exec_cmd"; then
6709 # We need to display help for each of the modes.
6712 "Usage: $modename [OPTION]... [MODE-ARG]...
6714 Provide generalized library-building support services.
6716 --config show all configuration variables
6717 --debug enable verbose shell tracing
6718 -n, --dry-run display commands without modifying any files
6719 --features display basic configuration information and exit
6720 --finish same as \`--mode=finish'
6721 --help display this help message and exit
6722 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6723 --quiet same as \`--silent'
6724 --silent don't print informational messages
6725 --tag=TAG use configuration variables from tag TAG
6726 --version print version information
6728 MODE must be one of the following:
6730 clean remove files from the build directory
6731 compile compile a source file into a libtool object
6732 execute automatically set library path, then run a program
6733 finish complete the installation of libtool libraries
6734 install install libraries or executables
6735 link create a library or an executable
6736 uninstall remove libraries from an installed directory
6738 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6739 a more detailed description of MODE.
6741 Report bugs to <bug-libtool@gnu.org>."
6747 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6749 Remove files from the build directory.
6751 RM is the name of the program to use to delete files associated with each FILE
6752 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6755 If FILE is a libtool library, object or program, all the files associated
6756 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6761 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6763 Compile a source file into a libtool library object.
6765 This mode accepts the following additional options:
6767 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6768 -prefer-pic try to building PIC objects only
6769 -prefer-non-pic try to building non-PIC objects only
6770 -static always build a \`.o' file suitable for static linking
6772 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6773 from the given SOURCEFILE.
6775 The output file name is determined by removing the directory component from
6776 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6777 library object suffix, \`.lo'."
6782 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6784 Automatically set library path, then run a program.
6786 This mode accepts the following additional options:
6788 -dlopen FILE add the directory containing FILE to the library path
6790 This mode sets the library path environment variable according to \`-dlopen'
6793 If any of the ARGS are libtool executable wrappers, then they are translated
6794 into their corresponding uninstalled binary, and any of their required library
6795 directories are added to the library path.
6797 Then, COMMAND is executed, with ARGS as arguments."
6802 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6804 Complete the installation of libtool libraries.
6806 Each LIBDIR is a directory that contains libtool libraries.
6808 The commands that this mode executes may require superuser privileges. Use
6809 the \`--dry-run' option if you just want to see what would be executed."
6814 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6816 Install executables or libraries.
6818 INSTALL-COMMAND is the installation command. The first component should be
6819 either the \`install' or \`cp' program.
6821 The rest of the components are interpreted as arguments to that command (only
6822 BSD-compatible install options are recognized)."
6827 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6829 Link object files or libraries together to form another library, or to
6830 create an executable program.
6832 LINK-COMMAND is a command using the C compiler that you would use to create
6833 a program from several object files.
6835 The following components of LINK-COMMAND are treated specially:
6837 -all-static do not do any dynamic linking at all
6838 -avoid-version do not add a version suffix if possible
6839 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6840 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6841 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6842 -export-symbols SYMFILE
6843 try to export only the symbols listed in SYMFILE
6844 -export-symbols-regex REGEX
6845 try to export only the symbols matching REGEX
6846 -LLIBDIR search LIBDIR for required installed libraries
6847 -lNAME OUTPUT-FILE requires the installed library libNAME
6848 -module build a library that can dlopened
6849 -no-fast-install disable the fast-install mode
6850 -no-install link a not-installable executable
6851 -no-undefined declare that a library does not refer to external symbols
6852 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6853 -objectlist FILE Use a list of object files found in FILE to specify objects
6854 -precious-files-regex REGEX
6855 don't remove output files matching REGEX
6856 -release RELEASE specify package release information
6857 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6858 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6859 -static do not do any dynamic linking of uninstalled libtool libraries
6860 -static-libtool-libs
6861 do not do any dynamic linking of libtool libraries
6862 -version-info CURRENT[:REVISION[:AGE]]
6863 specify library version info [each variable defaults to 0]
6865 All other options (arguments beginning with \`-') are ignored.
6867 Every other argument is treated as a filename. Files ending in \`.la' are
6868 treated as uninstalled libtool libraries, other files are standard or library
6871 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6872 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6873 required, except when creating a convenience library.
6875 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6876 using \`ar' and \`ranlib', or on Windows using \`lib'.
6878 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6879 is created, otherwise an executable program is created."
6884 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6886 Remove libraries from an installation directory.
6888 RM is the name of the program to use to delete files associated with each FILE
6889 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6892 If FILE is a libtool library, all the files associated with it are deleted.
6893 Otherwise, only FILE itself is deleted using RM."
6897 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6904 $echo "Try \`$modename --help' for more information about other modes."
6908 # The TAGs below are defined such that we never get into a situation
6909 # in which we disable both kinds of libraries. Given conflicting
6910 # choices, we go for a static library, that is the most portable,
6911 # since we can't tell whether shared libraries were disabled because
6912 # the user asked for that or because the platform doesn't support
6913 # them. This is particularly important on AIX, because we don't
6914 # support having both static and shared libraries enabled at the same
6915 # time on that platform, so we default to a shared-only configuration.
6916 # If a disable-shared tag is given, we'll fallback to a static-only
6917 # configuration. But we'll never go from static-only to shared-only.
6919 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6921 # ### END LIBTOOL TAG CONFIG: disable-shared
6923 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6925 # ### END LIBTOOL TAG CONFIG: disable-static