1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # define SED for historic ltconfig's generated by Libtool 1.3
37 test -z "$SED" && SED
=sed
39 # The name of this program:
40 progname
=`echo "$progpath" | $SED $basename`
50 TIMESTAMP
=" (1.1220.2.365 2005/12/18 22:14:06)"
52 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
53 if test -n "${ZSH_VERSION+set}" && (emulate sh
) >/dev
/null
2>&1; then
56 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
57 # is contrary to our usage. Disable this feature.
58 alias -g '${1+"$@"}'='"$@"'
61 case `(set -o) 2>/dev/null` in *posix
*) set -o posix
;; esac
64 # Check that we have a working $echo.
65 if test "X$1" = X--no-reexec
; then
66 # Discard the --no-reexec flag, and continue.
68 elif test "X$1" = X--fallback-echo
; then
69 # Avoid inline document here, it may be left over
71 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
72 # Yippee, $echo works!
75 # Restart under the correct shell, and then maybe $echo will work.
76 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
79 if test "X$1" = X--fallback-echo
; then
80 # used as fallback echo
89 help="Try \`$progname --help' for more information."
90 magic
="%%%MAGIC variable%%%"
95 # Sed substitution that helps us do robust quoting. It backslashifies
96 # metacharacters that are still active within double-quoted strings.
97 Xsed
="${SED}"' -e 1s/^X//'
98 sed_quote_subst
='s/\([\\`\\"$\\\\]\)/\\\1/g'
99 # test EBCDIC or ASCII
100 case `echo X|tr X '\101'` in
101 A
) # ASCII based system
102 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
104 NL2SP
='tr \015\012 \040\040'
106 *) # EBCDIC based system
108 NL2SP
='tr \r\n \100\100'
113 # Only set LANG and LC_ALL to C if already set.
114 # These must not be set unconditionally because not all systems understand
115 # e.g. LANG=C (notably SCO).
116 # We save the old values to restore during execute mode.
117 for lt_var
in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119 eval "if test \"\${$lt_var+set}\" = set; then
120 save_$lt_var=\$$lt_var
126 # Make sure IFS has a sensible default
131 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
132 $echo "$modename: not configured to build any kind of library" 1>&2
133 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
148 lo2o
="s/\\.lo\$/.${objext}/"
149 o2lo
="s/\\.${objext}\$/.lo/"
153 #####################################
154 # Shell function definitions:
155 # This seems to be the best place for them
157 # func_mktempdir [string]
158 # Make a temporary directory that won't clash with other running
159 # libtool processes, and avoids race conditions if possible. If
160 # given, STRING is the basename for that directory.
163 my_template
="${TMPDIR-/tmp}/${1-$progname}"
165 if test "$run" = ":"; then
166 # Return a directory name, but don't create it in dry-run mode
167 my_tmpdir
="${my_template}-$$"
170 # If mktemp works, use that first and foremost
171 my_tmpdir
=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
173 if test ! -d "$my_tmpdir"; then
174 # Failing that, at least try and use $RANDOM to avoid a race
175 my_tmpdir
="${my_template}-${RANDOM-0}$$"
177 save_mktempdir_umask
=`umask`
180 umask $save_mktempdir_umask
183 # If we're not in dry-run mode, bomb out on failure
184 test -d "$my_tmpdir" ||
{
185 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
190 $echo "X$my_tmpdir" |
$Xsed
194 # func_win32_libid arg
195 # return the library type of file 'arg'
197 # Need a lot of goo to handle *both* DLLs and import libs
198 # Has to be a shell function in order to 'eat' the argument
199 # that is supplied when $file_magic_command is called.
202 win32_libid_type
="unknown"
203 win32_fileres
=`file -L $1 2>/dev/null`
204 case $win32_fileres in
205 *ar\ archive\ import\ library
*) # definitely import
206 win32_libid_type
="x86 archive import"
208 *ar\ archive
*) # could be an import, or static
209 if eval $OBJDUMP -f $1 |
$SED -e '10q' 2>/dev
/null | \
210 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev
/null
; then
211 win32_nmres
=`eval $NM -f posix -A $1 | \
212 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
214 import
*) win32_libid_type
="x86 archive import";;
215 *) win32_libid_type
="x86 archive static";;
220 win32_libid_type
="x86 DLL"
222 *executable
*) # but shell scripts are "executable" too...
223 case $win32_fileres in
224 *MS\ Windows\ PE\ Intel
*)
225 win32_libid_type
="x86 DLL"
230 $echo $win32_libid_type
235 # Infer tagged configuration to use if any are available and
236 # if one wasn't chosen via the "--tag" command line option.
237 # Only attempt this if the compiler in the base compile
238 # command doesn't match the default compiler.
239 # arg is usually of the form 'gcc ...'
242 if test -n "$available_tags" && test -z "$tagname"; then
246 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
250 CC_quoted
="$CC_quoted $arg"
253 # Blanks in the command may have been stripped by the calling shell,
254 # but not from the CC environment variable when configure was run.
255 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*) ;;
256 # Blanks at the start of $base_compile will cause this to fail
257 # if we don't check for them as well.
259 for z
in $available_tags; do
260 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev
/null
; then
261 # Evaluate the configuration.
262 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
265 # Double-quote args containing other shell metacharacters.
267 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
271 CC_quoted
="$CC_quoted $arg"
274 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*)
275 # The compiler in the base compile command matches
276 # the one in the tagged configuration.
277 # Assume this is the tagged configuration we want.
284 # If $tagname still isn't set, then no tagged configuration
285 # was found and let the user know that the "--tag" command
286 # line option must be used.
287 if test -z "$tagname"; then
288 $echo "$modename: unable to infer tagged configuration"
289 $echo "$modename: specify a tag with \`--tag'" 1>&2
292 # $echo "$modename: using $tagname tagged configuration"
300 # func_extract_an_archive dir oldlib
301 func_extract_an_archive
()
303 f_ex_an_ar_dir
="$1"; shift
304 f_ex_an_ar_oldlib
="$1"
306 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
307 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" ||
exit $?
308 if ($AR t
"$f_ex_an_ar_oldlib" |
sort |
sort -uc >/dev
/null
2>&1); then
311 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
316 # func_extract_archives gentop oldlib ...
317 func_extract_archives
()
319 my_gentop
="$1"; shift
327 $show "${rm}r $my_gentop"
328 $run ${rm}r
"$my_gentop"
329 $show "$mkdir $my_gentop"
330 $run $mkdir "$my_gentop"
332 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
336 for my_xlib
in $my_oldlibs; do
337 # Extract the objects.
339 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
="$my_xlib" ;;
340 *) my_xabs
=`pwd`"/$my_xlib" ;;
342 my_xlib
=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
345 case " $extracted_archives " in
347 extracted_serial
=`expr $extracted_serial + 1`
348 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
352 extracted_archives
="$extracted_archives $my_xlib_u"
353 my_xdir
="$my_gentop/$my_xlib_u"
355 $show "${rm}r $my_xdir"
356 $run ${rm}r
"$my_xdir"
357 $show "$mkdir $my_xdir"
358 $run $mkdir "$my_xdir"
360 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
365 $show "Extracting $my_xabs"
366 # Do not bother doing anything if just a dry run
367 if test -z "$run"; then
368 darwin_orig_dir
=`pwd`
369 cd $my_xdir ||
exit $?
370 darwin_archive
=$my_xabs
372 darwin_base_archive
=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
373 darwin_arches
=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
374 if test -n "$darwin_arches"; then
375 darwin_arches
=`echo "$darwin_arches" | $SED -e 's/.*are://'`
377 $show "$darwin_base_archive has multiple architectures $darwin_arches"
378 for darwin_arch
in $darwin_arches ; do
379 mkdir
-p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
380 lipo
-thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
381 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
382 func_extract_an_archive
"`pwd`" "${darwin_base_archive}"
384 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
385 done # $darwin_arches
386 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
387 darwin_filelist
=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
390 for darwin_file
in $darwin_filelist; do
391 darwin_files
=`find unfat-$$ -name $darwin_file -print | $NL2SP`
392 lipo
-create -output "$darwin_file" $darwin_files
393 done # $darwin_filelist
395 cd "$darwin_orig_dir"
397 cd "$darwin_orig_dir"
398 func_extract_an_archive
"$my_xdir" "$my_xabs"
403 func_extract_an_archive
"$my_xdir" "$my_xabs"
406 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
408 func_extract_archives_result
="$my_oldobjs"
410 # End of Shell function definitions
411 #####################################
414 #eval std_shrext=\"$shrext_cmds\"
416 # And fixing for Darwin sucks for everybody else
417 if test -z "$shrext_cmds" && test -n "$shrext"; then
418 eval shrext_cmds
=\"$shrext\"
421 eval std_shrext
=\"$shrext_cmds\"
423 # This value is evaluated to 32768, so place it here as a compatilibity hack
424 # because older libtool.m4 didn't define this variable
425 test -z "$max_cmd_len" && max_cmd_len
=32768
429 # Parse our command line options once, thoroughly.
430 while test "$#" -gt 0
436 -*=*) optarg
=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
440 # If the previous option needs an argument, assign it.
441 if test -n "$prev"; then
444 execute_dlfiles
="$execute_dlfiles $arg"
448 preserve_args
="${preserve_args}=$arg"
450 # Check whether tagname contains only valid characters
453 $echo "$progname: invalid tag name: $tagname" 1>&2
460 # Don't test for the "default" C tag, as we know, it's there, but
461 # not specially marked.
464 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev
/null
; then
465 taglist
="$taglist $tagname"
466 # Evaluate the configuration.
467 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
469 $echo "$progname: ignoring unknown tag $tagname" 1>&2
484 # Have we seen a non-optional argument yet?
491 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
493 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
494 $echo "This is free software; see the source for copying conditions. There is NO"
495 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
500 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
501 # Now print the configurations for the tags.
502 for tagname
in $taglist; do
503 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
509 $echo "$progname: enabling shell trace mode"
511 preserve_args
="$preserve_args $arg"
520 if test "$build_libtool_libs" = yes; then
521 $echo "enable shared libraries"
523 $echo "disable shared libraries"
525 if test "$build_old_libs" = yes; then
526 $echo "enable static libraries"
528 $echo "disable static libraries"
533 --finish) mode
="finish" ;;
535 --mode) prevopt
="--mode" prev
=mode
;;
536 --mode=*) mode
="$optarg" ;;
538 --preserve-dup-deps) duplicate_deps
="yes" ;;
542 preserve_args
="$preserve_args $arg"
548 preserve_args
="$preserve_args --tag"
551 set tag
"$optarg" ${1+"$@"}
554 preserve_args
="$preserve_args --tag"
563 $echo "$modename: unrecognized option \`$arg'" 1>&2
575 if test -n "$prevopt"; then
576 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
581 case $disable_libs in
585 build_libtool_libs
=no
589 build_old_libs
=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
593 # If this variable is set in any of the actions, the command in it
594 # will be execed at the end. This prevents here-documents from being
595 # left over by shells.
598 if test -z "$show_help"; then
600 # Infer the operation mode.
601 if test -z "$mode"; then
602 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
603 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605 *cc | cc
* |
*++ | gcc
* |
*-gcc* | g
++* | xlc
*)
617 *db |
*dbx |
*strace |
*truss
)
627 # If we have no mode, but dlfiles were specified, then do execute mode.
628 test -n "$execute_dlfiles" && mode
=execute
630 # Just use the default operation mode.
631 if test -z "$mode"; then
632 if test -n "$nonopt"; then
633 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
642 # Only execute mode is allowed to have -dlopen flags.
643 if test -n "$execute_dlfiles" && test "$mode" != execute
; then
644 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
649 # Change the help message to a mode-specific one.
651 help="Try \`$modename --help --mode=$mode' for more information."
653 # These modes are in order of execution frequency so that they run quickly.
655 # libtool compile mode
657 modename
="$modename: compile"
658 # Get the compilation command and the source file.
660 srcfile
="$nonopt" # always keep a non-empty value in "srcfile"
671 # do not "continue". Instead, add this to base_compile
683 # Accept any command-line options.
686 if test -n "$libobj" ; then
687 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
694 -static |
-prefer-pic |
-prefer-non-pic)
705 arg_mode
=arg
# the next one goes into the "base_compile" arg list
706 continue # The current "srcfile" will either be retained or
707 ;; # replaced later. I would guess that would be a bug.
710 args
=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712 save_ifs
="$IFS"; IFS
=','
716 # Double-quote args containing other shell metacharacters.
717 # Many Bourne shells cannot handle close brackets correctly
718 # in scan sets, so we specify it separately.
720 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
724 lastarg
="$lastarg $arg"
727 lastarg
=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729 # Add the arguments to base_compile.
730 base_compile
="$base_compile $lastarg"
735 # Accept the current argument as the source file.
736 # The previous "srcfile" becomes the current argument.
743 esac # case $arg_mode
745 # Aesthetically quote the previous argument.
746 lastarg
=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
749 # Double-quote args containing other shell metacharacters.
750 # Many Bourne shells cannot handle close brackets correctly
751 # in scan sets, and some SunOS ksh mistreat backslash-escaping
752 # in scan sets (worked around with variable expansion),
753 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
754 # at all, so we specify them separately.
755 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
756 lastarg
="\"$lastarg\""
760 base_compile
="$base_compile $lastarg"
765 $echo "$modename: you must specify an argument for -Xcompile"
769 $echo "$modename: you must specify a target with \`-o'" 1>&2
773 # Get the name of the library object.
774 [ -z "$libobj" ] && libobj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
778 # Recognize several different file suffixes.
779 # If the user specifies -o file.o, it is replaced with file.lo
789 *.class
) xform
=class
;;
794 *.java
) xform
=java
;;
798 libobj
=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801 *.lo
) obj
=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
803 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
808 func_infer_tag
$base_compile
810 for arg
in $later; do
829 qlibobj
=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
831 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
832 qlibobj
="\"$qlibobj\"" ;;
834 test "X$libobj" != "X$qlibobj" \
835 && $echo "X$libobj" |
grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
836 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
837 objname
=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
838 xdir
=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
839 if test "X$xdir" = "X$obj"; then
844 lobj
=${xdir}$objdir/$objname
846 if test -z "$base_compile"; then
847 $echo "$modename: you must specify a compilation command" 1>&2
852 # Delete any leftover library objects.
853 if test "$build_old_libs" = yes; then
854 removelist
="$obj $lobj $libobj ${libobj}T"
856 removelist
="$lobj $libobj ${libobj}T"
860 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
862 # On Cygwin there's no "real" PIC flag so we must build both object types
864 cygwin
* | mingw
* | pw32
* | os2
*)
868 if test "$pic_mode" = no
&& test "$deplibs_check_method" != pass_all
; then
869 # non-PIC code in shared libraries is not supported
873 # Calculate the filename of the output object if compiler does
874 # not support -o with -c
875 if test "$compiler_c_o" = no
; then
876 output_obj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.
${objext}
877 lockfile
="$output_obj.lock"
878 removelist
="$removelist $output_obj $lockfile"
879 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
886 # Lock this critical section if it is needed
887 # We use this script file to make the link, it avoids creating a new file
888 if test "$need_locks" = yes; then
889 until $run ln "$progpath" "$lockfile" 2>/dev
/null
; do
890 $show "Waiting for $lockfile to be removed"
893 elif test "$need_locks" = warn
; then
894 if test -f "$lockfile"; then
896 *** ERROR, $lockfile exists and contains:
897 `cat $lockfile 2>/dev/null`
899 This indicates that another process is trying to use the same
900 temporary object file, and libtool could not work around it because
901 your compiler does not support \`-c' and \`-o' together. If you
902 repeat this compilation, it may succeed, by chance, but you had better
903 avoid parallel builds (make -j) in this platform, or get a better
909 $echo "$srcfile" > "$lockfile"
912 if test -n "$fix_srcfile_path"; then
913 eval srcfile
=\"$fix_srcfile_path\"
915 qsrcfile
=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
917 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
918 qsrcfile
="\"$qsrcfile\"" ;;
921 $run $rm "$libobj" "${libobj}T"
923 # Create a libtool object file (analogous to a ".la" file),
924 # but don't create it if we're doing a dry run.
925 test -z "$run" && cat > ${libobj}T
<<EOF
926 # $libobj - a libtool object file
927 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
929 # Please DO NOT delete this file!
930 # It is necessary for linking the library.
932 # Name of the PIC object.
935 # Only build a PIC object if we are building libtool libraries.
936 if test "$build_libtool_libs" = yes; then
937 # Without this assignment, base_compile gets emptied.
938 fbsd_hideous_sh_bug
=$base_compile
940 if test "$pic_mode" != no
; then
941 command="$base_compile $qsrcfile $pic_flag"
943 # Don't build PIC code
944 command="$base_compile $qsrcfile"
947 if test ! -d "${xdir}$objdir"; then
948 $show "$mkdir ${xdir}$objdir"
949 $run $mkdir ${xdir}$objdir
951 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
956 if test -z "$output_obj"; then
957 # Place PIC objects in $objdir
958 command="$command -o $lobj"
961 $run $rm "$lobj" "$output_obj"
964 if $run eval "$command"; then :
966 test -n "$output_obj" && $run $rm $removelist
970 if test "$need_locks" = warn
&&
971 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
973 *** ERROR, $lockfile contains:
974 `cat $lockfile 2>/dev/null`
976 but it should contain:
979 This indicates that another process is trying to use the same
980 temporary object file, and libtool could not work around it because
981 your compiler does not support \`-c' and \`-o' together. If you
982 repeat this compilation, it may succeed, by chance, but you had better
983 avoid parallel builds (make -j) in this platform, or get a better
990 # Just move the object if needed, then go on to compile the next one
991 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
992 $show "$mv $output_obj $lobj"
993 if $run $mv $output_obj $lobj; then :
1001 # Append the name of the PIC object to the libtool object file.
1002 test -z "$run" && cat >> ${libobj}T
<<EOF
1003 pic_object='$objdir/$objname'
1007 # Allow error messages only from the first compilation.
1008 if test "$suppress_opt" = yes; then
1009 suppress_output
=' >/dev/null 2>&1'
1012 # No PIC object so indicate it doesn't exist in the libtool
1014 test -z "$run" && cat >> ${libobj}T
<<EOF
1020 # Only build a position-dependent object if we build old libraries.
1021 if test "$build_old_libs" = yes; then
1022 if test "$pic_mode" != yes; then
1023 # Don't build PIC code
1024 command="$base_compile $qsrcfile"
1026 command="$base_compile $qsrcfile $pic_flag"
1028 if test "$compiler_c_o" = yes; then
1029 command="$command -o $obj"
1032 # Suppress compiler output if we already did a PIC compilation.
1033 command="$command$suppress_output"
1034 $run $rm "$obj" "$output_obj"
1036 if $run eval "$command"; then :
1038 $run $rm $removelist
1042 if test "$need_locks" = warn
&&
1043 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1045 *** ERROR, $lockfile contains:
1046 `cat $lockfile 2>/dev/null`
1048 but it should contain:
1051 This indicates that another process is trying to use the same
1052 temporary object file, and libtool could not work around it because
1053 your compiler does not support \`-c' and \`-o' together. If you
1054 repeat this compilation, it may succeed, by chance, but you had better
1055 avoid parallel builds (make -j) in this platform, or get a better
1058 $run $rm $removelist
1062 # Just move the object if needed
1063 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1064 $show "$mv $output_obj $obj"
1065 if $run $mv $output_obj $obj; then :
1068 $run $rm $removelist
1073 # Append the name of the non-PIC object the libtool object file.
1074 # Only append if the libtool object file exists.
1075 test -z "$run" && cat >> ${libobj}T
<<EOF
1076 # Name of the non-PIC object.
1077 non_pic_object='$objname'
1081 # Append the name of the non-PIC object the libtool object file.
1082 # Only append if the libtool object file exists.
1083 test -z "$run" && cat >> ${libobj}T
<<EOF
1084 # Name of the non-PIC object.
1090 $run $mv "${libobj}T" "${libobj}"
1092 # Unlock the critical section if it was locked
1093 if test "$need_locks" != no
; then
1094 $run $rm "$lockfile"
1102 modename
="$modename: link"
1104 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1105 # It is impossible to link a dll without this setting, and
1106 # we shouldn't force the makefile maintainer to figure out
1107 # which system we are compiling for in order to pass an extra
1108 # flag for every libtool invocation.
1109 # allow_undefined=no
1111 # FIXME: Unfortunately, there are problems with the above when trying
1112 # to make a dll which has undefined symbols, in which case not
1113 # even a static library is built. For now, we need to specify
1114 # -no-undefined on the libtool link line when we can be certain
1115 # that all symbols are satisfied, otherwise we get a static library.
1122 libtool_args
="$nonopt"
1123 base_compile
="$nonopt $@"
1124 compile_command
="$nonopt"
1125 finalize_command
="$nonopt"
1138 lib_search_path
=`pwd`
1147 export_symbols_regex
=
1155 notinst_path
= # paths that contain not-installed libtool libraries
1156 precious_files_regex
=
1157 prefer_static_libs
=no
1170 func_infer_tag
$base_compile
1172 # We need to know -static, to get the right output filenames.
1176 -all-static |
-static |
-static-libtool-libs)
1179 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1180 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1182 if test -n "$link_static_flag"; then
1183 dlopen_self
=$dlopen_self_static
1185 prefer_static_libs
=yes
1188 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1189 dlopen_self
=$dlopen_self_static
1191 prefer_static_libs
=built
1193 -static-libtool-libs)
1194 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1195 dlopen_self
=$dlopen_self_static
1197 prefer_static_libs
=yes
1200 build_libtool_libs
=no
1207 # See if our shared archives depend on static archives.
1208 test -n "$old_archive_from_new_cmds" && build_old_libs
=yes
1210 # Go through the arguments, transforming them on the way.
1211 while test "$#" -gt 0; do
1215 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1216 qarg
=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220 libtool_args
="$libtool_args $qarg"
1222 # If the previous option needs an argument, assign it.
1223 if test -n "$prev"; then
1226 compile_command
="$compile_command @OUTPUT@"
1227 finalize_command
="$finalize_command @OUTPUT@"
1233 if test "$preload" = no
; then
1234 # Add the symbol object into the linking commands.
1235 compile_command
="$compile_command @SYMFILE@"
1236 finalize_command
="$finalize_command @SYMFILE@"
1240 *.la |
*.lo
) ;; # We handle these cases below.
1242 if test "$dlself" = no
; then
1250 if test "$prev" = dlprefiles
; then
1252 elif test "$prev" = dlfiles
&& test "$dlopen_self" != yes; then
1262 if test "$prev" = dlfiles
; then
1263 dlfiles
="$dlfiles $arg"
1265 dlprefiles
="$dlprefiles $arg"
1273 export_symbols
="$arg"
1274 if test ! -f "$arg"; then
1275 $echo "$modename: symbol file \`$arg' does not exist"
1282 export_symbols_regex
="$arg"
1287 inst_prefix_dir
="$arg"
1292 precious_files_regex
="$arg"
1302 if test -f "$arg"; then
1305 for fil
in `cat $save_arg`
1307 # moreargs="$moreargs $fil"
1309 # A libtool-controlled object.
1311 # Check to see that this really is a libtool object.
1312 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1317 # If there is no directory component, then add one.
1319 */* |
*\\*) .
$arg ;;
1323 if test -z "$pic_object" || \
1324 test -z "$non_pic_object" ||
1325 test "$pic_object" = none
&& \
1326 test "$non_pic_object" = none
; then
1327 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331 # Extract subdirectory from the argument.
1332 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1333 if test "X$xdir" = "X$arg"; then
1339 if test "$pic_object" != none
; then
1340 # Prepend the subdirectory the object is found in.
1341 pic_object
="$xdir$pic_object"
1343 if test "$prev" = dlfiles
; then
1344 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1345 dlfiles
="$dlfiles $pic_object"
1349 # If libtool objects are unsupported, then we need to preload.
1354 # CHECK ME: I think I busted this. -Ossama
1355 if test "$prev" = dlprefiles
; then
1356 # Preload the old-style object.
1357 dlprefiles
="$dlprefiles $pic_object"
1362 libobjs
="$libobjs $pic_object"
1367 if test "$non_pic_object" != none
; then
1368 # Prepend the subdirectory the object is found in.
1369 non_pic_object
="$xdir$non_pic_object"
1371 # A standard non-PIC object
1372 non_pic_objects
="$non_pic_objects $non_pic_object"
1373 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1374 arg
="$non_pic_object"
1377 # If the PIC object exists, use it instead.
1378 # $xdir was prepended to $pic_object above.
1379 non_pic_object
="$pic_object"
1380 non_pic_objects
="$non_pic_objects $non_pic_object"
1383 # Only an error if not doing a dry-run.
1384 if test -z "$run"; then
1385 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1390 # Extract subdirectory from the argument.
1391 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1392 if test "X$xdir" = "X$arg"; then
1398 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1399 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1400 libobjs
="$libobjs $pic_object"
1401 non_pic_objects
="$non_pic_objects $non_pic_object"
1406 $echo "$modename: link input file \`$save_arg' does not exist"
1414 # We need an absolute path.
1416 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1418 $echo "$modename: only absolute run-paths are allowed" 1>&2
1422 if test "$prev" = rpath
; then
1425 *) rpath
="$rpath $arg" ;;
1430 *) xrpath
="$xrpath $arg" ;;
1437 compiler_flags
="$compiler_flags $qarg"
1439 compile_command
="$compile_command $qarg"
1440 finalize_command
="$finalize_command $qarg"
1444 linker_flags
="$linker_flags $qarg"
1445 compiler_flags
="$compiler_flags $wl$qarg"
1447 compile_command
="$compile_command $wl$qarg"
1448 finalize_command
="$finalize_command $wl$qarg"
1452 linker_flags
="$linker_flags $qarg"
1453 compiler_flags
="$compiler_flags $qarg"
1455 compile_command
="$compile_command $qarg"
1456 finalize_command
="$finalize_command $qarg"
1464 darwin_framework|darwin_framework_skip
)
1465 test "$prev" = "darwin_framework" && compiler_flags
="$compiler_flags $arg"
1466 compile_command
="$compile_command $arg"
1467 finalize_command
="$finalize_command $arg"
1472 eval "$prev=\"\$arg\""
1477 fi # test -n "$prev"
1483 if test -n "$link_static_flag"; then
1484 compile_command
="$compile_command $link_static_flag"
1485 finalize_command
="$finalize_command $link_static_flag"
1491 # FIXME: remove this flag sometime in the future.
1492 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1516 -export-symbols |
-export-symbols-regex)
1517 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
1518 $echo "$modename: more than one -exported-symbols argument is not allowed"
1521 if test "X$arg" = "X-export-symbols"; then
1529 -framework|
-arch|
-isysroot)
1531 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1532 prev
=darwin_framework_skip
;;
1533 *) compiler_flags
="$compiler_flags $arg"
1534 prev
=darwin_framework
;;
1536 compile_command
="$compile_command $arg"
1537 finalize_command
="$finalize_command $arg"
1546 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1547 # so, if we see these flags be careful not to treat them like -L
1549 case $with_gcc/$host in
1550 no
/*-*-irix* |
/*-*-irix*)
1551 compile_command
="$compile_command $arg"
1552 finalize_command
="$finalize_command $arg"
1559 dir
=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1560 # We need an absolute path.
1562 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1564 absdir
=`cd "$dir" && pwd`
1565 if test -z "$absdir"; then
1566 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1568 notinst_path
="$notinst_path $dir"
1576 deplibs
="$deplibs -L$dir"
1577 lib_search_path
="$lib_search_path $dir"
1581 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1582 testbindir
=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1583 case :$dllsearchpath: in
1585 *) dllsearchpath
="$dllsearchpath:$dir";;
1587 case :$dllsearchpath: in
1588 *":$testbindir:"*) ;;
1589 *) dllsearchpath
="$dllsearchpath:$testbindir";;
1597 if test "X$arg" = "X-lc" ||
test "X$arg" = "X-lm"; then
1599 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-beos*)
1600 # These systems don't actually have a C or math library (as such)
1604 # These systems don't actually have a C library (as such)
1605 test "X$arg" = "X-lc" && continue
1607 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1608 # Do not include libc due to us having libc/libc_r.
1609 test "X$arg" = "X-lc" && continue
1611 *-*-rhapsody* |
*-*-darwin1.
[012])
1612 # Rhapsody C and math libraries are in the System framework
1613 deplibs
="$deplibs -framework System"
1616 *-*-sco3.2v5
* |
*-*-sco5v6*)
1617 # Causes problems with __ctype
1618 test "X$arg" = "X-lc" && continue
1620 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
1621 # Compiler inserts libc in the correct place for threads to work
1622 test "X$arg" = "X-lc" && continue
1625 elif test "X$arg" = "X-lc_r"; then
1627 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1628 # Do not include libc_r directly, use -pthread flag.
1633 deplibs
="$deplibs $arg"
1637 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1638 # classes, name mangling, and exception handling.
1640 compile_command
="$compile_command $arg"
1641 compiler_flags
="$compiler_flags $arg"
1642 finalize_command
="$finalize_command $arg"
1647 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe)
1648 compiler_flags
="$compiler_flags $arg"
1649 compile_command
="$compile_command $arg"
1650 finalize_command
="$finalize_command $arg"
1659 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1660 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1661 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1662 # +DA*, +DD* enable 64-bit mode on the HP compiler
1663 # -q* pass through compiler args for the IBM compiler
1664 # -m* pass through architecture-specific compiler args for GCC
1665 # -m*, -t[45]*, -txscale* pass through architecture-specific
1666 # compiler args for GCC
1667 # -pg pass through profiling flag for GCC
1668 # @file GCC response files
1669 -64|
-mips[0-9]|
-r[0-9][0-9]*|
-xarch=*|
-xtarget=*|
+DA
*|
+DD
*|
-q*|
-m*|
-pg| \
1670 -t[45]*|
-txscale*|@
*)
1672 # Unknown arguments in both finalize_command and compile_command need
1673 # to be aesthetically quoted because they are evaled later.
1674 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1676 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1680 compile_command
="$compile_command $arg"
1681 finalize_command
="$finalize_command $arg"
1682 compiler_flags
="$compiler_flags $arg"
1698 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1699 # The PATH hackery in wrapper scripts is required on Windows
1700 # in order for the loader to find any dlls it needs.
1701 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1702 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1705 *) no_install
=yes ;;
1722 -precious-files-regex)
1743 dir
=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1744 # We need an absolute path.
1746 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1748 $echo "$modename: only absolute run-paths are allowed" 1>&2
1754 *) xrpath
="$xrpath $dir" ;;
1759 -static |
-static-libtool-libs)
1760 # The effects of -static are defined in a previous loop.
1761 # We used to do the same as -all-static on platforms that
1762 # didn't have a PIC flag, but the assumption that the effects
1763 # would be equivalent was wrong. It would break on at least
1764 # Digital Unix and AIX.
1784 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1786 save_ifs
="$IFS"; IFS
=','
1787 for flag
in $args; do
1790 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1795 compiler_flags
="$compiler_flags $flag"
1798 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1802 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1804 save_ifs
="$IFS"; IFS
=','
1805 for flag
in $args; do
1808 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1813 compiler_flags
="$compiler_flags $wl$flag"
1814 linker_flags
="$linker_flags $flag"
1817 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1835 # Some other compiler flag.
1837 # Unknown arguments in both finalize_command and compile_command need
1838 # to be aesthetically quoted because they are evaled later.
1839 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1841 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1848 # A standard object.
1853 # A libtool-controlled object.
1855 # Check to see that this really is a libtool object.
1856 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1861 # If there is no directory component, then add one.
1863 */* |
*\\*) .
$arg ;;
1867 if test -z "$pic_object" || \
1868 test -z "$non_pic_object" ||
1869 test "$pic_object" = none
&& \
1870 test "$non_pic_object" = none
; then
1871 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1875 # Extract subdirectory from the argument.
1876 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1877 if test "X$xdir" = "X$arg"; then
1883 if test "$pic_object" != none
; then
1884 # Prepend the subdirectory the object is found in.
1885 pic_object
="$xdir$pic_object"
1887 if test "$prev" = dlfiles
; then
1888 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1889 dlfiles
="$dlfiles $pic_object"
1893 # If libtool objects are unsupported, then we need to preload.
1898 # CHECK ME: I think I busted this. -Ossama
1899 if test "$prev" = dlprefiles
; then
1900 # Preload the old-style object.
1901 dlprefiles
="$dlprefiles $pic_object"
1906 libobjs
="$libobjs $pic_object"
1911 if test "$non_pic_object" != none
; then
1912 # Prepend the subdirectory the object is found in.
1913 non_pic_object
="$xdir$non_pic_object"
1915 # A standard non-PIC object
1916 non_pic_objects
="$non_pic_objects $non_pic_object"
1917 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1918 arg
="$non_pic_object"
1921 # If the PIC object exists, use it instead.
1922 # $xdir was prepended to $pic_object above.
1923 non_pic_object
="$pic_object"
1924 non_pic_objects
="$non_pic_objects $non_pic_object"
1927 # Only an error if not doing a dry-run.
1928 if test -z "$run"; then
1929 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1934 # Extract subdirectory from the argument.
1935 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1936 if test "X$xdir" = "X$arg"; then
1942 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1943 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1944 libobjs
="$libobjs $pic_object"
1945 non_pic_objects
="$non_pic_objects $non_pic_object"
1952 deplibs
="$deplibs $arg"
1953 old_deplibs
="$old_deplibs $arg"
1958 # A libtool-controlled library.
1960 if test "$prev" = dlfiles
; then
1961 # This library was specified with -dlopen.
1962 dlfiles
="$dlfiles $arg"
1964 elif test "$prev" = dlprefiles
; then
1965 # The library was specified with -dlpreopen.
1966 dlprefiles
="$dlprefiles $arg"
1969 deplibs
="$deplibs $arg"
1974 # Some other compiler argument.
1976 # Unknown arguments in both finalize_command and compile_command need
1977 # to be aesthetically quoted because they are evaled later.
1978 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1980 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1987 # Now actually substitute the argument into the commands.
1988 if test -n "$arg"; then
1989 compile_command
="$compile_command $arg"
1990 finalize_command
="$finalize_command $arg"
1992 done # argument parsing loop
1994 if test -n "$prev"; then
1995 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2000 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2001 eval arg
=\"$export_dynamic_flag_spec\"
2002 compile_command
="$compile_command $arg"
2003 finalize_command
="$finalize_command $arg"
2007 # calculate the name of the file, without its directory
2008 outputname
=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2009 libobjs_save
="$libobjs"
2011 if test -n "$shlibpath_var"; then
2012 # get the directories listed in $shlibpath_var
2013 eval shlib_search_path
=\
`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2017 eval sys_lib_search_path
=\"$sys_lib_search_path_spec\"
2018 eval sys_lib_dlsearch_path
=\"$sys_lib_dlsearch_path_spec\"
2020 output_objdir
=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2021 if test "X$output_objdir" = "X$output"; then
2022 output_objdir
="$objdir"
2024 output_objdir
="$output_objdir/$objdir"
2026 # Create the object directory.
2027 if test ! -d "$output_objdir"; then
2028 $show "$mkdir $output_objdir"
2029 $run $mkdir $output_objdir
2031 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2036 # Determine the type of output
2039 $echo "$modename: you must specify an output file" 1>&2
2043 *.
$libext) linkmode
=oldlib
;;
2044 *.lo |
*.
$objext) linkmode
=obj
;;
2045 *.la
) linkmode
=lib
;;
2046 *) linkmode
=prog
;; # Anything else should be a program.
2050 *cygwin
* |
*mingw
* |
*pw32
*)
2051 # don't eliminate duplications in $postdeps and $predeps
2052 duplicate_compiler_generated_deps
=yes
2055 duplicate_compiler_generated_deps
=$duplicate_deps
2061 # Find all interdependent deplibs by searching for libraries
2062 # that are linked more than once (e.g. -la -lb -la)
2063 for deplib
in $deplibs; do
2064 if test "X$duplicate_deps" = "Xyes" ; then
2066 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2069 libs
="$libs $deplib"
2072 if test "$linkmode" = lib
; then
2073 libs
="$predeps $libs $compiler_lib_search_path $postdeps"
2075 # Compute libraries that are listed more than once in $predeps
2076 # $postdeps and mark them as special (i.e., whose duplicates are
2077 # not to be eliminated).
2079 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2080 for pre_post_dep
in $predeps $postdeps; do
2081 case "$pre_post_deps " in
2082 *" $pre_post_dep "*) specialdeplibs
="$specialdeplibs $pre_post_deps" ;;
2084 pre_post_deps
="$pre_post_deps $pre_post_dep"
2093 need_relink
=no
# whether we're linking any uninstalled libtool libraries
2094 notinst_deplibs
= # not-installed libtool libraries
2098 for file in $dlfiles $dlprefiles; do
2102 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2114 passes
="conv scan dlopen dlpreopen link"
2119 for pass
in $passes; do
2120 if test "$linkmode,$pass" = "lib,link" ||
2121 test "$linkmode,$pass" = "prog,scan"; then
2125 if test "$linkmode" = prog
; then
2127 dlopen
) libs
="$dlfiles" ;;
2128 dlpreopen
) libs
="$dlprefiles" ;;
2129 link
) libs
="$deplibs %DEPLIBS% $dependency_libs" ;;
2132 if test "$pass" = dlopen
; then
2133 # Collect dlpreopened libraries
2134 save_deplibs
="$deplibs"
2137 for deplib
in $libs; do
2141 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe)
2142 if test "$linkmode,$pass" = "prog,link"; then
2143 compile_deplibs
="$deplib $compile_deplibs"
2144 finalize_deplibs
="$deplib $finalize_deplibs"
2146 compiler_flags
="$compiler_flags $deplib"
2151 if test "$linkmode" != lib
&& test "$linkmode" != prog
; then
2152 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2155 name
=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2156 for searchdir
in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2157 for search_ext
in .la
$std_shrext .so .a
; do
2158 # Search the libtool library
2159 lib
="$searchdir/lib${name}${search_ext}"
2160 if test -f "$lib"; then
2161 if test "$search_ext" = ".la"; then
2170 if test "$found" != yes; then
2171 # deplib doesn't seem to be a libtool library
2172 if test "$linkmode,$pass" = "prog,link"; then
2173 compile_deplibs
="$deplib $compile_deplibs"
2174 finalize_deplibs
="$deplib $finalize_deplibs"
2176 deplibs
="$deplib $deplibs"
2177 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2180 else # deplib is a libtool library
2181 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2182 # We need to do some special things here, and not later.
2183 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2184 case " $predeps $postdeps " in
2186 if (${SED} -e '2q' $lib |
2187 grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
2191 */* |
*\\*) .
$lib ;;
2194 for l
in $old_library $library_names; do
2197 if test "X$ll" = "X$old_library" ; then # only static version available
2199 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2200 test "X$ladir" = "X$lib" && ladir
="."
2201 lib
=$ladir/$old_library
2202 if test "$linkmode,$pass" = "prog,link"; then
2203 compile_deplibs
="$deplib $compile_deplibs"
2204 finalize_deplibs
="$deplib $finalize_deplibs"
2206 deplibs
="$deplib $deplibs"
2207 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2221 deplibs
="$deplib $deplibs"
2222 test "$pass" = conv
&& continue
2223 newdependency_libs
="$deplib $newdependency_libs"
2224 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2227 if test "$pass" = conv
; then
2228 deplibs
="$deplib $deplibs"
2231 if test "$pass" = scan
; then
2232 deplibs
="$deplib $deplibs"
2234 compile_deplibs
="$deplib $compile_deplibs"
2235 finalize_deplibs
="$deplib $finalize_deplibs"
2237 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2240 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2246 if test "$pass" = link
; then
2247 dir
=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2248 # Make sure the xrpath contains only unique directories.
2251 *) xrpath
="$xrpath $dir" ;;
2254 deplibs
="$deplib $deplibs"
2257 *.la
) lib
="$deplib" ;;
2259 if test "$pass" = conv
; then
2260 deplibs
="$deplib $deplibs"
2266 case $deplibs_check_method in
2268 set dummy
$deplibs_check_method
2269 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2270 if eval $echo \"$deplib\" 2>/dev
/null \
2272 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
2280 if test "$valid_a_lib" != yes; then
2282 $echo "*** Warning: Trying to link with static lib archive $deplib."
2283 $echo "*** I have the capability to make that library automatically link in when"
2284 $echo "*** you link to this library. But I can only do this if you have a"
2285 $echo "*** shared version of the library, which you do not appear to have"
2286 $echo "*** because the file extensions .$libext of this argument makes me believe"
2287 $echo "*** that it is just a static archive that I should not used here."
2290 $echo "*** Warning: Linking the shared library $output against the"
2291 $echo "*** static library $deplib is not portable!"
2292 deplibs
="$deplib $deplibs"
2297 if test "$pass" != link
; then
2298 deplibs
="$deplib $deplibs"
2300 compile_deplibs
="$deplib $compile_deplibs"
2301 finalize_deplibs
="$deplib $finalize_deplibs"
2308 if test "$pass" = conv
; then
2309 deplibs
="$deplib $deplibs"
2310 elif test "$linkmode" = prog
; then
2311 if test "$pass" = dlpreopen ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no
; then
2312 # If there is no dlopen support or we're linking statically,
2313 # we need to preload.
2314 newdlprefiles
="$newdlprefiles $deplib"
2315 compile_deplibs
="$deplib $compile_deplibs"
2316 finalize_deplibs
="$deplib $finalize_deplibs"
2318 newdlfiles
="$newdlfiles $deplib"
2328 if test "$found" = yes ||
test -f "$lib"; then :
2330 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2334 # Check to see that this really is a libtool archive.
2335 if (${SED} -e '2q' $lib |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
2337 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2341 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2342 test "X$ladir" = "X$lib" && ladir
="."
2350 # If the library was installed with an old release of libtool,
2351 # it will not redefine variables installed, or shouldnotlink
2359 */* |
*\\*) .
$lib ;;
2363 if test "$linkmode,$pass" = "lib,link" ||
2364 test "$linkmode,$pass" = "prog,scan" ||
2365 { test "$linkmode" != prog
&& test "$linkmode" != lib
; }; then
2366 test -n "$dlopen" && dlfiles
="$dlfiles $dlopen"
2367 test -n "$dlpreopen" && dlprefiles
="$dlprefiles $dlpreopen"
2370 if test "$pass" = conv
; then
2371 # Only check for convenience libraries
2372 deplibs
="$lib $deplibs"
2373 if test -z "$libdir"; then
2374 if test -z "$old_library"; then
2375 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2378 # It is a libtool convenience library, so add in its objects.
2379 convenience
="$convenience $ladir/$objdir/$old_library"
2380 old_convenience
="$old_convenience $ladir/$objdir/$old_library"
2382 for deplib
in $dependency_libs; do
2383 deplibs
="$deplib $deplibs"
2384 if test "X$duplicate_deps" = "Xyes" ; then
2385 case "$tmp_libs " in
2386 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2389 tmp_libs
="$tmp_libs $deplib"
2391 elif test "$linkmode" != prog
&& test "$linkmode" != lib
; then
2392 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2399 # Get the name of the library we link against.
2401 for l
in $old_library $library_names; do
2404 if test -z "$linklib"; then
2405 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2409 # This library was specified with -dlopen.
2410 if test "$pass" = dlopen
; then
2411 if test -z "$libdir"; then
2412 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2415 if test -z "$dlname" ||
2416 test "$dlopen_support" != yes ||
2417 test "$build_libtool_libs" = no
; then
2418 # If there is no dlname, no dlopen support or we're linking
2419 # statically, we need to preload. We also need to preload any
2420 # dependent libraries so libltdl's deplib preloader doesn't
2421 # bomb out in the load deplibs phase.
2422 dlprefiles
="$dlprefiles $lib $dependency_libs"
2424 newdlfiles
="$newdlfiles $lib"
2429 # We need an absolute path.
2431 [\\/]* |
[A-Za-z
]:[\\/]*) abs_ladir
="$ladir" ;;
2433 abs_ladir
=`cd "$ladir" && pwd`
2434 if test -z "$abs_ladir"; then
2435 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2436 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2441 laname
=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2443 # Find the relevant object directory and library name.
2444 if test "X$installed" = Xyes
; then
2445 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2446 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2454 test "X$hardcode_automatic" = Xyes
&& avoidtemprpath
=yes
2456 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2459 # Remove this search path later
2460 notinst_path
="$notinst_path $abs_ladir"
2462 dir
="$ladir/$objdir"
2463 absdir
="$abs_ladir/$objdir"
2464 # Remove this search path later
2465 notinst_path
="$notinst_path $abs_ladir"
2467 fi # $installed = yes
2468 name
=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2470 # This library was specified with -dlpreopen.
2471 if test "$pass" = dlpreopen
; then
2472 if test -z "$libdir"; then
2473 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2476 # Prefer using a static library (so that no silly _DYNAMIC symbols
2477 # are required to link).
2478 if test -n "$old_library"; then
2479 newdlprefiles
="$newdlprefiles $dir/$old_library"
2480 # Otherwise, use the dlname, so that lt_dlopen finds it.
2481 elif test -n "$dlname"; then
2482 newdlprefiles
="$newdlprefiles $dir/$dlname"
2484 newdlprefiles
="$newdlprefiles $dir/$linklib"
2486 fi # $pass = dlpreopen
2488 if test -z "$libdir"; then
2489 # Link the convenience library
2490 if test "$linkmode" = lib
; then
2491 deplibs
="$dir/$old_library $deplibs"
2492 elif test "$linkmode,$pass" = "prog,link"; then
2493 compile_deplibs
="$dir/$old_library $compile_deplibs"
2494 finalize_deplibs
="$dir/$old_library $finalize_deplibs"
2496 deplibs
="$lib $deplibs" # used for prog,scan pass
2502 if test "$linkmode" = prog
&& test "$pass" != link
; then
2503 newlib_search_path
="$newlib_search_path $ladir"
2504 deplibs
="$lib $deplibs"
2507 if test "$link_all_deplibs" != no ||
test -z "$library_names" ||
2508 test "$build_libtool_libs" = no
; then
2513 for deplib
in $dependency_libs; do
2515 -L*) newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2517 # Need to link against all dependency_libs?
2518 if test "$linkalldeplibs" = yes; then
2519 deplibs
="$deplib $deplibs"
2521 # Need to hardcode shared library paths
2522 # or/and link against static libraries
2523 newdependency_libs
="$deplib $newdependency_libs"
2525 if test "X$duplicate_deps" = "Xyes" ; then
2526 case "$tmp_libs " in
2527 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2530 tmp_libs
="$tmp_libs $deplib"
2533 fi # $linkmode = prog...
2535 if test "$linkmode,$pass" = "prog,link"; then
2536 if test -n "$library_names" &&
2537 { { test "$prefer_static_libs" = no ||
2538 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2539 test -z "$old_library"; }; then
2540 # We need to hardcode the library path
2541 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2542 # Make sure the rpath contains only unique directories.
2543 case "$temp_rpath " in
2546 *) temp_rpath
="$temp_rpath $absdir" ;;
2550 # Hardcode the library path.
2551 # Skip directories that are in the system default run-time
2553 case " $sys_lib_dlsearch_path " in
2556 case "$compile_rpath " in
2558 *) compile_rpath
="$compile_rpath $absdir"
2562 case " $sys_lib_dlsearch_path " in
2565 case "$finalize_rpath " in
2567 *) finalize_rpath
="$finalize_rpath $libdir"
2571 fi # $linkmode,$pass = prog,link...
2573 if test "$alldeplibs" = yes &&
2574 { test "$deplibs_check_method" = pass_all ||
2575 { test "$build_libtool_libs" = yes &&
2576 test -n "$library_names"; }; }; then
2577 # We only need to search for static libraries
2582 link_static
=no
# Whether the deplib will be linked statically
2583 use_static_libs
=$prefer_static_libs
2584 if test "$use_static_libs" = built
&& test "$installed" = yes ; then
2587 if test -n "$library_names" &&
2588 { test "$use_static_libs" = no ||
test -z "$old_library"; }; then
2589 if test "$installed" = no
; then
2590 notinst_deplibs
="$notinst_deplibs $lib"
2593 # This is a shared library
2595 # Warn about portability, can't link against -module's on
2596 # some systems (darwin)
2597 if test "$shouldnotlink" = yes && test "$pass" = link
; then
2599 if test "$linkmode" = prog
; then
2600 $echo "*** Warning: Linking the executable $output against the loadable module"
2602 $echo "*** Warning: Linking the shared library $output against the loadable module"
2604 $echo "*** $linklib is not portable!"
2606 if test "$linkmode" = lib
&&
2607 test "$hardcode_into_libs" = yes; then
2608 # Hardcode the library path.
2609 # Skip directories that are in the system default run-time
2611 case " $sys_lib_dlsearch_path " in
2614 case "$compile_rpath " in
2616 *) compile_rpath
="$compile_rpath $absdir"
2620 case " $sys_lib_dlsearch_path " in
2623 case "$finalize_rpath " in
2625 *) finalize_rpath
="$finalize_rpath $libdir"
2631 if test -n "$old_archive_from_expsyms_cmds"; then
2632 # figure out the soname
2633 set dummy
$library_names
2636 libname
=`eval \\$echo \"$libname_spec\"`
2637 # use dlname if we got it. it's perfectly good, no?
2638 if test -n "$dlname"; then
2640 elif test -n "$soname_spec"; then
2644 major
=`expr $current - $age`
2648 eval soname
=\"$soname_spec\"
2653 # Make a new name for the extract_expsyms_cmds to use
2655 soname
=`$echo $soroot | ${SED} -e 's/^.*\///'`
2656 newlib
="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2658 # If the library has no export list, then create one now
2659 if test -f "$output_objdir/$soname-def"; then :
2661 $show "extracting exported symbol list from \`$soname'"
2662 save_ifs
="$IFS"; IFS
='~'
2663 cmds
=$extract_expsyms_cmds
2664 for cmd
in $cmds; do
2668 $run eval "$cmd" ||
exit $?
2674 if test -f "$output_objdir/$newlib"; then :; else
2675 $show "generating import library for \`$soname'"
2676 save_ifs
="$IFS"; IFS
='~'
2677 cmds
=$old_archive_from_expsyms_cmds
2678 for cmd
in $cmds; do
2682 $run eval "$cmd" ||
exit $?
2686 # make sure the library variables are pointing to the new library
2689 fi # test -n "$old_archive_from_expsyms_cmds"
2691 if test "$linkmode" = prog ||
test "$mode" != relink
; then
2696 case $hardcode_action in
2697 immediate | unsupported
)
2698 if test "$hardcode_direct" = no
; then
2701 *-*-sco3.2v5.0.
[024]*) add_dir
="-L$dir" ;;
2702 *-*-sysv4*uw2
*) add_dir
="-L$dir" ;;
2703 *-*-sysv5OpenUNIX* |
*-*-sysv5UnixWare7.
[01].
[10]* | \
2704 *-*-unixware7*) add_dir
="-L$dir" ;;
2706 # if the lib is a module then we can not link against
2707 # it, someone is ignoring the new warnings I added
2708 if /usr
/bin
/file -L $add 2> /dev
/null |
2709 $EGREP ": [^:]* bundle" >/dev
/null
; then
2710 $echo "** Warning, lib $linklib is a module, not a shared library"
2711 if test -z "$old_library" ; then
2713 $echo "** And there doesn't seem to be a static archive available"
2714 $echo "** The link will probably fail, sorry"
2716 add
="$dir/$old_library"
2720 elif test "$hardcode_minus_L" = no
; then
2722 *-*-sunos*) add_shlibpath
="$dir" ;;
2726 elif test "$hardcode_shlibpath_var" = no
; then
2727 add_shlibpath
="$dir"
2734 if test "$hardcode_direct" = yes; then
2736 elif test "$hardcode_minus_L" = yes; then
2738 # Try looking first in the location we're being installed to.
2739 if test -n "$inst_prefix_dir"; then
2742 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2747 elif test "$hardcode_shlibpath_var" = yes; then
2748 add_shlibpath
="$dir"
2757 if test "$lib_linked" != yes; then
2758 $echo "$modename: configuration error: unsupported hardcode properties"
2762 if test -n "$add_shlibpath"; then
2763 case :$compile_shlibpath: in
2764 *":$add_shlibpath:"*) ;;
2765 *) compile_shlibpath
="$compile_shlibpath$add_shlibpath:" ;;
2768 if test "$linkmode" = prog
; then
2769 test -n "$add_dir" && compile_deplibs
="$add_dir $compile_deplibs"
2770 test -n "$add" && compile_deplibs
="$add $compile_deplibs"
2772 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2773 test -n "$add" && deplibs
="$add $deplibs"
2774 if test "$hardcode_direct" != yes && \
2775 test "$hardcode_minus_L" != yes && \
2776 test "$hardcode_shlibpath_var" = yes; then
2777 case :$finalize_shlibpath: in
2779 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2785 if test "$linkmode" = prog ||
test "$mode" = relink
; then
2789 # Finalize command for both is simple: just hardcode it.
2790 if test "$hardcode_direct" = yes; then
2791 add
="$libdir/$linklib"
2792 elif test "$hardcode_minus_L" = yes; then
2795 elif test "$hardcode_shlibpath_var" = yes; then
2796 case :$finalize_shlibpath: in
2798 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2801 elif test "$hardcode_automatic" = yes; then
2802 if test -n "$inst_prefix_dir" &&
2803 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2804 add
="$inst_prefix_dir$libdir/$linklib"
2806 add
="$libdir/$linklib"
2809 # We cannot seem to hardcode it, guess we'll fake it.
2811 # Try looking first in the location we're being installed to.
2812 if test -n "$inst_prefix_dir"; then
2815 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2822 if test "$linkmode" = prog
; then
2823 test -n "$add_dir" && finalize_deplibs
="$add_dir $finalize_deplibs"
2824 test -n "$add" && finalize_deplibs
="$add $finalize_deplibs"
2826 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2827 test -n "$add" && deplibs
="$add $deplibs"
2830 elif test "$linkmode" = prog
; then
2831 # Here we assume that one of hardcode_direct or hardcode_minus_L
2832 # is not unsupported. This is valid on all known static and
2834 if test "$hardcode_direct" != unsupported
; then
2835 test -n "$old_library" && linklib
="$old_library"
2836 compile_deplibs
="$dir/$linklib $compile_deplibs"
2837 finalize_deplibs
="$dir/$linklib $finalize_deplibs"
2839 compile_deplibs
="-l$name -L$dir $compile_deplibs"
2840 finalize_deplibs
="-l$name -L$dir $finalize_deplibs"
2842 elif test "$build_libtool_libs" = yes; then
2843 # Not a shared library
2844 if test "$deplibs_check_method" != pass_all
; then
2845 # We're trying link a shared library against a static one
2846 # but the system doesn't support it.
2848 # Just print a warning and add the library to dependency_libs so
2849 # that the program can be linked against the static library.
2851 $echo "*** Warning: This system can not link to static lib archive $lib."
2852 $echo "*** I have the capability to make that library automatically link in when"
2853 $echo "*** you link to this library. But I can only do this if you have a"
2854 $echo "*** shared version of the library, which you do not appear to have."
2855 if test "$module" = yes; then
2856 $echo "*** But as you try to build a module library, libtool will still create "
2857 $echo "*** a static module, that should work as long as the dlopening application"
2858 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2859 if test -z "$global_symbol_pipe"; then
2861 $echo "*** However, this would only work if libtool was able to extract symbol"
2862 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2863 $echo "*** not find such a program. So, this module is probably useless."
2864 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2866 if test "$build_old_libs" = no
; then
2867 build_libtool_libs
=module
2870 build_libtool_libs
=no
2874 deplibs
="$dir/$old_library $deplibs"
2877 fi # link shared/static library?
2879 if test "$linkmode" = lib
; then
2880 if test -n "$dependency_libs" &&
2881 { test "$hardcode_into_libs" != yes ||
2882 test "$build_old_libs" = yes ||
2883 test "$link_static" = yes; }; then
2884 # Extract -R from dependency_libs
2886 for libdir
in $dependency_libs; do
2888 -R*) temp_xrpath
=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2890 *" $temp_xrpath "*) ;;
2891 *) xrpath
="$xrpath $temp_xrpath";;
2893 *) temp_deplibs
="$temp_deplibs $libdir";;
2896 dependency_libs
="$temp_deplibs"
2899 newlib_search_path
="$newlib_search_path $absdir"
2900 # Link against this library
2901 test "$link_static" = no
&& newdependency_libs
="$abs_ladir/$laname $newdependency_libs"
2902 # ... and its dependency_libs
2904 for deplib
in $dependency_libs; do
2905 newdependency_libs
="$deplib $newdependency_libs"
2906 if test "X$duplicate_deps" = "Xyes" ; then
2907 case "$tmp_libs " in
2908 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2911 tmp_libs
="$tmp_libs $deplib"
2914 if test "$link_all_deplibs" != no
; then
2915 # Add the search paths of all dependency libraries
2916 for deplib
in $dependency_libs; do
2918 -L*) path
="$deplib" ;;
2920 dir
=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2921 test "X$dir" = "X$deplib" && dir
="."
2922 # We need an absolute path.
2924 [\\/]* |
[A-Za-z
]:[\\/]*) absdir
="$dir" ;;
2926 absdir
=`cd "$dir" && pwd`
2927 if test -z "$absdir"; then
2928 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2933 if grep "^installed=no" $deplib > /dev
/null
; then
2934 path
="$absdir/$objdir"
2936 eval libdir
=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2937 if test -z "$libdir"; then
2938 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2941 if test "$absdir" != "$libdir"; then
2942 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2949 # we do not want to link against static libs,
2950 # but need to link against shared
2951 eval deplibrary_names
=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2952 if test -n "$deplibrary_names" ; then
2953 for tmp
in $deplibrary_names ; do
2956 if test -f "$path/$depdepl" ; then
2957 depdepl
="$path/$depdepl"
2959 # do not add paths which are already there
2960 case " $newlib_search_path " in
2962 *) newlib_search_path
="$newlib_search_path $path";;
2975 # Again, we only want to link against shared libraries
2976 eval tmp_libs
=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2977 for tmp
in $newlib_search_path ; do
2978 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2979 eval depdepl
="$tmp/lib$tmp_libs.dylib"
2990 case " $deplibs " in
2992 *) deplibs
="$path $deplibs" ;;
2994 case " $deplibs " in
2996 *) deplibs
="$depdepl $deplibs" ;;
2999 fi # link_all_deplibs != no
3001 done # for deplib in $libs
3002 dependency_libs
="$newdependency_libs"
3003 if test "$pass" = dlpreopen
; then
3004 # Link the dlpreopened libraries before other libraries
3005 for deplib
in $save_deplibs; do
3006 deplibs
="$deplib $deplibs"
3009 if test "$pass" != dlopen
; then
3010 if test "$pass" != conv
; then
3011 # Make sure lib_search_path contains only unique directories.
3013 for dir
in $newlib_search_path; do
3014 case "$lib_search_path " in
3016 *) lib_search_path
="$lib_search_path $dir" ;;
3022 if test "$linkmode,$pass" != "prog,link"; then
3025 vars
="compile_deplibs finalize_deplibs"
3027 for var
in $vars dependency_libs
; do
3028 # Add libraries to $var in reverse order
3029 eval tmp_libs
=\"\$
$var\"
3031 for deplib
in $tmp_libs; do
3032 # FIXME: Pedantically, this is the right thing to do, so
3033 # that some nasty dependency loop isn't accidentally
3035 #new_libs="$deplib $new_libs"
3036 # Pragmatically, this seems to cause very few problems in
3039 -L*) new_libs
="$deplib $new_libs" ;;
3042 # And here is the reason: when a library appears more
3043 # than once as an explicit dependence of a library, or
3044 # is implicitly linked in more than once by the
3045 # compiler, it is considered special, and multiple
3046 # occurrences thereof are not removed. Compare this
3047 # with having the same library being listed as a
3048 # dependency of multiple other libraries: in this case,
3049 # we know (pedantically, we assume) the library does not
3050 # need to be listed more than once, so we keep only the
3051 # last copy. This is not always right, but it is rare
3052 # enough that we require users that really mean to play
3053 # such unportable linking tricks to link the library
3054 # using -Wl,-lname, so that libtool does not consider it
3055 # for duplicate removal.
3056 case " $specialdeplibs " in
3057 *" $deplib "*) new_libs
="$deplib $new_libs" ;;
3059 case " $new_libs " in
3061 *) new_libs
="$deplib $new_libs" ;;
3069 for deplib
in $new_libs; do
3072 case " $tmp_libs " in
3074 *) tmp_libs
="$tmp_libs $deplib" ;;
3077 *) tmp_libs
="$tmp_libs $deplib" ;;
3080 eval $var=\"$tmp_libs\"
3083 # Last step: remove runtime libs from dependency_libs
3084 # (they stay in deplibs)
3086 for i
in $dependency_libs ; do
3087 case " $predeps $postdeps $compiler_lib_search_path " in
3092 if test -n "$i" ; then
3093 tmp_libs
="$tmp_libs $i"
3096 dependency_libs
=$tmp_libs
3098 if test "$linkmode" = prog
; then
3099 dlfiles
="$newdlfiles"
3100 dlprefiles
="$newdlprefiles"
3105 if test -n "$deplibs"; then
3106 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3109 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
3110 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3113 if test -n "$rpath"; then
3114 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3117 if test -n "$xrpath"; then
3118 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3121 if test -n "$vinfo"; then
3122 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3125 if test -n "$release"; then
3126 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3129 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
3130 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3133 # Now set the variables for building old libraries.
3134 build_libtool_libs
=no
3136 objs
="$objs$old_deplibs"
3140 # Make sure we only generate libraries of the form `libNAME.la'.
3143 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3144 eval shared_ext
=\"$shrext_cmds\"
3145 eval libname
=\"$libname_spec\"
3148 if test "$module" = no
; then
3149 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3153 if test "$need_lib_prefix" != no
; then
3154 # Add the "lib" prefix for modules if required
3155 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3156 eval shared_ext
=\"$shrext_cmds\"
3157 eval libname
=\"$libname_spec\"
3159 libname
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3164 if test -n "$objs"; then
3165 if test "$deplibs_check_method" != pass_all
; then
3166 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3170 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3171 $echo "*** objects $objs is not portable!"
3172 libobjs
="$libobjs $objs"
3176 if test "$dlself" != no
; then
3177 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3181 if test "$#" -gt 2; then
3182 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3187 if test -z "$rpath"; then
3188 if test "$build_libtool_libs" = yes; then
3189 # Building a libtool convenience library.
3190 # Some compilers have problems with a `.al' extension so
3191 # convenience libraries should have the same extension an
3192 # archive normally would.
3193 oldlibs
="$output_objdir/$libname.$libext $oldlibs"
3194 build_libtool_libs
=convenience
3198 if test -n "$vinfo"; then
3199 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3202 if test -n "$release"; then
3203 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3207 # Parse the version information argument.
3208 save_ifs
="$IFS"; IFS
=':'
3209 set dummy
$vinfo 0 0 0
3212 if test -n "$8"; then
3213 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3218 # convert absolute version numbers to libtool ages
3219 # this retains compatibility with .la files and attempts
3220 # to make the code below a bit more comprehensible
3222 case $vinfo_number in
3226 number_revision
="$4"
3228 # There are really only two kinds -- those that
3229 # use the current revision as the major version
3230 # and those that subtract age and use age as
3231 # a minor version. But, then there is irix
3232 # which has an extra 1 added just for fun
3234 case $version_type in
3235 darwin|linux|osf|windows|none
)
3236 current
=`expr $number_major + $number_minor`
3238 revision
="$number_revision"
3240 freebsd-aout|freebsd-elf|sunos
)
3241 current
="$number_major"
3242 revision
="$number_minor"
3246 current
=`expr $number_major + $number_minor - 1`
3248 revision
="$number_minor"
3259 # Check that each of the things are valid numbers.
3261 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]) ;;
3263 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3264 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3270 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]) ;;
3272 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3273 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3279 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]) ;;
3281 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3282 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3287 if test "$age" -gt "$current"; then
3288 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3289 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3293 # Calculate the version variables.
3297 case $version_type in
3301 # Like Linux, but with the current version available in
3302 # verstring for coding it into the library header
3303 major
=.
`expr $current - $age`
3304 versuffix
="$major.$age.$revision"
3305 # Darwin ld doesn't like 0 for these options...
3306 minor_current
=`expr $current + 1`
3307 verstring
="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3312 versuffix
=".$current.$revision";
3317 versuffix
=".$current";
3321 major
=`expr $current - $age + 1`
3323 case $version_type in
3324 nonstopux
) verstring_prefix
=nonstopux
;;
3325 *) verstring_prefix
=sgi
;;
3327 verstring
="$verstring_prefix$major.$revision"
3329 # Add in all the interfaces that we are compatible with.
3331 while test "$loop" -ne 0; do
3332 iface
=`expr $revision - $loop`
3333 loop
=`expr $loop - 1`
3334 verstring
="$verstring_prefix$major.$iface:$verstring"
3337 # Before this point, $major must not contain `.'.
3339 versuffix
="$major.$revision"
3343 major
=.
`expr $current - $age`
3344 versuffix
="$major.$age.$revision"
3348 major
=.
`expr $current - $age`
3349 versuffix
=".$current.$age.$revision"
3350 verstring
="$current.$age.$revision"
3352 # Add in all the interfaces that we are compatible with.
3354 while test "$loop" -ne 0; do
3355 iface
=`expr $current - $loop`
3356 loop
=`expr $loop - 1`
3357 verstring
="$verstring:${iface}.0"
3360 # Make executables depend on our current version.
3361 verstring
="$verstring:${current}.0"
3366 versuffix
=".$current.$revision"
3370 # Use '-' rather than '.', since we only want one
3371 # extension on DOS 8.3 filesystems.
3372 major
=`expr $current - $age`
3377 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3378 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3383 # Clear the version info if we defaulted, and they specified a release.
3384 if test -z "$vinfo" && test -n "$release"; then
3386 case $version_type in
3388 # we can't check for "0.0" in archive_cmds due to quoting
3389 # problems, so we reset it completely
3396 if test "$need_version" = no
; then
3403 # Remove version info from name if versioning should be avoided
3404 if test "$avoid_version" = yes && test "$need_version" = no
; then
3410 # Check to see if the archive will have undefined symbols.
3411 if test "$allow_undefined" = yes; then
3412 if test "$allow_undefined_flag" = unsupported
; then
3413 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3414 build_libtool_libs
=no
3418 # Don't allow undefined symbols.
3419 allow_undefined_flag
="$no_undefined_flag"
3423 if test "$mode" != relink
; then
3424 # Remove our outputs, but don't remove object files since they
3425 # may have been created when compiling PIC objects.
3427 tempremovelist
=`$echo "$output_objdir/*"`
3428 for p
in $tempremovelist; do
3432 $output_objdir/$outputname |
$output_objdir/$libname.
* |
$output_objdir/${libname}${release}.
*)
3433 if test "X$precious_files_regex" != "X"; then
3434 if echo $p |
$EGREP -e "$precious_files_regex" >/dev
/null
2>&1
3439 removelist
="$removelist $p"
3444 if test -n "$removelist"; then
3445 $show "${rm}r $removelist"
3446 $run ${rm}r
$removelist
3450 # Now set the variables for building old libraries.
3451 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience
; then
3452 oldlibs
="$oldlibs $output_objdir/$libname.$libext"
3454 # Transform .lo files to .o files.
3455 oldobjs
="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3458 # Eliminate all temporary directories.
3459 # for path in $notinst_path; do
3460 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3461 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3462 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3465 if test -n "$xrpath"; then
3466 # If the user specified any rpath flags, then add them.
3468 for libdir
in $xrpath; do
3469 temp_xrpath
="$temp_xrpath -R$libdir"
3470 case "$finalize_rpath " in
3472 *) finalize_rpath
="$finalize_rpath $libdir" ;;
3475 if test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes; then
3476 dependency_libs
="$temp_xrpath $dependency_libs"
3480 # Make sure dlfiles contains only unique files that won't be dlpreopened
3481 old_dlfiles
="$dlfiles"
3483 for lib
in $old_dlfiles; do
3484 case " $dlprefiles $dlfiles " in
3486 *) dlfiles
="$dlfiles $lib" ;;
3490 # Make sure dlprefiles contains only unique files
3491 old_dlprefiles
="$dlprefiles"
3493 for lib
in $old_dlprefiles; do
3494 case "$dlprefiles " in
3496 *) dlprefiles
="$dlprefiles $lib" ;;
3500 if test "$build_libtool_libs" = yes; then
3501 if test -n "$rpath"; then
3503 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-*-beos*)
3504 # these systems don't actually have a c library (as such)!
3506 *-*-rhapsody* |
*-*-darwin1.
[012])
3507 # Rhapsody C library is in the System framework
3508 deplibs
="$deplibs -framework System"
3511 # Don't link with libc until the a.out ld.so is fixed.
3513 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
3514 # Do not include libc due to us having libc/libc_r.
3516 *-*-sco3.2v5
* |
*-*-sco5v6*)
3517 # Causes problems with __ctype
3519 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
3520 # Compiler inserts libc in the correct place for threads to work
3523 # Add libc to deplibs on all other systems if necessary.
3524 if test "$build_libtool_need_lc" = "yes"; then
3525 deplibs
="$deplibs -lc"
3531 # Transform deplibs into only deplibs that can be linked in shared.
3533 libname_save
=$libname
3534 release_save
=$release
3535 versuffix_save
=$versuffix
3537 # I'm not sure if I'm treating the release correctly. I think
3538 # release should show up in the -l (ie -lgmp5) so we don't want to
3539 # add it in twice. Is that correct?
3545 case $deplibs_check_method in
3547 # Don't check for shared/static. Everything works.
3548 # This might be a little naive. We might want to check
3549 # whether the library exists or not. But this is on
3550 # osf3 & osf4 and I'm not really sure... Just
3551 # implementing what was already the behavior.
3555 # This code stresses the "libraries are programs" paradigm to its
3556 # limits. Maybe even breaks it. We compile a program, linking it
3557 # against the deplibs as a proxy for the library. Then we can check
3558 # whether they linked in statically or dynamically with ldd.
3560 cat > conftest.c
<<EOF
3561 int main() { return 0; }
3564 if $LTCC $LTCFLAGS -o conftest conftest.c
$deplibs; then
3565 ldd_output
=`ldd conftest`
3566 for i
in $deplibs; do
3567 name
=`expr $i : '-l\(.*\)'`
3568 # If $name is empty we are operating on a -L argument.
3569 if test "$name" != "" && test "$name" != "0"; then
3570 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3571 case " $predeps $postdeps " in
3573 newdeplibs
="$newdeplibs $i"
3578 if test -n "$i" ; then
3579 libname
=`eval \\$echo \"$libname_spec\"`
3580 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3581 set dummy
$deplib_matches
3583 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3584 newdeplibs
="$newdeplibs $i"
3588 $echo "*** Warning: dynamic linker does not accept needed library $i."
3589 $echo "*** I have the capability to make that library automatically link in when"
3590 $echo "*** you link to this library. But I can only do this if you have a"
3591 $echo "*** shared version of the library, which I believe you do not have"
3592 $echo "*** because a test_compile did reveal that the linker did not use it for"
3593 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3597 newdeplibs
="$newdeplibs $i"
3601 # Error occurred in the first compile. Let's try to salvage
3602 # the situation: Compile a separate program for each library.
3603 for i
in $deplibs; do
3604 name
=`expr $i : '-l\(.*\)'`
3605 # If $name is empty we are operating on a -L argument.
3606 if test "$name" != "" && test "$name" != "0"; then
3608 if $LTCC $LTCFLAGS -o conftest conftest.c
$i; then
3609 ldd_output
=`ldd conftest`
3610 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3611 case " $predeps $postdeps " in
3613 newdeplibs
="$newdeplibs $i"
3618 if test -n "$i" ; then
3619 libname
=`eval \\$echo \"$libname_spec\"`
3620 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3621 set dummy
$deplib_matches
3623 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3624 newdeplibs
="$newdeplibs $i"
3628 $echo "*** Warning: dynamic linker does not accept needed library $i."
3629 $echo "*** I have the capability to make that library automatically link in when"
3630 $echo "*** you link to this library. But I can only do this if you have a"
3631 $echo "*** shared version of the library, which you do not appear to have"
3632 $echo "*** because a test_compile did reveal that the linker did not use this one"
3633 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3639 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3640 $echo "*** make it link in! You will probably need to install it or some"
3641 $echo "*** library that it depends on before this library will be fully"
3642 $echo "*** functional. Installing it before continuing would be even better."
3645 newdeplibs
="$newdeplibs $i"
3651 set dummy
$deplibs_check_method
3652 file_magic_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3653 for a_deplib
in $deplibs; do
3654 name
=`expr $a_deplib : '-l\(.*\)'`
3655 # If $name is empty we are operating on a -L argument.
3656 if test "$name" != "" && test "$name" != "0"; then
3657 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3658 case " $predeps $postdeps " in
3660 newdeplibs
="$newdeplibs $a_deplib"
3665 if test -n "$a_deplib" ; then
3666 libname
=`eval \\$echo \"$libname_spec\"`
3667 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3668 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3669 for potent_lib
in $potential_libs; do
3670 # Follow soft links.
3671 if ls -lLd "$potent_lib" 2>/dev
/null \
3672 |
grep " -> " >/dev
/null
; then
3675 # The statement above tries to avoid entering an
3676 # endless loop below, in case of cyclic links.
3677 # We might still enter an endless loop, since a link
3678 # loop can be closed while we follow links,
3680 potlib
="$potent_lib"
3681 while test -h "$potlib" 2>/dev
/null
; do
3682 potliblink
=`ls -ld $potlib | ${SED} 's/.* -> //'`
3684 [\\/]* |
[A-Za-z
]:[\\/]*) potlib
="$potliblink";;
3685 *) potlib
=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3688 if eval $file_magic_cmd \"\
$potlib\" 2>/dev
/null \
3690 |
$EGREP "$file_magic_regex" > /dev
/null
; then
3691 newdeplibs
="$newdeplibs $a_deplib"
3698 if test -n "$a_deplib" ; then
3701 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3702 $echo "*** I have the capability to make that library automatically link in when"
3703 $echo "*** you link to this library. But I can only do this if you have a"
3704 $echo "*** shared version of the library, which you do not appear to have"
3705 $echo "*** because I did check the linker path looking for a file starting"
3706 if test -z "$potlib" ; then
3707 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3709 $echo "*** with $libname and none of the candidates passed a file format test"
3710 $echo "*** using a file magic. Last file checked: $potlib"
3714 # Add a -L argument.
3715 newdeplibs
="$newdeplibs $a_deplib"
3717 done # Gone through all deplibs.
3720 set dummy
$deplibs_check_method
3721 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3722 for a_deplib
in $deplibs; do
3723 name
=`expr $a_deplib : '-l\(.*\)'`
3724 # If $name is empty we are operating on a -L argument.
3725 if test -n "$name" && test "$name" != "0"; then
3726 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3727 case " $predeps $postdeps " in
3729 newdeplibs
="$newdeplibs $a_deplib"
3734 if test -n "$a_deplib" ; then
3735 libname
=`eval \\$echo \"$libname_spec\"`
3736 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3737 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3738 for potent_lib
in $potential_libs; do
3739 potlib
="$potent_lib" # see symlink-check above in file_magic test
3740 if eval $echo \"$potent_lib\" 2>/dev
/null \
3742 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
3743 newdeplibs
="$newdeplibs $a_deplib"
3750 if test -n "$a_deplib" ; then
3753 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3754 $echo "*** I have the capability to make that library automatically link in when"
3755 $echo "*** you link to this library. But I can only do this if you have a"
3756 $echo "*** shared version of the library, which you do not appear to have"
3757 $echo "*** because I did check the linker path looking for a file starting"
3758 if test -z "$potlib" ; then
3759 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3761 $echo "*** with $libname and none of the candidates passed a file format test"
3762 $echo "*** using a regex pattern. Last file checked: $potlib"
3766 # Add a -L argument.
3767 newdeplibs
="$newdeplibs $a_deplib"
3769 done # Gone through all deplibs.
3773 tmp_deplibs
=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3774 -e 's/ -[LR][^ ]*//g'`
3775 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3776 for i
in $predeps $postdeps ; do
3777 # can't use Xsed below, because $i might contain '/'
3778 tmp_deplibs
=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3781 if $echo "X $tmp_deplibs" |
$Xsed -e 's/[ ]//g' \
3782 |
grep .
>/dev
/null
; then
3784 if test "X$deplibs_check_method" = "Xnone"; then
3785 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3787 $echo "*** Warning: inter-library dependencies are not known to be supported."
3789 $echo "*** All declared inter-library dependencies are being dropped."
3794 versuffix
=$versuffix_save
3796 release
=$release_save
3797 libname
=$libname_save
3801 *-*-rhapsody* |
*-*-darwin1.
[012])
3802 # On Rhapsody replace the C library is the System framework
3803 newdeplibs
=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3807 if test "$droppeddeps" = yes; then
3808 if test "$module" = yes; then
3810 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3811 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3812 $echo "*** a static module, that should work as long as the dlopening"
3813 $echo "*** application is linked with the -dlopen flag."
3814 if test -z "$global_symbol_pipe"; then
3816 $echo "*** However, this would only work if libtool was able to extract symbol"
3817 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3818 $echo "*** not find such a program. So, this module is probably useless."
3819 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3821 if test "$build_old_libs" = no
; then
3822 oldlibs
="$output_objdir/$libname.$libext"
3823 build_libtool_libs
=module
3826 build_libtool_libs
=no
3829 $echo "*** The inter-library dependencies that have been dropped here will be"
3830 $echo "*** automatically added whenever a program is linked with this library"
3831 $echo "*** or is declared to -dlopen it."
3833 if test "$allow_undefined" = no
; then
3835 $echo "*** Since this library must not contain undefined symbols,"
3836 $echo "*** because either the platform does not support them or"
3837 $echo "*** it was explicitly requested with -no-undefined,"
3838 $echo "*** libtool will only create a static version of it."
3839 if test "$build_old_libs" = no
; then
3840 oldlibs
="$output_objdir/$libname.$libext"
3841 build_libtool_libs
=module
3844 build_libtool_libs
=no
3849 # Done checking deplibs!
3854 # move library search paths that coincide with paths to not yet
3855 # installed libraries to the beginning of the library search list
3857 for path
in $notinst_path; do
3858 case " $new_libs " in
3859 *" -L$path/$objdir "*) ;;
3861 case " $deplibs " in
3862 *" -L$path/$objdir "*)
3863 new_libs
="$new_libs -L$path/$objdir" ;;
3868 for deplib
in $deplibs; do
3871 case " $new_libs " in
3873 *) new_libs
="$new_libs $deplib" ;;
3876 *) new_libs
="$new_libs $deplib" ;;
3882 # All the library-specific variables (install_libdir is set above).
3887 # Test again, we may have decided not to build it any more
3888 if test "$build_libtool_libs" = yes; then
3889 if test "$hardcode_into_libs" = yes; then
3890 # Hardcode the library paths
3893 rpath
="$finalize_rpath"
3894 test "$mode" != relink
&& rpath
="$compile_rpath$rpath"
3895 for libdir
in $rpath; do
3896 if test -n "$hardcode_libdir_flag_spec"; then
3897 if test -n "$hardcode_libdir_separator"; then
3898 if test -z "$hardcode_libdirs"; then
3899 hardcode_libdirs
="$libdir"
3901 # Just accumulate the unique libdirs.
3902 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3903 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3906 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3911 eval flag
=\"$hardcode_libdir_flag_spec\"
3912 dep_rpath
="$dep_rpath $flag"
3914 elif test -n "$runpath_var"; then
3915 case "$perm_rpath " in
3917 *) perm_rpath
="$perm_rpath $libdir" ;;
3921 # Substitute the hardcoded libdirs into the rpath.
3922 if test -n "$hardcode_libdir_separator" &&
3923 test -n "$hardcode_libdirs"; then
3924 libdir
="$hardcode_libdirs"
3925 if test -n "$hardcode_libdir_flag_spec_ld"; then
3926 eval dep_rpath
=\"$hardcode_libdir_flag_spec_ld\"
3928 eval dep_rpath
=\"$hardcode_libdir_flag_spec\"
3931 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3932 # We should set the runpath_var.
3934 for dir
in $perm_rpath; do
3937 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3939 test -n "$dep_rpath" && deplibs
="$dep_rpath $deplibs"
3942 shlibpath
="$finalize_shlibpath"
3943 test "$mode" != relink
&& shlibpath
="$compile_shlibpath$shlibpath"
3944 if test -n "$shlibpath"; then
3945 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3948 # Get the real and link names of the library.
3949 eval shared_ext
=\"$shrext_cmds\"
3950 eval library_names
=\"$library_names_spec\"
3951 set dummy
$library_names
3955 if test -n "$soname_spec"; then
3956 eval soname
=\"$soname_spec\"
3960 if test -z "$dlname"; then
3964 lib
="$output_objdir/$realname"
3968 linknames
="$linknames $link"
3971 # Use standard objects if they are pic
3972 test -z "$pic_flag" && libobjs
=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3974 # Prepare the list of exported symbols
3975 if test -z "$export_symbols"; then
3976 if test "$always_export_symbols" = yes ||
test -n "$export_symbols_regex"; then
3977 $show "generating symbol list for \`$libname.la'"
3978 export_symbols
="$output_objdir/$libname.exp"
3979 $run $rm $export_symbols
3980 cmds
=$export_symbols_cmds
3981 save_ifs
="$IFS"; IFS
='~'
3982 for cmd
in $cmds; do
3985 if len
=`expr "X$cmd" : ".*"` &&
3986 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
3988 $run eval "$cmd" ||
exit $?
3989 skipped_export
=false
3991 # The command line is too long to execute in one step.
3992 $show "using reloadable object file for export list..."
3994 # Break out early, otherwise skipped_export may be
3995 # set to false by a later but shorter cmd.
4000 if test -n "$export_symbols_regex"; then
4001 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4002 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4003 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4004 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4009 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4010 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4015 for test_deplib
in $deplibs; do
4016 case " $convenience " in
4017 *" $test_deplib "*) ;;
4019 if test -n "$inst_prefix_dir" && (echo "$test_deplib" |
grep -- "$inst_prefix_dir" >/dev
/null
); then
4020 inst_prefix_arg
="$inst_prefix_arg $test_deplib"
4022 tmp_deplibs
="$tmp_deplibs $test_deplib"
4027 deplibs
="$tmp_deplibs"
4028 if test -n "$inst_prefix_arg"; then
4029 deplibs
="$inst_prefix_arg $deplibs"
4032 if test -n "$convenience"; then
4033 if test -n "$whole_archive_flag_spec"; then
4034 save_libobjs
=$libobjs
4035 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4037 gentop
="$output_objdir/${outputname}x"
4038 generated
="$generated $gentop"
4040 func_extract_archives
$gentop $convenience
4041 libobjs
="$libobjs $func_extract_archives_result"
4045 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4046 eval flag
=\"$thread_safe_flag_spec\"
4047 linker_flags
="$linker_flags $flag"
4050 # Make a backup of the uninstalled library when relinking
4051 if test "$mode" = relink
; then
4052 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' ||
exit $?
4055 # Do each of the archive commands.
4056 if test "$module" = yes && test -n "$module_cmds" ; then
4057 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4058 eval test_cmds
=\"$module_expsym_cmds\"
4059 cmds
=$module_expsym_cmds
4061 eval test_cmds
=\"$module_cmds\"
4065 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4066 eval test_cmds
=\"$archive_expsym_cmds\"
4067 cmds
=$archive_expsym_cmds
4069 eval test_cmds
=\"$archive_cmds\"
4074 if test "X$skipped_export" != "X:" &&
4075 len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4076 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
4079 # The command line is too long to link in one step, link piecewise.
4080 $echo "creating reloadable object files..."
4082 # Save the value of $output and $libobjs because we want to
4083 # use them later. If we have whole_archive_flag_spec, we
4084 # want to use save_libobjs as it was before
4085 # whole_archive_flag_spec was expanded, because we can't
4086 # assume the linker understands whole_archive_flag_spec.
4087 # This may have to be revisited, in case too many
4088 # convenience libraries get linked in and end up exceeding
4090 if test -z "$convenience" ||
test -z "$whole_archive_flag_spec"; then
4091 save_libobjs
=$libobjs
4094 output_la
=`$echo "X$output" | $Xsed -e "$basename"`
4096 # Clear the reloadable object creation command queue and
4097 # initialize k to one.
4104 output
=$output_objdir/$output_la-${k}.
$objext
4105 # Loop over the list of objects to be linked.
4106 for obj
in $save_libobjs
4108 eval test_cmds
=\"$reload_cmds $objlist $last_robj\"
4109 if test "X$objlist" = X ||
4110 { len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4111 test "$len" -le "$max_cmd_len"; }; then
4112 objlist
="$objlist $obj"
4114 # The command $test_cmds is almost too long, add a
4115 # command to the queue.
4116 if test "$k" -eq 1 ; then
4117 # The first file doesn't have a previous command to add.
4118 eval concat_cmds
=\"$reload_cmds $objlist $last_robj\"
4120 # All subsequent reloadable object files will link in
4121 # the last one created.
4122 eval concat_cmds
=\"\
$concat_cmds~
$reload_cmds $objlist $last_robj\"
4124 last_robj
=$output_objdir/$output_la-${k}.
$objext
4126 output
=$output_objdir/$output_la-${k}.
$objext
4131 # Handle the remaining objects by creating one last
4132 # reloadable object file. All subsequent reloadable object
4133 # files will link in the last one created.
4134 test -z "$concat_cmds" || concat_cmds
=$concat_cmds~
4135 eval concat_cmds
=\"\
${concat_cmds}$reload_cmds $objlist $last_robj\"
4137 if ${skipped_export-false}; then
4138 $show "generating symbol list for \`$libname.la'"
4139 export_symbols
="$output_objdir/$libname.exp"
4140 $run $rm $export_symbols
4142 # Append the command to create the export file.
4143 eval concat_cmds
=\"\
$concat_cmds~
$export_symbols_cmds\"
4146 # Set up a command to remove the reloadable object files
4147 # after they are used.
4149 while test "$i" -lt "$k"
4152 delfiles
="$delfiles $output_objdir/$output_la-${i}.$objext"
4155 $echo "creating a temporary reloadable object file: $output"
4157 # Loop through the commands generated above and execute them.
4158 save_ifs
="$IFS"; IFS
='~'
4159 for cmd
in $concat_cmds; do
4162 $run eval "$cmd" ||
exit $?
4167 # Restore the value of output.
4170 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4171 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4173 # Expand the library linking commands again to reset the
4174 # value of $libobjs for piecewise linking.
4176 # Do each of the archive commands.
4177 if test "$module" = yes && test -n "$module_cmds" ; then
4178 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4179 cmds
=$module_expsym_cmds
4184 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4185 cmds
=$archive_expsym_cmds
4191 # Append the command to remove the reloadable object files
4192 # to the just-reset $cmds.
4193 eval cmds
=\"\
$cmds~\
$rm $delfiles\"
4195 save_ifs
="$IFS"; IFS
='~'
4196 for cmd
in $cmds; do
4200 $run eval "$cmd" ||
{
4203 # Restore the uninstalled library and exit
4204 if test "$mode" = relink
; then
4205 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4213 # Restore the uninstalled library and exit
4214 if test "$mode" = relink
; then
4215 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' ||
exit $?
4217 if test -n "$convenience"; then
4218 if test -z "$whole_archive_flag_spec"; then
4219 $show "${rm}r $gentop"
4220 $run ${rm}r
"$gentop"
4227 # Create links to the real library.
4228 for linkname
in $linknames; do
4229 if test "$realname" != "$linkname"; then
4230 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4231 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' ||
exit $?
4235 # If -module or -export-dynamic was specified, set the dlname.
4236 if test "$module" = yes ||
test "$export_dynamic" = yes; then
4237 # On all known operating systems, these are identical.
4244 if test -n "$deplibs"; then
4245 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4248 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4249 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4252 if test -n "$rpath"; then
4253 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4256 if test -n "$xrpath"; then
4257 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4260 if test -n "$vinfo"; then
4261 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4264 if test -n "$release"; then
4265 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4270 if test -n "$objs$old_deplibs"; then
4271 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4275 obj
=`$echo "X$output" | $Xsed -e "$lo2o"`
4283 # Delete the old objects.
4284 $run $rm $obj $libobj
4286 # Objects from convenience libraries. This assumes
4287 # single-version convenience libraries. Whenever we create
4288 # different ones for PIC/non-PIC, this we'll have to duplicate
4292 # reload_cmds runs $LD directly, so let us get rid of
4293 # -Wl from whole_archive_flag_spec and hope we can get by with
4294 # turning comma into space..
4297 if test -n "$convenience"; then
4298 if test -n "$whole_archive_flag_spec"; then
4299 eval tmp_whole_archive_flags
=\"$whole_archive_flag_spec\"
4300 reload_conv_objs
=$reload_objs\
`$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4302 gentop
="$output_objdir/${obj}x"
4303 generated
="$generated $gentop"
4305 func_extract_archives
$gentop $convenience
4306 reload_conv_objs
="$reload_objs $func_extract_archives_result"
4310 # Create the old-style object.
4311 reload_objs
="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4315 save_ifs
="$IFS"; IFS
='~'
4316 for cmd
in $cmds; do
4320 $run eval "$cmd" ||
exit $?
4324 # Exit if we aren't doing a library object file.
4325 if test -z "$libobj"; then
4326 if test -n "$gentop"; then
4327 $show "${rm}r $gentop"
4334 if test "$build_libtool_libs" != yes; then
4335 if test -n "$gentop"; then
4336 $show "${rm}r $gentop"
4340 # Create an invalid libtool object if no PIC, so that we don't
4341 # accidentally link it into a program.
4342 # $show "echo timestamp > $libobj"
4343 # $run eval "echo timestamp > $libobj" || exit $?
4347 if test -n "$pic_flag" ||
test "$pic_mode" != default
; then
4348 # Only do commands if we really have different PIC objects.
4349 reload_objs
="$libobjs $reload_conv_objs"
4352 save_ifs
="$IFS"; IFS
='~'
4353 for cmd
in $cmds; do
4357 $run eval "$cmd" ||
exit $?
4362 if test -n "$gentop"; then
4363 $show "${rm}r $gentop"
4372 *cygwin
*) output
=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4374 if test -n "$vinfo"; then
4375 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4378 if test -n "$release"; then
4379 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4382 if test "$preload" = yes; then
4383 if test "$dlopen_support" = unknown
&& test "$dlopen_self" = unknown
&&
4384 test "$dlopen_self_static" = unknown
; then
4385 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4390 *-*-rhapsody* |
*-*-darwin1.
[012])
4391 # On Rhapsody replace the C library is the System framework
4392 compile_deplibs
=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4393 finalize_deplibs
=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4399 # Don't allow lazy linking, it breaks C++ global constructors
4400 if test "$tagname" = CXX
; then
4401 compile_command
="$compile_command ${wl}-bind_at_load"
4402 finalize_command
="$finalize_command ${wl}-bind_at_load"
4408 # move library search paths that coincide with paths to not yet
4409 # installed libraries to the beginning of the library search list
4411 for path
in $notinst_path; do
4412 case " $new_libs " in
4413 *" -L$path/$objdir "*) ;;
4415 case " $compile_deplibs " in
4416 *" -L$path/$objdir "*)
4417 new_libs
="$new_libs -L$path/$objdir" ;;
4422 for deplib
in $compile_deplibs; do
4425 case " $new_libs " in
4427 *) new_libs
="$new_libs $deplib" ;;
4430 *) new_libs
="$new_libs $deplib" ;;
4433 compile_deplibs
="$new_libs"
4436 compile_command
="$compile_command $compile_deplibs"
4437 finalize_command
="$finalize_command $finalize_deplibs"
4439 if test -n "$rpath$xrpath"; then
4440 # If the user specified any rpath flags, then add them.
4441 for libdir
in $rpath $xrpath; do
4442 # This is the magic to use -rpath.
4443 case "$finalize_rpath " in
4445 *) finalize_rpath
="$finalize_rpath $libdir" ;;
4450 # Now hardcode the library paths
4453 for libdir
in $compile_rpath $finalize_rpath; do
4454 if test -n "$hardcode_libdir_flag_spec"; then
4455 if test -n "$hardcode_libdir_separator"; then
4456 if test -z "$hardcode_libdirs"; then
4457 hardcode_libdirs
="$libdir"
4459 # Just accumulate the unique libdirs.
4460 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4461 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4464 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4469 eval flag
=\"$hardcode_libdir_flag_spec\"
4470 rpath
="$rpath $flag"
4472 elif test -n "$runpath_var"; then
4473 case "$perm_rpath " in
4475 *) perm_rpath
="$perm_rpath $libdir" ;;
4479 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
4480 testbindir
=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4481 case :$dllsearchpath: in
4483 *) dllsearchpath
="$dllsearchpath:$libdir";;
4485 case :$dllsearchpath: in
4486 *":$testbindir:"*) ;;
4487 *) dllsearchpath
="$dllsearchpath:$testbindir";;
4492 # Substitute the hardcoded libdirs into the rpath.
4493 if test -n "$hardcode_libdir_separator" &&
4494 test -n "$hardcode_libdirs"; then
4495 libdir
="$hardcode_libdirs"
4496 eval rpath
=\" $hardcode_libdir_flag_spec\"
4498 compile_rpath
="$rpath"
4502 for libdir
in $finalize_rpath; do
4503 if test -n "$hardcode_libdir_flag_spec"; then
4504 if test -n "$hardcode_libdir_separator"; then
4505 if test -z "$hardcode_libdirs"; then
4506 hardcode_libdirs
="$libdir"
4508 # Just accumulate the unique libdirs.
4509 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4510 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4513 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4518 eval flag
=\"$hardcode_libdir_flag_spec\"
4519 rpath
="$rpath $flag"
4521 elif test -n "$runpath_var"; then
4522 case "$finalize_perm_rpath " in
4524 *) finalize_perm_rpath
="$finalize_perm_rpath $libdir" ;;
4528 # Substitute the hardcoded libdirs into the rpath.
4529 if test -n "$hardcode_libdir_separator" &&
4530 test -n "$hardcode_libdirs"; then
4531 libdir
="$hardcode_libdirs"
4532 eval rpath
=\" $hardcode_libdir_flag_spec\"
4534 finalize_rpath
="$rpath"
4536 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4537 # Transform all the library objects into standard objects.
4538 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4539 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4543 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4544 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4545 dlsyms
="${outputname}S.c"
4547 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4551 if test -n "$dlsyms"; then
4555 # Discover the nlist of each of the dlfiles.
4556 nlist
="$output_objdir/${outputname}.nm"
4558 $show "$rm $nlist ${nlist}S ${nlist}T"
4559 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4561 # Parse the name list into a source file.
4562 $show "creating $output_objdir/$dlsyms"
4564 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4565 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4566 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4572 /* Prevent the only kind of declaration conflicts we can make. */
4573 #define lt_preloaded_symbols some_other_symbol
4575 /* External symbol declarations for the compiler. */\
4578 if test "$dlself" = yes; then
4579 $show "generating symbol list for \`$output'"
4581 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4583 # Add our own program objects to the symbol list.
4584 progfiles
=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4585 for arg
in $progfiles; do
4586 $show "extracting global C symbols from \`$arg'"
4587 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4590 if test -n "$exclude_expsyms"; then
4591 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4592 $run eval '$mv "$nlist"T "$nlist"'
4595 if test -n "$export_symbols_regex"; then
4596 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4597 $run eval '$mv "$nlist"T "$nlist"'
4600 # Prepare the list of exported symbols
4601 if test -z "$export_symbols"; then
4602 export_symbols
="$output_objdir/$outputname.exp"
4603 $run $rm $export_symbols
4604 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4606 *cygwin
* |
*mingw
* )
4607 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4608 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4612 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4613 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4614 $run eval 'mv "$nlist"T "$nlist"'
4616 *cygwin
* |
*mingw
* )
4617 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4618 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4624 for arg
in $dlprefiles; do
4625 $show "extracting global C symbols from \`$arg'"
4626 name
=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4627 $run eval '$echo ": $name " >> "$nlist"'
4628 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4631 if test -z "$run"; then
4632 # Make sure we have at least an empty file.
4633 test -f "$nlist" ||
: > "$nlist"
4635 if test -n "$exclude_expsyms"; then
4636 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4637 $mv "$nlist"T
"$nlist"
4640 # Try sorting and uniquifying the output.
4641 if grep -v "^: " < "$nlist" |
4642 if sort -k 3 </dev
/null
>/dev
/null
2>&1; then
4647 uniq > "$nlist"S
; then
4650 grep -v "^: " < "$nlist" > "$nlist"S
4653 if test -f "$nlist"S
; then
4654 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4656 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4659 $echo >> "$output_objdir/$dlsyms" "\
4661 #undef lt_preloaded_symbols
4663 #if defined (__STDC__) && __STDC__
4664 # define lt_ptr void *
4666 # define lt_ptr char *
4670 /* The mapping between symbol names and symbols. */
4674 *cygwin
* |
*mingw
* )
4675 $echo >> "$output_objdir/$dlsyms" "\
4676 /* DATA imports from DLLs on WIN32 can't be const, because
4677 runtime relocations are performed -- see ld's documentation
4683 $echo >> "$output_objdir/$dlsyms" "\
4690 $echo >> "$output_objdir/$dlsyms" "\
4694 lt_preloaded_symbols[] =
4698 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4700 $echo >> "$output_objdir/$dlsyms" "\
4704 /* This works around a problem in FreeBSD linker */
4705 #ifdef FREEBSD_WORKAROUND
4706 static const void *lt_preloaded_setup() {
4707 return lt_preloaded_symbols;
4717 pic_flag_for_symtable
=
4719 # compiling the symbol table file with pic_flag works around
4720 # a FreeBSD bug that causes programs to crash when -lm is
4721 # linked before any other PIC object. But we must not use
4722 # pic_flag when linking with -static. The problem exists in
4723 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4724 *-*-freebsd2*|
*-*-freebsd3.0
*|
*-*-freebsdelf3.0
*)
4725 case "$compile_command " in
4727 *) pic_flag_for_symtable
=" $pic_flag -DFREEBSD_WORKAROUND";;
4730 case "$compile_command " in
4732 *) pic_flag_for_symtable
=" $pic_flag";;
4736 # Now compile the dynamic symbol file.
4737 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4738 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' ||
exit $?
4740 # Clean up the generated files.
4741 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4742 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4744 # Transform the symbol file into the correct name.
4746 *cygwin
* |
*mingw
* )
4747 if test -f "$output_objdir/${outputname}.def" ; then
4748 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4749 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4751 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4752 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4756 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4757 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4762 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4767 # We keep going just in case the user didn't refer to
4768 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4769 # really was required.
4771 # Nullify the symbol file.
4772 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4773 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4776 if test "$need_relink" = no ||
test "$build_libtool_libs" != yes; then
4777 # Replace the output file specification.
4778 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4779 link_command
="$compile_command$compile_rpath"
4781 # We have no uninstalled library dependencies, so finalize right now.
4782 $show "$link_command"
4783 $run eval "$link_command"
4786 # Delete the generated files.
4787 if test -n "$dlsyms"; then
4788 $show "$rm $output_objdir/${outputname}S.${objext}"
4789 $run $rm "$output_objdir/${outputname}S.${objext}"
4795 if test -n "$shlibpath_var"; then
4796 # We should set the shlibpath_var
4798 for dir
in $temp_rpath; do
4800 [\\/]* |
[A-Za-z
]:[\\/]*)
4805 # Relative path: add a thisdir entry.
4806 rpath
="$rpath\$thisdir/$dir:"
4813 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4814 compile_command
="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4816 if test -n "$finalize_shlibpath"; then
4817 finalize_command
="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4822 if test -n "$runpath_var"; then
4823 if test -n "$perm_rpath"; then
4824 # We should set the runpath_var.
4826 for dir
in $perm_rpath; do
4829 compile_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4831 if test -n "$finalize_perm_rpath"; then
4832 # We should set the runpath_var.
4834 for dir
in $finalize_perm_rpath; do
4837 finalize_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4841 if test "$no_install" = yes; then
4842 # We don't need to create a wrapper script.
4843 link_command
="$compile_var$compile_command$compile_rpath"
4844 # Replace the output file specification.
4845 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4846 # Delete the old output file.
4848 # Link the executable and exit
4849 $show "$link_command"
4850 $run eval "$link_command" ||
exit $?
4854 if test "$hardcode_action" = relink
; then
4855 # Fast installation is not supported
4856 link_command
="$compile_var$compile_command$compile_rpath"
4857 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4859 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4860 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4862 if test "$fast_install" != no
; then
4863 link_command
="$finalize_var$compile_command$finalize_rpath"
4864 if test "$fast_install" = yes; then
4865 relink_command
=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4867 # fast_install is set to needless
4871 link_command
="$compile_var$compile_command$compile_rpath"
4872 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4876 # Replace the output file specification.
4877 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4879 # Delete the old output files.
4880 $run $rm $output $output_objdir/$outputname $output_objdir/lt-
$outputname
4882 $show "$link_command"
4883 $run eval "$link_command" ||
exit $?
4885 # Now create the wrapper script.
4886 $show "creating $output"
4888 # Quote the relink command for shipping.
4889 if test -n "$relink_command"; then
4890 # Preserve any variables that may affect compiler behavior
4891 for var
in $variables_saved_for_relink; do
4892 if eval test -z \"\
${$var+set}\"; then
4893 relink_command
="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4894 elif eval var_value
=\$
$var; test -z "$var_value"; then
4895 relink_command
="$var=; export $var; $relink_command"
4897 var_value
=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4898 relink_command
="$var=\"$var_value\"; export $var; $relink_command"
4901 relink_command
="(cd `pwd`; $relink_command)"
4902 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4905 # Quote $echo for shipping.
4906 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4908 [\\/]* |
[A-Za-z
]:[\\/]*) qecho
="$SHELL $progpath --fallback-echo";;
4909 *) qecho
="$SHELL `pwd`/$progpath --fallback-echo";;
4911 qecho
=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4913 qecho
=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4916 # Only actually do things if our run command is non-null.
4917 if test -z "$run"; then
4918 # win32 will think the script is a binary if it has
4919 # a .exe suffix, so we strip it off here.
4921 *.exe
) output
=`$echo $output|${SED} 's,.exe$,,'` ;;
4923 # test for cygwin because mv fails w/o .exe extensions
4927 outputname
=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4931 *cygwin
* |
*mingw
* )
4932 output_name
=`basename $output`
4933 output_path
=`dirname $output`
4934 cwrappersource
="$output_path/$objdir/lt-$output_name.c"
4935 cwrapper
="$output_path/$output_name.exe"
4936 $rm $cwrappersource $cwrapper
4937 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4939 cat > $cwrappersource <<EOF
4941 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4942 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4944 The $output program cannot be directly executed until all the libtool
4945 libraries that it depends on are installed.
4947 This wrapper executable should never be moved out of the build directory.
4948 If it is, it will not operate correctly.
4950 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4951 but could eventually absorb all of the scripts functionality and
4952 exec $objdir/$outputname directly.
4955 cat >> $cwrappersource<<"EOF"
4964 #include <sys/stat.h>
4966 #if defined(PATH_MAX)
4967 # define LT_PATHMAX PATH_MAX
4968 #elif defined(MAXPATHLEN)
4969 # define LT_PATHMAX MAXPATHLEN
4971 # define LT_PATHMAX 1024
4974 #ifndef DIR_SEPARATOR
4975 # define DIR_SEPARATOR '/'
4976 # define PATH_SEPARATOR ':'
4979 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4981 # define HAVE_DOS_BASED_FILE_SYSTEM
4982 # ifndef DIR_SEPARATOR_2
4983 # define DIR_SEPARATOR_2 '\\'
4985 # ifndef PATH_SEPARATOR_2
4986 # define PATH_SEPARATOR_2 ';'
4990 #ifndef DIR_SEPARATOR_2
4991 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4992 #else /* DIR_SEPARATOR_2 */
4993 # define IS_DIR_SEPARATOR(ch) \
4994 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4995 #endif /* DIR_SEPARATOR_2 */
4997 #ifndef PATH_SEPARATOR_2
4998 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4999 #else /* PATH_SEPARATOR_2 */
5000 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5001 #endif /* PATH_SEPARATOR_2 */
5003 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5004 #define XFREE(stale) do { \
5005 if (stale) { free ((void *) stale); stale = 0; } \
5008 /* -DDEBUG is fairly common in CFLAGS. */
5010 #if defined DEBUGWRAPPER
5011 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5013 # define DEBUG(format, ...)
5016 const char *program_name = NULL;
5018 void * xmalloc (size_t num);
5019 char * xstrdup (const char *string);
5020 const char * base_name (const char *name);
5021 char * find_executable(const char *wrapper);
5022 int check_executable(const char *path);
5023 char * strendzap(char *str, const char *pat);
5024 void lt_fatal (const char *message, ...);
5027 main (int argc, char *argv[])
5032 program_name = (char *) xstrdup (base_name (argv[0]));
5033 DEBUG("(main) argv[0] : %s\n",argv[0]);
5034 DEBUG("(main) program_name : %s\n",program_name);
5035 newargz = XMALLOC(char *, argc+2);
5038 cat >> $cwrappersource <<EOF
5039 newargz[0] = (char *) xstrdup("$SHELL");
5042 cat >> $cwrappersource <<"EOF"
5043 newargz
[1] = find_executable
(argv
[0]);
5044 if (newargz
[1] == NULL
)
5045 lt_fatal
("Couldn't find %s", argv
[0]);
5046 DEBUG
("(main) found exe at : %s\n",newargz
[1]);
5047 /* we know the
script has the same name
, without the .exe
*/
5048 /* so
make sure newargz
[1] doesn
't end in .exe */
5049 strendzap(newargz[1],".exe");
5050 for (i = 1; i < argc; i++)
5051 newargz[i+1] = xstrdup(argv[i]);
5052 newargz[argc+1] = NULL;
5054 for (i=0; i<argc+1; i++)
5056 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5064 cat >> $cwrappersource <<EOF
5065 execv("$SHELL",(char const **)newargz);
5069 cat >> $cwrappersource <<EOF
5070 execv("$SHELL",newargz);
5075 cat >> $cwrappersource <<"EOF"
5080 xmalloc (size_t num)
5082 void * p = (void *) malloc (num);
5084 lt_fatal ("Memory exhausted");
5090 xstrdup (const char *string)
5092 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5097 base_name (const char *name)
5101 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5102 /* Skip over the disk name in MSDOS pathnames. */
5103 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5107 for (base = name; *name; name++)
5108 if (IS_DIR_SEPARATOR (*name))
5114 check_executable(const char * path)
5118 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5119 if ((!path) || (!*path))
5122 if ((stat (path, &st) >= 0) &&
5124 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5125 #if defined (S_IXOTH)
5126 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5128 #if defined (S_IXGRP)
5129 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5131 ((st.st_mode & S_IXUSR) == S_IXUSR))
5138 /* Searches for the full path of the wrapper. Returns
5139 newly allocated full path name if found, NULL otherwise */
5141 find_executable (const char* wrapper)
5146 /* static buffer for getcwd */
5147 char tmp[LT_PATHMAX + 1];
5151 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5153 if ((wrapper == NULL) || (*wrapper == '\
0'))
5156 /* Absolute path? */
5157 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5158 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5160 concat_name = xstrdup (wrapper);
5161 if (check_executable(concat_name))
5168 if (IS_DIR_SEPARATOR (wrapper[0]))
5170 concat_name = xstrdup (wrapper);
5171 if (check_executable(concat_name))
5175 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5179 for (p = wrapper; *p; p++)
5187 /* no slashes; search PATH */
5188 const char* path = getenv ("PATH");
5191 for (p = path; *p; p = p_next)
5195 for (q = p; *q; q++)
5196 if (IS_PATH_SEPARATOR(*q))
5199 p_next = (*q == '\
0' ? q : q + 1);
5202 /* empty path: current directory */
5203 if (getcwd (tmp, LT_PATHMAX) == NULL)
5204 lt_fatal ("getcwd failed");
5205 tmp_len = strlen(tmp);
5206 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5207 memcpy (concat_name, tmp, tmp_len);
5208 concat_name[tmp_len] = '/';
5209 strcpy (concat_name + tmp_len + 1, wrapper);
5213 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5214 memcpy (concat_name, p, p_len);
5215 concat_name[p_len] = '/';
5216 strcpy (concat_name + p_len + 1, wrapper);
5218 if (check_executable(concat_name))
5223 /* not found in PATH; assume curdir */
5225 /* Relative path | not found in path: prepend cwd */
5226 if (getcwd (tmp, LT_PATHMAX) == NULL)
5227 lt_fatal ("getcwd failed");
5228 tmp_len = strlen(tmp);
5229 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5230 memcpy (concat_name, tmp, tmp_len);
5231 concat_name[tmp_len] = '/';
5232 strcpy (concat_name + tmp_len + 1, wrapper);
5234 if (check_executable(concat_name))
5241 strendzap(char *str, const char *pat)
5245 assert(str != NULL);
5246 assert(pat != NULL);
5249 patlen = strlen(pat);
5253 str += len - patlen;
5254 if (strcmp(str, pat) == 0)
5261 lt_error_core (int exit_status, const char * mode,
5262 const char * message, va_list ap)
5264 fprintf (stderr, "%s: %s: ", program_name, mode);
5265 vfprintf (stderr, message, ap);
5266 fprintf (stderr, ".\n");
5268 if (exit_status >= 0)
5273 lt_fatal (const char *message, ...)
5276 va_start (ap, message);
5277 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5281 # we should really use a build-platform specific compiler
5282 # here, but OTOH, the wrappers (shell script and this C one)
5283 # are only useful if you want to execute the "real" binary.
5284 # Since the "real" binary is built for $host, then this
5285 # wrapper might as well be built for $host, too.
5286 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5290 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5295 # $output - temporary wrapper script for $objdir/$outputname
5296 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5298 # The $output program cannot be directly executed until all the libtool
5299 # libraries that it depends on are installed.
5301 # This wrapper script should never be moved out of the build directory.
5302 # If it is, it will not operate correctly.
5304 # Sed substitution that helps us do robust quoting. It backslashifies
5305 # metacharacters that are still active within double-quoted strings.
5306 Xsed='${SED} -e 1s
/^X
//'
5307 sed_quote_subst='$sed_quote_subst'
5309 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5310 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5313 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5314 # is contrary to our usage. Disable this feature.
5315 alias -g '\
${1+\"\$@\"}'='\"\$@
\"'
5316 setopt NO_GLOB_SUBST
5318 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5321 # The HP-UX ksh and POSIX shell print the target directory to stdout
5323 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5325 relink_command=\"$relink_command\"
5327 # This environment variable determines our operation mode.
5328 if test \"\$libtool_install_magic\" = \"$magic\"; then
5329 # install mode needs the following variable:
5330 notinst_deplibs='$notinst_deplibs'
5332 # When we are sourced in execute mode, \$file and \$echo are already set.
5333 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5336 # Make sure echo works.
5337 if test \"X\$1\" = X--no-reexec; then
5338 # Discard the --no-reexec flag, and continue.
5340 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X
\t'; then
5341 # Yippee, \$echo works!
5344 # Restart under the correct shell, and then maybe \$echo will work.
5345 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5351 # Find the directory that this script lives in.
5352 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*$
%%'\`
5353 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5355 # Follow symbolic links until we get to the real thisdir.
5356 file=\`ls -ld \"\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5357 while test -n \"\$file\"; do
5358 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*\$
%%'\`
5360 # If there was a directory component, then change thisdir.
5361 if test \"x\$destdir\" != \"x\$file\"; then
5362 case \"\$destdir\" in
5363 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5364 *) thisdir=\"\$thisdir/\$destdir\" ;;
5368 file=\`\$echo \"X\$file\" | \$Xsed -e 's
%^.
*/%%'\`
5369 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5372 # Try to get the absolute directory name.
5373 absdir=\`cd \"\$thisdir\" && pwd\`
5374 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5377 if test "$fast_install" = yes; then
5379 program=lt-'$outputname'$exeext
5380 progdir=\"\$thisdir/$objdir\"
5382 if test ! -f \"\$progdir/\$program\" || \\
5383 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5384 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5386 file=\"\$\$-\$program\"
5388 if test ! -d \"\$progdir\"; then
5389 $mkdir \"\$progdir\"
5391 $rm \"\$progdir/\$file\"
5396 # relink executable if necessary
5397 if test -n \"\$relink_command\"; then
5398 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5400 $echo \"\$relink_command_output\" >&2
5401 $rm \"\$progdir/\$file\"
5406 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5407 { $rm \"\$progdir/\$program\";
5408 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5409 $rm \"\$progdir/\$file\"
5413 program='$outputname'
5414 progdir=\"\$thisdir/$objdir\"
5420 if test -f \"\$progdir/\$program\"; then"
5422 # Export our shlibpath_var if we have one.
5423 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5425 # Add our own library path to $shlibpath_var
5426 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5428 # Some systems cannot cope with colon-terminated $shlibpath_var
5429 # The second colon is a workaround for a bug in BeOS R4 sed
5430 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's
/::*\$
//'\`
5432 export $shlibpath_var
5436 # fixup the dll searchpath if we need to.
5437 if test -n "$dllsearchpath"; then
5439 # Add the dll search path components to the executable PATH
5440 PATH=$dllsearchpath:\$PATH
5445 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5446 # Run the actual program with our arguments.
5449 # Backslashes separate directories on plain windows
5450 *-*-mingw | *-*-os2*)
5452 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5458 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5463 \$echo \"\$0: cannot exec \$program \$*\"
5467 # The program doesn't exist.
5468 \
$echo \"\
$0: error
: \\\
`\$progdir/\$program' does not exist\" 1>&2
5469 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5470 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5481 # See if we need to build an old-fashioned archive.
5482 for oldlib in $oldlibs; do
5484 if test "$build_libtool_libs" = convenience; then
5485 oldobjs="$libobjs_save"
5486 addlibs="$convenience"
5487 build_libtool_libs=no
5489 if test "$build_libtool_libs" = module; then
5490 oldobjs="$libobjs_save"
5491 build_libtool_libs=no
5493 oldobjs="$old_deplibs $non_pic_objects"
5495 addlibs="$old_convenience"
5498 if test -n "$addlibs"; then
5499 gentop="$output_objdir/${outputname}x"
5500 generated="$generated $gentop"
5502 func_extract_archives $gentop $addlibs
5503 oldobjs="$oldobjs $func_extract_archives_result"
5506 # Do each command in the archive commands.
5507 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5508 cmds=$old_archive_from_new_cmds
5510 # POSIX demands no paths to be encoded in archives. We have
5511 # to avoid creating archives with duplicate basenames if we
5512 # might have to extract them afterwards, e.g., when creating a
5513 # static archive out of a convenience library, or when linking
5514 # the entirety of a libtool archive into another (currently
5515 # not supported by libtool).
5516 if (for obj in $oldobjs
5518 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5519 done | sort | sort -uc >/dev/null 2>&1); then
5522 $echo "copying selected object files to avoid basename conflicts..."
5524 if test -z "$gentop"; then
5525 gentop="$output_objdir/${outputname}x"
5526 generated="$generated $gentop"
5528 $show "${rm}r $gentop"
5529 $run ${rm}r "$gentop"
5530 $show "$mkdir $gentop"
5531 $run $mkdir "$gentop"
5533 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5538 save_oldobjs=$oldobjs
5541 for obj in $save_oldobjs
5543 objbase=`$echo "X$obj" |
$Xsed -e 's%^.*/%%'`
5544 case " $oldobjs " in
5545 " ") oldobjs=$obj ;;
5548 # Make sure we don't pick an alternate name that also
5550 newobj=lt$counter-$objbase
5551 counter=`expr $counter + 1`
5552 case " $oldobjs " in
5553 *[\ /]"$newobj "*) ;;
5554 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5557 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5558 $run ln "$obj" "$gentop/$newobj" ||
5559 $run cp "$obj" "$gentop/$newobj"
5560 oldobjs="$oldobjs $gentop/$newobj"
5562 *) oldobjs="$oldobjs $obj" ;;
5567 eval cmds=\"$old_archive_cmds\"
5569 if len=`expr "X$cmds" : ".*"` &&
5570 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5571 cmds=$old_archive_cmds
5573 # the command line is too long to link in one step, link in parts
5574 $echo "using piecewise archive linking..."
5579 save_oldobjs=$oldobjs
5581 # Is there a better way of finding the last object in the list?
5582 for obj in $save_oldobjs
5586 for obj in $save_oldobjs
5588 oldobjs="$objlist $obj"
5589 objlist="$objlist $obj"
5590 eval test_cmds=\"$old_archive_cmds\"
5591 if len=`expr "X$test_cmds" : ".*" 2>/dev
/null
` &&
5592 test "$len" -le "$max_cmd_len"; then
5595 # the above command should be used before it gets too long
5597 if test "$obj" = "$last_oldobj" ; then
5600 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5601 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5607 if test "X$oldobjs" = "X" ; then
5608 eval cmds=\"\$concat_cmds\"
5610 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5614 save_ifs="$IFS"; IFS='~'
5615 for cmd in $cmds; do
5619 $run eval "$cmd" || exit $?
5624 if test -n "$generated"; then
5625 $show "${rm}r$generated"
5626 $run ${rm}r$generated
5629 # Now create the libtool archive.
5633 test "$build_old_libs" = yes && old_library="$libname.$libext"
5634 $show "creating $output"
5636 # Preserve any variables that may affect compiler behavior
5637 for var in $variables_saved_for_relink; do
5638 if eval test -z \"\${$var+set}\"; then
5639 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5640 elif eval var_value=\$$var; test -z "$var_value"; then
5641 relink_command="$var=; export $var; $relink_command"
5643 var_value=`$echo "X$var_value" |
$Xsed -e "$sed_quote_subst"`
5644 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5647 # Quote the link command for shipping.
5648 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5649 relink_command=`$echo "X$relink_command" |
$SP2NL |
$Xsed -e "$sed_quote_subst" |
$NL2SP`
5650 if test "$hardcode_automatic" = yes ; then
5655 # Only create the output if not a dry run.
5656 if test -z "$run"; then
5657 for installed in no yes; do
5658 if test "$installed" = yes; then
5659 if test -z "$install_libdir"; then
5662 output="$output_objdir/$outputname"i
5663 # Replace all uninstalled libtool libraries with the installed ones
5665 for deplib in $dependency_libs; do
5668 name=`$echo "X$deplib" |
$Xsed -e 's%^.*/%%'`
5669 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5670 if test -z "$libdir"; then
5671 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5674 newdependency_libs="$newdependency_libs $libdir/$name"
5676 *) newdependency_libs="$newdependency_libs $deplib" ;;
5679 dependency_libs="$newdependency_libs"
5681 for lib in $dlfiles; do
5682 name=`$echo "X$lib" | $Xsed -e 's
%^.
*/%%'`
5683 eval libdir=`${SED} -n -e 's
/^libdir
=\
(.
*\
)$
/\
1/p
' $lib`
5684 if test -z "$libdir"; then
5685 $echo "$modename: \`$lib' is not a valid libtool archive
" 1>&2
5688 newdlfiles="$newdlfiles $libdir/$name"
5690 dlfiles="$newdlfiles"
5692 for lib in $dlprefiles; do
5693 name=`$echo "X
$lib" | $Xsed -e 's%^.*/%%'`
5694 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5695 if test -z "$libdir"; then
5696 $echo "$modename: \
`$lib' is not a valid libtool archive" 1>&2
5699 newdlprefiles="$newdlprefiles $libdir/$name"
5701 dlprefiles="$newdlprefiles"
5704 for lib in $dlfiles; do
5706 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5707 *) abs=`pwd`"/$lib" ;;
5709 newdlfiles="$newdlfiles $abs"
5711 dlfiles="$newdlfiles"
5713 for lib in $dlprefiles; do
5715 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5716 *) abs=`pwd`"/$lib" ;;
5718 newdlprefiles="$newdlprefiles $abs"
5720 dlprefiles="$newdlprefiles"
5723 # place dlname in correct position for cygwin
5725 case $host,$output,$installed,$module,$dlname in
5726 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5729 # $outputname - a libtool library file
5730 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5732 # Please DO NOT delete this file!
5733 # It is necessary for linking the library.
5735 # The name that we can dlopen(3).
5738 # Names of this library.
5739 library_names='$library_names'
5741 # The name of the static archive.
5742 old_library='$old_library'
5744 # Libraries that this one depends upon.
5745 dependency_libs='$dependency_libs'
5747 # Version information for $libname.
5752 # Is this an already installed library?
5753 installed=$installed
5755 # Should we warn about portability when linking against -modules?
5756 shouldnotlink=$module
5758 # Files to dlopen/dlpreopen
5760 dlpreopen='$dlprefiles'
5762 # Directory that this library needs to be installed in:
5763 libdir='$install_libdir'"
5764 if test "$installed" = no && test "$need_relink" = yes; then
5766 relink_command=\"$relink_command\""
5771 # Do a symbolic link so that the libtool archive can be found in
5772 # LD_LIBRARY_PATH before the program is installed.
5773 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5774 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5780 # libtool install mode
5782 modename="$modename: install"
5784 # There may be an optional sh(1) argument at the beginning of
5785 # install_prog (especially on Windows NT).
5786 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5787 # Allow the use of GNU shtool's install command.
5788 $echo "X$nonopt" | grep shtool > /dev/null; then
5789 # Aesthetically quote it.
5790 arg=`$echo "X$nonopt" |
$Xsed -e "$sed_quote_subst"`
5792 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5796 install_prog="$arg "
5804 # The real first argument should be the name of the installation program.
5805 # Aesthetically quote it.
5806 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5808 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5812 install_prog="$install_prog$arg"
5814 # We need to accept at least all the BSD install flags.
5824 if test -n "$dest"; then
5825 files="$files $dest"
5833 case " $install_prog " in
5838 -g | -m | -o) prev=$arg ;;
5846 # If the previous option needed an argument, then skip it.
5847 if test -n "$prev"; then
5856 # Aesthetically quote the argument.
5857 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5859 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5863 install_prog="$install_prog $arg"
5866 if test -z "$install_prog"; then
5867 $echo "$modename: you must specify an install program" 1>&2
5872 if test -n "$prev"; then
5873 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5878 if test -z "$files"; then
5879 if test -z "$dest"; then
5880 $echo "$modename: no file or destination specified" 1>&2
5882 $echo "$modename: you must specify a destination" 1>&2
5888 # Strip any trailing slash from the destination.
5889 dest=`$echo "X$dest" | $Xsed -e 's
%/$
%%'`
5891 # Check to see that the destination is a directory.
5892 test -d "$dest" && isdir=yes
5893 if test "$isdir" = yes; then
5897 destdir=`$echo "X$dest" | $Xsed -e 's
%/[^
/]*$
%%'`
5898 test "X$destdir" = "X$dest" && destdir=.
5899 destname=`$echo "X$dest" | $Xsed -e 's
%^.
*/%%'`
5901 # Not a directory, so check to see that there is only one file specified.
5903 if test "$#" -gt 2; then
5904 $echo "$modename: \`$dest' is not a directory
" 1>&2
5910 [\\/]* | [A-Za-z]:[\\/]*) ;;
5912 for file in $files; do
5916 $echo "$modename: \
`$destdir' must be an absolute directory name" 1>&2
5925 # This variable tells wrapper scripts just to set variables rather
5926 # than running their programs.
5927 libtool_install_magic="$magic"
5932 for file in $files; do
5934 # Do each installation.
5937 # Do the static libraries later.
5938 staticlibs="$staticlibs $file"
5942 # Check to see that this really is a libtool archive.
5943 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5945 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5953 # If there is no directory component, then add one.
5955 */* | *\\*) . $file ;;
5959 # Add the libdir to current_libdirs if it is the destination.
5960 if test "X$destdir" = "X$libdir"; then
5961 case "$current_libdirs " in
5963 *) current_libdirs="$current_libdirs $libdir" ;;
5966 # Note the libdir as a future libdir.
5967 case "$future_libdirs " in
5969 *) future_libdirs="$future_libdirs $libdir" ;;
5973 dir=`$echo "X$file" | $Xsed -e 's
%/[^
/]*$
%%'`/
5974 test "X$dir" = "X$file/" && dir=
5977 if test -n "$relink_command"; then
5978 # Determine the prefix the user has applied to our future dir.
5979 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5981 # Don't allow the user to place us outside of our expected
5982 # location b/c this prevents finding dependent libraries that
5983 # are installed to the same prefix.
5984 # At present, this check doesn't affect windows .dll's that
5985 # are installed into $libdir/../bin (currently, that works fine)
5986 # but it's something to keep an eye on.
5987 if test "$inst_prefix_dir" = "$destdir"; then
5988 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5992 if test -n "$inst_prefix_dir"; then
5993 # Stick the inst_prefix_dir data into the link command.
5994 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
5996 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
5999 $echo "$modename: warning: relinking \`$file'" 1>&2
6000 $show "$relink_command"
6001 if $run eval "$relink_command"; then :
6003 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6008 # See the names of the shared library.
6009 set dummy
$library_names
6010 if test -n "$2"; then
6016 test -n "$relink_command" && srcname
="$realname"T
6018 # Install the shared library and build the symlinks.
6019 $show "$install_prog $dir/$srcname $destdir/$realname"
6020 $run eval "$install_prog $dir/$srcname $destdir/$realname" ||
exit $?
6021 if test -n "$stripme" && test -n "$striplib"; then
6022 $show "$striplib $destdir/$realname"
6023 $run eval "$striplib $destdir/$realname" ||
exit $?
6026 if test "$#" -gt 0; then
6027 # Delete the old symlinks, and create new ones.
6028 # Try `ln -sf' first, because the `ln' binary might depend on
6029 # the symlink we replace! Solaris /bin/ln does not understand -f,
6030 # so we also need to try rm && ln -s.
6033 if test "$linkname" != "$realname"; then
6034 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6035 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6040 # Do each command in the postinstall commands.
6041 lib
="$destdir/$realname"
6042 cmds
=$postinstall_cmds
6043 save_ifs
="$IFS"; IFS
='~'
6044 for cmd
in $cmds; do
6048 $run eval "$cmd" ||
{
6051 # Restore the uninstalled library and exit
6052 if test "$mode" = relink
; then
6053 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6062 # Install the pseudo-library for information purposes.
6063 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6064 instname
="$dir/$name"i
6065 $show "$install_prog $instname $destdir/$name"
6066 $run eval "$install_prog $instname $destdir/$name" ||
exit $?
6068 # Maybe install the static library, too.
6069 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
6073 # Install (i.e. copy) a libtool object.
6075 # Figure out destination file name, if it wasn't already specified.
6076 if test -n "$destname"; then
6077 destfile
="$destdir/$destname"
6079 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6080 destfile
="$destdir/$destfile"
6083 # Deduce the name of the destination old-style object file.
6086 staticdest
=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6089 staticdest
="$destfile"
6093 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6099 # Install the libtool object if requested.
6100 if test -n "$destfile"; then
6101 $show "$install_prog $file $destfile"
6102 $run eval "$install_prog $file $destfile" ||
exit $?
6105 # Install the old object if enabled.
6106 if test "$build_old_libs" = yes; then
6107 # Deduce the name of the old-style object file.
6108 staticobj
=`$echo "X$file" | $Xsed -e "$lo2o"`
6110 $show "$install_prog $staticobj $staticdest"
6111 $run eval "$install_prog \$staticobj \$staticdest" ||
exit $?
6117 # Figure out destination file name, if it wasn't already specified.
6118 if test -n "$destname"; then
6119 destfile
="$destdir/$destname"
6121 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6122 destfile
="$destdir/$destfile"
6125 # If the file is missing, and there is a .exe on the end, strip it
6126 # because it is most likely a libtool script we actually want to
6131 if test ! -f "$file"; then
6132 file=`$echo $file|${SED} 's,.exe$,,'`
6138 # Do a test to see if this is really a libtool program.
6141 wrapper
=`$echo $file | ${SED} -e 's,.exe$,,'`
6147 if (${SED} -e '4q' $wrapper |
grep "^# Generated by .*$PACKAGE")>/dev
/null
2>&1; then
6151 # Note that it is not necessary on cygwin/mingw to append a dot to
6152 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6153 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6154 # `FILE.' does not work on cygwin managed mounts.
6156 # If there is no directory component, then add one.
6158 */* |
*\\*) .
${wrapper} ;;
6159 *) . .
/${wrapper} ;;
6162 # Check the variables that should have been set.
6163 if test -z "$notinst_deplibs"; then
6164 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6169 for lib
in $notinst_deplibs; do
6170 # Check to see that each library is installed.
6172 if test -f "$lib"; then
6173 # If there is no directory component, then add one.
6175 */* |
*\\*) .
$lib ;;
6179 libfile
="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6180 if test -n "$libdir" && test ! -f "$libfile"; then
6181 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6187 # Note that it is not necessary on cygwin/mingw to append a dot to
6188 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6189 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6190 # `FILE.' does not work on cygwin managed mounts.
6192 # If there is no directory component, then add one.
6194 */* |
*\\*) .
${wrapper} ;;
6195 *) . .
/${wrapper} ;;
6199 if test "$fast_install" = no
&& test -n "$relink_command"; then
6200 if test "$finalize" = yes && test -z "$run"; then
6201 tmpdir
=`func_mktempdir`
6202 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6203 outputname
="$tmpdir/$file"
6204 # Replace the output file specification.
6205 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6207 $show "$relink_command"
6208 if $run eval "$relink_command"; then :
6210 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6216 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6219 # Install the binary that we compiled earlier.
6220 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6224 # remove .exe since cygwin /usr/bin/install will append another
6226 case $install_prog,$host in
6227 */usr
/bin
/install*,*cygwin
*)
6228 case $file:$destfile in
6233 destfile
=$destfile.exe
6236 destfile
=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6241 $show "$install_prog$stripme $file $destfile"
6242 $run eval "$install_prog\$stripme \$file \$destfile" ||
exit $?
6243 test -n "$outputname" && ${rm}r
"$tmpdir"
6248 for file in $staticlibs; do
6249 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6251 # Set up the ranlib parameters.
6252 oldlib
="$destdir/$name"
6254 $show "$install_prog $file $oldlib"
6255 $run eval "$install_prog \$file \$oldlib" ||
exit $?
6257 if test -n "$stripme" && test -n "$old_striplib"; then
6258 $show "$old_striplib $oldlib"
6259 $run eval "$old_striplib $oldlib" ||
exit $?
6262 # Do each command in the postinstall commands.
6263 cmds
=$old_postinstall_cmds
6264 save_ifs
="$IFS"; IFS
='~'
6265 for cmd
in $cmds; do
6269 $run eval "$cmd" ||
exit $?
6274 if test -n "$future_libdirs"; then
6275 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6278 if test -n "$current_libdirs"; then
6279 # Maybe just do a dry run.
6280 test -n "$run" && current_libdirs
=" -n$current_libdirs"
6281 exec_cmd
='$SHELL $progpath $preserve_args --finish$current_libdirs'
6287 # libtool finish mode
6289 modename
="$modename: finish"
6293 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6296 libdirs
="$libdirs $dir"
6299 for libdir
in $libdirs; do
6300 if test -n "$finish_cmds"; then
6301 # Do each command in the finish commands.
6303 save_ifs
="$IFS"; IFS
='~'
6304 for cmd
in $cmds; do
6308 $run eval "$cmd" || admincmds
="$admincmds
6313 if test -n "$finish_eval"; then
6314 # Do the single finish_eval.
6315 eval cmds
=\"$finish_eval\"
6316 $run eval "$cmds" || admincmds
="$admincmds
6322 # Exit here if they wanted silent mode.
6323 test "$show" = : && exit $EXIT_SUCCESS
6325 $echo "X----------------------------------------------------------------------" |
$Xsed
6326 $echo "Libraries have been installed in:"
6327 for libdir
in $libdirs; do
6331 $echo "If you ever happen to want to link against installed libraries"
6332 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6333 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6334 $echo "flag during linking and do at least one of the following:"
6335 if test -n "$shlibpath_var"; then
6336 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6337 $echo " during execution"
6339 if test -n "$runpath_var"; then
6340 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6341 $echo " during linking"
6343 if test -n "$hardcode_libdir_flag_spec"; then
6345 eval flag
=\"$hardcode_libdir_flag_spec\"
6347 $echo " - use the \`$flag' linker flag"
6349 if test -n "$admincmds"; then
6350 $echo " - have your system administrator run these commands:$admincmds"
6352 if test -f /etc
/ld.so.conf
; then
6353 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6356 $echo "See any operating system documentation about shared libraries for"
6357 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6358 $echo "X----------------------------------------------------------------------" |
$Xsed
6362 # libtool execute mode
6364 modename
="$modename: execute"
6366 # The first argument is the command name.
6368 if test -z "$cmd"; then
6369 $echo "$modename: you must specify a COMMAND" 1>&2
6374 # Handle -dlopen flags immediately.
6375 for file in $execute_dlfiles; do
6376 if test ! -f "$file"; then
6377 $echo "$modename: \`$file' is not a file" 1>&2
6385 # Check to see that this really is a libtool archive.
6386 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
6388 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6393 # Read the libtool library.
6397 # If there is no directory component, then add one.
6399 */* |
*\\*) .
$file ;;
6403 # Skip this library if it cannot be dlopened.
6404 if test -z "$dlname"; then
6405 # Warn if it was a shared library.
6406 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6410 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6411 test "X$dir" = "X$file" && dir
=.
6413 if test -f "$dir/$objdir/$dlname"; then
6416 $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
6491 # Now prepare to actually exec the command.
6492 exec_cmd
="\$cmd$args"
6494 # Display what would be done.
6495 if test -n "$shlibpath_var"; then
6496 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6497 $echo "export $shlibpath_var"
6504 # libtool clean and uninstall mode
6506 modename
="$modename: $mode"
6512 # This variable tells wrapper scripts just to set variables rather
6513 # than running their programs.
6514 libtool_install_magic
="$magic"
6519 -f) rm="$rm $arg"; rmforce
=yes ;;
6520 -*) rm="$rm $arg" ;;
6521 *) files
="$files $arg" ;;
6525 if test -z "$rm"; then
6526 $echo "$modename: you must specify an RM program" 1>&2
6533 origobjdir
="$objdir"
6534 for file in $files; do
6535 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6536 if test "X$dir" = "X$file"; then
6538 objdir
="$origobjdir"
6540 objdir
="$dir/$origobjdir"
6542 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6543 test "$mode" = uninstall
&& objdir
="$dir"
6545 # Remember objdir for removal later, being careful to avoid duplicates
6546 if test "$mode" = clean
; then
6549 *) rmdirs
="$rmdirs $objdir" ;;
6553 # Don't error if the file doesn't exist and rm -f was used.
6554 if (test -L "$file") >/dev
/null
2>&1 \
6555 ||
(test -h "$file") >/dev
/null
2>&1 \
6556 ||
test -f "$file"; then
6558 elif test -d "$file"; then
6561 elif test "$rmforce" = yes; then
6569 # Possibly a libtool archive, so verify it.
6570 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6573 # Delete the libtool libraries and symlinks.
6574 for n
in $library_names; do
6575 rmfiles
="$rmfiles $objdir/$n"
6577 test -n "$old_library" && rmfiles
="$rmfiles $objdir/$old_library"
6581 case " $library_names " in
6582 # " " in the beginning catches empty $dlname
6584 *) rmfiles
="$rmfiles $objdir/$dlname" ;;
6586 test -n "$libdir" && rmfiles
="$rmfiles $objdir/$name $objdir/${name}i"
6589 if test -n "$library_names"; then
6590 # Do each command in the postuninstall commands.
6591 cmds
=$postuninstall_cmds
6592 save_ifs
="$IFS"; IFS
='~'
6593 for cmd
in $cmds; do
6598 if test "$?" -ne 0 && test "$rmforce" != yes; then
6605 if test -n "$old_library"; then
6606 # Do each command in the old_postuninstall commands.
6607 cmds
=$old_postuninstall_cmds
6608 save_ifs
="$IFS"; IFS
='~'
6609 for cmd
in $cmds; do
6614 if test "$?" -ne 0 && test "$rmforce" != yes; then
6620 # FIXME: should reinstall the best remaining shared library.
6627 # Possibly a libtool object, so verify it.
6628 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6633 # Add PIC object to the list of files to remove.
6634 if test -n "$pic_object" \
6635 && test "$pic_object" != none
; then
6636 rmfiles
="$rmfiles $dir/$pic_object"
6639 # Add non-PIC object to the list of files to remove.
6640 if test -n "$non_pic_object" \
6641 && test "$non_pic_object" != none
; then
6642 rmfiles
="$rmfiles $dir/$non_pic_object"
6648 if test "$mode" = clean
; then
6652 file=`$echo $file|${SED} 's,.exe$,,'`
6653 noexename
=`$echo $name|${SED} 's,.exe$,,'`
6654 # $file with .exe has already been added to rmfiles,
6655 # add $file without .exe
6656 rmfiles
="$rmfiles $file"
6659 # Do a test to see if this is a libtool program.
6660 if (${SED} -e '4q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6664 # note $name still contains .exe if it was in $file originally
6665 # as does the version of $file that was added into $rmfiles
6666 rmfiles
="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6667 if test "$fast_install" = yes && test -n "$relink_command"; then
6668 rmfiles
="$rmfiles $objdir/lt-$name"
6670 if test "X$noexename" != "X$name" ; then
6671 rmfiles
="$rmfiles $objdir/lt-${noexename}.c"
6677 $show "$rm $rmfiles"
6678 $run $rm $rmfiles || exit_status
=1
6680 objdir
="$origobjdir"
6682 # Try to remove the ${objdir}s in the directories where we deleted files
6683 for dir
in $rmdirs; do
6684 if test -d "$dir"; then
6686 $run rmdir $dir >/dev
/null
2>&1
6694 $echo "$modename: you must specify a MODE" 1>&2
6695 $echo "$generic_help" 1>&2
6700 if test -z "$exec_cmd"; then
6701 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6702 $echo "$generic_help" 1>&2
6705 fi # test -z "$show_help"
6707 if test -n "$exec_cmd"; then
6712 # We need to display help for each of the modes.
6715 "Usage: $modename [OPTION]... [MODE-ARG]...
6717 Provide generalized library-building support services.
6719 --config show all configuration variables
6720 --debug enable verbose shell tracing
6721 -n, --dry-run display commands without modifying any files
6722 --features display basic configuration information and exit
6723 --finish same as \`--mode=finish'
6724 --help display this help message and exit
6725 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6726 --quiet same as \`--silent'
6727 --silent don't print informational messages
6728 --tag=TAG use configuration variables from tag TAG
6729 --version print version information
6731 MODE must be one of the following:
6733 clean remove files from the build directory
6734 compile compile a source file into a libtool object
6735 execute automatically set library path, then run a program
6736 finish complete the installation of libtool libraries
6737 install install libraries or executables
6738 link create a library or an executable
6739 uninstall remove libraries from an installed directory
6741 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6742 a more detailed description of MODE.
6744 Report bugs to <bug-libtool@gnu.org>."
6750 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6752 Remove files from the build directory.
6754 RM is the name of the program to use to delete files associated with each FILE
6755 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6758 If FILE is a libtool library, object or program, all the files associated
6759 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6764 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6766 Compile a source file into a libtool library object.
6768 This mode accepts the following additional options:
6770 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6771 -prefer-pic try to building PIC objects only
6772 -prefer-non-pic try to building non-PIC objects only
6773 -static always build a \`.o' file suitable for static linking
6775 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6776 from the given SOURCEFILE.
6778 The output file name is determined by removing the directory component from
6779 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6780 library object suffix, \`.lo'."
6785 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6787 Automatically set library path, then run a program.
6789 This mode accepts the following additional options:
6791 -dlopen FILE add the directory containing FILE to the library path
6793 This mode sets the library path environment variable according to \`-dlopen'
6796 If any of the ARGS are libtool executable wrappers, then they are translated
6797 into their corresponding uninstalled binary, and any of their required library
6798 directories are added to the library path.
6800 Then, COMMAND is executed, with ARGS as arguments."
6805 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6807 Complete the installation of libtool libraries.
6809 Each LIBDIR is a directory that contains libtool libraries.
6811 The commands that this mode executes may require superuser privileges. Use
6812 the \`--dry-run' option if you just want to see what would be executed."
6817 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6819 Install executables or libraries.
6821 INSTALL-COMMAND is the installation command. The first component should be
6822 either the \`install' or \`cp' program.
6824 The rest of the components are interpreted as arguments to that command (only
6825 BSD-compatible install options are recognized)."
6830 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6832 Link object files or libraries together to form another library, or to
6833 create an executable program.
6835 LINK-COMMAND is a command using the C compiler that you would use to create
6836 a program from several object files.
6838 The following components of LINK-COMMAND are treated specially:
6840 -all-static do not do any dynamic linking at all
6841 -avoid-version do not add a version suffix if possible
6842 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6843 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6844 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6845 -export-symbols SYMFILE
6846 try to export only the symbols listed in SYMFILE
6847 -export-symbols-regex REGEX
6848 try to export only the symbols matching REGEX
6849 -LLIBDIR search LIBDIR for required installed libraries
6850 -lNAME OUTPUT-FILE requires the installed library libNAME
6851 -module build a library that can dlopened
6852 -no-fast-install disable the fast-install mode
6853 -no-install link a not-installable executable
6854 -no-undefined declare that a library does not refer to external symbols
6855 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6856 -objectlist FILE Use a list of object files found in FILE to specify objects
6857 -precious-files-regex REGEX
6858 don't remove output files matching REGEX
6859 -release RELEASE specify package release information
6860 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6861 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6862 -static do not do any dynamic linking of uninstalled libtool libraries
6863 -static-libtool-libs
6864 do not do any dynamic linking of libtool libraries
6865 -version-info CURRENT[:REVISION[:AGE]]
6866 specify library version info [each variable defaults to 0]
6868 All other options (arguments beginning with \`-') are ignored.
6870 Every other argument is treated as a filename. Files ending in \`.la' are
6871 treated as uninstalled libtool libraries, other files are standard or library
6874 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6875 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6876 required, except when creating a convenience library.
6878 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6879 using \`ar' and \`ranlib', or on Windows using \`lib'.
6881 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6882 is created, otherwise an executable program is created."
6887 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6889 Remove libraries from an installation directory.
6891 RM is the name of the program to use to delete files associated with each FILE
6892 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6895 If FILE is a libtool library, all the files associated with it are deleted.
6896 Otherwise, only FILE itself is deleted using RM."
6900 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6907 $echo "Try \`$modename --help' for more information about other modes."
6911 # The TAGs below are defined such that we never get into a situation
6912 # in which we disable both kinds of libraries. Given conflicting
6913 # choices, we go for a static library, that is the most portable,
6914 # since we can't tell whether shared libraries were disabled because
6915 # the user asked for that or because the platform doesn't support
6916 # them. This is particularly important on AIX, because we don't
6917 # support having both static and shared libraries enabled at the same
6918 # time on that platform, so we default to a shared-only configuration.
6919 # If a disable-shared tag is given, we'll fallback to a static-only
6920 # configuration. But we'll never go from static-only to shared-only.
6922 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6924 # ### END LIBTOOL TAG CONFIG: disable-shared
6926 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6928 # ### END LIBTOOL TAG CONFIG: disable-static