VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.31/ltmain.sh@ 49482

Last change on this file since 49482 was 39924, checked in by vboxsync, 13 years ago

libxml-2.6.31 VBox modifications and remove libxml-2.6.30

  • Property svn:eol-style set to LF
File size: 194.8 KB
Line 
1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun configure.
3#
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
5# 2007 Free Software Foundation, Inc.
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
27
28# Oracle GPL Disclaimer: For the avoidance of doubt, except that if any license choice
29# other than GPL or LGPL is available it will apply instead, Oracle elects to use only
30# the General Public License version 2 (GPLv2) at this time for any software where
31# a choice of GPL license versions is made available with the language indicating
32# that GPLv2 or any later version may be used, or where a choice of which version
33# of the GPL is applied is otherwise unspecified.
34
35basename="s,^.*/,,g"
36
37# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
38# is ksh but when the shell is invoked as "sh" and the current value of
39# the _XPG environment variable is not equal to 1 (one), the special
40# positional parameter $0, within a function call, is the name of the
41# function.
42progpath="$0"
43
44# The name of this program:
45progname=`echo "$progpath" | $SED $basename`
46modename="$progname"
47
48# Global variables:
49EXIT_SUCCESS=0
50EXIT_FAILURE=1
51
52PROGRAM=ltmain.sh
53PACKAGE=libtool
54VERSION=1.5.24
55TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
56
57# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
58if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
59 emulate sh
60 NULLCMD=:
61 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
62 # is contrary to our usage. Disable this feature.
63 alias -g '${1+"$@"}'='"$@"'
64 setopt NO_GLOB_SUBST
65else
66 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
67fi
68BIN_SH=xpg4; export BIN_SH # for Tru64
69DUALCASE=1; export DUALCASE # for MKS sh
70
71# Check that we have a working $echo.
72if test "X$1" = X--no-reexec; then
73 # Discard the --no-reexec flag, and continue.
74 shift
75elif test "X$1" = X--fallback-echo; then
76 # Avoid inline document here, it may be left over
77 :
78elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
79 # Yippee, $echo works!
80 :
81else
82 # Restart under the correct shell, and then maybe $echo will work.
83 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
84fi
85
86if test "X$1" = X--fallback-echo; then
87 # used as fallback echo
88 shift
89 cat <<EOF
90$*
91EOF
92 exit $EXIT_SUCCESS
93fi
94
95default_mode=
96help="Try \`$progname --help' for more information."
97magic="%%%MAGIC variable%%%"
98mkdir="mkdir"
99mv="mv -f"
100rm="rm -f"
101
102# Sed substitution that helps us do robust quoting. It backslashifies
103# metacharacters that are still active within double-quoted strings.
104Xsed="${SED}"' -e 1s/^X//'
105sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
106# test EBCDIC or ASCII
107case `echo X|tr X '\101'` in
108 A) # ASCII based system
109 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
110 SP2NL='tr \040 \012'
111 NL2SP='tr \015\012 \040\040'
112 ;;
113 *) # EBCDIC based system
114 SP2NL='tr \100 \n'
115 NL2SP='tr \r\n \100\100'
116 ;;
117esac
118
119# NLS nuisances.
120# Only set LANG and LC_ALL to C if already set.
121# These must not be set unconditionally because not all systems understand
122# e.g. LANG=C (notably SCO).
123# We save the old values to restore during execute mode.
124for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
125do
126 eval "if test \"\${$lt_var+set}\" = set; then
127 save_$lt_var=\$$lt_var
128 $lt_var=C
129 export $lt_var
130 fi"
131done
132
133# Make sure IFS has a sensible default
134lt_nl='
135'
136IFS=" $lt_nl"
137
138if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
139 $echo "$modename: not configured to build any kind of library" 1>&2
140 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
141 exit $EXIT_FAILURE
142fi
143
144# Global variables.
145mode=$default_mode
146nonopt=
147prev=
148prevopt=
149run=
150show="$echo"
151show_help=
152execute_dlfiles=
153duplicate_deps=no
154preserve_args=
155lo2o="s/\\.lo\$/.${objext}/"
156o2lo="s/\\.${objext}\$/.lo/"
157extracted_archives=
158extracted_serial=0
159
160#####################################
161# Shell function definitions:
162# This seems to be the best place for them
163
164# func_mktempdir [string]
165# Make a temporary directory that won't clash with other running
166# libtool processes, and avoids race conditions if possible. If
167# given, STRING is the basename for that directory.
168func_mktempdir ()
169{
170 my_template="${TMPDIR-/tmp}/${1-$progname}"
171
172 if test "$run" = ":"; then
173 # Return a directory name, but don't create it in dry-run mode
174 my_tmpdir="${my_template}-$$"
175 else
176
177 # If mktemp works, use that first and foremost
178 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
179
180 if test ! -d "$my_tmpdir"; then
181 # Failing that, at least try and use $RANDOM to avoid a race
182 my_tmpdir="${my_template}-${RANDOM-0}$$"
183
184 save_mktempdir_umask=`umask`
185 umask 0077
186 $mkdir "$my_tmpdir"
187 umask $save_mktempdir_umask
188 fi
189
190 # If we're not in dry-run mode, bomb out on failure
191 test -d "$my_tmpdir" || {
192 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
193 exit $EXIT_FAILURE
194 }
195 fi
196
197 $echo "X$my_tmpdir" | $Xsed
198}
199
200
201# func_win32_libid arg
202# return the library type of file 'arg'
203#
204# Need a lot of goo to handle *both* DLLs and import libs
205# Has to be a shell function in order to 'eat' the argument
206# that is supplied when $file_magic_command is called.
207func_win32_libid ()
208{
209 win32_libid_type="unknown"
210 win32_fileres=`file -L $1 2>/dev/null`
211 case $win32_fileres in
212 *ar\ archive\ import\ library*) # definitely import
213 win32_libid_type="x86 archive import"
214 ;;
215 *ar\ archive*) # could be an import, or static
216 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
217 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
218 win32_nmres=`eval $NM -f posix -A $1 | \
219 $SED -n -e '1,100{
220 / I /{
221 s,.*,import,
222 p
223 q
224 }
225 }'`
226 case $win32_nmres in
227 import*) win32_libid_type="x86 archive import";;
228 *) win32_libid_type="x86 archive static";;
229 esac
230 fi
231 ;;
232 *DLL*)
233 win32_libid_type="x86 DLL"
234 ;;
235 *executable*) # but shell scripts are "executable" too...
236 case $win32_fileres in
237 *MS\ Windows\ PE\ Intel*)
238 win32_libid_type="x86 DLL"
239 ;;
240 esac
241 ;;
242 esac
243 $echo $win32_libid_type
244}
245
246
247# func_infer_tag arg
248# Infer tagged configuration to use if any are available and
249# if one wasn't chosen via the "--tag" command line option.
250# Only attempt this if the compiler in the base compile
251# command doesn't match the default compiler.
252# arg is usually of the form 'gcc ...'
253func_infer_tag ()
254{
255 if test -n "$available_tags" && test -z "$tagname"; then
256 CC_quoted=
257 for arg in $CC; do
258 case $arg in
259 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
260 arg="\"$arg\""
261 ;;
262 esac
263 CC_quoted="$CC_quoted $arg"
264 done
265 case $@ in
266 # Blanks in the command may have been stripped by the calling shell,
267 # but not from the CC environment variable when configure was run.
268 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
269 # Blanks at the start of $base_compile will cause this to fail
270 # if we don't check for them as well.
271 *)
272 for z in $available_tags; do
273 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
274 # Evaluate the configuration.
275 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
276 CC_quoted=
277 for arg in $CC; do
278 # Double-quote args containing other shell metacharacters.
279 case $arg in
280 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
281 arg="\"$arg\""
282 ;;
283 esac
284 CC_quoted="$CC_quoted $arg"
285 done
286 case "$@ " in
287 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
288 # The compiler in the base compile command matches
289 # the one in the tagged configuration.
290 # Assume this is the tagged configuration we want.
291 tagname=$z
292 break
293 ;;
294 esac
295 fi
296 done
297 # If $tagname still isn't set, then no tagged configuration
298 # was found and let the user know that the "--tag" command
299 # line option must be used.
300 if test -z "$tagname"; then
301 $echo "$modename: unable to infer tagged configuration"
302 $echo "$modename: specify a tag with \`--tag'" 1>&2
303 exit $EXIT_FAILURE
304# else
305# $echo "$modename: using $tagname tagged configuration"
306 fi
307 ;;
308 esac
309 fi
310}
311
312
313# func_extract_an_archive dir oldlib
314func_extract_an_archive ()
315{
316 f_ex_an_ar_dir="$1"; shift
317 f_ex_an_ar_oldlib="$1"
318
319 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
320 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
321 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
322 :
323 else
324 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
325 exit $EXIT_FAILURE
326 fi
327}
328
329# func_extract_archives gentop oldlib ...
330func_extract_archives ()
331{
332 my_gentop="$1"; shift
333 my_oldlibs=${1+"$@"}
334 my_oldobjs=""
335 my_xlib=""
336 my_xabs=""
337 my_xdir=""
338 my_status=""
339
340 $show "${rm}r $my_gentop"
341 $run ${rm}r "$my_gentop"
342 $show "$mkdir $my_gentop"
343 $run $mkdir "$my_gentop"
344 my_status=$?
345 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
346 exit $my_status
347 fi
348
349 for my_xlib in $my_oldlibs; do
350 # Extract the objects.
351 case $my_xlib in
352 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
353 *) my_xabs=`pwd`"/$my_xlib" ;;
354 esac
355 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
356 my_xlib_u=$my_xlib
357 while :; do
358 case " $extracted_archives " in
359 *" $my_xlib_u "*)
360 extracted_serial=`expr $extracted_serial + 1`
361 my_xlib_u=lt$extracted_serial-$my_xlib ;;
362 *) break ;;
363 esac
364 done
365 extracted_archives="$extracted_archives $my_xlib_u"
366 my_xdir="$my_gentop/$my_xlib_u"
367
368 $show "${rm}r $my_xdir"
369 $run ${rm}r "$my_xdir"
370 $show "$mkdir $my_xdir"
371 $run $mkdir "$my_xdir"
372 exit_status=$?
373 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
374 exit $exit_status
375 fi
376 case $host in
377 *-darwin*)
378 $show "Extracting $my_xabs"
379 # Do not bother doing anything if just a dry run
380 if test -z "$run"; then
381 darwin_orig_dir=`pwd`
382 cd $my_xdir || exit $?
383 darwin_archive=$my_xabs
384 darwin_curdir=`pwd`
385 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
386 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
387 if test -n "$darwin_arches"; then
388 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
389 darwin_arch=
390 $show "$darwin_base_archive has multiple architectures $darwin_arches"
391 for darwin_arch in $darwin_arches ; do
392 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
394 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
395 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
396 cd "$darwin_curdir"
397 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
398 done # $darwin_arches
399 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
400 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
401 darwin_file=
402 darwin_files=
403 for darwin_file in $darwin_filelist; do
404 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
405 lipo -create -output "$darwin_file" $darwin_files
406 done # $darwin_filelist
407 ${rm}r unfat-$$
408 cd "$darwin_orig_dir"
409 else
410 cd "$darwin_orig_dir"
411 func_extract_an_archive "$my_xdir" "$my_xabs"
412 fi # $darwin_arches
413 fi # $run
414 ;;
415 *)
416 func_extract_an_archive "$my_xdir" "$my_xabs"
417 ;;
418 esac
419 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
420 done
421 func_extract_archives_result="$my_oldobjs"
422}
423# End of Shell function definitions
424#####################################
425
426# Darwin sucks
427eval std_shrext=\"$shrext_cmds\"
428
429disable_libs=no
430
431# Parse our command line options once, thoroughly.
432while test "$#" -gt 0
433do
434 arg="$1"
435 shift
436
437 case $arg in
438 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
439 *) optarg= ;;
440 esac
441
442 # If the previous option needs an argument, assign it.
443 if test -n "$prev"; then
444 case $prev in
445 execute_dlfiles)
446 execute_dlfiles="$execute_dlfiles $arg"
447 ;;
448 tag)
449 tagname="$arg"
450 preserve_args="${preserve_args}=$arg"
451
452 # Check whether tagname contains only valid characters
453 case $tagname in
454 *[!-_A-Za-z0-9,/]*)
455 $echo "$progname: invalid tag name: $tagname" 1>&2
456 exit $EXIT_FAILURE
457 ;;
458 esac
459
460 case $tagname in
461 CC)
462 # Don't test for the "default" C tag, as we know, it's there, but
463 # not specially marked.
464 ;;
465 *)
466 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
467 taglist="$taglist $tagname"
468 # Evaluate the configuration.
469 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
470 else
471 $echo "$progname: ignoring unknown tag $tagname" 1>&2
472 fi
473 ;;
474 esac
475 ;;
476 *)
477 eval "$prev=\$arg"
478 ;;
479 esac
480
481 prev=
482 prevopt=
483 continue
484 fi
485
486 # Have we seen a non-optional argument yet?
487 case $arg in
488 --help)
489 show_help=yes
490 ;;
491
492 --version)
493 echo "\
494$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
495
496Copyright (C) 2007 Free Software Foundation, Inc.
497This is free software; see the source for copying conditions. There is NO
498warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
499 exit $?
500 ;;
501
502 --config)
503 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
504 # Now print the configurations for the tags.
505 for tagname in $taglist; do
506 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
507 done
508 exit $?
509 ;;
510
511 --debug)
512 $echo "$progname: enabling shell trace mode"
513 set -x
514 preserve_args="$preserve_args $arg"
515 ;;
516
517 --dry-run | -n)
518 run=:
519 ;;
520
521 --features)
522 $echo "host: $host"
523 if test "$build_libtool_libs" = yes; then
524 $echo "enable shared libraries"
525 else
526 $echo "disable shared libraries"
527 fi
528 if test "$build_old_libs" = yes; then
529 $echo "enable static libraries"
530 else
531 $echo "disable static libraries"
532 fi
533 exit $?
534 ;;
535
536 --finish) mode="finish" ;;
537
538 --mode) prevopt="--mode" prev=mode ;;
539 --mode=*) mode="$optarg" ;;
540
541 --preserve-dup-deps) duplicate_deps="yes" ;;
542
543 --quiet | --silent)
544 show=:
545 preserve_args="$preserve_args $arg"
546 ;;
547
548 --tag)
549 prevopt="--tag"
550 prev=tag
551 preserve_args="$preserve_args --tag"
552 ;;
553 --tag=*)
554 set tag "$optarg" ${1+"$@"}
555 shift
556 prev=tag
557 preserve_args="$preserve_args --tag"
558 ;;
559
560 -dlopen)
561 prevopt="-dlopen"
562 prev=execute_dlfiles
563 ;;
564
565 -*)
566 $echo "$modename: unrecognized option \`$arg'" 1>&2
567 $echo "$help" 1>&2
568 exit $EXIT_FAILURE
569 ;;
570
571 *)
572 nonopt="$arg"
573 break
574 ;;
575 esac
576done
577
578if test -n "$prevopt"; then
579 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
580 $echo "$help" 1>&2
581 exit $EXIT_FAILURE
582fi
583
584case $disable_libs in
585no)
586 ;;
587shared)
588 build_libtool_libs=no
589 build_old_libs=yes
590 ;;
591static)
592 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
593 ;;
594esac
595
596# If this variable is set in any of the actions, the command in it
597# will be execed at the end. This prevents here-documents from being
598# left over by shells.
599exec_cmd=
600
601if test -z "$show_help"; then
602
603 # Infer the operation mode.
604 if test -z "$mode"; then
605 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
606 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
607 case $nonopt in
608 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
609 mode=link
610 for arg
611 do
612 case $arg in
613 -c)
614 mode=compile
615 break
616 ;;
617 esac
618 done
619 ;;
620 *db | *dbx | *strace | *truss)
621 mode=execute
622 ;;
623 *install*|cp|mv)
624 mode=install
625 ;;
626 *rm)
627 mode=uninstall
628 ;;
629 *)
630 # If we have no mode, but dlfiles were specified, then do execute mode.
631 test -n "$execute_dlfiles" && mode=execute
632
633 # Just use the default operation mode.
634 if test -z "$mode"; then
635 if test -n "$nonopt"; then
636 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
637 else
638 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
639 fi
640 fi
641 ;;
642 esac
643 fi
644
645 # Only execute mode is allowed to have -dlopen flags.
646 if test -n "$execute_dlfiles" && test "$mode" != execute; then
647 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
648 $echo "$help" 1>&2
649 exit $EXIT_FAILURE
650 fi
651
652 # Change the help message to a mode-specific one.
653 generic_help="$help"
654 help="Try \`$modename --help --mode=$mode' for more information."
655
656 # These modes are in order of execution frequency so that they run quickly.
657 case $mode in
658 # libtool compile mode
659 compile)
660 modename="$modename: compile"
661 # Get the compilation command and the source file.
662 base_compile=
663 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
664 suppress_opt=yes
665 suppress_output=
666 arg_mode=normal
667 libobj=
668 later=
669
670 for arg
671 do
672 case $arg_mode in
673 arg )
674 # do not "continue". Instead, add this to base_compile
675 lastarg="$arg"
676 arg_mode=normal
677 ;;
678
679 target )
680 libobj="$arg"
681 arg_mode=normal
682 continue
683 ;;
684
685 normal )
686 # Accept any command-line options.
687 case $arg in
688 -o)
689 if test -n "$libobj" ; then
690 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
691 exit $EXIT_FAILURE
692 fi
693 arg_mode=target
694 continue
695 ;;
696
697 -static | -prefer-pic | -prefer-non-pic)
698 later="$later $arg"
699 continue
700 ;;
701
702 -no-suppress)
703 suppress_opt=no
704 continue
705 ;;
706
707 -Xcompiler)
708 arg_mode=arg # the next one goes into the "base_compile" arg list
709 continue # The current "srcfile" will either be retained or
710 ;; # replaced later. I would guess that would be a bug.
711
712 -Wc,*)
713 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
714 lastarg=
715 save_ifs="$IFS"; IFS=','
716 for arg in $args; do
717 IFS="$save_ifs"
718
719 # Double-quote args containing other shell metacharacters.
720 # Many Bourne shells cannot handle close brackets correctly
721 # in scan sets, so we specify it separately.
722 case $arg in
723 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
724 arg="\"$arg\""
725 ;;
726 esac
727 lastarg="$lastarg $arg"
728 done
729 IFS="$save_ifs"
730 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
731
732 # Add the arguments to base_compile.
733 base_compile="$base_compile $lastarg"
734 continue
735 ;;
736
737 * )
738 # Accept the current argument as the source file.
739 # The previous "srcfile" becomes the current argument.
740 #
741 lastarg="$srcfile"
742 srcfile="$arg"
743 ;;
744 esac # case $arg
745 ;;
746 esac # case $arg_mode
747
748 # Aesthetically quote the previous argument.
749 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
750
751 case $lastarg in
752 # Double-quote args containing other shell metacharacters.
753 # Many Bourne shells cannot handle close brackets correctly
754 # in scan sets, and some SunOS ksh mistreat backslash-escaping
755 # in scan sets (worked around with variable expansion),
756 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
757 # at all, so we specify them separately.
758 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
759 lastarg="\"$lastarg\""
760 ;;
761 esac
762
763 base_compile="$base_compile $lastarg"
764 done # for arg
765
766 case $arg_mode in
767 arg)
768 $echo "$modename: you must specify an argument for -Xcompile"
769 exit $EXIT_FAILURE
770 ;;
771 target)
772 $echo "$modename: you must specify a target with \`-o'" 1>&2
773 exit $EXIT_FAILURE
774 ;;
775 *)
776 # Get the name of the library object.
777 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
778 ;;
779 esac
780
781 # Recognize several different file suffixes.
782 # If the user specifies -o file.o, it is replaced with file.lo
783 xform='[cCFSifmso]'
784 case $libobj in
785 *.ada) xform=ada ;;
786 *.adb) xform=adb ;;
787 *.ads) xform=ads ;;
788 *.asm) xform=asm ;;
789 *.c++) xform=c++ ;;
790 *.cc) xform=cc ;;
791 *.ii) xform=ii ;;
792 *.class) xform=class ;;
793 *.cpp) xform=cpp ;;
794 *.cxx) xform=cxx ;;
795 *.[fF][09]?) xform=[fF][09]. ;;
796 *.for) xform=for ;;
797 *.java) xform=java ;;
798 *.obj) xform=obj ;;
799 esac
800
801 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
802
803 case $libobj in
804 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
805 *)
806 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
807 exit $EXIT_FAILURE
808 ;;
809 esac
810
811 func_infer_tag $base_compile
812
813 for arg in $later; do
814 case $arg in
815 -static)
816 build_old_libs=yes
817 continue
818 ;;
819
820 -prefer-pic)
821 pic_mode=yes
822 continue
823 ;;
824
825 -prefer-non-pic)
826 pic_mode=no
827 continue
828 ;;
829 esac
830 done
831
832 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
833 case $qlibobj in
834 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
835 qlibobj="\"$qlibobj\"" ;;
836 esac
837 test "X$libobj" != "X$qlibobj" \
838 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
839 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
840 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
841 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
842 if test "X$xdir" = "X$obj"; then
843 xdir=
844 else
845 xdir=$xdir/
846 fi
847 lobj=${xdir}$objdir/$objname
848
849 if test -z "$base_compile"; then
850 $echo "$modename: you must specify a compilation command" 1>&2
851 $echo "$help" 1>&2
852 exit $EXIT_FAILURE
853 fi
854
855 # Delete any leftover library objects.
856 if test "$build_old_libs" = yes; then
857 removelist="$obj $lobj $libobj ${libobj}T"
858 else
859 removelist="$lobj $libobj ${libobj}T"
860 fi
861
862 $run $rm $removelist
863 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
864
865 # On Cygwin there's no "real" PIC flag so we must build both object types
866 case $host_os in
867 cygwin* | mingw* | pw32* | os2*)
868 pic_mode=default
869 ;;
870 esac
871 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
872 # non-PIC code in shared libraries is not supported
873 pic_mode=default
874 fi
875
876 # Calculate the filename of the output object if compiler does
877 # not support -o with -c
878 if test "$compiler_c_o" = no; then
879 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
880 lockfile="$output_obj.lock"
881 removelist="$removelist $output_obj $lockfile"
882 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
883 else
884 output_obj=
885 need_locks=no
886 lockfile=
887 fi
888
889 # Lock this critical section if it is needed
890 # We use this script file to make the link, it avoids creating a new file
891 if test "$need_locks" = yes; then
892 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
893 $show "Waiting for $lockfile to be removed"
894 sleep 2
895 done
896 elif test "$need_locks" = warn; then
897 if test -f "$lockfile"; then
898 $echo "\
899*** ERROR, $lockfile exists and contains:
900`cat $lockfile 2>/dev/null`
901
902This indicates that another process is trying to use the same
903temporary object file, and libtool could not work around it because
904your compiler does not support \`-c' and \`-o' together. If you
905repeat this compilation, it may succeed, by chance, but you had better
906avoid parallel builds (make -j) in this platform, or get a better
907compiler."
908
909 $run $rm $removelist
910 exit $EXIT_FAILURE
911 fi
912 $echo "$srcfile" > "$lockfile"
913 fi
914
915 if test -n "$fix_srcfile_path"; then
916 eval srcfile=\"$fix_srcfile_path\"
917 fi
918 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
919 case $qsrcfile in
920 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
921 qsrcfile="\"$qsrcfile\"" ;;
922 esac
923
924 $run $rm "$libobj" "${libobj}T"
925
926 # Create a libtool object file (analogous to a ".la" file),
927 # but don't create it if we're doing a dry run.
928 test -z "$run" && cat > ${libobj}T <<EOF
929# $libobj - a libtool object file
930# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
931#
932# Please DO NOT delete this file!
933# It is necessary for linking the library.
934
935# Name of the PIC object.
936EOF
937
938 # Only build a PIC object if we are building libtool libraries.
939 if test "$build_libtool_libs" = yes; then
940 # Without this assignment, base_compile gets emptied.
941 fbsd_hideous_sh_bug=$base_compile
942
943 if test "$pic_mode" != no; then
944 command="$base_compile $qsrcfile $pic_flag"
945 else
946 # Don't build PIC code
947 command="$base_compile $qsrcfile"
948 fi
949
950 if test ! -d "${xdir}$objdir"; then
951 $show "$mkdir ${xdir}$objdir"
952 $run $mkdir ${xdir}$objdir
953 exit_status=$?
954 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
955 exit $exit_status
956 fi
957 fi
958
959 if test -z "$output_obj"; then
960 # Place PIC objects in $objdir
961 command="$command -o $lobj"
962 fi
963
964 $run $rm "$lobj" "$output_obj"
965
966 $show "$command"
967 if $run eval "$command"; then :
968 else
969 test -n "$output_obj" && $run $rm $removelist
970 exit $EXIT_FAILURE
971 fi
972
973 if test "$need_locks" = warn &&
974 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
975 $echo "\
976*** ERROR, $lockfile contains:
977`cat $lockfile 2>/dev/null`
978
979but it should contain:
980$srcfile
981
982This indicates that another process is trying to use the same
983temporary object file, and libtool could not work around it because
984your compiler does not support \`-c' and \`-o' together. If you
985repeat this compilation, it may succeed, by chance, but you had better
986avoid parallel builds (make -j) in this platform, or get a better
987compiler."
988
989 $run $rm $removelist
990 exit $EXIT_FAILURE
991 fi
992
993 # Just move the object if needed, then go on to compile the next one
994 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
995 $show "$mv $output_obj $lobj"
996 if $run $mv $output_obj $lobj; then :
997 else
998 error=$?
999 $run $rm $removelist
1000 exit $error
1001 fi
1002 fi
1003
1004 # Append the name of the PIC object to the libtool object file.
1005 test -z "$run" && cat >> ${libobj}T <<EOF
1006pic_object='$objdir/$objname'
1007
1008EOF
1009
1010 # Allow error messages only from the first compilation.
1011 if test "$suppress_opt" = yes; then
1012 suppress_output=' >/dev/null 2>&1'
1013 fi
1014 else
1015 # No PIC object so indicate it doesn't exist in the libtool
1016 # object file.
1017 test -z "$run" && cat >> ${libobj}T <<EOF
1018pic_object=none
1019
1020EOF
1021 fi
1022
1023 # Only build a position-dependent object if we build old libraries.
1024 if test "$build_old_libs" = yes; then
1025 if test "$pic_mode" != yes; then
1026 # Don't build PIC code
1027 command="$base_compile $qsrcfile"
1028 else
1029 command="$base_compile $qsrcfile $pic_flag"
1030 fi
1031 if test "$compiler_c_o" = yes; then
1032 command="$command -o $obj"
1033 fi
1034
1035 # Suppress compiler output if we already did a PIC compilation.
1036 command="$command$suppress_output"
1037 $run $rm "$obj" "$output_obj"
1038 $show "$command"
1039 if $run eval "$command"; then :
1040 else
1041 $run $rm $removelist
1042 exit $EXIT_FAILURE
1043 fi
1044
1045 if test "$need_locks" = warn &&
1046 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1047 $echo "\
1048*** ERROR, $lockfile contains:
1049`cat $lockfile 2>/dev/null`
1050
1051but it should contain:
1052$srcfile
1053
1054This indicates that another process is trying to use the same
1055temporary object file, and libtool could not work around it because
1056your compiler does not support \`-c' and \`-o' together. If you
1057repeat this compilation, it may succeed, by chance, but you had better
1058avoid parallel builds (make -j) in this platform, or get a better
1059compiler."
1060
1061 $run $rm $removelist
1062 exit $EXIT_FAILURE
1063 fi
1064
1065 # Just move the object if needed
1066 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1067 $show "$mv $output_obj $obj"
1068 if $run $mv $output_obj $obj; then :
1069 else
1070 error=$?
1071 $run $rm $removelist
1072 exit $error
1073 fi
1074 fi
1075
1076 # Append the name of the non-PIC object the libtool object file.
1077 # Only append if the libtool object file exists.
1078 test -z "$run" && cat >> ${libobj}T <<EOF
1079# Name of the non-PIC object.
1080non_pic_object='$objname'
1081
1082EOF
1083 else
1084 # Append the name of the non-PIC object the libtool object file.
1085 # Only append if the libtool object file exists.
1086 test -z "$run" && cat >> ${libobj}T <<EOF
1087# Name of the non-PIC object.
1088non_pic_object=none
1089
1090EOF
1091 fi
1092
1093 $run $mv "${libobj}T" "${libobj}"
1094
1095 # Unlock the critical section if it was locked
1096 if test "$need_locks" != no; then
1097 $run $rm "$lockfile"
1098 fi
1099
1100 exit $EXIT_SUCCESS
1101 ;;
1102
1103 # libtool link mode
1104 link | relink)
1105 modename="$modename: link"
1106 case $host in
1107 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1108 # It is impossible to link a dll without this setting, and
1109 # we shouldn't force the makefile maintainer to figure out
1110 # which system we are compiling for in order to pass an extra
1111 # flag for every libtool invocation.
1112 # allow_undefined=no
1113
1114 # FIXME: Unfortunately, there are problems with the above when trying
1115 # to make a dll which has undefined symbols, in which case not
1116 # even a static library is built. For now, we need to specify
1117 # -no-undefined on the libtool link line when we can be certain
1118 # that all symbols are satisfied, otherwise we get a static library.
1119 allow_undefined=yes
1120 ;;
1121 *)
1122 allow_undefined=yes
1123 ;;
1124 esac
1125 libtool_args="$nonopt"
1126 base_compile="$nonopt $@"
1127 compile_command="$nonopt"
1128 finalize_command="$nonopt"
1129
1130 compile_rpath=
1131 finalize_rpath=
1132 compile_shlibpath=
1133 finalize_shlibpath=
1134 convenience=
1135 old_convenience=
1136 deplibs=
1137 old_deplibs=
1138 compiler_flags=
1139 linker_flags=
1140 dllsearchpath=
1141 lib_search_path=`pwd`
1142 inst_prefix_dir=
1143
1144 avoid_version=no
1145 dlfiles=
1146 dlprefiles=
1147 dlself=no
1148 export_dynamic=no
1149 export_symbols=
1150 export_symbols_regex=
1151 generated=
1152 libobjs=
1153 ltlibs=
1154 module=no
1155 no_install=no
1156 objs=
1157 non_pic_objects=
1158 notinst_path= # paths that contain not-installed libtool libraries
1159 precious_files_regex=
1160 prefer_static_libs=no
1161 preload=no
1162 prev=
1163 prevarg=
1164 release=
1165 rpath=
1166 xrpath=
1167 perm_rpath=
1168 temp_rpath=
1169 thread_safe=no
1170 vinfo=
1171 vinfo_number=no
1172
1173 func_infer_tag $base_compile
1174
1175 # We need to know -static, to get the right output filenames.
1176 for arg
1177 do
1178 case $arg in
1179 -all-static | -static | -static-libtool-libs)
1180 case $arg in
1181 -all-static)
1182 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1183 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1184 fi
1185 if test -n "$link_static_flag"; then
1186 dlopen_self=$dlopen_self_static
1187 fi
1188 prefer_static_libs=yes
1189 ;;
1190 -static)
1191 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1193 fi
1194 prefer_static_libs=built
1195 ;;
1196 -static-libtool-libs)
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1199 fi
1200 prefer_static_libs=yes
1201 ;;
1202 esac
1203 build_libtool_libs=no
1204 build_old_libs=yes
1205 break
1206 ;;
1207 esac
1208 done
1209
1210 # See if our shared archives depend on static archives.
1211 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1212
1213 # Go through the arguments, transforming them on the way.
1214 while test "$#" -gt 0; do
1215 arg="$1"
1216 shift
1217 case $arg in
1218 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1219 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1220 ;;
1221 *) qarg=$arg ;;
1222 esac
1223 libtool_args="$libtool_args $qarg"
1224
1225 # If the previous option needs an argument, assign it.
1226 if test -n "$prev"; then
1227 case $prev in
1228 output)
1229 compile_command="$compile_command @OUTPUT@"
1230 finalize_command="$finalize_command @OUTPUT@"
1231 ;;
1232 esac
1233
1234 case $prev in
1235 dlfiles|dlprefiles)
1236 if test "$preload" = no; then
1237 # Add the symbol object into the linking commands.
1238 compile_command="$compile_command @SYMFILE@"
1239 finalize_command="$finalize_command @SYMFILE@"
1240 preload=yes
1241 fi
1242 case $arg in
1243 *.la | *.lo) ;; # We handle these cases below.
1244 force)
1245 if test "$dlself" = no; then
1246 dlself=needless
1247 export_dynamic=yes
1248 fi
1249 prev=
1250 continue
1251 ;;
1252 self)
1253 if test "$prev" = dlprefiles; then
1254 dlself=yes
1255 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1256 dlself=yes
1257 else
1258 dlself=needless
1259 export_dynamic=yes
1260 fi
1261 prev=
1262 continue
1263 ;;
1264 *)
1265 if test "$prev" = dlfiles; then
1266 dlfiles="$dlfiles $arg"
1267 else
1268 dlprefiles="$dlprefiles $arg"
1269 fi
1270 prev=
1271 continue
1272 ;;
1273 esac
1274 ;;
1275 expsyms)
1276 export_symbols="$arg"
1277 if test ! -f "$arg"; then
1278 $echo "$modename: symbol file \`$arg' does not exist"
1279 exit $EXIT_FAILURE
1280 fi
1281 prev=
1282 continue
1283 ;;
1284 expsyms_regex)
1285 export_symbols_regex="$arg"
1286 prev=
1287 continue
1288 ;;
1289 inst_prefix)
1290 inst_prefix_dir="$arg"
1291 prev=
1292 continue
1293 ;;
1294 precious_regex)
1295 precious_files_regex="$arg"
1296 prev=
1297 continue
1298 ;;
1299 release)
1300 release="-$arg"
1301 prev=
1302 continue
1303 ;;
1304 objectlist)
1305 if test -f "$arg"; then
1306 save_arg=$arg
1307 moreargs=
1308 for fil in `cat $save_arg`
1309 do
1310# moreargs="$moreargs $fil"
1311 arg=$fil
1312 # A libtool-controlled object.
1313
1314 # Check to see that this really is a libtool object.
1315 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1316 pic_object=
1317 non_pic_object=
1318
1319 # Read the .lo file
1320 # If there is no directory component, then add one.
1321 case $arg in
1322 */* | *\\*) . $arg ;;
1323 *) . ./$arg ;;
1324 esac
1325
1326 if test -z "$pic_object" || \
1327 test -z "$non_pic_object" ||
1328 test "$pic_object" = none && \
1329 test "$non_pic_object" = none; then
1330 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1331 exit $EXIT_FAILURE
1332 fi
1333
1334 # Extract subdirectory from the argument.
1335 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1336 if test "X$xdir" = "X$arg"; then
1337 xdir=
1338 else
1339 xdir="$xdir/"
1340 fi
1341
1342 if test "$pic_object" != none; then
1343 # Prepend the subdirectory the object is found in.
1344 pic_object="$xdir$pic_object"
1345
1346 if test "$prev" = dlfiles; then
1347 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1348 dlfiles="$dlfiles $pic_object"
1349 prev=
1350 continue
1351 else
1352 # If libtool objects are unsupported, then we need to preload.
1353 prev=dlprefiles
1354 fi
1355 fi
1356
1357 # CHECK ME: I think I busted this. -Ossama
1358 if test "$prev" = dlprefiles; then
1359 # Preload the old-style object.
1360 dlprefiles="$dlprefiles $pic_object"
1361 prev=
1362 fi
1363
1364 # A PIC object.
1365 libobjs="$libobjs $pic_object"
1366 arg="$pic_object"
1367 fi
1368
1369 # Non-PIC object.
1370 if test "$non_pic_object" != none; then
1371 # Prepend the subdirectory the object is found in.
1372 non_pic_object="$xdir$non_pic_object"
1373
1374 # A standard non-PIC object
1375 non_pic_objects="$non_pic_objects $non_pic_object"
1376 if test -z "$pic_object" || test "$pic_object" = none ; then
1377 arg="$non_pic_object"
1378 fi
1379 else
1380 # If the PIC object exists, use it instead.
1381 # $xdir was prepended to $pic_object above.
1382 non_pic_object="$pic_object"
1383 non_pic_objects="$non_pic_objects $non_pic_object"
1384 fi
1385 else
1386 # Only an error if not doing a dry-run.
1387 if test -z "$run"; then
1388 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1389 exit $EXIT_FAILURE
1390 else
1391 # Dry-run case.
1392
1393 # Extract subdirectory from the argument.
1394 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1395 if test "X$xdir" = "X$arg"; then
1396 xdir=
1397 else
1398 xdir="$xdir/"
1399 fi
1400
1401 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1402 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1403 libobjs="$libobjs $pic_object"
1404 non_pic_objects="$non_pic_objects $non_pic_object"
1405 fi
1406 fi
1407 done
1408 else
1409 $echo "$modename: link input file \`$save_arg' does not exist"
1410 exit $EXIT_FAILURE
1411 fi
1412 arg=$save_arg
1413 prev=
1414 continue
1415 ;;
1416 rpath | xrpath)
1417 # We need an absolute path.
1418 case $arg in
1419 [\\/]* | [A-Za-z]:[\\/]*) ;;
1420 *)
1421 $echo "$modename: only absolute run-paths are allowed" 1>&2
1422 exit $EXIT_FAILURE
1423 ;;
1424 esac
1425 if test "$prev" = rpath; then
1426 case "$rpath " in
1427 *" $arg "*) ;;
1428 *) rpath="$rpath $arg" ;;
1429 esac
1430 else
1431 case "$xrpath " in
1432 *" $arg "*) ;;
1433 *) xrpath="$xrpath $arg" ;;
1434 esac
1435 fi
1436 prev=
1437 continue
1438 ;;
1439 xcompiler)
1440 compiler_flags="$compiler_flags $qarg"
1441 prev=
1442 compile_command="$compile_command $qarg"
1443 finalize_command="$finalize_command $qarg"
1444 continue
1445 ;;
1446 xlinker)
1447 linker_flags="$linker_flags $qarg"
1448 compiler_flags="$compiler_flags $wl$qarg"
1449 prev=
1450 compile_command="$compile_command $wl$qarg"
1451 finalize_command="$finalize_command $wl$qarg"
1452 continue
1453 ;;
1454 xcclinker)
1455 linker_flags="$linker_flags $qarg"
1456 compiler_flags="$compiler_flags $qarg"
1457 prev=
1458 compile_command="$compile_command $qarg"
1459 finalize_command="$finalize_command $qarg"
1460 continue
1461 ;;
1462 shrext)
1463 shrext_cmds="$arg"
1464 prev=
1465 continue
1466 ;;
1467 darwin_framework|darwin_framework_skip)
1468 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1469 compile_command="$compile_command $arg"
1470 finalize_command="$finalize_command $arg"
1471 prev=
1472 continue
1473 ;;
1474 *)
1475 eval "$prev=\"\$arg\""
1476 prev=
1477 continue
1478 ;;
1479 esac
1480 fi # test -n "$prev"
1481
1482 prevarg="$arg"
1483
1484 case $arg in
1485 -all-static)
1486 if test -n "$link_static_flag"; then
1487 compile_command="$compile_command $link_static_flag"
1488 finalize_command="$finalize_command $link_static_flag"
1489 fi
1490 continue
1491 ;;
1492
1493 -allow-undefined)
1494 # FIXME: remove this flag sometime in the future.
1495 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1496 continue
1497 ;;
1498
1499 -avoid-version)
1500 avoid_version=yes
1501 continue
1502 ;;
1503
1504 -dlopen)
1505 prev=dlfiles
1506 continue
1507 ;;
1508
1509 -dlpreopen)
1510 prev=dlprefiles
1511 continue
1512 ;;
1513
1514 -export-dynamic)
1515 export_dynamic=yes
1516 continue
1517 ;;
1518
1519 -export-symbols | -export-symbols-regex)
1520 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1521 $echo "$modename: more than one -exported-symbols argument is not allowed"
1522 exit $EXIT_FAILURE
1523 fi
1524 if test "X$arg" = "X-export-symbols"; then
1525 prev=expsyms
1526 else
1527 prev=expsyms_regex
1528 fi
1529 continue
1530 ;;
1531
1532 -framework|-arch|-isysroot)
1533 case " $CC " in
1534 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1535 prev=darwin_framework_skip ;;
1536 *) compiler_flags="$compiler_flags $arg"
1537 prev=darwin_framework ;;
1538 esac
1539 compile_command="$compile_command $arg"
1540 finalize_command="$finalize_command $arg"
1541 continue
1542 ;;
1543
1544 -inst-prefix-dir)
1545 prev=inst_prefix
1546 continue
1547 ;;
1548
1549 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1550 # so, if we see these flags be careful not to treat them like -L
1551 -L[A-Z][A-Z]*:*)
1552 case $with_gcc/$host in
1553 no/*-*-irix* | /*-*-irix*)
1554 compile_command="$compile_command $arg"
1555 finalize_command="$finalize_command $arg"
1556 ;;
1557 esac
1558 continue
1559 ;;
1560
1561 -L*)
1562 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1563 # We need an absolute path.
1564 case $dir in
1565 [\\/]* | [A-Za-z]:[\\/]*) ;;
1566 *)
1567 absdir=`cd "$dir" && pwd`
1568 if test -z "$absdir"; then
1569 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1570 absdir="$dir"
1571 notinst_path="$notinst_path $dir"
1572 fi
1573 dir="$absdir"
1574 ;;
1575 esac
1576 case "$deplibs " in
1577 *" -L$dir "*) ;;
1578 *)
1579 deplibs="$deplibs -L$dir"
1580 lib_search_path="$lib_search_path $dir"
1581 ;;
1582 esac
1583 case $host in
1584 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1585 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1586 case :$dllsearchpath: in
1587 *":$dir:"*) ;;
1588 *) dllsearchpath="$dllsearchpath:$dir";;
1589 esac
1590 case :$dllsearchpath: in
1591 *":$testbindir:"*) ;;
1592 *) dllsearchpath="$dllsearchpath:$testbindir";;
1593 esac
1594 ;;
1595 esac
1596 continue
1597 ;;
1598
1599 -l*)
1600 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1601 case $host in
1602 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1603 # These systems don't actually have a C or math library (as such)
1604 continue
1605 ;;
1606 *-*-os2*)
1607 # These systems don't actually have a C library (as such)
1608 test "X$arg" = "X-lc" && continue
1609 ;;
1610 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1611 # Do not include libc due to us having libc/libc_r.
1612 test "X$arg" = "X-lc" && continue
1613 ;;
1614 *-*-rhapsody* | *-*-darwin1.[012])
1615 # Rhapsody C and math libraries are in the System framework
1616 deplibs="$deplibs -framework System"
1617 continue
1618 ;;
1619 *-*-sco3.2v5* | *-*-sco5v6*)
1620 # Causes problems with __ctype
1621 test "X$arg" = "X-lc" && continue
1622 ;;
1623 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1624 # Compiler inserts libc in the correct place for threads to work
1625 test "X$arg" = "X-lc" && continue
1626 ;;
1627 esac
1628 elif test "X$arg" = "X-lc_r"; then
1629 case $host in
1630 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1631 # Do not include libc_r directly, use -pthread flag.
1632 continue
1633 ;;
1634 esac
1635 fi
1636 deplibs="$deplibs $arg"
1637 continue
1638 ;;
1639
1640 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1641 # classes, name mangling, and exception handling.
1642 -model)
1643 compile_command="$compile_command $arg"
1644 compiler_flags="$compiler_flags $arg"
1645 finalize_command="$finalize_command $arg"
1646 prev=xcompiler
1647 continue
1648 ;;
1649
1650 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1651 compiler_flags="$compiler_flags $arg"
1652 compile_command="$compile_command $arg"
1653 finalize_command="$finalize_command $arg"
1654 continue
1655 ;;
1656
1657 -module)
1658 module=yes
1659 continue
1660 ;;
1661
1662 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1663 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1664 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1665 # +DA*, +DD* enable 64-bit mode on the HP compiler
1666 # -q* pass through compiler args for the IBM compiler
1667 # -m* pass through architecture-specific compiler args for GCC
1668 # -m*, -t[45]*, -txscale* pass through architecture-specific
1669 # compiler args for GCC
1670 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1671 # -F/path gives path to uninstalled frameworks, gcc on darwin
1672 # @file GCC response files
1673 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1674 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1675
1676 # Unknown arguments in both finalize_command and compile_command need
1677 # to be aesthetically quoted because they are evaled later.
1678 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1679 case $arg in
1680 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1681 arg="\"$arg\""
1682 ;;
1683 esac
1684 compile_command="$compile_command $arg"
1685 finalize_command="$finalize_command $arg"
1686 compiler_flags="$compiler_flags $arg"
1687 continue
1688 ;;
1689
1690 -shrext)
1691 prev=shrext
1692 continue
1693 ;;
1694
1695 -no-fast-install)
1696 fast_install=no
1697 continue
1698 ;;
1699
1700 -no-install)
1701 case $host in
1702 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1703 # The PATH hackery in wrapper scripts is required on Windows
1704 # and Darwin in order for the loader to find any dlls it needs.
1705 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1706 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1707 fast_install=no
1708 ;;
1709 *) no_install=yes ;;
1710 esac
1711 continue
1712 ;;
1713
1714 -no-undefined)
1715 allow_undefined=no
1716 continue
1717 ;;
1718
1719 -objectlist)
1720 prev=objectlist
1721 continue
1722 ;;
1723
1724 -o) prev=output ;;
1725
1726 -precious-files-regex)
1727 prev=precious_regex
1728 continue
1729 ;;
1730
1731 -release)
1732 prev=release
1733 continue
1734 ;;
1735
1736 -rpath)
1737 prev=rpath
1738 continue
1739 ;;
1740
1741 -R)
1742 prev=xrpath
1743 continue
1744 ;;
1745
1746 -R*)
1747 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1748 # We need an absolute path.
1749 case $dir in
1750 [\\/]* | [A-Za-z]:[\\/]*) ;;
1751 *)
1752 $echo "$modename: only absolute run-paths are allowed" 1>&2
1753 exit $EXIT_FAILURE
1754 ;;
1755 esac
1756 case "$xrpath " in
1757 *" $dir "*) ;;
1758 *) xrpath="$xrpath $dir" ;;
1759 esac
1760 continue
1761 ;;
1762
1763 -static | -static-libtool-libs)
1764 # The effects of -static are defined in a previous loop.
1765 # We used to do the same as -all-static on platforms that
1766 # didn't have a PIC flag, but the assumption that the effects
1767 # would be equivalent was wrong. It would break on at least
1768 # Digital Unix and AIX.
1769 continue
1770 ;;
1771
1772 -thread-safe)
1773 thread_safe=yes
1774 continue
1775 ;;
1776
1777 -version-info)
1778 prev=vinfo
1779 continue
1780 ;;
1781 -version-number)
1782 prev=vinfo
1783 vinfo_number=yes
1784 continue
1785 ;;
1786
1787 -Wc,*)
1788 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1789 arg=
1790 save_ifs="$IFS"; IFS=','
1791 for flag in $args; do
1792 IFS="$save_ifs"
1793 case $flag in
1794 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1795 flag="\"$flag\""
1796 ;;
1797 esac
1798 arg="$arg $wl$flag"
1799 compiler_flags="$compiler_flags $flag"
1800 done
1801 IFS="$save_ifs"
1802 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1803 ;;
1804
1805 -Wl,*)
1806 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1807 arg=
1808 save_ifs="$IFS"; IFS=','
1809 for flag in $args; do
1810 IFS="$save_ifs"
1811 case $flag in
1812 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1813 flag="\"$flag\""
1814 ;;
1815 esac
1816 arg="$arg $wl$flag"
1817 compiler_flags="$compiler_flags $wl$flag"
1818 linker_flags="$linker_flags $flag"
1819 done
1820 IFS="$save_ifs"
1821 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1822 ;;
1823
1824 -Xcompiler)
1825 prev=xcompiler
1826 continue
1827 ;;
1828
1829 -Xlinker)
1830 prev=xlinker
1831 continue
1832 ;;
1833
1834 -XCClinker)
1835 prev=xcclinker
1836 continue
1837 ;;
1838
1839 # Some other compiler flag.
1840 -* | +*)
1841 # Unknown arguments in both finalize_command and compile_command need
1842 # to be aesthetically quoted because they are evaled later.
1843 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1844 case $arg in
1845 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1846 arg="\"$arg\""
1847 ;;
1848 esac
1849 ;;
1850
1851 *.$objext)
1852 # A standard object.
1853 objs="$objs $arg"
1854 ;;
1855
1856 *.lo)
1857 # A libtool-controlled object.
1858
1859 # Check to see that this really is a libtool object.
1860 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1861 pic_object=
1862 non_pic_object=
1863
1864 # Read the .lo file
1865 # If there is no directory component, then add one.
1866 case $arg in
1867 */* | *\\*) . $arg ;;
1868 *) . ./$arg ;;
1869 esac
1870
1871 if test -z "$pic_object" || \
1872 test -z "$non_pic_object" ||
1873 test "$pic_object" = none && \
1874 test "$non_pic_object" = none; then
1875 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1876 exit $EXIT_FAILURE
1877 fi
1878
1879 # Extract subdirectory from the argument.
1880 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1881 if test "X$xdir" = "X$arg"; then
1882 xdir=
1883 else
1884 xdir="$xdir/"
1885 fi
1886
1887 if test "$pic_object" != none; then
1888 # Prepend the subdirectory the object is found in.
1889 pic_object="$xdir$pic_object"
1890
1891 if test "$prev" = dlfiles; then
1892 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1893 dlfiles="$dlfiles $pic_object"
1894 prev=
1895 continue
1896 else
1897 # If libtool objects are unsupported, then we need to preload.
1898 prev=dlprefiles
1899 fi
1900 fi
1901
1902 # CHECK ME: I think I busted this. -Ossama
1903 if test "$prev" = dlprefiles; then
1904 # Preload the old-style object.
1905 dlprefiles="$dlprefiles $pic_object"
1906 prev=
1907 fi
1908
1909 # A PIC object.
1910 libobjs="$libobjs $pic_object"
1911 arg="$pic_object"
1912 fi
1913
1914 # Non-PIC object.
1915 if test "$non_pic_object" != none; then
1916 # Prepend the subdirectory the object is found in.
1917 non_pic_object="$xdir$non_pic_object"
1918
1919 # A standard non-PIC object
1920 non_pic_objects="$non_pic_objects $non_pic_object"
1921 if test -z "$pic_object" || test "$pic_object" = none ; then
1922 arg="$non_pic_object"
1923 fi
1924 else
1925 # If the PIC object exists, use it instead.
1926 # $xdir was prepended to $pic_object above.
1927 non_pic_object="$pic_object"
1928 non_pic_objects="$non_pic_objects $non_pic_object"
1929 fi
1930 else
1931 # Only an error if not doing a dry-run.
1932 if test -z "$run"; then
1933 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1934 exit $EXIT_FAILURE
1935 else
1936 # Dry-run case.
1937
1938 # Extract subdirectory from the argument.
1939 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1940 if test "X$xdir" = "X$arg"; then
1941 xdir=
1942 else
1943 xdir="$xdir/"
1944 fi
1945
1946 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1947 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1948 libobjs="$libobjs $pic_object"
1949 non_pic_objects="$non_pic_objects $non_pic_object"
1950 fi
1951 fi
1952 ;;
1953
1954 *.$libext)
1955 # An archive.
1956 deplibs="$deplibs $arg"
1957 old_deplibs="$old_deplibs $arg"
1958 continue
1959 ;;
1960
1961 *.la)
1962 # A libtool-controlled library.
1963
1964 if test "$prev" = dlfiles; then
1965 # This library was specified with -dlopen.
1966 dlfiles="$dlfiles $arg"
1967 prev=
1968 elif test "$prev" = dlprefiles; then
1969 # The library was specified with -dlpreopen.
1970 dlprefiles="$dlprefiles $arg"
1971 prev=
1972 else
1973 deplibs="$deplibs $arg"
1974 fi
1975 continue
1976 ;;
1977
1978 # Some other compiler argument.
1979 *)
1980 # Unknown arguments in both finalize_command and compile_command need
1981 # to be aesthetically quoted because they are evaled later.
1982 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1983 case $arg in
1984 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1985 arg="\"$arg\""
1986 ;;
1987 esac
1988 ;;
1989 esac # arg
1990
1991 # Now actually substitute the argument into the commands.
1992 if test -n "$arg"; then
1993 compile_command="$compile_command $arg"
1994 finalize_command="$finalize_command $arg"
1995 fi
1996 done # argument parsing loop
1997
1998 if test -n "$prev"; then
1999 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2000 $echo "$help" 1>&2
2001 exit $EXIT_FAILURE
2002 fi
2003
2004 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2005 eval arg=\"$export_dynamic_flag_spec\"
2006 compile_command="$compile_command $arg"
2007 finalize_command="$finalize_command $arg"
2008 fi
2009
2010 oldlibs=
2011 # calculate the name of the file, without its directory
2012 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2013 libobjs_save="$libobjs"
2014
2015 if test -n "$shlibpath_var"; then
2016 # get the directories listed in $shlibpath_var
2017 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2018 else
2019 shlib_search_path=
2020 fi
2021 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2022 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2023
2024 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2025 if test "X$output_objdir" = "X$output"; then
2026 output_objdir="$objdir"
2027 else
2028 output_objdir="$output_objdir/$objdir"
2029 fi
2030 # Create the object directory.
2031 if test ! -d "$output_objdir"; then
2032 $show "$mkdir $output_objdir"
2033 $run $mkdir $output_objdir
2034 exit_status=$?
2035 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2036 exit $exit_status
2037 fi
2038 fi
2039
2040 # Determine the type of output
2041 case $output in
2042 "")
2043 $echo "$modename: you must specify an output file" 1>&2
2044 $echo "$help" 1>&2
2045 exit $EXIT_FAILURE
2046 ;;
2047 *.$libext) linkmode=oldlib ;;
2048 *.lo | *.$objext) linkmode=obj ;;
2049 *.la) linkmode=lib ;;
2050 *) linkmode=prog ;; # Anything else should be a program.
2051 esac
2052
2053 case $host in
2054 *cygwin* | *mingw* | *pw32*)
2055 # don't eliminate duplications in $postdeps and $predeps
2056 duplicate_compiler_generated_deps=yes
2057 ;;
2058 *)
2059 duplicate_compiler_generated_deps=$duplicate_deps
2060 ;;
2061 esac
2062 specialdeplibs=
2063
2064 libs=
2065 # Find all interdependent deplibs by searching for libraries
2066 # that are linked more than once (e.g. -la -lb -la)
2067 for deplib in $deplibs; do
2068 if test "X$duplicate_deps" = "Xyes" ; then
2069 case "$libs " in
2070 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2071 esac
2072 fi
2073 libs="$libs $deplib"
2074 done
2075
2076 if test "$linkmode" = lib; then
2077 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2078
2079 # Compute libraries that are listed more than once in $predeps
2080 # $postdeps and mark them as special (i.e., whose duplicates are
2081 # not to be eliminated).
2082 pre_post_deps=
2083 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2084 for pre_post_dep in $predeps $postdeps; do
2085 case "$pre_post_deps " in
2086 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2087 esac
2088 pre_post_deps="$pre_post_deps $pre_post_dep"
2089 done
2090 fi
2091 pre_post_deps=
2092 fi
2093
2094 deplibs=
2095 newdependency_libs=
2096 newlib_search_path=
2097 need_relink=no # whether we're linking any uninstalled libtool libraries
2098 notinst_deplibs= # not-installed libtool libraries
2099 case $linkmode in
2100 lib)
2101 passes="conv link"
2102 for file in $dlfiles $dlprefiles; do
2103 case $file in
2104 *.la) ;;
2105 *)
2106 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2107 exit $EXIT_FAILURE
2108 ;;
2109 esac
2110 done
2111 ;;
2112 prog)
2113 compile_deplibs=
2114 finalize_deplibs=
2115 alldeplibs=no
2116 newdlfiles=
2117 newdlprefiles=
2118 passes="conv scan dlopen dlpreopen link"
2119 ;;
2120 *) passes="conv"
2121 ;;
2122 esac
2123 for pass in $passes; do
2124 if test "$linkmode,$pass" = "lib,link" ||
2125 test "$linkmode,$pass" = "prog,scan"; then
2126 libs="$deplibs"
2127 deplibs=
2128 fi
2129 if test "$linkmode" = prog; then
2130 case $pass in
2131 dlopen) libs="$dlfiles" ;;
2132 dlpreopen) libs="$dlprefiles" ;;
2133 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2134 esac
2135 fi
2136 if test "$pass" = dlopen; then
2137 # Collect dlpreopened libraries
2138 save_deplibs="$deplibs"
2139 deplibs=
2140 fi
2141 for deplib in $libs; do
2142 lib=
2143 found=no
2144 case $deplib in
2145 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2146 if test "$linkmode,$pass" = "prog,link"; then
2147 compile_deplibs="$deplib $compile_deplibs"
2148 finalize_deplibs="$deplib $finalize_deplibs"
2149 else
2150 compiler_flags="$compiler_flags $deplib"
2151 fi
2152 continue
2153 ;;
2154 -l*)
2155 if test "$linkmode" != lib && test "$linkmode" != prog; then
2156 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2157 continue
2158 fi
2159 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2160 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2161 for search_ext in .la $std_shrext .so .a; do
2162 # Search the libtool library
2163 lib="$searchdir/lib${name}${search_ext}"
2164 if test -f "$lib"; then
2165 if test "$search_ext" = ".la"; then
2166 found=yes
2167 else
2168 found=no
2169 fi
2170 break 2
2171 fi
2172 done
2173 done
2174 if test "$found" != yes; then
2175 # deplib doesn't seem to be a libtool library
2176 if test "$linkmode,$pass" = "prog,link"; then
2177 compile_deplibs="$deplib $compile_deplibs"
2178 finalize_deplibs="$deplib $finalize_deplibs"
2179 else
2180 deplibs="$deplib $deplibs"
2181 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2182 fi
2183 continue
2184 else # deplib is a libtool library
2185 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2186 # We need to do some special things here, and not later.
2187 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2188 case " $predeps $postdeps " in
2189 *" $deplib "*)
2190 if (${SED} -e '2q' $lib |
2191 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2192 library_names=
2193 old_library=
2194 case $lib in
2195 */* | *\\*) . $lib ;;
2196 *) . ./$lib ;;
2197 esac
2198 for l in $old_library $library_names; do
2199 ll="$l"
2200 done
2201 if test "X$ll" = "X$old_library" ; then # only static version available
2202 found=no
2203 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2204 test "X$ladir" = "X$lib" && ladir="."
2205 lib=$ladir/$old_library
2206 if test "$linkmode,$pass" = "prog,link"; then
2207 compile_deplibs="$deplib $compile_deplibs"
2208 finalize_deplibs="$deplib $finalize_deplibs"
2209 else
2210 deplibs="$deplib $deplibs"
2211 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2212 fi
2213 continue
2214 fi
2215 fi
2216 ;;
2217 *) ;;
2218 esac
2219 fi
2220 fi
2221 ;; # -l
2222 -L*)
2223 case $linkmode in
2224 lib)
2225 deplibs="$deplib $deplibs"
2226 test "$pass" = conv && continue
2227 newdependency_libs="$deplib $newdependency_libs"
2228 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2229 ;;
2230 prog)
2231 if test "$pass" = conv; then
2232 deplibs="$deplib $deplibs"
2233 continue
2234 fi
2235 if test "$pass" = scan; then
2236 deplibs="$deplib $deplibs"
2237 else
2238 compile_deplibs="$deplib $compile_deplibs"
2239 finalize_deplibs="$deplib $finalize_deplibs"
2240 fi
2241 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2242 ;;
2243 *)
2244 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2245 ;;
2246 esac # linkmode
2247 continue
2248 ;; # -L
2249 -R*)
2250 if test "$pass" = link; then
2251 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2252 # Make sure the xrpath contains only unique directories.
2253 case "$xrpath " in
2254 *" $dir "*) ;;
2255 *) xrpath="$xrpath $dir" ;;
2256 esac
2257 fi
2258 deplibs="$deplib $deplibs"
2259 continue
2260 ;;
2261 *.la) lib="$deplib" ;;
2262 *.$libext)
2263 if test "$pass" = conv; then
2264 deplibs="$deplib $deplibs"
2265 continue
2266 fi
2267 case $linkmode in
2268 lib)
2269 valid_a_lib=no
2270 case $deplibs_check_method in
2271 match_pattern*)
2272 set dummy $deplibs_check_method
2273 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2274 if eval $echo \"$deplib\" 2>/dev/null \
2275 | $SED 10q \
2276 | $EGREP "$match_pattern_regex" > /dev/null; then
2277 valid_a_lib=yes
2278 fi
2279 ;;
2280 pass_all)
2281 valid_a_lib=yes
2282 ;;
2283 esac
2284 if test "$valid_a_lib" != yes; then
2285 $echo
2286 $echo "*** Warning: Trying to link with static lib archive $deplib."
2287 $echo "*** I have the capability to make that library automatically link in when"
2288 $echo "*** you link to this library. But I can only do this if you have a"
2289 $echo "*** shared version of the library, which you do not appear to have"
2290 $echo "*** because the file extensions .$libext of this argument makes me believe"
2291 $echo "*** that it is just a static archive that I should not used here."
2292 else
2293 $echo
2294 $echo "*** Warning: Linking the shared library $output against the"
2295 $echo "*** static library $deplib is not portable!"
2296 deplibs="$deplib $deplibs"
2297 fi
2298 continue
2299 ;;
2300 prog)
2301 if test "$pass" != link; then
2302 deplibs="$deplib $deplibs"
2303 else
2304 compile_deplibs="$deplib $compile_deplibs"
2305 finalize_deplibs="$deplib $finalize_deplibs"
2306 fi
2307 continue
2308 ;;
2309 esac # linkmode
2310 ;; # *.$libext
2311 *.lo | *.$objext)
2312 if test "$pass" = conv; then
2313 deplibs="$deplib $deplibs"
2314 elif test "$linkmode" = prog; then
2315 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2316 # If there is no dlopen support or we're linking statically,
2317 # we need to preload.
2318 newdlprefiles="$newdlprefiles $deplib"
2319 compile_deplibs="$deplib $compile_deplibs"
2320 finalize_deplibs="$deplib $finalize_deplibs"
2321 else
2322 newdlfiles="$newdlfiles $deplib"
2323 fi
2324 fi
2325 continue
2326 ;;
2327 %DEPLIBS%)
2328 alldeplibs=yes
2329 continue
2330 ;;
2331 esac # case $deplib
2332 if test "$found" = yes || test -f "$lib"; then :
2333 else
2334 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2335 exit $EXIT_FAILURE
2336 fi
2337
2338 # Check to see that this really is a libtool archive.
2339 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2340 else
2341 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2342 exit $EXIT_FAILURE
2343 fi
2344
2345 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2346 test "X$ladir" = "X$lib" && ladir="."
2347
2348 dlname=
2349 dlopen=
2350 dlpreopen=
2351 libdir=
2352 library_names=
2353 old_library=
2354 # If the library was installed with an old release of libtool,
2355 # it will not redefine variables installed, or shouldnotlink
2356 installed=yes
2357 shouldnotlink=no
2358 avoidtemprpath=
2359
2360
2361 # Read the .la file
2362 case $lib in
2363 */* | *\\*) . $lib ;;
2364 *) . ./$lib ;;
2365 esac
2366
2367 if test "$linkmode,$pass" = "lib,link" ||
2368 test "$linkmode,$pass" = "prog,scan" ||
2369 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2370 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2371 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2372 fi
2373
2374 if test "$pass" = conv; then
2375 # Only check for convenience libraries
2376 deplibs="$lib $deplibs"
2377 if test -z "$libdir"; then
2378 if test -z "$old_library"; then
2379 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2380 exit $EXIT_FAILURE
2381 fi
2382 # It is a libtool convenience library, so add in its objects.
2383 convenience="$convenience $ladir/$objdir/$old_library"
2384 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2385 tmp_libs=
2386 for deplib in $dependency_libs; do
2387 deplibs="$deplib $deplibs"
2388 if test "X$duplicate_deps" = "Xyes" ; then
2389 case "$tmp_libs " in
2390 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2391 esac
2392 fi
2393 tmp_libs="$tmp_libs $deplib"
2394 done
2395 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2396 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2397 exit $EXIT_FAILURE
2398 fi
2399 continue
2400 fi # $pass = conv
2401
2402
2403 # Get the name of the library we link against.
2404 linklib=
2405 for l in $old_library $library_names; do
2406 linklib="$l"
2407 done
2408 if test -z "$linklib"; then
2409 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2410 exit $EXIT_FAILURE
2411 fi
2412
2413 # This library was specified with -dlopen.
2414 if test "$pass" = dlopen; then
2415 if test -z "$libdir"; then
2416 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2417 exit $EXIT_FAILURE
2418 fi
2419 if test -z "$dlname" ||
2420 test "$dlopen_support" != yes ||
2421 test "$build_libtool_libs" = no; then
2422 # If there is no dlname, no dlopen support or we're linking
2423 # statically, we need to preload. We also need to preload any
2424 # dependent libraries so libltdl's deplib preloader doesn't
2425 # bomb out in the load deplibs phase.
2426 dlprefiles="$dlprefiles $lib $dependency_libs"
2427 else
2428 newdlfiles="$newdlfiles $lib"
2429 fi
2430 continue
2431 fi # $pass = dlopen
2432
2433 # We need an absolute path.
2434 case $ladir in
2435 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2436 *)
2437 abs_ladir=`cd "$ladir" && pwd`
2438 if test -z "$abs_ladir"; then
2439 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2440 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2441 abs_ladir="$ladir"
2442 fi
2443 ;;
2444 esac
2445 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2446
2447 # Find the relevant object directory and library name.
2448 if test "X$installed" = Xyes; then
2449 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2450 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2451 dir="$ladir"
2452 absdir="$abs_ladir"
2453 libdir="$abs_ladir"
2454 else
2455 dir="$libdir"
2456 absdir="$libdir"
2457 fi
2458 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2459 else
2460 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2461 dir="$ladir"
2462 absdir="$abs_ladir"
2463 # Remove this search path later
2464 notinst_path="$notinst_path $abs_ladir"
2465 else
2466 dir="$ladir/$objdir"
2467 absdir="$abs_ladir/$objdir"
2468 # Remove this search path later
2469 notinst_path="$notinst_path $abs_ladir"
2470 fi
2471 fi # $installed = yes
2472 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2473
2474 # This library was specified with -dlpreopen.
2475 if test "$pass" = dlpreopen; then
2476 if test -z "$libdir"; then
2477 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2478 exit $EXIT_FAILURE
2479 fi
2480 # Prefer using a static library (so that no silly _DYNAMIC symbols
2481 # are required to link).
2482 if test -n "$old_library"; then
2483 newdlprefiles="$newdlprefiles $dir/$old_library"
2484 # Otherwise, use the dlname, so that lt_dlopen finds it.
2485 elif test -n "$dlname"; then
2486 newdlprefiles="$newdlprefiles $dir/$dlname"
2487 else
2488 newdlprefiles="$newdlprefiles $dir/$linklib"
2489 fi
2490 fi # $pass = dlpreopen
2491
2492 if test -z "$libdir"; then
2493 # Link the convenience library
2494 if test "$linkmode" = lib; then
2495 deplibs="$dir/$old_library $deplibs"
2496 elif test "$linkmode,$pass" = "prog,link"; then
2497 compile_deplibs="$dir/$old_library $compile_deplibs"
2498 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2499 else
2500 deplibs="$lib $deplibs" # used for prog,scan pass
2501 fi
2502 continue
2503 fi
2504
2505
2506 if test "$linkmode" = prog && test "$pass" != link; then
2507 newlib_search_path="$newlib_search_path $ladir"
2508 deplibs="$lib $deplibs"
2509
2510 linkalldeplibs=no
2511 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2512 test "$build_libtool_libs" = no; then
2513 linkalldeplibs=yes
2514 fi
2515
2516 tmp_libs=
2517 for deplib in $dependency_libs; do
2518 case $deplib in
2519 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2520 esac
2521 # Need to link against all dependency_libs?
2522 if test "$linkalldeplibs" = yes; then
2523 deplibs="$deplib $deplibs"
2524 else
2525 # Need to hardcode shared library paths
2526 # or/and link against static libraries
2527 newdependency_libs="$deplib $newdependency_libs"
2528 fi
2529 if test "X$duplicate_deps" = "Xyes" ; then
2530 case "$tmp_libs " in
2531 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2532 esac
2533 fi
2534 tmp_libs="$tmp_libs $deplib"
2535 done # for deplib
2536 continue
2537 fi # $linkmode = prog...
2538
2539 if test "$linkmode,$pass" = "prog,link"; then
2540 if test -n "$library_names" &&
2541 { { test "$prefer_static_libs" = no ||
2542 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2543 test -z "$old_library"; }; then
2544 # We need to hardcode the library path
2545 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2546 # Make sure the rpath contains only unique directories.
2547 case "$temp_rpath " in
2548 *" $dir "*) ;;
2549 *" $absdir "*) ;;
2550 *) temp_rpath="$temp_rpath $absdir" ;;
2551 esac
2552 fi
2553
2554 # Hardcode the library path.
2555 # Skip directories that are in the system default run-time
2556 # search path.
2557 case " $sys_lib_dlsearch_path " in
2558 *" $absdir "*) ;;
2559 *)
2560 case "$compile_rpath " in
2561 *" $absdir "*) ;;
2562 *) compile_rpath="$compile_rpath $absdir"
2563 esac
2564 ;;
2565 esac
2566 case " $sys_lib_dlsearch_path " in
2567 *" $libdir "*) ;;
2568 *)
2569 case "$finalize_rpath " in
2570 *" $libdir "*) ;;
2571 *) finalize_rpath="$finalize_rpath $libdir"
2572 esac
2573 ;;
2574 esac
2575 fi # $linkmode,$pass = prog,link...
2576
2577 if test "$alldeplibs" = yes &&
2578 { test "$deplibs_check_method" = pass_all ||
2579 { test "$build_libtool_libs" = yes &&
2580 test -n "$library_names"; }; }; then
2581 # We only need to search for static libraries
2582 continue
2583 fi
2584 fi
2585
2586 link_static=no # Whether the deplib will be linked statically
2587 use_static_libs=$prefer_static_libs
2588 if test "$use_static_libs" = built && test "$installed" = yes ; then
2589 use_static_libs=no
2590 fi
2591 if test -n "$library_names" &&
2592 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2593 if test "$installed" = no; then
2594 notinst_deplibs="$notinst_deplibs $lib"
2595 need_relink=yes
2596 fi
2597 # This is a shared library
2598
2599 # Warn about portability, can't link against -module's on
2600 # some systems (darwin)
2601 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2602 $echo
2603 if test "$linkmode" = prog; then
2604 $echo "*** Warning: Linking the executable $output against the loadable module"
2605 else
2606 $echo "*** Warning: Linking the shared library $output against the loadable module"
2607 fi
2608 $echo "*** $linklib is not portable!"
2609 fi
2610 if test "$linkmode" = lib &&
2611 test "$hardcode_into_libs" = yes; then
2612 # Hardcode the library path.
2613 # Skip directories that are in the system default run-time
2614 # search path.
2615 case " $sys_lib_dlsearch_path " in
2616 *" $absdir "*) ;;
2617 *)
2618 case "$compile_rpath " in
2619 *" $absdir "*) ;;
2620 *) compile_rpath="$compile_rpath $absdir"
2621 esac
2622 ;;
2623 esac
2624 case " $sys_lib_dlsearch_path " in
2625 *" $libdir "*) ;;
2626 *)
2627 case "$finalize_rpath " in
2628 *" $libdir "*) ;;
2629 *) finalize_rpath="$finalize_rpath $libdir"
2630 esac
2631 ;;
2632 esac
2633 fi
2634
2635 if test -n "$old_archive_from_expsyms_cmds"; then
2636 # figure out the soname
2637 set dummy $library_names
2638 realname="$2"
2639 shift; shift
2640 libname=`eval \\$echo \"$libname_spec\"`
2641 # use dlname if we got it. it's perfectly good, no?
2642 if test -n "$dlname"; then
2643 soname="$dlname"
2644 elif test -n "$soname_spec"; then
2645 # bleh windows
2646 case $host in
2647 *cygwin* | mingw*)
2648 major=`expr $current - $age`
2649 versuffix="-$major"
2650 ;;
2651 esac
2652 eval soname=\"$soname_spec\"
2653 else
2654 soname="$realname"
2655 fi
2656
2657 # Make a new name for the extract_expsyms_cmds to use
2658 soroot="$soname"
2659 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2660 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2661
2662 # If the library has no export list, then create one now
2663 if test -f "$output_objdir/$soname-def"; then :
2664 else
2665 $show "extracting exported symbol list from \`$soname'"
2666 save_ifs="$IFS"; IFS='~'
2667 cmds=$extract_expsyms_cmds
2668 for cmd in $cmds; do
2669 IFS="$save_ifs"
2670 eval cmd=\"$cmd\"
2671 $show "$cmd"
2672 $run eval "$cmd" || exit $?
2673 done
2674 IFS="$save_ifs"
2675 fi
2676
2677 # Create $newlib
2678 if test -f "$output_objdir/$newlib"; then :; else
2679 $show "generating import library for \`$soname'"
2680 save_ifs="$IFS"; IFS='~'
2681 cmds=$old_archive_from_expsyms_cmds
2682 for cmd in $cmds; do
2683 IFS="$save_ifs"
2684 eval cmd=\"$cmd\"
2685 $show "$cmd"
2686 $run eval "$cmd" || exit $?
2687 done
2688 IFS="$save_ifs"
2689 fi
2690 # make sure the library variables are pointing to the new library
2691 dir=$output_objdir
2692 linklib=$newlib
2693 fi # test -n "$old_archive_from_expsyms_cmds"
2694
2695 if test "$linkmode" = prog || test "$mode" != relink; then
2696 add_shlibpath=
2697 add_dir=
2698 add=
2699 lib_linked=yes
2700 case $hardcode_action in
2701 immediate | unsupported)
2702 if test "$hardcode_direct" = no; then
2703 add="$dir/$linklib"
2704 case $host in
2705 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2706 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2707 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2708 *-*-unixware7*) add_dir="-L$dir" ;;
2709 *-*-darwin* )
2710 # if the lib is a module then we can not link against
2711 # it, someone is ignoring the new warnings I added
2712 if /usr/bin/file -L $add 2> /dev/null |
2713 $EGREP ": [^:]* bundle" >/dev/null ; then
2714 $echo "** Warning, lib $linklib is a module, not a shared library"
2715 if test -z "$old_library" ; then
2716 $echo
2717 $echo "** And there doesn't seem to be a static archive available"
2718 $echo "** The link will probably fail, sorry"
2719 else
2720 add="$dir/$old_library"
2721 fi
2722 fi
2723 esac
2724 elif test "$hardcode_minus_L" = no; then
2725 case $host in
2726 *-*-sunos*) add_shlibpath="$dir" ;;
2727 esac
2728 add_dir="-L$dir"
2729 add="-l$name"
2730 elif test "$hardcode_shlibpath_var" = no; then
2731 add_shlibpath="$dir"
2732 add="-l$name"
2733 else
2734 lib_linked=no
2735 fi
2736 ;;
2737 relink)
2738 if test "$hardcode_direct" = yes; then
2739 add="$dir/$linklib"
2740 elif test "$hardcode_minus_L" = yes; then
2741 add_dir="-L$dir"
2742 # Try looking first in the location we're being installed to.
2743 if test -n "$inst_prefix_dir"; then
2744 case $libdir in
2745 [\\/]*)
2746 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2747 ;;
2748 esac
2749 fi
2750 add="-l$name"
2751 elif test "$hardcode_shlibpath_var" = yes; then
2752 add_shlibpath="$dir"
2753 add="-l$name"
2754 else
2755 lib_linked=no
2756 fi
2757 ;;
2758 *) lib_linked=no ;;
2759 esac
2760
2761 if test "$lib_linked" != yes; then
2762 $echo "$modename: configuration error: unsupported hardcode properties"
2763 exit $EXIT_FAILURE
2764 fi
2765
2766 if test -n "$add_shlibpath"; then
2767 case :$compile_shlibpath: in
2768 *":$add_shlibpath:"*) ;;
2769 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2770 esac
2771 fi
2772 if test "$linkmode" = prog; then
2773 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2774 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2775 else
2776 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2777 test -n "$add" && deplibs="$add $deplibs"
2778 if test "$hardcode_direct" != yes && \
2779 test "$hardcode_minus_L" != yes && \
2780 test "$hardcode_shlibpath_var" = yes; then
2781 case :$finalize_shlibpath: in
2782 *":$libdir:"*) ;;
2783 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2784 esac
2785 fi
2786 fi
2787 fi
2788
2789 if test "$linkmode" = prog || test "$mode" = relink; then
2790 add_shlibpath=
2791 add_dir=
2792 add=
2793 # Finalize command for both is simple: just hardcode it.
2794 if test "$hardcode_direct" = yes; then
2795 add="$libdir/$linklib"
2796 elif test "$hardcode_minus_L" = yes; then
2797 add_dir="-L$libdir"
2798 add="-l$name"
2799 elif test "$hardcode_shlibpath_var" = yes; then
2800 case :$finalize_shlibpath: in
2801 *":$libdir:"*) ;;
2802 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2803 esac
2804 add="-l$name"
2805 elif test "$hardcode_automatic" = yes; then
2806 if test -n "$inst_prefix_dir" &&
2807 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2808 add="$inst_prefix_dir$libdir/$linklib"
2809 else
2810 add="$libdir/$linklib"
2811 fi
2812 else
2813 # We cannot seem to hardcode it, guess we'll fake it.
2814 add_dir="-L$libdir"
2815 # Try looking first in the location we're being installed to.
2816 if test -n "$inst_prefix_dir"; then
2817 case $libdir in
2818 [\\/]*)
2819 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2820 ;;
2821 esac
2822 fi
2823 add="-l$name"
2824 fi
2825
2826 if test "$linkmode" = prog; then
2827 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2828 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2829 else
2830 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2831 test -n "$add" && deplibs="$add $deplibs"
2832 fi
2833 fi
2834 elif test "$linkmode" = prog; then
2835 # Here we assume that one of hardcode_direct or hardcode_minus_L
2836 # is not unsupported. This is valid on all known static and
2837 # shared platforms.
2838 if test "$hardcode_direct" != unsupported; then
2839 test -n "$old_library" && linklib="$old_library"
2840 compile_deplibs="$dir/$linklib $compile_deplibs"
2841 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2842 else
2843 compile_deplibs="-l$name -L$dir $compile_deplibs"
2844 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2845 fi
2846 elif test "$build_libtool_libs" = yes; then
2847 # Not a shared library
2848 if test "$deplibs_check_method" != pass_all; then
2849 # We're trying link a shared library against a static one
2850 # but the system doesn't support it.
2851
2852 # Just print a warning and add the library to dependency_libs so
2853 # that the program can be linked against the static library.
2854 $echo
2855 $echo "*** Warning: This system can not link to static lib archive $lib."
2856 $echo "*** I have the capability to make that library automatically link in when"
2857 $echo "*** you link to this library. But I can only do this if you have a"
2858 $echo "*** shared version of the library, which you do not appear to have."
2859 if test "$module" = yes; then
2860 $echo "*** But as you try to build a module library, libtool will still create "
2861 $echo "*** a static module, that should work as long as the dlopening application"
2862 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2863 if test -z "$global_symbol_pipe"; then
2864 $echo
2865 $echo "*** However, this would only work if libtool was able to extract symbol"
2866 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2867 $echo "*** not find such a program. So, this module is probably useless."
2868 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2869 fi
2870 if test "$build_old_libs" = no; then
2871 build_libtool_libs=module
2872 build_old_libs=yes
2873 else
2874 build_libtool_libs=no
2875 fi
2876 fi
2877 else
2878 deplibs="$dir/$old_library $deplibs"
2879 link_static=yes
2880 fi
2881 fi # link shared/static library?
2882
2883 if test "$linkmode" = lib; then
2884 if test -n "$dependency_libs" &&
2885 { test "$hardcode_into_libs" != yes ||
2886 test "$build_old_libs" = yes ||
2887 test "$link_static" = yes; }; then
2888 # Extract -R from dependency_libs
2889 temp_deplibs=
2890 for libdir in $dependency_libs; do
2891 case $libdir in
2892 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2893 case " $xrpath " in
2894 *" $temp_xrpath "*) ;;
2895 *) xrpath="$xrpath $temp_xrpath";;
2896 esac;;
2897 *) temp_deplibs="$temp_deplibs $libdir";;
2898 esac
2899 done
2900 dependency_libs="$temp_deplibs"
2901 fi
2902
2903 newlib_search_path="$newlib_search_path $absdir"
2904 # Link against this library
2905 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2906 # ... and its dependency_libs
2907 tmp_libs=
2908 for deplib in $dependency_libs; do
2909 newdependency_libs="$deplib $newdependency_libs"
2910 if test "X$duplicate_deps" = "Xyes" ; then
2911 case "$tmp_libs " in
2912 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2913 esac
2914 fi
2915 tmp_libs="$tmp_libs $deplib"
2916 done
2917
2918 if test "$link_all_deplibs" != no; then
2919 # Add the search paths of all dependency libraries
2920 for deplib in $dependency_libs; do
2921 case $deplib in
2922 -L*) path="$deplib" ;;
2923 *.la)
2924 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2925 test "X$dir" = "X$deplib" && dir="."
2926 # We need an absolute path.
2927 case $dir in
2928 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2929 *)
2930 absdir=`cd "$dir" && pwd`
2931 if test -z "$absdir"; then
2932 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2933 absdir="$dir"
2934 fi
2935 ;;
2936 esac
2937 if grep "^installed=no" $deplib > /dev/null; then
2938 path="$absdir/$objdir"
2939 else
2940 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2941 if test -z "$libdir"; then
2942 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2943 exit $EXIT_FAILURE
2944 fi
2945 if test "$absdir" != "$libdir"; then
2946 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2947 fi
2948 path="$absdir"
2949 fi
2950 depdepl=
2951 case $host in
2952 *-*-darwin*)
2953 # we do not want to link against static libs,
2954 # but need to link against shared
2955 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2956 if test -n "$deplibrary_names" ; then
2957 for tmp in $deplibrary_names ; do
2958 depdepl=$tmp
2959 done
2960 if test -f "$path/$depdepl" ; then
2961 depdepl="$path/$depdepl"
2962 fi
2963 # do not add paths which are already there
2964 case " $newlib_search_path " in
2965 *" $path "*) ;;
2966 *) newlib_search_path="$newlib_search_path $path";;
2967 esac
2968 fi
2969 path=""
2970 ;;
2971 *)
2972 path="-L$path"
2973 ;;
2974 esac
2975 ;;
2976 -l*)
2977 case $host in
2978 *-*-darwin*)
2979 # Again, we only want to link against shared libraries
2980 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2981 for tmp in $newlib_search_path ; do
2982 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2983 eval depdepl="$tmp/lib$tmp_libs.dylib"
2984 break
2985 fi
2986 done
2987 path=""
2988 ;;
2989 *) continue ;;
2990 esac
2991 ;;
2992 *) continue ;;
2993 esac
2994 case " $deplibs " in
2995 *" $path "*) ;;
2996 *) deplibs="$path $deplibs" ;;
2997 esac
2998 case " $deplibs " in
2999 *" $depdepl "*) ;;
3000 *) deplibs="$depdepl $deplibs" ;;
3001 esac
3002 done
3003 fi # link_all_deplibs != no
3004 fi # linkmode = lib
3005 done # for deplib in $libs
3006 dependency_libs="$newdependency_libs"
3007 if test "$pass" = dlpreopen; then
3008 # Link the dlpreopened libraries before other libraries
3009 for deplib in $save_deplibs; do
3010 deplibs="$deplib $deplibs"
3011 done
3012 fi
3013 if test "$pass" != dlopen; then
3014 if test "$pass" != conv; then
3015 # Make sure lib_search_path contains only unique directories.
3016 lib_search_path=
3017 for dir in $newlib_search_path; do
3018 case "$lib_search_path " in
3019 *" $dir "*) ;;
3020 *) lib_search_path="$lib_search_path $dir" ;;
3021 esac
3022 done
3023 newlib_search_path=
3024 fi
3025
3026 if test "$linkmode,$pass" != "prog,link"; then
3027 vars="deplibs"
3028 else
3029 vars="compile_deplibs finalize_deplibs"
3030 fi
3031 for var in $vars dependency_libs; do
3032 # Add libraries to $var in reverse order
3033 eval tmp_libs=\"\$$var\"
3034 new_libs=
3035 for deplib in $tmp_libs; do
3036 # FIXME: Pedantically, this is the right thing to do, so
3037 # that some nasty dependency loop isn't accidentally
3038 # broken:
3039 #new_libs="$deplib $new_libs"
3040 # Pragmatically, this seems to cause very few problems in
3041 # practice:
3042 case $deplib in
3043 -L*) new_libs="$deplib $new_libs" ;;
3044 -R*) ;;
3045 *)
3046 # And here is the reason: when a library appears more
3047 # than once as an explicit dependence of a library, or
3048 # is implicitly linked in more than once by the
3049 # compiler, it is considered special, and multiple
3050 # occurrences thereof are not removed. Compare this
3051 # with having the same library being listed as a
3052 # dependency of multiple other libraries: in this case,
3053 # we know (pedantically, we assume) the library does not
3054 # need to be listed more than once, so we keep only the
3055 # last copy. This is not always right, but it is rare
3056 # enough that we require users that really mean to play
3057 # such unportable linking tricks to link the library
3058 # using -Wl,-lname, so that libtool does not consider it
3059 # for duplicate removal.
3060 case " $specialdeplibs " in
3061 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3062 *)
3063 case " $new_libs " in
3064 *" $deplib "*) ;;
3065 *) new_libs="$deplib $new_libs" ;;
3066 esac
3067 ;;
3068 esac
3069 ;;
3070 esac
3071 done
3072 tmp_libs=
3073 for deplib in $new_libs; do
3074 case $deplib in
3075 -L*)
3076 case " $tmp_libs " in
3077 *" $deplib "*) ;;
3078 *) tmp_libs="$tmp_libs $deplib" ;;
3079 esac
3080 ;;
3081 *) tmp_libs="$tmp_libs $deplib" ;;
3082 esac
3083 done
3084 eval $var=\"$tmp_libs\"
3085 done # for var
3086 fi
3087 # Last step: remove runtime libs from dependency_libs
3088 # (they stay in deplibs)
3089 tmp_libs=
3090 for i in $dependency_libs ; do
3091 case " $predeps $postdeps $compiler_lib_search_path " in
3092 *" $i "*)
3093 i=""
3094 ;;
3095 esac
3096 if test -n "$i" ; then
3097 tmp_libs="$tmp_libs $i"
3098 fi
3099 done
3100 dependency_libs=$tmp_libs
3101 done # for pass
3102 if test "$linkmode" = prog; then
3103 dlfiles="$newdlfiles"
3104 dlprefiles="$newdlprefiles"
3105 fi
3106
3107 case $linkmode in
3108 oldlib)
3109 if test -n "$deplibs"; then
3110 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3111 fi
3112
3113 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3114 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3115 fi
3116
3117 if test -n "$rpath"; then
3118 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3119 fi
3120
3121 if test -n "$xrpath"; then
3122 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3123 fi
3124
3125 if test -n "$vinfo"; then
3126 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3127 fi
3128
3129 if test -n "$release"; then
3130 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3131 fi
3132
3133 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3134 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3135 fi
3136
3137 # Now set the variables for building old libraries.
3138 build_libtool_libs=no
3139 oldlibs="$output"
3140 objs="$objs$old_deplibs"
3141 ;;
3142
3143 lib)
3144 # Make sure we only generate libraries of the form `libNAME.la'.
3145 case $outputname in
3146 lib*)
3147 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3148 eval shared_ext=\"$shrext_cmds\"
3149 eval libname=\"$libname_spec\"
3150 ;;
3151 *)
3152 if test "$module" = no; then
3153 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3154 $echo "$help" 1>&2
3155 exit $EXIT_FAILURE
3156 fi
3157 if test "$need_lib_prefix" != no; then
3158 # Add the "lib" prefix for modules if required
3159 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3160 eval shared_ext=\"$shrext_cmds\"
3161 eval libname=\"$libname_spec\"
3162 else
3163 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3164 fi
3165 ;;
3166 esac
3167
3168 if test -n "$objs"; then
3169 if test "$deplibs_check_method" != pass_all; then
3170 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3171 exit $EXIT_FAILURE
3172 else
3173 $echo
3174 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3175 $echo "*** objects $objs is not portable!"
3176 libobjs="$libobjs $objs"
3177 fi
3178 fi
3179
3180 if test "$dlself" != no; then
3181 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3182 fi
3183
3184 set dummy $rpath
3185 if test "$#" -gt 2; then
3186 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3187 fi
3188 install_libdir="$2"
3189
3190 oldlibs=
3191 if test -z "$rpath"; then
3192 if test "$build_libtool_libs" = yes; then
3193 # Building a libtool convenience library.
3194 # Some compilers have problems with a `.al' extension so
3195 # convenience libraries should have the same extension an
3196 # archive normally would.
3197 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3198 build_libtool_libs=convenience
3199 build_old_libs=yes
3200 fi
3201
3202 if test -n "$vinfo"; then
3203 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3204 fi
3205
3206 if test -n "$release"; then
3207 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3208 fi
3209 else
3210
3211 # Parse the version information argument.
3212 save_ifs="$IFS"; IFS=':'
3213 set dummy $vinfo 0 0 0
3214 IFS="$save_ifs"
3215
3216 if test -n "$8"; then
3217 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3218 $echo "$help" 1>&2
3219 exit $EXIT_FAILURE
3220 fi
3221
3222 # convert absolute version numbers to libtool ages
3223 # this retains compatibility with .la files and attempts
3224 # to make the code below a bit more comprehensible
3225
3226 case $vinfo_number in
3227 yes)
3228 number_major="$2"
3229 number_minor="$3"
3230 number_revision="$4"
3231 #
3232 # There are really only two kinds -- those that
3233 # use the current revision as the major version
3234 # and those that subtract age and use age as
3235 # a minor version. But, then there is irix
3236 # which has an extra 1 added just for fun
3237 #
3238 case $version_type in
3239 darwin|linux|osf|windows|none)
3240 current=`expr $number_major + $number_minor`
3241 age="$number_minor"
3242 revision="$number_revision"
3243 ;;
3244 freebsd-aout|freebsd-elf|sunos)
3245 current="$number_major"
3246 revision="$number_minor"
3247 age="0"
3248 ;;
3249 irix|nonstopux)
3250 current=`expr $number_major + $number_minor`
3251 age="$number_minor"
3252 revision="$number_minor"
3253 lt_irix_increment=no
3254 ;;
3255 esac
3256 ;;
3257 no)
3258 current="$2"
3259 revision="$3"
3260 age="$4"
3261 ;;
3262 esac
3263
3264 # Check that each of the things are valid numbers.
3265 case $current in
3266 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]) ;;
3267 *)
3268 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3269 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3270 exit $EXIT_FAILURE
3271 ;;
3272 esac
3273
3274 case $revision in
3275 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]) ;;
3276 *)
3277 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3278 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3279 exit $EXIT_FAILURE
3280 ;;
3281 esac
3282
3283 case $age in
3284 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]) ;;
3285 *)
3286 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3288 exit $EXIT_FAILURE
3289 ;;
3290 esac
3291
3292 if test "$age" -gt "$current"; then
3293 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3294 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3295 exit $EXIT_FAILURE
3296 fi
3297
3298 # Calculate the version variables.
3299 major=
3300 versuffix=
3301 verstring=
3302 case $version_type in
3303 none) ;;
3304
3305 darwin)
3306 # Like Linux, but with the current version available in
3307 # verstring for coding it into the library header
3308 major=.`expr $current - $age`
3309 versuffix="$major.$age.$revision"
3310 # Darwin ld doesn't like 0 for these options...
3311 minor_current=`expr $current + 1`
3312 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3313 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3314 ;;
3315
3316 freebsd-aout)
3317 major=".$current"
3318 versuffix=".$current.$revision";
3319 ;;
3320
3321 freebsd-elf)
3322 major=".$current"
3323 versuffix=".$current";
3324 ;;
3325
3326 irix | nonstopux)
3327 if test "X$lt_irix_increment" = "Xno"; then
3328 major=`expr $current - $age`
3329 else
3330 major=`expr $current - $age + 1`
3331 fi
3332 case $version_type in
3333 nonstopux) verstring_prefix=nonstopux ;;
3334 *) verstring_prefix=sgi ;;
3335 esac
3336 verstring="$verstring_prefix$major.$revision"
3337
3338 # Add in all the interfaces that we are compatible with.
3339 loop=$revision
3340 while test "$loop" -ne 0; do
3341 iface=`expr $revision - $loop`
3342 loop=`expr $loop - 1`
3343 verstring="$verstring_prefix$major.$iface:$verstring"
3344 done
3345
3346 # Before this point, $major must not contain `.'.
3347 major=.$major
3348 versuffix="$major.$revision"
3349 ;;
3350
3351 linux)
3352 major=.`expr $current - $age`
3353 versuffix="$major.$age.$revision"
3354 ;;
3355
3356 osf)
3357 major=.`expr $current - $age`
3358 versuffix=".$current.$age.$revision"
3359 verstring="$current.$age.$revision"
3360
3361 # Add in all the interfaces that we are compatible with.
3362 loop=$age
3363 while test "$loop" -ne 0; do
3364 iface=`expr $current - $loop`
3365 loop=`expr $loop - 1`
3366 verstring="$verstring:${iface}.0"
3367 done
3368
3369 # Make executables depend on our current version.
3370 verstring="$verstring:${current}.0"
3371 ;;
3372
3373 sunos)
3374 major=".$current"
3375 versuffix=".$current.$revision"
3376 ;;
3377
3378 windows)
3379 # Use '-' rather than '.', since we only want one
3380 # extension on DOS 8.3 filesystems.
3381 major=`expr $current - $age`
3382 versuffix="-$major"
3383 ;;
3384
3385 *)
3386 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3387 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3388 exit $EXIT_FAILURE
3389 ;;
3390 esac
3391
3392 # Clear the version info if we defaulted, and they specified a release.
3393 if test -z "$vinfo" && test -n "$release"; then
3394 major=
3395 case $version_type in
3396 darwin)
3397 # we can't check for "0.0" in archive_cmds due to quoting
3398 # problems, so we reset it completely
3399 verstring=
3400 ;;
3401 *)
3402 verstring="0.0"
3403 ;;
3404 esac
3405 if test "$need_version" = no; then
3406 versuffix=
3407 else
3408 versuffix=".0.0"
3409 fi
3410 fi
3411
3412 # Remove version info from name if versioning should be avoided
3413 if test "$avoid_version" = yes && test "$need_version" = no; then
3414 major=
3415 versuffix=
3416 verstring=""
3417 fi
3418
3419 # Check to see if the archive will have undefined symbols.
3420 if test "$allow_undefined" = yes; then
3421 if test "$allow_undefined_flag" = unsupported; then
3422 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3423 build_libtool_libs=no
3424 build_old_libs=yes
3425 fi
3426 else
3427 # Don't allow undefined symbols.
3428 allow_undefined_flag="$no_undefined_flag"
3429 fi
3430 fi
3431
3432 if test "$mode" != relink; then
3433 # Remove our outputs, but don't remove object files since they
3434 # may have been created when compiling PIC objects.
3435 removelist=
3436 tempremovelist=`$echo "$output_objdir/*"`
3437 for p in $tempremovelist; do
3438 case $p in
3439 *.$objext)
3440 ;;
3441 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3442 if test "X$precious_files_regex" != "X"; then
3443 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3444 then
3445 continue
3446 fi
3447 fi
3448 removelist="$removelist $p"
3449 ;;
3450 *) ;;
3451 esac
3452 done
3453 if test -n "$removelist"; then
3454 $show "${rm}r $removelist"
3455 $run ${rm}r $removelist
3456 fi
3457 fi
3458
3459 # Now set the variables for building old libraries.
3460 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3461 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3462
3463 # Transform .lo files to .o files.
3464 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3465 fi
3466
3467 # Eliminate all temporary directories.
3468 #for path in $notinst_path; do
3469 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3470 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3471 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3472 #done
3473
3474 if test -n "$xrpath"; then
3475 # If the user specified any rpath flags, then add them.
3476 temp_xrpath=
3477 for libdir in $xrpath; do
3478 temp_xrpath="$temp_xrpath -R$libdir"
3479 case "$finalize_rpath " in
3480 *" $libdir "*) ;;
3481 *) finalize_rpath="$finalize_rpath $libdir" ;;
3482 esac
3483 done
3484 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3485 dependency_libs="$temp_xrpath $dependency_libs"
3486 fi
3487 fi
3488
3489 # Make sure dlfiles contains only unique files that won't be dlpreopened
3490 old_dlfiles="$dlfiles"
3491 dlfiles=
3492 for lib in $old_dlfiles; do
3493 case " $dlprefiles $dlfiles " in
3494 *" $lib "*) ;;
3495 *) dlfiles="$dlfiles $lib" ;;
3496 esac
3497 done
3498
3499 # Make sure dlprefiles contains only unique files
3500 old_dlprefiles="$dlprefiles"
3501 dlprefiles=
3502 for lib in $old_dlprefiles; do
3503 case "$dlprefiles " in
3504 *" $lib "*) ;;
3505 *) dlprefiles="$dlprefiles $lib" ;;
3506 esac
3507 done
3508
3509 if test "$build_libtool_libs" = yes; then
3510 if test -n "$rpath"; then
3511 case $host in
3512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3513 # these systems don't actually have a c library (as such)!
3514 ;;
3515 *-*-rhapsody* | *-*-darwin1.[012])
3516 # Rhapsody C library is in the System framework
3517 deplibs="$deplibs -framework System"
3518 ;;
3519 *-*-netbsd*)
3520 # Don't link with libc until the a.out ld.so is fixed.
3521 ;;
3522 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3523 # Do not include libc due to us having libc/libc_r.
3524 ;;
3525 *-*-sco3.2v5* | *-*-sco5v6*)
3526 # Causes problems with __ctype
3527 ;;
3528 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3529 # Compiler inserts libc in the correct place for threads to work
3530 ;;
3531 *)
3532 # Add libc to deplibs on all other systems if necessary.
3533 if test "$build_libtool_need_lc" = "yes"; then
3534 deplibs="$deplibs -lc"
3535 fi
3536 ;;
3537 esac
3538 fi
3539
3540 # Transform deplibs into only deplibs that can be linked in shared.
3541 name_save=$name
3542 libname_save=$libname
3543 release_save=$release
3544 versuffix_save=$versuffix
3545 major_save=$major
3546 # I'm not sure if I'm treating the release correctly. I think
3547 # release should show up in the -l (ie -lgmp5) so we don't want to
3548 # add it in twice. Is that correct?
3549 release=""
3550 versuffix=""
3551 major=""
3552 newdeplibs=
3553 droppeddeps=no
3554 case $deplibs_check_method in
3555 pass_all)
3556 # Don't check for shared/static. Everything works.
3557 # This might be a little naive. We might want to check
3558 # whether the library exists or not. But this is on
3559 # osf3 & osf4 and I'm not really sure... Just
3560 # implementing what was already the behavior.
3561 newdeplibs=$deplibs
3562 ;;
3563 test_compile)
3564 # This code stresses the "libraries are programs" paradigm to its
3565 # limits. Maybe even breaks it. We compile a program, linking it
3566 # against the deplibs as a proxy for the library. Then we can check
3567 # whether they linked in statically or dynamically with ldd.
3568 $rm conftest.c
3569 cat > conftest.c <<EOF
3570 int main() { return 0; }
3571EOF
3572 $rm conftest
3573 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3574 ldd_output=`ldd conftest`
3575 for i in $deplibs; do
3576 name=`expr $i : '-l\(.*\)'`
3577 # If $name is empty we are operating on a -L argument.
3578 if test "$name" != "" && test "$name" != "0"; then
3579 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3580 case " $predeps $postdeps " in
3581 *" $i "*)
3582 newdeplibs="$newdeplibs $i"
3583 i=""
3584 ;;
3585 esac
3586 fi
3587 if test -n "$i" ; then
3588 libname=`eval \\$echo \"$libname_spec\"`
3589 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3590 set dummy $deplib_matches
3591 deplib_match=$2
3592 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3593 newdeplibs="$newdeplibs $i"
3594 else
3595 droppeddeps=yes
3596 $echo
3597 $echo "*** Warning: dynamic linker does not accept needed library $i."
3598 $echo "*** I have the capability to make that library automatically link in when"
3599 $echo "*** you link to this library. But I can only do this if you have a"
3600 $echo "*** shared version of the library, which I believe you do not have"
3601 $echo "*** because a test_compile did reveal that the linker did not use it for"
3602 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3603 fi
3604 fi
3605 else
3606 newdeplibs="$newdeplibs $i"
3607 fi
3608 done
3609 else
3610 # Error occurred in the first compile. Let's try to salvage
3611 # the situation: Compile a separate program for each library.
3612 for i in $deplibs; do
3613 name=`expr $i : '-l\(.*\)'`
3614 # If $name is empty we are operating on a -L argument.
3615 if test "$name" != "" && test "$name" != "0"; then
3616 $rm conftest
3617 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3618 ldd_output=`ldd conftest`
3619 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3620 case " $predeps $postdeps " in
3621 *" $i "*)
3622 newdeplibs="$newdeplibs $i"
3623 i=""
3624 ;;
3625 esac
3626 fi
3627 if test -n "$i" ; then
3628 libname=`eval \\$echo \"$libname_spec\"`
3629 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3630 set dummy $deplib_matches
3631 deplib_match=$2
3632 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3633 newdeplibs="$newdeplibs $i"
3634 else
3635 droppeddeps=yes
3636 $echo
3637 $echo "*** Warning: dynamic linker does not accept needed library $i."
3638 $echo "*** I have the capability to make that library automatically link in when"
3639 $echo "*** you link to this library. But I can only do this if you have a"
3640 $echo "*** shared version of the library, which you do not appear to have"
3641 $echo "*** because a test_compile did reveal that the linker did not use this one"
3642 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3643 fi
3644 fi
3645 else
3646 droppeddeps=yes
3647 $echo
3648 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3649 $echo "*** make it link in! You will probably need to install it or some"
3650 $echo "*** library that it depends on before this library will be fully"
3651 $echo "*** functional. Installing it before continuing would be even better."
3652 fi
3653 else
3654 newdeplibs="$newdeplibs $i"
3655 fi
3656 done
3657 fi
3658 ;;
3659 file_magic*)
3660 set dummy $deplibs_check_method
3661 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3662 for a_deplib in $deplibs; do
3663 name=`expr $a_deplib : '-l\(.*\)'`
3664 # If $name is empty we are operating on a -L argument.
3665 if test "$name" != "" && test "$name" != "0"; then
3666 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3667 case " $predeps $postdeps " in
3668 *" $a_deplib "*)
3669 newdeplibs="$newdeplibs $a_deplib"
3670 a_deplib=""
3671 ;;
3672 esac
3673 fi
3674 if test -n "$a_deplib" ; then
3675 libname=`eval \\$echo \"$libname_spec\"`
3676 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3677 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3678 for potent_lib in $potential_libs; do
3679 # Follow soft links.
3680 if ls -lLd "$potent_lib" 2>/dev/null \
3681 | grep " -> " >/dev/null; then
3682 continue
3683 fi
3684 # The statement above tries to avoid entering an
3685 # endless loop below, in case of cyclic links.
3686 # We might still enter an endless loop, since a link
3687 # loop can be closed while we follow links,
3688 # but so what?
3689 potlib="$potent_lib"
3690 while test -h "$potlib" 2>/dev/null; do
3691 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3692 case $potliblink in
3693 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3694 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3695 esac
3696 done
3697 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3698 | ${SED} 10q \
3699 | $EGREP "$file_magic_regex" > /dev/null; then
3700 newdeplibs="$newdeplibs $a_deplib"
3701 a_deplib=""
3702 break 2
3703 fi
3704 done
3705 done
3706 fi
3707 if test -n "$a_deplib" ; then
3708 droppeddeps=yes
3709 $echo
3710 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3711 $echo "*** I have the capability to make that library automatically link in when"
3712 $echo "*** you link to this library. But I can only do this if you have a"
3713 $echo "*** shared version of the library, which you do not appear to have"
3714 $echo "*** because I did check the linker path looking for a file starting"
3715 if test -z "$potlib" ; then
3716 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3717 else
3718 $echo "*** with $libname and none of the candidates passed a file format test"
3719 $echo "*** using a file magic. Last file checked: $potlib"
3720 fi
3721 fi
3722 else
3723 # Add a -L argument.
3724 newdeplibs="$newdeplibs $a_deplib"
3725 fi
3726 done # Gone through all deplibs.
3727 ;;
3728 match_pattern*)
3729 set dummy $deplibs_check_method
3730 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3731 for a_deplib in $deplibs; do
3732 name=`expr $a_deplib : '-l\(.*\)'`
3733 # If $name is empty we are operating on a -L argument.
3734 if test -n "$name" && test "$name" != "0"; then
3735 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3736 case " $predeps $postdeps " in
3737 *" $a_deplib "*)
3738 newdeplibs="$newdeplibs $a_deplib"
3739 a_deplib=""
3740 ;;
3741 esac
3742 fi
3743 if test -n "$a_deplib" ; then
3744 libname=`eval \\$echo \"$libname_spec\"`
3745 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3746 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3747 for potent_lib in $potential_libs; do
3748 potlib="$potent_lib" # see symlink-check above in file_magic test
3749 if eval $echo \"$potent_lib\" 2>/dev/null \
3750 | ${SED} 10q \
3751 | $EGREP "$match_pattern_regex" > /dev/null; then
3752 newdeplibs="$newdeplibs $a_deplib"
3753 a_deplib=""
3754 break 2
3755 fi
3756 done
3757 done
3758 fi
3759 if test -n "$a_deplib" ; then
3760 droppeddeps=yes
3761 $echo
3762 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3763 $echo "*** I have the capability to make that library automatically link in when"
3764 $echo "*** you link to this library. But I can only do this if you have a"
3765 $echo "*** shared version of the library, which you do not appear to have"
3766 $echo "*** because I did check the linker path looking for a file starting"
3767 if test -z "$potlib" ; then
3768 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3769 else
3770 $echo "*** with $libname and none of the candidates passed a file format test"
3771 $echo "*** using a regex pattern. Last file checked: $potlib"
3772 fi
3773 fi
3774 else
3775 # Add a -L argument.
3776 newdeplibs="$newdeplibs $a_deplib"
3777 fi
3778 done # Gone through all deplibs.
3779 ;;
3780 none | unknown | *)
3781 newdeplibs=""
3782 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3783 -e 's/ -[LR][^ ]*//g'`
3784 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3785 for i in $predeps $postdeps ; do
3786 # can't use Xsed below, because $i might contain '/'
3787 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3788 done
3789 fi
3790 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3791 | grep . >/dev/null; then
3792 $echo
3793 if test "X$deplibs_check_method" = "Xnone"; then
3794 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3795 else
3796 $echo "*** Warning: inter-library dependencies are not known to be supported."
3797 fi
3798 $echo "*** All declared inter-library dependencies are being dropped."
3799 droppeddeps=yes
3800 fi
3801 ;;
3802 esac
3803 versuffix=$versuffix_save
3804 major=$major_save
3805 release=$release_save
3806 libname=$libname_save
3807 name=$name_save
3808
3809 case $host in
3810 *-*-rhapsody* | *-*-darwin1.[012])
3811 # On Rhapsody replace the C library is the System framework
3812 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3813 ;;
3814 esac
3815
3816 if test "$droppeddeps" = yes; then
3817 if test "$module" = yes; then
3818 $echo
3819 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3820 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3821 $echo "*** a static module, that should work as long as the dlopening"
3822 $echo "*** application is linked with the -dlopen flag."
3823 if test -z "$global_symbol_pipe"; then
3824 $echo
3825 $echo "*** However, this would only work if libtool was able to extract symbol"
3826 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3827 $echo "*** not find such a program. So, this module is probably useless."
3828 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3829 fi
3830 if test "$build_old_libs" = no; then
3831 oldlibs="$output_objdir/$libname.$libext"
3832 build_libtool_libs=module
3833 build_old_libs=yes
3834 else
3835 build_libtool_libs=no
3836 fi
3837 else
3838 $echo "*** The inter-library dependencies that have been dropped here will be"
3839 $echo "*** automatically added whenever a program is linked with this library"
3840 $echo "*** or is declared to -dlopen it."
3841
3842 if test "$allow_undefined" = no; then
3843 $echo
3844 $echo "*** Since this library must not contain undefined symbols,"
3845 $echo "*** because either the platform does not support them or"
3846 $echo "*** it was explicitly requested with -no-undefined,"
3847 $echo "*** libtool will only create a static version of it."
3848 if test "$build_old_libs" = no; then
3849 oldlibs="$output_objdir/$libname.$libext"
3850 build_libtool_libs=module
3851 build_old_libs=yes
3852 else
3853 build_libtool_libs=no
3854 fi
3855 fi
3856 fi
3857 fi
3858 # Done checking deplibs!
3859 deplibs=$newdeplibs
3860 fi
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
3891 # All the library-specific variables (install_libdir is set above).
3892 library_names=
3893 old_library=
3894 dlname=
3895
3896 # Test again, we may have decided not to build it any more
3897 if test "$build_libtool_libs" = yes; then
3898 if test "$hardcode_into_libs" = yes; then
3899 # Hardcode the library paths
3900 hardcode_libdirs=
3901 dep_rpath=
3902 rpath="$finalize_rpath"
3903 test "$mode" != relink && rpath="$compile_rpath$rpath"
3904 for libdir in $rpath; do
3905 if test -n "$hardcode_libdir_flag_spec"; then
3906 if test -n "$hardcode_libdir_separator"; then
3907 if test -z "$hardcode_libdirs"; then
3908 hardcode_libdirs="$libdir"
3909 else
3910 # Just accumulate the unique libdirs.
3911 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3912 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3913 ;;
3914 *)
3915 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3916 ;;
3917 esac
3918 fi
3919 else
3920 eval flag=\"$hardcode_libdir_flag_spec\"
3921 dep_rpath="$dep_rpath $flag"
3922 fi
3923 elif test -n "$runpath_var"; then
3924 case "$perm_rpath " in
3925 *" $libdir "*) ;;
3926 *) perm_rpath="$perm_rpath $libdir" ;;
3927 esac
3928 fi
3929 done
3930 # Substitute the hardcoded libdirs into the rpath.
3931 if test -n "$hardcode_libdir_separator" &&
3932 test -n "$hardcode_libdirs"; then
3933 libdir="$hardcode_libdirs"
3934 if test -n "$hardcode_libdir_flag_spec_ld"; then
3935 case $archive_cmds in
3936 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3937 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3938 esac
3939 else
3940 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3941 fi
3942 fi
3943 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3944 # We should set the runpath_var.
3945 rpath=
3946 for dir in $perm_rpath; do
3947 rpath="$rpath$dir:"
3948 done
3949 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3950 fi
3951 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3952 fi
3953
3954 shlibpath="$finalize_shlibpath"
3955 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3956 if test -n "$shlibpath"; then
3957 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3958 fi
3959
3960 # Get the real and link names of the library.
3961 eval shared_ext=\"$shrext_cmds\"
3962 eval library_names=\"$library_names_spec\"
3963 set dummy $library_names
3964 realname="$2"
3965 shift; shift
3966
3967 if test -n "$soname_spec"; then
3968 eval soname=\"$soname_spec\"
3969 else
3970 soname="$realname"
3971 fi
3972 if test -z "$dlname"; then
3973 dlname=$soname
3974 fi
3975
3976 lib="$output_objdir/$realname"
3977 linknames=
3978 for link
3979 do
3980 linknames="$linknames $link"
3981 done
3982
3983 # Use standard objects if they are pic
3984 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3985
3986 # Prepare the list of exported symbols
3987 if test -z "$export_symbols"; then
3988 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3989 $show "generating symbol list for \`$libname.la'"
3990 export_symbols="$output_objdir/$libname.exp"
3991 $run $rm $export_symbols
3992 cmds=$export_symbols_cmds
3993 save_ifs="$IFS"; IFS='~'
3994 for cmd in $cmds; do
3995 IFS="$save_ifs"
3996 eval cmd=\"$cmd\"
3997 if len=`expr "X$cmd" : ".*"` &&
3998 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3999 $show "$cmd"
4000 $run eval "$cmd" || exit $?
4001 skipped_export=false
4002 else
4003 # The command line is too long to execute in one step.
4004 $show "using reloadable object file for export list..."
4005 skipped_export=:
4006 # Break out early, otherwise skipped_export may be
4007 # set to false by a later but shorter cmd.
4008 break
4009 fi
4010 done
4011 IFS="$save_ifs"
4012 if test -n "$export_symbols_regex"; then
4013 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4014 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4015 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4016 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4017 fi
4018 fi
4019 fi
4020
4021 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4022 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4023 fi
4024
4025 tmp_deplibs=
4026 for test_deplib in $deplibs; do
4027 case " $convenience " in
4028 *" $test_deplib "*) ;;
4029 *)
4030 tmp_deplibs="$tmp_deplibs $test_deplib"
4031 ;;
4032 esac
4033 done
4034 deplibs="$tmp_deplibs"
4035
4036 if test -n "$convenience"; then
4037 if test -n "$whole_archive_flag_spec"; then
4038 save_libobjs=$libobjs
4039 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4040 else
4041 gentop="$output_objdir/${outputname}x"
4042 generated="$generated $gentop"
4043
4044 func_extract_archives $gentop $convenience
4045 libobjs="$libobjs $func_extract_archives_result"
4046 fi
4047 fi
4048
4049 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4050 eval flag=\"$thread_safe_flag_spec\"
4051 linker_flags="$linker_flags $flag"
4052 fi
4053
4054 # Make a backup of the uninstalled library when relinking
4055 if test "$mode" = relink; then
4056 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4057 fi
4058
4059 # Do each of the archive commands.
4060 if test "$module" = yes && test -n "$module_cmds" ; then
4061 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4062 eval test_cmds=\"$module_expsym_cmds\"
4063 cmds=$module_expsym_cmds
4064 else
4065 eval test_cmds=\"$module_cmds\"
4066 cmds=$module_cmds
4067 fi
4068 else
4069 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4070 eval test_cmds=\"$archive_expsym_cmds\"
4071 cmds=$archive_expsym_cmds
4072 else
4073 eval test_cmds=\"$archive_cmds\"
4074 cmds=$archive_cmds
4075 fi
4076 fi
4077
4078 if test "X$skipped_export" != "X:" &&
4079 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4080 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4081 :
4082 else
4083 # The command line is too long to link in one step, link piecewise.
4084 $echo "creating reloadable object files..."
4085
4086 # Save the value of $output and $libobjs because we want to
4087 # use them later. If we have whole_archive_flag_spec, we
4088 # want to use save_libobjs as it was before
4089 # whole_archive_flag_spec was expanded, because we can't
4090 # assume the linker understands whole_archive_flag_spec.
4091 # This may have to be revisited, in case too many
4092 # convenience libraries get linked in and end up exceeding
4093 # the spec.
4094 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4095 save_libobjs=$libobjs
4096 fi
4097 save_output=$output
4098 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4099
4100 # Clear the reloadable object creation command queue and
4101 # initialize k to one.
4102 test_cmds=
4103 concat_cmds=
4104 objlist=
4105 delfiles=
4106 last_robj=
4107 k=1
4108 output=$output_objdir/$output_la-${k}.$objext
4109 # Loop over the list of objects to be linked.
4110 for obj in $save_libobjs
4111 do
4112 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4113 if test "X$objlist" = X ||
4114 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4115 test "$len" -le "$max_cmd_len"; }; then
4116 objlist="$objlist $obj"
4117 else
4118 # The command $test_cmds is almost too long, add a
4119 # command to the queue.
4120 if test "$k" -eq 1 ; then
4121 # The first file doesn't have a previous command to add.
4122 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4123 else
4124 # All subsequent reloadable object files will link in
4125 # the last one created.
4126 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4127 fi
4128 last_robj=$output_objdir/$output_la-${k}.$objext
4129 k=`expr $k + 1`
4130 output=$output_objdir/$output_la-${k}.$objext
4131 objlist=$obj
4132 len=1
4133 fi
4134 done
4135 # Handle the remaining objects by creating one last
4136 # reloadable object file. All subsequent reloadable object
4137 # files will link in the last one created.
4138 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4139 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4140
4141 if ${skipped_export-false}; then
4142 $show "generating symbol list for \`$libname.la'"
4143 export_symbols="$output_objdir/$libname.exp"
4144 $run $rm $export_symbols
4145 libobjs=$output
4146 # Append the command to create the export file.
4147 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4148 fi
4149
4150 # Set up a command to remove the reloadable object files
4151 # after they are used.
4152 i=0
4153 while test "$i" -lt "$k"
4154 do
4155 i=`expr $i + 1`
4156 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4157 done
4158
4159 $echo "creating a temporary reloadable object file: $output"
4160
4161 # Loop through the commands generated above and execute them.
4162 save_ifs="$IFS"; IFS='~'
4163 for cmd in $concat_cmds; do
4164 IFS="$save_ifs"
4165 $show "$cmd"
4166 $run eval "$cmd" || exit $?
4167 done
4168 IFS="$save_ifs"
4169
4170 libobjs=$output
4171 # Restore the value of output.
4172 output=$save_output
4173
4174 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4175 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4176 fi
4177 # Expand the library linking commands again to reset the
4178 # value of $libobjs for piecewise linking.
4179
4180 # Do each of the archive commands.
4181 if test "$module" = yes && test -n "$module_cmds" ; then
4182 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4183 cmds=$module_expsym_cmds
4184 else
4185 cmds=$module_cmds
4186 fi
4187 else
4188 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4189 cmds=$archive_expsym_cmds
4190 else
4191 cmds=$archive_cmds
4192 fi
4193 fi
4194
4195 # Append the command to remove the reloadable object files
4196 # to the just-reset $cmds.
4197 eval cmds=\"\$cmds~\$rm $delfiles\"
4198 fi
4199 save_ifs="$IFS"; IFS='~'
4200 for cmd in $cmds; do
4201 IFS="$save_ifs"
4202 eval cmd=\"$cmd\"
4203 $show "$cmd"
4204 $run eval "$cmd" || {
4205 lt_exit=$?
4206
4207 # Restore the uninstalled library and exit
4208 if test "$mode" = relink; then
4209 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4210 fi
4211
4212 exit $lt_exit
4213 }
4214 done
4215 IFS="$save_ifs"
4216
4217 # Restore the uninstalled library and exit
4218 if test "$mode" = relink; then
4219 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4220
4221 if test -n "$convenience"; then
4222 if test -z "$whole_archive_flag_spec"; then
4223 $show "${rm}r $gentop"
4224 $run ${rm}r "$gentop"
4225 fi
4226 fi
4227
4228 exit $EXIT_SUCCESS
4229 fi
4230
4231 # Create links to the real library.
4232 for linkname in $linknames; do
4233 if test "$realname" != "$linkname"; then
4234 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4235 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4236 fi
4237 done
4238
4239 # If -module or -export-dynamic was specified, set the dlname.
4240 if test "$module" = yes || test "$export_dynamic" = yes; then
4241 # On all known operating systems, these are identical.
4242 dlname="$soname"
4243 fi
4244 fi
4245 ;;
4246
4247 obj)
4248 if test -n "$deplibs"; then
4249 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4250 fi
4251
4252 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4253 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4254 fi
4255
4256 if test -n "$rpath"; then
4257 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4258 fi
4259
4260 if test -n "$xrpath"; then
4261 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4262 fi
4263
4264 if test -n "$vinfo"; then
4265 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4266 fi
4267
4268 if test -n "$release"; then
4269 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4270 fi
4271
4272 case $output in
4273 *.lo)
4274 if test -n "$objs$old_deplibs"; then
4275 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4276 exit $EXIT_FAILURE
4277 fi
4278 libobj="$output"
4279 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4280 ;;
4281 *)
4282 libobj=
4283 obj="$output"
4284 ;;
4285 esac
4286
4287 # Delete the old objects.
4288 $run $rm $obj $libobj
4289
4290 # Objects from convenience libraries. This assumes
4291 # single-version convenience libraries. Whenever we create
4292 # different ones for PIC/non-PIC, this we'll have to duplicate
4293 # the extraction.
4294 reload_conv_objs=
4295 gentop=
4296 # reload_cmds runs $LD directly, so let us get rid of
4297 # -Wl from whole_archive_flag_spec and hope we can get by with
4298 # turning comma into space..
4299 wl=
4300
4301 if test -n "$convenience"; then
4302 if test -n "$whole_archive_flag_spec"; then
4303 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4304 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4305 else
4306 gentop="$output_objdir/${obj}x"
4307 generated="$generated $gentop"
4308
4309 func_extract_archives $gentop $convenience
4310 reload_conv_objs="$reload_objs $func_extract_archives_result"
4311 fi
4312 fi
4313
4314 # Create the old-style object.
4315 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4316
4317 output="$obj"
4318 cmds=$reload_cmds
4319 save_ifs="$IFS"; IFS='~'
4320 for cmd in $cmds; do
4321 IFS="$save_ifs"
4322 eval cmd=\"$cmd\"
4323 $show "$cmd"
4324 $run eval "$cmd" || exit $?
4325 done
4326 IFS="$save_ifs"
4327
4328 # Exit if we aren't doing a library object file.
4329 if test -z "$libobj"; then
4330 if test -n "$gentop"; then
4331 $show "${rm}r $gentop"
4332 $run ${rm}r $gentop
4333 fi
4334
4335 exit $EXIT_SUCCESS
4336 fi
4337
4338 if test "$build_libtool_libs" != yes; then
4339 if test -n "$gentop"; then
4340 $show "${rm}r $gentop"
4341 $run ${rm}r $gentop
4342 fi
4343
4344 # Create an invalid libtool object if no PIC, so that we don't
4345 # accidentally link it into a program.
4346 # $show "echo timestamp > $libobj"
4347 # $run eval "echo timestamp > $libobj" || exit $?
4348 exit $EXIT_SUCCESS
4349 fi
4350
4351 if test -n "$pic_flag" || test "$pic_mode" != default; then
4352 # Only do commands if we really have different PIC objects.
4353 reload_objs="$libobjs $reload_conv_objs"
4354 output="$libobj"
4355 cmds=$reload_cmds
4356 save_ifs="$IFS"; IFS='~'
4357 for cmd in $cmds; do
4358 IFS="$save_ifs"
4359 eval cmd=\"$cmd\"
4360 $show "$cmd"
4361 $run eval "$cmd" || exit $?
4362 done
4363 IFS="$save_ifs"
4364 fi
4365
4366 if test -n "$gentop"; then
4367 $show "${rm}r $gentop"
4368 $run ${rm}r $gentop
4369 fi
4370
4371 exit $EXIT_SUCCESS
4372 ;;
4373
4374 prog)
4375 case $host in
4376 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4377 esac
4378 if test -n "$vinfo"; then
4379 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4380 fi
4381
4382 if test -n "$release"; then
4383 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4384 fi
4385
4386 if test "$preload" = yes; then
4387 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4388 test "$dlopen_self_static" = unknown; then
4389 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4390 fi
4391 fi
4392
4393 case $host in
4394 *-*-rhapsody* | *-*-darwin1.[012])
4395 # On Rhapsody replace the C library is the System framework
4396 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4397 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4398 ;;
4399 esac
4400
4401 case $host in
4402 *darwin*)
4403 # Don't allow lazy linking, it breaks C++ global constructors
4404 if test "$tagname" = CXX ; then
4405 compile_command="$compile_command ${wl}-bind_at_load"
4406 finalize_command="$finalize_command ${wl}-bind_at_load"
4407 fi
4408 ;;
4409 esac
4410
4411
4412 # move library search paths that coincide with paths to not yet
4413 # installed libraries to the beginning of the library search list
4414 new_libs=
4415 for path in $notinst_path; do
4416 case " $new_libs " in
4417 *" -L$path/$objdir "*) ;;
4418 *)
4419 case " $compile_deplibs " in
4420 *" -L$path/$objdir "*)
4421 new_libs="$new_libs -L$path/$objdir" ;;
4422 esac
4423 ;;
4424 esac
4425 done
4426 for deplib in $compile_deplibs; do
4427 case $deplib in
4428 -L*)
4429 case " $new_libs " in
4430 *" $deplib "*) ;;
4431 *) new_libs="$new_libs $deplib" ;;
4432 esac
4433 ;;
4434 *) new_libs="$new_libs $deplib" ;;
4435 esac
4436 done
4437 compile_deplibs="$new_libs"
4438
4439
4440 compile_command="$compile_command $compile_deplibs"
4441 finalize_command="$finalize_command $finalize_deplibs"
4442
4443 if test -n "$rpath$xrpath"; then
4444 # If the user specified any rpath flags, then add them.
4445 for libdir in $rpath $xrpath; do
4446 # This is the magic to use -rpath.
4447 case "$finalize_rpath " in
4448 *" $libdir "*) ;;
4449 *) finalize_rpath="$finalize_rpath $libdir" ;;
4450 esac
4451 done
4452 fi
4453
4454 # Now hardcode the library paths
4455 rpath=
4456 hardcode_libdirs=
4457 for libdir in $compile_rpath $finalize_rpath; do
4458 if test -n "$hardcode_libdir_flag_spec"; then
4459 if test -n "$hardcode_libdir_separator"; then
4460 if test -z "$hardcode_libdirs"; then
4461 hardcode_libdirs="$libdir"
4462 else
4463 # Just accumulate the unique libdirs.
4464 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4465 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4466 ;;
4467 *)
4468 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4469 ;;
4470 esac
4471 fi
4472 else
4473 eval flag=\"$hardcode_libdir_flag_spec\"
4474 rpath="$rpath $flag"
4475 fi
4476 elif test -n "$runpath_var"; then
4477 case "$perm_rpath " in
4478 *" $libdir "*) ;;
4479 *) perm_rpath="$perm_rpath $libdir" ;;
4480 esac
4481 fi
4482 case $host in
4483 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4484 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4485 case :$dllsearchpath: in
4486 *":$libdir:"*) ;;
4487 *) dllsearchpath="$dllsearchpath:$libdir";;
4488 esac
4489 case :$dllsearchpath: in
4490 *":$testbindir:"*) ;;
4491 *) dllsearchpath="$dllsearchpath:$testbindir";;
4492 esac
4493 ;;
4494 esac
4495 done
4496 # Substitute the hardcoded libdirs into the rpath.
4497 if test -n "$hardcode_libdir_separator" &&
4498 test -n "$hardcode_libdirs"; then
4499 libdir="$hardcode_libdirs"
4500 eval rpath=\" $hardcode_libdir_flag_spec\"
4501 fi
4502 compile_rpath="$rpath"
4503
4504 rpath=
4505 hardcode_libdirs=
4506 for libdir in $finalize_rpath; do
4507 if test -n "$hardcode_libdir_flag_spec"; then
4508 if test -n "$hardcode_libdir_separator"; then
4509 if test -z "$hardcode_libdirs"; then
4510 hardcode_libdirs="$libdir"
4511 else
4512 # Just accumulate the unique libdirs.
4513 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4514 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4515 ;;
4516 *)
4517 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4518 ;;
4519 esac
4520 fi
4521 else
4522 eval flag=\"$hardcode_libdir_flag_spec\"
4523 rpath="$rpath $flag"
4524 fi
4525 elif test -n "$runpath_var"; then
4526 case "$finalize_perm_rpath " in
4527 *" $libdir "*) ;;
4528 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4529 esac
4530 fi
4531 done
4532 # Substitute the hardcoded libdirs into the rpath.
4533 if test -n "$hardcode_libdir_separator" &&
4534 test -n "$hardcode_libdirs"; then
4535 libdir="$hardcode_libdirs"
4536 eval rpath=\" $hardcode_libdir_flag_spec\"
4537 fi
4538 finalize_rpath="$rpath"
4539
4540 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4541 # Transform all the library objects into standard objects.
4542 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4543 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4544 fi
4545
4546 dlsyms=
4547 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4548 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4549 dlsyms="${outputname}S.c"
4550 else
4551 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4552 fi
4553 fi
4554
4555 if test -n "$dlsyms"; then
4556 case $dlsyms in
4557 "") ;;
4558 *.c)
4559 # Discover the nlist of each of the dlfiles.
4560 nlist="$output_objdir/${outputname}.nm"
4561
4562 $show "$rm $nlist ${nlist}S ${nlist}T"
4563 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4564
4565 # Parse the name list into a source file.
4566 $show "creating $output_objdir/$dlsyms"
4567
4568 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4569/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4570/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4571
4572#ifdef __cplusplus
4573extern \"C\" {
4574#endif
4575
4576/* Prevent the only kind of declaration conflicts we can make. */
4577#define lt_preloaded_symbols some_other_symbol
4578
4579/* External symbol declarations for the compiler. */\
4580"
4581
4582 if test "$dlself" = yes; then
4583 $show "generating symbol list for \`$output'"
4584
4585 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4586
4587 # Add our own program objects to the symbol list.
4588 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4589 for arg in $progfiles; do
4590 $show "extracting global C symbols from \`$arg'"
4591 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4592 done
4593
4594 if test -n "$exclude_expsyms"; then
4595 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4596 $run eval '$mv "$nlist"T "$nlist"'
4597 fi
4598
4599 if test -n "$export_symbols_regex"; then
4600 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4601 $run eval '$mv "$nlist"T "$nlist"'
4602 fi
4603
4604 # Prepare the list of exported symbols
4605 if test -z "$export_symbols"; then
4606 export_symbols="$output_objdir/$outputname.exp"
4607 $run $rm $export_symbols
4608 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4609 case $host in
4610 *cygwin* | *mingw* )
4611 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4612 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4613 ;;
4614 esac
4615 else
4616 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4617 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4618 $run eval 'mv "$nlist"T "$nlist"'
4619 case $host in
4620 *cygwin* | *mingw* )
4621 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4622 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4623 ;;
4624 esac
4625 fi
4626 fi
4627
4628 for arg in $dlprefiles; do
4629 $show "extracting global C symbols from \`$arg'"
4630 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4631 $run eval '$echo ": $name " >> "$nlist"'
4632 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4633 done
4634
4635 if test -z "$run"; then
4636 # Make sure we have at least an empty file.
4637 test -f "$nlist" || : > "$nlist"
4638
4639 if test -n "$exclude_expsyms"; then
4640 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4641 $mv "$nlist"T "$nlist"
4642 fi
4643
4644 # Try sorting and uniquifying the output.
4645 if grep -v "^: " < "$nlist" |
4646 if sort -k 3 </dev/null >/dev/null 2>&1; then
4647 sort -k 3
4648 else
4649 sort +2
4650 fi |
4651 uniq > "$nlist"S; then
4652 :
4653 else
4654 grep -v "^: " < "$nlist" > "$nlist"S
4655 fi
4656
4657 if test -f "$nlist"S; then
4658 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4659 else
4660 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4661 fi
4662
4663 $echo >> "$output_objdir/$dlsyms" "\
4664
4665#undef lt_preloaded_symbols
4666
4667#if defined (__STDC__) && __STDC__
4668# define lt_ptr void *
4669#else
4670# define lt_ptr char *
4671# define const
4672#endif
4673
4674/* The mapping between symbol names and symbols. */
4675"
4676
4677 case $host in
4678 *cygwin* | *mingw* )
4679 $echo >> "$output_objdir/$dlsyms" "\
4680/* DATA imports from DLLs on WIN32 can't be const, because
4681 runtime relocations are performed -- see ld's documentation
4682 on pseudo-relocs */
4683struct {
4684"
4685 ;;
4686 * )
4687 $echo >> "$output_objdir/$dlsyms" "\
4688const struct {
4689"
4690 ;;
4691 esac
4692
4693
4694 $echo >> "$output_objdir/$dlsyms" "\
4695 const char *name;
4696 lt_ptr address;
4697}
4698lt_preloaded_symbols[] =
4699{\
4700"
4701
4702 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4703
4704 $echo >> "$output_objdir/$dlsyms" "\
4705 {0, (lt_ptr) 0}
4706};
4707
4708/* This works around a problem in FreeBSD linker */
4709#ifdef FREEBSD_WORKAROUND
4710static const void *lt_preloaded_setup() {
4711 return lt_preloaded_symbols;
4712}
4713#endif
4714
4715#ifdef __cplusplus
4716}
4717#endif\
4718"
4719 fi
4720
4721 pic_flag_for_symtable=
4722 case $host in
4723 # compiling the symbol table file with pic_flag works around
4724 # a FreeBSD bug that causes programs to crash when -lm is
4725 # linked before any other PIC object. But we must not use
4726 # pic_flag when linking with -static. The problem exists in
4727 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4728 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4729 case "$compile_command " in
4730 *" -static "*) ;;
4731 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4732 esac;;
4733 *-*-hpux*)
4734 case "$compile_command " in
4735 *" -static "*) ;;
4736 *) pic_flag_for_symtable=" $pic_flag";;
4737 esac
4738 esac
4739
4740 # Now compile the dynamic symbol file.
4741 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4742 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4743
4744 # Clean up the generated files.
4745 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4746 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4747
4748 # Transform the symbol file into the correct name.
4749 case $host in
4750 *cygwin* | *mingw* )
4751 if test -f "$output_objdir/${outputname}.def" ; then
4752 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4753 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4754 else
4755 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4756 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4757 fi
4758 ;;
4759 * )
4760 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4761 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4762 ;;
4763 esac
4764 ;;
4765 *)
4766 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4767 exit $EXIT_FAILURE
4768 ;;
4769 esac
4770 else
4771 # We keep going just in case the user didn't refer to
4772 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4773 # really was required.
4774
4775 # Nullify the symbol file.
4776 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4777 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4778 fi
4779
4780 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4781 # Replace the output file specification.
4782 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4783 link_command="$compile_command$compile_rpath"
4784
4785 # We have no uninstalled library dependencies, so finalize right now.
4786 $show "$link_command"
4787 $run eval "$link_command"
4788 exit_status=$?
4789
4790 # Delete the generated files.
4791 if test -n "$dlsyms"; then
4792 $show "$rm $output_objdir/${outputname}S.${objext}"
4793 $run $rm "$output_objdir/${outputname}S.${objext}"
4794 fi
4795
4796 exit $exit_status
4797 fi
4798
4799 if test -n "$shlibpath_var"; then
4800 # We should set the shlibpath_var
4801 rpath=
4802 for dir in $temp_rpath; do
4803 case $dir in
4804 [\\/]* | [A-Za-z]:[\\/]*)
4805 # Absolute path.
4806 rpath="$rpath$dir:"
4807 ;;
4808 *)
4809 # Relative path: add a thisdir entry.
4810 rpath="$rpath\$thisdir/$dir:"
4811 ;;
4812 esac
4813 done
4814 temp_rpath="$rpath"
4815 fi
4816
4817 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4818 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4819 fi
4820 if test -n "$finalize_shlibpath"; then
4821 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4822 fi
4823
4824 compile_var=
4825 finalize_var=
4826 if test -n "$runpath_var"; then
4827 if test -n "$perm_rpath"; then
4828 # We should set the runpath_var.
4829 rpath=
4830 for dir in $perm_rpath; do
4831 rpath="$rpath$dir:"
4832 done
4833 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4834 fi
4835 if test -n "$finalize_perm_rpath"; then
4836 # We should set the runpath_var.
4837 rpath=
4838 for dir in $finalize_perm_rpath; do
4839 rpath="$rpath$dir:"
4840 done
4841 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4842 fi
4843 fi
4844
4845 if test "$no_install" = yes; then
4846 # We don't need to create a wrapper script.
4847 link_command="$compile_var$compile_command$compile_rpath"
4848 # Replace the output file specification.
4849 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4850 # Delete the old output file.
4851 $run $rm $output
4852 # Link the executable and exit
4853 $show "$link_command"
4854 $run eval "$link_command" || exit $?
4855 exit $EXIT_SUCCESS
4856 fi
4857
4858 if test "$hardcode_action" = relink; then
4859 # Fast installation is not supported
4860 link_command="$compile_var$compile_command$compile_rpath"
4861 relink_command="$finalize_var$finalize_command$finalize_rpath"
4862
4863 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4864 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4865 else
4866 if test "$fast_install" != no; then
4867 link_command="$finalize_var$compile_command$finalize_rpath"
4868 if test "$fast_install" = yes; then
4869 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4870 else
4871 # fast_install is set to needless
4872 relink_command=
4873 fi
4874 else
4875 link_command="$compile_var$compile_command$compile_rpath"
4876 relink_command="$finalize_var$finalize_command$finalize_rpath"
4877 fi
4878 fi
4879
4880 # Replace the output file specification.
4881 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4882
4883 # Delete the old output files.
4884 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4885
4886 $show "$link_command"
4887 $run eval "$link_command" || exit $?
4888
4889 # Now create the wrapper script.
4890 $show "creating $output"
4891
4892 # Quote the relink command for shipping.
4893 if test -n "$relink_command"; then
4894 # Preserve any variables that may affect compiler behavior
4895 for var in $variables_saved_for_relink; do
4896 if eval test -z \"\${$var+set}\"; then
4897 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4898 elif eval var_value=\$$var; test -z "$var_value"; then
4899 relink_command="$var=; export $var; $relink_command"
4900 else
4901 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4902 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4903 fi
4904 done
4905 relink_command="(cd `pwd`; $relink_command)"
4906 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4907 fi
4908
4909 # Quote $echo for shipping.
4910 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4911 case $progpath in
4912 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4913 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4914 esac
4915 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4916 else
4917 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4918 fi
4919
4920 # Only actually do things if our run command is non-null.
4921 if test -z "$run"; then
4922 # win32 will think the script is a binary if it has
4923 # a .exe suffix, so we strip it off here.
4924 case $output in
4925 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4926 esac
4927 # test for cygwin because mv fails w/o .exe extensions
4928 case $host in
4929 *cygwin*)
4930 exeext=.exe
4931 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4932 *) exeext= ;;
4933 esac
4934 case $host in
4935 *cygwin* | *mingw* )
4936 output_name=`basename $output`
4937 output_path=`dirname $output`
4938 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4939 cwrapper="$output_path/$output_name.exe"
4940 $rm $cwrappersource $cwrapper
4941 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4942
4943 cat > $cwrappersource <<EOF
4944
4945/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4946 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4947
4948 The $output program cannot be directly executed until all the libtool
4949 libraries that it depends on are installed.
4950
4951 This wrapper executable should never be moved out of the build directory.
4952 If it is, it will not operate correctly.
4953
4954 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4955 but could eventually absorb all of the scripts functionality and
4956 exec $objdir/$outputname directly.
4957*/
4958EOF
4959 cat >> $cwrappersource<<"EOF"
4960#include <stdio.h>
4961#include <stdlib.h>
4962#include <unistd.h>
4963#include <malloc.h>
4964#include <stdarg.h>
4965#include <assert.h>
4966#include <string.h>
4967#include <ctype.h>
4968#include <sys/stat.h>
4969
4970#if defined(PATH_MAX)
4971# define LT_PATHMAX PATH_MAX
4972#elif defined(MAXPATHLEN)
4973# define LT_PATHMAX MAXPATHLEN
4974#else
4975# define LT_PATHMAX 1024
4976#endif
4977
4978#ifndef DIR_SEPARATOR
4979# define DIR_SEPARATOR '/'
4980# define PATH_SEPARATOR ':'
4981#endif
4982
4983#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4984 defined (__OS2__)
4985# define HAVE_DOS_BASED_FILE_SYSTEM
4986# ifndef DIR_SEPARATOR_2
4987# define DIR_SEPARATOR_2 '\\'
4988# endif
4989# ifndef PATH_SEPARATOR_2
4990# define PATH_SEPARATOR_2 ';'
4991# endif
4992#endif
4993
4994#ifndef DIR_SEPARATOR_2
4995# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4996#else /* DIR_SEPARATOR_2 */
4997# define IS_DIR_SEPARATOR(ch) \
4998 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4999#endif /* DIR_SEPARATOR_2 */
5000
5001#ifndef PATH_SEPARATOR_2
5002# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5003#else /* PATH_SEPARATOR_2 */
5004# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5005#endif /* PATH_SEPARATOR_2 */
5006
5007#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5008#define XFREE(stale) do { \
5009 if (stale) { free ((void *) stale); stale = 0; } \
5010} while (0)
5011
5012/* -DDEBUG is fairly common in CFLAGS. */
5013#undef DEBUG
5014#if defined DEBUGWRAPPER
5015# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5016#else
5017# define DEBUG(format, ...)
5018#endif
5019
5020const char *program_name = NULL;
5021
5022void * xmalloc (size_t num);
5023char * xstrdup (const char *string);
5024const char * base_name (const char *name);
5025char * find_executable(const char *wrapper);
5026int check_executable(const char *path);
5027char * strendzap(char *str, const char *pat);
5028void lt_fatal (const char *message, ...);
5029
5030int
5031main (int argc, char *argv[])
5032{
5033 char **newargz;
5034 int i;
5035
5036 program_name = (char *) xstrdup (base_name (argv[0]));
5037 DEBUG("(main) argv[0] : %s\n",argv[0]);
5038 DEBUG("(main) program_name : %s\n",program_name);
5039 newargz = XMALLOC(char *, argc+2);
5040EOF
5041
5042 cat >> $cwrappersource <<EOF
5043 newargz[0] = (char *) xstrdup("$SHELL");
5044EOF
5045
5046 cat >> $cwrappersource <<"EOF"
5047 newargz[1] = find_executable(argv[0]);
5048 if (newargz[1] == NULL)
5049 lt_fatal("Couldn't find %s", argv[0]);
5050 DEBUG("(main) found exe at : %s\n",newargz[1]);
5051 /* we know the script has the same name, without the .exe */
5052 /* so make sure newargz[1] doesn't end in .exe */
5053 strendzap(newargz[1],".exe");
5054 for (i = 1; i < argc; i++)
5055 newargz[i+1] = xstrdup(argv[i]);
5056 newargz[argc+1] = NULL;
5057
5058 for (i=0; i<argc+1; i++)
5059 {
5060 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5061 ;
5062 }
5063
5064EOF
5065
5066 case $host_os in
5067 mingw*)
5068 cat >> $cwrappersource <<EOF
5069 execv("$SHELL",(char const **)newargz);
5070EOF
5071 ;;
5072 *)
5073 cat >> $cwrappersource <<EOF
5074 execv("$SHELL",newargz);
5075EOF
5076 ;;
5077 esac
5078
5079 cat >> $cwrappersource <<"EOF"
5080 return 127;
5081}
5082
5083void *
5084xmalloc (size_t num)
5085{
5086 void * p = (void *) malloc (num);
5087 if (!p)
5088 lt_fatal ("Memory exhausted");
5089
5090 return p;
5091}
5092
5093char *
5094xstrdup (const char *string)
5095{
5096 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5097;
5098}
5099
5100const char *
5101base_name (const char *name)
5102{
5103 const char *base;
5104
5105#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5106 /* Skip over the disk name in MSDOS pathnames. */
5107 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5108 name += 2;
5109#endif
5110
5111 for (base = name; *name; name++)
5112 if (IS_DIR_SEPARATOR (*name))
5113 base = name + 1;
5114 return base;
5115}
5116
5117int
5118check_executable(const char * path)
5119{
5120 struct stat st;
5121
5122 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5123 if ((!path) || (!*path))
5124 return 0;
5125
5126 if ((stat (path, &st) >= 0) &&
5127 (
5128 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5129#if defined (S_IXOTH)
5130 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5131#endif
5132#if defined (S_IXGRP)
5133 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5134#endif
5135 ((st.st_mode & S_IXUSR) == S_IXUSR))
5136 )
5137 return 1;
5138 else
5139 return 0;
5140}
5141
5142/* Searches for the full path of the wrapper. Returns
5143 newly allocated full path name if found, NULL otherwise */
5144char *
5145find_executable (const char* wrapper)
5146{
5147 int has_slash = 0;
5148 const char* p;
5149 const char* p_next;
5150 /* static buffer for getcwd */
5151 char tmp[LT_PATHMAX + 1];
5152 int tmp_len;
5153 char* concat_name;
5154
5155 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5156
5157 if ((wrapper == NULL) || (*wrapper == '\0'))
5158 return NULL;
5159
5160 /* Absolute path? */
5161#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5162 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5163 {
5164 concat_name = xstrdup (wrapper);
5165 if (check_executable(concat_name))
5166 return concat_name;
5167 XFREE(concat_name);
5168 }
5169 else
5170 {
5171#endif
5172 if (IS_DIR_SEPARATOR (wrapper[0]))
5173 {
5174 concat_name = xstrdup (wrapper);
5175 if (check_executable(concat_name))
5176 return concat_name;
5177 XFREE(concat_name);
5178 }
5179#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5180 }
5181#endif
5182
5183 for (p = wrapper; *p; p++)
5184 if (*p == '/')
5185 {
5186 has_slash = 1;
5187 break;
5188 }
5189 if (!has_slash)
5190 {
5191 /* no slashes; search PATH */
5192 const char* path = getenv ("PATH");
5193 if (path != NULL)
5194 {
5195 for (p = path; *p; p = p_next)
5196 {
5197 const char* q;
5198 size_t p_len;
5199 for (q = p; *q; q++)
5200 if (IS_PATH_SEPARATOR(*q))
5201 break;
5202 p_len = q - p;
5203 p_next = (*q == '\0' ? q : q + 1);
5204 if (p_len == 0)
5205 {
5206 /* empty path: current directory */
5207 if (getcwd (tmp, LT_PATHMAX) == NULL)
5208 lt_fatal ("getcwd failed");
5209 tmp_len = strlen(tmp);
5210 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5211 memcpy (concat_name, tmp, tmp_len);
5212 concat_name[tmp_len] = '/';
5213 strcpy (concat_name + tmp_len + 1, wrapper);
5214 }
5215 else
5216 {
5217 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5218 memcpy (concat_name, p, p_len);
5219 concat_name[p_len] = '/';
5220 strcpy (concat_name + p_len + 1, wrapper);
5221 }
5222 if (check_executable(concat_name))
5223 return concat_name;
5224 XFREE(concat_name);
5225 }
5226 }
5227 /* not found in PATH; assume curdir */
5228 }
5229 /* Relative path | not found in path: prepend cwd */
5230 if (getcwd (tmp, LT_PATHMAX) == NULL)
5231 lt_fatal ("getcwd failed");
5232 tmp_len = strlen(tmp);
5233 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5234 memcpy (concat_name, tmp, tmp_len);
5235 concat_name[tmp_len] = '/';
5236 strcpy (concat_name + tmp_len + 1, wrapper);
5237
5238 if (check_executable(concat_name))
5239 return concat_name;
5240 XFREE(concat_name);
5241 return NULL;
5242}
5243
5244char *
5245strendzap(char *str, const char *pat)
5246{
5247 size_t len, patlen;
5248
5249 assert(str != NULL);
5250 assert(pat != NULL);
5251
5252 len = strlen(str);
5253 patlen = strlen(pat);
5254
5255 if (patlen <= len)
5256 {
5257 str += len - patlen;
5258 if (strcmp(str, pat) == 0)
5259 *str = '\0';
5260 }
5261 return str;
5262}
5263
5264static void
5265lt_error_core (int exit_status, const char * mode,
5266 const char * message, va_list ap)
5267{
5268 fprintf (stderr, "%s: %s: ", program_name, mode);
5269 vfprintf (stderr, message, ap);
5270 fprintf (stderr, ".\n");
5271
5272 if (exit_status >= 0)
5273 exit (exit_status);
5274}
5275
5276void
5277lt_fatal (const char *message, ...)
5278{
5279 va_list ap;
5280 va_start (ap, message);
5281 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5282 va_end (ap);
5283}
5284EOF
5285 # we should really use a build-platform specific compiler
5286 # here, but OTOH, the wrappers (shell script and this C one)
5287 # are only useful if you want to execute the "real" binary.
5288 # Since the "real" binary is built for $host, then this
5289 # wrapper might as well be built for $host, too.
5290 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5291 ;;
5292 esac
5293 $rm $output
5294 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5295
5296 $echo > $output "\
5297#! $SHELL
5298
5299# $output - temporary wrapper script for $objdir/$outputname
5300# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5301#
5302# The $output program cannot be directly executed until all the libtool
5303# libraries that it depends on are installed.
5304#
5305# This wrapper script should never be moved out of the build directory.
5306# If it is, it will not operate correctly.
5307
5308# Sed substitution that helps us do robust quoting. It backslashifies
5309# metacharacters that are still active within double-quoted strings.
5310Xsed='${SED} -e 1s/^X//'
5311sed_quote_subst='$sed_quote_subst'
5312
5313# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5314if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5315 emulate sh
5316 NULLCMD=:
5317 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5318 # is contrary to our usage. Disable this feature.
5319 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5320 setopt NO_GLOB_SUBST
5321else
5322 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5323fi
5324BIN_SH=xpg4; export BIN_SH # for Tru64
5325DUALCASE=1; export DUALCASE # for MKS sh
5326
5327# The HP-UX ksh and POSIX shell print the target directory to stdout
5328# if CDPATH is set.
5329(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5330
5331relink_command=\"$relink_command\"
5332
5333# This environment variable determines our operation mode.
5334if test \"\$libtool_install_magic\" = \"$magic\"; then
5335 # install mode needs the following variable:
5336 notinst_deplibs='$notinst_deplibs'
5337else
5338 # When we are sourced in execute mode, \$file and \$echo are already set.
5339 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5340 echo=\"$qecho\"
5341 file=\"\$0\"
5342 # Make sure echo works.
5343 if test \"X\$1\" = X--no-reexec; then
5344 # Discard the --no-reexec flag, and continue.
5345 shift
5346 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5347 # Yippee, \$echo works!
5348 :
5349 else
5350 # Restart under the correct shell, and then maybe \$echo will work.
5351 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5352 fi
5353 fi\
5354"
5355 $echo >> $output "\
5356
5357 # Find the directory that this script lives in.
5358 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5359 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5360
5361 # Follow symbolic links until we get to the real thisdir.
5362 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5363 while test -n \"\$file\"; do
5364 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5365
5366 # If there was a directory component, then change thisdir.
5367 if test \"x\$destdir\" != \"x\$file\"; then
5368 case \"\$destdir\" in
5369 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5370 *) thisdir=\"\$thisdir/\$destdir\" ;;
5371 esac
5372 fi
5373
5374 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5375 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5376 done
5377
5378 # Try to get the absolute directory name.
5379 absdir=\`cd \"\$thisdir\" && pwd\`
5380 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5381"
5382
5383 if test "$fast_install" = yes; then
5384 $echo >> $output "\
5385 program=lt-'$outputname'$exeext
5386 progdir=\"\$thisdir/$objdir\"
5387
5388 if test ! -f \"\$progdir/\$program\" || \\
5389 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5390 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5391
5392 file=\"\$\$-\$program\"
5393
5394 if test ! -d \"\$progdir\"; then
5395 $mkdir \"\$progdir\"
5396 else
5397 $rm \"\$progdir/\$file\"
5398 fi"
5399
5400 $echo >> $output "\
5401
5402 # relink executable if necessary
5403 if test -n \"\$relink_command\"; then
5404 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5405 else
5406 $echo \"\$relink_command_output\" >&2
5407 $rm \"\$progdir/\$file\"
5408 exit $EXIT_FAILURE
5409 fi
5410 fi
5411
5412 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5413 { $rm \"\$progdir/\$program\";
5414 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5415 $rm \"\$progdir/\$file\"
5416 fi"
5417 else
5418 $echo >> $output "\
5419 program='$outputname'
5420 progdir=\"\$thisdir/$objdir\"
5421"
5422 fi
5423
5424 $echo >> $output "\
5425
5426 if test -f \"\$progdir/\$program\"; then"
5427
5428 # Export our shlibpath_var if we have one.
5429 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5430 $echo >> $output "\
5431 # Add our own library path to $shlibpath_var
5432 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5433
5434 # Some systems cannot cope with colon-terminated $shlibpath_var
5435 # The second colon is a workaround for a bug in BeOS R4 sed
5436 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5437
5438 export $shlibpath_var
5439"
5440 fi
5441
5442 # fixup the dll searchpath if we need to.
5443 if test -n "$dllsearchpath"; then
5444 $echo >> $output "\
5445 # Add the dll search path components to the executable PATH
5446 PATH=$dllsearchpath:\$PATH
5447"
5448 fi
5449
5450 $echo >> $output "\
5451 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5452 # Run the actual program with our arguments.
5453"
5454 case $host in
5455 # Backslashes separate directories on plain windows
5456 *-*-mingw | *-*-os2*)
5457 $echo >> $output "\
5458 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5459"
5460 ;;
5461
5462 *)
5463 $echo >> $output "\
5464 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5465"
5466 ;;
5467 esac
5468 $echo >> $output "\
5469 \$echo \"\$0: cannot exec \$program \$*\"
5470 exit $EXIT_FAILURE
5471 fi
5472 else
5473 # The program doesn't exist.
5474 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5475 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5476 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5477 exit $EXIT_FAILURE
5478 fi
5479fi\
5480"
5481 chmod +x $output
5482 fi
5483 exit $EXIT_SUCCESS
5484 ;;
5485 esac
5486
5487 # See if we need to build an old-fashioned archive.
5488 for oldlib in $oldlibs; do
5489
5490 if test "$build_libtool_libs" = convenience; then
5491 oldobjs="$libobjs_save"
5492 addlibs="$convenience"
5493 build_libtool_libs=no
5494 else
5495 if test "$build_libtool_libs" = module; then
5496 oldobjs="$libobjs_save"
5497 build_libtool_libs=no
5498 else
5499 oldobjs="$old_deplibs $non_pic_objects"
5500 fi
5501 addlibs="$old_convenience"
5502 fi
5503
5504 if test -n "$addlibs"; then
5505 gentop="$output_objdir/${outputname}x"
5506 generated="$generated $gentop"
5507
5508 func_extract_archives $gentop $addlibs
5509 oldobjs="$oldobjs $func_extract_archives_result"
5510 fi
5511
5512 # Do each command in the archive commands.
5513 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5514 cmds=$old_archive_from_new_cmds
5515 else
5516 # POSIX demands no paths to be encoded in archives. We have
5517 # to avoid creating archives with duplicate basenames if we
5518 # might have to extract them afterwards, e.g., when creating a
5519 # static archive out of a convenience library, or when linking
5520 # the entirety of a libtool archive into another (currently
5521 # not supported by libtool).
5522 if (for obj in $oldobjs
5523 do
5524 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5525 done | sort | sort -uc >/dev/null 2>&1); then
5526 :
5527 else
5528 $echo "copying selected object files to avoid basename conflicts..."
5529
5530 if test -z "$gentop"; then
5531 gentop="$output_objdir/${outputname}x"
5532 generated="$generated $gentop"
5533
5534 $show "${rm}r $gentop"
5535 $run ${rm}r "$gentop"
5536 $show "$mkdir $gentop"
5537 $run $mkdir "$gentop"
5538 exit_status=$?
5539 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5540 exit $exit_status
5541 fi
5542 fi
5543
5544 save_oldobjs=$oldobjs
5545 oldobjs=
5546 counter=1
5547 for obj in $save_oldobjs
5548 do
5549 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5550 case " $oldobjs " in
5551 " ") oldobjs=$obj ;;
5552 *[\ /]"$objbase "*)
5553 while :; do
5554 # Make sure we don't pick an alternate name that also
5555 # overlaps.
5556 newobj=lt$counter-$objbase
5557 counter=`expr $counter + 1`
5558 case " $oldobjs " in
5559 *[\ /]"$newobj "*) ;;
5560 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5561 esac
5562 done
5563 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5564 $run ln "$obj" "$gentop/$newobj" ||
5565 $run cp "$obj" "$gentop/$newobj"
5566 oldobjs="$oldobjs $gentop/$newobj"
5567 ;;
5568 *) oldobjs="$oldobjs $obj" ;;
5569 esac
5570 done
5571 fi
5572
5573 eval cmds=\"$old_archive_cmds\"
5574
5575 if len=`expr "X$cmds" : ".*"` &&
5576 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5577 cmds=$old_archive_cmds
5578 else
5579 # the command line is too long to link in one step, link in parts
5580 $echo "using piecewise archive linking..."
5581 save_RANLIB=$RANLIB
5582 RANLIB=:
5583 objlist=
5584 concat_cmds=
5585 save_oldobjs=$oldobjs
5586
5587 # Is there a better way of finding the last object in the list?
5588 for obj in $save_oldobjs
5589 do
5590 last_oldobj=$obj
5591 done
5592 for obj in $save_oldobjs
5593 do
5594 oldobjs="$objlist $obj"
5595 objlist="$objlist $obj"
5596 eval test_cmds=\"$old_archive_cmds\"
5597 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5598 test "$len" -le "$max_cmd_len"; then
5599 :
5600 else
5601 # the above command should be used before it gets too long
5602 oldobjs=$objlist
5603 if test "$obj" = "$last_oldobj" ; then
5604 RANLIB=$save_RANLIB
5605 fi
5606 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5607 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5608 objlist=
5609 fi
5610 done
5611 RANLIB=$save_RANLIB
5612 oldobjs=$objlist
5613 if test "X$oldobjs" = "X" ; then
5614 eval cmds=\"\$concat_cmds\"
5615 else
5616 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5617 fi
5618 fi
5619 fi
5620 save_ifs="$IFS"; IFS='~'
5621 for cmd in $cmds; do
5622 eval cmd=\"$cmd\"
5623 IFS="$save_ifs"
5624 $show "$cmd"
5625 $run eval "$cmd" || exit $?
5626 done
5627 IFS="$save_ifs"
5628 done
5629
5630 if test -n "$generated"; then
5631 $show "${rm}r$generated"
5632 $run ${rm}r$generated
5633 fi
5634
5635 # Now create the libtool archive.
5636 case $output in
5637 *.la)
5638 old_library=
5639 test "$build_old_libs" = yes && old_library="$libname.$libext"
5640 $show "creating $output"
5641
5642 # Preserve any variables that may affect compiler behavior
5643 for var in $variables_saved_for_relink; do
5644 if eval test -z \"\${$var+set}\"; then
5645 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5646 elif eval var_value=\$$var; test -z "$var_value"; then
5647 relink_command="$var=; export $var; $relink_command"
5648 else
5649 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5650 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5651 fi
5652 done
5653 # Quote the link command for shipping.
5654 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5655 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5656 if test "$hardcode_automatic" = yes ; then
5657 relink_command=
5658 fi
5659
5660
5661 # Only create the output if not a dry run.
5662 if test -z "$run"; then
5663 for installed in no yes; do
5664 if test "$installed" = yes; then
5665 if test -z "$install_libdir"; then
5666 break
5667 fi
5668 output="$output_objdir/$outputname"i
5669 # Replace all uninstalled libtool libraries with the installed ones
5670 newdependency_libs=
5671 for deplib in $dependency_libs; do
5672 case $deplib in
5673 *.la)
5674 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5675 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5676 if test -z "$libdir"; then
5677 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5678 exit $EXIT_FAILURE
5679 fi
5680 newdependency_libs="$newdependency_libs $libdir/$name"
5681 ;;
5682 *) newdependency_libs="$newdependency_libs $deplib" ;;
5683 esac
5684 done
5685 dependency_libs="$newdependency_libs"
5686 newdlfiles=
5687 for lib in $dlfiles; do
5688 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5689 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5690 if test -z "$libdir"; then
5691 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5692 exit $EXIT_FAILURE
5693 fi
5694 newdlfiles="$newdlfiles $libdir/$name"
5695 done
5696 dlfiles="$newdlfiles"
5697 newdlprefiles=
5698 for lib in $dlprefiles; do
5699 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5700 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5701 if test -z "$libdir"; then
5702 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5703 exit $EXIT_FAILURE
5704 fi
5705 newdlprefiles="$newdlprefiles $libdir/$name"
5706 done
5707 dlprefiles="$newdlprefiles"
5708 else
5709 newdlfiles=
5710 for lib in $dlfiles; do
5711 case $lib in
5712 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5713 *) abs=`pwd`"/$lib" ;;
5714 esac
5715 newdlfiles="$newdlfiles $abs"
5716 done
5717 dlfiles="$newdlfiles"
5718 newdlprefiles=
5719 for lib in $dlprefiles; do
5720 case $lib in
5721 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5722 *) abs=`pwd`"/$lib" ;;
5723 esac
5724 newdlprefiles="$newdlprefiles $abs"
5725 done
5726 dlprefiles="$newdlprefiles"
5727 fi
5728 $rm $output
5729 # place dlname in correct position for cygwin
5730 tdlname=$dlname
5731 case $host,$output,$installed,$module,$dlname in
5732 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5733 esac
5734 $echo > $output "\
5735# $outputname - a libtool library file
5736# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5737#
5738# Please DO NOT delete this file!
5739# It is necessary for linking the library.
5740
5741# The name that we can dlopen(3).
5742dlname='$tdlname'
5743
5744# Names of this library.
5745library_names='$library_names'
5746
5747# The name of the static archive.
5748old_library='$old_library'
5749
5750# Libraries that this one depends upon.
5751dependency_libs='$dependency_libs'
5752
5753# Version information for $libname.
5754current=$current
5755age=$age
5756revision=$revision
5757
5758# Is this an already installed library?
5759installed=$installed
5760
5761# Should we warn about portability when linking against -modules?
5762shouldnotlink=$module
5763
5764# Files to dlopen/dlpreopen
5765dlopen='$dlfiles'
5766dlpreopen='$dlprefiles'
5767
5768# Directory that this library needs to be installed in:
5769libdir='$install_libdir'"
5770 if test "$installed" = no && test "$need_relink" = yes; then
5771 $echo >> $output "\
5772relink_command=\"$relink_command\""
5773 fi
5774 done
5775 fi
5776
5777 # Do a symbolic link so that the libtool archive can be found in
5778 # LD_LIBRARY_PATH before the program is installed.
5779 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5780 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5781 ;;
5782 esac
5783 exit $EXIT_SUCCESS
5784 ;;
5785
5786 # libtool install mode
5787 install)
5788 modename="$modename: install"
5789
5790 # There may be an optional sh(1) argument at the beginning of
5791 # install_prog (especially on Windows NT).
5792 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5793 # Allow the use of GNU shtool's install command.
5794 $echo "X$nonopt" | grep shtool > /dev/null; then
5795 # Aesthetically quote it.
5796 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5797 case $arg in
5798 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5799 arg="\"$arg\""
5800 ;;
5801 esac
5802 install_prog="$arg "
5803 arg="$1"
5804 shift
5805 else
5806 install_prog=
5807 arg=$nonopt
5808 fi
5809
5810 # The real first argument should be the name of the installation program.
5811 # Aesthetically quote it.
5812 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5813 case $arg in
5814 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5815 arg="\"$arg\""
5816 ;;
5817 esac
5818 install_prog="$install_prog$arg"
5819
5820 # We need to accept at least all the BSD install flags.
5821 dest=
5822 files=
5823 opts=
5824 prev=
5825 install_type=
5826 isdir=no
5827 stripme=
5828 for arg
5829 do
5830 if test -n "$dest"; then
5831 files="$files $dest"
5832 dest=$arg
5833 continue
5834 fi
5835
5836 case $arg in
5837 -d) isdir=yes ;;
5838 -f)
5839 case " $install_prog " in
5840 *[\\\ /]cp\ *) ;;
5841 *) prev=$arg ;;
5842 esac
5843 ;;
5844 -g | -m | -o) prev=$arg ;;
5845 -s)
5846 stripme=" -s"
5847 continue
5848 ;;
5849 -*)
5850 ;;
5851 *)
5852 # If the previous option needed an argument, then skip it.
5853 if test -n "$prev"; then
5854 prev=
5855 else
5856 dest=$arg
5857 continue
5858 fi
5859 ;;
5860 esac
5861
5862 # Aesthetically quote the argument.
5863 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5864 case $arg in
5865 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5866 arg="\"$arg\""
5867 ;;
5868 esac
5869 install_prog="$install_prog $arg"
5870 done
5871
5872 if test -z "$install_prog"; then
5873 $echo "$modename: you must specify an install program" 1>&2
5874 $echo "$help" 1>&2
5875 exit $EXIT_FAILURE
5876 fi
5877
5878 if test -n "$prev"; then
5879 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5880 $echo "$help" 1>&2
5881 exit $EXIT_FAILURE
5882 fi
5883
5884 if test -z "$files"; then
5885 if test -z "$dest"; then
5886 $echo "$modename: no file or destination specified" 1>&2
5887 else
5888 $echo "$modename: you must specify a destination" 1>&2
5889 fi
5890 $echo "$help" 1>&2
5891 exit $EXIT_FAILURE
5892 fi
5893
5894 # Strip any trailing slash from the destination.
5895 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5896
5897 # Check to see that the destination is a directory.
5898 test -d "$dest" && isdir=yes
5899 if test "$isdir" = yes; then
5900 destdir="$dest"
5901 destname=
5902 else
5903 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5904 test "X$destdir" = "X$dest" && destdir=.
5905 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5906
5907 # Not a directory, so check to see that there is only one file specified.
5908 set dummy $files
5909 if test "$#" -gt 2; then
5910 $echo "$modename: \`$dest' is not a directory" 1>&2
5911 $echo "$help" 1>&2
5912 exit $EXIT_FAILURE
5913 fi
5914 fi
5915 case $destdir in
5916 [\\/]* | [A-Za-z]:[\\/]*) ;;
5917 *)
5918 for file in $files; do
5919 case $file in
5920 *.lo) ;;
5921 *)
5922 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5923 $echo "$help" 1>&2
5924 exit $EXIT_FAILURE
5925 ;;
5926 esac
5927 done
5928 ;;
5929 esac
5930
5931 # This variable tells wrapper scripts just to set variables rather
5932 # than running their programs.
5933 libtool_install_magic="$magic"
5934
5935 staticlibs=
5936 future_libdirs=
5937 current_libdirs=
5938 for file in $files; do
5939
5940 # Do each installation.
5941 case $file in
5942 *.$libext)
5943 # Do the static libraries later.
5944 staticlibs="$staticlibs $file"
5945 ;;
5946
5947 *.la)
5948 # Check to see that this really is a libtool archive.
5949 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5950 else
5951 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5952 $echo "$help" 1>&2
5953 exit $EXIT_FAILURE
5954 fi
5955
5956 library_names=
5957 old_library=
5958 relink_command=
5959 # If there is no directory component, then add one.
5960 case $file in
5961 */* | *\\*) . $file ;;
5962 *) . ./$file ;;
5963 esac
5964
5965 # Add the libdir to current_libdirs if it is the destination.
5966 if test "X$destdir" = "X$libdir"; then
5967 case "$current_libdirs " in
5968 *" $libdir "*) ;;
5969 *) current_libdirs="$current_libdirs $libdir" ;;
5970 esac
5971 else
5972 # Note the libdir as a future libdir.
5973 case "$future_libdirs " in
5974 *" $libdir "*) ;;
5975 *) future_libdirs="$future_libdirs $libdir" ;;
5976 esac
5977 fi
5978
5979 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5980 test "X$dir" = "X$file/" && dir=
5981 dir="$dir$objdir"
5982
5983 if test -n "$relink_command"; then
5984 # Determine the prefix the user has applied to our future dir.
5985 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5986
5987 # Don't allow the user to place us outside of our expected
5988 # location b/c this prevents finding dependent libraries that
5989 # are installed to the same prefix.
5990 # At present, this check doesn't affect windows .dll's that
5991 # are installed into $libdir/../bin (currently, that works fine)
5992 # but it's something to keep an eye on.
5993 if test "$inst_prefix_dir" = "$destdir"; then
5994 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5995 exit $EXIT_FAILURE
5996 fi
5997
5998 if test -n "$inst_prefix_dir"; then
5999 # Stick the inst_prefix_dir data into the link command.
6000 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6001 else
6002 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6003 fi
6004
6005 $echo "$modename: warning: relinking \`$file'" 1>&2
6006 $show "$relink_command"
6007 if $run eval "$relink_command"; then :
6008 else
6009 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6010 exit $EXIT_FAILURE
6011 fi
6012 fi
6013
6014 # See the names of the shared library.
6015 set dummy $library_names
6016 if test -n "$2"; then
6017 realname="$2"
6018 shift
6019 shift
6020
6021 srcname="$realname"
6022 test -n "$relink_command" && srcname="$realname"T
6023
6024 # Install the shared library and build the symlinks.
6025 $show "$install_prog $dir/$srcname $destdir/$realname"
6026 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6027 if test -n "$stripme" && test -n "$striplib"; then
6028 $show "$striplib $destdir/$realname"
6029 $run eval "$striplib $destdir/$realname" || exit $?
6030 fi
6031
6032 if test "$#" -gt 0; then
6033 # Delete the old symlinks, and create new ones.
6034 # Try `ln -sf' first, because the `ln' binary might depend on
6035 # the symlink we replace! Solaris /bin/ln does not understand -f,
6036 # so we also need to try rm && ln -s.
6037 for linkname
6038 do
6039 if test "$linkname" != "$realname"; then
6040 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6041 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6042 fi
6043 done
6044 fi
6045
6046 # Do each command in the postinstall commands.
6047 lib="$destdir/$realname"
6048 cmds=$postinstall_cmds
6049 save_ifs="$IFS"; IFS='~'
6050 for cmd in $cmds; do
6051 IFS="$save_ifs"
6052 eval cmd=\"$cmd\"
6053 $show "$cmd"
6054 $run eval "$cmd" || {
6055 lt_exit=$?
6056
6057 # Restore the uninstalled library and exit
6058 if test "$mode" = relink; then
6059 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6060 fi
6061
6062 exit $lt_exit
6063 }
6064 done
6065 IFS="$save_ifs"
6066 fi
6067
6068 # Install the pseudo-library for information purposes.
6069 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6070 instname="$dir/$name"i
6071 $show "$install_prog $instname $destdir/$name"
6072 $run eval "$install_prog $instname $destdir/$name" || exit $?
6073
6074 # Maybe install the static library, too.
6075 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6076 ;;
6077
6078 *.lo)
6079 # Install (i.e. copy) a libtool object.
6080
6081 # Figure out destination file name, if it wasn't already specified.
6082 if test -n "$destname"; then
6083 destfile="$destdir/$destname"
6084 else
6085 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6086 destfile="$destdir/$destfile"
6087 fi
6088
6089 # Deduce the name of the destination old-style object file.
6090 case $destfile in
6091 *.lo)
6092 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6093 ;;
6094 *.$objext)
6095 staticdest="$destfile"
6096 destfile=
6097 ;;
6098 *)
6099 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6100 $echo "$help" 1>&2
6101 exit $EXIT_FAILURE
6102 ;;
6103 esac
6104
6105 # Install the libtool object if requested.
6106 if test -n "$destfile"; then
6107 $show "$install_prog $file $destfile"
6108 $run eval "$install_prog $file $destfile" || exit $?
6109 fi
6110
6111 # Install the old object if enabled.
6112 if test "$build_old_libs" = yes; then
6113 # Deduce the name of the old-style object file.
6114 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6115
6116 $show "$install_prog $staticobj $staticdest"
6117 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6118 fi
6119 exit $EXIT_SUCCESS
6120 ;;
6121
6122 *)
6123 # Figure out destination file name, if it wasn't already specified.
6124 if test -n "$destname"; then
6125 destfile="$destdir/$destname"
6126 else
6127 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6128 destfile="$destdir/$destfile"
6129 fi
6130
6131 # If the file is missing, and there is a .exe on the end, strip it
6132 # because it is most likely a libtool script we actually want to
6133 # install
6134 stripped_ext=""
6135 case $file in
6136 *.exe)
6137 if test ! -f "$file"; then
6138 file=`$echo $file|${SED} 's,.exe$,,'`
6139 stripped_ext=".exe"
6140 fi
6141 ;;
6142 esac
6143
6144 # Do a test to see if this is really a libtool program.
6145 case $host in
6146 *cygwin*|*mingw*)
6147 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6148 ;;
6149 *)
6150 wrapper=$file
6151 ;;
6152 esac
6153 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6154 notinst_deplibs=
6155 relink_command=
6156
6157 # Note that it is not necessary on cygwin/mingw to append a dot to
6158 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6159 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6160 # `FILE.' does not work on cygwin managed mounts.
6161 #
6162 # If there is no directory component, then add one.
6163 case $wrapper in
6164 */* | *\\*) . ${wrapper} ;;
6165 *) . ./${wrapper} ;;
6166 esac
6167
6168 # Check the variables that should have been set.
6169 if test -z "$notinst_deplibs"; then
6170 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6171 exit $EXIT_FAILURE
6172 fi
6173
6174 finalize=yes
6175 for lib in $notinst_deplibs; do
6176 # Check to see that each library is installed.
6177 libdir=
6178 if test -f "$lib"; then
6179 # If there is no directory component, then add one.
6180 case $lib in
6181 */* | *\\*) . $lib ;;
6182 *) . ./$lib ;;
6183 esac
6184 fi
6185 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6186 if test -n "$libdir" && test ! -f "$libfile"; then
6187 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6188 finalize=no
6189 fi
6190 done
6191
6192 relink_command=
6193 # Note that it is not necessary on cygwin/mingw to append a dot to
6194 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6195 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6196 # `FILE.' does not work on cygwin managed mounts.
6197 #
6198 # If there is no directory component, then add one.
6199 case $wrapper in
6200 */* | *\\*) . ${wrapper} ;;
6201 *) . ./${wrapper} ;;
6202 esac
6203
6204 outputname=
6205 if test "$fast_install" = no && test -n "$relink_command"; then
6206 if test "$finalize" = yes && test -z "$run"; then
6207 tmpdir=`func_mktempdir`
6208 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6209 outputname="$tmpdir/$file"
6210 # Replace the output file specification.
6211 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6212
6213 $show "$relink_command"
6214 if $run eval "$relink_command"; then :
6215 else
6216 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6217 ${rm}r "$tmpdir"
6218 continue
6219 fi
6220 file="$outputname"
6221 else
6222 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6223 fi
6224 else
6225 # Install the binary that we compiled earlier.
6226 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6227 fi
6228 fi
6229
6230 # remove .exe since cygwin /usr/bin/install will append another
6231 # one anyway
6232 case $install_prog,$host in
6233 */usr/bin/install*,*cygwin*)
6234 case $file:$destfile in
6235 *.exe:*.exe)
6236 # this is ok
6237 ;;
6238 *.exe:*)
6239 destfile=$destfile.exe
6240 ;;
6241 *:*.exe)
6242 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6243 ;;
6244 esac
6245 ;;
6246 esac
6247 $show "$install_prog$stripme $file $destfile"
6248 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6249 test -n "$outputname" && ${rm}r "$tmpdir"
6250 ;;
6251 esac
6252 done
6253
6254 for file in $staticlibs; do
6255 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6256
6257 # Set up the ranlib parameters.
6258 oldlib="$destdir/$name"
6259
6260 $show "$install_prog $file $oldlib"
6261 $run eval "$install_prog \$file \$oldlib" || exit $?
6262
6263 if test -n "$stripme" && test -n "$old_striplib"; then
6264 $show "$old_striplib $oldlib"
6265 $run eval "$old_striplib $oldlib" || exit $?
6266 fi
6267
6268 # Do each command in the postinstall commands.
6269 cmds=$old_postinstall_cmds
6270 save_ifs="$IFS"; IFS='~'
6271 for cmd in $cmds; do
6272 IFS="$save_ifs"
6273 eval cmd=\"$cmd\"
6274 $show "$cmd"
6275 $run eval "$cmd" || exit $?
6276 done
6277 IFS="$save_ifs"
6278 done
6279
6280 if test -n "$future_libdirs"; then
6281 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6282 fi
6283
6284 if test -n "$current_libdirs"; then
6285 # Maybe just do a dry run.
6286 test -n "$run" && current_libdirs=" -n$current_libdirs"
6287 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6288 else
6289 exit $EXIT_SUCCESS
6290 fi
6291 ;;
6292
6293 # libtool finish mode
6294 finish)
6295 modename="$modename: finish"
6296 libdirs="$nonopt"
6297 admincmds=
6298
6299 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6300 for dir
6301 do
6302 libdirs="$libdirs $dir"
6303 done
6304
6305 for libdir in $libdirs; do
6306 if test -n "$finish_cmds"; then
6307 # Do each command in the finish commands.
6308 cmds=$finish_cmds
6309 save_ifs="$IFS"; IFS='~'
6310 for cmd in $cmds; do
6311 IFS="$save_ifs"
6312 eval cmd=\"$cmd\"
6313 $show "$cmd"
6314 $run eval "$cmd" || admincmds="$admincmds
6315 $cmd"
6316 done
6317 IFS="$save_ifs"
6318 fi
6319 if test -n "$finish_eval"; then
6320 # Do the single finish_eval.
6321 eval cmds=\"$finish_eval\"
6322 $run eval "$cmds" || admincmds="$admincmds
6323 $cmds"
6324 fi
6325 done
6326 fi
6327
6328 # Exit here if they wanted silent mode.
6329 test "$show" = : && exit $EXIT_SUCCESS
6330
6331 $echo "X----------------------------------------------------------------------" | $Xsed
6332 $echo "Libraries have been installed in:"
6333 for libdir in $libdirs; do
6334 $echo " $libdir"
6335 done
6336 $echo
6337 $echo "If you ever happen to want to link against installed libraries"
6338 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6339 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6340 $echo "flag during linking and do at least one of the following:"
6341 if test -n "$shlibpath_var"; then
6342 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6343 $echo " during execution"
6344 fi
6345 if test -n "$runpath_var"; then
6346 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6347 $echo " during linking"
6348 fi
6349 if test -n "$hardcode_libdir_flag_spec"; then
6350 libdir=LIBDIR
6351 eval flag=\"$hardcode_libdir_flag_spec\"
6352
6353 $echo " - use the \`$flag' linker flag"
6354 fi
6355 if test -n "$admincmds"; then
6356 $echo " - have your system administrator run these commands:$admincmds"
6357 fi
6358 if test -f /etc/ld.so.conf; then
6359 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6360 fi
6361 $echo
6362 $echo "See any operating system documentation about shared libraries for"
6363 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6364 $echo "X----------------------------------------------------------------------" | $Xsed
6365 exit $EXIT_SUCCESS
6366 ;;
6367
6368 # libtool execute mode
6369 execute)
6370 modename="$modename: execute"
6371
6372 # The first argument is the command name.
6373 cmd="$nonopt"
6374 if test -z "$cmd"; then
6375 $echo "$modename: you must specify a COMMAND" 1>&2
6376 $echo "$help"
6377 exit $EXIT_FAILURE
6378 fi
6379
6380 # Handle -dlopen flags immediately.
6381 for file in $execute_dlfiles; do
6382 if test ! -f "$file"; then
6383 $echo "$modename: \`$file' is not a file" 1>&2
6384 $echo "$help" 1>&2
6385 exit $EXIT_FAILURE
6386 fi
6387
6388 dir=
6389 case $file in
6390 *.la)
6391 # Check to see that this really is a libtool archive.
6392 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6393 else
6394 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6395 $echo "$help" 1>&2
6396 exit $EXIT_FAILURE
6397 fi
6398
6399 # Read the libtool library.
6400 dlname=
6401 library_names=
6402
6403 # If there is no directory component, then add one.
6404 case $file in
6405 */* | *\\*) . $file ;;
6406 *) . ./$file ;;
6407 esac
6408
6409 # Skip this library if it cannot be dlopened.
6410 if test -z "$dlname"; then
6411 # Warn if it was a shared library.
6412 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6413 continue
6414 fi
6415
6416 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6417 test "X$dir" = "X$file" && dir=.
6418
6419 if test -f "$dir/$objdir/$dlname"; then
6420 dir="$dir/$objdir"
6421 else
6422 if test ! -f "$dir/$dlname"; then
6423 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6424 exit $EXIT_FAILURE
6425 fi
6426 fi
6427 ;;
6428
6429 *.lo)
6430 # Just add the directory containing the .lo file.
6431 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6432 test "X$dir" = "X$file" && dir=.
6433 ;;
6434
6435 *)
6436 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6437 continue
6438 ;;
6439 esac
6440
6441 # Get the absolute pathname.
6442 absdir=`cd "$dir" && pwd`
6443 test -n "$absdir" && dir="$absdir"
6444
6445 # Now add the directory to shlibpath_var.
6446 if eval "test -z \"\$$shlibpath_var\""; then
6447 eval "$shlibpath_var=\"\$dir\""
6448 else
6449 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6450 fi
6451 done
6452
6453 # This variable tells wrapper scripts just to set shlibpath_var
6454 # rather than running their programs.
6455 libtool_execute_magic="$magic"
6456
6457 # Check if any of the arguments is a wrapper script.
6458 args=
6459 for file
6460 do
6461 case $file in
6462 -*) ;;
6463 *)
6464 # Do a test to see if this is really a libtool program.
6465 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6466 # If there is no directory component, then add one.
6467 case $file in
6468 */* | *\\*) . $file ;;
6469 *) . ./$file ;;
6470 esac
6471
6472 # Transform arg to wrapped name.
6473 file="$progdir/$program"
6474 fi
6475 ;;
6476 esac
6477 # Quote arguments (to preserve shell metacharacters).
6478 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6479 args="$args \"$file\""
6480 done
6481
6482 if test -z "$run"; then
6483 if test -n "$shlibpath_var"; then
6484 # Export the shlibpath_var.
6485 eval "export $shlibpath_var"
6486 fi
6487
6488 # Restore saved environment variables
6489 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6490 do
6491 eval "if test \"\${save_$lt_var+set}\" = set; then
6492 $lt_var=\$save_$lt_var; export $lt_var
6493 fi"
6494 done
6495
6496 # Now prepare to actually exec the command.
6497 exec_cmd="\$cmd$args"
6498 else
6499 # Display what would be done.
6500 if test -n "$shlibpath_var"; then
6501 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6502 $echo "export $shlibpath_var"
6503 fi
6504 $echo "$cmd$args"
6505 exit $EXIT_SUCCESS
6506 fi
6507 ;;
6508
6509 # libtool clean and uninstall mode
6510 clean | uninstall)
6511 modename="$modename: $mode"
6512 rm="$nonopt"
6513 files=
6514 rmforce=
6515 exit_status=0
6516
6517 # This variable tells wrapper scripts just to set variables rather
6518 # than running their programs.
6519 libtool_install_magic="$magic"
6520
6521 for arg
6522 do
6523 case $arg in
6524 -f) rm="$rm $arg"; rmforce=yes ;;
6525 -*) rm="$rm $arg" ;;
6526 *) files="$files $arg" ;;
6527 esac
6528 done
6529
6530 if test -z "$rm"; then
6531 $echo "$modename: you must specify an RM program" 1>&2
6532 $echo "$help" 1>&2
6533 exit $EXIT_FAILURE
6534 fi
6535
6536 rmdirs=
6537
6538 origobjdir="$objdir"
6539 for file in $files; do
6540 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6541 if test "X$dir" = "X$file"; then
6542 dir=.
6543 objdir="$origobjdir"
6544 else
6545 objdir="$dir/$origobjdir"
6546 fi
6547 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6548 test "$mode" = uninstall && objdir="$dir"
6549
6550 # Remember objdir for removal later, being careful to avoid duplicates
6551 if test "$mode" = clean; then
6552 case " $rmdirs " in
6553 *" $objdir "*) ;;
6554 *) rmdirs="$rmdirs $objdir" ;;
6555 esac
6556 fi
6557
6558 # Don't error if the file doesn't exist and rm -f was used.
6559 if (test -L "$file") >/dev/null 2>&1 \
6560 || (test -h "$file") >/dev/null 2>&1 \
6561 || test -f "$file"; then
6562 :
6563 elif test -d "$file"; then
6564 exit_status=1
6565 continue
6566 elif test "$rmforce" = yes; then
6567 continue
6568 fi
6569
6570 rmfiles="$file"
6571
6572 case $name in
6573 *.la)
6574 # Possibly a libtool archive, so verify it.
6575 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6576 . $dir/$name
6577
6578 # Delete the libtool libraries and symlinks.
6579 for n in $library_names; do
6580 rmfiles="$rmfiles $objdir/$n"
6581 done
6582 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6583
6584 case "$mode" in
6585 clean)
6586 case " $library_names " in
6587 # " " in the beginning catches empty $dlname
6588 *" $dlname "*) ;;
6589 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6590 esac
6591 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6592 ;;
6593 uninstall)
6594 if test -n "$library_names"; then
6595 # Do each command in the postuninstall commands.
6596 cmds=$postuninstall_cmds
6597 save_ifs="$IFS"; IFS='~'
6598 for cmd in $cmds; do
6599 IFS="$save_ifs"
6600 eval cmd=\"$cmd\"
6601 $show "$cmd"
6602 $run eval "$cmd"
6603 if test "$?" -ne 0 && test "$rmforce" != yes; then
6604 exit_status=1
6605 fi
6606 done
6607 IFS="$save_ifs"
6608 fi
6609
6610 if test -n "$old_library"; then
6611 # Do each command in the old_postuninstall commands.
6612 cmds=$old_postuninstall_cmds
6613 save_ifs="$IFS"; IFS='~'
6614 for cmd in $cmds; do
6615 IFS="$save_ifs"
6616 eval cmd=\"$cmd\"
6617 $show "$cmd"
6618 $run eval "$cmd"
6619 if test "$?" -ne 0 && test "$rmforce" != yes; then
6620 exit_status=1
6621 fi
6622 done
6623 IFS="$save_ifs"
6624 fi
6625 # FIXME: should reinstall the best remaining shared library.
6626 ;;
6627 esac
6628 fi
6629 ;;
6630
6631 *.lo)
6632 # Possibly a libtool object, so verify it.
6633 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6634
6635 # Read the .lo file
6636 . $dir/$name
6637
6638 # Add PIC object to the list of files to remove.
6639 if test -n "$pic_object" \
6640 && test "$pic_object" != none; then
6641 rmfiles="$rmfiles $dir/$pic_object"
6642 fi
6643
6644 # Add non-PIC object to the list of files to remove.
6645 if test -n "$non_pic_object" \
6646 && test "$non_pic_object" != none; then
6647 rmfiles="$rmfiles $dir/$non_pic_object"
6648 fi
6649 fi
6650 ;;
6651
6652 *)
6653 if test "$mode" = clean ; then
6654 noexename=$name
6655 case $file in
6656 *.exe)
6657 file=`$echo $file|${SED} 's,.exe$,,'`
6658 noexename=`$echo $name|${SED} 's,.exe$,,'`
6659 # $file with .exe has already been added to rmfiles,
6660 # add $file without .exe
6661 rmfiles="$rmfiles $file"
6662 ;;
6663 esac
6664 # Do a test to see if this is a libtool program.
6665 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6666 relink_command=
6667 . $dir/$noexename
6668
6669 # note $name still contains .exe if it was in $file originally
6670 # as does the version of $file that was added into $rmfiles
6671 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6672 if test "$fast_install" = yes && test -n "$relink_command"; then
6673 rmfiles="$rmfiles $objdir/lt-$name"
6674 fi
6675 if test "X$noexename" != "X$name" ; then
6676 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6677 fi
6678 fi
6679 fi
6680 ;;
6681 esac
6682 $show "$rm $rmfiles"
6683 $run $rm $rmfiles || exit_status=1
6684 done
6685 objdir="$origobjdir"
6686
6687 # Try to remove the ${objdir}s in the directories where we deleted files
6688 for dir in $rmdirs; do
6689 if test -d "$dir"; then
6690 $show "rmdir $dir"
6691 $run rmdir $dir >/dev/null 2>&1
6692 fi
6693 done
6694
6695 exit $exit_status
6696 ;;
6697
6698 "")
6699 $echo "$modename: you must specify a MODE" 1>&2
6700 $echo "$generic_help" 1>&2
6701 exit $EXIT_FAILURE
6702 ;;
6703 esac
6704
6705 if test -z "$exec_cmd"; then
6706 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6707 $echo "$generic_help" 1>&2
6708 exit $EXIT_FAILURE
6709 fi
6710fi # test -z "$show_help"
6711
6712if test -n "$exec_cmd"; then
6713 eval exec $exec_cmd
6714 exit $EXIT_FAILURE
6715fi
6716
6717# We need to display help for each of the modes.
6718case $mode in
6719"") $echo \
6720"Usage: $modename [OPTION]... [MODE-ARG]...
6721
6722Provide generalized library-building support services.
6723
6724 --config show all configuration variables
6725 --debug enable verbose shell tracing
6726-n, --dry-run display commands without modifying any files
6727 --features display basic configuration information and exit
6728 --finish same as \`--mode=finish'
6729 --help display this help message and exit
6730 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6731 --quiet same as \`--silent'
6732 --silent don't print informational messages
6733 --tag=TAG use configuration variables from tag TAG
6734 --version print version information
6735
6736MODE must be one of the following:
6737
6738 clean remove files from the build directory
6739 compile compile a source file into a libtool object
6740 execute automatically set library path, then run a program
6741 finish complete the installation of libtool libraries
6742 install install libraries or executables
6743 link create a library or an executable
6744 uninstall remove libraries from an installed directory
6745
6746MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6747a more detailed description of MODE.
6748
6749Report bugs to <bug-libtool@gnu.org>."
6750 exit $EXIT_SUCCESS
6751 ;;
6752
6753clean)
6754 $echo \
6755"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6756
6757Remove files from the build directory.
6758
6759RM is the name of the program to use to delete files associated with each FILE
6760(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6761to RM.
6762
6763If FILE is a libtool library, object or program, all the files associated
6764with it are deleted. Otherwise, only FILE itself is deleted using RM."
6765 ;;
6766
6767compile)
6768 $echo \
6769"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6770
6771Compile a source file into a libtool library object.
6772
6773This mode accepts the following additional options:
6774
6775 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6776 -prefer-pic try to building PIC objects only
6777 -prefer-non-pic try to building non-PIC objects only
6778 -static always build a \`.o' file suitable for static linking
6779
6780COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6781from the given SOURCEFILE.
6782
6783The output file name is determined by removing the directory component from
6784SOURCEFILE, then substituting the C source code suffix \`.c' with the
6785library object suffix, \`.lo'."
6786 ;;
6787
6788execute)
6789 $echo \
6790"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6791
6792Automatically set library path, then run a program.
6793
6794This mode accepts the following additional options:
6795
6796 -dlopen FILE add the directory containing FILE to the library path
6797
6798This mode sets the library path environment variable according to \`-dlopen'
6799flags.
6800
6801If any of the ARGS are libtool executable wrappers, then they are translated
6802into their corresponding uninstalled binary, and any of their required library
6803directories are added to the library path.
6804
6805Then, COMMAND is executed, with ARGS as arguments."
6806 ;;
6807
6808finish)
6809 $echo \
6810"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6811
6812Complete the installation of libtool libraries.
6813
6814Each LIBDIR is a directory that contains libtool libraries.
6815
6816The commands that this mode executes may require superuser privileges. Use
6817the \`--dry-run' option if you just want to see what would be executed."
6818 ;;
6819
6820install)
6821 $echo \
6822"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6823
6824Install executables or libraries.
6825
6826INSTALL-COMMAND is the installation command. The first component should be
6827either the \`install' or \`cp' program.
6828
6829The rest of the components are interpreted as arguments to that command (only
6830BSD-compatible install options are recognized)."
6831 ;;
6832
6833link)
6834 $echo \
6835"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6836
6837Link object files or libraries together to form another library, or to
6838create an executable program.
6839
6840LINK-COMMAND is a command using the C compiler that you would use to create
6841a program from several object files.
6842
6843The following components of LINK-COMMAND are treated specially:
6844
6845 -all-static do not do any dynamic linking at all
6846 -avoid-version do not add a version suffix if possible
6847 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6848 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6849 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6850 -export-symbols SYMFILE
6851 try to export only the symbols listed in SYMFILE
6852 -export-symbols-regex REGEX
6853 try to export only the symbols matching REGEX
6854 -LLIBDIR search LIBDIR for required installed libraries
6855 -lNAME OUTPUT-FILE requires the installed library libNAME
6856 -module build a library that can dlopened
6857 -no-fast-install disable the fast-install mode
6858 -no-install link a not-installable executable
6859 -no-undefined declare that a library does not refer to external symbols
6860 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6861 -objectlist FILE Use a list of object files found in FILE to specify objects
6862 -precious-files-regex REGEX
6863 don't remove output files matching REGEX
6864 -release RELEASE specify package release information
6865 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6866 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6867 -static do not do any dynamic linking of uninstalled libtool libraries
6868 -static-libtool-libs
6869 do not do any dynamic linking of libtool libraries
6870 -version-info CURRENT[:REVISION[:AGE]]
6871 specify library version info [each variable defaults to 0]
6872
6873All other options (arguments beginning with \`-') are ignored.
6874
6875Every other argument is treated as a filename. Files ending in \`.la' are
6876treated as uninstalled libtool libraries, other files are standard or library
6877object files.
6878
6879If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6880only library objects (\`.lo' files) may be specified, and \`-rpath' is
6881required, except when creating a convenience library.
6882
6883If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6884using \`ar' and \`ranlib', or on Windows using \`lib'.
6885
6886If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6887is created, otherwise an executable program is created."
6888 ;;
6889
6890uninstall)
6891 $echo \
6892"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6893
6894Remove libraries from an installation directory.
6895
6896RM is the name of the program to use to delete files associated with each FILE
6897(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6898to RM.
6899
6900If FILE is a libtool library, all the files associated with it are deleted.
6901Otherwise, only FILE itself is deleted using RM."
6902 ;;
6903
6904*)
6905 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6906 $echo "$help" 1>&2
6907 exit $EXIT_FAILURE
6908 ;;
6909esac
6910
6911$echo
6912$echo "Try \`$modename --help' for more information about other modes."
6913
6914exit $?
6915
6916# The TAGs below are defined such that we never get into a situation
6917# in which we disable both kinds of libraries. Given conflicting
6918# choices, we go for a static library, that is the most portable,
6919# since we can't tell whether shared libraries were disabled because
6920# the user asked for that or because the platform doesn't support
6921# them. This is particularly important on AIX, because we don't
6922# support having both static and shared libraries enabled at the same
6923# time on that platform, so we default to a shared-only configuration.
6924# If a disable-shared tag is given, we'll fallback to a static-only
6925# configuration. But we'll never go from static-only to shared-only.
6926
6927# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6928disable_libs=shared
6929# ### END LIBTOOL TAG CONFIG: disable-shared
6930
6931# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6932disable_libs=static
6933# ### END LIBTOOL TAG CONFIG: disable-static
6934
6935# Local Variables:
6936# mode:shell-script
6937# sh-indentation:2
6938# End:
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette