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`
47
TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
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
27
61
# Check that we have a working $echo.
28
62
if test "X$1" = X--no-reexec; then
29
63
# Discard the --no-reexec flag, and continue.
89
111
# These must not be set unconditionally because not all systems understand
90
112
# e.g. LANG=C (notably SCO).
91
113
# We save the old values to restore during execute mode.
92
if test "${LC_ALL+set}" = set; then
93
save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
95
if test "${LANG+set}" = set; then
96
save_LANG="$LANG"; LANG=C; export LANG
114
for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
116
eval "if test \"\${$lt_var+set}\" = set; then
117
save_$lt_var=\$$lt_var
99
123
# Make sure IFS has a sensible default
102
128
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
103
129
$echo "$modename: not configured to build any kind of library" 1>&2
104
130
$echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
108
134
# Global variables.
117
145
lo2o="s/\\.lo\$/.${objext}/"
118
146
o2lo="s/\\.${objext}\$/.lo/"
120
150
#####################################
121
151
# Shell function definitions:
122
152
# This seems to be the best place for them
154
# func_mktempdir [string]
155
# Make a temporary directory that won't clash with other running
156
# libtool processes, and avoids race conditions if possible. If
157
# given, STRING is the basename for that directory.
160
my_template="${TMPDIR-/tmp}/${1-$progname}"
162
if test "$run" = ":"; then
163
# Return a directory name, but don't create it in dry-run mode
164
my_tmpdir="${my_template}-$$"
167
# If mktemp works, use that first and foremost
168
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
170
if test ! -d "$my_tmpdir"; then
171
# Failing that, at least try and use $RANDOM to avoid a race
172
my_tmpdir="${my_template}-${RANDOM-0}$$"
174
save_mktempdir_umask=`umask`
177
umask $save_mktempdir_umask
180
# If we're not in dry-run mode, bomb out on failure
181
test -d "$my_tmpdir" || {
182
$echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
187
$echo "X$my_tmpdir" | $Xsed
191
# func_win32_libid arg
192
# return the library type of file 'arg'
124
194
# Need a lot of goo to handle *both* DLLs and import libs
125
195
# Has to be a shell function in order to 'eat' the argument
126
196
# that is supplied when $file_magic_command is called.
128
199
win32_libid_type="unknown"
129
200
win32_fileres=`file -L $1 2>/dev/null`
130
201
case $win32_fileres in
134
205
*ar\ archive*) # could be an import, or static
135
206
if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
136
grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
207
$EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
137
208
win32_nmres=`eval $NM -f posix -A $1 | \
138
sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
139
if test "X$win32_nmres" = "Ximport" ; then
140
win32_libid_type="x86 archive import"
142
win32_libid_type="x86 archive static"
209
$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
211
import*) win32_libid_type="x86 archive import";;
212
*) win32_libid_type="x86 archive static";;
147
217
win32_libid_type="x86 DLL"
149
219
*executable*) # but shell scripts are "executable" too...
157
227
$echo $win32_libid_type
232
# Infer tagged configuration to use if any are available and
233
# if one wasn't chosen via the "--tag" command line option.
234
# Only attempt this if the compiler in the base compile
235
# command doesn't match the default compiler.
236
# arg is usually of the form 'gcc ...'
239
if test -n "$available_tags" && test -z "$tagname"; then
243
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
247
CC_quoted="$CC_quoted $arg"
250
# Blanks in the command may have been stripped by the calling shell,
251
# but not from the CC environment variable when configure was run.
252
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
253
# Blanks at the start of $base_compile will cause this to fail
254
# if we don't check for them as well.
256
for z in $available_tags; do
257
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
258
# Evaluate the configuration.
259
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
262
# Double-quote args containing other shell metacharacters.
264
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
268
CC_quoted="$CC_quoted $arg"
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%^.*/%%'`
342
case " $extracted_archives " in
344
extracted_serial=`expr $extracted_serial + 1`
345
my_xlib_u=lt$extracted_serial-$my_xlib ;;
349
extracted_archives="$extracted_archives $my_xlib_u"
350
my_xdir="$my_gentop/$my_xlib_u"
352
$show "${rm}r $my_xdir"
353
$run ${rm}r "$my_xdir"
354
$show "$mkdir $my_xdir"
355
$run $mkdir "$my_xdir"
357
if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
362
$show "Extracting $my_xabs"
363
# Do not bother doing anything if just a dry run
364
if test -z "$run"; then
365
darwin_orig_dir=`pwd`
366
cd $my_xdir || exit $?
367
darwin_archive=$my_xabs
369
darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
370
darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
371
if test -n "$darwin_arches"; then
372
darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
374
$show "$darwin_base_archive has multiple architectures $darwin_arches"
375
for darwin_arch in $darwin_arches ; do
376
mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
377
lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
378
cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
379
func_extract_an_archive "`pwd`" "${darwin_base_archive}"
381
$rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
382
done # $darwin_arches
383
## Okay now we have a bunch of thin objects, gotta fatten them up :)
384
darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
387
for darwin_file in $darwin_filelist; do
388
darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
389
lipo -create -output "$darwin_file" $darwin_files
390
done # $darwin_filelist
392
cd "$darwin_orig_dir"
394
cd "$darwin_orig_dir"
395
func_extract_an_archive "$my_xdir" "$my_xabs"
400
func_extract_an_archive "$my_xdir" "$my_xabs"
403
my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
405
func_extract_archives_result="$my_oldobjs"
160
407
# End of Shell function definitions
161
408
#####################################
411
eval std_shrext=\"$shrext_cmds\"
163
415
# Parse our command line options once, thoroughly.
164
416
while test "$#" -gt 0
224
477
$echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
226
$echo "Copyright (C) 2003 Free Software Foundation, Inc."
479
$echo "Copyright (C) 2005 Free Software Foundation, Inc."
227
480
$echo "This is free software; see the source for copying conditions. There is NO"
228
481
$echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
233
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
486
${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
234
487
# Now print the configurations for the tags.
235
488
for tagname in $taglist; do
236
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
489
${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
242
495
$echo "$progname: enabling shell trace mode"
497
preserve_args="$preserve_args $arg"
514
787
*.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
516
789
$echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
521
# Infer tagged configuration to use if any are available and
522
# if one wasn't chosen via the "--tag" command line option.
523
# Only attempt this if the compiler in the base compile
524
# command doesn't match the default compiler.
525
if test -n "$available_tags" && test -z "$tagname"; then
526
case $base_compile in
527
# Blanks in the command may have been stripped by the calling shell,
528
# but not from the CC environment variable when configure was run.
529
" $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
530
# Blanks at the start of $base_compile will cause this to fail
531
# if we don't check for them as well.
533
for z in $available_tags; do
534
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
535
# Evaluate the configuration.
536
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
537
case "$base_compile " in
538
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
539
# The compiler in the base compile command matches
540
# the one in the tagged configuration.
541
# Assume this is the tagged configuration we want.
548
# If $tagname still isn't set, then no tagged configuration
549
# was found and let the user know that the "--tag" command
550
# line option must be used.
551
if test -z "$tagname"; then
552
$echo "$modename: unable to infer tagged configuration"
553
$echo "$modename: specify a tag with \`--tag'" 1>&2
556
# $echo "$modename: using $tagname tagged configuration"
794
func_infer_tag $base_compile
796
for arg in $later; do
815
qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
817
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
818
qlibobj="\"$qlibobj\"" ;;
820
test "X$libobj" != "X$qlibobj" \
821
&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
822
&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
562
823
objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
563
824
xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
564
825
if test "X$xdir" = "X$obj"; then
1623
# Tru64 UNIX uses -model [arg] to determine the layout of C++
1624
# classes, name mangling, and exception handling.
1626
compile_command="$compile_command $arg"
1627
compiler_flags="$compiler_flags $arg"
1628
finalize_command="$finalize_command $arg"
1633
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1634
compiler_flags="$compiler_flags $arg"
1635
compile_command="$compile_command $arg"
1636
finalize_command="$finalize_command $arg"
1298
# gcc -m* arguments should be passed to the linker via $compiler_flags
1299
# in order to pass architecture information to the linker
1300
# (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo
1301
# but this is not reliable with gcc because gcc may use -mfoo to
1302
# select a different linker, different libraries, etc, while
1303
# -Wl,-mfoo simply passes -mfoo to the linker.
1645
# -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1646
# -r[0-9][0-9]* specifies the processor on the SGI compiler
1647
# -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1648
# +DA*, +DD* enable 64-bit mode on the HP compiler
1649
# -q* pass through compiler args for the IBM compiler
1650
# -m* pass through architecture-specific compiler args for GCC
1651
# -m*, -t[45]*, -txscale* pass through architecture-specific
1652
# compiler args for GCC
1653
# -pg pass through profiling flag for GCC
1654
# @file GCC response files
1655
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1656
-t[45]*|-txscale*|@*)
1305
1658
# Unknown arguments in both finalize_command and compile_command need
1306
1659
# to be aesthetically quoted because they are evaled later.
1307
1660
arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1619
1980
if test -n "$prev"; then
1620
1981
$echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1621
1982
$echo "$help" 1>&2
1625
# Infer tagged configuration to use if any are available and
1626
# if one wasn't chosen via the "--tag" command line option.
1627
# Only attempt this if the compiler in the base link
1628
# command doesn't match the default compiler.
1629
if test -n "$available_tags" && test -z "$tagname"; then
1630
case $base_compile in
1631
# Blanks in the command may have been stripped by the calling shell,
1632
# but not from the CC environment variable when configure was run.
1633
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1634
# Blanks at the start of $base_compile will cause this to fail
1635
# if we don't check for them as well.
1637
for z in $available_tags; do
1638
if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1639
# Evaluate the configuration.
1640
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1641
case $base_compile in
1642
"$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1643
# The compiler in $compile_command matches
1644
# the one in the tagged configuration.
1645
# Assume this is the tagged configuration we want.
1652
# If $tagname still isn't set, then no tagged configuration
1653
# was found and let the user know that the "--tag" command
1654
# line option must be used.
1655
if test -z "$tagname"; then
1656
$echo "$modename: unable to infer tagged configuration"
1657
$echo "$modename: specify a tag with \`--tag'" 1>&2
1660
# $echo "$modename: using $tagname tagged configuration"
1666
1986
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1807
2126
case $deplib in
2127
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2128
if test "$linkmode,$pass" = "prog,link"; then
2129
compile_deplibs="$deplib $compile_deplibs"
2130
finalize_deplibs="$deplib $finalize_deplibs"
2132
compiler_flags="$compiler_flags $deplib"
1809
2137
if test "$linkmode" != lib && test "$linkmode" != prog; then
1810
2138
$echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1813
if test "$pass" = conv; then
1814
deplibs="$deplib $deplibs"
1817
2141
name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1818
2142
for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1819
# Search the libtool library
1820
lib="$searchdir/lib${name}.la"
1821
if test -f "$lib"; then
2143
for search_ext in .la $std_shrext .so .a; do
2144
# Search the libtool library
2145
lib="$searchdir/lib${name}${search_ext}"
2146
if test -f "$lib"; then
2147
if test "$search_ext" = ".la"; then
1826
2156
if test "$found" != yes; then
1827
2157
# deplib doesn't seem to be a libtool library
2164
2521
if test "$linkmode,$pass" = "prog,link"; then
2165
2522
if test -n "$library_names" &&
2166
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2523
{ { test "$prefer_static_libs" = no ||
2524
test "$prefer_static_libs,$installed" = "built,yes"; } ||
2525
test -z "$old_library"; }; then
2167
2526
# We need to hardcode the library path
2168
if test -n "$shlibpath_var"; then
2527
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2169
2528
# Make sure the rpath contains only unique directories.
2170
2529
case "$temp_rpath " in
2172
2531
*" $absdir "*) ;;
2173
*) temp_rpath="$temp_rpath $dir" ;;
2532
*) temp_rpath="$temp_rpath $absdir" ;;
2209
2568
link_static=no # Whether the deplib will be linked statically
2569
use_static_libs=$prefer_static_libs
2570
if test "$use_static_libs" = built && test "$installed" = yes ; then
2210
2573
if test -n "$library_names" &&
2211
{ test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2574
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
2212
2575
if test "$installed" = no; then
2213
2576
notinst_deplibs="$notinst_deplibs $lib"
2214
2577
need_relink=yes
2216
2579
# This is a shared library
2218
# Warn about portability, can't link against -module's on some systems (darwin)
2219
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2581
# Warn about portability, can't link against -module's on
2582
# some systems (darwin)
2583
if test "$shouldnotlink" = yes && test "$pass" = link ; then
2221
2585
if test "$linkmode" = prog; then
2222
2586
$echo "*** Warning: Linking the executable $output against the loadable module"
2224
2588
$echo "*** Warning: Linking the shared library $output against the loadable module"
2226
$echo "*** $linklib is not portable!"
2590
$echo "*** $linklib is not portable!"
2228
2592
if test "$linkmode" = lib &&
2229
2593
test "$hardcode_into_libs" = yes; then
2230
2594
# Hardcode the library path.
2318
2684
if test "$hardcode_direct" = no; then
2319
2685
add="$dir/$linklib"
2321
*-*-sco3.2v5* ) add_dir="-L$dir" ;;
2687
*-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2688
*-*-sysv4*uw2*) add_dir="-L$dir" ;;
2689
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2690
*-*-unixware7*) add_dir="-L$dir" ;;
2323
# if the lib is a module then we can not link against it, someone
2324
# is ignoring the new warnings I added
2325
if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2692
# if the lib is a module then we can not link against
2693
# it, someone is ignoring the new warnings I added
2694
if /usr/bin/file -L $add 2> /dev/null |
2695
$EGREP ": [^:]* bundle" >/dev/null ; then
2326
2696
$echo "** Warning, lib $linklib is a module, not a shared library"
2327
2697
if test -z "$old_library" ; then
2571
2942
if test -f "$path/$depdepl" ; then
2572
2943
depdepl="$path/$depdepl"
2574
newlib_search_path="$newlib_search_path $path"
2945
# do not add paths which are already there
2946
case " $newlib_search_path " in
2948
*) newlib_search_path="$newlib_search_path $path";;
2587
# Again, we only want to link against shared libraries
2588
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2589
for tmp in $newlib_search_path ; do
2590
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2591
eval depdepl="$tmp/lib$tmp_libs.dylib"
2961
# Again, we only want to link against shared libraries
2962
eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2963
for tmp in $newlib_search_path ; do
2964
if test -f "$tmp/lib$tmp_libs.dylib" ; then
2965
eval depdepl="$tmp/lib$tmp_libs.dylib"
2602
2976
case " $deplibs " in
2978
*) deplibs="$path $deplibs" ;;
2980
case " $deplibs " in
2603
2981
*" $depdepl "*) ;;
2604
*) deplibs="$deplibs $depdepl" ;;
2606
case " $deplibs " in
2608
*) deplibs="$deplibs $path" ;;
2982
*) deplibs="$depdepl $deplibs" ;;
2611
2985
fi # link_all_deplibs != no
2870
3245
# Check that each of the things are valid numbers.
2871
3246
case $current in
3247
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]) ;;
2874
$echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3249
$echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2875
3250
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2880
3255
case $revision in
3256
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]) ;;
2883
$echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3258
$echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2884
3259
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
3265
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]) ;;
2892
$echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3267
$echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2893
3268
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2898
3273
if test "$age" -gt "$current"; then
2899
3274
$echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2900
3275
$echo "$modename: \`$vinfo' is not valid version information" 1>&2
2904
3279
# Calculate the version variables.
3596
4013
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3598
4015
gentop="$output_objdir/${outputname}x"
3599
$show "${rm}r $gentop"
3600
$run ${rm}r "$gentop"
3601
$show "$mkdir $gentop"
3602
$run $mkdir "$gentop"
3604
if test "$status" -ne 0 && test ! -d "$gentop"; then
3607
4016
generated="$generated $gentop"
3609
for xlib in $convenience; do
3610
# Extract the objects.
3612
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3613
*) xabs=`pwd`"/$xlib" ;;
3615
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3616
xdir="$gentop/$xlib"
3618
$show "${rm}r $xdir"
3620
$show "$mkdir $xdir"
3623
if test "$status" -ne 0 && test ! -d "$xdir"; then
3626
# We will extract separately just the conflicting names and we will no
3627
# longer touch any unique names. It is faster to leave these extract
3628
# automatically by $AR in one run.
3629
$show "(cd $xdir && $AR x $xabs)"
3630
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3631
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3634
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3635
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3636
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3639
while test "$i" -le "$count"
3641
# Put our $i before any first dot (extension)
3642
# Never overwrite any file
3644
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3646
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3648
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3649
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3655
libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4018
func_extract_archives $gentop $convenience
4019
libobjs="$libobjs $func_extract_archives_result"
3660
4023
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3661
4024
eval flag=\"$thread_safe_flag_spec\"
3662
4025
linker_flags="$linker_flags $flag"
3670
4033
# Do each of the archive commands.
3671
4034
if test "$module" = yes && test -n "$module_cmds" ; then
3672
4035
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3673
eval cmds=\"$module_expsym_cmds\"
4036
eval test_cmds=\"$module_expsym_cmds\"
4037
cmds=$module_expsym_cmds
3675
eval cmds=\"$module_cmds\"
4039
eval test_cmds=\"$module_cmds\"
3678
4043
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3679
eval cmds=\"$archive_expsym_cmds\"
4044
eval test_cmds=\"$archive_expsym_cmds\"
4045
cmds=$archive_expsym_cmds
3681
eval cmds=\"$archive_cmds\"
4047
eval test_cmds=\"$archive_cmds\"
3685
if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
4052
if test "X$skipped_export" != "X:" &&
4053
len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3686
4054
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3783
4152
# value of $libobjs for piecewise linking.
3785
4154
# Do each of the archive commands.
4155
if test "$module" = yes && test -n "$module_cmds" ; then
4156
if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4157
cmds=$module_expsym_cmds
3786
4162
if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3787
eval cmds=\"$archive_expsym_cmds\"
4163
cmds=$archive_expsym_cmds
3789
eval cmds=\"$archive_cmds\"
3792
4169
# Append the command to remove the reloadable object files
3793
4170
# to the just-reset $cmds.
3794
eval cmds=\"\$cmds~$rm $delfiles\"
4171
eval cmds=\"\$cmds~\$rm $delfiles\"
3796
4173
save_ifs="$IFS"; IFS='~'
3797
4174
for cmd in $cmds; do
3798
4175
IFS="$save_ifs"
3800
$run eval "$cmd" || exit $?
4178
$run eval "$cmd" || {
4181
# Restore the uninstalled library and exit
4182
if test "$mode" = relink; then
4183
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
3802
4189
IFS="$save_ifs"
3804
4191
# Restore the uninstalled library and exit
3805
4192
if test "$mode" = relink; then
3806
4193
$run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4195
if test -n "$convenience"; then
4196
if test -z "$whole_archive_flag_spec"; then
4197
$show "${rm}r $gentop"
4198
$run ${rm}r "$gentop"
3810
4205
# Create links to the real library.
3873
4268
reload_conv_objs=
3875
4270
# reload_cmds runs $LD directly, so let us get rid of
3876
# -Wl from whole_archive_flag_spec
4271
# -Wl from whole_archive_flag_spec and hope we can get by with
4272
# turning comma into space..
3879
4275
if test -n "$convenience"; then
3880
4276
if test -n "$whole_archive_flag_spec"; then
3881
eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4277
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4278
reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
3883
4280
gentop="$output_objdir/${obj}x"
3884
$show "${rm}r $gentop"
3885
$run ${rm}r "$gentop"
3886
$show "$mkdir $gentop"
3887
$run $mkdir "$gentop"
3889
if test "$status" -ne 0 && test ! -d "$gentop"; then
3892
4281
generated="$generated $gentop"
3894
for xlib in $convenience; do
3895
# Extract the objects.
3897
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3898
*) xabs=`pwd`"/$xlib" ;;
3900
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3901
xdir="$gentop/$xlib"
3903
$show "${rm}r $xdir"
3905
$show "$mkdir $xdir"
3908
if test "$status" -ne 0 && test ! -d "$xdir"; then
3911
# We will extract separately just the conflicting names and we will no
3912
# longer touch any unique names. It is faster to leave these extract
3913
# automatically by $AR in one run.
3914
$show "(cd $xdir && $AR x $xabs)"
3915
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3916
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3919
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3920
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3921
$AR t "$xabs" | sort | uniq -cd | while read -r count name
3924
while test "$i" -le "$count"
3926
# Put our $i before any first dot (extension)
3927
# Never overwrite any file
3929
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3931
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3933
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3934
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3940
reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4283
func_extract_archives $gentop $convenience
4284
reload_conv_objs="$reload_objs $func_extract_archives_result"
4199
4578
# Prepare the list of exported symbols
4200
4579
if test -z "$export_symbols"; then
4201
export_symbols="$output_objdir/$output.exp"
4580
export_symbols="$output_objdir/$outputname.exp"
4202
4581
$run $rm $export_symbols
4203
$run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4582
$run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4584
*cygwin* | *mingw* )
4585
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4586
$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4205
$run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4206
$run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4590
$run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4591
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4207
4592
$run eval 'mv "$nlist"T "$nlist"'
4594
*cygwin* | *mingw* )
4595
$run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4596
$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4304
4714
# Now compile the dynamic symbol file.
4305
$show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4306
$run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4715
$show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4716
$run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4308
4718
# Clean up the generated files.
4309
4719
$show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4310
4720
$run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4312
4722
# Transform the symbol file into the correct name.
4313
compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4314
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4724
*cygwin* | *mingw* )
4725
if test -f "$output_objdir/${outputname}.def" ; then
4726
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4727
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4729
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4730
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4734
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4735
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4317
4740
$echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4324
4747
# really was required.
4326
4749
# Nullify the symbol file.
4327
compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4328
finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4750
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4751
finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4331
4754
if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4332
4755
# Replace the output file specification.
4333
compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4756
compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4334
4757
link_command="$compile_command$compile_rpath"
4336
4759
# We have no uninstalled library dependencies, so finalize right now.
4337
4760
$show "$link_command"
4338
4761
$run eval "$link_command"
4341
4764
# Delete the generated files.
4342
4765
if test -n "$dlsyms"; then
4540
4972
(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4541
4973
#endif /* DIR_SEPARATOR_2 */
4975
#ifndef PATH_SEPARATOR_2
4976
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4977
#else /* PATH_SEPARATOR_2 */
4978
# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4979
#endif /* PATH_SEPARATOR_2 */
4543
4981
#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4544
4982
#define XFREE(stale) do { \
4545
4983
if (stale) { free ((void *) stale); stale = 0; } \
4986
/* -DDEBUG is fairly common in CFLAGS. */
4988
#if defined DEBUGWRAPPER
4989
# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4991
# define DEBUG(format, ...)
4548
4994
const char *program_name = NULL;
4550
4996
void * xmalloc (size_t num);
4551
4997
char * xstrdup (const char *string);
4552
char * basename (const char *name);
4553
char * fnqualify(const char *path);
4998
const char * base_name (const char *name);
4999
char * find_executable(const char *wrapper);
5000
int check_executable(const char *path);
4554
5001
char * strendzap(char *str, const char *pat);
4555
5002
void lt_fatal (const char *message, ...);
4560
5007
char **newargz;
4563
program_name = (char *) xstrdup ((char *) basename (argv[0]));
5010
program_name = (char *) xstrdup (base_name (argv[0]));
5011
DEBUG("(main) argv[0] : %s\n",argv[0]);
5012
DEBUG("(main) program_name : %s\n",program_name);
4564
5013
newargz = XMALLOC(char *, argc+2);
4567
cat >> $cwrappersource <<EOF
4568
newargz[0] = "$SHELL";
5016
cat >> $cwrappersource <<EOF
5017
newargz[0] = (char *) xstrdup("$SHELL");
4571
cat >> $cwrappersource <<"EOF"
4572
newargz[1] = fnqualify(argv[0]);
5020
cat >> $cwrappersource <<"EOF"
5021
newargz[1] = find_executable(argv[0]);
5022
if (newargz[1] == NULL)
5023
lt_fatal("Couldn't find %s", argv[0]);
5024
DEBUG("(main) found exe at : %s\n",newargz[1]);
4573
5025
/* we know the script has the same name, without the .exe */
4574
5026
/* so make sure newargz[1] doesn't end in .exe */
4575
strendzap(newargz[1],".exe");
5027
strendzap(newargz[1],".exe");
4576
5028
for (i = 1; i < argc; i++)
4577
5029
newargz[i+1] = xstrdup(argv[i]);
4578
5030
newargz[argc+1] = NULL;
4581
cat >> $cwrappersource <<EOF
5032
for (i=0; i<argc+1; i++)
5034
DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5042
cat >> $cwrappersource <<EOF
5043
execv("$SHELL",(char const **)newargz);
5047
cat >> $cwrappersource <<EOF
4582
5048
execv("$SHELL",newargz);
4585
cat >> $cwrappersource <<"EOF"
5053
cat >> $cwrappersource <<"EOF"
4599
5068
xstrdup (const char *string)
4601
5070
return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4606
basename (const char *name)
5075
base_name (const char *name)
4608
5077
const char *base;
4610
5079
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4611
5080
/* Skip over the disk name in MSDOS pathnames. */
4612
if (isalpha (name[0]) && name[1] == ':')
5081
if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4616
5085
for (base = name; *name; name++)
4617
5086
if (IS_DIR_SEPARATOR (*name))
4618
5087
base = name + 1;
4619
return (char *) base;
4623
fnqualify(const char *path)
5092
check_executable(const char * path)
5096
DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5097
if ((!path) || (!*path))
5100
if ((stat (path, &st) >= 0) &&
5102
/* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5103
#if defined (S_IXOTH)
5104
((st.st_mode & S_IXOTH) == S_IXOTH) ||
5106
#if defined (S_IXGRP)
5107
((st.st_mode & S_IXGRP) == S_IXGRP) ||
5109
((st.st_mode & S_IXUSR) == S_IXUSR))
5116
/* Searches for the full path of the wrapper. Returns
5117
newly allocated full path name if found, NULL otherwise */
5119
find_executable (const char* wrapper)
5124
/* static buffer for getcwd */
4627
5125
char tmp[LT_PATHMAX + 1];
4629
assert(path != NULL);
4631
/* Is it qualified already? */
4632
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4633
if (isalpha (path[0]) && path[1] == ':')
4634
return xstrdup (path);
4636
if (IS_DIR_SEPARATOR (path[0]))
4637
return xstrdup (path);
4639
/* prepend the current directory */
4640
/* doesn't handle '~' */
5129
DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5131
if ((wrapper == NULL) || (*wrapper == '\0'))
5134
/* Absolute path? */
5135
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5136
if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5138
concat_name = xstrdup (wrapper);
5139
if (check_executable(concat_name))
5146
if (IS_DIR_SEPARATOR (wrapper[0]))
5148
concat_name = xstrdup (wrapper);
5149
if (check_executable(concat_name))
5153
#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5157
for (p = wrapper; *p; p++)
5165
/* no slashes; search PATH */
5166
const char* path = getenv ("PATH");
5169
for (p = path; *p; p = p_next)
5173
for (q = p; *q; q++)
5174
if (IS_PATH_SEPARATOR(*q))
5177
p_next = (*q == '\0' ? q : q + 1);
5180
/* empty path: current directory */
5181
if (getcwd (tmp, LT_PATHMAX) == NULL)
5182
lt_fatal ("getcwd failed");
5183
tmp_len = strlen(tmp);
5184
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5185
memcpy (concat_name, tmp, tmp_len);
5186
concat_name[tmp_len] = '/';
5187
strcpy (concat_name + tmp_len + 1, wrapper);
5191
concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5192
memcpy (concat_name, p, p_len);
5193
concat_name[p_len] = '/';
5194
strcpy (concat_name + p_len + 1, wrapper);
5196
if (check_executable(concat_name))
5201
/* not found in PATH; assume curdir */
5203
/* Relative path | not found in path: prepend cwd */
4641
5204
if (getcwd (tmp, LT_PATHMAX) == NULL)
4642
5205
lt_fatal ("getcwd failed");
4643
size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4644
p = XMALLOC(char, size);
4645
sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
5206
tmp_len = strlen(tmp);
5207
concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5208
memcpy (concat_name, tmp, tmp_len);
5209
concat_name[tmp_len] = '/';
5210
strcpy (concat_name + tmp_len + 1, wrapper);
5212
if (check_executable(concat_name))
4650
strendzap(char *str, const char *pat)
5219
strendzap(char *str, const char *pat)
4652
5221
size_t len, patlen;
4690
# we should really use a build-platform specific compiler
4691
# here, but OTOH, the wrappers (shell script and this C one)
4692
# are only useful if you want to execute the "real" binary.
4693
# Since the "real" binary is built for $host, then this
4694
# wrapper might as well be built for $host, too.
4695
$run $LTCC -s -o $cwrapper $cwrappersource
4699
trap "$rm $output; exit 1" 1 2 15
5259
# we should really use a build-platform specific compiler
5260
# here, but OTOH, the wrappers (shell script and this C one)
5261
# are only useful if you want to execute the "real" binary.
5262
# Since the "real" binary is built for $host, then this
5263
# wrapper might as well be built for $host, too.
5264
$run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5268
trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4701
5270
$echo > $output "\
4895
5476
if test -n "$addlibs"; then
4896
5477
gentop="$output_objdir/${outputname}x"
4897
$show "${rm}r $gentop"
4898
$run ${rm}r "$gentop"
4899
$show "$mkdir $gentop"
4900
$run $mkdir "$gentop"
4902
if test "$status" -ne 0 && test ! -d "$gentop"; then
4905
5478
generated="$generated $gentop"
4907
# Add in members from convenience archives.
4908
for xlib in $addlibs; do
4909
# Extract the objects.
4911
[\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4912
*) xabs=`pwd`"/$xlib" ;;
4914
xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4915
xdir="$gentop/$xlib"
4917
$show "${rm}r $xdir"
4919
$show "$mkdir $xdir"
4922
if test "$status" -ne 0 && test ! -d "$xdir"; then
4925
# We will extract separately just the conflicting names and we will no
4926
# longer touch any unique names. It is faster to leave these extract
4927
# automatically by $AR in one run.
4928
$show "(cd $xdir && $AR x $xabs)"
4929
$run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4930
if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4933
$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4934
$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4935
$AR t "$xabs" | sort | uniq -cd | while read -r count name
4938
while test "$i" -le "$count"
4940
# Put our $i before any first dot (extension)
4941
# Never overwrite any file
4943
while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4945
name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4947
$show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4948
$run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4954
oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5480
func_extract_archives $gentop $addlibs
5481
oldobjs="$oldobjs $func_extract_archives_result"
4958
5484
# Do each command in the archive commands.
4959
5485
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4960
eval cmds=\"$old_archive_from_new_cmds\"
5486
cmds=$old_archive_from_new_cmds
5488
# POSIX demands no paths to be encoded in archives. We have
5489
# to avoid creating archives with duplicate basenames if we
5490
# might have to extract them afterwards, e.g., when creating a
5491
# static archive out of a convenience library, or when linking
5492
# the entirety of a libtool archive into another (currently
5493
# not supported by libtool).
5494
if (for obj in $oldobjs
5496
$echo "X$obj" | $Xsed -e 's%^.*/%%'
5497
done | sort | sort -uc >/dev/null 2>&1); then
5500
$echo "copying selected object files to avoid basename conflicts..."
5502
if test -z "$gentop"; then
5503
gentop="$output_objdir/${outputname}x"
5504
generated="$generated $gentop"
5506
$show "${rm}r $gentop"
5507
$run ${rm}r "$gentop"
5508
$show "$mkdir $gentop"
5509
$run $mkdir "$gentop"
5511
if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5516
save_oldobjs=$oldobjs
5519
for obj in $save_oldobjs
5521
objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5522
case " $oldobjs " in
5523
" ") oldobjs=$obj ;;
5526
# Make sure we don't pick an alternate name that also
5528
newobj=lt$counter-$objbase
5529
counter=`expr $counter + 1`
5530
case " $oldobjs " in
5531
*[\ /]"$newobj "*) ;;
5532
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5535
$show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5536
$run ln "$obj" "$gentop/$newobj" ||
5537
$run cp "$obj" "$gentop/$newobj"
5538
oldobjs="$oldobjs $gentop/$newobj"
5540
*) oldobjs="$oldobjs $obj" ;;
4962
5545
eval cmds=\"$old_archive_cmds\"
4964
5547
if len=`expr "X$cmds" : ".*"` &&
4965
5548
test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5549
cmds=$old_archive_cmds
4968
5551
# the command line is too long to link in one step, link in parts
4969
5552
$echo "using piecewise archive linking..."
4974
5557
save_oldobjs=$oldobjs
4975
# GNU ar 2.10+ was changed to match POSIX; thus no paths are
4976
# encoded into archives. This makes 'ar r' malfunction in
4977
# this piecewise linking case whenever conflicting object
4978
# names appear in distinct ar calls; check, warn and compensate.
4979
if (for obj in $save_oldobjs
4981
$echo "X$obj" | $Xsed -e 's%^.*/%%'
4982
done | sort | sort -uc >/dev/null 2>&1); then
4985
$echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
4986
$echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
4989
5559
# Is there a better way of finding the last object in the list?
4990
5560
for obj in $save_oldobjs
4992
5562
last_oldobj=$obj
4994
5564
for obj in $save_oldobjs
4996
5566
oldobjs="$objlist $obj"
4997
5567
objlist="$objlist $obj"
4998
5568
eval test_cmds=\"$old_archive_cmds\"
4999
if len=`expr "X$test_cmds" : ".*"` &&
5569
if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5000
5570
test "$len" -le "$max_cmd_len"; then
5407
6004
if test "$#" -gt 0; then
5408
6005
# Delete the old symlinks, and create new ones.
6006
# Try `ln -sf' first, because the `ln' binary might depend on
6007
# the symlink we replace! Solaris /bin/ln does not understand -f,
6008
# so we also need to try rm && ln -s.
5411
6011
if test "$linkname" != "$realname"; then
5412
$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5413
$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
6012
$show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6013
$run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5418
6018
# Do each command in the postinstall commands.
5419
6019
lib="$destdir/$realname"
5420
eval cmds=\"$postinstall_cmds\"
6020
cmds=$postinstall_cmds
5421
6021
save_ifs="$IFS"; IFS='~'
5422
6022
for cmd in $cmds; do
5423
6023
IFS="$save_ifs"
5425
$run eval "$cmd" || exit $?
6026
$run eval "$cmd" || {
6029
# Restore the uninstalled library and exit
6030
if test "$mode" = relink; then
6031
$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5427
6037
IFS="$save_ifs"
5516
6126
notinst_deplibs=
5517
6127
relink_command=
5519
# To insure that "foo" is sourced, and not "foo.exe",
5520
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5521
# which disallows the automatic-append-.exe behavior.
5523
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5524
*) wrapperdot=${wrapper} ;;
6129
# Note that it is not necessary on cygwin/mingw to append a dot to
6130
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6131
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6132
# `FILE.' does not work on cygwin managed mounts.
5526
6134
# If there is no directory component, then add one.
5528
*/* | *\\*) . ${wrapperdot} ;;
5529
*) . ./${wrapperdot} ;;
6136
*/* | *\\*) . ${wrapper} ;;
6137
*) . ./${wrapper} ;;
5532
6140
# Check the variables that should have been set.
5533
6141
if test -z "$notinst_deplibs"; then
5534
6142
$echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5556
6164
relink_command=
5557
# To insure that "foo" is sourced, and not "foo.exe",
5558
# finese the cygwin/MSYS system by explicitly sourcing "foo."
5559
# which disallows the automatic-append-.exe behavior.
5561
*cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5562
*) wrapperdot=${wrapper} ;;
6165
# Note that it is not necessary on cygwin/mingw to append a dot to
6166
# foo even if both foo and FILE.exe exist: automatic-append-.exe
6167
# behavior happens only for exec(3), not for open(2)! Also, sourcing
6168
# `FILE.' does not work on cygwin managed mounts.
5564
6170
# If there is no directory component, then add one.
5566
*/* | *\\*) . ${wrapperdot} ;;
5567
*) . ./${wrapperdot} ;;
6172
*/* | *\\*) . ${wrapper} ;;
6173
*) . ./${wrapper} ;;
5571
6177
if test "$fast_install" = no && test -n "$relink_command"; then
5572
6178
if test "$finalize" = yes && test -z "$run"; then
5574
test -n "$TMPDIR" && tmpdir="$TMPDIR"
5575
tmpdir_mktemp=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
5576
if test "$?" = 0 ; then
5577
tmpdir="$tmpdir_mktemp"
5580
tmpdir="$tmpdir/libtool-$$"
5582
if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
5584
$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
6179
tmpdir=`func_mktempdir`
5587
6180
file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5588
6181
outputname="$tmpdir/$file"
5589
6182
# Replace the output file specification.
5590
relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6183
relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
5592
6185
$show "$relink_command"
5593
6186
if $run eval "$relink_command"; then :
6223
6832
-no-undefined declare that a library does not refer to external symbols
6224
6833
-o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6225
6834
-objectlist FILE Use a list of object files found in FILE to specify objects
6835
-precious-files-regex REGEX
6836
don't remove output files matching REGEX
6226
6837
-release RELEASE specify package release information
6227
6838
-rpath LIBDIR the created library will eventually be installed in LIBDIR
6228
6839
-R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6229
-static do not do any dynamic linking of libtool libraries
6840
-static do not do any dynamic linking of uninstalled libtool libraries
6841
-static-libtool-libs
6842
do not do any dynamic linking of libtool libraries
6230
6843
-version-info CURRENT[:REVISION[:AGE]]
6231
specify library version info [each variable defaults to 0]
6844
specify library version info [each variable defaults to 0]
6233
6846
All other options (arguments beginning with \`-') are ignored.