1
1
# ltmain.sh - Provide generalized library-building support services.
2
2
# NOTE: Changing this file will not affect anything until you rerun configure.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
# Free Software Foundation, Inc.
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5
# 2007, 2008 Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8
8
# This program is free software; you can redistribute it and/or modify
18
18
# You should have received a copy of the GNU General Public License
19
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
22
# As a special exception to the GNU General Public License, if you
23
23
# distribute this file as part of a program that contains a
24
24
# configuration script generated by Autoconf, you may include it under
25
25
# the same distribution terms that you use for the rest of that program.
29
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30
# is ksh but when the shell is invoked as "sh" and the current value of
31
# the _XPG environment variable is not equal to 1 (one), the special
32
# positional parameter $0, within a function call, is the name of the
36
# The name of this program:
37
progname=`echo "$progpath" | $SED $basename`
46
VERSION="1.5.26 Debian 1.5.26-1ubuntu1"
47
TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
49
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
53
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54
# is contrary to our usage. Disable this feature.
55
alias -g '${1+"$@"}'='"$@"'
58
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
60
BIN_SH=xpg4; export BIN_SH # for Tru64
61
DUALCASE=1; export DUALCASE # for MKS sh
27
63
# Check that we have a working $echo.
28
64
if test "X$1" = X--no-reexec; then
29
65
# Discard the --no-reexec flag, and continue.
86
113
# These must not be set unconditionally because not all systems understand
87
114
# e.g. LANG=C (notably SCO).
88
115
# We save the old values to restore during execute mode.
89
if test "${LC_ALL+set}" = set; then
90
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
92
if test "${LANG+set}" = set; then
93
save_LANG="$LANG"; LANG=C; export LANG
117
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
119
eval "if test \"\${$lt_var+set}\" = set; then
120
save_$lt_var=\$$lt_var
121
lt_env=\"$lt_var=\$$lt_var \$lt_env\"
127
if test -n "$lt_env"; then
96
131
# Make sure IFS has a sensible default
99
136
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100
137
$echo "$modename: not configured to build any kind of library" 1>&2
101
138
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
105
142
# Global variables.
114
153
lo2o="s/\\.lo\$/.${objext}/"
115
154
o2lo="s/\\.${objext}\$/.lo/"
117
158
#####################################
118
159
# Shell function definitions:
119
160
# This seems to be the best place for them
162
# func_mktempdir [string]
163
# Make a temporary directory that won't clash with other running
164
# libtool processes, and avoids race conditions if possible. If
165
# given, STRING is the basename for that directory.
168
my_template="${TMPDIR-/tmp}/${1-$progname}"
170
if test "$run" = ":"; then
171
# Return a directory name, but don't create it in dry-run mode
172
my_tmpdir="${my_template}-$$"
175
# If mktemp works, use that first and foremost
176
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
178
if test ! -d "$my_tmpdir"; then
179
# Failing that, at least try and use $RANDOM to avoid a race
180
my_tmpdir="${my_template}-${RANDOM-0}$$"
182
save_mktempdir_umask=`umask`
185
umask $save_mktempdir_umask
188
# If we're not in dry-run mode, bomb out on failure
189
test -d "$my_tmpdir" || {
190
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
195
$echo "X$my_tmpdir" | $Xsed
199
# func_win32_libid arg
200
# return the library type of file 'arg'
121
202
# Need a lot of goo to handle *both* DLLs and import libs
122
203
# Has to be a shell function in order to 'eat' the argument
123
204
# that is supplied when $file_magic_command is called.
125
207
win32_libid_type="unknown"
126
208
win32_fileres=`file -L $1 2>/dev/null`
127
209
case $win32_fileres in
131
213
*ar\ archive*) # could be an import, or static
132
214
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
215
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134
216
win32_nmres=`eval $NM -f posix -A $1 | \
135
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136
if test "X$win32_nmres" = "Ximport" ; then
137
win32_libid_type="x86 archive import"
139
win32_libid_type="x86 archive static"
225
import*) win32_libid_type="x86 archive import";;
226
*) win32_libid_type="x86 archive static";;
144
231
win32_libid_type="x86 DLL"
146
233
*executable*) # but shell scripts are "executable" too...
154
241
$echo $win32_libid_type
246
# Infer tagged configuration to use if any are available and
247
# if one wasn't chosen via the "--tag" command line option.
248
# Only attempt this if the compiler in the base compile
249
# command doesn't match the default compiler.
250
# arg is usually of the form 'gcc ...'
253
if test -n "$available_tags" && test -z "$tagname"; then
257
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
261
CC_quoted="$CC_quoted $arg"
264
# Blanks in the command may have been stripped by the calling shell,
265
# but not from the CC environment variable when configure was run.
266
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267
# Blanks at the start of $base_compile will cause this to fail
268
# if we don't check for them as well.
270
for z in $available_tags; do
271
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272
# Evaluate the configuration.
273
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
276
# Double-quote args containing other shell metacharacters.
278
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
282
CC_quoted="$CC_quoted $arg"
285
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286
# The compiler in the base compile command matches
287
# the one in the tagged configuration.
288
# Assume this is the tagged configuration we want.
295
# If $tagname still isn't set, then no tagged configuration
296
# was found and let the user know that the "--tag" command
297
# line option must be used.
298
if test -z "$tagname"; then
299
$echo "$modename: unable to infer tagged configuration"
300
$echo "$modename: specify a tag with \`--tag'" 1>&2
303
# $echo "$modename: using $tagname tagged configuration"
311
# func_extract_an_archive dir oldlib
312
func_extract_an_archive ()
314
f_ex_an_ar_dir="$1"; shift
315
f_ex_an_ar_oldlib="$1"
317
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
322
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
327
# func_extract_archives gentop oldlib ...
328
func_extract_archives ()
330
my_gentop="$1"; shift
338
$show "${rm}r $my_gentop"
339
$run ${rm}r "$my_gentop"
340
$show "$mkdir $my_gentop"
341
$run $mkdir "$my_gentop"
343
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
347
for my_xlib in $my_oldlibs; do
348
# Extract the objects.
350
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351
*) my_xabs=`pwd`"/$my_xlib" ;;
353
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
356
case " $extracted_archives " in
358
extracted_serial=`expr $extracted_serial + 1`
359
my_xlib_u=lt$extracted_serial-$my_xlib ;;
363
extracted_archives="$extracted_archives $my_xlib_u"
364
my_xdir="$my_gentop/$my_xlib_u"
366
$show "${rm}r $my_xdir"
367
$run ${rm}r "$my_xdir"
368
$show "$mkdir $my_xdir"
369
$run $mkdir "$my_xdir"
371
if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
376
$show "Extracting $my_xabs"
377
# Do not bother doing anything if just a dry run
378
if test -z "$run"; then
379
darwin_orig_dir=`pwd`
380
cd $my_xdir || exit $?
381
darwin_archive=$my_xabs
383
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385
if test -n "$darwin_arches"; then
386
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
388
$show "$darwin_base_archive has multiple architectures $darwin_arches"
389
for darwin_arch in $darwin_arches ; do
390
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
395
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396
done # $darwin_arches
397
## Okay now we have a bunch of thin objects, gotta fatten them up :)
398
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
401
for darwin_file in $darwin_filelist; do
402
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403
lipo -create -output "$darwin_file" $darwin_files
404
done # $darwin_filelist
406
cd "$darwin_orig_dir"
408
cd "$darwin_orig_dir"
409
func_extract_an_archive "$my_xdir" "$my_xabs"
414
func_extract_an_archive "$my_xdir" "$my_xabs"
417
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
419
func_extract_archives_result="$my_oldobjs"
157
421
# End of Shell function definitions
158
422
#####################################
425
eval std_shrext=\"$shrext_cmds\"
160
429
# Parse our command line options once, thoroughly.
161
430
while test "$#" -gt 0
221
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
223
$echo "Copyright (C) 2003 Free Software Foundation, Inc."
224
$echo "This is free software; see the source for copying conditions. There is NO"
225
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
492
$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
494
Copyright (C) 2008 Free Software Foundation, Inc.
495
This is free software; see the source for copying conditions. There is NO
496
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
230
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
501
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
231
502
# Now print the configurations for the tags.
232
503
for tagname in $taglist; do
233
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
504
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
239
510
$echo "$progname: enabling shell trace mode"
512
preserve_args="$preserve_args $arg"
511
803
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
513
805
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
518
# Infer tagged configuration to use if any are available and
519
# if one wasn't chosen via the "--tag" command line option.
520
# Only attempt this if the compiler in the base compile
521
# command doesn't match the default compiler.
522
if test -n "$available_tags" && test -z "$tagname"; then
523
case $base_compile in
524
# Blanks in the command may have been stripped by the calling shell,
525
# but not from the CC environment variable when configure was run.
526
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
527
# Blanks at the start of $base_compile will cause this to fail
528
# if we don't check for them as well.
530
for z in $available_tags; do
531
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
532
# Evaluate the configuration.
533
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
534
case "$base_compile " in
535
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
536
# The compiler in the base compile command matches
537
# the one in the tagged configuration.
538
# Assume this is the tagged configuration we want.
545
# If $tagname still isn't set, then no tagged configuration
546
# was found and let the user know that the "--tag" command
547
# line option must be used.
548
if test -z "$tagname"; then
549
$echo "$modename: unable to infer tagged configuration"
550
$echo "$modename: specify a tag with \`--tag'" 1>&2
553
# $echo "$modename: using $tagname tagged configuration"
810
func_infer_tag $base_compile
812
for arg in $later; do
831
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
833
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834
qlibobj="\"$qlibobj\"" ;;
836
test "X$libobj" != "X$qlibobj" \
837
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
838
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
559
839
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
560
840
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
561
841
if test "X$xdir" = "X$obj"; then
1171
single_module="${wl}-single_module"
1173
func_infer_tag $base_compile
883
1175
# We need to know -static, to get the right output filenames.
887
-all-static | -static)
888
if test "X$arg" = "X-all-static"; then
1179
-all-static | -static | -static-libtool-libs)
889
1182
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
890
1183
$echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
892
1185
if test -n "$link_static_flag"; then
893
1186
dlopen_self=$dlopen_self_static
896
if test -z "$pic_flag" && test -n "$link_static_flag"; then
897
dlopen_self=$dlopen_self_static
1188
prefer_static_libs=yes
1191
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192
dlopen_self=$dlopen_self_static
1194
prefer_static_libs=built
1196
-static-libtool-libs)
1197
if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198
dlopen_self=$dlopen_self_static
1200
prefer_static_libs=yes
900
1203
build_libtool_libs=no
901
1204
build_old_libs=yes
902
prefer_static_libs=yes
1640
# Tru64 UNIX uses -model [arg] to determine the layout of C++
1641
# classes, name mangling, and exception handling.
1643
compile_command="$compile_command $arg"
1644
compiler_flags="$compiler_flags $arg"
1645
finalize_command="$finalize_command $arg"
1650
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651
compiler_flags="$compiler_flags $arg"
1652
compile_command="$compile_command $arg"
1653
finalize_command="$finalize_command $arg"
1658
single_module="${wl}-multi_module"
1295
# gcc -m* arguments should be passed to the linker via $compiler_flags
1296
# in order to pass architecture information to the linker
1297
# (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1298
# but this is not reliable with gcc because gcc may use -mfoo to
1299
# select a different linker, different libraries, etc, while
1300
# -Wl,-mfoo simply passes -mfoo to the linker.
1667
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1668
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1669
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1670
# +DA*, +DD* enable 64-bit mode on the HP compiler
1671
# -q* pass through compiler args for the IBM compiler
1672
# -m* pass through architecture-specific compiler args for GCC
1673
# -m*, -t[45]*, -txscale* pass through architecture-specific
1674
# compiler args for GCC
1675
# -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1676
# -F/path gives path to uninstalled frameworks, gcc on darwin
1677
# @file GCC response files
1678
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1679
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1302
1681
# Unknown arguments in both finalize_command and compile_command need
1303
1682
# to be aesthetically quoted because they are evaled later.
1304
1683
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1616
2003
if test -n "$prev"; then
1617
2004
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1618
2005
$echo "$help" 1>&2
1622
# Infer tagged configuration to use if any are available and
1623
# if one wasn't chosen via the "--tag" command line option.
1624
# Only attempt this if the compiler in the base link
1625
# command doesn't match the default compiler.
1626
if test -n "$available_tags" && test -z "$tagname"; then
1627
case $base_compile in
1628
# Blanks in the command may have been stripped by the calling shell,
1629
# but not from the CC environment variable when configure was run.
1630
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1631
# Blanks at the start of $base_compile will cause this to fail
1632
# if we don't check for them as well.
1634
for z in $available_tags; do
1635
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1636
# Evaluate the configuration.
1637
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1638
case $base_compile in
1639
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1640
# The compiler in $compile_command matches
1641
# the one in the tagged configuration.
1642
# Assume this is the tagged configuration we want.
1649
# If $tagname still isn't set, then no tagged configuration
1650
# was found and let the user know that the "--tag" command
1651
# line option must be used.
1652
if test -z "$tagname"; then
1653
$echo "$modename: unable to infer tagged configuration"
1654
$echo "$modename: specify a tag with \`--tag'" 1>&2
1657
# $echo "$modename: using $tagname tagged configuration"
1663
2009
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1804
2152
case $deplib in
2153
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2154
if test "$linkmode,$pass" = "prog,link"; then
2155
compile_deplibs="$deplib $compile_deplibs"
2156
finalize_deplibs="$deplib $finalize_deplibs"
2158
compiler_flags="$compiler_flags $deplib"
1806
2163
if test "$linkmode" != lib && test "$linkmode" != prog; then
1807
2164
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1810
if test "$pass" = conv; then
1811
deplibs="$deplib $deplibs"
1814
2167
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1815
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1816
# Search the libtool library
1817
lib="$searchdir/lib${name}.la"
1818
if test -f "$lib"; then
2168
if test "$linkmode" = lib; then
2169
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2171
searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2173
for searchdir in $searchdirs; do
2174
for search_ext in .la $std_shrext .so .a; do
2175
# Search the libtool library
2176
lib="$searchdir/lib${name}${search_ext}"
2177
if test -f "$lib"; then
2178
if test "$search_ext" = ".la"; then
1823
2187
if test "$found" != yes; then
1824
2188
# deplib doesn't seem to be a libtool library
2161
2552
if test "$linkmode,$pass" = "prog,link"; then
2162
2553
if test -n "$library_names" &&
2163
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2554
{ { test "$prefer_static_libs" = no ||
2555
test "$prefer_static_libs,$installed" = "built,yes"; } ||
2556
test -z "$old_library"; }; then
2164
2557
# We need to hardcode the library path
2165
if test -n "$shlibpath_var"; then
2558
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2166
2559
# Make sure the rpath contains only unique directories.
2167
2560
case "$temp_rpath " in
2169
2562
*" $absdir "*) ;;
2170
*) temp_rpath="$temp_rpath $dir" ;;
2563
*) temp_rpath="$temp_rpath $absdir" ;;
2206
2599
link_static=no # Whether the deplib will be linked statically
2600
use_static_libs=$prefer_static_libs
2601
if test "$use_static_libs" = built && test "$installed" = yes ; then
2207
2604
if test -n "$library_names" &&
2208
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2605
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
2209
2606
if test "$installed" = no; then
2210
2607
notinst_deplibs="$notinst_deplibs $lib"
2211
2608
need_relink=yes
2213
2610
# This is a shared library
2215
# Warn about portability, can't link against -module's on some systems (darwin)
2216
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2612
# Warn about portability, can't link against -module's on
2613
# some systems (darwin)
2614
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2218
2616
if test "$linkmode" = prog; then
2219
2617
$echo "*** Warning: Linking the executable $output against the loadable module"
2221
2619
$echo "*** Warning: Linking the shared library $output against the loadable module"
2223
$echo "*** $linklib is not portable!"
2621
$echo "*** $linklib is not portable!"
2225
2623
if test "$linkmode" = lib &&
2226
2624
test "$hardcode_into_libs" = yes; then
2227
2625
# Hardcode the library path.
2315
2715
if test "$hardcode_direct" = no; then
2316
2716
add="$dir/$linklib"
2318
*-*-sco3.2v5* ) add_dir="-L$dir" ;;
2718
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2719
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
2720
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2721
*-*-unixware7*) add_dir="-L$dir" ;;
2320
# if the lib is a module then we can not link against it, someone
2321
# is ignoring the new warnings I added
2322
if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2723
# if the lib is a module then we can not link against
2724
# it, someone is ignoring the new warnings I added
2725
if /usr/bin/file -L $add 2> /dev/null |
2726
$EGREP ": [^:]* bundle" >/dev/null ; then
2323
2727
$echo "** Warning, lib $linklib is a module, not a shared library"
2324
2728
if test -z "$old_library" ; then
2562
# we do not want to link against static libs, but need to link against shared
2966
# we do not want to link against static libs,
2967
# but need to link against shared
2563
2968
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2969
eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2564
2970
if test -n "$deplibrary_names" ; then
2565
2971
for tmp in $deplibrary_names ; do
2568
if test -f "$path/$depdepl" ; then
2974
if test -f "$deplibdir/$depdepl" ; then
2975
depdepl="$deplibdir/$depdepl"
2976
elif test -f "$path/$depdepl" ; then
2569
2977
depdepl="$path/$depdepl"
2571
newlib_search_path="$newlib_search_path $path"
2979
# Can't find it, oh well...
2982
# do not add paths which are already there
2983
case " $newlib_search_path " in
2985
*) newlib_search_path="$newlib_search_path $path";;
2584
# Again, we only want to link against shared libraries
2585
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2586
for tmp in $newlib_search_path ; do
2587
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2588
eval depdepl="$tmp/lib$tmp_libs.dylib"
2998
# Again, we only want to link against shared libraries
2999
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3000
for tmp in $newlib_search_path ; do
3001
if test -f "$tmp/lib$tmp_libs.dylib" ; then
3002
eval depdepl="$tmp/lib$tmp_libs.dylib"
2599
3013
case " $deplibs " in
3015
*) deplibs="$path $deplibs" ;;
3017
case " $deplibs " in
2600
3018
*" $depdepl "*) ;;
2601
*) deplibs="$deplibs $depdepl" ;;
2603
case " $deplibs " in
2605
*) deplibs="$deplibs $path" ;;
3019
*) deplibs="$depdepl $deplibs" ;;
2608
3022
fi # link_all_deplibs != no
2867
3289
# Check that each of the things are valid numbers.
2868
3290
case $current in
2869
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3291
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]) ;;
2871
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3293
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2872
3294
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2877
3299
case $revision in
2878
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3300
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]) ;;
2880
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3302
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2881
3303
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2887
0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3309
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]) ;;
2889
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3311
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2890
3312
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2895
3317
if test "$age" -gt "$current"; then
2896
3318
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2897
3319
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2901
3323
# Calculate the version variables.
3593
4064
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3595
4066
gentop="$output_objdir/${outputname}x"
3596
$show "${rm}r $gentop"
3597
$run ${rm}r "$gentop"
3598
$show "$mkdir $gentop"
3599
$run $mkdir "$gentop"
3601
if test "$status" -ne 0 && test ! -d "$gentop"; then
3604
4067
generated="$generated $gentop"
3606
for xlib in $convenience; do
3607
# Extract the objects.
3609
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3610
*) xabs=`pwd`"/$xlib" ;;
3612
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3613
xdir="$gentop/$xlib"
3615
$show "${rm}r $xdir"
3617
$show "$mkdir $xdir"
3620
if test "$status" -ne 0 && test ! -d "$xdir"; then
3623
# We will extract separately just the conflicting names and we will no
3624
# longer touch any unique names. It is faster to leave these extract
3625
# automatically by $AR in one run.
3626
$show "(cd $xdir && $AR x $xabs)"
3627
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3628
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3631
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3632
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3633
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3636
while test "$i" -le "$count"
3638
# Put our $i before any first dot (extension)
3639
# Never overwrite any file
3641
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3643
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3645
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3646
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3652
libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4069
func_extract_archives $gentop $convenience
4070
libobjs="$libobjs $func_extract_archives_result"
3657
4074
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3658
4075
eval flag=\"$thread_safe_flag_spec\"
3659
4076
linker_flags="$linker_flags $flag"
3667
4084
# Do each of the archive commands.
3668
4085
if test "$module" = yes && test -n "$module_cmds" ; then
3669
4086
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3670
eval cmds=\"$module_expsym_cmds\"
4087
eval test_cmds=\"$module_expsym_cmds\"
4088
cmds=$module_expsym_cmds
3672
eval cmds=\"$module_cmds\"
4090
eval test_cmds=\"$module_cmds\"
3675
4094
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3676
eval cmds=\"$archive_expsym_cmds\"
4095
eval test_cmds=\"$archive_expsym_cmds\"
4096
cmds=$archive_expsym_cmds
3678
eval cmds=\"$archive_cmds\"
4098
eval test_cmds=\"$archive_cmds\"
3682
if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
4103
if test "X$skipped_export" != "X:" &&
4104
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3683
4105
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3780
4203
# value of $libobjs for piecewise linking.
3782
4205
# Do each of the archive commands.
4206
if test "$module" = yes && test -n "$module_cmds" ; then
4207
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4208
cmds=$module_expsym_cmds
3783
4213
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3784
eval cmds=\"$archive_expsym_cmds\"
4214
cmds=$archive_expsym_cmds
3786
eval cmds=\"$archive_cmds\"
3789
4220
# Append the command to remove the reloadable object files
3790
4221
# to the just-reset $cmds.
3791
eval cmds=\"\$cmds~$rm $delfiles\"
4222
eval cmds=\"\$cmds~\$rm $delfiles\"
3793
4224
save_ifs="$IFS"; IFS='~'
3794
4225
for cmd in $cmds; do
3795
4226
IFS="$save_ifs"
3797
$run eval "$cmd" || exit $?
4229
$run eval "$cmd" || {
4232
# Restore the uninstalled library and exit
4233
if test "$mode" = relink; then
4234
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
3799
4240
IFS="$save_ifs"
3801
4242
# Restore the uninstalled library and exit
3802
4243
if test "$mode" = relink; then
3803
4244
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4246
if test -n "$convenience"; then
4247
if test -z "$whole_archive_flag_spec"; then
4248
$show "${rm}r $gentop"
4249
$run ${rm}r "$gentop"
3807
4256
# Create links to the real library.
3870
4320
reload_conv_objs=
3872
4322
# reload_cmds runs $LD directly, so let us get rid of
3873
# -Wl from whole_archive_flag_spec
4323
# -Wl from whole_archive_flag_spec and hope we can get by with
4324
# turning comma into space..
3876
4327
if test -n "$convenience"; then
3877
4328
if test -n "$whole_archive_flag_spec"; then
3878
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4329
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4330
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
3880
4332
gentop="$output_objdir/${obj}x"
3881
$show "${rm}r $gentop"
3882
$run ${rm}r "$gentop"
3883
$show "$mkdir $gentop"
3884
$run $mkdir "$gentop"
3886
if test "$status" -ne 0 && test ! -d "$gentop"; then
3889
4333
generated="$generated $gentop"
3891
for xlib in $convenience; do
3892
# Extract the objects.
3894
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3895
*) xabs=`pwd`"/$xlib" ;;
3897
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3898
xdir="$gentop/$xlib"
3900
$show "${rm}r $xdir"
3902
$show "$mkdir $xdir"
3905
if test "$status" -ne 0 && test ! -d "$xdir"; then
3908
# We will extract separately just the conflicting names and we will no
3909
# longer touch any unique names. It is faster to leave these extract
3910
# automatically by $AR in one run.
3911
$show "(cd $xdir && $AR x $xabs)"
3912
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3913
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3916
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3917
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3918
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3921
while test "$i" -le "$count"
3923
# Put our $i before any first dot (extension)
3924
# Never overwrite any file
3926
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3928
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3930
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3931
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3937
reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4335
func_extract_archives $gentop $convenience
4336
reload_conv_objs="$reload_objs $func_extract_archives_result"
4196
4630
# Prepare the list of exported symbols
4197
4631
if test -z "$export_symbols"; then
4198
export_symbols="$output_objdir/$output.exp"
4632
export_symbols="$output_objdir/$outputname.exp"
4199
4633
$run $rm $export_symbols
4200
$run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4634
$run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4636
*cygwin* | *mingw* )
4637
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4638
$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4202
$run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4203
$run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4642
$run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4643
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4204
4644
$run eval 'mv "$nlist"T "$nlist"'
4646
*cygwin* | *mingw* )
4647
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4648
$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4301
4766
# Now compile the dynamic symbol file.
4302
$show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4303
$run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4767
$show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4768
$run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4305
4770
# Clean up the generated files.
4306
4771
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4307
4772
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4309
4774
# Transform the symbol file into the correct name.
4310
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4311
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4776
*cygwin* | *mingw* )
4777
if test -f "$output_objdir/${outputname}.def" ; then
4778
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4781
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4782
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4786
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4787
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4314
4792
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4321
4799
# really was required.
4323
4801
# Nullify the symbol file.
4324
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4325
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4802
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4803
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4328
4806
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4329
4807
# Replace the output file specification.
4330
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4808
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4331
4809
link_command="$compile_command$compile_rpath"
4333
4811
# We have no uninstalled library dependencies, so finalize right now.
4334
4812
$show "$link_command"
4335
4813
$run eval "$link_command"
4338
4816
# Delete the generated files.
4339
4817
if test -n "$dlsyms"; then
4553
5035
if (stale) { free ((void *) stale); stale = 0; } \
5038
/* -DDEBUG is fairly common in CFLAGS. */
4556
5040
#if defined DEBUGWRAPPER
4557
5041
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4559
# define DEBUG(format, ...)
5043
# define DEBUG(format, ...)
4562
5046
const char *program_name = NULL;
4564
5048
void * xmalloc (size_t num);
4565
5049
char * xstrdup (const char *string);
4566
char * basename (const char *name);
5050
const char * base_name (const char *name);
4567
5051
char * find_executable(const char *wrapper);
4568
5052
int check_executable(const char *path);
4569
5053
char * strendzap(char *str, const char *pat);
4575
5059
char **newargz;
4578
program_name = (char *) xstrdup ((char *) basename (argv[0]));
5062
program_name = (char *) xstrdup (base_name (argv[0]));
4579
5063
DEBUG("(main) argv[0] : %s\n",argv[0]);
4580
5064
DEBUG("(main) program_name : %s\n",program_name);
4581
5065
newargz = XMALLOC(char *, argc+2);
4584
cat >> $cwrappersource <<EOF
4585
newargz[0] = "$SHELL";
5068
cat >> $cwrappersource <<EOF
5069
newargz[0] = (char *) xstrdup("$SHELL");
4588
cat >> $cwrappersource <<"EOF"
5072
cat >> $cwrappersource <<"EOF"
4589
5073
newargz[1] = find_executable(argv[0]);
4590
5074
if (newargz[1] == NULL)
4591
5075
lt_fatal("Couldn't find %s", argv[0]);
4592
5076
DEBUG("(main) found exe at : %s\n",newargz[1]);
4593
5077
/* we know the script has the same name, without the .exe */
4594
5078
/* so make sure newargz[1] doesn't end in .exe */
4595
strendzap(newargz[1],".exe");
5079
strendzap(newargz[1],".exe");
4596
5080
for (i = 1; i < argc; i++)
4597
5081
newargz[i+1] = xstrdup(argv[i]);
4598
5082
newargz[argc+1] = NULL;
4816
# we should really use a build-platform specific compiler
4817
# here, but OTOH, the wrappers (shell script and this C one)
4818
# are only useful if you want to execute the "real" binary.
4819
# Since the "real" binary is built for $host, then this
4820
# wrapper might as well be built for $host, too.
4821
$run $LTCC -s -o $cwrapper $cwrappersource
4825
trap "$rm $output; exit 1" 1 2 15
5311
# we should really use a build-platform specific compiler
5312
# here, but OTOH, the wrappers (shell script and this C one)
5313
# are only useful if you want to execute the "real" binary.
5314
# Since the "real" binary is built for $host, then this
5315
# wrapper might as well be built for $host, too.
5316
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5320
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4827
5322
$echo > $output "\
4841
5336
Xsed='${SED} -e 1s/^X//'
4842
5337
sed_quote_subst='$sed_quote_subst'
5339
# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5340
if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5343
# Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5344
# is contrary to our usage. Disable this feature.
5345
alias -g '\${1+\"\$@\"}'='\"\$@\"'
5346
setopt NO_GLOB_SUBST
5348
case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5350
BIN_SH=xpg4; export BIN_SH # for Tru64
5351
DUALCASE=1; export DUALCASE # for MKS sh
4844
5353
# The HP-UX ksh and POSIX shell print the target directory to stdout
4845
5354
# if CDPATH is set.
4846
if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
5355
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4848
5357
relink_command=\"$relink_command\"
5021
5530
if test -n "$addlibs"; then
5022
5531
gentop="$output_objdir/${outputname}x"
5023
$show "${rm}r $gentop"
5024
$run ${rm}r "$gentop"
5025
$show "$mkdir $gentop"
5026
$run $mkdir "$gentop"
5028
if test "$status" -ne 0 && test ! -d "$gentop"; then
5031
5532
generated="$generated $gentop"
5033
# Add in members from convenience archives.
5034
for xlib in $addlibs; do
5035
# Extract the objects.
5037
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5038
*) xabs=`pwd`"/$xlib" ;;
5040
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5041
xdir="$gentop/$xlib"
5043
$show "${rm}r $xdir"
5045
$show "$mkdir $xdir"
5048
if test "$status" -ne 0 && test ! -d "$xdir"; then
5051
# We will extract separately just the conflicting names and we will no
5052
# longer touch any unique names. It is faster to leave these extract
5053
# automatically by $AR in one run.
5054
$show "(cd $xdir && $AR x $xabs)"
5055
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5056
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5059
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5060
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5061
$AR t "$xabs" | sort | uniq -cd | while read -r count name
5064
while test "$i" -le "$count"
5066
# Put our $i before any first dot (extension)
5067
# Never overwrite any file
5069
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5071
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5073
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5074
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5080
oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5534
func_extract_archives $gentop $addlibs
5535
oldobjs="$oldobjs $func_extract_archives_result"
5084
5538
# Do each command in the archive commands.
5085
5539
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5086
eval cmds=\"$old_archive_from_new_cmds\"
5540
cmds=$old_archive_from_new_cmds
5542
# POSIX demands no paths to be encoded in archives. We have
5543
# to avoid creating archives with duplicate basenames if we
5544
# might have to extract them afterwards, e.g., when creating a
5545
# static archive out of a convenience library, or when linking
5546
# the entirety of a libtool archive into another (currently
5547
# not supported by libtool).
5548
if (for obj in $oldobjs
5550
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5551
done | sort | sort -uc >/dev/null 2>&1); then
5554
$echo "copying selected object files to avoid basename conflicts..."
5556
if test -z "$gentop"; then
5557
gentop="$output_objdir/${outputname}x"
5558
generated="$generated $gentop"
5560
$show "${rm}r $gentop"
5561
$run ${rm}r "$gentop"
5562
$show "$mkdir $gentop"
5563
$run $mkdir "$gentop"
5565
if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5570
save_oldobjs=$oldobjs
5573
for obj in $save_oldobjs
5575
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5576
case " $oldobjs " in
5577
" ") oldobjs=$obj ;;
5580
# Make sure we don't pick an alternate name that also
5582
newobj=lt$counter-$objbase
5583
counter=`expr $counter + 1`
5584
case " $oldobjs " in
5585
*[\ /]"$newobj "*) ;;
5586
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5589
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5590
$run ln "$obj" "$gentop/$newobj" ||
5591
$run cp "$obj" "$gentop/$newobj"
5592
oldobjs="$oldobjs $gentop/$newobj"
5594
*) oldobjs="$oldobjs $obj" ;;
5088
5599
eval cmds=\"$old_archive_cmds\"
5090
5601
if len=`expr "X$cmds" : ".*"` &&
5091
5602
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5603
cmds=$old_archive_cmds
5094
5605
# the command line is too long to link in one step, link in parts
5095
5606
$echo "using piecewise archive linking..."
5100
5611
save_oldobjs=$oldobjs
5101
# GNU ar 2.10+ was changed to match POSIX; thus no paths are
5102
# encoded into archives. This makes 'ar r' malfunction in
5103
# this piecewise linking case whenever conflicting object
5104
# names appear in distinct ar calls; check, warn and compensate.
5105
if (for obj in $save_oldobjs
5107
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5108
done | sort | sort -uc >/dev/null 2>&1); then
5111
$echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5112
$echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5115
5613
# Is there a better way of finding the last object in the list?
5116
5614
for obj in $save_oldobjs
5118
5616
last_oldobj=$obj
5120
5618
for obj in $save_oldobjs
5122
5620
oldobjs="$objlist $obj"
5123
5621
objlist="$objlist $obj"
5124
5622
eval test_cmds=\"$old_archive_cmds\"
5125
if len=`expr "X$test_cmds" : ".*"` &&
5623
if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5126
5624
test "$len" -le "$max_cmd_len"; then
5533
6058
if test "$#" -gt 0; then
5534
6059
# Delete the old symlinks, and create new ones.
6060
# Try `ln -sf' first, because the `ln' binary might depend on
6061
# the symlink we replace! Solaris /bin/ln does not understand -f,
6062
# so we also need to try rm && ln -s.
5537
6065
if test "$linkname" != "$realname"; then
5538
$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5539
$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
6066
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6067
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5544
6072
# Do each command in the postinstall commands.
5545
6073
lib="$destdir/$realname"
5546
eval cmds=\"$postinstall_cmds\"
6074
cmds=$postinstall_cmds
5547
6075
save_ifs="$IFS"; IFS='~'
5548
6076
for cmd in $cmds; do
5549
6077
IFS="$save_ifs"
5551
$run eval "$cmd" || exit $?
6080
$run eval "$cmd" || {
6083
# Restore the uninstalled library and exit
6084
if test "$mode" = relink; then
6085
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5553
6091
IFS="$save_ifs"
5642
6180
notinst_deplibs=
5643
6181
relink_command=
5645
# To insure that "foo" is sourced, and not "foo.exe",
5646
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5647
# which disallows the automatic-append-.exe behavior.
5649
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5650
*) wrapperdot=${wrapper} ;;
6183
# Note that it is not necessary on cygwin/mingw to append a dot to
6184
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6185
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6186
# `FILE.' does not work on cygwin managed mounts.
5652
6188
# If there is no directory component, then add one.
5654
*/* | *\\*) . ${wrapperdot} ;;
5655
*) . ./${wrapperdot} ;;
6190
*/* | *\\*) . ${wrapper} ;;
6191
*) . ./${wrapper} ;;
5658
6194
# Check the variables that should have been set.
5659
6195
if test -z "$notinst_deplibs"; then
5660
6196
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5682
6218
relink_command=
5683
# To insure that "foo" is sourced, and not "foo.exe",
5684
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5685
# which disallows the automatic-append-.exe behavior.
5687
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5688
*) wrapperdot=${wrapper} ;;
6219
# Note that it is not necessary on cygwin/mingw to append a dot to
6220
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6221
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6222
# `FILE.' does not work on cygwin managed mounts.
5690
6224
# If there is no directory component, then add one.
5692
*/* | *\\*) . ${wrapperdot} ;;
5693
*) . ./${wrapperdot} ;;
6226
*/* | *\\*) . ${wrapper} ;;
6227
*) . ./${wrapper} ;;
5697
6231
if test "$fast_install" = no && test -n "$relink_command"; then
5698
6232
if test "$finalize" = yes && test -z "$run"; then
5700
test -n "$TMPDIR" && tmpdir="$TMPDIR"
5701
tmpdir="$tmpdir/libtool-$$"
5702
if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5704
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
6233
tmpdir=`func_mktempdir`
5707
6234
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5708
6235
outputname="$tmpdir/$file"
5709
6236
# Replace the output file specification.
5710
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6237
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
5712
6239
$show "$relink_command"
5713
6240
if $run eval "$relink_command"; then :
6343
6885
-no-undefined declare that a library does not refer to external symbols
6344
6886
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6345
6887
-objectlist FILE Use a list of object files found in FILE to specify objects
6888
-precious-files-regex REGEX
6889
don't remove output files matching REGEX
6346
6890
-release RELEASE specify package release information
6347
6891
-rpath LIBDIR the created library will eventually be installed in LIBDIR
6348
6892
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6349
-static do not do any dynamic linking of libtool libraries
6893
-static do not do any dynamic linking of uninstalled libtool libraries
6894
-static-libtool-libs
6895
do not do any dynamic linking of libtool libraries
6350
6896
-version-info CURRENT[:REVISION[:AGE]]
6351
specify library version info [each variable defaults to 0]
6897
specify library version info [each variable defaults to 0]
6353
6899
All other options (arguments beginning with \`-') are ignored.