aboutsummaryrefslogtreecommitdiff
path: root/ltmain.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ltmain.sh')
-rw-r--r--ltmain.sh716
1 files changed, 414 insertions, 302 deletions
diff --git a/ltmain.sh b/ltmain.sh
index 1a224ac2..db4982d8 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,7 +1,7 @@
1# ltmain.sh - Provide generalized library-building support services. 1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun configure. 2# NOTE: Changing this file will not affect anything until you rerun configure.
3# 3#
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5# Free Software Foundation, Inc. 5# Free Software Foundation, Inc.
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7# 7#
@@ -17,7 +17,7 @@
17# 17#
18# You should have received a copy of the GNU General Public License 18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software 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.
21# 21#
22# As a special exception to the GNU General Public License, if you 22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a 23# distribute this file as part of a program that contains a
@@ -43,9 +43,14 @@ EXIT_FAILURE=1
43 43
44PROGRAM=ltmain.sh 44PROGRAM=ltmain.sh
45PACKAGE=libtool 45PACKAGE=libtool
46VERSION=1.5.6 46VERSION="1.5.20 Debian 1.5.20-2"
47TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $" 47TIMESTAMP=" (1.1220.2.287 2005/08/31 18:54:15)"
48 48
49# See if we are running on zsh, and set the options which allow our
50# commands through without removal of \ escapes.
51if test -n "${ZSH_VERSION+set}" ; then
52 setopt NO_GLOB_SUBST
53fi
49 54
50# Check that we have a working $echo. 55# Check that we have a working $echo.
51if test "X$1" = X--no-reexec; then 56if test "X$1" = X--no-reexec; then
@@ -83,14 +88,15 @@ rm="rm -f"
83Xsed="${SED}"' -e 1s/^X//' 88Xsed="${SED}"' -e 1s/^X//'
84sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 89sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
85# test EBCDIC or ASCII 90# test EBCDIC or ASCII
86case `echo A|tr A '\301'` in 91case `echo X|tr X '\101'` in
87 A) # EBCDIC based system 92 A) # ASCII based system
88 SP2NL="tr '\100' '\n'" 93 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
89 NL2SP="tr '\r\n' '\100\100'" 94 SP2NL='tr \040 \012'
95 NL2SP='tr \015\012 \040\040'
90 ;; 96 ;;
91 *) # Assume ASCII based system 97 *) # EBCDIC based system
92 SP2NL="tr '\040' '\012'" 98 SP2NL='tr \100 \n'
93 NL2SP="tr '\015\012' '\040\040'" 99 NL2SP='tr \r\n \100\100'
94 ;; 100 ;;
95esac 101esac
96 102
@@ -107,8 +113,9 @@ if test "${LANG+set}" = set; then
107fi 113fi
108 114
109# Make sure IFS has a sensible default 115# Make sure IFS has a sensible default
110: ${IFS=" 116lt_nl='
111"} 117'
118IFS=" $lt_nl"
112 119
113if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 120if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
114 $echo "$modename: not configured to build any kind of library" 1>&2 121 $echo "$modename: not configured to build any kind of library" 1>&2
@@ -138,7 +145,8 @@ o2lo="s/\\.${objext}\$/.lo/"
138# Need a lot of goo to handle *both* DLLs and import libs 145# Need a lot of goo to handle *both* DLLs and import libs
139# Has to be a shell function in order to 'eat' the argument 146# Has to be a shell function in order to 'eat' the argument
140# that is supplied when $file_magic_command is called. 147# that is supplied when $file_magic_command is called.
141func_win32_libid () { 148func_win32_libid ()
149{
142 win32_libid_type="unknown" 150 win32_libid_type="unknown"
143 win32_fileres=`file -L $1 2>/dev/null` 151 win32_fileres=`file -L $1 2>/dev/null`
144 case $win32_fileres in 152 case $win32_fileres in
@@ -178,7 +186,8 @@ func_win32_libid () {
178# Only attempt this if the compiler in the base compile 186# Only attempt this if the compiler in the base compile
179# command doesn't match the default compiler. 187# command doesn't match the default compiler.
180# arg is usually of the form 'gcc ...' 188# arg is usually of the form 'gcc ...'
181func_infer_tag () { 189func_infer_tag ()
190{
182 if test -n "$available_tags" && test -z "$tagname"; then 191 if test -n "$available_tags" && test -z "$tagname"; then
183 CC_quoted= 192 CC_quoted=
184 for arg in $CC; do 193 for arg in $CC; do
@@ -235,6 +244,108 @@ func_infer_tag () {
235 esac 244 esac
236 fi 245 fi
237} 246}
247
248
249# func_extract_an_archive dir oldlib
250func_extract_an_archive ()
251{
252 f_ex_an_ar_dir="$1"; shift
253 f_ex_an_ar_oldlib="$1"
254
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
258 :
259 else
260 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
261 exit $EXIT_FAILURE
262 fi
263}
264
265# func_extract_archives gentop oldlib ...
266func_extract_archives ()
267{
268 my_gentop="$1"; shift
269 my_oldlibs=${1+"$@"}
270 my_oldobjs=""
271 my_xlib=""
272 my_xabs=""
273 my_xdir=""
274 my_status=""
275
276 $show "${rm}r $my_gentop"
277 $run ${rm}r "$my_gentop"
278 $show "$mkdir $my_gentop"
279 $run $mkdir "$my_gentop"
280 my_status=$?
281 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
282 exit $my_status
283 fi
284
285 for my_xlib in $my_oldlibs; do
286 # Extract the objects.
287 case $my_xlib in
288 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
289 *) my_xabs=`pwd`"/$my_xlib" ;;
290 esac
291 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292 my_xdir="$my_gentop/$my_xlib"
293
294 $show "${rm}r $my_xdir"
295 $run ${rm}r "$my_xdir"
296 $show "$mkdir $my_xdir"
297 $run $mkdir "$my_xdir"
298 status=$?
299 if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300 exit $status
301 fi
302 case $host in
303 *-darwin*)
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
310 darwin_curdir=`pwd`
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://'`
315 darwin_arch=
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}"
322 cd "$darwin_curdir"
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`
327 darwin_file=
328 darwin_files=
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
333 ${rm}r unfat-$$
334 cd "$darwin_orig_dir"
335 else
336 cd "$darwin_orig_dir"
337 func_extract_an_archive "$my_xdir" "$my_xabs"
338 fi # $darwin_arches
339 fi # $run
340 ;;
341 *)
342 func_extract_an_archive "$my_xdir" "$my_xabs"
343 ;;
344 esac
345 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
346 done
347 func_extract_archives_result="$my_oldobjs"
348}
238# End of Shell function definitions 349# End of Shell function definitions
239##################################### 350#####################################
240 351
@@ -305,10 +416,10 @@ do
305 --version) 416 --version)
306 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 417 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
307 $echo 418 $echo
308 $echo "Copyright (C) 2003 Free Software Foundation, Inc." 419 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
309 $echo "This is free software; see the source for copying conditions. There is NO" 420 $echo "This is free software; see the source for copying conditions. There is NO"
310 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 421 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
311 exit $EXIT_SUCCESS 422 exit $?
312 ;; 423 ;;
313 424
314 --config) 425 --config)
@@ -317,7 +428,7 @@ do
317 for tagname in $taglist; do 428 for tagname in $taglist; do
318 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 429 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
319 done 430 done
320 exit $EXIT_SUCCESS 431 exit $?
321 ;; 432 ;;
322 433
323 --debug) 434 --debug)
@@ -342,7 +453,7 @@ do
342 else 453 else
343 $echo "disable static libraries" 454 $echo "disable static libraries"
344 fi 455 fi
345 exit $EXIT_SUCCESS 456 exit $?
346 ;; 457 ;;
347 458
348 --finish) mode="finish" ;; 459 --finish) mode="finish" ;;
@@ -399,7 +510,7 @@ if test -z "$show_help"; then
399 # Infer the operation mode. 510 # Infer the operation mode.
400 if test -z "$mode"; then 511 if test -z "$mode"; then
401 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 512 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
402 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 513 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
403 case $nonopt in 514 case $nonopt in
404 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 515 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
405 mode=link 516 mode=link
@@ -465,7 +576,7 @@ if test -z "$show_help"; then
465 576
466 for arg 577 for arg
467 do 578 do
468 case "$arg_mode" in 579 case $arg_mode in
469 arg ) 580 arg )
470 # do not "continue". Instead, add this to base_compile 581 # do not "continue". Instead, add this to base_compile
471 lastarg="$arg" 582 lastarg="$arg"
@@ -547,7 +658,10 @@ if test -z "$show_help"; then
547 case $lastarg in 658 case $lastarg in
548 # Double-quote args containing other shell metacharacters. 659 # Double-quote args containing other shell metacharacters.
549 # Many Bourne shells cannot handle close brackets correctly 660 # Many Bourne shells cannot handle close brackets correctly
550 # in scan sets, so we specify it separately. 661 # in scan sets, and some SunOS ksh mistreat backslash-escaping
662 # in scan sets (worked around with variable expansion),
663 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
664 # at all, so we specify them separately.
551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 665 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
552 lastarg="\"$lastarg\"" 666 lastarg="\"$lastarg\""
553 ;; 667 ;;
@@ -621,6 +735,14 @@ if test -z "$show_help"; then
621 esac 735 esac
622 done 736 done
623 737
738 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
739 case $qlibobj in
740 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
741 qlibobj="\"$qlibobj\"" ;;
742 esac
743 test "X$libobj" != "X$qlibobj" \
744 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
745 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
624 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 746 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
625 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 747 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
626 if test "X$xdir" = "X$obj"; then 748 if test "X$xdir" = "X$obj"; then
@@ -693,12 +815,17 @@ compiler."
693 $run $rm $removelist 815 $run $rm $removelist
694 exit $EXIT_FAILURE 816 exit $EXIT_FAILURE
695 fi 817 fi
696 $echo $srcfile > "$lockfile" 818 $echo "$srcfile" > "$lockfile"
697 fi 819 fi
698 820
699 if test -n "$fix_srcfile_path"; then 821 if test -n "$fix_srcfile_path"; then
700 eval srcfile=\"$fix_srcfile_path\" 822 eval srcfile=\"$fix_srcfile_path\"
701 fi 823 fi
824 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
825 case $qsrcfile in
826 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827 qsrcfile="\"$qsrcfile\"" ;;
828 esac
702 829
703 $run $rm "$libobj" "${libobj}T" 830 $run $rm "$libobj" "${libobj}T"
704 831
@@ -720,10 +847,10 @@ EOF
720 fbsd_hideous_sh_bug=$base_compile 847 fbsd_hideous_sh_bug=$base_compile
721 848
722 if test "$pic_mode" != no; then 849 if test "$pic_mode" != no; then
723 command="$base_compile $srcfile $pic_flag" 850 command="$base_compile $qsrcfile $pic_flag"
724 else 851 else
725 # Don't build PIC code 852 # Don't build PIC code
726 command="$base_compile $srcfile" 853 command="$base_compile $qsrcfile"
727 fi 854 fi
728 855
729 if test ! -d "${xdir}$objdir"; then 856 if test ! -d "${xdir}$objdir"; then
@@ -803,9 +930,9 @@ EOF
803 if test "$build_old_libs" = yes; then 930 if test "$build_old_libs" = yes; then
804 if test "$pic_mode" != yes; then 931 if test "$pic_mode" != yes; then
805 # Don't build PIC code 932 # Don't build PIC code
806 command="$base_compile $srcfile" 933 command="$base_compile $qsrcfile"
807 else 934 else
808 command="$base_compile $srcfile $pic_flag" 935 command="$base_compile $qsrcfile $pic_flag"
809 fi 936 fi
810 if test "$compiler_c_o" = yes; then 937 if test "$compiler_c_o" = yes; then
811 command="$command -o $obj" 938 command="$command -o $obj"
@@ -1227,6 +1354,13 @@ EOF
1227 prev= 1354 prev=
1228 continue 1355 continue
1229 ;; 1356 ;;
1357 darwin_framework)
1358 compiler_flags="$compiler_flags $arg"
1359 compile_command="$compile_command $arg"
1360 finalize_command="$finalize_command $arg"
1361 prev=
1362 continue
1363 ;;
1230 *) 1364 *)
1231 eval "$prev=\"\$arg\"" 1365 eval "$prev=\"\$arg\""
1232 prev= 1366 prev=
@@ -1285,6 +1419,14 @@ EOF
1285 continue 1419 continue
1286 ;; 1420 ;;
1287 1421
1422 -framework|-arch)
1423 prev=darwin_framework
1424 compiler_flags="$compiler_flags $arg"
1425 compile_command="$compile_command $arg"
1426 finalize_command="$finalize_command $arg"
1427 continue
1428 ;;
1429
1288 -inst-prefix-dir) 1430 -inst-prefix-dir)
1289 prev=inst_prefix 1431 prev=inst_prefix
1290 continue 1432 continue
@@ -1345,7 +1487,7 @@ EOF
1345 # These systems don't actually have a C library (as such) 1487 # These systems don't actually have a C library (as such)
1346 test "X$arg" = "X-lc" && continue 1488 test "X$arg" = "X-lc" && continue
1347 ;; 1489 ;;
1348 *-*-openbsd* | *-*-freebsd*) 1490 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1349 # Do not include libc due to us having libc/libc_r. 1491 # Do not include libc due to us having libc/libc_r.
1350 test "X$arg" = "X-lc" && continue 1492 test "X$arg" = "X-lc" && continue
1351 ;; 1493 ;;
@@ -1356,7 +1498,7 @@ EOF
1356 esac 1498 esac
1357 elif test "X$arg" = "X-lc_r"; then 1499 elif test "X$arg" = "X-lc_r"; then
1358 case $host in 1500 case $host in
1359 *-*-openbsd* | *-*-freebsd*) 1501 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1360 # Do not include libc_r directly, use -pthread flag. 1502 # Do not include libc_r directly, use -pthread flag.
1361 continue 1503 continue
1362 ;; 1504 ;;
@@ -1366,8 +1508,20 @@ EOF
1366 continue 1508 continue
1367 ;; 1509 ;;
1368 1510
1511 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1512 # classes, name mangling, and exception handling.
1513 -model)
1514 compile_command="$compile_command $arg"
1515 compiler_flags="$compiler_flags $arg"
1516 finalize_command="$finalize_command $arg"
1517 prev=xcompiler
1518 continue
1519 ;;
1520
1369 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1521 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1370 deplibs="$deplibs $arg" 1522 compiler_flags="$compiler_flags $arg"
1523 compile_command="$compile_command $arg"
1524 finalize_command="$finalize_command $arg"
1371 continue 1525 continue
1372 ;; 1526 ;;
1373 1527
@@ -1376,13 +1530,14 @@ EOF
1376 continue 1530 continue
1377 ;; 1531 ;;
1378 1532
1379 # gcc -m* arguments should be passed to the linker via $compiler_flags 1533 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1380 # in order to pass architecture information to the linker 1534 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1381 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo 1535 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1382 # but this is not reliable with gcc because gcc may use -mfoo to 1536 # +DA*, +DD* enable 64-bit mode on the HP compiler
1383 # select a different linker, different libraries, etc, while 1537 # -q* pass through compiler args for the IBM compiler
1384 # -Wl,-mfoo simply passes -mfoo to the linker. 1538 # -m* pass through architecture-specific compiler args for GCC
1385 -m*) 1539 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1540
1386 # Unknown arguments in both finalize_command and compile_command need 1541 # Unknown arguments in both finalize_command and compile_command need
1387 # to be aesthetically quoted because they are evaled later. 1542 # to be aesthetically quoted because they are evaled later.
1388 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1543 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
@@ -1858,7 +2013,7 @@ EOF
1858 compile_deplibs="$deplib $compile_deplibs" 2013 compile_deplibs="$deplib $compile_deplibs"
1859 finalize_deplibs="$deplib $finalize_deplibs" 2014 finalize_deplibs="$deplib $finalize_deplibs"
1860 else 2015 else
1861 deplibs="$deplib $deplibs" 2016 compiler_flags="$compiler_flags $deplib"
1862 fi 2017 fi
1863 continue 2018 continue
1864 ;; 2019 ;;
@@ -1977,7 +2132,22 @@ EOF
1977 fi 2132 fi
1978 case $linkmode in 2133 case $linkmode in
1979 lib) 2134 lib)
1980 if test "$deplibs_check_method" != pass_all; then 2135 valid_a_lib=no
2136 case $deplibs_check_method in
2137 match_pattern*)
2138 set dummy $deplibs_check_method
2139 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2140 if eval $echo \"$deplib\" 2>/dev/null \
2141 | $SED 10q \
2142 | $EGREP "$match_pattern_regex" > /dev/null; then
2143 valid_a_lib=yes
2144 fi
2145 ;;
2146 pass_all)
2147 valid_a_lib=yes
2148 ;;
2149 esac
2150 if test "$valid_a_lib" != yes; then
1981 $echo 2151 $echo
1982 $echo "*** Warning: Trying to link with static lib archive $deplib." 2152 $echo "*** Warning: Trying to link with static lib archive $deplib."
1983 $echo "*** I have the capability to make that library automatically link in when" 2153 $echo "*** I have the capability to make that library automatically link in when"
@@ -2051,6 +2221,8 @@ EOF
2051 # it will not redefine variables installed, or shouldnotlink 2221 # it will not redefine variables installed, or shouldnotlink
2052 installed=yes 2222 installed=yes
2053 shouldnotlink=no 2223 shouldnotlink=no
2224 avoidtemprpath=
2225
2054 2226
2055 # Read the .la file 2227 # Read the .la file
2056 case $lib in 2228 case $lib in
@@ -2149,11 +2321,19 @@ EOF
2149 dir="$libdir" 2321 dir="$libdir"
2150 absdir="$libdir" 2322 absdir="$libdir"
2151 fi 2323 fi
2324 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2152 else 2325 else
2153 dir="$ladir/$objdir" 2326 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2154 absdir="$abs_ladir/$objdir" 2327 dir="$ladir"
2155 # Remove this search path later 2328 absdir="$abs_ladir"
2156 notinst_path="$notinst_path $abs_ladir" 2329 # Remove this search path later
2330 notinst_path="$notinst_path $abs_ladir"
2331 else
2332 dir="$ladir/$objdir"
2333 absdir="$abs_ladir/$objdir"
2334 # Remove this search path later
2335 notinst_path="$notinst_path $abs_ladir"
2336 fi
2157 fi # $installed = yes 2337 fi # $installed = yes
2158 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2338 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2159 2339
@@ -2226,12 +2406,12 @@ EOF
2226 if test -n "$library_names" && 2406 if test -n "$library_names" &&
2227 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2407 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2228 # We need to hardcode the library path 2408 # We need to hardcode the library path
2229 if test -n "$shlibpath_var"; then 2409 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2230 # Make sure the rpath contains only unique directories. 2410 # Make sure the rpath contains only unique directories.
2231 case "$temp_rpath " in 2411 case "$temp_rpath " in
2232 *" $dir "*) ;; 2412 *" $dir "*) ;;
2233 *" $absdir "*) ;; 2413 *" $absdir "*) ;;
2234 *) temp_rpath="$temp_rpath $dir" ;; 2414 *) temp_rpath="$temp_rpath $absdir" ;;
2235 esac 2415 esac
2236 fi 2416 fi
2237 2417
@@ -2417,7 +2597,7 @@ EOF
2417 add_dir="-L$dir" 2597 add_dir="-L$dir"
2418 # Try looking first in the location we're being installed to. 2598 # Try looking first in the location we're being installed to.
2419 if test -n "$inst_prefix_dir"; then 2599 if test -n "$inst_prefix_dir"; then
2420 case "$libdir" in 2600 case $libdir in
2421 [\\/]*) 2601 [\\/]*)
2422 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2602 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2423 ;; 2603 ;;
@@ -2490,7 +2670,7 @@ EOF
2490 add_dir="-L$libdir" 2670 add_dir="-L$libdir"
2491 # Try looking first in the location we're being installed to. 2671 # Try looking first in the location we're being installed to.
2492 if test -n "$inst_prefix_dir"; then 2672 if test -n "$inst_prefix_dir"; then
2493 case "$libdir" in 2673 case $libdir in
2494 [\\/]*) 2674 [\\/]*)
2495 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2675 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2496 ;; 2676 ;;
@@ -2551,8 +2731,6 @@ EOF
2551 fi 2731 fi
2552 fi 2732 fi
2553 else 2733 else
2554 convenience="$convenience $dir/$old_library"
2555 old_convenience="$old_convenience $dir/$old_library"
2556 deplibs="$dir/$old_library $deplibs" 2734 deplibs="$dir/$old_library $deplibs"
2557 link_static=yes 2735 link_static=yes
2558 fi 2736 fi
@@ -2670,12 +2848,12 @@ EOF
2670 *) continue ;; 2848 *) continue ;;
2671 esac 2849 esac
2672 case " $deplibs " in 2850 case " $deplibs " in
2673 *" $depdepl "*) ;; 2851 *" $path "*) ;;
2674 *) deplibs="$depdepl $deplibs" ;; 2852 *) deplibs="$path $deplibs" ;;
2675 esac 2853 esac
2676 case " $deplibs " in 2854 case " $deplibs " in
2677 *" $path "*) ;; 2855 *" $depdepl "*) ;;
2678 *) deplibs="$deplibs $path" ;; 2856 *) deplibs="$depdepl $deplibs" ;;
2679 esac 2857 esac
2680 done 2858 done
2681 fi # link_all_deplibs != no 2859 fi # link_all_deplibs != no
@@ -2947,7 +3125,7 @@ EOF
2947 case $current in 3125 case $current in
2948 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]) ;; 3126 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]) ;;
2949 *) 3127 *)
2950 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 3128 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2951 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3129 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2952 exit $EXIT_FAILURE 3130 exit $EXIT_FAILURE
2953 ;; 3131 ;;
@@ -2956,7 +3134,7 @@ EOF
2956 case $revision in 3134 case $revision in
2957 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]) ;; 3135 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]) ;;
2958 *) 3136 *)
2959 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 3137 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2960 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3138 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2961 exit $EXIT_FAILURE 3139 exit $EXIT_FAILURE
2962 ;; 3140 ;;
@@ -2965,7 +3143,7 @@ EOF
2965 case $age in 3143 case $age in
2966 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]) ;; 3144 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]) ;;
2967 *) 3145 *)
2968 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 3146 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2969 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3147 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2970 exit $EXIT_FAILURE 3148 exit $EXIT_FAILURE
2971 ;; 3149 ;;
@@ -2991,7 +3169,7 @@ EOF
2991 versuffix="$major.$age.$revision" 3169 versuffix="$major.$age.$revision"
2992 # Darwin ld doesn't like 0 for these options... 3170 # Darwin ld doesn't like 0 for these options...
2993 minor_current=`expr $current + 1` 3171 minor_current=`expr $current + 1`
2994 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3172 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2995 ;; 3173 ;;
2996 3174
2997 freebsd-aout) 3175 freebsd-aout)
@@ -3197,7 +3375,7 @@ EOF
3197 *-*-netbsd*) 3375 *-*-netbsd*)
3198 # Don't link with libc until the a.out ld.so is fixed. 3376 # Don't link with libc until the a.out ld.so is fixed.
3199 ;; 3377 ;;
3200 *-*-openbsd* | *-*-freebsd*) 3378 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3201 # Do not include libc due to us having libc/libc_r. 3379 # Do not include libc due to us having libc/libc_r.
3202 test "X$arg" = "X-lc" && continue 3380 test "X$arg" = "X-lc" && continue
3203 ;; 3381 ;;
@@ -3247,7 +3425,7 @@ EOF
3247 if test "$?" -eq 0 ; then 3425 if test "$?" -eq 0 ; then
3248 ldd_output=`ldd conftest` 3426 ldd_output=`ldd conftest`
3249 for i in $deplibs; do 3427 for i in $deplibs; do
3250 name="`expr $i : '-l\(.*\)'`" 3428 name=`expr $i : '-l\(.*\)'`
3251 # If $name is empty we are operating on a -L argument. 3429 # If $name is empty we are operating on a -L argument.
3252 if test "$name" != "" && test "$name" -ne "0"; then 3430 if test "$name" != "" && test "$name" -ne "0"; then
3253 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3431 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3284,7 +3462,7 @@ EOF
3284 # Error occurred in the first compile. Let's try to salvage 3462 # Error occurred in the first compile. Let's try to salvage
3285 # the situation: Compile a separate program for each library. 3463 # the situation: Compile a separate program for each library.
3286 for i in $deplibs; do 3464 for i in $deplibs; do
3287 name="`expr $i : '-l\(.*\)'`" 3465 name=`expr $i : '-l\(.*\)'`
3288 # If $name is empty we are operating on a -L argument. 3466 # If $name is empty we are operating on a -L argument.
3289 if test "$name" != "" && test "$name" != "0"; then 3467 if test "$name" != "" && test "$name" != "0"; then
3290 $rm conftest 3468 $rm conftest
@@ -3336,7 +3514,7 @@ EOF
3336 set dummy $deplibs_check_method 3514 set dummy $deplibs_check_method
3337 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3515 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3338 for a_deplib in $deplibs; do 3516 for a_deplib in $deplibs; do
3339 name="`expr $a_deplib : '-l\(.*\)'`" 3517 name=`expr $a_deplib : '-l\(.*\)'`
3340 # If $name is empty we are operating on a -L argument. 3518 # If $name is empty we are operating on a -L argument.
3341 if test "$name" != "" && test "$name" != "0"; then 3519 if test "$name" != "" && test "$name" != "0"; then
3342 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3520 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3405,7 +3583,7 @@ EOF
3405 set dummy $deplibs_check_method 3583 set dummy $deplibs_check_method
3406 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3584 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3407 for a_deplib in $deplibs; do 3585 for a_deplib in $deplibs; do
3408 name="`expr $a_deplib : '-l\(.*\)'`" 3586 name=`expr $a_deplib : '-l\(.*\)'`
3409 # If $name is empty we are operating on a -L argument. 3587 # If $name is empty we are operating on a -L argument.
3410 if test -n "$name" && test "$name" != "0"; then 3588 if test -n "$name" && test "$name" != "0"; then
3411 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3589 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3646,6 +3824,9 @@ EOF
3646 # The command line is too long to execute in one step. 3824 # The command line is too long to execute in one step.
3647 $show "using reloadable object file for export list..." 3825 $show "using reloadable object file for export list..."
3648 skipped_export=: 3826 skipped_export=:
3827 # Break out early, otherwise skipped_export may be
3828 # set to false by a later but shorter cmd.
3829 break
3649 fi 3830 fi
3650 done 3831 done
3651 IFS="$save_ifs" 3832 IFS="$save_ifs"
@@ -3679,67 +3860,13 @@ EOF
3679 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3860 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3680 else 3861 else
3681 gentop="$output_objdir/${outputname}x" 3862 gentop="$output_objdir/${outputname}x"
3682 $show "${rm}r $gentop"
3683 $run ${rm}r "$gentop"
3684 $show "$mkdir $gentop"
3685 $run $mkdir "$gentop"
3686 status=$?
3687 if test "$status" -ne 0 && test ! -d "$gentop"; then
3688 exit $status
3689 fi
3690 generated="$generated $gentop" 3863 generated="$generated $gentop"
3691 3864
3692 for xlib in $convenience; do 3865 func_extract_archives $gentop $convenience
3693 # Extract the objects. 3866 libobjs="$libobjs $func_extract_archives_result"
3694 case $xlib in
3695 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3696 *) xabs=`pwd`"/$xlib" ;;
3697 esac
3698 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3699 xdir="$gentop/$xlib"
3700
3701 $show "${rm}r $xdir"
3702 $run ${rm}r "$xdir"
3703 $show "$mkdir $xdir"
3704 $run $mkdir "$xdir"
3705 status=$?
3706 if test "$status" -ne 0 && test ! -d "$xdir"; then
3707 exit $status
3708 fi
3709 # We will extract separately just the conflicting names and we will no
3710 # longer touch any unique names. It is faster to leave these extract
3711 # automatically by $AR in one run.
3712 $show "(cd $xdir && $AR x $xabs)"
3713 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3714 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3715 :
3716 else
3717 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3718 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3719 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3720 do
3721 i=1
3722 while test "$i" -le "$count"
3723 do
3724 # Put our $i before any first dot (extension)
3725 # Never overwrite any file
3726 name_to="$name"
3727 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3728 do
3729 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3730 done
3731 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3732 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3733 i=`expr $i + 1`
3734 done
3735 done
3736 fi
3737
3738 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3739 done
3740 fi 3867 fi
3741 fi 3868 fi
3742 3869
3743 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 3870 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3744 eval flag=\"$thread_safe_flag_spec\" 3871 eval flag=\"$thread_safe_flag_spec\"
3745 linker_flags="$linker_flags $flag" 3872 linker_flags="$linker_flags $flag"
@@ -3769,7 +3896,8 @@ EOF
3769 fi 3896 fi
3770 fi 3897 fi
3771 3898
3772 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && 3899 if test "X$skipped_export" != "X:" &&
3900 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3773 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 3901 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3774 : 3902 :
3775 else 3903 else
@@ -3788,6 +3916,7 @@ EOF
3788 save_libobjs=$libobjs 3916 save_libobjs=$libobjs
3789 fi 3917 fi
3790 save_output=$output 3918 save_output=$output
3919 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3791 3920
3792 # Clear the reloadable object creation command queue and 3921 # Clear the reloadable object creation command queue and
3793 # initialize k to one. 3922 # initialize k to one.
@@ -3797,13 +3926,13 @@ EOF
3797 delfiles= 3926 delfiles=
3798 last_robj= 3927 last_robj=
3799 k=1 3928 k=1
3800 output=$output_objdir/$save_output-${k}.$objext 3929 output=$output_objdir/$output_la-${k}.$objext
3801 # Loop over the list of objects to be linked. 3930 # Loop over the list of objects to be linked.
3802 for obj in $save_libobjs 3931 for obj in $save_libobjs
3803 do 3932 do
3804 eval test_cmds=\"$reload_cmds $objlist $last_robj\" 3933 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3805 if test "X$objlist" = X || 3934 if test "X$objlist" = X ||
3806 { len=`expr "X$test_cmds" : ".*"` && 3935 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3807 test "$len" -le "$max_cmd_len"; }; then 3936 test "$len" -le "$max_cmd_len"; }; then
3808 objlist="$objlist $obj" 3937 objlist="$objlist $obj"
3809 else 3938 else
@@ -3817,9 +3946,9 @@ EOF
3817 # the last one created. 3946 # the last one created.
3818 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 3947 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3819 fi 3948 fi
3820 last_robj=$output_objdir/$save_output-${k}.$objext 3949 last_robj=$output_objdir/$output_la-${k}.$objext
3821 k=`expr $k + 1` 3950 k=`expr $k + 1`
3822 output=$output_objdir/$save_output-${k}.$objext 3951 output=$output_objdir/$output_la-${k}.$objext
3823 objlist=$obj 3952 objlist=$obj
3824 len=1 3953 len=1
3825 fi 3954 fi
@@ -3839,13 +3968,13 @@ EOF
3839 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 3968 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3840 fi 3969 fi
3841 3970
3842 # Set up a command to remove the reloadale object files 3971 # Set up a command to remove the reloadable object files
3843 # after they are used. 3972 # after they are used.
3844 i=0 3973 i=0
3845 while test "$i" -lt "$k" 3974 while test "$i" -lt "$k"
3846 do 3975 do
3847 i=`expr $i + 1` 3976 i=`expr $i + 1`
3848 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 3977 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3849 done 3978 done
3850 3979
3851 $echo "creating a temporary reloadable object file: $output" 3980 $echo "creating a temporary reloadable object file: $output"
@@ -3893,13 +4022,30 @@ EOF
3893 IFS="$save_ifs" 4022 IFS="$save_ifs"
3894 eval cmd=\"$cmd\" 4023 eval cmd=\"$cmd\"
3895 $show "$cmd" 4024 $show "$cmd"
3896 $run eval "$cmd" || exit $? 4025 $run eval "$cmd" || {
4026 lt_exit=$?
4027
4028 # Restore the uninstalled library and exit
4029 if test "$mode" = relink; then
4030 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4031 fi
4032
4033 exit $lt_exit
4034 }
3897 done 4035 done
3898 IFS="$save_ifs" 4036 IFS="$save_ifs"
3899 4037
3900 # Restore the uninstalled library and exit 4038 # Restore the uninstalled library and exit
3901 if test "$mode" = relink; then 4039 if test "$mode" = relink; then
3902 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4040 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4041
4042 if test -n "$convenience"; then
4043 if test -z "$whole_archive_flag_spec"; then
4044 $show "${rm}r $gentop"
4045 $run ${rm}r "$gentop"
4046 fi
4047 fi
4048
3903 exit $EXIT_SUCCESS 4049 exit $EXIT_SUCCESS
3904 fi 4050 fi
3905 4051
@@ -3977,64 +4123,10 @@ EOF
3977 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4123 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3978 else 4124 else
3979 gentop="$output_objdir/${obj}x" 4125 gentop="$output_objdir/${obj}x"
3980 $show "${rm}r $gentop"
3981 $run ${rm}r "$gentop"
3982 $show "$mkdir $gentop"
3983 $run $mkdir "$gentop"
3984 status=$?
3985 if test "$status" -ne 0 && test ! -d "$gentop"; then
3986 exit $status
3987 fi
3988 generated="$generated $gentop" 4126 generated="$generated $gentop"
3989 4127
3990 for xlib in $convenience; do 4128 func_extract_archives $gentop $convenience
3991 # Extract the objects. 4129 reload_conv_objs="$reload_objs $func_extract_archives_result"
3992 case $xlib in
3993 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3994 *) xabs=`pwd`"/$xlib" ;;
3995 esac
3996 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3997 xdir="$gentop/$xlib"
3998
3999 $show "${rm}r $xdir"
4000 $run ${rm}r "$xdir"
4001 $show "$mkdir $xdir"
4002 $run $mkdir "$xdir"
4003 status=$?
4004 if test "$status" -ne 0 && test ! -d "$xdir"; then
4005 exit $status
4006 fi
4007 # We will extract separately just the conflicting names and we will no
4008 # longer touch any unique names. It is faster to leave these extract
4009 # automatically by $AR in one run.
4010 $show "(cd $xdir && $AR x $xabs)"
4011 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4012 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4013 :
4014 else
4015 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4016 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4017 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4018 do
4019 i=1
4020 while test "$i" -le "$count"
4021 do
4022 # Put our $i before any first dot (extension)
4023 # Never overwrite any file
4024 name_to="$name"
4025 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4026 do
4027 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4028 done
4029 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4030 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4031 i=`expr $i + 1`
4032 done
4033 done
4034 fi
4035
4036 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4037 done
4038 fi 4130 fi
4039 fi 4131 fi
4040 4132
@@ -4296,12 +4388,12 @@ extern \"C\" {
4296 4388
4297 # Prepare the list of exported symbols 4389 # Prepare the list of exported symbols
4298 if test -z "$export_symbols"; then 4390 if test -z "$export_symbols"; then
4299 export_symbols="$output_objdir/$output.exp" 4391 export_symbols="$output_objdir/$outputname.exp"
4300 $run $rm $export_symbols 4392 $run $rm $export_symbols
4301 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4393 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4302 else 4394 else
4303 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' 4395 $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4304 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' 4396 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4305 $run eval 'mv "$nlist"T "$nlist"' 4397 $run eval 'mv "$nlist"T "$nlist"'
4306 fi 4398 fi
4307 fi 4399 fi
@@ -4353,7 +4445,26 @@ extern \"C\" {
4353#endif 4445#endif
4354 4446
4355/* The mapping between symbol names and symbols. */ 4447/* The mapping between symbol names and symbols. */
4448"
4449
4450 case $host in
4451 *cygwin* | *mingw* )
4452 $echo >> "$output_objdir/$dlsyms" "\
4453/* DATA imports from DLLs on WIN32 can't be const, because
4454 runtime relocations are performed -- see ld's documentation
4455 on pseudo-relocs */
4456struct {
4457"
4458 ;;
4459 * )
4460 $echo >> "$output_objdir/$dlsyms" "\
4356const struct { 4461const struct {
4462"
4463 ;;
4464 esac
4465
4466
4467 $echo >> "$output_objdir/$dlsyms" "\
4357 const char *name; 4468 const char *name;
4358 lt_ptr address; 4469 lt_ptr address;
4359} 4470}
@@ -4582,7 +4693,7 @@ static const void *lt_preloaded_setup() {
4582 esac 4693 esac
4583 case $host in 4694 case $host in
4584 *cygwin* | *mingw* ) 4695 *cygwin* | *mingw* )
4585 cwrappersource=`$echo ${objdir}/lt-${output}.c` 4696 cwrappersource=`$echo ${objdir}/lt-${outputname}.c`
4586 cwrapper=`$echo ${output}.exe` 4697 cwrapper=`$echo ${output}.exe`
4587 $rm $cwrappersource $cwrapper 4698 $rm $cwrappersource $cwrapper
4588 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4699 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
@@ -4681,6 +4792,7 @@ EOF
4681EOF 4792EOF
4682 4793
4683 cat >> $cwrappersource <<"EOF" 4794 cat >> $cwrappersource <<"EOF"
4795 return 127;
4684} 4796}
4685 4797
4686void * 4798void *
@@ -4815,7 +4927,7 @@ sed_quote_subst='$sed_quote_subst'
4815 4927
4816# The HP-UX ksh and POSIX shell print the target directory to stdout 4928# The HP-UX ksh and POSIX shell print the target directory to stdout
4817# if CDPATH is set. 4929# if CDPATH is set.
4818if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi 4930(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4819 4931
4820relink_command=\"$relink_command\" 4932relink_command=\"$relink_command\"
4821 4933
@@ -4944,13 +5056,13 @@ else
4944 # Backslashes separate directories on plain windows 5056 # Backslashes separate directories on plain windows
4945 *-*-mingw | *-*-os2*) 5057 *-*-mingw | *-*-os2*)
4946 $echo >> $output "\ 5058 $echo >> $output "\
4947 exec \$progdir\\\\\$program \${1+\"\$@\"} 5059 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4948" 5060"
4949 ;; 5061 ;;
4950 5062
4951 *) 5063 *)
4952 $echo >> $output "\ 5064 $echo >> $output "\
4953 exec \$progdir/\$program \${1+\"\$@\"} 5065 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4954" 5066"
4955 ;; 5067 ;;
4956 esac 5068 esac
@@ -4960,7 +5072,7 @@ else
4960 fi 5072 fi
4961 else 5073 else
4962 # The program doesn't exist. 5074 # The program doesn't exist.
4963 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 5075 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4964 \$echo \"This script is just a wrapper for \$program.\" 1>&2 5076 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4965 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5077 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4966 exit $EXIT_FAILURE 5078 exit $EXIT_FAILURE
@@ -4992,71 +5104,73 @@ fi\
4992 5104
4993 if test -n "$addlibs"; then 5105 if test -n "$addlibs"; then
4994 gentop="$output_objdir/${outputname}x" 5106 gentop="$output_objdir/${outputname}x"
4995 $show "${rm}r $gentop"
4996 $run ${rm}r "$gentop"
4997 $show "$mkdir $gentop"
4998 $run $mkdir "$gentop"
4999 status=$?
5000 if test "$status" -ne 0 && test ! -d "$gentop"; then
5001 exit $status
5002 fi
5003 generated="$generated $gentop" 5107 generated="$generated $gentop"
5004 5108
5005 # Add in members from convenience archives. 5109 func_extract_archives $gentop $addlibs
5006 for xlib in $addlibs; do 5110 oldobjs="$oldobjs $func_extract_archives_result"
5007 # Extract the objects.
5008 case $xlib in
5009 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5010 *) xabs=`pwd`"/$xlib" ;;
5011 esac
5012 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5013 xdir="$gentop/$xlib"
5014
5015 $show "${rm}r $xdir"
5016 $run ${rm}r "$xdir"
5017 $show "$mkdir $xdir"
5018 $run $mkdir "$xdir"
5019 status=$?
5020 if test "$status" -ne 0 && test ! -d "$xdir"; then
5021 exit $status
5022 fi
5023 # We will extract separately just the conflicting names and we will no
5024 # longer touch any unique names. It is faster to leave these extract
5025 # automatically by $AR in one run.
5026 $show "(cd $xdir && $AR x $xabs)"
5027 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5028 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5029 :
5030 else
5031 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5032 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5033 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5034 do
5035 i=1
5036 while test "$i" -le "$count"
5037 do
5038 # Put our $i before any first dot (extension)
5039 # Never overwrite any file
5040 name_to="$name"
5041 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5042 do
5043 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5044 done
5045 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5046 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5047 i=`expr $i + 1`
5048 done
5049 done
5050 fi
5051
5052 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5053 done
5054 fi 5111 fi
5055 5112
5056 # Do each command in the archive commands. 5113 # Do each command in the archive commands.
5057 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5114 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5058 cmds=$old_archive_from_new_cmds 5115 cmds=$old_archive_from_new_cmds
5059 else 5116 else
5117 # POSIX demands no paths to be encoded in archives. We have
5118 # to avoid creating archives with duplicate basenames if we
5119 # might have to extract them afterwards, e.g., when creating a
5120 # static archive out of a convenience library, or when linking
5121 # the entirety of a libtool archive into another (currently
5122 # not supported by libtool).
5123 if (for obj in $oldobjs
5124 do
5125 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5126 done | sort | sort -uc >/dev/null 2>&1); then
5127 :
5128 else
5129 $echo "copying selected object files to avoid basename conflicts..."
5130
5131 if test -z "$gentop"; then
5132 gentop="$output_objdir/${outputname}x"
5133 generated="$generated $gentop"
5134
5135 $show "${rm}r $gentop"
5136 $run ${rm}r "$gentop"
5137 $show "$mkdir $gentop"
5138 $run $mkdir "$gentop"
5139 status=$?
5140 if test "$status" -ne 0 && test ! -d "$gentop"; then
5141 exit $status
5142 fi
5143 fi
5144
5145 save_oldobjs=$oldobjs
5146 oldobjs=
5147 counter=1
5148 for obj in $save_oldobjs
5149 do
5150 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5151 case " $oldobjs " in
5152 " ") oldobjs=$obj ;;
5153 *[\ /]"$objbase "*)
5154 while :; do
5155 # Make sure we don't pick an alternate name that also
5156 # overlaps.
5157 newobj=lt$counter-$objbase
5158 counter=`expr $counter + 1`
5159 case " $oldobjs " in
5160 *[\ /]"$newobj "*) ;;
5161 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5162 esac
5163 done
5164 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5165 $run ln "$obj" "$gentop/$newobj" ||
5166 $run cp "$obj" "$gentop/$newobj"
5167 oldobjs="$oldobjs $gentop/$newobj"
5168 ;;
5169 *) oldobjs="$oldobjs $obj" ;;
5170 esac
5171 done
5172 fi
5173
5060 eval cmds=\"$old_archive_cmds\" 5174 eval cmds=\"$old_archive_cmds\"
5061 5175
5062 if len=`expr "X$cmds" : ".*"` && 5176 if len=`expr "X$cmds" : ".*"` &&
@@ -5070,20 +5184,7 @@ fi\
5070 objlist= 5184 objlist=
5071 concat_cmds= 5185 concat_cmds=
5072 save_oldobjs=$oldobjs 5186 save_oldobjs=$oldobjs
5073 # GNU ar 2.10+ was changed to match POSIX; thus no paths are 5187
5074 # encoded into archives. This makes 'ar r' malfunction in
5075 # this piecewise linking case whenever conflicting object
5076 # names appear in distinct ar calls; check, warn and compensate.
5077 if (for obj in $save_oldobjs
5078 do
5079 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5080 done | sort | sort -uc >/dev/null 2>&1); then
5081 :
5082 else
5083 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5084 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5085 AR_FLAGS=cq
5086 fi
5087 # Is there a better way of finding the last object in the list? 5188 # Is there a better way of finding the last object in the list?
5088 for obj in $save_oldobjs 5189 for obj in $save_oldobjs
5089 do 5190 do
@@ -5094,7 +5195,7 @@ fi\
5094 oldobjs="$objlist $obj" 5195 oldobjs="$objlist $obj"
5095 objlist="$objlist $obj" 5196 objlist="$objlist $obj"
5096 eval test_cmds=\"$old_archive_cmds\" 5197 eval test_cmds=\"$old_archive_cmds\"
5097 if len=`expr "X$test_cmds" : ".*"` && 5198 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5098 test "$len" -le "$max_cmd_len"; then 5199 test "$len" -le "$max_cmd_len"; then
5099 : 5200 :
5100 else 5201 else
@@ -5291,11 +5392,11 @@ relink_command=\"$relink_command\""
5291 # install_prog (especially on Windows NT). 5392 # install_prog (especially on Windows NT).
5292 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5393 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5293 # Allow the use of GNU shtool's install command. 5394 # Allow the use of GNU shtool's install command.
5294 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 5395 $echo "X$nonopt" | grep shtool > /dev/null; then
5295 # Aesthetically quote it. 5396 # Aesthetically quote it.
5296 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5397 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5297 case $arg in 5398 case $arg in
5298 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5399 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5299 arg="\"$arg\"" 5400 arg="\"$arg\""
5300 ;; 5401 ;;
5301 esac 5402 esac
@@ -5304,14 +5405,14 @@ relink_command=\"$relink_command\""
5304 shift 5405 shift
5305 else 5406 else
5306 install_prog= 5407 install_prog=
5307 arg="$nonopt" 5408 arg=$nonopt
5308 fi 5409 fi
5309 5410
5310 # The real first argument should be the name of the installation program. 5411 # The real first argument should be the name of the installation program.
5311 # Aesthetically quote it. 5412 # Aesthetically quote it.
5312 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5413 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5313 case $arg in 5414 case $arg in
5314 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5415 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5315 arg="\"$arg\"" 5416 arg="\"$arg\""
5316 ;; 5417 ;;
5317 esac 5418 esac
@@ -5329,28 +5430,31 @@ relink_command=\"$relink_command\""
5329 do 5430 do
5330 if test -n "$dest"; then 5431 if test -n "$dest"; then
5331 files="$files $dest" 5432 files="$files $dest"
5332 dest="$arg" 5433 dest=$arg
5333 continue 5434 continue
5334 fi 5435 fi
5335 5436
5336 case $arg in 5437 case $arg in
5337 -d) isdir=yes ;; 5438 -d) isdir=yes ;;
5338 -f) prev="-f" ;; 5439 -f)
5339 -g) prev="-g" ;; 5440 case " $install_prog " in
5340 -m) prev="-m" ;; 5441 *[\\\ /]cp\ *) ;;
5341 -o) prev="-o" ;; 5442 *) prev=$arg ;;
5443 esac
5444 ;;
5445 -g | -m | -o) prev=$arg ;;
5342 -s) 5446 -s)
5343 stripme=" -s" 5447 stripme=" -s"
5344 continue 5448 continue
5345 ;; 5449 ;;
5346 -*) ;; 5450 -*)
5347 5451 ;;
5348 *) 5452 *)
5349 # If the previous option needed an argument, then skip it. 5453 # If the previous option needed an argument, then skip it.
5350 if test -n "$prev"; then 5454 if test -n "$prev"; then
5351 prev= 5455 prev=
5352 else 5456 else
5353 dest="$arg" 5457 dest=$arg
5354 continue 5458 continue
5355 fi 5459 fi
5356 ;; 5460 ;;
@@ -5359,7 +5463,7 @@ relink_command=\"$relink_command\""
5359 # Aesthetically quote the argument. 5463 # Aesthetically quote the argument.
5360 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5464 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5361 case $arg in 5465 case $arg in
5362 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5466 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5363 arg="\"$arg\"" 5467 arg="\"$arg\""
5364 ;; 5468 ;;
5365 esac 5469 esac
@@ -5528,11 +5632,14 @@ relink_command=\"$relink_command\""
5528 5632
5529 if test "$#" -gt 0; then 5633 if test "$#" -gt 0; then
5530 # Delete the old symlinks, and create new ones. 5634 # Delete the old symlinks, and create new ones.
5635 # Try `ln -sf' first, because the `ln' binary might depend on
5636 # the symlink we replace! Solaris /bin/ln does not understand -f,
5637 # so we also need to try rm && ln -s.
5531 for linkname 5638 for linkname
5532 do 5639 do
5533 if test "$linkname" != "$realname"; then 5640 if test "$linkname" != "$realname"; then
5534 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 5641 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5535 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 5642 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5536 fi 5643 fi
5537 done 5644 done
5538 fi 5645 fi
@@ -5545,7 +5652,16 @@ relink_command=\"$relink_command\""
5545 IFS="$save_ifs" 5652 IFS="$save_ifs"
5546 eval cmd=\"$cmd\" 5653 eval cmd=\"$cmd\"
5547 $show "$cmd" 5654 $show "$cmd"
5548 $run eval "$cmd" || exit $? 5655 $run eval "$cmd" || {
5656 lt_exit=$?
5657
5658 # Restore the uninstalled library and exit
5659 if test "$mode" = relink; then
5660 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5661 fi
5662
5663 exit $lt_exit
5664 }
5549 done 5665 done
5550 IFS="$save_ifs" 5666 IFS="$save_ifs"
5551 fi 5667 fi
@@ -5639,17 +5755,15 @@ relink_command=\"$relink_command\""
5639 notinst_deplibs= 5755 notinst_deplibs=
5640 relink_command= 5756 relink_command=
5641 5757
5642 # To insure that "foo" is sourced, and not "foo.exe", 5758 # Note that it is not necessary on cygwin/mingw to append a dot to
5643 # finese the cygwin/MSYS system by explicitly sourcing "foo." 5759 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5644 # which disallows the automatic-append-.exe behavior. 5760 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5645 case $build in 5761 # `FILE.' does not work on cygwin managed mounts.
5646 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 5762 #
5647 *) wrapperdot=${wrapper} ;;
5648 esac
5649 # If there is no directory component, then add one. 5763 # If there is no directory component, then add one.
5650 case $file in 5764 case $wrapper in
5651 */* | *\\*) . ${wrapperdot} ;; 5765 */* | *\\*) . ${wrapper} ;;
5652 *) . ./${wrapperdot} ;; 5766 *) . ./${wrapper} ;;
5653 esac 5767 esac
5654 5768
5655 # Check the variables that should have been set. 5769 # Check the variables that should have been set.
@@ -5677,17 +5791,15 @@ relink_command=\"$relink_command\""
5677 done 5791 done
5678 5792
5679 relink_command= 5793 relink_command=
5680 # To insure that "foo" is sourced, and not "foo.exe", 5794 # Note that it is not necessary on cygwin/mingw to append a dot to
5681 # finese the cygwin/MSYS system by explicitly sourcing "foo." 5795 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5682 # which disallows the automatic-append-.exe behavior. 5796 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5683 case $build in 5797 # `FILE.' does not work on cygwin managed mounts.
5684 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 5798 #
5685 *) wrapperdot=${wrapper} ;;
5686 esac
5687 # If there is no directory component, then add one. 5799 # If there is no directory component, then add one.
5688 case $file in 5800 case $wrapper in
5689 */* | *\\*) . ${wrapperdot} ;; 5801 */* | *\\*) . ${wrapper} ;;
5690 *) . ./${wrapperdot} ;; 5802 *) . ./${wrapper} ;;
5691 esac 5803 esac
5692 5804
5693 outputname= 5805 outputname=
@@ -5728,7 +5840,7 @@ relink_command=\"$relink_command\""
5728 fi 5840 fi
5729 5841
5730 # remove .exe since cygwin /usr/bin/install will append another 5842 # remove .exe since cygwin /usr/bin/install will append another
5731 # one anyways 5843 # one anyway
5732 case $install_prog,$host in 5844 case $install_prog,$host in
5733 */usr/bin/install*,*cygwin*) 5845 */usr/bin/install*,*cygwin*)
5734 case $file:$destfile in 5846 case $file:$destfile in
@@ -6398,7 +6510,7 @@ esac
6398$echo 6510$echo
6399$echo "Try \`$modename --help' for more information about other modes." 6511$echo "Try \`$modename --help' for more information about other modes."
6400 6512
6401exit $EXIT_SUCCESS 6513exit $?
6402 6514
6403# The TAGs below are defined such that we never get into a situation 6515# The TAGs below are defined such that we never get into a situation
6404# in which we disable both kinds of libraries. Given conflicting 6516# in which we disable both kinds of libraries. Given conflicting