1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5
# 2007, 2008 Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
# is ksh but when the shell is invoked as "sh" and the current value of
31
# the _XPG environment variable is not equal to 1 (one), the special
32
# positional parameter $0, within a function call, is the name of the
36
# The name of this program:
37
progname=`echo "$progpath" | $SED $basename`
47
TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54
# is contrary to our usage. Disable this feature.
55
alias -g '${1+"$@"}'='"$@"'
58
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60
BIN_SH=xpg4; export BIN_SH # for Tru64
61
DUALCASE=1; export DUALCASE # for MKS sh
63
# Check that we have a working $echo.
64
if test "X$1" = X--no-reexec; then
65
# Discard the --no-reexec flag, and continue.
67
elif test "X$1" = X--fallback-echo; then
68
# Avoid inline document here, it may be left over
70
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71
# Yippee, $echo works!
74
# Restart under the correct shell, and then maybe $echo will work.
75
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
78
if test "X$1" = X--fallback-echo; then
79
# used as fallback echo
88
help="Try \`$progname --help' for more information."
89
magic="%%%MAGIC variable%%%"
94
# Sed substitution that helps us do robust quoting. It backslashifies
95
# metacharacters that are still active within double-quoted strings.
96
Xsed="${SED}"' -e 1s/^X//'
97
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98
# test EBCDIC or ASCII
99
case `echo X|tr X '\101'` in
100
A) # ASCII based system
101
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
103
NL2SP='tr \015\012 \040\040'
105
*) # EBCDIC based system
107
NL2SP='tr \r\n \100\100'
112
# Only set LANG and LC_ALL to C if already set.
113
# These must not be set unconditionally because not all systems understand
114
# e.g. LANG=C (notably SCO).
115
# We save the old values to restore during execute mode.
117
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119
eval "if test \"\${$lt_var+set}\" = set; then
120
save_$lt_var=\$$lt_var
121
lt_env=\"$lt_var=\$$lt_var \$lt_env\"
127
if test -n "$lt_env"; then
131
# Make sure IFS has a sensible default
136
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137
$echo "$modename: not configured to build any kind of library" 1>&2
138
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
153
lo2o="s/\\.lo\$/.${objext}/"
154
o2lo="s/\\.${objext}\$/.lo/"
158
#####################################
159
# Shell function definitions:
160
# This seems to be the best place for them
162
# func_mktempdir [string]
163
# Make a temporary directory that won't clash with other running
164
# libtool processes, and avoids race conditions if possible. If
165
# given, STRING is the basename for that directory.
168
my_template="${TMPDIR-/tmp}/${1-$progname}"
170
if test "$run" = ":"; then
171
# Return a directory name, but don't create it in dry-run mode
172
my_tmpdir="${my_template}-$$"
175
# If mktemp works, use that first and foremost
176
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178
if test ! -d "$my_tmpdir"; then
179
# Failing that, at least try and use $RANDOM to avoid a race
180
my_tmpdir="${my_template}-${RANDOM-0}$$"
182
save_mktempdir_umask=`umask`
185
umask $save_mktempdir_umask
188
# If we're not in dry-run mode, bomb out on failure
189
test -d "$my_tmpdir" || {
190
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195
$echo "X$my_tmpdir" | $Xsed
199
# func_win32_libid arg
200
# return the library type of file 'arg'
202
# Need a lot of goo to handle *both* DLLs and import libs
203
# Has to be a shell function in order to 'eat' the argument
204
# that is supplied when $file_magic_command is called.
207
win32_libid_type="unknown"
208
win32_fileres=`file -L $1 2>/dev/null`
209
case $win32_fileres in
210
*ar\ archive\ import\ library*) # definitely import
211
win32_libid_type="x86 archive import"
213
*ar\ archive*) # could be an import, or static
214
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216
win32_nmres=`eval $NM -f posix -A $1 | \
225
import*) win32_libid_type="x86 archive import";;
226
*) win32_libid_type="x86 archive static";;
231
win32_libid_type="x86 DLL"
233
*executable*) # but shell scripts are "executable" too...
234
case $win32_fileres in
235
*MS\ Windows\ PE\ Intel*)
236
win32_libid_type="x86 DLL"
241
$echo $win32_libid_type
246
# Infer tagged configuration to use if any are available and
247
# if one wasn't chosen via the "--tag" command line option.
248
# Only attempt this if the compiler in the base compile
249
# command doesn't match the default compiler.
250
# arg is usually of the form 'gcc ...'
253
# FreeBSD-specific: where we install compilers with non-standard names
254
tag_compilers_CC="*cc cc* *gcc gcc*"
255
tag_compilers_CXX="*c++ c++* *g++ g++*"
256
base_compiler=`set -- "$@"; echo $1`
258
# If $tagname isn't set, then try to infer if the default "CC" tag applies
259
if test -z "$tagname"; then
260
for zp in $tag_compilers_CC; do
261
case $base_compiler in
262
$zp) tagname="CC"; break;;
267
if test -n "$available_tags" && test -z "$tagname"; then
271
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
275
CC_quoted="$CC_quoted $arg"
278
# Blanks in the command may have been stripped by the calling shell,
279
# but not from the CC environment variable when configure was run.
280
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
281
# Blanks at the start of $base_compile will cause this to fail
282
# if we don't check for them as well.
284
for z in $available_tags; do
285
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
286
# Evaluate the configuration.
287
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
290
# Double-quote args containing other shell metacharacters.
292
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
296
CC_quoted="$CC_quoted $arg"
299
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
300
# The compiler in the base compile command matches
301
# the one in the tagged configuration.
302
# Assume this is the tagged configuration we want.
308
# FreeBSD-specific: try compilers based on inferred tag
309
if test -z "$tagname"; then
310
eval "tag_compilers=\$tag_compilers_${z}"
311
if test -n "$tag_compilers"; then
312
for zp in $tag_compilers; do
313
case $base_compiler in
314
$zp) tagname=$z; break;;
317
if test -n "$tagname"; then
324
# If $tagname still isn't set, then no tagged configuration
325
# was found and let the user know that the "--tag" command
326
# line option must be used.
327
if test -z "$tagname"; then
328
$echo "$modename: unable to infer tagged configuration"
329
$echo "$modename: specify a tag with \`--tag'" 1>&2
332
# $echo "$modename: using $tagname tagged configuration"
340
# func_extract_an_archive dir oldlib
341
func_extract_an_archive ()
343
f_ex_an_ar_dir="$1"; shift
344
f_ex_an_ar_oldlib="$1"
346
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
347
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
348
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
351
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
356
# func_extract_archives gentop oldlib ...
357
func_extract_archives ()
359
my_gentop="$1"; shift
367
$show "${rm}r $my_gentop"
368
$run ${rm}r "$my_gentop"
369
$show "$mkdir $my_gentop"
370
$run $mkdir "$my_gentop"
372
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
376
for my_xlib in $my_oldlibs; do
377
# Extract the objects.
379
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
380
*) my_xabs=`pwd`"/$my_xlib" ;;
382
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
385
case " $extracted_archives " in
387
extracted_serial=`expr $extracted_serial + 1`
388
my_xlib_u=lt$extracted_serial-$my_xlib ;;
392
extracted_archives="$extracted_archives $my_xlib_u"
393
my_xdir="$my_gentop/$my_xlib_u"
395
$show "${rm}r $my_xdir"
396
$run ${rm}r "$my_xdir"
397
$show "$mkdir $my_xdir"
398
$run $mkdir "$my_xdir"
400
if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
405
$show "Extracting $my_xabs"
406
# Do not bother doing anything if just a dry run
407
if test -z "$run"; then
408
darwin_orig_dir=`pwd`
409
cd $my_xdir || exit $?
410
darwin_archive=$my_xabs
412
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
413
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
414
if test -n "$darwin_arches"; then
415
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
417
$show "$darwin_base_archive has multiple architectures $darwin_arches"
418
for darwin_arch in $darwin_arches ; do
419
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
420
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
421
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
422
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
424
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
425
done # $darwin_arches
426
## Okay now we have a bunch of thin objects, gotta fatten them up :)
427
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
430
for darwin_file in $darwin_filelist; do
431
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
432
lipo -create -output "$darwin_file" $darwin_files
433
done # $darwin_filelist
435
cd "$darwin_orig_dir"
437
cd "$darwin_orig_dir"
438
func_extract_an_archive "$my_xdir" "$my_xabs"
443
func_extract_an_archive "$my_xdir" "$my_xabs"
446
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
448
func_extract_archives_result="$my_oldobjs"
450
# End of Shell function definitions
451
#####################################
454
eval std_shrext=\"$shrext_cmds\"
458
# Parse our command line options once, thoroughly.
459
while test "$#" -gt 0
465
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
469
# If the previous option needs an argument, assign it.
470
if test -n "$prev"; then
473
execute_dlfiles="$execute_dlfiles $arg"
477
preserve_args="${preserve_args}=$arg"
479
# Check whether tagname contains only valid characters
482
$echo "$progname: invalid tag name: $tagname" 1>&2
489
# Don't test for the "default" C tag, as we know, it's there, but
490
# not specially marked.
493
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
494
taglist="$taglist $tagname"
495
# Evaluate the configuration.
496
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
498
$echo "$progname: ignoring unknown tag $tagname" 1>&2
513
# Have we seen a non-optional argument yet?
521
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
523
Copyright (C) 2008 Free Software Foundation, Inc.
524
This is free software; see the source for copying conditions. There is NO
525
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
530
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
531
# Now print the configurations for the tags.
532
for tagname in $taglist; do
533
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
539
$echo "$progname: enabling shell trace mode"
541
preserve_args="$preserve_args $arg"
550
if test "$build_libtool_libs" = yes; then
551
$echo "enable shared libraries"
553
$echo "disable shared libraries"
555
if test "$build_old_libs" = yes; then
556
$echo "enable static libraries"
558
$echo "disable static libraries"
563
--finish) mode="finish" ;;
565
--mode) prevopt="--mode" prev=mode ;;
566
--mode=*) mode="$optarg" ;;
568
--preserve-dup-deps) duplicate_deps="yes" ;;
572
preserve_args="$preserve_args $arg"
578
preserve_args="$preserve_args --tag"
581
set tag "$optarg" ${1+"$@"}
584
preserve_args="$preserve_args --tag"
593
$echo "$modename: unrecognized option \`$arg'" 1>&2
605
if test -n "$prevopt"; then
606
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
611
case $disable_libs in
615
build_libtool_libs=no
619
build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
623
# If this variable is set in any of the actions, the command in it
624
# will be execed at the end. This prevents here-documents from being
625
# left over by shells.
628
if test -z "$show_help"; then
630
# Infer the operation mode.
631
if test -z "$mode"; then
632
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
633
$echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
635
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
647
*db | *dbx | *strace | *truss)
657
# If we have no mode, but dlfiles were specified, then do execute mode.
658
test -n "$execute_dlfiles" && mode=execute
660
# Just use the default operation mode.
661
if test -z "$mode"; then
662
if test -n "$nonopt"; then
663
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
665
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
672
# Only execute mode is allowed to have -dlopen flags.
673
if test -n "$execute_dlfiles" && test "$mode" != execute; then
674
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
679
# Change the help message to a mode-specific one.
681
help="Try \`$modename --help --mode=$mode' for more information."
683
# These modes are in order of execution frequency so that they run quickly.
685
# libtool compile mode
687
modename="$modename: compile"
688
# Get the compilation command and the source file.
690
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
701
# do not "continue". Instead, add this to base_compile
713
# Accept any command-line options.
716
if test -n "$libobj" ; then
717
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
724
-static | -prefer-pic | -prefer-non-pic)
735
arg_mode=arg # the next one goes into the "base_compile" arg list
736
continue # The current "srcfile" will either be retained or
737
;; # replaced later. I would guess that would be a bug.
740
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
742
save_ifs="$IFS"; IFS=','
746
# Double-quote args containing other shell metacharacters.
747
# Many Bourne shells cannot handle close brackets correctly
748
# in scan sets, so we specify it separately.
750
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
754
lastarg="$lastarg $arg"
757
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
759
# Add the arguments to base_compile.
760
base_compile="$base_compile $lastarg"
765
# Accept the current argument as the source file.
766
# The previous "srcfile" becomes the current argument.
773
esac # case $arg_mode
775
# Aesthetically quote the previous argument.
776
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
779
# Double-quote args containing other shell metacharacters.
780
# Many Bourne shells cannot handle close brackets correctly
781
# in scan sets, and some SunOS ksh mistreat backslash-escaping
782
# in scan sets (worked around with variable expansion),
783
# and furthermore cannot handle '|' '&' '(' ')' in scan sets
784
# at all, so we specify them separately.
785
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
786
lastarg="\"$lastarg\""
790
base_compile="$base_compile $lastarg"
795
$echo "$modename: you must specify an argument for -Xcompile"
799
$echo "$modename: you must specify a target with \`-o'" 1>&2
803
# Get the name of the library object.
804
[ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
808
# Recognize several different file suffixes.
809
# If the user specifies -o file.o, it is replaced with file.lo
819
*.class) xform=class ;;
822
*.[fF][09]?) xform=[fF][09]. ;;
824
*.java) xform=java ;;
829
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
832
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
834
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
839
func_infer_tag $base_compile
841
for arg in $later; do
860
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
862
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
863
qlibobj="\"$qlibobj\"" ;;
865
test "X$libobj" != "X$qlibobj" \
866
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
867
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
868
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
869
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
870
if test "X$xdir" = "X$obj"; then
875
lobj=${xdir}$objdir/$objname
877
if test -z "$base_compile"; then
878
$echo "$modename: you must specify a compilation command" 1>&2
883
# Delete any leftover library objects.
884
if test "$build_old_libs" = yes; then
885
removelist="$obj $lobj $libobj ${libobj}T"
887
removelist="$lobj $libobj ${libobj}T"
891
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
893
# On Cygwin there's no "real" PIC flag so we must build both object types
895
cygwin* | mingw* | pw32* | os2*)
899
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
900
# non-PIC code in shared libraries is not supported
904
# Calculate the filename of the output object if compiler does
905
# not support -o with -c
906
if test "$compiler_c_o" = no; then
907
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
908
lockfile="$output_obj.lock"
909
removelist="$removelist $output_obj $lockfile"
910
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
917
# Lock this critical section if it is needed
918
# We use this script file to make the link, it avoids creating a new file
919
if test "$need_locks" = yes; then
920
until $run ln "$progpath" "$lockfile" 2>/dev/null; do
921
$show "Waiting for $lockfile to be removed"
924
elif test "$need_locks" = warn; then
925
if test -f "$lockfile"; then
927
*** ERROR, $lockfile exists and contains:
928
`cat $lockfile 2>/dev/null`
930
This indicates that another process is trying to use the same
931
temporary object file, and libtool could not work around it because
932
your compiler does not support \`-c' and \`-o' together. If you
933
repeat this compilation, it may succeed, by chance, but you had better
934
avoid parallel builds (make -j) in this platform, or get a better
940
$echo "$srcfile" > "$lockfile"
943
if test -n "$fix_srcfile_path"; then
944
eval srcfile=\"$fix_srcfile_path\"
946
qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
948
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
949
qsrcfile="\"$qsrcfile\"" ;;
952
$run $rm "$libobj" "${libobj}T"
954
# Create a libtool object file (analogous to a ".la" file),
955
# but don't create it if we're doing a dry run.
956
test -z "$run" && cat > ${libobj}T <<EOF
957
# $libobj - a libtool object file
958
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
960
# Please DO NOT delete this file!
961
# It is necessary for linking the library.
963
# Name of the PIC object.
966
# Only build a PIC object if we are building libtool libraries.
967
if test "$build_libtool_libs" = yes; then
968
# Without this assignment, base_compile gets emptied.
969
fbsd_hideous_sh_bug=$base_compile
971
if test "$pic_mode" != no; then
972
command="$base_compile $qsrcfile $pic_flag"
974
# Don't build PIC code
975
command="$base_compile $qsrcfile"
978
if test ! -d "${xdir}$objdir"; then
979
$show "$mkdir ${xdir}$objdir"
980
$run $mkdir ${xdir}$objdir
982
if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
987
if test -z "$output_obj"; then
988
# Place PIC objects in $objdir
989
command="$command -o $lobj"
992
$run $rm "$lobj" "$output_obj"
995
if $run eval $lt_env "$command"; then :
997
test -n "$output_obj" && $run $rm $removelist
1001
if test "$need_locks" = warn &&
1002
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1004
*** ERROR, $lockfile contains:
1005
`cat $lockfile 2>/dev/null`
1007
but it should contain:
1010
This indicates that another process is trying to use the same
1011
temporary object file, and libtool could not work around it because
1012
your compiler does not support \`-c' and \`-o' together. If you
1013
repeat this compilation, it may succeed, by chance, but you had better
1014
avoid parallel builds (make -j) in this platform, or get a better
1017
$run $rm $removelist
1021
# Just move the object if needed, then go on to compile the next one
1022
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1023
$show "$mv $output_obj $lobj"
1024
if $run $mv $output_obj $lobj; then :
1027
$run $rm $removelist
1032
# Append the name of the PIC object to the libtool object file.
1033
test -z "$run" && cat >> ${libobj}T <<EOF
1034
pic_object='$objdir/$objname'
1038
# Allow error messages only from the first compilation.
1039
if test "$suppress_opt" = yes; then
1040
suppress_output=' >/dev/null 2>&1'
1043
# No PIC object so indicate it doesn't exist in the libtool
1045
test -z "$run" && cat >> ${libobj}T <<EOF
1051
# Only build a position-dependent object if we build old libraries.
1052
if test "$build_old_libs" = yes; then
1053
if test "$pic_mode" != yes; then
1054
# Don't build PIC code
1055
command="$base_compile $qsrcfile"
1057
command="$base_compile $qsrcfile $pic_flag"
1059
if test "$compiler_c_o" = yes; then
1060
command="$command -o $obj"
1063
# Suppress compiler output if we already did a PIC compilation.
1064
command="$command$suppress_output"
1065
$run $rm "$obj" "$output_obj"
1067
if $run eval $lt_env "$command"; then :
1069
$run $rm $removelist
1073
if test "$need_locks" = warn &&
1074
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1076
*** ERROR, $lockfile contains:
1077
`cat $lockfile 2>/dev/null`
1079
but it should contain:
1082
This indicates that another process is trying to use the same
1083
temporary object file, and libtool could not work around it because
1084
your compiler does not support \`-c' and \`-o' together. If you
1085
repeat this compilation, it may succeed, by chance, but you had better
1086
avoid parallel builds (make -j) in this platform, or get a better
1089
$run $rm $removelist
1093
# Just move the object if needed
1094
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1095
$show "$mv $output_obj $obj"
1096
if $run $mv $output_obj $obj; then :
1099
$run $rm $removelist
1104
# Append the name of the non-PIC object the libtool object file.
1105
# Only append if the libtool object file exists.
1106
test -z "$run" && cat >> ${libobj}T <<EOF
1107
# Name of the non-PIC object.
1108
non_pic_object='$objname'
1112
# Append the name of the non-PIC object the libtool object file.
1113
# Only append if the libtool object file exists.
1114
test -z "$run" && cat >> ${libobj}T <<EOF
1115
# Name of the non-PIC object.
1121
$run $mv "${libobj}T" "${libobj}"
1123
# Unlock the critical section if it was locked
1124
if test "$need_locks" != no; then
1125
$run $rm "$lockfile"
1133
modename="$modename: link"
1135
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1136
# It is impossible to link a dll without this setting, and
1137
# we shouldn't force the makefile maintainer to figure out
1138
# which system we are compiling for in order to pass an extra
1139
# flag for every libtool invocation.
1140
# allow_undefined=no
1142
# FIXME: Unfortunately, there are problems with the above when trying
1143
# to make a dll which has undefined symbols, in which case not
1144
# even a static library is built. For now, we need to specify
1145
# -no-undefined on the libtool link line when we can be certain
1146
# that all symbols are satisfied, otherwise we get a static library.
1153
libtool_args="$nonopt"
1154
base_compile="$nonopt $@"
1155
compile_command="$nonopt"
1156
finalize_command="$nonopt"
1169
lib_search_path=`pwd`
1178
export_symbols_regex=
1186
notinst_path= # paths that contain not-installed libtool libraries
1187
precious_files_regex=
1188
prefer_static_libs=no
1200
single_module="${wl}-single_module"
1202
func_infer_tag $base_compile
1204
# We need to know -static, to get the right output filenames.
1208
-all-static | -static | -static-libtool-libs)
1211
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1212
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1214
if test -n "$link_static_flag"; then
1215
dlopen_self=$dlopen_self_static
1217
prefer_static_libs=yes
1220
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1221
dlopen_self=$dlopen_self_static
1223
prefer_static_libs=built
1225
-static-libtool-libs)
1226
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1227
dlopen_self=$dlopen_self_static
1229
prefer_static_libs=yes
1232
build_libtool_libs=no
1239
# See if our shared archives depend on static archives.
1240
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1242
# Go through the arguments, transforming them on the way.
1243
while test "$#" -gt 0; do
1247
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1248
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1252
libtool_args="$libtool_args $qarg"
1254
# If the previous option needs an argument, assign it.
1255
if test -n "$prev"; then
1258
compile_command="$compile_command @OUTPUT@"
1259
finalize_command="$finalize_command @OUTPUT@"
1265
if test "$preload" = no; then
1266
# Add the symbol object into the linking commands.
1267
compile_command="$compile_command @SYMFILE@"
1268
finalize_command="$finalize_command @SYMFILE@"
1272
*.la | *.lo) ;; # We handle these cases below.
1274
if test "$dlself" = no; then
1282
if test "$prev" = dlprefiles; then
1284
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1294
if test "$prev" = dlfiles; then
1295
dlfiles="$dlfiles $arg"
1297
dlprefiles="$dlprefiles $arg"
1305
export_symbols="$arg"
1306
if test ! -f "$arg"; then
1307
$echo "$modename: symbol file \`$arg' does not exist"
1314
export_symbols_regex="$arg"
1319
inst_prefix_dir="$arg"
1324
precious_files_regex="$arg"
1334
if test -f "$arg"; then
1337
for fil in `cat $save_arg`
1339
# moreargs="$moreargs $fil"
1341
# A libtool-controlled object.
1343
# Check to see that this really is a libtool object.
1344
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1349
# If there is no directory component, then add one.
1351
*/* | *\\*) . $arg ;;
1355
if test -z "$pic_object" || \
1356
test -z "$non_pic_object" ||
1357
test "$pic_object" = none && \
1358
test "$non_pic_object" = none; then
1359
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1363
# Extract subdirectory from the argument.
1364
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1365
if test "X$xdir" = "X$arg"; then
1371
if test "$pic_object" != none; then
1372
# Prepend the subdirectory the object is found in.
1373
pic_object="$xdir$pic_object"
1375
if test "$prev" = dlfiles; then
1376
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1377
dlfiles="$dlfiles $pic_object"
1381
# If libtool objects are unsupported, then we need to preload.
1386
# CHECK ME: I think I busted this. -Ossama
1387
if test "$prev" = dlprefiles; then
1388
# Preload the old-style object.
1389
dlprefiles="$dlprefiles $pic_object"
1394
libobjs="$libobjs $pic_object"
1399
if test "$non_pic_object" != none; then
1400
# Prepend the subdirectory the object is found in.
1401
non_pic_object="$xdir$non_pic_object"
1403
# A standard non-PIC object
1404
non_pic_objects="$non_pic_objects $non_pic_object"
1405
if test -z "$pic_object" || test "$pic_object" = none ; then
1406
arg="$non_pic_object"
1409
# If the PIC object exists, use it instead.
1410
# $xdir was prepended to $pic_object above.
1411
non_pic_object="$pic_object"
1412
non_pic_objects="$non_pic_objects $non_pic_object"
1415
# Only an error if not doing a dry-run.
1416
if test -z "$run"; then
1417
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1422
# Extract subdirectory from the argument.
1423
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1424
if test "X$xdir" = "X$arg"; then
1430
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1431
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1432
libobjs="$libobjs $pic_object"
1433
non_pic_objects="$non_pic_objects $non_pic_object"
1438
$echo "$modename: link input file \`$save_arg' does not exist"
1446
# We need an absolute path.
1448
[\\/]* | [A-Za-z]:[\\/]*) ;;
1450
$echo "$modename: only absolute run-paths are allowed" 1>&2
1454
if test "$prev" = rpath; then
1457
*) rpath="$rpath $arg" ;;
1462
*) xrpath="$xrpath $arg" ;;
1469
compiler_flags="$compiler_flags $qarg"
1471
compile_command="$compile_command $qarg"
1472
finalize_command="$finalize_command $qarg"
1476
linker_flags="$linker_flags $qarg"
1477
compiler_flags="$compiler_flags $wl$qarg"
1479
compile_command="$compile_command $wl$qarg"
1480
finalize_command="$finalize_command $wl$qarg"
1484
linker_flags="$linker_flags $qarg"
1485
compiler_flags="$compiler_flags $qarg"
1487
compile_command="$compile_command $qarg"
1488
finalize_command="$finalize_command $qarg"
1496
darwin_framework|darwin_framework_skip)
1497
test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1498
compile_command="$compile_command $arg"
1499
finalize_command="$finalize_command $arg"
1504
eval "$prev=\"\$arg\""
1509
fi # test -n "$prev"
1515
if test -n "$link_static_flag"; then
1516
compile_command="$compile_command $link_static_flag"
1517
finalize_command="$finalize_command $link_static_flag"
1523
# FIXME: remove this flag sometime in the future.
1524
$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1548
-export-symbols | -export-symbols-regex)
1549
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1550
$echo "$modename: more than one -exported-symbols argument is not allowed"
1553
if test "X$arg" = "X-export-symbols"; then
1561
-framework|-arch|-isysroot)
1563
*" ${arg} ${1} "* | *" ${arg} ${1} "*)
1564
prev=darwin_framework_skip ;;
1565
*) compiler_flags="$compiler_flags $arg"
1566
prev=darwin_framework ;;
1568
compile_command="$compile_command $arg"
1569
finalize_command="$finalize_command $arg"
1578
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1579
# so, if we see these flags be careful not to treat them like -L
1581
case $with_gcc/$host in
1582
no/*-*-irix* | /*-*-irix*)
1583
compile_command="$compile_command $arg"
1584
finalize_command="$finalize_command $arg"
1591
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1592
# We need an absolute path.
1594
[\\/]* | [A-Za-z]:[\\/]*) ;;
1596
absdir=`cd "$dir" && pwd`
1597
if test -z "$absdir"; then
1598
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1600
notinst_path="$notinst_path $dir"
1608
deplibs="$deplibs -L$dir"
1609
lib_search_path="$lib_search_path $dir"
1613
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1614
testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1615
case :$dllsearchpath: in
1617
*) dllsearchpath="$dllsearchpath:$dir";;
1619
case :$dllsearchpath: in
1620
*":$testbindir:"*) ;;
1621
*) dllsearchpath="$dllsearchpath:$testbindir";;
1629
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1631
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1632
# These systems don't actually have a C or math library (as such)
1636
# These systems don't actually have a C library (as such)
1637
test "X$arg" = "X-lc" && continue
1639
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1640
# Do not include libc due to us having libc/libc_r.
1641
test "X$arg" = "X-lc" && continue
1643
*-*-rhapsody* | *-*-darwin1.[012])
1644
# Rhapsody C and math libraries are in the System framework
1645
deplibs="$deplibs -framework System"
1648
*-*-sco3.2v5* | *-*-sco5v6*)
1649
# Causes problems with __ctype
1650
test "X$arg" = "X-lc" && continue
1652
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1653
# Compiler inserts libc in the correct place for threads to work
1654
test "X$arg" = "X-lc" && continue
1657
elif test "X$arg" = "X-lc_r"; then
1659
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1660
# Do not include libc_r directly, use -pthread flag.
1665
deplibs="$deplibs $arg"
1669
# Tru64 UNIX uses -model [arg] to determine the layout of C++
1670
# classes, name mangling, and exception handling.
1672
compile_command="$compile_command $arg"
1673
compiler_flags="$compiler_flags $arg"
1674
finalize_command="$finalize_command $arg"
1679
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1680
compiler_flags="$compiler_flags $arg"
1681
compile_command="$compile_command $arg"
1682
finalize_command="$finalize_command $arg"
1683
deplibs="$deplibs $arg"
1688
single_module="${wl}-multi_module"
1697
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1698
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1699
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1700
# +DA*, +DD* enable 64-bit mode on the HP compiler
1701
# -q* pass through compiler args for the IBM compiler
1702
# -m* pass through architecture-specific compiler args for GCC
1703
# -m*, -t[45]*, -txscale* pass through architecture-specific
1704
# compiler args for GCC
1705
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1706
# -F/path gives path to uninstalled frameworks, gcc on darwin
1707
# @file GCC response files
1708
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1709
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1711
# Unknown arguments in both finalize_command and compile_command need
1712
# to be aesthetically quoted because they are evaled later.
1713
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1715
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1719
compile_command="$compile_command $arg"
1720
finalize_command="$finalize_command $arg"
1721
compiler_flags="$compiler_flags $arg"
1737
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1738
# The PATH hackery in wrapper scripts is required on Windows
1739
# and Darwin in order for the loader to find any dlls it needs.
1740
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1741
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1744
*) no_install=yes ;;
1761
-precious-files-regex)
1782
dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1783
# We need an absolute path.
1785
[\\/]* | [A-Za-z]:[\\/]*) ;;
1787
$echo "$modename: only absolute run-paths are allowed" 1>&2
1793
*) xrpath="$xrpath $dir" ;;
1798
-static | -static-libtool-libs)
1799
# The effects of -static are defined in a previous loop.
1800
# We used to do the same as -all-static on platforms that
1801
# didn't have a PIC flag, but the assumption that the effects
1802
# would be equivalent was wrong. It would break on at least
1803
# Digital Unix and AIX.
1823
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1825
save_ifs="$IFS"; IFS=','
1826
for flag in $args; do
1829
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1834
compiler_flags="$compiler_flags $flag"
1837
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1841
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1843
save_ifs="$IFS"; IFS=','
1844
for flag in $args; do
1847
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1852
compiler_flags="$compiler_flags $wl$flag"
1853
linker_flags="$linker_flags $flag"
1856
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1874
# Some other compiler flag.
1876
# Unknown arguments in both finalize_command and compile_command need
1877
# to be aesthetically quoted because they are evaled later.
1878
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1880
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1887
# A standard object.
1892
# A libtool-controlled object.
1894
# Check to see that this really is a libtool object.
1895
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1900
# If there is no directory component, then add one.
1902
*/* | *\\*) . $arg ;;
1906
if test -z "$pic_object" || \
1907
test -z "$non_pic_object" ||
1908
test "$pic_object" = none && \
1909
test "$non_pic_object" = none; then
1910
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1914
# Extract subdirectory from the argument.
1915
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1916
if test "X$xdir" = "X$arg"; then
1922
if test "$pic_object" != none; then
1923
# Prepend the subdirectory the object is found in.
1924
pic_object="$xdir$pic_object"
1926
if test "$prev" = dlfiles; then
1927
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1928
dlfiles="$dlfiles $pic_object"
1932
# If libtool objects are unsupported, then we need to preload.
1937
# CHECK ME: I think I busted this. -Ossama
1938
if test "$prev" = dlprefiles; then
1939
# Preload the old-style object.
1940
dlprefiles="$dlprefiles $pic_object"
1945
libobjs="$libobjs $pic_object"
1950
if test "$non_pic_object" != none; then
1951
# Prepend the subdirectory the object is found in.
1952
non_pic_object="$xdir$non_pic_object"
1954
# A standard non-PIC object
1955
non_pic_objects="$non_pic_objects $non_pic_object"
1956
if test -z "$pic_object" || test "$pic_object" = none ; then
1957
arg="$non_pic_object"
1960
# If the PIC object exists, use it instead.
1961
# $xdir was prepended to $pic_object above.
1962
non_pic_object="$pic_object"
1963
non_pic_objects="$non_pic_objects $non_pic_object"
1966
# Only an error if not doing a dry-run.
1967
if test -z "$run"; then
1968
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1973
# Extract subdirectory from the argument.
1974
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1975
if test "X$xdir" = "X$arg"; then
1981
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1982
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1983
libobjs="$libobjs $pic_object"
1984
non_pic_objects="$non_pic_objects $non_pic_object"
1991
deplibs="$deplibs $arg"
1992
old_deplibs="$old_deplibs $arg"
1997
# A libtool-controlled library.
1999
if test "$prev" = dlfiles; then
2000
# This library was specified with -dlopen.
2001
dlfiles="$dlfiles $arg"
2003
elif test "$prev" = dlprefiles; then
2004
# The library was specified with -dlpreopen.
2005
dlprefiles="$dlprefiles $arg"
2008
deplibs="$deplibs $arg"
2013
# Some other compiler argument.
2015
# Unknown arguments in both finalize_command and compile_command need
2016
# to be aesthetically quoted because they are evaled later.
2017
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2019
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2026
# Now actually substitute the argument into the commands.
2027
if test -n "$arg"; then
2028
compile_command="$compile_command $arg"
2029
finalize_command="$finalize_command $arg"
2031
done # argument parsing loop
2033
if test -n "$prev"; then
2034
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2039
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2040
eval arg=\"$export_dynamic_flag_spec\"
2041
compile_command="$compile_command $arg"
2042
finalize_command="$finalize_command $arg"
2046
# calculate the name of the file, without its directory
2047
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2048
libobjs_save="$libobjs"
2050
if test -n "$shlibpath_var"; then
2051
# get the directories listed in $shlibpath_var
2052
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2056
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2057
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2059
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2060
if test "X$output_objdir" = "X$output"; then
2061
output_objdir="$objdir"
2063
output_objdir="$output_objdir/$objdir"
2065
# Create the object directory.
2066
if test ! -d "$output_objdir"; then
2067
$show "$mkdir $output_objdir"
2068
$run $mkdir $output_objdir
2070
if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2075
# Determine the type of output
2078
$echo "$modename: you must specify an output file" 1>&2
2082
*.$libext) linkmode=oldlib ;;
2083
*.lo | *.$objext) linkmode=obj ;;
2084
*.la) linkmode=lib ;;
2085
*) linkmode=prog ;; # Anything else should be a program.
2089
*cygwin* | *mingw* | *pw32*)
2090
# don't eliminate duplications in $postdeps and $predeps
2091
duplicate_compiler_generated_deps=yes
2094
duplicate_compiler_generated_deps=$duplicate_deps
2100
# Find all interdependent deplibs by searching for libraries
2101
# that are linked more than once (e.g. -la -lb -la)
2102
for deplib in $deplibs; do
2103
if test "X$duplicate_deps" = "Xyes" ; then
2105
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2108
libs="$libs $deplib"
2111
if test "$linkmode" = lib; then
2112
libs="$predeps $libs $compiler_lib_search_path $postdeps"
2114
# Compute libraries that are listed more than once in $predeps
2115
# $postdeps and mark them as special (i.e., whose duplicates are
2116
# not to be eliminated).
2118
if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2119
for pre_post_dep in $predeps $postdeps; do
2120
case "$pre_post_deps " in
2121
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2123
pre_post_deps="$pre_post_deps $pre_post_dep"
2132
need_relink=no # whether we're linking any uninstalled libtool libraries
2133
notinst_deplibs= # not-installed libtool libraries
2137
for file in $dlfiles $dlprefiles; do
2141
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2153
passes="conv scan dlopen dlpreopen link"
2158
for pass in $passes; do
2159
if test "$linkmode,$pass" = "lib,link" ||
2160
test "$linkmode,$pass" = "prog,scan"; then
2164
if test "$linkmode" = prog; then
2166
dlopen) libs="$dlfiles" ;;
2167
dlpreopen) libs="$dlprefiles" ;;
2168
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2171
if test "$pass" = dlopen; then
2172
# Collect dlpreopened libraries
2173
save_deplibs="$deplibs"
2176
for deplib in $libs; do
2180
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2181
if test "$linkmode,$pass" = "prog,link"; then
2182
compile_deplibs="$deplib $compile_deplibs"
2183
finalize_deplibs="$deplib $finalize_deplibs"
2185
compiler_flags="$compiler_flags $deplib"
2190
deplibs="$deplib $deplibs"
2191
test "$pass" = conv && continue
2192
newdependency_libs="$deplib $newdependency_libs"
2195
if test "$pass" = conv; then
2196
deplibs="$deplib $deplibs"
2199
if test "$pass" = scan; then
2200
deplibs="$deplib $deplibs"
2202
compile_deplibs="$deplib $compile_deplibs"
2203
finalize_deplibs="$deplib $finalize_deplibs"
2213
if test "$linkmode" != lib && test "$linkmode" != prog; then
2214
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2217
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2218
if test "$linkmode" = lib; then
2219
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2221
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2223
for searchdir in $searchdirs; do
2224
for search_ext in .la $std_shrext .so .a; do
2225
# Search the libtool library
2226
lib="$searchdir/lib${name}${search_ext}"
2227
if test -f "$lib"; then
2228
if test "$search_ext" = ".la"; then
2237
if test "$found" != yes; then
2238
# deplib doesn't seem to be a libtool library
2239
if test "$linkmode,$pass" = "prog,link"; then
2240
compile_deplibs="$deplib $compile_deplibs"
2241
finalize_deplibs="$deplib $finalize_deplibs"
2243
deplibs="$deplib $deplibs"
2244
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2247
else # deplib is a libtool library
2248
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2249
# We need to do some special things here, and not later.
2250
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2251
case " $predeps $postdeps " in
2253
if (${SED} -e '2q' $lib |
2254
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2258
*/* | *\\*) . $lib ;;
2261
for l in $old_library $library_names; do
2264
if test "X$ll" = "X$old_library" ; then # only static version available
2266
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2267
test "X$ladir" = "X$lib" && ladir="."
2268
lib=$ladir/$old_library
2269
if test "$linkmode,$pass" = "prog,link"; then
2270
compile_deplibs="$deplib $compile_deplibs"
2271
finalize_deplibs="$deplib $finalize_deplibs"
2273
deplibs="$deplib $deplibs"
2274
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2288
deplibs="$deplib $deplibs"
2289
test "$pass" = conv && continue
2290
newdependency_libs="$deplib $newdependency_libs"
2291
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2294
if test "$pass" = conv; then
2295
deplibs="$deplib $deplibs"
2298
if test "$pass" = scan; then
2299
deplibs="$deplib $deplibs"
2301
compile_deplibs="$deplib $compile_deplibs"
2302
finalize_deplibs="$deplib $finalize_deplibs"
2304
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2307
$echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2313
if test "$pass" = link; then
2314
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2315
# Make sure the xrpath contains only unique directories.
2318
*) xrpath="$xrpath $dir" ;;
2321
deplibs="$deplib $deplibs"
2324
*.la) lib="$deplib" ;;
2326
if test "$pass" = conv; then
2327
deplibs="$deplib $deplibs"
2333
case $deplibs_check_method in
2335
set dummy $deplibs_check_method
2336
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2337
if eval $echo \"$deplib\" 2>/dev/null \
2339
| $EGREP "$match_pattern_regex" > /dev/null; then
2347
if test "$valid_a_lib" != yes; then
2349
$echo "*** Warning: Trying to link with static lib archive $deplib."
2350
$echo "*** I have the capability to make that library automatically link in when"
2351
$echo "*** you link to this library. But I can only do this if you have a"
2352
$echo "*** shared version of the library, which you do not appear to have"
2353
$echo "*** because the file extensions .$libext of this argument makes me believe"
2354
$echo "*** that it is just a static archive that I should not used here."
2357
$echo "*** Warning: Linking the shared library $output against the"
2358
$echo "*** static library $deplib is not portable!"
2359
deplibs="$deplib $deplibs"
2364
if test "$pass" != link; then
2365
deplibs="$deplib $deplibs"
2367
compile_deplibs="$deplib $compile_deplibs"
2368
finalize_deplibs="$deplib $finalize_deplibs"
2375
if test "$pass" = conv; then
2376
deplibs="$deplib $deplibs"
2377
elif test "$linkmode" = prog; then
2378
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2379
# If there is no dlopen support or we're linking statically,
2380
# we need to preload.
2381
newdlprefiles="$newdlprefiles $deplib"
2382
compile_deplibs="$deplib $compile_deplibs"
2383
finalize_deplibs="$deplib $finalize_deplibs"
2385
newdlfiles="$newdlfiles $deplib"
2395
if test "$found" = yes || test -f "$lib"; then :
2397
$echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2401
# Check to see that this really is a libtool archive.
2402
if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2404
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2408
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2409
test "X$ladir" = "X$lib" && ladir="."
2417
# If the library was installed with an old release of libtool,
2418
# it will not redefine variables installed, or shouldnotlink
2426
*/* | *\\*) . $lib ;;
2430
if test "$linkmode,$pass" = "lib,link" ||
2431
test "$linkmode,$pass" = "prog,scan" ||
2432
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
2433
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2434
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2437
if test "$pass" = conv; then
2438
# Only check for convenience libraries
2439
deplibs="$lib $deplibs"
2440
if test -z "$libdir"; then
2441
if test -z "$old_library"; then
2442
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2445
# It is a libtool convenience library, so add in its objects.
2446
convenience="$convenience $ladir/$objdir/$old_library"
2447
old_convenience="$old_convenience $ladir/$objdir/$old_library"
2449
for deplib in $dependency_libs; do
2450
deplibs="$deplib $deplibs"
2451
if test "X$duplicate_deps" = "Xyes" ; then
2452
case "$tmp_libs " in
2453
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2456
tmp_libs="$tmp_libs $deplib"
2458
elif test "$linkmode" != prog && test "$linkmode" != lib; then
2459
$echo "$modename: \`$lib' is not a convenience library" 1>&2
2466
# Get the name of the library we link against.
2468
for l in $old_library $library_names; do
2471
if test -z "$linklib"; then
2472
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2476
# This library was specified with -dlopen.
2477
if test "$pass" = dlopen; then
2478
if test -z "$libdir"; then
2479
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2482
if test -z "$dlname" ||
2483
test "$dlopen_support" != yes ||
2484
test "$build_libtool_libs" = no; then
2485
# If there is no dlname, no dlopen support or we're linking
2486
# statically, we need to preload. We also need to preload any
2487
# dependent libraries so libltdl's deplib preloader doesn't
2488
# bomb out in the load deplibs phase.
2489
dlprefiles="$dlprefiles $lib $dependency_libs"
2491
newdlfiles="$newdlfiles $lib"
2496
# We need an absolute path.
2498
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2500
abs_ladir=`cd "$ladir" && pwd`
2501
if test -z "$abs_ladir"; then
2502
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2503
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2508
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2510
# Find the relevant object directory and library name.
2511
if test "X$installed" = Xyes; then
2512
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2513
$echo "$modename: warning: library \`$lib' was moved." 1>&2
2521
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2523
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2526
# Remove this search path later
2527
notinst_path="$notinst_path $abs_ladir"
2529
dir="$ladir/$objdir"
2530
absdir="$abs_ladir/$objdir"
2531
# Remove this search path later
2532
notinst_path="$notinst_path $abs_ladir"
2534
fi # $installed = yes
2535
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2537
# This library was specified with -dlpreopen.
2538
if test "$pass" = dlpreopen; then
2539
if test -z "$libdir"; then
2540
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2543
# Prefer using a static library (so that no silly _DYNAMIC symbols
2544
# are required to link).
2545
if test -n "$old_library"; then
2546
newdlprefiles="$newdlprefiles $dir/$old_library"
2547
# Otherwise, use the dlname, so that lt_dlopen finds it.
2548
elif test -n "$dlname"; then
2549
newdlprefiles="$newdlprefiles $dir/$dlname"
2551
newdlprefiles="$newdlprefiles $dir/$linklib"
2553
fi # $pass = dlpreopen
2555
if test -z "$libdir"; then
2556
# Link the convenience library
2557
if test "$linkmode" = lib; then
2558
deplibs="$dir/$old_library $deplibs"
2559
elif test "$linkmode,$pass" = "prog,link"; then
2560
compile_deplibs="$dir/$old_library $compile_deplibs"
2561
finalize_deplibs="$dir/$old_library $finalize_deplibs"
2563
deplibs="$lib $deplibs" # used for prog,scan pass
2569
if test "$linkmode" = prog && test "$pass" != link; then
2570
newlib_search_path="$newlib_search_path $ladir"
2571
deplibs="$lib $deplibs"
2574
if test "$link_all_deplibs" != no || test -z "$library_names" ||
2575
test "$build_libtool_libs" = no; then
2580
for deplib in $dependency_libs; do
2582
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2584
# Need to link against all dependency_libs?
2585
if test "$linkalldeplibs" = yes; then
2586
deplibs="$deplib $deplibs"
2588
# Need to hardcode shared library paths
2589
# or/and link against static libraries
2590
newdependency_libs="$deplib $newdependency_libs"
2592
if test "X$duplicate_deps" = "Xyes" ; then
2593
case "$tmp_libs " in
2594
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2597
tmp_libs="$tmp_libs $deplib"
2600
fi # $linkmode = prog...
2602
if test "$linkmode,$pass" = "prog,link"; then
2603
if test -n "$library_names" &&
2604
{ { test "$prefer_static_libs" = no ||
2605
test "$prefer_static_libs,$installed" = "built,yes"; } ||
2606
test -z "$old_library"; }; then
2607
# We need to hardcode the library path
2608
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2609
# Make sure the rpath contains only unique directories.
2610
case "$temp_rpath " in
2613
*) temp_rpath="$temp_rpath $absdir" ;;
2617
# Hardcode the library path.
2618
# Skip directories that are in the system default run-time
2620
case " $sys_lib_dlsearch_path " in
2623
case "$compile_rpath " in
2625
*) compile_rpath="$compile_rpath $absdir"
2629
case " $sys_lib_dlsearch_path " in
2632
case "$finalize_rpath " in
2634
*) finalize_rpath="$finalize_rpath $libdir"
2638
fi # $linkmode,$pass = prog,link...
2640
if test "$alldeplibs" = yes &&
2641
{ test "$deplibs_check_method" = pass_all ||
2642
{ test "$build_libtool_libs" = yes &&
2643
test -n "$library_names"; }; }; then
2644
# We only need to search for static libraries
2649
link_static=no # Whether the deplib will be linked statically
2650
use_static_libs=$prefer_static_libs
2651
if test "$use_static_libs" = built && test "$installed" = yes ; then
2654
if test -n "$library_names" &&
2655
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
2656
if test "$installed" = no; then
2657
notinst_deplibs="$notinst_deplibs $lib"
2660
# This is a shared library
2662
# Warn about portability, can't link against -module's on
2663
# some systems (darwin)
2664
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2666
if test "$linkmode" = prog; then
2667
$echo "*** Warning: Linking the executable $output against the loadable module"
2669
$echo "*** Warning: Linking the shared library $output against the loadable module"
2671
$echo "*** $linklib is not portable!"
2673
if test "$linkmode" = lib &&
2674
test "$hardcode_into_libs" = yes; then
2675
# Hardcode the library path.
2676
# Skip directories that are in the system default run-time
2678
case " $sys_lib_dlsearch_path " in
2681
case "$compile_rpath " in
2683
*) compile_rpath="$compile_rpath $absdir"
2687
case " $sys_lib_dlsearch_path " in
2690
case "$finalize_rpath " in
2692
*) finalize_rpath="$finalize_rpath $libdir"
2698
if test -n "$old_archive_from_expsyms_cmds"; then
2699
# figure out the soname
2700
set dummy $library_names
2703
libname=`eval \\$echo \"$libname_spec\"`
2704
# use dlname if we got it. it's perfectly good, no?
2705
if test -n "$dlname"; then
2707
elif test -n "$soname_spec"; then
2711
major=`expr $current - $age`
2715
eval soname=\"$soname_spec\"
2720
# Make a new name for the extract_expsyms_cmds to use
2722
soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2723
newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2725
# If the library has no export list, then create one now
2726
if test -f "$output_objdir/$soname-def"; then :
2728
$show "extracting exported symbol list from \`$soname'"
2729
save_ifs="$IFS"; IFS='~'
2730
cmds=$extract_expsyms_cmds
2731
for cmd in $cmds; do
2735
$run eval "$cmd" || exit $?
2741
if test -f "$output_objdir/$newlib"; then :; else
2742
$show "generating import library for \`$soname'"
2743
save_ifs="$IFS"; IFS='~'
2744
cmds=$old_archive_from_expsyms_cmds
2745
for cmd in $cmds; do
2749
$run eval "$cmd" || exit $?
2753
# make sure the library variables are pointing to the new library
2756
fi # test -n "$old_archive_from_expsyms_cmds"
2758
if test "$linkmode" = prog || test "$mode" != relink; then
2763
case $hardcode_action in
2764
immediate | unsupported)
2765
if test "$hardcode_direct" = no; then
2768
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2769
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
2770
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2771
*-*-unixware7*) add_dir="-L$dir" ;;
2773
# if the lib is a module then we can not link against
2774
# it, someone is ignoring the new warnings I added
2775
if /usr/bin/file -L $add 2> /dev/null |
2776
$EGREP ": [^:]* bundle" >/dev/null ; then
2777
$echo "** Warning, lib $linklib is a module, not a shared library"
2778
if test -z "$old_library" ; then
2780
$echo "** And there doesn't seem to be a static archive available"
2781
$echo "** The link will probably fail, sorry"
2783
add="$dir/$old_library"
2787
elif test "$hardcode_minus_L" = no; then
2789
*-*-sunos*) add_shlibpath="$dir" ;;
2793
elif test "$hardcode_shlibpath_var" = no; then
2794
add_shlibpath="$dir"
2801
if test "$hardcode_direct" = yes; then
2803
elif test "$hardcode_minus_L" = yes; then
2805
# Try looking first in the location we're being installed to.
2806
if test -n "$inst_prefix_dir"; then
2809
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2814
elif test "$hardcode_shlibpath_var" = yes; then
2815
add_shlibpath="$dir"
2824
if test "$lib_linked" != yes; then
2825
$echo "$modename: configuration error: unsupported hardcode properties"
2829
if test -n "$add_shlibpath"; then
2830
case :$compile_shlibpath: in
2831
*":$add_shlibpath:"*) ;;
2832
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2835
if test "$linkmode" = prog; then
2836
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2837
test -n "$add" && compile_deplibs="$add $compile_deplibs"
2839
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2840
test -n "$add" && deplibs="$add $deplibs"
2841
if test "$hardcode_direct" != yes && \
2842
test "$hardcode_minus_L" != yes && \
2843
test "$hardcode_shlibpath_var" = yes; then
2844
case :$finalize_shlibpath: in
2846
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2852
if test "$linkmode" = prog || test "$mode" = relink; then
2856
# Finalize command for both is simple: just hardcode it.
2857
if test "$hardcode_direct" = yes; then
2858
add="$libdir/$linklib"
2859
elif test "$hardcode_minus_L" = yes; then
2862
elif test "$hardcode_shlibpath_var" = yes; then
2863
case :$finalize_shlibpath: in
2865
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2868
elif test "$hardcode_automatic" = yes; then
2869
if test -n "$inst_prefix_dir" &&
2870
test -f "$inst_prefix_dir$libdir/$linklib" ; then
2871
add="$inst_prefix_dir$libdir/$linklib"
2873
add="$libdir/$linklib"
2876
# We cannot seem to hardcode it, guess we'll fake it.
2878
# Try looking first in the location we're being installed to.
2879
if test -n "$inst_prefix_dir"; then
2882
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2889
if test "$linkmode" = prog; then
2890
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2891
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2893
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2894
test -n "$add" && deplibs="$add $deplibs"
2897
elif test "$linkmode" = prog; then
2898
# Here we assume that one of hardcode_direct or hardcode_minus_L
2899
# is not unsupported. This is valid on all known static and
2901
if test "$hardcode_direct" != unsupported; then
2902
test -n "$old_library" && linklib="$old_library"
2903
compile_deplibs="$dir/$linklib $compile_deplibs"
2904
finalize_deplibs="$dir/$linklib $finalize_deplibs"
2906
compile_deplibs="-l$name -L$dir $compile_deplibs"
2907
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2909
elif test "$build_libtool_libs" = yes; then
2910
# Not a shared library
2911
if test "$deplibs_check_method" != pass_all; then
2912
# We're trying link a shared library against a static one
2913
# but the system doesn't support it.
2915
# Just print a warning and add the library to dependency_libs so
2916
# that the program can be linked against the static library.
2918
$echo "*** Warning: This system can not link to static lib archive $lib."
2919
$echo "*** I have the capability to make that library automatically link in when"
2920
$echo "*** you link to this library. But I can only do this if you have a"
2921
$echo "*** shared version of the library, which you do not appear to have."
2922
if test "$module" = yes; then
2923
$echo "*** But as you try to build a module library, libtool will still create "
2924
$echo "*** a static module, that should work as long as the dlopening application"
2925
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2926
if test -z "$global_symbol_pipe"; then
2928
$echo "*** However, this would only work if libtool was able to extract symbol"
2929
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2930
$echo "*** not find such a program. So, this module is probably useless."
2931
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2933
if test "$build_old_libs" = no; then
2934
build_libtool_libs=module
2937
build_libtool_libs=no
2941
deplibs="$dir/$old_library $deplibs"
2944
fi # link shared/static library?
2946
if test "$linkmode" = lib; then
2947
if test -n "$dependency_libs" &&
2948
{ test "$hardcode_into_libs" != yes ||
2949
test "$build_old_libs" = yes ||
2950
test "$link_static" = yes; }; then
2951
# Extract -R from dependency_libs
2953
for libdir in $dependency_libs; do
2955
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2957
*" $temp_xrpath "*) ;;
2958
*) xrpath="$xrpath $temp_xrpath";;
2960
*) temp_deplibs="$temp_deplibs $libdir";;
2963
dependency_libs="$temp_deplibs"
2966
newlib_search_path="$newlib_search_path $absdir"
2967
# Link against this library
2968
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2969
# ... and its dependency_libs
2971
for deplib in $dependency_libs; do
2972
newdependency_libs="$deplib $newdependency_libs"
2973
if test "X$duplicate_deps" = "Xyes" ; then
2974
case "$tmp_libs " in
2975
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2978
tmp_libs="$tmp_libs $deplib"
2981
if test "$link_all_deplibs" != no; then
2982
# Add the search paths of all dependency libraries
2983
for deplib in $dependency_libs; do
2985
-L*) path="$deplib" ;;
2987
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2988
test "X$dir" = "X$deplib" && dir="."
2989
# We need an absolute path.
2991
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2993
absdir=`cd "$dir" && pwd`
2994
if test -z "$absdir"; then
2995
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
3000
if grep "^installed=no" $deplib > /dev/null; then
3001
path="$absdir/$objdir"
3003
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3004
if test -z "$libdir"; then
3005
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3008
if test "$absdir" != "$libdir"; then
3009
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
3016
# we do not want to link against static libs,
3017
# but need to link against shared
3018
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3019
eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3020
if test -n "$deplibrary_names" ; then
3021
for tmp in $deplibrary_names ; do
3024
if test -f "$deplibdir/$depdepl" ; then
3025
depdepl="$deplibdir/$depdepl"
3026
elif test -f "$path/$depdepl" ; then
3027
depdepl="$path/$depdepl"
3029
# Can't find it, oh well...
3032
# do not add paths which are already there
3033
case " $newlib_search_path " in
3035
*) newlib_search_path="$newlib_search_path $path";;
3048
# Again, we only want to link against shared libraries
3049
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3050
for tmp in $newlib_search_path ; do
3051
if test -f "$tmp/lib$tmp_libs.dylib" ; then
3052
eval depdepl="$tmp/lib$tmp_libs.dylib"
3063
case " $deplibs " in
3065
*) deplibs="$path $deplibs" ;;
3067
case " $deplibs " in
3069
*) deplibs="$depdepl $deplibs" ;;
3072
fi # link_all_deplibs != no
3074
done # for deplib in $libs
3075
dependency_libs="$newdependency_libs"
3076
if test "$pass" = dlpreopen; then
3077
# Link the dlpreopened libraries before other libraries
3078
for deplib in $save_deplibs; do
3079
deplibs="$deplib $deplibs"
3082
if test "$pass" != dlopen; then
3083
if test "$pass" != conv; then
3084
# Make sure lib_search_path contains only unique directories.
3086
for dir in $newlib_search_path; do
3087
case "$lib_search_path " in
3089
*) lib_search_path="$lib_search_path $dir" ;;
3095
if test "$linkmode,$pass" != "prog,link"; then
3098
vars="compile_deplibs finalize_deplibs"
3100
for var in $vars dependency_libs; do
3101
# Add libraries to $var in reverse order
3102
eval tmp_libs=\"\$$var\"
3104
for deplib in $tmp_libs; do
3105
# FIXME: Pedantically, this is the right thing to do, so
3106
# that some nasty dependency loop isn't accidentally
3108
#new_libs="$deplib $new_libs"
3109
# Pragmatically, this seems to cause very few problems in
3112
-L*) new_libs="$deplib $new_libs" ;;
3115
# And here is the reason: when a library appears more
3116
# than once as an explicit dependence of a library, or
3117
# is implicitly linked in more than once by the
3118
# compiler, it is considered special, and multiple
3119
# occurrences thereof are not removed. Compare this
3120
# with having the same library being listed as a
3121
# dependency of multiple other libraries: in this case,
3122
# we know (pedantically, we assume) the library does not
3123
# need to be listed more than once, so we keep only the
3124
# last copy. This is not always right, but it is rare
3125
# enough that we require users that really mean to play
3126
# such unportable linking tricks to link the library
3127
# using -Wl,-lname, so that libtool does not consider it
3128
# for duplicate removal.
3129
case " $specialdeplibs " in
3130
*" $deplib "*) new_libs="$deplib $new_libs" ;;
3132
case " $new_libs " in
3134
*) new_libs="$deplib $new_libs" ;;
3142
for deplib in $new_libs; do
3145
case " $tmp_libs " in
3147
*) tmp_libs="$tmp_libs $deplib" ;;
3150
*) tmp_libs="$tmp_libs $deplib" ;;
3153
eval $var=\"$tmp_libs\"
3156
# Last step: remove runtime libs from dependency_libs
3157
# (they stay in deplibs)
3159
for i in $dependency_libs ; do
3160
case " $predeps $postdeps $compiler_lib_search_path " in
3165
if test -n "$i" ; then
3166
tmp_libs="$tmp_libs $i"
3169
dependency_libs=$tmp_libs
3171
if test "$linkmode" = prog; then
3172
dlfiles="$newdlfiles"
3173
dlprefiles="$newdlprefiles"
3180
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3183
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3184
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3187
if test -n "$rpath"; then
3188
$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3191
if test -n "$xrpath"; then
3192
$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3195
if test -n "$vinfo"; then
3196
$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3199
if test -n "$release"; then
3200
$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3203
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3204
$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3207
# Now set the variables for building old libraries.
3208
build_libtool_libs=no
3210
objs="$objs$old_deplibs"
3214
# Make sure we only generate libraries of the form `libNAME.la'.
3217
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3218
eval shared_ext=\"$shrext_cmds\"
3219
eval libname=\"$libname_spec\"
3222
if test "$module" = no; then
3223
$echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3227
if test "$need_lib_prefix" != no; then
3228
# Add the "lib" prefix for modules if required
3229
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3230
eval shared_ext=\"$shrext_cmds\"
3231
eval libname=\"$libname_spec\"
3233
libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3238
if test -n "$objs"; then
3239
if test "$deplibs_check_method" != pass_all; then
3240
$echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3244
$echo "*** Warning: Linking the shared library $output against the non-libtool"
3245
$echo "*** objects $objs is not portable!"
3246
libobjs="$libobjs $objs"
3250
if test "$dlself" != no; then
3251
$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3255
if test "$#" -gt 2; then
3256
$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3261
if test -z "$rpath"; then
3262
if test "$build_libtool_libs" = yes; then
3263
# Building a libtool convenience library.
3264
# Some compilers have problems with a `.al' extension so
3265
# convenience libraries should have the same extension an
3266
# archive normally would.
3267
oldlibs="$output_objdir/$libname.$libext $oldlibs"
3268
build_libtool_libs=convenience
3272
if test -n "$vinfo"; then
3273
$echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3276
if test -n "$release"; then
3277
$echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3281
# Parse the version information argument.
3282
save_ifs="$IFS"; IFS=':'
3283
set dummy $vinfo 0 0 0
3286
if test -n "$8"; then
3287
$echo "$modename: too many parameters to \`-version-info'" 1>&2
3292
# convert absolute version numbers to libtool ages
3293
# this retains compatibility with .la files and attempts
3294
# to make the code below a bit more comprehensible
3296
case $vinfo_number in
3300
number_revision="$4"
3302
# There are really only two kinds -- those that
3303
# use the current revision as the major version
3304
# and those that subtract age and use age as
3305
# a minor version. But, then there is irix
3306
# which has an extra 1 added just for fun
3308
case $version_type in
3309
darwin|linux|osf|windows|none)
3310
current=`expr $number_major + $number_minor`
3312
revision="$number_revision"
3314
freebsd-aout|freebsd-elf|sunos)
3315
current="$number_major"
3316
revision="$number_minor"
3320
current=`expr $number_major + $number_minor`
3322
revision="$number_minor"
3323
lt_irix_increment=no
3334
# Check that each of the things are valid numbers.
3336
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]) ;;
3338
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3339
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3345
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]) ;;
3347
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3348
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3354
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]) ;;
3356
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3357
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3362
if test "$age" -gt "$current"; then
3363
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3364
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3368
# Calculate the version variables.
3372
case $version_type in
3376
# Like Linux, but with the current version available in
3377
# verstring for coding it into the library header
3378
major=.`expr $current - $age`
3379
versuffix="$major.$age.$revision"
3380
# Darwin ld doesn't like 0 for these options...
3381
minor_current=`expr $current + 1`
3382
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3383
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3388
versuffix=".$current.$revision";
3393
versuffix=".$current";
3397
if test "X$lt_irix_increment" = "Xno"; then
3398
major=`expr $current - $age`
3400
major=`expr $current - $age + 1`
3402
case $version_type in
3403
nonstopux) verstring_prefix=nonstopux ;;
3404
*) verstring_prefix=sgi ;;
3406
verstring="$verstring_prefix$major.$revision"
3408
# Add in all the interfaces that we are compatible with.
3410
while test "$loop" -ne 0; do
3411
iface=`expr $revision - $loop`
3412
loop=`expr $loop - 1`
3413
verstring="$verstring_prefix$major.$iface:$verstring"
3416
# Before this point, $major must not contain `.'.
3418
versuffix="$major.$revision"
3422
major=.`expr $current - $age`
3423
versuffix="$major.$age.$revision"
3427
major=.`expr $current - $age`
3428
versuffix=".$current.$age.$revision"
3429
verstring="$current.$age.$revision"
3431
# Add in all the interfaces that we are compatible with.
3433
while test "$loop" -ne 0; do
3434
iface=`expr $current - $loop`
3435
loop=`expr $loop - 1`
3436
verstring="$verstring:${iface}.0"
3439
# Make executables depend on our current version.
3440
verstring="$verstring:${current}.0"
3445
versuffix=".$current.$revision"
3449
# Use '-' rather than '.', since we only want one
3450
# extension on DOS 8.3 filesystems.
3451
major=`expr $current - $age`
3456
$echo "$modename: unknown library version type \`$version_type'" 1>&2
3457
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3462
# Clear the version info if we defaulted, and they specified a release.
3463
if test -z "$vinfo" && test -n "$release"; then
3465
case $version_type in
3467
# we can't check for "0.0" in archive_cmds due to quoting
3468
# problems, so we reset it completely
3475
if test "$need_version" = no; then
3482
# Remove version info from name if versioning should be avoided
3483
if test "$avoid_version" = yes && test "$need_version" = no; then
3489
# Check to see if the archive will have undefined symbols.
3490
if test "$allow_undefined" = yes; then
3491
if test "$allow_undefined_flag" = unsupported; then
3492
$echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3493
build_libtool_libs=no
3497
# Don't allow undefined symbols.
3498
allow_undefined_flag="$no_undefined_flag"
3502
if test "$mode" != relink; then
3503
# Remove our outputs, but don't remove object files since they
3504
# may have been created when compiling PIC objects.
3506
tempremovelist=`$echo "$output_objdir/*"`
3507
for p in $tempremovelist; do
3511
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3512
if test "X$precious_files_regex" != "X"; then
3513
if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3518
removelist="$removelist $p"
3523
if test -n "$removelist"; then
3524
$show "${rm}r $removelist"
3525
$run ${rm}r $removelist
3529
# Now set the variables for building old libraries.
3530
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3531
oldlibs="$oldlibs $output_objdir/$libname.$libext"
3533
# Transform .lo files to .o files.
3534
oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3537
# Eliminate all temporary directories.
3538
#for path in $notinst_path; do
3539
# lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3540
# deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3541
# dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3544
if test -n "$xrpath"; then
3545
# If the user specified any rpath flags, then add them.
3547
for libdir in $xrpath; do
3548
temp_xrpath="$temp_xrpath -R$libdir"
3549
case "$finalize_rpath " in
3551
*) finalize_rpath="$finalize_rpath $libdir" ;;
3554
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3555
dependency_libs="$temp_xrpath $dependency_libs"
3559
# Make sure dlfiles contains only unique files that won't be dlpreopened
3560
old_dlfiles="$dlfiles"
3562
for lib in $old_dlfiles; do
3563
case " $dlprefiles $dlfiles " in
3565
*) dlfiles="$dlfiles $lib" ;;
3569
# Make sure dlprefiles contains only unique files
3570
old_dlprefiles="$dlprefiles"
3572
for lib in $old_dlprefiles; do
3573
case "$dlprefiles " in
3575
*) dlprefiles="$dlprefiles $lib" ;;
3579
if test "$build_libtool_libs" = yes; then
3580
if test -n "$rpath"; then
3582
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3583
# these systems don't actually have a c library (as such)!
3585
*-*-rhapsody* | *-*-darwin1.[012])
3586
# Rhapsody C library is in the System framework
3587
deplibs="$deplibs -framework System"
3590
# Don't link with libc until the a.out ld.so is fixed.
3592
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3593
# Do not include libc due to us having libc/libc_r.
3595
*-*-sco3.2v5* | *-*-sco5v6*)
3596
# Causes problems with __ctype
3598
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3599
# Compiler inserts libc in the correct place for threads to work
3602
# Add libc to deplibs on all other systems if necessary.
3603
if test "$build_libtool_need_lc" = "yes"; then
3604
deplibs="$deplibs -lc"
3610
# Transform deplibs into only deplibs that can be linked in shared.
3612
libname_save=$libname
3613
release_save=$release
3614
versuffix_save=$versuffix
3616
# I'm not sure if I'm treating the release correctly. I think
3617
# release should show up in the -l (ie -lgmp5) so we don't want to
3618
# add it in twice. Is that correct?
3624
case $deplibs_check_method in
3626
# Don't check for shared/static. Everything works.
3627
# This might be a little naive. We might want to check
3628
# whether the library exists or not. But this is on
3629
# osf3 & osf4 and I'm not really sure... Just
3630
# implementing what was already the behavior.
3634
# This code stresses the "libraries are programs" paradigm to its
3635
# limits. Maybe even breaks it. We compile a program, linking it
3636
# against the deplibs as a proxy for the library. Then we can check
3637
# whether they linked in statically or dynamically with ldd.
3639
cat > conftest.c <<EOF
3640
int main() { return 0; }
3643
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3644
ldd_output=`ldd conftest`
3645
for i in $deplibs; do
3646
name=`expr $i : '-l\(.*\)'`
3647
# If $name is empty we are operating on a -L argument.
3648
if test "$name" != "" && test "$name" != "0"; then
3649
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3650
case " $predeps $postdeps " in
3652
newdeplibs="$newdeplibs $i"
3657
if test -n "$i" ; then
3658
libname=`eval \\$echo \"$libname_spec\"`
3659
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3660
set dummy $deplib_matches
3662
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3663
newdeplibs="$newdeplibs $i"
3667
$echo "*** Warning: dynamic linker does not accept needed library $i."
3668
$echo "*** I have the capability to make that library automatically link in when"
3669
$echo "*** you link to this library. But I can only do this if you have a"
3670
$echo "*** shared version of the library, which I believe you do not have"
3671
$echo "*** because a test_compile did reveal that the linker did not use it for"
3672
$echo "*** its dynamic dependency list that programs get resolved with at runtime."
3676
newdeplibs="$newdeplibs $i"
3680
# Error occurred in the first compile. Let's try to salvage
3681
# the situation: Compile a separate program for each library.
3682
for i in $deplibs; do
3683
name=`expr $i : '-l\(.*\)'`
3684
# If $name is empty we are operating on a -L argument.
3685
if test "$name" != "" && test "$name" != "0"; then
3687
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3688
ldd_output=`ldd conftest`
3689
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3690
case " $predeps $postdeps " in
3692
newdeplibs="$newdeplibs $i"
3697
if test -n "$i" ; then
3698
libname=`eval \\$echo \"$libname_spec\"`
3699
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3700
set dummy $deplib_matches
3702
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3703
newdeplibs="$newdeplibs $i"
3707
$echo "*** Warning: dynamic linker does not accept needed library $i."
3708
$echo "*** I have the capability to make that library automatically link in when"
3709
$echo "*** you link to this library. But I can only do this if you have a"
3710
$echo "*** shared version of the library, which you do not appear to have"
3711
$echo "*** because a test_compile did reveal that the linker did not use this one"
3712
$echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3718
$echo "*** Warning! Library $i is needed by this library but I was not able to"
3719
$echo "*** make it link in! You will probably need to install it or some"
3720
$echo "*** library that it depends on before this library will be fully"
3721
$echo "*** functional. Installing it before continuing would be even better."
3724
newdeplibs="$newdeplibs $i"
3730
set dummy $deplibs_check_method
3731
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3732
for a_deplib in $deplibs; do
3733
name=`expr $a_deplib : '-l\(.*\)'`
3734
# If $name is empty we are operating on a -L argument.
3735
if test "$name" != "" && test "$name" != "0"; then
3736
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3737
case " $predeps $postdeps " in
3739
newdeplibs="$newdeplibs $a_deplib"
3744
if test -n "$a_deplib" ; then
3745
libname=`eval \\$echo \"$libname_spec\"`
3746
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3747
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3748
for potent_lib in $potential_libs; do
3749
# Follow soft links.
3750
if ls -lLd "$potent_lib" 2>/dev/null \
3751
| grep " -> " >/dev/null; then
3754
# The statement above tries to avoid entering an
3755
# endless loop below, in case of cyclic links.
3756
# We might still enter an endless loop, since a link
3757
# loop can be closed while we follow links,
3759
potlib="$potent_lib"
3760
while test -h "$potlib" 2>/dev/null; do
3761
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3763
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3764
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3767
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3769
| $EGREP "$file_magic_regex" > /dev/null; then
3770
newdeplibs="$newdeplibs $a_deplib"
3777
if test -n "$a_deplib" ; then
3780
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3781
$echo "*** I have the capability to make that library automatically link in when"
3782
$echo "*** you link to this library. But I can only do this if you have a"
3783
$echo "*** shared version of the library, which you do not appear to have"
3784
$echo "*** because I did check the linker path looking for a file starting"
3785
if test -z "$potlib" ; then
3786
$echo "*** with $libname but no candidates were found. (...for file magic test)"
3788
$echo "*** with $libname and none of the candidates passed a file format test"
3789
$echo "*** using a file magic. Last file checked: $potlib"
3793
# Add a -L argument.
3794
newdeplibs="$newdeplibs $a_deplib"
3796
done # Gone through all deplibs.
3799
set dummy $deplibs_check_method
3800
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3801
for a_deplib in $deplibs; do
3802
name=`expr $a_deplib : '-l\(.*\)'`
3803
# If $name is empty we are operating on a -L argument.
3804
if test -n "$name" && test "$name" != "0"; then
3805
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3806
case " $predeps $postdeps " in
3808
newdeplibs="$newdeplibs $a_deplib"
3813
if test -n "$a_deplib" ; then
3814
libname=`eval \\$echo \"$libname_spec\"`
3815
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3816
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3817
for potent_lib in $potential_libs; do
3818
potlib="$potent_lib" # see symlink-check above in file_magic test
3819
if eval $echo \"$potent_lib\" 2>/dev/null \
3821
| $EGREP "$match_pattern_regex" > /dev/null; then
3822
newdeplibs="$newdeplibs $a_deplib"
3829
if test -n "$a_deplib" ; then
3832
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3833
$echo "*** I have the capability to make that library automatically link in when"
3834
$echo "*** you link to this library. But I can only do this if you have a"
3835
$echo "*** shared version of the library, which you do not appear to have"
3836
$echo "*** because I did check the linker path looking for a file starting"
3837
if test -z "$potlib" ; then
3838
$echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3840
$echo "*** with $libname and none of the candidates passed a file format test"
3841
$echo "*** using a regex pattern. Last file checked: $potlib"
3845
# Add a -L argument.
3846
newdeplibs="$newdeplibs $a_deplib"
3848
done # Gone through all deplibs.
3852
tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3853
-e 's/ -[LR][^ ]*//g'`
3854
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3855
for i in $predeps $postdeps ; do
3856
# can't use Xsed below, because $i might contain '/'
3857
tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3860
if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3861
| grep . >/dev/null; then
3863
if test "X$deplibs_check_method" = "Xnone"; then
3864
$echo "*** Warning: inter-library dependencies are not supported in this platform."
3866
$echo "*** Warning: inter-library dependencies are not known to be supported."
3868
$echo "*** All declared inter-library dependencies are being dropped."
3873
versuffix=$versuffix_save
3875
release=$release_save
3876
libname=$libname_save
3880
*-*-rhapsody* | *-*-darwin1.[012])
3881
# On Rhapsody replace the C library is the System framework
3882
newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3886
if test "$droppeddeps" = yes; then
3887
if test "$module" = yes; then
3889
$echo "*** Warning: libtool could not satisfy all declared inter-library"
3890
$echo "*** dependencies of module $libname. Therefore, libtool will create"
3891
$echo "*** a static module, that should work as long as the dlopening"
3892
$echo "*** application is linked with the -dlopen flag."
3893
if test -z "$global_symbol_pipe"; then
3895
$echo "*** However, this would only work if libtool was able to extract symbol"
3896
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3897
$echo "*** not find such a program. So, this module is probably useless."
3898
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
3900
if test "$build_old_libs" = no; then
3901
oldlibs="$output_objdir/$libname.$libext"
3902
build_libtool_libs=module
3905
build_libtool_libs=no
3908
$echo "*** The inter-library dependencies that have been dropped here will be"
3909
$echo "*** automatically added whenever a program is linked with this library"
3910
$echo "*** or is declared to -dlopen it."
3912
if test "$allow_undefined" = no; then
3914
$echo "*** Since this library must not contain undefined symbols,"
3915
$echo "*** because either the platform does not support them or"
3916
$echo "*** it was explicitly requested with -no-undefined,"
3917
$echo "*** libtool will only create a static version of it."
3918
if test "$build_old_libs" = no; then
3919
oldlibs="$output_objdir/$libname.$libext"
3920
build_libtool_libs=module
3923
build_libtool_libs=no
3928
# Done checking deplibs!
3933
# move library search paths that coincide with paths to not yet
3934
# installed libraries to the beginning of the library search list
3936
for path in $notinst_path; do
3937
case " $new_libs " in
3938
*" -L$path/$objdir "*) ;;
3940
case " $deplibs " in
3941
*" -L$path/$objdir "*)
3942
new_libs="$new_libs -L$path/$objdir" ;;
3947
for deplib in $deplibs; do
3950
case " $new_libs " in
3952
*) new_libs="$new_libs $deplib" ;;
3955
*) new_libs="$new_libs $deplib" ;;
3961
# All the library-specific variables (install_libdir is set above).
3966
# Test again, we may have decided not to build it any more
3967
if test "$build_libtool_libs" = yes; then
3968
if test "$hardcode_into_libs" = yes; then
3969
# Hardcode the library paths
3972
rpath="$finalize_rpath"
3973
test "$mode" != relink && rpath="$compile_rpath$rpath"
3974
for libdir in $rpath; do
3975
if test -n "$hardcode_libdir_flag_spec"; then
3976
if test -n "$hardcode_libdir_separator"; then
3977
if test -z "$hardcode_libdirs"; then
3978
hardcode_libdirs="$libdir"
3980
# Just accumulate the unique libdirs.
3981
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3982
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3985
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3990
eval flag=\"$hardcode_libdir_flag_spec\"
3991
dep_rpath="$dep_rpath $flag"
3993
elif test -n "$runpath_var"; then
3994
case "$perm_rpath " in
3996
*) perm_rpath="$perm_rpath $libdir" ;;
4000
# Substitute the hardcoded libdirs into the rpath.
4001
if test -n "$hardcode_libdir_separator" &&
4002
test -n "$hardcode_libdirs"; then
4003
libdir="$hardcode_libdirs"
4004
if test -n "$hardcode_libdir_flag_spec_ld"; then
4005
case $archive_cmds in
4006
*\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
4007
*) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
4010
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
4013
if test -n "$runpath_var" && test -n "$perm_rpath"; then
4014
# We should set the runpath_var.
4016
for dir in $perm_rpath; do
4019
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
4021
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
4024
shlibpath="$finalize_shlibpath"
4025
test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4026
if test -n "$shlibpath"; then
4027
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4030
# Get the real and link names of the library.
4031
eval shared_ext=\"$shrext_cmds\"
4032
eval library_names=\"$library_names_spec\"
4033
set dummy $library_names
4037
if test -n "$soname_spec"; then
4038
eval soname=\"$soname_spec\"
4042
if test -z "$dlname"; then
4046
lib="$output_objdir/$realname"
4050
linknames="$linknames $link"
4053
# Use standard objects if they are pic
4054
test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4056
# Prepare the list of exported symbols
4057
if test -z "$export_symbols"; then
4058
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4059
$show "generating symbol list for \`$libname.la'"
4060
export_symbols="$output_objdir/$libname.exp"
4061
$run $rm $export_symbols
4062
cmds=$export_symbols_cmds
4063
save_ifs="$IFS"; IFS='~'
4064
for cmd in $cmds; do
4067
if len=`expr "X$cmd" : ".*"` &&
4068
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4070
$run eval "$cmd" || exit $?
4071
skipped_export=false
4073
# The command line is too long to execute in one step.
4074
$show "using reloadable object file for export list..."
4076
# Break out early, otherwise skipped_export may be
4077
# set to false by a later but shorter cmd.
4082
if test -n "$export_symbols_regex"; then
4083
$show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4084
$run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4085
$show "$mv \"${export_symbols}T\" \"$export_symbols\""
4086
$run eval '$mv "${export_symbols}T" "$export_symbols"'
4091
if test -n "$export_symbols" && test -n "$include_expsyms"; then
4092
$run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4096
for test_deplib in $deplibs; do
4097
case " $convenience " in
4098
*" $test_deplib "*) ;;
4100
tmp_deplibs="$tmp_deplibs $test_deplib"
4104
deplibs="$tmp_deplibs"
4106
if test -n "$convenience"; then
4107
if test -n "$whole_archive_flag_spec"; then
4108
save_libobjs=$libobjs
4109
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4111
gentop="$output_objdir/${outputname}x"
4112
generated="$generated $gentop"
4114
func_extract_archives $gentop $convenience
4115
libobjs="$libobjs $func_extract_archives_result"
4119
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4120
eval flag=\"$thread_safe_flag_spec\"
4121
linker_flags="$linker_flags $flag"
4124
# Make a backup of the uninstalled library when relinking
4125
if test "$mode" = relink; then
4126
$run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4129
# Do each of the archive commands.
4130
if test "$module" = yes && test -n "$module_cmds" ; then
4131
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4132
eval test_cmds=\"$module_expsym_cmds\"
4133
cmds=$module_expsym_cmds
4135
eval test_cmds=\"$module_cmds\"
4139
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4140
eval test_cmds=\"$archive_expsym_cmds\"
4141
cmds=$archive_expsym_cmds
4143
eval test_cmds=\"$archive_cmds\"
4148
if test "X$skipped_export" != "X:" &&
4149
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4150
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4153
# The command line is too long to link in one step, link piecewise.
4154
$echo "creating reloadable object files..."
4156
# Save the value of $output and $libobjs because we want to
4157
# use them later. If we have whole_archive_flag_spec, we
4158
# want to use save_libobjs as it was before
4159
# whole_archive_flag_spec was expanded, because we can't
4160
# assume the linker understands whole_archive_flag_spec.
4161
# This may have to be revisited, in case too many
4162
# convenience libraries get linked in and end up exceeding
4164
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4165
save_libobjs=$libobjs
4168
output_la=`$echo "X$output" | $Xsed -e "$basename"`
4170
# Clear the reloadable object creation command queue and
4171
# initialize k to one.
4178
output=$output_objdir/$output_la-${k}.$objext
4179
# Loop over the list of objects to be linked.
4180
for obj in $save_libobjs
4182
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4183
if test "X$objlist" = X ||
4184
{ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4185
test "$len" -le "$max_cmd_len"; }; then
4186
objlist="$objlist $obj"
4188
# The command $test_cmds is almost too long, add a
4189
# command to the queue.
4190
if test "$k" -eq 1 ; then
4191
# The first file doesn't have a previous command to add.
4192
eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4194
# All subsequent reloadable object files will link in
4195
# the last one created.
4196
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4198
last_robj=$output_objdir/$output_la-${k}.$objext
4200
output=$output_objdir/$output_la-${k}.$objext
4205
# Handle the remaining objects by creating one last
4206
# reloadable object file. All subsequent reloadable object
4207
# files will link in the last one created.
4208
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4209
eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4211
if ${skipped_export-false}; then
4212
$show "generating symbol list for \`$libname.la'"
4213
export_symbols="$output_objdir/$libname.exp"
4214
$run $rm $export_symbols
4216
# Append the command to create the export file.
4217
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4220
# Set up a command to remove the reloadable object files
4221
# after they are used.
4223
while test "$i" -lt "$k"
4226
delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4229
$echo "creating a temporary reloadable object file: $output"
4231
# Loop through the commands generated above and execute them.
4232
save_ifs="$IFS"; IFS='~'
4233
for cmd in $concat_cmds; do
4236
$run eval "$cmd" || exit $?
4241
# Restore the value of output.
4244
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4245
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4247
# Expand the library linking commands again to reset the
4248
# value of $libobjs for piecewise linking.
4250
# Do each of the archive commands.
4251
if test "$module" = yes && test -n "$module_cmds" ; then
4252
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4253
cmds=$module_expsym_cmds
4258
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4259
cmds=$archive_expsym_cmds
4265
# Append the command to remove the reloadable object files
4266
# to the just-reset $cmds.
4267
eval cmds=\"\$cmds~\$rm $delfiles\"
4269
save_ifs="$IFS"; IFS='~'
4270
for cmd in $cmds; do
4274
$run eval "$cmd" || {
4277
# Restore the uninstalled library and exit
4278
if test "$mode" = relink; then
4279
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4287
# Restore the uninstalled library and exit
4288
if test "$mode" = relink; then
4289
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4291
if test -n "$convenience"; then
4292
if test -z "$whole_archive_flag_spec"; then
4293
$show "${rm}r $gentop"
4294
$run ${rm}r "$gentop"
4301
# Create links to the real library.
4302
for linkname in $linknames; do
4303
if test "$realname" != "$linkname"; then
4304
$show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4305
$run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4309
# If -module or -export-dynamic was specified, set the dlname.
4310
if test "$module" = yes || test "$export_dynamic" = yes; then
4311
# On all known operating systems, these are identical.
4320
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4323
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4324
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4327
if test -n "$rpath"; then
4328
$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4331
if test -n "$xrpath"; then
4332
$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4335
if test -n "$vinfo"; then
4336
$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4339
if test -n "$release"; then
4340
$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4345
if test -n "$objs$old_deplibs"; then
4346
$echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4350
obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4358
# Delete the old objects.
4359
$run $rm $obj $libobj
4361
# Objects from convenience libraries. This assumes
4362
# single-version convenience libraries. Whenever we create
4363
# different ones for PIC/non-PIC, this we'll have to duplicate
4367
# reload_cmds runs $LD directly, so let us get rid of
4368
# -Wl from whole_archive_flag_spec and hope we can get by with
4369
# turning comma into space..
4372
if test -n "$convenience"; then
4373
if test -n "$whole_archive_flag_spec"; then
4374
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4375
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4377
gentop="$output_objdir/${obj}x"
4378
generated="$generated $gentop"
4380
func_extract_archives $gentop $convenience
4381
reload_conv_objs="$reload_objs $func_extract_archives_result"
4385
# Create the old-style object.
4386
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
4390
save_ifs="$IFS"; IFS='~'
4391
for cmd in $cmds; do
4395
$run eval "$cmd" || exit $?
4399
# Exit if we aren't doing a library object file.
4400
if test -z "$libobj"; then
4401
if test -n "$gentop"; then
4402
$show "${rm}r $gentop"
4409
if test "$build_libtool_libs" != yes; then
4410
if test -n "$gentop"; then
4411
$show "${rm}r $gentop"
4415
# Create an invalid libtool object if no PIC, so that we don't
4416
# accidentally link it into a program.
4417
# $show "echo timestamp > $libobj"
4418
# $run eval "echo timestamp > $libobj" || exit $?
4422
if test -n "$pic_flag" || test "$pic_mode" != default; then
4423
# Only do commands if we really have different PIC objects.
4424
reload_objs="$libobjs $reload_conv_objs"
4427
save_ifs="$IFS"; IFS='~'
4428
for cmd in $cmds; do
4432
$run eval "$cmd" || exit $?
4437
if test -n "$gentop"; then
4438
$show "${rm}r $gentop"
4447
*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4449
if test -n "$vinfo"; then
4450
$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4453
if test -n "$release"; then
4454
$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4457
if test "$preload" = yes; then
4458
if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4459
test "$dlopen_self_static" = unknown; then
4460
$echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4465
*-*-rhapsody* | *-*-darwin1.[012])
4466
# On Rhapsody replace the C library is the System framework
4467
compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4468
finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4474
# Don't allow lazy linking, it breaks C++ global constructors
4475
if test "$tagname" = CXX ; then
4476
compile_command="$compile_command ${wl}-bind_at_load"
4477
finalize_command="$finalize_command ${wl}-bind_at_load"
4483
# move library search paths that coincide with paths to not yet
4484
# installed libraries to the beginning of the library search list
4486
for path in $notinst_path; do
4487
case " $new_libs " in
4488
*" -L$path/$objdir "*) ;;
4490
case " $compile_deplibs " in
4491
*" -L$path/$objdir "*)
4492
new_libs="$new_libs -L$path/$objdir" ;;
4497
for deplib in $compile_deplibs; do
4500
case " $new_libs " in
4502
*) new_libs="$new_libs $deplib" ;;
4505
*) new_libs="$new_libs $deplib" ;;
4508
compile_deplibs="$new_libs"
4511
compile_command="$compile_command $compile_deplibs"
4512
finalize_command="$finalize_command $finalize_deplibs"
4514
if test -n "$rpath$xrpath"; then
4515
# If the user specified any rpath flags, then add them.
4516
for libdir in $rpath $xrpath; do
4517
# This is the magic to use -rpath.
4518
case "$finalize_rpath " in
4520
*) finalize_rpath="$finalize_rpath $libdir" ;;
4525
# Now hardcode the library paths
4528
for libdir in $compile_rpath $finalize_rpath; do
4529
if test -n "$hardcode_libdir_flag_spec"; then
4530
if test -n "$hardcode_libdir_separator"; then
4531
if test -z "$hardcode_libdirs"; then
4532
hardcode_libdirs="$libdir"
4534
# Just accumulate the unique libdirs.
4535
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4536
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4539
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4544
eval flag=\"$hardcode_libdir_flag_spec\"
4545
rpath="$rpath $flag"
4547
elif test -n "$runpath_var"; then
4548
case "$perm_rpath " in
4550
*) perm_rpath="$perm_rpath $libdir" ;;
4554
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4555
testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4556
case :$dllsearchpath: in
4558
*) dllsearchpath="$dllsearchpath:$libdir";;
4560
case :$dllsearchpath: in
4561
*":$testbindir:"*) ;;
4562
*) dllsearchpath="$dllsearchpath:$testbindir";;
4567
# Substitute the hardcoded libdirs into the rpath.
4568
if test -n "$hardcode_libdir_separator" &&
4569
test -n "$hardcode_libdirs"; then
4570
libdir="$hardcode_libdirs"
4571
eval rpath=\" $hardcode_libdir_flag_spec\"
4573
compile_rpath="$rpath"
4577
for libdir in $finalize_rpath; do
4578
if test -n "$hardcode_libdir_flag_spec"; then
4579
if test -n "$hardcode_libdir_separator"; then
4580
if test -z "$hardcode_libdirs"; then
4581
hardcode_libdirs="$libdir"
4583
# Just accumulate the unique libdirs.
4584
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4585
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4588
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4593
eval flag=\"$hardcode_libdir_flag_spec\"
4594
rpath="$rpath $flag"
4596
elif test -n "$runpath_var"; then
4597
case "$finalize_perm_rpath " in
4599
*) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4603
# Substitute the hardcoded libdirs into the rpath.
4604
if test -n "$hardcode_libdir_separator" &&
4605
test -n "$hardcode_libdirs"; then
4606
libdir="$hardcode_libdirs"
4607
eval rpath=\" $hardcode_libdir_flag_spec\"
4609
finalize_rpath="$rpath"
4611
if test -n "$libobjs" && test "$build_old_libs" = yes; then
4612
# Transform all the library objects into standard objects.
4613
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4614
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4618
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4619
if test -n "$NM" && test -n "$global_symbol_pipe"; then
4620
dlsyms="${outputname}S.c"
4622
$echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4626
if test -n "$dlsyms"; then
4630
# Discover the nlist of each of the dlfiles.
4631
nlist="$output_objdir/${outputname}.nm"
4633
$show "$rm $nlist ${nlist}S ${nlist}T"
4634
$run $rm "$nlist" "${nlist}S" "${nlist}T"
4636
# Parse the name list into a source file.
4637
$show "creating $output_objdir/$dlsyms"
4639
test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4640
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4641
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4647
/* Prevent the only kind of declaration conflicts we can make. */
4648
#define lt_preloaded_symbols some_other_symbol
4650
/* External symbol declarations for the compiler. */\
4653
if test "$dlself" = yes; then
4654
$show "generating symbol list for \`$output'"
4656
test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4658
# Add our own program objects to the symbol list.
4659
progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4660
for arg in $progfiles; do
4661
$show "extracting global C symbols from \`$arg'"
4662
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4665
if test -n "$exclude_expsyms"; then
4666
$run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4667
$run eval '$mv "$nlist"T "$nlist"'
4670
if test -n "$export_symbols_regex"; then
4671
$run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4672
$run eval '$mv "$nlist"T "$nlist"'
4675
# Prepare the list of exported symbols
4676
if test -z "$export_symbols"; then
4677
export_symbols="$output_objdir/$outputname.exp"
4678
$run $rm $export_symbols
4679
$run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4681
*cygwin* | *mingw* )
4682
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4683
$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4687
$run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4688
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4689
$run eval 'mv "$nlist"T "$nlist"'
4691
*cygwin* | *mingw* )
4692
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4693
$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4699
for arg in $dlprefiles; do
4700
$show "extracting global C symbols from \`$arg'"
4701
name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4702
$run eval '$echo ": $name " >> "$nlist"'
4703
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4706
if test -z "$run"; then
4707
# Make sure we have at least an empty file.
4708
test -f "$nlist" || : > "$nlist"
4710
if test -n "$exclude_expsyms"; then
4711
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4712
$mv "$nlist"T "$nlist"
4715
# Try sorting and uniquifying the output.
4716
if grep -v "^: " < "$nlist" |
4717
if sort -k 3 </dev/null >/dev/null 2>&1; then
4722
uniq > "$nlist"S; then
4725
grep -v "^: " < "$nlist" > "$nlist"S
4728
if test -f "$nlist"S; then
4729
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4731
$echo '/* NONE */' >> "$output_objdir/$dlsyms"
4734
$echo >> "$output_objdir/$dlsyms" "\
4736
#undef lt_preloaded_symbols
4738
#if defined (__STDC__) && __STDC__
4739
# define lt_ptr void *
4741
# define lt_ptr char *
4745
/* The mapping between symbol names and symbols. */
4749
*cygwin* | *mingw* )
4750
$echo >> "$output_objdir/$dlsyms" "\
4751
/* DATA imports from DLLs on WIN32 can't be const, because
4752
runtime relocations are performed -- see ld's documentation
4758
$echo >> "$output_objdir/$dlsyms" "\
4765
$echo >> "$output_objdir/$dlsyms" "\
4769
lt_preloaded_symbols[] =
4773
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4775
$echo >> "$output_objdir/$dlsyms" "\
4779
/* This works around a problem in FreeBSD linker */
4780
#ifdef FREEBSD_WORKAROUND
4781
static const void *lt_preloaded_setup() {
4782
return lt_preloaded_symbols;
4792
pic_flag_for_symtable=
4794
# compiling the symbol table file with pic_flag works around
4795
# a FreeBSD bug that causes programs to crash when -lm is
4796
# linked before any other PIC object. But we must not use
4797
# pic_flag when linking with -static. The problem exists in
4798
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4799
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4800
case "$compile_command " in
4802
*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4805
case "$compile_command " in
4807
*) pic_flag_for_symtable=" $pic_flag";;
4811
# Now compile the dynamic symbol file.
4812
$show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4813
$run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4815
# Clean up the generated files.
4816
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4817
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4819
# Transform the symbol file into the correct name.
4821
*cygwin* | *mingw* )
4822
if test -f "$output_objdir/${outputname}.def" ; then
4823
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4824
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4826
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4827
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4831
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4832
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4837
# FreeBSD doesn't need this...
4840
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4845
# We keep going just in case the user didn't refer to
4846
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4847
# really was required.
4849
# Nullify the symbol file.
4850
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4851
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4854
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4855
# Replace the output file specification.
4856
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4857
link_command="$compile_command$compile_rpath"
4859
# We have no uninstalled library dependencies, so finalize right now.
4860
$show "$link_command"
4861
$run eval "$link_command"
4864
# Delete the generated files.
4865
if test -n "$dlsyms"; then
4866
$show "$rm $output_objdir/${outputname}S.${objext}"
4867
$run $rm "$output_objdir/${outputname}S.${objext}"
4873
if test -n "$shlibpath_var"; then
4874
# We should set the shlibpath_var
4876
for dir in $temp_rpath; do
4878
[\\/]* | [A-Za-z]:[\\/]*)
4883
# Relative path: add a thisdir entry.
4884
rpath="$rpath\$thisdir/$dir:"
4891
if test -n "$compile_shlibpath$finalize_shlibpath"; then
4892
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4894
if test -n "$finalize_shlibpath"; then
4895
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4900
if test -n "$runpath_var"; then
4901
if test -n "$perm_rpath"; then
4902
# We should set the runpath_var.
4904
for dir in $perm_rpath; do
4907
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4909
if test -n "$finalize_perm_rpath"; then
4910
# We should set the runpath_var.
4912
for dir in $finalize_perm_rpath; do
4915
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4919
if test "$no_install" = yes; then
4920
# We don't need to create a wrapper script.
4921
link_command="$compile_var$compile_command$compile_rpath"
4922
# Replace the output file specification.
4923
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4924
# Delete the old output file.
4926
# Link the executable and exit
4927
$show "$link_command"
4928
$run eval "$link_command" || exit $?
4932
if test "$hardcode_action" = relink; then
4933
# Fast installation is not supported
4934
link_command="$compile_var$compile_command$compile_rpath"
4935
relink_command="$finalize_var$finalize_command$finalize_rpath"
4937
$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4938
$echo "$modename: \`$output' will be relinked during installation" 1>&2
4940
if test "$fast_install" != no; then
4941
link_command="$finalize_var$compile_command$finalize_rpath"
4942
if test "$fast_install" = yes; then
4943
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4945
# fast_install is set to needless
4949
link_command="$compile_var$compile_command$compile_rpath"
4950
relink_command="$finalize_var$finalize_command$finalize_rpath"
4954
# Replace the output file specification.
4955
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4957
# Delete the old output files.
4958
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4960
$show "$link_command"
4961
$run eval "$link_command" || exit $?
4963
# Now create the wrapper script.
4964
$show "creating $output"
4966
# Quote the relink command for shipping.
4967
if test -n "$relink_command"; then
4968
# Preserve any variables that may affect compiler behavior
4969
for var in $variables_saved_for_relink; do
4970
if eval test -z \"\${$var+set}\"; then
4971
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4972
elif eval var_value=\$$var; test -z "$var_value"; then
4973
relink_command="$var=; export $var; $relink_command"
4975
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4976
relink_command="$var=\"$var_value\"; export $var; $relink_command"
4979
relink_command="(cd `pwd`; $relink_command)"
4980
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4983
# Quote $echo for shipping.
4984
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4986
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4987
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4989
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4991
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4994
# Only actually do things if our run command is non-null.
4995
if test -z "$run"; then
4996
# win32 will think the script is a binary if it has
4997
# a .exe suffix, so we strip it off here.
4999
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
5001
# test for cygwin because mv fails w/o .exe extensions
5005
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
5009
*cygwin* | *mingw* )
5010
output_name=`basename $output`
5011
output_path=`dirname $output`
5012
cwrappersource="$output_path/$objdir/lt-$output_name.c"
5013
cwrapper="$output_path/$output_name.exe"
5014
$rm $cwrappersource $cwrapper
5015
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
5017
cat > $cwrappersource <<EOF
5019
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5020
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5022
The $output program cannot be directly executed until all the libtool
5023
libraries that it depends on are installed.
5025
This wrapper executable should never be moved out of the build directory.
5026
If it is, it will not operate correctly.
5028
Currently, it simply execs the wrapper *script* "/bin/sh $output",
5029
but could eventually absorb all of the scripts functionality and
5030
exec $objdir/$outputname directly.
5033
cat >> $cwrappersource<<"EOF"
5042
#include <sys/stat.h>
5044
#if defined(PATH_MAX)
5045
# define LT_PATHMAX PATH_MAX
5046
#elif defined(MAXPATHLEN)
5047
# define LT_PATHMAX MAXPATHLEN
5049
# define LT_PATHMAX 1024
5052
#ifndef DIR_SEPARATOR
5053
# define DIR_SEPARATOR '/'
5054
# define PATH_SEPARATOR ':'
5057
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5059
# define HAVE_DOS_BASED_FILE_SYSTEM
5060
# ifndef DIR_SEPARATOR_2
5061
# define DIR_SEPARATOR_2 '\\'
5063
# ifndef PATH_SEPARATOR_2
5064
# define PATH_SEPARATOR_2 ';'
5068
#ifndef DIR_SEPARATOR_2
5069
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5070
#else /* DIR_SEPARATOR_2 */
5071
# define IS_DIR_SEPARATOR(ch) \
5072
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5073
#endif /* DIR_SEPARATOR_2 */
5075
#ifndef PATH_SEPARATOR_2
5076
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5077
#else /* PATH_SEPARATOR_2 */
5078
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5079
#endif /* PATH_SEPARATOR_2 */
5081
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5082
#define XFREE(stale) do { \
5083
if (stale) { free ((void *) stale); stale = 0; } \
5086
/* -DDEBUG is fairly common in CFLAGS. */
5088
#if defined DEBUGWRAPPER
5089
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5091
# define DEBUG(format, ...)
5094
const char *program_name = NULL;
5096
void * xmalloc (size_t num);
5097
char * xstrdup (const char *string);
5098
const char * base_name (const char *name);
5099
char * find_executable(const char *wrapper);
5100
int check_executable(const char *path);
5101
char * strendzap(char *str, const char *pat);
5102
void lt_fatal (const char *message, ...);
5105
main (int argc, char *argv[])
5110
program_name = (char *) xstrdup (base_name (argv[0]));
5111
DEBUG("(main) argv[0] : %s\n",argv[0]);
5112
DEBUG("(main) program_name : %s\n",program_name);
5113
newargz = XMALLOC(char *, argc+2);
5116
cat >> $cwrappersource <<EOF
5117
newargz[0] = (char *) xstrdup("$SHELL");
5120
cat >> $cwrappersource <<"EOF"
5121
newargz[1] = find_executable(argv[0]);
5122
if (newargz[1] == NULL)
5123
lt_fatal("Couldn't find %s", argv[0]);
5124
DEBUG("(main) found exe at : %s\n",newargz[1]);
5125
/* we know the script has the same name, without the .exe */
5126
/* so make sure newargz[1] doesn't end in .exe */
5127
strendzap(newargz[1],".exe");
5128
for (i = 1; i < argc; i++)
5129
newargz[i+1] = xstrdup(argv[i]);
5130
newargz[argc+1] = NULL;
5132
for (i=0; i<argc+1; i++)
5134
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5142
cat >> $cwrappersource <<EOF
5143
execv("$SHELL",(char const **)newargz);
5147
cat >> $cwrappersource <<EOF
5148
execv("$SHELL",newargz);
5153
cat >> $cwrappersource <<"EOF"
5158
xmalloc (size_t num)
5160
void * p = (void *) malloc (num);
5162
lt_fatal ("Memory exhausted");
5168
xstrdup (const char *string)
5170
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5175
base_name (const char *name)
5179
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5180
/* Skip over the disk name in MSDOS pathnames. */
5181
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5185
for (base = name; *name; name++)
5186
if (IS_DIR_SEPARATOR (*name))
5192
check_executable(const char * path)
5196
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5197
if ((!path) || (!*path))
5200
if ((stat (path, &st) >= 0) &&
5202
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5203
#if defined (S_IXOTH)
5204
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5206
#if defined (S_IXGRP)
5207
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5209
((st.st_mode & S_IXUSR) == S_IXUSR))
5216
/* Searches for the full path of the wrapper. Returns
5217
newly allocated full path name if found, NULL otherwise */
5219
find_executable (const char* wrapper)
5224
/* static buffer for getcwd */
5225
char tmp[LT_PATHMAX + 1];
5229
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5231
if ((wrapper == NULL) || (*wrapper == '\0'))
5234
/* Absolute path? */
5235
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5236
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5238
concat_name = xstrdup (wrapper);
5239
if (check_executable(concat_name))
5246
if (IS_DIR_SEPARATOR (wrapper[0]))
5248
concat_name = xstrdup (wrapper);
5249
if (check_executable(concat_name))
5253
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5257
for (p = wrapper; *p; p++)
5265
/* no slashes; search PATH */
5266
const char* path = getenv ("PATH");
5269
for (p = path; *p; p = p_next)
5273
for (q = p; *q; q++)
5274
if (IS_PATH_SEPARATOR(*q))
5277
p_next = (*q == '\0' ? q : q + 1);
5280
/* empty path: current directory */
5281
if (getcwd (tmp, LT_PATHMAX) == NULL)
5282
lt_fatal ("getcwd failed");
5283
tmp_len = strlen(tmp);
5284
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5285
memcpy (concat_name, tmp, tmp_len);
5286
concat_name[tmp_len] = '/';
5287
strcpy (concat_name + tmp_len + 1, wrapper);
5291
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5292
memcpy (concat_name, p, p_len);
5293
concat_name[p_len] = '/';
5294
strcpy (concat_name + p_len + 1, wrapper);
5296
if (check_executable(concat_name))
5301
/* not found in PATH; assume curdir */
5303
/* Relative path | not found in path: prepend cwd */
5304
if (getcwd (tmp, LT_PATHMAX) == NULL)
5305
lt_fatal ("getcwd failed");
5306
tmp_len = strlen(tmp);
5307
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5308
memcpy (concat_name, tmp, tmp_len);
5309
concat_name[tmp_len] = '/';
5310
strcpy (concat_name + tmp_len + 1, wrapper);
5312
if (check_executable(concat_name))
5319
strendzap(char *str, const char *pat)
5323
assert(str != NULL);
5324
assert(pat != NULL);
5327
patlen = strlen(pat);
5331
str += len - patlen;
5332
if (strcmp(str, pat) == 0)
5339
lt_error_core (int exit_status, const char * mode,
5340
const char * message, va_list ap)
5342
fprintf (stderr, "%s: %s: ", program_name, mode);
5343
vfprintf (stderr, message, ap);
5344
fprintf (stderr, ".\n");
5346
if (exit_status >= 0)
5351
lt_fatal (const char *message, ...)
5354
va_start (ap, message);
5355
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5359
# we should really use a build-platform specific compiler
5360
# here, but OTOH, the wrappers (shell script and this C one)
5361
# are only useful if you want to execute the "real" binary.
5362
# Since the "real" binary is built for $host, then this
5363
# wrapper might as well be built for $host, too.
5364
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5368
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5373
# $output - temporary wrapper script for $objdir/$outputname
5374
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5376
# The $output program cannot be directly executed until all the libtool
5377
# libraries that it depends on are installed.
5379
# This wrapper script should never be moved out of the build directory.
5380
# If it is, it will not operate correctly.
5382
# Sed substitution that helps us do robust quoting. It backslashifies
5383
# metacharacters that are still active within double-quoted strings.
5384
Xsed='${SED} -e 1s/^X//'
5385
sed_quote_subst='$sed_quote_subst'
5387
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5388
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5391
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5392
# is contrary to our usage. Disable this feature.
5393
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5394
setopt NO_GLOB_SUBST
5396
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5398
BIN_SH=xpg4; export BIN_SH # for Tru64
5399
DUALCASE=1; export DUALCASE # for MKS sh
5401
# The HP-UX ksh and POSIX shell print the target directory to stdout
5403
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5405
relink_command=\"$relink_command\"
5407
# This environment variable determines our operation mode.
5408
if test \"\$libtool_install_magic\" = \"$magic\"; then
5409
# install mode needs the following variable:
5410
notinst_deplibs='$notinst_deplibs'
5412
# When we are sourced in execute mode, \$file and \$echo are already set.
5413
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5416
# Make sure echo works.
5417
if test \"X\$1\" = X--no-reexec; then
5418
# Discard the --no-reexec flag, and continue.
5420
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5421
# Yippee, \$echo works!
5424
# Restart under the correct shell, and then maybe \$echo will work.
5425
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5431
# Find the directory that this script lives in.
5432
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5433
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5435
# Follow symbolic links until we get to the real thisdir.
5436
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5437
while test -n \"\$file\"; do
5438
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5440
# If there was a directory component, then change thisdir.
5441
if test \"x\$destdir\" != \"x\$file\"; then
5442
case \"\$destdir\" in
5443
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5444
*) thisdir=\"\$thisdir/\$destdir\" ;;
5448
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5449
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5452
# Try to get the absolute directory name.
5453
absdir=\`cd \"\$thisdir\" && pwd\`
5454
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5457
if test "$fast_install" = yes; then
5459
program=lt-'$outputname'$exeext
5460
progdir=\"\$thisdir/$objdir\"
5462
if test ! -f \"\$progdir/\$program\" || \\
5463
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5464
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5466
file=\"\$\$-\$program\"
5468
if test ! -d \"\$progdir\"; then
5469
$mkdir \"\$progdir\"
5471
$rm \"\$progdir/\$file\"
5476
# relink executable if necessary
5477
if test -n \"\$relink_command\"; then
5478
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5480
$echo \"\$relink_command_output\" >&2
5481
$rm \"\$progdir/\$file\"
5486
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5487
{ $rm \"\$progdir/\$program\";
5488
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5489
$rm \"\$progdir/\$file\"
5493
program='$outputname'
5494
progdir=\"\$thisdir/$objdir\"
5500
if test -f \"\$progdir/\$program\"; then"
5502
# Export our shlibpath_var if we have one.
5503
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5505
# Add our own library path to $shlibpath_var
5506
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5508
# Some systems cannot cope with colon-terminated $shlibpath_var
5509
# The second colon is a workaround for a bug in BeOS R4 sed
5510
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5512
export $shlibpath_var
5516
# fixup the dll searchpath if we need to.
5517
if test -n "$dllsearchpath"; then
5519
# Add the dll search path components to the executable PATH
5520
PATH=$dllsearchpath:\$PATH
5525
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5526
# Run the actual program with our arguments.
5529
# Backslashes separate directories on plain windows
5530
*-*-mingw | *-*-os2*)
5532
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5538
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5543
\$echo \"\$0: cannot exec \$program \$*\"
5547
# The program doesn't exist.
5548
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5549
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5550
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
5561
# See if we need to build an old-fashioned archive.
5562
for oldlib in $oldlibs; do
5564
if test "$build_libtool_libs" = convenience; then
5565
oldobjs="$libobjs_save"
5566
addlibs="$convenience"
5567
build_libtool_libs=no
5569
if test "$build_libtool_libs" = module; then
5570
oldobjs="$libobjs_save"
5571
build_libtool_libs=no
5573
oldobjs="$old_deplibs $non_pic_objects"
5575
addlibs="$old_convenience"
5578
if test -n "$addlibs"; then
5579
gentop="$output_objdir/${outputname}x"
5580
generated="$generated $gentop"
5582
func_extract_archives $gentop $addlibs
5583
oldobjs="$oldobjs $func_extract_archives_result"
5586
# Do each command in the archive commands.
5587
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5588
cmds=$old_archive_from_new_cmds
5590
# POSIX demands no paths to be encoded in archives. We have
5591
# to avoid creating archives with duplicate basenames if we
5592
# might have to extract them afterwards, e.g., when creating a
5593
# static archive out of a convenience library, or when linking
5594
# the entirety of a libtool archive into another (currently
5595
# not supported by libtool).
5596
if (for obj in $oldobjs
5598
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5599
done | sort | sort -uc >/dev/null 2>&1); then
5602
$echo "copying selected object files to avoid basename conflicts..."
5604
if test -z "$gentop"; then
5605
gentop="$output_objdir/${outputname}x"
5606
generated="$generated $gentop"
5608
$show "${rm}r $gentop"
5609
$run ${rm}r "$gentop"
5610
$show "$mkdir $gentop"
5611
$run $mkdir "$gentop"
5613
if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5618
save_oldobjs=$oldobjs
5621
for obj in $save_oldobjs
5623
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5624
case " $oldobjs " in
5625
" ") oldobjs=$obj ;;
5628
# Make sure we don't pick an alternate name that also
5630
newobj=lt$counter-$objbase
5631
counter=`expr $counter + 1`
5632
case " $oldobjs " in
5633
*[\ /]"$newobj "*) ;;
5634
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5637
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5638
$run ln "$obj" "$gentop/$newobj" ||
5639
$run cp "$obj" "$gentop/$newobj"
5640
oldobjs="$oldobjs $gentop/$newobj"
5642
*) oldobjs="$oldobjs $obj" ;;
5647
eval cmds=\"$old_archive_cmds\"
5649
if len=`expr "X$cmds" : ".*"` &&
5650
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5651
cmds=$old_archive_cmds
5653
# the command line is too long to link in one step, link in parts
5654
$echo "using piecewise archive linking..."
5659
save_oldobjs=$oldobjs
5661
# Is there a better way of finding the last object in the list?
5662
for obj in $save_oldobjs
5666
for obj in $save_oldobjs
5668
oldobjs="$objlist $obj"
5669
objlist="$objlist $obj"
5670
eval test_cmds=\"$old_archive_cmds\"
5671
if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5672
test "$len" -le "$max_cmd_len"; then
5675
# the above command should be used before it gets too long
5677
if test "$obj" = "$last_oldobj" ; then
5680
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5681
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5687
if test "X$oldobjs" = "X" ; then
5688
eval cmds=\"\$concat_cmds\"
5690
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5694
save_ifs="$IFS"; IFS='~'
5695
for cmd in $cmds; do
5699
$run eval "$cmd" || exit $?
5704
if test -n "$generated"; then
5705
$show "${rm}r$generated"
5706
$run ${rm}r$generated
5709
# Now create the libtool archive.
5713
test "$build_old_libs" = yes && old_library="$libname.$libext"
5714
$show "creating $output"
5716
# Preserve any variables that may affect compiler behavior
5717
for var in $variables_saved_for_relink; do
5718
if eval test -z \"\${$var+set}\"; then
5719
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5720
elif eval var_value=\$$var; test -z "$var_value"; then
5721
relink_command="$var=; export $var; $relink_command"
5723
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5724
relink_command="$var=\"$var_value\"; export $var; $relink_command"
5727
# Quote the link command for shipping.
5728
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5729
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5730
if test "$hardcode_automatic" = yes ; then
5735
# Only create the output if not a dry run.
5736
if test -z "$run"; then
5737
for installed in no yes; do
5738
if test "$installed" = yes; then
5739
if test -z "$install_libdir"; then
5742
output="$output_objdir/$outputname"i
5743
# Replace all uninstalled libtool libraries with the installed ones
5745
for deplib in $dependency_libs; do
5748
name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5749
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5750
if test -z "$libdir"; then
5751
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5754
newdependency_libs="$newdependency_libs $libdir/$name"
5756
*) newdependency_libs="$newdependency_libs $deplib" ;;
5759
dependency_libs="$newdependency_libs"
5761
for lib in $dlfiles; do
5762
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5763
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5764
if test -z "$libdir"; then
5765
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5768
newdlfiles="$newdlfiles $libdir/$name"
5770
dlfiles="$newdlfiles"
5772
for lib in $dlprefiles; do
5773
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5774
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5775
if test -z "$libdir"; then
5776
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5779
newdlprefiles="$newdlprefiles $libdir/$name"
5781
dlprefiles="$newdlprefiles"
5784
for lib in $dlfiles; do
5786
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5787
*) abs=`pwd`"/$lib" ;;
5789
newdlfiles="$newdlfiles $abs"
5791
dlfiles="$newdlfiles"
5793
for lib in $dlprefiles; do
5795
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5796
*) abs=`pwd`"/$lib" ;;
5798
newdlprefiles="$newdlprefiles $abs"
5800
dlprefiles="$newdlprefiles"
5803
# place dlname in correct position for cygwin
5805
case $host,$output,$installed,$module,$dlname in
5806
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5809
# $outputname - a libtool library file
5810
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5812
# Please DO NOT delete this file!
5813
# It is necessary for linking the library.
5815
# The name that we can dlopen(3).
5818
# Names of this library.
5819
library_names='$library_names'
5821
# The name of the static archive.
5822
old_library='$old_library'
5824
# Libraries that this one depends upon.
5825
dependency_libs='$dependency_libs'
5827
# Version information for $libname.
5832
# Is this an already installed library?
5833
installed=$installed
5835
# Should we warn about portability when linking against -modules?
5836
shouldnotlink=$module
5838
# Files to dlopen/dlpreopen
5840
dlpreopen='$dlprefiles'
5842
# Directory that this library needs to be installed in:
5843
libdir='$install_libdir'"
5844
if test "$installed" = no && test "$need_relink" = yes; then
5846
relink_command=\"$relink_command\""
5851
# Do a symbolic link so that the libtool archive can be found in
5852
# LD_LIBRARY_PATH before the program is installed.
5853
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5854
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5860
# libtool install mode
5862
modename="$modename: install"
5864
# There may be an optional sh(1) argument at the beginning of
5865
# install_prog (especially on Windows NT).
5866
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5867
# Allow the use of GNU shtool's install command.
5868
$echo "X$nonopt" | grep shtool > /dev/null; then
5869
# Aesthetically quote it.
5870
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5872
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5876
install_prog="$arg "
5884
# The real first argument should be the name of the installation program.
5885
# Aesthetically quote it.
5886
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5888
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5892
install_prog="$install_prog$arg"
5894
# We need to accept at least all the BSD install flags.
5904
if test -n "$dest"; then
5905
files="$files $dest"
5913
case " $install_prog " in
5918
-g | -m | -o) prev=$arg ;;
5926
# If the previous option needed an argument, then skip it.
5927
if test -n "$prev"; then
5936
# Aesthetically quote the argument.
5937
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5939
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5943
install_prog="$install_prog $arg"
5946
if test -z "$install_prog"; then
5947
$echo "$modename: you must specify an install program" 1>&2
5952
if test -n "$prev"; then
5953
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5958
if test -z "$files"; then
5959
if test -z "$dest"; then
5960
$echo "$modename: no file or destination specified" 1>&2
5962
$echo "$modename: you must specify a destination" 1>&2
5968
# Strip any trailing slash from the destination.
5969
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5971
# Check to see that the destination is a directory.
5972
test -d "$dest" && isdir=yes
5973
if test "$isdir" = yes; then
5977
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5978
test "X$destdir" = "X$dest" && destdir=.
5979
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5981
# Not a directory, so check to see that there is only one file specified.
5983
if test "$#" -gt 2; then
5984
$echo "$modename: \`$dest' is not a directory" 1>&2
5990
[\\/]* | [A-Za-z]:[\\/]*) ;;
5992
for file in $files; do
5996
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
6005
# This variable tells wrapper scripts just to set variables rather
6006
# than running their programs.
6007
libtool_install_magic="$magic"
6012
for file in $files; do
6014
# Do each installation.
6017
# Do the static libraries later.
6018
staticlibs="$staticlibs $file"
6022
# Check to see that this really is a libtool archive.
6023
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6025
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6033
# If there is no directory component, then add one.
6035
*/* | *\\*) . $file ;;
6039
# Add the libdir to current_libdirs if it is the destination.
6040
if test "X$destdir" = "X$libdir"; then
6041
case "$current_libdirs " in
6043
*) current_libdirs="$current_libdirs $libdir" ;;
6046
# Note the libdir as a future libdir.
6047
case "$future_libdirs " in
6049
*) future_libdirs="$future_libdirs $libdir" ;;
6053
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6054
test "X$dir" = "X$file/" && dir=
6057
if test -n "$relink_command"; then
6058
# Determine the prefix the user has applied to our future dir.
6059
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6061
# Don't allow the user to place us outside of our expected
6062
# location b/c this prevents finding dependent libraries that
6063
# are installed to the same prefix.
6064
# At present, this check doesn't affect windows .dll's that
6065
# are installed into $libdir/../bin (currently, that works fine)
6066
# but it's something to keep an eye on.
6067
if test "$inst_prefix_dir" = "$destdir"; then
6068
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6072
if test -n "$inst_prefix_dir"; then
6073
# Stick the inst_prefix_dir data into the link command.
6074
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6076
relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6079
$echo "$modename: warning: relinking \`$file'" 1>&2
6080
$show "$relink_command"
6081
if $run eval "$relink_command"; then :
6083
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6088
# See the names of the shared library.
6089
set dummy $library_names
6090
if test -n "$2"; then
6096
test -n "$relink_command" && srcname="$realname"T
6098
# Install the shared library and build the symlinks.
6099
$show "$install_prog $dir/$srcname $destdir/$realname"
6100
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6101
if test -n "$stripme" && test -n "$striplib"; then
6102
$show "$striplib $destdir/$realname"
6103
$run eval "$striplib $destdir/$realname" || exit $?
6106
if test "$#" -gt 0; then
6107
# Delete the old symlinks, and create new ones.
6108
# Try `ln -sf' first, because the `ln' binary might depend on
6109
# the symlink we replace! Solaris /bin/ln does not understand -f,
6110
# so we also need to try rm && ln -s.
6113
if test "$linkname" != "$realname"; then
6114
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6115
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6120
# Do each command in the postinstall commands.
6121
lib="$destdir/$realname"
6122
cmds=$postinstall_cmds
6123
save_ifs="$IFS"; IFS='~'
6124
for cmd in $cmds; do
6128
$run eval "$cmd" || {
6131
# Restore the uninstalled library and exit
6132
if test "$mode" = relink; then
6133
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6142
# Install the pseudo-library for information purposes.
6143
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6144
instname="$dir/$name"i
6145
$show "$install_prog $instname $destdir/$name"
6146
$run eval "$install_prog $instname $destdir/$name" || exit $?
6148
# Maybe install the static library, too.
6149
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6153
# Install (i.e. copy) a libtool object.
6155
# Figure out destination file name, if it wasn't already specified.
6156
if test -n "$destname"; then
6157
destfile="$destdir/$destname"
6159
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6160
destfile="$destdir/$destfile"
6163
# Deduce the name of the destination old-style object file.
6166
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6169
staticdest="$destfile"
6173
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6179
# Install the libtool object if requested.
6180
if test -n "$destfile"; then
6181
$show "$install_prog $file $destfile"
6182
$run eval "$install_prog $file $destfile" || exit $?
6185
# Install the old object if enabled.
6186
if test "$build_old_libs" = yes; then
6187
# Deduce the name of the old-style object file.
6188
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6190
$show "$install_prog $staticobj $staticdest"
6191
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
6197
# Figure out destination file name, if it wasn't already specified.
6198
if test -n "$destname"; then
6199
destfile="$destdir/$destname"
6201
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6202
destfile="$destdir/$destfile"
6205
# If the file is missing, and there is a .exe on the end, strip it
6206
# because it is most likely a libtool script we actually want to
6211
if test ! -f "$file"; then
6212
file=`$echo $file|${SED} 's,.exe$,,'`
6218
# Do a test to see if this is really a libtool program.
6221
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6227
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6231
# Note that it is not necessary on cygwin/mingw to append a dot to
6232
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6233
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6234
# `FILE.' does not work on cygwin managed mounts.
6236
# If there is no directory component, then add one.
6238
*/* | *\\*) . ${wrapper} ;;
6239
*) . ./${wrapper} ;;
6242
# Check the variables that should have been set.
6243
if test -z "$notinst_deplibs"; then
6244
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6249
for lib in $notinst_deplibs; do
6250
# Check to see that each library is installed.
6252
if test -f "$lib"; then
6253
# If there is no directory component, then add one.
6255
*/* | *\\*) . $lib ;;
6259
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6260
if test -n "$libdir" && test ! -f "$libfile"; then
6261
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6267
# Note that it is not necessary on cygwin/mingw to append a dot to
6268
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6269
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6270
# `FILE.' does not work on cygwin managed mounts.
6272
# If there is no directory component, then add one.
6274
*/* | *\\*) . ${wrapper} ;;
6275
*) . ./${wrapper} ;;
6279
if test "$fast_install" = no && test -n "$relink_command"; then
6280
if test "$finalize" = yes && test -z "$run"; then
6281
tmpdir=`func_mktempdir`
6282
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6283
outputname="$tmpdir/$file"
6284
# Replace the output file specification.
6285
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6287
$show "$relink_command"
6288
if $run eval "$relink_command"; then :
6290
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6296
$echo "$modename: warning: cannot relink \`$file'" 1>&2
6299
# Install the binary that we compiled earlier.
6300
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6304
# remove .exe since cygwin /usr/bin/install will append another
6306
case $install_prog,$host in
6307
*/usr/bin/install*,*cygwin*)
6308
case $file:$destfile in
6313
destfile=$destfile.exe
6316
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6321
$show "$install_prog$stripme $file $destfile"
6322
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6323
test -n "$outputname" && ${rm}r "$tmpdir"
6328
for file in $staticlibs; do
6329
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6331
# Set up the ranlib parameters.
6332
oldlib="$destdir/$name"
6334
$show "$install_prog $file $oldlib"
6335
$run eval "$install_prog \$file \$oldlib" || exit $?
6337
if test -n "$stripme" && test -n "$old_striplib"; then
6338
$show "$old_striplib $oldlib"
6339
$run eval "$old_striplib $oldlib" || exit $?
6342
# Do each command in the postinstall commands.
6343
cmds=$old_postinstall_cmds
6344
save_ifs="$IFS"; IFS='~'
6345
for cmd in $cmds; do
6349
$run eval "$cmd" || exit $?
6354
if test -n "$future_libdirs"; then
6355
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6358
if test -n "$current_libdirs"; then
6359
# Maybe just do a dry run.
6360
test -n "$run" && current_libdirs=" -n$current_libdirs"
6361
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6367
# libtool finish mode
6369
modename="$modename: finish"
6373
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6376
libdirs="$libdirs $dir"
6379
for libdir in $libdirs; do
6380
if test -n "$finish_cmds"; then
6381
# Do each command in the finish commands.
6383
save_ifs="$IFS"; IFS='~'
6384
for cmd in $cmds; do
6388
$run eval "$cmd" || admincmds="$admincmds
6393
if test -n "$finish_eval"; then
6394
# Do the single finish_eval.
6395
eval cmds=\"$finish_eval\"
6396
$run eval "$cmds" || admincmds="$admincmds
6402
# Exit here if they wanted silent mode.
6403
test "$show" = : && exit $EXIT_SUCCESS
6405
$echo "X----------------------------------------------------------------------" | $Xsed
6406
$echo "Libraries have been installed in:"
6407
for libdir in $libdirs; do
6411
$echo "If you ever happen to want to link against installed libraries"
6412
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6413
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6414
$echo "flag during linking and do at least one of the following:"
6415
if test -n "$shlibpath_var"; then
6416
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6417
$echo " during execution"
6419
if test -n "$runpath_var"; then
6420
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6421
$echo " during linking"
6423
if test -n "$hardcode_libdir_flag_spec"; then
6425
eval flag=\"$hardcode_libdir_flag_spec\"
6427
$echo " - use the \`$flag' linker flag"
6429
if test -n "$admincmds"; then
6430
$echo " - have your system administrator run these commands:$admincmds"
6432
if test -f /etc/ld.so.conf; then
6433
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6436
$echo "See any operating system documentation about shared libraries for"
6437
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6438
$echo "X----------------------------------------------------------------------" | $Xsed
6442
# libtool execute mode
6444
modename="$modename: execute"
6446
# The first argument is the command name.
6448
if test -z "$cmd"; then
6449
$echo "$modename: you must specify a COMMAND" 1>&2
6454
# Handle -dlopen flags immediately.
6455
for file in $execute_dlfiles; do
6456
if test ! -f "$file"; then
6457
$echo "$modename: \`$file' is not a file" 1>&2
6465
# Check to see that this really is a libtool archive.
6466
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6468
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6473
# Read the libtool library.
6477
# If there is no directory component, then add one.
6479
*/* | *\\*) . $file ;;
6483
# Skip this library if it cannot be dlopened.
6484
if test -z "$dlname"; then
6485
# Warn if it was a shared library.
6486
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6490
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6491
test "X$dir" = "X$file" && dir=.
6493
if test -f "$dir/$objdir/$dlname"; then
6496
if test ! -f "$dir/$dlname"; then
6497
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6504
# Just add the directory containing the .lo file.
6505
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6506
test "X$dir" = "X$file" && dir=.
6510
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6515
# Get the absolute pathname.
6516
absdir=`cd "$dir" && pwd`
6517
test -n "$absdir" && dir="$absdir"
6519
# Now add the directory to shlibpath_var.
6520
if eval "test -z \"\$$shlibpath_var\""; then
6521
eval "$shlibpath_var=\"\$dir\""
6523
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6527
# This variable tells wrapper scripts just to set shlibpath_var
6528
# rather than running their programs.
6529
libtool_execute_magic="$magic"
6531
# Check if any of the arguments is a wrapper script.
6538
# Do a test to see if this is really a libtool program.
6539
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6540
# If there is no directory component, then add one.
6542
*/* | *\\*) . $file ;;
6546
# Transform arg to wrapped name.
6547
file="$progdir/$program"
6551
# Quote arguments (to preserve shell metacharacters).
6552
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6553
args="$args \"$file\""
6556
if test -z "$run"; then
6557
if test -n "$shlibpath_var"; then
6558
# Export the shlibpath_var.
6559
eval "export $shlibpath_var"
6562
# Restore saved environment variables
6563
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6565
eval "if test \"\${save_$lt_var+set}\" = set; then
6566
$lt_var=\$save_$lt_var; export $lt_var
6570
# Now prepare to actually exec the command.
6571
exec_cmd="\$cmd$args"
6573
# Display what would be done.
6574
if test -n "$shlibpath_var"; then
6575
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6576
$echo "export $shlibpath_var"
6583
# libtool clean and uninstall mode
6585
modename="$modename: $mode"
6591
# This variable tells wrapper scripts just to set variables rather
6592
# than running their programs.
6593
libtool_install_magic="$magic"
6598
-f) rm="$rm $arg"; rmforce=yes ;;
6599
-*) rm="$rm $arg" ;;
6600
*) files="$files $arg" ;;
6604
if test -z "$rm"; then
6605
$echo "$modename: you must specify an RM program" 1>&2
6612
origobjdir="$objdir"
6613
for file in $files; do
6614
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6615
if test "X$dir" = "X$file"; then
6617
objdir="$origobjdir"
6619
objdir="$dir/$origobjdir"
6621
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6622
test "$mode" = uninstall && objdir="$dir"
6624
# Remember objdir for removal later, being careful to avoid duplicates
6625
if test "$mode" = clean; then
6628
*) rmdirs="$rmdirs $objdir" ;;
6632
# Don't error if the file doesn't exist and rm -f was used.
6633
if (test -L "$file") >/dev/null 2>&1 \
6634
|| (test -h "$file") >/dev/null 2>&1 \
6635
|| test -f "$file"; then
6637
elif test -d "$file"; then
6640
elif test "$rmforce" = yes; then
6648
# Possibly a libtool archive, so verify it.
6649
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6652
# Delete the libtool libraries and symlinks.
6653
for n in $library_names; do
6654
rmfiles="$rmfiles $objdir/$n"
6656
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6660
case " $library_names " in
6661
# " " in the beginning catches empty $dlname
6663
*) rmfiles="$rmfiles $objdir/$dlname" ;;
6665
test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6668
if test -n "$library_names"; then
6669
# Do each command in the postuninstall commands.
6670
cmds=$postuninstall_cmds
6671
save_ifs="$IFS"; IFS='~'
6672
for cmd in $cmds; do
6677
if test "$?" -ne 0 && test "$rmforce" != yes; then
6684
if test -n "$old_library"; then
6685
# Do each command in the old_postuninstall commands.
6686
cmds=$old_postuninstall_cmds
6687
save_ifs="$IFS"; IFS='~'
6688
for cmd in $cmds; do
6693
if test "$?" -ne 0 && test "$rmforce" != yes; then
6699
# FIXME: should reinstall the best remaining shared library.
6706
# Possibly a libtool object, so verify it.
6707
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6712
# Add PIC object to the list of files to remove.
6713
if test -n "$pic_object" \
6714
&& test "$pic_object" != none; then
6715
rmfiles="$rmfiles $dir/$pic_object"
6718
# Add non-PIC object to the list of files to remove.
6719
if test -n "$non_pic_object" \
6720
&& test "$non_pic_object" != none; then
6721
rmfiles="$rmfiles $dir/$non_pic_object"
6727
if test "$mode" = clean ; then
6731
file=`$echo $file|${SED} 's,.exe$,,'`
6732
noexename=`$echo $name|${SED} 's,.exe$,,'`
6733
# $file with .exe has already been added to rmfiles,
6734
# add $file without .exe
6735
rmfiles="$rmfiles $file"
6738
# Do a test to see if this is a libtool program.
6739
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6743
# note $name still contains .exe if it was in $file originally
6744
# as does the version of $file that was added into $rmfiles
6745
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6746
if test "$fast_install" = yes && test -n "$relink_command"; then
6747
rmfiles="$rmfiles $objdir/lt-$name"
6749
if test "X$noexename" != "X$name" ; then
6750
rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6756
$show "$rm $rmfiles"
6757
$run $rm $rmfiles || exit_status=1
6759
objdir="$origobjdir"
6761
# Try to remove the ${objdir}s in the directories where we deleted files
6762
for dir in $rmdirs; do
6763
if test -d "$dir"; then
6765
$run rmdir $dir >/dev/null 2>&1
6773
$echo "$modename: you must specify a MODE" 1>&2
6774
$echo "$generic_help" 1>&2
6779
if test -z "$exec_cmd"; then
6780
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6781
$echo "$generic_help" 1>&2
6784
fi # test -z "$show_help"
6786
if test -n "$exec_cmd"; then
6791
# We need to display help for each of the modes.
6794
"Usage: $modename [OPTION]... [MODE-ARG]...
6796
Provide generalized library-building support services.
6798
--config show all configuration variables
6799
--debug enable verbose shell tracing
6800
-n, --dry-run display commands without modifying any files
6801
--features display basic configuration information and exit
6802
--finish same as \`--mode=finish'
6803
--help display this help message and exit
6804
--mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6805
--quiet same as \`--silent'
6806
--silent don't print informational messages
6807
--tag=TAG use configuration variables from tag TAG
6808
--version print version information
6810
MODE must be one of the following:
6812
clean remove files from the build directory
6813
compile compile a source file into a libtool object
6814
execute automatically set library path, then run a program
6815
finish complete the installation of libtool libraries
6816
install install libraries or executables
6817
link create a library or an executable
6818
uninstall remove libraries from an installed directory
6820
MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6821
a more detailed description of MODE.
6823
Report bugs to <bug-libtool@gnu.org>."
6829
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6831
Remove files from the build directory.
6833
RM is the name of the program to use to delete files associated with each FILE
6834
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6837
If FILE is a libtool library, object or program, all the files associated
6838
with it are deleted. Otherwise, only FILE itself is deleted using RM."
6843
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6845
Compile a source file into a libtool library object.
6847
This mode accepts the following additional options:
6849
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
6850
-prefer-pic try to building PIC objects only
6851
-prefer-non-pic try to building non-PIC objects only
6852
-static always build a \`.o' file suitable for static linking
6854
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6855
from the given SOURCEFILE.
6857
The output file name is determined by removing the directory component from
6858
SOURCEFILE, then substituting the C source code suffix \`.c' with the
6859
library object suffix, \`.lo'."
6864
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6866
Automatically set library path, then run a program.
6868
This mode accepts the following additional options:
6870
-dlopen FILE add the directory containing FILE to the library path
6872
This mode sets the library path environment variable according to \`-dlopen'
6875
If any of the ARGS are libtool executable wrappers, then they are translated
6876
into their corresponding uninstalled binary, and any of their required library
6877
directories are added to the library path.
6879
Then, COMMAND is executed, with ARGS as arguments."
6884
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6886
Complete the installation of libtool libraries.
6888
Each LIBDIR is a directory that contains libtool libraries.
6890
The commands that this mode executes may require superuser privileges. Use
6891
the \`--dry-run' option if you just want to see what would be executed."
6896
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6898
Install executables or libraries.
6900
INSTALL-COMMAND is the installation command. The first component should be
6901
either the \`install' or \`cp' program.
6903
The rest of the components are interpreted as arguments to that command (only
6904
BSD-compatible install options are recognized)."
6909
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6911
Link object files or libraries together to form another library, or to
6912
create an executable program.
6914
LINK-COMMAND is a command using the C compiler that you would use to create
6915
a program from several object files.
6917
The following components of LINK-COMMAND are treated specially:
6919
-all-static do not do any dynamic linking at all
6920
-avoid-version do not add a version suffix if possible
6921
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6922
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6923
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6924
-export-symbols SYMFILE
6925
try to export only the symbols listed in SYMFILE
6926
-export-symbols-regex REGEX
6927
try to export only the symbols matching REGEX
6928
-LLIBDIR search LIBDIR for required installed libraries
6929
-lNAME OUTPUT-FILE requires the installed library libNAME
6930
-module build a library that can dlopened
6931
-no-fast-install disable the fast-install mode
6932
-no-install link a not-installable executable
6933
-no-undefined declare that a library does not refer to external symbols
6934
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6935
-objectlist FILE Use a list of object files found in FILE to specify objects
6936
-precious-files-regex REGEX
6937
don't remove output files matching REGEX
6938
-release RELEASE specify package release information
6939
-rpath LIBDIR the created library will eventually be installed in LIBDIR
6940
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6941
-static do not do any dynamic linking of uninstalled libtool libraries
6942
-static-libtool-libs
6943
do not do any dynamic linking of libtool libraries
6944
-version-info CURRENT[:REVISION[:AGE]]
6945
specify library version info [each variable defaults to 0]
6947
All other options (arguments beginning with \`-') are ignored.
6949
Every other argument is treated as a filename. Files ending in \`.la' are
6950
treated as uninstalled libtool libraries, other files are standard or library
6953
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6954
only library objects (\`.lo' files) may be specified, and \`-rpath' is
6955
required, except when creating a convenience library.
6957
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6958
using \`ar' and \`ranlib', or on Windows using \`lib'.
6960
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6961
is created, otherwise an executable program is created."
6966
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6968
Remove libraries from an installation directory.
6970
RM is the name of the program to use to delete files associated with each FILE
6971
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6974
If FILE is a libtool library, all the files associated with it are deleted.
6975
Otherwise, only FILE itself is deleted using RM."
6979
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6986
$echo "Try \`$modename --help' for more information about other modes."
6990
# The TAGs below are defined such that we never get into a situation
6991
# in which we disable both kinds of libraries. Given conflicting
6992
# choices, we go for a static library, that is the most portable,
6993
# since we can't tell whether shared libraries were disabled because
6994
# the user asked for that or because the platform doesn't support
6995
# them. This is particularly important on AIX, because we don't
6996
# support having both static and shared libraries enabled at the same
6997
# time on that platform, so we default to a shared-only configuration.
6998
# If a disable-shared tag is given, we'll fallback to a static-only
6999
# configuration. But we'll never go from static-only to shared-only.
7001
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7003
# ### END LIBTOOL TAG CONFIG: disable-shared
7005
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
7007
# ### END LIBTOOL TAG CONFIG: disable-static