ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/ltmain.sh
(Generate patch)

Comparing deliantra/server/utils/ltmain.sh (file contents):
Revision 1.3 by elmex, Wed Mar 15 15:35:53 2006 UTC vs.
Revision 1.5 by pippijn, Sun May 7 08:19:30 2006 UTC

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#
8# This program is free software; you can redistribute it and/or modify 8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by 9# it under the terms of the GNU General Public License as published by
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details. 16# General Public License for more details.
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
24# configuration script generated by Autoconf, you may include it under 24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program. 25# the same distribution terms that you use for the rest of that program.
41EXIT_SUCCESS=0 41EXIT_SUCCESS=0
42EXIT_FAILURE=1 42EXIT_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: 215 $" 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
52 # Discard the --no-reexec flag, and continue. 57 # Discard the --no-reexec flag, and continue.
53 shift 58 shift
81# Sed substitution that helps us do robust quoting. It backslashifies 86# Sed substitution that helps us do robust quoting. It backslashifies
82# metacharacters that are still active within double-quoted strings. 87# metacharacters that are still active within double-quoted strings.
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
97# NLS nuisances. 103# NLS nuisances.
98# Only set LANG and LC_ALL to C if already set. 104# Only set LANG and LC_ALL to C if already set.
105if test "${LANG+set}" = set; then 111if test "${LANG+set}" = set; then
106 save_LANG="$LANG"; LANG=C; export LANG 112 save_LANG="$LANG"; LANG=C; export LANG
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
115 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 122 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
116 exit $EXIT_FAILURE 123 exit $EXIT_FAILURE
123prevopt= 130prevopt=
124run= 131run=
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
131##################################### 140#####################################
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
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
134 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
145 *ar\ archive\ import\ library*) # definitely import 192 *ar\ archive\ import\ library*) # definitely import
146 win32_libid_type="x86 archive import" 193 win32_libid_type="x86 archive import"
147 ;; 194 ;;
148 *ar\ archive*) # could be an import, or static 195 *ar\ archive*) # could be an import, or static
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
156 win32_libid_type="x86 archive static" 202 *) win32_libid_type="x86 archive static";;
157 fi 203 esac
158 fi 204 fi
159 ;; 205 ;;
160 *DLL*) 206 *DLL*)
161 win32_libid_type="x86 DLL" 207 win32_libid_type="x86 DLL"
162 ;; 208 ;;
176# Infer tagged configuration to use if any are available and 222# Infer tagged configuration to use if any are available and
177# if one wasn't chosen via the "--tag" command line option. 223# if one wasn't chosen via the "--tag" command line option.
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
185 case $arg in 232 case $arg in
186 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 233 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
233 fi 280 fi
234 ;; 281 ;;
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\"
392
393disable_libs=no
243 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
247 arg="$1" 398 arg="$1"
303 ;; 454 ;;
304 455
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)
315 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 466 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
316 # Now print the configurations for the tags. 467 # Now print the configurations for the tags.
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)
324 $echo "$progname: enabling shell trace mode" 475 $echo "$progname: enabling shell trace mode"
325 set -x 476 set -x
340 if test "$build_old_libs" = yes; then 491 if test "$build_old_libs" = yes; then
341 $echo "enable static libraries" 492 $echo "enable static libraries"
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" ;;
349 500
350 --mode) prevopt="--mode" prev=mode ;; 501 --mode) prevopt="--mode" prev=mode ;;
355 --quiet | --silent) 506 --quiet | --silent)
356 show=: 507 show=:
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
364 prev=tag 519 prev=tag
365 preserve_args="$preserve_args --tag" 520 preserve_args="$preserve_args --tag"
387 $echo "$modename: option \`$prevopt' requires an argument" 1>&2 542 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
388 $echo "$help" 1>&2 543 $echo "$help" 1>&2
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.
395exec_cmd= 562exec_cmd=
396 563
397if test -z "$show_help"; then 564if test -z "$show_help"; then
398 565
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
406 for arg 573 for arg
407 do 574 do
463 libobj= 630 libobj=
464 later= 631 later=
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"
472 arg_mode=normal 639 arg_mode=normal
473 ;; 640 ;;
545 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 712 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
546 713
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
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
550 # in scan sets, so we specify it separately. 720 # at all, so we specify them separately.
551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 721 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
552 lastarg="\"$lastarg\"" 722 lastarg="\"$lastarg\""
553 ;; 723 ;;
554 esac 724 esac
555 725
619 continue 789 continue
620 ;; 790 ;;
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
627 xdir= 805 xdir=
628 else 806 else
691compiler." 869compiler."
692 870
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
705 # Create a libtool object file (analogous to a ".la" file), 888 # Create a libtool object file (analogous to a ".la" file),
706 # but don't create it if we're doing a dry run. 889 # but don't create it if we're doing a dry run.
718 if test "$build_libtool_libs" = yes; then 901 if test "$build_libtool_libs" = yes; then
719 # Without this assignment, base_compile gets emptied. 902 # Without this assignment, base_compile gets emptied.
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
738 if test -z "$output_obj"; then 921 if test -z "$output_obj"; then
739 # Place PIC objects in $objdir 922 # Place PIC objects in $objdir
801 984
802 # Only build a position-dependent object if we build old libraries. 985 # Only build a position-dependent object if we build old libraries.
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"
812 fi 995 fi
813 996
932 ltlibs= 1115 ltlibs=
933 module=no 1116 module=no
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
940 prev= 1124 prev=
941 prevarg= 1125 prevarg=
960 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1144 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
961 fi 1145 fi
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
976 done 1161 done
977 1162
1142 # A standard non-PIC object 1327 # A standard non-PIC object
1143 non_pic_objects="$non_pic_objects $non_pic_object" 1328 non_pic_objects="$non_pic_objects $non_pic_object"
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.
1150 if test -z "$run"; then 1340 if test -z "$run"; then
1151 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1341 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1225 shrext) 1415 shrext)
1226 shrext_cmds="$arg" 1416 shrext_cmds="$arg"
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=
1233 continue 1430 continue
1234 ;; 1431 ;;
1280 if test "X$arg" = "X-export-symbols"; then 1477 if test "X$arg" = "X-export-symbols"; then
1281 prev=expsyms 1478 prev=expsyms
1282 else 1479 else
1283 prev=expsyms_regex 1480 prev=expsyms_regex
1284 fi 1481 fi
1482 continue
1483 ;;
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"
1285 continue 1494 continue
1286 ;; 1495 ;;
1287 1496
1288 -inst-prefix-dir) 1497 -inst-prefix-dir)
1289 prev=inst_prefix 1498 prev=inst_prefix
1309 [\\/]* | [A-Za-z]:[\\/]*) ;; 1518 [\\/]* | [A-Za-z]:[\\/]*) ;;
1310 *) 1519 *)
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 ;;
1318 esac 1528 esac
1319 case "$deplibs " in 1529 case "$deplibs " in
1323 lib_search_path="$lib_search_path $dir" 1533 lib_search_path="$lib_search_path $dir"
1324 ;; 1534 ;;
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
1335 ;; 1550 ;;
1336 1551
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 ;;
1352 *-*-rhapsody* | *-*-darwin1.[012]) 1567 *-*-rhapsody* | *-*-darwin1.[012])
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 ;;
1363 esac 1587 esac
1364 fi 1588 fi
1365 deplibs="$deplibs $arg" 1589 deplibs="$deplibs $arg"
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
1374 -module) 1610 -module)
1375 module=yes 1611 module=yes
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"`
1389 case $arg in 1631 case $arg in
1390 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1632 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1391 arg="\"$arg\"" 1633 arg="\"$arg\""
1392 ;; 1634 ;;
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
1397 compiler_flags="$compiler_flags $arg" 1638 compiler_flags="$compiler_flags $arg"
1398 fi
1399 continue 1639 continue
1400 ;; 1640 ;;
1401 1641
1402 -shrext) 1642 -shrext)
1403 prev=shrext 1643 prev=shrext
1631 # A standard non-PIC object 1871 # A standard non-PIC object
1632 non_pic_objects="$non_pic_objects $non_pic_object" 1872 non_pic_objects="$non_pic_objects $non_pic_object"
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.
1639 if test -z "$run"; then 1884 if test -z "$run"; then
1640 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1885 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1736 fi 1981 fi
1737 # Create the object directory. 1982 # Create the object directory.
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
1747 # Determine the type of output 1992 # Determine the type of output
1748 case $output in 1993 case $output in
1801 deplibs= 2046 deplibs=
1802 newdependency_libs= 2047 newdependency_libs=
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"
1810 for file in $dlfiles $dlprefiles; do 2054 for file in $dlfiles $dlprefiles; do
1811 case $file in 2055 case $file in
1856 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 2100 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1857 if test "$linkmode,$pass" = "prog,link"; then 2101 if test "$linkmode,$pass" = "prog,link"; then
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 ;;
1865 -l*) 2109 -l*)
1866 if test "$linkmode" != lib && test "$linkmode" != prog; then 2110 if test "$linkmode" != lib && test "$linkmode" != prog; then
1867 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2111 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1868 continue
1869 fi
1870 if test "$pass" = conv; then
1871 deplibs="$deplib $deplibs"
1872 continue 2112 continue
1873 fi 2113 fi
1874 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2114 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1875 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2115 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1876 for search_ext in .la $std_shrext .so .a; do 2116 for search_ext in .la $std_shrext .so .a; do
1979 deplibs="$deplib $deplibs" 2219 deplibs="$deplib $deplibs"
1980 continue 2220 continue
1981 fi 2221 fi
1982 case $linkmode in 2222 case $linkmode in
1983 lib) 2223 lib)
1984 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
1985 $echo 2240 $echo
1986 $echo "*** Warning: Trying to link with static lib archive $deplib." 2241 $echo "*** Warning: Trying to link with static lib archive $deplib."
1987 $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"
1988 $echo "*** you link to this library. But I can only do this if you have a" 2243 $echo "*** you link to this library. But I can only do this if you have a"
1989 $echo "*** shared version of the library, which you do not appear to have" 2244 $echo "*** shared version of the library, which you do not appear to have"
2029 continue 2284 continue
2030 ;; 2285 ;;
2031 esac # case $deplib 2286 esac # case $deplib
2032 if test "$found" = yes || test -f "$lib"; then : 2287 if test "$found" = yes || test -f "$lib"; then :
2033 else 2288 else
2034 $echo "$modename: cannot find the library \`$lib'" 1>&2 2289 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2035 exit $EXIT_FAILURE 2290 exit $EXIT_FAILURE
2036 fi 2291 fi
2037 2292
2038 # Check to see that this really is a libtool archive. 2293 # Check to see that this really is a libtool archive.
2039 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2294 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2053 old_library= 2308 old_library=
2054 # If the library was installed with an old release of libtool, 2309 # If the library was installed with an old release of libtool,
2055 # it will not redefine variables installed, or shouldnotlink 2310 # it will not redefine variables installed, or shouldnotlink
2056 installed=yes 2311 installed=yes
2057 shouldnotlink=no 2312 shouldnotlink=no
2313 avoidtemprpath=
2314
2058 2315
2059 # Read the .la file 2316 # Read the .la file
2060 case $lib in 2317 case $lib in
2061 */* | *\\*) . $lib ;; 2318 */* | *\\*) . $lib ;;
2062 *) . ./$lib ;; 2319 *) . ./$lib ;;
2151 libdir="$abs_ladir" 2408 libdir="$abs_ladir"
2152 else 2409 else
2153 dir="$libdir" 2410 dir="$libdir"
2154 absdir="$libdir" 2411 absdir="$libdir"
2155 fi 2412 fi
2413 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2156 else 2414 else
2415 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2157 dir="$ladir/$objdir" 2416 dir="$ladir"
2158 absdir="$abs_ladir/$objdir" 2417 absdir="$abs_ladir"
2159 # Remove this search path later 2418 # Remove this search path later
2160 notinst_path="$notinst_path $abs_ladir" 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
2161 fi # $installed = yes 2426 fi # $installed = yes
2162 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2427 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2163 2428
2164 # This library was specified with -dlpreopen. 2429 # This library was specified with -dlpreopen.
2165 if test "$pass" = dlpreopen; then 2430 if test "$pass" = dlpreopen; then
2228 2493
2229 if test "$linkmode,$pass" = "prog,link"; then 2494 if test "$linkmode,$pass" = "prog,link"; then
2230 if test -n "$library_names" && 2495 if test -n "$library_names" &&
2231 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2496 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2232 # We need to hardcode the library path 2497 # We need to hardcode the library path
2233 if test -n "$shlibpath_var"; then 2498 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2234 # Make sure the rpath contains only unique directories. 2499 # Make sure the rpath contains only unique directories.
2235 case "$temp_rpath " in 2500 case "$temp_rpath " in
2236 *" $dir "*) ;; 2501 *" $dir "*) ;;
2237 *" $absdir "*) ;; 2502 *" $absdir "*) ;;
2238 *) temp_rpath="$temp_rpath $dir" ;; 2503 *) temp_rpath="$temp_rpath $absdir" ;;
2239 esac 2504 esac
2240 fi 2505 fi
2241 2506
2242 # Hardcode the library path. 2507 # Hardcode the library path.
2243 # Skip directories that are in the system default run-time 2508 # Skip directories that are in the system default run-time
2270 continue 2535 continue
2271 fi 2536 fi
2272 fi 2537 fi
2273 2538
2274 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
2275 if test -n "$library_names" && 2544 if test -n "$library_names" &&
2276 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2545 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2277 if test "$installed" = no; then 2546 if test "$installed" = no; then
2278 notinst_deplibs="$notinst_deplibs $lib" 2547 notinst_deplibs="$notinst_deplibs $lib"
2279 need_relink=yes 2548 need_relink=yes
2280 fi 2549 fi
2281 # This is a shared library 2550 # This is a shared library
2384 case $hardcode_action in 2653 case $hardcode_action in
2385 immediate | unsupported) 2654 immediate | unsupported)
2386 if test "$hardcode_direct" = no; then 2655 if test "$hardcode_direct" = no; then
2387 add="$dir/$linklib" 2656 add="$dir/$linklib"
2388 case $host in 2657 case $host in
2389 *-*-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" ;;
2390 *-*-darwin* ) 2662 *-*-darwin* )
2391 # 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
2392 # it, someone is ignoring the new warnings I added 2664 # it, someone is ignoring the new warnings I added
2393 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
2394 $echo "** Warning, lib $linklib is a module, not a shared library" 2667 $echo "** Warning, lib $linklib is a module, not a shared library"
2395 if test -z "$old_library" ; then 2668 if test -z "$old_library" ; then
2396 $echo 2669 $echo
2397 $echo "** And there doesn't seem to be a static archive available" 2670 $echo "** And there doesn't seem to be a static archive available"
2398 $echo "** The link will probably fail, sorry" 2671 $echo "** The link will probably fail, sorry"
2419 add="$dir/$linklib" 2692 add="$dir/$linklib"
2420 elif test "$hardcode_minus_L" = yes; then 2693 elif test "$hardcode_minus_L" = yes; then
2421 add_dir="-L$dir" 2694 add_dir="-L$dir"
2422 # Try looking first in the location we're being installed to. 2695 # Try looking first in the location we're being installed to.
2423 if test -n "$inst_prefix_dir"; then 2696 if test -n "$inst_prefix_dir"; then
2424 case "$libdir" in 2697 case $libdir in
2425 [\\/]*) 2698 [\\/]*)
2426 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2699 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2427 ;; 2700 ;;
2428 esac 2701 esac
2429 fi 2702 fi
2492 else 2765 else
2493 # We cannot seem to hardcode it, guess we'll fake it. 2766 # We cannot seem to hardcode it, guess we'll fake it.
2494 add_dir="-L$libdir" 2767 add_dir="-L$libdir"
2495 # Try looking first in the location we're being installed to. 2768 # Try looking first in the location we're being installed to.
2496 if test -n "$inst_prefix_dir"; then 2769 if test -n "$inst_prefix_dir"; then
2497 case "$libdir" in 2770 case $libdir in
2498 [\\/]*) 2771 [\\/]*)
2499 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2772 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2500 ;; 2773 ;;
2501 esac 2774 esac
2502 fi 2775 fi
2553 else 2826 else
2554 build_libtool_libs=no 2827 build_libtool_libs=no
2555 fi 2828 fi
2556 fi 2829 fi
2557 else 2830 else
2558 convenience="$convenience $dir/$old_library"
2559 old_convenience="$old_convenience $dir/$old_library"
2560 deplibs="$dir/$old_library $deplibs" 2831 deplibs="$dir/$old_library $deplibs"
2561 link_static=yes 2832 link_static=yes
2562 fi 2833 fi
2563 fi # link shared/static library? 2834 fi # link shared/static library?
2564 2835
2672 esac 2943 esac
2673 ;; 2944 ;;
2674 *) continue ;; 2945 *) continue ;;
2675 esac 2946 esac
2676 case " $deplibs " in 2947 case " $deplibs " in
2948 *" $path "*) ;;
2949 *) deplibs="$path $deplibs" ;;
2950 esac
2951 case " $deplibs " in
2677 *" $depdepl "*) ;; 2952 *" $depdepl "*) ;;
2678 *) deplibs="$depdepl $deplibs" ;; 2953 *) deplibs="$depdepl $deplibs" ;;
2679 esac
2680 case " $deplibs " in
2681 *" $path "*) ;;
2682 *) deplibs="$deplibs $path" ;;
2683 esac 2954 esac
2684 done 2955 done
2685 fi # link_all_deplibs != no 2956 fi # link_all_deplibs != no
2686 fi # linkmode = lib 2957 fi # linkmode = lib
2687 done # for deplib in $libs 2958 done # for deplib in $libs
2947 ;; 3218 ;;
2948 esac 3219 esac
2949 3220
2950 # Check that each of the things are valid numbers. 3221 # Check that each of the things are valid numbers.
2951 case $current in 3222 case $current in
2952 0 | [1-9] | [1-9][0-9] | [1-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]) ;;
2953 *) 3224 *)
2954 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 3225 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
2955 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3226 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2956 exit $EXIT_FAILURE 3227 exit $EXIT_FAILURE
2957 ;; 3228 ;;
2958 esac 3229 esac
2959 3230
2960 case $revision in 3231 case $revision in
2961 0 | [1-9] | [1-9][0-9] | [1-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]) ;;
2962 *) 3233 *)
2963 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 3234 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
2964 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3235 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2965 exit $EXIT_FAILURE 3236 exit $EXIT_FAILURE
2966 ;; 3237 ;;
2967 esac 3238 esac
2968 3239
2969 case $age in 3240 case $age in
2970 0 | [1-9] | [1-9][0-9] | [1-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]) ;;
2971 *) 3242 *)
2972 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 3243 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
2973 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3244 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2974 exit $EXIT_FAILURE 3245 exit $EXIT_FAILURE
2975 ;; 3246 ;;
2976 esac 3247 esac
2977 3248
2993 # verstring for coding it into the library header 3264 # verstring for coding it into the library header
2994 major=.`expr $current - $age` 3265 major=.`expr $current - $age`
2995 versuffix="$major.$age.$revision" 3266 versuffix="$major.$age.$revision"
2996 # Darwin ld doesn't like 0 for these options... 3267 # Darwin ld doesn't like 0 for these options...
2997 minor_current=`expr $current + 1` 3268 minor_current=`expr $current + 1`
2998 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"
2999 ;; 3270 ;;
3000 3271
3001 freebsd-aout) 3272 freebsd-aout)
3002 major=".$current" 3273 major=".$current"
3003 versuffix=".$current.$revision"; 3274 versuffix=".$current.$revision";
3146 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3417 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3147 fi 3418 fi
3148 3419
3149 # Eliminate all temporary directories. 3420 # Eliminate all temporary directories.
3150 for path in $notinst_path; do 3421 for path in $notinst_path; do
3151 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"`
3152 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` 3423 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3153 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` 3424 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3154 done 3425 done
3155 3426
3156 if test -n "$xrpath"; then 3427 if test -n "$xrpath"; then
3157 # If the user specified any rpath flags, then add them. 3428 # If the user specified any rpath flags, then add them.
3158 temp_xrpath= 3429 temp_xrpath=
3199 deplibs="$deplibs -framework System" 3470 deplibs="$deplibs -framework System"
3200 ;; 3471 ;;
3201 *-*-netbsd*) 3472 *-*-netbsd*)
3202 # 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.
3203 ;; 3474 ;;
3204 *-*-openbsd* | *-*-freebsd*) 3475 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3205 # Do not include libc due to us having libc/libc_r. 3476 # Do not include libc due to us having libc/libc_r.
3206 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
3207 ;; 3483 ;;
3208 *) 3484 *)
3209 # Add libc to deplibs on all other systems if necessary. 3485 # Add libc to deplibs on all other systems if necessary.
3210 if test "$build_libtool_need_lc" = "yes"; then 3486 if test "$build_libtool_need_lc" = "yes"; then
3211 deplibs="$deplibs -lc" 3487 deplibs="$deplibs -lc"
3245 $rm conftest.c 3521 $rm conftest.c
3246 cat > conftest.c <<EOF 3522 cat > conftest.c <<EOF
3247 int main() { return 0; } 3523 int main() { return 0; }
3248EOF 3524EOF
3249 $rm conftest 3525 $rm conftest
3250 $LTCC -o conftest conftest.c $deplibs 3526 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3251 if test "$?" -eq 0 ; then 3527 if test "$?" -eq 0 ; then
3252 ldd_output=`ldd conftest` 3528 ldd_output=`ldd conftest`
3253 for i in $deplibs; do 3529 for i in $deplibs; do
3254 name="`expr $i : '-l\(.*\)'`" 3530 name=`expr $i : '-l\(.*\)'`
3255 # If $name is empty we are operating on a -L argument. 3531 # If $name is empty we are operating on a -L argument.
3256 if test "$name" != "" && test "$name" -ne "0"; then 3532 if test "$name" != "" && test "$name" -ne "0"; then
3257 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3533 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3258 case " $predeps $postdeps " in 3534 case " $predeps $postdeps " in
3259 *" $i "*) 3535 *" $i "*)
3286 done 3562 done
3287 else 3563 else
3288 # Error occurred in the first compile. Let's try to salvage 3564 # Error occurred in the first compile. Let's try to salvage
3289 # the situation: Compile a separate program for each library. 3565 # the situation: Compile a separate program for each library.
3290 for i in $deplibs; do 3566 for i in $deplibs; do
3291 name="`expr $i : '-l\(.*\)'`" 3567 name=`expr $i : '-l\(.*\)'`
3292 # If $name is empty we are operating on a -L argument. 3568 # If $name is empty we are operating on a -L argument.
3293 if test "$name" != "" && test "$name" != "0"; then 3569 if test "$name" != "" && test "$name" != "0"; then
3294 $rm conftest 3570 $rm conftest
3295 $LTCC -o conftest conftest.c $i 3571 $LTCC $LTCFLAGS -o conftest conftest.c $i
3296 # Did it work? 3572 # Did it work?
3297 if test "$?" -eq 0 ; then 3573 if test "$?" -eq 0 ; then
3298 ldd_output=`ldd conftest` 3574 ldd_output=`ldd conftest`
3299 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3575 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3300 case " $predeps $postdeps " in 3576 case " $predeps $postdeps " in
3338 ;; 3614 ;;
3339 file_magic*) 3615 file_magic*)
3340 set dummy $deplibs_check_method 3616 set dummy $deplibs_check_method
3341 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3617 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3342 for a_deplib in $deplibs; do 3618 for a_deplib in $deplibs; do
3343 name="`expr $a_deplib : '-l\(.*\)'`" 3619 name=`expr $a_deplib : '-l\(.*\)'`
3344 # If $name is empty we are operating on a -L argument. 3620 # If $name is empty we are operating on a -L argument.
3345 if test "$name" != "" && test "$name" != "0"; then 3621 if test "$name" != "" && test "$name" != "0"; then
3346 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3622 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3347 case " $predeps $postdeps " in 3623 case " $predeps $postdeps " in
3348 *" $a_deplib "*) 3624 *" $a_deplib "*)
3407 ;; 3683 ;;
3408 match_pattern*) 3684 match_pattern*)
3409 set dummy $deplibs_check_method 3685 set dummy $deplibs_check_method
3410 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3686 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3411 for a_deplib in $deplibs; do 3687 for a_deplib in $deplibs; do
3412 name="`expr $a_deplib : '-l\(.*\)'`" 3688 name=`expr $a_deplib : '-l\(.*\)'`
3413 # If $name is empty we are operating on a -L argument. 3689 # If $name is empty we are operating on a -L argument.
3414 if test -n "$name" && test "$name" != "0"; then 3690 if test -n "$name" && test "$name" != "0"; then
3415 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3691 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3416 case " $predeps $postdeps " in 3692 case " $predeps $postdeps " in
3417 *" $a_deplib "*) 3693 *" $a_deplib "*)
3537 fi 3813 fi
3538 # Done checking deplibs! 3814 # Done checking deplibs!
3539 deplibs=$newdeplibs 3815 deplibs=$newdeplibs
3540 fi 3816 fi
3541 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
3542 # All the library-specific variables (install_libdir is set above). 3847 # All the library-specific variables (install_libdir is set above).
3543 library_names= 3848 library_names=
3544 old_library= 3849 old_library=
3545 dlname= 3850 dlname=
3546 3851
3620 if test -z "$dlname"; then 3925 if test -z "$dlname"; then
3621 dlname=$soname 3926 dlname=$soname
3622 fi 3927 fi
3623 3928
3624 lib="$output_objdir/$realname" 3929 lib="$output_objdir/$realname"
3930 linknames=
3625 for link 3931 for link
3626 do 3932 do
3627 linknames="$linknames $link" 3933 linknames="$linknames $link"
3628 done 3934 done
3629 3935
3648 skipped_export=false 3954 skipped_export=false
3649 else 3955 else
3650 # The command line is too long to execute in one step. 3956 # The command line is too long to execute in one step.
3651 $show "using reloadable object file for export list..." 3957 $show "using reloadable object file for export list..."
3652 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
3653 fi 3962 fi
3654 done 3963 done
3655 IFS="$save_ifs" 3964 IFS="$save_ifs"
3656 if test -n "$export_symbols_regex"; then 3965 if test -n "$export_symbols_regex"; then
3657 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 3966 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3681 if test -n "$whole_archive_flag_spec"; then 3990 if test -n "$whole_archive_flag_spec"; then
3682 save_libobjs=$libobjs 3991 save_libobjs=$libobjs
3683 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 3992 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3684 else 3993 else
3685 gentop="$output_objdir/${outputname}x" 3994 gentop="$output_objdir/${outputname}x"
3686 $show "${rm}r $gentop"
3687 $run ${rm}r "$gentop"
3688 $show "$mkdir $gentop"
3689 $run $mkdir "$gentop"
3690 status=$?
3691 if test "$status" -ne 0 && test ! -d "$gentop"; then
3692 exit $status
3693 fi
3694 generated="$generated $gentop" 3995 generated="$generated $gentop"
3695 3996
3696 for xlib in $convenience; do 3997 func_extract_archives $gentop $convenience
3697 # Extract the objects. 3998 libobjs="$libobjs $func_extract_archives_result"
3698 case $xlib in
3699 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3700 *) xabs=`pwd`"/$xlib" ;;
3701 esac
3702 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3703 xdir="$gentop/$xlib"
3704
3705 $show "${rm}r $xdir"
3706 $run ${rm}r "$xdir"
3707 $show "$mkdir $xdir"
3708 $run $mkdir "$xdir"
3709 status=$?
3710 if test "$status" -ne 0 && test ! -d "$xdir"; then
3711 exit $status
3712 fi
3713 # We will extract separately just the conflicting names and we will no
3714 # longer touch any unique names. It is faster to leave these extract
3715 # automatically by $AR in one run.
3716 $show "(cd $xdir && $AR x $xabs)"
3717 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3718 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3719 :
3720 else
3721 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3722 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3723 $AR t "$xabs" | sort | uniq -cd | while read -r count name
3724 do
3725 i=1
3726 while test "$i" -le "$count"
3727 do
3728 # Put our $i before any first dot (extension)
3729 # Never overwrite any file
3730 name_to="$name"
3731 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3732 do
3733 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3734 done
3735 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3736 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3737 i=`expr $i + 1`
3738 done
3739 done
3740 fi
3741
3742 libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3743 done
3744 fi
3745 fi 3999 fi
3746 4000 fi
4001
3747 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
3748 eval flag=\"$thread_safe_flag_spec\" 4003 eval flag=\"$thread_safe_flag_spec\"
3749 linker_flags="$linker_flags $flag" 4004 linker_flags="$linker_flags $flag"
3750 fi 4005 fi
3751 4006
3771 eval test_cmds=\"$archive_cmds\" 4026 eval test_cmds=\"$archive_cmds\"
3772 cmds=$archive_cmds 4027 cmds=$archive_cmds
3773 fi 4028 fi
3774 fi 4029 fi
3775 4030
3776 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` &&
3777 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
3778 : 4034 :
3779 else 4035 else
3780 # The command line is too long to link in one step, link piecewise. 4036 # The command line is too long to link in one step, link piecewise.
3781 $echo "creating reloadable object files..." 4037 $echo "creating reloadable object files..."
3790 # the spec. 4046 # the spec.
3791 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4047 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3792 save_libobjs=$libobjs 4048 save_libobjs=$libobjs
3793 fi 4049 fi
3794 save_output=$output 4050 save_output=$output
4051 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3795 4052
3796 # Clear the reloadable object creation command queue and 4053 # Clear the reloadable object creation command queue and
3797 # initialize k to one. 4054 # initialize k to one.
3798 test_cmds= 4055 test_cmds=
3799 concat_cmds= 4056 concat_cmds=
3800 objlist= 4057 objlist=
3801 delfiles= 4058 delfiles=
3802 last_robj= 4059 last_robj=
3803 k=1 4060 k=1
3804 output=$output_objdir/$save_output-${k}.$objext 4061 output=$output_objdir/$output_la-${k}.$objext
3805 # Loop over the list of objects to be linked. 4062 # Loop over the list of objects to be linked.
3806 for obj in $save_libobjs 4063 for obj in $save_libobjs
3807 do 4064 do
3808 eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4065 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3809 if test "X$objlist" = X || 4066 if test "X$objlist" = X ||
3810 { len=`expr "X$test_cmds" : ".*"` && 4067 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3811 test "$len" -le "$max_cmd_len"; }; then 4068 test "$len" -le "$max_cmd_len"; }; then
3812 objlist="$objlist $obj" 4069 objlist="$objlist $obj"
3813 else 4070 else
3814 # The command $test_cmds is almost too long, add a 4071 # The command $test_cmds is almost too long, add a
3815 # command to the queue. 4072 # command to the queue.
3819 else 4076 else
3820 # All subsequent reloadable object files will link in 4077 # All subsequent reloadable object files will link in
3821 # the last one created. 4078 # the last one created.
3822 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4079 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3823 fi 4080 fi
3824 last_robj=$output_objdir/$save_output-${k}.$objext 4081 last_robj=$output_objdir/$output_la-${k}.$objext
3825 k=`expr $k + 1` 4082 k=`expr $k + 1`
3826 output=$output_objdir/$save_output-${k}.$objext 4083 output=$output_objdir/$output_la-${k}.$objext
3827 objlist=$obj 4084 objlist=$obj
3828 len=1 4085 len=1
3829 fi 4086 fi
3830 done 4087 done
3831 # Handle the remaining objects by creating one last 4088 # Handle the remaining objects by creating one last
3841 libobjs=$output 4098 libobjs=$output
3842 # Append the command to create the export file. 4099 # Append the command to create the export file.
3843 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4100 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3844 fi 4101 fi
3845 4102
3846 # Set up a command to remove the reloadale object files 4103 # Set up a command to remove the reloadable object files
3847 # after they are used. 4104 # after they are used.
3848 i=0 4105 i=0
3849 while test "$i" -lt "$k" 4106 while test "$i" -lt "$k"
3850 do 4107 do
3851 i=`expr $i + 1` 4108 i=`expr $i + 1`
3852 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 4109 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3853 done 4110 done
3854 4111
3855 $echo "creating a temporary reloadable object file: $output" 4112 $echo "creating a temporary reloadable object file: $output"
3856 4113
3857 # Loop through the commands generated above and execute them. 4114 # Loop through the commands generated above and execute them.
3895 save_ifs="$IFS"; IFS='~' 4152 save_ifs="$IFS"; IFS='~'
3896 for cmd in $cmds; do 4153 for cmd in $cmds; do
3897 IFS="$save_ifs" 4154 IFS="$save_ifs"
3898 eval cmd=\"$cmd\" 4155 eval cmd=\"$cmd\"
3899 $show "$cmd" 4156 $show "$cmd"
3900 $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 }
3901 done 4167 done
3902 IFS="$save_ifs" 4168 IFS="$save_ifs"
3903 4169
3904 # Restore the uninstalled library and exit 4170 # Restore the uninstalled library and exit
3905 if test "$mode" = relink; then 4171 if test "$mode" = relink; then
3906 $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
3907 exit $EXIT_SUCCESS 4181 exit $EXIT_SUCCESS
3908 fi 4182 fi
3909 4183
3910 # Create links to the real library. 4184 # Create links to the real library.
3911 for linkname in $linknames; do 4185 for linkname in $linknames; do
3979 if test -n "$convenience"; then 4253 if test -n "$convenience"; then
3980 if test -n "$whole_archive_flag_spec"; then 4254 if test -n "$whole_archive_flag_spec"; then
3981 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" 4255 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3982 else 4256 else
3983 gentop="$output_objdir/${obj}x" 4257 gentop="$output_objdir/${obj}x"
3984 $show "${rm}r $gentop"
3985 $run ${rm}r "$gentop"
3986 $show "$mkdir $gentop"
3987 $run $mkdir "$gentop"
3988 status=$?
3989 if test "$status" -ne 0 && test ! -d "$gentop"; then
3990 exit $status
3991 fi
3992 generated="$generated $gentop" 4258 generated="$generated $gentop"
3993 4259
3994 for xlib in $convenience; do 4260 func_extract_archives $gentop $convenience
3995 # Extract the objects. 4261 reload_conv_objs="$reload_objs $func_extract_archives_result"
3996 case $xlib in
3997 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3998 *) xabs=`pwd`"/$xlib" ;;
3999 esac
4000 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4001 xdir="$gentop/$xlib"
4002
4003 $show "${rm}r $xdir"
4004 $run ${rm}r "$xdir"
4005 $show "$mkdir $xdir"
4006 $run $mkdir "$xdir"
4007 status=$?
4008 if test "$status" -ne 0 && test ! -d "$xdir"; then
4009 exit $status
4010 fi
4011 # We will extract separately just the conflicting names and we will no
4012 # longer touch any unique names. It is faster to leave these extract
4013 # automatically by $AR in one run.
4014 $show "(cd $xdir && $AR x $xabs)"
4015 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4016 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4017 :
4018 else
4019 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4020 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4021 $AR t "$xabs" | sort | uniq -cd | while read -r count name
4022 do
4023 i=1
4024 while test "$i" -le "$count"
4025 do
4026 # Put our $i before any first dot (extension)
4027 # Never overwrite any file
4028 name_to="$name"
4029 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4030 do
4031 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4032 done
4033 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4034 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4035 i=`expr $i + 1`
4036 done
4037 done
4038 fi
4039
4040 reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4041 done
4042 fi 4262 fi
4043 fi 4263 fi
4044 4264
4045 # Create the old-style object. 4265 # Create the old-style object.
4046 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 4266 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4136 compile_command="$compile_command ${wl}-bind_at_load" 4356 compile_command="$compile_command ${wl}-bind_at_load"
4137 finalize_command="$finalize_command ${wl}-bind_at_load" 4357 finalize_command="$finalize_command ${wl}-bind_at_load"
4138 fi 4358 fi
4139 ;; 4359 ;;
4140 esac 4360 esac
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
4141 4390
4142 compile_command="$compile_command $compile_deplibs" 4391 compile_command="$compile_command $compile_deplibs"
4143 finalize_command="$finalize_command $finalize_deplibs" 4392 finalize_command="$finalize_command $finalize_deplibs"
4144 4393
4145 if test -n "$rpath$xrpath"; then 4394 if test -n "$rpath$xrpath"; then
4181 *) perm_rpath="$perm_rpath $libdir" ;; 4430 *) perm_rpath="$perm_rpath $libdir" ;;
4182 esac 4431 esac
4183 fi 4432 fi
4184 case $host in 4433 case $host in
4185 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4434 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4435 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4186 case :$dllsearchpath: in 4436 case :$dllsearchpath: in
4187 *":$libdir:"*) ;; 4437 *":$libdir:"*) ;;
4188 *) dllsearchpath="$dllsearchpath:$libdir";; 4438 *) dllsearchpath="$dllsearchpath:$libdir";;
4439 esac
4440 case :$dllsearchpath: in
4441 *":$testbindir:"*) ;;
4442 *) dllsearchpath="$dllsearchpath:$testbindir";;
4189 esac 4443 esac
4190 ;; 4444 ;;
4191 esac 4445 esac
4192 done 4446 done
4193 # Substitute the hardcoded libdirs into the rpath. 4447 # Substitute the hardcoded libdirs into the rpath.
4298 $run eval '$mv "$nlist"T "$nlist"' 4552 $run eval '$mv "$nlist"T "$nlist"'
4299 fi 4553 fi
4300 4554
4301 # Prepare the list of exported symbols 4555 # Prepare the list of exported symbols
4302 if test -z "$export_symbols"; then 4556 if test -z "$export_symbols"; then
4303 export_symbols="$output_objdir/$output.exp" 4557 export_symbols="$output_objdir/$outputname.exp"
4304 $run $rm $export_symbols 4558 $run $rm $export_symbols
4305 $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
4306 else 4566 else
4307 $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"'
4308 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' 4568 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4309 $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
4310 fi 4576 fi
4311 fi 4577 fi
4312 4578
4313 for arg in $dlprefiles; do 4579 for arg in $dlprefiles; do
4314 $show "extracting global C symbols from \`$arg'" 4580 $show "extracting global C symbols from \`$arg'"
4355# define lt_ptr char * 4621# define lt_ptr char *
4356# define const 4622# define const
4357#endif 4623#endif
4358 4624
4359/* 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" "\
4360const struct { 4639const struct {
4640"
4641 ;;
4642 esac
4643
4644
4645 $echo >> "$output_objdir/$dlsyms" "\
4361 const char *name; 4646 const char *name;
4362 lt_ptr address; 4647 lt_ptr address;
4363} 4648}
4364lt_preloaded_symbols[] = 4649lt_preloaded_symbols[] =
4365{\ 4650{\
4402 *) pic_flag_for_symtable=" $pic_flag";; 4687 *) pic_flag_for_symtable=" $pic_flag";;
4403 esac 4688 esac
4404 esac 4689 esac
4405 4690
4406 # Now compile the dynamic symbol file. 4691 # Now compile the dynamic symbol file.
4407 $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\")"
4408 $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 $?
4409 4694
4410 # Clean up the generated files. 4695 # Clean up the generated files.
4411 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4696 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4412 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4697 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4413 4698
4414 # Transform the symbol file into the correct name. 4699 # Transform the symbol file into the correct name.
4700 case $host in
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 * )
4415 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4711 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4416 finalize_command=`$echo "X$finalize_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
4417 ;; 4715 ;;
4418 *) 4716 *)
4419 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4717 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4420 exit $EXIT_FAILURE 4718 exit $EXIT_FAILURE
4421 ;; 4719 ;;
4436 link_command="$compile_command$compile_rpath" 4734 link_command="$compile_command$compile_rpath"
4437 4735
4438 # We have no uninstalled library dependencies, so finalize right now. 4736 # We have no uninstalled library dependencies, so finalize right now.
4439 $show "$link_command" 4737 $show "$link_command"
4440 $run eval "$link_command" 4738 $run eval "$link_command"
4441 status=$? 4739 exit_status=$?
4442 4740
4443 # Delete the generated files. 4741 # Delete the generated files.
4444 if test -n "$dlsyms"; then 4742 if test -n "$dlsyms"; then
4445 $show "$rm $output_objdir/${outputname}S.${objext}" 4743 $show "$rm $output_objdir/${outputname}S.${objext}"
4446 $run $rm "$output_objdir/${outputname}S.${objext}" 4744 $run $rm "$output_objdir/${outputname}S.${objext}"
4447 fi 4745 fi
4448 4746
4449 exit $status 4747 exit $exit_status
4450 fi 4748 fi
4451 4749
4452 if test -n "$shlibpath_var"; then 4750 if test -n "$shlibpath_var"; then
4453 # We should set the shlibpath_var 4751 # We should set the shlibpath_var
4454 rpath= 4752 rpath=
4584 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4882 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4585 *) exeext= ;; 4883 *) exeext= ;;
4586 esac 4884 esac
4587 case $host in 4885 case $host in
4588 *cygwin* | *mingw* ) 4886 *cygwin* | *mingw* )
4589 cwrappersource=`$echo ${objdir}/lt-${output}.c` 4887 output_name=`basename $output`
4590 cwrapper=`$echo ${output}.exe` 4888 output_path=`dirname $output`
4889 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4890 cwrapper="$output_path/$output_name.exe"
4591 $rm $cwrappersource $cwrapper 4891 $rm $cwrappersource $cwrapper
4592 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4892 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4593 4893
4594 cat > $cwrappersource <<EOF 4894 cat > $cwrappersource <<EOF
4595 4895
4596/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4896/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4597 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4897 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4612#include <stdlib.h> 4912#include <stdlib.h>
4613#include <unistd.h> 4913#include <unistd.h>
4614#include <malloc.h> 4914#include <malloc.h>
4615#include <stdarg.h> 4915#include <stdarg.h>
4616#include <assert.h> 4916#include <assert.h>
4917#include <string.h>
4918#include <ctype.h>
4919#include <sys/stat.h>
4617 4920
4618#if defined(PATH_MAX) 4921#if defined(PATH_MAX)
4619# define LT_PATHMAX PATH_MAX 4922# define LT_PATHMAX PATH_MAX
4620#elif defined(MAXPATHLEN) 4923#elif defined(MAXPATHLEN)
4621# define LT_PATHMAX MAXPATHLEN 4924# define LT_PATHMAX MAXPATHLEN
4622#else 4925#else
4623# define LT_PATHMAX 1024 4926# define LT_PATHMAX 1024
4624#endif 4927#endif
4625 4928
4626#ifndef DIR_SEPARATOR 4929#ifndef DIR_SEPARATOR
4627#define DIR_SEPARATOR '/' 4930# define DIR_SEPARATOR '/'
4931# define PATH_SEPARATOR ':'
4628#endif 4932#endif
4629 4933
4630#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4934#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4631 defined (__OS2__) 4935 defined (__OS2__)
4632#define HAVE_DOS_BASED_FILE_SYSTEM 4936# define HAVE_DOS_BASED_FILE_SYSTEM
4633#ifndef DIR_SEPARATOR_2 4937# ifndef DIR_SEPARATOR_2
4634#define DIR_SEPARATOR_2 '\\' 4938# define DIR_SEPARATOR_2 '\\'
4635#endif 4939# endif
4940# ifndef PATH_SEPARATOR_2
4941# define PATH_SEPARATOR_2 ';'
4942# endif
4636#endif 4943#endif
4637 4944
4638#ifndef DIR_SEPARATOR_2 4945#ifndef DIR_SEPARATOR_2
4639# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4946# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4640#else /* DIR_SEPARATOR_2 */ 4947#else /* DIR_SEPARATOR_2 */
4641# define IS_DIR_SEPARATOR(ch) \ 4948# define IS_DIR_SEPARATOR(ch) \
4642 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4949 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4643#endif /* DIR_SEPARATOR_2 */ 4950#endif /* DIR_SEPARATOR_2 */
4644 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
4645#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 4958#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4646#define XFREE(stale) do { \ 4959#define XFREE(stale) do { \
4647 if (stale) { free ((void *) stale); stale = 0; } \ 4960 if (stale) { free ((void *) stale); stale = 0; } \
4648} while (0) 4961} while (0)
4649 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
4650const char *program_name = NULL; 4971const char *program_name = NULL;
4651 4972
4652void * xmalloc (size_t num); 4973void * xmalloc (size_t num);
4653char * xstrdup (const char *string); 4974char * xstrdup (const char *string);
4654char * basename (const char *name); 4975const char * base_name (const char *name);
4655char * fnqualify(const char *path); 4976char * find_executable(const char *wrapper);
4977int check_executable(const char *path);
4656char * strendzap(char *str, const char *pat); 4978char * strendzap(char *str, const char *pat);
4657void lt_fatal (const char *message, ...); 4979void lt_fatal (const char *message, ...);
4658 4980
4659int 4981int
4660main (int argc, char *argv[]) 4982main (int argc, char *argv[])
4661{ 4983{
4662 char **newargz; 4984 char **newargz;
4663 int i; 4985 int i;
4664 4986
4665 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);
4666 newargz = XMALLOC(char *, argc+2); 4990 newargz = XMALLOC(char *, argc+2);
4667EOF 4991EOF
4668 4992
4669 cat >> $cwrappersource <<EOF 4993 cat >> $cwrappersource <<EOF
4670 newargz[0] = "$SHELL"; 4994 newargz[0] = (char *) xstrdup("$SHELL");
4671EOF 4995EOF
4672 4996
4673 cat >> $cwrappersource <<"EOF" 4997 cat >> $cwrappersource <<"EOF"
4674 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]);
4675 /* we know the script has the same name, without the .exe */ 5002 /* we know the script has the same name, without the .exe */
4676 /* so make sure newargz[1] doesn't end in .exe */ 5003 /* so make sure newargz[1] doesn't end in .exe */
4677 strendzap(newargz[1],".exe"); 5004 strendzap(newargz[1],".exe");
4678 for (i = 1; i < argc; i++) 5005 for (i = 1; i < argc; i++)
4679 newargz[i+1] = xstrdup(argv[i]); 5006 newargz[i+1] = xstrdup(argv[i]);
4680 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
4681EOF 5015EOF
4682 5016
5017 case $host_os in
5018 mingw*)
4683 cat >> $cwrappersource <<EOF 5019 cat >> $cwrappersource <<EOF
5020 execv("$SHELL",(char const **)newargz);
5021EOF
5022 ;;
5023 *)
5024 cat >> $cwrappersource <<EOF
4684 execv("$SHELL",newargz); 5025 execv("$SHELL",newargz);
4685EOF 5026EOF
5027 ;;
5028 esac
4686 5029
4687 cat >> $cwrappersource <<"EOF" 5030 cat >> $cwrappersource <<"EOF"
5031 return 127;
4688} 5032}
4689 5033
4690void * 5034void *
4691xmalloc (size_t num) 5035xmalloc (size_t num)
4692{ 5036{
4702{ 5046{
4703 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5047 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4704; 5048;
4705} 5049}
4706 5050
4707char * 5051const char *
4708basename (const char *name) 5052base_name (const char *name)
4709{ 5053{
4710 const char *base; 5054 const char *base;
4711 5055
4712#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5056#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4713 /* Skip over the disk name in MSDOS pathnames. */ 5057 /* Skip over the disk name in MSDOS pathnames. */
4714 if (isalpha (name[0]) && name[1] == ':') 5058 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4715 name += 2; 5059 name += 2;
4716#endif 5060#endif
4717 5061
4718 for (base = name; *name; name++) 5062 for (base = name; *name; name++)
4719 if (IS_DIR_SEPARATOR (*name)) 5063 if (IS_DIR_SEPARATOR (*name))
4720 base = name + 1; 5064 base = name + 1;
4721 return (char *) base; 5065 return base;
4722} 5066}
4723 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 */
4724char * 5095char *
4725fnqualify(const char *path) 5096find_executable (const char* wrapper)
4726{ 5097{
4727 size_t size; 5098 int has_slash = 0;
4728 char *p; 5099 const char* p;
5100 const char* p_next;
5101 /* static buffer for getcwd */
4729 char tmp[LT_PATHMAX + 1]; 5102 char tmp[LT_PATHMAX + 1];
5103 int tmp_len;
5104 char* concat_name;
4730 5105
4731 assert(path != NULL); 5106 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
4732 5107
4733 /* Is it qualified already? */ 5108 if ((wrapper == NULL) || (*wrapper == '\0'))
5109 return NULL;
5110
5111 /* Absolute path? */
4734#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5112#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4735 if (isalpha (path[0]) && path[1] == ':') 5113 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
4736 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 {
4737#endif 5122#endif
4738 if (IS_DIR_SEPARATOR (path[0])) 5123 if (IS_DIR_SEPARATOR (wrapper[0]))
4739 return xstrdup (path); 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 }
5132#endif
4740 5133
4741 /* prepend the current directory */ 5134 for (p = wrapper; *p; p++)
4742 /* 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 */
4743 if (getcwd (tmp, LT_PATHMAX) == NULL) 5181 if (getcwd (tmp, LT_PATHMAX) == NULL)
4744 lt_fatal ("getcwd failed"); 5182 lt_fatal ("getcwd failed");
4745 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ 5183 tmp_len = strlen(tmp);
4746 p = XMALLOC(char, size); 5184 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
4747 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); 5185 memcpy (concat_name, tmp, tmp_len);
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);
4748 return p; 5192 return NULL;
4749} 5193}
4750 5194
4751char * 5195char *
4752strendzap(char *str, const char *pat) 5196strendzap(char *str, const char *pat)
4753{ 5197{
4787 va_start (ap, message); 5231 va_start (ap, message);
4788 lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5232 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4789 va_end (ap); 5233 va_end (ap);
4790} 5234}
4791EOF 5235EOF
4792 # we should really use a build-platform specific compiler 5236 # we should really use a build-platform specific compiler
4793 # here, but OTOH, the wrappers (shell script and this C one) 5237 # here, but OTOH, the wrappers (shell script and this C one)
4794 # are only useful if you want to execute the "real" binary. 5238 # are only useful if you want to execute the "real" binary.
4795 # Since the "real" binary is built for $host, then this 5239 # Since the "real" binary is built for $host, then this
4796 # wrapper might as well be built for $host, too. 5240 # wrapper might as well be built for $host, too.
4797 $run $LTCC -s -o $cwrapper $cwrappersource 5241 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
4798 ;; 5242 ;;
4799 esac 5243 esac
4800 $rm $output 5244 $rm $output
4801 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5245 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4802 5246
4803 $echo > $output "\ 5247 $echo > $output "\
4804#! $SHELL 5248#! $SHELL
4805 5249
4806# $output - temporary wrapper script for $objdir/$outputname 5250# $output - temporary wrapper script for $objdir/$outputname
4817Xsed='${SED} -e 1s/^X//' 5261Xsed='${SED} -e 1s/^X//'
4818sed_quote_subst='$sed_quote_subst' 5262sed_quote_subst='$sed_quote_subst'
4819 5263
4820# 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
4821# if CDPATH is set. 5265# if CDPATH is set.
4822if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi 5266(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4823 5267
4824relink_command=\"$relink_command\" 5268relink_command=\"$relink_command\"
4825 5269
4826# This environment variable determines our operation mode. 5270# This environment variable determines our operation mode.
4827if test \"\$libtool_install_magic\" = \"$magic\"; then 5271if test \"\$libtool_install_magic\" = \"$magic\"; then
4946" 5390"
4947 case $host in 5391 case $host in
4948 # Backslashes separate directories on plain windows 5392 # Backslashes separate directories on plain windows
4949 *-*-mingw | *-*-os2*) 5393 *-*-mingw | *-*-os2*)
4950 $echo >> $output "\ 5394 $echo >> $output "\
4951 exec \$progdir\\\\\$program \${1+\"\$@\"} 5395 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
4952" 5396"
4953 ;; 5397 ;;
4954 5398
4955 *) 5399 *)
4956 $echo >> $output "\ 5400 $echo >> $output "\
4957 exec \$progdir/\$program \${1+\"\$@\"} 5401 exec \"\$progdir/\$program\" \${1+\"\$@\"}
4958" 5402"
4959 ;; 5403 ;;
4960 esac 5404 esac
4961 $echo >> $output "\ 5405 $echo >> $output "\
4962 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 5406 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4963 exit $EXIT_FAILURE 5407 exit $EXIT_FAILURE
4964 fi 5408 fi
4965 else 5409 else
4966 # The program doesn't exist. 5410 # The program doesn't exist.
4967 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 5411 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
4968 \$echo \"This script is just a wrapper for \$program.\" 1>&2 5412 \$echo \"This script is just a wrapper for \$program.\" 1>&2
4969 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5413 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4970 exit $EXIT_FAILURE 5414 exit $EXIT_FAILURE
4971 fi 5415 fi
4972fi\ 5416fi\
4994 addlibs="$old_convenience" 5438 addlibs="$old_convenience"
4995 fi 5439 fi
4996 5440
4997 if test -n "$addlibs"; then 5441 if test -n "$addlibs"; then
4998 gentop="$output_objdir/${outputname}x" 5442 gentop="$output_objdir/${outputname}x"
4999 $show "${rm}r $gentop"
5000 $run ${rm}r "$gentop"
5001 $show "$mkdir $gentop"
5002 $run $mkdir "$gentop"
5003 status=$?
5004 if test "$status" -ne 0 && test ! -d "$gentop"; then
5005 exit $status
5006 fi
5007 generated="$generated $gentop" 5443 generated="$generated $gentop"
5008 5444
5009 # Add in members from convenience archives. 5445 func_extract_archives $gentop $addlibs
5010 for xlib in $addlibs; do 5446 oldobjs="$oldobjs $func_extract_archives_result"
5011 # Extract the objects.
5012 case $xlib in
5013 [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5014 *) xabs=`pwd`"/$xlib" ;;
5015 esac
5016 xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5017 xdir="$gentop/$xlib"
5018
5019 $show "${rm}r $xdir"
5020 $run ${rm}r "$xdir"
5021 $show "$mkdir $xdir"
5022 $run $mkdir "$xdir"
5023 status=$?
5024 if test "$status" -ne 0 && test ! -d "$xdir"; then
5025 exit $status
5026 fi
5027 # We will extract separately just the conflicting names and we will no
5028 # longer touch any unique names. It is faster to leave these extract
5029 # automatically by $AR in one run.
5030 $show "(cd $xdir && $AR x $xabs)"
5031 $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5032 if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5033 :
5034 else
5035 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5036 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5037 $AR t "$xabs" | sort | uniq -cd | while read -r count name
5038 do
5039 i=1
5040 while test "$i" -le "$count"
5041 do
5042 # Put our $i before any first dot (extension)
5043 # Never overwrite any file
5044 name_to="$name"
5045 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5046 do
5047 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5048 done
5049 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5050 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5051 i=`expr $i + 1`
5052 done
5053 done
5054 fi
5055
5056 oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5057 done
5058 fi 5447 fi
5059 5448
5060 # Do each command in the archive commands. 5449 # Do each command in the archive commands.
5061 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
5062 cmds=$old_archive_from_new_cmds 5451 cmds=$old_archive_from_new_cmds
5063 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
5064 eval cmds=\"$old_archive_cmds\" 5510 eval cmds=\"$old_archive_cmds\"
5065 5511
5066 if len=`expr "X$cmds" : ".*"` && 5512 if len=`expr "X$cmds" : ".*"` &&
5067 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5513 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5068 cmds=$old_archive_cmds 5514 cmds=$old_archive_cmds
5072 save_RANLIB=$RANLIB 5518 save_RANLIB=$RANLIB
5073 RANLIB=: 5519 RANLIB=:
5074 objlist= 5520 objlist=
5075 concat_cmds= 5521 concat_cmds=
5076 save_oldobjs=$oldobjs 5522 save_oldobjs=$oldobjs
5077 # GNU ar 2.10+ was changed to match POSIX; thus no paths are 5523
5078 # encoded into archives. This makes 'ar r' malfunction in
5079 # this piecewise linking case whenever conflicting object
5080 # names appear in distinct ar calls; check, warn and compensate.
5081 if (for obj in $save_oldobjs
5082 do
5083 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5084 done | sort | sort -uc >/dev/null 2>&1); then
5085 :
5086 else
5087 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5088 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5089 AR_FLAGS=cq
5090 fi
5091 # 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?
5092 for obj in $save_oldobjs 5525 for obj in $save_oldobjs
5093 do 5526 do
5094 last_oldobj=$obj 5527 last_oldobj=$obj
5095 done 5528 done
5096 for obj in $save_oldobjs 5529 for obj in $save_oldobjs
5097 do 5530 do
5098 oldobjs="$objlist $obj" 5531 oldobjs="$objlist $obj"
5099 objlist="$objlist $obj" 5532 objlist="$objlist $obj"
5100 eval test_cmds=\"$old_archive_cmds\" 5533 eval test_cmds=\"$old_archive_cmds\"
5101 if len=`expr "X$test_cmds" : ".*"` && 5534 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5102 test "$len" -le "$max_cmd_len"; then 5535 test "$len" -le "$max_cmd_len"; then
5103 : 5536 :
5104 else 5537 else
5105 # the above command should be used before it gets too long 5538 # the above command should be used before it gets too long
5106 oldobjs=$objlist 5539 oldobjs=$objlist
5293 5726
5294 # There may be an optional sh(1) argument at the beginning of 5727 # There may be an optional sh(1) argument at the beginning of
5295 # install_prog (especially on Windows NT). 5728 # install_prog (especially on Windows NT).
5296 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5729 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5297 # Allow the use of GNU shtool's install command. 5730 # Allow the use of GNU shtool's install command.
5298 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 5731 $echo "X$nonopt" | grep shtool > /dev/null; then
5299 # Aesthetically quote it. 5732 # Aesthetically quote it.
5300 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5733 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5301 case $arg in 5734 case $arg in
5302 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5735 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5303 arg="\"$arg\"" 5736 arg="\"$arg\""
5304 ;; 5737 ;;
5305 esac 5738 esac
5306 install_prog="$arg " 5739 install_prog="$arg "
5307 arg="$1" 5740 arg="$1"
5308 shift 5741 shift
5309 else 5742 else
5310 install_prog= 5743 install_prog=
5311 arg="$nonopt" 5744 arg=$nonopt
5312 fi 5745 fi
5313 5746
5314 # 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.
5315 # Aesthetically quote it. 5748 # Aesthetically quote it.
5316 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5749 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5317 case $arg in 5750 case $arg in
5318 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5751 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5319 arg="\"$arg\"" 5752 arg="\"$arg\""
5320 ;; 5753 ;;
5321 esac 5754 esac
5322 install_prog="$install_prog$arg" 5755 install_prog="$install_prog$arg"
5323 5756
5331 stripme= 5764 stripme=
5332 for arg 5765 for arg
5333 do 5766 do
5334 if test -n "$dest"; then 5767 if test -n "$dest"; then
5335 files="$files $dest" 5768 files="$files $dest"
5336 dest="$arg" 5769 dest=$arg
5337 continue 5770 continue
5338 fi 5771 fi
5339 5772
5340 case $arg in 5773 case $arg in
5341 -d) isdir=yes ;; 5774 -d) isdir=yes ;;
5342 -f) prev="-f" ;; 5775 -f)
5343 -g) prev="-g" ;; 5776 case " $install_prog " in
5344 -m) prev="-m" ;; 5777 *[\\\ /]cp\ *) ;;
5345 -o) prev="-o" ;; 5778 *) prev=$arg ;;
5779 esac
5780 ;;
5781 -g | -m | -o) prev=$arg ;;
5346 -s) 5782 -s)
5347 stripme=" -s" 5783 stripme=" -s"
5348 continue 5784 continue
5349 ;; 5785 ;;
5350 -*) ;; 5786 -*)
5351 5787 ;;
5352 *) 5788 *)
5353 # If the previous option needed an argument, then skip it. 5789 # If the previous option needed an argument, then skip it.
5354 if test -n "$prev"; then 5790 if test -n "$prev"; then
5355 prev= 5791 prev=
5356 else 5792 else
5357 dest="$arg" 5793 dest=$arg
5358 continue 5794 continue
5359 fi 5795 fi
5360 ;; 5796 ;;
5361 esac 5797 esac
5362 5798
5363 # Aesthetically quote the argument. 5799 # Aesthetically quote the argument.
5364 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5800 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5365 case $arg in 5801 case $arg in
5366 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5802 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5367 arg="\"$arg\"" 5803 arg="\"$arg\""
5368 ;; 5804 ;;
5369 esac 5805 esac
5370 install_prog="$install_prog $arg" 5806 install_prog="$install_prog $arg"
5371 done 5807 done
5530 $run eval "$striplib $destdir/$realname" || exit $? 5966 $run eval "$striplib $destdir/$realname" || exit $?
5531 fi 5967 fi
5532 5968
5533 if test "$#" -gt 0; then 5969 if test "$#" -gt 0; then
5534 # 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.
5535 for linkname 5974 for linkname
5536 do 5975 do
5537 if test "$linkname" != "$realname"; then 5976 if test "$linkname" != "$realname"; then
5538 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 5977 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5539 $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; }; })"
5540 fi 5979 fi
5541 done 5980 done
5542 fi 5981 fi
5543 5982
5544 # Do each command in the postinstall commands. 5983 # Do each command in the postinstall commands.
5547 save_ifs="$IFS"; IFS='~' 5986 save_ifs="$IFS"; IFS='~'
5548 for cmd in $cmds; do 5987 for cmd in $cmds; do
5549 IFS="$save_ifs" 5988 IFS="$save_ifs"
5550 eval cmd=\"$cmd\" 5989 eval cmd=\"$cmd\"
5551 $show "$cmd" 5990 $show "$cmd"
5552 $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 }
5553 done 6001 done
5554 IFS="$save_ifs" 6002 IFS="$save_ifs"
5555 fi 6003 fi
5556 6004
5557 # Install the pseudo-library for information purposes. 6005 # Install the pseudo-library for information purposes.
5641 esac 6089 esac
5642 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6090 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5643 notinst_deplibs= 6091 notinst_deplibs=
5644 relink_command= 6092 relink_command=
5645 6093
5646 # 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
5647 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6095 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5648 # which disallows the automatic-append-.exe behavior. 6096 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5649 case $build in 6097 # `FILE.' does not work on cygwin managed mounts.
5650 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6098 #
5651 *) wrapperdot=${wrapper} ;;
5652 esac
5653 # If there is no directory component, then add one. 6099 # If there is no directory component, then add one.
5654 case $file in 6100 case $wrapper in
5655 */* | *\\*) . ${wrapperdot} ;; 6101 */* | *\\*) . ${wrapper} ;;
5656 *) . ./${wrapperdot} ;; 6102 *) . ./${wrapper} ;;
5657 esac 6103 esac
5658 6104
5659 # Check the variables that should have been set. 6105 # Check the variables that should have been set.
5660 if test -z "$notinst_deplibs"; then 6106 if test -z "$notinst_deplibs"; then
5661 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6107 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5679 finalize=no 6125 finalize=no
5680 fi 6126 fi
5681 done 6127 done
5682 6128
5683 relink_command= 6129 relink_command=
5684 # 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
5685 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6131 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5686 # which disallows the automatic-append-.exe behavior. 6132 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5687 case $build in 6133 # `FILE.' does not work on cygwin managed mounts.
5688 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6134 #
5689 *) wrapperdot=${wrapper} ;;
5690 esac
5691 # If there is no directory component, then add one. 6135 # If there is no directory component, then add one.
5692 case $file in 6136 case $wrapper in
5693 */* | *\\*) . ${wrapperdot} ;; 6137 */* | *\\*) . ${wrapper} ;;
5694 *) . ./${wrapperdot} ;; 6138 *) . ./${wrapper} ;;
5695 esac 6139 esac
5696 6140
5697 outputname= 6141 outputname=
5698 if test "$fast_install" = no && test -n "$relink_command"; then 6142 if test "$fast_install" = no && test -n "$relink_command"; then
5699 if test "$finalize" = yes && test -z "$run"; then 6143 if test "$finalize" = yes && test -z "$run"; then
5700 tmpdir="/tmp" 6144 tmpdir=`func_mktempdir`
5701 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5702 tmpdir="$tmpdir/libtool-$$"
5703 save_umask=`umask`
5704 umask 0077
5705 if $mkdir "$tmpdir"; then
5706 umask $save_umask
5707 else
5708 umask $save_umask
5709 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5710 continue
5711 fi
5712 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6145 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5713 outputname="$tmpdir/$file" 6146 outputname="$tmpdir/$file"
5714 # Replace the output file specification. 6147 # Replace the output file specification.
5715 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 6148 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5716 6149
5730 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6163 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5731 fi 6164 fi
5732 fi 6165 fi
5733 6166
5734 # remove .exe since cygwin /usr/bin/install will append another 6167 # remove .exe since cygwin /usr/bin/install will append another
5735 # one anyways 6168 # one anyway
5736 case $install_prog,$host in 6169 case $install_prog,$host in
5737 */usr/bin/install*,*cygwin*) 6170 */usr/bin/install*,*cygwin*)
5738 case $file:$destfile in 6171 case $file:$destfile in
5739 *.exe:*.exe) 6172 *.exe:*.exe)
5740 # this is ok 6173 # this is ok
5830 fi 6263 fi
5831 6264
5832 # Exit here if they wanted silent mode. 6265 # Exit here if they wanted silent mode.
5833 test "$show" = : && exit $EXIT_SUCCESS 6266 test "$show" = : && exit $EXIT_SUCCESS
5834 6267
5835 $echo "----------------------------------------------------------------------" 6268 $echo "X----------------------------------------------------------------------" | $Xsed
5836 $echo "Libraries have been installed in:" 6269 $echo "Libraries have been installed in:"
5837 for libdir in $libdirs; do 6270 for libdir in $libdirs; do
5838 $echo " $libdir" 6271 $echo " $libdir"
5839 done 6272 done
5840 $echo 6273 $echo
5863 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6296 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5864 fi 6297 fi
5865 $echo 6298 $echo
5866 $echo "See any operating system documentation about shared libraries for" 6299 $echo "See any operating system documentation about shared libraries for"
5867 $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."
5868 $echo "----------------------------------------------------------------------" 6301 $echo "X----------------------------------------------------------------------" | $Xsed
5869 exit $EXIT_SUCCESS 6302 exit $EXIT_SUCCESS
5870 ;; 6303 ;;
5871 6304
5872 # libtool execute mode 6305 # libtool execute mode
5873 execute) 6306 execute)
6080 # Delete the libtool libraries and symlinks. 6513 # Delete the libtool libraries and symlinks.
6081 for n in $library_names; do 6514 for n in $library_names; do
6082 rmfiles="$rmfiles $objdir/$n" 6515 rmfiles="$rmfiles $objdir/$n"
6083 done 6516 done
6084 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6517 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6518
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
6085 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6526 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6086 6527 ;;
6087 if test "$mode" = uninstall; then 6528 uninstall)
6088 if test -n "$library_names"; then 6529 if test -n "$library_names"; then
6089 # Do each command in the postuninstall commands. 6530 # Do each command in the postuninstall commands.
6090 cmds=$postuninstall_cmds 6531 cmds=$postuninstall_cmds
6091 save_ifs="$IFS"; IFS='~' 6532 save_ifs="$IFS"; IFS='~'
6092 for cmd in $cmds; do 6533 for cmd in $cmds; do
6115 fi 6556 fi
6116 done 6557 done
6117 IFS="$save_ifs" 6558 IFS="$save_ifs"
6118 fi 6559 fi
6119 # FIXME: should reinstall the best remaining shared library. 6560 # FIXME: should reinstall the best remaining shared library.
6120 fi 6561 ;;
6562 esac
6121 fi 6563 fi
6122 ;; 6564 ;;
6123 6565
6124 *.lo) 6566 *.lo)
6125 # Possibly a libtool object, so verify it. 6567 # Possibly a libtool object, so verify it.
6400esac 6842esac
6401 6843
6402$echo 6844$echo
6403$echo "Try \`$modename --help' for more information about other modes." 6845$echo "Try \`$modename --help' for more information about other modes."
6404 6846
6405exit $EXIT_SUCCESS 6847exit $?
6406 6848
6407# 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
6408# in which we disable both kinds of libraries. Given conflicting 6850# in which we disable both kinds of libraries. Given conflicting
6409# choices, we go for a static library, that is the most portable, 6851# choices, we go for a static library, that is the most portable,
6410# since we can't tell whether shared libraries were disabled because 6852# since we can't tell whether shared libraries were disabled because
6414# time on that platform, so we default to a shared-only configuration. 6856# time on that platform, so we default to a shared-only configuration.
6415# If a disable-shared tag is given, we'll fallback to a static-only 6857# If a disable-shared tag is given, we'll fallback to a static-only
6416# 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.
6417 6859
6418# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6860# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6419build_libtool_libs=no 6861disable_libs=shared
6420build_old_libs=yes
6421# ### END LIBTOOL TAG CONFIG: disable-shared 6862# ### END LIBTOOL TAG CONFIG: disable-shared
6422 6863
6423# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6864# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6424build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` 6865disable_libs=static
6425# ### END LIBTOOL TAG CONFIG: disable-static 6866# ### END LIBTOOL TAG CONFIG: disable-static
6426 6867
6427# Local Variables: 6868# Local Variables:
6428# mode:shell-script 6869# mode:shell-script
6429# sh-indentation:2 6870# sh-indentation:2

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines