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, 2004, 2005
4
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5
5
# Free Software Foundation, Inc.
6
6
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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`
47
TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)"
49
# See if we are running on zsh, and set the options which allow our
50
# commands through without removal of \ escapes.
51
if test -n "${ZSH_VERSION+set}" ; then
55
27
# Check that we have a working $echo.
56
28
if test "X$1" = X--no-reexec; then
57
29
# Discard the --no-reexec flag, and continue.
134
118
lo2o="s/\\.lo\$/.${objext}/"
135
119
o2lo="s/\\.${objext}\$/.lo/"
136
quote_scanset='[[~#^*{};<>?'"'"' ]'
121
if test -z "$max_cmd_len"; then
126
# If test is not a shell built-in, we'll probably end up computing a
127
# maximum length that is only half of the actual maximum length, but
129
while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
130
= "XX$testring") >/dev/null 2>&1 &&
131
new_result=`expr "X$testring" : ".*" 2>&1` &&
132
max_cmd_len="$new_result" &&
133
test $i != 17 # 1/2 MB should be enough
136
testring="$testring$testring"
139
# Add a significant safety factor because C++ compilers can tack on massive
140
# amounts of additional arguments before passing them to the linker.
141
# It appears as though 1/2 is a usable value.
142
max_cmd_len=`expr $max_cmd_len \/ 2`
138
145
#####################################
139
146
# Shell function definitions:
140
147
# This seems to be the best place for them
142
# func_win32_libid arg
143
# return the library type of file 'arg'
145
149
# Need a lot of goo to handle *both* DLLs and import libs
146
150
# Has to be a shell function in order to 'eat' the argument
147
151
# that is supplied when $file_magic_command is called.
150
153
win32_libid_type="unknown"
151
154
win32_fileres=`file -L $1 2>/dev/null`
152
155
case $win32_fileres in
179
182
$echo $win32_libid_type
184
# Infer tagged configuration to use if any are available and
185
# if one wasn't chosen via the "--tag" command line option.
186
# Only attempt this if the compiler in the base compile
187
# command doesn't match the default compiler.
188
# arg is usually of the form 'gcc ...'
191
if test -n "$available_tags" && test -z "$tagname"; then
195
*$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
199
CC_quoted="$CC_quoted $arg"
202
# Blanks in the command may have been stripped by the calling shell,
203
# but not from the CC environment variable when configure was run.
204
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
205
# Blanks at the start of $base_compile will cause this to fail
206
# if we don't check for them as well.
208
for z in $available_tags; do
209
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
210
# Evaluate the configuration.
211
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
214
# Double-quote args containing other shell metacharacters.
216
*$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
220
CC_quoted="$CC_quoted $arg"
223
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
224
# The compiler in the base compile command matches
225
# the one in the tagged configuration.
226
# Assume this is the tagged configuration we want.
233
# If $tagname still isn't set, then no tagged configuration
234
# was found and let the user know that the "--tag" command
235
# line option must be used.
236
if test -z "$tagname"; then
237
$echo "$modename: unable to infer tagged configuration"
238
$echo "$modename: specify a tag with \`--tag'" 1>&2
241
# $echo "$modename: using $tagname tagged configuration"
249
# func_extract_an_archive dir oldlib
250
func_extract_an_archive ()
252
f_ex_an_ar_dir="$1"; shift
253
f_ex_an_ar_oldlib="$1"
255
$show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
256
$run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
257
if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
260
$echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
265
# func_extract_archives gentop oldlib ...
266
func_extract_archives ()
268
my_gentop="$1"; shift
276
$show "${rm}r $my_gentop"
277
$run ${rm}r "$my_gentop"
278
$show "$mkdir $my_gentop"
279
$run $mkdir "$my_gentop"
281
if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
285
for my_xlib in $my_oldlibs; do
286
# Extract the objects.
288
[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
289
*) my_xabs=`pwd`"/$my_xlib" ;;
291
my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292
my_xdir="$my_gentop/$my_xlib"
294
$show "${rm}r $my_xdir"
295
$run ${rm}r "$my_xdir"
296
$show "$mkdir $my_xdir"
297
$run $mkdir "$my_xdir"
299
if test "$status" -ne 0 && test ! -d "$my_xdir"; then
304
$show "Extracting $my_xabs"
305
# Do not bother doing anything if just a dry run
306
if test -z "$run"; then
307
darwin_orig_dir=`pwd`
308
cd $my_xdir || exit $?
309
darwin_archive=$my_xabs
311
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
312
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
313
if test -n "$darwin_arches"; then
314
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
316
$show "$darwin_base_archive has multiple architectures $darwin_arches"
317
for darwin_arch in $darwin_arches ; do
318
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
319
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
320
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
321
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
323
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
324
done # $darwin_arches
325
## Okay now we have a bunch of thin objects, gotta fatten them up :)
326
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
329
for darwin_file in $darwin_filelist; do
330
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
331
lipo -create -output "$darwin_file" $darwin_files
332
done # $darwin_filelist
334
cd "$darwin_orig_dir"
336
cd "$darwin_orig_dir"
337
func_extract_an_archive "$my_xdir" "$my_xabs"
342
func_extract_an_archive "$my_xdir" "$my_xabs"
345
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
347
func_extract_archives_result="$my_oldobjs"
349
185
# End of Shell function definitions
350
186
#####################################
353
eval std_shrext=\"$shrext_cmds\"
355
188
# Parse our command line options once, thoroughly.
356
189
while test "$#" -gt 0
417
250
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
419
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
252
$echo "Copyright (C) 2003 Free Software Foundation, Inc."
420
253
$echo "This is free software; see the source for copying conditions. There is NO"
421
254
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
426
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
259
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
427
260
# Now print the configurations for the tags.
428
261
for tagname in $taglist; do
429
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
262
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
710
540
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
712
542
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
717
func_infer_tag $base_compile
547
# Infer tagged configuration to use if any are available and
548
# if one wasn't chosen via the "--tag" command line option.
549
# Only attempt this if the compiler in the base compile
550
# command doesn't match the default compiler.
551
if test -n "$available_tags" && test -z "$tagname"; then
552
case $base_compile in
553
# Blanks in the command may have been stripped by the calling shell,
554
# but not from the CC environment variable when configure was run.
555
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
556
# Blanks at the start of $base_compile will cause this to fail
557
# if we don't check for them as well.
559
for z in $available_tags; do
560
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
561
# Evaluate the configuration.
562
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
563
case "$base_compile " in
564
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
565
# The compiler in the base compile command matches
566
# the one in the tagged configuration.
567
# Assume this is the tagged configuration we want.
574
# If $tagname still isn't set, then no tagged configuration
575
# was found and let the user know that the "--tag" command
576
# line option must be used.
577
if test -z "$tagname"; then
578
$echo "$modename: unable to infer tagged configuration"
579
$echo "$modename: specify a tag with \`--tag'" 1>&2
582
# $echo "$modename: using $tagname tagged configuration"
719
588
for arg in $later; do
1079
func_infer_tag $base_compile
934
# Infer tagged configuration to use if any are available and
935
# if one wasn't chosen via the "--tag" command line option.
936
# Only attempt this if the compiler in the base link
937
# command doesn't match the default compiler.
938
if test -n "$available_tags" && test -z "$tagname"; then
939
case $base_compile in
940
# Blanks in the command may have been stripped by the calling shell,
941
# but not from the CC environment variable when configure was run.
942
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
943
# Blanks at the start of $base_compile will cause this to fail
944
# if we don't check for them as well.
946
for z in $available_tags; do
947
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
948
# Evaluate the configuration.
949
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
950
case $base_compile in
951
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
952
# The compiler in $compile_command matches
953
# the one in the tagged configuration.
954
# Assume this is the tagged configuration we want.
961
# If $tagname still isn't set, then no tagged configuration
962
# was found and let the user know that the "--tag" command
963
# line option must be used.
964
if test -z "$tagname"; then
965
$echo "$modename: unable to infer tagged configuration"
966
$echo "$modename: specify a tag with \`--tag'" 1>&2
969
# $echo "$modename: using $tagname tagged configuration"
1081
975
# We need to know -static, to get the right output filenames.
1534
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1535
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1536
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1537
# +DA*, +DD* enable 64-bit mode on the HP compiler
1538
# -q* pass through compiler args for the IBM compiler
1539
# -m* pass through architecture-specific compiler args for GCC
1540
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1396
# gcc -m* arguments should be passed to the linker via $compiler_flags
1397
# in order to pass architecture information to the linker
1398
# (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1399
# but this is not reliable with gcc because gcc may use -mfoo to
1400
# select a different linker, different libraries, etc, while
1401
# -Wl,-mfoo simply passes -mfoo to the linker.
1542
1403
# Unknown arguments in both finalize_command and compile_command need
1543
1404
# to be aesthetically quoted because they are evaled later.
1544
1405
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1546
*$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1407
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2272
2125
if test -z "$linklib"; then
2273
2126
$echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2277
2130
# This library was specified with -dlopen.
2278
2131
if test "$pass" = dlopen; then
2279
2132
if test -z "$libdir"; then
2280
2133
$echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2283
if test -z "$dlname" ||
2284
test "$dlopen_support" != yes ||
2285
test "$build_libtool_libs" = no; then
2136
if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2286
2137
# If there is no dlname, no dlopen support or we're linking
2287
2138
# statically, we need to preload. We also need to preload any
2288
2139
# dependent libraries so libltdl's deplib preloader doesn't
2453
2296
need_relink=yes
2455
2298
# This is a shared library
2457
# Warn about portability, can't link against -module's on
2458
# some systems (darwin)
2459
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2300
# Warn about portability, can't link against -module's on some systems (darwin)
2301
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2461
2303
if test "$linkmode" = prog; then
2462
2304
$echo "*** Warning: Linking the executable $output against the loadable module"
2464
2306
$echo "*** Warning: Linking the shared library $output against the loadable module"
2466
$echo "*** $linklib is not portable!"
2308
$echo "*** $linklib is not portable!"
2468
2310
if test "$linkmode" = lib &&
2469
2311
test "$hardcode_into_libs" = yes; then
2470
2312
# Hardcode the library path.
2835
# Again, we only want to link against shared libraries
2836
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2837
for tmp in $newlib_search_path ; do
2838
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2839
eval depdepl="$tmp/lib$tmp_libs.dylib"
2675
# Again, we only want to link against shared libraries
2676
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2677
for tmp in $newlib_search_path ; do
2678
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2679
eval depdepl="$tmp/lib$tmp_libs.dylib"
2850
2690
case " $deplibs " in
2692
*) deplibs="$deplibs $depdepl" ;;
2694
case " $deplibs " in
2851
2695
*" $path "*) ;;
2852
*) deplibs="$path $deplibs" ;;
2854
case " $deplibs " in
2856
*) deplibs="$depdepl $deplibs" ;;
2696
*) deplibs="$deplibs $path" ;;
2859
2699
fi # link_all_deplibs != no
3001
2840
case $outputname in
3003
2842
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3004
eval shared_ext=\"$shrext_cmds\"
2843
eval shared_ext=\"$shrext\"
3005
2844
eval libname=\"$libname_spec\"
3008
2847
if test "$module" = no; then
3009
2848
$echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3010
2849
$echo "$help" 1>&2
3013
2852
if test "$need_lib_prefix" != no; then
3014
2853
# Add the "lib" prefix for modules if required
3015
2854
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3016
eval shared_ext=\"$shrext_cmds\"
2855
eval shared_ext=\"$shrext\"
3017
2856
eval libname=\"$libname_spec\"
3019
2858
libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3119
2958
# Check that each of the things are valid numbers.
3120
2959
case $current in
3121
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]) ;;
3123
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2962
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3124
2963
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3129
2968
case $revision in
3130
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]) ;;
3132
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2971
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3133
2972
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3139
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]) ;;
3141
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2980
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3142
2981
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3147
2986
if test "$age" -gt "$current"; then
3148
2987
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3149
2988
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3153
2992
# Calculate the version variables.
3852
3696
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3854
3698
gentop="$output_objdir/${outputname}x"
3699
$show "${rm}r $gentop"
3700
$run ${rm}r "$gentop"
3701
$show "$mkdir $gentop"
3702
$run $mkdir "$gentop"
3704
if test "$status" -ne 0 && test ! -d "$gentop"; then
3855
3707
generated="$generated $gentop"
3857
func_extract_archives $gentop $convenience
3858
libobjs="$libobjs $func_extract_archives_result"
3709
for xlib in $convenience; do
3710
# Extract the objects.
3712
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3713
*) xabs=`pwd`"/$xlib" ;;
3715
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3716
xdir="$gentop/$xlib"
3718
$show "${rm}r $xdir"
3720
$show "$mkdir $xdir"
3723
if test "$status" -ne 0 && test ! -d "$xdir"; then
3726
# We will extract separately just the conflicting names and we will no
3727
# longer touch any unique names. It is faster to leave these extract
3728
# automatically by $AR in one run.
3729
$show "(cd $xdir && $AR x $xabs)"
3730
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3731
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3734
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3735
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3736
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3739
while test "$i" -le "$count"
3741
# Put our $i before any first dot (extension)
3742
# Never overwrite any file
3744
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3746
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3748
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3749
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3755
libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3862
3760
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3863
3761
eval flag=\"$thread_safe_flag_spec\"
3864
3762
linker_flags="$linker_flags $flag"
4097
3995
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4099
3997
gentop="$output_objdir/${obj}x"
3998
$show "${rm}r $gentop"
3999
$run ${rm}r "$gentop"
4000
$show "$mkdir $gentop"
4001
$run $mkdir "$gentop"
4003
if test "$status" -ne 0 && test ! -d "$gentop"; then
4100
4006
generated="$generated $gentop"
4102
func_extract_archives $gentop $convenience
4103
reload_conv_objs="$reload_objs $func_extract_archives_result"
4008
for xlib in $convenience; do
4009
# Extract the objects.
4011
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4012
*) xabs=`pwd`"/$xlib" ;;
4014
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4015
xdir="$gentop/$xlib"
4017
$show "${rm}r $xdir"
4019
$show "$mkdir $xdir"
4022
if test "$status" -ne 0 && test ! -d "$xdir"; then
4025
# We will extract separately just the conflicting names and we will no
4026
# longer touch any unique names. It is faster to leave these extract
4027
# automatically by $AR in one run.
4028
$show "(cd $xdir && $AR x $xabs)"
4029
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4030
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4033
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4034
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4035
$AR t "$xabs" | sort | uniq -cd | while read -r count name
4038
while test "$i" -le "$count"
4040
# Put our $i before any first dot (extension)
4041
# Never overwrite any file
4043
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4045
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4047
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4048
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4054
reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
5078
5011
if test -n "$addlibs"; then
5079
5012
gentop="$output_objdir/${outputname}x"
5013
$show "${rm}r $gentop"
5014
$run ${rm}r "$gentop"
5015
$show "$mkdir $gentop"
5016
$run $mkdir "$gentop"
5018
if test "$status" -ne 0 && test ! -d "$gentop"; then
5080
5021
generated="$generated $gentop"
5082
func_extract_archives $gentop $addlibs
5083
oldobjs="$oldobjs $func_extract_archives_result"
5023
# Add in members from convenience archives.
5024
for xlib in $addlibs; do
5025
# Extract the objects.
5027
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5028
*) xabs=`pwd`"/$xlib" ;;
5030
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5031
xdir="$gentop/$xlib"
5033
$show "${rm}r $xdir"
5035
$show "$mkdir $xdir"
5038
if test "$status" -ne 0 && test ! -d "$xdir"; then
5041
# We will extract separately just the conflicting names and we will no
5042
# longer touch any unique names. It is faster to leave these extract
5043
# automatically by $AR in one run.
5044
$show "(cd $xdir && $AR x $xabs)"
5045
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5046
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5049
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5050
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5051
$AR t "$xabs" | sort | uniq -cd | while read -r count name
5054
while test "$i" -le "$count"
5056
# Put our $i before any first dot (extension)
5057
# Never overwrite any file
5059
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5061
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5063
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5064
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5070
oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5086
5074
# Do each command in the archive commands.
5087
5075
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5088
5076
cmds=$old_archive_from_new_cmds
5090
# POSIX demands no paths to be encoded in archives. We have
5091
# to avoid creating archives with duplicate basenames if we
5092
# might have to extract them afterwards, e.g., when creating a
5093
# static archive out of a convenience library, or when linking
5094
# the entirety of a libtool archive into another (currently
5095
# not supported by libtool).
5096
if (for obj in $oldobjs
5098
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5099
done | sort | sort -uc >/dev/null 2>&1); then
5102
$echo "copying selected object files to avoid basename conflicts..."
5104
if test -z "$gentop"; then
5105
gentop="$output_objdir/${outputname}x"
5106
generated="$generated $gentop"
5108
$show "${rm}r $gentop"
5109
$run ${rm}r "$gentop"
5110
$show "$mkdir $gentop"
5111
$run $mkdir "$gentop"
5113
if test "$status" -ne 0 && test ! -d "$gentop"; then
5118
save_oldobjs=$oldobjs
5121
for obj in $save_oldobjs
5123
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5124
case " $oldobjs " in
5125
" ") oldobjs=$obj ;;
5128
# Make sure we don't pick an alternate name that also
5130
newobj=lt$counter-$objbase
5131
counter=`expr $counter + 1`
5132
case " $oldobjs " in
5133
*[\ /]"$newobj "*) ;;
5134
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5137
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5138
$run ln "$obj" "$gentop/$newobj" ||
5139
$run cp "$obj" "$gentop/$newobj"
5140
oldobjs="$oldobjs $gentop/$newobj"
5142
*) oldobjs="$oldobjs $obj" ;;
5147
5078
eval cmds=\"$old_archive_cmds\"
5149
5080
if len=`expr "X$cmds" : ".*"` &&
5249
5191
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5250
5192
if test -z "$libdir"; then
5251
5193
$echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5254
newdependency_libs="$newdependency_libs $libdir/$name"
5256
*) newdependency_libs="$newdependency_libs $deplib" ;;
5196
# We do not want portage's install root ($D) present. Check only for
5197
# this if the .la is being installed.
5198
if test "$installed" = yes && test "$D"; then
5199
eval mynewdependency_lib="`echo "$libdir/$name" |sed -e "s:$D::g" -e 's://:/:g'`"
5201
mynewdependency_lib="$libdir/$name"
5203
# Do not add duplicates
5204
if test "$mynewdependency_lib"; then
5205
if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5206
newdependency_libs="$newdependency_libs $mynewdependency_lib"
5211
if test "$installed" = yes; then
5212
# Rather use S=WORKDIR if our version of portage supports it.
5213
# This is because some ebuild (gcc) do not use $S as buildroot.
5214
if test "$PWORKDIR"; then
5217
# We do not want portage's build root ($S) present.
5218
if test -n "`echo $deplib |grep -e "$S"`" && test "$S"; then
5219
mynewdependency_lib=""
5220
# We do not want portage's install root ($D) present.
5221
elif test -n "`echo $deplib |grep -e "$D"`" && test "$D"; then
5222
eval mynewdependency_lib="`echo "$deplib" |sed -e "s:$D::g" -e 's://:/:g'`"
5224
mynewdependency_lib="$deplib"
5227
mynewdependency_lib="$deplib"
5229
# Do not add duplicates
5230
if test "$mynewdependency_lib"; then
5231
if test -z "`echo $newdependency_libs |grep -e "$mynewdependency_lib"`"; then
5232
newdependency_libs="$newdependency_libs $mynewdependency_lib"
5259
5238
dependency_libs="$newdependency_libs"