1
# ltmain.sh - Provide generalized library-building support services.
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5
# Free Software Foundation, Inc.
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
# This program is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful, but
14
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
# General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
# As a special exception to the GNU General Public License, if you
23
# distribute this file as part of a program that contains a
24
# configuration script generated by Autoconf, you may include it under
25
# the same distribution terms that you use for the rest of that program.
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
# is ksh but when the shell is invoked as "sh" and the current value of
31
# the _XPG environment variable is not equal to 1 (one), the special
32
# positional parameter $0, within a function call, is the name of the
36
# define SED for historic ltconfig's generated by Libtool 1.3
37
test -z "$SED" && SED=sed
39
# The name of this program:
40
progname=`echo "$progpath" | $SED $basename`
50
TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
52
# See if we are running on zsh, and set the options which allow our
53
# commands through without removal of \ escapes.
54
if test -n "${ZSH_VERSION+set}" ; then
57
# Same for EGREP, and just to be sure, do LTCC as well
58
if test "X$EGREP" = X ; then
61
if test "X$LTCC" = X ; then
65
# Check that we have a working $echo.
66
if test "X$1" = X--no-reexec; then
67
# Discard the --no-reexec flag, and continue.
69
elif test "X$1" = X--fallback-echo; then
70
# Avoid inline document here, it may be left over
72
elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
73
# Yippee, $echo works!
76
# Restart under the correct shell, and then maybe $echo will work.
77
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
80
if test "X$1" = X--fallback-echo; then
81
# used as fallback echo
90
help="Try \`$progname --help' for more information."
91
magic="%%%MAGIC variable%%%"
96
# Sed substitution that helps us do robust quoting. It backslashifies
97
# metacharacters that are still active within double-quoted strings.
98
Xsed="${SED}"' -e 1s/^X//'
99
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
100
# test EBCDIC or ASCII
101
case `echo X|tr X '\101'` in
102
A) # ASCII based system
103
# \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
105
NL2SP='tr \015\012 \040\040'
107
*) # EBCDIC based system
109
NL2SP='tr \r\n \100\100'
114
# Only set LANG and LC_ALL to C if already set.
115
# These must not be set unconditionally because not all systems understand
116
# e.g. LANG=C (notably SCO).
117
# We save the old values to restore during execute mode.
118
if test "${LC_ALL+set}" = set; then
119
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
121
if test "${LANG+set}" = set; then
122
save_LANG="$LANG"; LANG=C; export LANG
125
# Make sure IFS has a sensible default
130
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131
$echo "$modename: not configured to build any kind of library" 1>&2
132
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
145
lo2o="s/\\.lo\$/.${objext}/"
146
o2lo="s/\\.${objext}\$/.lo/"
148
if test -z "$max_cmd_len"; then
153
# If test is not a shell built-in, we'll probably end up computing a
154
# maximum length that is only half of the actual maximum length, but
156
while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
157
= "XX$testring") >/dev/null 2>&1 &&
158
new_result=`expr "X$testring" : ".*" 2>&1` &&
159
max_cmd_len="$new_result" &&
160
test "$i" != 17 # 1/2 MB should be enough
163
testring="$testring$testring"
166
# Add a significant safety factor because C++ compilers can tack on massive
167
# amounts of additional arguments before passing them to the linker.
168
# It appears as though 1/2 is a usable value.
169
max_cmd_len=`expr $max_cmd_len \/ 2`
172
#####################################
173
# Shell function definitions:
174
# This seems to be the best place for them
176
# func_win32_libid arg
177
# return the library type of file 'arg'
179
# Need a lot of goo to handle *both* DLLs and import libs
180
# Has to be a shell function in order to 'eat' the argument
181
# that is supplied when $file_magic_command is called.
184
win32_libid_type="unknown"
185
win32_fileres=`file -L $1 2>/dev/null`
186
case $win32_fileres in
187
*ar\ archive\ import\ library*) # definitely import
188
win32_libid_type="x86 archive import"
190
*ar\ archive*) # could be an import, or static
191
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
192
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
193
win32_nmres=`eval $NM -f posix -A $1 | \
194
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
195
if test "X$win32_nmres" = "Ximport" ; then
196
win32_libid_type="x86 archive import"
198
win32_libid_type="x86 archive static"
203
win32_libid_type="x86 DLL"
205
*executable*) # but shell scripts are "executable" too...
206
case $win32_fileres in
207
*MS\ Windows\ PE\ Intel*)
208
win32_libid_type="x86 DLL"
213
$echo $win32_libid_type
218
# Infer tagged configuration to use if any are available and
219
# if one wasn't chosen via the "--tag" command line option.
220
# Only attempt this if the compiler in the base compile
221
# command doesn't match the default compiler.
222
# arg is usually of the form 'gcc ...'
225
if test -n "$available_tags" && test -z "$tagname"; then
229
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
233
CC_quoted="$CC_quoted $arg"
236
# Blanks in the command may have been stripped by the calling shell,
237
# but not from the CC environment variable when configure was run.
238
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
239
# Blanks at the start of $base_compile will cause this to fail
240
# if we don't check for them as well.
242
for z in $available_tags; do
243
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
244
# Evaluate the configuration.
245
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
248
# Double-quote args containing other shell metacharacters.
250
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
254
CC_quoted="$CC_quoted $arg"
256
# user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
257
trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
258
# and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
259
extendcc=${host}-${CC}
260
# and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
261
# (Gentoo-specific hack because we always export $CHOST)
262
mungedcc=${CHOST-${host}}-${trimedcc}
264
"cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
265
"gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
268
"$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
269
"$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
270
"$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
271
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
272
# The compiler in the base compile command matches
273
# the one in the tagged configuration.
274
# Assume this is the tagged configuration we want.
281
# If $tagname still isn't set, then no tagged configuration
282
# was found and let the user know that the "--tag" command
283
# line option must be used.
284
if test -z "$tagname"; then
285
$echo "$modename: unable to infer tagged configuration"
286
$echo "$modename: specify a tag with \`--tag'" 1>&2
289
# $echo "$modename: using $tagname tagged configuration"
297
# func_extract_an_archive dir oldlib
298
func_extract_an_archive ()
300
f_ex_an_ar_dir="$1"; shift
301
f_ex_an_ar_oldlib="$1"
303
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
304
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
305
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
308
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
313
# func_extract_archives gentop oldlib ...
314
func_extract_archives ()
316
my_gentop="$1"; shift
324
$show "${rm}r $my_gentop"
325
$run ${rm}r "$my_gentop"
326
$show "$mkdir $my_gentop"
327
$run $mkdir "$my_gentop"
329
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
333
for my_xlib in $my_oldlibs; do
334
# Extract the objects.
336
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
337
*) my_xabs=`pwd`"/$my_xlib" ;;
339
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
340
my_xdir="$my_gentop/$my_xlib"
342
$show "${rm}r $my_xdir"
343
$run ${rm}r "$my_xdir"
344
$show "$mkdir $my_xdir"
345
$run $mkdir "$my_xdir"
347
if test "$status" -ne 0 && test ! -d "$my_xdir"; then
352
$show "Extracting $my_xabs"
353
# Do not bother doing anything if just a dry run
354
if test -z "$run"; then
355
darwin_orig_dir=`pwd`
356
cd $my_xdir || exit $?
357
darwin_archive=$my_xabs
359
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
360
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
361
if test -n "$darwin_arches"; then
362
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
364
$show "$darwin_base_archive has multiple architectures $darwin_arches"
365
for darwin_arch in $darwin_arches ; do
366
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
367
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
368
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
369
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
371
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
372
done # $darwin_arches
373
## Okay now we have a bunch of thin objects, gotta fatten them up :)
374
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
377
for darwin_file in $darwin_filelist; do
378
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
379
lipo -create -output "$darwin_file" $darwin_files
380
done # $darwin_filelist
382
cd "$darwin_orig_dir"
384
cd "$darwin_orig_dir"
385
func_extract_an_archive "$my_xdir" "$my_xabs"
390
func_extract_an_archive "$my_xdir" "$my_xabs"
393
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
395
func_extract_archives_result="$my_oldobjs"
397
# End of Shell function definitions
398
#####################################
401
eval std_shrext=\"$shrext_cmds\"
403
# Parse our command line options once, thoroughly.
404
while test "$#" -gt 0
410
-*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
414
# If the previous option needs an argument, assign it.
415
if test -n "$prev"; then
418
execute_dlfiles="$execute_dlfiles $arg"
422
preserve_args="${preserve_args}=$arg"
424
# Check whether tagname contains only valid characters
427
$echo "$progname: invalid tag name: $tagname" 1>&2
434
# Don't test for the "default" C tag, as we know, it's there, but
435
# not specially marked.
438
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
439
taglist="$taglist $tagname"
440
# Evaluate the configuration.
441
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
443
$echo "$progname: ignoring unknown tag $tagname" 1>&2
458
# Have we seen a non-optional argument yet?
465
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
467
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
468
$echo "This is free software; see the source for copying conditions. There is NO"
469
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
474
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
475
# Now print the configurations for the tags.
476
for tagname in $taglist; do
477
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
483
$echo "$progname: enabling shell trace mode"
485
preserve_args="$preserve_args $arg"
494
if test "$build_libtool_libs" = yes; then
495
$echo "enable shared libraries"
497
$echo "disable shared libraries"
499
if test "$build_old_libs" = yes; then
500
$echo "enable static libraries"
502
$echo "disable static libraries"
507
--finish) mode="finish" ;;
509
--mode) prevopt="--mode" prev=mode ;;
510
--mode=*) mode="$optarg" ;;
512
--preserve-dup-deps) duplicate_deps="yes" ;;
516
preserve_args="$preserve_args $arg"
519
--tag) prevopt="--tag" prev=tag ;;
521
set tag "$optarg" ${1+"$@"}
524
preserve_args="$preserve_args --tag"
533
$echo "$modename: unrecognized option \`$arg'" 1>&2
545
if test -n "$prevopt"; then
546
$echo "$modename: option \`$prevopt' requires an argument" 1>&2
551
# If this variable is set in any of the actions, the command in it
552
# will be execed at the end. This prevents here-documents from being
553
# left over by shells.
556
if test -z "$show_help"; then
558
# Infer the operation mode.
559
if test -z "$mode"; then
560
$echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
561
$echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
563
*cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
575
*db | *dbx | *strace | *truss)
585
# If we have no mode, but dlfiles were specified, then do execute mode.
586
test -n "$execute_dlfiles" && mode=execute
588
# Just use the default operation mode.
589
if test -z "$mode"; then
590
if test -n "$nonopt"; then
591
$echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
593
$echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
600
# Only execute mode is allowed to have -dlopen flags.
601
if test -n "$execute_dlfiles" && test "$mode" != execute; then
602
$echo "$modename: unrecognized option \`-dlopen'" 1>&2
607
# Change the help message to a mode-specific one.
609
help="Try \`$modename --help --mode=$mode' for more information."
611
# These modes are in order of execution frequency so that they run quickly.
613
# libtool compile mode
615
modename="$modename: compile"
616
# Get the compilation command and the source file.
618
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
629
# do not "continue". Instead, add this to base_compile
641
# Accept any command-line options.
644
if test -n "$libobj" ; then
645
$echo "$modename: you cannot specify \`-o' more than once" 1>&2
652
-static | -prefer-pic | -prefer-non-pic)
663
arg_mode=arg # the next one goes into the "base_compile" arg list
664
continue # The current "srcfile" will either be retained or
665
;; # replaced later. I would guess that would be a bug.
668
args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
670
save_ifs="$IFS"; IFS=','
674
# Double-quote args containing other shell metacharacters.
675
# Many Bourne shells cannot handle close brackets correctly
676
# in scan sets, so we specify it separately.
678
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
682
lastarg="$lastarg $arg"
685
lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
687
# Add the arguments to base_compile.
688
base_compile="$base_compile $lastarg"
693
# Accept the current argument as the source file.
694
# The previous "srcfile" becomes the current argument.
701
esac # case $arg_mode
703
# Aesthetically quote the previous argument.
704
lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
707
# Double-quote args containing other shell metacharacters.
708
# Many Bourne shells cannot handle close brackets correctly
709
# in scan sets, and some SunOS ksh mistreat backslash-escaping
710
# in scan sets (worked around with variable expansion),
711
# and furthermore cannot handle '|' '&' '(' ')' in scan sets
712
# at all, so we specify them separately.
713
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
714
lastarg="\"$lastarg\""
718
base_compile="$base_compile $lastarg"
723
$echo "$modename: you must specify an argument for -Xcompile"
727
$echo "$modename: you must specify a target with \`-o'" 1>&2
731
# Get the name of the library object.
732
[ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
736
# Recognize several different file suffixes.
737
# If the user specifies -o file.o, it is replaced with file.lo
747
*.class) xform=class ;;
752
*.java) xform=java ;;
755
libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
758
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
760
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
765
func_infer_tag $base_compile
767
for arg in $later; do
786
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
788
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
789
qlibobj="\"$qlibobj\"" ;;
791
test "X$libobj" != "X$qlibobj" \
792
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
793
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
794
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
795
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
796
if test "X$xdir" = "X$obj"; then
801
lobj=${xdir}$objdir/$objname
803
if test -z "$base_compile"; then
804
$echo "$modename: you must specify a compilation command" 1>&2
809
# Delete any leftover library objects.
810
if test "$build_old_libs" = yes; then
811
removelist="$obj $lobj $libobj ${libobj}T"
813
removelist="$lobj $libobj ${libobj}T"
817
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
819
# On Cygwin there's no "real" PIC flag so we must build both object types
821
cygwin* | mingw* | pw32* | os2*)
825
if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
826
# non-PIC code in shared libraries is not supported
830
# Calculate the filename of the output object if compiler does
831
# not support -o with -c
832
if test "$compiler_c_o" = no; then
833
output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
834
lockfile="$output_obj.lock"
835
removelist="$removelist $output_obj $lockfile"
836
trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
843
# Lock this critical section if it is needed
844
# We use this script file to make the link, it avoids creating a new file
845
if test "$need_locks" = yes; then
846
until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
847
$show "Waiting for $lockfile to be removed"
850
elif test "$need_locks" = warn; then
851
if test -f "$lockfile"; then
853
*** ERROR, $lockfile exists and contains:
854
`cat $lockfile 2>/dev/null`
856
This indicates that another process is trying to use the same
857
temporary object file, and libtool could not work around it because
858
your compiler does not support \`-c' and \`-o' together. If you
859
repeat this compilation, it may succeed, by chance, but you had better
860
avoid parallel builds (make -j) in this platform, or get a better
866
$echo "$srcfile" > "$lockfile"
869
if test -n "$fix_srcfile_path"; then
870
eval srcfile=\"$fix_srcfile_path\"
872
qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
874
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
875
qsrcfile="\"$qsrcfile\"" ;;
878
$run $rm "$libobj" "${libobj}T"
880
# Create a libtool object file (analogous to a ".la" file),
881
# but don't create it if we're doing a dry run.
882
test -z "$run" && cat > ${libobj}T <<EOF
883
# $libobj - a libtool object file
884
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
886
# Please DO NOT delete this file!
887
# It is necessary for linking the library.
889
# Name of the PIC object.
892
# Only build a PIC object if we are building libtool libraries.
893
if test "$build_libtool_libs" = yes; then
894
# Without this assignment, base_compile gets emptied.
895
fbsd_hideous_sh_bug=$base_compile
897
if test "$pic_mode" != no; then
898
command="$base_compile $qsrcfile $pic_flag"
900
# Don't build PIC code
901
command="$base_compile $qsrcfile"
904
if test ! -d "${xdir}$objdir"; then
905
$show "$mkdir ${xdir}$objdir"
906
$run $mkdir ${xdir}$objdir
908
if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
913
if test -z "$output_obj"; then
914
# Place PIC objects in $objdir
915
command="$command -o $lobj"
918
$run $rm "$lobj" "$output_obj"
921
if $run eval "$command"; then :
923
test -n "$output_obj" && $run $rm $removelist
927
if test "$need_locks" = warn &&
928
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
930
*** ERROR, $lockfile contains:
931
`cat $lockfile 2>/dev/null`
933
but it should contain:
936
This indicates that another process is trying to use the same
937
temporary object file, and libtool could not work around it because
938
your compiler does not support \`-c' and \`-o' together. If you
939
repeat this compilation, it may succeed, by chance, but you had better
940
avoid parallel builds (make -j) in this platform, or get a better
947
# Just move the object if needed, then go on to compile the next one
948
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
949
$show "$mv $output_obj $lobj"
950
if $run $mv $output_obj $lobj; then :
958
# Append the name of the PIC object to the libtool object file.
959
test -z "$run" && cat >> ${libobj}T <<EOF
960
pic_object='$objdir/$objname'
964
# Allow error messages only from the first compilation.
965
if test "$suppress_opt" = yes; then
966
suppress_output=' >/dev/null 2>&1'
969
# No PIC object so indicate it doesn't exist in the libtool
971
test -z "$run" && cat >> ${libobj}T <<EOF
977
# Only build a position-dependent object if we build old libraries.
978
if test "$build_old_libs" = yes; then
979
if test "$pic_mode" != yes; then
980
# Don't build PIC code
981
command="$base_compile $qsrcfile"
983
command="$base_compile $qsrcfile $pic_flag"
985
if test "$compiler_c_o" = yes; then
986
command="$command -o $obj"
989
# Suppress compiler output if we already did a PIC compilation.
990
command="$command$suppress_output"
991
$run $rm "$obj" "$output_obj"
993
if $run eval "$command"; then :
999
if test "$need_locks" = warn &&
1000
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1002
*** ERROR, $lockfile contains:
1003
`cat $lockfile 2>/dev/null`
1005
but it should contain:
1008
This indicates that another process is trying to use the same
1009
temporary object file, and libtool could not work around it because
1010
your compiler does not support \`-c' and \`-o' together. If you
1011
repeat this compilation, it may succeed, by chance, but you had better
1012
avoid parallel builds (make -j) in this platform, or get a better
1015
$run $rm $removelist
1019
# Just move the object if needed
1020
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1021
$show "$mv $output_obj $obj"
1022
if $run $mv $output_obj $obj; then :
1025
$run $rm $removelist
1030
# Append the name of the non-PIC object the libtool object file.
1031
# Only append if the libtool object file exists.
1032
test -z "$run" && cat >> ${libobj}T <<EOF
1033
# Name of the non-PIC object.
1034
non_pic_object='$objname'
1038
# Append the name of the non-PIC object the libtool object file.
1039
# Only append if the libtool object file exists.
1040
test -z "$run" && cat >> ${libobj}T <<EOF
1041
# Name of the non-PIC object.
1047
$run $mv "${libobj}T" "${libobj}"
1049
# Unlock the critical section if it was locked
1050
if test "$need_locks" != no; then
1051
$run $rm "$lockfile"
1059
modename="$modename: link"
1061
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1062
# It is impossible to link a dll without this setting, and
1063
# we shouldn't force the makefile maintainer to figure out
1064
# which system we are compiling for in order to pass an extra
1065
# flag for every libtool invocation.
1066
# allow_undefined=no
1068
# FIXME: Unfortunately, there are problems with the above when trying
1069
# to make a dll which has undefined symbols, in which case not
1070
# even a static library is built. For now, we need to specify
1071
# -no-undefined on the libtool link line when we can be certain
1072
# that all symbols are satisfied, otherwise we get a static library.
1079
libtool_args="$nonopt"
1080
base_compile="$nonopt $@"
1081
compile_command="$nonopt"
1082
finalize_command="$nonopt"
1095
lib_search_path=`pwd`
1104
export_symbols_regex=
1112
precious_files_regex=
1113
prefer_static_libs=no
1126
func_infer_tag $base_compile
1128
# We need to know -static, to get the right output filenames.
1132
-all-static | -static)
1133
if test "X$arg" = "X-all-static"; then
1134
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1135
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1137
if test -n "$link_static_flag"; then
1138
dlopen_self=$dlopen_self_static
1141
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1142
dlopen_self=$dlopen_self_static
1145
build_libtool_libs=no
1147
prefer_static_libs=yes
1153
# See if our shared archives depend on static archives.
1154
test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1156
# Go through the arguments, transforming them on the way.
1157
while test "$#" -gt 0; do
1161
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1162
qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1166
libtool_args="$libtool_args $qarg"
1168
# If the previous option needs an argument, assign it.
1169
if test -n "$prev"; then
1172
compile_command="$compile_command @OUTPUT@"
1173
finalize_command="$finalize_command @OUTPUT@"
1179
if test "$preload" = no; then
1180
# Add the symbol object into the linking commands.
1181
compile_command="$compile_command @SYMFILE@"
1182
finalize_command="$finalize_command @SYMFILE@"
1186
*.la | *.lo) ;; # We handle these cases below.
1188
if test "$dlself" = no; then
1196
if test "$prev" = dlprefiles; then
1198
elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1208
if test "$prev" = dlfiles; then
1209
dlfiles="$dlfiles $arg"
1211
dlprefiles="$dlprefiles $arg"
1219
export_symbols="$arg"
1220
if test ! -f "$arg"; then
1221
$echo "$modename: symbol file \`$arg' does not exist"
1228
export_symbols_regex="$arg"
1233
inst_prefix_dir="$arg"
1238
precious_files_regex="$arg"
1248
if test -f "$arg"; then
1251
for fil in `cat $save_arg`
1253
# moreargs="$moreargs $fil"
1255
# A libtool-controlled object.
1257
# Check to see that this really is a libtool object.
1258
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1263
# If there is no directory component, then add one.
1265
*/* | *\\*) . $arg ;;
1269
if test -z "$pic_object" || \
1270
test -z "$non_pic_object" ||
1271
test "$pic_object" = none && \
1272
test "$non_pic_object" = none; then
1273
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1277
# Extract subdirectory from the argument.
1278
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1279
if test "X$xdir" = "X$arg"; then
1285
if test "$pic_object" != none; then
1286
# Prepend the subdirectory the object is found in.
1287
pic_object="$xdir$pic_object"
1289
if test "$prev" = dlfiles; then
1290
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1291
dlfiles="$dlfiles $pic_object"
1295
# If libtool objects are unsupported, then we need to preload.
1300
# CHECK ME: I think I busted this. -Ossama
1301
if test "$prev" = dlprefiles; then
1302
# Preload the old-style object.
1303
dlprefiles="$dlprefiles $pic_object"
1308
libobjs="$libobjs $pic_object"
1313
if test "$non_pic_object" != none; then
1314
# Prepend the subdirectory the object is found in.
1315
non_pic_object="$xdir$non_pic_object"
1317
# A standard non-PIC object
1318
non_pic_objects="$non_pic_objects $non_pic_object"
1319
if test -z "$pic_object" || test "$pic_object" = none ; then
1320
arg="$non_pic_object"
1324
# Only an error if not doing a dry-run.
1325
if test -z "$run"; then
1326
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1331
# Extract subdirectory from the argument.
1332
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1333
if test "X$xdir" = "X$arg"; then
1339
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1340
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1341
libobjs="$libobjs $pic_object"
1342
non_pic_objects="$non_pic_objects $non_pic_object"
1347
$echo "$modename: link input file \`$save_arg' does not exist"
1355
# We need an absolute path.
1357
[\\/]* | [A-Za-z]:[\\/]*) ;;
1359
$echo "$modename: only absolute run-paths are allowed" 1>&2
1363
if test "$prev" = rpath; then
1366
*) rpath="$rpath $arg" ;;
1371
*) xrpath="$xrpath $arg" ;;
1378
compiler_flags="$compiler_flags $qarg"
1380
compile_command="$compile_command $qarg"
1381
finalize_command="$finalize_command $qarg"
1385
linker_flags="$linker_flags $qarg"
1386
compiler_flags="$compiler_flags $wl$qarg"
1388
compile_command="$compile_command $wl$qarg"
1389
finalize_command="$finalize_command $wl$qarg"
1393
linker_flags="$linker_flags $qarg"
1394
compiler_flags="$compiler_flags $qarg"
1396
compile_command="$compile_command $qarg"
1397
finalize_command="$finalize_command $qarg"
1406
compiler_flags="$compiler_flags $arg"
1407
compile_command="$compile_command $arg"
1408
finalize_command="$finalize_command $arg"
1413
eval "$prev=\"\$arg\""
1418
fi # test -n "$prev"
1424
if test -n "$link_static_flag"; then
1425
compile_command="$compile_command $link_static_flag"
1426
finalize_command="$finalize_command $link_static_flag"
1432
# FIXME: remove this flag sometime in the future.
1433
$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1457
-export-symbols | -export-symbols-regex)
1458
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1459
$echo "$modename: more than one -exported-symbols argument is not allowed"
1462
if test "X$arg" = "X-export-symbols"; then
1471
prev=darwin_framework
1472
compiler_flags="$compiler_flags $arg"
1473
compile_command="$compile_command $arg"
1474
finalize_command="$finalize_command $arg"
1483
# The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1484
# so, if we see these flags be careful not to treat them like -L
1486
case $with_gcc/$host in
1487
no/*-*-irix* | /*-*-irix*)
1488
compile_command="$compile_command $arg"
1489
finalize_command="$finalize_command $arg"
1496
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1497
# We need an absolute path.
1499
[\\/]* | [A-Za-z]:[\\/]*) ;;
1501
absdir=`cd "$dir" && pwd`
1502
if test -z "$absdir"; then
1503
$echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1512
deplibs="$deplibs -L$dir"
1513
lib_search_path="$lib_search_path $dir"
1517
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1518
case :$dllsearchpath: in
1520
*) dllsearchpath="$dllsearchpath:$dir";;
1528
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1530
*-*-cygwin* | *-*-pw32* | *-*-beos*)
1531
# These systems don't actually have a C or math library (as such)
1534
*-*-mingw* | *-*-os2*)
1535
# These systems don't actually have a C library (as such)
1536
test "X$arg" = "X-lc" && continue
1538
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1539
# Do not include libc due to us having libc/libc_r.
1540
test "X$arg" = "X-lc" && continue
1542
*-*-rhapsody* | *-*-darwin1.[012])
1543
# Rhapsody C and math libraries are in the System framework
1544
deplibs="$deplibs -framework System"
1547
elif test "X$arg" = "X-lc_r"; then
1549
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1550
# Do not include libc_r directly, use -pthread flag.
1555
deplibs="$deplibs $arg"
1559
# Tru64 UNIX uses -model [arg] to determine the layout of C++
1560
# classes, name mangling, and exception handling.
1562
compile_command="$compile_command $arg"
1563
compiler_flags="$compiler_flags $arg"
1564
finalize_command="$finalize_command $arg"
1569
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1570
compiler_flags="$compiler_flags $arg"
1571
compile_command="$compile_command $arg"
1572
finalize_command="$finalize_command $arg"
1581
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1582
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1583
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1584
# +DA*, +DD* enable 64-bit mode on the HP compiler
1585
# -q* pass through compiler args for the IBM compiler
1586
# -m* pass through architecture-specific compiler args for GCC
1587
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1589
# Unknown arguments in both finalize_command and compile_command need
1590
# to be aesthetically quoted because they are evaled later.
1591
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1593
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1597
compile_command="$compile_command $arg"
1598
finalize_command="$finalize_command $arg"
1599
if test "$with_gcc" = "yes" ; then
1600
compiler_flags="$compiler_flags $arg"
1617
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1618
# The PATH hackery in wrapper scripts is required on Windows
1619
# in order for the loader to find any dlls it needs.
1620
$echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1621
$echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1624
*) no_install=yes ;;
1641
-precious-files-regex)
1662
dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1663
# We need an absolute path.
1665
[\\/]* | [A-Za-z]:[\\/]*) ;;
1667
$echo "$modename: only absolute run-paths are allowed" 1>&2
1673
*) xrpath="$xrpath $dir" ;;
1679
# The effects of -static are defined in a previous loop.
1680
# We used to do the same as -all-static on platforms that
1681
# didn't have a PIC flag, but the assumption that the effects
1682
# would be equivalent was wrong. It would break on at least
1683
# Digital Unix and AIX.
1703
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1705
save_ifs="$IFS"; IFS=','
1706
for flag in $args; do
1709
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1714
compiler_flags="$compiler_flags $flag"
1717
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1721
args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1723
save_ifs="$IFS"; IFS=','
1724
for flag in $args; do
1727
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1732
compiler_flags="$compiler_flags $wl$flag"
1733
linker_flags="$linker_flags $flag"
1736
arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1754
-Kthread | -mthreads | -mt | -pthread | -pthreads | -threads | -qthreaded | -kthread )
1755
compiler_flags="$compiler_flags $arg"
1759
# Some other compiler flag.
1761
# Unknown arguments in both finalize_command and compile_command need
1762
# to be aesthetically quoted because they are evaled later.
1763
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1765
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1772
# A standard object.
1777
# A libtool-controlled object.
1779
# Check to see that this really is a libtool object.
1780
if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1785
# If there is no directory component, then add one.
1787
*/* | *\\*) . $arg ;;
1791
if test -z "$pic_object" || \
1792
test -z "$non_pic_object" ||
1793
test "$pic_object" = none && \
1794
test "$non_pic_object" = none; then
1795
$echo "$modename: cannot find name of object for \`$arg'" 1>&2
1799
# Extract subdirectory from the argument.
1800
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1801
if test "X$xdir" = "X$arg"; then
1807
if test "$pic_object" != none; then
1808
# Prepend the subdirectory the object is found in.
1809
pic_object="$xdir$pic_object"
1811
if test "$prev" = dlfiles; then
1812
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1813
dlfiles="$dlfiles $pic_object"
1817
# If libtool objects are unsupported, then we need to preload.
1822
# CHECK ME: I think I busted this. -Ossama
1823
if test "$prev" = dlprefiles; then
1824
# Preload the old-style object.
1825
dlprefiles="$dlprefiles $pic_object"
1830
libobjs="$libobjs $pic_object"
1835
if test "$non_pic_object" != none; then
1836
# Prepend the subdirectory the object is found in.
1837
non_pic_object="$xdir$non_pic_object"
1839
# A standard non-PIC object
1840
non_pic_objects="$non_pic_objects $non_pic_object"
1841
if test -z "$pic_object" || test "$pic_object" = none ; then
1842
arg="$non_pic_object"
1846
# Only an error if not doing a dry-run.
1847
if test -z "$run"; then
1848
$echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1853
# Extract subdirectory from the argument.
1854
xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1855
if test "X$xdir" = "X$arg"; then
1861
pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1862
non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1863
libobjs="$libobjs $pic_object"
1864
non_pic_objects="$non_pic_objects $non_pic_object"
1871
deplibs="$deplibs $arg"
1872
old_deplibs="$old_deplibs $arg"
1877
# A libtool-controlled library.
1879
if test "$prev" = dlfiles; then
1880
# This library was specified with -dlopen.
1881
dlfiles="$dlfiles $arg"
1883
elif test "$prev" = dlprefiles; then
1884
# The library was specified with -dlpreopen.
1885
dlprefiles="$dlprefiles $arg"
1888
deplibs="$deplibs $arg"
1893
# Some other compiler argument.
1895
# Unknown arguments in both finalize_command and compile_command need
1896
# to be aesthetically quoted because they are evaled later.
1897
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1899
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1906
# Now actually substitute the argument into the commands.
1907
if test -n "$arg"; then
1908
compile_command="$compile_command $arg"
1909
finalize_command="$finalize_command $arg"
1911
done # argument parsing loop
1913
if test -n "$prev"; then
1914
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1919
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1920
eval arg=\"$export_dynamic_flag_spec\"
1921
compile_command="$compile_command $arg"
1922
finalize_command="$finalize_command $arg"
1926
# calculate the name of the file, without its directory
1927
outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1928
libobjs_save="$libobjs"
1930
if test -n "$shlibpath_var"; then
1931
# get the directories listed in $shlibpath_var
1932
eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1936
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1937
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1939
output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1940
if test "X$output_objdir" = "X$output"; then
1941
output_objdir="$objdir"
1943
output_objdir="$output_objdir/$objdir"
1945
# Create the object directory.
1946
if test ! -d "$output_objdir"; then
1947
$show "$mkdir $output_objdir"
1948
$run $mkdir $output_objdir
1950
if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1955
# Determine the type of output
1958
$echo "$modename: you must specify an output file" 1>&2
1962
*.$libext) linkmode=oldlib ;;
1963
*.lo | *.$objext) linkmode=obj ;;
1964
*.la) linkmode=lib ;;
1965
*) linkmode=prog ;; # Anything else should be a program.
1969
*cygwin* | *mingw* | *pw32*)
1970
# don't eliminate duplications in $postdeps and $predeps
1971
duplicate_compiler_generated_deps=yes
1974
duplicate_compiler_generated_deps=$duplicate_deps
1980
# Find all interdependent deplibs by searching for libraries
1981
# that are linked more than once (e.g. -la -lb -la)
1982
for deplib in $deplibs; do
1983
if test "X$duplicate_deps" = "Xyes" ; then
1985
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1988
libs="$libs $deplib"
1991
if test "$linkmode" = lib; then
1992
libs="$predeps $libs $compiler_lib_search_path $postdeps"
1994
# Compute libraries that are listed more than once in $predeps
1995
# $postdeps and mark them as special (i.e., whose duplicates are
1996
# not to be eliminated).
1998
if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1999
for pre_post_dep in $predeps $postdeps; do
2000
case "$pre_post_deps " in
2001
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2003
pre_post_deps="$pre_post_deps $pre_post_dep"
2012
need_relink=no # whether we're linking any uninstalled libtool libraries
2013
notinst_deplibs= # not-installed libtool libraries
2014
notinst_path= # paths that contain not-installed libtool libraries
2018
for file in $dlfiles $dlprefiles; do
2022
$echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2034
passes="conv scan dlopen dlpreopen link"
2039
for pass in $passes; do
2040
if test "$linkmode,$pass" = "lib,link" ||
2041
test "$linkmode,$pass" = "prog,scan"; then
2045
if test "$linkmode" = prog; then
2047
dlopen) libs="$dlfiles" ;;
2048
dlpreopen) libs="$dlprefiles" ;;
2049
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2052
if test "$pass" = dlopen; then
2053
# Collect dlpreopened libraries
2054
save_deplibs="$deplibs"
2057
for deplib in $libs; do
2061
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2062
if test "$linkmode,$pass" = "prog,link"; then
2063
compile_deplibs="$deplib $compile_deplibs"
2064
finalize_deplibs="$deplib $finalize_deplibs"
2066
compiler_flags="$compiler_flags $deplib"
2071
if test "$linkmode" != lib && test "$linkmode" != prog; then
2072
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2075
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2076
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2077
for search_ext in .la $std_shrext .so .a; do
2078
# Search the libtool library
2079
lib="$searchdir/lib${name}${search_ext}"
2080
if test -f "$lib"; then
2081
if test "$search_ext" = ".la"; then
2090
if test "$found" != yes; then
2091
# deplib doesn't seem to be a libtool library
2092
if test "$linkmode,$pass" = "prog,link"; then
2093
compile_deplibs="$deplib $compile_deplibs"
2094
finalize_deplibs="$deplib $finalize_deplibs"
2096
deplibs="$deplib $deplibs"
2097
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2100
else # deplib is a libtool library
2101
# If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2102
# We need to do some special things here, and not later.
2103
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2104
case " $predeps $postdeps " in
2106
if (${SED} -e '2q' $lib |
2107
grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2111
*/* | *\\*) . $lib ;;
2114
for l in $old_library $library_names; do
2117
if test "X$ll" = "X$old_library" ; then # only static version available
2119
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2120
test "X$ladir" = "X$lib" && ladir="."
2121
lib=$ladir/$old_library
2122
if test "$linkmode,$pass" = "prog,link"; then
2123
compile_deplibs="$deplib $compile_deplibs"
2124
finalize_deplibs="$deplib $finalize_deplibs"
2126
deplibs="$deplib $deplibs"
2127
test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2141
deplibs="$deplib $deplibs"
2142
test "$pass" = conv && continue
2143
newdependency_libs="$deplib $newdependency_libs"
2144
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2147
if test "$pass" = conv; then
2148
deplibs="$deplib $deplibs"
2151
if test "$pass" = scan; then
2152
deplibs="$deplib $deplibs"
2154
compile_deplibs="$deplib $compile_deplibs"
2155
finalize_deplibs="$deplib $finalize_deplibs"
2157
newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2160
$echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2166
if test "$pass" = link; then
2167
dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2168
# Make sure the xrpath contains only unique directories.
2171
*) xrpath="$xrpath $dir" ;;
2174
deplibs="$deplib $deplibs"
2177
*.la) lib="$deplib" ;;
2179
if test "$pass" = conv; then
2180
deplibs="$deplib $deplibs"
2186
case $deplibs_check_method in
2188
set dummy $deplibs_check_method
2189
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2190
if eval $echo \"$deplib\" 2>/dev/null \
2192
| $EGREP "$match_pattern_regex" > /dev/null; then
2200
if test "$valid_a_lib" != yes; then
2202
$echo "*** Warning: Trying to link with static lib archive $deplib."
2203
$echo "*** I have the capability to make that library automatically link in when"
2204
$echo "*** you link to this library. But I can only do this if you have a"
2205
$echo "*** shared version of the library, which you do not appear to have"
2206
$echo "*** because the file extensions .$libext of this argument makes me believe"
2207
$echo "*** that it is just a static archive that I should not used here."
2210
$echo "*** Warning: Linking the shared library $output against the"
2211
$echo "*** static library $deplib is not portable!"
2212
deplibs="$deplib $deplibs"
2217
if test "$pass" != link; then
2218
deplibs="$deplib $deplibs"
2220
compile_deplibs="$deplib $compile_deplibs"
2221
finalize_deplibs="$deplib $finalize_deplibs"
2228
if test "$pass" = conv; then
2229
deplibs="$deplib $deplibs"
2230
elif test "$linkmode" = prog; then
2231
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2232
# If there is no dlopen support or we're linking statically,
2233
# we need to preload.
2234
newdlprefiles="$newdlprefiles $deplib"
2235
compile_deplibs="$deplib $compile_deplibs"
2236
finalize_deplibs="$deplib $finalize_deplibs"
2238
newdlfiles="$newdlfiles $deplib"
2248
if test "$found" = yes || test -f "$lib"; then :
2250
$echo "$modename: cannot find the library \`$lib'" 1>&2
2254
# Check to see that this really is a libtool archive.
2255
if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2257
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2261
ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2262
test "X$ladir" = "X$lib" && ladir="."
2270
# If the library was installed with an old release of libtool,
2271
# it will not redefine variables installed, or shouldnotlink
2279
*/* | *\\*) . $lib ;;
2283
if test "$linkmode,$pass" = "lib,link" ||
2284
test "$linkmode,$pass" = "prog,scan" ||
2285
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
2286
test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2287
test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2290
if test "$pass" = conv; then
2291
# Only check for convenience libraries
2292
deplibs="$lib $deplibs"
2293
if test -z "$libdir"; then
2294
if test -z "$old_library"; then
2295
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2298
# It is a libtool convenience library, so add in its objects.
2299
convenience="$convenience $ladir/$objdir/$old_library"
2300
old_convenience="$old_convenience $ladir/$objdir/$old_library"
2302
for deplib in $dependency_libs; do
2303
deplibs="$deplib $deplibs"
2304
if test "X$duplicate_deps" = "Xyes" ; then
2305
case "$tmp_libs " in
2306
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2309
tmp_libs="$tmp_libs $deplib"
2311
elif test "$linkmode" != prog && test "$linkmode" != lib; then
2312
$echo "$modename: \`$lib' is not a convenience library" 1>&2
2319
# Get the name of the library we link against.
2321
for l in $old_library $library_names; do
2324
if test -z "$linklib"; then
2325
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2329
# This library was specified with -dlopen.
2330
if test "$pass" = dlopen; then
2331
if test -z "$libdir"; then
2332
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2335
if test -z "$dlname" ||
2336
test "$dlopen_support" != yes ||
2337
test "$build_libtool_libs" = no; then
2338
# If there is no dlname, no dlopen support or we're linking
2339
# statically, we need to preload. We also need to preload any
2340
# dependent libraries so libltdl's deplib preloader doesn't
2341
# bomb out in the load deplibs phase.
2342
dlprefiles="$dlprefiles $lib $dependency_libs"
2344
newdlfiles="$newdlfiles $lib"
2349
# We need an absolute path.
2351
[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2353
abs_ladir=`cd "$ladir" && pwd`
2354
if test -z "$abs_ladir"; then
2355
$echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2356
$echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2361
laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2363
# Find the relevant object directory and library name.
2364
if test "X$installed" = Xyes; then
2365
if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2366
$echo "$modename: warning: library \`$lib' was moved." 1>&2
2374
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2376
if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2379
# Remove this search path later
2380
notinst_path="$notinst_path $abs_ladir"
2382
dir="$ladir/$objdir"
2383
absdir="$abs_ladir/$objdir"
2384
# Remove this search path later
2385
notinst_path="$notinst_path $abs_ladir"
2387
fi # $installed = yes
2388
name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2390
# This library was specified with -dlpreopen.
2391
if test "$pass" = dlpreopen; then
2392
if test -z "$libdir"; then
2393
$echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2396
# Prefer using a static library (so that no silly _DYNAMIC symbols
2397
# are required to link).
2398
if test -n "$old_library"; then
2399
newdlprefiles="$newdlprefiles $dir/$old_library"
2400
# Otherwise, use the dlname, so that lt_dlopen finds it.
2401
elif test -n "$dlname"; then
2402
newdlprefiles="$newdlprefiles $dir/$dlname"
2404
newdlprefiles="$newdlprefiles $dir/$linklib"
2406
fi # $pass = dlpreopen
2408
if test -z "$libdir"; then
2409
# Link the convenience library
2410
if test "$linkmode" = lib; then
2411
deplibs="$dir/$old_library $deplibs"
2412
elif test "$linkmode,$pass" = "prog,link"; then
2413
compile_deplibs="$dir/$old_library $compile_deplibs"
2414
finalize_deplibs="$dir/$old_library $finalize_deplibs"
2416
deplibs="$lib $deplibs" # used for prog,scan pass
2422
if test "$linkmode" = prog && test "$pass" != link; then
2423
newlib_search_path="$newlib_search_path $ladir"
2424
deplibs="$lib $deplibs"
2427
if test "$link_all_deplibs" != no || test -z "$library_names" ||
2428
test "$build_libtool_libs" = no; then
2433
for deplib in $dependency_libs; do
2435
-L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2437
# Need to link against all dependency_libs?
2438
if test "$linkalldeplibs" = yes; then
2439
deplibs="$deplib $deplibs"
2441
# Need to hardcode shared library paths
2442
# or/and link against static libraries
2443
newdependency_libs="$deplib $newdependency_libs"
2445
if test "X$duplicate_deps" = "Xyes" ; then
2446
case "$tmp_libs " in
2447
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2450
tmp_libs="$tmp_libs $deplib"
2453
fi # $linkmode = prog...
2455
if test "$linkmode,$pass" = "prog,link"; then
2456
if test -n "$library_names" &&
2457
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2458
# We need to hardcode the library path
2459
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2460
# Make sure the rpath contains only unique directories.
2461
case "$temp_rpath " in
2464
*) temp_rpath="$temp_rpath $absdir" ;;
2468
# Hardcode the library path.
2469
# Skip directories that are in the system default run-time
2471
case " $sys_lib_dlsearch_path " in
2474
case "$compile_rpath " in
2476
*) compile_rpath="$compile_rpath $absdir"
2480
case " $sys_lib_dlsearch_path " in
2483
case "$finalize_rpath " in
2485
*) finalize_rpath="$finalize_rpath $libdir"
2489
fi # $linkmode,$pass = prog,link...
2491
if test "$alldeplibs" = yes &&
2492
{ test "$deplibs_check_method" = pass_all ||
2493
{ test "$build_libtool_libs" = yes &&
2494
test -n "$library_names"; }; }; then
2495
# We only need to search for static libraries
2500
link_static=no # Whether the deplib will be linked statically
2501
if test -n "$library_names" &&
2502
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2503
if test "$installed" = no; then
2504
notinst_deplibs="$notinst_deplibs $lib"
2507
# This is a shared library
2509
# Warn about portability, can't link against -module's on
2510
# some systems (darwin)
2511
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2513
if test "$linkmode" = prog; then
2514
$echo "*** Warning: Linking the executable $output against the loadable module"
2516
$echo "*** Warning: Linking the shared library $output against the loadable module"
2518
$echo "*** $linklib is not portable!"
2520
if test "$linkmode" = lib &&
2521
test "$hardcode_into_libs" = yes; then
2522
# Hardcode the library path.
2523
# Skip directories that are in the system default run-time
2525
case " $sys_lib_dlsearch_path " in
2528
case "$compile_rpath " in
2530
*) compile_rpath="$compile_rpath $absdir"
2534
case " $sys_lib_dlsearch_path " in
2537
case "$finalize_rpath " in
2539
*) finalize_rpath="$finalize_rpath $libdir"
2545
if test -n "$old_archive_from_expsyms_cmds"; then
2546
# figure out the soname
2547
set dummy $library_names
2550
libname=`eval \\$echo \"$libname_spec\"`
2551
# use dlname if we got it. it's perfectly good, no?
2552
if test -n "$dlname"; then
2554
elif test -n "$soname_spec"; then
2558
major=`expr $current - $age`
2562
eval soname=\"$soname_spec\"
2567
# Make a new name for the extract_expsyms_cmds to use
2569
soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2570
newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2572
# If the library has no export list, then create one now
2573
if test -f "$output_objdir/$soname-def"; then :
2575
$show "extracting exported symbol list from \`$soname'"
2576
save_ifs="$IFS"; IFS='~'
2577
cmds=$extract_expsyms_cmds
2578
for cmd in $cmds; do
2582
$run eval "$cmd" || exit $?
2588
if test -f "$output_objdir/$newlib"; then :; else
2589
$show "generating import library for \`$soname'"
2590
save_ifs="$IFS"; IFS='~'
2591
cmds=$old_archive_from_expsyms_cmds
2592
for cmd in $cmds; do
2596
$run eval "$cmd" || exit $?
2600
# make sure the library variables are pointing to the new library
2603
fi # test -n "$old_archive_from_expsyms_cmds"
2605
if test "$linkmode" = prog || test "$mode" != relink; then
2610
case $hardcode_action in
2611
immediate | unsupported)
2612
if test "$hardcode_direct" = no; then
2615
*-*-sco3.2v5* ) add_dir="-L$dir" ;;
2617
# if the lib is a module then we can not link against
2618
# it, someone is ignoring the new warnings I added
2619
if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2620
$echo "** Warning, lib $linklib is a module, not a shared library"
2621
if test -z "$old_library" ; then
2623
$echo "** And there doesn't seem to be a static archive available"
2624
$echo "** The link will probably fail, sorry"
2626
add="$dir/$old_library"
2630
elif test "$hardcode_minus_L" = no; then
2632
*-*-sunos*) add_shlibpath="$dir" ;;
2636
elif test "$hardcode_shlibpath_var" = no; then
2637
add_shlibpath="$dir"
2644
if test "$hardcode_direct" = yes; then
2646
elif test "$hardcode_minus_L" = yes; then
2648
# Try looking first in the location we're being installed to.
2649
if test -n "$inst_prefix_dir"; then
2652
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2657
elif test "$hardcode_shlibpath_var" = yes; then
2658
add_shlibpath="$dir"
2667
if test "$lib_linked" != yes; then
2668
$echo "$modename: configuration error: unsupported hardcode properties"
2672
if test -n "$add_shlibpath"; then
2673
case :$compile_shlibpath: in
2674
*":$add_shlibpath:"*) ;;
2675
*) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2678
if test "$linkmode" = prog; then
2679
test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2680
test -n "$add" && compile_deplibs="$add $compile_deplibs"
2682
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2683
test -n "$add" && deplibs="$add $deplibs"
2684
if test "$hardcode_direct" != yes && \
2685
test "$hardcode_minus_L" != yes && \
2686
test "$hardcode_shlibpath_var" = yes; then
2687
case :$finalize_shlibpath: in
2689
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2695
if test "$linkmode" = prog || test "$mode" = relink; then
2699
# Finalize command for both is simple: just hardcode it.
2700
if test "$hardcode_direct" = yes; then
2701
add="$libdir/$linklib"
2702
elif test "$hardcode_minus_L" = yes; then
2705
elif test "$hardcode_shlibpath_var" = yes; then
2706
case :$finalize_shlibpath: in
2708
*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2711
elif test "$hardcode_automatic" = yes; then
2712
if test -n "$inst_prefix_dir" &&
2713
test -f "$inst_prefix_dir$libdir/$linklib" ; then
2714
add="$inst_prefix_dir$libdir/$linklib"
2716
add="$libdir/$linklib"
2719
# We cannot seem to hardcode it, guess we'll fake it.
2721
# Try looking first in the location we're being installed to.
2722
if test -n "$inst_prefix_dir"; then
2725
add_dir="$add_dir -L$inst_prefix_dir$libdir"
2732
if test "$linkmode" = prog; then
2733
test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2734
test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2736
test -n "$add_dir" && deplibs="$add_dir $deplibs"
2737
test -n "$add" && deplibs="$add $deplibs"
2740
elif test "$linkmode" = prog; then
2741
# Here we assume that one of hardcode_direct or hardcode_minus_L
2742
# is not unsupported. This is valid on all known static and
2744
if test "$hardcode_direct" != unsupported; then
2745
test -n "$old_library" && linklib="$old_library"
2746
compile_deplibs="$dir/$linklib $compile_deplibs"
2747
finalize_deplibs="$dir/$linklib $finalize_deplibs"
2749
compile_deplibs="-l$name -L$dir $compile_deplibs"
2750
finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2752
elif test "$build_libtool_libs" = yes; then
2753
# Not a shared library
2754
if test "$deplibs_check_method" != pass_all; then
2755
# We're trying link a shared library against a static one
2756
# but the system doesn't support it.
2758
# Just print a warning and add the library to dependency_libs so
2759
# that the program can be linked against the static library.
2761
$echo "*** Warning: This system can not link to static lib archive $lib."
2762
$echo "*** I have the capability to make that library automatically link in when"
2763
$echo "*** you link to this library. But I can only do this if you have a"
2764
$echo "*** shared version of the library, which you do not appear to have."
2765
if test "$module" = yes; then
2766
$echo "*** But as you try to build a module library, libtool will still create "
2767
$echo "*** a static module, that should work as long as the dlopening application"
2768
$echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2769
if test -z "$global_symbol_pipe"; then
2771
$echo "*** However, this would only work if libtool was able to extract symbol"
2772
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2773
$echo "*** not find such a program. So, this module is probably useless."
2774
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2776
if test "$build_old_libs" = no; then
2777
build_libtool_libs=module
2780
build_libtool_libs=no
2784
deplibs="$dir/$old_library $deplibs"
2787
fi # link shared/static library?
2789
if test "$linkmode" = lib; then
2790
if test -n "$dependency_libs" &&
2791
{ test "$hardcode_into_libs" != yes ||
2792
test "$build_old_libs" = yes ||
2793
test "$link_static" = yes; }; then
2794
# Extract -R from dependency_libs
2796
for libdir in $dependency_libs; do
2798
-R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2800
*" $temp_xrpath "*) ;;
2801
*) xrpath="$xrpath $temp_xrpath";;
2803
*) temp_deplibs="$temp_deplibs $libdir";;
2806
dependency_libs="$temp_deplibs"
2809
newlib_search_path="$newlib_search_path $absdir"
2810
# Link against this library
2811
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2812
# ... and its dependency_libs
2814
for deplib in $dependency_libs; do
2815
newdependency_libs="$deplib $newdependency_libs"
2816
if test "X$duplicate_deps" = "Xyes" ; then
2817
case "$tmp_libs " in
2818
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2821
tmp_libs="$tmp_libs $deplib"
2824
if test "$link_all_deplibs" != no; then
2825
# Add the search paths of all dependency libraries
2826
for deplib in $dependency_libs; do
2828
-L*) path="$deplib" ;;
2830
dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2831
test "X$dir" = "X$deplib" && dir="."
2832
# We need an absolute path.
2834
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2836
absdir=`cd "$dir" && pwd`
2837
if test -z "$absdir"; then
2838
$echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2843
if grep "^installed=no" $deplib > /dev/null; then
2844
path="$absdir/$objdir"
2846
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2847
if test -z "$libdir"; then
2848
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2851
if test "$absdir" != "$libdir"; then
2852
$echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2859
# we do not want to link against static libs,
2860
# but need to link against shared
2861
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2862
if test -n "$deplibrary_names" ; then
2863
for tmp in $deplibrary_names ; do
2866
if test -f "$path/$depdepl" ; then
2867
depdepl="$path/$depdepl"
2869
# do not add paths which are already there
2870
case " $newlib_search_path " in
2872
*) newlib_search_path="$newlib_search_path $path";;
2885
# Again, we only want to link against shared libraries
2886
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2887
for tmp in $newlib_search_path ; do
2888
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2889
eval depdepl="$tmp/lib$tmp_libs.dylib"
2900
case " $deplibs " in
2902
*) deplibs="$path $deplibs" ;;
2904
case " $deplibs " in
2906
*) deplibs="$depdepl $deplibs" ;;
2909
fi # link_all_deplibs != no
2911
done # for deplib in $libs
2912
dependency_libs="$newdependency_libs"
2913
if test "$pass" = dlpreopen; then
2914
# Link the dlpreopened libraries before other libraries
2915
for deplib in $save_deplibs; do
2916
deplibs="$deplib $deplibs"
2919
if test "$pass" != dlopen; then
2920
if test "$pass" != conv; then
2921
# Make sure lib_search_path contains only unique directories.
2923
for dir in $newlib_search_path; do
2924
case "$lib_search_path " in
2926
*) lib_search_path="$lib_search_path $dir" ;;
2932
if test "$linkmode,$pass" != "prog,link"; then
2935
vars="compile_deplibs finalize_deplibs"
2937
for var in $vars dependency_libs; do
2938
# Add libraries to $var in reverse order
2939
eval tmp_libs=\"\$$var\"
2941
for deplib in $tmp_libs; do
2942
# FIXME: Pedantically, this is the right thing to do, so
2943
# that some nasty dependency loop isn't accidentally
2945
#new_libs="$deplib $new_libs"
2946
# Pragmatically, this seems to cause very few problems in
2949
-L*) new_libs="$deplib $new_libs" ;;
2952
# And here is the reason: when a library appears more
2953
# than once as an explicit dependence of a library, or
2954
# is implicitly linked in more than once by the
2955
# compiler, it is considered special, and multiple
2956
# occurrences thereof are not removed. Compare this
2957
# with having the same library being listed as a
2958
# dependency of multiple other libraries: in this case,
2959
# we know (pedantically, we assume) the library does not
2960
# need to be listed more than once, so we keep only the
2961
# last copy. This is not always right, but it is rare
2962
# enough that we require users that really mean to play
2963
# such unportable linking tricks to link the library
2964
# using -Wl,-lname, so that libtool does not consider it
2965
# for duplicate removal.
2966
case " $specialdeplibs " in
2967
*" $deplib "*) new_libs="$deplib $new_libs" ;;
2969
case " $new_libs " in
2971
*) new_libs="$deplib $new_libs" ;;
2979
for deplib in $new_libs; do
2982
case " $tmp_libs " in
2984
*) tmp_libs="$tmp_libs $deplib" ;;
2987
*) tmp_libs="$tmp_libs $deplib" ;;
2990
eval $var=\"$tmp_libs\"
2993
# Last step: remove runtime libs from dependency_libs
2994
# (they stay in deplibs)
2996
for i in $dependency_libs ; do
2997
case " $predeps $postdeps $compiler_lib_search_path " in
3002
if test -n "$i" ; then
3003
tmp_libs="$tmp_libs $i"
3006
dependency_libs=$tmp_libs
3008
if test "$linkmode" = prog; then
3009
dlfiles="$newdlfiles"
3010
dlprefiles="$newdlprefiles"
3015
if test -n "$deplibs"; then
3016
$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3019
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3020
$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3023
if test -n "$rpath"; then
3024
$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3027
if test -n "$xrpath"; then
3028
$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3031
if test -n "$vinfo"; then
3032
$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3035
if test -n "$release"; then
3036
$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3039
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3040
$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3043
# Now set the variables for building old libraries.
3044
build_libtool_libs=no
3046
objs="$objs$old_deplibs"
3050
# Make sure we only generate libraries of the form `libNAME.la'.
3053
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3054
eval shared_ext=\"$shrext_cmds\"
3055
eval libname=\"$libname_spec\"
3058
if test "$module" = no; then
3059
$echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3063
if test "$need_lib_prefix" != no; then
3064
# Add the "lib" prefix for modules if required
3065
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3066
eval shared_ext=\"$shrext_cmds\"
3067
eval libname=\"$libname_spec\"
3069
libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3074
if test -n "$objs"; then
3075
if test "$deplibs_check_method" != pass_all; then
3076
$echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3080
$echo "*** Warning: Linking the shared library $output against the non-libtool"
3081
$echo "*** objects $objs is not portable!"
3082
libobjs="$libobjs $objs"
3086
if test "$dlself" != no; then
3087
$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3091
if test "$#" -gt 2; then
3092
$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3097
if test -z "$rpath"; then
3098
if test "$build_libtool_libs" = yes; then
3099
# Building a libtool convenience library.
3100
# Some compilers have problems with a `.al' extension so
3101
# convenience libraries should have the same extension an
3102
# archive normally would.
3103
oldlibs="$output_objdir/$libname.$libext $oldlibs"
3104
build_libtool_libs=convenience
3108
if test -n "$vinfo"; then
3109
$echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3112
if test -n "$release"; then
3113
$echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3117
# Parse the version information argument.
3118
save_ifs="$IFS"; IFS=':'
3119
set dummy $vinfo 0 0 0
3122
if test -n "$8"; then
3123
$echo "$modename: too many parameters to \`-version-info'" 1>&2
3128
# convert absolute version numbers to libtool ages
3129
# this retains compatibility with .la files and attempts
3130
# to make the code below a bit more comprehensible
3132
case $vinfo_number in
3136
number_revision="$4"
3138
# There are really only two kinds -- those that
3139
# use the current revision as the major version
3140
# and those that subtract age and use age as
3141
# a minor version. But, then there is irix
3142
# which has an extra 1 added just for fun
3144
case $version_type in
3145
darwin|linux|osf|windows)
3146
current=`expr $number_major + $number_minor`
3148
revision="$number_revision"
3150
freebsd-aout|freebsd-elf|sunos)
3151
current="$number_major"
3152
revision="$number_minor"
3156
current=`expr $number_major + $number_minor - 1`
3158
revision="$number_minor"
3169
# Check that each of the things are valid numbers.
3171
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]) ;;
3173
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3174
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3180
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]) ;;
3182
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3183
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3189
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]) ;;
3191
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3192
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3197
if test "$age" -gt "$current"; then
3198
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3199
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3203
# Calculate the version variables.
3207
case $version_type in
3211
# Like Linux, but with the current version available in
3212
# verstring for coding it into the library header
3213
major=.`expr $current - $age`
3214
versuffix="$major.$age.$revision"
3215
# Darwin ld doesn't like 0 for these options...
3216
minor_current=`expr $current + 1`
3217
verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3222
versuffix=".$current.$revision";
3227
versuffix=".$current";
3231
major=`expr $current - $age + 1`
3233
case $version_type in
3234
nonstopux) verstring_prefix=nonstopux ;;
3235
*) verstring_prefix=sgi ;;
3237
verstring="$verstring_prefix$major.$revision"
3239
# Add in all the interfaces that we are compatible with.
3241
while test "$loop" -ne 0; do
3242
iface=`expr $revision - $loop`
3243
loop=`expr $loop - 1`
3244
verstring="$verstring_prefix$major.$iface:$verstring"
3247
# Before this point, $major must not contain `.'.
3249
versuffix="$major.$revision"
3253
major=.`expr $current - $age`
3254
versuffix="$major.$age.$revision"
3258
major=.`expr $current - $age`
3259
versuffix=".$current.$age.$revision"
3260
verstring="$current.$age.$revision"
3262
# Add in all the interfaces that we are compatible with.
3264
while test "$loop" -ne 0; do
3265
iface=`expr $current - $loop`
3266
loop=`expr $loop - 1`
3267
verstring="$verstring:${iface}.0"
3270
# Make executables depend on our current version.
3271
verstring="$verstring:${current}.0"
3276
versuffix=".$current.$revision"
3280
# Use '-' rather than '.', since we only want one
3281
# extension on DOS 8.3 filesystems.
3282
major=`expr $current - $age`
3287
$echo "$modename: unknown library version type \`$version_type'" 1>&2
3288
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3293
# Clear the version info if we defaulted, and they specified a release.
3294
if test -z "$vinfo" && test -n "$release"; then
3296
case $version_type in
3298
# we can't check for "0.0" in archive_cmds due to quoting
3299
# problems, so we reset it completely
3306
if test "$need_version" = no; then
3313
# Remove version info from name if versioning should be avoided
3314
if test "$avoid_version" = yes && test "$need_version" = no; then
3320
# Check to see if the archive will have undefined symbols.
3321
if test "$allow_undefined" = yes; then
3322
if test "$allow_undefined_flag" = unsupported; then
3323
$echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3324
build_libtool_libs=no
3328
# Don't allow undefined symbols.
3329
allow_undefined_flag="$no_undefined_flag"
3333
if test "$mode" != relink; then
3334
# Remove our outputs, but don't remove object files since they
3335
# may have been created when compiling PIC objects.
3337
tempremovelist=`$echo "$output_objdir/*"`
3338
for p in $tempremovelist; do
3342
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3343
if test "X$precious_files_regex" != "X"; then
3344
if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3349
removelist="$removelist $p"
3354
if test -n "$removelist"; then
3355
$show "${rm}r $removelist"
3356
$run ${rm}r $removelist
3360
# Now set the variables for building old libraries.
3361
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3362
oldlibs="$oldlibs $output_objdir/$libname.$libext"
3364
# Transform .lo files to .o files.
3365
oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3368
# Eliminate all temporary directories.
3369
for path in $notinst_path; do
3370
lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3371
deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3372
dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3375
if test -n "$xrpath"; then
3376
# If the user specified any rpath flags, then add them.
3378
for libdir in $xrpath; do
3379
temp_xrpath="$temp_xrpath -R$libdir"
3380
case "$finalize_rpath " in
3382
*) finalize_rpath="$finalize_rpath $libdir" ;;
3385
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3386
dependency_libs="$temp_xrpath $dependency_libs"
3390
# Make sure dlfiles contains only unique files that won't be dlpreopened
3391
old_dlfiles="$dlfiles"
3393
for lib in $old_dlfiles; do
3394
case " $dlprefiles $dlfiles " in
3396
*) dlfiles="$dlfiles $lib" ;;
3400
# Make sure dlprefiles contains only unique files
3401
old_dlprefiles="$dlprefiles"
3403
for lib in $old_dlprefiles; do
3404
case "$dlprefiles " in
3406
*) dlprefiles="$dlprefiles $lib" ;;
3410
if test "$build_libtool_libs" = yes; then
3411
if test -n "$rpath"; then
3413
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3414
# these systems don't actually have a c library (as such)!
3416
*-*-rhapsody* | *-*-darwin1.[012])
3417
# Rhapsody C library is in the System framework
3418
deplibs="$deplibs -framework System"
3421
# Don't link with libc until the a.out ld.so is fixed.
3423
*-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3424
# Do not include libc due to us having libc/libc_r.
3425
test "X$arg" = "X-lc" && continue
3428
# Add libc to deplibs on all other systems if necessary.
3429
if test "$build_libtool_need_lc" = "yes"; then
3430
deplibs="$deplibs -lc"
3436
# Transform deplibs into only deplibs that can be linked in shared.
3438
libname_save=$libname
3439
release_save=$release
3440
versuffix_save=$versuffix
3442
# I'm not sure if I'm treating the release correctly. I think
3443
# release should show up in the -l (ie -lgmp5) so we don't want to
3444
# add it in twice. Is that correct?
3450
case $deplibs_check_method in
3452
# Don't check for shared/static. Everything works.
3453
# This might be a little naive. We might want to check
3454
# whether the library exists or not. But this is on
3455
# osf3 & osf4 and I'm not really sure... Just
3456
# implementing what was already the behavior.
3460
# This code stresses the "libraries are programs" paradigm to its
3461
# limits. Maybe even breaks it. We compile a program, linking it
3462
# against the deplibs as a proxy for the library. Then we can check
3463
# whether they linked in statically or dynamically with ldd.
3465
cat > conftest.c <<EOF
3466
int main() { return 0; }
3469
$LTCC -o conftest conftest.c $deplibs
3470
if test "$?" -eq 0 ; then
3471
ldd_output=`ldd conftest`
3472
for i in $deplibs; do
3473
name=`expr $i : '-l\(.*\)'`
3474
# If $name is empty we are operating on a -L argument.
3475
if test "$name" != "" && test "$name" -ne "0"; then
3476
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3477
case " $predeps $postdeps " in
3479
newdeplibs="$newdeplibs $i"
3484
if test -n "$i" ; then
3485
libname=`eval \\$echo \"$libname_spec\"`
3486
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3487
set dummy $deplib_matches
3489
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3490
newdeplibs="$newdeplibs $i"
3494
$echo "*** Warning: dynamic linker does not accept needed library $i."
3495
$echo "*** I have the capability to make that library automatically link in when"
3496
$echo "*** you link to this library. But I can only do this if you have a"
3497
$echo "*** shared version of the library, which I believe you do not have"
3498
$echo "*** because a test_compile did reveal that the linker did not use it for"
3499
$echo "*** its dynamic dependency list that programs get resolved with at runtime."
3503
newdeplibs="$newdeplibs $i"
3507
# Error occurred in the first compile. Let's try to salvage
3508
# the situation: Compile a separate program for each library.
3509
for i in $deplibs; do
3510
name=`expr $i : '-l\(.*\)'`
3511
# If $name is empty we are operating on a -L argument.
3512
if test "$name" != "" && test "$name" != "0"; then
3514
$LTCC -o conftest conftest.c $i
3516
if test "$?" -eq 0 ; then
3517
ldd_output=`ldd conftest`
3518
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3519
case " $predeps $postdeps " in
3521
newdeplibs="$newdeplibs $i"
3526
if test -n "$i" ; then
3527
libname=`eval \\$echo \"$libname_spec\"`
3528
deplib_matches=`eval \\$echo \"$library_names_spec\"`
3529
set dummy $deplib_matches
3531
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3532
newdeplibs="$newdeplibs $i"
3536
$echo "*** Warning: dynamic linker does not accept needed library $i."
3537
$echo "*** I have the capability to make that library automatically link in when"
3538
$echo "*** you link to this library. But I can only do this if you have a"
3539
$echo "*** shared version of the library, which you do not appear to have"
3540
$echo "*** because a test_compile did reveal that the linker did not use this one"
3541
$echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3547
$echo "*** Warning! Library $i is needed by this library but I was not able to"
3548
$echo "*** make it link in! You will probably need to install it or some"
3549
$echo "*** library that it depends on before this library will be fully"
3550
$echo "*** functional. Installing it before continuing would be even better."
3553
newdeplibs="$newdeplibs $i"
3559
set dummy $deplibs_check_method
3560
file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3561
for a_deplib in $deplibs; do
3562
name=`expr $a_deplib : '-l\(.*\)'`
3563
# If $name is empty we are operating on a -L argument.
3564
if test "$name" != "" && test "$name" != "0"; then
3565
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3566
case " $predeps $postdeps " in
3568
newdeplibs="$newdeplibs $a_deplib"
3573
if test -n "$a_deplib" ; then
3574
libname=`eval \\$echo \"$libname_spec\"`
3575
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3576
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3577
for potent_lib in $potential_libs; do
3578
# Follow soft links.
3579
if ls -lLd "$potent_lib" 2>/dev/null \
3580
| grep " -> " >/dev/null; then
3583
# The statement above tries to avoid entering an
3584
# endless loop below, in case of cyclic links.
3585
# We might still enter an endless loop, since a link
3586
# loop can be closed while we follow links,
3588
potlib="$potent_lib"
3589
while test -h "$potlib" 2>/dev/null; do
3590
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3592
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3593
*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3596
# It is ok to link against an archive when
3597
# building a shared library.
3598
if $AR -t $potlib > /dev/null 2>&1; then
3599
newdeplibs="$newdeplibs $a_deplib"
3603
if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3605
| $EGREP "$file_magic_regex" > /dev/null; then
3606
newdeplibs="$newdeplibs $a_deplib"
3613
if test -n "$a_deplib" ; then
3616
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3617
$echo "*** I have the capability to make that library automatically link in when"
3618
$echo "*** you link to this library. But I can only do this if you have a"
3619
$echo "*** shared version of the library, which you do not appear to have"
3620
$echo "*** because I did check the linker path looking for a file starting"
3621
if test -z "$potlib" ; then
3622
$echo "*** with $libname but no candidates were found. (...for file magic test)"
3624
$echo "*** with $libname and none of the candidates passed a file format test"
3625
$echo "*** using a file magic. Last file checked: $potlib"
3629
# Add a -L argument.
3630
newdeplibs="$newdeplibs $a_deplib"
3632
done # Gone through all deplibs.
3635
set dummy $deplibs_check_method
3636
match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3637
for a_deplib in $deplibs; do
3638
name=`expr $a_deplib : '-l\(.*\)'`
3639
# If $name is empty we are operating on a -L argument.
3640
if test -n "$name" && test "$name" != "0"; then
3641
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3642
case " $predeps $postdeps " in
3644
newdeplibs="$newdeplibs $a_deplib"
3649
if test -n "$a_deplib" ; then
3650
libname=`eval \\$echo \"$libname_spec\"`
3651
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3652
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3653
for potent_lib in $potential_libs; do
3654
potlib="$potent_lib" # see symlink-check above in file_magic test
3655
if eval $echo \"$potent_lib\" 2>/dev/null \
3657
| $EGREP "$match_pattern_regex" > /dev/null; then
3658
newdeplibs="$newdeplibs $a_deplib"
3665
if test -n "$a_deplib" ; then
3668
$echo "*** Warning: linker path does not have real file for library $a_deplib."
3669
$echo "*** I have the capability to make that library automatically link in when"
3670
$echo "*** you link to this library. But I can only do this if you have a"
3671
$echo "*** shared version of the library, which you do not appear to have"
3672
$echo "*** because I did check the linker path looking for a file starting"
3673
if test -z "$potlib" ; then
3674
$echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3676
$echo "*** with $libname and none of the candidates passed a file format test"
3677
$echo "*** using a regex pattern. Last file checked: $potlib"
3681
# Add a -L argument.
3682
newdeplibs="$newdeplibs $a_deplib"
3684
done # Gone through all deplibs.
3688
tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3689
-e 's/ -[LR][^ ]*//g'`
3690
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3691
for i in $predeps $postdeps ; do
3692
# can't use Xsed below, because $i might contain '/'
3693
tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3696
if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3697
| grep . >/dev/null; then
3699
if test "X$deplibs_check_method" = "Xnone"; then
3700
$echo "*** Warning: inter-library dependencies are not supported in this platform."
3702
$echo "*** Warning: inter-library dependencies are not known to be supported."
3704
$echo "*** All declared inter-library dependencies are being dropped."
3709
versuffix=$versuffix_save
3711
release=$release_save
3712
libname=$libname_save
3716
*-*-rhapsody* | *-*-darwin1.[012])
3717
# On Rhapsody replace the C library is the System framework
3718
newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3722
if test "$droppeddeps" = yes; then
3723
if test "$module" = yes; then
3725
$echo "*** Warning: libtool could not satisfy all declared inter-library"
3726
$echo "*** dependencies of module $libname. Therefore, libtool will create"
3727
$echo "*** a static module, that should work as long as the dlopening"
3728
$echo "*** application is linked with the -dlopen flag."
3729
if test -z "$global_symbol_pipe"; then
3731
$echo "*** However, this would only work if libtool was able to extract symbol"
3732
$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3733
$echo "*** not find such a program. So, this module is probably useless."
3734
$echo "*** \`nm' from GNU binutils and a full rebuild may help."
3736
if test "$build_old_libs" = no; then
3737
oldlibs="$output_objdir/$libname.$libext"
3738
build_libtool_libs=module
3741
build_libtool_libs=no
3744
$echo "*** The inter-library dependencies that have been dropped here will be"
3745
$echo "*** automatically added whenever a program is linked with this library"
3746
$echo "*** or is declared to -dlopen it."
3748
if test "$allow_undefined" = no; then
3750
$echo "*** Since this library must not contain undefined symbols,"
3751
$echo "*** because either the platform does not support them or"
3752
$echo "*** it was explicitly requested with -no-undefined,"
3753
$echo "*** libtool will only create a static version of it."
3754
if test "$build_old_libs" = no; then
3755
oldlibs="$output_objdir/$libname.$libext"
3756
build_libtool_libs=module
3759
build_libtool_libs=no
3764
# Done checking deplibs!
3768
# All the library-specific variables (install_libdir is set above).
3773
# Test again, we may have decided not to build it any more
3774
if test "$build_libtool_libs" = yes; then
3775
if test "$hardcode_into_libs" = yes; then
3776
# Hardcode the library paths
3779
rpath="$finalize_rpath"
3780
test "$mode" != relink && rpath="$compile_rpath$rpath"
3781
for libdir in $rpath; do
3782
if test -n "$hardcode_libdir_flag_spec"; then
3783
if test -n "$hardcode_libdir_separator"; then
3784
if test -z "$hardcode_libdirs"; then
3785
hardcode_libdirs="$libdir"
3787
# Just accumulate the unique libdirs.
3788
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3789
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3792
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3797
eval flag=\"$hardcode_libdir_flag_spec\"
3798
dep_rpath="$dep_rpath $flag"
3800
elif test -n "$runpath_var"; then
3801
case "$perm_rpath " in
3803
*) perm_rpath="$perm_rpath $libdir" ;;
3807
# Substitute the hardcoded libdirs into the rpath.
3808
if test -n "$hardcode_libdir_separator" &&
3809
test -n "$hardcode_libdirs"; then
3810
libdir="$hardcode_libdirs"
3811
if test -n "$hardcode_libdir_flag_spec_ld"; then
3812
eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3814
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3817
if test -n "$runpath_var" && test -n "$perm_rpath"; then
3818
# We should set the runpath_var.
3820
for dir in $perm_rpath; do
3823
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3825
test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3828
shlibpath="$finalize_shlibpath"
3829
test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3830
if test -n "$shlibpath"; then
3831
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3834
# Get the real and link names of the library.
3835
eval shared_ext=\"$shrext_cmds\"
3836
eval library_names=\"$library_names_spec\"
3837
set dummy $library_names
3841
if test -n "$soname_spec"; then
3842
eval soname=\"$soname_spec\"
3846
if test -z "$dlname"; then
3850
lib="$output_objdir/$realname"
3853
linknames="$linknames $link"
3856
# Use standard objects if they are pic
3857
test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3859
# Prepare the list of exported symbols
3860
if test -z "$export_symbols"; then
3861
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3862
$show "generating symbol list for \`$libname.la'"
3863
export_symbols="$output_objdir/$libname.exp"
3864
$run $rm $export_symbols
3865
cmds=$export_symbols_cmds
3866
save_ifs="$IFS"; IFS='~'
3867
for cmd in $cmds; do
3870
if len=`expr "X$cmd" : ".*"` &&
3871
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3873
$run eval "$cmd" || exit $?
3874
skipped_export=false
3876
# The command line is too long to execute in one step.
3877
$show "using reloadable object file for export list..."
3879
# Break out early, otherwise skipped_export may be
3880
# set to false by a later but shorter cmd.
3885
if test -n "$export_symbols_regex"; then
3886
$show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3887
$run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3888
$show "$mv \"${export_symbols}T\" \"$export_symbols\""
3889
$run eval '$mv "${export_symbols}T" "$export_symbols"'
3894
if test -n "$export_symbols" && test -n "$include_expsyms"; then
3895
$run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3899
for test_deplib in $deplibs; do
3900
case " $convenience " in
3901
*" $test_deplib "*) ;;
3903
tmp_deplibs="$tmp_deplibs $test_deplib"
3907
deplibs="$tmp_deplibs"
3909
if test -n "$convenience"; then
3910
if test -n "$whole_archive_flag_spec"; then
3911
save_libobjs=$libobjs
3912
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3914
gentop="$output_objdir/${outputname}x"
3915
generated="$generated $gentop"
3917
func_extract_archives $gentop $convenience
3918
libobjs="$libobjs $func_extract_archives_result"
3922
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3923
eval flag=\"$thread_safe_flag_spec\"
3924
linker_flags="$linker_flags $flag"
3927
# Make a backup of the uninstalled library when relinking
3928
if test "$mode" = relink; then
3929
$run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3932
# Do each of the archive commands.
3933
if test "$module" = yes && test -n "$module_cmds" ; then
3934
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3935
eval test_cmds=\"$module_expsym_cmds\"
3936
cmds=$module_expsym_cmds
3938
eval test_cmds=\"$module_cmds\"
3942
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3943
eval test_cmds=\"$archive_expsym_cmds\"
3944
cmds=$archive_expsym_cmds
3946
eval test_cmds=\"$archive_cmds\"
3951
if test "X$skipped_export" != "X:" &&
3952
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3953
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3956
# The command line is too long to link in one step, link piecewise.
3957
$echo "creating reloadable object files..."
3959
# Save the value of $output and $libobjs because we want to
3960
# use them later. If we have whole_archive_flag_spec, we
3961
# want to use save_libobjs as it was before
3962
# whole_archive_flag_spec was expanded, because we can't
3963
# assume the linker understands whole_archive_flag_spec.
3964
# This may have to be revisited, in case too many
3965
# convenience libraries get linked in and end up exceeding
3967
if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3968
save_libobjs=$libobjs
3971
output_la=`$echo "X$output" | $Xsed -e "$basename"`
3973
# Clear the reloadable object creation command queue and
3974
# initialize k to one.
3981
output=$output_objdir/$output_la-${k}.$objext
3982
# Loop over the list of objects to be linked.
3983
for obj in $save_libobjs
3985
eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3986
if test "X$objlist" = X ||
3987
{ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3988
test "$len" -le "$max_cmd_len"; }; then
3989
objlist="$objlist $obj"
3991
# The command $test_cmds is almost too long, add a
3992
# command to the queue.
3993
if test "$k" -eq 1 ; then
3994
# The first file doesn't have a previous command to add.
3995
eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3997
# All subsequent reloadable object files will link in
3998
# the last one created.
3999
eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4001
last_robj=$output_objdir/$output_la-${k}.$objext
4003
output=$output_objdir/$output_la-${k}.$objext
4008
# Handle the remaining objects by creating one last
4009
# reloadable object file. All subsequent reloadable object
4010
# files will link in the last one created.
4011
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4012
eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4014
if ${skipped_export-false}; then
4015
$show "generating symbol list for \`$libname.la'"
4016
export_symbols="$output_objdir/$libname.exp"
4017
$run $rm $export_symbols
4019
# Append the command to create the export file.
4020
eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4023
# Set up a command to remove the reloadable object files
4024
# after they are used.
4026
while test "$i" -lt "$k"
4029
delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4032
$echo "creating a temporary reloadable object file: $output"
4034
# Loop through the commands generated above and execute them.
4035
save_ifs="$IFS"; IFS='~'
4036
for cmd in $concat_cmds; do
4039
$run eval "$cmd" || exit $?
4044
# Restore the value of output.
4047
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4048
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4050
# Expand the library linking commands again to reset the
4051
# value of $libobjs for piecewise linking.
4053
# Do each of the archive commands.
4054
if test "$module" = yes && test -n "$module_cmds" ; then
4055
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4056
cmds=$module_expsym_cmds
4061
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4062
cmds=$archive_expsym_cmds
4068
# Append the command to remove the reloadable object files
4069
# to the just-reset $cmds.
4070
eval cmds=\"\$cmds~\$rm $delfiles\"
4072
save_ifs="$IFS"; IFS='~'
4073
for cmd in $cmds; do
4077
$run eval "$cmd" || {
4080
# Restore the uninstalled library and exit
4081
if test "$mode" = relink; then
4082
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4090
# Restore the uninstalled library and exit
4091
if test "$mode" = relink; then
4092
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4094
if test -n "$convenience"; then
4095
if test -z "$whole_archive_flag_spec"; then
4096
$show "${rm}r $gentop"
4097
$run ${rm}r "$gentop"
4104
# Create links to the real library.
4105
for linkname in $linknames; do
4106
if test "$realname" != "$linkname"; then
4107
$show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4108
$run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4112
# If -module or -export-dynamic was specified, set the dlname.
4113
if test "$module" = yes || test "$export_dynamic" = yes; then
4114
# On all known operating systems, these are identical.
4121
if test -n "$deplibs"; then
4122
$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4125
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4126
$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4129
if test -n "$rpath"; then
4130
$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4133
if test -n "$xrpath"; then
4134
$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4137
if test -n "$vinfo"; then
4138
$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4141
if test -n "$release"; then
4142
$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4147
if test -n "$objs$old_deplibs"; then
4148
$echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4152
obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4160
# Delete the old objects.
4161
$run $rm $obj $libobj
4163
# Objects from convenience libraries. This assumes
4164
# single-version convenience libraries. Whenever we create
4165
# different ones for PIC/non-PIC, this we'll have to duplicate
4169
# reload_cmds runs $LD directly, so let us get rid of
4170
# -Wl from whole_archive_flag_spec
4173
if test -n "$convenience"; then
4174
if test -n "$whole_archive_flag_spec"; then
4175
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4177
gentop="$output_objdir/${obj}x"
4178
generated="$generated $gentop"
4180
func_extract_archives $gentop $convenience
4181
reload_conv_objs="$reload_objs $func_extract_archives_result"
4185
# Create the old-style object.
4186
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
4190
save_ifs="$IFS"; IFS='~'
4191
for cmd in $cmds; do
4195
$run eval "$cmd" || exit $?
4199
# Exit if we aren't doing a library object file.
4200
if test -z "$libobj"; then
4201
if test -n "$gentop"; then
4202
$show "${rm}r $gentop"
4209
if test "$build_libtool_libs" != yes; then
4210
if test -n "$gentop"; then
4211
$show "${rm}r $gentop"
4215
# Create an invalid libtool object if no PIC, so that we don't
4216
# accidentally link it into a program.
4217
# $show "echo timestamp > $libobj"
4218
# $run eval "echo timestamp > $libobj" || exit $?
4222
if test -n "$pic_flag" || test "$pic_mode" != default; then
4223
# Only do commands if we really have different PIC objects.
4224
reload_objs="$libobjs $reload_conv_objs"
4227
save_ifs="$IFS"; IFS='~'
4228
for cmd in $cmds; do
4232
$run eval "$cmd" || exit $?
4237
if test -n "$gentop"; then
4238
$show "${rm}r $gentop"
4247
*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4249
if test -n "$vinfo"; then
4250
$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4253
if test -n "$release"; then
4254
$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4257
if test "$preload" = yes; then
4258
if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4259
test "$dlopen_self_static" = unknown; then
4260
$echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4265
*-*-rhapsody* | *-*-darwin1.[012])
4266
# On Rhapsody replace the C library is the System framework
4267
compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4268
finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4274
# Don't allow lazy linking, it breaks C++ global constructors
4275
if test "$tagname" = CXX ; then
4276
compile_command="$compile_command ${wl}-bind_at_load"
4277
finalize_command="$finalize_command ${wl}-bind_at_load"
4282
compile_command="$compile_command $compile_deplibs"
4283
finalize_command="$finalize_command $finalize_deplibs"
4285
if test -n "$rpath$xrpath"; then
4286
# If the user specified any rpath flags, then add them.
4287
for libdir in $rpath $xrpath; do
4288
# This is the magic to use -rpath.
4289
case "$finalize_rpath " in
4291
*) finalize_rpath="$finalize_rpath $libdir" ;;
4296
# Now hardcode the library paths
4299
for libdir in $compile_rpath $finalize_rpath; do
4300
if test -n "$hardcode_libdir_flag_spec"; then
4301
if test -n "$hardcode_libdir_separator"; then
4302
if test -z "$hardcode_libdirs"; then
4303
hardcode_libdirs="$libdir"
4305
# Just accumulate the unique libdirs.
4306
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4307
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4310
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4315
eval flag=\"$hardcode_libdir_flag_spec\"
4316
rpath="$rpath $flag"
4318
elif test -n "$runpath_var"; then
4319
case "$perm_rpath " in
4321
*) perm_rpath="$perm_rpath $libdir" ;;
4325
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4326
case :$dllsearchpath: in
4328
*) dllsearchpath="$dllsearchpath:$libdir";;
4333
# Substitute the hardcoded libdirs into the rpath.
4334
if test -n "$hardcode_libdir_separator" &&
4335
test -n "$hardcode_libdirs"; then
4336
libdir="$hardcode_libdirs"
4337
eval rpath=\" $hardcode_libdir_flag_spec\"
4339
compile_rpath="$rpath"
4343
for libdir in $finalize_rpath; do
4344
if test -n "$hardcode_libdir_flag_spec"; then
4345
if test -n "$hardcode_libdir_separator"; then
4346
if test -z "$hardcode_libdirs"; then
4347
hardcode_libdirs="$libdir"
4349
# Just accumulate the unique libdirs.
4350
case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4351
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4354
hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4359
eval flag=\"$hardcode_libdir_flag_spec\"
4360
rpath="$rpath $flag"
4362
elif test -n "$runpath_var"; then
4363
case "$finalize_perm_rpath " in
4365
*) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4369
# Substitute the hardcoded libdirs into the rpath.
4370
if test -n "$hardcode_libdir_separator" &&
4371
test -n "$hardcode_libdirs"; then
4372
libdir="$hardcode_libdirs"
4373
eval rpath=\" $hardcode_libdir_flag_spec\"
4375
finalize_rpath="$rpath"
4377
if test -n "$libobjs" && test "$build_old_libs" = yes; then
4378
# Transform all the library objects into standard objects.
4379
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4380
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4384
if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4385
if test -n "$NM" && test -n "$global_symbol_pipe"; then
4386
dlsyms="${outputname}S.c"
4388
$echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4392
if test -n "$dlsyms"; then
4396
# Discover the nlist of each of the dlfiles.
4397
nlist="$output_objdir/${outputname}.nm"
4399
$show "$rm $nlist ${nlist}S ${nlist}T"
4400
$run $rm "$nlist" "${nlist}S" "${nlist}T"
4402
# Parse the name list into a source file.
4403
$show "creating $output_objdir/$dlsyms"
4405
test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4406
/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4407
/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4413
/* Prevent the only kind of declaration conflicts we can make. */
4414
#define lt_preloaded_symbols some_other_symbol
4416
/* External symbol declarations for the compiler. */\
4419
if test "$dlself" = yes; then
4420
$show "generating symbol list for \`$output'"
4422
test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4424
# Add our own program objects to the symbol list.
4425
progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4426
for arg in $progfiles; do
4427
$show "extracting global C symbols from \`$arg'"
4428
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4431
if test -n "$exclude_expsyms"; then
4432
$run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4433
$run eval '$mv "$nlist"T "$nlist"'
4436
if test -n "$export_symbols_regex"; then
4437
$run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4438
$run eval '$mv "$nlist"T "$nlist"'
4441
# Prepare the list of exported symbols
4442
if test -z "$export_symbols"; then
4443
export_symbols="$output_objdir/$outputname.exp"
4444
$run $rm $export_symbols
4445
$run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4447
$run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4448
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4449
$run eval 'mv "$nlist"T "$nlist"'
4453
for arg in $dlprefiles; do
4454
$show "extracting global C symbols from \`$arg'"
4455
name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4456
$run eval '$echo ": $name " >> "$nlist"'
4457
$run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4460
if test -z "$run"; then
4461
# Make sure we have at least an empty file.
4462
test -f "$nlist" || : > "$nlist"
4464
if test -n "$exclude_expsyms"; then
4465
$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4466
$mv "$nlist"T "$nlist"
4469
# Try sorting and uniquifying the output.
4470
if grep -v "^: " < "$nlist" |
4471
if sort -k 3 </dev/null >/dev/null 2>&1; then
4476
uniq > "$nlist"S; then
4479
grep -v "^: " < "$nlist" > "$nlist"S
4482
if test -f "$nlist"S; then
4483
eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4485
$echo '/* NONE */' >> "$output_objdir/$dlsyms"
4488
$echo >> "$output_objdir/$dlsyms" "\
4490
#undef lt_preloaded_symbols
4492
#if defined (__STDC__) && __STDC__
4493
# define lt_ptr void *
4495
# define lt_ptr char *
4499
/* The mapping between symbol names and symbols. */
4503
*cygwin* | *mingw* )
4504
$echo >> "$output_objdir/$dlsyms" "\
4505
/* DATA imports from DLLs on WIN32 can't be const, because
4506
runtime relocations are performed -- see ld's documentation
4512
$echo >> "$output_objdir/$dlsyms" "\
4519
$echo >> "$output_objdir/$dlsyms" "\
4523
lt_preloaded_symbols[] =
4527
eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4529
$echo >> "$output_objdir/$dlsyms" "\
4533
/* This works around a problem in FreeBSD linker */
4534
#ifdef FREEBSD_WORKAROUND
4535
static const void *lt_preloaded_setup() {
4536
return lt_preloaded_symbols;
4546
pic_flag_for_symtable=
4548
# compiling the symbol table file with pic_flag works around
4549
# a FreeBSD bug that causes programs to crash when -lm is
4550
# linked before any other PIC object. But we must not use
4551
# pic_flag when linking with -static. The problem exists in
4552
# FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4553
*-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4554
case "$compile_command " in
4556
*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4559
case "$compile_command " in
4561
*) pic_flag_for_symtable=" $pic_flag";;
4565
# Now compile the dynamic symbol file.
4566
$show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4567
$run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4569
# Clean up the generated files.
4570
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4571
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4573
# Transform the symbol file into the correct name.
4574
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4575
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4578
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4583
# We keep going just in case the user didn't refer to
4584
# lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4585
# really was required.
4587
# Nullify the symbol file.
4588
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4589
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4592
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4593
# Replace the output file specification.
4594
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4595
link_command="$compile_command$compile_rpath"
4597
# We have no uninstalled library dependencies, so finalize right now.
4598
$show "$link_command"
4599
$run eval "$link_command"
4602
# Delete the generated files.
4603
if test -n "$dlsyms"; then
4604
$show "$rm $output_objdir/${outputname}S.${objext}"
4605
$run $rm "$output_objdir/${outputname}S.${objext}"
4611
if test -n "$shlibpath_var"; then
4612
# We should set the shlibpath_var
4614
for dir in $temp_rpath; do
4616
[\\/]* | [A-Za-z]:[\\/]*)
4621
# Relative path: add a thisdir entry.
4622
rpath="$rpath\$thisdir/$dir:"
4629
if test -n "$compile_shlibpath$finalize_shlibpath"; then
4630
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4632
if test -n "$finalize_shlibpath"; then
4633
finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4638
if test -n "$runpath_var"; then
4639
if test -n "$perm_rpath"; then
4640
# We should set the runpath_var.
4642
for dir in $perm_rpath; do
4645
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4647
if test -n "$finalize_perm_rpath"; then
4648
# We should set the runpath_var.
4650
for dir in $finalize_perm_rpath; do
4653
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4657
if test "$no_install" = yes; then
4658
# We don't need to create a wrapper script.
4659
link_command="$compile_var$compile_command$compile_rpath"
4660
# Replace the output file specification.
4661
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4662
# Delete the old output file.
4664
# Link the executable and exit
4665
$show "$link_command"
4666
$run eval "$link_command" || exit $?
4670
if test "$hardcode_action" = relink; then
4671
# Fast installation is not supported
4672
link_command="$compile_var$compile_command$compile_rpath"
4673
relink_command="$finalize_var$finalize_command$finalize_rpath"
4675
$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4676
$echo "$modename: \`$output' will be relinked during installation" 1>&2
4678
if test "$fast_install" != no; then
4679
link_command="$finalize_var$compile_command$finalize_rpath"
4680
if test "$fast_install" = yes; then
4681
relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4683
# fast_install is set to needless
4687
link_command="$compile_var$compile_command$compile_rpath"
4688
relink_command="$finalize_var$finalize_command$finalize_rpath"
4692
# Replace the output file specification.
4693
link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4695
# Delete the old output files.
4696
$run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4698
$show "$link_command"
4699
$run eval "$link_command" || exit $?
4701
# Now create the wrapper script.
4702
$show "creating $output"
4704
# Quote the relink command for shipping.
4705
if test -n "$relink_command"; then
4706
# Preserve any variables that may affect compiler behavior
4707
for var in $variables_saved_for_relink; do
4708
if eval test -z \"\${$var+set}\"; then
4709
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4710
elif eval var_value=\$$var; test -z "$var_value"; then
4711
relink_command="$var=; export $var; $relink_command"
4713
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4714
relink_command="$var=\"$var_value\"; export $var; $relink_command"
4717
relink_command="(cd `pwd`; $relink_command)"
4718
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4721
# Quote $echo for shipping.
4722
if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4724
[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4725
*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4727
qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4729
qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4732
# Only actually do things if our run command is non-null.
4733
if test -z "$run"; then
4734
# win32 will think the script is a binary if it has
4735
# a .exe suffix, so we strip it off here.
4737
*.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4739
# test for cygwin because mv fails w/o .exe extensions
4743
outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4747
*cygwin* | *mingw* )
4748
cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4749
cwrapper=`$echo ${output}.exe`
4750
$rm $cwrappersource $cwrapper
4751
trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4753
cat > $cwrappersource <<EOF
4755
/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4756
Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4758
The $output program cannot be directly executed until all the libtool
4759
libraries that it depends on are installed.
4761
This wrapper executable should never be moved out of the build directory.
4762
If it is, it will not operate correctly.
4764
Currently, it simply execs the wrapper *script* "/bin/sh $output",
4765
but could eventually absorb all of the scripts functionality and
4766
exec $objdir/$outputname directly.
4769
cat >> $cwrappersource<<"EOF"
4777
#if defined(PATH_MAX)
4778
# define LT_PATHMAX PATH_MAX
4779
#elif defined(MAXPATHLEN)
4780
# define LT_PATHMAX MAXPATHLEN
4782
# define LT_PATHMAX 1024
4785
#ifndef DIR_SEPARATOR
4786
#define DIR_SEPARATOR '/'
4789
#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4791
#define HAVE_DOS_BASED_FILE_SYSTEM
4792
#ifndef DIR_SEPARATOR_2
4793
#define DIR_SEPARATOR_2 '\\'
4797
#ifndef DIR_SEPARATOR_2
4798
# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4799
#else /* DIR_SEPARATOR_2 */
4800
# define IS_DIR_SEPARATOR(ch) \
4801
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4802
#endif /* DIR_SEPARATOR_2 */
4804
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4805
#define XFREE(stale) do { \
4806
if (stale) { free ((void *) stale); stale = 0; } \
4809
const char *program_name = NULL;
4811
void * xmalloc (size_t num);
4812
char * xstrdup (const char *string);
4813
char * basename (const char *name);
4814
char * fnqualify(const char *path);
4815
char * strendzap(char *str, const char *pat);
4816
void lt_fatal (const char *message, ...);
4819
main (int argc, char *argv[])
4824
program_name = (char *) xstrdup ((char *) basename (argv[0]));
4825
newargz = XMALLOC(char *, argc+2);
4828
cat >> $cwrappersource <<EOF
4829
newargz[0] = "$SHELL";
4832
cat >> $cwrappersource <<"EOF"
4833
newargz[1] = fnqualify(argv[0]);
4834
/* we know the script has the same name, without the .exe */
4835
/* so make sure newargz[1] doesn't end in .exe */
4836
strendzap(newargz[1],".exe");
4837
for (i = 1; i < argc; i++)
4838
newargz[i+1] = xstrdup(argv[i]);
4839
newargz[argc+1] = NULL;
4842
cat >> $cwrappersource <<EOF
4843
execv("$SHELL",newargz);
4846
cat >> $cwrappersource <<"EOF"
4851
xmalloc (size_t num)
4853
void * p = (void *) malloc (num);
4855
lt_fatal ("Memory exhausted");
4861
xstrdup (const char *string)
4863
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4868
basename (const char *name)
4872
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4873
/* Skip over the disk name in MSDOS pathnames. */
4874
if (isalpha (name[0]) && name[1] == ':')
4878
for (base = name; *name; name++)
4879
if (IS_DIR_SEPARATOR (*name))
4881
return (char *) base;
4885
fnqualify(const char *path)
4889
char tmp[LT_PATHMAX + 1];
4891
assert(path != NULL);
4893
/* Is it qualified already? */
4894
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4895
if (isalpha (path[0]) && path[1] == ':')
4896
return xstrdup (path);
4898
if (IS_DIR_SEPARATOR (path[0]))
4899
return xstrdup (path);
4901
/* prepend the current directory */
4902
/* doesn't handle '~' */
4903
if (getcwd (tmp, LT_PATHMAX) == NULL)
4904
lt_fatal ("getcwd failed");
4905
size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4906
p = XMALLOC(char, size);
4907
sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4912
strendzap(char *str, const char *pat)
4916
assert(str != NULL);
4917
assert(pat != NULL);
4920
patlen = strlen(pat);
4924
str += len - patlen;
4925
if (strcmp(str, pat) == 0)
4932
lt_error_core (int exit_status, const char * mode,
4933
const char * message, va_list ap)
4935
fprintf (stderr, "%s: %s: ", program_name, mode);
4936
vfprintf (stderr, message, ap);
4937
fprintf (stderr, ".\n");
4939
if (exit_status >= 0)
4944
lt_fatal (const char *message, ...)
4947
va_start (ap, message);
4948
lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4952
# we should really use a build-platform specific compiler
4953
# here, but OTOH, the wrappers (shell script and this C one)
4954
# are only useful if you want to execute the "real" binary.
4955
# Since the "real" binary is built for $host, then this
4956
# wrapper might as well be built for $host, too.
4957
$run $LTCC -s -o $cwrapper $cwrappersource
4961
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4966
# $output - temporary wrapper script for $objdir/$outputname
4967
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4969
# The $output program cannot be directly executed until all the libtool
4970
# libraries that it depends on are installed.
4972
# This wrapper script should never be moved out of the build directory.
4973
# If it is, it will not operate correctly.
4975
# Sed substitution that helps us do robust quoting. It backslashifies
4976
# metacharacters that are still active within double-quoted strings.
4977
Xsed='${SED} -e 1s/^X//'
4978
sed_quote_subst='$sed_quote_subst'
4980
# The HP-UX ksh and POSIX shell print the target directory to stdout
4982
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4984
relink_command=\"$relink_command\"
4986
# This environment variable determines our operation mode.
4987
if test \"\$libtool_install_magic\" = \"$magic\"; then
4988
# install mode needs the following variable:
4989
notinst_deplibs='$notinst_deplibs'
4991
# When we are sourced in execute mode, \$file and \$echo are already set.
4992
if test \"\$libtool_execute_magic\" != \"$magic\"; then
4995
# Make sure echo works.
4996
if test \"X\$1\" = X--no-reexec; then
4997
# Discard the --no-reexec flag, and continue.
4999
elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5000
# Yippee, \$echo works!
5003
# Restart under the correct shell, and then maybe \$echo will work.
5004
exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5010
# Find the directory that this script lives in.
5011
thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5012
test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5014
# Follow symbolic links until we get to the real thisdir.
5015
file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5016
while test -n \"\$file\"; do
5017
destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5019
# If there was a directory component, then change thisdir.
5020
if test \"x\$destdir\" != \"x\$file\"; then
5021
case \"\$destdir\" in
5022
[\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5023
*) thisdir=\"\$thisdir/\$destdir\" ;;
5027
file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5028
file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5031
# Try to get the absolute directory name.
5032
absdir=\`cd \"\$thisdir\" && pwd\`
5033
test -n \"\$absdir\" && thisdir=\"\$absdir\"
5036
if test "$fast_install" = yes; then
5038
program=lt-'$outputname'$exeext
5039
progdir=\"\$thisdir/$objdir\"
5041
if test ! -f \"\$progdir/\$program\" || \\
5042
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5043
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5045
file=\"\$\$-\$program\"
5047
if test ! -d \"\$progdir\"; then
5048
$mkdir \"\$progdir\"
5050
$rm \"\$progdir/\$file\"
5055
# relink executable if necessary
5056
if test -n \"\$relink_command\"; then
5057
if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5059
$echo \"\$relink_command_output\" >&2
5060
$rm \"\$progdir/\$file\"
5065
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5066
{ $rm \"\$progdir/\$program\";
5067
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5068
$rm \"\$progdir/\$file\"
5072
program='$outputname'
5073
progdir=\"\$thisdir/$objdir\"
5079
if test -f \"\$progdir/\$program\"; then"
5081
# Export our shlibpath_var if we have one.
5082
if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5084
# Add our own library path to $shlibpath_var
5085
$shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5087
# Some systems cannot cope with colon-terminated $shlibpath_var
5088
# The second colon is a workaround for a bug in BeOS R4 sed
5089
$shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5091
export $shlibpath_var
5095
# fixup the dll searchpath if we need to.
5096
if test -n "$dllsearchpath"; then
5098
# Add the dll search path components to the executable PATH
5099
PATH=$dllsearchpath:\$PATH
5104
if test \"\$libtool_execute_magic\" != \"$magic\"; then
5105
# Run the actual program with our arguments.
5107
# Make sure env LD_LIBRARY_PATH does not mess us up
5108
if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5109
export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5113
# Backslashes separate directories on plain windows
5114
*-*-mingw | *-*-os2*)
5116
exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5122
exec \"\$progdir/\$program\" \${1+\"\$@\"}
5127
\$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5131
# The program doesn't exist.
5132
\$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5133
\$echo \"This script is just a wrapper for \$program.\" 1>&2
5134
$echo \"See the $PACKAGE documentation for more information.\" 1>&2
5145
# See if we need to build an old-fashioned archive.
5146
for oldlib in $oldlibs; do
5148
if test "$build_libtool_libs" = convenience; then
5149
oldobjs="$libobjs_save"
5150
addlibs="$convenience"
5151
build_libtool_libs=no
5153
if test "$build_libtool_libs" = module; then
5154
oldobjs="$libobjs_save"
5155
build_libtool_libs=no
5157
oldobjs="$old_deplibs $non_pic_objects"
5159
addlibs="$old_convenience"
5162
if test -n "$addlibs"; then
5163
gentop="$output_objdir/${outputname}x"
5164
generated="$generated $gentop"
5166
func_extract_archives $gentop $addlibs
5167
oldobjs="$oldobjs $func_extract_archives_result"
5170
# Do each command in the archive commands.
5171
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5172
cmds=$old_archive_from_new_cmds
5174
# POSIX demands no paths to be encoded in archives. We have
5175
# to avoid creating archives with duplicate basenames if we
5176
# might have to extract them afterwards, e.g., when creating a
5177
# static archive out of a convenience library, or when linking
5178
# the entirety of a libtool archive into another (currently
5179
# not supported by libtool).
5180
if (for obj in $oldobjs
5182
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5183
done | sort | sort -uc >/dev/null 2>&1); then
5186
$echo "copying selected object files to avoid basename conflicts..."
5188
if test -z "$gentop"; then
5189
gentop="$output_objdir/${outputname}x"
5190
generated="$generated $gentop"
5192
$show "${rm}r $gentop"
5193
$run ${rm}r "$gentop"
5194
$show "$mkdir $gentop"
5195
$run $mkdir "$gentop"
5197
if test "$status" -ne 0 && test ! -d "$gentop"; then
5202
save_oldobjs=$oldobjs
5205
for obj in $save_oldobjs
5207
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5208
case " $oldobjs " in
5209
" ") oldobjs=$obj ;;
5212
# Make sure we don't pick an alternate name that also
5214
newobj=lt$counter-$objbase
5215
counter=`expr $counter + 1`
5216
case " $oldobjs " in
5217
*[\ /]"$newobj "*) ;;
5218
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5221
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5222
$run ln "$obj" "$gentop/$newobj" ||
5223
$run cp "$obj" "$gentop/$newobj"
5224
oldobjs="$oldobjs $gentop/$newobj"
5226
*) oldobjs="$oldobjs $obj" ;;
5231
eval cmds=\"$old_archive_cmds\"
5233
if len=`expr "X$cmds" : ".*"` &&
5234
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5235
cmds=$old_archive_cmds
5237
# the command line is too long to link in one step, link in parts
5238
$echo "using piecewise archive linking..."
5243
save_oldobjs=$oldobjs
5245
# Is there a better way of finding the last object in the list?
5246
for obj in $save_oldobjs
5250
for obj in $save_oldobjs
5252
oldobjs="$objlist $obj"
5253
objlist="$objlist $obj"
5254
eval test_cmds=\"$old_archive_cmds\"
5255
if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5256
test "$len" -le "$max_cmd_len"; then
5259
# the above command should be used before it gets too long
5261
if test "$obj" = "$last_oldobj" ; then
5264
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5265
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5271
if test "X$oldobjs" = "X" ; then
5272
eval cmds=\"\$concat_cmds\"
5274
eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5278
save_ifs="$IFS"; IFS='~'
5279
for cmd in $cmds; do
5283
$run eval "$cmd" || exit $?
5288
if test -n "$generated"; then
5289
$show "${rm}r$generated"
5290
$run ${rm}r$generated
5293
# Now create the libtool archive.
5297
test "$build_old_libs" = yes && old_library="$libname.$libext"
5298
$show "creating $output"
5300
# Preserve any variables that may affect compiler behavior
5301
for var in $variables_saved_for_relink; do
5302
if eval test -z \"\${$var+set}\"; then
5303
relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5304
elif eval var_value=\$$var; test -z "$var_value"; then
5305
relink_command="$var=; export $var; $relink_command"
5307
var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5308
relink_command="$var=\"$var_value\"; export $var; $relink_command"
5311
# Quote the link command for shipping.
5312
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5313
relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5314
if test "$hardcode_automatic" = yes ; then
5319
# Only create the output if not a dry run.
5320
if test -z "$run"; then
5321
for installed in no yes; do
5322
if test "$installed" = yes; then
5323
if test -z "$install_libdir"; then
5326
output="$output_objdir/$outputname"i
5327
# Replace all uninstalled libtool libraries with the installed ones
5329
for deplib in $dependency_libs; do
5332
name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5333
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5334
if test -z "$libdir"; then
5335
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5338
if test "X$EGREP" = X ; then
5341
# We do not want portage's install root ($D) present. Check only for
5342
# this if the .la is being installed.
5343
if test "$installed" = yes && test "$D"; then
5344
eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5346
mynewdependency_lib="$libdir/$name"
5348
# Do not add duplicates
5349
if test "$mynewdependency_lib"; then
5350
my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5351
if test -z "$my_little_ninja_foo_1"; then
5352
newdependency_libs="$newdependency_libs $mynewdependency_lib"
5357
if test "$installed" = yes; then
5358
# Rather use S=WORKDIR if our version of portage supports it.
5359
# This is because some ebuild (gcc) do not use $S as buildroot.
5360
if test "$PWORKDIR"; then
5363
# We do not want portage's build root ($S) present.
5364
my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5365
# We do not want portage's install root ($D) present.
5366
my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5367
if test -n "$my_little_ninja_foo_2" && test "$S"; then
5368
mynewdependency_lib=""
5369
elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5370
eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5372
mynewdependency_lib="$deplib"
5375
mynewdependency_lib="$deplib"
5377
# Do not add duplicates
5378
if test "$mynewdependency_lib"; then
5379
my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5380
if test -z "$my_little_ninja_foo_4"; then
5381
newdependency_libs="$newdependency_libs $mynewdependency_lib"
5387
dependency_libs="$newdependency_libs"
5389
for lib in $dlfiles; do
5390
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5391
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5392
if test -z "$libdir"; then
5393
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5396
newdlfiles="$newdlfiles $libdir/$name"
5398
dlfiles="$newdlfiles"
5400
for lib in $dlprefiles; do
5401
name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5402
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5403
if test -z "$libdir"; then
5404
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5407
newdlprefiles="$newdlprefiles $libdir/$name"
5409
dlprefiles="$newdlprefiles"
5412
for lib in $dlfiles; do
5414
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5415
*) abs=`pwd`"/$lib" ;;
5417
newdlfiles="$newdlfiles $abs"
5419
dlfiles="$newdlfiles"
5421
for lib in $dlprefiles; do
5423
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5424
*) abs=`pwd`"/$lib" ;;
5426
newdlprefiles="$newdlprefiles $abs"
5428
dlprefiles="$newdlprefiles"
5431
# place dlname in correct position for cygwin
5433
case $host,$output,$installed,$module,$dlname in
5434
*cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5436
# Do not add duplicates
5437
if test "$installed" = yes && test "$D"; then
5438
install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5441
# $outputname - a libtool library file
5442
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5444
# Please DO NOT delete this file!
5445
# It is necessary for linking the library.
5447
# The name that we can dlopen(3).
5450
# Names of this library.
5451
library_names='$library_names'
5453
# The name of the static archive.
5454
old_library='$old_library'
5456
# Libraries that this one depends upon.
5457
dependency_libs='$dependency_libs'
5459
# Version information for $libname.
5464
# Is this an already installed library?
5465
installed=$installed
5467
# Should we warn about portability when linking against -modules?
5468
shouldnotlink=$module
5470
# Files to dlopen/dlpreopen
5472
dlpreopen='$dlprefiles'
5474
# Directory that this library needs to be installed in:
5475
libdir='$install_libdir'"
5476
if test "$installed" = no && test "$need_relink" = yes; then
5478
relink_command=\"$relink_command\""
5483
# Do a symbolic link so that the libtool archive can be found in
5484
# LD_LIBRARY_PATH before the program is installed.
5485
$show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5486
$run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5492
# libtool install mode
5494
modename="$modename: install"
5496
# There may be an optional sh(1) argument at the beginning of
5497
# install_prog (especially on Windows NT).
5498
if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5499
# Allow the use of GNU shtool's install command.
5500
$echo "X$nonopt" | grep shtool > /dev/null; then
5501
# Aesthetically quote it.
5502
arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5504
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5508
install_prog="$arg "
5516
# The real first argument should be the name of the installation program.
5517
# Aesthetically quote it.
5518
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5520
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5524
install_prog="$install_prog$arg"
5526
# We need to accept at least all the BSD install flags.
5536
if test -n "$dest"; then
5537
files="$files $dest"
5545
case " $install_prog " in
5550
-g | -m | -o) prev=$arg ;;
5558
# If the previous option needed an argument, then skip it.
5559
if test -n "$prev"; then
5568
# Aesthetically quote the argument.
5569
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5571
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5575
install_prog="$install_prog $arg"
5578
if test -z "$install_prog"; then
5579
$echo "$modename: you must specify an install program" 1>&2
5584
if test -n "$prev"; then
5585
$echo "$modename: the \`$prev' option requires an argument" 1>&2
5590
if test -z "$files"; then
5591
if test -z "$dest"; then
5592
$echo "$modename: no file or destination specified" 1>&2
5594
$echo "$modename: you must specify a destination" 1>&2
5600
# Strip any trailing slash from the destination.
5601
dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5603
# Check to see that the destination is a directory.
5604
test -d "$dest" && isdir=yes
5605
if test "$isdir" = yes; then
5609
destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5610
test "X$destdir" = "X$dest" && destdir=.
5611
destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5613
# Not a directory, so check to see that there is only one file specified.
5615
if test "$#" -gt 2; then
5616
$echo "$modename: \`$dest' is not a directory" 1>&2
5622
[\\/]* | [A-Za-z]:[\\/]*) ;;
5624
for file in $files; do
5628
$echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5637
# This variable tells wrapper scripts just to set variables rather
5638
# than running their programs.
5639
libtool_install_magic="$magic"
5644
for file in $files; do
5646
# Do each installation.
5649
# Do the static libraries later.
5650
staticlibs="$staticlibs $file"
5654
# Check to see that this really is a libtool archive.
5655
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5657
$echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5665
# If there is no directory component, then add one.
5667
*/* | *\\*) . $file ;;
5671
# Add the libdir to current_libdirs if it is the destination.
5672
if test "X$destdir" = "X$libdir"; then
5673
case "$current_libdirs " in
5675
*) current_libdirs="$current_libdirs $libdir" ;;
5678
# Note the libdir as a future libdir.
5679
case "$future_libdirs " in
5681
*) future_libdirs="$future_libdirs $libdir" ;;
5685
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5686
test "X$dir" = "X$file/" && dir=
5689
if test -n "$relink_command"; then
5690
# Determine the prefix the user has applied to our future dir.
5691
inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5693
# Don't allow the user to place us outside of our expected
5694
# location b/c this prevents finding dependent libraries that
5695
# are installed to the same prefix.
5696
# At present, this check doesn't affect windows .dll's that
5697
# are installed into $libdir/../bin (currently, that works fine)
5698
# but it's something to keep an eye on.
5699
if test "$inst_prefix_dir" = "$destdir"; then
5700
$echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5704
if test -n "$inst_prefix_dir"; then
5705
# Stick the inst_prefix_dir data into the link command.
5706
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5708
relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5711
$echo "$modename: warning: relinking \`$file'" 1>&2
5712
$show "$relink_command"
5713
if $run eval "$relink_command"; then :
5715
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5720
# See the names of the shared library.
5721
set dummy $library_names
5722
if test -n "$2"; then
5728
test -n "$relink_command" && srcname="$realname"T
5730
# Install the shared library and build the symlinks.
5731
$show "$install_prog $dir/$srcname $destdir/$realname"
5732
$run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5733
if test -n "$stripme" && test -n "$striplib"; then
5734
$show "$striplib $destdir/$realname"
5735
$run eval "$striplib $destdir/$realname" || exit $?
5738
if test "$#" -gt 0; then
5739
# Delete the old symlinks, and create new ones.
5740
# Try `ln -sf' first, because the `ln' binary might depend on
5741
# the symlink we replace! Solaris /bin/ln does not understand -f,
5742
# so we also need to try rm && ln -s.
5745
if test "$linkname" != "$realname"; then
5746
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5747
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5752
# Do each command in the postinstall commands.
5753
lib="$destdir/$realname"
5754
cmds=$postinstall_cmds
5755
save_ifs="$IFS"; IFS='~'
5756
for cmd in $cmds; do
5760
$run eval "$cmd" || {
5763
# Restore the uninstalled library and exit
5764
if test "$mode" = relink; then
5765
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5774
# Install the pseudo-library for information purposes.
5775
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5776
instname="$dir/$name"i
5777
$show "$install_prog $instname $destdir/$name"
5778
$run eval "$install_prog $instname $destdir/$name" || exit $?
5780
# Maybe install the static library, too.
5781
test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5785
# Install (i.e. copy) a libtool object.
5787
# Figure out destination file name, if it wasn't already specified.
5788
if test -n "$destname"; then
5789
destfile="$destdir/$destname"
5791
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5792
destfile="$destdir/$destfile"
5795
# Deduce the name of the destination old-style object file.
5798
staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5801
staticdest="$destfile"
5805
$echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5811
# Install the libtool object if requested.
5812
if test -n "$destfile"; then
5813
$show "$install_prog $file $destfile"
5814
$run eval "$install_prog $file $destfile" || exit $?
5817
# Install the old object if enabled.
5818
if test "$build_old_libs" = yes; then
5819
# Deduce the name of the old-style object file.
5820
staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5822
$show "$install_prog $staticobj $staticdest"
5823
$run eval "$install_prog \$staticobj \$staticdest" || exit $?
5829
# Figure out destination file name, if it wasn't already specified.
5830
if test -n "$destname"; then
5831
destfile="$destdir/$destname"
5833
destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5834
destfile="$destdir/$destfile"
5837
# If the file is missing, and there is a .exe on the end, strip it
5838
# because it is most likely a libtool script we actually want to
5843
if test ! -f "$file"; then
5844
file=`$echo $file|${SED} 's,.exe$,,'`
5850
# Do a test to see if this is really a libtool program.
5853
wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5859
if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5863
# Note that it is not necessary on cygwin/mingw to append a dot to
5864
# foo even if both foo and FILE.exe exist: automatic-append-.exe
5865
# behavior happens only for exec(3), not for open(2)! Also, sourcing
5866
# `FILE.' does not work on cygwin managed mounts.
5868
# If there is no directory component, then add one.
5870
*/* | *\\*) . ${wrapper} ;;
5871
*) . ./${wrapper} ;;
5874
# Check the variables that should have been set.
5875
if test -z "$notinst_deplibs"; then
5876
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5881
for lib in $notinst_deplibs; do
5882
# Check to see that each library is installed.
5884
if test -f "$lib"; then
5885
# If there is no directory component, then add one.
5887
*/* | *\\*) . $lib ;;
5891
libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5892
if test -n "$libdir" && test ! -f "$libfile"; then
5893
$echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5899
# Note that it is not necessary on cygwin/mingw to append a dot to
5900
# foo even if both foo and FILE.exe exist: automatic-append-.exe
5901
# behavior happens only for exec(3), not for open(2)! Also, sourcing
5902
# `FILE.' does not work on cygwin managed mounts.
5904
# If there is no directory component, then add one.
5906
*/* | *\\*) . ${wrapper} ;;
5907
*) . ./${wrapper} ;;
5911
if test "$fast_install" = no && test -n "$relink_command"; then
5912
if test "$finalize" = yes && test -z "$run"; then
5914
test -n "$TMPDIR" && tmpdir="$TMPDIR"
5915
tmpdir="$tmpdir/libtool-$$"
5918
if $mkdir "$tmpdir"; then
5922
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5925
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5926
outputname="$tmpdir/$file"
5927
# Replace the output file specification.
5928
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5930
$show "$relink_command"
5931
if $run eval "$relink_command"; then :
5933
$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5939
$echo "$modename: warning: cannot relink \`$file'" 1>&2
5942
# Install the binary that we compiled earlier.
5943
file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5947
# remove .exe since cygwin /usr/bin/install will append another
5949
case $install_prog,$host in
5950
*/usr/bin/install*,*cygwin*)
5951
case $file:$destfile in
5956
destfile=$destfile.exe
5959
destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5964
$show "$install_prog$stripme $file $destfile"
5965
$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5966
test -n "$outputname" && ${rm}r "$tmpdir"
5971
for file in $staticlibs; do
5972
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5974
# Set up the ranlib parameters.
5975
oldlib="$destdir/$name"
5977
$show "$install_prog $file $oldlib"
5978
$run eval "$install_prog \$file \$oldlib" || exit $?
5980
if test -n "$stripme" && test -n "$old_striplib"; then
5981
$show "$old_striplib $oldlib"
5982
$run eval "$old_striplib $oldlib" || exit $?
5985
# Do each command in the postinstall commands.
5986
cmds=$old_postinstall_cmds
5987
save_ifs="$IFS"; IFS='~'
5988
for cmd in $cmds; do
5992
$run eval "$cmd" || exit $?
5997
if test -n "$future_libdirs"; then
5998
$echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6001
if test -n "$current_libdirs"; then
6002
# Maybe just do a dry run.
6003
test -n "$run" && current_libdirs=" -n$current_libdirs"
6004
exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6010
# libtool finish mode
6012
modename="$modename: finish"
6016
if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6019
libdirs="$libdirs $dir"
6022
for libdir in $libdirs; do
6023
if test -n "$finish_cmds"; then
6024
# Do each command in the finish commands.
6026
save_ifs="$IFS"; IFS='~'
6027
for cmd in $cmds; do
6031
$run eval "$cmd" || admincmds="$admincmds
6036
if test -n "$finish_eval"; then
6037
# Do the single finish_eval.
6038
eval cmds=\"$finish_eval\"
6039
$run eval "$cmds" || admincmds="$admincmds
6045
# Exit here if they wanted silent mode.
6046
test "$show" = : && exit $EXIT_SUCCESS
6048
$echo "----------------------------------------------------------------------"
6049
$echo "Libraries have been installed in:"
6050
for libdir in $libdirs; do
6054
$echo "If you ever happen to want to link against installed libraries"
6055
$echo "in a given directory, LIBDIR, you must either use libtool, and"
6056
$echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6057
$echo "flag during linking and do at least one of the following:"
6058
if test -n "$shlibpath_var"; then
6059
$echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6060
$echo " during execution"
6062
if test -n "$runpath_var"; then
6063
$echo " - add LIBDIR to the \`$runpath_var' environment variable"
6064
$echo " during linking"
6066
if test -n "$hardcode_libdir_flag_spec"; then
6068
eval flag=\"$hardcode_libdir_flag_spec\"
6070
$echo " - use the \`$flag' linker flag"
6072
if test -n "$admincmds"; then
6073
$echo " - have your system administrator run these commands:$admincmds"
6075
if test -f /etc/ld.so.conf; then
6076
$echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6079
$echo "See any operating system documentation about shared libraries for"
6080
$echo "more information, such as the ld(1) and ld.so(8) manual pages."
6081
$echo "----------------------------------------------------------------------"
6085
# libtool execute mode
6087
modename="$modename: execute"
6089
# The first argument is the command name.
6091
if test -z "$cmd"; then
6092
$echo "$modename: you must specify a COMMAND" 1>&2
6097
# Handle -dlopen flags immediately.
6098
for file in $execute_dlfiles; do
6099
if test ! -f "$file"; then
6100
$echo "$modename: \`$file' is not a file" 1>&2
6108
# Check to see that this really is a libtool archive.
6109
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6111
$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6116
# Read the libtool library.
6120
# If there is no directory component, then add one.
6122
*/* | *\\*) . $file ;;
6126
# Skip this library if it cannot be dlopened.
6127
if test -z "$dlname"; then
6128
# Warn if it was a shared library.
6129
test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6133
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6134
test "X$dir" = "X$file" && dir=.
6136
if test -f "$dir/$objdir/$dlname"; then
6139
$echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6145
# Just add the directory containing the .lo file.
6146
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6147
test "X$dir" = "X$file" && dir=.
6151
$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6156
# Get the absolute pathname.
6157
absdir=`cd "$dir" && pwd`
6158
test -n "$absdir" && dir="$absdir"
6160
# Now add the directory to shlibpath_var.
6161
if eval "test -z \"\$$shlibpath_var\""; then
6162
eval "$shlibpath_var=\"\$dir\""
6164
eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6168
# This variable tells wrapper scripts just to set shlibpath_var
6169
# rather than running their programs.
6170
libtool_execute_magic="$magic"
6172
# Check if any of the arguments is a wrapper script.
6179
# Do a test to see if this is really a libtool program.
6180
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6181
# If there is no directory component, then add one.
6183
*/* | *\\*) . $file ;;
6187
# Transform arg to wrapped name.
6188
file="$progdir/$program"
6192
# Quote arguments (to preserve shell metacharacters).
6193
file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6194
args="$args \"$file\""
6197
if test -z "$run"; then
6198
if test -n "$shlibpath_var"; then
6199
# Export the shlibpath_var.
6200
eval "export $shlibpath_var"
6203
# Restore saved environment variables
6204
if test "${save_LC_ALL+set}" = set; then
6205
LC_ALL="$save_LC_ALL"; export LC_ALL
6207
if test "${save_LANG+set}" = set; then
6208
LANG="$save_LANG"; export LANG
6211
# Now prepare to actually exec the command.
6212
exec_cmd="\$cmd$args"
6214
# Display what would be done.
6215
if test -n "$shlibpath_var"; then
6216
eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6217
$echo "export $shlibpath_var"
6224
# libtool clean and uninstall mode
6226
modename="$modename: $mode"
6232
# This variable tells wrapper scripts just to set variables rather
6233
# than running their programs.
6234
libtool_install_magic="$magic"
6239
-f) rm="$rm $arg"; rmforce=yes ;;
6240
-*) rm="$rm $arg" ;;
6241
*) files="$files $arg" ;;
6245
if test -z "$rm"; then
6246
$echo "$modename: you must specify an RM program" 1>&2
6253
origobjdir="$objdir"
6254
for file in $files; do
6255
dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6256
if test "X$dir" = "X$file"; then
6258
objdir="$origobjdir"
6260
objdir="$dir/$origobjdir"
6262
name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6263
test "$mode" = uninstall && objdir="$dir"
6265
# Remember objdir for removal later, being careful to avoid duplicates
6266
if test "$mode" = clean; then
6269
*) rmdirs="$rmdirs $objdir" ;;
6273
# Don't error if the file doesn't exist and rm -f was used.
6274
if (test -L "$file") >/dev/null 2>&1 \
6275
|| (test -h "$file") >/dev/null 2>&1 \
6276
|| test -f "$file"; then
6278
elif test -d "$file"; then
6281
elif test "$rmforce" = yes; then
6289
# Possibly a libtool archive, so verify it.
6290
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6293
# Delete the libtool libraries and symlinks.
6294
for n in $library_names; do
6295
rmfiles="$rmfiles $objdir/$n"
6297
test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6298
test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6300
if test "$mode" = uninstall; then
6301
if test -n "$library_names"; then
6302
# Do each command in the postuninstall commands.
6303
cmds=$postuninstall_cmds
6304
save_ifs="$IFS"; IFS='~'
6305
for cmd in $cmds; do
6310
if test "$?" -ne 0 && test "$rmforce" != yes; then
6317
if test -n "$old_library"; then
6318
# Do each command in the old_postuninstall commands.
6319
cmds=$old_postuninstall_cmds
6320
save_ifs="$IFS"; IFS='~'
6321
for cmd in $cmds; do
6326
if test "$?" -ne 0 && test "$rmforce" != yes; then
6332
# FIXME: should reinstall the best remaining shared library.
6338
# Possibly a libtool object, so verify it.
6339
if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6344
# Add PIC object to the list of files to remove.
6345
if test -n "$pic_object" \
6346
&& test "$pic_object" != none; then
6347
rmfiles="$rmfiles $dir/$pic_object"
6350
# Add non-PIC object to the list of files to remove.
6351
if test -n "$non_pic_object" \
6352
&& test "$non_pic_object" != none; then
6353
rmfiles="$rmfiles $dir/$non_pic_object"
6359
if test "$mode" = clean ; then
6363
file=`$echo $file|${SED} 's,.exe$,,'`
6364
noexename=`$echo $name|${SED} 's,.exe$,,'`
6365
# $file with .exe has already been added to rmfiles,
6366
# add $file without .exe
6367
rmfiles="$rmfiles $file"
6370
# Do a test to see if this is a libtool program.
6371
if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6375
# note $name still contains .exe if it was in $file originally
6376
# as does the version of $file that was added into $rmfiles
6377
rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6378
if test "$fast_install" = yes && test -n "$relink_command"; then
6379
rmfiles="$rmfiles $objdir/lt-$name"
6381
if test "X$noexename" != "X$name" ; then
6382
rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6388
$show "$rm $rmfiles"
6389
$run $rm $rmfiles || exit_status=1
6391
objdir="$origobjdir"
6393
# Try to remove the ${objdir}s in the directories where we deleted files
6394
for dir in $rmdirs; do
6395
if test -d "$dir"; then
6397
$run rmdir $dir >/dev/null 2>&1
6405
$echo "$modename: you must specify a MODE" 1>&2
6406
$echo "$generic_help" 1>&2
6411
if test -z "$exec_cmd"; then
6412
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6413
$echo "$generic_help" 1>&2
6416
fi # test -z "$show_help"
6418
if test -n "$exec_cmd"; then
6423
# We need to display help for each of the modes.
6426
"Usage: $modename [OPTION]... [MODE-ARG]...
6428
Provide generalized library-building support services.
6430
--config show all configuration variables
6431
--debug enable verbose shell tracing
6432
-n, --dry-run display commands without modifying any files
6433
--features display basic configuration information and exit
6434
--finish same as \`--mode=finish'
6435
--help display this help message and exit
6436
--mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6437
--quiet same as \`--silent'
6438
--silent don't print informational messages
6439
--tag=TAG use configuration variables from tag TAG
6440
--version print version information
6442
MODE must be one of the following:
6444
clean remove files from the build directory
6445
compile compile a source file into a libtool object
6446
execute automatically set library path, then run a program
6447
finish complete the installation of libtool libraries
6448
install install libraries or executables
6449
link create a library or an executable
6450
uninstall remove libraries from an installed directory
6452
MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6453
a more detailed description of MODE.
6455
Report bugs to <bug-libtool@gnu.org>."
6461
"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6463
Remove files from the build directory.
6465
RM is the name of the program to use to delete files associated with each FILE
6466
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6469
If FILE is a libtool library, object or program, all the files associated
6470
with it are deleted. Otherwise, only FILE itself is deleted using RM."
6475
"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6477
Compile a source file into a libtool library object.
6479
This mode accepts the following additional options:
6481
-o OUTPUT-FILE set the output file name to OUTPUT-FILE
6482
-prefer-pic try to building PIC objects only
6483
-prefer-non-pic try to building non-PIC objects only
6484
-static always build a \`.o' file suitable for static linking
6486
COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6487
from the given SOURCEFILE.
6489
The output file name is determined by removing the directory component from
6490
SOURCEFILE, then substituting the C source code suffix \`.c' with the
6491
library object suffix, \`.lo'."
6496
"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6498
Automatically set library path, then run a program.
6500
This mode accepts the following additional options:
6502
-dlopen FILE add the directory containing FILE to the library path
6504
This mode sets the library path environment variable according to \`-dlopen'
6507
If any of the ARGS are libtool executable wrappers, then they are translated
6508
into their corresponding uninstalled binary, and any of their required library
6509
directories are added to the library path.
6511
Then, COMMAND is executed, with ARGS as arguments."
6516
"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6518
Complete the installation of libtool libraries.
6520
Each LIBDIR is a directory that contains libtool libraries.
6522
The commands that this mode executes may require superuser privileges. Use
6523
the \`--dry-run' option if you just want to see what would be executed."
6528
"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6530
Install executables or libraries.
6532
INSTALL-COMMAND is the installation command. The first component should be
6533
either the \`install' or \`cp' program.
6535
The rest of the components are interpreted as arguments to that command (only
6536
BSD-compatible install options are recognized)."
6541
"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6543
Link object files or libraries together to form another library, or to
6544
create an executable program.
6546
LINK-COMMAND is a command using the C compiler that you would use to create
6547
a program from several object files.
6549
The following components of LINK-COMMAND are treated specially:
6551
-all-static do not do any dynamic linking at all
6552
-avoid-version do not add a version suffix if possible
6553
-dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6554
-dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6555
-export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6556
-export-symbols SYMFILE
6557
try to export only the symbols listed in SYMFILE
6558
-export-symbols-regex REGEX
6559
try to export only the symbols matching REGEX
6560
-LLIBDIR search LIBDIR for required installed libraries
6561
-lNAME OUTPUT-FILE requires the installed library libNAME
6562
-module build a library that can dlopened
6563
-no-fast-install disable the fast-install mode
6564
-no-install link a not-installable executable
6565
-no-undefined declare that a library does not refer to external symbols
6566
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6567
-objectlist FILE Use a list of object files found in FILE to specify objects
6568
-precious-files-regex REGEX
6569
don't remove output files matching REGEX
6570
-release RELEASE specify package release information
6571
-rpath LIBDIR the created library will eventually be installed in LIBDIR
6572
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6573
-static do not do any dynamic linking of libtool libraries
6574
-version-info CURRENT[:REVISION[:AGE]]
6575
specify library version info [each variable defaults to 0]
6577
All other options (arguments beginning with \`-') are ignored.
6579
Every other argument is treated as a filename. Files ending in \`.la' are
6580
treated as uninstalled libtool libraries, other files are standard or library
6583
If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6584
only library objects (\`.lo' files) may be specified, and \`-rpath' is
6585
required, except when creating a convenience library.
6587
If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6588
using \`ar' and \`ranlib', or on Windows using \`lib'.
6590
If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6591
is created, otherwise an executable program is created."
6596
"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6598
Remove libraries from an installation directory.
6600
RM is the name of the program to use to delete files associated with each FILE
6601
(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6604
If FILE is a libtool library, all the files associated with it are deleted.
6605
Otherwise, only FILE itself is deleted using RM."
6609
$echo "$modename: invalid operation mode \`$mode'" 1>&2
6616
$echo "Try \`$modename --help' for more information about other modes."
6620
# The TAGs below are defined such that we never get into a situation
6621
# in which we disable both kinds of libraries. Given conflicting
6622
# choices, we go for a static library, that is the most portable,
6623
# since we can't tell whether shared libraries were disabled because
6624
# the user asked for that or because the platform doesn't support
6625
# them. This is particularly important on AIX, because we don't
6626
# support having both static and shared libraries enabled at the same
6627
# time on that platform, so we default to a shared-only configuration.
6628
# If a disable-shared tag is given, we'll fallback to a static-only
6629
# configuration. But we'll never go from static-only to shared-only.
6631
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6632
build_libtool_libs=no
6634
# ### END LIBTOOL TAG CONFIG: disable-shared
6636
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6637
build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6638
# ### END LIBTOOL TAG CONFIG: disable-static