1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5
# 2007 Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
# is ksh but when the shell is invoked as "sh" and the current value of
31
# the _XPG environment variable is not equal to 1 (one), the special
32
# positional parameter $0, within a function call, is the name of the
36
# The name of this program:
37
progname=`echo "$progpath" | $SED $basename`
47
TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54
# is contrary to our usage. Disable this feature.
55
alias -g '${1+"$@"}'='"$@"'
58
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60
BIN_SH=xpg4; export BIN_SH # for Tru64
61
DUALCASE=1; export DUALCASE # for MKS sh
63
# Check that we have a working $echo.
64
if test "X$1" = X--no-reexec; then
65
# Discard the --no-reexec flag, and continue.
67
elif test "X$1" = X--fallback-echo; then
68
# Avoid inline document here, it may be left over
70
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71
# Yippee, $echo works!
74
# Restart under the correct shell, and then maybe $echo will work.
75
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78
if test "X$1" = X--fallback-echo; then
79
# used as fallback echo
88
help="Try \`$progname --help' for more information."
89
magic="%%%MAGIC variable%%%"
94
# Sed substitution that helps us do robust quoting. It backslashifies
95
# metacharacters that are still active within double-quoted strings.
96
Xsed="${SED}"' -e 1s/^X//'
97
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98
# test EBCDIC or ASCII
99
case `echo X|tr X '\101'` in
100
A) # ASCII based system
101
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103
NL2SP='tr \015\012 \040\040'
105
*) # EBCDIC based system
107
NL2SP='tr \r\n \100\100'
112
# Only set LANG and LC_ALL to C if already set.
113
# These must not be set unconditionally because not all systems understand
114
# e.g. LANG=C (notably SCO).
115
# We save the old values to restore during execute mode.
116
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118
eval "if test \"\${$lt_var+set}\" = set; then
119
save_$lt_var=\$$lt_var
125
# Make sure IFS has a sensible default
130
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131
$echo "$modename: not configured to build any kind of library" 1>&2
132
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
147
lo2o="s/\\.lo\$/.${objext}/"
148
o2lo="s/\\.${objext}\$/.lo/"
152
#####################################
153
# Shell function definitions:
154
# This seems to be the best place for them
156
# func_mktempdir [string]
157
# Make a temporary directory that won't clash with other running
158
# libtool processes, and avoids race conditions if possible. If
159
# given, STRING is the basename for that directory.
162
my_template="${TMPDIR-/tmp}/${1-$progname}"
164
if test "$run" = ":"; then
165
# Return a directory name, but don't create it in dry-run mode
166
my_tmpdir="${my_template}-$$"
169
# If mktemp works, use that first and foremost
170
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172
if test ! -d "$my_tmpdir"; then
173
# Failing that, at least try and use $RANDOM to avoid a race
174
my_tmpdir="${my_template}-${RANDOM-0}$$"
176
save_mktempdir_umask=`umask`
179
umask $save_mktempdir_umask
182
# If we're not in dry-run mode, bomb out on failure
183
test -d "$my_tmpdir" || {
184
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
189
$echo "X$my_tmpdir" | $Xsed
193
# func_win32_libid arg
194
# return the library type of file 'arg'
196
# Need a lot of goo to handle *both* DLLs and import libs
197
# Has to be a shell function in order to 'eat' the argument
198
# that is supplied when $file_magic_command is called.
201
win32_libid_type="unknown"
202
win32_fileres=`file -L $1 2>/dev/null`
203
case $win32_fileres in
204
*ar\ archive\ import\ library*) # definitely import
205
win32_libid_type="x86 archive import"
207
*ar\ archive*) # could be an import, or static
208
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210
win32_nmres=`eval $NM -f posix -A $1 | \
219
import*) win32_libid_type="x86 archive import";;
220
*) win32_libid_type="x86 archive static";;
225
win32_libid_type="x86 DLL"
227
*executable*) # but shell scripts are "executable" too...
228
case $win32_fileres in
229
*MS\ Windows\ PE\ Intel*)
230
win32_libid_type="x86 DLL"
235
$echo $win32_libid_type
240
# Infer tagged configuration to use if any are available and
241
# if one wasn't chosen via the "--tag" command line option.
242
# Only attempt this if the compiler in the base compile
243
# command doesn't match the default compiler.
244
# arg is usually of the form 'gcc ...'
247
# FreeBSD-specific: where we install compilers with non-standard names
248
tag_compilers_CC="*cc cc* *gcc gcc*"
249
tag_compilers_CXX="*c++ c++* *g++ g++*"
250
base_compiler=`set -- "$@"; echo $1`
252
# If $tagname isn't set, then try to infer if the default "CC" tag applies
253
if test -z "$tagname"; then
254
for zp in $tag_compilers_CC; do
255
case $base_compiler in
256
$zp) tagname="CC"; break;;
261
if test -n "$available_tags" && test -z "$tagname"; then
265
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
269
CC_quoted="$CC_quoted $arg"
272
# Blanks in the command may have been stripped by the calling shell,
273
# but not from the CC environment variable when configure was run.
274
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
275
# Blanks at the start of $base_compile will cause this to fail
276
# if we don't check for them as well.
278
for z in $available_tags; do
279
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
280
# Evaluate the configuration.
281
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
284
# Double-quote args containing other shell metacharacters.
286
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
290
CC_quoted="$CC_quoted $arg"
293
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
294
# The compiler in the base compile command matches
295
# the one in the tagged configuration.
296
# Assume this is the tagged configuration we want.
302
# FreeBSD-specific: try compilers based on inferred tag
303
if test -z "$tagname"; then
304
eval "tag_compilers=\$tag_compilers_${z}"
305
if test -n "$tag_compilers"; then
306
for zp in $tag_compilers; do
307
case $base_compiler in
308
$zp) tagname=$z; break;;
311
if test -n "$tagname"; then
318
# If $tagname still isn't set, then no tagged configuration
319
# was found and let the user know that the "--tag" command
320
# line option must be used.
321
if test -z "$tagname"; then
322
$echo "$modename: unable to infer tagged configuration"
323
$echo "$modename: specify a tag with \`--tag'" 1>&2
326
# $echo "$modename: using $tagname tagged configuration"
334
# func_extract_an_archive dir oldlib
335
func_extract_an_archive ()
337
f_ex_an_ar_dir="$1"; shift
338
f_ex_an_ar_oldlib="$1"
340
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
341
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
342
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
345
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
350
# func_extract_archives gentop oldlib ...
351
func_extract_archives ()
353
my_gentop="$1"; shift
361
$show "${rm}r $my_gentop"
362
$run ${rm}r "$my_gentop"
363
$show "$mkdir $my_gentop"
364
$run $mkdir "$my_gentop"
366
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
370
for my_xlib in $my_oldlibs; do
371
# Extract the objects.
373
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
374
*) my_xabs=`pwd`"/$my_xlib" ;;
376
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
379
case " $extracted_archives " in
381
extracted_serial=`expr $extracted_serial + 1`
382
my_xlib_u=lt$extracted_serial-$my_xlib ;;
386
extracted_archives="$extracted_archives $my_xlib_u"
387
my_xdir="$my_gentop/$my_xlib_u"
389
$show "${rm}r $my_xdir"
390
$run ${rm}r "$my_xdir"
391
$show "$mkdir $my_xdir"
392
$run $mkdir "$my_xdir"
394
if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
399
$show "Extracting $my_xabs"
400
# Do not bother doing anything if just a dry run
401
if test -z "$run"; then
402
darwin_orig_dir=`pwd`
403
cd $my_xdir || exit $?
404
darwin_archive=$my_xabs
406
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
407
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
408
if test -n "$darwin_arches"; then
409
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
411
$show "$darwin_base_archive has multiple architectures $darwin_arches"
412
for darwin_arch in $darwin_arches ; do
413
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
414
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
415
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
416
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
418
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
419
done # $darwin_arches
420
## Okay now we have a bunch of thin objects, gotta fatten them up :)
421
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
424
for darwin_file in $darwin_filelist; do
425
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
426
lipo -create -output "$darwin_file" $darwin_files
427
done # $darwin_filelist
429
cd "$darwin_orig_dir"
431
cd "$darwin_orig_dir"
432
func_extract_an_archive "$my_xdir" "$my_xabs"
437
func_extract_an_archive "$my_xdir" "$my_xabs"
440
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
442
func_extract_archives_result="$my_oldobjs"
444
# End of Shell function definitions
445
#####################################
448
eval std_shrext=\"$shrext_cmds\"
452
# Parse our command line options once, thoroughly.
453
while test "$#" -gt 0
459
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
463
# If the previous option needs an argument, assign it.
464
if test -n "$prev"; then
467
execute_dlfiles="$execute_dlfiles $arg"
471
preserve_args="${preserve_args}=$arg"
473
# Check whether tagname contains only valid characters
476
$echo "$progname: invalid tag name: $tagname" 1>&2
483
# Don't test for the "default" C tag, as we know, it's there, but
484
# not specially marked.
487
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
488
taglist="$taglist $tagname"
489
# Evaluate the configuration.
490
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
492
$echo "$progname: ignoring unknown tag $tagname" 1>&2
507
# Have we seen a non-optional argument yet?
515
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
517
Copyright (C) 2007 Free Software Foundation, Inc.
518
This is free software; see the source for copying conditions. There is NO
519
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
524
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
525
# Now print the configurations for the tags.
526
for tagname in $taglist; do
527
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
533
$echo "$progname: enabling shell trace mode"
535
preserve_args="$preserve_args $arg"
544
if test "$build_libtool_libs" = yes; then
545
$echo "enable shared libraries"
547
$echo "disable shared libraries"
549
if test "$build_old_libs" = yes; then
550
$echo "enable static libraries"
552
$echo "disable static libraries"
557
--finish) mode="finish" ;;
559
--mode) prevopt="--mode" prev=mode ;;
560
--mode=*) mode="$optarg" ;;
562
--preserve-dup-deps) duplicate_deps="yes" ;;
566
preserve_args="$preserve_args $arg"
572
preserve_args="$preserve_args --tag"
575
set tag "$optarg" ${1+"$@"}
578
preserve_args="$preserve_args --tag"
587
$echo "$modename: unrecognized option \`$arg'" 1>&2
599
if test -n "$prevopt"; then
600
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
605
case $disable_libs in
609
build_libtool_libs=no
613
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
617
# If this variable is set in any of the actions, the command in it
618
# will be execed at the end. This prevents here-documents from being
619
# left over by shells.
622
if test -z "$show_help"; then
624
# Infer the operation mode.
625
if test -z "$mode"; then
626
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
627
$echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
629
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
641
*db | *dbx | *strace | *truss)
651
# If we have no mode, but dlfiles were specified, then do execute mode.
652
test -n "$execute_dlfiles" && mode=execute
654
# Just use the default operation mode.
655
if test -z "$mode"; then
656
if test -n "$nonopt"; then
657
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
659
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
666
# Only execute mode is allowed to have -dlopen flags.
667
if test -n "$execute_dlfiles" && test "$mode" != execute; then
668
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
673
# Change the help message to a mode-specific one.
675
help="Try \`$modename --help --mode=$mode' for more information."
677
# These modes are in order of execution frequency so that they run quickly.
679
# libtool compile mode
681
modename="$modename: compile"
682
# Get the compilation command and the source file.
684
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
695
# do not "continue". Instead, add this to base_compile
707
# Accept any command-line options.
710
if test -n "$libobj" ; then
711
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
718
-static | -prefer-pic | -prefer-non-pic)
729
arg_mode=arg # the next one goes into the "base_compile" arg list
730
continue # The current "srcfile" will either be retained or
731
;; # replaced later. I would guess that would be a bug.
734
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
736
save_ifs="$IFS"; IFS=','
740
# Double-quote args containing other shell metacharacters.
741
# Many Bourne shells cannot handle close brackets correctly
742
# in scan sets, so we specify it separately.
744
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
748
lastarg="$lastarg $arg"
751
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
753
# Add the arguments to base_compile.
754
base_compile="$base_compile $lastarg"
759
# Accept the current argument as the source file.
760
# The previous "srcfile" becomes the current argument.
767
esac # case $arg_mode
769
# Aesthetically quote the previous argument.
770
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
773
# Double-quote args containing other shell metacharacters.
774
# Many Bourne shells cannot handle close brackets correctly
775
# in scan sets, and some SunOS ksh mistreat backslash-escaping
776
# in scan sets (worked around with variable expansion),
777
# and furthermore cannot handle '|' '&' '(' ')' in scan sets
778
# at all, so we specify them separately.
779
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
780
lastarg="\"$lastarg\""
784
base_compile="$base_compile $lastarg"
789
$echo "$modename: you must specify an argument for -Xcompile"
793
$echo "$modename: you must specify a target with \`-o'" 1>&2
797
# Get the name of the library object.
798
[ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
802
# Recognize several different file suffixes.
803
# If the user specifies -o file.o, it is replaced with file.lo
813
*.class) xform=class ;;
816
*.[fF][09]?) xform=[fF][09]. ;;
818
*.java) xform=java ;;
822
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
825
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
827
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
832
func_infer_tag $base_compile
834
for arg in $later; do
853
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
855
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
856
qlibobj="\"$qlibobj\"" ;;
858
test "X$libobj" != "X$qlibobj" \
859
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
860
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
861
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
862
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
863
if test "X$xdir" = "X$obj"; then
868
lobj=${xdir}$objdir/$objname
870
if test -z "$base_compile"; then
871
$echo "$modename: you must specify a compilation command" 1>&2
876
# Delete any leftover library objects.
877
if test "$build_old_libs" = yes; then
878
removelist="$obj $lobj $libobj ${libobj}T"
880
removelist="$lobj $libobj ${libobj}T"
884
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
886
# On Cygwin there's no "real" PIC flag so we must build both object types
888
cygwin* | mingw* | pw32* | os2*)
892
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
893
# non-PIC code in shared libraries is not supported
897
# Calculate the filename of the output object if compiler does
898
# not support -o with -c
899
if test "$compiler_c_o" = no; then
900
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
901
lockfile="$output_obj.lock"
902
removelist="$removelist $output_obj $lockfile"
903
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
910
# Lock this critical section if it is needed
911
# We use this script file to make the link, it avoids creating a new file
912
if test "$need_locks" = yes; then
913
until $run ln "$progpath" "$lockfile" 2>/dev/null; do
914
$show "Waiting for $lockfile to be removed"
917
elif test "$need_locks" = warn; then
918
if test -f "$lockfile"; then
920
*** ERROR, $lockfile exists and contains:
921
`cat $lockfile 2>/dev/null`
923
This indicates that another process is trying to use the same
924
temporary object file, and libtool could not work around it because
925
your compiler does not support \`-c' and \`-o' together. If you
926
repeat this compilation, it may succeed, by chance, but you had better
927
avoid parallel builds (make -j) in this platform, or get a better
933
$echo "$srcfile" > "$lockfile"
936
if test -n "$fix_srcfile_path"; then
937
eval srcfile=\"$fix_srcfile_path\"
939
qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
941
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
942
qsrcfile="\"$qsrcfile\"" ;;
945
$run $rm "$libobj" "${libobj}T"
947
# Create a libtool object file (analogous to a ".la" file),
948
# but don't create it if we're doing a dry run.
949
test -z "$run" && cat > ${libobj}T <<EOF
950
# $libobj - a libtool object file
951
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
953
# Please DO NOT delete this file!
954
# It is necessary for linking the library.
956
# Name of the PIC object.
959
# Only build a PIC object if we are building libtool libraries.
960
if test "$build_libtool_libs" = yes; then
961
# Without this assignment, base_compile gets emptied.
962
fbsd_hideous_sh_bug=$base_compile
964
if test "$pic_mode" != no; then
965
command="$base_compile $qsrcfile $pic_flag"
967
# Don't build PIC code
968
command="$base_compile $qsrcfile"
971
if test ! -d "${xdir}$objdir"; then
972
$show "$mkdir ${xdir}$objdir"
973
$run $mkdir ${xdir}$objdir
975
if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
980
if test -z "$output_obj"; then
981
# Place PIC objects in $objdir
982
command="$command -o $lobj"
985
$run $rm "$lobj" "$output_obj"
988
if $run eval "$command"; then :
990
test -n "$output_obj" && $run $rm $removelist
994
if test "$need_locks" = warn &&
995
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
997
*** ERROR, $lockfile contains:
998
`cat $lockfile 2>/dev/null`
1000
but it should contain:
1003
This indicates that another process is trying to use the same
1004
temporary object file, and libtool could not work around it because
1005
your compiler does not support \`-c' and \`-o' together. If you
1006
repeat this compilation, it may succeed, by chance, but you had better
1007
avoid parallel builds (make -j) in this platform, or get a better
1010
$run $rm $removelist
1014
# Just move the object if needed, then go on to compile the next one
1015
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1016
$show "$mv $output_obj $lobj"
1017
if $run $mv $output_obj $lobj; then :
1020
$run $rm $removelist
1025
# Append the name of the PIC object to the libtool object file.
1026
test -z "$run" && cat >> ${libobj}T <<EOF
1027
pic_object='$objdir/$objname'
1031
# Allow error messages only from the first compilation.
1032
if test "$suppress_opt" = yes; then
1033
suppress_output=' >/dev/null 2>&1'
1036
# No PIC object so indicate it doesn't exist in the libtool
1038
test -z "$run" && cat >> ${libobj}T <<EOF
1044
# Only build a position-dependent object if we build old libraries.
1045
if test "$build_old_libs" = yes; then
1046
if test "$pic_mode" != yes; then
1047
# Don't build PIC code
1048
command="$base_compile $qsrcfile"
1050
command="$base_compile $qsrcfile $pic_flag"
1052
if test "$compiler_c_o" = yes; then
1053
command="$command -o $obj"
1056
# Suppress compiler output if we already did a PIC compilation.
1057
command="$command$suppress_output"
1058
$run $rm "$obj" "$output_obj"
1060
if $run eval "$command"; then :
1062
$run $rm $removelist
1066
if test "$need_locks" = warn &&
1067
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1069
*** ERROR, $lockfile contains:
1070
`cat $lockfile 2>/dev/null`
1072
but it should contain:
1075
This indicates that another process is trying to use the same
1076
temporary object file, and libtool could not work around it because
1077
your compiler does not support \`-c' and \`-o' together. If you
1078
repeat this compilation, it may succeed, by chance, but you had better
1079
avoid parallel builds (make -j) in this platform, or get a better
1082
$run $rm $removelist
1086
# Just move the object if needed
1087
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1088
$show "$mv $output_obj $obj"
1089
if $run $mv $output_obj $obj; then :
1092
$run $rm $removelist
1097
# Append the name of the non-PIC object the libtool object file.
1098
# Only append if the libtool object file exists.
1099
test -z "$run" && cat >> ${libobj}T <<EOF
1100
# Name of the non-PIC object.
1101
non_pic_object='$objname'
1105
# Append the name of the non-PIC object the libtool object file.
1106
# Only append if the libtool object file exists.
1107
test -z "$run" && cat >> ${libobj}T <<EOF
1108
# Name of the non-PIC object.
1114
$run $mv "${libobj}T" "${libobj}"
1116
# Unlock the critical section if it was locked
1117
if test "$need_locks" != no; then
1118
$run $rm "$lockfile"
1126
modename="$modename: link"
1128
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1129
# It is impossible to link a dll without this setting, and
1130
# we shouldn't force the makefile maintainer to figure out
1131
# which system we are compiling for in order to pass an extra
1132
# flag for every libtool invocation.
1133
# allow_undefined=no
1135
# FIXME: Unfortunately, there are problems with the above when trying
1136
# to make a dll which has undefined symbols, in which case not
1137
# even a static library is built. For now, we need to specify
1138
# -no-undefined on the libtool link line when we can be certain
1139
# that all symbols are satisfied, otherwise we get a static library.
1146
libtool_args="$nonopt"
1147
base_compile="$nonopt $@"
1148
compile_command="$nonopt"
1149
finalize_command="$nonopt"
1162
lib_search_path=`pwd`
1171
export_symbols_regex=
1179
notinst_path= # paths that contain not-installed libtool libraries
1180
precious_files_regex=
1181
prefer_static_libs=no
1194
func_infer_tag $base_compile
1196
# We need to know -static, to get the right output filenames.
1200
-all-static | -static | -static-libtool-libs)
1203
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1204
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1206
if test -n "$link_static_flag"; then
1207
dlopen_self=$dlopen_self_static
1209
prefer_static_libs=yes
1212
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1213
dlopen_self=$dlopen_self_static
1215
prefer_static_libs=built
1217
-static-libtool-libs)
1218
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1219
dlopen_self=$dlopen_self_static
1221
prefer_static_libs=yes
1224
build_libtool_libs=no
1231
# See if our shared archives depend on static archives.
1232
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1234
# Go through the arguments, transforming them on the way.
1235
while test "$#" -gt 0; do
1239
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1240
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1244
libtool_args="$libtool_args $qarg"
1246
# If the previous option needs an argument, assign it.
1247
if test -n "$prev"; then
1250
compile_command="$compile_command @OUTPUT@"
1251
finalize_command="$finalize_command @OUTPUT@"
1257
if test "$preload" = no; then
1258
# Add the symbol object into the linking commands.
1259
compile_command="$compile_command @SYMFILE@"
1260
finalize_command="$finalize_command @SYMFILE@"
1264
*.la | *.lo) ;; # We handle these cases below.
1266
if test "$dlself" = no; then
1274
if test "$prev" = dlprefiles; then
1276
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1286
if test "$prev" = dlfiles; then
1287
dlfiles="$dlfiles $arg"
1289
dlprefiles="$dlprefiles $arg"
1297
export_symbols="$arg"
1298
if test ! -f "$arg"; then
1299
$echo "$modename: symbol file \`$arg' does not exist"
1306
export_symbols_regex="$arg"
1311
inst_prefix_dir="$arg"
1316
precious_files_regex="$arg"
1326
if test -f "$arg"; then
1329
for fil in `cat $save_arg`
1331
# moreargs="$moreargs $fil"
1333
# A libtool-controlled object.
1335
# Check to see that this really is a libtool object.
1336
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1341
# If there is no directory component, then add one.
1343
*/* | *\\*) . $arg ;;
1347
if test -z "$pic_object" || \
1348
test -z "$non_pic_object" ||
1349
test "$pic_object" = none && \
1350
test "$non_pic_object" = none; then
1351
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1355
# Extract subdirectory from the argument.
1356
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1357
if test "X$xdir" = "X$arg"; then
1363
if test "$pic_object" != none; then
1364
# Prepend the subdirectory the object is found in.
1365
pic_object="$xdir$pic_object"
1367
if test "$prev" = dlfiles; then
1368
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1369
dlfiles="$dlfiles $pic_object"
1373
# If libtool objects are unsupported, then we need to preload.
1378
# CHECK ME: I think I busted this. -Ossama
1379
if test "$prev" = dlprefiles; then
1380
# Preload the old-style object.
1381
dlprefiles="$dlprefiles $pic_object"
1386
libobjs="$libobjs $pic_object"
1391
if test "$non_pic_object" != none; then
1392
# Prepend the subdirectory the object is found in.
1393
non_pic_object="$xdir$non_pic_object"
1395
# A standard non-PIC object
1396
non_pic_objects="$non_pic_objects $non_pic_object"
1397
if test -z "$pic_object" || test "$pic_object" = none ; then
1398
arg="$non_pic_object"
1401
# If the PIC object exists, use it instead.
1402
# $xdir was prepended to $pic_object above.
1403
non_pic_object="$pic_object"
1404
non_pic_objects="$non_pic_objects $non_pic_object"
1407
# Only an error if not doing a dry-run.
1408
if test -z "$run"; then
1409
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1414
# Extract subdirectory from the argument.
1415
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1416
if test "X$xdir" = "X$arg"; then
1422
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1423
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1424
libobjs="$libobjs $pic_object"
1425
non_pic_objects="$non_pic_objects $non_pic_object"
1430
$echo "$modename: link input file \`$save_arg' does not exist"
1438
# We need an absolute path.
1440
[\\/]* | [A-Za-z]:[\\/]*) ;;
1442
$echo "$modename: only absolute run-paths are allowed" 1>&2
1446
if test "$prev" = rpath; then
1449
*) rpath="$rpath $arg" ;;
1454
*) xrpath="$xrpath $arg" ;;
1461
compiler_flags="$compiler_flags $qarg"
1463
compile_command="$compile_command $qarg"
1464
finalize_command="$finalize_command $qarg"
1468
linker_flags="$linker_flags $qarg"
1469
compiler_flags="$compiler_flags $wl$qarg"
1471
compile_command="$compile_command $wl$qarg"
1472
finalize_command="$finalize_command $wl$qarg"
1476
linker_flags="$linker_flags $qarg"
1477
compiler_flags="$compiler_flags $qarg"
1479
compile_command="$compile_command $qarg"
1480
finalize_command="$finalize_command $qarg"
1488
darwin_framework|darwin_framework_skip)
1489
test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1490
compile_command="$compile_command $arg"
1491
finalize_command="$finalize_command $arg"
1496
eval "$prev=\"\$arg\""
1501
fi # test -n "$prev"
1507
if test -n "$link_static_flag"; then
1508
compile_command="$compile_command $link_static_flag"
1509
finalize_command="$finalize_command $link_static_flag"
1515
# FIXME: remove this flag sometime in the future.
1516
$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1540
-export-symbols | -export-symbols-regex)
1541
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1542
$echo "$modename: more than one -exported-symbols argument is not allowed"
1545
if test "X$arg" = "X-export-symbols"; then
1553
-framework|-arch|-isysroot)
1555
*" ${arg} ${1} "* | *" ${arg} ${1} "*)
1556
prev=darwin_framework_skip ;;
1557
*) compiler_flags="$compiler_flags $arg"
1558
prev=darwin_framework ;;
1560
compile_command="$compile_command $arg"
1561
finalize_command="$finalize_command $arg"
1570
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1571
# so, if we see these flags be careful not to treat them like -L
1573
case $with_gcc/$host in
1574
no/*-*-irix* | /*-*-irix*)
1575
compile_command="$compile_command $arg"
1576
finalize_command="$finalize_command $arg"
1583
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1584
# We need an absolute path.
1586
[\\/]* | [A-Za-z]:[\\/]*) ;;
1588
absdir=`cd "$dir" && pwd`
1589
if test -z "$absdir"; then
1590
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1592
notinst_path="$notinst_path $dir"
1600
deplibs="$deplibs -L$dir"
1601
lib_search_path="$lib_search_path $dir"
1605
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1606
testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1607
case :$dllsearchpath: in
1609
*) dllsearchpath="$dllsearchpath:$dir";;
1611
case :$dllsearchpath: in
1612
*":$testbindir:"*) ;;
1613
*) dllsearchpath="$dllsearchpath:$testbindir";;
1621
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1623
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1624
# These systems don't actually have a C or math library (as such)
1628
# These systems don't actually have a C library (as such)
1629
test "X$arg" = "X-lc" && continue
1631
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1632
# Do not include libc due to us having libc/libc_r.
1633
test "X$arg" = "X-lc" && continue
1635
*-*-rhapsody* | *-*-darwin1.[012])
1636
# Rhapsody C and math libraries are in the System framework
1637
deplibs="$deplibs -framework System"
1640
*-*-sco3.2v5* | *-*-sco5v6*)
1641
# Causes problems with __ctype
1642
test "X$arg" = "X-lc" && continue
1644
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1645
# Compiler inserts libc in the correct place for threads to work
1646
test "X$arg" = "X-lc" && continue
1649
elif test "X$arg" = "X-lc_r"; then
1651
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1652
# Do not include libc_r directly, use -pthread flag.
1657
deplibs="$deplibs $arg"
1661
# Tru64 UNIX uses -model [arg] to determine the layout of C++
1662
# classes, name mangling, and exception handling.
1664
compile_command="$compile_command $arg"
1665
compiler_flags="$compiler_flags $arg"
1666
finalize_command="$finalize_command $arg"
1671
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1672
compiler_flags="$compiler_flags $arg"
1673
compile_command="$compile_command $arg"
1674
finalize_command="$finalize_command $arg"
1675
deplibs="$deplibs $arg"
1684
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1685
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1686
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1687
# +DA*, +DD* enable 64-bit mode on the HP compiler
1688
# -q* pass through compiler args for the IBM compiler
1689
# -m* pass through architecture-specific compiler args for GCC
1690
# -m*, -t[45]*, -txscale* pass through architecture-specific
1691
# compiler args for GCC
1692
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1693
# -F/path gives path to uninstalled frameworks, gcc on darwin
1694
# @file GCC response files
1695
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1696
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1698
# Unknown arguments in both finalize_command and compile_command need
1699
# to be aesthetically quoted because they are evaled later.
1700
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1702
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1706
compile_command="$compile_command $arg"
1707
finalize_command="$finalize_command $arg"
1708
compiler_flags="$compiler_flags $arg"
1724
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1725
# The PATH hackery in wrapper scripts is required on Windows
1726
# and Darwin in order for the loader to find any dlls it needs.
1727
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1728
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1731
*) no_install=yes ;;
1748
-precious-files-regex)
1769
dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1770
# We need an absolute path.
1772
[\\/]* | [A-Za-z]:[\\/]*) ;;
1774
$echo "$modename: only absolute run-paths are allowed" 1>&2
1780
*) xrpath="$xrpath $dir" ;;
1785
-static | -static-libtool-libs)
1786
# The effects of -static are defined in a previous loop.
1787
# We used to do the same as -all-static on platforms that
1788
# didn't have a PIC flag, but the assumption that the effects
1789
# would be equivalent was wrong. It would break on at least
1790
# Digital Unix and AIX.
1810
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1812
save_ifs="$IFS"; IFS=','
1813
for flag in $args; do
1816
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1821
compiler_flags="$compiler_flags $flag"
1824
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1828
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1830
save_ifs="$IFS"; IFS=','
1831
for flag in $args; do
1834
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1839
compiler_flags="$compiler_flags $wl$flag"
1840
linker_flags="$linker_flags $flag"
1843
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1861
# Some other compiler flag.
1863
# Unknown arguments in both finalize_command and compile_command need
1864
# to be aesthetically quoted because they are evaled later.
1865
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1867
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1874
# A standard object.
1879
# A libtool-controlled object.
1881
# Check to see that this really is a libtool object.
1882
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1887
# If there is no directory component, then add one.
1889
*/* | *\\*) . $arg ;;
1893
if test -z "$pic_object" || \
1894
test -z "$non_pic_object" ||
1895
test "$pic_object" = none && \
1896
test "$non_pic_object" = none; then
1897
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1901
# Extract subdirectory from the argument.
1902
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1903
if test "X$xdir" = "X$arg"; then
1909
if test "$pic_object" != none; then
1910
# Prepend the subdirectory the object is found in.
1911
pic_object="$xdir$pic_object"
1913
if test "$prev" = dlfiles; then
1914
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1915
dlfiles="$dlfiles $pic_object"
1919
# If libtool objects are unsupported, then we need to preload.
1924
# CHECK ME: I think I busted this. -Ossama
1925
if test "$prev" = dlprefiles; then
1926
# Preload the old-style object.
1927
dlprefiles="$dlprefiles $pic_object"
1932
libobjs="$libobjs $pic_object"
1937
if test "$non_pic_object" != none; then
1938
# Prepend the subdirectory the object is found in.
1939
non_pic_object="$xdir$non_pic_object"
1941
# A standard non-PIC object
1942
non_pic_objects="$non_pic_objects $non_pic_object"
1943
if test -z "$pic_object" || test "$pic_object" = none ; then
1944
arg="$non_pic_object"
1947
# If the PIC object exists, use it instead.
1948
# $xdir was prepended to $pic_object above.
1949
non_pic_object="$pic_object"
1950
non_pic_objects="$non_pic_objects $non_pic_object"
1953
# Only an error if not doing a dry-run.
1954
if test -z "$run"; then
1955
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1960
# Extract subdirectory from the argument.
1961
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1962
if test "X$xdir" = "X$arg"; then
1968
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1969
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1970
libobjs="$libobjs $pic_object"
1971
non_pic_objects="$non_pic_objects $non_pic_object"
1978
deplibs="$deplibs $arg"
1979
old_deplibs="$old_deplibs $arg"
1984
# A libtool-controlled library.
1986
if test "$prev" = dlfiles; then
1987
# This library was specified with -dlopen.
1988
dlfiles="$dlfiles $arg"
1990
elif test "$prev" = dlprefiles; then
1991
# The library was specified with -dlpreopen.
1992
dlprefiles="$dlprefiles $arg"
1995
deplibs="$deplibs $arg"
2000
# Some other compiler argument.
2002
# Unknown arguments in both finalize_command and compile_command need
2003
# to be aesthetically quoted because they are evaled later.
2004
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2006
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2013
# Now actually substitute the argument into the commands.
2014
if test -n "$arg"; then
2015
compile_command="$compile_command $arg"
2016
finalize_command="$finalize_command $arg"
2018
done # argument parsing loop
2020
if test -n "$prev"; then
2021
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2026
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2027
eval arg=\"$export_dynamic_flag_spec\"
2028
compile_command="$compile_command $arg"
2029
finalize_command="$finalize_command $arg"
2033
# calculate the name of the file, without its directory
2034
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2035
libobjs_save="$libobjs"
2037
if test -n "$shlibpath_var"; then
2038
# get the directories listed in $shlibpath_var
2039
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2043
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2044
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2046
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2047
if test "X$output_objdir" = "X$output"; then
2048
output_objdir="$objdir"
2050
output_objdir="$output_objdir/$objdir"
2052
# Create the object directory.
2053
if test ! -d "$output_objdir"; then
2054
$show "$mkdir $output_objdir"
2055
$run $mkdir $output_objdir
2057
if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2062
# Determine the type of output
2065
$echo "$modename: you must specify an output file" 1>&2
2069
*.$libext) linkmode=oldlib ;;
2070
*.lo | *.$objext) linkmode=obj ;;
2071
*.la) linkmode=lib ;;
2072
*) linkmode=prog ;; # Anything else should be a program.
2076
*cygwin* | *mingw* | *pw32*)
2077
# don't eliminate duplications in $postdeps and $predeps
2078
duplicate_compiler_generated_deps=yes
2081
duplicate_compiler_generated_deps=$duplicate_deps
2087
# Find all interdependent deplibs by searching for libraries
2088
# that are linked more than once (e.g. -la -lb -la)
2089
for deplib in $deplibs; do
2090
if test "X$duplicate_deps" = "Xyes" ; then
2092
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2095
libs="$libs $deplib"
2098
if test "$linkmode" = lib; then
2099
libs="$predeps $libs $compiler_lib_search_path $postdeps"
2101
# Compute libraries that are listed more than once in $predeps
2102
# $postdeps and mark them as special (i.e., whose duplicates are
2103
# not to be eliminated).
2105
if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2106
for pre_post_dep in $predeps $postdeps; do
2107
case "$pre_post_deps " in
2108
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2110
pre_post_deps="$pre_post_deps $pre_post_dep"
2119
need_relink=no # whether we're linking any uninstalled libtool libraries
2120
notinst_deplibs= # not-installed libtool libraries
2124
for file in $dlfiles $dlprefiles; do
2128
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2140
passes="conv scan dlopen dlpreopen link"
2145
for pass in $passes; do
2146
if test "$linkmode,$pass" = "lib,link" ||
2147
test "$linkmode,$pass" = "prog,scan"; then
2151
if test "$linkmode" = prog; then
2153
dlopen) libs="$dlfiles" ;;
2154
dlpreopen) libs="$dlprefiles" ;;
2155
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2158
if test "$pass" = dlopen; then
2159
# Collect dlpreopened libraries
2160
save_deplibs="$deplibs"
2163
for deplib in $libs; do
2167
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2168
if test "$linkmode,$pass" = "prog,link"; then
2169
compile_deplibs="$deplib $compile_deplibs"
2170
finalize_deplibs="$deplib $finalize_deplibs"
2172
compiler_flags="$compiler_flags $deplib"
2177
deplibs="$deplib $deplibs"
2178
test "$pass" = conv && continue
2179
newdependency_libs="$deplib $newdependency_libs"
2182
if test "$pass" = conv; then
2183
deplibs="$deplib $deplibs"
2186
if test "$pass" = scan; then
2187
deplibs="$deplib $deplibs"
2189
compile_deplibs="$deplib $compile_deplibs"
2190
finalize_deplibs="$deplib $finalize_deplibs"
2200
if test "$linkmode" != lib && test "$linkmode" != prog; then
2201
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2204
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2205
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2206
for search_ext in .la $std_shrext .so .a; do
2207
# Search the libtool library
2208
lib="$searchdir/lib${name}${search_ext}"
2209
if test -f "$lib"; then
2210
if test "$search_ext" = ".la"; then
2219
if test "$found" != yes; then
2220
# deplib doesn't seem to be a libtool library
2221
if test "$linkmode,$pass" = "prog,link"; then
2222
compile_deplibs="$deplib $compile_deplibs"
2223
finalize_deplibs="$deplib $finalize_deplibs"
2225
deplibs="$deplib $deplibs"
2226
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2229
else # deplib is a libtool library
2230
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2231
# We need to do some special things here, and not later.
2232
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2233
case " $predeps $postdeps " in
2235
if (${SED} -e '2q' $lib |
2236
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2240
*/* | *\\*) . $lib ;;
2243
for l in $old_library $library_names; do
2246
if test "X$ll" = "X$old_library" ; then # only static version available
2248
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2249
test "X$ladir" = "X$lib" && ladir="."
2250
lib=$ladir/$old_library
2251
if test "$linkmode,$pass" = "prog,link"; then
2252
compile_deplibs="$deplib $compile_deplibs"
2253
finalize_deplibs="$deplib $finalize_deplibs"
2255
deplibs="$deplib $deplibs"
2256
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2270
deplibs="$deplib $deplibs"
2271
test "$pass" = conv && continue
2272
newdependency_libs="$deplib $newdependency_libs"
2273
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2276
if test "$pass" = conv; then
2277
deplibs="$deplib $deplibs"
2280
if test "$pass" = scan; then
2281
deplibs="$deplib $deplibs"
2283
compile_deplibs="$deplib $compile_deplibs"
2284
finalize_deplibs="$deplib $finalize_deplibs"
2286
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2289
$echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2295
if test "$pass" = link; then
2296
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2297
# Make sure the xrpath contains only unique directories.
2300
*) xrpath="$xrpath $dir" ;;
2303
deplibs="$deplib $deplibs"
2306
*.la) lib="$deplib" ;;
2308
if test "$pass" = conv; then
2309
deplibs="$deplib $deplibs"
2315
case $deplibs_check_method in
2317
set dummy $deplibs_check_method
2318
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2319
if eval $echo \"$deplib\" 2>/dev/null \
2321
| $EGREP "$match_pattern_regex" > /dev/null; then
2329
if test "$valid_a_lib" != yes; then
2331
$echo "*** Warning: Trying to link with static lib archive $deplib."
2332
$echo "*** I have the capability to make that library automatically link in when"
2333
$echo "*** you link to this library. But I can only do this if you have a"
2334
$echo "*** shared version of the library, which you do not appear to have"
2335
$echo "*** because the file extensions .$libext of this argument makes me believe"
2336
$echo "*** that it is just a static archive that I should not used here."
2339
$echo "*** Warning: Linking the shared library $output against the"
2340
$echo "*** static library $deplib is not portable!"
2341
deplibs="$deplib $deplibs"
2346
if test "$pass" != link; then
2347
deplibs="$deplib $deplibs"
2349
compile_deplibs="$deplib $compile_deplibs"
2350
finalize_deplibs="$deplib $finalize_deplibs"
2357
if test "$pass" = conv; then
2358
deplibs="$deplib $deplibs"
2359
elif test "$linkmode" = prog; then
2360
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2361
# If there is no dlopen support or we're linking statically,
2362
# we need to preload.
2363
newdlprefiles="$newdlprefiles $deplib"
2364
compile_deplibs="$deplib $compile_deplibs"
2365
finalize_deplibs="$deplib $finalize_deplibs"
2367
newdlfiles="$newdlfiles $deplib"
2377
if test "$found" = yes || test -f "$lib"; then :
2379
$echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2383
# Check to see that this really is a libtool archive.
2384
if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2386
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2390
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2391
test "X$ladir" = "X$lib" && ladir="."
2399
# If the library was installed with an old release of libtool,
2400
# it will not redefine variables installed, or shouldnotlink
2408
*/* | *\\*) . $lib ;;
2412
if test "$linkmode,$pass" = "lib,link" ||
2413
test "$linkmode,$pass" = "prog,scan" ||
2414
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
2415
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2416
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2419
if test "$pass" = conv; then
2420
# Only check for convenience libraries
2421
deplibs="$lib $deplibs"
2422
if test -z "$libdir"; then
2423
if test -z "$old_library"; then
2424
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2427
# It is a libtool convenience library, so add in its objects.
2428
convenience="$convenience $ladir/$objdir/$old_library"
2429
old_convenience="$old_convenience $ladir/$objdir/$old_library"
2431
for deplib in $dependency_libs; do
2432
deplibs="$deplib $deplibs"
2433
if test "X$duplicate_deps" = "Xyes" ; then
2434
case "$tmp_libs " in
2435
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2438
tmp_libs="$tmp_libs $deplib"
2440
elif test "$linkmode" != prog && test "$linkmode" != lib; then
2441
$echo "$modename: \`$lib' is not a convenience library" 1>&2
2448
# Get the name of the library we link against.
2450
for l in $old_library $library_names; do
2453
if test -z "$linklib"; then
2454
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2458
# This library was specified with -dlopen.
2459
if test "$pass" = dlopen; then
2460
if test -z "$libdir"; then
2461
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2464
if test -z "$dlname" ||
2465
test "$dlopen_support" != yes ||
2466
test "$build_libtool_libs" = no; then
2467
# If there is no dlname, no dlopen support or we're linking
2468
# statically, we need to preload. We also need to preload any
2469
# dependent libraries so libltdl's deplib preloader doesn't
2470
# bomb out in the load deplibs phase.
2471
dlprefiles="$dlprefiles $lib $dependency_libs"
2473
newdlfiles="$newdlfiles $lib"
2478
# We need an absolute path.
2480
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2482
abs_ladir=`cd "$ladir" && pwd`
2483
if test -z "$abs_ladir"; then
2484
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2485
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2490
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2492
# Find the relevant object directory and library name.
2493
if test "X$installed" = Xyes; then
2494
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2495
$echo "$modename: warning: library \`$lib' was moved." 1>&2
2503
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2505
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2508
# Remove this search path later
2509
notinst_path="$notinst_path $abs_ladir"
2511
dir="$ladir/$objdir"
2512
absdir="$abs_ladir/$objdir"
2513
# Remove this search path later
2514
notinst_path="$notinst_path $abs_ladir"
2516
fi # $installed = yes
2517
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2519
# This library was specified with -dlpreopen.
2520
if test "$pass" = dlpreopen; then
2521
if test -z "$libdir"; then
2522
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2525
# Prefer using a static library (so that no silly _DYNAMIC symbols
2526
# are required to link).
2527
if test -n "$old_library"; then
2528
newdlprefiles="$newdlprefiles $dir/$old_library"
2529
# Otherwise, use the dlname, so that lt_dlopen finds it.
2530
elif test -n "$dlname"; then
2531
newdlprefiles="$newdlprefiles $dir/$dlname"
2533
newdlprefiles="$newdlprefiles $dir/$linklib"
2535
fi # $pass = dlpreopen
2537
if test -z "$libdir"; then
2538
# Link the convenience library
2539
if test "$linkmode" = lib; then
2540
deplibs="$dir/$old_library $deplibs"
2541
elif test "$linkmode,$pass" = "prog,link"; then
2542
compile_deplibs="$dir/$old_library $compile_deplibs"
2543
finalize_deplibs="$dir/$old_library $finalize_deplibs"
2545
deplibs="$lib $deplibs" # used for prog,scan pass
2551
if test "$linkmode" = prog && test "$pass" != link; then
2552
newlib_search_path="$newlib_search_path $ladir"
2553
deplibs="$lib $deplibs"
2556
if test "$link_all_deplibs" != no || test -z "$library_names" ||
2557
test "$build_libtool_libs" = no; then
2562
for deplib in $dependency_libs; do
2564
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2566
# Need to link against all dependency_libs?
2567
if test "$linkalldeplibs" = yes; then
2568
deplibs="$deplib $deplibs"
2570
# Need to hardcode shared library paths
2571
# or/and link against static libraries
2572
newdependency_libs="$deplib $newdependency_libs"
2574
if test "X$duplicate_deps" = "Xyes" ; then
2575
case "$tmp_libs " in
2576
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2579
tmp_libs="$tmp_libs $deplib"
2582
fi # $linkmode = prog...
2584
if test "$linkmode,$pass" = "prog,link"; then
2585
if test -n "$library_names" &&
2586
{ { test "$prefer_static_libs" = no ||
2587
test "$prefer_static_libs,$installed" = "built,yes"; } ||
2588
test -z "$old_library"; }; then
2589
# We need to hardcode the library path
2590
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2591
# Make sure the rpath contains only unique directories.
2592
case "$temp_rpath " in
2595
*) temp_rpath="$temp_rpath $absdir" ;;
2599
# Hardcode the library path.
2600
# Skip directories that are in the system default run-time
2602
case " $sys_lib_dlsearch_path " in
2605
case "$compile_rpath " in
2607
*) compile_rpath="$compile_rpath $absdir"
2611
case " $sys_lib_dlsearch_path " in
2614
case "$finalize_rpath " in
2616
*) finalize_rpath="$finalize_rpath $libdir"
2620
fi # $linkmode,$pass = prog,link...
2622
if test "$alldeplibs" = yes &&
2623
{ test "$deplibs_check_method" = pass_all ||
2624
{ test "$build_libtool_libs" = yes &&
2625
test -n "$library_names"; }; }; then
2626
# We only need to search for static libraries
2631
link_static=no # Whether the deplib will be linked statically
2632
use_static_libs=$prefer_static_libs
2633
if test "$use_static_libs" = built && test "$installed" = yes ; then
2636
if test -n "$library_names" &&
2637
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
2638
if test "$installed" = no; then
2639
notinst_deplibs="$notinst_deplibs $lib"
2642
# This is a shared library
2644
# Warn about portability, can't link against -module's on
2645
# some systems (darwin)
2646
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2648
if test "$linkmode" = prog; then
2649
$echo "*** Warning: Linking the executable $output against the loadable module"
2651
$echo "*** Warning: Linking the shared library $output against the loadable module"
2653
$echo "*** $linklib is not portable!"
2655
if test "$linkmode" = lib &&
2656
test "$hardcode_into_libs" = yes; then
2657
# Hardcode the library path.
2658
# Skip directories that are in the system default run-time
2660
case " $sys_lib_dlsearch_path " in
2663
case "$compile_rpath " in
2665
*) compile_rpath="$compile_rpath $absdir"
2669
case " $sys_lib_dlsearch_path " in
2672
case "$finalize_rpath " in
2674
*) finalize_rpath="$finalize_rpath $libdir"
2680
if test -n "$old_archive_from_expsyms_cmds"; then
2681
# figure out the soname
2682
set dummy $library_names
2685
libname=`eval \\$echo \"$libname_spec\"`
2686
# use dlname if we got it. it's perfectly good, no?
2687
if test -n "$dlname"; then
2689
elif test -n "$soname_spec"; then
2693
major=`expr $current - $age`
2697
eval soname=\"$soname_spec\"
2702
# Make a new name for the extract_expsyms_cmds to use
2704
soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2705
newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2707
# If the library has no export list, then create one now
2708
if test -f "$output_objdir/$soname-def"; then :
2710
$show "extracting exported symbol list from \`$soname'"
2711
save_ifs="$IFS"; IFS='~'
2712
cmds=$extract_expsyms_cmds
2713
for cmd in $cmds; do
2717
$run eval "$cmd" || exit $?
2723
if test -f "$output_objdir/$newlib"; then :; else
2724
$show "generating import library for \`$soname'"
2725
save_ifs="$IFS"; IFS='~'
2726
cmds=$old_archive_from_expsyms_cmds
2727
for cmd in $cmds; do
2731
$run eval "$cmd" || exit $?
2735
# make sure the library variables are pointing to the new library
2738
fi # test -n "$old_archive_from_expsyms_cmds"
2740
if test "$linkmode" = prog || test "$mode" != relink; then
2745
case $hardcode_action in
2746
immediate | unsupported)
2747
if test "$hardcode_direct" = no; then
2750
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2751
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
2752
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2753
*-*-unixware7*) add_dir="-L$dir" ;;
2755
# if the lib is a module then we can not link against
2756
# it, someone is ignoring the new warnings I added
2757
if /usr/bin/file -L $add 2> /dev/null |
2758
$EGREP ": [^:]* bundle" >/dev/null ; then
2759
$echo "** Warning, lib $linklib is a module, not a shared library"
2760
if test -z "$old_library" ; then
2762
$echo "** And there doesn't seem to be a static archive available"
2763
$echo "** The link will probably fail, sorry"
2765
add="$dir/$old_library"
2769
elif test "$hardcode_minus_L" = no; then
2771
*-*-sunos*) add_shlibpath="$dir" ;;
2775
elif test "$hardcode_shlibpath_var" = no; then
2776
add_shlibpath="$dir"
2783
if test "$hardcode_direct" = yes; then
2785
elif test "$hardcode_minus_L" = yes; then
2787
# Try looking first in the location we're being installed to.
2788
if test -n "$inst_prefix_dir"; then
2791
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2796
elif test "$hardcode_shlibpath_var" = yes; then
2797
add_shlibpath="$dir"
2806
if test "$lib_linked" != yes; then
2807
$echo "$modename: configuration error: unsupported hardcode properties"
2811
if test -n "$add_shlibpath"; then
2812
case :$compile_shlibpath: in
2813
*":$add_shlibpath:"*) ;;
2814
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2817
if test "$linkmode" = prog; then
2818
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2819
test -n "$add" && compile_deplibs="$add $compile_deplibs"
2821
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2822
test -n "$add" && deplibs="$add $deplibs"
2823
if test "$hardcode_direct" != yes && \
2824
test "$hardcode_minus_L" != yes && \
2825
test "$hardcode_shlibpath_var" = yes; then
2826
case :$finalize_shlibpath: in
2828
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2834
if test "$linkmode" = prog || test "$mode" = relink; then
2838
# Finalize command for both is simple: just hardcode it.
2839
if test "$hardcode_direct" = yes; then
2840
add="$libdir/$linklib"
2841
elif test "$hardcode_minus_L" = yes; then
2844
elif test "$hardcode_shlibpath_var" = yes; then
2845
case :$finalize_shlibpath: in
2847
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2850
elif test "$hardcode_automatic" = yes; then
2851
if test -n "$inst_prefix_dir" &&
2852
test -f "$inst_prefix_dir$libdir/$linklib" ; then
2853
add="$inst_prefix_dir$libdir/$linklib"
2855
add="$libdir/$linklib"
2858
# We cannot seem to hardcode it, guess we'll fake it.
2860
# Try looking first in the location we're being installed to.
2861
if test -n "$inst_prefix_dir"; then
2864
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2871
if test "$linkmode" = prog; then
2872
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2873
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2875
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2876
test -n "$add" && deplibs="$add $deplibs"
2879
elif test "$linkmode" = prog; then
2880
# Here we assume that one of hardcode_direct or hardcode_minus_L
2881
# is not unsupported. This is valid on all known static and
2883
if test "$hardcode_direct" != unsupported; then
2884
test -n "$old_library" && linklib="$old_library"
2885
compile_deplibs="$dir/$linklib $compile_deplibs"
2886
finalize_deplibs="$dir/$linklib $finalize_deplibs"
2888
compile_deplibs="-l$name -L$dir $compile_deplibs"
2889
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2891
elif test "$build_libtool_libs" = yes; then
2892
# Not a shared library
2893
if test "$deplibs_check_method" != pass_all; then
2894
# We're trying link a shared library against a static one
2895
# but the system doesn't support it.
2897
# Just print a warning and add the library to dependency_libs so
2898
# that the program can be linked against the static library.
2900
$echo "*** Warning: This system can not link to static lib archive $lib."
2901
$echo "*** I have the capability to make that library automatically link in when"
2902
$echo "*** you link to this library. But I can only do this if you have a"
2903
$echo "*** shared version of the library, which you do not appear to have."
2904
if test "$module" = yes; then
2905
$echo "*** But as you try to build a module library, libtool will still create "
2906
$echo "*** a static module, that should work as long as the dlopening application"
2907
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2908
if test -z "$global_symbol_pipe"; then
2910
$echo "*** However, this would only work if libtool was able to extract symbol"
2911
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2912
$echo "*** not find such a program. So, this module is probably useless."
2913
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2915
if test "$build_old_libs" = no; then
2916
build_libtool_libs=module
2919
build_libtool_libs=no
2923
deplibs="$dir/$old_library $deplibs"
2926
fi # link shared/static library?
2928
if test "$linkmode" = lib; then
2929
if test -n "$dependency_libs" &&
2930
{ test "$hardcode_into_libs" != yes ||
2931
test "$build_old_libs" = yes ||
2932
test "$link_static" = yes; }; then
2933
# Extract -R from dependency_libs
2935
for libdir in $dependency_libs; do
2937
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2939
*" $temp_xrpath "*) ;;
2940
*) xrpath="$xrpath $temp_xrpath";;
2942
*) temp_deplibs="$temp_deplibs $libdir";;
2945
dependency_libs="$temp_deplibs"
2948
newlib_search_path="$newlib_search_path $absdir"
2949
# Link against this library
2950
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2951
# ... and its dependency_libs
2953
for deplib in $dependency_libs; do
2954
newdependency_libs="$deplib $newdependency_libs"
2955
if test "X$duplicate_deps" = "Xyes" ; then
2956
case "$tmp_libs " in
2957
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2960
tmp_libs="$tmp_libs $deplib"
2963
if test "$link_all_deplibs" != no; then
2964
# Add the search paths of all dependency libraries
2965
for deplib in $dependency_libs; do
2967
-L*) path="$deplib" ;;
2969
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2970
test "X$dir" = "X$deplib" && dir="."
2971
# We need an absolute path.
2973
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2975
absdir=`cd "$dir" && pwd`
2976
if test -z "$absdir"; then
2977
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2982
if grep "^installed=no" $deplib > /dev/null; then
2983
path="$absdir/$objdir"
2985
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2986
if test -z "$libdir"; then
2987
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2990
if test "$absdir" != "$libdir"; then
2991
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2998
# we do not want to link against static libs,
2999
# but need to link against shared
3000
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3001
if test -n "$deplibrary_names" ; then
3002
for tmp in $deplibrary_names ; do
3005
if test -f "$path/$depdepl" ; then
3006
depdepl="$path/$depdepl"
3008
# do not add paths which are already there
3009
case " $newlib_search_path " in
3011
*) newlib_search_path="$newlib_search_path $path";;
3024
# Again, we only want to link against shared libraries
3025
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3026
for tmp in $newlib_search_path ; do
3027
if test -f "$tmp/lib$tmp_libs.dylib" ; then
3028
eval depdepl="$tmp/lib$tmp_libs.dylib"
3039
case " $deplibs " in
3041
*) deplibs="$path $deplibs" ;;
3043
case " $deplibs " in
3045
*) deplibs="$depdepl $deplibs" ;;
3048
fi # link_all_deplibs != no
3050
done # for deplib in $libs
3051
dependency_libs="$newdependency_libs"
3052
if test "$pass" = dlpreopen; then
3053
# Link the dlpreopened libraries before other libraries
3054
for deplib in $save_deplibs; do
3055
deplibs="$deplib $deplibs"
3058
if test "$pass" != dlopen; then
3059
if test "$pass" != conv; then
3060
# Make sure lib_search_path contains only unique directories.
3062
for dir in $newlib_search_path; do
3063
case "$lib_search_path " in
3065
*) lib_search_path="$lib_search_path $dir" ;;
3071
if test "$linkmode,$pass" != "prog,link"; then
3074
vars="compile_deplibs finalize_deplibs"
3076
for var in $vars dependency_libs; do
3077
# Add libraries to $var in reverse order
3078
eval tmp_libs=\"\$$var\"
3080
for deplib in $tmp_libs; do
3081
# FIXME: Pedantically, this is the right thing to do, so
3082
# that some nasty dependency loop isn't accidentally
3084
#new_libs="$deplib $new_libs"
3085
# Pragmatically, this seems to cause very few problems in
3088
-L*) new_libs="$deplib $new_libs" ;;
3091
# And here is the reason: when a library appears more
3092
# than once as an explicit dependence of a library, or
3093
# is implicitly linked in more than once by the
3094
# compiler, it is considered special, and multiple
3095
# occurrences thereof are not removed. Compare this
3096
# with having the same library being listed as a
3097
# dependency of multiple other libraries: in this case,
3098
# we know (pedantically, we assume) the library does not
3099
# need to be listed more than once, so we keep only the
3100
# last copy. This is not always right, but it is rare
3101
# enough that we require users that really mean to play
3102
# such unportable linking tricks to link the library
3103
# using -Wl,-lname, so that libtool does not consider it
3104
# for duplicate removal.
3105
case " $specialdeplibs " in
3106
*" $deplib "*) new_libs="$deplib $new_libs" ;;
3108
case " $new_libs " in
3110
*) new_libs="$deplib $new_libs" ;;
3118
for deplib in $new_libs; do
3121
case " $tmp_libs " in
3123
*) tmp_libs="$tmp_libs $deplib" ;;
3126
*) tmp_libs="$tmp_libs $deplib" ;;
3129
eval $var=\"$tmp_libs\"
3132
# Last step: remove runtime libs from dependency_libs
3133
# (they stay in deplibs)
3135
for i in $dependency_libs ; do
3136
case " $predeps $postdeps $compiler_lib_search_path " in
3141
if test -n "$i" ; then
3142
tmp_libs="$tmp_libs $i"
3145
dependency_libs=$tmp_libs
3147
if test "$linkmode" = prog; then
3148
dlfiles="$newdlfiles"
3149
dlprefiles="$newdlprefiles"
3154
if test -n "$deplibs"; then
3155
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3158
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3159
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3162
if test -n "$rpath"; then
3163
$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3166
if test -n "$xrpath"; then
3167
$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3170
if test -n "$vinfo"; then
3171
$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3174
if test -n "$release"; then
3175
$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3178
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3179
$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3182
# Now set the variables for building old libraries.
3183
build_libtool_libs=no
3185
objs="$objs$old_deplibs"
3189
# Make sure we only generate libraries of the form `libNAME.la'.
3192
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3193
eval shared_ext=\"$shrext_cmds\"
3194
eval libname=\"$libname_spec\"
3197
if test "$module" = no; then
3198
$echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3202
if test "$need_lib_prefix" != no; then
3203
# Add the "lib" prefix for modules if required
3204
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3205
eval shared_ext=\"$shrext_cmds\"
3206
eval libname=\"$libname_spec\"
3208
libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3213
if test -n "$objs"; then
3214
if test "$deplibs_check_method" != pass_all; then
3215
$echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3219
$echo "*** Warning: Linking the shared library $output against the non-libtool"
3220
$echo "*** objects $objs is not portable!"
3221
libobjs="$libobjs $objs"
3225
if test "$dlself" != no; then
3226
$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3230
if test "$#" -gt 2; then
3231
$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3236
if test -z "$rpath"; then
3237
if test "$build_libtool_libs" = yes; then
3238
# Building a libtool convenience library.
3239
# Some compilers have problems with a `.al' extension so
3240
# convenience libraries should have the same extension an
3241
# archive normally would.
3242
oldlibs="$output_objdir/$libname.$libext $oldlibs"
3243
build_libtool_libs=convenience
3247
if test -n "$vinfo"; then
3248
$echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3251
if test -n "$release"; then
3252
$echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3256
# Parse the version information argument.
3257
save_ifs="$IFS"; IFS=':'
3258
set dummy $vinfo 0 0 0
3261
if test -n "$8"; then
3262
$echo "$modename: too many parameters to \`-version-info'" 1>&2
3267
# convert absolute version numbers to libtool ages
3268
# this retains compatibility with .la files and attempts
3269
# to make the code below a bit more comprehensible
3271
case $vinfo_number in
3275
number_revision="$4"
3277
# There are really only two kinds -- those that
3278
# use the current revision as the major version
3279
# and those that subtract age and use age as
3280
# a minor version. But, then there is irix
3281
# which has an extra 1 added just for fun
3283
case $version_type in
3284
darwin|linux|osf|windows|none)
3285
current=`expr $number_major + $number_minor`
3287
revision="$number_revision"
3289
freebsd-aout|freebsd-elf|sunos)
3290
current="$number_major"
3291
revision="$number_minor"
3295
current=`expr $number_major + $number_minor`
3297
revision="$number_minor"
3298
lt_irix_increment=no
3309
# Check that each of the things are valid numbers.
3311
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]) ;;
3313
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3314
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3320
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]) ;;
3322
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3323
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3329
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]) ;;
3331
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3332
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3337
if test "$age" -gt "$current"; then
3338
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3339
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3343
# Calculate the version variables.
3347
case $version_type in
3351
# Like Linux, but with the current version available in
3352
# verstring for coding it into the library header
3353
major=.`expr $current - $age`
3354
versuffix="$major.$age.$revision"
3355
# Darwin ld doesn't like 0 for these options...
3356
minor_current=`expr $current + 1`
3357
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3358
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3363
versuffix=".$current.$revision";
3368
versuffix=".$current";
3372
if test "X$lt_irix_increment" = "Xno"; then
3373
major=`expr $current - $age`
3375
major=`expr $current - $age + 1`
3377
case $version_type in
3378
nonstopux) verstring_prefix=nonstopux ;;
3379
*) verstring_prefix=sgi ;;
3381
verstring="$verstring_prefix$major.$revision"
3383
# Add in all the interfaces that we are compatible with.
3385
while test "$loop" -ne 0; do
3386
iface=`expr $revision - $loop`
3387
loop=`expr $loop - 1`
3388
verstring="$verstring_prefix$major.$iface:$verstring"
3391
# Before this point, $major must not contain `.'.
3393
versuffix="$major.$revision"
3397
major=.`expr $current - $age`
3398
versuffix="$major.$age.$revision"
3402
major=.`expr $current - $age`
3403
versuffix=".$current.$age.$revision"
3404
verstring="$current.$age.$revision"
3406
# Add in all the interfaces that we are compatible with.
3408
while test "$loop" -ne 0; do
3409
iface=`expr $current - $loop`
3410
loop=`expr $loop - 1`
3411
verstring="$verstring:${iface}.0"
3414
# Make executables depend on our current version.
3415
verstring="$verstring:${current}.0"
3420
versuffix=".$current.$revision"
3424
# Use '-' rather than '.', since we only want one
3425
# extension on DOS 8.3 filesystems.
3426
major=`expr $current - $age`
3431
$echo "$modename: unknown library version type \`$version_type'" 1>&2
3432
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3437
# Clear the version info if we defaulted, and they specified a release.
3438
if test -z "$vinfo" && test -n "$release"; then
3440
case $version_type in
3442
# we can't check for "0.0" in archive_cmds due to quoting
3443
# problems, so we reset it completely
3450
if test "$need_version" = no; then
3457
# Remove version info from name if versioning should be avoided
3458
if test "$avoid_version" = yes && test "$need_version" = no; then
3464
# Check to see if the archive will have undefined symbols.
3465
if test "$allow_undefined" = yes; then
3466
if test "$allow_undefined_flag" = unsupported; then
3467
$echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3468
build_libtool_libs=no
3472
# Don't allow undefined symbols.
3473
allow_undefined_flag="$no_undefined_flag"
3477
if test "$mode" != relink; then
3478
# Remove our outputs, but don't remove object files since they
3479
# may have been created when compiling PIC objects.
3481
tempremovelist=`$echo "$output_objdir/*"`
3482
for p in $tempremovelist; do
3486
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3487
if test "X$precious_files_regex" != "X"; then
3488
if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3493
removelist="$removelist $p"
3498
if test -n "$removelist"; then
3499
$show "${rm}r $removelist"
3500
$run ${rm}r $removelist
3504
# Now set the variables for building old libraries.
3505
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3506
oldlibs="$oldlibs $output_objdir/$libname.$libext"
3508
# Transform .lo files to .o files.
3509
oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3512
# Eliminate all temporary directories.
3513
#for path in $notinst_path; do
3514
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3515
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3516
# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3519
if test -n "$xrpath"; then
3520
# If the user specified any rpath flags, then add them.
3522
for libdir in $xrpath; do
3523
temp_xrpath="$temp_xrpath -R$libdir"
3524
case "$finalize_rpath " in
3526
*) finalize_rpath="$finalize_rpath $libdir" ;;
3529
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3530
dependency_libs="$temp_xrpath $dependency_libs"
3534
# Make sure dlfiles contains only unique files that won't be dlpreopened
3535
old_dlfiles="$dlfiles"
3537
for lib in $old_dlfiles; do
3538
case " $dlprefiles $dlfiles " in
3540
*) dlfiles="$dlfiles $lib" ;;
3544
# Make sure dlprefiles contains only unique files
3545
old_dlprefiles="$dlprefiles"
3547
for lib in $old_dlprefiles; do
3548
case "$dlprefiles " in
3550
*) dlprefiles="$dlprefiles $lib" ;;
3554
if test "$build_libtool_libs" = yes; then
3555
if test -n "$rpath"; then
3557
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3558
# these systems don't actually have a c library (as such)!
3560
*-*-rhapsody* | *-*-darwin1.[012])
3561
# Rhapsody C library is in the System framework
3562
deplibs="$deplibs -framework System"
3565
# Don't link with libc until the a.out ld.so is fixed.
3567
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3568
# Do not include libc due to us having libc/libc_r.
3570
*-*-sco3.2v5* | *-*-sco5v6*)
3571
# Causes problems with __ctype
3573
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3574
# Compiler inserts libc in the correct place for threads to work
3577
# Add libc to deplibs on all other systems if necessary.
3578
if test "$build_libtool_need_lc" = "yes"; then
3579
deplibs="$deplibs -lc"
3585
# Transform deplibs into only deplibs that can be linked in shared.
3587
libname_save=$libname
3588
release_save=$release
3589
versuffix_save=$versuffix
3591
# I'm not sure if I'm treating the release correctly. I think
3592
# release should show up in the -l (ie -lgmp5) so we don't want to
3593
# add it in twice. Is that correct?
3599
case $deplibs_check_method in
3601
# Don't check for shared/static. Everything works.
3602
# This might be a little naive. We might want to check
3603
# whether the library exists or not. But this is on
3604
# osf3 & osf4 and I'm not really sure... Just
3605
# implementing what was already the behavior.
3609
# This code stresses the "libraries are programs" paradigm to its
3610
# limits. Maybe even breaks it. We compile a program, linking it
3611
# against the deplibs as a proxy for the library. Then we can check
3612
# whether they linked in statically or dynamically with ldd.
3614
cat > conftest.c <<EOF
3615
int main() { return 0; }
3618
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3619
ldd_output=`ldd conftest`
3620
for i in $deplibs; do
3621
name=`expr $i : '-l\(.*\)'`
3622
# If $name is empty we are operating on a -L argument.
3623
if test "$name" != "" && test "$name" != "0"; then
3624
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3625
case " $predeps $postdeps " in
3627
newdeplibs="$newdeplibs $i"
3632
if test -n "$i" ; then
3633
libname=`eval \\$echo \"$libname_spec\"`
3634
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3635
set dummy $deplib_matches
3637
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3638
newdeplibs="$newdeplibs $i"
3642
$echo "*** Warning: dynamic linker does not accept needed library $i."
3643
$echo "*** I have the capability to make that library automatically link in when"
3644
$echo "*** you link to this library. But I can only do this if you have a"
3645
$echo "*** shared version of the library, which I believe you do not have"
3646
$echo "*** because a test_compile did reveal that the linker did not use it for"
3647
$echo "*** its dynamic dependency list that programs get resolved with at runtime."
3651
newdeplibs="$newdeplibs $i"
3655
# Error occurred in the first compile. Let's try to salvage
3656
# the situation: Compile a separate program for each library.
3657
for i in $deplibs; do
3658
name=`expr $i : '-l\(.*\)'`
3659
# If $name is empty we are operating on a -L argument.
3660
if test "$name" != "" && test "$name" != "0"; then
3662
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3663
ldd_output=`ldd conftest`
3664
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3665
case " $predeps $postdeps " in
3667
newdeplibs="$newdeplibs $i"
3672
if test -n "$i" ; then
3673
libname=`eval \\$echo \"$libname_spec\"`
3674
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3675
set dummy $deplib_matches
3677
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3678
newdeplibs="$newdeplibs $i"
3682
$echo "*** Warning: dynamic linker does not accept needed library $i."
3683
$echo "*** I have the capability to make that library automatically link in when"
3684
$echo "*** you link to this library. But I can only do this if you have a"
3685
$echo "*** shared version of the library, which you do not appear to have"
3686
$echo "*** because a test_compile did reveal that the linker did not use this one"
3687
$echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3693
$echo "*** Warning! Library $i is needed by this library but I was not able to"
3694
$echo "*** make it link in! You will probably need to install it or some"
3695
$echo "*** library that it depends on before this library will be fully"
3696
$echo "*** functional. Installing it before continuing would be even better."
3699
newdeplibs="$newdeplibs $i"
3705
set dummy $deplibs_check_method
3706
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3707
for a_deplib in $deplibs; do
3708
name=`expr $a_deplib : '-l\(.*\)'`
3709
# If $name is empty we are operating on a -L argument.
3710
if test "$name" != "" && test "$name" != "0"; then
3711
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3712
case " $predeps $postdeps " in
3714
newdeplibs="$newdeplibs $a_deplib"
3719
if test -n "$a_deplib" ; then
3720
libname=`eval \\$echo \"$libname_spec\"`
3721
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3722
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3723
for potent_lib in $potential_libs; do
3724
# Follow soft links.
3725
if ls -lLd "$potent_lib" 2>/dev/null \
3726
| grep " -> " >/dev/null; then
3729
# The statement above tries to avoid entering an
3730
# endless loop below, in case of cyclic links.
3731
# We might still enter an endless loop, since a link
3732
# loop can be closed while we follow links,
3734
potlib="$potent_lib"
3735
while test -h "$potlib" 2>/dev/null; do
3736
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3738
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3739
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3742
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3744
| $EGREP "$file_magic_regex" > /dev/null; then
3745
newdeplibs="$newdeplibs $a_deplib"
3752
if test -n "$a_deplib" ; then
3755
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3756
$echo "*** I have the capability to make that library automatically link in when"
3757
$echo "*** you link to this library. But I can only do this if you have a"
3758
$echo "*** shared version of the library, which you do not appear to have"
3759
$echo "*** because I did check the linker path looking for a file starting"
3760
if test -z "$potlib" ; then
3761
$echo "*** with $libname but no candidates were found. (...for file magic test)"
3763
$echo "*** with $libname and none of the candidates passed a file format test"
3764
$echo "*** using a file magic. Last file checked: $potlib"
3768
# Add a -L argument.
3769
newdeplibs="$newdeplibs $a_deplib"
3771
done # Gone through all deplibs.
3774
set dummy $deplibs_check_method
3775
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3776
for a_deplib in $deplibs; do
3777
name=`expr $a_deplib : '-l\(.*\)'`
3778
# If $name is empty we are operating on a -L argument.
3779
if test -n "$name" && test "$name" != "0"; then
3780
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3781
case " $predeps $postdeps " in
3783
newdeplibs="$newdeplibs $a_deplib"
3788
if test -n "$a_deplib" ; then
3789
libname=`eval \\$echo \"$libname_spec\"`
3790
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3791
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3792
for potent_lib in $potential_libs; do
3793
potlib="$potent_lib" # see symlink-check above in file_magic test
3794
if eval $echo \"$potent_lib\" 2>/dev/null \
3796
| $EGREP "$match_pattern_regex" > /dev/null; then
3797
newdeplibs="$newdeplibs $a_deplib"
3804
if test -n "$a_deplib" ; then
3807
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3808
$echo "*** I have the capability to make that library automatically link in when"
3809
$echo "*** you link to this library. But I can only do this if you have a"
3810
$echo "*** shared version of the library, which you do not appear to have"
3811
$echo "*** because I did check the linker path looking for a file starting"
3812
if test -z "$potlib" ; then
3813
$echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3815
$echo "*** with $libname and none of the candidates passed a file format test"
3816
$echo "*** using a regex pattern. Last file checked: $potlib"
3820
# Add a -L argument.
3821
newdeplibs="$newdeplibs $a_deplib"
3823
done # Gone through all deplibs.
3827
tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3828
-e 's/ -[LR][^ ]*//g'`
3829
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3830
for i in $predeps $postdeps ; do
3831
# can't use Xsed below, because $i might contain '/'
3832
tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3835
if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3836
| grep . >/dev/null; then
3838
if test "X$deplibs_check_method" = "Xnone"; then
3839
$echo "*** Warning: inter-library dependencies are not supported in this platform."
3841
$echo "*** Warning: inter-library dependencies are not known to be supported."
3843
$echo "*** All declared inter-library dependencies are being dropped."
3848
versuffix=$versuffix_save
3850
release=$release_save
3851
libname=$libname_save
3855
*-*-rhapsody* | *-*-darwin1.[012])
3856
# On Rhapsody replace the C library is the System framework
3857
newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3861
if test "$droppeddeps" = yes; then
3862
if test "$module" = yes; then
3864
$echo "*** Warning: libtool could not satisfy all declared inter-library"
3865
$echo "*** dependencies of module $libname. Therefore, libtool will create"
3866
$echo "*** a static module, that should work as long as the dlopening"
3867
$echo "*** application is linked with the -dlopen flag."
3868
if test -z "$global_symbol_pipe"; then
3870
$echo "*** However, this would only work if libtool was able to extract symbol"
3871
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3872
$echo "*** not find such a program. So, this module is probably useless."
3873
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
3875
if test "$build_old_libs" = no; then
3876
oldlibs="$output_objdir/$libname.$libext"
3877
build_libtool_libs=module
3880
build_libtool_libs=no
3883
$echo "*** The inter-library dependencies that have been dropped here will be"
3884
$echo "*** automatically added whenever a program is linked with this library"
3885
$echo "*** or is declared to -dlopen it."
3887
if test "$allow_undefined" = no; then
3889
$echo "*** Since this library must not contain undefined symbols,"
3890
$echo "*** because either the platform does not support them or"
3891
$echo "*** it was explicitly requested with -no-undefined,"
3892
$echo "*** libtool will only create a static version of it."
3893
if test "$build_old_libs" = no; then
3894
oldlibs="$output_objdir/$libname.$libext"
3895
build_libtool_libs=module
3898
build_libtool_libs=no
3903
# Done checking deplibs!
3908
# move library search paths that coincide with paths to not yet
3909
# installed libraries to the beginning of the library search list
3911
for path in $notinst_path; do
3912
case " $new_libs " in
3913
*" -L$path/$objdir "*) ;;
3915
case " $deplibs " in
3916
*" -L$path/$objdir "*)
3917
new_libs="$new_libs -L$path/$objdir" ;;
3922
for deplib in $deplibs; do
3925
case " $new_libs " in
3927
*) new_libs="$new_libs $deplib" ;;
3930
*) new_libs="$new_libs $deplib" ;;
3936
# All the library-specific variables (install_libdir is set above).
3941
# Test again, we may have decided not to build it any more
3942
if test "$build_libtool_libs" = yes; then
3943
if test "$hardcode_into_libs" = yes; then
3944
# Hardcode the library paths
3947
rpath="$finalize_rpath"
3948
test "$mode" != relink && rpath="$compile_rpath$rpath"
3949
for libdir in $rpath; do
3950
if test -n "$hardcode_libdir_flag_spec"; then
3951
if test -n "$hardcode_libdir_separator"; then
3952
if test -z "$hardcode_libdirs"; then
3953
hardcode_libdirs="$libdir"
3955
# Just accumulate the unique libdirs.
3956
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3957
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3960
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3965
eval flag=\"$hardcode_libdir_flag_spec\"
3966
dep_rpath="$dep_rpath $flag"
3968
elif test -n "$runpath_var"; then
3969
case "$perm_rpath " in
3971
*) perm_rpath="$perm_rpath $libdir" ;;
3975
# Substitute the hardcoded libdirs into the rpath.
3976
if test -n "$hardcode_libdir_separator" &&
3977
test -n "$hardcode_libdirs"; then
3978
libdir="$hardcode_libdirs"
3979
if test -n "$hardcode_libdir_flag_spec_ld"; then
3980
case $archive_cmds in
3981
*\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3982
*) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3985
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3988
if test -n "$runpath_var" && test -n "$perm_rpath"; then
3989
# We should set the runpath_var.
3991
for dir in $perm_rpath; do
3994
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3996
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3999
shlibpath="$finalize_shlibpath"
4000
test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4001
if test -n "$shlibpath"; then
4002
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4005
# Get the real and link names of the library.
4006
eval shared_ext=\"$shrext_cmds\"
4007
eval library_names=\"$library_names_spec\"
4008
set dummy $library_names
4012
if test -n "$soname_spec"; then
4013
eval soname=\"$soname_spec\"
4017
if test -z "$dlname"; then
4021
lib="$output_objdir/$realname"
4025
linknames="$linknames $link"
4028
# Use standard objects if they are pic
4029
test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4031
# Prepare the list of exported symbols
4032
if test -z "$export_symbols"; then
4033
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4034
$show "generating symbol list for \`$libname.la'"
4035
export_symbols="$output_objdir/$libname.exp"
4036
$run $rm $export_symbols
4037
cmds=$export_symbols_cmds
4038
save_ifs="$IFS"; IFS='~'
4039
for cmd in $cmds; do
4042
if len=`expr "X$cmd" : ".*"` &&
4043
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4045
$run eval "$cmd" || exit $?
4046
skipped_export=false
4048
# The command line is too long to execute in one step.
4049
$show "using reloadable object file for export list..."
4051
# Break out early, otherwise skipped_export may be
4052
# set to false by a later but shorter cmd.
4057
if test -n "$export_symbols_regex"; then
4058
$show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4059
$run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4060
$show "$mv \"${export_symbols}T\" \"$export_symbols\""
4061
$run eval '$mv "${export_symbols}T" "$export_symbols"'
4066
if test -n "$export_symbols" && test -n "$include_expsyms"; then
4067
$run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4071
for test_deplib in $deplibs; do
4072
case " $convenience " in
4073
*" $test_deplib "*) ;;
4075
tmp_deplibs="$tmp_deplibs $test_deplib"
4079
deplibs="$tmp_deplibs"
4081
if test -n "$convenience"; then
4082
if test -n "$whole_archive_flag_spec"; then
4083
save_libobjs=$libobjs
4084
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4086
gentop="$output_objdir/${outputname}x"
4087
generated="$generated $gentop"
4089
func_extract_archives $gentop $convenience
4090
libobjs="$libobjs $func_extract_archives_result"
4094
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4095
eval flag=\"$thread_safe_flag_spec\"
4096
linker_flags="$linker_flags $flag"
4099
# Make a backup of the uninstalled library when relinking
4100
if test "$mode" = relink; then
4101
$run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4104
# Do each of the archive commands.
4105
if test "$module" = yes && test -n "$module_cmds" ; then
4106
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4107
eval test_cmds=\"$module_expsym_cmds\"
4108
cmds=$module_expsym_cmds
4110
eval test_cmds=\"$module_cmds\"
4114
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4115
eval test_cmds=\"$archive_expsym_cmds\"
4116
cmds=$archive_expsym_cmds
4118
eval test_cmds=\"$archive_cmds\"
4123
if test "X$skipped_export" != "X:" &&
4124
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4125
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4128
# The command line is too long to link in one step, link piecewise.
4129
$echo "creating reloadable object files..."
4131
# Save the value of $output and $libobjs because we want to
4132
# use them later. If we have whole_archive_flag_spec, we
4133
# want to use save_libobjs as it was before
4134
# whole_archive_flag_spec was expanded, because we can't
4135
# assume the linker understands whole_archive_flag_spec.
4136
# This may have to be revisited, in case too many
4137
# convenience libraries get linked in and end up exceeding
4139
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4140
save_libobjs=$libobjs
4143
output_la=`$echo "X$output" | $Xsed -e "$basename"`
4145
# Clear the reloadable object creation command queue and
4146
# initialize k to one.
4153
output=$output_objdir/$output_la-${k}.$objext
4154
# Loop over the list of objects to be linked.
4155
for obj in $save_libobjs
4157
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4158
if test "X$objlist" = X ||
4159
{ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4160
test "$len" -le "$max_cmd_len"; }; then
4161
objlist="$objlist $obj"
4163
# The command $test_cmds is almost too long, add a
4164
# command to the queue.
4165
if test "$k" -eq 1 ; then
4166
# The first file doesn't have a previous command to add.
4167
eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4169
# All subsequent reloadable object files will link in
4170
# the last one created.
4171
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4173
last_robj=$output_objdir/$output_la-${k}.$objext
4175
output=$output_objdir/$output_la-${k}.$objext
4180
# Handle the remaining objects by creating one last
4181
# reloadable object file. All subsequent reloadable object
4182
# files will link in the last one created.
4183
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4184
eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4186
if ${skipped_export-false}; then
4187
$show "generating symbol list for \`$libname.la'"
4188
export_symbols="$output_objdir/$libname.exp"
4189
$run $rm $export_symbols
4191
# Append the command to create the export file.
4192
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4195
# Set up a command to remove the reloadable object files
4196
# after they are used.
4198
while test "$i" -lt "$k"
4201
delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4204
$echo "creating a temporary reloadable object file: $output"
4206
# Loop through the commands generated above and execute them.
4207
save_ifs="$IFS"; IFS='~'
4208
for cmd in $concat_cmds; do
4211
$run eval "$cmd" || exit $?
4216
# Restore the value of output.
4219
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4220
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4222
# Expand the library linking commands again to reset the
4223
# value of $libobjs for piecewise linking.
4225
# Do each of the archive commands.
4226
if test "$module" = yes && test -n "$module_cmds" ; then
4227
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4228
cmds=$module_expsym_cmds
4233
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4234
cmds=$archive_expsym_cmds
4240
# Append the command to remove the reloadable object files
4241
# to the just-reset $cmds.
4242
eval cmds=\"\$cmds~\$rm $delfiles\"
4244
save_ifs="$IFS"; IFS='~'
4245
for cmd in $cmds; do
4249
$run eval "$cmd" || {
4252
# Restore the uninstalled library and exit
4253
if test "$mode" = relink; then
4254
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4262
# Restore the uninstalled library and exit
4263
if test "$mode" = relink; then
4264
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4266
if test -n "$convenience"; then
4267
if test -z "$whole_archive_flag_spec"; then
4268
$show "${rm}r $gentop"
4269
$run ${rm}r "$gentop"
4276
# Create links to the real library.
4277
for linkname in $linknames; do
4278
if test "$realname" != "$linkname"; then
4279
$show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4280
$run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4284
# If -module or -export-dynamic was specified, set the dlname.
4285
if test "$module" = yes || test "$export_dynamic" = yes; then
4286
# On all known operating systems, these are identical.
4293
if test -n "$deplibs"; then
4294
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4297
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4298
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4301
if test -n "$rpath"; then
4302
$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4305
if test -n "$xrpath"; then
4306
$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4309
if test -n "$vinfo"; then
4310
$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4313
if test -n "$release"; then
4314
$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4319
if test -n "$objs$old_deplibs"; then
4320
$echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4324
obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4332
# Delete the old objects.
4333
$run $rm $obj $libobj
4335
# Objects from convenience libraries. This assumes
4336
# single-version convenience libraries. Whenever we create
4337
# different ones for PIC/non-PIC, this we'll have to duplicate
4341
# reload_cmds runs $LD directly, so let us get rid of
4342
# -Wl from whole_archive_flag_spec and hope we can get by with
4343
# turning comma into space..
4346
if test -n "$convenience"; then
4347
if test -n "$whole_archive_flag_spec"; then
4348
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4349
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4351
gentop="$output_objdir/${obj}x"
4352
generated="$generated $gentop"
4354
func_extract_archives $gentop $convenience
4355
reload_conv_objs="$reload_objs $func_extract_archives_result"
4359
# Create the old-style object.
4360
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
4364
save_ifs="$IFS"; IFS='~'
4365
for cmd in $cmds; do
4369
$run eval "$cmd" || exit $?
4373
# Exit if we aren't doing a library object file.
4374
if test -z "$libobj"; then
4375
if test -n "$gentop"; then
4376
$show "${rm}r $gentop"
4383
if test "$build_libtool_libs" != yes; then
4384
if test -n "$gentop"; then
4385
$show "${rm}r $gentop"
4389
# Create an invalid libtool object if no PIC, so that we don't
4390
# accidentally link it into a program.
4391
# $show "echo timestamp > $libobj"
4392
# $run eval "echo timestamp > $libobj" || exit $?
4396
if test -n "$pic_flag" || test "$pic_mode" != default; then
4397
# Only do commands if we really have different PIC objects.
4398
reload_objs="$libobjs $reload_conv_objs"
4401
save_ifs="$IFS"; IFS='~'
4402
for cmd in $cmds; do
4406
$run eval "$cmd" || exit $?
4411
if test -n "$gentop"; then
4412
$show "${rm}r $gentop"
4421
*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4423
if test -n "$vinfo"; then
4424
$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4427
if test -n "$release"; then
4428
$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4431
if test "$preload" = yes; then
4432
if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4433
test "$dlopen_self_static" = unknown; then
4434
$echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4439
*-*-rhapsody* | *-*-darwin1.[012])
4440
# On Rhapsody replace the C library is the System framework
4441
compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4442
finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4448
# Don't allow lazy linking, it breaks C++ global constructors
4449
if test "$tagname" = CXX ; then
4450
compile_command="$compile_command ${wl}-bind_at_load"
4451
finalize_command="$finalize_command ${wl}-bind_at_load"
4457
# move library search paths that coincide with paths to not yet
4458
# installed libraries to the beginning of the library search list
4460
for path in $notinst_path; do
4461
case " $new_libs " in
4462
*" -L$path/$objdir "*) ;;
4464
case " $compile_deplibs " in
4465
*" -L$path/$objdir "*)
4466
new_libs="$new_libs -L$path/$objdir" ;;
4471
for deplib in $compile_deplibs; do
4474
case " $new_libs " in
4476
*) new_libs="$new_libs $deplib" ;;
4479
*) new_libs="$new_libs $deplib" ;;
4482
compile_deplibs="$new_libs"
4485
compile_command="$compile_command $compile_deplibs"
4486
finalize_command="$finalize_command $finalize_deplibs"
4488
if test -n "$rpath$xrpath"; then
4489
# If the user specified any rpath flags, then add them.
4490
for libdir in $rpath $xrpath; do
4491
# This is the magic to use -rpath.
4492
case "$finalize_rpath " in
4494
*) finalize_rpath="$finalize_rpath $libdir" ;;
4499
# Now hardcode the library paths
4502
for libdir in $compile_rpath $finalize_rpath; do
4503
if test -n "$hardcode_libdir_flag_spec"; then
4504
if test -n "$hardcode_libdir_separator"; then
4505
if test -z "$hardcode_libdirs"; then
4506
hardcode_libdirs="$libdir"
4508
# Just accumulate the unique libdirs.
4509
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4510
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4513
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4518
eval flag=\"$hardcode_libdir_flag_spec\"
4519
rpath="$rpath $flag"
4521
elif test -n "$runpath_var"; then
4522
case "$perm_rpath " in
4524
*) perm_rpath="$perm_rpath $libdir" ;;
4528
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4529
testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4530
case :$dllsearchpath: in
4532
*) dllsearchpath="$dllsearchpath:$libdir";;
4534
case :$dllsearchpath: in
4535
*":$testbindir:"*) ;;
4536
*) dllsearchpath="$dllsearchpath:$testbindir";;
4541
# Substitute the hardcoded libdirs into the rpath.
4542
if test -n "$hardcode_libdir_separator" &&
4543
test -n "$hardcode_libdirs"; then
4544
libdir="$hardcode_libdirs"
4545
eval rpath=\" $hardcode_libdir_flag_spec\"
4547
compile_rpath="$rpath"
4551
for libdir in $finalize_rpath; do
4552
if test -n "$hardcode_libdir_flag_spec"; then
4553
if test -n "$hardcode_libdir_separator"; then
4554
if test -z "$hardcode_libdirs"; then
4555
hardcode_libdirs="$libdir"
4557
# Just accumulate the unique libdirs.
4558
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4559
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4562
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4567
eval flag=\"$hardcode_libdir_flag_spec\"
4568
rpath="$rpath $flag"
4570
elif test -n "$runpath_var"; then
4571
case "$finalize_perm_rpath " in
4573
*) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4577
# Substitute the hardcoded libdirs into the rpath.
4578
if test -n "$hardcode_libdir_separator" &&
4579
test -n "$hardcode_libdirs"; then
4580
libdir="$hardcode_libdirs"
4581
eval rpath=\" $hardcode_libdir_flag_spec\"
4583
finalize_rpath="$rpath"
4585
if test -n "$libobjs" && test "$build_old_libs" = yes; then
4586
# Transform all the library objects into standard objects.
4587
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4588
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4592
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4593
if test -n "$NM" && test -n "$global_symbol_pipe"; then
4594
dlsyms="${outputname}S.c"
4596
$echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4600
if test -n "$dlsyms"; then
4604
# Discover the nlist of each of the dlfiles.
4605
nlist="$output_objdir/${outputname}.nm"
4607
$show "$rm $nlist ${nlist}S ${nlist}T"
4608
$run $rm "$nlist" "${nlist}S" "${nlist}T"
4610
# Parse the name list into a source file.
4611
$show "creating $output_objdir/$dlsyms"
4613
test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4614
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4615
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4621
/* Prevent the only kind of declaration conflicts we can make. */
4622
#define lt_preloaded_symbols some_other_symbol
4624
/* External symbol declarations for the compiler. */\
4627
if test "$dlself" = yes; then
4628
$show "generating symbol list for \`$output'"
4630
test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4632
# Add our own program objects to the symbol list.
4633
progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4634
for arg in $progfiles; do
4635
$show "extracting global C symbols from \`$arg'"
4636
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4639
if test -n "$exclude_expsyms"; then
4640
$run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4641
$run eval '$mv "$nlist"T "$nlist"'
4644
if test -n "$export_symbols_regex"; then
4645
$run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4646
$run eval '$mv "$nlist"T "$nlist"'
4649
# Prepare the list of exported symbols
4650
if test -z "$export_symbols"; then
4651
export_symbols="$output_objdir/$outputname.exp"
4652
$run $rm $export_symbols
4653
$run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4655
*cygwin* | *mingw* )
4656
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4657
$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4661
$run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4662
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4663
$run eval 'mv "$nlist"T "$nlist"'
4665
*cygwin* | *mingw* )
4666
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4667
$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4673
for arg in $dlprefiles; do
4674
$show "extracting global C symbols from \`$arg'"
4675
name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4676
$run eval '$echo ": $name " >> "$nlist"'
4677
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4680
if test -z "$run"; then
4681
# Make sure we have at least an empty file.
4682
test -f "$nlist" || : > "$nlist"
4684
if test -n "$exclude_expsyms"; then
4685
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4686
$mv "$nlist"T "$nlist"
4689
# Try sorting and uniquifying the output.
4690
if grep -v "^: " < "$nlist" |
4691
if sort -k 3 </dev/null >/dev/null 2>&1; then
4696
uniq > "$nlist"S; then
4699
grep -v "^: " < "$nlist" > "$nlist"S
4702
if test -f "$nlist"S; then
4703
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4705
$echo '/* NONE */' >> "$output_objdir/$dlsyms"
4708
$echo >> "$output_objdir/$dlsyms" "\
4710
#undef lt_preloaded_symbols
4712
#if defined (__STDC__) && __STDC__
4713
# define lt_ptr void *
4715
# define lt_ptr char *
4719
/* The mapping between symbol names and symbols. */
4723
*cygwin* | *mingw* )
4724
$echo >> "$output_objdir/$dlsyms" "\
4725
/* DATA imports from DLLs on WIN32 can't be const, because
4726
runtime relocations are performed -- see ld's documentation
4732
$echo >> "$output_objdir/$dlsyms" "\
4739
$echo >> "$output_objdir/$dlsyms" "\
4743
lt_preloaded_symbols[] =
4747
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4749
$echo >> "$output_objdir/$dlsyms" "\
4753
/* This works around a problem in FreeBSD linker */
4754
#ifdef FREEBSD_WORKAROUND
4755
static const void *lt_preloaded_setup() {
4756
return lt_preloaded_symbols;
4766
pic_flag_for_symtable=
4768
# compiling the symbol table file with pic_flag works around
4769
# a FreeBSD bug that causes programs to crash when -lm is
4770
# linked before any other PIC object. But we must not use
4771
# pic_flag when linking with -static. The problem exists in
4772
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4773
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4774
case "$compile_command " in
4776
*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4779
case "$compile_command " in
4781
*) pic_flag_for_symtable=" $pic_flag";;
4785
# Now compile the dynamic symbol file.
4786
$show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4787
$run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4789
# Clean up the generated files.
4790
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4791
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4793
# Transform the symbol file into the correct name.
4795
*cygwin* | *mingw* )
4796
if test -f "$output_objdir/${outputname}.def" ; then
4797
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4798
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4800
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4801
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4805
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4806
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4811
# FreeBSD doesn't need this...
4814
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4819
# We keep going just in case the user didn't refer to
4820
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4821
# really was required.
4823
# Nullify the symbol file.
4824
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4825
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4828
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4829
# Replace the output file specification.
4830
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4831
link_command="$compile_command$compile_rpath"
4833
# We have no uninstalled library dependencies, so finalize right now.
4834
$show "$link_command"
4835
$run eval "$link_command"
4838
# Delete the generated files.
4839
if test -n "$dlsyms"; then
4840
$show "$rm $output_objdir/${outputname}S.${objext}"
4841
$run $rm "$output_objdir/${outputname}S.${objext}"
4847
if test -n "$shlibpath_var"; then
4848
# We should set the shlibpath_var
4850
for dir in $temp_rpath; do
4852
[\\/]* | [A-Za-z]:[\\/]*)
4857
# Relative path: add a thisdir entry.
4858
rpath="$rpath\$thisdir/$dir:"
4865
if test -n "$compile_shlibpath$finalize_shlibpath"; then
4866
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4868
if test -n "$finalize_shlibpath"; then
4869
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4874
if test -n "$runpath_var"; then
4875
if test -n "$perm_rpath"; then
4876
# We should set the runpath_var.
4878
for dir in $perm_rpath; do
4881
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4883
if test -n "$finalize_perm_rpath"; then
4884
# We should set the runpath_var.
4886
for dir in $finalize_perm_rpath; do
4889
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4893
if test "$no_install" = yes; then
4894
# We don't need to create a wrapper script.
4895
link_command="$compile_var$compile_command$compile_rpath"
4896
# Replace the output file specification.
4897
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4898
# Delete the old output file.
4900
# Link the executable and exit
4901
$show "$link_command"
4902
$run eval "$link_command" || exit $?
4906
if test "$hardcode_action" = relink; then
4907
# Fast installation is not supported
4908
link_command="$compile_var$compile_command$compile_rpath"
4909
relink_command="$finalize_var$finalize_command$finalize_rpath"
4911
$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4912
$echo "$modename: \`$output' will be relinked during installation" 1>&2
4914
if test "$fast_install" != no; then
4915
link_command="$finalize_var$compile_command$finalize_rpath"
4916
if test "$fast_install" = yes; then
4917
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4919
# fast_install is set to needless
4923
link_command="$compile_var$compile_command$compile_rpath"
4924
relink_command="$finalize_var$finalize_command$finalize_rpath"
4928
# Replace the output file specification.
4929
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4931
# Delete the old output files.
4932
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4934
$show "$link_command"
4935
$run eval "$link_command" || exit $?
4937
# Now create the wrapper script.
4938
$show "creating $output"
4940
# Quote the relink command for shipping.
4941
if test -n "$relink_command"; then
4942
# Preserve any variables that may affect compiler behavior
4943
for var in $variables_saved_for_relink; do
4944
if eval test -z \"\${$var+set}\"; then
4945
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4946
elif eval var_value=\$$var; test -z "$var_value"; then
4947
relink_command="$var=; export $var; $relink_command"
4949
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4950
relink_command="$var=\"$var_value\"; export $var; $relink_command"
4953
relink_command="(cd `pwd`; $relink_command)"
4954
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4957
# Quote $echo for shipping.
4958
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4960
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4961
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4963
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4965
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4968
# Only actually do things if our run command is non-null.
4969
if test -z "$run"; then
4970
# win32 will think the script is a binary if it has
4971
# a .exe suffix, so we strip it off here.
4973
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4975
# test for cygwin because mv fails w/o .exe extensions
4979
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4983
*cygwin* | *mingw* )
4984
output_name=`basename $output`
4985
output_path=`dirname $output`
4986
cwrappersource="$output_path/$objdir/lt-$output_name.c"
4987
cwrapper="$output_path/$output_name.exe"
4988
$rm $cwrappersource $cwrapper
4989
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4991
cat > $cwrappersource <<EOF
4993
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4994
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4996
The $output program cannot be directly executed until all the libtool
4997
libraries that it depends on are installed.
4999
This wrapper executable should never be moved out of the build directory.
5000
If it is, it will not operate correctly.
5002
Currently, it simply execs the wrapper *script* "/bin/sh $output",
5003
but could eventually absorb all of the scripts functionality and
5004
exec $objdir/$outputname directly.
5007
cat >> $cwrappersource<<"EOF"
5016
#include <sys/stat.h>
5018
#if defined(PATH_MAX)
5019
# define LT_PATHMAX PATH_MAX
5020
#elif defined(MAXPATHLEN)
5021
# define LT_PATHMAX MAXPATHLEN
5023
# define LT_PATHMAX 1024
5026
#ifndef DIR_SEPARATOR
5027
# define DIR_SEPARATOR '/'
5028
# define PATH_SEPARATOR ':'
5031
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5033
# define HAVE_DOS_BASED_FILE_SYSTEM
5034
# ifndef DIR_SEPARATOR_2
5035
# define DIR_SEPARATOR_2 '\\'
5037
# ifndef PATH_SEPARATOR_2
5038
# define PATH_SEPARATOR_2 ';'
5042
#ifndef DIR_SEPARATOR_2
5043
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5044
#else /* DIR_SEPARATOR_2 */
5045
# define IS_DIR_SEPARATOR(ch) \
5046
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5047
#endif /* DIR_SEPARATOR_2 */
5049
#ifndef PATH_SEPARATOR_2
5050
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5051
#else /* PATH_SEPARATOR_2 */
5052
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5053
#endif /* PATH_SEPARATOR_2 */
5055
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5056
#define XFREE(stale) do { \
5057
if (stale) { free ((void *) stale); stale = 0; } \
5060
/* -DDEBUG is fairly common in CFLAGS. */
5062
#if defined DEBUGWRAPPER
5063
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5065
# define DEBUG(format, ...)
5068
const char *program_name = NULL;
5070
void * xmalloc (size_t num);
5071
char * xstrdup (const char *string);
5072
const char * base_name (const char *name);
5073
char * find_executable(const char *wrapper);
5074
int check_executable(const char *path);
5075
char * strendzap(char *str, const char *pat);
5076
void lt_fatal (const char *message, ...);
5079
main (int argc, char *argv[])
5084
program_name = (char *) xstrdup (base_name (argv[0]));
5085
DEBUG("(main) argv[0] : %s\n",argv[0]);
5086
DEBUG("(main) program_name : %s\n",program_name);
5087
newargz = XMALLOC(char *, argc+2);
5090
cat >> $cwrappersource <<EOF
5091
newargz[0] = (char *) xstrdup("$SHELL");
5094
cat >> $cwrappersource <<"EOF"
5095
newargz[1] = find_executable(argv[0]);
5096
if (newargz[1] == NULL)
5097
lt_fatal("Couldn't find %s", argv[0]);
5098
DEBUG("(main) found exe at : %s\n",newargz[1]);
5099
/* we know the script has the same name, without the .exe */
5100
/* so make sure newargz[1] doesn't end in .exe */
5101
strendzap(newargz[1],".exe");
5102
for (i = 1; i < argc; i++)
5103
newargz[i+1] = xstrdup(argv[i]);
5104
newargz[argc+1] = NULL;
5106
for (i=0; i<argc+1; i++)
5108
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5116
cat >> $cwrappersource <<EOF
5117
execv("$SHELL",(char const **)newargz);
5121
cat >> $cwrappersource <<EOF
5122
execv("$SHELL",newargz);
5127
cat >> $cwrappersource <<"EOF"
5132
xmalloc (size_t num)
5134
void * p = (void *) malloc (num);
5136
lt_fatal ("Memory exhausted");
5142
xstrdup (const char *string)
5144
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5149
base_name (const char *name)
5153
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5154
/* Skip over the disk name in MSDOS pathnames. */
5155
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5159
for (base = name; *name; name++)
5160
if (IS_DIR_SEPARATOR (*name))
5166
check_executable(const char * path)
5170
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5171
if ((!path) || (!*path))
5174
if ((stat (path, &st) >= 0) &&
5176
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5177
#if defined (S_IXOTH)
5178
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5180
#if defined (S_IXGRP)
5181
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5183
((st.st_mode & S_IXUSR) == S_IXUSR))
5190
/* Searches for the full path of the wrapper. Returns
5191
newly allocated full path name if found, NULL otherwise */
5193
find_executable (const char* wrapper)
5198
/* static buffer for getcwd */
5199
char tmp[LT_PATHMAX + 1];
5203
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5205
if ((wrapper == NULL) || (*wrapper == '\0'))
5208
/* Absolute path? */
5209
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5210
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5212
concat_name = xstrdup (wrapper);
5213
if (check_executable(concat_name))
5220
if (IS_DIR_SEPARATOR (wrapper[0]))
5222
concat_name = xstrdup (wrapper);
5223
if (check_executable(concat_name))
5227
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5231
for (p = wrapper; *p; p++)
5239
/* no slashes; search PATH */
5240
const char* path = getenv ("PATH");
5243
for (p = path; *p; p = p_next)
5247
for (q = p; *q; q++)
5248
if (IS_PATH_SEPARATOR(*q))
5251
p_next = (*q == '\0' ? q : q + 1);
5254
/* empty path: current directory */
5255
if (getcwd (tmp, LT_PATHMAX) == NULL)
5256
lt_fatal ("getcwd failed");
5257
tmp_len = strlen(tmp);
5258
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5259
memcpy (concat_name, tmp, tmp_len);
5260
concat_name[tmp_len] = '/';
5261
strcpy (concat_name + tmp_len + 1, wrapper);
5265
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5266
memcpy (concat_name, p, p_len);
5267
concat_name[p_len] = '/';
5268
strcpy (concat_name + p_len + 1, wrapper);
5270
if (check_executable(concat_name))
5275
/* not found in PATH; assume curdir */
5277
/* Relative path | not found in path: prepend cwd */
5278
if (getcwd (tmp, LT_PATHMAX) == NULL)
5279
lt_fatal ("getcwd failed");
5280
tmp_len = strlen(tmp);
5281
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5282
memcpy (concat_name, tmp, tmp_len);
5283
concat_name[tmp_len] = '/';
5284
strcpy (concat_name + tmp_len + 1, wrapper);
5286
if (check_executable(concat_name))
5293
strendzap(char *str, const char *pat)
5297
assert(str != NULL);
5298
assert(pat != NULL);
5301
patlen = strlen(pat);
5305
str += len - patlen;
5306
if (strcmp(str, pat) == 0)
5313
lt_error_core (int exit_status, const char * mode,
5314
const char * message, va_list ap)
5316
fprintf (stderr, "%s: %s: ", program_name, mode);
5317
vfprintf (stderr, message, ap);
5318
fprintf (stderr, ".\n");
5320
if (exit_status >= 0)
5325
lt_fatal (const char *message, ...)
5328
va_start (ap, message);
5329
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5333
# we should really use a build-platform specific compiler
5334
# here, but OTOH, the wrappers (shell script and this C one)
5335
# are only useful if you want to execute the "real" binary.
5336
# Since the "real" binary is built for $host, then this
5337
# wrapper might as well be built for $host, too.
5338
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5342
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5347
# $output - temporary wrapper script for $objdir/$outputname
5348
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5350
# The $output program cannot be directly executed until all the libtool
5351
# libraries that it depends on are installed.
5353
# This wrapper script should never be moved out of the build directory.
5354
# If it is, it will not operate correctly.
5356
# Sed substitution that helps us do robust quoting. It backslashifies
5357
# metacharacters that are still active within double-quoted strings.
5358
Xsed='${SED} -e 1s/^X//'
5359
sed_quote_subst='$sed_quote_subst'
5361
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5362
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5365
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5366
# is contrary to our usage. Disable this feature.
5367
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5368
setopt NO_GLOB_SUBST
5370
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5372
BIN_SH=xpg4; export BIN_SH # for Tru64
5373
DUALCASE=1; export DUALCASE # for MKS sh
5375
# The HP-UX ksh and POSIX shell print the target directory to stdout
5377
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5379
relink_command=\"$relink_command\"
5381
# This environment variable determines our operation mode.
5382
if test \"\$libtool_install_magic\" = \"$magic\"; then
5383
# install mode needs the following variable:
5384
notinst_deplibs='$notinst_deplibs'
5386
# When we are sourced in execute mode, \$file and \$echo are already set.
5387
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5390
# Make sure echo works.
5391
if test \"X\$1\" = X--no-reexec; then
5392
# Discard the --no-reexec flag, and continue.
5394
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5395
# Yippee, \$echo works!
5398
# Restart under the correct shell, and then maybe \$echo will work.
5399
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5405
# Find the directory that this script lives in.
5406
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5407
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5409
# Follow symbolic links until we get to the real thisdir.
5410
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5411
while test -n \"\$file\"; do
5412
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5414
# If there was a directory component, then change thisdir.
5415
if test \"x\$destdir\" != \"x\$file\"; then
5416
case \"\$destdir\" in
5417
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5418
*) thisdir=\"\$thisdir/\$destdir\" ;;
5422
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5423
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5426
# Try to get the absolute directory name.
5427
absdir=\`cd \"\$thisdir\" && pwd\`
5428
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5431
if test "$fast_install" = yes; then
5433
program=lt-'$outputname'$exeext
5434
progdir=\"\$thisdir/$objdir\"
5436
if test ! -f \"\$progdir/\$program\" || \\
5437
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5438
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5440
file=\"\$\$-\$program\"
5442
if test ! -d \"\$progdir\"; then
5443
$mkdir \"\$progdir\"
5445
$rm \"\$progdir/\$file\"
5450
# relink executable if necessary
5451
if test -n \"\$relink_command\"; then
5452
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5454
$echo \"\$relink_command_output\" >&2
5455
$rm \"\$progdir/\$file\"
5460
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5461
{ $rm \"\$progdir/\$program\";
5462
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5463
$rm \"\$progdir/\$file\"
5467
program='$outputname'
5468
progdir=\"\$thisdir/$objdir\"
5474
if test -f \"\$progdir/\$program\"; then"
5476
# Export our shlibpath_var if we have one.
5477
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5479
# Add our own library path to $shlibpath_var
5480
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5482
# Some systems cannot cope with colon-terminated $shlibpath_var
5483
# The second colon is a workaround for a bug in BeOS R4 sed
5484
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5486
export $shlibpath_var
5490
# fixup the dll searchpath if we need to.
5491
if test -n "$dllsearchpath"; then
5493
# Add the dll search path components to the executable PATH
5494
PATH=$dllsearchpath:\$PATH
5499
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5500
# Run the actual program with our arguments.
5503
# Backslashes separate directories on plain windows
5504
*-*-mingw | *-*-os2*)
5506
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5512
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5517
\$echo \"\$0: cannot exec \$program \$*\"
5521
# The program doesn't exist.
5522
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5523
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5524
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
5535
# See if we need to build an old-fashioned archive.
5536
for oldlib in $oldlibs; do
5538
if test "$build_libtool_libs" = convenience; then
5539
oldobjs="$libobjs_save"
5540
addlibs="$convenience"
5541
build_libtool_libs=no
5543
if test "$build_libtool_libs" = module; then
5544
oldobjs="$libobjs_save"
5545
build_libtool_libs=no
5547
oldobjs="$old_deplibs $non_pic_objects"
5549
addlibs="$old_convenience"
5552
if test -n "$addlibs"; then
5553
gentop="$output_objdir/${outputname}x"
5554
generated="$generated $gentop"
5556
func_extract_archives $gentop $addlibs
5557
oldobjs="$oldobjs $func_extract_archives_result"
5560
# Do each command in the archive commands.
5561
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5562
cmds=$old_archive_from_new_cmds
5564
# POSIX demands no paths to be encoded in archives. We have
5565
# to avoid creating archives with duplicate basenames if we
5566
# might have to extract them afterwards, e.g., when creating a
5567
# static archive out of a convenience library, or when linking
5568
# the entirety of a libtool archive into another (currently
5569
# not supported by libtool).
5570
if (for obj in $oldobjs
5572
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5573
done | sort | sort -uc >/dev/null 2>&1); then
5576
$echo "copying selected object files to avoid basename conflicts..."
5578
if test -z "$gentop"; then
5579
gentop="$output_objdir/${outputname}x"
5580
generated="$generated $gentop"
5582
$show "${rm}r $gentop"
5583
$run ${rm}r "$gentop"
5584
$show "$mkdir $gentop"
5585
$run $mkdir "$gentop"
5587
if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5592
save_oldobjs=$oldobjs
5595
for obj in $save_oldobjs
5597
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5598
case " $oldobjs " in
5599
" ") oldobjs=$obj ;;
5602
# Make sure we don't pick an alternate name that also
5604
newobj=lt$counter-$objbase
5605
counter=`expr $counter + 1`
5606
case " $oldobjs " in
5607
*[\ /]"$newobj "*) ;;
5608
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5611
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5612
$run ln "$obj" "$gentop/$newobj" ||
5613
$run cp "$obj" "$gentop/$newobj"
5614
oldobjs="$oldobjs $gentop/$newobj"
5616
*) oldobjs="$oldobjs $obj" ;;
5621
eval cmds=\"$old_archive_cmds\"
5623
if len=`expr "X$cmds" : ".*"` &&
5624
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5625
cmds=$old_archive_cmds
5627
# the command line is too long to link in one step, link in parts
5628
$echo "using piecewise archive linking..."
5633
save_oldobjs=$oldobjs
5635
# Is there a better way of finding the last object in the list?
5636
for obj in $save_oldobjs
5640
for obj in $save_oldobjs
5642
oldobjs="$objlist $obj"
5643
objlist="$objlist $obj"
5644
eval test_cmds=\"$old_archive_cmds\"
5645
if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5646
test "$len" -le "$max_cmd_len"; then
5649
# the above command should be used before it gets too long
5651
if test "$obj" = "$last_oldobj" ; then
5654
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5655
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5661
if test "X$oldobjs" = "X" ; then
5662
eval cmds=\"\$concat_cmds\"
5664
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5668
save_ifs="$IFS"; IFS='~'
5669
for cmd in $cmds; do
5673
$run eval "$cmd" || exit $?
5678
if test -n "$generated"; then
5679
$show "${rm}r$generated"
5680
$run ${rm}r$generated
5683
# Now create the libtool archive.
5687
test "$build_old_libs" = yes && old_library="$libname.$libext"
5688
$show "creating $output"
5690
# Preserve any variables that may affect compiler behavior
5691
for var in $variables_saved_for_relink; do
5692
if eval test -z \"\${$var+set}\"; then
5693
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5694
elif eval var_value=\$$var; test -z "$var_value"; then
5695
relink_command="$var=; export $var; $relink_command"
5697
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5698
relink_command="$var=\"$var_value\"; export $var; $relink_command"
5701
# Quote the link command for shipping.
5702
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5703
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5704
if test "$hardcode_automatic" = yes ; then
5709
# Only create the output if not a dry run.
5710
if test -z "$run"; then
5711
for installed in no yes; do
5712
if test "$installed" = yes; then
5713
if test -z "$install_libdir"; then
5716
output="$output_objdir/$outputname"i
5717
# Replace all uninstalled libtool libraries with the installed ones
5719
for deplib in $dependency_libs; do
5722
name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5723
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5724
if test -z "$libdir"; then
5725
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5728
newdependency_libs="$newdependency_libs $libdir/$name"
5730
*) newdependency_libs="$newdependency_libs $deplib" ;;
5733
dependency_libs="$newdependency_libs"
5735
for lib in $dlfiles; do
5736
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5737
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5738
if test -z "$libdir"; then
5739
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5742
newdlfiles="$newdlfiles $libdir/$name"
5744
dlfiles="$newdlfiles"
5746
for lib in $dlprefiles; do
5747
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5748
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5749
if test -z "$libdir"; then
5750
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5753
newdlprefiles="$newdlprefiles $libdir/$name"
5755
dlprefiles="$newdlprefiles"
5758
for lib in $dlfiles; do
5760
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5761
*) abs=`pwd`"/$lib" ;;
5763
newdlfiles="$newdlfiles $abs"
5765
dlfiles="$newdlfiles"
5767
for lib in $dlprefiles; do
5769
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5770
*) abs=`pwd`"/$lib" ;;
5772
newdlprefiles="$newdlprefiles $abs"
5774
dlprefiles="$newdlprefiles"
5777
# place dlname in correct position for cygwin
5779
case $host,$output,$installed,$module,$dlname in
5780
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5783
# $outputname - a libtool library file
5784
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5786
# Please DO NOT delete this file!
5787
# It is necessary for linking the library.
5789
# The name that we can dlopen(3).
5792
# Names of this library.
5793
library_names='$library_names'
5795
# The name of the static archive.
5796
old_library='$old_library'
5798
# Libraries that this one depends upon.
5799
dependency_libs='$dependency_libs'
5801
# Version information for $libname.
5806
# Is this an already installed library?
5807
installed=$installed
5809
# Should we warn about portability when linking against -modules?
5810
shouldnotlink=$module
5812
# Files to dlopen/dlpreopen
5814
dlpreopen='$dlprefiles'
5816
# Directory that this library needs to be installed in:
5817
libdir='$install_libdir'"
5818
if test "$installed" = no && test "$need_relink" = yes; then
5820
relink_command=\"$relink_command\""
5825
# Do a symbolic link so that the libtool archive can be found in
5826
# LD_LIBRARY_PATH before the program is installed.
5827
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5828
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5834
# libtool install mode
5836
modename="$modename: install"
5838
# There may be an optional sh(1) argument at the beginning of
5839
# install_prog (especially on Windows NT).
5840
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5841
# Allow the use of GNU shtool's install command.
5842
$echo "X$nonopt" | grep shtool > /dev/null; then
5843
# Aesthetically quote it.
5844
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5846
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5850
install_prog="$arg "
5858
# The real first argument should be the name of the installation program.
5859
# Aesthetically quote it.
5860
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5862
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5866
install_prog="$install_prog$arg"
5868
# We need to accept at least all the BSD install flags.
5878
if test -n "$dest"; then
5879
files="$files $dest"
5887
case " $install_prog " in
5892
-g | -m | -o) prev=$arg ;;
5900
# If the previous option needed an argument, then skip it.
5901
if test -n "$prev"; then
5910
# Aesthetically quote the argument.
5911
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5913
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5917
install_prog="$install_prog $arg"
5920
if test -z "$install_prog"; then
5921
$echo "$modename: you must specify an install program" 1>&2
5926
if test -n "$prev"; then
5927
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5932
if test -z "$files"; then
5933
if test -z "$dest"; then
5934
$echo "$modename: no file or destination specified" 1>&2
5936
$echo "$modename: you must specify a destination" 1>&2
5942
# Strip any trailing slash from the destination.
5943
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5945
# Check to see that the destination is a directory.
5946
test -d "$dest" && isdir=yes
5947
if test "$isdir" = yes; then
5951
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5952
test "X$destdir" = "X$dest" && destdir=.
5953
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5955
# Not a directory, so check to see that there is only one file specified.
5957
if test "$#" -gt 2; then
5958
$echo "$modename: \`$dest' is not a directory" 1>&2
5964
[\\/]* | [A-Za-z]:[\\/]*) ;;
5966
for file in $files; do
5970
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5979
# This variable tells wrapper scripts just to set variables rather
5980
# than running their programs.
5981
libtool_install_magic="$magic"
5986
for file in $files; do
5988
# Do each installation.
5991
# Do the static libraries later.
5992
staticlibs="$staticlibs $file"
5996
# Check to see that this really is a libtool archive.
5997
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5999
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6007
# If there is no directory component, then add one.
6009
*/* | *\\*) . $file ;;
6013
# Add the libdir to current_libdirs if it is the destination.
6014
if test "X$destdir" = "X$libdir"; then
6015
case "$current_libdirs " in
6017
*) current_libdirs="$current_libdirs $libdir" ;;
6020
# Note the libdir as a future libdir.
6021
case "$future_libdirs " in
6023
*) future_libdirs="$future_libdirs $libdir" ;;
6027
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6028
test "X$dir" = "X$file/" && dir=
6031
if test -n "$relink_command"; then
6032
# Determine the prefix the user has applied to our future dir.
6033
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6035
# Don't allow the user to place us outside of our expected
6036
# location b/c this prevents finding dependent libraries that
6037
# are installed to the same prefix.
6038
# At present, this check doesn't affect windows .dll's that
6039
# are installed into $libdir/../bin (currently, that works fine)
6040
# but it's something to keep an eye on.
6041
if test "$inst_prefix_dir" = "$destdir"; then
6042
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6046
if test -n "$inst_prefix_dir"; then
6047
# Stick the inst_prefix_dir data into the link command.
6048
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6050
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6053
$echo "$modename: warning: relinking \`$file'" 1>&2
6054
$show "$relink_command"
6055
if $run eval "$relink_command"; then :
6057
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6062
# See the names of the shared library.
6063
set dummy $library_names
6064
if test -n "$2"; then
6070
test -n "$relink_command" && srcname="$realname"T
6072
# Install the shared library and build the symlinks.
6073
$show "$install_prog $dir/$srcname $destdir/$realname"
6074
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6075
if test -n "$stripme" && test -n "$striplib"; then
6076
$show "$striplib $destdir/$realname"
6077
$run eval "$striplib $destdir/$realname" || exit $?
6080
if test "$#" -gt 0; then
6081
# Delete the old symlinks, and create new ones.
6082
# Try `ln -sf' first, because the `ln' binary might depend on
6083
# the symlink we replace! Solaris /bin/ln does not understand -f,
6084
# so we also need to try rm && ln -s.
6087
if test "$linkname" != "$realname"; then
6088
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6089
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6094
# Do each command in the postinstall commands.
6095
lib="$destdir/$realname"
6096
cmds=$postinstall_cmds
6097
save_ifs="$IFS"; IFS='~'
6098
for cmd in $cmds; do
6102
$run eval "$cmd" || {
6105
# Restore the uninstalled library and exit
6106
if test "$mode" = relink; then
6107
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6116
# Install the pseudo-library for information purposes.
6117
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6118
instname="$dir/$name"i
6119
$show "$install_prog $instname $destdir/$name"
6120
$run eval "$install_prog $instname $destdir/$name" || exit $?
6122
# Maybe install the static library, too.
6123
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6127
# Install (i.e. copy) a libtool object.
6129
# Figure out destination file name, if it wasn't already specified.
6130
if test -n "$destname"; then
6131
destfile="$destdir/$destname"
6133
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6134
destfile="$destdir/$destfile"
6137
# Deduce the name of the destination old-style object file.
6140
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6143
staticdest="$destfile"
6147
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6153
# Install the libtool object if requested.
6154
if test -n "$destfile"; then
6155
$show "$install_prog $file $destfile"
6156
$run eval "$install_prog $file $destfile" || exit $?
6159
# Install the old object if enabled.
6160
if test "$build_old_libs" = yes; then
6161
# Deduce the name of the old-style object file.
6162
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6164
$show "$install_prog $staticobj $staticdest"
6165
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6171
# Figure out destination file name, if it wasn't already specified.
6172
if test -n "$destname"; then
6173
destfile="$destdir/$destname"
6175
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6176
destfile="$destdir/$destfile"
6179
# If the file is missing, and there is a .exe on the end, strip it
6180
# because it is most likely a libtool script we actually want to
6185
if test ! -f "$file"; then
6186
file=`$echo $file|${SED} 's,.exe$,,'`
6192
# Do a test to see if this is really a libtool program.
6195
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6201
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6205
# Note that it is not necessary on cygwin/mingw to append a dot to
6206
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6207
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6208
# `FILE.' does not work on cygwin managed mounts.
6210
# If there is no directory component, then add one.
6212
*/* | *\\*) . ${wrapper} ;;
6213
*) . ./${wrapper} ;;
6216
# Check the variables that should have been set.
6217
if test -z "$notinst_deplibs"; then
6218
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6223
for lib in $notinst_deplibs; do
6224
# Check to see that each library is installed.
6226
if test -f "$lib"; then
6227
# If there is no directory component, then add one.
6229
*/* | *\\*) . $lib ;;
6233
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6234
if test -n "$libdir" && test ! -f "$libfile"; then
6235
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6241
# Note that it is not necessary on cygwin/mingw to append a dot to
6242
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6243
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6244
# `FILE.' does not work on cygwin managed mounts.
6246
# If there is no directory component, then add one.
6248
*/* | *\\*) . ${wrapper} ;;
6249
*) . ./${wrapper} ;;
6253
if test "$fast_install" = no && test -n "$relink_command"; then
6254
if test "$finalize" = yes && test -z "$run"; then
6255
tmpdir=`func_mktempdir`
6256
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6257
outputname="$tmpdir/$file"
6258
# Replace the output file specification.
6259
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6261
$show "$relink_command"
6262
if $run eval "$relink_command"; then :
6264
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6270
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6273
# Install the binary that we compiled earlier.
6274
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6278
# remove .exe since cygwin /usr/bin/install will append another
6280
case $install_prog,$host in
6281
*/usr/bin/install*,*cygwin*)
6282
case $file:$destfile in
6287
destfile=$destfile.exe
6290
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6295
$show "$install_prog$stripme $file $destfile"
6296
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6297
test -n "$outputname" && ${rm}r "$tmpdir"
6302
for file in $staticlibs; do
6303
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6305
# Set up the ranlib parameters.
6306
oldlib="$destdir/$name"
6308
$show "$install_prog $file $oldlib"
6309
$run eval "$install_prog \$file \$oldlib" || exit $?
6311
if test -n "$stripme" && test -n "$old_striplib"; then
6312
$show "$old_striplib $oldlib"
6313
$run eval "$old_striplib $oldlib" || exit $?
6316
# Do each command in the postinstall commands.
6317
cmds=$old_postinstall_cmds
6318
save_ifs="$IFS"; IFS='~'
6319
for cmd in $cmds; do
6323
$run eval "$cmd" || exit $?
6328
if test -n "$future_libdirs"; then
6329
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6332
if test -n "$current_libdirs"; then
6333
# Maybe just do a dry run.
6334
test -n "$run" && current_libdirs=" -n$current_libdirs"
6335
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6341
# libtool finish mode
6343
modename="$modename: finish"
6347
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6350
libdirs="$libdirs $dir"
6353
for libdir in $libdirs; do
6354
if test -n "$finish_cmds"; then
6355
# Do each command in the finish commands.
6357
save_ifs="$IFS"; IFS='~'
6358
for cmd in $cmds; do
6362
$run eval "$cmd" || admincmds="$admincmds
6367
if test -n "$finish_eval"; then
6368
# Do the single finish_eval.
6369
eval cmds=\"$finish_eval\"
6370
$run eval "$cmds" || admincmds="$admincmds
6376
# Exit here if they wanted silent mode.
6377
test "$show" = : && exit $EXIT_SUCCESS
6379
$echo "X----------------------------------------------------------------------" | $Xsed
6380
$echo "Libraries have been installed in:"
6381
for libdir in $libdirs; do
6385
$echo "If you ever happen to want to link against installed libraries"
6386
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6387
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6388
$echo "flag during linking and do at least one of the following:"
6389
if test -n "$shlibpath_var"; then
6390
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6391
$echo " during execution"
6393
if test -n "$runpath_var"; then
6394
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6395
$echo " during linking"
6397
if test -n "$hardcode_libdir_flag_spec"; then
6399
eval flag=\"$hardcode_libdir_flag_spec\"
6401
$echo " - use the \`$flag' linker flag"
6403
if test -n "$admincmds"; then
6404
$echo " - have your system administrator run these commands:$admincmds"
6406
if test -f /etc/ld.so.conf; then
6407
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6410
$echo "See any operating system documentation about shared libraries for"
6411
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6412
$echo "X----------------------------------------------------------------------" | $Xsed
6416
# libtool execute mode
6418
modename="$modename: execute"
6420
# The first argument is the command name.
6422
if test -z "$cmd"; then
6423
$echo "$modename: you must specify a COMMAND" 1>&2
6428
# Handle -dlopen flags immediately.
6429
for file in $execute_dlfiles; do
6430
if test ! -f "$file"; then
6431
$echo "$modename: \`$file' is not a file" 1>&2
6439
# Check to see that this really is a libtool archive.
6440
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6442
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6447
# Read the libtool library.
6451
# If there is no directory component, then add one.
6453
*/* | *\\*) . $file ;;
6457
# Skip this library if it cannot be dlopened.
6458
if test -z "$dlname"; then
6459
# Warn if it was a shared library.
6460
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6464
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6465
test "X$dir" = "X$file" && dir=.
6467
if test -f "$dir/$objdir/$dlname"; then
6470
if test ! -f "$dir/$dlname"; then
6471
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6478
# Just add the directory containing the .lo file.
6479
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6480
test "X$dir" = "X$file" && dir=.
6484
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6489
# Get the absolute pathname.
6490
absdir=`cd "$dir" && pwd`
6491
test -n "$absdir" && dir="$absdir"
6493
# Now add the directory to shlibpath_var.
6494
if eval "test -z \"\$$shlibpath_var\""; then
6495
eval "$shlibpath_var=\"\$dir\""
6497
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6501
# This variable tells wrapper scripts just to set shlibpath_var
6502
# rather than running their programs.
6503
libtool_execute_magic="$magic"
6505
# Check if any of the arguments is a wrapper script.
6512
# Do a test to see if this is really a libtool program.
6513
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6514
# If there is no directory component, then add one.
6516
*/* | *\\*) . $file ;;
6520
# Transform arg to wrapped name.
6521
file="$progdir/$program"
6525
# Quote arguments (to preserve shell metacharacters).
6526
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6527
args="$args \"$file\""
6530
if test -z "$run"; then
6531
if test -n "$shlibpath_var"; then
6532
# Export the shlibpath_var.
6533
eval "export $shlibpath_var"
6536
# Restore saved environment variables
6537
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6539
eval "if test \"\${save_$lt_var+set}\" = set; then
6540
$lt_var=\$save_$lt_var; export $lt_var
6544
# Now prepare to actually exec the command.
6545
exec_cmd="\$cmd$args"
6547
# Display what would be done.
6548
if test -n "$shlibpath_var"; then
6549
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6550
$echo "export $shlibpath_var"
6557
# libtool clean and uninstall mode
6559
modename="$modename: $mode"
6565
# This variable tells wrapper scripts just to set variables rather
6566
# than running their programs.
6567
libtool_install_magic="$magic"
6572
-f) rm="$rm $arg"; rmforce=yes ;;
6573
-*) rm="$rm $arg" ;;
6574
*) files="$files $arg" ;;
6578
if test -z "$rm"; then
6579
$echo "$modename: you must specify an RM program" 1>&2
6586
origobjdir="$objdir"
6587
for file in $files; do
6588
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6589
if test "X$dir" = "X$file"; then
6591
objdir="$origobjdir"
6593
objdir="$dir/$origobjdir"
6595
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6596
test "$mode" = uninstall && objdir="$dir"
6598
# Remember objdir for removal later, being careful to avoid duplicates
6599
if test "$mode" = clean; then
6602
*) rmdirs="$rmdirs $objdir" ;;
6606
# Don't error if the file doesn't exist and rm -f was used.
6607
if (test -L "$file") >/dev/null 2>&1 \
6608
|| (test -h "$file") >/dev/null 2>&1 \
6609
|| test -f "$file"; then
6611
elif test -d "$file"; then
6614
elif test "$rmforce" = yes; then
6622
# Possibly a libtool archive, so verify it.
6623
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6626
# Delete the libtool libraries and symlinks.
6627
for n in $library_names; do
6628
rmfiles="$rmfiles $objdir/$n"
6630
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6634
case " $library_names " in
6635
# " " in the beginning catches empty $dlname
6637
*) rmfiles="$rmfiles $objdir/$dlname" ;;
6639
test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6642
if test -n "$library_names"; then
6643
# Do each command in the postuninstall commands.
6644
cmds=$postuninstall_cmds
6645
save_ifs="$IFS"; IFS='~'
6646
for cmd in $cmds; do
6651
if test "$?" -ne 0 && test "$rmforce" != yes; then
6658
if test -n "$old_library"; then
6659
# Do each command in the old_postuninstall commands.
6660
cmds=$old_postuninstall_cmds
6661
save_ifs="$IFS"; IFS='~'
6662
for cmd in $cmds; do
6667
if test "$?" -ne 0 && test "$rmforce" != yes; then
6673
# FIXME: should reinstall the best remaining shared library.
6680
# Possibly a libtool object, so verify it.
6681
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6686
# Add PIC object to the list of files to remove.
6687
if test -n "$pic_object" \
6688
&& test "$pic_object" != none; then
6689
rmfiles="$rmfiles $dir/$pic_object"
6692
# Add non-PIC object to the list of files to remove.
6693
if test -n "$non_pic_object" \
6694
&& test "$non_pic_object" != none; then
6695
rmfiles="$rmfiles $dir/$non_pic_object"
6701
if test "$mode" = clean ; then
6705
file=`$echo $file|${SED} 's,.exe$,,'`
6706
noexename=`$echo $name|${SED} 's,.exe$,,'`
6707
# $file with .exe has already been added to rmfiles,
6708
# add $file without .exe
6709
rmfiles="$rmfiles $file"
6712
# Do a test to see if this is a libtool program.
6713
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6717
# note $name still contains .exe if it was in $file originally
6718
# as does the version of $file that was added into $rmfiles
6719
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6720
if test "$fast_install" = yes && test -n "$relink_command"; then
6721
rmfiles="$rmfiles $objdir/lt-$name"
6723
if test "X$noexename" != "X$name" ; then
6724
rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6730
$show "$rm $rmfiles"
6731
$run $rm $rmfiles || exit_status=1
6733
objdir="$origobjdir"
6735
# Try to remove the ${objdir}s in the directories where we deleted files
6736
for dir in $rmdirs; do
6737
if test -d "$dir"; then
6739
$run rmdir $dir >/dev/null 2>&1
6747
$echo "$modename: you must specify a MODE" 1>&2
6748
$echo "$generic_help" 1>&2
6753
if test -z "$exec_cmd"; then
6754
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6755
$echo "$generic_help" 1>&2
6758
fi # test -z "$show_help"
6760
if test -n "$exec_cmd"; then
6765
# We need to display help for each of the modes.
6768
"Usage: $modename [OPTION]... [MODE-ARG]...
6770
Provide generalized library-building support services.
6772
--config show all configuration variables
6773
--debug enable verbose shell tracing
6774
-n, --dry-run display commands without modifying any files
6775
--features display basic configuration information and exit
6776
--finish same as \`--mode=finish'
6777
--help display this help message and exit
6778
--mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6779
--quiet same as \`--silent'
6780
--silent don't print informational messages
6781
--tag=TAG use configuration variables from tag TAG
6782
--version print version information
6784
MODE must be one of the following:
6786
clean remove files from the build directory
6787
compile compile a source file into a libtool object
6788
execute automatically set library path, then run a program
6789
finish complete the installation of libtool libraries
6790
install install libraries or executables
6791
link create a library or an executable
6792
uninstall remove libraries from an installed directory
6794
MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6795
a more detailed description of MODE.
6797
Report bugs to <bug-libtool@gnu.org>."
6803
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6805
Remove files from the build directory.
6807
RM is the name of the program to use to delete files associated with each FILE
6808
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6811
If FILE is a libtool library, object or program, all the files associated
6812
with it are deleted. Otherwise, only FILE itself is deleted using RM."
6817
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6819
Compile a source file into a libtool library object.
6821
This mode accepts the following additional options:
6823
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
6824
-prefer-pic try to building PIC objects only
6825
-prefer-non-pic try to building non-PIC objects only
6826
-static always build a \`.o' file suitable for static linking
6828
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6829
from the given SOURCEFILE.
6831
The output file name is determined by removing the directory component from
6832
SOURCEFILE, then substituting the C source code suffix \`.c' with the
6833
library object suffix, \`.lo'."
6838
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6840
Automatically set library path, then run a program.
6842
This mode accepts the following additional options:
6844
-dlopen FILE add the directory containing FILE to the library path
6846
This mode sets the library path environment variable according to \`-dlopen'
6849
If any of the ARGS are libtool executable wrappers, then they are translated
6850
into their corresponding uninstalled binary, and any of their required library
6851
directories are added to the library path.
6853
Then, COMMAND is executed, with ARGS as arguments."
6858
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6860
Complete the installation of libtool libraries.
6862
Each LIBDIR is a directory that contains libtool libraries.
6864
The commands that this mode executes may require superuser privileges. Use
6865
the \`--dry-run' option if you just want to see what would be executed."
6870
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6872
Install executables or libraries.
6874
INSTALL-COMMAND is the installation command. The first component should be
6875
either the \`install' or \`cp' program.
6877
The rest of the components are interpreted as arguments to that command (only
6878
BSD-compatible install options are recognized)."
6883
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6885
Link object files or libraries together to form another library, or to
6886
create an executable program.
6888
LINK-COMMAND is a command using the C compiler that you would use to create
6889
a program from several object files.
6891
The following components of LINK-COMMAND are treated specially:
6893
-all-static do not do any dynamic linking at all
6894
-avoid-version do not add a version suffix if possible
6895
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6896
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6897
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6898
-export-symbols SYMFILE
6899
try to export only the symbols listed in SYMFILE
6900
-export-symbols-regex REGEX
6901
try to export only the symbols matching REGEX
6902
-LLIBDIR search LIBDIR for required installed libraries
6903
-lNAME OUTPUT-FILE requires the installed library libNAME
6904
-module build a library that can dlopened
6905
-no-fast-install disable the fast-install mode
6906
-no-install link a not-installable executable
6907
-no-undefined declare that a library does not refer to external symbols
6908
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6909
-objectlist FILE Use a list of object files found in FILE to specify objects
6910
-precious-files-regex REGEX
6911
don't remove output files matching REGEX
6912
-release RELEASE specify package release information
6913
-rpath LIBDIR the created library will eventually be installed in LIBDIR
6914
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6915
-static do not do any dynamic linking of uninstalled libtool libraries
6916
-static-libtool-libs
6917
do not do any dynamic linking of libtool libraries
6918
-version-info CURRENT[:REVISION[:AGE]]
6919
specify library version info [each variable defaults to 0]
6921
All other options (arguments beginning with \`-') are ignored.
6923
Every other argument is treated as a filename. Files ending in \`.la' are
6924
treated as uninstalled libtool libraries, other files are standard or library
6927
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6928
only library objects (\`.lo' files) may be specified, and \`-rpath' is
6929
required, except when creating a convenience library.
6931
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6932
using \`ar' and \`ranlib', or on Windows using \`lib'.
6934
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6935
is created, otherwise an executable program is created."
6940
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6942
Remove libraries from an installation directory.
6944
RM is the name of the program to use to delete files associated with each FILE
6945
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6948
If FILE is a libtool library, all the files associated with it are deleted.
6949
Otherwise, only FILE itself is deleted using RM."
6953
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6960
$echo "Try \`$modename --help' for more information about other modes."
6964
# The TAGs below are defined such that we never get into a situation
6965
# in which we disable both kinds of libraries. Given conflicting
6966
# choices, we go for a static library, that is the most portable,
6967
# since we can't tell whether shared libraries were disabled because
6968
# the user asked for that or because the platform doesn't support
6969
# them. This is particularly important on AIX, because we don't
6970
# support having both static and shared libraries enabled at the same
6971
# time on that platform, so we default to a shared-only configuration.
6972
# If a disable-shared tag is given, we'll fallback to a static-only
6973
# configuration. But we'll never go from static-only to shared-only.
6975
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6977
# ### END LIBTOOL TAG CONFIG: disable-shared
6979
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6981
# ### END LIBTOOL TAG CONFIG: disable-static