aboutsummaryrefslogtreecommitdiff
path: root/ltmain.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ltmain.sh')
-rw-r--r--ltmain.sh1255
1 files changed, 850 insertions, 405 deletions
diff --git a/ltmain.sh b/ltmain.sh
index 1a224ac2..c715b594 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.22 Debian 1.5.22-4"
47TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $" 47TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
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
@@ -125,6 +132,8 @@ run=
125show="$echo" 132show="$echo"
126show_help= 133show_help=
127execute_dlfiles= 134execute_dlfiles=
135duplicate_deps=no
136preserve_args=
128lo2o="s/\\.lo\$/.${objext}/" 137lo2o="s/\\.lo\$/.${objext}/"
129o2lo="s/\\.${objext}\$/.lo/" 138o2lo="s/\\.${objext}\$/.lo/"
130 139
@@ -132,13 +141,51 @@ o2lo="s/\\.${objext}\$/.lo/"
132# Shell function definitions: 141# Shell function definitions:
133# This seems to be the best place for them 142# This seems to be the best place for them
134 143
144# func_mktempdir [string]
145# Make a temporary directory that won't clash with other running
146# libtool processes, and avoids race conditions if possible. If
147# given, STRING is the basename for that directory.
148func_mktempdir ()
149{
150 my_template="${TMPDIR-/tmp}/${1-$progname}"
151
152 if test "$run" = ":"; then
153 # Return a directory name, but don't create it in dry-run mode
154 my_tmpdir="${my_template}-$$"
155 else
156
157 # If mktemp works, use that first and foremost
158 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
159
160 if test ! -d "$my_tmpdir"; then
161 # Failing that, at least try and use $RANDOM to avoid a race
162 my_tmpdir="${my_template}-${RANDOM-0}$$"
163
164 save_mktempdir_umask=`umask`
165 umask 0077
166 $mkdir "$my_tmpdir"
167 umask $save_mktempdir_umask
168 fi
169
170 # If we're not in dry-run mode, bomb out on failure
171 test -d "$my_tmpdir" || {
172 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
173 exit $EXIT_FAILURE
174 }
175 fi
176
177 $echo "X$my_tmpdir" | $Xsed
178}
179
180
135# func_win32_libid arg 181# func_win32_libid arg
136# return the library type of file 'arg' 182# return the library type of file 'arg'
137# 183#
138# Need a lot of goo to handle *both* DLLs and import libs 184# 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 185# Has to be a shell function in order to 'eat' the argument
140# that is supplied when $file_magic_command is called. 186# that is supplied when $file_magic_command is called.
141func_win32_libid () { 187func_win32_libid ()
188{
142 win32_libid_type="unknown" 189 win32_libid_type="unknown"
143 win32_fileres=`file -L $1 2>/dev/null` 190 win32_fileres=`file -L $1 2>/dev/null`
144 case $win32_fileres in 191 case $win32_fileres in
@@ -149,12 +196,11 @@ func_win32_libid () {
149 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 196 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
150 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 197 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
151 win32_nmres=`eval $NM -f posix -A $1 | \ 198 win32_nmres=`eval $NM -f posix -A $1 | \
152 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` 199 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
153 if test "X$win32_nmres" = "Ximport" ; then 200 case $win32_nmres in
154 win32_libid_type="x86 archive import" 201 import*) win32_libid_type="x86 archive import";;
155 else 202 *) win32_libid_type="x86 archive static";;
156 win32_libid_type="x86 archive static" 203 esac
157 fi
158 fi 204 fi
159 ;; 205 ;;
160 *DLL*) 206 *DLL*)
@@ -178,7 +224,8 @@ func_win32_libid () {
178# Only attempt this if the compiler in the base compile 224# Only attempt this if the compiler in the base compile
179# command doesn't match the default compiler. 225# command doesn't match the default compiler.
180# arg is usually of the form 'gcc ...' 226# arg is usually of the form 'gcc ...'
181func_infer_tag () { 227func_infer_tag ()
228{
182 if test -n "$available_tags" && test -z "$tagname"; then 229 if test -n "$available_tags" && test -z "$tagname"; then
183 CC_quoted= 230 CC_quoted=
184 for arg in $CC; do 231 for arg in $CC; do
@@ -235,12 +282,116 @@ func_infer_tag () {
235 esac 282 esac
236 fi 283 fi
237} 284}
285
286
287# func_extract_an_archive dir oldlib
288func_extract_an_archive ()
289{
290 f_ex_an_ar_dir="$1"; shift
291 f_ex_an_ar_oldlib="$1"
292
293 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
294 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
295 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
296 :
297 else
298 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
299 exit $EXIT_FAILURE
300 fi
301}
302
303# func_extract_archives gentop oldlib ...
304func_extract_archives ()
305{
306 my_gentop="$1"; shift
307 my_oldlibs=${1+"$@"}
308 my_oldobjs=""
309 my_xlib=""
310 my_xabs=""
311 my_xdir=""
312 my_status=""
313
314 $show "${rm}r $my_gentop"
315 $run ${rm}r "$my_gentop"
316 $show "$mkdir $my_gentop"
317 $run $mkdir "$my_gentop"
318 my_status=$?
319 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
320 exit $my_status
321 fi
322
323 for my_xlib in $my_oldlibs; do
324 # Extract the objects.
325 case $my_xlib in
326 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
327 *) my_xabs=`pwd`"/$my_xlib" ;;
328 esac
329 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
330 my_xdir="$my_gentop/$my_xlib"
331
332 $show "${rm}r $my_xdir"
333 $run ${rm}r "$my_xdir"
334 $show "$mkdir $my_xdir"
335 $run $mkdir "$my_xdir"
336 exit_status=$?
337 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
338 exit $exit_status
339 fi
340 case $host in
341 *-darwin*)
342 $show "Extracting $my_xabs"
343 # Do not bother doing anything if just a dry run
344 if test -z "$run"; then
345 darwin_orig_dir=`pwd`
346 cd $my_xdir || exit $?
347 darwin_archive=$my_xabs
348 darwin_curdir=`pwd`
349 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
350 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
351 if test -n "$darwin_arches"; then
352 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
353 darwin_arch=
354 $show "$darwin_base_archive has multiple architectures $darwin_arches"
355 for darwin_arch in $darwin_arches ; do
356 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
357 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
358 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
360 cd "$darwin_curdir"
361 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
362 done # $darwin_arches
363 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
364 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
365 darwin_file=
366 darwin_files=
367 for darwin_file in $darwin_filelist; do
368 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
369 lipo -create -output "$darwin_file" $darwin_files
370 done # $darwin_filelist
371 ${rm}r unfat-$$
372 cd "$darwin_orig_dir"
373 else
374 cd "$darwin_orig_dir"
375 func_extract_an_archive "$my_xdir" "$my_xabs"
376 fi # $darwin_arches
377 fi # $run
378 ;;
379 *)
380 func_extract_an_archive "$my_xdir" "$my_xabs"
381 ;;
382 esac
383 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
384 done
385 func_extract_archives_result="$my_oldobjs"
386}
238# End of Shell function definitions 387# End of Shell function definitions
239##################################### 388#####################################
240 389
241# Darwin sucks 390# Darwin sucks
242eval std_shrext=\"$shrext_cmds\" 391eval std_shrext=\"$shrext_cmds\"
243 392
393disable_libs=no
394
244# Parse our command line options once, thoroughly. 395# Parse our command line options once, thoroughly.
245while test "$#" -gt 0 396while test "$#" -gt 0
246do 397do
@@ -305,10 +456,10 @@ do
305 --version) 456 --version)
306 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 457 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
307 $echo 458 $echo
308 $echo "Copyright (C) 2003 Free Software Foundation, Inc." 459 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
309 $echo "This is free software; see the source for copying conditions. There is NO" 460 $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." 461 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
311 exit $EXIT_SUCCESS 462 exit $?
312 ;; 463 ;;
313 464
314 --config) 465 --config)
@@ -317,7 +468,7 @@ do
317 for tagname in $taglist; do 468 for tagname in $taglist; do
318 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 469 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
319 done 470 done
320 exit $EXIT_SUCCESS 471 exit $?
321 ;; 472 ;;
322 473
323 --debug) 474 --debug)
@@ -342,7 +493,7 @@ do
342 else 493 else
343 $echo "disable static libraries" 494 $echo "disable static libraries"
344 fi 495 fi
345 exit $EXIT_SUCCESS 496 exit $?
346 ;; 497 ;;
347 498
348 --finish) mode="finish" ;; 499 --finish) mode="finish" ;;
@@ -357,7 +508,11 @@ do
357 preserve_args="$preserve_args $arg" 508 preserve_args="$preserve_args $arg"
358 ;; 509 ;;
359 510
360 --tag) prevopt="--tag" prev=tag ;; 511 --tag)
512 prevopt="--tag"
513 prev=tag
514 preserve_args="$preserve_args --tag"
515 ;;
361 --tag=*) 516 --tag=*)
362 set tag "$optarg" ${1+"$@"} 517 set tag "$optarg" ${1+"$@"}
363 shift 518 shift
@@ -389,6 +544,18 @@ if test -n "$prevopt"; then
389 exit $EXIT_FAILURE 544 exit $EXIT_FAILURE
390fi 545fi
391 546
547case $disable_libs in
548no)
549 ;;
550shared)
551 build_libtool_libs=no
552 build_old_libs=yes
553 ;;
554static)
555 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
556 ;;
557esac
558
392# If this variable is set in any of the actions, the command in it 559# If this variable is set in any of the actions, the command in it
393# will be execed at the end. This prevents here-documents from being 560# will be execed at the end. This prevents here-documents from being
394# left over by shells. 561# left over by shells.
@@ -399,7 +566,7 @@ if test -z "$show_help"; then
399 # Infer the operation mode. 566 # Infer the operation mode.
400 if test -z "$mode"; then 567 if test -z "$mode"; then
401 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 568 $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 569 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
403 case $nonopt in 570 case $nonopt in
404 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 571 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
405 mode=link 572 mode=link
@@ -465,7 +632,7 @@ if test -z "$show_help"; then
465 632
466 for arg 633 for arg
467 do 634 do
468 case "$arg_mode" in 635 case $arg_mode in
469 arg ) 636 arg )
470 # do not "continue". Instead, add this to base_compile 637 # do not "continue". Instead, add this to base_compile
471 lastarg="$arg" 638 lastarg="$arg"
@@ -547,7 +714,10 @@ if test -z "$show_help"; then
547 case $lastarg in 714 case $lastarg in
548 # Double-quote args containing other shell metacharacters. 715 # Double-quote args containing other shell metacharacters.
549 # Many Bourne shells cannot handle close brackets correctly 716 # Many Bourne shells cannot handle close brackets correctly
550 # in scan sets, so we specify it separately. 717 # in scan sets, and some SunOS ksh mistreat backslash-escaping
718 # in scan sets (worked around with variable expansion),
719 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
720 # at all, so we specify them separately.
551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 721 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
552 lastarg="\"$lastarg\"" 722 lastarg="\"$lastarg\""
553 ;; 723 ;;
@@ -621,6 +791,14 @@ if test -z "$show_help"; then
621 esac 791 esac
622 done 792 done
623 793
794 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
795 case $qlibobj in
796 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
797 qlibobj="\"$qlibobj\"" ;;
798 esac
799 test "X$libobj" != "X$qlibobj" \
800 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
801 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
624 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 802 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
625 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 803 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
626 if test "X$xdir" = "X$obj"; then 804 if test "X$xdir" = "X$obj"; then
@@ -693,12 +871,17 @@ compiler."
693 $run $rm $removelist 871 $run $rm $removelist
694 exit $EXIT_FAILURE 872 exit $EXIT_FAILURE
695 fi 873 fi
696 $echo $srcfile > "$lockfile" 874 $echo "$srcfile" > "$lockfile"
697 fi 875 fi
698 876
699 if test -n "$fix_srcfile_path"; then 877 if test -n "$fix_srcfile_path"; then
700 eval srcfile=\"$fix_srcfile_path\" 878 eval srcfile=\"$fix_srcfile_path\"
701 fi 879 fi
880 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
881 case $qsrcfile in
882 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
883 qsrcfile="\"$qsrcfile\"" ;;
884 esac
702 885
703 $run $rm "$libobj" "${libobj}T" 886 $run $rm "$libobj" "${libobj}T"
704 887
@@ -720,18 +903,18 @@ EOF
720 fbsd_hideous_sh_bug=$base_compile 903 fbsd_hideous_sh_bug=$base_compile
721 904
722 if test "$pic_mode" != no; then 905 if test "$pic_mode" != no; then
723 command="$base_compile $srcfile $pic_flag" 906 command="$base_compile $qsrcfile $pic_flag"
724 else 907 else
725 # Don't build PIC code 908 # Don't build PIC code
726 command="$base_compile $srcfile" 909 command="$base_compile $qsrcfile"
727 fi 910 fi
728 911
729 if test ! -d "${xdir}$objdir"; then 912 if test ! -d "${xdir}$objdir"; then
730 $show "$mkdir ${xdir}$objdir" 913 $show "$mkdir ${xdir}$objdir"
731 $run $mkdir ${xdir}$objdir 914 $run $mkdir ${xdir}$objdir
732 status=$? 915 exit_status=$?
733 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then 916 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
734 exit $status 917 exit $exit_status
735 fi 918 fi
736 fi 919 fi
737 920
@@ -803,9 +986,9 @@ EOF
803 if test "$build_old_libs" = yes; then 986 if test "$build_old_libs" = yes; then
804 if test "$pic_mode" != yes; then 987 if test "$pic_mode" != yes; then
805 # Don't build PIC code 988 # Don't build PIC code
806 command="$base_compile $srcfile" 989 command="$base_compile $qsrcfile"
807 else 990 else
808 command="$base_compile $srcfile $pic_flag" 991 command="$base_compile $qsrcfile $pic_flag"
809 fi 992 fi
810 if test "$compiler_c_o" = yes; then 993 if test "$compiler_c_o" = yes; then
811 command="$command -o $obj" 994 command="$command -o $obj"
@@ -934,6 +1117,7 @@ EOF
934 no_install=no 1117 no_install=no
935 objs= 1118 objs=
936 non_pic_objects= 1119 non_pic_objects=
1120 notinst_path= # paths that contain not-installed libtool libraries
937 precious_files_regex= 1121 precious_files_regex=
938 prefer_static_libs=no 1122 prefer_static_libs=no
939 preload=no 1123 preload=no
@@ -962,14 +1146,15 @@ EOF
962 if test -n "$link_static_flag"; then 1146 if test -n "$link_static_flag"; then
963 dlopen_self=$dlopen_self_static 1147 dlopen_self=$dlopen_self_static
964 fi 1148 fi
1149 prefer_static_libs=yes
965 else 1150 else
966 if test -z "$pic_flag" && test -n "$link_static_flag"; then 1151 if test -z "$pic_flag" && test -n "$link_static_flag"; then
967 dlopen_self=$dlopen_self_static 1152 dlopen_self=$dlopen_self_static
968 fi 1153 fi
1154 prefer_static_libs=built
969 fi 1155 fi
970 build_libtool_libs=no 1156 build_libtool_libs=no
971 build_old_libs=yes 1157 build_old_libs=yes
972 prefer_static_libs=yes
973 break 1158 break
974 ;; 1159 ;;
975 esac 1160 esac
@@ -1144,6 +1329,11 @@ EOF
1144 if test -z "$pic_object" || test "$pic_object" = none ; then 1329 if test -z "$pic_object" || test "$pic_object" = none ; then
1145 arg="$non_pic_object" 1330 arg="$non_pic_object"
1146 fi 1331 fi
1332 else
1333 # If the PIC object exists, use it instead.
1334 # $xdir was prepended to $pic_object above.
1335 non_pic_object="$pic_object"
1336 non_pic_objects="$non_pic_objects $non_pic_object"
1147 fi 1337 fi
1148 else 1338 else
1149 # Only an error if not doing a dry-run. 1339 # Only an error if not doing a dry-run.
@@ -1227,6 +1417,13 @@ EOF
1227 prev= 1417 prev=
1228 continue 1418 continue
1229 ;; 1419 ;;
1420 darwin_framework|darwin_framework_skip)
1421 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1422 compile_command="$compile_command $arg"
1423 finalize_command="$finalize_command $arg"
1424 prev=
1425 continue
1426 ;;
1230 *) 1427 *)
1231 eval "$prev=\"\$arg\"" 1428 eval "$prev=\"\$arg\""
1232 prev= 1429 prev=
@@ -1285,6 +1482,18 @@ EOF
1285 continue 1482 continue
1286 ;; 1483 ;;
1287 1484
1485 -framework|-arch|-isysroot)
1486 case " $CC " in
1487 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1488 prev=darwin_framework_skip ;;
1489 *) compiler_flags="$compiler_flags $arg"
1490 prev=darwin_framework ;;
1491 esac
1492 compile_command="$compile_command $arg"
1493 finalize_command="$finalize_command $arg"
1494 continue
1495 ;;
1496
1288 -inst-prefix-dir) 1497 -inst-prefix-dir)
1289 prev=inst_prefix 1498 prev=inst_prefix
1290 continue 1499 continue
@@ -1311,7 +1520,8 @@ EOF
1311 absdir=`cd "$dir" && pwd` 1520 absdir=`cd "$dir" && pwd`
1312 if test -z "$absdir"; then 1521 if test -z "$absdir"; then
1313 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1522 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1314 exit $EXIT_FAILURE 1523 absdir="$dir"
1524 notinst_path="$notinst_path $dir"
1315 fi 1525 fi
1316 dir="$absdir" 1526 dir="$absdir"
1317 ;; 1527 ;;
@@ -1325,10 +1535,15 @@ EOF
1325 esac 1535 esac
1326 case $host in 1536 case $host in
1327 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1537 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1538 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1328 case :$dllsearchpath: in 1539 case :$dllsearchpath: in
1329 *":$dir:"*) ;; 1540 *":$dir:"*) ;;
1330 *) dllsearchpath="$dllsearchpath:$dir";; 1541 *) dllsearchpath="$dllsearchpath:$dir";;
1331 esac 1542 esac
1543 case :$dllsearchpath: in
1544 *":$testbindir:"*) ;;
1545 *) dllsearchpath="$dllsearchpath:$testbindir";;
1546 esac
1332 ;; 1547 ;;
1333 esac 1548 esac
1334 continue 1549 continue
@@ -1337,15 +1552,15 @@ EOF
1337 -l*) 1552 -l*)
1338 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1553 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1339 case $host in 1554 case $host in
1340 *-*-cygwin* | *-*-pw32* | *-*-beos*) 1555 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1341 # These systems don't actually have a C or math library (as such) 1556 # These systems don't actually have a C or math library (as such)
1342 continue 1557 continue
1343 ;; 1558 ;;
1344 *-*-mingw* | *-*-os2*) 1559 *-*-os2*)
1345 # These systems don't actually have a C library (as such) 1560 # These systems don't actually have a C library (as such)
1346 test "X$arg" = "X-lc" && continue 1561 test "X$arg" = "X-lc" && continue
1347 ;; 1562 ;;
1348 *-*-openbsd* | *-*-freebsd*) 1563 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1349 # Do not include libc due to us having libc/libc_r. 1564 # Do not include libc due to us having libc/libc_r.
1350 test "X$arg" = "X-lc" && continue 1565 test "X$arg" = "X-lc" && continue
1351 ;; 1566 ;;
@@ -1353,10 +1568,19 @@ EOF
1353 # Rhapsody C and math libraries are in the System framework 1568 # Rhapsody C and math libraries are in the System framework
1354 deplibs="$deplibs -framework System" 1569 deplibs="$deplibs -framework System"
1355 continue 1570 continue
1571 ;;
1572 *-*-sco3.2v5* | *-*-sco5v6*)
1573 # Causes problems with __ctype
1574 test "X$arg" = "X-lc" && continue
1575 ;;
1576 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1577 # Compiler inserts libc in the correct place for threads to work
1578 test "X$arg" = "X-lc" && continue
1579 ;;
1356 esac 1580 esac
1357 elif test "X$arg" = "X-lc_r"; then 1581 elif test "X$arg" = "X-lc_r"; then
1358 case $host in 1582 case $host in
1359 *-*-openbsd* | *-*-freebsd*) 1583 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1360 # Do not include libc_r directly, use -pthread flag. 1584 # Do not include libc_r directly, use -pthread flag.
1361 continue 1585 continue
1362 ;; 1586 ;;
@@ -1366,8 +1590,20 @@ EOF
1366 continue 1590 continue
1367 ;; 1591 ;;
1368 1592
1593 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1594 # classes, name mangling, and exception handling.
1595 -model)
1596 compile_command="$compile_command $arg"
1597 compiler_flags="$compiler_flags $arg"
1598 finalize_command="$finalize_command $arg"
1599 prev=xcompiler
1600 continue
1601 ;;
1602
1369 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1603 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1370 deplibs="$deplibs $arg" 1604 compiler_flags="$compiler_flags $arg"
1605 compile_command="$compile_command $arg"
1606 finalize_command="$finalize_command $arg"
1371 continue 1607 continue
1372 ;; 1608 ;;
1373 1609
@@ -1376,13 +1612,19 @@ EOF
1376 continue 1612 continue
1377 ;; 1613 ;;
1378 1614
1379 # gcc -m* arguments should be passed to the linker via $compiler_flags 1615 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1380 # in order to pass architecture information to the linker 1616 # -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 1617 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1382 # but this is not reliable with gcc because gcc may use -mfoo to 1618 # +DA*, +DD* enable 64-bit mode on the HP compiler
1383 # select a different linker, different libraries, etc, while 1619 # -q* pass through compiler args for the IBM compiler
1384 # -Wl,-mfoo simply passes -mfoo to the linker. 1620 # -m* pass through architecture-specific compiler args for GCC
1385 -m*) 1621 # -m*, -t[45]*, -txscale* pass through architecture-specific
1622 # compiler args for GCC
1623 # -pg pass through profiling flag for GCC
1624 # @file GCC response files
1625 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1626 -t[45]*|-txscale*|@*)
1627
1386 # Unknown arguments in both finalize_command and compile_command need 1628 # Unknown arguments in both finalize_command and compile_command need
1387 # to be aesthetically quoted because they are evaled later. 1629 # to be aesthetically quoted because they are evaled later.
1388 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1630 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
@@ -1393,9 +1635,7 @@ EOF
1393 esac 1635 esac
1394 compile_command="$compile_command $arg" 1636 compile_command="$compile_command $arg"
1395 finalize_command="$finalize_command $arg" 1637 finalize_command="$finalize_command $arg"
1396 if test "$with_gcc" = "yes" ; then 1638 compiler_flags="$compiler_flags $arg"
1397 compiler_flags="$compiler_flags $arg"
1398 fi
1399 continue 1639 continue
1400 ;; 1640 ;;
1401 1641
@@ -1633,6 +1873,11 @@ EOF
1633 if test -z "$pic_object" || test "$pic_object" = none ; then 1873 if test -z "$pic_object" || test "$pic_object" = none ; then
1634 arg="$non_pic_object" 1874 arg="$non_pic_object"
1635 fi 1875 fi
1876 else
1877 # If the PIC object exists, use it instead.
1878 # $xdir was prepended to $pic_object above.
1879 non_pic_object="$pic_object"
1880 non_pic_objects="$non_pic_objects $non_pic_object"
1636 fi 1881 fi
1637 else 1882 else
1638 # Only an error if not doing a dry-run. 1883 # Only an error if not doing a dry-run.
@@ -1738,9 +1983,9 @@ EOF
1738 if test ! -d "$output_objdir"; then 1983 if test ! -d "$output_objdir"; then
1739 $show "$mkdir $output_objdir" 1984 $show "$mkdir $output_objdir"
1740 $run $mkdir $output_objdir 1985 $run $mkdir $output_objdir
1741 status=$? 1986 exit_status=$?
1742 if test "$status" -ne 0 && test ! -d "$output_objdir"; then 1987 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1743 exit $status 1988 exit $exit_status
1744 fi 1989 fi
1745 fi 1990 fi
1746 1991
@@ -1803,7 +2048,6 @@ EOF
1803 newlib_search_path= 2048 newlib_search_path=
1804 need_relink=no # whether we're linking any uninstalled libtool libraries 2049 need_relink=no # whether we're linking any uninstalled libtool libraries
1805 notinst_deplibs= # not-installed libtool libraries 2050 notinst_deplibs= # not-installed libtool libraries
1806 notinst_path= # paths that contain not-installed libtool libraries
1807 case $linkmode in 2051 case $linkmode in
1808 lib) 2052 lib)
1809 passes="conv link" 2053 passes="conv link"
@@ -1858,7 +2102,7 @@ EOF
1858 compile_deplibs="$deplib $compile_deplibs" 2102 compile_deplibs="$deplib $compile_deplibs"
1859 finalize_deplibs="$deplib $finalize_deplibs" 2103 finalize_deplibs="$deplib $finalize_deplibs"
1860 else 2104 else
1861 deplibs="$deplib $deplibs" 2105 compiler_flags="$compiler_flags $deplib"
1862 fi 2106 fi
1863 continue 2107 continue
1864 ;; 2108 ;;
@@ -1977,7 +2221,22 @@ EOF
1977 fi 2221 fi
1978 case $linkmode in 2222 case $linkmode in
1979 lib) 2223 lib)
1980 if test "$deplibs_check_method" != pass_all; then 2224 valid_a_lib=no
2225 case $deplibs_check_method in
2226 match_pattern*)
2227 set dummy $deplibs_check_method
2228 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2229 if eval $echo \"$deplib\" 2>/dev/null \
2230 | $SED 10q \
2231 | $EGREP "$match_pattern_regex" > /dev/null; then
2232 valid_a_lib=yes
2233 fi
2234 ;;
2235 pass_all)
2236 valid_a_lib=yes
2237 ;;
2238 esac
2239 if test "$valid_a_lib" != yes; then
1981 $echo 2240 $echo
1982 $echo "*** Warning: Trying to link with static lib archive $deplib." 2241 $echo "*** Warning: Trying to link with static lib archive $deplib."
1983 $echo "*** I have the capability to make that library automatically link in when" 2242 $echo "*** I have the capability to make that library automatically link in when"
@@ -2027,7 +2286,7 @@ EOF
2027 esac # case $deplib 2286 esac # case $deplib
2028 if test "$found" = yes || test -f "$lib"; then : 2287 if test "$found" = yes || test -f "$lib"; then :
2029 else 2288 else
2030 $echo "$modename: cannot find the library \`$lib'" 1>&2 2289 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2031 exit $EXIT_FAILURE 2290 exit $EXIT_FAILURE
2032 fi 2291 fi
2033 2292
@@ -2051,6 +2310,8 @@ EOF
2051 # it will not redefine variables installed, or shouldnotlink 2310 # it will not redefine variables installed, or shouldnotlink
2052 installed=yes 2311 installed=yes
2053 shouldnotlink=no 2312 shouldnotlink=no
2313 avoidtemprpath=
2314
2054 2315
2055 # Read the .la file 2316 # Read the .la file
2056 case $lib in 2317 case $lib in
@@ -2149,11 +2410,19 @@ EOF
2149 dir="$libdir" 2410 dir="$libdir"
2150 absdir="$libdir" 2411 absdir="$libdir"
2151 fi 2412 fi
2413 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2152 else 2414 else
2153 dir="$ladir/$objdir" 2415 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2154 absdir="$abs_ladir/$objdir" 2416 dir="$ladir"
2155 # Remove this search path later 2417 absdir="$abs_ladir"
2156 notinst_path="$notinst_path $abs_ladir" 2418 # Remove this search path later
2419 notinst_path="$notinst_path $abs_ladir"
2420 else
2421 dir="$ladir/$objdir"
2422 absdir="$abs_ladir/$objdir"
2423 # Remove this search path later
2424 notinst_path="$notinst_path $abs_ladir"
2425 fi
2157 fi # $installed = yes 2426 fi # $installed = yes
2158 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2427 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2159 2428
@@ -2226,12 +2495,12 @@ EOF
2226 if test -n "$library_names" && 2495 if test -n "$library_names" &&
2227 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2496 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2228 # We need to hardcode the library path 2497 # We need to hardcode the library path
2229 if test -n "$shlibpath_var"; then 2498 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2230 # Make sure the rpath contains only unique directories. 2499 # Make sure the rpath contains only unique directories.
2231 case "$temp_rpath " in 2500 case "$temp_rpath " in
2232 *" $dir "*) ;; 2501 *" $dir "*) ;;
2233 *" $absdir "*) ;; 2502 *" $absdir "*) ;;
2234 *) temp_rpath="$temp_rpath $dir" ;; 2503 *) temp_rpath="$temp_rpath $absdir" ;;
2235 esac 2504 esac
2236 fi 2505 fi
2237 2506
@@ -2268,8 +2537,12 @@ EOF
2268 fi 2537 fi
2269 2538
2270 link_static=no # Whether the deplib will be linked statically 2539 link_static=no # Whether the deplib will be linked statically
2540 use_static_libs=$prefer_static_libs
2541 if test "$use_static_libs" = built && test "$installed" = yes ; then
2542 use_static_libs=no
2543 fi
2271 if test -n "$library_names" && 2544 if test -n "$library_names" &&
2272 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2545 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2273 if test "$installed" = no; then 2546 if test "$installed" = no; then
2274 notinst_deplibs="$notinst_deplibs $lib" 2547 notinst_deplibs="$notinst_deplibs $lib"
2275 need_relink=yes 2548 need_relink=yes
@@ -2382,11 +2655,15 @@ EOF
2382 if test "$hardcode_direct" = no; then 2655 if test "$hardcode_direct" = no; then
2383 add="$dir/$linklib" 2656 add="$dir/$linklib"
2384 case $host in 2657 case $host in
2385 *-*-sco3.2v5* ) add_dir="-L$dir" ;; 2658 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2659 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2660 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2661 *-*-unixware7*) add_dir="-L$dir" ;;
2386 *-*-darwin* ) 2662 *-*-darwin* )
2387 # if the lib is a module then we can not link against 2663 # if the lib is a module then we can not link against
2388 # it, someone is ignoring the new warnings I added 2664 # it, someone is ignoring the new warnings I added
2389 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then 2665 if /usr/bin/file -L $add 2> /dev/null |
2666 $EGREP ": [^:]* bundle" >/dev/null ; then
2390 $echo "** Warning, lib $linklib is a module, not a shared library" 2667 $echo "** Warning, lib $linklib is a module, not a shared library"
2391 if test -z "$old_library" ; then 2668 if test -z "$old_library" ; then
2392 $echo 2669 $echo
@@ -2417,7 +2694,7 @@ EOF
2417 add_dir="-L$dir" 2694 add_dir="-L$dir"
2418 # Try looking first in the location we're being installed to. 2695 # Try looking first in the location we're being installed to.
2419 if test -n "$inst_prefix_dir"; then 2696 if test -n "$inst_prefix_dir"; then
2420 case "$libdir" in 2697 case $libdir in
2421 [\\/]*) 2698 [\\/]*)
2422 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2699 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2423 ;; 2700 ;;
@@ -2490,7 +2767,7 @@ EOF
2490 add_dir="-L$libdir" 2767 add_dir="-L$libdir"
2491 # Try looking first in the location we're being installed to. 2768 # Try looking first in the location we're being installed to.
2492 if test -n "$inst_prefix_dir"; then 2769 if test -n "$inst_prefix_dir"; then
2493 case "$libdir" in 2770 case $libdir in
2494 [\\/]*) 2771 [\\/]*)
2495 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2772 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2496 ;; 2773 ;;
@@ -2551,8 +2828,6 @@ EOF
2551 fi 2828 fi
2552 fi 2829 fi
2553 else 2830 else
2554 convenience="$convenience $dir/$old_library"
2555 old_convenience="$old_convenience $dir/$old_library"
2556 deplibs="$dir/$old_library $deplibs" 2831 deplibs="$dir/$old_library $deplibs"
2557 link_static=yes 2832 link_static=yes
2558 fi 2833 fi
@@ -2670,12 +2945,12 @@ EOF
2670 *) continue ;; 2945 *) continue ;;
2671 esac 2946 esac
2672 case " $deplibs " in 2947 case " $deplibs " in
2673 *" $depdepl "*) ;; 2948 *" $path "*) ;;
2674 *) deplibs="$depdepl $deplibs" ;; 2949 *) deplibs="$path $deplibs" ;;
2675 esac 2950 esac
2676 case " $deplibs " in 2951 case " $deplibs " in
2677 *" $path "*) ;; 2952 *" $depdepl "*) ;;
2678 *) deplibs="$deplibs $path" ;; 2953 *) deplibs="$depdepl $deplibs" ;;
2679 esac 2954 esac
2680 done 2955 done
2681 fi # link_all_deplibs != no 2956 fi # link_all_deplibs != no
@@ -2947,7 +3222,7 @@ EOF
2947 case $current in 3222 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]) ;; 3223 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 *) 3224 *)
2950 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 3225 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2951 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3226 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2952 exit $EXIT_FAILURE 3227 exit $EXIT_FAILURE
2953 ;; 3228 ;;
@@ -2956,7 +3231,7 @@ EOF
2956 case $revision in 3231 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]) ;; 3232 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 *) 3233 *)
2959 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 3234 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2960 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3235 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2961 exit $EXIT_FAILURE 3236 exit $EXIT_FAILURE
2962 ;; 3237 ;;
@@ -2965,7 +3240,7 @@ EOF
2965 case $age in 3240 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]) ;; 3241 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 *) 3242 *)
2968 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 3243 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2969 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3244 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2970 exit $EXIT_FAILURE 3245 exit $EXIT_FAILURE
2971 ;; 3246 ;;
@@ -2991,7 +3266,7 @@ EOF
2991 versuffix="$major.$age.$revision" 3266 versuffix="$major.$age.$revision"
2992 # Darwin ld doesn't like 0 for these options... 3267 # Darwin ld doesn't like 0 for these options...
2993 minor_current=`expr $current + 1` 3268 minor_current=`expr $current + 1`
2994 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3269 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
2995 ;; 3270 ;;
2996 3271
2997 freebsd-aout) 3272 freebsd-aout)
@@ -3144,9 +3419,9 @@ EOF
3144 3419
3145 # Eliminate all temporary directories. 3420 # Eliminate all temporary directories.
3146 for path in $notinst_path; do 3421 for path in $notinst_path; do
3147 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` 3422 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3148 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` 3423 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3149 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` 3424 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3150 done 3425 done
3151 3426
3152 if test -n "$xrpath"; then 3427 if test -n "$xrpath"; then
@@ -3197,9 +3472,14 @@ EOF
3197 *-*-netbsd*) 3472 *-*-netbsd*)
3198 # Don't link with libc until the a.out ld.so is fixed. 3473 # Don't link with libc until the a.out ld.so is fixed.
3199 ;; 3474 ;;
3200 *-*-openbsd* | *-*-freebsd*) 3475 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3201 # Do not include libc due to us having libc/libc_r. 3476 # Do not include libc due to us having libc/libc_r.
3202 test "X$arg" = "X-lc" && continue 3477 ;;
3478 *-*-sco3.2v5* | *-*-sco5v6*)
3479 # Causes problems with __ctype
3480 ;;
3481 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3482 # Compiler inserts libc in the correct place for threads to work
3203 ;; 3483 ;;
3204 *) 3484 *)
3205 # Add libc to deplibs on all other systems if necessary. 3485 # Add libc to deplibs on all other systems if necessary.
@@ -3243,11 +3523,11 @@ EOF
3243 int main() { return 0; } 3523 int main() { return 0; }
3244EOF 3524EOF
3245 $rm conftest 3525 $rm conftest
3246 $LTCC -o conftest conftest.c $deplibs 3526 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3247 if test "$?" -eq 0 ; then 3527 if test "$?" -eq 0 ; then
3248 ldd_output=`ldd conftest` 3528 ldd_output=`ldd conftest`
3249 for i in $deplibs; do 3529 for i in $deplibs; do
3250 name="`expr $i : '-l\(.*\)'`" 3530 name=`expr $i : '-l\(.*\)'`
3251 # If $name is empty we are operating on a -L argument. 3531 # If $name is empty we are operating on a -L argument.
3252 if test "$name" != "" && test "$name" -ne "0"; then 3532 if test "$name" != "" && test "$name" -ne "0"; then
3253 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3533 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3284,11 +3564,11 @@ EOF
3284 # Error occurred in the first compile. Let's try to salvage 3564 # Error occurred in the first compile. Let's try to salvage
3285 # the situation: Compile a separate program for each library. 3565 # the situation: Compile a separate program for each library.
3286 for i in $deplibs; do 3566 for i in $deplibs; do
3287 name="`expr $i : '-l\(.*\)'`" 3567 name=`expr $i : '-l\(.*\)'`
3288 # If $name is empty we are operating on a -L argument. 3568 # If $name is empty we are operating on a -L argument.
3289 if test "$name" != "" && test "$name" != "0"; then 3569 if test "$name" != "" && test "$name" != "0"; then
3290 $rm conftest 3570 $rm conftest
3291 $LTCC -o conftest conftest.c $i 3571 $LTCC $LTCFLAGS -o conftest conftest.c $i
3292 # Did it work? 3572 # Did it work?
3293 if test "$?" -eq 0 ; then 3573 if test "$?" -eq 0 ; then
3294 ldd_output=`ldd conftest` 3574 ldd_output=`ldd conftest`
@@ -3336,7 +3616,7 @@ EOF
3336 set dummy $deplibs_check_method 3616 set dummy $deplibs_check_method
3337 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3617 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3338 for a_deplib in $deplibs; do 3618 for a_deplib in $deplibs; do
3339 name="`expr $a_deplib : '-l\(.*\)'`" 3619 name=`expr $a_deplib : '-l\(.*\)'`
3340 # If $name is empty we are operating on a -L argument. 3620 # If $name is empty we are operating on a -L argument.
3341 if test "$name" != "" && test "$name" != "0"; then 3621 if test "$name" != "" && test "$name" != "0"; then
3342 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3622 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3405,7 +3685,7 @@ EOF
3405 set dummy $deplibs_check_method 3685 set dummy $deplibs_check_method
3406 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3686 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3407 for a_deplib in $deplibs; do 3687 for a_deplib in $deplibs; do
3408 name="`expr $a_deplib : '-l\(.*\)'`" 3688 name=`expr $a_deplib : '-l\(.*\)'`
3409 # If $name is empty we are operating on a -L argument. 3689 # If $name is empty we are operating on a -L argument.
3410 if test -n "$name" && test "$name" != "0"; then 3690 if test -n "$name" && test "$name" != "0"; then
3411 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3691 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3535,6 +3815,35 @@ EOF
3535 deplibs=$newdeplibs 3815 deplibs=$newdeplibs
3536 fi 3816 fi
3537 3817
3818
3819 # move library search paths that coincide with paths to not yet
3820 # installed libraries to the beginning of the library search list
3821 new_libs=
3822 for path in $notinst_path; do
3823 case " $new_libs " in
3824 *" -L$path/$objdir "*) ;;
3825 *)
3826 case " $deplibs " in
3827 *" -L$path/$objdir "*)
3828 new_libs="$new_libs -L$path/$objdir" ;;
3829 esac
3830 ;;
3831 esac
3832 done
3833 for deplib in $deplibs; do
3834 case $deplib in
3835 -L*)
3836 case " $new_libs " in
3837 *" $deplib "*) ;;
3838 *) new_libs="$new_libs $deplib" ;;
3839 esac
3840 ;;
3841 *) new_libs="$new_libs $deplib" ;;
3842 esac
3843 done
3844 deplibs="$new_libs"
3845
3846
3538 # All the library-specific variables (install_libdir is set above). 3847 # All the library-specific variables (install_libdir is set above).
3539 library_names= 3848 library_names=
3540 old_library= 3849 old_library=
@@ -3618,6 +3927,7 @@ EOF
3618 fi 3927 fi
3619 3928
3620 lib="$output_objdir/$realname" 3929 lib="$output_objdir/$realname"
3930 linknames=
3621 for link 3931 for link
3622 do 3932 do
3623 linknames="$linknames $link" 3933 linknames="$linknames $link"
@@ -3646,6 +3956,9 @@ EOF
3646 # The command line is too long to execute in one step. 3956 # The command line is too long to execute in one step.
3647 $show "using reloadable object file for export list..." 3957 $show "using reloadable object file for export list..."
3648 skipped_export=: 3958 skipped_export=:
3959 # Break out early, otherwise skipped_export may be
3960 # set to false by a later but shorter cmd.
3961 break
3649 fi 3962 fi
3650 done 3963 done
3651 IFS="$save_ifs" 3964 IFS="$save_ifs"
@@ -3679,67 +3992,13 @@ EOF
3679 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3992 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3680 else 3993 else
3681 gentop="$output_objdir/${outputname}x" 3994 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" 3995 generated="$generated $gentop"
3691 3996
3692 for xlib in $convenience; do 3997 func_extract_archives $gentop $convenience
3693 # Extract the objects. 3998 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 3999 fi
3741 fi 4000 fi
3742 4001
3743 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4002 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3744 eval flag=\"$thread_safe_flag_spec\" 4003 eval flag=\"$thread_safe_flag_spec\"
3745 linker_flags="$linker_flags $flag" 4004 linker_flags="$linker_flags $flag"
@@ -3769,7 +4028,8 @@ EOF
3769 fi 4028 fi
3770 fi 4029 fi
3771 4030
3772 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && 4031 if test "X$skipped_export" != "X:" &&
4032 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3773 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4033 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3774 : 4034 :
3775 else 4035 else
@@ -3788,6 +4048,7 @@ EOF
3788 save_libobjs=$libobjs 4048 save_libobjs=$libobjs
3789 fi 4049 fi
3790 save_output=$output 4050 save_output=$output
4051 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3791 4052
3792 # Clear the reloadable object creation command queue and 4053 # Clear the reloadable object creation command queue and
3793 # initialize k to one. 4054 # initialize k to one.
@@ -3797,13 +4058,13 @@ EOF
3797 delfiles= 4058 delfiles=
3798 last_robj= 4059 last_robj=
3799 k=1 4060 k=1
3800 output=$output_objdir/$save_output-${k}.$objext 4061 output=$output_objdir/$output_la-${k}.$objext
3801 # Loop over the list of objects to be linked. 4062 # Loop over the list of objects to be linked.
3802 for obj in $save_libobjs 4063 for obj in $save_libobjs
3803 do 4064 do
3804 eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4065 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3805 if test "X$objlist" = X || 4066 if test "X$objlist" = X ||
3806 { len=`expr "X$test_cmds" : ".*"` && 4067 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3807 test "$len" -le "$max_cmd_len"; }; then 4068 test "$len" -le "$max_cmd_len"; }; then
3808 objlist="$objlist $obj" 4069 objlist="$objlist $obj"
3809 else 4070 else
@@ -3817,9 +4078,9 @@ EOF
3817 # the last one created. 4078 # the last one created.
3818 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4079 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3819 fi 4080 fi
3820 last_robj=$output_objdir/$save_output-${k}.$objext 4081 last_robj=$output_objdir/$output_la-${k}.$objext
3821 k=`expr $k + 1` 4082 k=`expr $k + 1`
3822 output=$output_objdir/$save_output-${k}.$objext 4083 output=$output_objdir/$output_la-${k}.$objext
3823 objlist=$obj 4084 objlist=$obj
3824 len=1 4085 len=1
3825 fi 4086 fi
@@ -3839,13 +4100,13 @@ EOF
3839 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4100 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3840 fi 4101 fi
3841 4102
3842 # Set up a command to remove the reloadale object files 4103 # Set up a command to remove the reloadable object files
3843 # after they are used. 4104 # after they are used.
3844 i=0 4105 i=0
3845 while test "$i" -lt "$k" 4106 while test "$i" -lt "$k"
3846 do 4107 do
3847 i=`expr $i + 1` 4108 i=`expr $i + 1`
3848 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 4109 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3849 done 4110 done
3850 4111
3851 $echo "creating a temporary reloadable object file: $output" 4112 $echo "creating a temporary reloadable object file: $output"
@@ -3893,13 +4154,30 @@ EOF
3893 IFS="$save_ifs" 4154 IFS="$save_ifs"
3894 eval cmd=\"$cmd\" 4155 eval cmd=\"$cmd\"
3895 $show "$cmd" 4156 $show "$cmd"
3896 $run eval "$cmd" || exit $? 4157 $run eval "$cmd" || {
4158 lt_exit=$?
4159
4160 # Restore the uninstalled library and exit
4161 if test "$mode" = relink; then
4162 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4163 fi
4164
4165 exit $lt_exit
4166 }
3897 done 4167 done
3898 IFS="$save_ifs" 4168 IFS="$save_ifs"
3899 4169
3900 # Restore the uninstalled library and exit 4170 # Restore the uninstalled library and exit
3901 if test "$mode" = relink; then 4171 if test "$mode" = relink; then
3902 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4172 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4173
4174 if test -n "$convenience"; then
4175 if test -z "$whole_archive_flag_spec"; then
4176 $show "${rm}r $gentop"
4177 $run ${rm}r "$gentop"
4178 fi
4179 fi
4180
3903 exit $EXIT_SUCCESS 4181 exit $EXIT_SUCCESS
3904 fi 4182 fi
3905 4183
@@ -3977,64 +4255,10 @@ EOF
3977 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4255 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3978 else 4256 else
3979 gentop="$output_objdir/${obj}x" 4257 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" 4258 generated="$generated $gentop"
3989 4259
3990 for xlib in $convenience; do 4260 func_extract_archives $gentop $convenience
3991 # Extract the objects. 4261 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 4262 fi
4039 fi 4263 fi
4040 4264
@@ -4135,6 +4359,35 @@ EOF
4135 ;; 4359 ;;
4136 esac 4360 esac
4137 4361
4362
4363 # move library search paths that coincide with paths to not yet
4364 # installed libraries to the beginning of the library search list
4365 new_libs=
4366 for path in $notinst_path; do
4367 case " $new_libs " in
4368 *" -L$path/$objdir "*) ;;
4369 *)
4370 case " $compile_deplibs " in
4371 *" -L$path/$objdir "*)
4372 new_libs="$new_libs -L$path/$objdir" ;;
4373 esac
4374 ;;
4375 esac
4376 done
4377 for deplib in $compile_deplibs; do
4378 case $deplib in
4379 -L*)
4380 case " $new_libs " in
4381 *" $deplib "*) ;;
4382 *) new_libs="$new_libs $deplib" ;;
4383 esac
4384 ;;
4385 *) new_libs="$new_libs $deplib" ;;
4386 esac
4387 done
4388 compile_deplibs="$new_libs"
4389
4390
4138 compile_command="$compile_command $compile_deplibs" 4391 compile_command="$compile_command $compile_deplibs"
4139 finalize_command="$finalize_command $finalize_deplibs" 4392 finalize_command="$finalize_command $finalize_deplibs"
4140 4393
@@ -4179,10 +4432,15 @@ EOF
4179 fi 4432 fi
4180 case $host in 4433 case $host in
4181 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4434 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4435 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4182 case :$dllsearchpath: in 4436 case :$dllsearchpath: in
4183 *":$libdir:"*) ;; 4437 *":$libdir:"*) ;;
4184 *) dllsearchpath="$dllsearchpath:$libdir";; 4438 *) dllsearchpath="$dllsearchpath:$libdir";;
4185 esac 4439 esac
4440 case :$dllsearchpath: in
4441 *":$testbindir:"*) ;;
4442 *) dllsearchpath="$dllsearchpath:$testbindir";;
4443 esac
4186 ;; 4444 ;;
4187 esac 4445 esac
4188 done 4446 done
@@ -4296,13 +4554,25 @@ extern \"C\" {
4296 4554
4297 # Prepare the list of exported symbols 4555 # Prepare the list of exported symbols
4298 if test -z "$export_symbols"; then 4556 if test -z "$export_symbols"; then
4299 export_symbols="$output_objdir/$output.exp" 4557 export_symbols="$output_objdir/$outputname.exp"
4300 $run $rm $export_symbols 4558 $run $rm $export_symbols
4301 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4559 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4560 case $host in
4561 *cygwin* | *mingw* )
4562 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4563 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4564 ;;
4565 esac
4302 else 4566 else
4303 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' 4567 $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' 4568 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4305 $run eval 'mv "$nlist"T "$nlist"' 4569 $run eval 'mv "$nlist"T "$nlist"'
4570 case $host in
4571 *cygwin* | *mingw* )
4572 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4573 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4574 ;;
4575 esac
4306 fi 4576 fi
4307 fi 4577 fi
4308 4578
@@ -4353,7 +4623,26 @@ extern \"C\" {
4353#endif 4623#endif
4354 4624
4355/* The mapping between symbol names and symbols. */ 4625/* The mapping between symbol names and symbols. */
4626"
4627
4628 case $host in
4629 *cygwin* | *mingw* )
4630 $echo >> "$output_objdir/$dlsyms" "\
4631/* DATA imports from DLLs on WIN32 can't be const, because
4632 runtime relocations are performed -- see ld's documentation
4633 on pseudo-relocs */
4634struct {
4635"
4636 ;;
4637 * )
4638 $echo >> "$output_objdir/$dlsyms" "\
4356const struct { 4639const struct {
4640"
4641 ;;
4642 esac
4643
4644
4645 $echo >> "$output_objdir/$dlsyms" "\
4357 const char *name; 4646 const char *name;
4358 lt_ptr address; 4647 lt_ptr address;
4359} 4648}
@@ -4400,16 +4689,29 @@ static const void *lt_preloaded_setup() {
4400 esac 4689 esac
4401 4690
4402 # Now compile the dynamic symbol file. 4691 # Now compile the dynamic symbol file.
4403 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4692 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4404 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4693 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4405 4694
4406 # Clean up the generated files. 4695 # Clean up the generated files.
4407 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4696 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4408 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4697 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4409 4698
4410 # Transform the symbol file into the correct name. 4699 # Transform the symbol file into the correct name.
4411 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4700 case $host in
4412 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4701 *cygwin* | *mingw* )
4702 if test -f "$output_objdir/${outputname}.def" ; then
4703 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4704 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4705 else
4706 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4707 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4708 fi
4709 ;;
4710 * )
4711 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4712 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4713 ;;
4714 esac
4413 ;; 4715 ;;
4414 *) 4716 *)
4415 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4717 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
@@ -4434,7 +4736,7 @@ static const void *lt_preloaded_setup() {
4434 # We have no uninstalled library dependencies, so finalize right now. 4736 # We have no uninstalled library dependencies, so finalize right now.
4435 $show "$link_command" 4737 $show "$link_command"
4436 $run eval "$link_command" 4738 $run eval "$link_command"
4437 status=$? 4739 exit_status=$?
4438 4740
4439 # Delete the generated files. 4741 # Delete the generated files.
4440 if test -n "$dlsyms"; then 4742 if test -n "$dlsyms"; then
@@ -4442,7 +4744,7 @@ static const void *lt_preloaded_setup() {
4442 $run $rm "$output_objdir/${outputname}S.${objext}" 4744 $run $rm "$output_objdir/${outputname}S.${objext}"
4443 fi 4745 fi
4444 4746
4445 exit $status 4747 exit $exit_status
4446 fi 4748 fi
4447 4749
4448 if test -n "$shlibpath_var"; then 4750 if test -n "$shlibpath_var"; then
@@ -4582,10 +4884,12 @@ static const void *lt_preloaded_setup() {
4582 esac 4884 esac
4583 case $host in 4885 case $host in
4584 *cygwin* | *mingw* ) 4886 *cygwin* | *mingw* )
4585 cwrappersource=`$echo ${objdir}/lt-${output}.c` 4887 output_name=`basename $output`
4586 cwrapper=`$echo ${output}.exe` 4888 output_path=`dirname $output`
4587 $rm $cwrappersource $cwrapper 4889 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4588 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4890 cwrapper="$output_path/$output_name.exe"
4891 $rm $cwrappersource $cwrapper
4892 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4589 4893
4590 cat > $cwrappersource <<EOF 4894 cat > $cwrappersource <<EOF
4591 4895
@@ -4610,6 +4914,9 @@ EOF
4610#include <malloc.h> 4914#include <malloc.h>
4611#include <stdarg.h> 4915#include <stdarg.h>
4612#include <assert.h> 4916#include <assert.h>
4917#include <string.h>
4918#include <ctype.h>
4919#include <sys/stat.h>
4613 4920
4614#if defined(PATH_MAX) 4921#if defined(PATH_MAX)
4615# define LT_PATHMAX PATH_MAX 4922# define LT_PATHMAX PATH_MAX
@@ -4620,15 +4927,19 @@ EOF
4620#endif 4927#endif
4621 4928
4622#ifndef DIR_SEPARATOR 4929#ifndef DIR_SEPARATOR
4623#define DIR_SEPARATOR '/' 4930# define DIR_SEPARATOR '/'
4931# define PATH_SEPARATOR ':'
4624#endif 4932#endif
4625 4933
4626#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4934#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4627 defined (__OS2__) 4935 defined (__OS2__)
4628#define HAVE_DOS_BASED_FILE_SYSTEM 4936# define HAVE_DOS_BASED_FILE_SYSTEM
4629#ifndef DIR_SEPARATOR_2 4937# ifndef DIR_SEPARATOR_2
4630#define DIR_SEPARATOR_2 '\\' 4938# define DIR_SEPARATOR_2 '\\'
4631#endif 4939# endif
4940# ifndef PATH_SEPARATOR_2
4941# define PATH_SEPARATOR_2 ';'
4942# endif
4632#endif 4943#endif
4633 4944
4634#ifndef DIR_SEPARATOR_2 4945#ifndef DIR_SEPARATOR_2
@@ -4638,17 +4949,32 @@ EOF
4638 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4949 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4639#endif /* DIR_SEPARATOR_2 */ 4950#endif /* DIR_SEPARATOR_2 */
4640 4951
4952#ifndef PATH_SEPARATOR_2
4953# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4954#else /* PATH_SEPARATOR_2 */
4955# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4956#endif /* PATH_SEPARATOR_2 */
4957
4641#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4958#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4642#define XFREE(stale) do { \ 4959#define XFREE(stale) do { \
4643 if (stale) { free ((void *) stale); stale = 0; } \ 4960 if (stale) { free ((void *) stale); stale = 0; } \
4644} while (0) 4961} while (0)
4645 4962
4963/* -DDEBUG is fairly common in CFLAGS. */
4964#undef DEBUG
4965#if defined DEBUGWRAPPER
4966# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4967#else
4968# define DEBUG(format, ...)
4969#endif
4970
4646const char *program_name = NULL; 4971const char *program_name = NULL;
4647 4972
4648void * xmalloc (size_t num); 4973void * xmalloc (size_t num);
4649char * xstrdup (const char *string); 4974char * xstrdup (const char *string);
4650char * basename (const char *name); 4975const char * base_name (const char *name);
4651char * fnqualify(const char *path); 4976char * find_executable(const char *wrapper);
4977int check_executable(const char *path);
4652char * strendzap(char *str, const char *pat); 4978char * strendzap(char *str, const char *pat);
4653void lt_fatal (const char *message, ...); 4979void lt_fatal (const char *message, ...);
4654 4980
@@ -4658,29 +4984,51 @@ main (int argc, char *argv[])
4658 char **newargz; 4984 char **newargz;
4659 int i; 4985 int i;
4660 4986
4661 program_name = (char *) xstrdup ((char *) basename (argv[0])); 4987 program_name = (char *) xstrdup (base_name (argv[0]));
4988 DEBUG("(main) argv[0] : %s\n",argv[0]);
4989 DEBUG("(main) program_name : %s\n",program_name);
4662 newargz = XMALLOC(char *, argc+2); 4990 newargz = XMALLOC(char *, argc+2);
4663EOF 4991EOF
4664 4992
4665 cat >> $cwrappersource <<EOF 4993 cat >> $cwrappersource <<EOF
4666 newargz[0] = "$SHELL"; 4994 newargz[0] = (char *) xstrdup("$SHELL");
4667EOF 4995EOF
4668 4996
4669 cat >> $cwrappersource <<"EOF" 4997 cat >> $cwrappersource <<"EOF"
4670 newargz[1] = fnqualify(argv[0]); 4998 newargz[1] = find_executable(argv[0]);
4999 if (newargz[1] == NULL)
5000 lt_fatal("Couldn't find %s", argv[0]);
5001 DEBUG("(main) found exe at : %s\n",newargz[1]);
4671 /* we know the script has the same name, without the .exe */ 5002 /* we know the script has the same name, without the .exe */
4672 /* so make sure newargz[1] doesn't end in .exe */ 5003 /* so make sure newargz[1] doesn't end in .exe */
4673 strendzap(newargz[1],".exe"); 5004 strendzap(newargz[1],".exe");
4674 for (i = 1; i < argc; i++) 5005 for (i = 1; i < argc; i++)
4675 newargz[i+1] = xstrdup(argv[i]); 5006 newargz[i+1] = xstrdup(argv[i]);
4676 newargz[argc+1] = NULL; 5007 newargz[argc+1] = NULL;
5008
5009 for (i=0; i<argc+1; i++)
5010 {
5011 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5012 ;
5013 }
5014
4677EOF 5015EOF
4678 5016
4679 cat >> $cwrappersource <<EOF 5017 case $host_os in
5018 mingw*)
5019 cat >> $cwrappersource <<EOF
5020 execv("$SHELL",(char const **)newargz);
5021EOF
5022 ;;
5023 *)
5024 cat >> $cwrappersource <<EOF
4680 execv("$SHELL",newargz); 5025 execv("$SHELL",newargz);
4681EOF 5026EOF
5027 ;;
5028 esac
4682 5029
4683 cat >> $cwrappersource <<"EOF" 5030 cat >> $cwrappersource <<"EOF"
5031 return 127;
4684} 5032}
4685 5033
4686void * 5034void *
@@ -4700,48 +5048,148 @@ xstrdup (const char *string)
4700; 5048;
4701} 5049}
4702 5050
4703char * 5051const char *
4704basename (const char *name) 5052base_name (const char *name)
4705{ 5053{
4706 const char *base; 5054 const char *base;
4707 5055
4708#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5056#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4709 /* Skip over the disk name in MSDOS pathnames. */ 5057 /* Skip over the disk name in MSDOS pathnames. */
4710 if (isalpha (name[0]) && name[1] == ':') 5058 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4711 name += 2; 5059 name += 2;
4712#endif 5060#endif
4713 5061
4714 for (base = name; *name; name++) 5062 for (base = name; *name; name++)
4715 if (IS_DIR_SEPARATOR (*name)) 5063 if (IS_DIR_SEPARATOR (*name))
4716 base = name + 1; 5064 base = name + 1;
4717 return (char *) base; 5065 return base;
4718} 5066}
4719 5067
5068int
5069check_executable(const char * path)
5070{
5071 struct stat st;
5072
5073 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5074 if ((!path) || (!*path))
5075 return 0;
5076
5077 if ((stat (path, &st) >= 0) &&
5078 (
5079 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5080#if defined (S_IXOTH)
5081 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5082#endif
5083#if defined (S_IXGRP)
5084 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5085#endif
5086 ((st.st_mode & S_IXUSR) == S_IXUSR))
5087 )
5088 return 1;
5089 else
5090 return 0;
5091}
5092
5093/* Searches for the full path of the wrapper. Returns
5094 newly allocated full path name if found, NULL otherwise */
4720char * 5095char *
4721fnqualify(const char *path) 5096find_executable (const char* wrapper)
4722{ 5097{
4723 size_t size; 5098 int has_slash = 0;
4724 char *p; 5099 const char* p;
5100 const char* p_next;
5101 /* static buffer for getcwd */
4725 char tmp[LT_PATHMAX + 1]; 5102 char tmp[LT_PATHMAX + 1];
5103 int tmp_len;
5104 char* concat_name;
4726 5105
4727 assert(path != NULL); 5106 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
4728 5107
4729 /* Is it qualified already? */ 5108 if ((wrapper == NULL) || (*wrapper == '\0'))
5109 return NULL;
5110
5111 /* Absolute path? */
4730#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5112#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4731 if (isalpha (path[0]) && path[1] == ':') 5113 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
4732 return xstrdup (path); 5114 {
5115 concat_name = xstrdup (wrapper);
5116 if (check_executable(concat_name))
5117 return concat_name;
5118 XFREE(concat_name);
5119 }
5120 else
5121 {
5122#endif
5123 if (IS_DIR_SEPARATOR (wrapper[0]))
5124 {
5125 concat_name = xstrdup (wrapper);
5126 if (check_executable(concat_name))
5127 return concat_name;
5128 XFREE(concat_name);
5129 }
5130#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5131 }
4733#endif 5132#endif
4734 if (IS_DIR_SEPARATOR (path[0]))
4735 return xstrdup (path);
4736 5133
4737 /* prepend the current directory */ 5134 for (p = wrapper; *p; p++)
4738 /* doesn't handle '~' */ 5135 if (*p == '/')
5136 {
5137 has_slash = 1;
5138 break;
5139 }
5140 if (!has_slash)
5141 {
5142 /* no slashes; search PATH */
5143 const char* path = getenv ("PATH");
5144 if (path != NULL)
5145 {
5146 for (p = path; *p; p = p_next)
5147 {
5148 const char* q;
5149 size_t p_len;
5150 for (q = p; *q; q++)
5151 if (IS_PATH_SEPARATOR(*q))
5152 break;
5153 p_len = q - p;
5154 p_next = (*q == '\0' ? q : q + 1);
5155 if (p_len == 0)
5156 {
5157 /* empty path: current directory */
5158 if (getcwd (tmp, LT_PATHMAX) == NULL)
5159 lt_fatal ("getcwd failed");
5160 tmp_len = strlen(tmp);
5161 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5162 memcpy (concat_name, tmp, tmp_len);
5163 concat_name[tmp_len] = '/';
5164 strcpy (concat_name + tmp_len + 1, wrapper);
5165 }
5166 else
5167 {
5168 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5169 memcpy (concat_name, p, p_len);
5170 concat_name[p_len] = '/';
5171 strcpy (concat_name + p_len + 1, wrapper);
5172 }
5173 if (check_executable(concat_name))
5174 return concat_name;
5175 XFREE(concat_name);
5176 }
5177 }
5178 /* not found in PATH; assume curdir */
5179 }
5180 /* Relative path | not found in path: prepend cwd */
4739 if (getcwd (tmp, LT_PATHMAX) == NULL) 5181 if (getcwd (tmp, LT_PATHMAX) == NULL)
4740 lt_fatal ("getcwd failed"); 5182 lt_fatal ("getcwd failed");
4741 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ 5183 tmp_len = strlen(tmp);
4742 p = XMALLOC(char, size); 5184 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
4743 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); 5185 memcpy (concat_name, tmp, tmp_len);
4744 return p; 5186 concat_name[tmp_len] = '/';
5187 strcpy (concat_name + tmp_len + 1, wrapper);
5188
5189 if (check_executable(concat_name))
5190 return concat_name;
5191 XFREE(concat_name);
5192 return NULL;
4745} 5193}
4746 5194
4747char * 5195char *
@@ -4785,16 +5233,16 @@ lt_fatal (const char *message, ...)
4785 va_end (ap); 5233 va_end (ap);
4786} 5234}
4787EOF 5235EOF
4788 # we should really use a build-platform specific compiler 5236 # we should really use a build-platform specific compiler
4789 # here, but OTOH, the wrappers (shell script and this C one) 5237 # here, but OTOH, the wrappers (shell script and this C one)
4790 # are only useful if you want to execute the "real" binary. 5238 # are only useful if you want to execute the "real" binary.
4791 # Since the "real" binary is built for $host, then this 5239 # Since the "real" binary is built for $host, then this
4792 # wrapper might as well be built for $host, too. 5240 # wrapper might as well be built for $host, too.
4793 $run $LTCC -s -o $cwrapper $cwrappersource 5241 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
4794 ;; 5242 ;;
4795 esac 5243 esac
4796 $rm $output 5244 $rm $output
4797 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5245 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4798 5246
4799 $echo > $output "\ 5247 $echo > $output "\
4800#! $SHELL 5248#! $SHELL
@@ -4815,7 +5263,7 @@ sed_quote_subst='$sed_quote_subst'
4815 5263
4816# The HP-UX ksh and POSIX shell print the target directory to stdout 5264# The HP-UX ksh and POSIX shell print the target directory to stdout
4817# if CDPATH is set. 5265# if CDPATH is set.
4818if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi 5266(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4819 5267
4820relink_command=\"$relink_command\" 5268relink_command=\"$relink_command\"
4821 5269
@@ -4944,13 +5392,13 @@ else
4944 # Backslashes separate directories on plain windows 5392 # Backslashes separate directories on plain windows
4945 *-*-mingw | *-*-os2*) 5393 *-*-mingw | *-*-os2*)
4946 $echo >> $output "\ 5394 $echo >> $output "\
4947 exec \$progdir\\\\\$program \${1+\"\$@\"} 5395 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4948" 5396"
4949 ;; 5397 ;;
4950 5398
4951 *) 5399 *)
4952 $echo >> $output "\ 5400 $echo >> $output "\
4953 exec \$progdir/\$program \${1+\"\$@\"} 5401 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4954" 5402"
4955 ;; 5403 ;;
4956 esac 5404 esac
@@ -4960,7 +5408,7 @@ else
4960 fi 5408 fi
4961 else 5409 else
4962 # The program doesn't exist. 5410 # The program doesn't exist.
4963 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 5411 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4964 \$echo \"This script is just a wrapper for \$program.\" 1>&2 5412 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4965 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5413 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4966 exit $EXIT_FAILURE 5414 exit $EXIT_FAILURE
@@ -4992,71 +5440,73 @@ fi\
4992 5440
4993 if test -n "$addlibs"; then 5441 if test -n "$addlibs"; then
4994 gentop="$output_objdir/${outputname}x" 5442 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" 5443 generated="$generated $gentop"
5004 5444
5005 # Add in members from convenience archives. 5445 func_extract_archives $gentop $addlibs
5006 for xlib in $addlibs; do 5446 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 5447 fi
5055 5448
5056 # Do each command in the archive commands. 5449 # Do each command in the archive commands.
5057 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5450 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5058 cmds=$old_archive_from_new_cmds 5451 cmds=$old_archive_from_new_cmds
5059 else 5452 else
5453 # POSIX demands no paths to be encoded in archives. We have
5454 # to avoid creating archives with duplicate basenames if we
5455 # might have to extract them afterwards, e.g., when creating a
5456 # static archive out of a convenience library, or when linking
5457 # the entirety of a libtool archive into another (currently
5458 # not supported by libtool).
5459 if (for obj in $oldobjs
5460 do
5461 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5462 done | sort | sort -uc >/dev/null 2>&1); then
5463 :
5464 else
5465 $echo "copying selected object files to avoid basename conflicts..."
5466
5467 if test -z "$gentop"; then
5468 gentop="$output_objdir/${outputname}x"
5469 generated="$generated $gentop"
5470
5471 $show "${rm}r $gentop"
5472 $run ${rm}r "$gentop"
5473 $show "$mkdir $gentop"
5474 $run $mkdir "$gentop"
5475 exit_status=$?
5476 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5477 exit $exit_status
5478 fi
5479 fi
5480
5481 save_oldobjs=$oldobjs
5482 oldobjs=
5483 counter=1
5484 for obj in $save_oldobjs
5485 do
5486 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5487 case " $oldobjs " in
5488 " ") oldobjs=$obj ;;
5489 *[\ /]"$objbase "*)
5490 while :; do
5491 # Make sure we don't pick an alternate name that also
5492 # overlaps.
5493 newobj=lt$counter-$objbase
5494 counter=`expr $counter + 1`
5495 case " $oldobjs " in
5496 *[\ /]"$newobj "*) ;;
5497 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5498 esac
5499 done
5500 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5501 $run ln "$obj" "$gentop/$newobj" ||
5502 $run cp "$obj" "$gentop/$newobj"
5503 oldobjs="$oldobjs $gentop/$newobj"
5504 ;;
5505 *) oldobjs="$oldobjs $obj" ;;
5506 esac
5507 done
5508 fi
5509
5060 eval cmds=\"$old_archive_cmds\" 5510 eval cmds=\"$old_archive_cmds\"
5061 5511
5062 if len=`expr "X$cmds" : ".*"` && 5512 if len=`expr "X$cmds" : ".*"` &&
@@ -5070,20 +5520,7 @@ fi\
5070 objlist= 5520 objlist=
5071 concat_cmds= 5521 concat_cmds=
5072 save_oldobjs=$oldobjs 5522 save_oldobjs=$oldobjs
5073 # GNU ar 2.10+ was changed to match POSIX; thus no paths are 5523
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? 5524 # Is there a better way of finding the last object in the list?
5088 for obj in $save_oldobjs 5525 for obj in $save_oldobjs
5089 do 5526 do
@@ -5094,7 +5531,7 @@ fi\
5094 oldobjs="$objlist $obj" 5531 oldobjs="$objlist $obj"
5095 objlist="$objlist $obj" 5532 objlist="$objlist $obj"
5096 eval test_cmds=\"$old_archive_cmds\" 5533 eval test_cmds=\"$old_archive_cmds\"
5097 if len=`expr "X$test_cmds" : ".*"` && 5534 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5098 test "$len" -le "$max_cmd_len"; then 5535 test "$len" -le "$max_cmd_len"; then
5099 : 5536 :
5100 else 5537 else
@@ -5291,11 +5728,11 @@ relink_command=\"$relink_command\""
5291 # install_prog (especially on Windows NT). 5728 # install_prog (especially on Windows NT).
5292 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5729 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5293 # Allow the use of GNU shtool's install command. 5730 # Allow the use of GNU shtool's install command.
5294 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 5731 $echo "X$nonopt" | grep shtool > /dev/null; then
5295 # Aesthetically quote it. 5732 # Aesthetically quote it.
5296 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5733 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5297 case $arg in 5734 case $arg in
5298 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5735 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5299 arg="\"$arg\"" 5736 arg="\"$arg\""
5300 ;; 5737 ;;
5301 esac 5738 esac
@@ -5304,14 +5741,14 @@ relink_command=\"$relink_command\""
5304 shift 5741 shift
5305 else 5742 else
5306 install_prog= 5743 install_prog=
5307 arg="$nonopt" 5744 arg=$nonopt
5308 fi 5745 fi
5309 5746
5310 # The real first argument should be the name of the installation program. 5747 # The real first argument should be the name of the installation program.
5311 # Aesthetically quote it. 5748 # Aesthetically quote it.
5312 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5749 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5313 case $arg in 5750 case $arg in
5314 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5751 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5315 arg="\"$arg\"" 5752 arg="\"$arg\""
5316 ;; 5753 ;;
5317 esac 5754 esac
@@ -5329,28 +5766,31 @@ relink_command=\"$relink_command\""
5329 do 5766 do
5330 if test -n "$dest"; then 5767 if test -n "$dest"; then
5331 files="$files $dest" 5768 files="$files $dest"
5332 dest="$arg" 5769 dest=$arg
5333 continue 5770 continue
5334 fi 5771 fi
5335 5772
5336 case $arg in 5773 case $arg in
5337 -d) isdir=yes ;; 5774 -d) isdir=yes ;;
5338 -f) prev="-f" ;; 5775 -f)
5339 -g) prev="-g" ;; 5776 case " $install_prog " in
5340 -m) prev="-m" ;; 5777 *[\\\ /]cp\ *) ;;
5341 -o) prev="-o" ;; 5778 *) prev=$arg ;;
5779 esac
5780 ;;
5781 -g | -m | -o) prev=$arg ;;
5342 -s) 5782 -s)
5343 stripme=" -s" 5783 stripme=" -s"
5344 continue 5784 continue
5345 ;; 5785 ;;
5346 -*) ;; 5786 -*)
5347 5787 ;;
5348 *) 5788 *)
5349 # If the previous option needed an argument, then skip it. 5789 # If the previous option needed an argument, then skip it.
5350 if test -n "$prev"; then 5790 if test -n "$prev"; then
5351 prev= 5791 prev=
5352 else 5792 else
5353 dest="$arg" 5793 dest=$arg
5354 continue 5794 continue
5355 fi 5795 fi
5356 ;; 5796 ;;
@@ -5359,7 +5799,7 @@ relink_command=\"$relink_command\""
5359 # Aesthetically quote the argument. 5799 # Aesthetically quote the argument.
5360 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5800 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5361 case $arg in 5801 case $arg in
5362 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5802 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5363 arg="\"$arg\"" 5803 arg="\"$arg\""
5364 ;; 5804 ;;
5365 esac 5805 esac
@@ -5528,11 +5968,14 @@ relink_command=\"$relink_command\""
5528 5968
5529 if test "$#" -gt 0; then 5969 if test "$#" -gt 0; then
5530 # Delete the old symlinks, and create new ones. 5970 # Delete the old symlinks, and create new ones.
5971 # Try `ln -sf' first, because the `ln' binary might depend on
5972 # the symlink we replace! Solaris /bin/ln does not understand -f,
5973 # so we also need to try rm && ln -s.
5531 for linkname 5974 for linkname
5532 do 5975 do
5533 if test "$linkname" != "$realname"; then 5976 if test "$linkname" != "$realname"; then
5534 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 5977 $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)" 5978 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5536 fi 5979 fi
5537 done 5980 done
5538 fi 5981 fi
@@ -5545,7 +5988,16 @@ relink_command=\"$relink_command\""
5545 IFS="$save_ifs" 5988 IFS="$save_ifs"
5546 eval cmd=\"$cmd\" 5989 eval cmd=\"$cmd\"
5547 $show "$cmd" 5990 $show "$cmd"
5548 $run eval "$cmd" || exit $? 5991 $run eval "$cmd" || {
5992 lt_exit=$?
5993
5994 # Restore the uninstalled library and exit
5995 if test "$mode" = relink; then
5996 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5997 fi
5998
5999 exit $lt_exit
6000 }
5549 done 6001 done
5550 IFS="$save_ifs" 6002 IFS="$save_ifs"
5551 fi 6003 fi
@@ -5639,17 +6091,15 @@ relink_command=\"$relink_command\""
5639 notinst_deplibs= 6091 notinst_deplibs=
5640 relink_command= 6092 relink_command=
5641 6093
5642 # To insure that "foo" is sourced, and not "foo.exe", 6094 # Note that it is not necessary on cygwin/mingw to append a dot to
5643 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6095 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5644 # which disallows the automatic-append-.exe behavior. 6096 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5645 case $build in 6097 # `FILE.' does not work on cygwin managed mounts.
5646 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6098 #
5647 *) wrapperdot=${wrapper} ;;
5648 esac
5649 # If there is no directory component, then add one. 6099 # If there is no directory component, then add one.
5650 case $file in 6100 case $wrapper in
5651 */* | *\\*) . ${wrapperdot} ;; 6101 */* | *\\*) . ${wrapper} ;;
5652 *) . ./${wrapperdot} ;; 6102 *) . ./${wrapper} ;;
5653 esac 6103 esac
5654 6104
5655 # Check the variables that should have been set. 6105 # Check the variables that should have been set.
@@ -5677,34 +6127,21 @@ relink_command=\"$relink_command\""
5677 done 6127 done
5678 6128
5679 relink_command= 6129 relink_command=
5680 # To insure that "foo" is sourced, and not "foo.exe", 6130 # Note that it is not necessary on cygwin/mingw to append a dot to
5681 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6131 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5682 # which disallows the automatic-append-.exe behavior. 6132 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5683 case $build in 6133 # `FILE.' does not work on cygwin managed mounts.
5684 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6134 #
5685 *) wrapperdot=${wrapper} ;;
5686 esac
5687 # If there is no directory component, then add one. 6135 # If there is no directory component, then add one.
5688 case $file in 6136 case $wrapper in
5689 */* | *\\*) . ${wrapperdot} ;; 6137 */* | *\\*) . ${wrapper} ;;
5690 *) . ./${wrapperdot} ;; 6138 *) . ./${wrapper} ;;
5691 esac 6139 esac
5692 6140
5693 outputname= 6141 outputname=
5694 if test "$fast_install" = no && test -n "$relink_command"; then 6142 if test "$fast_install" = no && test -n "$relink_command"; then
5695 if test "$finalize" = yes && test -z "$run"; then 6143 if test "$finalize" = yes && test -z "$run"; then
5696 tmpdir="/tmp" 6144 tmpdir=`func_mktempdir`
5697 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5698 tmpdir="$tmpdir/libtool-$$"
5699 save_umask=`umask`
5700 umask 0077
5701 if $mkdir "$tmpdir"; then
5702 umask $save_umask
5703 else
5704 umask $save_umask
5705 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5706 continue
5707 fi
5708 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6145 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5709 outputname="$tmpdir/$file" 6146 outputname="$tmpdir/$file"
5710 # Replace the output file specification. 6147 # Replace the output file specification.
@@ -5728,7 +6165,7 @@ relink_command=\"$relink_command\""
5728 fi 6165 fi
5729 6166
5730 # remove .exe since cygwin /usr/bin/install will append another 6167 # remove .exe since cygwin /usr/bin/install will append another
5731 # one anyways 6168 # one anyway
5732 case $install_prog,$host in 6169 case $install_prog,$host in
5733 */usr/bin/install*,*cygwin*) 6170 */usr/bin/install*,*cygwin*)
5734 case $file:$destfile in 6171 case $file:$destfile in
@@ -5828,7 +6265,7 @@ relink_command=\"$relink_command\""
5828 # Exit here if they wanted silent mode. 6265 # Exit here if they wanted silent mode.
5829 test "$show" = : && exit $EXIT_SUCCESS 6266 test "$show" = : && exit $EXIT_SUCCESS
5830 6267
5831 $echo "----------------------------------------------------------------------" 6268 $echo "X----------------------------------------------------------------------" | $Xsed
5832 $echo "Libraries have been installed in:" 6269 $echo "Libraries have been installed in:"
5833 for libdir in $libdirs; do 6270 for libdir in $libdirs; do
5834 $echo " $libdir" 6271 $echo " $libdir"
@@ -5861,7 +6298,7 @@ relink_command=\"$relink_command\""
5861 $echo 6298 $echo
5862 $echo "See any operating system documentation about shared libraries for" 6299 $echo "See any operating system documentation about shared libraries for"
5863 $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6300 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5864 $echo "----------------------------------------------------------------------" 6301 $echo "X----------------------------------------------------------------------" | $Xsed
5865 exit $EXIT_SUCCESS 6302 exit $EXIT_SUCCESS
5866 ;; 6303 ;;
5867 6304
@@ -6078,9 +6515,17 @@ relink_command=\"$relink_command\""
6078 rmfiles="$rmfiles $objdir/$n" 6515 rmfiles="$rmfiles $objdir/$n"
6079 done 6516 done
6080 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6517 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6081 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6082 6518
6083 if test "$mode" = uninstall; then 6519 case "$mode" in
6520 clean)
6521 case " $library_names " in
6522 # " " in the beginning catches empty $dlname
6523 *" $dlname "*) ;;
6524 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6525 esac
6526 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6527 ;;
6528 uninstall)
6084 if test -n "$library_names"; then 6529 if test -n "$library_names"; then
6085 # Do each command in the postuninstall commands. 6530 # Do each command in the postuninstall commands.
6086 cmds=$postuninstall_cmds 6531 cmds=$postuninstall_cmds
@@ -6113,7 +6558,8 @@ relink_command=\"$relink_command\""
6113 IFS="$save_ifs" 6558 IFS="$save_ifs"
6114 fi 6559 fi
6115 # FIXME: should reinstall the best remaining shared library. 6560 # FIXME: should reinstall the best remaining shared library.
6116 fi 6561 ;;
6562 esac
6117 fi 6563 fi
6118 ;; 6564 ;;
6119 6565
@@ -6398,7 +6844,7 @@ esac
6398$echo 6844$echo
6399$echo "Try \`$modename --help' for more information about other modes." 6845$echo "Try \`$modename --help' for more information about other modes."
6400 6846
6401exit $EXIT_SUCCESS 6847exit $?
6402 6848
6403# The TAGs below are defined such that we never get into a situation 6849# The TAGs below are defined such that we never get into a situation
6404# in which we disable both kinds of libraries. Given conflicting 6850# in which we disable both kinds of libraries. Given conflicting
@@ -6412,12 +6858,11 @@ exit $EXIT_SUCCESS
6412# configuration. But we'll never go from static-only to shared-only. 6858# configuration. But we'll never go from static-only to shared-only.
6413 6859
6414# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6860# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6415build_libtool_libs=no 6861disable_libs=shared
6416build_old_libs=yes
6417# ### END LIBTOOL TAG CONFIG: disable-shared 6862# ### END LIBTOOL TAG CONFIG: disable-shared
6418 6863
6419# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6864# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6420build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` 6865disable_libs=static
6421# ### END LIBTOOL TAG CONFIG: disable-static 6866# ### END LIBTOOL TAG CONFIG: disable-static
6422 6867
6423# Local Variables: 6868# Local Variables: