Changed the names to match the PECL nomenclature
[phpCairo.git] / src / cairo / ltmain.sh
blob6150bb3defe6234efe53e0fe6260f391c1e80821
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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.
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.
27 basename="s,^.*/,,g"
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
33 # function.
34 progpath="$0"
36 # define SED for historic ltconfig's generated by Libtool 1.3
37 test -z "$SED" && SED=sed
39 # The name of this program:
40 progname=`echo "$progpath" | $SED $basename`
41 modename="$progname"
43 # Global variables:
44 EXIT_SUCCESS=0
45 EXIT_FAILURE=1
47 PROGRAM=ltmain.sh
48 PACKAGE=libtool
49 VERSION=1.5.22
50 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
52 # See if we are running on zsh, and set the options which allow our
53 # commands through without removal of \ escapes.
54 if test -n "${ZSH_VERSION+set}" ; then
55 setopt NO_GLOB_SUBST
57 # Same for EGREP, and just to be sure, do LTCC as well
58 if test "X$EGREP" = X ; then
59 EGREP=egrep
61 if test "X$LTCC" = X ; then
62 LTCC=${CC-gcc}
64 # Same for EGREP, and just to be sure, do LTCC as well
65 if test "x$EGREP" = x ; then
66 EGREP=egrep
68 if test "x$LTCC" = x ; then
69 LTCC=${CC-gcc}
72 # Check that we have a working $echo.
73 if test "X$1" = X--no-reexec; then
74 # Discard the --no-reexec flag, and continue.
75 shift
76 elif test "X$1" = X--fallback-echo; then
77 # Avoid inline document here, it may be left over
79 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
80 # Yippee, $echo works!
82 else
83 # Restart under the correct shell, and then maybe $echo will work.
84 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
87 if test "X$1" = X--fallback-echo; then
88 # used as fallback echo
89 shift
90 cat <<EOF
92 EOF
93 exit $EXIT_SUCCESS
96 default_mode=
97 help="Try \`$progname --help' for more information."
98 magic="%%%MAGIC variable%%%"
99 mkdir="mkdir"
100 mv="mv -f"
101 rm="rm -f"
103 # Sed substitution that helps us do robust quoting. It backslashifies
104 # metacharacters that are still active within double-quoted strings.
105 Xsed="${SED}"' -e 1s/^X//'
106 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
107 # test EBCDIC or ASCII
108 case `echo X|tr X '\101'` in
109 A) # ASCII based system
110 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
111 SP2NL='tr \040 \012'
112 NL2SP='tr \015\012 \040\040'
114 *) # EBCDIC based system
115 SP2NL='tr \100 \n'
116 NL2SP='tr \r\n \100\100'
118 esac
120 # NLS nuisances.
121 # Only set LANG and LC_ALL to C if already set.
122 # These must not be set unconditionally because not all systems understand
123 # e.g. LANG=C (notably SCO).
124 # We save the old values to restore during execute mode.
125 if test "${LC_ALL+set}" = set; then
126 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
128 if test "${LANG+set}" = set; then
129 save_LANG="$LANG"; LANG=C; export LANG
132 # Make sure IFS has a sensible default
133 lt_nl='
135 IFS=" $lt_nl"
137 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
138 $echo "$modename: not configured to build any kind of library" 1>&2
139 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
140 exit $EXIT_FAILURE
143 # Global variables.
144 mode=$default_mode
145 nonopt=
146 prev=
147 prevopt=
148 run=
149 show="$echo"
150 show_help=
151 execute_dlfiles=
152 duplicate_deps=no
153 preserve_args=
154 lo2o="s/\\.lo\$/.${objext}/"
155 o2lo="s/\\.${objext}\$/.lo/"
157 if test -z "$max_cmd_len"; then
159 testring="ABCD"
160 new_result=
162 # If test is not a shell built-in, we'll probably end up computing a
163 # maximum length that is only half of the actual maximum length, but
164 # we can't tell.
165 while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
166 = "XX$testring") >/dev/null 2>&1 &&
167 new_result=`expr "X$testring" : ".*" 2>&1` &&
168 max_cmd_len="$new_result" &&
169 test $i != 17 # 1/2 MB should be enough
171 i=`expr $i + 1`
172 testring="$testring$testring"
173 done
174 testring=
175 # Add a significant safety factor because C++ compilers can tack on massive
176 # amounts of additional arguments before passing them to the linker.
177 # It appears as though 1/2 is a usable value.
178 max_cmd_len=`expr $max_cmd_len \/ 2`
181 if test -z "$max_cmd_len"; then
183 testring="ABCD"
184 new_result=
186 # If test is not a shell built-in, we'll probably end up computing a
187 # maximum length that is only half of the actual maximum length, but
188 # we can't tell.
189 while (test "X"`$SHELL $0 --fallback-echo "X$testring" 2>/dev/null` \
190 = "XX$testring") >/dev/null 2>&1 &&
191 new_result=`expr "X$testring" : ".*" 2>&1` &&
192 max_cmd_len="$new_result" &&
193 test "$i" != 17 # 1/2 MB should be enough
195 i=`expr $i + 1`
196 testring="$testring$testring"
197 done
198 testring=
199 # Add a significant safety factor because C++ compilers can tack on massive
200 # amounts of additional arguments before passing them to the linker.
201 # It appears as though 1/2 is a usable value.
202 max_cmd_len=`expr $max_cmd_len \/ 2`
205 #####################################
206 # Shell function definitions:
207 # This seems to be the best place for them
209 # func_mktempdir [string]
210 # Make a temporary directory that won't clash with other running
211 # libtool processes, and avoids race conditions if possible. If
212 # given, STRING is the basename for that directory.
213 func_mktempdir ()
215 my_template="${TMPDIR-/tmp}/${1-$progname}"
217 if test "$run" = ":"; then
218 # Return a directory name, but don't create it in dry-run mode
219 my_tmpdir="${my_template}-$$"
220 else
222 # If mktemp works, use that first and foremost
223 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
225 if test ! -d "$my_tmpdir"; then
226 # Failing that, at least try and use $RANDOM to avoid a race
227 my_tmpdir="${my_template}-${RANDOM-0}$$"
229 save_mktempdir_umask=`umask`
230 umask 0077
231 $mkdir "$my_tmpdir"
232 umask $save_mktempdir_umask
235 # If we're not in dry-run mode, bomb out on failure
236 test -d "$my_tmpdir" || {
237 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
238 exit $EXIT_FAILURE
242 $echo "X$my_tmpdir" | $Xsed
246 # func_win32_libid arg
247 # return the library type of file 'arg'
249 # Need a lot of goo to handle *both* DLLs and import libs
250 # Has to be a shell function in order to 'eat' the argument
251 # that is supplied when $file_magic_command is called.
252 func_win32_libid ()
254 win32_libid_type="unknown"
255 win32_fileres=`file -L $1 2>/dev/null`
256 case $win32_fileres in
257 *ar\ archive\ import\ library*) # definitely import
258 win32_libid_type="x86 archive import"
260 *ar\ archive*) # could be an import, or static
261 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
262 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
263 win32_nmres=`eval $NM -f posix -A $1 | \
264 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
265 case $win32_nmres in
266 import*) win32_libid_type="x86 archive import";;
267 *) win32_libid_type="x86 archive static";;
268 esac
271 *DLL*)
272 win32_libid_type="x86 DLL"
274 *executable*) # but shell scripts are "executable" too...
275 case $win32_fileres in
276 *MS\ Windows\ PE\ Intel*)
277 win32_libid_type="x86 DLL"
279 esac
281 esac
282 $echo $win32_libid_type
286 # func_infer_tag arg
287 # Infer tagged configuration to use if any are available and
288 # if one wasn't chosen via the "--tag" command line option.
289 # Only attempt this if the compiler in the base compile
290 # command doesn't match the default compiler.
291 # arg is usually of the form 'gcc ...'
292 func_infer_tag ()
294 if test -n "$available_tags" && test -z "$tagname"; then
295 CC_quoted=
296 for arg in $CC; do
297 case $arg in
298 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
299 arg="\"$arg\""
301 esac
302 CC_quoted="$CC_quoted $arg"
303 done
304 case $@ in
305 # Blanks in the command may have been stripped by the calling shell,
306 # but not from the CC environment variable when configure was run.
307 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
308 # Blanks at the start of $base_compile will cause this to fail
309 # if we don't check for them as well.
311 for z in $available_tags; do
312 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
313 # Evaluate the configuration.
314 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
315 CC_quoted=
316 for arg in $CC; do
317 # Double-quote args containing other shell metacharacters.
318 case $arg in
319 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
320 arg="\"$arg\""
322 esac
323 CC_quoted="$CC_quoted $arg"
324 done
325 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
326 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
327 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
328 extendcc=${host}-${CC}
329 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
330 # (Gentoo-specific hack because we always export $CHOST)
331 mungedcc=${CHOST-${host}}-${trimedcc}
332 case "$@ " in
333 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
334 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
335 tagname=CC
336 break ;;
337 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
338 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
339 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
340 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
341 # The compiler in the base compile command matches
342 # the one in the tagged configuration.
343 # Assume this is the tagged configuration we want.
344 tagname=$z
345 break
347 esac
349 done
350 # If $tagname still isn't set, then no tagged configuration
351 # was found and let the user know that the "--tag" command
352 # line option must be used.
353 if test -z "$tagname"; then
354 $echo "$modename: unable to infer tagged configuration"
355 $echo "$modename: specify a tag with \`--tag'" 1>&2
356 exit $EXIT_FAILURE
357 # else
358 # $echo "$modename: using $tagname tagged configuration"
361 esac
366 # func_extract_an_archive dir oldlib
367 func_extract_an_archive ()
369 f_ex_an_ar_dir="$1"; shift
370 f_ex_an_ar_oldlib="$1"
372 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
373 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
374 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
376 else
377 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
378 exit $EXIT_FAILURE
382 # func_extract_archives gentop oldlib ...
383 func_extract_archives ()
385 my_gentop="$1"; shift
386 my_oldlibs=${1+"$@"}
387 my_oldobjs=""
388 my_xlib=""
389 my_xabs=""
390 my_xdir=""
391 my_status=""
393 $show "${rm}r $my_gentop"
394 $run ${rm}r "$my_gentop"
395 $show "$mkdir $my_gentop"
396 $run $mkdir "$my_gentop"
397 my_status=$?
398 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
399 exit $my_status
402 for my_xlib in $my_oldlibs; do
403 # Extract the objects.
404 case $my_xlib in
405 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
406 *) my_xabs=`pwd`"/$my_xlib" ;;
407 esac
408 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
409 my_xdir="$my_gentop/$my_xlib"
411 $show "${rm}r $my_xdir"
412 $run ${rm}r "$my_xdir"
413 $show "$mkdir $my_xdir"
414 $run $mkdir "$my_xdir"
415 exit_status=$?
416 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
417 exit $exit_status
419 case $host in
420 *-darwin*)
421 $show "Extracting $my_xabs"
422 # Do not bother doing anything if just a dry run
423 if test -z "$run"; then
424 darwin_orig_dir=`pwd`
425 cd $my_xdir || exit $?
426 darwin_archive=$my_xabs
427 darwin_curdir=`pwd`
428 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
429 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
430 if test -n "$darwin_arches"; then
431 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
432 darwin_arch=
433 $show "$darwin_base_archive has multiple architectures $darwin_arches"
434 for darwin_arch in $darwin_arches ; do
435 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
436 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
437 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
438 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
439 cd "$darwin_curdir"
440 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
441 done # $darwin_arches
442 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
443 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
444 darwin_file=
445 darwin_files=
446 for darwin_file in $darwin_filelist; do
447 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
448 lipo -create -output "$darwin_file" $darwin_files
449 done # $darwin_filelist
450 ${rm}r unfat-$$
451 cd "$darwin_orig_dir"
452 else
453 cd "$darwin_orig_dir"
454 func_extract_an_archive "$my_xdir" "$my_xabs"
455 fi # $darwin_arches
456 fi # $run
459 func_extract_an_archive "$my_xdir" "$my_xabs"
461 esac
462 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
463 done
464 func_extract_archives_result="$my_oldobjs"
466 # End of Shell function definitions
467 #####################################
469 # Darwin sucks
470 eval std_shrext=\"$shrext_cmds\"
472 disable_libs=no
474 # Parse our command line options once, thoroughly.
475 while test "$#" -gt 0
477 arg="$1"
478 shift
480 case $arg in
481 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
482 *) optarg= ;;
483 esac
485 # If the previous option needs an argument, assign it.
486 if test -n "$prev"; then
487 case $prev in
488 execute_dlfiles)
489 execute_dlfiles="$execute_dlfiles $arg"
491 tag)
492 tagname="$arg"
493 preserve_args="${preserve_args}=$arg"
495 # Check whether tagname contains only valid characters
496 case $tagname in
497 *[!-_A-Za-z0-9,/]*)
498 $echo "$progname: invalid tag name: $tagname" 1>&2
499 exit $EXIT_FAILURE
501 esac
503 case $tagname in
505 # Don't test for the "default" C tag, as we know, it's there, but
506 # not specially marked.
509 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
510 taglist="$taglist $tagname"
511 # Evaluate the configuration.
512 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
513 else
514 $echo "$progname: ignoring unknown tag $tagname" 1>&2
517 esac
520 eval "$prev=\$arg"
522 esac
524 prev=
525 prevopt=
526 continue
529 # Have we seen a non-optional argument yet?
530 case $arg in
531 --help)
532 show_help=yes
535 --version)
536 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
537 $echo
538 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
539 $echo "This is free software; see the source for copying conditions. There is NO"
540 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
541 exit $?
544 --config)
545 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
546 # Now print the configurations for the tags.
547 for tagname in $taglist; do
548 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
549 done
550 exit $?
553 --debug)
554 $echo "$progname: enabling shell trace mode"
555 set -x
556 preserve_args="$preserve_args $arg"
559 --dry-run | -n)
560 run=:
563 --features)
564 $echo "host: $host"
565 if test "$build_libtool_libs" = yes; then
566 $echo "enable shared libraries"
567 else
568 $echo "disable shared libraries"
570 if test "$build_old_libs" = yes; then
571 $echo "enable static libraries"
572 else
573 $echo "disable static libraries"
575 exit $?
578 --finish) mode="finish" ;;
580 --mode) prevopt="--mode" prev=mode ;;
581 --mode=*) mode="$optarg" ;;
583 --preserve-dup-deps) duplicate_deps="yes" ;;
585 --quiet | --silent)
586 show=:
587 preserve_args="$preserve_args $arg"
590 --tag)
591 prevopt="--tag"
592 prev=tag
593 preserve_args="$preserve_args --tag"
595 --tag=*)
596 set tag "$optarg" ${1+"$@"}
597 shift
598 prev=tag
599 preserve_args="$preserve_args --tag"
602 -dlopen)
603 prevopt="-dlopen"
604 prev=execute_dlfiles
608 $echo "$modename: unrecognized option \`$arg'" 1>&2
609 $echo "$help" 1>&2
610 exit $EXIT_FAILURE
614 nonopt="$arg"
615 break
617 esac
618 done
620 if test -n "$prevopt"; then
621 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
622 $echo "$help" 1>&2
623 exit $EXIT_FAILURE
626 case $disable_libs in
627 no)
629 shared)
630 build_libtool_libs=no
631 build_old_libs=yes
633 static)
634 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
636 esac
638 # If this variable is set in any of the actions, the command in it
639 # will be execed at the end. This prevents here-documents from being
640 # left over by shells.
641 exec_cmd=
643 if test -z "$show_help"; then
645 # Infer the operation mode.
646 if test -z "$mode"; then
647 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
648 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
649 case $nonopt in
650 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
651 mode=link
652 for arg
654 case $arg in
656 mode=compile
657 break
659 esac
660 done
662 *db | *dbx | *strace | *truss)
663 mode=execute
665 *install*|cp|mv)
666 mode=install
668 *rm)
669 mode=uninstall
672 # If we have no mode, but dlfiles were specified, then do execute mode.
673 test -n "$execute_dlfiles" && mode=execute
675 # Just use the default operation mode.
676 if test -z "$mode"; then
677 if test -n "$nonopt"; then
678 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
679 else
680 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
684 esac
687 # Only execute mode is allowed to have -dlopen flags.
688 if test -n "$execute_dlfiles" && test "$mode" != execute; then
689 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
690 $echo "$help" 1>&2
691 exit $EXIT_FAILURE
694 # Change the help message to a mode-specific one.
695 generic_help="$help"
696 help="Try \`$modename --help --mode=$mode' for more information."
698 # These modes are in order of execution frequency so that they run quickly.
699 case $mode in
700 # libtool compile mode
701 compile)
702 modename="$modename: compile"
703 # Get the compilation command and the source file.
704 base_compile=
705 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
706 suppress_opt=yes
707 suppress_output=
708 arg_mode=normal
709 libobj=
710 later=
712 for arg
714 case $arg_mode in
715 arg )
716 # do not "continue". Instead, add this to base_compile
717 lastarg="$arg"
718 arg_mode=normal
721 target )
722 libobj="$arg"
723 arg_mode=normal
724 continue
727 normal )
728 # Accept any command-line options.
729 case $arg in
731 if test -n "$libobj" ; then
732 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
733 exit $EXIT_FAILURE
735 arg_mode=target
736 continue
739 -static | -prefer-pic | -prefer-non-pic)
740 later="$later $arg"
741 continue
744 -no-suppress)
745 suppress_opt=no
746 continue
749 -Xcompiler)
750 arg_mode=arg # the next one goes into the "base_compile" arg list
751 continue # The current "srcfile" will either be retained or
752 ;; # replaced later. I would guess that would be a bug.
754 -Wc,*)
755 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
756 lastarg=
757 save_ifs="$IFS"; IFS=','
758 for arg in $args; do
759 IFS="$save_ifs"
761 # Double-quote args containing other shell metacharacters.
762 # Many Bourne shells cannot handle close brackets correctly
763 # in scan sets, so we specify it separately.
764 case $arg in
765 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
766 arg="\"$arg\""
768 esac
769 lastarg="$lastarg $arg"
770 done
771 IFS="$save_ifs"
772 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
774 # Add the arguments to base_compile.
775 base_compile="$base_compile $lastarg"
776 continue
780 # Accept the current argument as the source file.
781 # The previous "srcfile" becomes the current argument.
783 lastarg="$srcfile"
784 srcfile="$arg"
786 esac # case $arg
788 esac # case $arg_mode
790 # Aesthetically quote the previous argument.
791 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
793 case $lastarg in
794 # Double-quote args containing other shell metacharacters.
795 # Many Bourne shells cannot handle close brackets correctly
796 # in scan sets, and some SunOS ksh mistreat backslash-escaping
797 # in scan sets (worked around with variable expansion),
798 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
799 # at all, so we specify them separately.
800 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
801 lastarg="\"$lastarg\""
803 esac
805 base_compile="$base_compile $lastarg"
806 done # for arg
808 case $arg_mode in
809 arg)
810 $echo "$modename: you must specify an argument for -Xcompile"
811 exit $EXIT_FAILURE
813 target)
814 $echo "$modename: you must specify a target with \`-o'" 1>&2
815 exit $EXIT_FAILURE
818 # Get the name of the library object.
819 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
821 esac
823 # Recognize several different file suffixes.
824 # If the user specifies -o file.o, it is replaced with file.lo
825 xform='[cCFSifmso]'
826 case $libobj in
827 *.ada) xform=ada ;;
828 *.adb) xform=adb ;;
829 *.ads) xform=ads ;;
830 *.asm) xform=asm ;;
831 *.c++) xform=c++ ;;
832 *.cc) xform=cc ;;
833 *.ii) xform=ii ;;
834 *.class) xform=class ;;
835 *.cpp) xform=cpp ;;
836 *.cxx) xform=cxx ;;
837 *.f90) xform=f90 ;;
838 *.for) xform=for ;;
839 *.java) xform=java ;;
840 esac
842 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
844 case $libobj in
845 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
847 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
848 exit $EXIT_FAILURE
850 esac
852 func_infer_tag $base_compile
854 for arg in $later; do
855 case $arg in
856 -static)
857 build_old_libs=yes
858 continue
861 -prefer-pic)
862 pic_mode=yes
863 continue
866 -prefer-non-pic)
867 pic_mode=no
868 continue
870 esac
871 done
873 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
874 case $qlibobj in
875 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
876 qlibobj="\"$qlibobj\"" ;;
877 esac
878 test "X$libobj" != "X$qlibobj" \
879 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
880 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
881 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
882 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
883 if test "X$xdir" = "X$obj"; then
884 xdir=
885 else
886 xdir=$xdir/
888 lobj=${xdir}$objdir/$objname
890 if test -z "$base_compile"; then
891 $echo "$modename: you must specify a compilation command" 1>&2
892 $echo "$help" 1>&2
893 exit $EXIT_FAILURE
896 # Delete any leftover library objects.
897 if test "$build_old_libs" = yes; then
898 removelist="$obj $lobj $libobj ${libobj}T"
899 else
900 removelist="$lobj $libobj ${libobj}T"
903 $run $rm $removelist
904 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
906 # On Cygwin there's no "real" PIC flag so we must build both object types
907 case $host_os in
908 cygwin* | mingw* | pw32* | os2*)
909 pic_mode=default
911 esac
912 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
913 # non-PIC code in shared libraries is not supported
914 pic_mode=default
917 # Calculate the filename of the output object if compiler does
918 # not support -o with -c
919 if test "$compiler_c_o" = no; then
920 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
921 lockfile="$output_obj.lock"
922 removelist="$removelist $output_obj $lockfile"
923 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
924 else
925 output_obj=
926 need_locks=no
927 lockfile=
930 # Lock this critical section if it is needed
931 # We use this script file to make the link, it avoids creating a new file
932 if test "$need_locks" = yes; then
933 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
934 $show "Waiting for $lockfile to be removed"
935 sleep 2
936 done
937 elif test "$need_locks" = warn; then
938 if test -f "$lockfile"; then
939 $echo "\
940 *** ERROR, $lockfile exists and contains:
941 `cat $lockfile 2>/dev/null`
943 This indicates that another process is trying to use the same
944 temporary object file, and libtool could not work around it because
945 your compiler does not support \`-c' and \`-o' together. If you
946 repeat this compilation, it may succeed, by chance, but you had better
947 avoid parallel builds (make -j) in this platform, or get a better
948 compiler."
950 $run $rm $removelist
951 exit $EXIT_FAILURE
953 $echo "$srcfile" > "$lockfile"
956 if test -n "$fix_srcfile_path"; then
957 eval srcfile=\"$fix_srcfile_path\"
959 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
960 case $qsrcfile in
961 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
962 qsrcfile="\"$qsrcfile\"" ;;
963 esac
965 $run $rm "$libobj" "${libobj}T"
967 # Create a libtool object file (analogous to a ".la" file),
968 # but don't create it if we're doing a dry run.
969 test -z "$run" && cat > ${libobj}T <<EOF
970 # $libobj - a libtool object file
971 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
973 # Please DO NOT delete this file!
974 # It is necessary for linking the library.
976 # Name of the PIC object.
979 # Only build a PIC object if we are building libtool libraries.
980 if test "$build_libtool_libs" = yes; then
981 # Without this assignment, base_compile gets emptied.
982 fbsd_hideous_sh_bug=$base_compile
984 if test "$pic_mode" != no; then
985 command="$base_compile $qsrcfile $pic_flag"
986 else
987 # Don't build PIC code
988 command="$base_compile $qsrcfile"
991 if test ! -d "${xdir}$objdir"; then
992 $show "$mkdir ${xdir}$objdir"
993 $run $mkdir ${xdir}$objdir
994 exit_status=$?
995 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
996 exit $exit_status
1000 if test -z "$output_obj"; then
1001 # Place PIC objects in $objdir
1002 command="$command -o $lobj"
1005 $run $rm "$lobj" "$output_obj"
1007 $show "$command"
1008 if $run eval "$command"; then :
1009 else
1010 test -n "$output_obj" && $run $rm $removelist
1011 exit $EXIT_FAILURE
1014 if test "$need_locks" = warn &&
1015 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1016 $echo "\
1017 *** ERROR, $lockfile contains:
1018 `cat $lockfile 2>/dev/null`
1020 but it should contain:
1021 $srcfile
1023 This indicates that another process is trying to use the same
1024 temporary object file, and libtool could not work around it because
1025 your compiler does not support \`-c' and \`-o' together. If you
1026 repeat this compilation, it may succeed, by chance, but you had better
1027 avoid parallel builds (make -j) in this platform, or get a better
1028 compiler."
1030 $run $rm $removelist
1031 exit $EXIT_FAILURE
1034 # Just move the object if needed, then go on to compile the next one
1035 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1036 $show "$mv $output_obj $lobj"
1037 if $run $mv $output_obj $lobj; then :
1038 else
1039 error=$?
1040 $run $rm $removelist
1041 exit $error
1045 # Append the name of the PIC object to the libtool object file.
1046 test -z "$run" && cat >> ${libobj}T <<EOF
1047 pic_object='$objdir/$objname'
1051 # Allow error messages only from the first compilation.
1052 if test "$suppress_opt" = yes; then
1053 suppress_output=' >/dev/null 2>&1'
1055 else
1056 # No PIC object so indicate it doesn't exist in the libtool
1057 # object file.
1058 test -z "$run" && cat >> ${libobj}T <<EOF
1059 pic_object=none
1064 # Only build a position-dependent object if we build old libraries.
1065 if test "$build_old_libs" = yes; then
1066 if test "$pic_mode" != yes; then
1067 # Don't build PIC code
1068 command="$base_compile $qsrcfile"
1069 else
1070 command="$base_compile $qsrcfile $pic_flag"
1072 if test "$compiler_c_o" = yes; then
1073 command="$command -o $obj"
1076 # Suppress compiler output if we already did a PIC compilation.
1077 command="$command$suppress_output"
1078 $run $rm "$obj" "$output_obj"
1079 $show "$command"
1080 if $run eval "$command"; then :
1081 else
1082 $run $rm $removelist
1083 exit $EXIT_FAILURE
1086 if test "$need_locks" = warn &&
1087 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1088 $echo "\
1089 *** ERROR, $lockfile contains:
1090 `cat $lockfile 2>/dev/null`
1092 but it should contain:
1093 $srcfile
1095 This indicates that another process is trying to use the same
1096 temporary object file, and libtool could not work around it because
1097 your compiler does not support \`-c' and \`-o' together. If you
1098 repeat this compilation, it may succeed, by chance, but you had better
1099 avoid parallel builds (make -j) in this platform, or get a better
1100 compiler."
1102 $run $rm $removelist
1103 exit $EXIT_FAILURE
1106 # Just move the object if needed
1107 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1108 $show "$mv $output_obj $obj"
1109 if $run $mv $output_obj $obj; then :
1110 else
1111 error=$?
1112 $run $rm $removelist
1113 exit $error
1117 # Append the name of the non-PIC object the libtool object file.
1118 # Only append if the libtool object file exists.
1119 test -z "$run" && cat >> ${libobj}T <<EOF
1120 # Name of the non-PIC object.
1121 non_pic_object='$objname'
1124 else
1125 # Append the name of the non-PIC object the libtool object file.
1126 # Only append if the libtool object file exists.
1127 test -z "$run" && cat >> ${libobj}T <<EOF
1128 # Name of the non-PIC object.
1129 non_pic_object=none
1134 $run $mv "${libobj}T" "${libobj}"
1136 # Unlock the critical section if it was locked
1137 if test "$need_locks" != no; then
1138 $run $rm "$lockfile"
1141 exit $EXIT_SUCCESS
1144 # libtool link mode
1145 link | relink)
1146 modename="$modename: link"
1147 case $host in
1148 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1149 # It is impossible to link a dll without this setting, and
1150 # we shouldn't force the makefile maintainer to figure out
1151 # which system we are compiling for in order to pass an extra
1152 # flag for every libtool invocation.
1153 # allow_undefined=no
1155 # FIXME: Unfortunately, there are problems with the above when trying
1156 # to make a dll which has undefined symbols, in which case not
1157 # even a static library is built. For now, we need to specify
1158 # -no-undefined on the libtool link line when we can be certain
1159 # that all symbols are satisfied, otherwise we get a static library.
1160 allow_undefined=yes
1163 allow_undefined=yes
1165 esac
1166 libtool_args="$nonopt"
1167 base_compile="$nonopt $@"
1168 compile_command="$nonopt"
1169 finalize_command="$nonopt"
1171 compile_rpath=
1172 finalize_rpath=
1173 compile_shlibpath=
1174 finalize_shlibpath=
1175 convenience=
1176 old_convenience=
1177 deplibs=
1178 old_deplibs=
1179 compiler_flags=
1180 linker_flags=
1181 dllsearchpath=
1182 lib_search_path=`pwd`
1183 inst_prefix_dir=
1185 avoid_version=no
1186 dlfiles=
1187 dlprefiles=
1188 dlself=no
1189 export_dynamic=no
1190 export_symbols=
1191 export_symbols_regex=
1192 generated=
1193 libobjs=
1194 ltlibs=
1195 module=no
1196 no_install=no
1197 objs=
1198 non_pic_objects=
1199 notinst_path= # paths that contain not-installed libtool libraries
1200 precious_files_regex=
1201 prefer_static_libs=no
1202 preload=no
1203 prev=
1204 prevarg=
1205 release=
1206 rpath=
1207 xrpath=
1208 perm_rpath=
1209 temp_rpath=
1210 thread_safe=no
1211 vinfo=
1212 vinfo_number=no
1214 func_infer_tag $base_compile
1216 # We need to know -static, to get the right output filenames.
1217 for arg
1219 case $arg in
1220 -all-static | -static)
1221 if test "X$arg" = "X-all-static"; then
1222 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1223 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1225 if test -n "$link_static_flag"; then
1226 dlopen_self=$dlopen_self_static
1228 prefer_static_libs=yes
1229 else
1230 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1231 dlopen_self=$dlopen_self_static
1233 prefer_static_libs=built
1235 build_libtool_libs=no
1236 build_old_libs=yes
1237 break
1239 esac
1240 done
1242 # See if our shared archives depend on static archives.
1243 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1245 # Go through the arguments, transforming them on the way.
1246 while test "$#" -gt 0; do
1247 arg="$1"
1248 shift
1249 case $arg in
1250 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1251 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1253 *) qarg=$arg ;;
1254 esac
1255 libtool_args="$libtool_args $qarg"
1257 # If the previous option needs an argument, assign it.
1258 if test -n "$prev"; then
1259 case $prev in
1260 output)
1261 compile_command="$compile_command @OUTPUT@"
1262 finalize_command="$finalize_command @OUTPUT@"
1264 esac
1266 case $prev in
1267 dlfiles|dlprefiles)
1268 if test "$preload" = no; then
1269 # Add the symbol object into the linking commands.
1270 compile_command="$compile_command @SYMFILE@"
1271 finalize_command="$finalize_command @SYMFILE@"
1272 preload=yes
1274 case $arg in
1275 *.la | *.lo) ;; # We handle these cases below.
1276 force)
1277 if test "$dlself" = no; then
1278 dlself=needless
1279 export_dynamic=yes
1281 prev=
1282 continue
1284 self)
1285 if test "$prev" = dlprefiles; then
1286 dlself=yes
1287 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1288 dlself=yes
1289 else
1290 dlself=needless
1291 export_dynamic=yes
1293 prev=
1294 continue
1297 if test "$prev" = dlfiles; then
1298 dlfiles="$dlfiles $arg"
1299 else
1300 dlprefiles="$dlprefiles $arg"
1302 prev=
1303 continue
1305 esac
1307 expsyms)
1308 export_symbols="$arg"
1309 if test ! -f "$arg"; then
1310 $echo "$modename: symbol file \`$arg' does not exist"
1311 exit $EXIT_FAILURE
1313 prev=
1314 continue
1316 expsyms_regex)
1317 export_symbols_regex="$arg"
1318 prev=
1319 continue
1321 inst_prefix)
1322 inst_prefix_dir="$arg"
1323 prev=
1324 continue
1326 precious_regex)
1327 precious_files_regex="$arg"
1328 prev=
1329 continue
1331 release)
1332 release="-$arg"
1333 prev=
1334 continue
1336 objectlist)
1337 if test -f "$arg"; then
1338 save_arg=$arg
1339 moreargs=
1340 for fil in `cat $save_arg`
1342 # moreargs="$moreargs $fil"
1343 arg=$fil
1344 # A libtool-controlled object.
1346 # Check to see that this really is a libtool object.
1347 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1348 pic_object=
1349 non_pic_object=
1351 # Read the .lo file
1352 # If there is no directory component, then add one.
1353 case $arg in
1354 */* | *\\*) . $arg ;;
1355 *) . ./$arg ;;
1356 esac
1358 if test -z "$pic_object" || \
1359 test -z "$non_pic_object" ||
1360 test "$pic_object" = none && \
1361 test "$non_pic_object" = none; then
1362 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1363 exit $EXIT_FAILURE
1366 # Extract subdirectory from the argument.
1367 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1368 if test "X$xdir" = "X$arg"; then
1369 xdir=
1370 else
1371 xdir="$xdir/"
1374 if test "$pic_object" != none; then
1375 # Prepend the subdirectory the object is found in.
1376 pic_object="$xdir$pic_object"
1378 if test "$prev" = dlfiles; then
1379 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1380 dlfiles="$dlfiles $pic_object"
1381 prev=
1382 continue
1383 else
1384 # If libtool objects are unsupported, then we need to preload.
1385 prev=dlprefiles
1389 # CHECK ME: I think I busted this. -Ossama
1390 if test "$prev" = dlprefiles; then
1391 # Preload the old-style object.
1392 dlprefiles="$dlprefiles $pic_object"
1393 prev=
1396 # A PIC object.
1397 libobjs="$libobjs $pic_object"
1398 arg="$pic_object"
1401 # Non-PIC object.
1402 if test "$non_pic_object" != none; then
1403 # Prepend the subdirectory the object is found in.
1404 non_pic_object="$xdir$non_pic_object"
1406 # A standard non-PIC object
1407 non_pic_objects="$non_pic_objects $non_pic_object"
1408 if test -z "$pic_object" || test "$pic_object" = none ; then
1409 arg="$non_pic_object"
1411 else
1412 # If the PIC object exists, use it instead.
1413 # $xdir was prepended to $pic_object above.
1414 non_pic_object="$pic_object"
1415 non_pic_objects="$non_pic_objects $non_pic_object"
1417 else
1418 # Only an error if not doing a dry-run.
1419 if test -z "$run"; then
1420 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1421 exit $EXIT_FAILURE
1422 else
1423 # Dry-run case.
1425 # Extract subdirectory from the argument.
1426 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1427 if test "X$xdir" = "X$arg"; then
1428 xdir=
1429 else
1430 xdir="$xdir/"
1433 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1434 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1435 libobjs="$libobjs $pic_object"
1436 non_pic_objects="$non_pic_objects $non_pic_object"
1439 done
1440 else
1441 $echo "$modename: link input file \`$save_arg' does not exist"
1442 exit $EXIT_FAILURE
1444 arg=$save_arg
1445 prev=
1446 continue
1448 rpath | xrpath)
1449 # We need an absolute path.
1450 case $arg in
1451 [\\/]* | [A-Za-z]:[\\/]*) ;;
1453 $echo "$modename: only absolute run-paths are allowed" 1>&2
1454 exit $EXIT_FAILURE
1456 esac
1457 if test "$prev" = rpath; then
1458 case "$rpath " in
1459 *" $arg "*) ;;
1460 *) rpath="$rpath $arg" ;;
1461 esac
1462 else
1463 case "$xrpath " in
1464 *" $arg "*) ;;
1465 *) xrpath="$xrpath $arg" ;;
1466 esac
1468 prev=
1469 continue
1471 xcompiler)
1472 compiler_flags="$compiler_flags $qarg"
1473 prev=
1474 compile_command="$compile_command $qarg"
1475 finalize_command="$finalize_command $qarg"
1476 continue
1478 xlinker)
1479 linker_flags="$linker_flags $qarg"
1480 compiler_flags="$compiler_flags $wl$qarg"
1481 prev=
1482 compile_command="$compile_command $wl$qarg"
1483 finalize_command="$finalize_command $wl$qarg"
1484 continue
1486 xcclinker)
1487 linker_flags="$linker_flags $qarg"
1488 compiler_flags="$compiler_flags $qarg"
1489 prev=
1490 compile_command="$compile_command $qarg"
1491 finalize_command="$finalize_command $qarg"
1492 continue
1494 shrext)
1495 shrext_cmds="$arg"
1496 prev=
1497 continue
1499 darwin_framework|darwin_framework_skip)
1500 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1501 compile_command="$compile_command $arg"
1502 finalize_command="$finalize_command $arg"
1503 prev=
1504 continue
1507 eval "$prev=\"\$arg\""
1508 prev=
1509 continue
1511 esac
1512 fi # test -n "$prev"
1514 prevarg="$arg"
1516 case $arg in
1517 -all-static)
1518 if test -n "$link_static_flag"; then
1519 compile_command="$compile_command $link_static_flag"
1520 finalize_command="$finalize_command $link_static_flag"
1522 continue
1525 -allow-undefined)
1526 # FIXME: remove this flag sometime in the future.
1527 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1528 continue
1531 -avoid-version)
1532 avoid_version=yes
1533 continue
1536 -dlopen)
1537 prev=dlfiles
1538 continue
1541 -dlpreopen)
1542 prev=dlprefiles
1543 continue
1546 -export-dynamic)
1547 export_dynamic=yes
1548 continue
1551 -export-symbols | -export-symbols-regex)
1552 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1553 $echo "$modename: more than one -exported-symbols argument is not allowed"
1554 exit $EXIT_FAILURE
1556 if test "X$arg" = "X-export-symbols"; then
1557 prev=expsyms
1558 else
1559 prev=expsyms_regex
1561 continue
1564 -framework|-arch|-isysroot)
1565 case " $CC " in
1566 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1567 prev=darwin_framework_skip ;;
1568 *) compiler_flags="$compiler_flags $arg"
1569 prev=darwin_framework ;;
1570 esac
1571 compile_command="$compile_command $arg"
1572 finalize_command="$finalize_command $arg"
1573 continue
1576 -inst-prefix-dir)
1577 prev=inst_prefix
1578 continue
1581 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1582 # so, if we see these flags be careful not to treat them like -L
1583 -L[A-Z][A-Z]*:*)
1584 case $with_gcc/$host in
1585 no/*-*-irix* | /*-*-irix*)
1586 compile_command="$compile_command $arg"
1587 finalize_command="$finalize_command $arg"
1589 esac
1590 continue
1593 -L*)
1594 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1595 # We need an absolute path.
1596 case $dir in
1597 [\\/]* | [A-Za-z]:[\\/]*) ;;
1599 absdir=`cd "$dir" && pwd`
1600 if test -z "$absdir"; then
1601 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1602 absdir="$dir"
1603 notinst_path="$notinst_path $dir"
1605 dir="$absdir"
1607 esac
1608 case "$deplibs " in
1609 *" -L$dir "*) ;;
1611 deplibs="$deplibs -L$dir"
1612 lib_search_path="$lib_search_path $dir"
1614 esac
1615 case $host in
1616 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1617 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1618 case :$dllsearchpath: in
1619 *":$dir:"*) ;;
1620 *) dllsearchpath="$dllsearchpath:$dir";;
1621 esac
1622 case :$dllsearchpath: in
1623 *":$testbindir:"*) ;;
1624 *) dllsearchpath="$dllsearchpath:$testbindir";;
1625 esac
1627 esac
1628 continue
1631 -l*)
1632 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1633 case $host in
1634 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1635 # These systems don't actually have a C or math library (as such)
1636 continue
1638 *-*-os2*)
1639 # These systems don't actually have a C library (as such)
1640 test "X$arg" = "X-lc" && continue
1642 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1643 # Do not include libc due to us having libc/libc_r.
1644 test "X$arg" = "X-lc" && continue
1646 *-*-rhapsody* | *-*-darwin1.[012])
1647 # Rhapsody C and math libraries are in the System framework
1648 deplibs="$deplibs -framework System"
1649 continue
1651 *-*-sco3.2v5* | *-*-sco5v6*)
1652 # Causes problems with __ctype
1653 test "X$arg" = "X-lc" && continue
1655 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1656 # Compiler inserts libc in the correct place for threads to work
1657 test "X$arg" = "X-lc" && continue
1659 esac
1660 elif test "X$arg" = "X-lc_r"; then
1661 case $host in
1662 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1663 # Do not include libc_r directly, use -pthread flag.
1664 continue
1666 esac
1668 deplibs="$deplibs $arg"
1669 continue
1672 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1673 # classes, name mangling, and exception handling.
1674 -model)
1675 compile_command="$compile_command $arg"
1676 compiler_flags="$compiler_flags $arg"
1677 finalize_command="$finalize_command $arg"
1678 prev=xcompiler
1679 continue
1682 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1683 compiler_flags="$compiler_flags $arg"
1684 compile_command="$compile_command $arg"
1685 finalize_command="$finalize_command $arg"
1686 continue
1689 -module)
1690 module=yes
1691 continue
1694 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1695 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1696 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1697 # +DA*, +DD* enable 64-bit mode on the HP compiler
1698 # -q* pass through compiler args for the IBM compiler
1699 # -m* pass through architecture-specific compiler args for GCC
1700 # -m*, -t[45]*, -txscale* pass through architecture-specific
1701 # compiler args for GCC
1702 # -pg pass through profiling flag for GCC
1703 # @file GCC response files
1704 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1705 -t[45]*|-txscale*|@*)
1707 # Unknown arguments in both finalize_command and compile_command need
1708 # to be aesthetically quoted because they are evaled later.
1709 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1710 case $arg in
1711 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1712 arg="\"$arg\""
1714 esac
1715 compile_command="$compile_command $arg"
1716 finalize_command="$finalize_command $arg"
1717 compiler_flags="$compiler_flags $arg"
1718 continue
1721 -shrext)
1722 prev=shrext
1723 continue
1726 -no-fast-install)
1727 fast_install=no
1728 continue
1731 -no-install)
1732 case $host in
1733 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1734 # The PATH hackery in wrapper scripts is required on Windows
1735 # in order for the loader to find any dlls it needs.
1736 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1737 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1738 fast_install=no
1740 *) no_install=yes ;;
1741 esac
1742 continue
1745 -no-undefined)
1746 allow_undefined=no
1747 continue
1750 -objectlist)
1751 prev=objectlist
1752 continue
1755 -o) prev=output ;;
1757 -precious-files-regex)
1758 prev=precious_regex
1759 continue
1762 -release)
1763 prev=release
1764 continue
1767 -rpath)
1768 prev=rpath
1769 continue
1773 prev=xrpath
1774 continue
1777 -R*)
1778 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1779 # We need an absolute path.
1780 case $dir in
1781 [\\/]* | [A-Za-z]:[\\/]*) ;;
1783 $echo "$modename: only absolute run-paths are allowed" 1>&2
1784 exit $EXIT_FAILURE
1786 esac
1787 case "$xrpath " in
1788 *" $dir "*) ;;
1789 *) xrpath="$xrpath $dir" ;;
1790 esac
1791 continue
1794 -static)
1795 # The effects of -static are defined in a previous loop.
1796 # We used to do the same as -all-static on platforms that
1797 # didn't have a PIC flag, but the assumption that the effects
1798 # would be equivalent was wrong. It would break on at least
1799 # Digital Unix and AIX.
1800 continue
1803 -thread-safe)
1804 thread_safe=yes
1805 continue
1808 -version-info)
1809 prev=vinfo
1810 continue
1812 -version-number)
1813 prev=vinfo
1814 vinfo_number=yes
1815 continue
1818 -Wc,*)
1819 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1820 arg=
1821 save_ifs="$IFS"; IFS=','
1822 for flag in $args; do
1823 IFS="$save_ifs"
1824 case $flag in
1825 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1826 flag="\"$flag\""
1828 esac
1829 arg="$arg $wl$flag"
1830 compiler_flags="$compiler_flags $flag"
1831 done
1832 IFS="$save_ifs"
1833 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1836 -Wl,*)
1837 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1838 arg=
1839 save_ifs="$IFS"; IFS=','
1840 for flag in $args; do
1841 IFS="$save_ifs"
1842 case $flag in
1843 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1844 flag="\"$flag\""
1846 esac
1847 arg="$arg $wl$flag"
1848 compiler_flags="$compiler_flags $wl$flag"
1849 linker_flags="$linker_flags $flag"
1850 done
1851 IFS="$save_ifs"
1852 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1855 -Xcompiler)
1856 prev=xcompiler
1857 continue
1860 -Xlinker)
1861 prev=xlinker
1862 continue
1865 -XCClinker)
1866 prev=xcclinker
1867 continue
1870 # Some other compiler flag.
1871 -* | +*)
1872 # Unknown arguments in both finalize_command and compile_command need
1873 # to be aesthetically quoted because they are evaled later.
1874 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1875 case $arg in
1876 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1877 arg="\"$arg\""
1879 esac
1882 *.$objext)
1883 # A standard object.
1884 objs="$objs $arg"
1887 *.lo)
1888 # A libtool-controlled object.
1890 # Check to see that this really is a libtool object.
1891 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1892 pic_object=
1893 non_pic_object=
1895 # Read the .lo file
1896 # If there is no directory component, then add one.
1897 case $arg in
1898 */* | *\\*) . $arg ;;
1899 *) . ./$arg ;;
1900 esac
1902 if test -z "$pic_object" || \
1903 test -z "$non_pic_object" ||
1904 test "$pic_object" = none && \
1905 test "$non_pic_object" = none; then
1906 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1907 exit $EXIT_FAILURE
1910 # Extract subdirectory from the argument.
1911 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1912 if test "X$xdir" = "X$arg"; then
1913 xdir=
1914 else
1915 xdir="$xdir/"
1918 if test "$pic_object" != none; then
1919 # Prepend the subdirectory the object is found in.
1920 pic_object="$xdir$pic_object"
1922 if test "$prev" = dlfiles; then
1923 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1924 dlfiles="$dlfiles $pic_object"
1925 prev=
1926 continue
1927 else
1928 # If libtool objects are unsupported, then we need to preload.
1929 prev=dlprefiles
1933 # CHECK ME: I think I busted this. -Ossama
1934 if test "$prev" = dlprefiles; then
1935 # Preload the old-style object.
1936 dlprefiles="$dlprefiles $pic_object"
1937 prev=
1940 # A PIC object.
1941 libobjs="$libobjs $pic_object"
1942 arg="$pic_object"
1945 # Non-PIC object.
1946 if test "$non_pic_object" != none; then
1947 # Prepend the subdirectory the object is found in.
1948 non_pic_object="$xdir$non_pic_object"
1950 # A standard non-PIC object
1951 non_pic_objects="$non_pic_objects $non_pic_object"
1952 if test -z "$pic_object" || test "$pic_object" = none ; then
1953 arg="$non_pic_object"
1955 else
1956 # If the PIC object exists, use it instead.
1957 # $xdir was prepended to $pic_object above.
1958 non_pic_object="$pic_object"
1959 non_pic_objects="$non_pic_objects $non_pic_object"
1961 else
1962 # Only an error if not doing a dry-run.
1963 if test -z "$run"; then
1964 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1965 exit $EXIT_FAILURE
1966 else
1967 # Dry-run case.
1969 # Extract subdirectory from the argument.
1970 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1971 if test "X$xdir" = "X$arg"; then
1972 xdir=
1973 else
1974 xdir="$xdir/"
1977 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1978 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1979 libobjs="$libobjs $pic_object"
1980 non_pic_objects="$non_pic_objects $non_pic_object"
1985 *.$libext)
1986 # An archive.
1987 deplibs="$deplibs $arg"
1988 old_deplibs="$old_deplibs $arg"
1989 continue
1992 *.la)
1993 # A libtool-controlled library.
1995 if test "$prev" = dlfiles; then
1996 # This library was specified with -dlopen.
1997 dlfiles="$dlfiles $arg"
1998 prev=
1999 elif test "$prev" = dlprefiles; then
2000 # The library was specified with -dlpreopen.
2001 dlprefiles="$dlprefiles $arg"
2002 prev=
2003 else
2004 deplibs="$deplibs $arg"
2006 continue
2009 # Some other compiler argument.
2011 # Unknown arguments in both finalize_command and compile_command need
2012 # to be aesthetically quoted because they are evaled later.
2013 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2014 case $arg in
2015 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2016 arg="\"$arg\""
2018 esac
2020 esac # arg
2022 # Now actually substitute the argument into the commands.
2023 if test -n "$arg"; then
2024 compile_command="$compile_command $arg"
2025 finalize_command="$finalize_command $arg"
2027 done # argument parsing loop
2029 if test -n "$prev"; then
2030 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2031 $echo "$help" 1>&2
2032 exit $EXIT_FAILURE
2035 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2036 eval arg=\"$export_dynamic_flag_spec\"
2037 compile_command="$compile_command $arg"
2038 finalize_command="$finalize_command $arg"
2041 oldlibs=
2042 # calculate the name of the file, without its directory
2043 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2044 libobjs_save="$libobjs"
2046 if test -n "$shlibpath_var"; then
2047 # get the directories listed in $shlibpath_var
2048 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2049 else
2050 shlib_search_path=
2052 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2053 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2055 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2056 if test "X$output_objdir" = "X$output"; then
2057 output_objdir="$objdir"
2058 else
2059 output_objdir="$output_objdir/$objdir"
2061 # Create the object directory.
2062 if test ! -d "$output_objdir"; then
2063 $show "$mkdir $output_objdir"
2064 $run $mkdir $output_objdir
2065 exit_status=$?
2066 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2067 exit $exit_status
2071 # Determine the type of output
2072 case $output in
2074 $echo "$modename: you must specify an output file" 1>&2
2075 $echo "$help" 1>&2
2076 exit $EXIT_FAILURE
2078 *.$libext) linkmode=oldlib ;;
2079 *.lo | *.$objext) linkmode=obj ;;
2080 *.la) linkmode=lib ;;
2081 *) linkmode=prog ;; # Anything else should be a program.
2082 esac
2084 case $host in
2085 *cygwin* | *mingw* | *pw32*)
2086 # don't eliminate duplications in $postdeps and $predeps
2087 duplicate_compiler_generated_deps=yes
2090 duplicate_compiler_generated_deps=$duplicate_deps
2092 esac
2093 specialdeplibs=
2095 libs=
2096 # Find all interdependent deplibs by searching for libraries
2097 # that are linked more than once (e.g. -la -lb -la)
2098 for deplib in $deplibs; do
2099 if test "X$duplicate_deps" = "Xyes" ; then
2100 case "$libs " in
2101 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2102 esac
2104 libs="$libs $deplib"
2105 done
2107 if test "$linkmode" = lib; then
2108 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2110 # Compute libraries that are listed more than once in $predeps
2111 # $postdeps and mark them as special (i.e., whose duplicates are
2112 # not to be eliminated).
2113 pre_post_deps=
2114 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2115 for pre_post_dep in $predeps $postdeps; do
2116 case "$pre_post_deps " in
2117 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2118 esac
2119 pre_post_deps="$pre_post_deps $pre_post_dep"
2120 done
2122 pre_post_deps=
2125 deplibs=
2126 newdependency_libs=
2127 newlib_search_path=
2128 need_relink=no # whether we're linking any uninstalled libtool libraries
2129 notinst_deplibs= # not-installed libtool libraries
2130 case $linkmode in
2131 lib)
2132 passes="conv link"
2133 for file in $dlfiles $dlprefiles; do
2134 case $file in
2135 *.la) ;;
2137 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2138 exit $EXIT_FAILURE
2140 esac
2141 done
2143 prog)
2144 compile_deplibs=
2145 finalize_deplibs=
2146 alldeplibs=no
2147 newdlfiles=
2148 newdlprefiles=
2149 passes="conv scan dlopen dlpreopen link"
2151 *) passes="conv"
2153 esac
2154 for pass in $passes; do
2155 if test "$linkmode,$pass" = "lib,link" ||
2156 test "$linkmode,$pass" = "prog,scan"; then
2157 libs="$deplibs"
2158 deplibs=
2160 if test "$linkmode" = prog; then
2161 case $pass in
2162 dlopen) libs="$dlfiles" ;;
2163 dlpreopen) libs="$dlprefiles" ;;
2164 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2165 esac
2167 if test "$pass" = dlopen; then
2168 # Collect dlpreopened libraries
2169 save_deplibs="$deplibs"
2170 deplibs=
2172 for deplib in $libs; do
2173 lib=
2174 found=no
2175 case $deplib in
2176 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2177 if test "$linkmode,$pass" = "prog,link"; then
2178 compile_deplibs="$deplib $compile_deplibs"
2179 finalize_deplibs="$deplib $finalize_deplibs"
2180 else
2181 compiler_flags="$compiler_flags $deplib"
2183 continue
2185 -l*)
2186 if test "$linkmode" != lib && test "$linkmode" != prog; then
2187 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2188 continue
2190 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2191 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2192 for search_ext in .la $std_shrext .so .a; do
2193 # Search the libtool library
2194 lib="$searchdir/lib${name}${search_ext}"
2195 if test -f "$lib"; then
2196 if test "$search_ext" = ".la"; then
2197 found=yes
2198 else
2199 found=no
2201 break 2
2203 done
2204 done
2205 if test "$found" != yes; then
2206 # deplib doesn't seem to be a libtool library
2207 if test "$linkmode,$pass" = "prog,link"; then
2208 compile_deplibs="$deplib $compile_deplibs"
2209 finalize_deplibs="$deplib $finalize_deplibs"
2210 else
2211 deplibs="$deplib $deplibs"
2212 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2214 continue
2215 else # deplib is a libtool library
2216 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2217 # We need to do some special things here, and not later.
2218 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2219 case " $predeps $postdeps " in
2220 *" $deplib "*)
2221 if (${SED} -e '2q' $lib |
2222 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2223 library_names=
2224 old_library=
2225 case $lib in
2226 */* | *\\*) . $lib ;;
2227 *) . ./$lib ;;
2228 esac
2229 for l in $old_library $library_names; do
2230 ll="$l"
2231 done
2232 if test "X$ll" = "X$old_library" ; then # only static version available
2233 found=no
2234 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2235 test "X$ladir" = "X$lib" && ladir="."
2236 lib=$ladir/$old_library
2237 if test "$linkmode,$pass" = "prog,link"; then
2238 compile_deplibs="$deplib $compile_deplibs"
2239 finalize_deplibs="$deplib $finalize_deplibs"
2240 else
2241 deplibs="$deplib $deplibs"
2242 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2244 continue
2248 *) ;;
2249 esac
2252 ;; # -l
2253 -L*)
2254 case $linkmode in
2255 lib)
2256 deplibs="$deplib $deplibs"
2257 test "$pass" = conv && continue
2258 newdependency_libs="$deplib $newdependency_libs"
2259 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2261 prog)
2262 if test "$pass" = conv; then
2263 deplibs="$deplib $deplibs"
2264 continue
2266 if test "$pass" = scan; then
2267 deplibs="$deplib $deplibs"
2268 else
2269 compile_deplibs="$deplib $compile_deplibs"
2270 finalize_deplibs="$deplib $finalize_deplibs"
2272 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2275 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2277 esac # linkmode
2278 continue
2279 ;; # -L
2280 -R*)
2281 if test "$pass" = link; then
2282 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2283 # Make sure the xrpath contains only unique directories.
2284 case "$xrpath " in
2285 *" $dir "*) ;;
2286 *) xrpath="$xrpath $dir" ;;
2287 esac
2289 deplibs="$deplib $deplibs"
2290 continue
2292 *.la) lib="$deplib" ;;
2293 *.$libext)
2294 if test "$pass" = conv; then
2295 deplibs="$deplib $deplibs"
2296 continue
2298 case $linkmode in
2299 lib)
2300 valid_a_lib=no
2301 case $deplibs_check_method in
2302 match_pattern*)
2303 set dummy $deplibs_check_method
2304 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2305 if eval $echo \"$deplib\" 2>/dev/null \
2306 | $SED 10q \
2307 | $EGREP "$match_pattern_regex" > /dev/null; then
2308 valid_a_lib=yes
2311 pass_all)
2312 valid_a_lib=yes
2314 esac
2315 if test "$valid_a_lib" != yes; then
2316 $echo
2317 $echo "*** Warning: Trying to link with static lib archive $deplib."
2318 $echo "*** I have the capability to make that library automatically link in when"
2319 $echo "*** you link to this library. But I can only do this if you have a"
2320 $echo "*** shared version of the library, which you do not appear to have"
2321 $echo "*** because the file extensions .$libext of this argument makes me believe"
2322 $echo "*** that it is just a static archive that I should not used here."
2323 else
2324 $echo
2325 $echo "*** Warning: Linking the shared library $output against the"
2326 $echo "*** static library $deplib is not portable!"
2327 deplibs="$deplib $deplibs"
2329 continue
2331 prog)
2332 if test "$pass" != link; then
2333 deplibs="$deplib $deplibs"
2334 else
2335 compile_deplibs="$deplib $compile_deplibs"
2336 finalize_deplibs="$deplib $finalize_deplibs"
2338 continue
2340 esac # linkmode
2341 ;; # *.$libext
2342 *.lo | *.$objext)
2343 if test "$pass" = conv; then
2344 deplibs="$deplib $deplibs"
2345 elif test "$linkmode" = prog; then
2346 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2347 # If there is no dlopen support or we're linking statically,
2348 # we need to preload.
2349 newdlprefiles="$newdlprefiles $deplib"
2350 compile_deplibs="$deplib $compile_deplibs"
2351 finalize_deplibs="$deplib $finalize_deplibs"
2352 else
2353 newdlfiles="$newdlfiles $deplib"
2356 continue
2358 %DEPLIBS%)
2359 alldeplibs=yes
2360 continue
2362 esac # case $deplib
2363 if test "$found" = yes || test -f "$lib"; then :
2364 else
2365 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2366 exit $EXIT_FAILURE
2369 # Check to see that this really is a libtool archive.
2370 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2371 else
2372 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2373 exit $EXIT_FAILURE
2376 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2377 test "X$ladir" = "X$lib" && ladir="."
2379 dlname=
2380 dlopen=
2381 dlpreopen=
2382 libdir=
2383 library_names=
2384 old_library=
2385 # If the library was installed with an old release of libtool,
2386 # it will not redefine variables installed, or shouldnotlink
2387 installed=yes
2388 shouldnotlink=no
2389 avoidtemprpath=
2392 # Read the .la file
2393 case $lib in
2394 */* | *\\*) . $lib ;;
2395 *) . ./$lib ;;
2396 esac
2398 if test "$linkmode,$pass" = "lib,link" ||
2399 test "$linkmode,$pass" = "prog,scan" ||
2400 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2401 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2402 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2405 if test "$pass" = conv; then
2406 # Only check for convenience libraries
2407 deplibs="$lib $deplibs"
2408 if test -z "$libdir"; then
2409 if test -z "$old_library"; then
2410 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2411 exit $EXIT_FAILURE
2413 # It is a libtool convenience library, so add in its objects.
2414 convenience="$convenience $ladir/$objdir/$old_library"
2415 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2416 tmp_libs=
2417 for deplib in $dependency_libs; do
2418 deplibs="$deplib $deplibs"
2419 if test "X$duplicate_deps" = "Xyes" ; then
2420 case "$tmp_libs " in
2421 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2422 esac
2424 tmp_libs="$tmp_libs $deplib"
2425 done
2426 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2427 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2428 exit $EXIT_FAILURE
2430 continue
2431 fi # $pass = conv
2434 # Get the name of the library we link against.
2435 linklib=
2436 for l in $old_library $library_names; do
2437 linklib="$l"
2438 done
2439 if test -z "$linklib"; then
2440 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2441 exit $EXIT_FAILURE
2444 # This library was specified with -dlopen.
2445 if test "$pass" = dlopen; then
2446 if test -z "$libdir"; then
2447 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2448 exit $EXIT_FAILURE
2450 if test -z "$dlname" ||
2451 test "$dlopen_support" != yes ||
2452 test "$build_libtool_libs" = no; then
2453 # If there is no dlname, no dlopen support or we're linking
2454 # statically, we need to preload. We also need to preload any
2455 # dependent libraries so libltdl's deplib preloader doesn't
2456 # bomb out in the load deplibs phase.
2457 dlprefiles="$dlprefiles $lib $dependency_libs"
2458 else
2459 newdlfiles="$newdlfiles $lib"
2461 continue
2462 fi # $pass = dlopen
2464 # We need an absolute path.
2465 case $ladir in
2466 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2468 abs_ladir=`cd "$ladir" && pwd`
2469 if test -z "$abs_ladir"; then
2470 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2471 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2472 abs_ladir="$ladir"
2475 esac
2476 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2478 # Find the relevant object directory and library name.
2479 if test "X$installed" = Xyes; then
2480 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2481 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2482 dir="$ladir"
2483 absdir="$abs_ladir"
2484 libdir="$abs_ladir"
2485 else
2486 dir="$libdir"
2487 absdir="$libdir"
2489 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2490 else
2491 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2492 dir="$ladir"
2493 absdir="$abs_ladir"
2494 # Remove this search path later
2495 notinst_path="$notinst_path $abs_ladir"
2496 else
2497 dir="$ladir/$objdir"
2498 absdir="$abs_ladir/$objdir"
2499 # Remove this search path later
2500 notinst_path="$notinst_path $abs_ladir"
2502 fi # $installed = yes
2503 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2505 # This library was specified with -dlpreopen.
2506 if test "$pass" = dlpreopen; then
2507 if test -z "$libdir"; then
2508 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2509 exit $EXIT_FAILURE
2511 # Prefer using a static library (so that no silly _DYNAMIC symbols
2512 # are required to link).
2513 if test -n "$old_library"; then
2514 newdlprefiles="$newdlprefiles $dir/$old_library"
2515 # Otherwise, use the dlname, so that lt_dlopen finds it.
2516 elif test -n "$dlname"; then
2517 newdlprefiles="$newdlprefiles $dir/$dlname"
2518 else
2519 newdlprefiles="$newdlprefiles $dir/$linklib"
2521 fi # $pass = dlpreopen
2523 if test -z "$libdir"; then
2524 # Link the convenience library
2525 if test "$linkmode" = lib; then
2526 deplibs="$dir/$old_library $deplibs"
2527 elif test "$linkmode,$pass" = "prog,link"; then
2528 compile_deplibs="$dir/$old_library $compile_deplibs"
2529 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2530 else
2531 deplibs="$lib $deplibs" # used for prog,scan pass
2533 continue
2537 if test "$linkmode" = prog && test "$pass" != link; then
2538 newlib_search_path="$newlib_search_path $ladir"
2539 deplibs="$lib $deplibs"
2541 linkalldeplibs=no
2542 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2543 test "$build_libtool_libs" = no; then
2544 linkalldeplibs=yes
2547 tmp_libs=
2548 for deplib in $dependency_libs; do
2549 case $deplib in
2550 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2551 esac
2552 # Need to link against all dependency_libs?
2553 if test "$linkalldeplibs" = yes; then
2554 deplibs="$deplib $deplibs"
2555 else
2556 # Need to hardcode shared library paths
2557 # or/and link against static libraries
2558 newdependency_libs="$deplib $newdependency_libs"
2560 if test "X$duplicate_deps" = "Xyes" ; then
2561 case "$tmp_libs " in
2562 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2563 esac
2565 tmp_libs="$tmp_libs $deplib"
2566 done # for deplib
2567 continue
2568 fi # $linkmode = prog...
2570 if test "$linkmode,$pass" = "prog,link"; then
2571 if test -n "$library_names" &&
2572 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2573 # We need to hardcode the library path
2574 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2575 # Make sure the rpath contains only unique directories.
2576 case "$temp_rpath " in
2577 *" $dir "*) ;;
2578 *" $absdir "*) ;;
2579 *) temp_rpath="$temp_rpath $absdir" ;;
2580 esac
2583 # Hardcode the library path.
2584 # Skip directories that are in the system default run-time
2585 # search path.
2586 case " $sys_lib_dlsearch_path " in
2587 *" $absdir "*) ;;
2589 case "$compile_rpath " in
2590 *" $absdir "*) ;;
2591 *) compile_rpath="$compile_rpath $absdir"
2592 esac
2594 esac
2595 case " $sys_lib_dlsearch_path " in
2596 *" $libdir "*) ;;
2598 case "$finalize_rpath " in
2599 *" $libdir "*) ;;
2600 *) finalize_rpath="$finalize_rpath $libdir"
2601 esac
2603 esac
2604 fi # $linkmode,$pass = prog,link...
2606 if test "$alldeplibs" = yes &&
2607 { test "$deplibs_check_method" = pass_all ||
2608 { test "$build_libtool_libs" = yes &&
2609 test -n "$library_names"; }; }; then
2610 # We only need to search for static libraries
2611 continue
2615 link_static=no # Whether the deplib will be linked statically
2616 use_static_libs=$prefer_static_libs
2617 if test "$use_static_libs" = built && test "$installed" = yes ; then
2618 use_static_libs=no
2620 if test -n "$library_names" &&
2621 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2622 if test "$installed" = no; then
2623 notinst_deplibs="$notinst_deplibs $lib"
2624 need_relink=yes
2626 # This is a shared library
2628 # Warn about portability, can't link against -module's on
2629 # some systems (darwin)
2630 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2631 $echo
2632 if test "$linkmode" = prog; then
2633 $echo "*** Warning: Linking the executable $output against the loadable module"
2634 else
2635 $echo "*** Warning: Linking the shared library $output against the loadable module"
2637 $echo "*** $linklib is not portable!"
2639 if test "$linkmode" = lib &&
2640 test "$hardcode_into_libs" = yes; then
2641 # Hardcode the library path.
2642 # Skip directories that are in the system default run-time
2643 # search path.
2644 case " $sys_lib_dlsearch_path " in
2645 *" $absdir "*) ;;
2647 case "$compile_rpath " in
2648 *" $absdir "*) ;;
2649 *) compile_rpath="$compile_rpath $absdir"
2650 esac
2652 esac
2653 case " $sys_lib_dlsearch_path " in
2654 *" $libdir "*) ;;
2656 case "$finalize_rpath " in
2657 *" $libdir "*) ;;
2658 *) finalize_rpath="$finalize_rpath $libdir"
2659 esac
2661 esac
2664 if test -n "$old_archive_from_expsyms_cmds"; then
2665 # figure out the soname
2666 set dummy $library_names
2667 realname="$2"
2668 shift; shift
2669 libname=`eval \\$echo \"$libname_spec\"`
2670 # use dlname if we got it. it's perfectly good, no?
2671 if test -n "$dlname"; then
2672 soname="$dlname"
2673 elif test -n "$soname_spec"; then
2674 # bleh windows
2675 case $host in
2676 *cygwin* | mingw*)
2677 major=`expr $current - $age`
2678 versuffix="-$major"
2680 esac
2681 eval soname=\"$soname_spec\"
2682 else
2683 soname="$realname"
2686 # Make a new name for the extract_expsyms_cmds to use
2687 soroot="$soname"
2688 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2689 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2691 # If the library has no export list, then create one now
2692 if test -f "$output_objdir/$soname-def"; then :
2693 else
2694 $show "extracting exported symbol list from \`$soname'"
2695 save_ifs="$IFS"; IFS='~'
2696 cmds=$extract_expsyms_cmds
2697 for cmd in $cmds; do
2698 IFS="$save_ifs"
2699 eval cmd=\"$cmd\"
2700 $show "$cmd"
2701 $run eval "$cmd" || exit $?
2702 done
2703 IFS="$save_ifs"
2706 # Create $newlib
2707 if test -f "$output_objdir/$newlib"; then :; else
2708 $show "generating import library for \`$soname'"
2709 save_ifs="$IFS"; IFS='~'
2710 cmds=$old_archive_from_expsyms_cmds
2711 for cmd in $cmds; do
2712 IFS="$save_ifs"
2713 eval cmd=\"$cmd\"
2714 $show "$cmd"
2715 $run eval "$cmd" || exit $?
2716 done
2717 IFS="$save_ifs"
2719 # make sure the library variables are pointing to the new library
2720 dir=$output_objdir
2721 linklib=$newlib
2722 fi # test -n "$old_archive_from_expsyms_cmds"
2724 if test "$linkmode" = prog || test "$mode" != relink; then
2725 add_shlibpath=
2726 add_dir=
2727 add=
2728 lib_linked=yes
2729 case $hardcode_action in
2730 immediate | unsupported)
2731 if test "$hardcode_direct" = no; then
2732 add="$dir/$linklib"
2733 case $host in
2734 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2735 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2736 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2737 *-*-unixware7*) add_dir="-L$dir" ;;
2738 *-*-darwin* )
2739 # if the lib is a module then we can not link against
2740 # it, someone is ignoring the new warnings I added
2741 if /usr/bin/file -L $add 2> /dev/null |
2742 $EGREP ": [^:]* bundle" >/dev/null ; then
2743 $echo "** Warning, lib $linklib is a module, not a shared library"
2744 if test -z "$old_library" ; then
2745 $echo
2746 $echo "** And there doesn't seem to be a static archive available"
2747 $echo "** The link will probably fail, sorry"
2748 else
2749 add="$dir/$old_library"
2752 esac
2753 elif test "$hardcode_minus_L" = no; then
2754 case $host in
2755 *-*-sunos*) add_shlibpath="$dir" ;;
2756 esac
2757 add_dir="-L$dir"
2758 add="-l$name"
2759 elif test "$hardcode_shlibpath_var" = no; then
2760 add_shlibpath="$dir"
2761 add="-l$name"
2762 else
2763 lib_linked=no
2766 relink)
2767 if test "$hardcode_direct" = yes; then
2768 add="$dir/$linklib"
2769 elif test "$hardcode_minus_L" = yes; then
2770 add_dir="-L$dir"
2771 # Try looking first in the location we're being installed to.
2772 if test -n "$inst_prefix_dir"; then
2773 case $libdir in
2774 [\\/]*)
2775 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2777 esac
2779 add="-l$name"
2780 elif test "$hardcode_shlibpath_var" = yes; then
2781 add_shlibpath="$dir"
2782 add="-l$name"
2783 else
2784 lib_linked=no
2787 *) lib_linked=no ;;
2788 esac
2790 if test "$lib_linked" != yes; then
2791 $echo "$modename: configuration error: unsupported hardcode properties"
2792 exit $EXIT_FAILURE
2795 if test -n "$add_shlibpath"; then
2796 case :$compile_shlibpath: in
2797 *":$add_shlibpath:"*) ;;
2798 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2799 esac
2801 if test "$linkmode" = prog; then
2802 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2803 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2804 else
2805 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2806 test -n "$add" && deplibs="$add $deplibs"
2807 if test "$hardcode_direct" != yes && \
2808 test "$hardcode_minus_L" != yes && \
2809 test "$hardcode_shlibpath_var" = yes; then
2810 case :$finalize_shlibpath: in
2811 *":$libdir:"*) ;;
2812 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2813 esac
2818 if test "$linkmode" = prog || test "$mode" = relink; then
2819 add_shlibpath=
2820 add_dir=
2821 add=
2822 # Finalize command for both is simple: just hardcode it.
2823 if test "$hardcode_direct" = yes; then
2824 add="$libdir/$linklib"
2825 elif test "$hardcode_minus_L" = yes; then
2826 add_dir="-L$libdir"
2827 add="-l$name"
2828 elif test "$hardcode_shlibpath_var" = yes; then
2829 case :$finalize_shlibpath: in
2830 *":$libdir:"*) ;;
2831 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2832 esac
2833 add="-l$name"
2834 elif test "$hardcode_automatic" = yes; then
2835 if test -n "$inst_prefix_dir" &&
2836 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2837 add="$inst_prefix_dir$libdir/$linklib"
2838 else
2839 add="$libdir/$linklib"
2841 else
2842 # We cannot seem to hardcode it, guess we'll fake it.
2843 add_dir="-L$libdir"
2844 # Try looking first in the location we're being installed to.
2845 if test -n "$inst_prefix_dir"; then
2846 case $libdir in
2847 [\\/]*)
2848 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2850 esac
2852 add="-l$name"
2855 if test "$linkmode" = prog; then
2856 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2857 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2858 else
2859 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2860 test -n "$add" && deplibs="$add $deplibs"
2863 elif test "$linkmode" = prog; then
2864 # Here we assume that one of hardcode_direct or hardcode_minus_L
2865 # is not unsupported. This is valid on all known static and
2866 # shared platforms.
2867 if test "$hardcode_direct" != unsupported; then
2868 test -n "$old_library" && linklib="$old_library"
2869 compile_deplibs="$dir/$linklib $compile_deplibs"
2870 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2871 else
2872 compile_deplibs="-l$name -L$dir $compile_deplibs"
2873 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2875 elif test "$build_libtool_libs" = yes; then
2876 # Not a shared library
2877 if test "$deplibs_check_method" != pass_all; then
2878 # We're trying link a shared library against a static one
2879 # but the system doesn't support it.
2881 # Just print a warning and add the library to dependency_libs so
2882 # that the program can be linked against the static library.
2883 $echo
2884 $echo "*** Warning: This system can not link to static lib archive $lib."
2885 $echo "*** I have the capability to make that library automatically link in when"
2886 $echo "*** you link to this library. But I can only do this if you have a"
2887 $echo "*** shared version of the library, which you do not appear to have."
2888 if test "$module" = yes; then
2889 $echo "*** But as you try to build a module library, libtool will still create "
2890 $echo "*** a static module, that should work as long as the dlopening application"
2891 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2892 if test -z "$global_symbol_pipe"; then
2893 $echo
2894 $echo "*** However, this would only work if libtool was able to extract symbol"
2895 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2896 $echo "*** not find such a program. So, this module is probably useless."
2897 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2899 if test "$build_old_libs" = no; then
2900 build_libtool_libs=module
2901 build_old_libs=yes
2902 else
2903 build_libtool_libs=no
2906 else
2907 deplibs="$dir/$old_library $deplibs"
2908 link_static=yes
2910 fi # link shared/static library?
2912 if test "$linkmode" = lib; then
2913 if test -n "$dependency_libs" &&
2914 { test "$hardcode_into_libs" != yes ||
2915 test "$build_old_libs" = yes ||
2916 test "$link_static" = yes; }; then
2917 # Extract -R from dependency_libs
2918 temp_deplibs=
2919 for libdir in $dependency_libs; do
2920 case $libdir in
2921 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2922 case " $xrpath " in
2923 *" $temp_xrpath "*) ;;
2924 *) xrpath="$xrpath $temp_xrpath";;
2925 esac;;
2926 *) temp_deplibs="$temp_deplibs $libdir";;
2927 esac
2928 done
2929 dependency_libs="$temp_deplibs"
2932 newlib_search_path="$newlib_search_path $absdir"
2933 # Link against this library
2934 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2935 # ... and its dependency_libs
2936 tmp_libs=
2937 for deplib in $dependency_libs; do
2938 newdependency_libs="$deplib $newdependency_libs"
2939 if test "X$duplicate_deps" = "Xyes" ; then
2940 case "$tmp_libs " in
2941 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2942 esac
2944 tmp_libs="$tmp_libs $deplib"
2945 done
2947 if test "$link_all_deplibs" != no; then
2948 # Add the search paths of all dependency libraries
2949 for deplib in $dependency_libs; do
2950 case $deplib in
2951 -L*) path="$deplib" ;;
2952 *.la)
2953 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2954 test "X$dir" = "X$deplib" && dir="."
2955 # We need an absolute path.
2956 case $dir in
2957 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2959 absdir=`cd "$dir" && pwd`
2960 if test -z "$absdir"; then
2961 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2962 absdir="$dir"
2965 esac
2966 if grep "^installed=no" $deplib > /dev/null; then
2967 path="$absdir/$objdir"
2968 else
2969 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2970 if test -z "$libdir"; then
2971 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2972 exit $EXIT_FAILURE
2974 if test "$absdir" != "$libdir"; then
2975 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2977 path="$absdir"
2979 depdepl=
2980 case $host in
2981 *-*-darwin*)
2982 # we do not want to link against static libs,
2983 # but need to link against shared
2984 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2985 if test -n "$deplibrary_names" ; then
2986 for tmp in $deplibrary_names ; do
2987 depdepl=$tmp
2988 done
2989 if test -f "$path/$depdepl" ; then
2990 depdepl="$path/$depdepl"
2992 # do not add paths which are already there
2993 case " $newlib_search_path " in
2994 *" $path "*) ;;
2995 *) newlib_search_path="$newlib_search_path $path";;
2996 esac
2998 path=""
3001 path="-L$path"
3003 esac
3005 -l*)
3006 case $host in
3007 *-*-darwin*)
3008 # Again, we only want to link against shared libraries
3009 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3010 for tmp in $newlib_search_path ; do
3011 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3012 eval depdepl="$tmp/lib$tmp_libs.dylib"
3013 break
3015 done
3016 path=""
3018 *) continue ;;
3019 esac
3021 *) continue ;;
3022 esac
3023 case " $deplibs " in
3024 *" $path "*) ;;
3025 *) deplibs="$path $deplibs" ;;
3026 esac
3027 case " $deplibs " in
3028 *" $depdepl "*) ;;
3029 *) deplibs="$depdepl $deplibs" ;;
3030 esac
3031 done
3032 fi # link_all_deplibs != no
3033 fi # linkmode = lib
3034 done # for deplib in $libs
3035 dependency_libs="$newdependency_libs"
3036 if test "$pass" = dlpreopen; then
3037 # Link the dlpreopened libraries before other libraries
3038 for deplib in $save_deplibs; do
3039 deplibs="$deplib $deplibs"
3040 done
3042 if test "$pass" != dlopen; then
3043 if test "$pass" != conv; then
3044 # Make sure lib_search_path contains only unique directories.
3045 lib_search_path=
3046 for dir in $newlib_search_path; do
3047 case "$lib_search_path " in
3048 *" $dir "*) ;;
3049 *) lib_search_path="$lib_search_path $dir" ;;
3050 esac
3051 done
3052 newlib_search_path=
3055 if test "$linkmode,$pass" != "prog,link"; then
3056 vars="deplibs"
3057 else
3058 vars="compile_deplibs finalize_deplibs"
3060 for var in $vars dependency_libs; do
3061 # Add libraries to $var in reverse order
3062 eval tmp_libs=\"\$$var\"
3063 new_libs=
3064 for deplib in $tmp_libs; do
3065 # FIXME: Pedantically, this is the right thing to do, so
3066 # that some nasty dependency loop isn't accidentally
3067 # broken:
3068 #new_libs="$deplib $new_libs"
3069 # Pragmatically, this seems to cause very few problems in
3070 # practice:
3071 case $deplib in
3072 -L*) new_libs="$deplib $new_libs" ;;
3073 -R*) ;;
3075 # And here is the reason: when a library appears more
3076 # than once as an explicit dependence of a library, or
3077 # is implicitly linked in more than once by the
3078 # compiler, it is considered special, and multiple
3079 # occurrences thereof are not removed. Compare this
3080 # with having the same library being listed as a
3081 # dependency of multiple other libraries: in this case,
3082 # we know (pedantically, we assume) the library does not
3083 # need to be listed more than once, so we keep only the
3084 # last copy. This is not always right, but it is rare
3085 # enough that we require users that really mean to play
3086 # such unportable linking tricks to link the library
3087 # using -Wl,-lname, so that libtool does not consider it
3088 # for duplicate removal.
3089 case " $specialdeplibs " in
3090 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3092 case " $new_libs " in
3093 *" $deplib "*) ;;
3094 *) new_libs="$deplib $new_libs" ;;
3095 esac
3097 esac
3099 esac
3100 done
3101 tmp_libs=
3102 for deplib in $new_libs; do
3103 case $deplib in
3104 -L*)
3105 case " $tmp_libs " in
3106 *" $deplib "*) ;;
3107 *) tmp_libs="$tmp_libs $deplib" ;;
3108 esac
3110 *) tmp_libs="$tmp_libs $deplib" ;;
3111 esac
3112 done
3113 eval $var=\"$tmp_libs\"
3114 done # for var
3116 # Last step: remove runtime libs from dependency_libs
3117 # (they stay in deplibs)
3118 tmp_libs=
3119 for i in $dependency_libs ; do
3120 case " $predeps $postdeps $compiler_lib_search_path " in
3121 *" $i "*)
3122 i=""
3124 esac
3125 if test -n "$i" ; then
3126 tmp_libs="$tmp_libs $i"
3128 done
3129 dependency_libs=$tmp_libs
3130 done # for pass
3131 if test "$linkmode" = prog; then
3132 dlfiles="$newdlfiles"
3133 dlprefiles="$newdlprefiles"
3136 case $linkmode in
3137 oldlib)
3138 if test -n "$deplibs"; then
3139 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3142 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3143 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3146 if test -n "$rpath"; then
3147 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3150 if test -n "$xrpath"; then
3151 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3154 if test -n "$vinfo"; then
3155 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3158 if test -n "$release"; then
3159 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3162 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3163 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3166 # Now set the variables for building old libraries.
3167 build_libtool_libs=no
3168 oldlibs="$output"
3169 objs="$objs$old_deplibs"
3172 lib)
3173 # Make sure we only generate libraries of the form `libNAME.la'.
3174 case $outputname in
3175 lib*)
3176 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3177 eval shared_ext=\"$shrext_cmds\"
3178 eval libname=\"$libname_spec\"
3181 if test "$module" = no; then
3182 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3183 $echo "$help" 1>&2
3184 exit $EXIT_FAILURE
3186 if test "$need_lib_prefix" != no; then
3187 # Add the "lib" prefix for modules if required
3188 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3189 eval shared_ext=\"$shrext_cmds\"
3190 eval libname=\"$libname_spec\"
3191 else
3192 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3195 esac
3197 if test -n "$objs"; then
3198 if test "$deplibs_check_method" != pass_all; then
3199 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3200 exit $EXIT_FAILURE
3201 else
3202 $echo
3203 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3204 $echo "*** objects $objs is not portable!"
3205 libobjs="$libobjs $objs"
3209 if test "$dlself" != no; then
3210 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3213 set dummy $rpath
3214 if test "$#" -gt 2; then
3215 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3217 install_libdir="$2"
3219 oldlibs=
3220 if test -z "$rpath"; then
3221 if test "$build_libtool_libs" = yes; then
3222 # Building a libtool convenience library.
3223 # Some compilers have problems with a `.al' extension so
3224 # convenience libraries should have the same extension an
3225 # archive normally would.
3226 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3227 build_libtool_libs=convenience
3228 build_old_libs=yes
3231 if test -n "$vinfo"; then
3232 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3235 if test -n "$release"; then
3236 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3238 else
3240 # Parse the version information argument.
3241 save_ifs="$IFS"; IFS=':'
3242 set dummy $vinfo 0 0 0
3243 IFS="$save_ifs"
3245 if test -n "$8"; then
3246 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3247 $echo "$help" 1>&2
3248 exit $EXIT_FAILURE
3251 # convert absolute version numbers to libtool ages
3252 # this retains compatibility with .la files and attempts
3253 # to make the code below a bit more comprehensible
3255 case $vinfo_number in
3256 yes)
3257 number_major="$2"
3258 number_minor="$3"
3259 number_revision="$4"
3261 # There are really only two kinds -- those that
3262 # use the current revision as the major version
3263 # and those that subtract age and use age as
3264 # a minor version. But, then there is irix
3265 # which has an extra 1 added just for fun
3267 case $version_type in
3268 darwin|linux|osf|windows)
3269 current=`expr $number_major + $number_minor`
3270 age="$number_minor"
3271 revision="$number_revision"
3273 freebsd-aout|freebsd-elf|sunos)
3274 current="$number_major"
3275 revision="$number_minor"
3276 age="0"
3278 irix|nonstopux)
3279 current=`expr $number_major + $number_minor - 1`
3280 age="$number_minor"
3281 revision="$number_minor"
3283 esac
3286 current="$2"
3287 revision="$3"
3288 age="$4"
3290 esac
3292 # Check that each of the things are valid numbers.
3293 case $current in
3294 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]) ;;
3296 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3297 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3298 exit $EXIT_FAILURE
3300 esac
3302 case $revision in
3303 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]) ;;
3305 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3306 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3307 exit $EXIT_FAILURE
3309 esac
3311 case $age in
3312 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]) ;;
3314 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3315 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3316 exit $EXIT_FAILURE
3318 esac
3320 if test "$age" -gt "$current"; then
3321 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3322 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3323 exit $EXIT_FAILURE
3326 # Calculate the version variables.
3327 major=
3328 versuffix=
3329 verstring=
3330 case $version_type in
3331 none) ;;
3333 darwin)
3334 # Like Linux, but with the current version available in
3335 # verstring for coding it into the library header
3336 major=.`expr $current - $age`
3337 versuffix="$major.$age.$revision"
3338 # Darwin ld doesn't like 0 for these options...
3339 minor_current=`expr $current + 1`
3340 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3343 freebsd-aout)
3344 major=".$current"
3345 versuffix=".$current.$revision";
3348 freebsd-elf)
3349 major=".$current"
3350 versuffix=".$current";
3353 irix | nonstopux)
3354 major=`expr $current - $age + 1`
3356 case $version_type in
3357 nonstopux) verstring_prefix=nonstopux ;;
3358 *) verstring_prefix=sgi ;;
3359 esac
3360 verstring="$verstring_prefix$major.$revision"
3362 # Add in all the interfaces that we are compatible with.
3363 loop=$revision
3364 while test "$loop" -ne 0; do
3365 iface=`expr $revision - $loop`
3366 loop=`expr $loop - 1`
3367 verstring="$verstring_prefix$major.$iface:$verstring"
3368 done
3370 # Before this point, $major must not contain `.'.
3371 major=.$major
3372 versuffix="$major.$revision"
3375 linux)
3376 major=.`expr $current - $age`
3377 versuffix="$major.$age.$revision"
3380 osf)
3381 major=.`expr $current - $age`
3382 versuffix=".$current.$age.$revision"
3383 verstring="$current.$age.$revision"
3385 # Add in all the interfaces that we are compatible with.
3386 loop=$age
3387 while test "$loop" -ne 0; do
3388 iface=`expr $current - $loop`
3389 loop=`expr $loop - 1`
3390 verstring="$verstring:${iface}.0"
3391 done
3393 # Make executables depend on our current version.
3394 verstring="$verstring:${current}.0"
3397 sunos)
3398 major=".$current"
3399 versuffix=".$current.$revision"
3402 windows)
3403 # Use '-' rather than '.', since we only want one
3404 # extension on DOS 8.3 filesystems.
3405 major=`expr $current - $age`
3406 versuffix="-$major"
3410 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3411 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3412 exit $EXIT_FAILURE
3414 esac
3416 # Clear the version info if we defaulted, and they specified a release.
3417 if test -z "$vinfo" && test -n "$release"; then
3418 major=
3419 case $version_type in
3420 darwin)
3421 # we can't check for "0.0" in archive_cmds due to quoting
3422 # problems, so we reset it completely
3423 verstring=
3426 verstring="0.0"
3428 esac
3429 if test "$need_version" = no; then
3430 versuffix=
3431 else
3432 versuffix=".0.0"
3436 # Remove version info from name if versioning should be avoided
3437 if test "$avoid_version" = yes && test "$need_version" = no; then
3438 major=
3439 versuffix=
3440 verstring=""
3443 # Check to see if the archive will have undefined symbols.
3444 if test "$allow_undefined" = yes; then
3445 if test "$allow_undefined_flag" = unsupported; then
3446 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3447 build_libtool_libs=no
3448 build_old_libs=yes
3450 else
3451 # Don't allow undefined symbols.
3452 allow_undefined_flag="$no_undefined_flag"
3456 if test "$mode" != relink; then
3457 # Remove our outputs, but don't remove object files since they
3458 # may have been created when compiling PIC objects.
3459 removelist=
3460 tempremovelist=`$echo "$output_objdir/*"`
3461 for p in $tempremovelist; do
3462 case $p in
3463 *.$objext)
3465 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3466 if test "X$precious_files_regex" != "X"; then
3467 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3468 then
3469 continue
3472 removelist="$removelist $p"
3474 *) ;;
3475 esac
3476 done
3477 if test -n "$removelist"; then
3478 $show "${rm}r $removelist"
3479 $run ${rm}r $removelist
3483 # Now set the variables for building old libraries.
3484 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3485 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3487 # Transform .lo files to .o files.
3488 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3491 # Eliminate all temporary directories.
3492 for path in $notinst_path; do
3493 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3494 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3495 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3496 done
3498 if test -n "$xrpath"; then
3499 # If the user specified any rpath flags, then add them.
3500 temp_xrpath=
3501 for libdir in $xrpath; do
3502 temp_xrpath="$temp_xrpath -R$libdir"
3503 case "$finalize_rpath " in
3504 *" $libdir "*) ;;
3505 *) finalize_rpath="$finalize_rpath $libdir" ;;
3506 esac
3507 done
3508 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3509 dependency_libs="$temp_xrpath $dependency_libs"
3513 # Make sure dlfiles contains only unique files that won't be dlpreopened
3514 old_dlfiles="$dlfiles"
3515 dlfiles=
3516 for lib in $old_dlfiles; do
3517 case " $dlprefiles $dlfiles " in
3518 *" $lib "*) ;;
3519 *) dlfiles="$dlfiles $lib" ;;
3520 esac
3521 done
3523 # Make sure dlprefiles contains only unique files
3524 old_dlprefiles="$dlprefiles"
3525 dlprefiles=
3526 for lib in $old_dlprefiles; do
3527 case "$dlprefiles " in
3528 *" $lib "*) ;;
3529 *) dlprefiles="$dlprefiles $lib" ;;
3530 esac
3531 done
3533 if test "$build_libtool_libs" = yes; then
3534 if test -n "$rpath"; then
3535 case $host in
3536 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3537 # these systems don't actually have a c library (as such)!
3539 *-*-rhapsody* | *-*-darwin1.[012])
3540 # Rhapsody C library is in the System framework
3541 deplibs="$deplibs -framework System"
3543 *-*-netbsd*)
3544 # Don't link with libc until the a.out ld.so is fixed.
3546 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3547 # Do not include libc due to us having libc/libc_r.
3549 *-*-sco3.2v5* | *-*-sco5v6*)
3550 # Causes problems with __ctype
3552 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3553 # Compiler inserts libc in the correct place for threads to work
3556 # Add libc to deplibs on all other systems if necessary.
3557 if test "$build_libtool_need_lc" = "yes"; then
3558 deplibs="$deplibs -lc"
3561 esac
3564 # Transform deplibs into only deplibs that can be linked in shared.
3565 name_save=$name
3566 libname_save=$libname
3567 release_save=$release
3568 versuffix_save=$versuffix
3569 major_save=$major
3570 # I'm not sure if I'm treating the release correctly. I think
3571 # release should show up in the -l (ie -lgmp5) so we don't want to
3572 # add it in twice. Is that correct?
3573 release=""
3574 versuffix=""
3575 major=""
3576 newdeplibs=
3577 droppeddeps=no
3578 case $deplibs_check_method in
3579 pass_all)
3580 # Don't check for shared/static. Everything works.
3581 # This might be a little naive. We might want to check
3582 # whether the library exists or not. But this is on
3583 # osf3 & osf4 and I'm not really sure... Just
3584 # implementing what was already the behavior.
3585 newdeplibs=$deplibs
3587 test_compile)
3588 # This code stresses the "libraries are programs" paradigm to its
3589 # limits. Maybe even breaks it. We compile a program, linking it
3590 # against the deplibs as a proxy for the library. Then we can check
3591 # whether they linked in statically or dynamically with ldd.
3592 $rm conftest.c
3593 cat > conftest.c <<EOF
3594 int main() { return 0; }
3596 $rm conftest
3597 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3598 if test "$?" -eq 0 ; then
3599 ldd_output=`ldd conftest`
3600 for i in $deplibs; do
3601 name=`expr $i : '-l\(.*\)'`
3602 # If $name is empty we are operating on a -L argument.
3603 if test "$name" != "" && test "$name" -ne "0"; then
3604 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3605 case " $predeps $postdeps " in
3606 *" $i "*)
3607 newdeplibs="$newdeplibs $i"
3608 i=""
3610 esac
3612 if test -n "$i" ; then
3613 libname=`eval \\$echo \"$libname_spec\"`
3614 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3615 set dummy $deplib_matches
3616 deplib_match=$2
3617 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3618 newdeplibs="$newdeplibs $i"
3619 else
3620 droppeddeps=yes
3621 $echo
3622 $echo "*** Warning: dynamic linker does not accept needed library $i."
3623 $echo "*** I have the capability to make that library automatically link in when"
3624 $echo "*** you link to this library. But I can only do this if you have a"
3625 $echo "*** shared version of the library, which I believe you do not have"
3626 $echo "*** because a test_compile did reveal that the linker did not use it for"
3627 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3630 else
3631 newdeplibs="$newdeplibs $i"
3633 done
3634 else
3635 # Error occurred in the first compile. Let's try to salvage
3636 # the situation: Compile a separate program for each library.
3637 for i in $deplibs; do
3638 name=`expr $i : '-l\(.*\)'`
3639 # If $name is empty we are operating on a -L argument.
3640 if test "$name" != "" && test "$name" != "0"; then
3641 $rm conftest
3642 $LTCC $LTCFLAGS -o conftest conftest.c $i
3643 # Did it work?
3644 if test "$?" -eq 0 ; then
3645 ldd_output=`ldd conftest`
3646 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3647 case " $predeps $postdeps " in
3648 *" $i "*)
3649 newdeplibs="$newdeplibs $i"
3650 i=""
3652 esac
3654 if test -n "$i" ; then
3655 libname=`eval \\$echo \"$libname_spec\"`
3656 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3657 set dummy $deplib_matches
3658 deplib_match=$2
3659 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3660 newdeplibs="$newdeplibs $i"
3661 else
3662 droppeddeps=yes
3663 $echo
3664 $echo "*** Warning: dynamic linker does not accept needed library $i."
3665 $echo "*** I have the capability to make that library automatically link in when"
3666 $echo "*** you link to this library. But I can only do this if you have a"
3667 $echo "*** shared version of the library, which you do not appear to have"
3668 $echo "*** because a test_compile did reveal that the linker did not use this one"
3669 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3672 else
3673 droppeddeps=yes
3674 $echo
3675 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3676 $echo "*** make it link in! You will probably need to install it or some"
3677 $echo "*** library that it depends on before this library will be fully"
3678 $echo "*** functional. Installing it before continuing would be even better."
3680 else
3681 newdeplibs="$newdeplibs $i"
3683 done
3686 file_magic*)
3687 set dummy $deplibs_check_method
3688 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3689 for a_deplib in $deplibs; do
3690 name=`expr $a_deplib : '-l\(.*\)'`
3691 # If $name is empty we are operating on a -L argument.
3692 if test "$name" != "" && test "$name" != "0"; then
3693 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3694 case " $predeps $postdeps " in
3695 *" $a_deplib "*)
3696 newdeplibs="$newdeplibs $a_deplib"
3697 a_deplib=""
3699 esac
3701 if test -n "$a_deplib" ; then
3702 libname=`eval \\$echo \"$libname_spec\"`
3703 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3704 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3705 for potent_lib in $potential_libs; do
3706 # Follow soft links.
3707 if ls -lLd "$potent_lib" 2>/dev/null \
3708 | grep " -> " >/dev/null; then
3709 continue
3711 # The statement above tries to avoid entering an
3712 # endless loop below, in case of cyclic links.
3713 # We might still enter an endless loop, since a link
3714 # loop can be closed while we follow links,
3715 # but so what?
3716 potlib="$potent_lib"
3717 while test -h "$potlib" 2>/dev/null; do
3718 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3719 case $potliblink in
3720 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3721 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3722 esac
3723 done
3724 # It is ok to link against an archive when
3725 # building a shared library.
3726 if $AR -t $potlib > /dev/null 2>&1; then
3727 newdeplibs="$newdeplibs $a_deplib"
3728 a_deplib=""
3729 break 2
3731 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3732 | ${SED} 10q \
3733 | $EGREP "$file_magic_regex" > /dev/null; then
3734 newdeplibs="$newdeplibs $a_deplib"
3735 a_deplib=""
3736 break 2
3738 done
3739 done
3741 if test -n "$a_deplib" ; then
3742 droppeddeps=yes
3743 $echo
3744 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3745 $echo "*** I have the capability to make that library automatically link in when"
3746 $echo "*** you link to this library. But I can only do this if you have a"
3747 $echo "*** shared version of the library, which you do not appear to have"
3748 $echo "*** because I did check the linker path looking for a file starting"
3749 if test -z "$potlib" ; then
3750 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3751 else
3752 $echo "*** with $libname and none of the candidates passed a file format test"
3753 $echo "*** using a file magic. Last file checked: $potlib"
3756 else
3757 # Add a -L argument.
3758 newdeplibs="$newdeplibs $a_deplib"
3760 done # Gone through all deplibs.
3762 match_pattern*)
3763 set dummy $deplibs_check_method
3764 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3765 for a_deplib in $deplibs; do
3766 name=`expr $a_deplib : '-l\(.*\)'`
3767 # If $name is empty we are operating on a -L argument.
3768 if test -n "$name" && test "$name" != "0"; then
3769 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3770 case " $predeps $postdeps " in
3771 *" $a_deplib "*)
3772 newdeplibs="$newdeplibs $a_deplib"
3773 a_deplib=""
3775 esac
3777 if test -n "$a_deplib" ; then
3778 libname=`eval \\$echo \"$libname_spec\"`
3779 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3780 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3781 for potent_lib in $potential_libs; do
3782 potlib="$potent_lib" # see symlink-check above in file_magic test
3783 if eval $echo \"$potent_lib\" 2>/dev/null \
3784 | ${SED} 10q \
3785 | $EGREP "$match_pattern_regex" > /dev/null; then
3786 newdeplibs="$newdeplibs $a_deplib"
3787 a_deplib=""
3788 break 2
3790 done
3791 done
3793 if test -n "$a_deplib" ; then
3794 droppeddeps=yes
3795 $echo
3796 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3797 $echo "*** I have the capability to make that library automatically link in when"
3798 $echo "*** you link to this library. But I can only do this if you have a"
3799 $echo "*** shared version of the library, which you do not appear to have"
3800 $echo "*** because I did check the linker path looking for a file starting"
3801 if test -z "$potlib" ; then
3802 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3803 else
3804 $echo "*** with $libname and none of the candidates passed a file format test"
3805 $echo "*** using a regex pattern. Last file checked: $potlib"
3808 else
3809 # Add a -L argument.
3810 newdeplibs="$newdeplibs $a_deplib"
3812 done # Gone through all deplibs.
3814 none | unknown | *)
3815 newdeplibs=""
3816 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3817 -e 's/ -[LR][^ ]*//g'`
3818 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3819 for i in $predeps $postdeps ; do
3820 # can't use Xsed below, because $i might contain '/'
3821 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3822 done
3824 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3825 | grep . >/dev/null; then
3826 $echo
3827 if test "X$deplibs_check_method" = "Xnone"; then
3828 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3829 else
3830 $echo "*** Warning: inter-library dependencies are not known to be supported."
3832 $echo "*** All declared inter-library dependencies are being dropped."
3833 droppeddeps=yes
3836 esac
3837 versuffix=$versuffix_save
3838 major=$major_save
3839 release=$release_save
3840 libname=$libname_save
3841 name=$name_save
3843 case $host in
3844 *-*-rhapsody* | *-*-darwin1.[012])
3845 # On Rhapsody replace the C library is the System framework
3846 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3848 esac
3850 if test "$droppeddeps" = yes; then
3851 if test "$module" = yes; then
3852 $echo
3853 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3854 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3855 $echo "*** a static module, that should work as long as the dlopening"
3856 $echo "*** application is linked with the -dlopen flag."
3857 if test -z "$global_symbol_pipe"; then
3858 $echo
3859 $echo "*** However, this would only work if libtool was able to extract symbol"
3860 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3861 $echo "*** not find such a program. So, this module is probably useless."
3862 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3864 if test "$build_old_libs" = no; then
3865 oldlibs="$output_objdir/$libname.$libext"
3866 build_libtool_libs=module
3867 build_old_libs=yes
3868 else
3869 build_libtool_libs=no
3871 else
3872 $echo "*** The inter-library dependencies that have been dropped here will be"
3873 $echo "*** automatically added whenever a program is linked with this library"
3874 $echo "*** or is declared to -dlopen it."
3876 if test "$allow_undefined" = no; then
3877 $echo
3878 $echo "*** Since this library must not contain undefined symbols,"
3879 $echo "*** because either the platform does not support them or"
3880 $echo "*** it was explicitly requested with -no-undefined,"
3881 $echo "*** libtool will only create a static version of it."
3882 if test "$build_old_libs" = no; then
3883 oldlibs="$output_objdir/$libname.$libext"
3884 build_libtool_libs=module
3885 build_old_libs=yes
3886 else
3887 build_libtool_libs=no
3892 # Done checking deplibs!
3893 deplibs=$newdeplibs
3897 # move library search paths that coincide with paths to not yet
3898 # installed libraries to the beginning of the library search list
3899 new_libs=
3900 for path in $notinst_path; do
3901 case " $new_libs " in
3902 *" -L$path/$objdir "*) ;;
3904 case " $deplibs " in
3905 *" -L$path/$objdir "*)
3906 new_libs="$new_libs -L$path/$objdir" ;;
3907 esac
3909 esac
3910 done
3911 for deplib in $deplibs; do
3912 case $deplib in
3913 -L*)
3914 case " $new_libs " in
3915 *" $deplib "*) ;;
3916 *) new_libs="$new_libs $deplib" ;;
3917 esac
3919 *) new_libs="$new_libs $deplib" ;;
3920 esac
3921 done
3922 deplibs="$new_libs"
3925 # All the library-specific variables (install_libdir is set above).
3926 library_names=
3927 old_library=
3928 dlname=
3930 # Test again, we may have decided not to build it any more
3931 if test "$build_libtool_libs" = yes; then
3932 if test "$hardcode_into_libs" = yes; then
3933 # Hardcode the library paths
3934 hardcode_libdirs=
3935 dep_rpath=
3936 rpath="$finalize_rpath"
3937 test "$mode" != relink && rpath="$compile_rpath$rpath"
3938 for libdir in $rpath; do
3939 if test -n "$hardcode_libdir_flag_spec"; then
3940 if test -n "$hardcode_libdir_separator"; then
3941 if test -z "$hardcode_libdirs"; then
3942 hardcode_libdirs="$libdir"
3943 else
3944 # Just accumulate the unique libdirs.
3945 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3946 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3949 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3951 esac
3953 else
3954 eval flag=\"$hardcode_libdir_flag_spec\"
3955 dep_rpath="$dep_rpath $flag"
3957 elif test -n "$runpath_var"; then
3958 case "$perm_rpath " in
3959 *" $libdir "*) ;;
3960 *) perm_rpath="$perm_rpath $libdir" ;;
3961 esac
3963 done
3964 # Substitute the hardcoded libdirs into the rpath.
3965 if test -n "$hardcode_libdir_separator" &&
3966 test -n "$hardcode_libdirs"; then
3967 libdir="$hardcode_libdirs"
3968 if test -n "$hardcode_libdir_flag_spec_ld"; then
3969 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3970 else
3971 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3974 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3975 # We should set the runpath_var.
3976 rpath=
3977 for dir in $perm_rpath; do
3978 rpath="$rpath$dir:"
3979 done
3980 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3982 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3985 shlibpath="$finalize_shlibpath"
3986 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3987 if test -n "$shlibpath"; then
3988 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3991 # Get the real and link names of the library.
3992 eval shared_ext=\"$shrext_cmds\"
3993 eval library_names=\"$library_names_spec\"
3994 set dummy $library_names
3995 realname="$2"
3996 shift; shift
3998 if test -n "$soname_spec"; then
3999 eval soname=\"$soname_spec\"
4000 else
4001 soname="$realname"
4003 if test -z "$dlname"; then
4004 dlname=$soname
4007 lib="$output_objdir/$realname"
4008 linknames=
4009 for link
4011 linknames="$linknames $link"
4012 done
4014 # Use standard objects if they are pic
4015 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4017 # Prepare the list of exported symbols
4018 if test -z "$export_symbols"; then
4019 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4020 $show "generating symbol list for \`$libname.la'"
4021 export_symbols="$output_objdir/$libname.exp"
4022 $run $rm $export_symbols
4023 cmds=$export_symbols_cmds
4024 save_ifs="$IFS"; IFS='~'
4025 for cmd in $cmds; do
4026 IFS="$save_ifs"
4027 eval cmd=\"$cmd\"
4028 if len=`expr "X$cmd" : ".*"` &&
4029 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4030 $show "$cmd"
4031 $run eval "$cmd" || exit $?
4032 skipped_export=false
4033 else
4034 # The command line is too long to execute in one step.
4035 $show "using reloadable object file for export list..."
4036 skipped_export=:
4037 # Break out early, otherwise skipped_export may be
4038 # set to false by a later but shorter cmd.
4039 break
4041 done
4042 IFS="$save_ifs"
4043 if test -n "$export_symbols_regex"; then
4044 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4045 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4046 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4047 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4052 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4053 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4056 tmp_deplibs=
4057 for test_deplib in $deplibs; do
4058 case " $convenience " in
4059 *" $test_deplib "*) ;;
4061 tmp_deplibs="$tmp_deplibs $test_deplib"
4063 esac
4064 done
4065 deplibs="$tmp_deplibs"
4067 if test -n "$convenience"; then
4068 if test -n "$whole_archive_flag_spec"; then
4069 save_libobjs=$libobjs
4070 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4071 else
4072 gentop="$output_objdir/${outputname}x"
4073 generated="$generated $gentop"
4075 func_extract_archives $gentop $convenience
4076 libobjs="$libobjs $func_extract_archives_result"
4080 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4081 eval flag=\"$thread_safe_flag_spec\"
4082 linker_flags="$linker_flags $flag"
4085 # Make a backup of the uninstalled library when relinking
4086 if test "$mode" = relink; then
4087 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4090 # Do each of the archive commands.
4091 if test "$module" = yes && test -n "$module_cmds" ; then
4092 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4093 eval test_cmds=\"$module_expsym_cmds\"
4094 cmds=$module_expsym_cmds
4095 else
4096 eval test_cmds=\"$module_cmds\"
4097 cmds=$module_cmds
4099 else
4100 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4101 eval test_cmds=\"$archive_expsym_cmds\"
4102 cmds=$archive_expsym_cmds
4103 else
4104 eval test_cmds=\"$archive_cmds\"
4105 cmds=$archive_cmds
4109 if test "X$skipped_export" != "X:" &&
4110 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4111 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4113 else
4114 # The command line is too long to link in one step, link piecewise.
4115 $echo "creating reloadable object files..."
4117 # Save the value of $output and $libobjs because we want to
4118 # use them later. If we have whole_archive_flag_spec, we
4119 # want to use save_libobjs as it was before
4120 # whole_archive_flag_spec was expanded, because we can't
4121 # assume the linker understands whole_archive_flag_spec.
4122 # This may have to be revisited, in case too many
4123 # convenience libraries get linked in and end up exceeding
4124 # the spec.
4125 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4126 save_libobjs=$libobjs
4128 save_output=$output
4129 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4131 # Clear the reloadable object creation command queue and
4132 # initialize k to one.
4133 test_cmds=
4134 concat_cmds=
4135 objlist=
4136 delfiles=
4137 last_robj=
4139 output=$output_objdir/$output_la-${k}.$objext
4140 # Loop over the list of objects to be linked.
4141 for obj in $save_libobjs
4143 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4144 if test "X$objlist" = X ||
4145 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4146 test "$len" -le "$max_cmd_len"; }; then
4147 objlist="$objlist $obj"
4148 else
4149 # The command $test_cmds is almost too long, add a
4150 # command to the queue.
4151 if test "$k" -eq 1 ; then
4152 # The first file doesn't have a previous command to add.
4153 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4154 else
4155 # All subsequent reloadable object files will link in
4156 # the last one created.
4157 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4159 last_robj=$output_objdir/$output_la-${k}.$objext
4160 k=`expr $k + 1`
4161 output=$output_objdir/$output_la-${k}.$objext
4162 objlist=$obj
4163 len=1
4165 done
4166 # Handle the remaining objects by creating one last
4167 # reloadable object file. All subsequent reloadable object
4168 # files will link in the last one created.
4169 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4170 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4172 if ${skipped_export-false}; then
4173 $show "generating symbol list for \`$libname.la'"
4174 export_symbols="$output_objdir/$libname.exp"
4175 $run $rm $export_symbols
4176 libobjs=$output
4177 # Append the command to create the export file.
4178 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4181 # Set up a command to remove the reloadable object files
4182 # after they are used.
4184 while test "$i" -lt "$k"
4186 i=`expr $i + 1`
4187 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4188 done
4190 $echo "creating a temporary reloadable object file: $output"
4192 # Loop through the commands generated above and execute them.
4193 save_ifs="$IFS"; IFS='~'
4194 for cmd in $concat_cmds; do
4195 IFS="$save_ifs"
4196 $show "$cmd"
4197 $run eval "$cmd" || exit $?
4198 done
4199 IFS="$save_ifs"
4201 libobjs=$output
4202 # Restore the value of output.
4203 output=$save_output
4205 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4206 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4208 # Expand the library linking commands again to reset the
4209 # value of $libobjs for piecewise linking.
4211 # Do each of the archive commands.
4212 if test "$module" = yes && test -n "$module_cmds" ; then
4213 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4214 cmds=$module_expsym_cmds
4215 else
4216 cmds=$module_cmds
4218 else
4219 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4220 cmds=$archive_expsym_cmds
4221 else
4222 cmds=$archive_cmds
4226 # Append the command to remove the reloadable object files
4227 # to the just-reset $cmds.
4228 eval cmds=\"\$cmds~\$rm $delfiles\"
4230 save_ifs="$IFS"; IFS='~'
4231 for cmd in $cmds; do
4232 IFS="$save_ifs"
4233 eval cmd=\"$cmd\"
4234 $show "$cmd"
4235 $run eval "$cmd" || {
4236 lt_exit=$?
4238 # Restore the uninstalled library and exit
4239 if test "$mode" = relink; then
4240 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4243 exit $lt_exit
4245 done
4246 IFS="$save_ifs"
4248 # Restore the uninstalled library and exit
4249 if test "$mode" = relink; then
4250 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4252 if test -n "$convenience"; then
4253 if test -z "$whole_archive_flag_spec"; then
4254 $show "${rm}r $gentop"
4255 $run ${rm}r "$gentop"
4259 exit $EXIT_SUCCESS
4262 # Create links to the real library.
4263 for linkname in $linknames; do
4264 if test "$realname" != "$linkname"; then
4265 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4266 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4268 done
4270 # If -module or -export-dynamic was specified, set the dlname.
4271 if test "$module" = yes || test "$export_dynamic" = yes; then
4272 # On all known operating systems, these are identical.
4273 dlname="$soname"
4278 obj)
4279 if test -n "$deplibs"; then
4280 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4283 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4284 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4287 if test -n "$rpath"; then
4288 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4291 if test -n "$xrpath"; then
4292 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4295 if test -n "$vinfo"; then
4296 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4299 if test -n "$release"; then
4300 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4303 case $output in
4304 *.lo)
4305 if test -n "$objs$old_deplibs"; then
4306 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4307 exit $EXIT_FAILURE
4309 libobj="$output"
4310 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4313 libobj=
4314 obj="$output"
4316 esac
4318 # Delete the old objects.
4319 $run $rm $obj $libobj
4321 # Objects from convenience libraries. This assumes
4322 # single-version convenience libraries. Whenever we create
4323 # different ones for PIC/non-PIC, this we'll have to duplicate
4324 # the extraction.
4325 reload_conv_objs=
4326 gentop=
4327 # reload_cmds runs $LD directly, so let us get rid of
4328 # -Wl from whole_archive_flag_spec
4331 if test -n "$convenience"; then
4332 if test -n "$whole_archive_flag_spec"; then
4333 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4334 else
4335 gentop="$output_objdir/${obj}x"
4336 generated="$generated $gentop"
4338 func_extract_archives $gentop $convenience
4339 reload_conv_objs="$reload_objs $func_extract_archives_result"
4343 # Create the old-style object.
4344 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
4346 output="$obj"
4347 cmds=$reload_cmds
4348 save_ifs="$IFS"; IFS='~'
4349 for cmd in $cmds; do
4350 IFS="$save_ifs"
4351 eval cmd=\"$cmd\"
4352 $show "$cmd"
4353 $run eval "$cmd" || exit $?
4354 done
4355 IFS="$save_ifs"
4357 # Exit if we aren't doing a library object file.
4358 if test -z "$libobj"; then
4359 if test -n "$gentop"; then
4360 $show "${rm}r $gentop"
4361 $run ${rm}r $gentop
4364 exit $EXIT_SUCCESS
4367 if test "$build_libtool_libs" != yes; then
4368 if test -n "$gentop"; then
4369 $show "${rm}r $gentop"
4370 $run ${rm}r $gentop
4373 # Create an invalid libtool object if no PIC, so that we don't
4374 # accidentally link it into a program.
4375 # $show "echo timestamp > $libobj"
4376 # $run eval "echo timestamp > $libobj" || exit $?
4377 exit $EXIT_SUCCESS
4380 if test -n "$pic_flag" || test "$pic_mode" != default; then
4381 # Only do commands if we really have different PIC objects.
4382 reload_objs="$libobjs $reload_conv_objs"
4383 output="$libobj"
4384 cmds=$reload_cmds
4385 save_ifs="$IFS"; IFS='~'
4386 for cmd in $cmds; do
4387 IFS="$save_ifs"
4388 eval cmd=\"$cmd\"
4389 $show "$cmd"
4390 $run eval "$cmd" || exit $?
4391 done
4392 IFS="$save_ifs"
4395 if test -n "$gentop"; then
4396 $show "${rm}r $gentop"
4397 $run ${rm}r $gentop
4400 exit $EXIT_SUCCESS
4403 prog)
4404 case $host in
4405 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4406 esac
4407 if test -n "$vinfo"; then
4408 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4411 if test -n "$release"; then
4412 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4415 if test "$preload" = yes; then
4416 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4417 test "$dlopen_self_static" = unknown; then
4418 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4422 case $host in
4423 *-*-rhapsody* | *-*-darwin1.[012])
4424 # On Rhapsody replace the C library is the System framework
4425 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4426 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4428 esac
4430 case $host in
4431 *darwin*)
4432 # Don't allow lazy linking, it breaks C++ global constructors
4433 if test "$tagname" = CXX ; then
4434 compile_command="$compile_command ${wl}-bind_at_load"
4435 finalize_command="$finalize_command ${wl}-bind_at_load"
4438 esac
4441 # move library search paths that coincide with paths to not yet
4442 # installed libraries to the beginning of the library search list
4443 new_libs=
4444 for path in $notinst_path; do
4445 case " $new_libs " in
4446 *" -L$path/$objdir "*) ;;
4448 case " $compile_deplibs " in
4449 *" -L$path/$objdir "*)
4450 new_libs="$new_libs -L$path/$objdir" ;;
4451 esac
4453 esac
4454 done
4455 for deplib in $compile_deplibs; do
4456 case $deplib in
4457 -L*)
4458 case " $new_libs " in
4459 *" $deplib "*) ;;
4460 *) new_libs="$new_libs $deplib" ;;
4461 esac
4463 *) new_libs="$new_libs $deplib" ;;
4464 esac
4465 done
4466 compile_deplibs="$new_libs"
4469 compile_command="$compile_command $compile_deplibs"
4470 finalize_command="$finalize_command $finalize_deplibs"
4472 if test -n "$rpath$xrpath"; then
4473 # If the user specified any rpath flags, then add them.
4474 for libdir in $rpath $xrpath; do
4475 # This is the magic to use -rpath.
4476 case "$finalize_rpath " in
4477 *" $libdir "*) ;;
4478 *) finalize_rpath="$finalize_rpath $libdir" ;;
4479 esac
4480 done
4483 # Now hardcode the library paths
4484 rpath=
4485 hardcode_libdirs=
4486 for libdir in $compile_rpath $finalize_rpath; do
4487 if test -n "$hardcode_libdir_flag_spec"; then
4488 if test -n "$hardcode_libdir_separator"; then
4489 if test -z "$hardcode_libdirs"; then
4490 hardcode_libdirs="$libdir"
4491 else
4492 # Just accumulate the unique libdirs.
4493 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4494 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4497 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4499 esac
4501 else
4502 eval flag=\"$hardcode_libdir_flag_spec\"
4503 rpath="$rpath $flag"
4505 elif test -n "$runpath_var"; then
4506 case "$perm_rpath " in
4507 *" $libdir "*) ;;
4508 *) perm_rpath="$perm_rpath $libdir" ;;
4509 esac
4511 case $host in
4512 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4513 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4514 case :$dllsearchpath: in
4515 *":$libdir:"*) ;;
4516 *) dllsearchpath="$dllsearchpath:$libdir";;
4517 esac
4518 case :$dllsearchpath: in
4519 *":$testbindir:"*) ;;
4520 *) dllsearchpath="$dllsearchpath:$testbindir";;
4521 esac
4523 esac
4524 done
4525 # Substitute the hardcoded libdirs into the rpath.
4526 if test -n "$hardcode_libdir_separator" &&
4527 test -n "$hardcode_libdirs"; then
4528 libdir="$hardcode_libdirs"
4529 eval rpath=\" $hardcode_libdir_flag_spec\"
4531 compile_rpath="$rpath"
4533 rpath=
4534 hardcode_libdirs=
4535 for libdir in $finalize_rpath; do
4536 if test -n "$hardcode_libdir_flag_spec"; then
4537 if test -n "$hardcode_libdir_separator"; then
4538 if test -z "$hardcode_libdirs"; then
4539 hardcode_libdirs="$libdir"
4540 else
4541 # Just accumulate the unique libdirs.
4542 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4543 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4546 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4548 esac
4550 else
4551 eval flag=\"$hardcode_libdir_flag_spec\"
4552 rpath="$rpath $flag"
4554 elif test -n "$runpath_var"; then
4555 case "$finalize_perm_rpath " in
4556 *" $libdir "*) ;;
4557 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4558 esac
4560 done
4561 # Substitute the hardcoded libdirs into the rpath.
4562 if test -n "$hardcode_libdir_separator" &&
4563 test -n "$hardcode_libdirs"; then
4564 libdir="$hardcode_libdirs"
4565 eval rpath=\" $hardcode_libdir_flag_spec\"
4567 finalize_rpath="$rpath"
4569 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4570 # Transform all the library objects into standard objects.
4571 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4572 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4575 dlsyms=
4576 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4577 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4578 dlsyms="${outputname}S.c"
4579 else
4580 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4584 if test -n "$dlsyms"; then
4585 case $dlsyms in
4586 "") ;;
4587 *.c)
4588 # Discover the nlist of each of the dlfiles.
4589 nlist="$output_objdir/${outputname}.nm"
4591 $show "$rm $nlist ${nlist}S ${nlist}T"
4592 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4594 # Parse the name list into a source file.
4595 $show "creating $output_objdir/$dlsyms"
4597 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4598 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4599 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4601 #ifdef __cplusplus
4602 extern \"C\" {
4603 #endif
4605 /* Prevent the only kind of declaration conflicts we can make. */
4606 #define lt_preloaded_symbols some_other_symbol
4608 /* External symbol declarations for the compiler. */\
4611 if test "$dlself" = yes; then
4612 $show "generating symbol list for \`$output'"
4614 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4616 # Add our own program objects to the symbol list.
4617 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4618 for arg in $progfiles; do
4619 $show "extracting global C symbols from \`$arg'"
4620 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4621 done
4623 if test -n "$exclude_expsyms"; then
4624 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4625 $run eval '$mv "$nlist"T "$nlist"'
4628 if test -n "$export_symbols_regex"; then
4629 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4630 $run eval '$mv "$nlist"T "$nlist"'
4633 # Prepare the list of exported symbols
4634 if test -z "$export_symbols"; then
4635 export_symbols="$output_objdir/$outputname.exp"
4636 $run $rm $export_symbols
4637 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4638 case $host in
4639 *cygwin* | *mingw* )
4640 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4641 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4643 esac
4644 else
4645 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4646 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4647 $run eval 'mv "$nlist"T "$nlist"'
4648 case $host in
4649 *cygwin* | *mingw* )
4650 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4651 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4653 esac
4657 for arg in $dlprefiles; do
4658 $show "extracting global C symbols from \`$arg'"
4659 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4660 $run eval '$echo ": $name " >> "$nlist"'
4661 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4662 done
4664 if test -z "$run"; then
4665 # Make sure we have at least an empty file.
4666 test -f "$nlist" || : > "$nlist"
4668 if test -n "$exclude_expsyms"; then
4669 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4670 $mv "$nlist"T "$nlist"
4673 # Try sorting and uniquifying the output.
4674 if grep -v "^: " < "$nlist" |
4675 if sort -k 3 </dev/null >/dev/null 2>&1; then
4676 sort -k 3
4677 else
4678 sort +2
4679 fi |
4680 uniq > "$nlist"S; then
4682 else
4683 grep -v "^: " < "$nlist" > "$nlist"S
4686 if test -f "$nlist"S; then
4687 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4688 else
4689 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4692 $echo >> "$output_objdir/$dlsyms" "\
4694 #undef lt_preloaded_symbols
4696 #if defined (__STDC__) && __STDC__
4697 # define lt_ptr void *
4698 #else
4699 # define lt_ptr char *
4700 # define const
4701 #endif
4703 /* The mapping between symbol names and symbols. */
4706 case $host in
4707 *cygwin* | *mingw* )
4708 $echo >> "$output_objdir/$dlsyms" "\
4709 /* DATA imports from DLLs on WIN32 can't be const, because
4710 runtime relocations are performed -- see ld's documentation
4711 on pseudo-relocs */
4712 struct {
4716 $echo >> "$output_objdir/$dlsyms" "\
4717 const struct {
4720 esac
4723 $echo >> "$output_objdir/$dlsyms" "\
4724 const char *name;
4725 lt_ptr address;
4727 lt_preloaded_symbols[] =
4731 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4733 $echo >> "$output_objdir/$dlsyms" "\
4734 {0, (lt_ptr) 0}
4737 /* This works around a problem in FreeBSD linker */
4738 #ifdef FREEBSD_WORKAROUND
4739 static const void *lt_preloaded_setup() {
4740 return lt_preloaded_symbols;
4742 #endif
4744 #ifdef __cplusplus
4746 #endif\
4750 pic_flag_for_symtable=
4751 case $host in
4752 # compiling the symbol table file with pic_flag works around
4753 # a FreeBSD bug that causes programs to crash when -lm is
4754 # linked before any other PIC object. But we must not use
4755 # pic_flag when linking with -static. The problem exists in
4756 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4757 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4758 case "$compile_command " in
4759 *" -static "*) ;;
4760 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4761 esac;;
4762 *-*-hpux*)
4763 case "$compile_command " in
4764 *" -static "*) ;;
4765 *) pic_flag_for_symtable=" $pic_flag";;
4766 esac
4767 esac
4769 # Now compile the dynamic symbol file.
4770 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4771 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4773 # Clean up the generated files.
4774 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4775 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4777 # Transform the symbol file into the correct name.
4778 case $host in
4779 *cygwin* | *mingw* )
4780 if test -f "$output_objdir/${outputname}.def" ; then
4781 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4782 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4783 else
4784 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4785 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4789 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4790 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4792 esac
4795 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4796 exit $EXIT_FAILURE
4798 esac
4799 else
4800 # We keep going just in case the user didn't refer to
4801 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4802 # really was required.
4804 # Nullify the symbol file.
4805 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4806 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4809 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4810 # Replace the output file specification.
4811 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4812 link_command="$compile_command$compile_rpath"
4814 # We have no uninstalled library dependencies, so finalize right now.
4815 $show "$link_command"
4816 $run eval "$link_command"
4817 exit_status=$?
4819 # Delete the generated files.
4820 if test -n "$dlsyms"; then
4821 $show "$rm $output_objdir/${outputname}S.${objext}"
4822 $run $rm "$output_objdir/${outputname}S.${objext}"
4825 exit $exit_status
4828 if test -n "$shlibpath_var"; then
4829 # We should set the shlibpath_var
4830 rpath=
4831 for dir in $temp_rpath; do
4832 case $dir in
4833 [\\/]* | [A-Za-z]:[\\/]*)
4834 # Absolute path.
4835 rpath="$rpath$dir:"
4838 # Relative path: add a thisdir entry.
4839 rpath="$rpath\$thisdir/$dir:"
4841 esac
4842 done
4843 temp_rpath="$rpath"
4846 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4847 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4849 if test -n "$finalize_shlibpath"; then
4850 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4853 compile_var=
4854 finalize_var=
4855 if test -n "$runpath_var"; then
4856 if test -n "$perm_rpath"; then
4857 # We should set the runpath_var.
4858 rpath=
4859 for dir in $perm_rpath; do
4860 rpath="$rpath$dir:"
4861 done
4862 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4864 if test -n "$finalize_perm_rpath"; then
4865 # We should set the runpath_var.
4866 rpath=
4867 for dir in $finalize_perm_rpath; do
4868 rpath="$rpath$dir:"
4869 done
4870 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4874 if test "$no_install" = yes; then
4875 # We don't need to create a wrapper script.
4876 link_command="$compile_var$compile_command$compile_rpath"
4877 # Replace the output file specification.
4878 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4879 # Delete the old output file.
4880 $run $rm $output
4881 # Link the executable and exit
4882 $show "$link_command"
4883 $run eval "$link_command" || exit $?
4884 exit $EXIT_SUCCESS
4887 if test "$hardcode_action" = relink; then
4888 # Fast installation is not supported
4889 link_command="$compile_var$compile_command$compile_rpath"
4890 relink_command="$finalize_var$finalize_command$finalize_rpath"
4892 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4893 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4894 else
4895 if test "$fast_install" != no; then
4896 link_command="$finalize_var$compile_command$finalize_rpath"
4897 if test "$fast_install" = yes; then
4898 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4899 else
4900 # fast_install is set to needless
4901 relink_command=
4903 else
4904 link_command="$compile_var$compile_command$compile_rpath"
4905 relink_command="$finalize_var$finalize_command$finalize_rpath"
4909 # Replace the output file specification.
4910 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4912 # Delete the old output files.
4913 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4915 $show "$link_command"
4916 $run eval "$link_command" || exit $?
4918 # Now create the wrapper script.
4919 $show "creating $output"
4921 # Quote the relink command for shipping.
4922 if test -n "$relink_command"; then
4923 # Preserve any variables that may affect compiler behavior
4924 for var in $variables_saved_for_relink; do
4925 if eval test -z \"\${$var+set}\"; then
4926 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4927 elif eval var_value=\$$var; test -z "$var_value"; then
4928 relink_command="$var=; export $var; $relink_command"
4929 else
4930 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4931 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4933 done
4934 relink_command="(cd `pwd`; $relink_command)"
4935 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4938 # Quote $echo for shipping.
4939 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4940 case $progpath in
4941 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4942 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4943 esac
4944 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4945 else
4946 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4949 # Only actually do things if our run command is non-null.
4950 if test -z "$run"; then
4951 # win32 will think the script is a binary if it has
4952 # a .exe suffix, so we strip it off here.
4953 case $output in
4954 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4955 esac
4956 # test for cygwin because mv fails w/o .exe extensions
4957 case $host in
4958 *cygwin*)
4959 exeext=.exe
4960 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4961 *) exeext= ;;
4962 esac
4963 case $host in
4964 *cygwin* | *mingw* )
4965 output_name=`basename $output`
4966 output_path=`dirname $output`
4967 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4968 cwrapper="$output_path/$output_name.exe"
4969 $rm $cwrappersource $cwrapper
4970 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4972 cat > $cwrappersource <<EOF
4974 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4975 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4977 The $output program cannot be directly executed until all the libtool
4978 libraries that it depends on are installed.
4980 This wrapper executable should never be moved out of the build directory.
4981 If it is, it will not operate correctly.
4983 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4984 but could eventually absorb all of the scripts functionality and
4985 exec $objdir/$outputname directly.
4988 cat >> $cwrappersource<<"EOF"
4989 #include <stdio.h>
4990 #include <stdlib.h>
4991 #include <unistd.h>
4992 #include <malloc.h>
4993 #include <stdarg.h>
4994 #include <assert.h>
4995 #include <string.h>
4996 #include <ctype.h>
4997 #include <sys/stat.h>
4999 #if defined(PATH_MAX)
5000 # define LT_PATHMAX PATH_MAX
5001 #elif defined(MAXPATHLEN)
5002 # define LT_PATHMAX MAXPATHLEN
5003 #else
5004 # define LT_PATHMAX 1024
5005 #endif
5007 #ifndef DIR_SEPARATOR
5008 # define DIR_SEPARATOR '/'
5009 # define PATH_SEPARATOR ':'
5010 #endif
5012 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5013 defined (__OS2__)
5014 # define HAVE_DOS_BASED_FILE_SYSTEM
5015 # ifndef DIR_SEPARATOR_2
5016 # define DIR_SEPARATOR_2 '\\'
5017 # endif
5018 # ifndef PATH_SEPARATOR_2
5019 # define PATH_SEPARATOR_2 ';'
5020 # endif
5021 #endif
5023 #ifndef DIR_SEPARATOR_2
5024 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5025 #else /* DIR_SEPARATOR_2 */
5026 # define IS_DIR_SEPARATOR(ch) \
5027 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5028 #endif /* DIR_SEPARATOR_2 */
5030 #ifndef PATH_SEPARATOR_2
5031 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5032 #else /* PATH_SEPARATOR_2 */
5033 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5034 #endif /* PATH_SEPARATOR_2 */
5036 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5037 #define XFREE(stale) do { \
5038 if (stale) { free ((void *) stale); stale = 0; } \
5039 } while (0)
5041 /* -DDEBUG is fairly common in CFLAGS. */
5042 #undef DEBUG
5043 #if defined DEBUGWRAPPER
5044 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5045 #else
5046 # define DEBUG(format, ...)
5047 #endif
5049 const char *program_name = NULL;
5051 void * xmalloc (size_t num);
5052 char * xstrdup (const char *string);
5053 const char * base_name (const char *name);
5054 char * find_executable(const char *wrapper);
5055 int check_executable(const char *path);
5056 char * strendzap(char *str, const char *pat);
5057 void lt_fatal (const char *message, ...);
5060 main (int argc, char *argv[])
5062 char **newargz;
5063 int i;
5065 program_name = (char *) xstrdup (base_name (argv[0]));
5066 DEBUG("(main) argv[0] : %s\n",argv[0]);
5067 DEBUG("(main) program_name : %s\n",program_name);
5068 newargz = XMALLOC(char *, argc+2);
5071 cat >> $cwrappersource <<EOF
5072 newargz[0] = (char *) xstrdup("$SHELL");
5075 cat >> $cwrappersource <<"EOF"
5076 newargz[1] = find_executable(argv[0]);
5077 if (newargz[1] == NULL)
5078 lt_fatal("Couldn't find %s", argv[0]);
5079 DEBUG("(main) found exe at : %s\n",newargz[1]);
5080 /* we know the script has the same name, without the .exe */
5081 /* so make sure newargz[1] doesn't end in .exe */
5082 strendzap(newargz[1],".exe");
5083 for (i = 1; i < argc; i++)
5084 newargz[i+1] = xstrdup(argv[i]);
5085 newargz[argc+1] = NULL;
5087 for (i=0; i<argc+1; i++)
5089 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5095 case $host_os in
5096 mingw*)
5097 cat >> $cwrappersource <<EOF
5098 execv("$SHELL",(char const **)newargz);
5102 cat >> $cwrappersource <<EOF
5103 execv("$SHELL",newargz);
5106 esac
5108 cat >> $cwrappersource <<"EOF"
5109 return 127;
5112 void *
5113 xmalloc (size_t num)
5115 void * p = (void *) malloc (num);
5116 if (!p)
5117 lt_fatal ("Memory exhausted");
5119 return p;
5122 char *
5123 xstrdup (const char *string)
5125 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5129 const char *
5130 base_name (const char *name)
5132 const char *base;
5134 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5135 /* Skip over the disk name in MSDOS pathnames. */
5136 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5137 name += 2;
5138 #endif
5140 for (base = name; *name; name++)
5141 if (IS_DIR_SEPARATOR (*name))
5142 base = name + 1;
5143 return base;
5147 check_executable(const char * path)
5149 struct stat st;
5151 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5152 if ((!path) || (!*path))
5153 return 0;
5155 if ((stat (path, &st) >= 0) &&
5157 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5158 #if defined (S_IXOTH)
5159 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5160 #endif
5161 #if defined (S_IXGRP)
5162 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5163 #endif
5164 ((st.st_mode & S_IXUSR) == S_IXUSR))
5166 return 1;
5167 else
5168 return 0;
5171 /* Searches for the full path of the wrapper. Returns
5172 newly allocated full path name if found, NULL otherwise */
5173 char *
5174 find_executable (const char* wrapper)
5176 int has_slash = 0;
5177 const char* p;
5178 const char* p_next;
5179 /* static buffer for getcwd */
5180 char tmp[LT_PATHMAX + 1];
5181 int tmp_len;
5182 char* concat_name;
5184 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5186 if ((wrapper == NULL) || (*wrapper == '\0'))
5187 return NULL;
5189 /* Absolute path? */
5190 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5191 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5193 concat_name = xstrdup (wrapper);
5194 if (check_executable(concat_name))
5195 return concat_name;
5196 XFREE(concat_name);
5198 else
5200 #endif
5201 if (IS_DIR_SEPARATOR (wrapper[0]))
5203 concat_name = xstrdup (wrapper);
5204 if (check_executable(concat_name))
5205 return concat_name;
5206 XFREE(concat_name);
5208 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5210 #endif
5212 for (p = wrapper; *p; p++)
5213 if (*p == '/')
5215 has_slash = 1;
5216 break;
5218 if (!has_slash)
5220 /* no slashes; search PATH */
5221 const char* path = getenv ("PATH");
5222 if (path != NULL)
5224 for (p = path; *p; p = p_next)
5226 const char* q;
5227 size_t p_len;
5228 for (q = p; *q; q++)
5229 if (IS_PATH_SEPARATOR(*q))
5230 break;
5231 p_len = q - p;
5232 p_next = (*q == '\0' ? q : q + 1);
5233 if (p_len == 0)
5235 /* empty path: current directory */
5236 if (getcwd (tmp, LT_PATHMAX) == NULL)
5237 lt_fatal ("getcwd failed");
5238 tmp_len = strlen(tmp);
5239 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5240 memcpy (concat_name, tmp, tmp_len);
5241 concat_name[tmp_len] = '/';
5242 strcpy (concat_name + tmp_len + 1, wrapper);
5244 else
5246 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5247 memcpy (concat_name, p, p_len);
5248 concat_name[p_len] = '/';
5249 strcpy (concat_name + p_len + 1, wrapper);
5251 if (check_executable(concat_name))
5252 return concat_name;
5253 XFREE(concat_name);
5256 /* not found in PATH; assume curdir */
5258 /* Relative path | not found in path: prepend cwd */
5259 if (getcwd (tmp, LT_PATHMAX) == NULL)
5260 lt_fatal ("getcwd failed");
5261 tmp_len = strlen(tmp);
5262 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5263 memcpy (concat_name, tmp, tmp_len);
5264 concat_name[tmp_len] = '/';
5265 strcpy (concat_name + tmp_len + 1, wrapper);
5267 if (check_executable(concat_name))
5268 return concat_name;
5269 XFREE(concat_name);
5270 return NULL;
5273 char *
5274 strendzap(char *str, const char *pat)
5276 size_t len, patlen;
5278 assert(str != NULL);
5279 assert(pat != NULL);
5281 len = strlen(str);
5282 patlen = strlen(pat);
5284 if (patlen <= len)
5286 str += len - patlen;
5287 if (strcmp(str, pat) == 0)
5288 *str = '\0';
5290 return str;
5293 static void
5294 lt_error_core (int exit_status, const char * mode,
5295 const char * message, va_list ap)
5297 fprintf (stderr, "%s: %s: ", program_name, mode);
5298 vfprintf (stderr, message, ap);
5299 fprintf (stderr, ".\n");
5301 if (exit_status >= 0)
5302 exit (exit_status);
5305 void
5306 lt_fatal (const char *message, ...)
5308 va_list ap;
5309 va_start (ap, message);
5310 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5311 va_end (ap);
5314 # we should really use a build-platform specific compiler
5315 # here, but OTOH, the wrappers (shell script and this C one)
5316 # are only useful if you want to execute the "real" binary.
5317 # Since the "real" binary is built for $host, then this
5318 # wrapper might as well be built for $host, too.
5319 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5321 esac
5322 $rm $output
5323 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5325 $echo > $output "\
5326 #! $SHELL
5328 # $output - temporary wrapper script for $objdir/$outputname
5329 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5331 # The $output program cannot be directly executed until all the libtool
5332 # libraries that it depends on are installed.
5334 # This wrapper script should never be moved out of the build directory.
5335 # If it is, it will not operate correctly.
5337 # Sed substitution that helps us do robust quoting. It backslashifies
5338 # metacharacters that are still active within double-quoted strings.
5339 Xsed='${SED} -e 1s/^X//'
5340 sed_quote_subst='$sed_quote_subst'
5342 # The HP-UX ksh and POSIX shell print the target directory to stdout
5343 # if CDPATH is set.
5344 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5346 relink_command=\"$relink_command\"
5348 # This environment variable determines our operation mode.
5349 if test \"\$libtool_install_magic\" = \"$magic\"; then
5350 # install mode needs the following variable:
5351 notinst_deplibs='$notinst_deplibs'
5352 else
5353 # When we are sourced in execute mode, \$file and \$echo are already set.
5354 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5355 echo=\"$qecho\"
5356 file=\"\$0\"
5357 # Make sure echo works.
5358 if test \"X\$1\" = X--no-reexec; then
5359 # Discard the --no-reexec flag, and continue.
5360 shift
5361 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5362 # Yippee, \$echo works!
5364 else
5365 # Restart under the correct shell, and then maybe \$echo will work.
5366 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5370 $echo >> $output "\
5372 # Find the directory that this script lives in.
5373 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5374 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5376 # Follow symbolic links until we get to the real thisdir.
5377 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5378 while test -n \"\$file\"; do
5379 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5381 # If there was a directory component, then change thisdir.
5382 if test \"x\$destdir\" != \"x\$file\"; then
5383 case \"\$destdir\" in
5384 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5385 *) thisdir=\"\$thisdir/\$destdir\" ;;
5386 esac
5389 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5390 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5391 done
5393 # Try to get the absolute directory name.
5394 absdir=\`cd \"\$thisdir\" && pwd\`
5395 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5398 if test "$fast_install" = yes; then
5399 $echo >> $output "\
5400 program=lt-'$outputname'$exeext
5401 progdir=\"\$thisdir/$objdir\"
5403 if test ! -f \"\$progdir/\$program\" || \\
5404 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5405 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5407 file=\"\$\$-\$program\"
5409 if test ! -d \"\$progdir\"; then
5410 $mkdir \"\$progdir\"
5411 else
5412 $rm \"\$progdir/\$file\"
5415 $echo >> $output "\
5417 # relink executable if necessary
5418 if test -n \"\$relink_command\"; then
5419 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5420 else
5421 $echo \"\$relink_command_output\" >&2
5422 $rm \"\$progdir/\$file\"
5423 exit $EXIT_FAILURE
5427 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5428 { $rm \"\$progdir/\$program\";
5429 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5430 $rm \"\$progdir/\$file\"
5432 else
5433 $echo >> $output "\
5434 program='$outputname'
5435 progdir=\"\$thisdir/$objdir\"
5439 $echo >> $output "\
5441 if test -f \"\$progdir/\$program\"; then"
5443 # Export our shlibpath_var if we have one.
5444 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5445 $echo >> $output "\
5446 # Add our own library path to $shlibpath_var
5447 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5449 # Some systems cannot cope with colon-terminated $shlibpath_var
5450 # The second colon is a workaround for a bug in BeOS R4 sed
5451 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5453 export $shlibpath_var
5457 # fixup the dll searchpath if we need to.
5458 if test -n "$dllsearchpath"; then
5459 $echo >> $output "\
5460 # Add the dll search path components to the executable PATH
5461 PATH=$dllsearchpath:\$PATH
5465 $echo >> $output "\
5466 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5467 # Run the actual program with our arguments.
5469 # Make sure env LD_LIBRARY_PATH does not mess us up
5470 if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5471 export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5474 case $host in
5475 # Backslashes separate directories on plain windows
5476 *-*-mingw | *-*-os2*)
5477 $echo >> $output "\
5478 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5483 $echo >> $output "\
5484 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5487 esac
5488 $echo >> $output "\
5489 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5490 exit $EXIT_FAILURE
5492 else
5493 # The program doesn't exist.
5494 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5495 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5496 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5497 exit $EXIT_FAILURE
5501 chmod +x $output
5503 exit $EXIT_SUCCESS
5505 esac
5507 # See if we need to build an old-fashioned archive.
5508 for oldlib in $oldlibs; do
5510 if test "$build_libtool_libs" = convenience; then
5511 oldobjs="$libobjs_save"
5512 addlibs="$convenience"
5513 build_libtool_libs=no
5514 else
5515 if test "$build_libtool_libs" = module; then
5516 oldobjs="$libobjs_save"
5517 build_libtool_libs=no
5518 else
5519 oldobjs="$old_deplibs $non_pic_objects"
5521 addlibs="$old_convenience"
5524 if test -n "$addlibs"; then
5525 gentop="$output_objdir/${outputname}x"
5526 generated="$generated $gentop"
5528 func_extract_archives $gentop $addlibs
5529 oldobjs="$oldobjs $func_extract_archives_result"
5532 # Do each command in the archive commands.
5533 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5534 cmds=$old_archive_from_new_cmds
5535 else
5536 # POSIX demands no paths to be encoded in archives. We have
5537 # to avoid creating archives with duplicate basenames if we
5538 # might have to extract them afterwards, e.g., when creating a
5539 # static archive out of a convenience library, or when linking
5540 # the entirety of a libtool archive into another (currently
5541 # not supported by libtool).
5542 if (for obj in $oldobjs
5544 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5545 done | sort | sort -uc >/dev/null 2>&1); then
5547 else
5548 $echo "copying selected object files to avoid basename conflicts..."
5550 if test -z "$gentop"; then
5551 gentop="$output_objdir/${outputname}x"
5552 generated="$generated $gentop"
5554 $show "${rm}r $gentop"
5555 $run ${rm}r "$gentop"
5556 $show "$mkdir $gentop"
5557 $run $mkdir "$gentop"
5558 exit_status=$?
5559 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5560 exit $exit_status
5564 save_oldobjs=$oldobjs
5565 oldobjs=
5566 counter=1
5567 for obj in $save_oldobjs
5569 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5570 case " $oldobjs " in
5571 " ") oldobjs=$obj ;;
5572 *[\ /]"$objbase "*)
5573 while :; do
5574 # Make sure we don't pick an alternate name that also
5575 # overlaps.
5576 newobj=lt$counter-$objbase
5577 counter=`expr $counter + 1`
5578 case " $oldobjs " in
5579 *[\ /]"$newobj "*) ;;
5580 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5581 esac
5582 done
5583 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5584 $run ln "$obj" "$gentop/$newobj" ||
5585 $run cp "$obj" "$gentop/$newobj"
5586 oldobjs="$oldobjs $gentop/$newobj"
5588 *) oldobjs="$oldobjs $obj" ;;
5589 esac
5590 done
5593 eval cmds=\"$old_archive_cmds\"
5595 if len=`expr "X$cmds" : ".*"` &&
5596 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5597 cmds=$old_archive_cmds
5598 else
5599 # the command line is too long to link in one step, link in parts
5600 $echo "using piecewise archive linking..."
5601 save_RANLIB=$RANLIB
5602 RANLIB=:
5603 objlist=
5604 concat_cmds=
5605 save_oldobjs=$oldobjs
5607 # Is there a better way of finding the last object in the list?
5608 for obj in $save_oldobjs
5610 last_oldobj=$obj
5611 done
5612 for obj in $save_oldobjs
5614 oldobjs="$objlist $obj"
5615 objlist="$objlist $obj"
5616 eval test_cmds=\"$old_archive_cmds\"
5617 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5618 test "$len" -le "$max_cmd_len"; then
5620 else
5621 # the above command should be used before it gets too long
5622 oldobjs=$objlist
5623 if test "$obj" = "$last_oldobj" ; then
5624 RANLIB=$save_RANLIB
5626 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5627 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5628 objlist=
5630 done
5631 RANLIB=$save_RANLIB
5632 oldobjs=$objlist
5633 if test "X$oldobjs" = "X" ; then
5634 eval cmds=\"\$concat_cmds\"
5635 else
5636 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5640 save_ifs="$IFS"; IFS='~'
5641 for cmd in $cmds; do
5642 eval cmd=\"$cmd\"
5643 IFS="$save_ifs"
5644 $show "$cmd"
5645 $run eval "$cmd" || exit $?
5646 done
5647 IFS="$save_ifs"
5648 done
5650 if test -n "$generated"; then
5651 $show "${rm}r$generated"
5652 $run ${rm}r$generated
5655 # Now create the libtool archive.
5656 case $output in
5657 *.la)
5658 old_library=
5659 test "$build_old_libs" = yes && old_library="$libname.$libext"
5660 $show "creating $output"
5662 # Preserve any variables that may affect compiler behavior
5663 for var in $variables_saved_for_relink; do
5664 if eval test -z \"\${$var+set}\"; then
5665 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5666 elif eval var_value=\$$var; test -z "$var_value"; then
5667 relink_command="$var=; export $var; $relink_command"
5668 else
5669 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5670 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5672 done
5673 # Quote the link command for shipping.
5674 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5675 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5676 if test "$hardcode_automatic" = yes ; then
5677 relink_command=
5681 # Only create the output if not a dry run.
5682 if test -z "$run"; then
5683 for installed in no yes; do
5684 if test "$installed" = yes; then
5685 if test -z "$install_libdir"; then
5686 break
5688 output="$output_objdir/$outputname"i
5689 # Replace all uninstalled libtool libraries with the installed ones
5690 newdependency_libs=
5691 for deplib in $dependency_libs; do
5692 case $deplib in
5693 *.la)
5694 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5695 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5696 if test -z "$libdir"; then
5697 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5698 exit $EXIT_FAILURE
5700 if test "X$EGREP" = X ; then
5701 EGREP=egrep
5703 # We do not want portage's install root ($D) present. Check only for
5704 # this if the .la is being installed.
5705 if test "$installed" = yes && test "$D"; then
5706 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5707 else
5708 mynewdependency_lib="$libdir/$name"
5710 # Do not add duplicates
5711 if test "$mynewdependency_lib"; then
5712 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5713 if test -z "$my_little_ninja_foo_1"; then
5714 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5719 if test "$installed" = yes; then
5720 # Rather use S=WORKDIR if our version of portage supports it.
5721 # This is because some ebuild (gcc) do not use $S as buildroot.
5722 if test "$PWORKDIR"; then
5723 S="$PWORKDIR"
5725 # We do not want portage's build root ($S) present.
5726 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5727 # We do not want portage's install root ($D) present.
5728 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5729 if test -n "$my_little_ninja_foo_2" && test "$S"; then
5730 mynewdependency_lib=""
5731 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5732 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5733 else
5734 mynewdependency_lib="$deplib"
5736 else
5737 mynewdependency_lib="$deplib"
5739 # Do not add duplicates
5740 if test "$mynewdependency_lib"; then
5741 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5742 if test -z "$my_little_ninja_foo_4"; then
5743 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5747 esac
5748 done
5749 dependency_libs="$newdependency_libs"
5750 newdlfiles=
5751 for lib in $dlfiles; do
5752 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5753 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5754 if test -z "$libdir"; then
5755 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5756 exit $EXIT_FAILURE
5758 newdlfiles="$newdlfiles $libdir/$name"
5759 done
5760 dlfiles="$newdlfiles"
5761 newdlprefiles=
5762 for lib in $dlprefiles; do
5763 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5764 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5765 if test -z "$libdir"; then
5766 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5767 exit $EXIT_FAILURE
5769 newdlprefiles="$newdlprefiles $libdir/$name"
5770 done
5771 dlprefiles="$newdlprefiles"
5772 else
5773 newdlfiles=
5774 for lib in $dlfiles; do
5775 case $lib in
5776 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5777 *) abs=`pwd`"/$lib" ;;
5778 esac
5779 newdlfiles="$newdlfiles $abs"
5780 done
5781 dlfiles="$newdlfiles"
5782 newdlprefiles=
5783 for lib in $dlprefiles; do
5784 case $lib in
5785 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5786 *) abs=`pwd`"/$lib" ;;
5787 esac
5788 newdlprefiles="$newdlprefiles $abs"
5789 done
5790 dlprefiles="$newdlprefiles"
5792 $rm $output
5793 # place dlname in correct position for cygwin
5794 tdlname=$dlname
5795 case $host,$output,$installed,$module,$dlname in
5796 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5797 esac
5798 # Do not add duplicates
5799 if test "$installed" = yes && test "$D"; then
5800 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5802 $echo > $output "\
5803 # $outputname - a libtool library file
5804 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5806 # Please DO NOT delete this file!
5807 # It is necessary for linking the library.
5809 # The name that we can dlopen(3).
5810 dlname='$tdlname'
5812 # Names of this library.
5813 library_names='$library_names'
5815 # The name of the static archive.
5816 old_library='$old_library'
5818 # Libraries that this one depends upon.
5819 dependency_libs='$dependency_libs'
5821 # Version information for $libname.
5822 current=$current
5823 age=$age
5824 revision=$revision
5826 # Is this an already installed library?
5827 installed=$installed
5829 # Should we warn about portability when linking against -modules?
5830 shouldnotlink=$module
5832 # Files to dlopen/dlpreopen
5833 dlopen='$dlfiles'
5834 dlpreopen='$dlprefiles'
5836 # Directory that this library needs to be installed in:
5837 libdir='$install_libdir'"
5838 if test "$installed" = no && test "$need_relink" = yes; then
5839 $echo >> $output "\
5840 relink_command=\"$relink_command\""
5842 done
5845 # Do a symbolic link so that the libtool archive can be found in
5846 # LD_LIBRARY_PATH before the program is installed.
5847 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5848 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5850 esac
5851 exit $EXIT_SUCCESS
5854 # libtool install mode
5855 install)
5856 modename="$modename: install"
5858 # There may be an optional sh(1) argument at the beginning of
5859 # install_prog (especially on Windows NT).
5860 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5861 # Allow the use of GNU shtool's install command.
5862 $echo "X$nonopt" | grep shtool > /dev/null; then
5863 # Aesthetically quote it.
5864 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5865 case $arg in
5866 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5867 arg="\"$arg\""
5869 esac
5870 install_prog="$arg "
5871 arg="$1"
5872 shift
5873 else
5874 install_prog=
5875 arg=$nonopt
5878 # The real first argument should be the name of the installation program.
5879 # Aesthetically quote it.
5880 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5881 case $arg in
5882 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5883 arg="\"$arg\""
5885 esac
5886 install_prog="$install_prog$arg"
5888 # We need to accept at least all the BSD install flags.
5889 dest=
5890 files=
5891 opts=
5892 prev=
5893 install_type=
5894 isdir=no
5895 stripme=
5896 for arg
5898 if test -n "$dest"; then
5899 files="$files $dest"
5900 dest=$arg
5901 continue
5904 case $arg in
5905 -d) isdir=yes ;;
5906 -f)
5907 case " $install_prog " in
5908 *[\\\ /]cp\ *) ;;
5909 *) prev=$arg ;;
5910 esac
5912 -g | -m | -o) prev=$arg ;;
5914 stripme=" -s"
5915 continue
5920 # If the previous option needed an argument, then skip it.
5921 if test -n "$prev"; then
5922 prev=
5923 else
5924 dest=$arg
5925 continue
5928 esac
5930 # Aesthetically quote the argument.
5931 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5932 case $arg in
5933 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5934 arg="\"$arg\""
5936 esac
5937 install_prog="$install_prog $arg"
5938 done
5940 if test -z "$install_prog"; then
5941 $echo "$modename: you must specify an install program" 1>&2
5942 $echo "$help" 1>&2
5943 exit $EXIT_FAILURE
5946 if test -n "$prev"; then
5947 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5948 $echo "$help" 1>&2
5949 exit $EXIT_FAILURE
5952 if test -z "$files"; then
5953 if test -z "$dest"; then
5954 $echo "$modename: no file or destination specified" 1>&2
5955 else
5956 $echo "$modename: you must specify a destination" 1>&2
5958 $echo "$help" 1>&2
5959 exit $EXIT_FAILURE
5962 # Strip any trailing slash from the destination.
5963 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5965 # Check to see that the destination is a directory.
5966 test -d "$dest" && isdir=yes
5967 if test "$isdir" = yes; then
5968 destdir="$dest"
5969 destname=
5970 else
5971 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5972 test "X$destdir" = "X$dest" && destdir=.
5973 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5975 # Not a directory, so check to see that there is only one file specified.
5976 set dummy $files
5977 if test "$#" -gt 2; then
5978 $echo "$modename: \`$dest' is not a directory" 1>&2
5979 $echo "$help" 1>&2
5980 exit $EXIT_FAILURE
5983 case $destdir in
5984 [\\/]* | [A-Za-z]:[\\/]*) ;;
5986 for file in $files; do
5987 case $file in
5988 *.lo) ;;
5990 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5991 $echo "$help" 1>&2
5992 exit $EXIT_FAILURE
5994 esac
5995 done
5997 esac
5999 # This variable tells wrapper scripts just to set variables rather
6000 # than running their programs.
6001 libtool_install_magic="$magic"
6003 staticlibs=
6004 future_libdirs=
6005 current_libdirs=
6006 for file in $files; do
6008 # Do each installation.
6009 case $file in
6010 *.$libext)
6011 # Do the static libraries later.
6012 staticlibs="$staticlibs $file"
6015 *.la)
6016 # Check to see that this really is a libtool archive.
6017 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6018 else
6019 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6020 $echo "$help" 1>&2
6021 exit $EXIT_FAILURE
6024 library_names=
6025 old_library=
6026 relink_command=
6027 # If there is no directory component, then add one.
6028 case $file in
6029 */* | *\\*) . $file ;;
6030 *) . ./$file ;;
6031 esac
6033 # Add the libdir to current_libdirs if it is the destination.
6034 if test "X$destdir" = "X$libdir"; then
6035 case "$current_libdirs " in
6036 *" $libdir "*) ;;
6037 *) current_libdirs="$current_libdirs $libdir" ;;
6038 esac
6039 else
6040 # Note the libdir as a future libdir.
6041 case "$future_libdirs " in
6042 *" $libdir "*) ;;
6043 *) future_libdirs="$future_libdirs $libdir" ;;
6044 esac
6047 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6048 test "X$dir" = "X$file/" && dir=
6049 dir="$dir$objdir"
6051 if test -n "$relink_command"; then
6052 # Determine the prefix the user has applied to our future dir.
6053 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6055 # Don't allow the user to place us outside of our expected
6056 # location b/c this prevents finding dependent libraries that
6057 # are installed to the same prefix.
6058 # At present, this check doesn't affect windows .dll's that
6059 # are installed into $libdir/../bin (currently, that works fine)
6060 # but it's something to keep an eye on.
6061 if test "$inst_prefix_dir" = "$destdir"; then
6062 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6063 exit $EXIT_FAILURE
6066 if test -n "$inst_prefix_dir"; then
6067 # Stick the inst_prefix_dir data into the link command.
6068 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
6069 else
6070 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
6073 $echo "$modename: warning: relinking \`$file'" 1>&2
6074 $show "$relink_command"
6075 if $run eval "$relink_command"; then :
6076 else
6077 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6078 exit $EXIT_FAILURE
6082 # See the names of the shared library.
6083 set dummy $library_names
6084 if test -n "$2"; then
6085 realname="$2"
6086 shift
6087 shift
6089 srcname="$realname"
6090 test -n "$relink_command" && srcname="$realname"T
6092 # Install the shared library and build the symlinks.
6093 $show "$install_prog $dir/$srcname $destdir/$realname"
6094 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6095 if test -n "$stripme" && test -n "$striplib"; then
6096 $show "$striplib $destdir/$realname"
6097 $run eval "$striplib $destdir/$realname" || exit $?
6100 if test "$#" -gt 0; then
6101 # Delete the old symlinks, and create new ones.
6102 # Try `ln -sf' first, because the `ln' binary might depend on
6103 # the symlink we replace! Solaris /bin/ln does not understand -f,
6104 # so we also need to try rm && ln -s.
6105 for linkname
6107 if test "$linkname" != "$realname"; then
6108 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6109 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6111 done
6114 # Do each command in the postinstall commands.
6115 lib="$destdir/$realname"
6116 cmds=$postinstall_cmds
6117 save_ifs="$IFS"; IFS='~'
6118 for cmd in $cmds; do
6119 IFS="$save_ifs"
6120 eval cmd=\"$cmd\"
6121 $show "$cmd"
6122 $run eval "$cmd" || {
6123 lt_exit=$?
6125 # Restore the uninstalled library and exit
6126 if test "$mode" = relink; then
6127 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6130 exit $lt_exit
6132 done
6133 IFS="$save_ifs"
6136 # Install the pseudo-library for information purposes.
6137 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6138 instname="$dir/$name"i
6139 $show "$install_prog $instname $destdir/$name"
6140 $run eval "$install_prog $instname $destdir/$name" || exit $?
6142 # Maybe install the static library, too.
6143 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6146 *.lo)
6147 # Install (i.e. copy) a libtool object.
6149 # Figure out destination file name, if it wasn't already specified.
6150 if test -n "$destname"; then
6151 destfile="$destdir/$destname"
6152 else
6153 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6154 destfile="$destdir/$destfile"
6157 # Deduce the name of the destination old-style object file.
6158 case $destfile in
6159 *.lo)
6160 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6162 *.$objext)
6163 staticdest="$destfile"
6164 destfile=
6167 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6168 $echo "$help" 1>&2
6169 exit $EXIT_FAILURE
6171 esac
6173 # Install the libtool object if requested.
6174 if test -n "$destfile"; then
6175 $show "$install_prog $file $destfile"
6176 $run eval "$install_prog $file $destfile" || exit $?
6179 # Install the old object if enabled.
6180 if test "$build_old_libs" = yes; then
6181 # Deduce the name of the old-style object file.
6182 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6184 $show "$install_prog $staticobj $staticdest"
6185 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6187 exit $EXIT_SUCCESS
6191 # Figure out destination file name, if it wasn't already specified.
6192 if test -n "$destname"; then
6193 destfile="$destdir/$destname"
6194 else
6195 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6196 destfile="$destdir/$destfile"
6199 # If the file is missing, and there is a .exe on the end, strip it
6200 # because it is most likely a libtool script we actually want to
6201 # install
6202 stripped_ext=""
6203 case $file in
6204 *.exe)
6205 if test ! -f "$file"; then
6206 file=`$echo $file|${SED} 's,.exe$,,'`
6207 stripped_ext=".exe"
6210 esac
6212 # Do a test to see if this is really a libtool program.
6213 case $host in
6214 *cygwin*|*mingw*)
6215 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6218 wrapper=$file
6220 esac
6221 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6222 notinst_deplibs=
6223 relink_command=
6225 # Note that it is not necessary on cygwin/mingw to append a dot to
6226 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6227 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6228 # `FILE.' does not work on cygwin managed mounts.
6230 # If there is no directory component, then add one.
6231 case $wrapper in
6232 */* | *\\*) . ${wrapper} ;;
6233 *) . ./${wrapper} ;;
6234 esac
6236 # Check the variables that should have been set.
6237 if test -z "$notinst_deplibs"; then
6238 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6239 exit $EXIT_FAILURE
6242 finalize=yes
6243 for lib in $notinst_deplibs; do
6244 # Check to see that each library is installed.
6245 libdir=
6246 if test -f "$lib"; then
6247 # If there is no directory component, then add one.
6248 case $lib in
6249 */* | *\\*) . $lib ;;
6250 *) . ./$lib ;;
6251 esac
6253 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6254 if test -n "$libdir" && test ! -f "$libfile"; then
6255 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6256 finalize=no
6258 done
6260 relink_command=
6261 # Note that it is not necessary on cygwin/mingw to append a dot to
6262 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6263 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6264 # `FILE.' does not work on cygwin managed mounts.
6266 # If there is no directory component, then add one.
6267 case $wrapper in
6268 */* | *\\*) . ${wrapper} ;;
6269 *) . ./${wrapper} ;;
6270 esac
6272 outputname=
6273 if test "$fast_install" = no && test -n "$relink_command"; then
6274 if test "$finalize" = yes && test -z "$run"; then
6275 tmpdir=`func_mktempdir`
6276 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6277 outputname="$tmpdir/$file"
6278 # Replace the output file specification.
6279 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6281 $show "$relink_command"
6282 if $run eval "$relink_command"; then :
6283 else
6284 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6285 ${rm}r "$tmpdir"
6286 continue
6288 file="$outputname"
6289 else
6290 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6292 else
6293 # Install the binary that we compiled earlier.
6294 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6298 # remove .exe since cygwin /usr/bin/install will append another
6299 # one anyway
6300 case $install_prog,$host in
6301 */usr/bin/install*,*cygwin*)
6302 case $file:$destfile in
6303 *.exe:*.exe)
6304 # this is ok
6306 *.exe:*)
6307 destfile=$destfile.exe
6309 *:*.exe)
6310 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6312 esac
6314 esac
6315 $show "$install_prog$stripme $file $destfile"
6316 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6317 test -n "$outputname" && ${rm}r "$tmpdir"
6319 esac
6320 done
6322 for file in $staticlibs; do
6323 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6325 # Set up the ranlib parameters.
6326 oldlib="$destdir/$name"
6328 $show "$install_prog $file $oldlib"
6329 $run eval "$install_prog \$file \$oldlib" || exit $?
6331 if test -n "$stripme" && test -n "$old_striplib"; then
6332 $show "$old_striplib $oldlib"
6333 $run eval "$old_striplib $oldlib" || exit $?
6336 # Do each command in the postinstall commands.
6337 cmds=$old_postinstall_cmds
6338 save_ifs="$IFS"; IFS='~'
6339 for cmd in $cmds; do
6340 IFS="$save_ifs"
6341 eval cmd=\"$cmd\"
6342 $show "$cmd"
6343 $run eval "$cmd" || exit $?
6344 done
6345 IFS="$save_ifs"
6346 done
6348 if test -n "$future_libdirs"; then
6349 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6352 if test -n "$current_libdirs"; then
6353 # Maybe just do a dry run.
6354 test -n "$run" && current_libdirs=" -n$current_libdirs"
6355 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6356 else
6357 exit $EXIT_SUCCESS
6361 # libtool finish mode
6362 finish)
6363 modename="$modename: finish"
6364 libdirs="$nonopt"
6365 admincmds=
6367 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6368 for dir
6370 libdirs="$libdirs $dir"
6371 done
6373 for libdir in $libdirs; do
6374 if test -n "$finish_cmds"; then
6375 # Do each command in the finish commands.
6376 cmds=$finish_cmds
6377 save_ifs="$IFS"; IFS='~'
6378 for cmd in $cmds; do
6379 IFS="$save_ifs"
6380 eval cmd=\"$cmd\"
6381 $show "$cmd"
6382 $run eval "$cmd" || admincmds="$admincmds
6383 $cmd"
6384 done
6385 IFS="$save_ifs"
6387 if test -n "$finish_eval"; then
6388 # Do the single finish_eval.
6389 eval cmds=\"$finish_eval\"
6390 $run eval "$cmds" || admincmds="$admincmds
6391 $cmds"
6393 done
6396 # Exit here if they wanted silent mode.
6397 test "$show" = : && exit $EXIT_SUCCESS
6399 $echo "X----------------------------------------------------------------------" | $Xsed
6400 $echo "Libraries have been installed in:"
6401 for libdir in $libdirs; do
6402 $echo " $libdir"
6403 done
6404 $echo
6405 $echo "If you ever happen to want to link against installed libraries"
6406 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6407 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6408 $echo "flag during linking and do at least one of the following:"
6409 if test -n "$shlibpath_var"; then
6410 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6411 $echo " during execution"
6413 if test -n "$runpath_var"; then
6414 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6415 $echo " during linking"
6417 if test -n "$hardcode_libdir_flag_spec"; then
6418 libdir=LIBDIR
6419 eval flag=\"$hardcode_libdir_flag_spec\"
6421 $echo " - use the \`$flag' linker flag"
6423 if test -n "$admincmds"; then
6424 $echo " - have your system administrator run these commands:$admincmds"
6426 if test -f /etc/ld.so.conf; then
6427 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6429 $echo
6430 $echo "See any operating system documentation about shared libraries for"
6431 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6432 $echo "X----------------------------------------------------------------------" | $Xsed
6433 exit $EXIT_SUCCESS
6436 # libtool execute mode
6437 execute)
6438 modename="$modename: execute"
6440 # The first argument is the command name.
6441 cmd="$nonopt"
6442 if test -z "$cmd"; then
6443 $echo "$modename: you must specify a COMMAND" 1>&2
6444 $echo "$help"
6445 exit $EXIT_FAILURE
6448 # Handle -dlopen flags immediately.
6449 for file in $execute_dlfiles; do
6450 if test ! -f "$file"; then
6451 $echo "$modename: \`$file' is not a file" 1>&2
6452 $echo "$help" 1>&2
6453 exit $EXIT_FAILURE
6456 dir=
6457 case $file in
6458 *.la)
6459 # Check to see that this really is a libtool archive.
6460 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6461 else
6462 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6463 $echo "$help" 1>&2
6464 exit $EXIT_FAILURE
6467 # Read the libtool library.
6468 dlname=
6469 library_names=
6471 # If there is no directory component, then add one.
6472 case $file in
6473 */* | *\\*) . $file ;;
6474 *) . ./$file ;;
6475 esac
6477 # Skip this library if it cannot be dlopened.
6478 if test -z "$dlname"; then
6479 # Warn if it was a shared library.
6480 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6481 continue
6484 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6485 test "X$dir" = "X$file" && dir=.
6487 if test -f "$dir/$objdir/$dlname"; then
6488 dir="$dir/$objdir"
6489 else
6490 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6491 exit $EXIT_FAILURE
6495 *.lo)
6496 # Just add the directory containing the .lo file.
6497 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6498 test "X$dir" = "X$file" && dir=.
6502 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6503 continue
6505 esac
6507 # Get the absolute pathname.
6508 absdir=`cd "$dir" && pwd`
6509 test -n "$absdir" && dir="$absdir"
6511 # Now add the directory to shlibpath_var.
6512 if eval "test -z \"\$$shlibpath_var\""; then
6513 eval "$shlibpath_var=\"\$dir\""
6514 else
6515 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6517 done
6519 # This variable tells wrapper scripts just to set shlibpath_var
6520 # rather than running their programs.
6521 libtool_execute_magic="$magic"
6523 # Check if any of the arguments is a wrapper script.
6524 args=
6525 for file
6527 case $file in
6528 -*) ;;
6530 # Do a test to see if this is really a libtool program.
6531 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6532 # If there is no directory component, then add one.
6533 case $file in
6534 */* | *\\*) . $file ;;
6535 *) . ./$file ;;
6536 esac
6538 # Transform arg to wrapped name.
6539 file="$progdir/$program"
6542 esac
6543 # Quote arguments (to preserve shell metacharacters).
6544 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6545 args="$args \"$file\""
6546 done
6548 if test -z "$run"; then
6549 if test -n "$shlibpath_var"; then
6550 # Export the shlibpath_var.
6551 eval "export $shlibpath_var"
6554 # Restore saved environment variables
6555 if test "${save_LC_ALL+set}" = set; then
6556 LC_ALL="$save_LC_ALL"; export LC_ALL
6558 if test "${save_LANG+set}" = set; then
6559 LANG="$save_LANG"; export LANG
6562 # Now prepare to actually exec the command.
6563 exec_cmd="\$cmd$args"
6564 else
6565 # Display what would be done.
6566 if test -n "$shlibpath_var"; then
6567 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6568 $echo "export $shlibpath_var"
6570 $echo "$cmd$args"
6571 exit $EXIT_SUCCESS
6575 # libtool clean and uninstall mode
6576 clean | uninstall)
6577 modename="$modename: $mode"
6578 rm="$nonopt"
6579 files=
6580 rmforce=
6581 exit_status=0
6583 # This variable tells wrapper scripts just to set variables rather
6584 # than running their programs.
6585 libtool_install_magic="$magic"
6587 for arg
6589 case $arg in
6590 -f) rm="$rm $arg"; rmforce=yes ;;
6591 -*) rm="$rm $arg" ;;
6592 *) files="$files $arg" ;;
6593 esac
6594 done
6596 if test -z "$rm"; then
6597 $echo "$modename: you must specify an RM program" 1>&2
6598 $echo "$help" 1>&2
6599 exit $EXIT_FAILURE
6602 rmdirs=
6604 origobjdir="$objdir"
6605 for file in $files; do
6606 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6607 if test "X$dir" = "X$file"; then
6608 dir=.
6609 objdir="$origobjdir"
6610 else
6611 objdir="$dir/$origobjdir"
6613 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6614 test "$mode" = uninstall && objdir="$dir"
6616 # Remember objdir for removal later, being careful to avoid duplicates
6617 if test "$mode" = clean; then
6618 case " $rmdirs " in
6619 *" $objdir "*) ;;
6620 *) rmdirs="$rmdirs $objdir" ;;
6621 esac
6624 # Don't error if the file doesn't exist and rm -f was used.
6625 if (test -L "$file") >/dev/null 2>&1 \
6626 || (test -h "$file") >/dev/null 2>&1 \
6627 || test -f "$file"; then
6629 elif test -d "$file"; then
6630 exit_status=1
6631 continue
6632 elif test "$rmforce" = yes; then
6633 continue
6636 rmfiles="$file"
6638 case $name in
6639 *.la)
6640 # Possibly a libtool archive, so verify it.
6641 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6642 . $dir/$name
6644 # Delete the libtool libraries and symlinks.
6645 for n in $library_names; do
6646 rmfiles="$rmfiles $objdir/$n"
6647 done
6648 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6650 case "$mode" in
6651 clean)
6652 case " $library_names " in
6653 # " " in the beginning catches empty $dlname
6654 *" $dlname "*) ;;
6655 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6656 esac
6657 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6659 uninstall)
6660 if test -n "$library_names"; then
6661 # Do each command in the postuninstall commands.
6662 cmds=$postuninstall_cmds
6663 save_ifs="$IFS"; IFS='~'
6664 for cmd in $cmds; do
6665 IFS="$save_ifs"
6666 eval cmd=\"$cmd\"
6667 $show "$cmd"
6668 $run eval "$cmd"
6669 if test "$?" -ne 0 && test "$rmforce" != yes; then
6670 exit_status=1
6672 done
6673 IFS="$save_ifs"
6676 if test -n "$old_library"; then
6677 # Do each command in the old_postuninstall commands.
6678 cmds=$old_postuninstall_cmds
6679 save_ifs="$IFS"; IFS='~'
6680 for cmd in $cmds; do
6681 IFS="$save_ifs"
6682 eval cmd=\"$cmd\"
6683 $show "$cmd"
6684 $run eval "$cmd"
6685 if test "$?" -ne 0 && test "$rmforce" != yes; then
6686 exit_status=1
6688 done
6689 IFS="$save_ifs"
6691 # FIXME: should reinstall the best remaining shared library.
6693 esac
6697 *.lo)
6698 # Possibly a libtool object, so verify it.
6699 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6701 # Read the .lo file
6702 . $dir/$name
6704 # Add PIC object to the list of files to remove.
6705 if test -n "$pic_object" \
6706 && test "$pic_object" != none; then
6707 rmfiles="$rmfiles $dir/$pic_object"
6710 # Add non-PIC object to the list of files to remove.
6711 if test -n "$non_pic_object" \
6712 && test "$non_pic_object" != none; then
6713 rmfiles="$rmfiles $dir/$non_pic_object"
6719 if test "$mode" = clean ; then
6720 noexename=$name
6721 case $file in
6722 *.exe)
6723 file=`$echo $file|${SED} 's,.exe$,,'`
6724 noexename=`$echo $name|${SED} 's,.exe$,,'`
6725 # $file with .exe has already been added to rmfiles,
6726 # add $file without .exe
6727 rmfiles="$rmfiles $file"
6729 esac
6730 # Do a test to see if this is a libtool program.
6731 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6732 relink_command=
6733 . $dir/$noexename
6735 # note $name still contains .exe if it was in $file originally
6736 # as does the version of $file that was added into $rmfiles
6737 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6738 if test "$fast_install" = yes && test -n "$relink_command"; then
6739 rmfiles="$rmfiles $objdir/lt-$name"
6741 if test "X$noexename" != "X$name" ; then
6742 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6747 esac
6748 $show "$rm $rmfiles"
6749 $run $rm $rmfiles || exit_status=1
6750 done
6751 objdir="$origobjdir"
6753 # Try to remove the ${objdir}s in the directories where we deleted files
6754 for dir in $rmdirs; do
6755 if test -d "$dir"; then
6756 $show "rmdir $dir"
6757 $run rmdir $dir >/dev/null 2>&1
6759 done
6761 exit $exit_status
6765 $echo "$modename: you must specify a MODE" 1>&2
6766 $echo "$generic_help" 1>&2
6767 exit $EXIT_FAILURE
6769 esac
6771 if test -z "$exec_cmd"; then
6772 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6773 $echo "$generic_help" 1>&2
6774 exit $EXIT_FAILURE
6776 fi # test -z "$show_help"
6778 if test -n "$exec_cmd"; then
6779 eval exec $exec_cmd
6780 exit $EXIT_FAILURE
6783 # We need to display help for each of the modes.
6784 case $mode in
6785 "") $echo \
6786 "Usage: $modename [OPTION]... [MODE-ARG]...
6788 Provide generalized library-building support services.
6790 --config show all configuration variables
6791 --debug enable verbose shell tracing
6792 -n, --dry-run display commands without modifying any files
6793 --features display basic configuration information and exit
6794 --finish same as \`--mode=finish'
6795 --help display this help message and exit
6796 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6797 --quiet same as \`--silent'
6798 --silent don't print informational messages
6799 --tag=TAG use configuration variables from tag TAG
6800 --version print version information
6802 MODE must be one of the following:
6804 clean remove files from the build directory
6805 compile compile a source file into a libtool object
6806 execute automatically set library path, then run a program
6807 finish complete the installation of libtool libraries
6808 install install libraries or executables
6809 link create a library or an executable
6810 uninstall remove libraries from an installed directory
6812 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6813 a more detailed description of MODE.
6815 Report bugs to <bug-libtool@gnu.org>."
6816 exit $EXIT_SUCCESS
6819 clean)
6820 $echo \
6821 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6823 Remove files from the build directory.
6825 RM is the name of the program to use to delete files associated with each FILE
6826 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6827 to RM.
6829 If FILE is a libtool library, object or program, all the files associated
6830 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6833 compile)
6834 $echo \
6835 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6837 Compile a source file into a libtool library object.
6839 This mode accepts the following additional options:
6841 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6842 -prefer-pic try to building PIC objects only
6843 -prefer-non-pic try to building non-PIC objects only
6844 -static always build a \`.o' file suitable for static linking
6846 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6847 from the given SOURCEFILE.
6849 The output file name is determined by removing the directory component from
6850 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6851 library object suffix, \`.lo'."
6854 execute)
6855 $echo \
6856 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6858 Automatically set library path, then run a program.
6860 This mode accepts the following additional options:
6862 -dlopen FILE add the directory containing FILE to the library path
6864 This mode sets the library path environment variable according to \`-dlopen'
6865 flags.
6867 If any of the ARGS are libtool executable wrappers, then they are translated
6868 into their corresponding uninstalled binary, and any of their required library
6869 directories are added to the library path.
6871 Then, COMMAND is executed, with ARGS as arguments."
6874 finish)
6875 $echo \
6876 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6878 Complete the installation of libtool libraries.
6880 Each LIBDIR is a directory that contains libtool libraries.
6882 The commands that this mode executes may require superuser privileges. Use
6883 the \`--dry-run' option if you just want to see what would be executed."
6886 install)
6887 $echo \
6888 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6890 Install executables or libraries.
6892 INSTALL-COMMAND is the installation command. The first component should be
6893 either the \`install' or \`cp' program.
6895 The rest of the components are interpreted as arguments to that command (only
6896 BSD-compatible install options are recognized)."
6899 link)
6900 $echo \
6901 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6903 Link object files or libraries together to form another library, or to
6904 create an executable program.
6906 LINK-COMMAND is a command using the C compiler that you would use to create
6907 a program from several object files.
6909 The following components of LINK-COMMAND are treated specially:
6911 -all-static do not do any dynamic linking at all
6912 -avoid-version do not add a version suffix if possible
6913 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6914 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6915 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6916 -export-symbols SYMFILE
6917 try to export only the symbols listed in SYMFILE
6918 -export-symbols-regex REGEX
6919 try to export only the symbols matching REGEX
6920 -LLIBDIR search LIBDIR for required installed libraries
6921 -lNAME OUTPUT-FILE requires the installed library libNAME
6922 -module build a library that can dlopened
6923 -no-fast-install disable the fast-install mode
6924 -no-install link a not-installable executable
6925 -no-undefined declare that a library does not refer to external symbols
6926 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6927 -objectlist FILE Use a list of object files found in FILE to specify objects
6928 -precious-files-regex REGEX
6929 don't remove output files matching REGEX
6930 -release RELEASE specify package release information
6931 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6932 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6933 -static do not do any dynamic linking of libtool libraries
6934 -version-info CURRENT[:REVISION[:AGE]]
6935 specify library version info [each variable defaults to 0]
6937 All other options (arguments beginning with \`-') are ignored.
6939 Every other argument is treated as a filename. Files ending in \`.la' are
6940 treated as uninstalled libtool libraries, other files are standard or library
6941 object files.
6943 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6944 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6945 required, except when creating a convenience library.
6947 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6948 using \`ar' and \`ranlib', or on Windows using \`lib'.
6950 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6951 is created, otherwise an executable program is created."
6954 uninstall)
6955 $echo \
6956 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6958 Remove libraries from an installation directory.
6960 RM is the name of the program to use to delete files associated with each FILE
6961 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6962 to RM.
6964 If FILE is a libtool library, all the files associated with it are deleted.
6965 Otherwise, only FILE itself is deleted using RM."
6969 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6970 $echo "$help" 1>&2
6971 exit $EXIT_FAILURE
6973 esac
6975 $echo
6976 $echo "Try \`$modename --help' for more information about other modes."
6978 exit $?
6980 # The TAGs below are defined such that we never get into a situation
6981 # in which we disable both kinds of libraries. Given conflicting
6982 # choices, we go for a static library, that is the most portable,
6983 # since we can't tell whether shared libraries were disabled because
6984 # the user asked for that or because the platform doesn't support
6985 # them. This is particularly important on AIX, because we don't
6986 # support having both static and shared libraries enabled at the same
6987 # time on that platform, so we default to a shared-only configuration.
6988 # If a disable-shared tag is given, we'll fallback to a static-only
6989 # configuration. But we'll never go from static-only to shared-only.
6991 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6992 disable_libs=shared
6993 # ### END LIBTOOL TAG CONFIG: disable-shared
6995 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6996 disable_libs=static
6997 # ### END LIBTOOL TAG CONFIG: disable-static
6999 # Local Variables:
7000 # mode:shell-script
7001 # sh-indentation:2
7002 # End: