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