comparison build-scripts/ltmain.sh @ 1570:a740bca2a1b1

Updated to libtool-1.5.22
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Mar 2006 10:20:44 +0000
parents 19418e4422cb
children ec3466b08f17
comparison
equal deleted inserted replaced
1569:50d9888d201d 1570:a740bca2a1b1
1 # Based on libtool-1.5.8 1 # Based on libtool-1.5.22
2 # ltmain.sh - Provide generalized library-building support services. 2 # ltmain.sh - Provide generalized library-building support services.
3 # NOTE: Changing this file will not affect anything until you rerun configure. 3 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # 4 #
5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 5 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
6 # Free Software Foundation, Inc. 6 # Free Software Foundation, Inc.
7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # 8 #
9 # This program is free software; you can redistribute it and/or modify 9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by 10 # it under the terms of the GNU General Public License as published by
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details. 17 # General Public License for more details.
18 # 18 #
19 # You should have received a copy of the GNU General Public License 19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software 20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # 22 #
23 # As a special exception to the GNU General Public License, if you 23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a 24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under 25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program. 26 # the same distribution terms that you use for the rest of that program.
42 EXIT_SUCCESS=0 42 EXIT_SUCCESS=0
43 EXIT_FAILURE=1 43 EXIT_FAILURE=1
44 44
45 PROGRAM=ltmain.sh 45 PROGRAM=ltmain.sh
46 PACKAGE=libtool 46 PACKAGE=libtool
47 VERSION=1.5.8 47 VERSION=1.5.22
48 TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)" 48 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
49 49
50 # See if we are running on zsh, and set the options which allow our 50 # See if we are running on zsh, and set the options which allow our
51 # commands through without removal of \ escapes. 51 # commands through without removal of \ escapes.
52 if test -n "${ZSH_VERSION+set}" ; then 52 if test -n "${ZSH_VERSION+set}" ; then
53 setopt NO_GLOB_SUBST 53 setopt NO_GLOB_SUBST
87 # Sed substitution that helps us do robust quoting. It backslashifies 87 # Sed substitution that helps us do robust quoting. It backslashifies
88 # metacharacters that are still active within double-quoted strings. 88 # metacharacters that are still active within double-quoted strings.
89 Xsed="${SED}"' -e 1s/^X//' 89 Xsed="${SED}"' -e 1s/^X//'
90 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 90 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
91 # test EBCDIC or ASCII 91 # test EBCDIC or ASCII
92 case `echo A|tr A '\301'` in 92 case `echo X|tr X '\101'` in
93 A) # EBCDIC based system 93 A) # ASCII based system
94 SP2NL="tr '\100' '\n'" 94 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
95 NL2SP="tr '\r\n' '\100\100'" 95 SP2NL='tr \040 \012'
96 NL2SP='tr \015\012 \040\040'
96 ;; 97 ;;
97 *) # Assume ASCII based system 98 *) # EBCDIC based system
98 SP2NL="tr '\040' '\012'" 99 SP2NL='tr \100 \n'
99 NL2SP="tr '\015\012' '\040\040'" 100 NL2SP='tr \r\n \100\100'
100 ;; 101 ;;
101 esac 102 esac
102 103
103 # NLS nuisances. 104 # NLS nuisances.
104 # Only set LANG and LC_ALL to C if already set. 105 # Only set LANG and LC_ALL to C if already set.
111 if test "${LANG+set}" = set; then 112 if test "${LANG+set}" = set; then
112 save_LANG="$LANG"; LANG=C; export LANG 113 save_LANG="$LANG"; LANG=C; export LANG
113 fi 114 fi
114 115
115 # Make sure IFS has a sensible default 116 # Make sure IFS has a sensible default
116 : ${IFS=" 117 lt_nl='
117 "} 118 '
119 IFS=" $lt_nl"
118 120
119 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 121 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
120 $echo "$modename: not configured to build any kind of library" 1>&2 122 $echo "$modename: not configured to build any kind of library" 1>&2
121 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 123 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
122 exit $EXIT_FAILURE 124 exit $EXIT_FAILURE
129 prevopt= 131 prevopt=
130 run= 132 run=
131 show="$echo" 133 show="$echo"
132 show_help= 134 show_help=
133 execute_dlfiles= 135 execute_dlfiles=
136 duplicate_deps=no
137 preserve_args=
134 lo2o="s/\\.lo\$/.${objext}/" 138 lo2o="s/\\.lo\$/.${objext}/"
135 o2lo="s/\\.${objext}\$/.lo/" 139 o2lo="s/\\.${objext}\$/.lo/"
136 140
137 ##################################### 141 #####################################
138 # Shell function definitions: 142 # Shell function definitions:
139 # This seems to be the best place for them 143 # This seems to be the best place for them
144
145 # func_mktempdir [string]
146 # Make a temporary directory that won't clash with other running
147 # libtool processes, and avoids race conditions if possible. If
148 # given, STRING is the basename for that directory.
149 func_mktempdir ()
150 {
151 my_template="${TMPDIR-/tmp}/${1-$progname}"
152
153 if test "$run" = ":"; then
154 # Return a directory name, but don't create it in dry-run mode
155 my_tmpdir="${my_template}-$$"
156 else
157
158 # If mktemp works, use that first and foremost
159 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
160
161 if test ! -d "$my_tmpdir"; then
162 # Failing that, at least try and use $RANDOM to avoid a race
163 my_tmpdir="${my_template}-${RANDOM-0}$$"
164
165 save_mktempdir_umask=`umask`
166 umask 0077
167 $mkdir "$my_tmpdir"
168 umask $save_mktempdir_umask
169 fi
170
171 # If we're not in dry-run mode, bomb out on failure
172 test -d "$my_tmpdir" || {
173 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
174 exit $EXIT_FAILURE
175 }
176 fi
177
178 $echo "X$my_tmpdir" | $Xsed
179 }
180
140 181
141 # func_win32_libid arg 182 # func_win32_libid arg
142 # return the library type of file 'arg' 183 # return the library type of file 'arg'
143 # 184 #
144 # Need a lot of goo to handle *both* DLLs and import libs 185 # Need a lot of goo to handle *both* DLLs and import libs
145 # Has to be a shell function in order to 'eat' the argument 186 # Has to be a shell function in order to 'eat' the argument
146 # that is supplied when $file_magic_command is called. 187 # that is supplied when $file_magic_command is called.
147 func_win32_libid () { 188 func_win32_libid ()
189 {
148 win32_libid_type="unknown" 190 win32_libid_type="unknown"
149 win32_fileres=`file -L $1 2>/dev/null` 191 win32_fileres=`file -L $1 2>/dev/null`
150 case $win32_fileres in 192 case $win32_fileres in
151 *ar\ archive\ import\ library*) # definitely import 193 *ar\ archive\ import\ library*) # definitely import
152 win32_libid_type="x86 archive import" 194 win32_libid_type="x86 archive import"
153 ;; 195 ;;
154 *ar\ archive*) # could be an import, or static 196 *ar\ archive*) # could be an import, or static
155 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 197 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
156 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 198 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
157 win32_nmres=`eval $NM -f posix -A $1 | \ 199 win32_nmres=`eval $NM -f posix -A $1 | \
158 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` 200 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
159 if test "X$win32_nmres" = "Ximport" ; then 201 case $win32_nmres in
160 win32_libid_type="x86 archive import" 202 import*) win32_libid_type="x86 archive import";;
161 else 203 *) win32_libid_type="x86 archive static";;
162 win32_libid_type="x86 archive static" 204 esac
163 fi
164 fi 205 fi
165 ;; 206 ;;
166 *DLL*) 207 *DLL*)
167 win32_libid_type="x86 DLL" 208 win32_libid_type="x86 DLL"
168 ;; 209 ;;
182 # Infer tagged configuration to use if any are available and 223 # Infer tagged configuration to use if any are available and
183 # if one wasn't chosen via the "--tag" command line option. 224 # if one wasn't chosen via the "--tag" command line option.
184 # Only attempt this if the compiler in the base compile 225 # Only attempt this if the compiler in the base compile
185 # command doesn't match the default compiler. 226 # command doesn't match the default compiler.
186 # arg is usually of the form 'gcc ...' 227 # arg is usually of the form 'gcc ...'
187 func_infer_tag () { 228 func_infer_tag ()
229 {
188 if test -n "$available_tags" && test -z "$tagname"; then 230 if test -n "$available_tags" && test -z "$tagname"; then
189 CC_quoted= 231 CC_quoted=
190 for arg in $CC; do 232 for arg in $CC; do
191 case $arg in 233 case $arg in
192 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 234 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
241 esac 283 esac
242 fi 284 fi
243 } 285 }
244 286
245 287
288 # func_extract_an_archive dir oldlib
289 func_extract_an_archive ()
290 {
291 f_ex_an_ar_dir="$1"; shift
292 f_ex_an_ar_oldlib="$1"
293
294 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
295 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
296 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
297 :
298 else
299 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
300 exit $EXIT_FAILURE
301 fi
302 }
303
246 # func_extract_archives gentop oldlib ... 304 # func_extract_archives gentop oldlib ...
247 func_extract_archives () { 305 func_extract_archives ()
306 {
248 my_gentop="$1"; shift 307 my_gentop="$1"; shift
249 my_oldlibs=${1+"$@"} 308 my_oldlibs=${1+"$@"}
250 my_oldobjs="" 309 my_oldobjs=""
251 my_xlib="" 310 my_xlib=""
252 my_xabs="" 311 my_xabs=""
273 332
274 $show "${rm}r $my_xdir" 333 $show "${rm}r $my_xdir"
275 $run ${rm}r "$my_xdir" 334 $run ${rm}r "$my_xdir"
276 $show "$mkdir $my_xdir" 335 $show "$mkdir $my_xdir"
277 $run $mkdir "$my_xdir" 336 $run $mkdir "$my_xdir"
278 status=$? 337 exit_status=$?
279 if test "$status" -ne 0 && test ! -d "$my_xdir"; then 338 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
280 exit $status 339 exit $exit_status
281 fi 340 fi
282 case $host in 341 case $host in
283 *-darwin*) 342 *-darwin*)
284 $show "Extracting $my_xabs" 343 $show "Extracting $my_xabs"
285 # Do not bother doing anything if just a dry run 344 # Do not bother doing anything if just a dry run
286 if test -z "$run"; then 345 if test -z "$run"; then
287 darwin_orig_dir=`pwd` 346 darwin_orig_dir=`pwd`
288 cd $my_xdir || exit $? 347 cd $my_xdir || exit $?
289 darwin_archive=$my_xabs 348 darwin_archive=$my_xabs
290 darwin_curdir=`pwd` 349 darwin_curdir=`pwd`
291 darwin_base_archive=`basename $darwin_archive` 350 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
292 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 351 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
293 if test -n "$darwin_arches"; then 352 if test -n "$darwin_arches"; then
294 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 353 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
295 darwin_arch= 354 darwin_arch=
296 $show "$darwin_base_archive has multiple architectures $darwin_arches" 355 $show "$darwin_base_archive has multiple architectures $darwin_arches"
297 for darwin_arch in $darwin_arches ; do 356 for darwin_arch in $darwin_arches ; do
298 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 357 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
299 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 358 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
300 # Remove the table of contents from the thin files.
301 $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
302 $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
303 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 359 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
304 $AR -xo "${darwin_base_archive}" 360 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
305 rm "${darwin_base_archive}"
306 cd "$darwin_curdir" 361 cd "$darwin_curdir"
362 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
307 done # $darwin_arches 363 done # $darwin_arches
308 ## Okay now we have a bunch of thin objects, gotta fatten them up :) 364 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
309 darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` 365 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
310 darwin_file= 366 darwin_file=
311 darwin_files= 367 darwin_files=
312 for darwin_file in $darwin_filelist; do 368 for darwin_file in $darwin_filelist; do
313 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 369 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
314 lipo -create -output "$darwin_file" $darwin_files 370 lipo -create -output "$darwin_file" $darwin_files
315 done # $darwin_filelist 371 done # $darwin_filelist
316 rm -rf unfat-$$ 372 ${rm}r unfat-$$
317 cd "$darwin_orig_dir" 373 cd "$darwin_orig_dir"
318 else 374 else
319 cd $darwin_orig_dir 375 cd "$darwin_orig_dir"
320 (cd $my_xdir && $AR x $my_xabs) || exit $? 376 func_extract_an_archive "$my_xdir" "$my_xabs"
321 fi # $darwin_arches 377 fi # $darwin_arches
322 fi # $run 378 fi # $run
323 ;; 379 ;;
324 *) 380 *)
325 # We will extract separately just the conflicting names and we will 381 func_extract_an_archive "$my_xdir" "$my_xabs"
326 # no longer touch any unique names. It is faster to leave these 382 ;;
327 # extract automatically by $AR in one run.
328 $show "(cd $my_xdir && $AR x $my_xabs)"
329 $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
330 if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
331 :
332 else
333 $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
334 $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
335 $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
336 do
337 i=1
338 while test "$i" -le "$count"
339 do
340 # Put our $i before any first dot (extension)
341 # Never overwrite any file
342 name_to="$name"
343 while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
344 do
345 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
346 done
347 $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
348 $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
349 i=`expr $i + 1`
350 done
351 done
352 fi
353 ;;
354 esac 383 esac
355 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 384 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
356 done 385 done
357
358 func_extract_archives_result="$my_oldobjs" 386 func_extract_archives_result="$my_oldobjs"
359 } 387 }
360 # End of Shell function definitions 388 # End of Shell function definitions
361 ##################################### 389 #####################################
362 390
363 # Darwin sucks 391 # Darwin sucks
364 eval std_shrext=\"$shrext_cmds\" 392 eval std_shrext=\"$shrext_cmds\"
393
394 disable_libs=no
365 395
366 # Parse our command line options once, thoroughly. 396 # Parse our command line options once, thoroughly.
367 while test "$#" -gt 0 397 while test "$#" -gt 0
368 do 398 do
369 arg="$1" 399 arg="$1"
425 ;; 455 ;;
426 456
427 --version) 457 --version)
428 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 458 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
429 $echo 459 $echo
430 $echo "Copyright (C) 2003 Free Software Foundation, Inc." 460 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
431 $echo "This is free software; see the source for copying conditions. There is NO" 461 $echo "This is free software; see the source for copying conditions. There is NO"
432 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 462 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
433 exit $EXIT_SUCCESS 463 exit $?
434 ;; 464 ;;
435 465
436 --config) 466 --config)
437 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 467 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
438 # Now print the configurations for the tags. 468 # Now print the configurations for the tags.
439 for tagname in $taglist; do 469 for tagname in $taglist; do
440 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 470 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
441 done 471 done
442 exit $EXIT_SUCCESS 472 exit $?
443 ;; 473 ;;
444 474
445 --debug) 475 --debug)
446 $echo "$progname: enabling shell trace mode" 476 $echo "$progname: enabling shell trace mode"
447 set -x 477 set -x
462 if test "$build_old_libs" = yes; then 492 if test "$build_old_libs" = yes; then
463 $echo "enable static libraries" 493 $echo "enable static libraries"
464 else 494 else
465 $echo "disable static libraries" 495 $echo "disable static libraries"
466 fi 496 fi
467 exit $EXIT_SUCCESS 497 exit $?
468 ;; 498 ;;
469 499
470 --finish) mode="finish" ;; 500 --finish) mode="finish" ;;
471 501
472 --mode) prevopt="--mode" prev=mode ;; 502 --mode) prevopt="--mode" prev=mode ;;
477 --quiet | --silent) 507 --quiet | --silent)
478 show=: 508 show=:
479 preserve_args="$preserve_args $arg" 509 preserve_args="$preserve_args $arg"
480 ;; 510 ;;
481 511
482 --tag) prevopt="--tag" prev=tag ;; 512 --tag)
513 prevopt="--tag"
514 prev=tag
515 preserve_args="$preserve_args --tag"
516 ;;
483 --tag=*) 517 --tag=*)
484 set tag "$optarg" ${1+"$@"} 518 set tag "$optarg" ${1+"$@"}
485 shift 519 shift
486 prev=tag 520 prev=tag
487 preserve_args="$preserve_args --tag" 521 preserve_args="$preserve_args --tag"
509 $echo "$modename: option \`$prevopt' requires an argument" 1>&2 543 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
510 $echo "$help" 1>&2 544 $echo "$help" 1>&2
511 exit $EXIT_FAILURE 545 exit $EXIT_FAILURE
512 fi 546 fi
513 547
548 case $disable_libs in
549 no)
550 ;;
551 shared)
552 build_libtool_libs=no
553 build_old_libs=yes
554 ;;
555 static)
556 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
557 ;;
558 esac
559
514 # If this variable is set in any of the actions, the command in it 560 # If this variable is set in any of the actions, the command in it
515 # will be execed at the end. This prevents here-documents from being 561 # will be execed at the end. This prevents here-documents from being
516 # left over by shells. 562 # left over by shells.
517 exec_cmd= 563 exec_cmd=
518 564
519 if test -z "$show_help"; then 565 if test -z "$show_help"; then
520 566
521 # Infer the operation mode. 567 # Infer the operation mode.
522 if test -z "$mode"; then 568 if test -z "$mode"; then
523 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 569 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
524 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 570 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
525 case $nonopt in 571 case $nonopt in
526 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 572 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
527 mode=link 573 mode=link
528 for arg 574 for arg
529 do 575 do
585 libobj= 631 libobj=
586 later= 632 later=
587 633
588 for arg 634 for arg
589 do 635 do
590 case "$arg_mode" in 636 case $arg_mode in
591 arg ) 637 arg )
592 # do not "continue". Instead, add this to base_compile 638 # do not "continue". Instead, add this to base_compile
593 lastarg="$arg" 639 lastarg="$arg"
594 arg_mode=normal 640 arg_mode=normal
595 ;; 641 ;;
667 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 713 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
668 714
669 case $lastarg in 715 case $lastarg in
670 # Double-quote args containing other shell metacharacters. 716 # Double-quote args containing other shell metacharacters.
671 # Many Bourne shells cannot handle close brackets correctly 717 # Many Bourne shells cannot handle close brackets correctly
672 # in scan sets, so we specify it separately. 718 # in scan sets, and some SunOS ksh mistreat backslash-escaping
719 # in scan sets (worked around with variable expansion),
720 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
721 # at all, so we specify them separately.
673 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 722 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
674 lastarg="\"$lastarg\"" 723 lastarg="\"$lastarg\""
675 ;; 724 ;;
676 esac 725 esac
677 726
741 continue 790 continue
742 ;; 791 ;;
743 esac 792 esac
744 done 793 done
745 794
795 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
796 case $qlibobj in
797 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
798 qlibobj="\"$qlibobj\"" ;;
799 esac
800 test "X$libobj" != "X$qlibobj" \
801 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
802 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
746 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 803 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
747 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 804 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
748 if test "X$xdir" = "X$obj"; then 805 if test "X$xdir" = "X$obj"; then
749 xdir= 806 xdir=
750 else 807 else
813 compiler." 870 compiler."
814 871
815 $run $rm $removelist 872 $run $rm $removelist
816 exit $EXIT_FAILURE 873 exit $EXIT_FAILURE
817 fi 874 fi
818 $echo $srcfile > "$lockfile" 875 $echo "$srcfile" > "$lockfile"
819 fi 876 fi
820 877
821 if test -n "$fix_srcfile_path"; then 878 if test -n "$fix_srcfile_path"; then
822 eval srcfile=\"$fix_srcfile_path\" 879 eval srcfile=\"$fix_srcfile_path\"
823 fi 880 fi
881 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
882 case $qsrcfile in
883 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
884 qsrcfile="\"$qsrcfile\"" ;;
885 esac
824 886
825 $run $rm "$libobj" "${libobj}T" 887 $run $rm "$libobj" "${libobj}T"
826 888
827 # Create a libtool object file (analogous to a ".la" file), 889 # Create a libtool object file (analogous to a ".la" file),
828 # but don't create it if we're doing a dry run. 890 # but don't create it if we're doing a dry run.
840 if test "$build_libtool_libs" = yes; then 902 if test "$build_libtool_libs" = yes; then
841 # Without this assignment, base_compile gets emptied. 903 # Without this assignment, base_compile gets emptied.
842 fbsd_hideous_sh_bug=$base_compile 904 fbsd_hideous_sh_bug=$base_compile
843 905
844 if test "$pic_mode" != no; then 906 if test "$pic_mode" != no; then
845 command="$base_compile $srcfile $pic_flag" 907 command="$base_compile $qsrcfile $pic_flag"
846 else 908 else
847 # Don't build PIC code 909 # Don't build PIC code
848 command="$base_compile $srcfile" 910 command="$base_compile $qsrcfile"
849 fi 911 fi
850 912
851 if test ! -d "${xdir}$objdir"; then 913 if test ! -d "${xdir}$objdir"; then
852 $show "$mkdir ${xdir}$objdir" 914 $show "$mkdir ${xdir}$objdir"
853 $run $mkdir ${xdir}$objdir 915 $run $mkdir ${xdir}$objdir
854 status=$? 916 exit_status=$?
855 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then 917 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
856 exit $status 918 exit $exit_status
857 fi 919 fi
858 fi 920 fi
859 921
860 if test -z "$output_obj"; then 922 if test -z "$output_obj"; then
861 # Place PIC objects in $objdir 923 # Place PIC objects in $objdir
923 985
924 # Only build a position-dependent object if we build old libraries. 986 # Only build a position-dependent object if we build old libraries.
925 if test "$build_old_libs" = yes; then 987 if test "$build_old_libs" = yes; then
926 if test "$pic_mode" != yes; then 988 if test "$pic_mode" != yes; then
927 # Don't build PIC code 989 # Don't build PIC code
928 command="$base_compile $srcfile" 990 command="$base_compile $qsrcfile"
929 else 991 else
930 command="$base_compile $srcfile $pic_flag" 992 command="$base_compile $qsrcfile $pic_flag"
931 fi 993 fi
932 if test "$compiler_c_o" = yes; then 994 if test "$compiler_c_o" = yes; then
933 command="$command -o $obj" 995 command="$command -o $obj"
934 fi 996 fi
935 997
1054 ltlibs= 1116 ltlibs=
1055 module=no 1117 module=no
1056 no_install=no 1118 no_install=no
1057 objs= 1119 objs=
1058 non_pic_objects= 1120 non_pic_objects=
1121 notinst_path= # paths that contain not-installed libtool libraries
1059 precious_files_regex= 1122 precious_files_regex=
1060 prefer_static_libs=no 1123 prefer_static_libs=no
1061 preload=no 1124 preload=no
1062 prev= 1125 prev=
1063 prevarg= 1126 prevarg=
1082 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1145 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1083 fi 1146 fi
1084 if test -n "$link_static_flag"; then 1147 if test -n "$link_static_flag"; then
1085 dlopen_self=$dlopen_self_static 1148 dlopen_self=$dlopen_self_static
1086 fi 1149 fi
1150 prefer_static_libs=yes
1087 else 1151 else
1088 if test -z "$pic_flag" && test -n "$link_static_flag"; then 1152 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1089 dlopen_self=$dlopen_self_static 1153 dlopen_self=$dlopen_self_static
1090 fi 1154 fi
1155 prefer_static_libs=built
1091 fi 1156 fi
1092 build_libtool_libs=no 1157 build_libtool_libs=no
1093 build_old_libs=yes 1158 build_old_libs=yes
1094 prefer_static_libs=yes
1095 break 1159 break
1096 ;; 1160 ;;
1097 esac 1161 esac
1098 done 1162 done
1099 1163
1264 # A standard non-PIC object 1328 # A standard non-PIC object
1265 non_pic_objects="$non_pic_objects $non_pic_object" 1329 non_pic_objects="$non_pic_objects $non_pic_object"
1266 if test -z "$pic_object" || test "$pic_object" = none ; then 1330 if test -z "$pic_object" || test "$pic_object" = none ; then
1267 arg="$non_pic_object" 1331 arg="$non_pic_object"
1268 fi 1332 fi
1333 else
1334 # If the PIC object exists, use it instead.
1335 # $xdir was prepended to $pic_object above.
1336 non_pic_object="$pic_object"
1337 non_pic_objects="$non_pic_objects $non_pic_object"
1269 fi 1338 fi
1270 else 1339 else
1271 # Only an error if not doing a dry-run. 1340 # Only an error if not doing a dry-run.
1272 if test -z "$run"; then 1341 if test -z "$run"; then
1273 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1342 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1360 shrext) 1429 shrext)
1361 shrext_cmds="$arg" 1430 shrext_cmds="$arg"
1362 prev= 1431 prev=
1363 continue 1432 continue
1364 ;; 1433 ;;
1434 darwin_framework|darwin_framework_skip)
1435 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1436 compile_command="$compile_command $arg"
1437 finalize_command="$finalize_command $arg"
1438 prev=
1439 continue
1440 ;;
1365 *) 1441 *)
1366 eval "$prev=\"\$arg\"" 1442 eval "$prev=\"\$arg\""
1367 prev= 1443 prev=
1368 continue 1444 continue
1369 ;; 1445 ;;
1415 if test "X$arg" = "X-export-symbols"; then 1491 if test "X$arg" = "X-export-symbols"; then
1416 prev=expsyms 1492 prev=expsyms
1417 else 1493 else
1418 prev=expsyms_regex 1494 prev=expsyms_regex
1419 fi 1495 fi
1496 continue
1497 ;;
1498
1499 -framework|-arch|-isysroot)
1500 case " $CC " in
1501 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1502 prev=darwin_framework_skip ;;
1503 *) compiler_flags="$compiler_flags $arg"
1504 prev=darwin_framework ;;
1505 esac
1506 compile_command="$compile_command $arg"
1507 finalize_command="$finalize_command $arg"
1420 continue 1508 continue
1421 ;; 1509 ;;
1422 1510
1423 -inst-prefix-dir) 1511 -inst-prefix-dir)
1424 prev=inst_prefix 1512 prev=inst_prefix
1444 [\\/]* | [A-Za-z]:[\\/]*) ;; 1532 [\\/]* | [A-Za-z]:[\\/]*) ;;
1445 *) 1533 *)
1446 absdir=`cd "$dir" && pwd` 1534 absdir=`cd "$dir" && pwd`
1447 if test -z "$absdir"; then 1535 if test -z "$absdir"; then
1448 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1536 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1449 exit $EXIT_FAILURE 1537 absdir="$dir"
1538 notinst_path="$notinst_path $dir"
1450 fi 1539 fi
1451 dir="$absdir" 1540 dir="$absdir"
1452 ;; 1541 ;;
1453 esac 1542 esac
1454 case "$deplibs " in 1543 case "$deplibs " in
1458 lib_search_path="$lib_search_path $dir" 1547 lib_search_path="$lib_search_path $dir"
1459 ;; 1548 ;;
1460 esac 1549 esac
1461 case $host in 1550 case $host in
1462 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1551 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1552 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1463 case :$dllsearchpath: in 1553 case :$dllsearchpath: in
1464 *":$dir:"*) ;; 1554 *":$dir:"*) ;;
1465 *) dllsearchpath="$dllsearchpath:$dir";; 1555 *) dllsearchpath="$dllsearchpath:$dir";;
1466 esac 1556 esac
1557 case :$dllsearchpath: in
1558 *":$testbindir:"*) ;;
1559 *) dllsearchpath="$dllsearchpath:$testbindir";;
1560 esac
1467 ;; 1561 ;;
1468 esac 1562 esac
1469 continue 1563 continue
1470 ;; 1564 ;;
1471 1565
1472 -l*) 1566 -l*)
1473 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1567 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1474 case $host in 1568 case $host in
1475 *-*-cygwin* | *-*-pw32* | *-*-beos*) 1569 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1476 # These systems don't actually have a C or math library (as such) 1570 # These systems don't actually have a C or math library (as such)
1477 continue 1571 continue
1478 ;; 1572 ;;
1479 *-*-mingw* | *-*-os2*) 1573 *-*-os2*)
1480 # These systems don't actually have a C library (as such) 1574 # These systems don't actually have a C library (as such)
1481 test "X$arg" = "X-lc" && continue 1575 test "X$arg" = "X-lc" && continue
1482 ;; 1576 ;;
1483 *-*-openbsd* | *-*-freebsd*) 1577 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1484 # Do not include libc due to us having libc/libc_r. 1578 # Do not include libc due to us having libc/libc_r.
1485 test "X$arg" = "X-lc" && continue 1579 test "X$arg" = "X-lc" && continue
1486 ;; 1580 ;;
1487 *-*-rhapsody* | *-*-darwin1.[012]) 1581 *-*-rhapsody* | *-*-darwin1.[012])
1488 # Rhapsody C and math libraries are in the System framework 1582 # Rhapsody C and math libraries are in the System framework
1489 deplibs="$deplibs -framework System" 1583 deplibs="$deplibs -framework System"
1490 continue 1584 continue
1585 ;;
1586 *-*-sco3.2v5* | *-*-sco5v6*)
1587 # Causes problems with __ctype
1588 test "X$arg" = "X-lc" && continue
1589 ;;
1590 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1591 # Compiler inserts libc in the correct place for threads to work
1592 test "X$arg" = "X-lc" && continue
1593 ;;
1491 esac 1594 esac
1492 elif test "X$arg" = "X-lc_r"; then 1595 elif test "X$arg" = "X-lc_r"; then
1493 case $host in 1596 case $host in
1494 *-*-openbsd* | *-*-freebsd*) 1597 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1495 # Do not include libc_r directly, use -pthread flag. 1598 # Do not include libc_r directly, use -pthread flag.
1496 continue 1599 continue
1497 ;; 1600 ;;
1498 esac 1601 esac
1499 fi 1602 fi
1500 deplibs="$deplibs $arg" 1603 deplibs="$deplibs $arg"
1501 continue 1604 continue
1502 ;; 1605 ;;
1503 1606
1607 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1608 # classes, name mangling, and exception handling.
1609 -model)
1610 compile_command="$compile_command $arg"
1611 compiler_flags="$compiler_flags $arg"
1612 finalize_command="$finalize_command $arg"
1613 prev=xcompiler
1614 continue
1615 ;;
1616
1504 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1617 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1505 deplibs="$deplibs $arg" 1618 compiler_flags="$compiler_flags $arg"
1619 compile_command="$compile_command $arg"
1620 finalize_command="$finalize_command $arg"
1506 continue 1621 continue
1507 ;; 1622 ;;
1508 1623
1509 -module) 1624 -module)
1510 module=yes 1625 module=yes
1511 continue 1626 continue
1512 ;; 1627 ;;
1513 1628
1514 # gcc -m* arguments should be passed to the linker via $compiler_flags 1629 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1515 # in order to pass architecture information to the linker 1630 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1516 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo 1631 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1517 # but this is not reliable with gcc because gcc may use -mfoo to 1632 # +DA*, +DD* enable 64-bit mode on the HP compiler
1518 # select a different linker, different libraries, etc, while 1633 # -q* pass through compiler args for the IBM compiler
1519 # -Wl,-mfoo simply passes -mfoo to the linker. 1634 # -m* pass through architecture-specific compiler args for GCC
1520 -m*) 1635 # -m*, -t[45]*, -txscale* pass through architecture-specific
1636 # compiler args for GCC
1637 # -pg pass through profiling flag for GCC
1638 # @file GCC response files
1639 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1640 -t[45]*|-txscale*|@*)
1641
1521 # Unknown arguments in both finalize_command and compile_command need 1642 # Unknown arguments in both finalize_command and compile_command need
1522 # to be aesthetically quoted because they are evaled later. 1643 # to be aesthetically quoted because they are evaled later.
1523 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1644 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1524 case $arg in 1645 case $arg in
1525 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1646 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1526 arg="\"$arg\"" 1647 arg="\"$arg\""
1527 ;; 1648 ;;
1528 esac 1649 esac
1529 compile_command="$compile_command $arg" 1650 compile_command="$compile_command $arg"
1530 finalize_command="$finalize_command $arg" 1651 finalize_command="$finalize_command $arg"
1531 if test "$with_gcc" = "yes" ; then 1652 compiler_flags="$compiler_flags $arg"
1532 compiler_flags="$compiler_flags $arg"
1533 fi
1534 continue 1653 continue
1535 ;; 1654 ;;
1536 1655
1537 -shrext) 1656 -shrext)
1538 prev=shrext 1657 prev=shrext
1771 # A standard non-PIC object 1890 # A standard non-PIC object
1772 non_pic_objects="$non_pic_objects $non_pic_object" 1891 non_pic_objects="$non_pic_objects $non_pic_object"
1773 if test -z "$pic_object" || test "$pic_object" = none ; then 1892 if test -z "$pic_object" || test "$pic_object" = none ; then
1774 arg="$non_pic_object" 1893 arg="$non_pic_object"
1775 fi 1894 fi
1895 else
1896 # If the PIC object exists, use it instead.
1897 # $xdir was prepended to $pic_object above.
1898 non_pic_object="$pic_object"
1899 non_pic_objects="$non_pic_objects $non_pic_object"
1776 fi 1900 fi
1777 else 1901 else
1778 # Only an error if not doing a dry-run. 1902 # Only an error if not doing a dry-run.
1779 if test -z "$run"; then 1903 if test -z "$run"; then
1780 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1904 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1876 fi 2000 fi
1877 # Create the object directory. 2001 # Create the object directory.
1878 if test ! -d "$output_objdir"; then 2002 if test ! -d "$output_objdir"; then
1879 $show "$mkdir $output_objdir" 2003 $show "$mkdir $output_objdir"
1880 $run $mkdir $output_objdir 2004 $run $mkdir $output_objdir
1881 status=$? 2005 exit_status=$?
1882 if test "$status" -ne 0 && test ! -d "$output_objdir"; then 2006 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1883 exit $status 2007 exit $exit_status
1884 fi 2008 fi
1885 fi 2009 fi
1886 2010
1887 # Determine the type of output 2011 # Determine the type of output
1888 case $output in 2012 case $output in
1941 deplibs= 2065 deplibs=
1942 newdependency_libs= 2066 newdependency_libs=
1943 newlib_search_path= 2067 newlib_search_path=
1944 need_relink=no # whether we're linking any uninstalled libtool libraries 2068 need_relink=no # whether we're linking any uninstalled libtool libraries
1945 notinst_deplibs= # not-installed libtool libraries 2069 notinst_deplibs= # not-installed libtool libraries
1946 notinst_path= # paths that contain not-installed libtool libraries
1947 case $linkmode in 2070 case $linkmode in
1948 lib) 2071 lib)
1949 passes="conv link" 2072 passes="conv link"
1950 for file in $dlfiles $dlprefiles; do 2073 for file in $dlfiles $dlprefiles; do
1951 case $file in 2074 case $file in
1993 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 2116 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1994 if test "$linkmode,$pass" = "prog,link"; then 2117 if test "$linkmode,$pass" = "prog,link"; then
1995 compile_deplibs="$deplib $compile_deplibs" 2118 compile_deplibs="$deplib $compile_deplibs"
1996 finalize_deplibs="$deplib $finalize_deplibs" 2119 finalize_deplibs="$deplib $finalize_deplibs"
1997 else 2120 else
1998 deplibs="$deplib $deplibs" 2121 compiler_flags="$compiler_flags $deplib"
1999 fi 2122 fi
2000 continue 2123 continue
2001 ;; 2124 ;;
2002 -l*) 2125 -l*)
2003 if test "$linkmode" != lib && test "$linkmode" != prog; then 2126 if test "$linkmode" != lib && test "$linkmode" != prog; then
2004 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2127 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2005 continue
2006 fi
2007 if test "$pass" = conv; then
2008 deplibs="$deplib $deplibs"
2009 continue 2128 continue
2010 fi 2129 fi
2011 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2130 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2012 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 2131 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2013 for search_ext in .la $std_shrext .so .a; do 2132 for search_ext in .la $std_shrext .so .a; do
2193 continue 2312 continue
2194 ;; 2313 ;;
2195 esac # case $deplib 2314 esac # case $deplib
2196 if test "$found" = yes || test -f "$lib"; then : 2315 if test "$found" = yes || test -f "$lib"; then :
2197 else 2316 else
2198 $echo "$modename: cannot find the library \`$lib'" 1>&2 2317 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2199 exit $EXIT_FAILURE 2318 exit $EXIT_FAILURE
2200 fi 2319 fi
2201 2320
2202 # Check to see that this really is a libtool archive. 2321 # Check to see that this really is a libtool archive.
2203 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2322 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2217 old_library= 2336 old_library=
2218 # If the library was installed with an old release of libtool, 2337 # If the library was installed with an old release of libtool,
2219 # it will not redefine variables installed, or shouldnotlink 2338 # it will not redefine variables installed, or shouldnotlink
2220 installed=yes 2339 installed=yes
2221 shouldnotlink=no 2340 shouldnotlink=no
2341 avoidtemprpath=
2342
2222 2343
2223 # Read the .la file 2344 # Read the .la file
2224 case $lib in 2345 case $lib in
2225 */* | *\\*) . $lib ;; 2346 */* | *\\*) . $lib ;;
2226 *) . ./$lib ;; 2347 *) . ./$lib ;;
2322 libdir="$abs_ladir" 2443 libdir="$abs_ladir"
2323 else 2444 else
2324 dir="$libdir" 2445 dir="$libdir"
2325 absdir="$libdir" 2446 absdir="$libdir"
2326 fi 2447 fi
2448 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2327 else 2449 else
2328 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2450 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2329 dir="$ladir" 2451 dir="$ladir"
2330 absdir="$abs_ladir" 2452 absdir="$abs_ladir"
2331 # Remove this search path later 2453 # Remove this search path later
2406 2528
2407 if test "$linkmode,$pass" = "prog,link"; then 2529 if test "$linkmode,$pass" = "prog,link"; then
2408 if test -n "$library_names" && 2530 if test -n "$library_names" &&
2409 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2531 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2410 # We need to hardcode the library path 2532 # We need to hardcode the library path
2411 if test -n "$shlibpath_var"; then 2533 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2412 # Make sure the rpath contains only unique directories. 2534 # Make sure the rpath contains only unique directories.
2413 case "$temp_rpath " in 2535 case "$temp_rpath " in
2414 *" $dir "*) ;; 2536 *" $dir "*) ;;
2415 *" $absdir "*) ;; 2537 *" $absdir "*) ;;
2416 *) temp_rpath="$temp_rpath $dir" ;; 2538 *) temp_rpath="$temp_rpath $absdir" ;;
2417 esac 2539 esac
2418 fi 2540 fi
2419 2541
2420 # Hardcode the library path. 2542 # Hardcode the library path.
2421 # Skip directories that are in the system default run-time 2543 # Skip directories that are in the system default run-time
2448 continue 2570 continue
2449 fi 2571 fi
2450 fi 2572 fi
2451 2573
2452 link_static=no # Whether the deplib will be linked statically 2574 link_static=no # Whether the deplib will be linked statically
2575 use_static_libs=$prefer_static_libs
2576 if test "$use_static_libs" = built && test "$installed" = yes ; then
2577 use_static_libs=no
2578 fi
2453 if test -n "$library_names" && 2579 if test -n "$library_names" &&
2454 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then 2580 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2455 if test "$installed" = no; then 2581 if test "$installed" = no; then
2456 notinst_deplibs="$notinst_deplibs $lib" 2582 notinst_deplibs="$notinst_deplibs $lib"
2457 need_relink=yes 2583 need_relink=yes
2458 fi 2584 fi
2459 # This is a shared library 2585 # This is a shared library
2562 case $hardcode_action in 2688 case $hardcode_action in
2563 immediate | unsupported) 2689 immediate | unsupported)
2564 if test "$hardcode_direct" = no; then 2690 if test "$hardcode_direct" = no; then
2565 add="$dir/$linklib" 2691 add="$dir/$linklib"
2566 case $host in 2692 case $host in
2567 *-*-sco3.2v5* ) add_dir="-L$dir" ;; 2693 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2694 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2695 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2696 *-*-unixware7*) add_dir="-L$dir" ;;
2568 *-*-darwin* ) 2697 *-*-darwin* )
2569 # if the lib is a module then we can not link against 2698 # if the lib is a module then we can not link against
2570 # it, someone is ignoring the new warnings I added 2699 # it, someone is ignoring the new warnings I added
2571 if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then 2700 if /usr/bin/file -L $add 2> /dev/null |
2701 $EGREP ": [^:]* bundle" >/dev/null ; then
2572 $echo "** Warning, lib $linklib is a module, not a shared library" 2702 $echo "** Warning, lib $linklib is a module, not a shared library"
2573 if test -z "$old_library" ; then 2703 if test -z "$old_library" ; then
2574 $echo 2704 $echo
2575 $echo "** And there doesn't seem to be a static archive available" 2705 $echo "** And there doesn't seem to be a static archive available"
2576 $echo "** The link will probably fail, sorry" 2706 $echo "** The link will probably fail, sorry"
2597 add="$dir/$linklib" 2727 add="$dir/$linklib"
2598 elif test "$hardcode_minus_L" = yes; then 2728 elif test "$hardcode_minus_L" = yes; then
2599 add_dir="-L$dir" 2729 add_dir="-L$dir"
2600 # Try looking first in the location we're being installed to. 2730 # Try looking first in the location we're being installed to.
2601 if test -n "$inst_prefix_dir"; then 2731 if test -n "$inst_prefix_dir"; then
2602 case "$libdir" in 2732 case $libdir in
2603 [\\/]*) 2733 [\\/]*)
2604 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2734 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2605 ;; 2735 ;;
2606 esac 2736 esac
2607 fi 2737 fi
2670 else 2800 else
2671 # We cannot seem to hardcode it, guess we'll fake it. 2801 # We cannot seem to hardcode it, guess we'll fake it.
2672 add_dir="-L$libdir" 2802 add_dir="-L$libdir"
2673 # Try looking first in the location we're being installed to. 2803 # Try looking first in the location we're being installed to.
2674 if test -n "$inst_prefix_dir"; then 2804 if test -n "$inst_prefix_dir"; then
2675 case "$libdir" in 2805 case $libdir in
2676 [\\/]*) 2806 [\\/]*)
2677 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2807 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2678 ;; 2808 ;;
2679 esac 2809 esac
2680 fi 2810 fi
2731 else 2861 else
2732 build_libtool_libs=no 2862 build_libtool_libs=no
2733 fi 2863 fi
2734 fi 2864 fi
2735 else 2865 else
2736 convenience="$convenience $dir/$old_library"
2737 old_convenience="$old_convenience $dir/$old_library"
2738 deplibs="$dir/$old_library $deplibs" 2866 deplibs="$dir/$old_library $deplibs"
2739 link_static=yes 2867 link_static=yes
2740 fi 2868 fi
2741 fi # link shared/static library? 2869 fi # link shared/static library?
2742 2870
2857 esac 2985 esac
2858 ;; 2986 ;;
2859 *) continue ;; 2987 *) continue ;;
2860 esac 2988 esac
2861 case " $deplibs " in 2989 case " $deplibs " in
2990 *" $path "*) ;;
2991 *) deplibs="$path $deplibs" ;;
2992 esac
2993 case " $deplibs " in
2862 *" $depdepl "*) ;; 2994 *" $depdepl "*) ;;
2863 *) deplibs="$depdepl $deplibs" ;; 2995 *) deplibs="$depdepl $deplibs" ;;
2864 esac
2865 case " $deplibs " in
2866 *" $path "*) ;;
2867 *) deplibs="$deplibs $path" ;;
2868 esac 2996 esac
2869 done 2997 done
2870 fi # link_all_deplibs != no 2998 fi # link_all_deplibs != no
2871 fi # linkmode = lib 2999 fi # linkmode = lib
2872 done # for deplib in $libs 3000 done # for deplib in $libs
3127 ;; 3255 ;;
3128 esac 3256 esac
3129 3257
3130 # Check that each of the things are valid numbers. 3258 # Check that each of the things are valid numbers.
3131 case $current in 3259 case $current in
3132 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 3260 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]) ;;
3133 *) 3261 *)
3134 $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 3262 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3135 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3263 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3136 exit $EXIT_FAILURE 3264 exit $EXIT_FAILURE
3137 ;; 3265 ;;
3138 esac 3266 esac
3139 3267
3140 case $revision in 3268 case $revision in
3141 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 3269 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]) ;;
3142 *) 3270 *)
3143 $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 3271 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3144 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3272 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3145 exit $EXIT_FAILURE 3273 exit $EXIT_FAILURE
3146 ;; 3274 ;;
3147 esac 3275 esac
3148 3276
3149 case $age in 3277 case $age in
3150 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; 3278 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]) ;;
3151 *) 3279 *)
3152 $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 3280 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3153 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3281 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3154 exit $EXIT_FAILURE 3282 exit $EXIT_FAILURE
3155 ;; 3283 ;;
3156 esac 3284 esac
3157 3285
3326 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3454 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3327 fi 3455 fi
3328 3456
3329 # Eliminate all temporary directories. 3457 # Eliminate all temporary directories.
3330 for path in $notinst_path; do 3458 for path in $notinst_path; do
3331 lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` 3459 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3332 deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` 3460 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3333 dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` 3461 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3334 done 3462 done
3335 3463
3336 if test -n "$xrpath"; then 3464 if test -n "$xrpath"; then
3337 # If the user specified any rpath flags, then add them. 3465 # If the user specified any rpath flags, then add them.
3338 temp_xrpath= 3466 temp_xrpath=
3379 deplibs="$deplibs -framework System" 3507 deplibs="$deplibs -framework System"
3380 ;; 3508 ;;
3381 *-*-netbsd*) 3509 *-*-netbsd*)
3382 # Don't link with libc until the a.out ld.so is fixed. 3510 # Don't link with libc until the a.out ld.so is fixed.
3383 ;; 3511 ;;
3384 *-*-openbsd* | *-*-freebsd*) 3512 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3385 # Do not include libc due to us having libc/libc_r. 3513 # Do not include libc due to us having libc/libc_r.
3386 test "X$arg" = "X-lc" && continue 3514 ;;
3515 *-*-sco3.2v5* | *-*-sco5v6*)
3516 # Causes problems with __ctype
3517 ;;
3518 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3519 # Compiler inserts libc in the correct place for threads to work
3387 ;; 3520 ;;
3388 *) 3521 *)
3389 # Add libc to deplibs on all other systems if necessary. 3522 # Add libc to deplibs on all other systems if necessary.
3390 if test "$build_libtool_need_lc" = "yes"; then 3523 if test "$build_libtool_need_lc" = "yes"; then
3391 deplibs="$deplibs -lc" 3524 deplibs="$deplibs -lc"
3425 $rm conftest.c 3558 $rm conftest.c
3426 cat > conftest.c <<EOF 3559 cat > conftest.c <<EOF
3427 int main() { return 0; } 3560 int main() { return 0; }
3428 EOF 3561 EOF
3429 $rm conftest 3562 $rm conftest
3430 $LTCC -o conftest conftest.c $deplibs 3563 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3431 if test "$?" -eq 0 ; then 3564 if test "$?" -eq 0 ; then
3432 ldd_output=`ldd conftest` 3565 ldd_output=`ldd conftest`
3433 for i in $deplibs; do 3566 for i in $deplibs; do
3434 name="`expr $i : '-l\(.*\)'`" 3567 name=`expr $i : '-l\(.*\)'`
3435 # If $name is empty we are operating on a -L argument. 3568 # If $name is empty we are operating on a -L argument.
3436 if test "$name" != "" && test "$name" -ne "0"; then 3569 if test "$name" != "" && test "$name" -ne "0"; then
3437 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3570 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3438 case " $predeps $postdeps " in 3571 case " $predeps $postdeps " in
3439 *" $i "*) 3572 *" $i "*)
3466 done 3599 done
3467 else 3600 else
3468 # Error occurred in the first compile. Let's try to salvage 3601 # Error occurred in the first compile. Let's try to salvage
3469 # the situation: Compile a separate program for each library. 3602 # the situation: Compile a separate program for each library.
3470 for i in $deplibs; do 3603 for i in $deplibs; do
3471 name="`expr $i : '-l\(.*\)'`" 3604 name=`expr $i : '-l\(.*\)'`
3472 # If $name is empty we are operating on a -L argument. 3605 # If $name is empty we are operating on a -L argument.
3473 if test "$name" != "" && test "$name" != "0"; then 3606 if test "$name" != "" && test "$name" != "0"; then
3474 $rm conftest 3607 $rm conftest
3475 $LTCC -o conftest conftest.c $i 3608 $LTCC $LTCFLAGS -o conftest conftest.c $i
3476 # Did it work? 3609 # Did it work?
3477 if test "$?" -eq 0 ; then 3610 if test "$?" -eq 0 ; then
3478 ldd_output=`ldd conftest` 3611 ldd_output=`ldd conftest`
3479 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3612 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3480 case " $predeps $postdeps " in 3613 case " $predeps $postdeps " in
3518 ;; 3651 ;;
3519 file_magic*) 3652 file_magic*)
3520 set dummy $deplibs_check_method 3653 set dummy $deplibs_check_method
3521 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3654 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3522 for a_deplib in $deplibs; do 3655 for a_deplib in $deplibs; do
3523 name="`expr $a_deplib : '-l\(.*\)'`" 3656 name=`expr $a_deplib : '-l\(.*\)'`
3524 # If $name is empty we are operating on a -L argument. 3657 # If $name is empty we are operating on a -L argument.
3525 if test "$name" != "" && test "$name" != "0"; then 3658 if test "$name" != "" && test "$name" != "0"; then
3526 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3659 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3527 case " $predeps $postdeps " in 3660 case " $predeps $postdeps " in
3528 *" $a_deplib "*) 3661 *" $a_deplib "*)
3587 ;; 3720 ;;
3588 match_pattern*) 3721 match_pattern*)
3589 set dummy $deplibs_check_method 3722 set dummy $deplibs_check_method
3590 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3723 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3591 for a_deplib in $deplibs; do 3724 for a_deplib in $deplibs; do
3592 name="`expr $a_deplib : '-l\(.*\)'`" 3725 name=`expr $a_deplib : '-l\(.*\)'`
3593 # If $name is empty we are operating on a -L argument. 3726 # If $name is empty we are operating on a -L argument.
3594 if test -n "$name" && test "$name" != "0"; then 3727 if test -n "$name" && test "$name" != "0"; then
3595 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3728 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3596 case " $predeps $postdeps " in 3729 case " $predeps $postdeps " in
3597 *" $a_deplib "*) 3730 *" $a_deplib "*)
3724 esac 3857 esac
3725 # Done checking deplibs! 3858 # Done checking deplibs!
3726 deplibs=$newdeplibs 3859 deplibs=$newdeplibs
3727 fi 3860 fi
3728 3861
3862
3863 # move library search paths that coincide with paths to not yet
3864 # installed libraries to the beginning of the library search list
3865 new_libs=
3866 for path in $notinst_path; do
3867 case " $new_libs " in
3868 *" -L$path/$objdir "*) ;;
3869 *)
3870 case " $deplibs " in
3871 *" -L$path/$objdir "*)
3872 new_libs="$new_libs -L$path/$objdir" ;;
3873 esac
3874 ;;
3875 esac
3876 done
3877 for deplib in $deplibs; do
3878 case $deplib in
3879 -L*)
3880 case " $new_libs " in
3881 *" $deplib "*) ;;
3882 *) new_libs="$new_libs $deplib" ;;
3883 esac
3884 ;;
3885 *) new_libs="$new_libs $deplib" ;;
3886 esac
3887 done
3888 deplibs="$new_libs"
3889
3890
3729 # All the library-specific variables (install_libdir is set above). 3891 # All the library-specific variables (install_libdir is set above).
3730 library_names= 3892 library_names=
3731 old_library= 3893 old_library=
3732 dlname= 3894 dlname=
3733 3895
3807 if test -z "$dlname"; then 3969 if test -z "$dlname"; then
3808 dlname=$soname 3970 dlname=$soname
3809 fi 3971 fi
3810 3972
3811 lib="$output_objdir/$realname" 3973 lib="$output_objdir/$realname"
3974 linknames=
3812 for link 3975 for link
3813 do 3976 do
3814 linknames="$linknames $link" 3977 linknames="$linknames $link"
3815 done 3978 done
3816 3979
3835 skipped_export=false 3998 skipped_export=false
3836 else 3999 else
3837 # The command line is too long to execute in one step. 4000 # The command line is too long to execute in one step.
3838 $show "using reloadable object file for export list..." 4001 $show "using reloadable object file for export list..."
3839 skipped_export=: 4002 skipped_export=:
4003 # Break out early, otherwise skipped_export may be
4004 # set to false by a later but shorter cmd.
4005 break
3840 fi 4006 fi
3841 done 4007 done
3842 IFS="$save_ifs" 4008 IFS="$save_ifs"
3843 if test -n "$export_symbols_regex"; then 4009 if test -n "$export_symbols_regex"; then
3844 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4010 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3904 eval test_cmds=\"$archive_cmds\" 4070 eval test_cmds=\"$archive_cmds\"
3905 cmds=$archive_cmds 4071 cmds=$archive_cmds
3906 fi 4072 fi
3907 fi 4073 fi
3908 4074
3909 if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && 4075 if test "X$skipped_export" != "X:" &&
4076 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3910 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4077 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3911 : 4078 :
3912 else 4079 else
3913 # The command line is too long to link in one step, link piecewise. 4080 # The command line is too long to link in one step, link piecewise.
3914 $echo "creating reloadable object files..." 4081 $echo "creating reloadable object files..."
3923 # the spec. 4090 # the spec.
3924 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4091 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3925 save_libobjs=$libobjs 4092 save_libobjs=$libobjs
3926 fi 4093 fi
3927 save_output=$output 4094 save_output=$output
4095 output_la=`$echo "X$output" | $Xsed -e "$basename"`
3928 4096
3929 # Clear the reloadable object creation command queue and 4097 # Clear the reloadable object creation command queue and
3930 # initialize k to one. 4098 # initialize k to one.
3931 test_cmds= 4099 test_cmds=
3932 concat_cmds= 4100 concat_cmds=
3933 objlist= 4101 objlist=
3934 delfiles= 4102 delfiles=
3935 last_robj= 4103 last_robj=
3936 k=1 4104 k=1
3937 output=$output_objdir/$save_output-${k}.$objext 4105 output=$output_objdir/$output_la-${k}.$objext
3938 # Loop over the list of objects to be linked. 4106 # Loop over the list of objects to be linked.
3939 for obj in $save_libobjs 4107 for obj in $save_libobjs
3940 do 4108 do
3941 eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4109 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3942 if test "X$objlist" = X || 4110 if test "X$objlist" = X ||
3943 { len=`expr "X$test_cmds" : ".*"` && 4111 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
3944 test "$len" -le "$max_cmd_len"; }; then 4112 test "$len" -le "$max_cmd_len"; }; then
3945 objlist="$objlist $obj" 4113 objlist="$objlist $obj"
3946 else 4114 else
3947 # The command $test_cmds is almost too long, add a 4115 # The command $test_cmds is almost too long, add a
3948 # command to the queue. 4116 # command to the queue.
3952 else 4120 else
3953 # All subsequent reloadable object files will link in 4121 # All subsequent reloadable object files will link in
3954 # the last one created. 4122 # the last one created.
3955 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4123 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3956 fi 4124 fi
3957 last_robj=$output_objdir/$save_output-${k}.$objext 4125 last_robj=$output_objdir/$output_la-${k}.$objext
3958 k=`expr $k + 1` 4126 k=`expr $k + 1`
3959 output=$output_objdir/$save_output-${k}.$objext 4127 output=$output_objdir/$output_la-${k}.$objext
3960 objlist=$obj 4128 objlist=$obj
3961 len=1 4129 len=1
3962 fi 4130 fi
3963 done 4131 done
3964 # Handle the remaining objects by creating one last 4132 # Handle the remaining objects by creating one last
3974 libobjs=$output 4142 libobjs=$output
3975 # Append the command to create the export file. 4143 # Append the command to create the export file.
3976 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4144 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3977 fi 4145 fi
3978 4146
3979 # Set up a command to remove the reloadale object files 4147 # Set up a command to remove the reloadable object files
3980 # after they are used. 4148 # after they are used.
3981 i=0 4149 i=0
3982 while test "$i" -lt "$k" 4150 while test "$i" -lt "$k"
3983 do 4151 do
3984 i=`expr $i + 1` 4152 i=`expr $i + 1`
3985 delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" 4153 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
3986 done 4154 done
3987 4155
3988 $echo "creating a temporary reloadable object file: $output" 4156 $echo "creating a temporary reloadable object file: $output"
3989 4157
3990 # Loop through the commands generated above and execute them. 4158 # Loop through the commands generated above and execute them.
4028 save_ifs="$IFS"; IFS='~' 4196 save_ifs="$IFS"; IFS='~'
4029 for cmd in $cmds; do 4197 for cmd in $cmds; do
4030 IFS="$save_ifs" 4198 IFS="$save_ifs"
4031 eval cmd=\"$cmd\" 4199 eval cmd=\"$cmd\"
4032 $show "$cmd" 4200 $show "$cmd"
4033 $run eval "$cmd" || exit $? 4201 $run eval "$cmd" || {
4202 lt_exit=$?
4203
4204 # Restore the uninstalled library and exit
4205 if test "$mode" = relink; then
4206 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4207 fi
4208
4209 exit $lt_exit
4210 }
4034 done 4211 done
4035 IFS="$save_ifs" 4212 IFS="$save_ifs"
4036 4213
4037 # Restore the uninstalled library and exit 4214 # Restore the uninstalled library and exit
4038 if test "$mode" = relink; then 4215 if test "$mode" = relink; then
4039 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4216 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4217
4218 if test -n "$convenience"; then
4219 if test -z "$whole_archive_flag_spec"; then
4220 $show "${rm}r $gentop"
4221 $run ${rm}r "$gentop"
4222 fi
4223 fi
4224
4040 exit $EXIT_SUCCESS 4225 exit $EXIT_SUCCESS
4041 fi 4226 fi
4042 4227
4043 # Create links to the real library. 4228 # Create links to the real library.
4044 for linkname in $linknames; do 4229 for linkname in $linknames; do
4218 # Time to change all our "foo.framework" stuff back to "-framework foo" 4403 # Time to change all our "foo.framework" stuff back to "-framework foo"
4219 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` 4404 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
4220 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'` 4405 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
4221 ;; 4406 ;;
4222 esac 4407 esac
4408
4409
4410 # move library search paths that coincide with paths to not yet
4411 # installed libraries to the beginning of the library search list
4412 new_libs=
4413 for path in $notinst_path; do
4414 case " $new_libs " in
4415 *" -L$path/$objdir "*) ;;
4416 *)
4417 case " $compile_deplibs " in
4418 *" -L$path/$objdir "*)
4419 new_libs="$new_libs -L$path/$objdir" ;;
4420 esac
4421 ;;
4422 esac
4423 done
4424 for deplib in $compile_deplibs; do
4425 case $deplib in
4426 -L*)
4427 case " $new_libs " in
4428 *" $deplib "*) ;;
4429 *) new_libs="$new_libs $deplib" ;;
4430 esac
4431 ;;
4432 *) new_libs="$new_libs $deplib" ;;
4433 esac
4434 done
4435 compile_deplibs="$new_libs"
4436
4223 4437
4224 compile_command="$compile_command $compile_deplibs" 4438 compile_command="$compile_command $compile_deplibs"
4225 finalize_command="$finalize_command $finalize_deplibs" 4439 finalize_command="$finalize_command $finalize_deplibs"
4226 4440
4227 if test -n "$rpath$xrpath"; then 4441 if test -n "$rpath$xrpath"; then
4263 *) perm_rpath="$perm_rpath $libdir" ;; 4477 *) perm_rpath="$perm_rpath $libdir" ;;
4264 esac 4478 esac
4265 fi 4479 fi
4266 case $host in 4480 case $host in
4267 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4481 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4482 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4268 case :$dllsearchpath: in 4483 case :$dllsearchpath: in
4269 *":$libdir:"*) ;; 4484 *":$libdir:"*) ;;
4270 *) dllsearchpath="$dllsearchpath:$libdir";; 4485 *) dllsearchpath="$dllsearchpath:$libdir";;
4486 esac
4487 case :$dllsearchpath: in
4488 *":$testbindir:"*) ;;
4489 *) dllsearchpath="$dllsearchpath:$testbindir";;
4271 esac 4490 esac
4272 ;; 4491 ;;
4273 esac 4492 esac
4274 done 4493 done
4275 # Substitute the hardcoded libdirs into the rpath. 4494 # Substitute the hardcoded libdirs into the rpath.
4380 $run eval '$mv "$nlist"T "$nlist"' 4599 $run eval '$mv "$nlist"T "$nlist"'
4381 fi 4600 fi
4382 4601
4383 # Prepare the list of exported symbols 4602 # Prepare the list of exported symbols
4384 if test -z "$export_symbols"; then 4603 if test -z "$export_symbols"; then
4385 export_symbols="$output_objdir/$output.exp" 4604 export_symbols="$output_objdir/$outputname.exp"
4386 $run $rm $export_symbols 4605 $run $rm $export_symbols
4387 $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4606 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4607 case $host in
4608 *cygwin* | *mingw* )
4609 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4610 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4611 ;;
4612 esac
4388 else 4613 else
4389 $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' 4614 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4390 $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' 4615 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4391 $run eval 'mv "$nlist"T "$nlist"' 4616 $run eval 'mv "$nlist"T "$nlist"'
4617 case $host in
4618 *cygwin* | *mingw* )
4619 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4620 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4621 ;;
4622 esac
4392 fi 4623 fi
4393 fi 4624 fi
4394 4625
4395 for arg in $dlprefiles; do 4626 for arg in $dlprefiles; do
4396 $show "extracting global C symbols from \`$arg'" 4627 $show "extracting global C symbols from \`$arg'"
4437 # define lt_ptr char * 4668 # define lt_ptr char *
4438 # define const 4669 # define const
4439 #endif 4670 #endif
4440 4671
4441 /* The mapping between symbol names and symbols. */ 4672 /* The mapping between symbol names and symbols. */
4673 "
4674
4675 case $host in
4676 *cygwin* | *mingw* )
4677 $echo >> "$output_objdir/$dlsyms" "\
4678 /* DATA imports from DLLs on WIN32 can't be const, because
4679 runtime relocations are performed -- see ld's documentation
4680 on pseudo-relocs */
4681 struct {
4682 "
4683 ;;
4684 * )
4685 $echo >> "$output_objdir/$dlsyms" "\
4442 const struct { 4686 const struct {
4687 "
4688 ;;
4689 esac
4690
4691
4692 $echo >> "$output_objdir/$dlsyms" "\
4443 const char *name; 4693 const char *name;
4444 lt_ptr address; 4694 lt_ptr address;
4445 } 4695 }
4446 lt_preloaded_symbols[] = 4696 lt_preloaded_symbols[] =
4447 {\ 4697 {\
4484 *) pic_flag_for_symtable=" $pic_flag";; 4734 *) pic_flag_for_symtable=" $pic_flag";;
4485 esac 4735 esac
4486 esac 4736 esac
4487 4737
4488 # Now compile the dynamic symbol file. 4738 # Now compile the dynamic symbol file.
4489 $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4739 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4490 $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4740 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4491 4741
4492 # Clean up the generated files. 4742 # Clean up the generated files.
4493 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4743 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4494 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4744 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4495 4745
4496 # Transform the symbol file into the correct name. 4746 # Transform the symbol file into the correct name.
4497 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4747 case $host in
4498 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` 4748 *cygwin* | *mingw* )
4749 if test -f "$output_objdir/${outputname}.def" ; then
4750 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4751 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4752 else
4753 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4754 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4755 fi
4756 ;;
4757 * )
4758 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4759 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4760 ;;
4761 esac
4499 ;; 4762 ;;
4500 *) 4763 *)
4501 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4764 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4502 exit $EXIT_FAILURE 4765 exit $EXIT_FAILURE
4503 ;; 4766 ;;
4518 link_command="$compile_command$compile_rpath" 4781 link_command="$compile_command$compile_rpath"
4519 4782
4520 # We have no uninstalled library dependencies, so finalize right now. 4783 # We have no uninstalled library dependencies, so finalize right now.
4521 $show "$link_command" 4784 $show "$link_command"
4522 $run eval "$link_command" 4785 $run eval "$link_command"
4523 status=$? 4786 exit_status=$?
4524 4787
4525 # Delete the generated files. 4788 # Delete the generated files.
4526 if test -n "$dlsyms"; then 4789 if test -n "$dlsyms"; then
4527 $show "$rm $output_objdir/${outputname}S.${objext}" 4790 $show "$rm $output_objdir/${outputname}S.${objext}"
4528 $run $rm "$output_objdir/${outputname}S.${objext}" 4791 $run $rm "$output_objdir/${outputname}S.${objext}"
4529 fi 4792 fi
4530 4793
4531 exit $status 4794 exit $exit_status
4532 fi 4795 fi
4533 4796
4534 if test -n "$shlibpath_var"; then 4797 if test -n "$shlibpath_var"; then
4535 # We should set the shlibpath_var 4798 # We should set the shlibpath_var
4536 rpath= 4799 rpath=
4666 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4929 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4667 *) exeext= ;; 4930 *) exeext= ;;
4668 esac 4931 esac
4669 case $host in 4932 case $host in
4670 *cygwin* | *mingw* ) 4933 *cygwin* | *mingw* )
4671 cwrappersource=`$echo ${objdir}/lt-${output}.c` 4934 output_name=`basename $output`
4672 cwrapper=`$echo ${output}.exe` 4935 output_path=`dirname $output`
4673 $rm $cwrappersource $cwrapper 4936 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4674 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4937 cwrapper="$output_path/$output_name.exe"
4938 $rm $cwrappersource $cwrapper
4939 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4675 4940
4676 cat > $cwrappersource <<EOF 4941 cat > $cwrappersource <<EOF
4677 4942
4678 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4943 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4679 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4944 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4694 #include <stdlib.h> 4959 #include <stdlib.h>
4695 #include <unistd.h> 4960 #include <unistd.h>
4696 #include <malloc.h> 4961 #include <malloc.h>
4697 #include <stdarg.h> 4962 #include <stdarg.h>
4698 #include <assert.h> 4963 #include <assert.h>
4964 #include <string.h>
4965 #include <ctype.h>
4966 #include <sys/stat.h>
4699 4967
4700 #if defined(PATH_MAX) 4968 #if defined(PATH_MAX)
4701 # define LT_PATHMAX PATH_MAX 4969 # define LT_PATHMAX PATH_MAX
4702 #elif defined(MAXPATHLEN) 4970 #elif defined(MAXPATHLEN)
4703 # define LT_PATHMAX MAXPATHLEN 4971 # define LT_PATHMAX MAXPATHLEN
4704 #else 4972 #else
4705 # define LT_PATHMAX 1024 4973 # define LT_PATHMAX 1024
4706 #endif 4974 #endif
4707 4975
4708 #ifndef DIR_SEPARATOR 4976 #ifndef DIR_SEPARATOR
4709 #define DIR_SEPARATOR '/' 4977 # define DIR_SEPARATOR '/'
4978 # define PATH_SEPARATOR ':'
4710 #endif 4979 #endif
4711 4980
4712 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 4981 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4713 defined (__OS2__) 4982 defined (__OS2__)
4714 #define HAVE_DOS_BASED_FILE_SYSTEM 4983 # define HAVE_DOS_BASED_FILE_SYSTEM
4715 #ifndef DIR_SEPARATOR_2 4984 # ifndef DIR_SEPARATOR_2
4716 #define DIR_SEPARATOR_2 '\\' 4985 # define DIR_SEPARATOR_2 '\\'
4717 #endif 4986 # endif
4987 # ifndef PATH_SEPARATOR_2
4988 # define PATH_SEPARATOR_2 ';'
4989 # endif
4718 #endif 4990 #endif
4719 4991
4720 #ifndef DIR_SEPARATOR_2 4992 #ifndef DIR_SEPARATOR_2
4721 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 4993 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4722 #else /* DIR_SEPARATOR_2 */ 4994 #else /* DIR_SEPARATOR_2 */
4723 # define IS_DIR_SEPARATOR(ch) \ 4995 # define IS_DIR_SEPARATOR(ch) \
4724 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 4996 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4725 #endif /* DIR_SEPARATOR_2 */ 4997 #endif /* DIR_SEPARATOR_2 */
4726 4998
4999 #ifndef PATH_SEPARATOR_2
5000 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5001 #else /* PATH_SEPARATOR_2 */
5002 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5003 #endif /* PATH_SEPARATOR_2 */
5004
4727 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5005 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4728 #define XFREE(stale) do { \ 5006 #define XFREE(stale) do { \
4729 if (stale) { free ((void *) stale); stale = 0; } \ 5007 if (stale) { free ((void *) stale); stale = 0; } \
4730 } while (0) 5008 } while (0)
4731 5009
5010 /* -DDEBUG is fairly common in CFLAGS. */
5011 #undef DEBUG
5012 #if defined DEBUGWRAPPER
5013 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5014 #else
5015 # define DEBUG(format, ...)
5016 #endif
5017
4732 const char *program_name = NULL; 5018 const char *program_name = NULL;
4733 5019
4734 void * xmalloc (size_t num); 5020 void * xmalloc (size_t num);
4735 char * xstrdup (const char *string); 5021 char * xstrdup (const char *string);
4736 char * basename (const char *name); 5022 const char * base_name (const char *name);
4737 char * fnqualify(const char *path); 5023 char * find_executable(const char *wrapper);
5024 int check_executable(const char *path);
4738 char * strendzap(char *str, const char *pat); 5025 char * strendzap(char *str, const char *pat);
4739 void lt_fatal (const char *message, ...); 5026 void lt_fatal (const char *message, ...);
4740 5027
4741 int 5028 int
4742 main (int argc, char *argv[]) 5029 main (int argc, char *argv[])
4743 { 5030 {
4744 char **newargz; 5031 char **newargz;
4745 int i; 5032 int i;
4746 5033
4747 program_name = (char *) xstrdup ((char *) basename (argv[0])); 5034 program_name = (char *) xstrdup (base_name (argv[0]));
5035 DEBUG("(main) argv[0] : %s\n",argv[0]);
5036 DEBUG("(main) program_name : %s\n",program_name);
4748 newargz = XMALLOC(char *, argc+2); 5037 newargz = XMALLOC(char *, argc+2);
4749 EOF 5038 EOF
4750 5039
4751 cat >> $cwrappersource <<EOF 5040 cat >> $cwrappersource <<EOF
4752 newargz[0] = "$SHELL"; 5041 newargz[0] = (char *) xstrdup("$SHELL");
4753 EOF 5042 EOF
4754 5043
4755 cat >> $cwrappersource <<"EOF" 5044 cat >> $cwrappersource <<"EOF"
4756 newargz[1] = fnqualify(argv[0]); 5045 newargz[1] = find_executable(argv[0]);
5046 if (newargz[1] == NULL)
5047 lt_fatal("Couldn't find %s", argv[0]);
5048 DEBUG("(main) found exe at : %s\n",newargz[1]);
4757 /* we know the script has the same name, without the .exe */ 5049 /* we know the script has the same name, without the .exe */
4758 /* so make sure newargz[1] doesn't end in .exe */ 5050 /* so make sure newargz[1] doesn't end in .exe */
4759 strendzap(newargz[1],".exe"); 5051 strendzap(newargz[1],".exe");
4760 for (i = 1; i < argc; i++) 5052 for (i = 1; i < argc; i++)
4761 newargz[i+1] = xstrdup(argv[i]); 5053 newargz[i+1] = xstrdup(argv[i]);
4762 newargz[argc+1] = NULL; 5054 newargz[argc+1] = NULL;
5055
5056 for (i=0; i<argc+1; i++)
5057 {
5058 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5059 ;
5060 }
5061
4763 EOF 5062 EOF
4764 5063
4765 cat >> $cwrappersource <<EOF 5064 case $host_os in
5065 mingw*)
5066 cat >> $cwrappersource <<EOF
5067 execv("$SHELL",(char const **)newargz);
5068 EOF
5069 ;;
5070 *)
5071 cat >> $cwrappersource <<EOF
4766 execv("$SHELL",newargz); 5072 execv("$SHELL",newargz);
4767 EOF 5073 EOF
4768 5074 ;;
4769 cat >> $cwrappersource <<"EOF" 5075 esac
5076
5077 cat >> $cwrappersource <<"EOF"
5078 return 127;
4770 } 5079 }
4771 5080
4772 void * 5081 void *
4773 xmalloc (size_t num) 5082 xmalloc (size_t num)
4774 { 5083 {
4784 { 5093 {
4785 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5094 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4786 ; 5095 ;
4787 } 5096 }
4788 5097
4789 char * 5098 const char *
4790 basename (const char *name) 5099 base_name (const char *name)
4791 { 5100 {
4792 const char *base; 5101 const char *base;
4793 5102
4794 #if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5103 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4795 /* Skip over the disk name in MSDOS pathnames. */ 5104 /* Skip over the disk name in MSDOS pathnames. */
4796 if (isalpha (name[0]) && name[1] == ':') 5105 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
4797 name += 2; 5106 name += 2;
4798 #endif 5107 #endif
4799 5108
4800 for (base = name; *name; name++) 5109 for (base = name; *name; name++)
4801 if (IS_DIR_SEPARATOR (*name)) 5110 if (IS_DIR_SEPARATOR (*name))
4802 base = name + 1; 5111 base = name + 1;
4803 return (char *) base; 5112 return base;
4804 } 5113 }
4805 5114
5115 int
5116 check_executable(const char * path)
5117 {
5118 struct stat st;
5119
5120 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5121 if ((!path) || (!*path))
5122 return 0;
5123
5124 if ((stat (path, &st) >= 0) &&
5125 (
5126 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5127 #if defined (S_IXOTH)
5128 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5129 #endif
5130 #if defined (S_IXGRP)
5131 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5132 #endif
5133 ((st.st_mode & S_IXUSR) == S_IXUSR))
5134 )
5135 return 1;
5136 else
5137 return 0;
5138 }
5139
5140 /* Searches for the full path of the wrapper. Returns
5141 newly allocated full path name if found, NULL otherwise */
4806 char * 5142 char *
4807 fnqualify(const char *path) 5143 find_executable (const char* wrapper)
4808 { 5144 {
4809 size_t size; 5145 int has_slash = 0;
4810 char *p; 5146 const char* p;
5147 const char* p_next;
5148 /* static buffer for getcwd */
4811 char tmp[LT_PATHMAX + 1]; 5149 char tmp[LT_PATHMAX + 1];
4812 5150 int tmp_len;
4813 assert(path != NULL); 5151 char* concat_name;
4814 5152
4815 /* Is it qualified already? */ 5153 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5154
5155 if ((wrapper == NULL) || (*wrapper == '\0'))
5156 return NULL;
5157
5158 /* Absolute path? */
4816 #if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5159 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4817 if (isalpha (path[0]) && path[1] == ':') 5160 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
4818 return xstrdup (path); 5161 {
5162 concat_name = xstrdup (wrapper);
5163 if (check_executable(concat_name))
5164 return concat_name;
5165 XFREE(concat_name);
5166 }
5167 else
5168 {
4819 #endif 5169 #endif
4820 if (IS_DIR_SEPARATOR (path[0])) 5170 if (IS_DIR_SEPARATOR (wrapper[0]))
4821 return xstrdup (path); 5171 {
4822 5172 concat_name = xstrdup (wrapper);
4823 /* prepend the current directory */ 5173 if (check_executable(concat_name))
4824 /* doesn't handle '~' */ 5174 return concat_name;
5175 XFREE(concat_name);
5176 }
5177 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5178 }
5179 #endif
5180
5181 for (p = wrapper; *p; p++)
5182 if (*p == '/')
5183 {
5184 has_slash = 1;
5185 break;
5186 }
5187 if (!has_slash)
5188 {
5189 /* no slashes; search PATH */
5190 const char* path = getenv ("PATH");
5191 if (path != NULL)
5192 {
5193 for (p = path; *p; p = p_next)
5194 {
5195 const char* q;
5196 size_t p_len;
5197 for (q = p; *q; q++)
5198 if (IS_PATH_SEPARATOR(*q))
5199 break;
5200 p_len = q - p;
5201 p_next = (*q == '\0' ? q : q + 1);
5202 if (p_len == 0)
5203 {
5204 /* empty path: current directory */
5205 if (getcwd (tmp, LT_PATHMAX) == NULL)
5206 lt_fatal ("getcwd failed");
5207 tmp_len = strlen(tmp);
5208 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5209 memcpy (concat_name, tmp, tmp_len);
5210 concat_name[tmp_len] = '/';
5211 strcpy (concat_name + tmp_len + 1, wrapper);
5212 }
5213 else
5214 {
5215 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5216 memcpy (concat_name, p, p_len);
5217 concat_name[p_len] = '/';
5218 strcpy (concat_name + p_len + 1, wrapper);
5219 }
5220 if (check_executable(concat_name))
5221 return concat_name;
5222 XFREE(concat_name);
5223 }
5224 }
5225 /* not found in PATH; assume curdir */
5226 }
5227 /* Relative path | not found in path: prepend cwd */
4825 if (getcwd (tmp, LT_PATHMAX) == NULL) 5228 if (getcwd (tmp, LT_PATHMAX) == NULL)
4826 lt_fatal ("getcwd failed"); 5229 lt_fatal ("getcwd failed");
4827 size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */ 5230 tmp_len = strlen(tmp);
4828 p = XMALLOC(char, size); 5231 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
4829 sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path); 5232 memcpy (concat_name, tmp, tmp_len);
4830 return p; 5233 concat_name[tmp_len] = '/';
5234 strcpy (concat_name + tmp_len + 1, wrapper);
5235
5236 if (check_executable(concat_name))
5237 return concat_name;
5238 XFREE(concat_name);
5239 return NULL;
4831 } 5240 }
4832 5241
4833 char * 5242 char *
4834 strendzap(char *str, const char *pat) 5243 strendzap(char *str, const char *pat)
4835 { 5244 {
4869 va_start (ap, message); 5278 va_start (ap, message);
4870 lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5279 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4871 va_end (ap); 5280 va_end (ap);
4872 } 5281 }
4873 EOF 5282 EOF
4874 # we should really use a build-platform specific compiler 5283 # we should really use a build-platform specific compiler
4875 # here, but OTOH, the wrappers (shell script and this C one) 5284 # here, but OTOH, the wrappers (shell script and this C one)
4876 # are only useful if you want to execute the "real" binary. 5285 # are only useful if you want to execute the "real" binary.
4877 # Since the "real" binary is built for $host, then this 5286 # Since the "real" binary is built for $host, then this
4878 # wrapper might as well be built for $host, too. 5287 # wrapper might as well be built for $host, too.
4879 $run $LTCC -s -o $cwrapper $cwrappersource 5288 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
4880 ;; 5289 ;;
4881 esac 5290 esac
4882 $rm $output 5291 $rm $output
4883 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5292 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4884 5293
4885 $echo > $output "\ 5294 $echo > $output "\
4886 #! $SHELL 5295 #! $SHELL
4887 5296
4888 # $output - temporary wrapper script for $objdir/$outputname 5297 # $output - temporary wrapper script for $objdir/$outputname
5028 " 5437 "
5029 case $host in 5438 case $host in
5030 # Backslashes separate directories on plain windows 5439 # Backslashes separate directories on plain windows
5031 *-*-mingw | *-*-os2*) 5440 *-*-mingw | *-*-os2*)
5032 $echo >> $output "\ 5441 $echo >> $output "\
5033 exec \$progdir\\\\\$program \${1+\"\$@\"} 5442 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5034 " 5443 "
5035 ;; 5444 ;;
5036 5445
5037 *) 5446 *)
5038 $echo >> $output "\ 5447 $echo >> $output "\
5039 exec \$progdir/\$program \${1+\"\$@\"} 5448 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5040 " 5449 "
5041 ;; 5450 ;;
5042 esac 5451 esac
5043 $echo >> $output "\ 5452 $echo >> $output "\
5044 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" 5453 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5045 exit $EXIT_FAILURE 5454 exit $EXIT_FAILURE
5046 fi 5455 fi
5047 else 5456 else
5048 # The program doesn't exist. 5457 # The program doesn't exist.
5049 \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 5458 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5050 \$echo \"This script is just a wrapper for \$program.\" 1>&2 5459 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5051 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5460 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5052 exit $EXIT_FAILURE 5461 exit $EXIT_FAILURE
5053 fi 5462 fi
5054 fi\ 5463 fi\
5086 5495
5087 # Do each command in the archive commands. 5496 # Do each command in the archive commands.
5088 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5497 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5089 cmds=$old_archive_from_new_cmds 5498 cmds=$old_archive_from_new_cmds
5090 else 5499 else
5500 # POSIX demands no paths to be encoded in archives. We have
5501 # to avoid creating archives with duplicate basenames if we
5502 # might have to extract them afterwards, e.g., when creating a
5503 # static archive out of a convenience library, or when linking
5504 # the entirety of a libtool archive into another (currently
5505 # not supported by libtool).
5506 if (for obj in $oldobjs
5507 do
5508 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5509 done | sort | sort -uc >/dev/null 2>&1); then
5510 :
5511 else
5512 $echo "copying selected object files to avoid basename conflicts..."
5513
5514 if test -z "$gentop"; then
5515 gentop="$output_objdir/${outputname}x"
5516 generated="$generated $gentop"
5517
5518 $show "${rm}r $gentop"
5519 $run ${rm}r "$gentop"
5520 $show "$mkdir $gentop"
5521 $run $mkdir "$gentop"
5522 exit_status=$?
5523 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5524 exit $exit_status
5525 fi
5526 fi
5527
5528 save_oldobjs=$oldobjs
5529 oldobjs=
5530 counter=1
5531 for obj in $save_oldobjs
5532 do
5533 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5534 case " $oldobjs " in
5535 " ") oldobjs=$obj ;;
5536 *[\ /]"$objbase "*)
5537 while :; do
5538 # Make sure we don't pick an alternate name that also
5539 # overlaps.
5540 newobj=lt$counter-$objbase
5541 counter=`expr $counter + 1`
5542 case " $oldobjs " in
5543 *[\ /]"$newobj "*) ;;
5544 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5545 esac
5546 done
5547 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5548 $run ln "$obj" "$gentop/$newobj" ||
5549 $run cp "$obj" "$gentop/$newobj"
5550 oldobjs="$oldobjs $gentop/$newobj"
5551 ;;
5552 *) oldobjs="$oldobjs $obj" ;;
5553 esac
5554 done
5555 fi
5556
5091 eval cmds=\"$old_archive_cmds\" 5557 eval cmds=\"$old_archive_cmds\"
5092 5558
5093 if len=`expr "X$cmds" : ".*"` && 5559 if len=`expr "X$cmds" : ".*"` &&
5094 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5560 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5095 cmds=$old_archive_cmds 5561 cmds=$old_archive_cmds
5099 save_RANLIB=$RANLIB 5565 save_RANLIB=$RANLIB
5100 RANLIB=: 5566 RANLIB=:
5101 objlist= 5567 objlist=
5102 concat_cmds= 5568 concat_cmds=
5103 save_oldobjs=$oldobjs 5569 save_oldobjs=$oldobjs
5104 # GNU ar 2.10+ was changed to match POSIX; thus no paths are 5570
5105 # encoded into archives. This makes 'ar r' malfunction in
5106 # this piecewise linking case whenever conflicting object
5107 # names appear in distinct ar calls; check, warn and compensate.
5108 if (for obj in $save_oldobjs
5109 do
5110 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5111 done | sort | sort -uc >/dev/null 2>&1); then
5112 :
5113 else
5114 $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5115 $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5116 AR_FLAGS=cq
5117 fi
5118 # Is there a better way of finding the last object in the list? 5571 # Is there a better way of finding the last object in the list?
5119 for obj in $save_oldobjs 5572 for obj in $save_oldobjs
5120 do 5573 do
5121 last_oldobj=$obj 5574 last_oldobj=$obj
5122 done 5575 done
5123 for obj in $save_oldobjs 5576 for obj in $save_oldobjs
5124 do 5577 do
5125 oldobjs="$objlist $obj" 5578 oldobjs="$objlist $obj"
5126 objlist="$objlist $obj" 5579 objlist="$objlist $obj"
5127 eval test_cmds=\"$old_archive_cmds\" 5580 eval test_cmds=\"$old_archive_cmds\"
5128 if len=`expr "X$test_cmds" : ".*"` && 5581 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5129 test "$len" -le "$max_cmd_len"; then 5582 test "$len" -le "$max_cmd_len"; then
5130 : 5583 :
5131 else 5584 else
5132 # the above command should be used before it gets too long 5585 # the above command should be used before it gets too long
5133 oldobjs=$objlist 5586 oldobjs=$objlist
5320 5773
5321 # There may be an optional sh(1) argument at the beginning of 5774 # There may be an optional sh(1) argument at the beginning of
5322 # install_prog (especially on Windows NT). 5775 # install_prog (especially on Windows NT).
5323 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5776 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5324 # Allow the use of GNU shtool's install command. 5777 # Allow the use of GNU shtool's install command.
5325 $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then 5778 $echo "X$nonopt" | grep shtool > /dev/null; then
5326 # Aesthetically quote it. 5779 # Aesthetically quote it.
5327 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5780 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5328 case $arg in 5781 case $arg in
5329 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5782 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5330 arg="\"$arg\"" 5783 arg="\"$arg\""
5331 ;; 5784 ;;
5332 esac 5785 esac
5333 install_prog="$arg " 5786 install_prog="$arg "
5334 arg="$1" 5787 arg="$1"
5335 shift 5788 shift
5336 else 5789 else
5337 install_prog= 5790 install_prog=
5338 arg="$nonopt" 5791 arg=$nonopt
5339 fi 5792 fi
5340 5793
5341 # The real first argument should be the name of the installation program. 5794 # The real first argument should be the name of the installation program.
5342 # Aesthetically quote it. 5795 # Aesthetically quote it.
5343 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5796 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5344 case $arg in 5797 case $arg in
5345 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5798 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5346 arg="\"$arg\"" 5799 arg="\"$arg\""
5347 ;; 5800 ;;
5348 esac 5801 esac
5349 install_prog="$install_prog$arg" 5802 install_prog="$install_prog$arg"
5350 5803
5358 stripme= 5811 stripme=
5359 for arg 5812 for arg
5360 do 5813 do
5361 if test -n "$dest"; then 5814 if test -n "$dest"; then
5362 files="$files $dest" 5815 files="$files $dest"
5363 dest="$arg" 5816 dest=$arg
5364 continue 5817 continue
5365 fi 5818 fi
5366 5819
5367 case $arg in 5820 case $arg in
5368 -d) isdir=yes ;; 5821 -d) isdir=yes ;;
5369 -f) prev="-f" ;; 5822 -f)
5370 -g) prev="-g" ;; 5823 case " $install_prog " in
5371 -m) prev="-m" ;; 5824 *[\\\ /]cp\ *) ;;
5372 -o) prev="-o" ;; 5825 *) prev=$arg ;;
5826 esac
5827 ;;
5828 -g | -m | -o) prev=$arg ;;
5373 -s) 5829 -s)
5374 stripme=" -s" 5830 stripme=" -s"
5375 continue 5831 continue
5376 ;; 5832 ;;
5377 -*) ;; 5833 -*)
5378 5834 ;;
5379 *) 5835 *)
5380 # If the previous option needed an argument, then skip it. 5836 # If the previous option needed an argument, then skip it.
5381 if test -n "$prev"; then 5837 if test -n "$prev"; then
5382 prev= 5838 prev=
5383 else 5839 else
5384 dest="$arg" 5840 dest=$arg
5385 continue 5841 continue
5386 fi 5842 fi
5387 ;; 5843 ;;
5388 esac 5844 esac
5389 5845
5390 # Aesthetically quote the argument. 5846 # Aesthetically quote the argument.
5391 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5847 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5392 case $arg in 5848 case $arg in
5393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) 5849 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5394 arg="\"$arg\"" 5850 arg="\"$arg\""
5395 ;; 5851 ;;
5396 esac 5852 esac
5397 install_prog="$install_prog $arg" 5853 install_prog="$install_prog $arg"
5398 done 5854 done
5557 $run eval "$striplib $destdir/$realname" || exit $? 6013 $run eval "$striplib $destdir/$realname" || exit $?
5558 fi 6014 fi
5559 6015
5560 if test "$#" -gt 0; then 6016 if test "$#" -gt 0; then
5561 # Delete the old symlinks, and create new ones. 6017 # Delete the old symlinks, and create new ones.
6018 # Try `ln -sf' first, because the `ln' binary might depend on
6019 # the symlink we replace! Solaris /bin/ln does not understand -f,
6020 # so we also need to try rm && ln -s.
5562 for linkname 6021 for linkname
5563 do 6022 do
5564 if test "$linkname" != "$realname"; then 6023 if test "$linkname" != "$realname"; then
5565 $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 6024 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5566 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" 6025 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5567 fi 6026 fi
5568 done 6027 done
5569 fi 6028 fi
5570 6029
5571 # Do each command in the postinstall commands. 6030 # Do each command in the postinstall commands.
5574 save_ifs="$IFS"; IFS='~' 6033 save_ifs="$IFS"; IFS='~'
5575 for cmd in $cmds; do 6034 for cmd in $cmds; do
5576 IFS="$save_ifs" 6035 IFS="$save_ifs"
5577 eval cmd=\"$cmd\" 6036 eval cmd=\"$cmd\"
5578 $show "$cmd" 6037 $show "$cmd"
5579 $run eval "$cmd" || exit $? 6038 $run eval "$cmd" || {
6039 lt_exit=$?
6040
6041 # Restore the uninstalled library and exit
6042 if test "$mode" = relink; then
6043 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6044 fi
6045
6046 exit $lt_exit
6047 }
5580 done 6048 done
5581 IFS="$save_ifs" 6049 IFS="$save_ifs"
5582 fi 6050 fi
5583 6051
5584 # Install the pseudo-library for information purposes. 6052 # Install the pseudo-library for information purposes.
5668 esac 6136 esac
5669 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6137 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5670 notinst_deplibs= 6138 notinst_deplibs=
5671 relink_command= 6139 relink_command=
5672 6140
5673 # To insure that "foo" is sourced, and not "foo.exe", 6141 # Note that it is not necessary on cygwin/mingw to append a dot to
5674 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6142 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5675 # which disallows the automatic-append-.exe behavior. 6143 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5676 case $build in 6144 # `FILE.' does not work on cygwin managed mounts.
5677 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6145 #
5678 *) wrapperdot=${wrapper} ;;
5679 esac
5680 # If there is no directory component, then add one. 6146 # If there is no directory component, then add one.
5681 case $file in 6147 case $wrapper in
5682 */* | *\\*) . ${wrapperdot} ;; 6148 */* | *\\*) . ${wrapper} ;;
5683 *) . ./${wrapperdot} ;; 6149 *) . ./${wrapper} ;;
5684 esac 6150 esac
5685 6151
5686 # Check the variables that should have been set. 6152 # Check the variables that should have been set.
5687 if test -z "$notinst_deplibs"; then 6153 if test -z "$notinst_deplibs"; then
5688 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6154 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5706 finalize=no 6172 finalize=no
5707 fi 6173 fi
5708 done 6174 done
5709 6175
5710 relink_command= 6176 relink_command=
5711 # To insure that "foo" is sourced, and not "foo.exe", 6177 # Note that it is not necessary on cygwin/mingw to append a dot to
5712 # finese the cygwin/MSYS system by explicitly sourcing "foo." 6178 # foo even if both foo and FILE.exe exist: automatic-append-.exe
5713 # which disallows the automatic-append-.exe behavior. 6179 # behavior happens only for exec(3), not for open(2)! Also, sourcing
5714 case $build in 6180 # `FILE.' does not work on cygwin managed mounts.
5715 *cygwin* | *mingw*) wrapperdot=${wrapper}. ;; 6181 #
5716 *) wrapperdot=${wrapper} ;;
5717 esac
5718 # If there is no directory component, then add one. 6182 # If there is no directory component, then add one.
5719 case $file in 6183 case $wrapper in
5720 */* | *\\*) . ${wrapperdot} ;; 6184 */* | *\\*) . ${wrapper} ;;
5721 *) . ./${wrapperdot} ;; 6185 *) . ./${wrapper} ;;
5722 esac 6186 esac
5723 6187
5724 outputname= 6188 outputname=
5725 if test "$fast_install" = no && test -n "$relink_command"; then 6189 if test "$fast_install" = no && test -n "$relink_command"; then
5726 if test "$finalize" = yes && test -z "$run"; then 6190 if test "$finalize" = yes && test -z "$run"; then
5727 tmpdir="/tmp" 6191 tmpdir=`func_mktempdir`
5728 test -n "$TMPDIR" && tmpdir="$TMPDIR"
5729 tmpdir="$tmpdir/libtool-$$"
5730 save_umask=`umask`
5731 umask 0077
5732 if $mkdir "$tmpdir"; then
5733 umask $save_umask
5734 else
5735 umask $save_umask
5736 $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5737 continue
5738 fi
5739 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6192 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5740 outputname="$tmpdir/$file" 6193 outputname="$tmpdir/$file"
5741 # Replace the output file specification. 6194 # Replace the output file specification.
5742 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` 6195 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5743 6196
5757 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6210 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5758 fi 6211 fi
5759 fi 6212 fi
5760 6213
5761 # remove .exe since cygwin /usr/bin/install will append another 6214 # remove .exe since cygwin /usr/bin/install will append another
5762 # one anyways 6215 # one anyway
5763 case $install_prog,$host in 6216 case $install_prog,$host in
5764 */usr/bin/install*,*cygwin*) 6217 */usr/bin/install*,*cygwin*)
5765 case $file:$destfile in 6218 case $file:$destfile in
5766 *.exe:*.exe) 6219 *.exe:*.exe)
5767 # this is ok 6220 # this is ok
5857 fi 6310 fi
5858 6311
5859 # Exit here if they wanted silent mode. 6312 # Exit here if they wanted silent mode.
5860 test "$show" = : && exit $EXIT_SUCCESS 6313 test "$show" = : && exit $EXIT_SUCCESS
5861 6314
5862 $echo "----------------------------------------------------------------------" 6315 $echo "X----------------------------------------------------------------------" | $Xsed
5863 $echo "Libraries have been installed in:" 6316 $echo "Libraries have been installed in:"
5864 for libdir in $libdirs; do 6317 for libdir in $libdirs; do
5865 $echo " $libdir" 6318 $echo " $libdir"
5866 done 6319 done
5867 $echo 6320 $echo
5890 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6343 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5891 fi 6344 fi
5892 $echo 6345 $echo
5893 $echo "See any operating system documentation about shared libraries for" 6346 $echo "See any operating system documentation about shared libraries for"
5894 $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6347 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5895 $echo "----------------------------------------------------------------------" 6348 $echo "X----------------------------------------------------------------------" | $Xsed
5896 exit $EXIT_SUCCESS 6349 exit $EXIT_SUCCESS
5897 ;; 6350 ;;
5898 6351
5899 # libtool execute mode 6352 # libtool execute mode
5900 execute) 6353 execute)
6107 # Delete the libtool libraries and symlinks. 6560 # Delete the libtool libraries and symlinks.
6108 for n in $library_names; do 6561 for n in $library_names; do
6109 rmfiles="$rmfiles $objdir/$n" 6562 rmfiles="$rmfiles $objdir/$n"
6110 done 6563 done
6111 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6564 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6112 test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6565
6113 6566 case "$mode" in
6114 if test "$mode" = uninstall; then 6567 clean)
6568 case " $library_names " in
6569 # " " in the beginning catches empty $dlname
6570 *" $dlname "*) ;;
6571 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6572 esac
6573 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6574 ;;
6575 uninstall)
6115 if test -n "$library_names"; then 6576 if test -n "$library_names"; then
6116 # Do each command in the postuninstall commands. 6577 # Do each command in the postuninstall commands.
6117 cmds=$postuninstall_cmds 6578 cmds=$postuninstall_cmds
6118 save_ifs="$IFS"; IFS='~' 6579 save_ifs="$IFS"; IFS='~'
6119 for cmd in $cmds; do 6580 for cmd in $cmds; do
6142 fi 6603 fi
6143 done 6604 done
6144 IFS="$save_ifs" 6605 IFS="$save_ifs"
6145 fi 6606 fi
6146 # FIXME: should reinstall the best remaining shared library. 6607 # FIXME: should reinstall the best remaining shared library.
6147 fi 6608 ;;
6609 esac
6148 fi 6610 fi
6149 ;; 6611 ;;
6150 6612
6151 *.lo) 6613 *.lo)
6152 # Possibly a libtool object, so verify it. 6614 # Possibly a libtool object, so verify it.
6427 esac 6889 esac
6428 6890
6429 $echo 6891 $echo
6430 $echo "Try \`$modename --help' for more information about other modes." 6892 $echo "Try \`$modename --help' for more information about other modes."
6431 6893
6432 exit $EXIT_SUCCESS 6894 exit $?
6433 6895
6434 # The TAGs below are defined such that we never get into a situation 6896 # The TAGs below are defined such that we never get into a situation
6435 # in which we disable both kinds of libraries. Given conflicting 6897 # in which we disable both kinds of libraries. Given conflicting
6436 # choices, we go for a static library, that is the most portable, 6898 # choices, we go for a static library, that is the most portable,
6437 # since we can't tell whether shared libraries were disabled because 6899 # since we can't tell whether shared libraries were disabled because
6441 # time on that platform, so we default to a shared-only configuration. 6903 # time on that platform, so we default to a shared-only configuration.
6442 # If a disable-shared tag is given, we'll fallback to a static-only 6904 # If a disable-shared tag is given, we'll fallback to a static-only
6443 # configuration. But we'll never go from static-only to shared-only. 6905 # configuration. But we'll never go from static-only to shared-only.
6444 6906
6445 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6907 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6446 build_libtool_libs=no 6908 disable_libs=shared
6447 build_old_libs=yes
6448 # ### END LIBTOOL TAG CONFIG: disable-shared 6909 # ### END LIBTOOL TAG CONFIG: disable-shared
6449 6910
6450 # ### BEGIN LIBTOOL TAG CONFIG: disable-static 6911 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6451 build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` 6912 disable_libs=static
6452 # ### END LIBTOOL TAG CONFIG: disable-static 6913 # ### END LIBTOOL TAG CONFIG: disable-static
6453 6914
6454 # Local Variables: 6915 # Local Variables:
6455 # mode:shell-script 6916 # mode:shell-script
6456 # sh-indentation:2 6917 # sh-indentation:2