1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5 # 2007, 2008 Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
36 # The name of this program:
37 progname
=`echo "$progpath" | $SED $basename`
47 TIMESTAMP
=" (1.1220.2.492 2008/01/30 06:40:56)"
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh
) >/dev
/null
2>&1; then
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
58 case `(set -o) 2>/dev/null` in *posix
*) set -o posix
;; esac
60 BIN_SH
=xpg4
; export BIN_SH
# for Tru64
61 DUALCASE
=1; export DUALCASE
# for MKS sh
63 # Check that we have a working $echo.
64 if test "X$1" = X--no-reexec
; then
65 # Discard the --no-reexec flag, and continue.
67 elif test "X$1" = X--fallback-echo
; then
68 # Avoid inline document here, it may be left over
70 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71 # Yippee, $echo works!
74 # Restart under the correct shell, and then maybe $echo will work.
75 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78 if test "X$1" = X--fallback-echo
; then
79 # used as fallback echo
88 help="Try \`$progname --help' for more information."
89 magic
="%%%MAGIC variable%%%"
94 # Sed substitution that helps us do robust quoting. It backslashifies
95 # metacharacters that are still active within double-quoted strings.
96 Xsed
="${SED}"' -e 1s/^X//'
97 sed_quote_subst
='s/\([\\`\\"$\\\\]\)/\\\1/g'
98 # test EBCDIC or ASCII
99 case `echo X|tr X '\101'` in
100 A
) # ASCII based system
101 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103 NL2SP
='tr \015\012 \040\040'
105 *) # EBCDIC based system
107 NL2SP
='tr \r\n \100\100'
112 # Only set LANG and LC_ALL to C if already set.
113 # These must not be set unconditionally because not all systems understand
114 # e.g. LANG=C (notably SCO).
115 # We save the old values to restore during execute mode.
117 for lt_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119 eval "if test \"\${$lt_var+set}\" = set; then
120 save_$lt_var=\$$lt_var
121 lt_env=\"$lt_var=\$$lt_var \$lt_env\"
127 if test -n "$lt_env"; then
131 # Make sure IFS has a sensible default
136 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137 $echo "$modename: not configured to build any kind of library" 1>&2
138 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
153 lo2o
="s/\\.lo\$/.${objext}/"
154 o2lo
="s/\\.${objext}\$/.lo/"
158 #####################################
159 # Shell function definitions:
160 # This seems to be the best place for them
162 # func_mktempdir [string]
163 # Make a temporary directory that won't clash with other running
164 # libtool processes, and avoids race conditions if possible. If
165 # given, STRING is the basename for that directory.
168 my_template
="${TMPDIR-/tmp}/${1-$progname}"
170 if test "$run" = ":"; then
171 # Return a directory name, but don't create it in dry-run mode
172 my_tmpdir
="${my_template}-$$"
175 # If mktemp works, use that first and foremost
176 my_tmpdir
=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178 if test ! -d "$my_tmpdir"; then
179 # Failing that, at least try and use $RANDOM to avoid a race
180 my_tmpdir
="${my_template}-${RANDOM-0}$$"
182 save_mktempdir_umask
=`umask`
185 umask $save_mktempdir_umask
188 # If we're not in dry-run mode, bomb out on failure
189 test -d "$my_tmpdir" ||
{
190 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195 $echo "X$my_tmpdir" |
$Xsed
199 # func_win32_libid arg
200 # return the library type of file 'arg'
202 # Need a lot of goo to handle *both* DLLs and import libs
203 # Has to be a shell function in order to 'eat' the argument
204 # that is supplied when $file_magic_command is called.
207 win32_libid_type
="unknown"
208 win32_fileres
=`file -L $1 2>/dev/null`
209 case $win32_fileres in
210 *ar\ archive\ import\ library
*) # definitely import
211 win32_libid_type
="x86 archive import"
213 *ar\ archive
*) # could be an import, or static
214 if eval $OBJDUMP -f $1 |
$SED -e '10q' 2>/dev
/null | \
215 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev
/null
; then
216 win32_nmres
=`eval $NM -f posix -A $1 | \
225 import
*) win32_libid_type
="x86 archive import";;
226 *) win32_libid_type
="x86 archive static";;
231 win32_libid_type
="x86 DLL"
233 *executable
*) # but shell scripts are "executable" too...
234 case $win32_fileres in
235 *MS\ Windows\ PE\ Intel
*)
236 win32_libid_type
="x86 DLL"
241 $echo $win32_libid_type
246 # Infer tagged configuration to use if any are available and
247 # if one wasn't chosen via the "--tag" command line option.
248 # Only attempt this if the compiler in the base compile
249 # command doesn't match the default compiler.
250 # arg is usually of the form 'gcc ...'
253 if test -n "$available_tags" && test -z "$tagname"; then
257 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
261 CC_quoted
="$CC_quoted $arg"
264 # Blanks in the command may have been stripped by the calling shell,
265 # but not from the CC environment variable when configure was run.
266 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*) ;;
267 # Blanks at the start of $base_compile will cause this to fail
268 # if we don't check for them as well.
270 for z
in $available_tags; do
271 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev
/null
; then
272 # Evaluate the configuration.
273 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
276 # Double-quote args containing other shell metacharacters.
278 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
282 CC_quoted
="$CC_quoted $arg"
285 " $CC "* |
"$CC "* |
" `$echo $CC` "* |
"`$echo $CC` "* |
" $CC_quoted"* |
"$CC_quoted "* |
" `$echo $CC_quoted` "* |
"`$echo $CC_quoted` "*)
286 # The compiler in the base compile command matches
287 # the one in the tagged configuration.
288 # Assume this is the tagged configuration we want.
295 # If $tagname still isn't set, then no tagged configuration
296 # was found and let the user know that the "--tag" command
297 # line option must be used.
298 if test -z "$tagname"; then
299 $echo "$modename: unable to infer tagged configuration"
300 $echo "$modename: specify a tag with \`--tag'" 1>&2
303 # $echo "$modename: using $tagname tagged configuration"
311 # func_extract_an_archive dir oldlib
312 func_extract_an_archive
()
314 f_ex_an_ar_dir
="$1"; shift
315 f_ex_an_ar_oldlib
="$1"
317 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" ||
exit $?
319 if ($AR t
"$f_ex_an_ar_oldlib" |
sort |
sort -uc >/dev
/null
2>&1); then
322 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
327 # func_extract_archives gentop oldlib ...
328 func_extract_archives
()
330 my_gentop
="$1"; shift
338 $show "${rm}r $my_gentop"
339 $run ${rm}r
"$my_gentop"
340 $show "$mkdir $my_gentop"
341 $run $mkdir "$my_gentop"
343 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
347 for my_xlib
in $my_oldlibs; do
348 # Extract the objects.
350 [\\/]* |
[A-Za-z
]:[\\/]*) my_xabs
="$my_xlib" ;;
351 *) my_xabs
=`pwd`"/$my_xlib" ;;
353 my_xlib
=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
356 case " $extracted_archives " in
358 extracted_serial
=`expr $extracted_serial + 1`
359 my_xlib_u
=lt
$extracted_serial-$my_xlib ;;
363 extracted_archives
="$extracted_archives $my_xlib_u"
364 my_xdir
="$my_gentop/$my_xlib_u"
366 $show "${rm}r $my_xdir"
367 $run ${rm}r
"$my_xdir"
368 $show "$mkdir $my_xdir"
369 $run $mkdir "$my_xdir"
371 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
376 $show "Extracting $my_xabs"
377 # Do not bother doing anything if just a dry run
378 if test -z "$run"; then
379 darwin_orig_dir
=`pwd`
380 cd $my_xdir ||
exit $?
381 darwin_archive
=$my_xabs
383 darwin_base_archive
=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384 darwin_arches
=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385 if test -n "$darwin_arches"; then
386 darwin_arches
=`echo "$darwin_arches" | $SED -e 's/.*are://'`
388 $show "$darwin_base_archive has multiple architectures $darwin_arches"
389 for darwin_arch
in $darwin_arches ; do
390 mkdir
-p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391 lipo
-thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393 func_extract_an_archive
"`pwd`" "${darwin_base_archive}"
395 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396 done # $darwin_arches
397 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398 darwin_filelist
=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
401 for darwin_file
in $darwin_filelist; do
402 darwin_files
=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403 lipo
-create -output "$darwin_file" $darwin_files
404 done # $darwin_filelist
406 cd "$darwin_orig_dir"
408 cd "$darwin_orig_dir"
409 func_extract_an_archive
"$my_xdir" "$my_xabs"
414 func_extract_an_archive
"$my_xdir" "$my_xabs"
417 my_oldobjs
="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
419 func_extract_archives_result
="$my_oldobjs"
421 # End of Shell function definitions
422 #####################################
425 eval std_shrext
=\"$shrext_cmds\"
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?
492 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
494 Copyright (C) 2008 Free Software Foundation, Inc.
495 This is free software; see the source for copying conditions. There is NO
496 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
501 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502 # Now print the configurations for the tags.
503 for tagname
in $taglist; do
504 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
510 $echo "$progname: enabling shell trace mode"
512 preserve_args
="$preserve_args $arg"
521 if test "$build_libtool_libs" = yes; then
522 $echo "enable shared libraries"
524 $echo "disable shared libraries"
526 if test "$build_old_libs" = yes; then
527 $echo "enable static libraries"
529 $echo "disable static libraries"
534 --finish) mode
="finish" ;;
536 --mode) prevopt
="--mode" prev
=mode
;;
537 --mode=*) mode
="$optarg" ;;
539 --preserve-dup-deps) duplicate_deps
="yes" ;;
543 preserve_args
="$preserve_args $arg"
549 preserve_args
="$preserve_args --tag"
552 set tag
"$optarg" ${1+"$@"}
555 preserve_args
="$preserve_args --tag"
564 $echo "$modename: unrecognized option \`$arg'" 1>&2
576 if test -n "$prevopt"; then
577 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
582 case $disable_libs in
586 build_libtool_libs
=no
590 build_old_libs
=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
594 # If this variable is set in any of the actions, the command in it
595 # will be execed at the end. This prevents here-documents from being
596 # left over by shells.
599 if test -z "$show_help"; then
601 # Infer the operation mode.
602 if test -z "$mode"; then
603 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
606 *cc | cc
* |
*++ | gcc
* |
*-gcc* | g
++* | xlc
*)
618 *db |
*dbx |
*strace |
*truss
)
628 # If we have no mode, but dlfiles were specified, then do execute mode.
629 test -n "$execute_dlfiles" && mode
=execute
631 # Just use the default operation mode.
632 if test -z "$mode"; then
633 if test -n "$nonopt"; then
634 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
636 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
643 # Only execute mode is allowed to have -dlopen flags.
644 if test -n "$execute_dlfiles" && test "$mode" != execute
; then
645 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
650 # Change the help message to a mode-specific one.
652 help="Try \`$modename --help --mode=$mode' for more information."
654 # These modes are in order of execution frequency so that they run quickly.
656 # libtool compile mode
658 modename
="$modename: compile"
659 # Get the compilation command and the source file.
661 srcfile
="$nonopt" # always keep a non-empty value in "srcfile"
672 # do not "continue". Instead, add this to base_compile
684 # Accept any command-line options.
687 if test -n "$libobj" ; then
688 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
695 -static |
-prefer-pic |
-prefer-non-pic)
706 arg_mode
=arg
# the next one goes into the "base_compile" arg list
707 continue # The current "srcfile" will either be retained or
708 ;; # replaced later. I would guess that would be a bug.
711 args
=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
713 save_ifs
="$IFS"; IFS
=','
717 # Double-quote args containing other shell metacharacters.
718 # Many Bourne shells cannot handle close brackets correctly
719 # in scan sets, so we specify it separately.
721 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
725 lastarg
="$lastarg $arg"
728 lastarg
=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
730 # Add the arguments to base_compile.
731 base_compile
="$base_compile $lastarg"
736 # Accept the current argument as the source file.
737 # The previous "srcfile" becomes the current argument.
744 esac # case $arg_mode
746 # Aesthetically quote the previous argument.
747 lastarg
=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
750 # Double-quote args containing other shell metacharacters.
751 # Many Bourne shells cannot handle close brackets correctly
752 # in scan sets, and some SunOS ksh mistreat backslash-escaping
753 # in scan sets (worked around with variable expansion),
754 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755 # at all, so we specify them separately.
756 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
757 lastarg
="\"$lastarg\""
761 base_compile
="$base_compile $lastarg"
766 $echo "$modename: you must specify an argument for -Xcompile"
770 $echo "$modename: you must specify a target with \`-o'" 1>&2
774 # Get the name of the library object.
775 [ -z "$libobj" ] && libobj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
779 # Recognize several different file suffixes.
780 # If the user specifies -o file.o, it is replaced with file.lo
790 *.class
) xform
=class
;;
793 *.
[fF
][09]?
) xform
=[fF
][09].
;;
795 *.java
) xform
=java
;;
800 libobj
=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
803 *.lo
) obj
=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
805 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
810 func_infer_tag
$base_compile
812 for arg
in $later; do
831 qlibobj
=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
833 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834 qlibobj
="\"$qlibobj\"" ;;
836 test "X$libobj" != "X$qlibobj" \
837 && $echo "X$libobj" |
grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
838 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
839 objname
=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
840 xdir
=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
841 if test "X$xdir" = "X$obj"; then
846 lobj
=${xdir}$objdir/$objname
848 if test -z "$base_compile"; then
849 $echo "$modename: you must specify a compilation command" 1>&2
854 # Delete any leftover library objects.
855 if test "$build_old_libs" = yes; then
856 removelist
="$obj $lobj $libobj ${libobj}T"
858 removelist
="$lobj $libobj ${libobj}T"
862 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
864 # On Cygwin there's no "real" PIC flag so we must build both object types
866 cygwin
* | mingw
* | pw32
* | os2
*)
870 if test "$pic_mode" = no
&& test "$deplibs_check_method" != pass_all
; then
871 # non-PIC code in shared libraries is not supported
875 # Calculate the filename of the output object if compiler does
876 # not support -o with -c
877 if test "$compiler_c_o" = no
; then
878 output_obj
=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.
${objext}
879 lockfile
="$output_obj.lock"
880 removelist
="$removelist $output_obj $lockfile"
881 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
888 # Lock this critical section if it is needed
889 # We use this script file to make the link, it avoids creating a new file
890 if test "$need_locks" = yes; then
891 until $run ln "$progpath" "$lockfile" 2>/dev
/null
; do
892 $show "Waiting for $lockfile to be removed"
895 elif test "$need_locks" = warn
; then
896 if test -f "$lockfile"; then
898 *** ERROR, $lockfile exists and contains:
899 `cat $lockfile 2>/dev/null`
901 This indicates that another process is trying to use the same
902 temporary object file, and libtool could not work around it because
903 your compiler does not support \`-c' and \`-o' together. If you
904 repeat this compilation, it may succeed, by chance, but you had better
905 avoid parallel builds (make -j) in this platform, or get a better
911 $echo "$srcfile" > "$lockfile"
914 if test -n "$fix_srcfile_path"; then
915 eval srcfile
=\"$fix_srcfile_path\"
917 qsrcfile
=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
919 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
920 qsrcfile
="\"$qsrcfile\"" ;;
923 $run $rm "$libobj" "${libobj}T"
925 # Create a libtool object file (analogous to a ".la" file),
926 # but don't create it if we're doing a dry run.
927 test -z "$run" && cat > ${libobj}T
<<EOF
928 # $libobj - a libtool object file
929 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
931 # Please DO NOT delete this file!
932 # It is necessary for linking the library.
934 # Name of the PIC object.
937 # Only build a PIC object if we are building libtool libraries.
938 if test "$build_libtool_libs" = yes; then
939 # Without this assignment, base_compile gets emptied.
940 fbsd_hideous_sh_bug
=$base_compile
942 if test "$pic_mode" != no
; then
943 command="$base_compile $qsrcfile $pic_flag"
945 # Don't build PIC code
946 command="$base_compile $qsrcfile"
949 if test ! -d "${xdir}$objdir"; then
950 $show "$mkdir ${xdir}$objdir"
951 $run $mkdir ${xdir}$objdir
953 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
958 if test -z "$output_obj"; then
960 # Place PIC objects in $objdir
961 command="$command -o $lobj"
963 $run $rm "$lobj" "$output_obj"
967 if $run eval $lt_env "$command"; then :
969 test -n "$output_obj" && $run $rm $removelist
973 if test "$need_locks" = warn
&&
974 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
976 *** ERROR, $lockfile contains:
977 `cat $lockfile 2>/dev/null`
979 but it should contain:
982 This indicates that another process is trying to use the same
983 temporary object file, and libtool could not work around it because
984 your compiler does not support \`-c' and \`-o' together. If you
985 repeat this compilation, it may succeed, by chance, but you had better
986 avoid parallel builds (make -j) in this platform, or get a better
993 # Just move the object if needed, then go on to compile the next one
994 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
995 $show "$mv $output_obj $lobj"
996 if $run $mv $output_obj $lobj; then :
1004 # Append the name of the PIC object to the libtool object file.
1005 test -z "$run" && cat >> ${libobj}T
<<EOF
1006 pic_object='$objdir/$objname'
1010 # Allow error messages only from the first compilation.
1011 if test "$suppress_opt" = yes; then
1012 suppress_output
=' >/dev/null 2>&1'
1015 # No PIC object so indicate it doesn't exist in the libtool
1017 test -z "$run" && cat >> ${libobj}T
<<EOF
1023 # Only build a position-dependent object if we build old libraries.
1024 if test "$build_old_libs" = yes; then
1025 if test "$pic_mode" != yes; then
1026 # Don't build PIC code
1027 command="$base_compile $qsrcfile"
1029 command="$base_compile $qsrcfile $pic_flag"
1031 if test "$compiler_c_o" = yes; then
1032 command="$command -o $obj"
1035 # Suppress compiler output if we already did a PIC compilation.
1036 command="$command$suppress_output"
1037 $run $rm "$obj" "$output_obj"
1039 if $run eval $lt_env "$command"; then :
1041 $run $rm $removelist
1045 if test "$need_locks" = warn
&&
1046 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1048 *** ERROR, $lockfile contains:
1049 `cat $lockfile 2>/dev/null`
1051 but it should contain:
1054 This indicates that another process is trying to use the same
1055 temporary object file, and libtool could not work around it because
1056 your compiler does not support \`-c' and \`-o' together. If you
1057 repeat this compilation, it may succeed, by chance, but you had better
1058 avoid parallel builds (make -j) in this platform, or get a better
1061 $run $rm $removelist
1065 # Just move the object if needed
1066 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1067 $show "$mv $output_obj $obj"
1068 if $run $mv $output_obj $obj; then :
1071 $run $rm $removelist
1076 # Append the name of the non-PIC object the libtool object file.
1077 # Only append if the libtool object file exists.
1078 test -z "$run" && cat >> ${libobj}T
<<EOF
1079 # Name of the non-PIC object.
1080 non_pic_object='$objname'
1084 # Append the name of the non-PIC object the libtool object file.
1085 # Only append if the libtool object file exists.
1086 test -z "$run" && cat >> ${libobj}T
<<EOF
1087 # Name of the non-PIC object.
1093 $run $mv "${libobj}T" "${libobj}"
1095 # Unlock the critical section if it was locked
1096 if test "$need_locks" != no
; then
1097 $run $rm "$lockfile"
1105 modename
="$modename: link"
1107 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1108 # It is impossible to link a dll without this setting, and
1109 # we shouldn't force the makefile maintainer to figure out
1110 # which system we are compiling for in order to pass an extra
1111 # flag for every libtool invocation.
1112 # allow_undefined=no
1114 # FIXME: Unfortunately, there are problems with the above when trying
1115 # to make a dll which has undefined symbols, in which case not
1116 # even a static library is built. For now, we need to specify
1117 # -no-undefined on the libtool link line when we can be certain
1118 # that all symbols are satisfied, otherwise we get a static library.
1125 libtool_args
="$nonopt"
1126 base_compile
="$nonopt $@"
1127 compile_command
="$nonopt"
1128 finalize_command
="$nonopt"
1141 lib_search_path
=`pwd`
1150 export_symbols_regex
=
1158 notinst_path
= # paths that contain not-installed libtool libraries
1159 precious_files_regex
=
1160 prefer_static_libs
=no
1172 single_module
="${wl}-single_module"
1174 func_infer_tag
$base_compile
1176 # We need to know -static, to get the right output filenames.
1180 -all-static |
-static |
-static-libtool-libs)
1183 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1184 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1186 if test -n "$link_static_flag"; then
1187 dlopen_self
=$dlopen_self_static
1189 prefer_static_libs
=yes
1192 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1193 dlopen_self
=$dlopen_self_static
1195 prefer_static_libs
=built
1197 -static-libtool-libs)
1198 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1199 dlopen_self
=$dlopen_self_static
1201 prefer_static_libs
=yes
1204 build_libtool_libs
=no
1211 # See if our shared archives depend on static archives.
1212 test -n "$old_archive_from_new_cmds" && build_old_libs
=yes
1214 # Go through the arguments, transforming them on the way.
1215 while test "$#" -gt 0; do
1219 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1220 qarg
=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1224 libtool_args
="$libtool_args $qarg"
1226 # If the previous option needs an argument, assign it.
1227 if test -n "$prev"; then
1230 compile_command
="$compile_command @OUTPUT@"
1231 finalize_command
="$finalize_command @OUTPUT@"
1237 if test "$preload" = no
; then
1238 # Add the symbol object into the linking commands.
1239 compile_command
="$compile_command @SYMFILE@"
1240 finalize_command
="$finalize_command @SYMFILE@"
1244 *.la |
*.lo
) ;; # We handle these cases below.
1246 if test "$dlself" = no
; then
1254 if test "$prev" = dlprefiles
; then
1256 elif test "$prev" = dlfiles
&& test "$dlopen_self" != yes; then
1266 if test "$prev" = dlfiles
; then
1267 dlfiles
="$dlfiles $arg"
1269 dlprefiles
="$dlprefiles $arg"
1277 export_symbols
="$arg"
1278 if test ! -f "$arg"; then
1279 $echo "$modename: symbol file \`$arg' does not exist"
1286 export_symbols_regex
="$arg"
1291 inst_prefix_dir
="$arg"
1296 precious_files_regex
="$arg"
1306 if test -f "$arg"; then
1309 for fil
in `cat $save_arg`
1311 # moreargs="$moreargs $fil"
1313 # A libtool-controlled object.
1315 # Check to see that this really is a libtool object.
1316 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1321 # If there is no directory component, then add one.
1323 */* |
*\\*) .
$arg ;;
1327 if test -z "$pic_object" || \
1328 test -z "$non_pic_object" ||
1329 test "$pic_object" = none
&& \
1330 test "$non_pic_object" = none
; then
1331 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1335 # Extract subdirectory from the argument.
1336 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1337 if test "X$xdir" = "X$arg"; then
1343 if test "$pic_object" != none
; then
1344 # Prepend the subdirectory the object is found in.
1345 pic_object
="$xdir$pic_object"
1347 if test "$prev" = dlfiles
; then
1348 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1349 dlfiles
="$dlfiles $pic_object"
1353 # If libtool objects are unsupported, then we need to preload.
1358 # CHECK ME: I think I busted this. -Ossama
1359 if test "$prev" = dlprefiles
; then
1360 # Preload the old-style object.
1361 dlprefiles
="$dlprefiles $pic_object"
1366 libobjs
="$libobjs $pic_object"
1371 if test "$non_pic_object" != none
; then
1372 # Prepend the subdirectory the object is found in.
1373 non_pic_object
="$xdir$non_pic_object"
1375 # A standard non-PIC object
1376 non_pic_objects
="$non_pic_objects $non_pic_object"
1377 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1378 arg
="$non_pic_object"
1381 # If the PIC object exists, use it instead.
1382 # $xdir was prepended to $pic_object above.
1383 non_pic_object
="$pic_object"
1384 non_pic_objects
="$non_pic_objects $non_pic_object"
1387 # Only an error if not doing a dry-run.
1388 if test -z "$run"; then
1389 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1394 # Extract subdirectory from the argument.
1395 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1396 if test "X$xdir" = "X$arg"; then
1402 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1403 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1404 libobjs
="$libobjs $pic_object"
1405 non_pic_objects
="$non_pic_objects $non_pic_object"
1410 $echo "$modename: link input file \`$save_arg' does not exist"
1418 # We need an absolute path.
1420 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1422 $echo "$modename: only absolute run-paths are allowed" 1>&2
1426 if test "$prev" = rpath
; then
1429 *) rpath
="$rpath $arg" ;;
1434 *) xrpath
="$xrpath $arg" ;;
1441 compiler_flags
="$compiler_flags $qarg"
1443 compile_command
="$compile_command $qarg"
1444 finalize_command
="$finalize_command $qarg"
1448 linker_flags
="$linker_flags $qarg"
1449 compiler_flags
="$compiler_flags $wl$qarg"
1451 compile_command
="$compile_command $wl$qarg"
1452 finalize_command
="$finalize_command $wl$qarg"
1456 linker_flags
="$linker_flags $qarg"
1457 compiler_flags
="$compiler_flags $qarg"
1459 compile_command
="$compile_command $qarg"
1460 finalize_command
="$finalize_command $qarg"
1468 darwin_framework|darwin_framework_skip
)
1469 test "$prev" = "darwin_framework" && compiler_flags
="$compiler_flags $arg"
1470 compile_command
="$compile_command $arg"
1471 finalize_command
="$finalize_command $arg"
1476 eval "$prev=\"\$arg\""
1481 fi # test -n "$prev"
1487 if test -n "$link_static_flag"; then
1488 compile_command
="$compile_command $link_static_flag"
1489 finalize_command
="$finalize_command $link_static_flag"
1495 # FIXME: remove this flag sometime in the future.
1496 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1520 -export-symbols |
-export-symbols-regex)
1521 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
1522 $echo "$modename: more than one -exported-symbols argument is not allowed"
1525 if test "X$arg" = "X-export-symbols"; then
1533 -framework|
-arch|
-isysroot)
1535 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1536 prev
=darwin_framework_skip
;;
1537 *) compiler_flags
="$compiler_flags $arg"
1538 prev
=darwin_framework
;;
1540 compile_command
="$compile_command $arg"
1541 finalize_command
="$finalize_command $arg"
1550 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1551 # so, if we see these flags be careful not to treat them like -L
1553 case $with_gcc/$host in
1554 no
/*-*-irix* |
/*-*-irix*)
1555 compile_command
="$compile_command $arg"
1556 finalize_command
="$finalize_command $arg"
1563 dir
=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1564 # We need an absolute path.
1566 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1568 absdir
=`cd "$dir" && pwd`
1569 if test -z "$absdir"; then
1570 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1572 notinst_path
="$notinst_path $dir"
1580 deplibs
="$deplibs -L$dir"
1581 lib_search_path
="$lib_search_path $dir"
1585 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
1586 testbindir
=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1587 case :$dllsearchpath: in
1589 *) dllsearchpath
="$dllsearchpath:$dir";;
1591 case :$dllsearchpath: in
1592 *":$testbindir:"*) ;;
1593 *) dllsearchpath
="$dllsearchpath:$testbindir";;
1601 if test "X$arg" = "X-lc" ||
test "X$arg" = "X-lm"; then
1603 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-beos*)
1604 # These systems don't actually have a C or math library (as such)
1608 # These systems don't actually have a C library (as such)
1609 test "X$arg" = "X-lc" && continue
1611 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1612 # Do not include libc due to us having libc/libc_r.
1613 test "X$arg" = "X-lc" && continue
1615 *-*-rhapsody* |
*-*-darwin1.
[012])
1616 # Rhapsody C and math libraries are in the System framework
1617 deplibs
="$deplibs -framework System"
1620 *-*-sco3.2v5
* |
*-*-sco5v6*)
1621 # Causes problems with __ctype
1622 test "X$arg" = "X-lc" && continue
1624 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
1625 # Compiler inserts libc in the correct place for threads to work
1626 test "X$arg" = "X-lc" && continue
1629 elif test "X$arg" = "X-lc_r"; then
1631 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
1632 # Do not include libc_r directly, use -pthread flag.
1637 deplibs
="$deplibs $arg"
1641 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1642 # classes, name mangling, and exception handling.
1644 compile_command
="$compile_command $arg"
1645 compiler_flags
="$compiler_flags $arg"
1646 finalize_command
="$finalize_command $arg"
1651 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe|
-threads)
1652 compiler_flags
="$compiler_flags $arg"
1653 compile_command
="$compile_command $arg"
1654 finalize_command
="$finalize_command $arg"
1659 single_module
="${wl}-multi_module"
1668 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671 # +DA*, +DD* enable 64-bit mode on the HP compiler
1672 # -q* pass through compiler args for the IBM compiler
1673 # -m* pass through architecture-specific compiler args for GCC
1674 # -m*, -t[45]*, -txscale* pass through architecture-specific
1675 # compiler args for GCC
1676 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677 # -F/path gives path to uninstalled frameworks, gcc on darwin
1678 # @file GCC response files
1679 -64|
-mips[0-9]|
-r[0-9][0-9]*|
-xarch=*|
-xtarget=*|
+DA
*|
+DD
*|
-q*|
-m*| \
1680 -t[45]*|
-txscale*|
-p|
-pg|
--coverage|
-fprofile-*|
-F*|@
*)
1682 # Unknown arguments in both finalize_command and compile_command need
1683 # to be aesthetically quoted because they are evaled later.
1684 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1686 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1690 compile_command
="$compile_command $arg"
1691 finalize_command
="$finalize_command $arg"
1692 compiler_flags
="$compiler_flags $arg"
1708 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-*-darwin*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # and Darwin in order for the loader to find any dlls it needs.
1711 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1715 *) no_install
=yes ;;
1732 -precious-files-regex)
1753 dir
=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754 # We need an absolute path.
1756 [\\/]* |
[A-Za-z
]:[\\/]*) ;;
1758 $echo "$modename: only absolute run-paths are allowed" 1>&2
1764 *) xrpath
="$xrpath $dir" ;;
1769 -static |
-static-libtool-libs)
1770 # The effects of -static are defined in a previous loop.
1771 # We used to do the same as -all-static on platforms that
1772 # didn't have a PIC flag, but the assumption that the effects
1773 # would be equivalent was wrong. It would break on at least
1774 # Digital Unix and AIX.
1794 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1796 save_ifs
="$IFS"; IFS
=','
1797 for flag
in $args; do
1800 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1805 compiler_flags
="$compiler_flags $flag"
1808 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1812 args
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1814 save_ifs
="$IFS"; IFS
=','
1815 for flag
in $args; do
1818 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1823 compiler_flags
="$compiler_flags $wl$flag"
1824 linker_flags
="$linker_flags $flag"
1827 arg
=`$echo "X$arg" | $Xsed -e "s/^ //"`
1845 # Some other compiler flag.
1847 # Unknown arguments in both finalize_command and compile_command need
1848 # to be aesthetically quoted because they are evaled later.
1849 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1851 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1858 # A standard object.
1863 # A libtool-controlled object.
1865 # Check to see that this really is a libtool object.
1866 if (${SED} -e '2q' $arg |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
1871 # If there is no directory component, then add one.
1873 */* |
*\\*) .
$arg ;;
1877 if test -z "$pic_object" || \
1878 test -z "$non_pic_object" ||
1879 test "$pic_object" = none
&& \
1880 test "$non_pic_object" = none
; then
1881 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1885 # Extract subdirectory from the argument.
1886 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$xdir" = "X$arg"; then
1893 if test "$pic_object" != none
; then
1894 # Prepend the subdirectory the object is found in.
1895 pic_object
="$xdir$pic_object"
1897 if test "$prev" = dlfiles
; then
1898 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899 dlfiles
="$dlfiles $pic_object"
1903 # If libtool objects are unsupported, then we need to preload.
1908 # CHECK ME: I think I busted this. -Ossama
1909 if test "$prev" = dlprefiles
; then
1910 # Preload the old-style object.
1911 dlprefiles
="$dlprefiles $pic_object"
1916 libobjs
="$libobjs $pic_object"
1921 if test "$non_pic_object" != none
; then
1922 # Prepend the subdirectory the object is found in.
1923 non_pic_object
="$xdir$non_pic_object"
1925 # A standard non-PIC object
1926 non_pic_objects
="$non_pic_objects $non_pic_object"
1927 if test -z "$pic_object" ||
test "$pic_object" = none
; then
1928 arg
="$non_pic_object"
1931 # If the PIC object exists, use it instead.
1932 # $xdir was prepended to $pic_object above.
1933 non_pic_object
="$pic_object"
1934 non_pic_objects
="$non_pic_objects $non_pic_object"
1937 # Only an error if not doing a dry-run.
1938 if test -z "$run"; then
1939 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1944 # Extract subdirectory from the argument.
1945 xdir
=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946 if test "X$xdir" = "X$arg"; then
1952 pic_object
=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953 non_pic_object
=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954 libobjs
="$libobjs $pic_object"
1955 non_pic_objects
="$non_pic_objects $non_pic_object"
1962 deplibs
="$deplibs $arg"
1963 old_deplibs
="$old_deplibs $arg"
1968 # A libtool-controlled library.
1970 if test "$prev" = dlfiles
; then
1971 # This library was specified with -dlopen.
1972 dlfiles
="$dlfiles $arg"
1974 elif test "$prev" = dlprefiles
; then
1975 # The library was specified with -dlpreopen.
1976 dlprefiles
="$dlprefiles $arg"
1979 deplibs
="$deplibs $arg"
1984 # Some other compiler argument.
1986 # Unknown arguments in both finalize_command and compile_command need
1987 # to be aesthetically quoted because they are evaled later.
1988 arg
=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1990 *[\
[\~\
#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1997 # Now actually substitute the argument into the commands.
1998 if test -n "$arg"; then
1999 compile_command
="$compile_command $arg"
2000 finalize_command
="$finalize_command $arg"
2002 done # argument parsing loop
2004 if test -n "$prev"; then
2005 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2010 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011 eval arg
=\"$export_dynamic_flag_spec\"
2012 compile_command
="$compile_command $arg"
2013 finalize_command
="$finalize_command $arg"
2017 # calculate the name of the file, without its directory
2018 outputname
=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019 libobjs_save
="$libobjs"
2021 if test -n "$shlibpath_var"; then
2022 # get the directories listed in $shlibpath_var
2023 eval shlib_search_path
=\
`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2027 eval sys_lib_search_path
=\"$sys_lib_search_path_spec\"
2028 eval sys_lib_dlsearch_path
=\"$sys_lib_dlsearch_path_spec\"
2030 output_objdir
=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031 if test "X$output_objdir" = "X$output"; then
2032 output_objdir
="$objdir"
2034 output_objdir
="$output_objdir/$objdir"
2036 # Create the object directory.
2037 if test ! -d "$output_objdir"; then
2038 $show "$mkdir $output_objdir"
2039 $run $mkdir $output_objdir
2041 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2046 # Determine the type of output
2049 $echo "$modename: you must specify an output file" 1>&2
2053 *.
$libext) linkmode
=oldlib
;;
2054 *.lo |
*.
$objext) linkmode
=obj
;;
2055 *.la
) linkmode
=lib
;;
2056 *) linkmode
=prog
;; # Anything else should be a program.
2060 *cygwin
* |
*mingw
* |
*pw32
*)
2061 # don't eliminate duplications in $postdeps and $predeps
2062 duplicate_compiler_generated_deps
=yes
2065 duplicate_compiler_generated_deps
=$duplicate_deps
2071 # Find all interdependent deplibs by searching for libraries
2072 # that are linked more than once (e.g. -la -lb -la)
2073 for deplib
in $deplibs; do
2074 if test "X$duplicate_deps" = "Xyes" ; then
2076 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2079 libs
="$libs $deplib"
2082 if test "$linkmode" = lib
; then
2083 libs
="$predeps $libs $compiler_lib_search_path $postdeps"
2085 # Compute libraries that are listed more than once in $predeps
2086 # $postdeps and mark them as special (i.e., whose duplicates are
2087 # not to be eliminated).
2089 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090 for pre_post_dep
in $predeps $postdeps; do
2091 case "$pre_post_deps " in
2092 *" $pre_post_dep "*) specialdeplibs
="$specialdeplibs $pre_post_deps" ;;
2094 pre_post_deps
="$pre_post_deps $pre_post_dep"
2103 need_relink
=no
# whether we're linking any uninstalled libtool libraries
2104 notinst_deplibs
= # not-installed libtool libraries
2108 for file in $dlfiles $dlprefiles; do
2112 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2124 passes
="conv scan dlopen dlpreopen link"
2129 for pass
in $passes; do
2130 if test "$linkmode,$pass" = "lib,link" ||
2131 test "$linkmode,$pass" = "prog,scan"; then
2135 if test "$linkmode" = prog
; then
2137 dlopen
) libs
="$dlfiles" ;;
2138 dlpreopen
) libs
="$dlprefiles" ;;
2139 link
) libs
="$deplibs %DEPLIBS% $dependency_libs" ;;
2142 if test "$pass" = dlopen
; then
2143 # Collect dlpreopened libraries
2144 save_deplibs
="$deplibs"
2147 for deplib
in $libs; do
2151 -mt|
-mthreads|
-kthread|
-Kthread|
-pthread|
-pthreads|
--thread-safe|
-threads)
2152 if test "$linkmode,$pass" = "prog,link"; then
2153 compile_deplibs
="$deplib $compile_deplibs"
2154 finalize_deplibs
="$deplib $finalize_deplibs"
2156 compiler_flags
="$compiler_flags $deplib"
2161 if test "$linkmode" != lib
&& test "$linkmode" != prog
; then
2162 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2165 name
=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166 if test "$linkmode" = lib
; then
2167 searchdirs
="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2169 searchdirs
="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2171 for searchdir
in $searchdirs; do
2172 for search_ext
in .la
$std_shrext .so .a
; do
2173 # Search the libtool library
2174 lib
="$searchdir/lib${name}${search_ext}"
2175 if test -f "$lib"; then
2176 if test "$search_ext" = ".la"; then
2185 if test "$found" != yes; then
2186 # deplib doesn't seem to be a libtool library
2187 if test "$linkmode,$pass" = "prog,link"; then
2188 compile_deplibs
="$deplib $compile_deplibs"
2189 finalize_deplibs
="$deplib $finalize_deplibs"
2191 deplibs
="$deplib $deplibs"
2192 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2195 else # deplib is a libtool library
2196 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2197 # We need to do some special things here, and not later.
2198 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2199 case " $predeps $postdeps " in
2201 if (${SED} -e '2q' $lib |
2202 grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
2206 */* |
*\\*) .
$lib ;;
2209 for l
in $old_library $library_names; do
2212 if test "X$ll" = "X$old_library" ; then # only static version available
2214 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2215 test "X$ladir" = "X$lib" && ladir
="."
2216 lib
=$ladir/$old_library
2217 if test "$linkmode,$pass" = "prog,link"; then
2218 compile_deplibs
="$deplib $compile_deplibs"
2219 finalize_deplibs
="$deplib $finalize_deplibs"
2221 deplibs
="$deplib $deplibs"
2222 test "$linkmode" = lib
&& newdependency_libs
="$deplib $newdependency_libs"
2236 deplibs
="$deplib $deplibs"
2237 test "$pass" = conv
&& continue
2238 newdependency_libs
="$deplib $newdependency_libs"
2239 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2242 if test "$pass" = conv
; then
2243 deplibs
="$deplib $deplibs"
2246 if test "$pass" = scan
; then
2247 deplibs
="$deplib $deplibs"
2249 compile_deplibs
="$deplib $compile_deplibs"
2250 finalize_deplibs
="$deplib $finalize_deplibs"
2252 newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2255 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2261 if test "$pass" = link
; then
2262 dir
=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2263 # Make sure the xrpath contains only unique directories.
2266 *) xrpath
="$xrpath $dir" ;;
2269 deplibs
="$deplib $deplibs"
2272 *.la
) lib
="$deplib" ;;
2274 if test "$pass" = conv
; then
2275 deplibs
="$deplib $deplibs"
2281 case $deplibs_check_method in
2283 set dummy
$deplibs_check_method
2284 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2285 if eval $echo \"$deplib\" 2>/dev
/null \
2287 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
2295 if test "$valid_a_lib" != yes; then
2297 $echo "*** Warning: Trying to link with static lib archive $deplib."
2298 $echo "*** I have the capability to make that library automatically link in when"
2299 $echo "*** you link to this library. But I can only do this if you have a"
2300 $echo "*** shared version of the library, which you do not appear to have"
2301 $echo "*** because the file extensions .$libext of this argument makes me believe"
2302 $echo "*** that it is just a static archive that I should not used here."
2305 $echo "*** Warning: Linking the shared library $output against the"
2306 $echo "*** static library $deplib is not portable!"
2307 deplibs
="$deplib $deplibs"
2312 if test "$pass" != link
; then
2313 deplibs
="$deplib $deplibs"
2315 compile_deplibs
="$deplib $compile_deplibs"
2316 finalize_deplibs
="$deplib $finalize_deplibs"
2323 if test "$pass" = conv
; then
2324 deplibs
="$deplib $deplibs"
2325 elif test "$linkmode" = prog
; then
2326 if test "$pass" = dlpreopen ||
test "$dlopen_support" != yes ||
test "$build_libtool_libs" = no
; then
2327 # If there is no dlopen support or we're linking statically,
2328 # we need to preload.
2329 newdlprefiles
="$newdlprefiles $deplib"
2330 compile_deplibs
="$deplib $compile_deplibs"
2331 finalize_deplibs
="$deplib $finalize_deplibs"
2333 newdlfiles
="$newdlfiles $deplib"
2343 if test "$found" = yes ||
test -f "$lib"; then :
2345 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2349 # Check to see that this really is a libtool archive.
2350 if (${SED} -e '2q' $lib |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
2352 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2356 ladir
=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2357 test "X$ladir" = "X$lib" && ladir
="."
2365 # If the library was installed with an old release of libtool,
2366 # it will not redefine variables installed, or shouldnotlink
2374 */* |
*\\*) .
$lib ;;
2378 if test "$linkmode,$pass" = "lib,link" ||
2379 test "$linkmode,$pass" = "prog,scan" ||
2380 { test "$linkmode" != prog
&& test "$linkmode" != lib
; }; then
2381 test -n "$dlopen" && dlfiles
="$dlfiles $dlopen"
2382 test -n "$dlpreopen" && dlprefiles
="$dlprefiles $dlpreopen"
2385 if test "$pass" = conv
; then
2386 # Only check for convenience libraries
2387 deplibs
="$lib $deplibs"
2388 if test -z "$libdir"; then
2389 if test -z "$old_library"; then
2390 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2393 # It is a libtool convenience library, so add in its objects.
2394 convenience
="$convenience $ladir/$objdir/$old_library"
2395 old_convenience
="$old_convenience $ladir/$objdir/$old_library"
2397 for deplib
in $dependency_libs; do
2398 deplibs
="$deplib $deplibs"
2399 if test "X$duplicate_deps" = "Xyes" ; then
2400 case "$tmp_libs " in
2401 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2404 tmp_libs
="$tmp_libs $deplib"
2406 elif test "$linkmode" != prog
&& test "$linkmode" != lib
; then
2407 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2414 # Get the name of the library we link against.
2416 for l
in $old_library $library_names; do
2419 if test -z "$linklib"; then
2420 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2424 # This library was specified with -dlopen.
2425 if test "$pass" = dlopen
; then
2426 if test -z "$libdir"; then
2427 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2430 if test -z "$dlname" ||
2431 test "$dlopen_support" != yes ||
2432 test "$build_libtool_libs" = no
; then
2433 # If there is no dlname, no dlopen support or we're linking
2434 # statically, we need to preload. We also need to preload any
2435 # dependent libraries so libltdl's deplib preloader doesn't
2436 # bomb out in the load deplibs phase.
2437 dlprefiles
="$dlprefiles $lib $dependency_libs"
2439 newdlfiles
="$newdlfiles $lib"
2444 # We need an absolute path.
2446 [\\/]* |
[A-Za-z
]:[\\/]*) abs_ladir
="$ladir" ;;
2448 abs_ladir
=`cd "$ladir" && pwd`
2449 if test -z "$abs_ladir"; then
2450 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2451 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2456 laname
=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2458 # Find the relevant object directory and library name.
2459 if test "X$installed" = Xyes
; then
2460 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2461 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2469 test "X$hardcode_automatic" = Xyes
&& avoidtemprpath
=yes
2471 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2474 # Remove this search path later
2475 notinst_path
="$notinst_path $abs_ladir"
2477 dir
="$ladir/$objdir"
2478 absdir
="$abs_ladir/$objdir"
2479 # Remove this search path later
2480 notinst_path
="$notinst_path $abs_ladir"
2482 fi # $installed = yes
2483 name
=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2485 # This library was specified with -dlpreopen.
2486 if test "$pass" = dlpreopen
; then
2487 if test -z "$libdir"; then
2488 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2491 # Prefer using a static library (so that no silly _DYNAMIC symbols
2492 # are required to link).
2493 if test -n "$old_library"; then
2494 newdlprefiles
="$newdlprefiles $dir/$old_library"
2495 # Otherwise, use the dlname, so that lt_dlopen finds it.
2496 elif test -n "$dlname"; then
2497 newdlprefiles
="$newdlprefiles $dir/$dlname"
2499 newdlprefiles
="$newdlprefiles $dir/$linklib"
2501 fi # $pass = dlpreopen
2503 if test -z "$libdir"; then
2504 # Link the convenience library
2505 if test "$linkmode" = lib
; then
2506 deplibs
="$dir/$old_library $deplibs"
2507 elif test "$linkmode,$pass" = "prog,link"; then
2508 compile_deplibs
="$dir/$old_library $compile_deplibs"
2509 finalize_deplibs
="$dir/$old_library $finalize_deplibs"
2511 deplibs
="$lib $deplibs" # used for prog,scan pass
2517 if test "$linkmode" = prog
&& test "$pass" != link
; then
2518 newlib_search_path
="$newlib_search_path $ladir"
2519 deplibs
="$lib $deplibs"
2522 if test "$link_all_deplibs" != no ||
test -z "$library_names" ||
2523 test "$build_libtool_libs" = no
; then
2528 for deplib
in $dependency_libs; do
2530 -L*) newlib_search_path
="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2532 # Need to link against all dependency_libs?
2533 if test "$linkalldeplibs" = yes; then
2534 deplibs
="$deplib $deplibs"
2536 # Need to hardcode shared library paths
2537 # or/and link against static libraries
2538 newdependency_libs
="$deplib $newdependency_libs"
2540 if test "X$duplicate_deps" = "Xyes" ; then
2541 case "$tmp_libs " in
2542 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2545 tmp_libs
="$tmp_libs $deplib"
2548 fi # $linkmode = prog...
2550 if test "$linkmode,$pass" = "prog,link"; then
2551 if test -n "$library_names" &&
2552 { { test "$prefer_static_libs" = no ||
2553 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2554 test -z "$old_library"; }; then
2555 # We need to hardcode the library path
2556 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2557 # Make sure the rpath contains only unique directories.
2558 case "$temp_rpath " in
2561 *) temp_rpath
="$temp_rpath $absdir" ;;
2565 # Hardcode the library path.
2566 # Skip directories that are in the system default run-time
2568 case " $sys_lib_dlsearch_path " in
2571 case "$compile_rpath " in
2573 *) compile_rpath
="$compile_rpath $absdir"
2577 case " $sys_lib_dlsearch_path " in
2580 case "$finalize_rpath " in
2582 *) finalize_rpath
="$finalize_rpath $libdir"
2586 fi # $linkmode,$pass = prog,link...
2588 if test "$alldeplibs" = yes &&
2589 { test "$deplibs_check_method" = pass_all ||
2590 { test "$build_libtool_libs" = yes &&
2591 test -n "$library_names"; }; }; then
2592 # We only need to search for static libraries
2597 link_static
=no
# Whether the deplib will be linked statically
2598 use_static_libs
=$prefer_static_libs
2599 if test "$use_static_libs" = built
&& test "$installed" = yes ; then
2602 if test -n "$library_names" &&
2603 { test "$use_static_libs" = no ||
test -z "$old_library"; }; then
2604 if test "$installed" = no
; then
2605 notinst_deplibs
="$notinst_deplibs $lib"
2608 # This is a shared library
2610 # Warn about portability, can't link against -module's on
2611 # some systems (darwin)
2612 if test "$shouldnotlink" = yes && test "$pass" = link
; then
2614 if test "$linkmode" = prog
; then
2615 $echo "*** Warning: Linking the executable $output against the loadable module"
2617 $echo "*** Warning: Linking the shared library $output against the loadable module"
2619 $echo "*** $linklib is not portable!"
2621 if test "$linkmode" = lib
&&
2622 test "$hardcode_into_libs" = yes; then
2623 # Hardcode the library path.
2624 # Skip directories that are in the system default run-time
2626 case " $sys_lib_dlsearch_path " in
2629 case "$compile_rpath " in
2631 *) compile_rpath
="$compile_rpath $absdir"
2635 case " $sys_lib_dlsearch_path " in
2638 case "$finalize_rpath " in
2640 *) finalize_rpath
="$finalize_rpath $libdir"
2646 if test -n "$old_archive_from_expsyms_cmds"; then
2647 # figure out the soname
2648 set dummy
$library_names
2651 libname
=`eval \\$echo \"$libname_spec\"`
2652 # use dlname if we got it. it's perfectly good, no?
2653 if test -n "$dlname"; then
2655 elif test -n "$soname_spec"; then
2659 major
=`expr $current - $age`
2663 eval soname
=\"$soname_spec\"
2668 # Make a new name for the extract_expsyms_cmds to use
2670 soname
=`$echo $soroot | ${SED} -e 's/^.*\///'`
2671 newlib
="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2673 # If the library has no export list, then create one now
2674 if test -f "$output_objdir/$soname-def"; then :
2676 $show "extracting exported symbol list from \`$soname'"
2677 save_ifs
="$IFS"; IFS
='~'
2678 cmds
=$extract_expsyms_cmds
2679 for cmd
in $cmds; do
2683 $run eval "$cmd" ||
exit $?
2689 if test -f "$output_objdir/$newlib"; then :; else
2690 $show "generating import library for \`$soname'"
2691 save_ifs
="$IFS"; IFS
='~'
2692 cmds
=$old_archive_from_expsyms_cmds
2693 for cmd
in $cmds; do
2697 $run eval "$cmd" ||
exit $?
2701 # make sure the library variables are pointing to the new library
2704 fi # test -n "$old_archive_from_expsyms_cmds"
2706 if test "$linkmode" = prog ||
test "$mode" != relink
; then
2711 case $hardcode_action in
2712 immediate | unsupported
)
2713 if test "$hardcode_direct" = no
; then
2716 *-*-sco3.2v5.0.
[024]*) add_dir
="-L$dir" ;;
2717 *-*-sysv4*uw2
*) add_dir
="-L$dir" ;;
2718 *-*-sysv5OpenUNIX* |
*-*-sysv5UnixWare7.
[01].
[10]* | \
2719 *-*-unixware7*) add_dir
="-L$dir" ;;
2721 # if the lib is a module then we can not link against
2722 # it, someone is ignoring the new warnings I added
2723 if /usr
/bin
/file -L $add 2> /dev
/null |
2724 $EGREP ": [^:]* bundle" >/dev
/null
; then
2725 $echo "** Warning, lib $linklib is a module, not a shared library"
2726 if test -z "$old_library" ; then
2728 $echo "** And there doesn't seem to be a static archive available"
2729 $echo "** The link will probably fail, sorry"
2731 add
="$dir/$old_library"
2735 elif test "$hardcode_minus_L" = no
; then
2737 *-*-sunos*) add_shlibpath
="$dir" ;;
2741 elif test "$hardcode_shlibpath_var" = no
; then
2742 add_shlibpath
="$dir"
2749 if test "$hardcode_direct" = yes; then
2751 elif test "$hardcode_minus_L" = yes; then
2753 # Try looking first in the location we're being installed to.
2754 if test -n "$inst_prefix_dir"; then
2757 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2762 elif test "$hardcode_shlibpath_var" = yes; then
2763 add_shlibpath
="$dir"
2772 if test "$lib_linked" != yes; then
2773 $echo "$modename: configuration error: unsupported hardcode properties"
2777 if test -n "$add_shlibpath"; then
2778 case :$compile_shlibpath: in
2779 *":$add_shlibpath:"*) ;;
2780 *) compile_shlibpath
="$compile_shlibpath$add_shlibpath:" ;;
2783 if test "$linkmode" = prog
; then
2784 test -n "$add_dir" && compile_deplibs
="$add_dir $compile_deplibs"
2785 test -n "$add" && compile_deplibs
="$add $compile_deplibs"
2787 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2788 test -n "$add" && deplibs
="$add $deplibs"
2789 if test "$hardcode_direct" != yes && \
2790 test "$hardcode_minus_L" != yes && \
2791 test "$hardcode_shlibpath_var" = yes; then
2792 case :$finalize_shlibpath: in
2794 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2800 if test "$linkmode" = prog ||
test "$mode" = relink
; then
2804 # Finalize command for both is simple: just hardcode it.
2805 if test "$hardcode_direct" = yes; then
2806 add
="$libdir/$linklib"
2807 elif test "$hardcode_minus_L" = yes; then
2810 elif test "$hardcode_shlibpath_var" = yes; then
2811 case :$finalize_shlibpath: in
2813 *) finalize_shlibpath
="$finalize_shlibpath$libdir:" ;;
2816 elif test "$hardcode_automatic" = yes; then
2817 if test -n "$inst_prefix_dir" &&
2818 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2819 add
="$inst_prefix_dir$libdir/$linklib"
2821 add
="$libdir/$linklib"
2824 # We cannot seem to hardcode it, guess we'll fake it.
2826 # Try looking first in the location we're being installed to.
2827 if test -n "$inst_prefix_dir"; then
2830 add_dir
="$add_dir -L$inst_prefix_dir$libdir"
2837 if test "$linkmode" = prog
; then
2838 test -n "$add_dir" && finalize_deplibs
="$add_dir $finalize_deplibs"
2839 test -n "$add" && finalize_deplibs
="$add $finalize_deplibs"
2841 test -n "$add_dir" && deplibs
="$add_dir $deplibs"
2842 test -n "$add" && deplibs
="$add $deplibs"
2845 elif test "$linkmode" = prog
; then
2846 # Here we assume that one of hardcode_direct or hardcode_minus_L
2847 # is not unsupported. This is valid on all known static and
2849 if test "$hardcode_direct" != unsupported
; then
2850 test -n "$old_library" && linklib
="$old_library"
2851 compile_deplibs
="$dir/$linklib $compile_deplibs"
2852 finalize_deplibs
="$dir/$linklib $finalize_deplibs"
2854 compile_deplibs
="-l$name -L$dir $compile_deplibs"
2855 finalize_deplibs
="-l$name -L$dir $finalize_deplibs"
2857 elif test "$build_libtool_libs" = yes; then
2858 # Not a shared library
2859 if test "$deplibs_check_method" != pass_all
; then
2860 # We're trying link a shared library against a static one
2861 # but the system doesn't support it.
2863 # Just print a warning and add the library to dependency_libs so
2864 # that the program can be linked against the static library.
2866 $echo "*** Warning: This system can not link to static lib archive $lib."
2867 $echo "*** I have the capability to make that library automatically link in when"
2868 $echo "*** you link to this library. But I can only do this if you have a"
2869 $echo "*** shared version of the library, which you do not appear to have."
2870 if test "$module" = yes; then
2871 $echo "*** But as you try to build a module library, libtool will still create "
2872 $echo "*** a static module, that should work as long as the dlopening application"
2873 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2874 if test -z "$global_symbol_pipe"; then
2876 $echo "*** However, this would only work if libtool was able to extract symbol"
2877 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2878 $echo "*** not find such a program. So, this module is probably useless."
2879 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2881 if test "$build_old_libs" = no
; then
2882 build_libtool_libs
=module
2885 build_libtool_libs
=no
2889 deplibs
="$dir/$old_library $deplibs"
2892 fi # link shared/static library?
2894 if test "$linkmode" = lib
; then
2895 if test -n "$dependency_libs" &&
2896 { test "$hardcode_into_libs" != yes ||
2897 test "$build_old_libs" = yes ||
2898 test "$link_static" = yes; }; then
2899 # Extract -R from dependency_libs
2901 for libdir
in $dependency_libs; do
2903 -R*) temp_xrpath
=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2905 *" $temp_xrpath "*) ;;
2906 *) xrpath
="$xrpath $temp_xrpath";;
2908 *) temp_deplibs
="$temp_deplibs $libdir";;
2911 dependency_libs
="$temp_deplibs"
2914 newlib_search_path
="$newlib_search_path $absdir"
2915 # Link against this library
2916 test "$link_static" = no
&& newdependency_libs
="$abs_ladir/$laname $newdependency_libs"
2917 # ... and its dependency_libs
2919 for deplib
in $dependency_libs; do
2920 newdependency_libs
="$deplib $newdependency_libs"
2921 if test "X$duplicate_deps" = "Xyes" ; then
2922 case "$tmp_libs " in
2923 *" $deplib "*) specialdeplibs
="$specialdeplibs $deplib" ;;
2926 tmp_libs
="$tmp_libs $deplib"
2929 if test "$link_all_deplibs" != no
; then
2930 # Add the search paths of all dependency libraries
2931 for deplib
in $dependency_libs; do
2933 -L*) path
="$deplib" ;;
2935 dir
=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2936 test "X$dir" = "X$deplib" && dir
="."
2937 # We need an absolute path.
2939 [\\/]* |
[A-Za-z
]:[\\/]*) absdir
="$dir" ;;
2941 absdir
=`cd "$dir" && pwd`
2942 if test -z "$absdir"; then
2943 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2948 if grep "^installed=no" $deplib > /dev
/null
; then
2949 path
="$absdir/$objdir"
2951 eval libdir
=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2952 if test -z "$libdir"; then
2953 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2956 if test "$absdir" != "$libdir"; then
2957 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2964 # we do not want to link against static libs,
2965 # but need to link against shared
2966 eval deplibrary_names
=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2967 eval deplibdir
=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2968 if test -n "$deplibrary_names" ; then
2969 for tmp
in $deplibrary_names ; do
2972 if test -f "$deplibdir/$depdepl" ; then
2973 depdepl
="$deplibdir/$depdepl"
2974 elif test -f "$path/$depdepl" ; then
2975 depdepl
="$path/$depdepl"
2977 # Can't find it, oh well...
2980 # do not add paths which are already there
2981 case " $newlib_search_path " in
2983 *) newlib_search_path
="$newlib_search_path $path";;
2996 # Again, we only want to link against shared libraries
2997 eval tmp_libs
=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2998 for tmp
in $newlib_search_path ; do
2999 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3000 eval depdepl
="$tmp/lib$tmp_libs.dylib"
3011 case " $deplibs " in
3013 *) deplibs
="$path $deplibs" ;;
3015 case " $deplibs " in
3017 *) deplibs
="$depdepl $deplibs" ;;
3020 fi # link_all_deplibs != no
3022 done # for deplib in $libs
3023 dependency_libs
="$newdependency_libs"
3024 if test "$pass" = dlpreopen
; then
3025 # Link the dlpreopened libraries before other libraries
3026 for deplib
in $save_deplibs; do
3027 deplibs
="$deplib $deplibs"
3030 if test "$pass" != dlopen
; then
3031 if test "$pass" != conv
; then
3032 # Make sure lib_search_path contains only unique directories.
3034 for dir
in $newlib_search_path; do
3035 case "$lib_search_path " in
3037 *) lib_search_path
="$lib_search_path $dir" ;;
3043 if test "$linkmode,$pass" != "prog,link"; then
3046 vars
="compile_deplibs finalize_deplibs"
3048 for var
in $vars dependency_libs
; do
3049 # Add libraries to $var in reverse order
3050 eval tmp_libs
=\"\$
$var\"
3052 for deplib
in $tmp_libs; do
3053 # FIXME: Pedantically, this is the right thing to do, so
3054 # that some nasty dependency loop isn't accidentally
3056 #new_libs="$deplib $new_libs"
3057 # Pragmatically, this seems to cause very few problems in
3060 -L*) new_libs
="$deplib $new_libs" ;;
3063 # And here is the reason: when a library appears more
3064 # than once as an explicit dependence of a library, or
3065 # is implicitly linked in more than once by the
3066 # compiler, it is considered special, and multiple
3067 # occurrences thereof are not removed. Compare this
3068 # with having the same library being listed as a
3069 # dependency of multiple other libraries: in this case,
3070 # we know (pedantically, we assume) the library does not
3071 # need to be listed more than once, so we keep only the
3072 # last copy. This is not always right, but it is rare
3073 # enough that we require users that really mean to play
3074 # such unportable linking tricks to link the library
3075 # using -Wl,-lname, so that libtool does not consider it
3076 # for duplicate removal.
3077 case " $specialdeplibs " in
3078 *" $deplib "*) new_libs
="$deplib $new_libs" ;;
3080 case " $new_libs " in
3082 *) new_libs
="$deplib $new_libs" ;;
3090 for deplib
in $new_libs; do
3093 case " $tmp_libs " in
3095 *) tmp_libs
="$tmp_libs $deplib" ;;
3098 *) tmp_libs
="$tmp_libs $deplib" ;;
3101 eval $var=\"$tmp_libs\"
3104 # Last step: remove runtime libs from dependency_libs
3105 # (they stay in deplibs)
3107 for i
in $dependency_libs ; do
3108 case " $predeps $postdeps $compiler_lib_search_path " in
3113 if test -n "$i" ; then
3114 tmp_libs
="$tmp_libs $i"
3117 dependency_libs
=$tmp_libs
3119 if test "$linkmode" = prog
; then
3120 dlfiles
="$newdlfiles"
3121 dlprefiles
="$newdlprefiles"
3128 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3131 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
3132 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3135 if test -n "$rpath"; then
3136 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3139 if test -n "$xrpath"; then
3140 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3143 if test -n "$vinfo"; then
3144 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3147 if test -n "$release"; then
3148 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3151 if test -n "$export_symbols" ||
test -n "$export_symbols_regex"; then
3152 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3155 # Now set the variables for building old libraries.
3156 build_libtool_libs
=no
3158 objs
="$objs$old_deplibs"
3162 # Make sure we only generate libraries of the form `libNAME.la'.
3165 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3166 eval shared_ext
=\"$shrext_cmds\"
3167 eval libname
=\"$libname_spec\"
3170 if test "$module" = no
; then
3171 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3175 if test "$need_lib_prefix" != no
; then
3176 # Add the "lib" prefix for modules if required
3177 name
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3178 eval shared_ext
=\"$shrext_cmds\"
3179 eval libname
=\"$libname_spec\"
3181 libname
=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3186 if test -n "$objs"; then
3187 if test "$deplibs_check_method" != pass_all
; then
3188 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3192 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3193 $echo "*** objects $objs is not portable!"
3194 libobjs
="$libobjs $objs"
3198 if test "$dlself" != no
; then
3199 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3203 if test "$#" -gt 2; then
3204 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3209 if test -z "$rpath"; then
3210 if test "$build_libtool_libs" = yes; then
3211 # Building a libtool convenience library.
3212 # Some compilers have problems with a `.al' extension so
3213 # convenience libraries should have the same extension an
3214 # archive normally would.
3215 oldlibs
="$output_objdir/$libname.$libext $oldlibs"
3216 build_libtool_libs
=convenience
3220 if test -n "$vinfo"; then
3221 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3224 if test -n "$release"; then
3225 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3229 # Parse the version information argument.
3230 save_ifs
="$IFS"; IFS
=':'
3231 set dummy
$vinfo 0 0 0
3234 if test -n "$8"; then
3235 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3240 # convert absolute version numbers to libtool ages
3241 # this retains compatibility with .la files and attempts
3242 # to make the code below a bit more comprehensible
3244 case $vinfo_number in
3248 number_revision
="$4"
3250 # There are really only two kinds -- those that
3251 # use the current revision as the major version
3252 # and those that subtract age and use age as
3253 # a minor version. But, then there is irix
3254 # which has an extra 1 added just for fun
3256 case $version_type in
3257 darwin|linux|osf|windows|none
)
3258 current
=`expr $number_major + $number_minor`
3260 revision
="$number_revision"
3262 freebsd-aout|freebsd-elf|sunos
)
3263 current
="$number_major"
3264 revision
="$number_minor"
3268 current
=`expr $number_major + $number_minor`
3270 revision
="$number_minor"
3271 lt_irix_increment
=no
3282 # Check that each of the things are valid numbers.
3284 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]) ;;
3286 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3293 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]) ;;
3295 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3296 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3302 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]) ;;
3304 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3305 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3310 if test "$age" -gt "$current"; then
3311 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3312 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3316 # Calculate the version variables.
3320 case $version_type in
3324 # Like Linux, but with the current version available in
3325 # verstring for coding it into the library header
3326 major
=.
`expr $current - $age`
3327 versuffix
="$major.$age.$revision"
3328 # Darwin ld doesn't like 0 for these options...
3329 minor_current
=`expr $current + 1`
3330 xlcverstring
="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3331 verstring
="-compatibility_version $minor_current -current_version $minor_current.$revision"
3336 versuffix
=".$current.$revision";
3341 versuffix
=".$current";
3345 if test "X$lt_irix_increment" = "Xno"; then
3346 major
=`expr $current - $age`
3348 major
=`expr $current - $age + 1`
3350 case $version_type in
3351 nonstopux
) verstring_prefix
=nonstopux
;;
3352 *) verstring_prefix
=sgi
;;
3354 verstring
="$verstring_prefix$major.$revision"
3356 # Add in all the interfaces that we are compatible with.
3358 while test "$loop" -ne 0; do
3359 iface
=`expr $revision - $loop`
3360 loop
=`expr $loop - 1`
3361 verstring
="$verstring_prefix$major.$iface:$verstring"
3364 # Before this point, $major must not contain `.'.
3366 versuffix
="$major.$revision"
3370 major
=.
`expr $current - $age`
3371 versuffix
="$major.$age.$revision"
3375 major
=.
`expr $current - $age`
3376 versuffix
=".$current.$age.$revision"
3377 verstring
="$current.$age.$revision"
3379 # Add in all the interfaces that we are compatible with.
3381 while test "$loop" -ne 0; do
3382 iface
=`expr $current - $loop`
3383 loop
=`expr $loop - 1`
3384 verstring
="$verstring:${iface}.0"
3387 # Make executables depend on our current version.
3388 verstring
="$verstring:${current}.0"
3393 versuffix
=".$current.$revision"
3397 # Use '-' rather than '.', since we only want one
3398 # extension on DOS 8.3 filesystems.
3399 major
=`expr $current - $age`
3404 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3405 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3410 # Clear the version info if we defaulted, and they specified a release.
3411 if test -z "$vinfo" && test -n "$release"; then
3413 case $version_type in
3415 # we can't check for "0.0" in archive_cmds due to quoting
3416 # problems, so we reset it completely
3423 if test "$need_version" = no
; then
3430 # Remove version info from name if versioning should be avoided
3431 if test "$avoid_version" = yes && test "$need_version" = no
; then
3437 # Check to see if the archive will have undefined symbols.
3438 if test "$allow_undefined" = yes; then
3439 if test "$allow_undefined_flag" = unsupported
; then
3440 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3441 build_libtool_libs
=no
3445 # Don't allow undefined symbols.
3446 allow_undefined_flag
="$no_undefined_flag"
3450 if test "$mode" != relink
; then
3451 # Remove our outputs, but don't remove object files since they
3452 # may have been created when compiling PIC objects.
3454 tempremovelist
=`$echo "$output_objdir/*"`
3455 for p
in $tempremovelist; do
3459 $output_objdir/$outputname |
$output_objdir/$libname.
* |
$output_objdir/${libname}${release}.
*)
3460 if test "X$precious_files_regex" != "X"; then
3461 if echo $p |
$EGREP -e "$precious_files_regex" >/dev
/null
2>&1
3466 removelist
="$removelist $p"
3471 if test -n "$removelist"; then
3472 $show "${rm}r $removelist"
3473 $run ${rm}r
$removelist
3477 # Now set the variables for building old libraries.
3478 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience
; then
3479 oldlibs
="$oldlibs $output_objdir/$libname.$libext"
3481 # Transform .lo files to .o files.
3482 oldobjs
="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3485 # Eliminate all temporary directories.
3486 #for path in $notinst_path; do
3487 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3488 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3489 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3492 if test -n "$xrpath"; then
3493 # If the user specified any rpath flags, then add them.
3495 for libdir
in $xrpath; do
3496 temp_xrpath
="$temp_xrpath -R$libdir"
3497 case "$finalize_rpath " in
3499 *) finalize_rpath
="$finalize_rpath $libdir" ;;
3502 if test "$hardcode_into_libs" != yes ||
test "$build_old_libs" = yes; then
3503 dependency_libs
="$temp_xrpath $dependency_libs"
3507 # Make sure dlfiles contains only unique files that won't be dlpreopened
3508 old_dlfiles
="$dlfiles"
3510 for lib
in $old_dlfiles; do
3511 case " $dlprefiles $dlfiles " in
3513 *) dlfiles
="$dlfiles $lib" ;;
3517 # Make sure dlprefiles contains only unique files
3518 old_dlprefiles
="$dlprefiles"
3520 for lib
in $old_dlprefiles; do
3521 case "$dlprefiles " in
3523 *) dlprefiles
="$dlprefiles $lib" ;;
3527 if test "$build_libtool_libs" = yes; then
3528 if test -n "$rpath"; then
3530 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2* |
*-*-beos*)
3531 # these systems don't actually have a c library (as such)!
3533 *-*-rhapsody* |
*-*-darwin1.
[012])
3534 # Rhapsody C library is in the System framework
3535 deplibs
="$deplibs -framework System"
3538 # Don't link with libc until the a.out ld.so is fixed.
3540 *-*-openbsd* |
*-*-freebsd* |
*-*-dragonfly*)
3541 # Do not include libc due to us having libc/libc_r.
3543 *-*-sco3.2v5
* |
*-*-sco5v6*)
3544 # Causes problems with __ctype
3546 *-*-sysv4.2uw2
* |
*-*-sysv5* |
*-*-unixware* |
*-*-OpenUNIX*)
3547 # Compiler inserts libc in the correct place for threads to work
3550 # Add libc to deplibs on all other systems if necessary.
3551 if test "$build_libtool_need_lc" = "yes"; then
3552 deplibs
="$deplibs -lc"
3558 # Transform deplibs into only deplibs that can be linked in shared.
3560 libname_save
=$libname
3561 release_save
=$release
3562 versuffix_save
=$versuffix
3564 # I'm not sure if I'm treating the release correctly. I think
3565 # release should show up in the -l (ie -lgmp5) so we don't want to
3566 # add it in twice. Is that correct?
3572 case $deplibs_check_method in
3574 # Don't check for shared/static. Everything works.
3575 # This might be a little naive. We might want to check
3576 # whether the library exists or not. But this is on
3577 # osf3 & osf4 and I'm not really sure... Just
3578 # implementing what was already the behavior.
3582 # This code stresses the "libraries are programs" paradigm to its
3583 # limits. Maybe even breaks it. We compile a program, linking it
3584 # against the deplibs as a proxy for the library. Then we can check
3585 # whether they linked in statically or dynamically with ldd.
3587 cat > conftest.c
<<EOF
3588 int main() { return 0; }
3591 if $LTCC $LTCFLAGS -o conftest conftest.c
$deplibs; then
3592 ldd_output
=`ldd conftest`
3593 for i
in $deplibs; do
3594 name
=`expr $i : '-l\(.*\)'`
3595 # If $name is empty we are operating on a -L argument.
3596 if test "$name" != "" && test "$name" != "0"; then
3597 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3598 case " $predeps $postdeps " in
3600 newdeplibs
="$newdeplibs $i"
3605 if test -n "$i" ; then
3606 libname
=`eval \\$echo \"$libname_spec\"`
3607 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3608 set dummy
$deplib_matches
3610 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3611 newdeplibs
="$newdeplibs $i"
3615 $echo "*** Warning: dynamic linker does not accept needed library $i."
3616 $echo "*** I have the capability to make that library automatically link in when"
3617 $echo "*** you link to this library. But I can only do this if you have a"
3618 $echo "*** shared version of the library, which I believe you do not have"
3619 $echo "*** because a test_compile did reveal that the linker did not use it for"
3620 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3624 newdeplibs
="$newdeplibs $i"
3628 # Error occurred in the first compile. Let's try to salvage
3629 # the situation: Compile a separate program for each library.
3630 for i
in $deplibs; do
3631 name
=`expr $i : '-l\(.*\)'`
3632 # If $name is empty we are operating on a -L argument.
3633 if test "$name" != "" && test "$name" != "0"; then
3635 if $LTCC $LTCFLAGS -o conftest conftest.c
$i; then
3636 ldd_output
=`ldd conftest`
3637 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3638 case " $predeps $postdeps " in
3640 newdeplibs
="$newdeplibs $i"
3645 if test -n "$i" ; then
3646 libname
=`eval \\$echo \"$libname_spec\"`
3647 deplib_matches
=`eval \\$echo \"$library_names_spec\"`
3648 set dummy
$deplib_matches
3650 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3651 newdeplibs
="$newdeplibs $i"
3655 $echo "*** Warning: dynamic linker does not accept needed library $i."
3656 $echo "*** I have the capability to make that library automatically link in when"
3657 $echo "*** you link to this library. But I can only do this if you have a"
3658 $echo "*** shared version of the library, which you do not appear to have"
3659 $echo "*** because a test_compile did reveal that the linker did not use this one"
3660 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3666 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3667 $echo "*** make it link in! You will probably need to install it or some"
3668 $echo "*** library that it depends on before this library will be fully"
3669 $echo "*** functional. Installing it before continuing would be even better."
3672 newdeplibs
="$newdeplibs $i"
3678 set dummy
$deplibs_check_method
3679 file_magic_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3680 for a_deplib
in $deplibs; do
3681 name
=`expr $a_deplib : '-l\(.*\)'`
3682 # If $name is empty we are operating on a -L argument.
3683 if test "$name" != "" && test "$name" != "0"; then
3684 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3685 case " $predeps $postdeps " in
3687 newdeplibs
="$newdeplibs $a_deplib"
3692 if test -n "$a_deplib" ; then
3693 libname
=`eval \\$echo \"$libname_spec\"`
3694 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3695 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3696 for potent_lib
in $potential_libs; do
3697 # Follow soft links.
3698 if ls -lLd "$potent_lib" 2>/dev
/null \
3699 |
grep " -> " >/dev
/null
; then
3702 # The statement above tries to avoid entering an
3703 # endless loop below, in case of cyclic links.
3704 # We might still enter an endless loop, since a link
3705 # loop can be closed while we follow links,
3707 potlib
="$potent_lib"
3708 while test -h "$potlib" 2>/dev
/null
; do
3709 potliblink
=`ls -ld $potlib | ${SED} 's/.* -> //'`
3711 [\\/]* |
[A-Za-z
]:[\\/]*) potlib
="$potliblink";;
3712 *) potlib
=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3715 if eval $file_magic_cmd \"\
$potlib\" 2>/dev
/null \
3717 |
$EGREP "$file_magic_regex" > /dev
/null
; then
3718 newdeplibs
="$newdeplibs $a_deplib"
3725 if test -n "$a_deplib" ; then
3728 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3729 $echo "*** I have the capability to make that library automatically link in when"
3730 $echo "*** you link to this library. But I can only do this if you have a"
3731 $echo "*** shared version of the library, which you do not appear to have"
3732 $echo "*** because I did check the linker path looking for a file starting"
3733 if test -z "$potlib" ; then
3734 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3736 $echo "*** with $libname and none of the candidates passed a file format test"
3737 $echo "*** using a file magic. Last file checked: $potlib"
3741 # Add a -L argument.
3742 newdeplibs
="$newdeplibs $a_deplib"
3744 done # Gone through all deplibs.
3747 set dummy
$deplibs_check_method
3748 match_pattern_regex
=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3749 for a_deplib
in $deplibs; do
3750 name
=`expr $a_deplib : '-l\(.*\)'`
3751 # If $name is empty we are operating on a -L argument.
3752 if test -n "$name" && test "$name" != "0"; then
3753 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3754 case " $predeps $postdeps " in
3756 newdeplibs
="$newdeplibs $a_deplib"
3761 if test -n "$a_deplib" ; then
3762 libname
=`eval \\$echo \"$libname_spec\"`
3763 for i
in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3764 potential_libs
=`ls $i/$libname[.-]* 2>/dev/null`
3765 for potent_lib
in $potential_libs; do
3766 potlib
="$potent_lib" # see symlink-check above in file_magic test
3767 if eval $echo \"$potent_lib\" 2>/dev
/null \
3769 |
$EGREP "$match_pattern_regex" > /dev
/null
; then
3770 newdeplibs
="$newdeplibs $a_deplib"
3777 if test -n "$a_deplib" ; then
3780 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3781 $echo "*** I have the capability to make that library automatically link in when"
3782 $echo "*** you link to this library. But I can only do this if you have a"
3783 $echo "*** shared version of the library, which you do not appear to have"
3784 $echo "*** because I did check the linker path looking for a file starting"
3785 if test -z "$potlib" ; then
3786 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3788 $echo "*** with $libname and none of the candidates passed a file format test"
3789 $echo "*** using a regex pattern. Last file checked: $potlib"
3793 # Add a -L argument.
3794 newdeplibs
="$newdeplibs $a_deplib"
3796 done # Gone through all deplibs.
3800 tmp_deplibs
=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3801 -e 's/ -[LR][^ ]*//g'`
3802 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3803 for i
in $predeps $postdeps ; do
3804 # can't use Xsed below, because $i might contain '/'
3805 tmp_deplibs
=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3808 if $echo "X $tmp_deplibs" |
$Xsed -e 's/[ ]//g' \
3809 |
grep .
>/dev
/null
; then
3811 if test "X$deplibs_check_method" = "Xnone"; then
3812 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3814 $echo "*** Warning: inter-library dependencies are not known to be supported."
3816 $echo "*** All declared inter-library dependencies are being dropped."
3821 versuffix
=$versuffix_save
3823 release
=$release_save
3824 libname
=$libname_save
3828 *-*-rhapsody* |
*-*-darwin1.
[012])
3829 # On Rhapsody replace the C library is the System framework
3830 newdeplibs
=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3834 if test "$droppeddeps" = yes; then
3835 if test "$module" = yes; then
3837 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3838 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3839 $echo "*** a static module, that should work as long as the dlopening"
3840 $echo "*** application is linked with the -dlopen flag."
3841 if test -z "$global_symbol_pipe"; then
3843 $echo "*** However, this would only work if libtool was able to extract symbol"
3844 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3845 $echo "*** not find such a program. So, this module is probably useless."
3846 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3848 if test "$build_old_libs" = no
; then
3849 oldlibs
="$output_objdir/$libname.$libext"
3850 build_libtool_libs
=module
3853 build_libtool_libs
=no
3856 $echo "*** The inter-library dependencies that have been dropped here will be"
3857 $echo "*** automatically added whenever a program is linked with this library"
3858 $echo "*** or is declared to -dlopen it."
3860 if test "$allow_undefined" = no
; then
3862 $echo "*** Since this library must not contain undefined symbols,"
3863 $echo "*** because either the platform does not support them or"
3864 $echo "*** it was explicitly requested with -no-undefined,"
3865 $echo "*** libtool will only create a static version of it."
3866 if test "$build_old_libs" = no
; then
3867 oldlibs
="$output_objdir/$libname.$libext"
3868 build_libtool_libs
=module
3871 build_libtool_libs
=no
3876 # Done checking deplibs!
3881 # move library search paths that coincide with paths to not yet
3882 # installed libraries to the beginning of the library search list
3884 for path
in $notinst_path; do
3885 case " $new_libs " in
3886 *" -L$path/$objdir "*) ;;
3888 case " $deplibs " in
3889 *" -L$path/$objdir "*)
3890 new_libs
="$new_libs -L$path/$objdir" ;;
3895 for deplib
in $deplibs; do
3898 case " $new_libs " in
3900 *) new_libs
="$new_libs $deplib" ;;
3903 *) new_libs
="$new_libs $deplib" ;;
3909 # All the library-specific variables (install_libdir is set above).
3914 # Test again, we may have decided not to build it any more
3915 if test "$build_libtool_libs" = yes; then
3916 if test "$hardcode_into_libs" = yes; then
3917 # Hardcode the library paths
3920 rpath
="$finalize_rpath"
3921 test "$mode" != relink
&& rpath
="$compile_rpath$rpath"
3922 for libdir
in $rpath; do
3923 if test -n "$hardcode_libdir_flag_spec"; then
3924 if test -n "$hardcode_libdir_separator"; then
3925 if test -z "$hardcode_libdirs"; then
3926 hardcode_libdirs
="$libdir"
3928 # Just accumulate the unique libdirs.
3929 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3930 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3933 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3938 eval flag
=\"$hardcode_libdir_flag_spec\"
3939 dep_rpath
="$dep_rpath $flag"
3941 elif test -n "$runpath_var"; then
3942 case "$perm_rpath " in
3944 *) perm_rpath
="$perm_rpath $libdir" ;;
3948 # Substitute the hardcoded libdirs into the rpath.
3949 if test -n "$hardcode_libdir_separator" &&
3950 test -n "$hardcode_libdirs"; then
3951 libdir
="$hardcode_libdirs"
3952 if test -n "$hardcode_libdir_flag_spec_ld"; then
3953 case $archive_cmds in
3954 *\
$LD*) eval dep_rpath
=\"$hardcode_libdir_flag_spec_ld\" ;;
3955 *) eval dep_rpath
=\"$hardcode_libdir_flag_spec\" ;;
3958 eval dep_rpath
=\"$hardcode_libdir_flag_spec\"
3961 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3962 # We should set the runpath_var.
3964 for dir
in $perm_rpath; do
3967 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3969 test -n "$dep_rpath" && deplibs
="$dep_rpath $deplibs"
3972 shlibpath
="$finalize_shlibpath"
3973 test "$mode" != relink
&& shlibpath
="$compile_shlibpath$shlibpath"
3974 if test -n "$shlibpath"; then
3975 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3978 # Get the real and link names of the library.
3979 eval shared_ext
=\"$shrext_cmds\"
3980 eval library_names
=\"$library_names_spec\"
3981 set dummy
$library_names
3985 if test -n "$soname_spec"; then
3986 eval soname
=\"$soname_spec\"
3990 if test -z "$dlname"; then
3994 lib
="$output_objdir/$realname"
3998 linknames
="$linknames $link"
4001 # Use standard objects if they are pic
4002 test -z "$pic_flag" && libobjs
=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4004 # Prepare the list of exported symbols
4005 if test -z "$export_symbols"; then
4006 if test "$always_export_symbols" = yes ||
test -n "$export_symbols_regex"; then
4007 $show "generating symbol list for \`$libname.la'"
4008 export_symbols
="$output_objdir/$libname.exp"
4009 $run $rm $export_symbols
4010 cmds
=$export_symbols_cmds
4011 save_ifs
="$IFS"; IFS
='~'
4012 for cmd
in $cmds; do
4015 if len
=`expr "X$cmd" : ".*"` &&
4016 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
4018 $run eval "$cmd" ||
exit $?
4019 skipped_export
=false
4021 # The command line is too long to execute in one step.
4022 $show "using reloadable object file for export list..."
4024 # Break out early, otherwise skipped_export may be
4025 # set to false by a later but shorter cmd.
4030 if test -n "$export_symbols_regex"; then
4031 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4032 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4033 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4034 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4039 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4040 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4044 for test_deplib
in $deplibs; do
4045 case " $convenience " in
4046 *" $test_deplib "*) ;;
4048 tmp_deplibs
="$tmp_deplibs $test_deplib"
4052 deplibs
="$tmp_deplibs"
4054 if test -n "$convenience"; then
4055 if test -n "$whole_archive_flag_spec"; then
4056 save_libobjs
=$libobjs
4057 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4059 gentop
="$output_objdir/${outputname}x"
4060 generated
="$generated $gentop"
4062 func_extract_archives
$gentop $convenience
4063 libobjs
="$libobjs $func_extract_archives_result"
4067 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4068 eval flag
=\"$thread_safe_flag_spec\"
4069 linker_flags
="$linker_flags $flag"
4072 # Make a backup of the uninstalled library when relinking
4073 if test "$mode" = relink
; then
4074 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' ||
exit $?
4077 # Do each of the archive commands.
4078 if test "$module" = yes && test -n "$module_cmds" ; then
4079 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4080 eval test_cmds
=\"$module_expsym_cmds\"
4081 cmds
=$module_expsym_cmds
4083 eval test_cmds
=\"$module_cmds\"
4087 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4088 eval test_cmds
=\"$archive_expsym_cmds\"
4089 cmds
=$archive_expsym_cmds
4091 eval test_cmds
=\"$archive_cmds\"
4096 if test "X$skipped_export" != "X:" &&
4097 len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4098 test "$len" -le "$max_cmd_len" ||
test "$max_cmd_len" -le -1; then
4101 # The command line is too long to link in one step, link piecewise.
4102 $echo "creating reloadable object files..."
4104 # Save the value of $output and $libobjs because we want to
4105 # use them later. If we have whole_archive_flag_spec, we
4106 # want to use save_libobjs as it was before
4107 # whole_archive_flag_spec was expanded, because we can't
4108 # assume the linker understands whole_archive_flag_spec.
4109 # This may have to be revisited, in case too many
4110 # convenience libraries get linked in and end up exceeding
4112 if test -z "$convenience" ||
test -z "$whole_archive_flag_spec"; then
4113 save_libobjs
=$libobjs
4116 output_la
=`$echo "X$output" | $Xsed -e "$basename"`
4118 # Clear the reloadable object creation command queue and
4119 # initialize k to one.
4126 output
=$output_objdir/$output_la-${k}.
$objext
4127 # Loop over the list of objects to be linked.
4128 for obj
in $save_libobjs
4130 eval test_cmds
=\"$reload_cmds $objlist $last_robj\"
4131 if test "X$objlist" = X ||
4132 { len
=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4133 test "$len" -le "$max_cmd_len"; }; then
4134 objlist
="$objlist $obj"
4136 # The command $test_cmds is almost too long, add a
4137 # command to the queue.
4138 if test "$k" -eq 1 ; then
4139 # The first file doesn't have a previous command to add.
4140 eval concat_cmds
=\"$reload_cmds $objlist $last_robj\"
4142 # All subsequent reloadable object files will link in
4143 # the last one created.
4144 eval concat_cmds
=\"\
$concat_cmds~
$reload_cmds $objlist $last_robj\"
4146 last_robj
=$output_objdir/$output_la-${k}.
$objext
4148 output
=$output_objdir/$output_la-${k}.
$objext
4153 # Handle the remaining objects by creating one last
4154 # reloadable object file. All subsequent reloadable object
4155 # files will link in the last one created.
4156 test -z "$concat_cmds" || concat_cmds
=$concat_cmds~
4157 eval concat_cmds
=\"\
${concat_cmds}$reload_cmds $objlist $last_robj\"
4159 if ${skipped_export-false}; then
4160 $show "generating symbol list for \`$libname.la'"
4161 export_symbols
="$output_objdir/$libname.exp"
4162 $run $rm $export_symbols
4164 # Append the command to create the export file.
4165 eval concat_cmds
=\"\
$concat_cmds~
$export_symbols_cmds\"
4168 # Set up a command to remove the reloadable object files
4169 # after they are used.
4171 while test "$i" -lt "$k"
4174 delfiles
="$delfiles $output_objdir/$output_la-${i}.$objext"
4177 $echo "creating a temporary reloadable object file: $output"
4179 # Loop through the commands generated above and execute them.
4180 save_ifs
="$IFS"; IFS
='~'
4181 for cmd
in $concat_cmds; do
4184 $run eval "$cmd" ||
exit $?
4189 # Restore the value of output.
4192 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4193 eval libobjs
=\"\
$libobjs $whole_archive_flag_spec\"
4195 # Expand the library linking commands again to reset the
4196 # value of $libobjs for piecewise linking.
4198 # Do each of the archive commands.
4199 if test "$module" = yes && test -n "$module_cmds" ; then
4200 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4201 cmds
=$module_expsym_cmds
4206 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4207 cmds
=$archive_expsym_cmds
4213 # Append the command to remove the reloadable object files
4214 # to the just-reset $cmds.
4215 eval cmds
=\"\
$cmds~\
$rm $delfiles\"
4217 save_ifs
="$IFS"; IFS
='~'
4218 for cmd
in $cmds; do
4222 $run eval "$cmd" ||
{
4225 # Restore the uninstalled library and exit
4226 if test "$mode" = relink
; then
4227 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4235 # Restore the uninstalled library and exit
4236 if test "$mode" = relink
; then
4237 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' ||
exit $?
4239 if test -n "$convenience"; then
4240 if test -z "$whole_archive_flag_spec"; then
4241 $show "${rm}r $gentop"
4242 $run ${rm}r
"$gentop"
4249 # Create links to the real library.
4250 for linkname
in $linknames; do
4251 if test "$realname" != "$linkname"; then
4252 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4253 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' ||
exit $?
4257 # If -module or -export-dynamic was specified, set the dlname.
4258 if test "$module" = yes ||
test "$export_dynamic" = yes; then
4259 # On all known operating systems, these are identical.
4268 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4271 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4272 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4275 if test -n "$rpath"; then
4276 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4279 if test -n "$xrpath"; then
4280 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4283 if test -n "$vinfo"; then
4284 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4287 if test -n "$release"; then
4288 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4293 if test -n "$objs$old_deplibs"; then
4294 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4298 obj
=`$echo "X$output" | $Xsed -e "$lo2o"`
4306 # Delete the old objects.
4307 $run $rm $obj $libobj
4309 # Objects from convenience libraries. This assumes
4310 # single-version convenience libraries. Whenever we create
4311 # different ones for PIC/non-PIC, this we'll have to duplicate
4315 # reload_cmds runs $LD directly, so let us get rid of
4316 # -Wl from whole_archive_flag_spec and hope we can get by with
4317 # turning comma into space..
4320 if test -n "$convenience"; then
4321 if test -n "$whole_archive_flag_spec"; then
4322 eval tmp_whole_archive_flags
=\"$whole_archive_flag_spec\"
4323 reload_conv_objs
=$reload_objs\
`$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4325 gentop
="$output_objdir/${obj}x"
4326 generated
="$generated $gentop"
4328 func_extract_archives
$gentop $convenience
4329 reload_conv_objs
="$reload_objs $func_extract_archives_result"
4333 # Create the old-style object.
4334 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
4338 save_ifs
="$IFS"; IFS
='~'
4339 for cmd
in $cmds; do
4343 $run eval "$cmd" ||
exit $?
4347 # Exit if we aren't doing a library object file.
4348 if test -z "$libobj"; then
4349 if test -n "$gentop"; then
4350 $show "${rm}r $gentop"
4357 if test "$build_libtool_libs" != yes; then
4358 if test -n "$gentop"; then
4359 $show "${rm}r $gentop"
4363 # Create an invalid libtool object if no PIC, so that we don't
4364 # accidentally link it into a program.
4365 # $show "echo timestamp > $libobj"
4366 # $run eval "echo timestamp > $libobj" || exit $?
4370 if test -n "$pic_flag" ||
test "$pic_mode" != default
; then
4371 # Only do commands if we really have different PIC objects.
4372 reload_objs
="$libobjs $reload_conv_objs"
4375 save_ifs
="$IFS"; IFS
='~'
4376 for cmd
in $cmds; do
4380 $run eval "$cmd" ||
exit $?
4385 if test -n "$gentop"; then
4386 $show "${rm}r $gentop"
4395 *cygwin
*) output
=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4397 if test -n "$vinfo"; then
4398 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4401 if test -n "$release"; then
4402 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4405 if test "$preload" = yes; then
4406 if test "$dlopen_support" = unknown
&& test "$dlopen_self" = unknown
&&
4407 test "$dlopen_self_static" = unknown
; then
4408 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4413 *-*-rhapsody* |
*-*-darwin1.
[012])
4414 # On Rhapsody replace the C library is the System framework
4415 compile_deplibs
=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4416 finalize_deplibs
=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4422 # Don't allow lazy linking, it breaks C++ global constructors
4423 if test "$tagname" = CXX
; then
4424 compile_command
="$compile_command ${wl}-bind_at_load"
4425 finalize_command
="$finalize_command ${wl}-bind_at_load"
4431 # move library search paths that coincide with paths to not yet
4432 # installed libraries to the beginning of the library search list
4434 for path
in $notinst_path; do
4435 case " $new_libs " in
4436 *" -L$path/$objdir "*) ;;
4438 case " $compile_deplibs " in
4439 *" -L$path/$objdir "*)
4440 new_libs
="$new_libs -L$path/$objdir" ;;
4445 for deplib
in $compile_deplibs; do
4448 case " $new_libs " in
4450 *) new_libs
="$new_libs $deplib" ;;
4453 *) new_libs
="$new_libs $deplib" ;;
4456 compile_deplibs
="$new_libs"
4459 compile_command
="$compile_command $compile_deplibs"
4460 finalize_command
="$finalize_command $finalize_deplibs"
4462 if test -n "$rpath$xrpath"; then
4463 # If the user specified any rpath flags, then add them.
4464 for libdir
in $rpath $xrpath; do
4465 # This is the magic to use -rpath.
4466 case "$finalize_rpath " in
4468 *) finalize_rpath
="$finalize_rpath $libdir" ;;
4473 # Now hardcode the library paths
4476 for libdir
in $compile_rpath $finalize_rpath; do
4477 if test -n "$hardcode_libdir_flag_spec"; then
4478 if test -n "$hardcode_libdir_separator"; then
4479 if test -z "$hardcode_libdirs"; then
4480 hardcode_libdirs
="$libdir"
4482 # Just accumulate the unique libdirs.
4483 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4484 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4487 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4492 eval flag
=\"$hardcode_libdir_flag_spec\"
4493 rpath
="$rpath $flag"
4495 elif test -n "$runpath_var"; then
4496 case "$perm_rpath " in
4498 *) perm_rpath
="$perm_rpath $libdir" ;;
4502 *-*-cygwin* |
*-*-mingw* |
*-*-pw32* |
*-*-os2*)
4503 testbindir
=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4504 case :$dllsearchpath: in
4506 *) dllsearchpath
="$dllsearchpath:$libdir";;
4508 case :$dllsearchpath: in
4509 *":$testbindir:"*) ;;
4510 *) dllsearchpath
="$dllsearchpath:$testbindir";;
4515 # Substitute the hardcoded libdirs into the rpath.
4516 if test -n "$hardcode_libdir_separator" &&
4517 test -n "$hardcode_libdirs"; then
4518 libdir
="$hardcode_libdirs"
4519 eval rpath
=\" $hardcode_libdir_flag_spec\"
4521 compile_rpath
="$rpath"
4525 for libdir
in $finalize_rpath; do
4526 if test -n "$hardcode_libdir_flag_spec"; then
4527 if test -n "$hardcode_libdir_separator"; then
4528 if test -z "$hardcode_libdirs"; then
4529 hardcode_libdirs
="$libdir"
4531 # Just accumulate the unique libdirs.
4532 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4533 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4536 hardcode_libdirs
="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4541 eval flag
=\"$hardcode_libdir_flag_spec\"
4542 rpath
="$rpath $flag"
4544 elif test -n "$runpath_var"; then
4545 case "$finalize_perm_rpath " in
4547 *) finalize_perm_rpath
="$finalize_perm_rpath $libdir" ;;
4551 # Substitute the hardcoded libdirs into the rpath.
4552 if test -n "$hardcode_libdir_separator" &&
4553 test -n "$hardcode_libdirs"; then
4554 libdir
="$hardcode_libdirs"
4555 eval rpath
=\" $hardcode_libdir_flag_spec\"
4557 finalize_rpath
="$rpath"
4559 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4560 # Transform all the library objects into standard objects.
4561 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4562 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4566 if test -n "$dlfiles$dlprefiles" ||
test "$dlself" != no
; then
4567 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4568 dlsyms
="${outputname}S.c"
4570 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4574 if test -n "$dlsyms"; then
4578 # Discover the nlist of each of the dlfiles.
4579 nlist
="$output_objdir/${outputname}.nm"
4581 $show "$rm $nlist ${nlist}S ${nlist}T"
4582 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4584 # Parse the name list into a source file.
4585 $show "creating $output_objdir/$dlsyms"
4587 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4588 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4589 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4595 /* Prevent the only kind of declaration conflicts we can make. */
4596 #define lt_preloaded_symbols some_other_symbol
4598 /* External symbol declarations for the compiler. */\
4601 if test "$dlself" = yes; then
4602 $show "generating symbol list for \`$output'"
4604 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4606 # Add our own program objects to the symbol list.
4607 progfiles
=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4608 for arg
in $progfiles; do
4609 $show "extracting global C symbols from \`$arg'"
4610 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4613 if test -n "$exclude_expsyms"; then
4614 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4615 $run eval '$mv "$nlist"T "$nlist"'
4618 if test -n "$export_symbols_regex"; then
4619 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4620 $run eval '$mv "$nlist"T "$nlist"'
4623 # Prepare the list of exported symbols
4624 if test -z "$export_symbols"; then
4625 export_symbols
="$output_objdir/$outputname.exp"
4626 $run $rm $export_symbols
4627 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4629 *cygwin
* |
*mingw
* )
4630 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4631 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4635 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4636 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4637 $run eval 'mv "$nlist"T "$nlist"'
4639 *cygwin
* |
*mingw
* )
4640 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4641 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4647 for arg
in $dlprefiles; do
4648 $show "extracting global C symbols from \`$arg'"
4649 name
=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4650 $run eval '$echo ": $name " >> "$nlist"'
4651 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4654 if test -z "$run"; then
4655 # Make sure we have at least an empty file.
4656 test -f "$nlist" ||
: > "$nlist"
4658 if test -n "$exclude_expsyms"; then
4659 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4660 $mv "$nlist"T
"$nlist"
4663 # Try sorting and uniquifying the output.
4664 if grep -v "^: " < "$nlist" |
4665 if sort -k 3 </dev
/null
>/dev
/null
2>&1; then
4670 uniq > "$nlist"S
; then
4673 grep -v "^: " < "$nlist" > "$nlist"S
4676 if test -f "$nlist"S
; then
4677 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4679 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4682 $echo >> "$output_objdir/$dlsyms" "\
4684 #undef lt_preloaded_symbols
4686 #if defined (__STDC__) && __STDC__
4687 # define lt_ptr void *
4689 # define lt_ptr char *
4693 /* The mapping between symbol names and symbols. */
4697 *cygwin
* |
*mingw
* )
4698 $echo >> "$output_objdir/$dlsyms" "\
4699 /* DATA imports from DLLs on WIN32 can't be const, because
4700 runtime relocations are performed -- see ld's documentation
4706 $echo >> "$output_objdir/$dlsyms" "\
4713 $echo >> "$output_objdir/$dlsyms" "\
4717 lt_preloaded_symbols[] =
4721 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4723 $echo >> "$output_objdir/$dlsyms" "\
4727 /* This works around a problem in FreeBSD linker */
4728 #ifdef FREEBSD_WORKAROUND
4729 static const void *lt_preloaded_setup() {
4730 return lt_preloaded_symbols;
4740 pic_flag_for_symtable
=
4742 # compiling the symbol table file with pic_flag works around
4743 # a FreeBSD bug that causes programs to crash when -lm is
4744 # linked before any other PIC object. But we must not use
4745 # pic_flag when linking with -static. The problem exists in
4746 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4747 *-*-freebsd2*|
*-*-freebsd3.0
*|
*-*-freebsdelf3.0
*)
4748 case "$compile_command " in
4750 *) pic_flag_for_symtable
=" $pic_flag -DFREEBSD_WORKAROUND";;
4753 case "$compile_command " in
4755 *) pic_flag_for_symtable
=" $pic_flag";;
4759 # Now compile the dynamic symbol file.
4760 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4761 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' ||
exit $?
4763 # Clean up the generated files.
4764 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4765 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4767 # Transform the symbol file into the correct name.
4769 *cygwin
* |
*mingw
* )
4770 if test -f "$output_objdir/${outputname}.def" ; then
4771 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4774 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4775 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4780 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4785 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4790 # We keep going just in case the user didn't refer to
4791 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4792 # really was required.
4794 # Nullify the symbol file.
4795 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4796 finalize_command
=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4799 if test "$need_relink" = no ||
test "$build_libtool_libs" != yes; then
4800 # Replace the output file specification.
4801 compile_command
=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4802 link_command
="$compile_command$compile_rpath"
4804 # We have no uninstalled library dependencies, so finalize right now.
4805 $show "$link_command"
4806 $run eval "$link_command"
4809 # Delete the generated files.
4810 if test -n "$dlsyms"; then
4811 $show "$rm $output_objdir/${outputname}S.${objext}"
4812 $run $rm "$output_objdir/${outputname}S.${objext}"
4818 if test -n "$shlibpath_var"; then
4819 # We should set the shlibpath_var
4821 for dir
in $temp_rpath; do
4823 [\\/]* |
[A-Za-z
]:[\\/]*)
4828 # Relative path: add a thisdir entry.
4829 rpath
="$rpath\$thisdir/$dir:"
4836 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4837 compile_command
="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4839 if test -n "$finalize_shlibpath"; then
4840 finalize_command
="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4845 if test -n "$runpath_var"; then
4846 if test -n "$perm_rpath"; then
4847 # We should set the runpath_var.
4849 for dir
in $perm_rpath; do
4852 compile_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4854 if test -n "$finalize_perm_rpath"; then
4855 # We should set the runpath_var.
4857 for dir
in $finalize_perm_rpath; do
4860 finalize_var
="$runpath_var=\"$rpath\$$runpath_var\" "
4864 if test "$no_install" = yes; then
4865 # We don't need to create a wrapper script.
4866 link_command
="$compile_var$compile_command$compile_rpath"
4867 # Replace the output file specification.
4868 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4869 # Delete the old output file.
4871 # Link the executable and exit
4872 $show "$link_command"
4873 $run eval "$link_command" ||
exit $?
4877 if test "$hardcode_action" = relink
; then
4878 # Fast installation is not supported
4879 link_command
="$compile_var$compile_command$compile_rpath"
4880 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4882 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4883 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4885 if test "$fast_install" != no
; then
4886 link_command
="$finalize_var$compile_command$finalize_rpath"
4887 if test "$fast_install" = yes; then
4888 relink_command
=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4890 # fast_install is set to needless
4894 link_command
="$compile_var$compile_command$compile_rpath"
4895 relink_command
="$finalize_var$finalize_command$finalize_rpath"
4899 # Replace the output file specification.
4900 link_command
=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4902 # Delete the old output files.
4903 $run $rm $output $output_objdir/$outputname $output_objdir/lt-
$outputname
4905 $show "$link_command"
4906 $run eval "$link_command" ||
exit $?
4908 # Now create the wrapper script.
4909 $show "creating $output"
4911 # Quote the relink command for shipping.
4912 if test -n "$relink_command"; then
4913 # Preserve any variables that may affect compiler behavior
4914 for var
in $variables_saved_for_relink; do
4915 if eval test -z \"\
${$var+set}\"; then
4916 relink_command
="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4917 elif eval var_value
=\$
$var; test -z "$var_value"; then
4918 relink_command
="$var=; export $var; $relink_command"
4920 var_value
=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4921 relink_command
="$var=\"$var_value\"; export $var; $relink_command"
4924 relink_command
="(cd `pwd`; $relink_command)"
4925 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4928 # Quote $echo for shipping.
4929 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4931 [\\/]* |
[A-Za-z
]:[\\/]*) qecho
="$SHELL $progpath --fallback-echo";;
4932 *) qecho
="$SHELL `pwd`/$progpath --fallback-echo";;
4934 qecho
=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4936 qecho
=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4939 # Only actually do things if our run command is non-null.
4940 if test -z "$run"; then
4941 # win32 will think the script is a binary if it has
4942 # a .exe suffix, so we strip it off here.
4944 *.exe
) output
=`$echo $output|${SED} 's,.exe$,,'` ;;
4946 # test for cygwin because mv fails w/o .exe extensions
4950 outputname
=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4954 *cygwin
* |
*mingw
* )
4955 output_name
=`basename $output`
4956 output_path
=`dirname $output`
4957 cwrappersource
="$output_path/$objdir/lt-$output_name.c"
4958 cwrapper
="$output_path/$output_name.exe"
4959 $rm $cwrappersource $cwrapper
4960 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4962 cat > $cwrappersource <<EOF
4964 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4965 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4967 The $output program cannot be directly executed until all the libtool
4968 libraries that it depends on are installed.
4970 This wrapper executable should never be moved out of the build directory.
4971 If it is, it will not operate correctly.
4973 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4974 but could eventually absorb all of the scripts functionality and
4975 exec $objdir/$outputname directly.
4978 cat >> $cwrappersource<<"EOF"
4987 #include <sys/stat.h>
4989 #if defined(PATH_MAX)
4990 # define LT_PATHMAX PATH_MAX
4991 #elif defined(MAXPATHLEN)
4992 # define LT_PATHMAX MAXPATHLEN
4994 # define LT_PATHMAX 1024
4997 #ifndef DIR_SEPARATOR
4998 # define DIR_SEPARATOR '/'
4999 # define PATH_SEPARATOR ':'
5002 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5004 # define HAVE_DOS_BASED_FILE_SYSTEM
5005 # ifndef DIR_SEPARATOR_2
5006 # define DIR_SEPARATOR_2 '\\'
5008 # ifndef PATH_SEPARATOR_2
5009 # define PATH_SEPARATOR_2 ';'
5013 #ifndef DIR_SEPARATOR_2
5014 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5015 #else /* DIR_SEPARATOR_2 */
5016 # define IS_DIR_SEPARATOR(ch) \
5017 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5018 #endif /* DIR_SEPARATOR_2 */
5020 #ifndef PATH_SEPARATOR_2
5021 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5022 #else /* PATH_SEPARATOR_2 */
5023 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5024 #endif /* PATH_SEPARATOR_2 */
5026 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5027 #define XFREE(stale) do { \
5028 if (stale) { free ((void *) stale); stale = 0; } \
5031 /* -DDEBUG is fairly common in CFLAGS. */
5033 #if defined DEBUGWRAPPER
5034 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5036 # define DEBUG(format, ...)
5039 const char *program_name = NULL;
5041 void * xmalloc (size_t num);
5042 char * xstrdup (const char *string);
5043 const char * base_name (const char *name);
5044 char * find_executable(const char *wrapper);
5045 int check_executable(const char *path);
5046 char * strendzap(char *str, const char *pat);
5047 void lt_fatal (const char *message, ...);
5050 main (int argc, char *argv[])
5055 program_name = (char *) xstrdup (base_name (argv[0]));
5056 DEBUG("(main) argv[0] : %s\n",argv[0]);
5057 DEBUG("(main) program_name : %s\n",program_name);
5058 newargz = XMALLOC(char *, argc+2);
5061 cat >> $cwrappersource <<EOF
5062 newargz[0] = (char *) xstrdup("$SHELL");
5065 cat >> $cwrappersource <<"EOF"
5066 newargz
[1] = find_executable
(argv
[0]);
5067 if (newargz
[1] == NULL
)
5068 lt_fatal
("Couldn't find %s", argv
[0]);
5069 DEBUG
("(main) found exe at : %s\n",newargz
[1]);
5070 /* we know the
script has the same name
, without the .exe
*/
5071 /* so
make sure newargz
[1] doesn
't end in .exe */
5072 strendzap(newargz[1],".exe");
5073 for (i = 1; i < argc; i++)
5074 newargz[i+1] = xstrdup(argv[i]);
5075 newargz[argc+1] = NULL;
5077 for (i=0; i<argc+1; i++)
5079 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5087 cat >> $cwrappersource <<EOF
5088 execv("$SHELL",(char const **)newargz);
5092 cat >> $cwrappersource <<EOF
5093 execv("$SHELL",newargz);
5098 cat >> $cwrappersource <<"EOF"
5103 xmalloc (size_t num)
5105 void * p = (void *) malloc (num);
5107 lt_fatal ("Memory exhausted");
5113 xstrdup (const char *string)
5115 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5120 base_name (const char *name)
5124 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5125 /* Skip over the disk name in MSDOS pathnames. */
5126 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5130 for (base = name; *name; name++)
5131 if (IS_DIR_SEPARATOR (*name))
5137 check_executable(const char * path)
5141 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5142 if ((!path) || (!*path))
5145 if ((stat (path, &st) >= 0) &&
5147 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5148 #if defined (S_IXOTH)
5149 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5151 #if defined (S_IXGRP)
5152 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5154 ((st.st_mode & S_IXUSR) == S_IXUSR))
5161 /* Searches for the full path of the wrapper. Returns
5162 newly allocated full path name if found, NULL otherwise */
5164 find_executable (const char* wrapper)
5169 /* static buffer for getcwd */
5170 char tmp[LT_PATHMAX + 1];
5174 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5176 if ((wrapper == NULL) || (*wrapper == '\
0'))
5179 /* Absolute path? */
5180 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5181 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5183 concat_name = xstrdup (wrapper);
5184 if (check_executable(concat_name))
5191 if (IS_DIR_SEPARATOR (wrapper[0]))
5193 concat_name = xstrdup (wrapper);
5194 if (check_executable(concat_name))
5198 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5202 for (p = wrapper; *p; p++)
5210 /* no slashes; search PATH */
5211 const char* path = getenv ("PATH");
5214 for (p = path; *p; p = p_next)
5218 for (q = p; *q; q++)
5219 if (IS_PATH_SEPARATOR(*q))
5222 p_next = (*q == '\
0' ? q : q + 1);
5225 /* empty path: current directory */
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);
5236 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5237 memcpy (concat_name, p, p_len);
5238 concat_name[p_len] = '/';
5239 strcpy (concat_name + p_len + 1, wrapper);
5241 if (check_executable(concat_name))
5246 /* not found in PATH; assume curdir */
5248 /* Relative path | not found in path: prepend cwd */
5249 if (getcwd (tmp, LT_PATHMAX) == NULL)
5250 lt_fatal ("getcwd failed");
5251 tmp_len = strlen(tmp);
5252 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5253 memcpy (concat_name, tmp, tmp_len);
5254 concat_name[tmp_len] = '/';
5255 strcpy (concat_name + tmp_len + 1, wrapper);
5257 if (check_executable(concat_name))
5264 strendzap(char *str, const char *pat)
5268 assert(str != NULL);
5269 assert(pat != NULL);
5272 patlen = strlen(pat);
5276 str += len - patlen;
5277 if (strcmp(str, pat) == 0)
5284 lt_error_core (int exit_status, const char * mode,
5285 const char * message, va_list ap)
5287 fprintf (stderr, "%s: %s: ", program_name, mode);
5288 vfprintf (stderr, message, ap);
5289 fprintf (stderr, ".\n");
5291 if (exit_status >= 0)
5296 lt_fatal (const char *message, ...)
5299 va_start (ap, message);
5300 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5304 # we should really use a build-platform specific compiler
5305 # here, but OTOH, the wrappers (shell script and this C one)
5306 # are only useful if you want to execute the "real" binary.
5307 # Since the "real" binary is built for $host, then this
5308 # wrapper might as well be built for $host, too.
5309 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5313 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5318 # $output - temporary wrapper script for $objdir/$outputname
5319 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5321 # The $output program cannot be directly executed until all the libtool
5322 # libraries that it depends on are installed.
5324 # This wrapper script should never be moved out of the build directory.
5325 # If it is, it will not operate correctly.
5327 # Sed substitution that helps us do robust quoting. It backslashifies
5328 # metacharacters that are still active within double-quoted strings.
5329 Xsed='${SED} -e 1s
/^X
//'
5330 sed_quote_subst='$sed_quote_subst'
5332 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5333 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5336 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5337 # is contrary to our usage. Disable this feature.
5338 alias -g '\
${1+\"\$@\"}'='\"\$@
\"'
5339 setopt NO_GLOB_SUBST
5341 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5343 BIN_SH=xpg4; export BIN_SH # for Tru64
5344 DUALCASE=1; export DUALCASE # for MKS sh
5346 # The HP-UX ksh and POSIX shell print the target directory to stdout
5348 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5350 relink_command=\"$relink_command\"
5352 # This environment variable determines our operation mode.
5353 if test \"\$libtool_install_magic\" = \"$magic\"; then
5354 # install mode needs the following variable:
5355 notinst_deplibs='$notinst_deplibs'
5357 # When we are sourced in execute mode, \$file and \$echo are already set.
5358 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5361 # Make sure echo works.
5362 if test \"X\$1\" = X--no-reexec; then
5363 # Discard the --no-reexec flag, and continue.
5365 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X
\t'; then
5366 # Yippee, \$echo works!
5369 # Restart under the correct shell, and then maybe \$echo will work.
5370 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5376 # Find the directory that this script lives in.
5377 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*$
%%'\`
5378 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5380 # Follow symbolic links until we get to the real thisdir.
5381 file=\`ls -ld \"\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5382 while test -n \"\$file\"; do
5383 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's
%/[^
/]*\$
%%'\`
5385 # If there was a directory component, then change thisdir.
5386 if test \"x\$destdir\" != \"x\$file\"; then
5387 case \"\$destdir\" in
5388 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5389 *) thisdir=\"\$thisdir/\$destdir\" ;;
5393 file=\`\$echo \"X\$file\" | \$Xsed -e 's
%^.
*/%%'\`
5394 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's
/.
*-> //p
'\`
5397 # Try to get the absolute directory name.
5398 absdir=\`cd \"\$thisdir\" && pwd\`
5399 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5402 if test "$fast_install" = yes; then
5404 program=lt-'$outputname'$exeext
5405 progdir=\"\$thisdir/$objdir\"
5407 if test ! -f \"\$progdir/\$program\" || \\
5408 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5409 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5411 file=\"\$\$-\$program\"
5413 if test ! -d \"\$progdir\"; then
5414 $mkdir \"\$progdir\"
5416 $rm \"\$progdir/\$file\"
5421 # relink executable if necessary
5422 if test -n \"\$relink_command\"; then
5423 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5425 $echo \"\$relink_command_output\" >&2
5426 $rm \"\$progdir/\$file\"
5431 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5432 { $rm \"\$progdir/\$program\";
5433 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5434 $rm \"\$progdir/\$file\"
5438 program='$outputname'
5439 progdir=\"\$thisdir/$objdir\"
5445 if test -f \"\$progdir/\$program\"; then"
5447 # Export our shlibpath_var if we have one.
5448 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5450 # Add our own library path to $shlibpath_var
5451 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5453 # Some systems cannot cope with colon-terminated $shlibpath_var
5454 # The second colon is a workaround for a bug in BeOS R4 sed
5455 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's
/::*\$
//'\`
5457 export $shlibpath_var
5461 # fixup the dll searchpath if we need to.
5462 if test -n "$dllsearchpath"; then
5464 # Add the dll search path components to the executable PATH
5465 PATH=$dllsearchpath:\$PATH
5470 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5471 # Run the actual program with our arguments.
5474 # Backslashes separate directories on plain windows
5475 *-*-mingw | *-*-os2*)
5477 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5483 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5488 \$echo \"\$0: cannot exec \$program \$*\"
5492 # The program doesn't exist.
5493 \
$echo \"\
$0: error
: \\\
`\$progdir/\$program' does not exist\" 1>&2
5494 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5495 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5506 # See if we need to build an old-fashioned archive.
5507 for oldlib in $oldlibs; do
5509 if test "$build_libtool_libs" = convenience; then
5510 oldobjs="$libobjs_save"
5511 addlibs="$convenience"
5512 build_libtool_libs=no
5514 if test "$build_libtool_libs" = module; then
5515 oldobjs="$libobjs_save"
5516 build_libtool_libs=no
5518 oldobjs="$old_deplibs $non_pic_objects"
5520 addlibs="$old_convenience"
5523 if test -n "$addlibs"; then
5524 gentop="$output_objdir/${outputname}x"
5525 generated="$generated $gentop"
5527 func_extract_archives $gentop $addlibs
5528 oldobjs="$oldobjs $func_extract_archives_result"
5531 # Do each command in the archive commands.
5532 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5533 cmds=$old_archive_from_new_cmds
5535 # POSIX demands no paths to be encoded in archives. We have
5536 # to avoid creating archives with duplicate basenames if we
5537 # might have to extract them afterwards, e.g., when creating a
5538 # static archive out of a convenience library, or when linking
5539 # the entirety of a libtool archive into another (currently
5540 # not supported by libtool).
5541 if (for obj in $oldobjs
5543 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5544 done | sort | sort -uc >/dev/null 2>&1); then
5547 $echo "copying selected object files to avoid basename conflicts..."
5549 if test -z "$gentop"; then
5550 gentop="$output_objdir/${outputname}x"
5551 generated="$generated $gentop"
5553 $show "${rm}r $gentop"
5554 $run ${rm}r "$gentop"
5555 $show "$mkdir $gentop"
5556 $run $mkdir "$gentop"
5558 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5563 save_oldobjs=$oldobjs
5566 for obj in $save_oldobjs
5568 objbase=`$echo "X$obj" |
$Xsed -e 's%^.*/%%'`
5569 case " $oldobjs " in
5570 " ") oldobjs=$obj ;;
5573 # Make sure we don't pick an alternate name that also
5575 newobj=lt$counter-$objbase
5576 counter=`expr $counter + 1`
5577 case " $oldobjs " in
5578 *[\ /]"$newobj "*) ;;
5579 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5582 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5583 $run ln "$obj" "$gentop/$newobj" ||
5584 $run cp "$obj" "$gentop/$newobj"
5585 oldobjs="$oldobjs $gentop/$newobj"
5587 *) oldobjs="$oldobjs $obj" ;;
5592 eval cmds=\"$old_archive_cmds\"
5594 if len=`expr "X$cmds" : ".*"` &&
5595 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5596 cmds=$old_archive_cmds
5598 # the command line is too long to link in one step, link in parts
5599 $echo "using piecewise archive linking..."
5604 save_oldobjs=$oldobjs
5606 # Is there a better way of finding the last object in the list?
5607 for obj in $save_oldobjs
5611 for obj in $save_oldobjs
5613 oldobjs="$objlist $obj"
5614 objlist="$objlist $obj"
5615 eval test_cmds=\"$old_archive_cmds\"
5616 if len=`expr "X$test_cmds" : ".*" 2>/dev
/null
` &&
5617 test "$len" -le "$max_cmd_len"; then
5620 # the above command should be used before it gets too long
5622 if test "$obj" = "$last_oldobj" ; then
5625 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5626 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5632 if test "X$oldobjs" = "X" ; then
5633 eval cmds=\"\$concat_cmds\"
5635 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5639 save_ifs="$IFS"; IFS='~'
5640 for cmd in $cmds; do
5644 $run eval "$cmd" || exit $?
5649 if test -n "$generated"; then
5650 $show "${rm}r$generated"
5651 $run ${rm}r$generated
5654 # Now create the libtool archive.
5658 test "$build_old_libs" = yes && old_library="$libname.$libext"
5659 $show "creating $output"
5661 # Preserve any variables that may affect compiler behavior
5662 for var in $variables_saved_for_relink; do
5663 if eval test -z \"\${$var+set}\"; then
5664 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5665 elif eval var_value=\$$var; test -z "$var_value"; then
5666 relink_command="$var=; export $var; $relink_command"
5668 var_value=`$echo "X$var_value" |
$Xsed -e "$sed_quote_subst"`
5669 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5672 # Quote the link command for shipping.
5673 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5674 relink_command=`$echo "X$relink_command" |
$SP2NL |
$Xsed -e "$sed_quote_subst" |
$NL2SP`
5675 if test "$hardcode_automatic" = yes ; then
5680 # Only create the output if not a dry run.
5681 if test -z "$run"; then
5682 for installed in no yes; do
5683 if test "$installed" = yes; then
5684 if test -z "$install_libdir"; then
5687 output="$output_objdir/$outputname"i
5688 # Replace all uninstalled libtool libraries with the installed ones
5690 for deplib in $dependency_libs; do
5693 name=`$echo "X$deplib" |
$Xsed -e 's%^.*/%%'`
5694 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5695 if test -z "$libdir"; then
5696 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5699 newdependency_libs="$newdependency_libs $libdir/$name"
5701 *) newdependency_libs="$newdependency_libs $deplib" ;;
5704 dependency_libs="$newdependency_libs"
5706 for lib in $dlfiles; do
5707 name=`$echo "X$lib" | $Xsed -e 's
%^.
*/%%'`
5708 eval libdir=`${SED} -n -e 's
/^libdir
=\
(.
*\
)$
/\
1/p
' $lib`
5709 if test -z "$libdir"; then
5710 $echo "$modename: \`$lib' is not a valid libtool archive
" 1>&2
5713 newdlfiles="$newdlfiles $libdir/$name"
5715 dlfiles="$newdlfiles"
5717 for lib in $dlprefiles; do
5718 name=`$echo "X
$lib" | $Xsed -e 's%^.*/%%'`
5719 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5720 if test -z "$libdir"; then
5721 $echo "$modename: \
`$lib' is not a valid libtool archive" 1>&2
5724 newdlprefiles="$newdlprefiles $libdir/$name"
5726 dlprefiles="$newdlprefiles"
5729 for lib in $dlfiles; do
5731 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5732 *) abs=`pwd`"/$lib" ;;
5734 newdlfiles="$newdlfiles $abs"
5736 dlfiles="$newdlfiles"
5738 for lib in $dlprefiles; do
5740 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5741 *) abs=`pwd`"/$lib" ;;
5743 newdlprefiles="$newdlprefiles $abs"
5745 dlprefiles="$newdlprefiles"
5748 # place dlname in correct position for cygwin
5750 case $host,$output,$installed,$module,$dlname in
5751 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5754 # $outputname - a libtool library file
5755 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5757 # Please DO NOT delete this file!
5758 # It is necessary for linking the library.
5760 # The name that we can dlopen(3).
5763 # Names of this library.
5764 library_names='$library_names'
5766 # The name of the static archive.
5767 old_library='$old_library'
5769 # Libraries that this one depends upon.
5770 dependency_libs='$dependency_libs'
5772 # Version information for $libname.
5777 # Is this an already installed library?
5778 installed=$installed
5780 # Should we warn about portability when linking against -modules?
5781 shouldnotlink=$module
5783 # Files to dlopen/dlpreopen
5785 dlpreopen='$dlprefiles'
5787 # Directory that this library needs to be installed in:
5788 libdir='$install_libdir'"
5789 if test "$installed" = no && test "$need_relink" = yes; then
5791 relink_command=\"$relink_command\""
5796 # Do a symbolic link so that the libtool archive can be found in
5797 # LD_LIBRARY_PATH before the program is installed.
5798 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5799 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5805 # libtool install mode
5807 modename="$modename: install"
5809 # There may be an optional sh(1) argument at the beginning of
5810 # install_prog (especially on Windows NT).
5811 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5812 # Allow the use of GNU shtool's install command.
5813 $echo "X$nonopt" | grep shtool > /dev/null; then
5814 # Aesthetically quote it.
5815 arg=`$echo "X$nonopt" |
$Xsed -e "$sed_quote_subst"`
5817 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5821 install_prog="$arg "
5829 # The real first argument should be the name of the installation program.
5830 # Aesthetically quote it.
5831 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5833 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5837 install_prog="$install_prog$arg"
5839 # We need to accept at least all the BSD install flags.
5849 if test -n "$dest"; then
5850 files="$files $dest"
5858 case " $install_prog " in
5863 -g | -m | -o) prev=$arg ;;
5871 # If the previous option needed an argument, then skip it.
5872 if test -n "$prev"; then
5881 # Aesthetically quote the argument.
5882 arg=`$echo "X$arg" |
$Xsed -e "$sed_quote_subst"`
5884 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5888 install_prog="$install_prog $arg"
5891 if test -z "$install_prog"; then
5892 $echo "$modename: you must specify an install program" 1>&2
5897 if test -n "$prev"; then
5898 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5903 if test -z "$files"; then
5904 if test -z "$dest"; then
5905 $echo "$modename: no file or destination specified" 1>&2
5907 $echo "$modename: you must specify a destination" 1>&2
5913 # Strip any trailing slash from the destination.
5914 dest=`$echo "X$dest" | $Xsed -e 's
%/$
%%'`
5916 # Check to see that the destination is a directory.
5917 test -d "$dest" && isdir=yes
5918 if test "$isdir" = yes; then
5922 destdir=`$echo "X$dest" | $Xsed -e 's
%/[^
/]*$
%%'`
5923 test "X$destdir" = "X$dest" && destdir=.
5924 destname=`$echo "X$dest" | $Xsed -e 's
%^.
*/%%'`
5926 # Not a directory, so check to see that there is only one file specified.
5928 if test "$#" -gt 2; then
5929 $echo "$modename: \`$dest' is not a directory
" 1>&2
5935 [\\/]* | [A-Za-z]:[\\/]*) ;;
5937 for file in $files; do
5941 $echo "$modename: \
`$destdir' must be an absolute directory name" 1>&2
5950 # This variable tells wrapper scripts just to set variables rather
5951 # than running their programs.
5952 libtool_install_magic="$magic"
5957 for file in $files; do
5959 # Do each installation.
5962 # Do the static libraries later.
5963 staticlibs="$staticlibs $file"
5967 # Check to see that this really is a libtool archive.
5968 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5970 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5978 # If there is no directory component, then add one.
5980 */* | *\\*) . $file ;;
5984 # Add the libdir to current_libdirs if it is the destination.
5985 if test "X$destdir" = "X$libdir"; then
5986 case "$current_libdirs " in
5988 *) current_libdirs="$current_libdirs $libdir" ;;
5991 # Note the libdir as a future libdir.
5992 case "$future_libdirs " in
5994 *) future_libdirs="$future_libdirs $libdir" ;;
5998 dir=`$echo "X$file" | $Xsed -e 's
%/[^
/]*$
%%'`/
5999 test "X$dir" = "X$file/" && dir=
6002 if test -n "$relink_command"; then
6003 # Determine the prefix the user has applied to our future dir.
6004 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6006 # Don't allow the user to place us outside of our expected
6007 # location b/c this prevents finding dependent libraries that
6008 # are installed to the same prefix.
6009 # At present, this check doesn't affect windows .dll's that
6010 # are installed into $libdir/../bin (currently, that works fine)
6011 # but it's something to keep an eye on.
6012 if test "$inst_prefix_dir" = "$destdir"; then
6013 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6017 if test -n "$inst_prefix_dir"; then
6018 # Stick the inst_prefix_dir data into the link command.
6019 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6021 relink_command
=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6024 $echo "$modename: warning: relinking \`$file'" 1>&2
6025 $show "$relink_command"
6026 if $run eval "$relink_command"; then :
6028 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6033 # See the names of the shared library.
6034 set dummy
$library_names
6035 if test -n "$2"; then
6041 test -n "$relink_command" && srcname
="$realname"T
6043 # Install the shared library and build the symlinks.
6044 $show "$install_prog $dir/$srcname $destdir/$realname"
6045 $run eval "$install_prog $dir/$srcname $destdir/$realname" ||
exit $?
6046 if test -n "$stripme" && test -n "$striplib"; then
6047 $show "$striplib $destdir/$realname"
6048 $run eval "$striplib $destdir/$realname" ||
exit $?
6051 if test "$#" -gt 0; then
6052 # Delete the old symlinks, and create new ones.
6053 # Try `ln -sf' first, because the `ln' binary might depend on
6054 # the symlink we replace! Solaris /bin/ln does not understand -f,
6055 # so we also need to try rm && ln -s.
6058 if test "$linkname" != "$realname"; then
6059 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6060 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6065 # Do each command in the postinstall commands.
6066 lib
="$destdir/$realname"
6067 cmds
=$postinstall_cmds
6068 save_ifs
="$IFS"; IFS
='~'
6069 for cmd
in $cmds; do
6073 $run eval "$cmd" ||
{
6076 # Restore the uninstalled library and exit
6077 if test "$mode" = relink
; then
6078 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6087 # Install the pseudo-library for information purposes.
6088 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6089 instname
="$dir/$name"i
6090 $show "$install_prog $instname $destdir/$name"
6091 $run eval "$install_prog $instname $destdir/$name" ||
exit $?
6093 # Maybe install the static library, too.
6094 test -n "$old_library" && staticlibs
="$staticlibs $dir/$old_library"
6098 # Install (i.e. copy) a libtool object.
6100 # Figure out destination file name, if it wasn't already specified.
6101 if test -n "$destname"; then
6102 destfile
="$destdir/$destname"
6104 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6105 destfile
="$destdir/$destfile"
6108 # Deduce the name of the destination old-style object file.
6111 staticdest
=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6114 staticdest
="$destfile"
6118 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6124 # Install the libtool object if requested.
6125 if test -n "$destfile"; then
6126 $show "$install_prog $file $destfile"
6127 $run eval "$install_prog $file $destfile" ||
exit $?
6130 # Install the old object if enabled.
6131 if test "$build_old_libs" = yes; then
6132 # Deduce the name of the old-style object file.
6133 staticobj
=`$echo "X$file" | $Xsed -e "$lo2o"`
6135 $show "$install_prog $staticobj $staticdest"
6136 $run eval "$install_prog \$staticobj \$staticdest" ||
exit $?
6142 # Figure out destination file name, if it wasn't already specified.
6143 if test -n "$destname"; then
6144 destfile
="$destdir/$destname"
6146 destfile
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6147 destfile
="$destdir/$destfile"
6150 # If the file is missing, and there is a .exe on the end, strip it
6151 # because it is most likely a libtool script we actually want to
6156 if test ! -f "$file"; then
6157 file=`$echo $file|${SED} 's,.exe$,,'`
6163 # Do a test to see if this is really a libtool program.
6166 wrapper
=`$echo $file | ${SED} -e 's,.exe$,,'`
6172 if (${SED} -e '4q' $wrapper |
grep "^# Generated by .*$PACKAGE")>/dev
/null
2>&1; then
6176 # Note that it is not necessary on cygwin/mingw to append a dot to
6177 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6178 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6179 # `FILE.' does not work on cygwin managed mounts.
6181 # If there is no directory component, then add one.
6183 */* |
*\\*) .
${wrapper} ;;
6184 *) . .
/${wrapper} ;;
6187 # Check the variables that should have been set.
6188 if test -z "$notinst_deplibs"; then
6189 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6194 for lib
in $notinst_deplibs; do
6195 # Check to see that each library is installed.
6197 if test -f "$lib"; then
6198 # If there is no directory component, then add one.
6200 */* |
*\\*) .
$lib ;;
6204 libfile
="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6205 if test -n "$libdir" && test ! -f "$libfile"; then
6206 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6212 # Note that it is not necessary on cygwin/mingw to append a dot to
6213 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6214 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6215 # `FILE.' does not work on cygwin managed mounts.
6217 # If there is no directory component, then add one.
6219 */* |
*\\*) .
${wrapper} ;;
6220 *) . .
/${wrapper} ;;
6224 if test "$fast_install" = no
&& test -n "$relink_command"; then
6225 if test "$finalize" = yes && test -z "$run"; then
6226 tmpdir
=`func_mktempdir`
6227 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6228 outputname
="$tmpdir/$file"
6229 # Replace the output file specification.
6230 relink_command
=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6232 $show "$relink_command"
6233 if $run eval "$relink_command"; then :
6235 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6241 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6244 # Install the binary that we compiled earlier.
6245 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6249 # remove .exe since cygwin /usr/bin/install will append another
6251 case $install_prog,$host in
6252 */usr
/bin
/install*,*cygwin
*)
6253 case $file:$destfile in
6258 destfile
=$destfile.exe
6261 destfile
=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6266 $show "$install_prog$stripme $file $destfile"
6267 $run eval "$install_prog\$stripme \$file \$destfile" ||
exit $?
6268 test -n "$outputname" && ${rm}r
"$tmpdir"
6273 for file in $staticlibs; do
6274 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6276 # Set up the ranlib parameters.
6277 oldlib
="$destdir/$name"
6279 $show "$install_prog $file $oldlib"
6280 $run eval "$install_prog \$file \$oldlib" ||
exit $?
6282 if test -n "$stripme" && test -n "$old_striplib"; then
6283 $show "$old_striplib $oldlib"
6284 $run eval "$old_striplib $oldlib" ||
exit $?
6287 # Do each command in the postinstall commands.
6288 cmds
=$old_postinstall_cmds
6289 save_ifs
="$IFS"; IFS
='~'
6290 for cmd
in $cmds; do
6294 $run eval "$cmd" ||
exit $?
6299 if test -n "$future_libdirs"; then
6300 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6303 if test -n "$current_libdirs"; then
6304 # Maybe just do a dry run.
6305 test -n "$run" && current_libdirs
=" -n$current_libdirs"
6306 exec_cmd
='$SHELL $progpath $preserve_args --finish$current_libdirs'
6312 # libtool finish mode
6314 modename
="$modename: finish"
6318 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6321 libdirs
="$libdirs $dir"
6324 for libdir
in $libdirs; do
6325 if test -n "$finish_cmds"; then
6326 # Do each command in the finish commands.
6328 save_ifs
="$IFS"; IFS
='~'
6329 for cmd
in $cmds; do
6333 $run eval "$cmd" || admincmds
="$admincmds
6338 if test -n "$finish_eval"; then
6339 # Do the single finish_eval.
6340 eval cmds
=\"$finish_eval\"
6341 $run eval "$cmds" || admincmds
="$admincmds
6347 # Exit here if they wanted silent mode.
6348 test "$show" = : && exit $EXIT_SUCCESS
6350 $echo "X----------------------------------------------------------------------" |
$Xsed
6351 $echo "Libraries have been installed in:"
6352 for libdir
in $libdirs; do
6356 $echo "If you ever happen to want to link against installed libraries"
6357 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6358 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6359 $echo "flag during linking and do at least one of the following:"
6360 if test -n "$shlibpath_var"; then
6361 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6362 $echo " during execution"
6364 if test -n "$runpath_var"; then
6365 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6366 $echo " during linking"
6368 if test -n "$hardcode_libdir_flag_spec"; then
6370 eval flag
=\"$hardcode_libdir_flag_spec\"
6372 $echo " - use the \`$flag' linker flag"
6374 if test -n "$admincmds"; then
6375 $echo " - have your system administrator run these commands:$admincmds"
6377 if test -f /etc
/ld.so.conf
; then
6378 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6381 $echo "See any operating system documentation about shared libraries for"
6382 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6383 $echo "X----------------------------------------------------------------------" |
$Xsed
6387 # libtool execute mode
6389 modename
="$modename: execute"
6391 # The first argument is the command name.
6393 if test -z "$cmd"; then
6394 $echo "$modename: you must specify a COMMAND" 1>&2
6399 # Handle -dlopen flags immediately.
6400 for file in $execute_dlfiles; do
6401 if test ! -f "$file"; then
6402 $echo "$modename: \`$file' is not a file" 1>&2
6410 # Check to see that this really is a libtool archive.
6411 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then :
6413 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6418 # Read the libtool library.
6422 # If there is no directory component, then add one.
6424 */* |
*\\*) .
$file ;;
6428 # Skip this library if it cannot be dlopened.
6429 if test -z "$dlname"; then
6430 # Warn if it was a shared library.
6431 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6435 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6436 test "X$dir" = "X$file" && dir
=.
6438 if test -f "$dir/$objdir/$dlname"; then
6441 if test ! -f "$dir/$dlname"; then
6442 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6449 # Just add the directory containing the .lo file.
6450 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6451 test "X$dir" = "X$file" && dir
=.
6455 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6460 # Get the absolute pathname.
6461 absdir
=`cd "$dir" && pwd`
6462 test -n "$absdir" && dir
="$absdir"
6464 # Now add the directory to shlibpath_var.
6465 if eval "test -z \"\$$shlibpath_var\""; then
6466 eval "$shlibpath_var=\"\$dir\""
6468 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6472 # This variable tells wrapper scripts just to set shlibpath_var
6473 # rather than running their programs.
6474 libtool_execute_magic
="$magic"
6476 # Check if any of the arguments is a wrapper script.
6483 # Do a test to see if this is really a libtool program.
6484 if (${SED} -e '4q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6485 # If there is no directory component, then add one.
6487 */* |
*\\*) .
$file ;;
6491 # Transform arg to wrapped name.
6492 file="$progdir/$program"
6496 # Quote arguments (to preserve shell metacharacters).
6497 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6498 args
="$args \"$file\""
6501 if test -z "$run"; then
6502 if test -n "$shlibpath_var"; then
6503 # Export the shlibpath_var.
6504 eval "export $shlibpath_var"
6507 # Restore saved environment variables
6508 for lt_var
in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6510 eval "if test \"\${save_$lt_var+set}\" = set; then
6511 $lt_var=\$save_$lt_var; export $lt_var
6515 # Now prepare to actually exec the command.
6516 exec_cmd
="\$cmd$args"
6518 # Display what would be done.
6519 if test -n "$shlibpath_var"; then
6520 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6521 $echo "export $shlibpath_var"
6528 # libtool clean and uninstall mode
6530 modename
="$modename: $mode"
6536 # This variable tells wrapper scripts just to set variables rather
6537 # than running their programs.
6538 libtool_install_magic
="$magic"
6543 -f) rm="$rm $arg"; rmforce
=yes ;;
6544 -*) rm="$rm $arg" ;;
6545 *) files
="$files $arg" ;;
6549 if test -z "$rm"; then
6550 $echo "$modename: you must specify an RM program" 1>&2
6557 origobjdir
="$objdir"
6558 for file in $files; do
6559 dir
=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6560 if test "X$dir" = "X$file"; then
6562 objdir
="$origobjdir"
6564 objdir
="$dir/$origobjdir"
6566 name
=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6567 test "$mode" = uninstall
&& objdir
="$dir"
6569 # Remember objdir for removal later, being careful to avoid duplicates
6570 if test "$mode" = clean
; then
6573 *) rmdirs
="$rmdirs $objdir" ;;
6577 # Don't error if the file doesn't exist and rm -f was used.
6578 if (test -L "$file") >/dev
/null
2>&1 \
6579 ||
(test -h "$file") >/dev
/null
2>&1 \
6580 ||
test -f "$file"; then
6582 elif test -d "$file"; then
6585 elif test "$rmforce" = yes; then
6593 # Possibly a libtool archive, so verify it.
6594 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6597 # Delete the libtool libraries and symlinks.
6598 for n
in $library_names; do
6599 rmfiles
="$rmfiles $objdir/$n"
6601 test -n "$old_library" && rmfiles
="$rmfiles $objdir/$old_library"
6605 case " $library_names " in
6606 # " " in the beginning catches empty $dlname
6608 *) rmfiles
="$rmfiles $objdir/$dlname" ;;
6610 test -n "$libdir" && rmfiles
="$rmfiles $objdir/$name $objdir/${name}i"
6613 if test -n "$library_names"; then
6614 # Do each command in the postuninstall commands.
6615 cmds
=$postuninstall_cmds
6616 save_ifs
="$IFS"; IFS
='~'
6617 for cmd
in $cmds; do
6622 if test "$?" -ne 0 && test "$rmforce" != yes; then
6629 if test -n "$old_library"; then
6630 # Do each command in the old_postuninstall commands.
6631 cmds
=$old_postuninstall_cmds
6632 save_ifs
="$IFS"; IFS
='~'
6633 for cmd
in $cmds; do
6638 if test "$?" -ne 0 && test "$rmforce" != yes; then
6644 # FIXME: should reinstall the best remaining shared library.
6651 # Possibly a libtool object, so verify it.
6652 if (${SED} -e '2q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6657 # Add PIC object to the list of files to remove.
6658 if test -n "$pic_object" \
6659 && test "$pic_object" != none
; then
6660 rmfiles
="$rmfiles $dir/$pic_object"
6663 # Add non-PIC object to the list of files to remove.
6664 if test -n "$non_pic_object" \
6665 && test "$non_pic_object" != none
; then
6666 rmfiles
="$rmfiles $dir/$non_pic_object"
6672 if test "$mode" = clean
; then
6676 file=`$echo $file|${SED} 's,.exe$,,'`
6677 noexename
=`$echo $name|${SED} 's,.exe$,,'`
6678 # $file with .exe has already been added to rmfiles,
6679 # add $file without .exe
6680 rmfiles
="$rmfiles $file"
6683 # Do a test to see if this is a libtool program.
6684 if (${SED} -e '4q' $file |
grep "^# Generated by .*$PACKAGE") >/dev
/null
2>&1; then
6688 # note $name still contains .exe if it was in $file originally
6689 # as does the version of $file that was added into $rmfiles
6690 rmfiles
="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6691 if test "$fast_install" = yes && test -n "$relink_command"; then
6692 rmfiles
="$rmfiles $objdir/lt-$name"
6694 if test "X$noexename" != "X$name" ; then
6695 rmfiles
="$rmfiles $objdir/lt-${noexename}.c"
6701 $show "$rm $rmfiles"
6702 $run $rm $rmfiles || exit_status
=1
6704 objdir
="$origobjdir"
6706 # Try to remove the ${objdir}s in the directories where we deleted files
6707 for dir
in $rmdirs; do
6708 if test -d "$dir"; then
6710 $run rmdir $dir >/dev
/null
2>&1
6718 $echo "$modename: you must specify a MODE" 1>&2
6719 $echo "$generic_help" 1>&2
6724 if test -z "$exec_cmd"; then
6725 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6726 $echo "$generic_help" 1>&2
6729 fi # test -z "$show_help"
6731 if test -n "$exec_cmd"; then
6736 # We need to display help for each of the modes.
6739 "Usage: $modename [OPTION]... [MODE-ARG]...
6741 Provide generalized library-building support services.
6743 --config show all configuration variables
6744 --debug enable verbose shell tracing
6745 -n, --dry-run display commands without modifying any files
6746 --features display basic configuration information and exit
6747 --finish same as \`--mode=finish'
6748 --help display this help message and exit
6749 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6750 --quiet same as \`--silent'
6751 --silent don't print informational messages
6752 --tag=TAG use configuration variables from tag TAG
6753 --version print version information
6755 MODE must be one of the following:
6757 clean remove files from the build directory
6758 compile compile a source file into a libtool object
6759 execute automatically set library path, then run a program
6760 finish complete the installation of libtool libraries
6761 install install libraries or executables
6762 link create a library or an executable
6763 uninstall remove libraries from an installed directory
6765 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6766 a more detailed description of MODE.
6768 Report bugs to <bug-libtool@gnu.org>."
6774 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6776 Remove files from the build directory.
6778 RM is the name of the program to use to delete files associated with each FILE
6779 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6782 If FILE is a libtool library, object or program, all the files associated
6783 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6788 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6790 Compile a source file into a libtool library object.
6792 This mode accepts the following additional options:
6794 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6795 -prefer-pic try to building PIC objects only
6796 -prefer-non-pic try to building non-PIC objects only
6797 -static always build a \`.o' file suitable for static linking
6799 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6800 from the given SOURCEFILE.
6802 The output file name is determined by removing the directory component from
6803 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6804 library object suffix, \`.lo'."
6809 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6811 Automatically set library path, then run a program.
6813 This mode accepts the following additional options:
6815 -dlopen FILE add the directory containing FILE to the library path
6817 This mode sets the library path environment variable according to \`-dlopen'
6820 If any of the ARGS are libtool executable wrappers, then they are translated
6821 into their corresponding uninstalled binary, and any of their required library
6822 directories are added to the library path.
6824 Then, COMMAND is executed, with ARGS as arguments."
6829 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6831 Complete the installation of libtool libraries.
6833 Each LIBDIR is a directory that contains libtool libraries.
6835 The commands that this mode executes may require superuser privileges. Use
6836 the \`--dry-run' option if you just want to see what would be executed."
6841 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6843 Install executables or libraries.
6845 INSTALL-COMMAND is the installation command. The first component should be
6846 either the \`install' or \`cp' program.
6848 The rest of the components are interpreted as arguments to that command (only
6849 BSD-compatible install options are recognized)."
6854 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6856 Link object files or libraries together to form another library, or to
6857 create an executable program.
6859 LINK-COMMAND is a command using the C compiler that you would use to create
6860 a program from several object files.
6862 The following components of LINK-COMMAND are treated specially:
6864 -all-static do not do any dynamic linking at all
6865 -avoid-version do not add a version suffix if possible
6866 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6867 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6868 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6869 -export-symbols SYMFILE
6870 try to export only the symbols listed in SYMFILE
6871 -export-symbols-regex REGEX
6872 try to export only the symbols matching REGEX
6873 -LLIBDIR search LIBDIR for required installed libraries
6874 -lNAME OUTPUT-FILE requires the installed library libNAME
6875 -module build a library that can dlopened
6876 -no-fast-install disable the fast-install mode
6877 -no-install link a not-installable executable
6878 -no-undefined declare that a library does not refer to external symbols
6879 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6880 -objectlist FILE Use a list of object files found in FILE to specify objects
6881 -precious-files-regex REGEX
6882 don't remove output files matching REGEX
6883 -release RELEASE specify package release information
6884 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6885 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6886 -static do not do any dynamic linking of uninstalled libtool libraries
6887 -static-libtool-libs
6888 do not do any dynamic linking of libtool libraries
6889 -version-info CURRENT[:REVISION[:AGE]]
6890 specify library version info [each variable defaults to 0]
6892 All other options (arguments beginning with \`-') are ignored.
6894 Every other argument is treated as a filename. Files ending in \`.la' are
6895 treated as uninstalled libtool libraries, other files are standard or library
6898 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6899 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6900 required, except when creating a convenience library.
6902 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6903 using \`ar' and \`ranlib', or on Windows using \`lib'.
6905 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6906 is created, otherwise an executable program is created."
6911 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6913 Remove libraries from an installation directory.
6915 RM is the name of the program to use to delete files associated with each FILE
6916 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6919 If FILE is a libtool library, all the files associated with it are deleted.
6920 Otherwise, only FILE itself is deleted using RM."
6924 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6931 $echo "Try \`$modename --help' for more information about other modes."
6935 # The TAGs below are defined such that we never get into a situation
6936 # in which we disable both kinds of libraries. Given conflicting
6937 # choices, we go for a static library, that is the most portable,
6938 # since we can't tell whether shared libraries were disabled because
6939 # the user asked for that or because the platform doesn't support
6940 # them. This is particularly important on AIX, because we don't
6941 # support having both static and shared libraries enabled at the same
6942 # time on that platform, so we default to a shared-only configuration.
6943 # If a disable-shared tag is given, we'll fallback to a static-only
6944 # configuration. But we'll never go from static-only to shared-only.
6946 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6948 # ### END LIBTOOL TAG CONFIG: disable-shared
6950 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6952 # ### END LIBTOOL TAG CONFIG: disable-static