dnscrypt-proxy update: 1.4.1
[tomato.git] / release / src / router / php / ltmain.sh
blob7e2240e980e01c4c6dc968077f4b4a9c1b285b9a
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 $run $rm "$lobj"
960 # Place PIC objects in $objdir
961 command="$command -o $lobj"
962 else
963 $run $rm "$lobj" "$output_obj"
966 $show "$command"
967 if $run eval $lt_env "$command"; then :
968 else
969 test -n "$output_obj" && $run $rm $removelist
970 exit $EXIT_FAILURE
973 if test "$need_locks" = warn &&
974 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
975 $echo "\
976 *** ERROR, $lockfile contains:
977 `cat $lockfile 2>/dev/null`
979 but it should contain:
980 $srcfile
982 This indicates that another process is trying to use the same
983 temporary object file, and libtool could not work around it because
984 your compiler does not support \`-c' and \`-o' together. If you
985 repeat this compilation, it may succeed, by chance, but you had better
986 avoid parallel builds (make -j) in this platform, or get a better
987 compiler."
989 $run $rm $removelist
990 exit $EXIT_FAILURE
993 # Just move the object if needed, then go on to compile the next one
994 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
995 $show "$mv $output_obj $lobj"
996 if $run $mv $output_obj $lobj; then :
997 else
998 error=$?
999 $run $rm $removelist
1000 exit $error
1004 # Append the name of the PIC object to the libtool object file.
1005 test -z "$run" && cat >> ${libobj}T <<EOF
1006 pic_object='$objdir/$objname'
1010 # Allow error messages only from the first compilation.
1011 if test "$suppress_opt" = yes; then
1012 suppress_output=' >/dev/null 2>&1'
1014 else
1015 # No PIC object so indicate it doesn't exist in the libtool
1016 # object file.
1017 test -z "$run" && cat >> ${libobj}T <<EOF
1018 pic_object=none
1023 # Only build a position-dependent object if we build old libraries.
1024 if test "$build_old_libs" = yes; then
1025 if test "$pic_mode" != yes; then
1026 # Don't build PIC code
1027 command="$base_compile $qsrcfile"
1028 else
1029 command="$base_compile $qsrcfile $pic_flag"
1031 if test "$compiler_c_o" = yes; then
1032 command="$command -o $obj"
1035 # Suppress compiler output if we already did a PIC compilation.
1036 command="$command$suppress_output"
1037 $run $rm "$obj" "$output_obj"
1038 $show "$command"
1039 if $run eval $lt_env "$command"; then :
1040 else
1041 $run $rm $removelist
1042 exit $EXIT_FAILURE
1045 if test "$need_locks" = warn &&
1046 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1047 $echo "\
1048 *** ERROR, $lockfile contains:
1049 `cat $lockfile 2>/dev/null`
1051 but it should contain:
1052 $srcfile
1054 This indicates that another process is trying to use the same
1055 temporary object file, and libtool could not work around it because
1056 your compiler does not support \`-c' and \`-o' together. If you
1057 repeat this compilation, it may succeed, by chance, but you had better
1058 avoid parallel builds (make -j) in this platform, or get a better
1059 compiler."
1061 $run $rm $removelist
1062 exit $EXIT_FAILURE
1065 # Just move the object if needed
1066 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1067 $show "$mv $output_obj $obj"
1068 if $run $mv $output_obj $obj; then :
1069 else
1070 error=$?
1071 $run $rm $removelist
1072 exit $error
1076 # Append the name of the non-PIC object the libtool object file.
1077 # Only append if the libtool object file exists.
1078 test -z "$run" && cat >> ${libobj}T <<EOF
1079 # Name of the non-PIC object.
1080 non_pic_object='$objname'
1083 else
1084 # Append the name of the non-PIC object the libtool object file.
1085 # Only append if the libtool object file exists.
1086 test -z "$run" && cat >> ${libobj}T <<EOF
1087 # Name of the non-PIC object.
1088 non_pic_object=none
1093 $run $mv "${libobj}T" "${libobj}"
1095 # Unlock the critical section if it was locked
1096 if test "$need_locks" != no; then
1097 $run $rm "$lockfile"
1100 exit $EXIT_SUCCESS
1103 # libtool link mode
1104 link | relink)
1105 modename="$modename: link"
1106 case $host in
1107 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1108 # It is impossible to link a dll without this setting, and
1109 # we shouldn't force the makefile maintainer to figure out
1110 # which system we are compiling for in order to pass an extra
1111 # flag for every libtool invocation.
1112 # allow_undefined=no
1114 # FIXME: Unfortunately, there are problems with the above when trying
1115 # to make a dll which has undefined symbols, in which case not
1116 # even a static library is built. For now, we need to specify
1117 # -no-undefined on the libtool link line when we can be certain
1118 # that all symbols are satisfied, otherwise we get a static library.
1119 allow_undefined=yes
1122 allow_undefined=yes
1124 esac
1125 libtool_args="$nonopt"
1126 base_compile="$nonopt $@"
1127 compile_command="$nonopt"
1128 finalize_command="$nonopt"
1130 compile_rpath=
1131 finalize_rpath=
1132 compile_shlibpath=
1133 finalize_shlibpath=
1134 convenience=
1135 old_convenience=
1136 deplibs=
1137 old_deplibs=
1138 compiler_flags=
1139 linker_flags=
1140 dllsearchpath=
1141 lib_search_path=`pwd`
1142 inst_prefix_dir=
1144 avoid_version=no
1145 dlfiles=
1146 dlprefiles=
1147 dlself=no
1148 export_dynamic=no
1149 export_symbols=
1150 export_symbols_regex=
1151 generated=
1152 libobjs=
1153 ltlibs=
1154 module=no
1155 no_install=no
1156 objs=
1157 non_pic_objects=
1158 notinst_path= # paths that contain not-installed libtool libraries
1159 precious_files_regex=
1160 prefer_static_libs=no
1161 preload=no
1162 prev=
1163 prevarg=
1164 release=
1165 rpath=
1166 xrpath=
1167 perm_rpath=
1168 temp_rpath=
1169 thread_safe=no
1170 vinfo=
1171 vinfo_number=no
1172 single_module="${wl}-single_module"
1174 func_infer_tag $base_compile
1176 # We need to know -static, to get the right output filenames.
1177 for arg
1179 case $arg in
1180 -all-static | -static | -static-libtool-libs)
1181 case $arg in
1182 -all-static)
1183 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1184 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1186 if test -n "$link_static_flag"; then
1187 dlopen_self=$dlopen_self_static
1189 prefer_static_libs=yes
1191 -static)
1192 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1193 dlopen_self=$dlopen_self_static
1195 prefer_static_libs=built
1197 -static-libtool-libs)
1198 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1199 dlopen_self=$dlopen_self_static
1201 prefer_static_libs=yes
1203 esac
1204 build_libtool_libs=no
1205 build_old_libs=yes
1206 break
1208 esac
1209 done
1211 # See if our shared archives depend on static archives.
1212 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1214 # Go through the arguments, transforming them on the way.
1215 while test "$#" -gt 0; do
1216 arg="$1"
1217 shift
1218 case $arg in
1219 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1220 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1222 *) qarg=$arg ;;
1223 esac
1224 libtool_args="$libtool_args $qarg"
1226 # If the previous option needs an argument, assign it.
1227 if test -n "$prev"; then
1228 case $prev in
1229 output)
1230 compile_command="$compile_command @OUTPUT@"
1231 finalize_command="$finalize_command @OUTPUT@"
1233 esac
1235 case $prev in
1236 dlfiles|dlprefiles)
1237 if test "$preload" = no; then
1238 # Add the symbol object into the linking commands.
1239 compile_command="$compile_command @SYMFILE@"
1240 finalize_command="$finalize_command @SYMFILE@"
1241 preload=yes
1243 case $arg in
1244 *.la | *.lo) ;; # We handle these cases below.
1245 force)
1246 if test "$dlself" = no; then
1247 dlself=needless
1248 export_dynamic=yes
1250 prev=
1251 continue
1253 self)
1254 if test "$prev" = dlprefiles; then
1255 dlself=yes
1256 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1257 dlself=yes
1258 else
1259 dlself=needless
1260 export_dynamic=yes
1262 prev=
1263 continue
1266 if test "$prev" = dlfiles; then
1267 dlfiles="$dlfiles $arg"
1268 else
1269 dlprefiles="$dlprefiles $arg"
1271 prev=
1272 continue
1274 esac
1276 expsyms)
1277 export_symbols="$arg"
1278 if test ! -f "$arg"; then
1279 $echo "$modename: symbol file \`$arg' does not exist"
1280 exit $EXIT_FAILURE
1282 prev=
1283 continue
1285 expsyms_regex)
1286 export_symbols_regex="$arg"
1287 prev=
1288 continue
1290 inst_prefix)
1291 inst_prefix_dir="$arg"
1292 prev=
1293 continue
1295 precious_regex)
1296 precious_files_regex="$arg"
1297 prev=
1298 continue
1300 release)
1301 release="-$arg"
1302 prev=
1303 continue
1305 objectlist)
1306 if test -f "$arg"; then
1307 save_arg=$arg
1308 moreargs=
1309 for fil in `cat $save_arg`
1311 # moreargs="$moreargs $fil"
1312 arg=$fil
1313 # A libtool-controlled object.
1315 # Check to see that this really is a libtool object.
1316 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1317 pic_object=
1318 non_pic_object=
1320 # Read the .lo file
1321 # If there is no directory component, then add one.
1322 case $arg in
1323 */* | *\\*) . $arg ;;
1324 *) . ./$arg ;;
1325 esac
1327 if test -z "$pic_object" || \
1328 test -z "$non_pic_object" ||
1329 test "$pic_object" = none && \
1330 test "$non_pic_object" = none; then
1331 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1332 exit $EXIT_FAILURE
1335 # Extract subdirectory from the argument.
1336 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1337 if test "X$xdir" = "X$arg"; then
1338 xdir=
1339 else
1340 xdir="$xdir/"
1343 if test "$pic_object" != none; then
1344 # Prepend the subdirectory the object is found in.
1345 pic_object="$xdir$pic_object"
1347 if test "$prev" = dlfiles; then
1348 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1349 dlfiles="$dlfiles $pic_object"
1350 prev=
1351 continue
1352 else
1353 # If libtool objects are unsupported, then we need to preload.
1354 prev=dlprefiles
1358 # CHECK ME: I think I busted this. -Ossama
1359 if test "$prev" = dlprefiles; then
1360 # Preload the old-style object.
1361 dlprefiles="$dlprefiles $pic_object"
1362 prev=
1365 # A PIC object.
1366 libobjs="$libobjs $pic_object"
1367 arg="$pic_object"
1370 # Non-PIC object.
1371 if test "$non_pic_object" != none; then
1372 # Prepend the subdirectory the object is found in.
1373 non_pic_object="$xdir$non_pic_object"
1375 # A standard non-PIC object
1376 non_pic_objects="$non_pic_objects $non_pic_object"
1377 if test -z "$pic_object" || test "$pic_object" = none ; then
1378 arg="$non_pic_object"
1380 else
1381 # If the PIC object exists, use it instead.
1382 # $xdir was prepended to $pic_object above.
1383 non_pic_object="$pic_object"
1384 non_pic_objects="$non_pic_objects $non_pic_object"
1386 else
1387 # Only an error if not doing a dry-run.
1388 if test -z "$run"; then
1389 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1390 exit $EXIT_FAILURE
1391 else
1392 # Dry-run case.
1394 # Extract subdirectory from the argument.
1395 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1396 if test "X$xdir" = "X$arg"; then
1397 xdir=
1398 else
1399 xdir="$xdir/"
1402 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1403 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1404 libobjs="$libobjs $pic_object"
1405 non_pic_objects="$non_pic_objects $non_pic_object"
1408 done
1409 else
1410 $echo "$modename: link input file \`$save_arg' does not exist"
1411 exit $EXIT_FAILURE
1413 arg=$save_arg
1414 prev=
1415 continue
1417 rpath | xrpath)
1418 # We need an absolute path.
1419 case $arg in
1420 [\\/]* | [A-Za-z]:[\\/]*) ;;
1422 $echo "$modename: only absolute run-paths are allowed" 1>&2
1423 exit $EXIT_FAILURE
1425 esac
1426 if test "$prev" = rpath; then
1427 case "$rpath " in
1428 *" $arg "*) ;;
1429 *) rpath="$rpath $arg" ;;
1430 esac
1431 else
1432 case "$xrpath " in
1433 *" $arg "*) ;;
1434 *) xrpath="$xrpath $arg" ;;
1435 esac
1437 prev=
1438 continue
1440 xcompiler)
1441 compiler_flags="$compiler_flags $qarg"
1442 prev=
1443 compile_command="$compile_command $qarg"
1444 finalize_command="$finalize_command $qarg"
1445 continue
1447 xlinker)
1448 linker_flags="$linker_flags $qarg"
1449 compiler_flags="$compiler_flags $wl$qarg"
1450 prev=
1451 compile_command="$compile_command $wl$qarg"
1452 finalize_command="$finalize_command $wl$qarg"
1453 continue
1455 xcclinker)
1456 linker_flags="$linker_flags $qarg"
1457 compiler_flags="$compiler_flags $qarg"
1458 prev=
1459 compile_command="$compile_command $qarg"
1460 finalize_command="$finalize_command $qarg"
1461 continue
1463 shrext)
1464 shrext_cmds="$arg"
1465 prev=
1466 continue
1468 darwin_framework|darwin_framework_skip)
1469 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1470 compile_command="$compile_command $arg"
1471 finalize_command="$finalize_command $arg"
1472 prev=
1473 continue
1476 eval "$prev=\"\$arg\""
1477 prev=
1478 continue
1480 esac
1481 fi # test -n "$prev"
1483 prevarg="$arg"
1485 case $arg in
1486 -all-static)
1487 if test -n "$link_static_flag"; then
1488 compile_command="$compile_command $link_static_flag"
1489 finalize_command="$finalize_command $link_static_flag"
1491 continue
1494 -allow-undefined)
1495 # FIXME: remove this flag sometime in the future.
1496 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1497 continue
1500 -avoid-version)
1501 avoid_version=yes
1502 continue
1505 -dlopen)
1506 prev=dlfiles
1507 continue
1510 -dlpreopen)
1511 prev=dlprefiles
1512 continue
1515 -export-dynamic)
1516 export_dynamic=yes
1517 continue
1520 -export-symbols | -export-symbols-regex)
1521 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1522 $echo "$modename: more than one -exported-symbols argument is not allowed"
1523 exit $EXIT_FAILURE
1525 if test "X$arg" = "X-export-symbols"; then
1526 prev=expsyms
1527 else
1528 prev=expsyms_regex
1530 continue
1533 -framework|-arch|-isysroot)
1534 case " $CC " in
1535 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1536 prev=darwin_framework_skip ;;
1537 *) compiler_flags="$compiler_flags $arg"
1538 prev=darwin_framework ;;
1539 esac
1540 compile_command="$compile_command $arg"
1541 finalize_command="$finalize_command $arg"
1542 continue
1545 -inst-prefix-dir)
1546 prev=inst_prefix
1547 continue
1550 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1551 # so, if we see these flags be careful not to treat them like -L
1552 -L[A-Z][A-Z]*:*)
1553 case $with_gcc/$host in
1554 no/*-*-irix* | /*-*-irix*)
1555 compile_command="$compile_command $arg"
1556 finalize_command="$finalize_command $arg"
1558 esac
1559 continue
1562 -L*)
1563 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1564 # We need an absolute path.
1565 case $dir in
1566 [\\/]* | [A-Za-z]:[\\/]*) ;;
1568 absdir=`cd "$dir" && pwd`
1569 if test -z "$absdir"; then
1570 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1571 absdir="$dir"
1572 notinst_path="$notinst_path $dir"
1574 dir="$absdir"
1576 esac
1577 case "$deplibs " in
1578 *" -L$dir "*) ;;
1580 deplibs="$deplibs -L$dir"
1581 lib_search_path="$lib_search_path $dir"
1583 esac
1584 case $host in
1585 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1586 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1587 case :$dllsearchpath: in
1588 *":$dir:"*) ;;
1589 *) dllsearchpath="$dllsearchpath:$dir";;
1590 esac
1591 case :$dllsearchpath: in
1592 *":$testbindir:"*) ;;
1593 *) dllsearchpath="$dllsearchpath:$testbindir";;
1594 esac
1596 esac
1597 continue
1600 -l*)
1601 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1602 case $host in
1603 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1604 # These systems don't actually have a C or math library (as such)
1605 continue
1607 *-*-os2*)
1608 # These systems don't actually have a C library (as such)
1609 test "X$arg" = "X-lc" && continue
1611 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1612 # Do not include libc due to us having libc/libc_r.
1613 test "X$arg" = "X-lc" && continue
1615 *-*-rhapsody* | *-*-darwin1.[012])
1616 # Rhapsody C and math libraries are in the System framework
1617 deplibs="$deplibs -framework System"
1618 continue
1620 *-*-sco3.2v5* | *-*-sco5v6*)
1621 # Causes problems with __ctype
1622 test "X$arg" = "X-lc" && continue
1624 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1625 # Compiler inserts libc in the correct place for threads to work
1626 test "X$arg" = "X-lc" && continue
1628 esac
1629 elif test "X$arg" = "X-lc_r"; then
1630 case $host in
1631 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1632 # Do not include libc_r directly, use -pthread flag.
1633 continue
1635 esac
1637 deplibs="$deplibs $arg"
1638 continue
1641 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1642 # classes, name mangling, and exception handling.
1643 -model)
1644 compile_command="$compile_command $arg"
1645 compiler_flags="$compiler_flags $arg"
1646 finalize_command="$finalize_command $arg"
1647 prev=xcompiler
1648 continue
1651 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1652 compiler_flags="$compiler_flags $arg"
1653 compile_command="$compile_command $arg"
1654 finalize_command="$finalize_command $arg"
1655 continue
1658 -multi_module)
1659 single_module="${wl}-multi_module"
1660 continue
1663 -module)
1664 module=yes
1665 continue
1668 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671 # +DA*, +DD* enable 64-bit mode on the HP compiler
1672 # -q* pass through compiler args for the IBM compiler
1673 # -m* pass through architecture-specific compiler args for GCC
1674 # -m*, -t[45]*, -txscale* pass through architecture-specific
1675 # compiler args for GCC
1676 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677 # -F/path gives path to uninstalled frameworks, gcc on darwin
1678 # @file GCC response files
1679 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1682 # Unknown arguments in both finalize_command and compile_command need
1683 # to be aesthetically quoted because they are evaled later.
1684 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1685 case $arg in
1686 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1687 arg="\"$arg\""
1689 esac
1690 compile_command="$compile_command $arg"
1691 finalize_command="$finalize_command $arg"
1692 compiler_flags="$compiler_flags $arg"
1693 continue
1696 -shrext)
1697 prev=shrext
1698 continue
1701 -no-fast-install)
1702 fast_install=no
1703 continue
1706 -no-install)
1707 case $host in
1708 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # and Darwin in order for the loader to find any dlls it needs.
1711 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1713 fast_install=no
1715 *) no_install=yes ;;
1716 esac
1717 continue
1720 -no-undefined)
1721 allow_undefined=no
1722 continue
1725 -objectlist)
1726 prev=objectlist
1727 continue
1730 -o) prev=output ;;
1732 -precious-files-regex)
1733 prev=precious_regex
1734 continue
1737 -release)
1738 prev=release
1739 continue
1742 -rpath)
1743 prev=rpath
1744 continue
1748 prev=xrpath
1749 continue
1752 -R*)
1753 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754 # We need an absolute path.
1755 case $dir in
1756 [\\/]* | [A-Za-z]:[\\/]*) ;;
1758 $echo "$modename: only absolute run-paths are allowed" 1>&2
1759 exit $EXIT_FAILURE
1761 esac
1762 case "$xrpath " in
1763 *" $dir "*) ;;
1764 *) xrpath="$xrpath $dir" ;;
1765 esac
1766 continue
1769 -static | -static-libtool-libs)
1770 # The effects of -static are defined in a previous loop.
1771 # We used to do the same as -all-static on platforms that
1772 # didn't have a PIC flag, but the assumption that the effects
1773 # would be equivalent was wrong. It would break on at least
1774 # Digital Unix and AIX.
1775 continue
1778 -thread-safe)
1779 thread_safe=yes
1780 continue
1783 -version-info)
1784 prev=vinfo
1785 continue
1787 -version-number)
1788 prev=vinfo
1789 vinfo_number=yes
1790 continue
1793 -Wc,*)
1794 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1795 arg=
1796 save_ifs="$IFS"; IFS=','
1797 for flag in $args; do
1798 IFS="$save_ifs"
1799 case $flag in
1800 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1801 flag="\"$flag\""
1803 esac
1804 arg="$arg $wl$flag"
1805 compiler_flags="$compiler_flags $flag"
1806 done
1807 IFS="$save_ifs"
1808 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1811 -Wl,*)
1812 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1813 arg=
1814 save_ifs="$IFS"; IFS=','
1815 for flag in $args; do
1816 IFS="$save_ifs"
1817 case $flag in
1818 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1819 flag="\"$flag\""
1821 esac
1822 arg="$arg $wl$flag"
1823 compiler_flags="$compiler_flags $wl$flag"
1824 linker_flags="$linker_flags $flag"
1825 done
1826 IFS="$save_ifs"
1827 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1830 -Xcompiler)
1831 prev=xcompiler
1832 continue
1835 -Xlinker)
1836 prev=xlinker
1837 continue
1840 -XCClinker)
1841 prev=xcclinker
1842 continue
1845 # Some other compiler flag.
1846 -* | +*)
1847 # Unknown arguments in both finalize_command and compile_command need
1848 # to be aesthetically quoted because they are evaled later.
1849 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1850 case $arg in
1851 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1852 arg="\"$arg\""
1854 esac
1857 *.$objext)
1858 # A standard object.
1859 objs="$objs $arg"
1862 *.lo)
1863 # A libtool-controlled object.
1865 # Check to see that this really is a libtool object.
1866 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1867 pic_object=
1868 non_pic_object=
1870 # Read the .lo file
1871 # If there is no directory component, then add one.
1872 case $arg in
1873 */* | *\\*) . $arg ;;
1874 *) . ./$arg ;;
1875 esac
1877 if test -z "$pic_object" || \
1878 test -z "$non_pic_object" ||
1879 test "$pic_object" = none && \
1880 test "$non_pic_object" = none; then
1881 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1882 exit $EXIT_FAILURE
1885 # Extract subdirectory from the argument.
1886 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$xdir" = "X$arg"; then
1888 xdir=
1889 else
1890 xdir="$xdir/"
1893 if test "$pic_object" != none; then
1894 # Prepend the subdirectory the object is found in.
1895 pic_object="$xdir$pic_object"
1897 if test "$prev" = dlfiles; then
1898 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899 dlfiles="$dlfiles $pic_object"
1900 prev=
1901 continue
1902 else
1903 # If libtool objects are unsupported, then we need to preload.
1904 prev=dlprefiles
1908 # CHECK ME: I think I busted this. -Ossama
1909 if test "$prev" = dlprefiles; then
1910 # Preload the old-style object.
1911 dlprefiles="$dlprefiles $pic_object"
1912 prev=
1915 # A PIC object.
1916 libobjs="$libobjs $pic_object"
1917 arg="$pic_object"
1920 # Non-PIC object.
1921 if test "$non_pic_object" != none; then
1922 # Prepend the subdirectory the object is found in.
1923 non_pic_object="$xdir$non_pic_object"
1925 # A standard non-PIC object
1926 non_pic_objects="$non_pic_objects $non_pic_object"
1927 if test -z "$pic_object" || test "$pic_object" = none ; then
1928 arg="$non_pic_object"
1930 else
1931 # If the PIC object exists, use it instead.
1932 # $xdir was prepended to $pic_object above.
1933 non_pic_object="$pic_object"
1934 non_pic_objects="$non_pic_objects $non_pic_object"
1936 else
1937 # Only an error if not doing a dry-run.
1938 if test -z "$run"; then
1939 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1940 exit $EXIT_FAILURE
1941 else
1942 # Dry-run case.
1944 # Extract subdirectory from the argument.
1945 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946 if test "X$xdir" = "X$arg"; then
1947 xdir=
1948 else
1949 xdir="$xdir/"
1952 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954 libobjs="$libobjs $pic_object"
1955 non_pic_objects="$non_pic_objects $non_pic_object"
1960 *.$libext)
1961 # An archive.
1962 deplibs="$deplibs $arg"
1963 old_deplibs="$old_deplibs $arg"
1964 continue
1967 *.la)
1968 # A libtool-controlled library.
1970 if test "$prev" = dlfiles; then
1971 # This library was specified with -dlopen.
1972 dlfiles="$dlfiles $arg"
1973 prev=
1974 elif test "$prev" = dlprefiles; then
1975 # The library was specified with -dlpreopen.
1976 dlprefiles="$dlprefiles $arg"
1977 prev=
1978 else
1979 deplibs="$deplibs $arg"
1981 continue
1984 # Some other compiler argument.
1986 # Unknown arguments in both finalize_command and compile_command need
1987 # to be aesthetically quoted because they are evaled later.
1988 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1989 case $arg in
1990 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1991 arg="\"$arg\""
1993 esac
1995 esac # arg
1997 # Now actually substitute the argument into the commands.
1998 if test -n "$arg"; then
1999 compile_command="$compile_command $arg"
2000 finalize_command="$finalize_command $arg"
2002 done # argument parsing loop
2004 if test -n "$prev"; then
2005 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2006 $echo "$help" 1>&2
2007 exit $EXIT_FAILURE
2010 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011 eval arg=\"$export_dynamic_flag_spec\"
2012 compile_command="$compile_command $arg"
2013 finalize_command="$finalize_command $arg"
2016 oldlibs=
2017 # calculate the name of the file, without its directory
2018 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019 libobjs_save="$libobjs"
2021 if test -n "$shlibpath_var"; then
2022 # get the directories listed in $shlibpath_var
2023 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2024 else
2025 shlib_search_path=
2027 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2030 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031 if test "X$output_objdir" = "X$output"; then
2032 output_objdir="$objdir"
2033 else
2034 output_objdir="$output_objdir/$objdir"
2036 # Create the object directory.
2037 if test ! -d "$output_objdir"; then
2038 $show "$mkdir $output_objdir"
2039 $run $mkdir $output_objdir
2040 exit_status=$?
2041 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2042 exit $exit_status
2046 # Determine the type of output
2047 case $output in
2049 $echo "$modename: you must specify an output file" 1>&2
2050 $echo "$help" 1>&2
2051 exit $EXIT_FAILURE
2053 *.$libext) linkmode=oldlib ;;
2054 *.lo | *.$objext) linkmode=obj ;;
2055 *.la) linkmode=lib ;;
2056 *) linkmode=prog ;; # Anything else should be a program.
2057 esac
2059 case $host in
2060 *cygwin* | *mingw* | *pw32*)
2061 # don't eliminate duplications in $postdeps and $predeps
2062 duplicate_compiler_generated_deps=yes
2065 duplicate_compiler_generated_deps=$duplicate_deps
2067 esac
2068 specialdeplibs=
2070 libs=
2071 # Find all interdependent deplibs by searching for libraries
2072 # that are linked more than once (e.g. -la -lb -la)
2073 for deplib in $deplibs; do
2074 if test "X$duplicate_deps" = "Xyes" ; then
2075 case "$libs " in
2076 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2077 esac
2079 libs="$libs $deplib"
2080 done
2082 if test "$linkmode" = lib; then
2083 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2085 # Compute libraries that are listed more than once in $predeps
2086 # $postdeps and mark them as special (i.e., whose duplicates are
2087 # not to be eliminated).
2088 pre_post_deps=
2089 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090 for pre_post_dep in $predeps $postdeps; do
2091 case "$pre_post_deps " in
2092 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2093 esac
2094 pre_post_deps="$pre_post_deps $pre_post_dep"
2095 done
2097 pre_post_deps=
2100 deplibs=
2101 newdependency_libs=
2102 newlib_search_path=
2103 need_relink=no # whether we're linking any uninstalled libtool libraries
2104 notinst_deplibs= # not-installed libtool libraries
2105 case $linkmode in
2106 lib)
2107 passes="conv link"
2108 for file in $dlfiles $dlprefiles; do
2109 case $file in
2110 *.la) ;;
2112 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2113 exit $EXIT_FAILURE
2115 esac
2116 done
2118 prog)
2119 compile_deplibs=
2120 finalize_deplibs=
2121 alldeplibs=no
2122 newdlfiles=
2123 newdlprefiles=
2124 passes="conv scan dlopen dlpreopen link"
2126 *) passes="conv"
2128 esac
2129 for pass in $passes; do
2130 if test "$linkmode,$pass" = "lib,link" ||
2131 test "$linkmode,$pass" = "prog,scan"; then
2132 libs="$deplibs"
2133 deplibs=
2135 if test "$linkmode" = prog; then
2136 case $pass in
2137 dlopen) libs="$dlfiles" ;;
2138 dlpreopen) libs="$dlprefiles" ;;
2139 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2140 esac
2142 if test "$pass" = dlopen; then
2143 # Collect dlpreopened libraries
2144 save_deplibs="$deplibs"
2145 deplibs=
2147 for deplib in $libs; do
2148 lib=
2149 found=no
2150 case $deplib in
2151 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152 if test "$linkmode,$pass" = "prog,link"; then
2153 compile_deplibs="$deplib $compile_deplibs"
2154 finalize_deplibs="$deplib $finalize_deplibs"
2155 else
2156 compiler_flags="$compiler_flags $deplib"
2158 continue
2160 -l*)
2161 if test "$linkmode" != lib && test "$linkmode" != prog; then
2162 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2163 continue
2165 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166 if test "$linkmode" = lib; then
2167 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
2168 else
2169 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
2171 for searchdir in $searchdirs; do
2172 for search_ext in .la $std_shrext .so .a; do
2173 # Search the libtool library
2174 lib="$searchdir/lib${name}${search_ext}"
2175 if test -f "$lib"; then
2176 if test "$search_ext" = ".la"; then
2177 found=yes
2178 else
2179 found=no
2181 break 2
2183 done
2184 done
2185 if test "$found" != yes; then
2186 # deplib doesn't seem to be a libtool library
2187 if test "$linkmode,$pass" = "prog,link"; then
2188 compile_deplibs="$deplib $compile_deplibs"
2189 finalize_deplibs="$deplib $finalize_deplibs"
2190 else
2191 deplibs="$deplib $deplibs"
2192 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2194 continue
2195 else # deplib is a libtool library
2196 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2197 # We need to do some special things here, and not later.
2198 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2199 case " $predeps $postdeps " in
2200 *" $deplib "*)
2201 if (${SED} -e '2q' $lib |
2202 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2203 library_names=
2204 old_library=
2205 case $lib in
2206 */* | *\\*) . $lib ;;
2207 *) . ./$lib ;;
2208 esac
2209 for l in $old_library $library_names; do
2210 ll="$l"
2211 done
2212 if test "X$ll" = "X$old_library" ; then # only static version available
2213 found=no
2214 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2215 test "X$ladir" = "X$lib" && ladir="."
2216 lib=$ladir/$old_library
2217 if test "$linkmode,$pass" = "prog,link"; then
2218 compile_deplibs="$deplib $compile_deplibs"
2219 finalize_deplibs="$deplib $finalize_deplibs"
2220 else
2221 deplibs="$deplib $deplibs"
2222 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2224 continue
2228 *) ;;
2229 esac
2232 ;; # -l
2233 -L*)
2234 case $linkmode in
2235 lib)
2236 deplibs="$deplib $deplibs"
2237 test "$pass" = conv && continue
2238 newdependency_libs="$deplib $newdependency_libs"
2239 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2241 prog)
2242 if test "$pass" = conv; then
2243 deplibs="$deplib $deplibs"
2244 continue
2246 if test "$pass" = scan; then
2247 deplibs="$deplib $deplibs"
2248 else
2249 compile_deplibs="$deplib $compile_deplibs"
2250 finalize_deplibs="$deplib $finalize_deplibs"
2252 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2255 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2257 esac # linkmode
2258 continue
2259 ;; # -L
2260 -R*)
2261 if test "$pass" = link; then
2262 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2263 # Make sure the xrpath contains only unique directories.
2264 case "$xrpath " in
2265 *" $dir "*) ;;
2266 *) xrpath="$xrpath $dir" ;;
2267 esac
2269 deplibs="$deplib $deplibs"
2270 continue
2272 *.la) lib="$deplib" ;;
2273 *.$libext)
2274 if test "$pass" = conv; then
2275 deplibs="$deplib $deplibs"
2276 continue
2278 case $linkmode in
2279 lib)
2280 valid_a_lib=no
2281 case $deplibs_check_method in
2282 match_pattern*)
2283 set dummy $deplibs_check_method
2284 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2285 if eval $echo \"$deplib\" 2>/dev/null \
2286 | $SED 10q \
2287 | $EGREP "$match_pattern_regex" > /dev/null; then
2288 valid_a_lib=yes
2291 pass_all)
2292 valid_a_lib=yes
2294 esac
2295 if test "$valid_a_lib" != yes; then
2296 $echo
2297 $echo "*** Warning: Trying to link with static lib archive $deplib."
2298 $echo "*** I have the capability to make that library automatically link in when"
2299 $echo "*** you link to this library. But I can only do this if you have a"
2300 $echo "*** shared version of the library, which you do not appear to have"
2301 $echo "*** because the file extensions .$libext of this argument makes me believe"
2302 $echo "*** that it is just a static archive that I should not used here."
2303 else
2304 $echo
2305 $echo "*** Warning: Linking the shared library $output against the"
2306 $echo "*** static library $deplib is not portable!"
2307 deplibs="$deplib $deplibs"
2309 continue
2311 prog)
2312 if test "$pass" != link; then
2313 deplibs="$deplib $deplibs"
2314 else
2315 compile_deplibs="$deplib $compile_deplibs"
2316 finalize_deplibs="$deplib $finalize_deplibs"
2318 continue
2320 esac # linkmode
2321 ;; # *.$libext
2322 *.lo | *.$objext)
2323 if test "$pass" = conv; then
2324 deplibs="$deplib $deplibs"
2325 elif test "$linkmode" = prog; then
2326 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2327 # If there is no dlopen support or we're linking statically,
2328 # we need to preload.
2329 newdlprefiles="$newdlprefiles $deplib"
2330 compile_deplibs="$deplib $compile_deplibs"
2331 finalize_deplibs="$deplib $finalize_deplibs"
2332 else
2333 newdlfiles="$newdlfiles $deplib"
2336 continue
2338 %DEPLIBS%)
2339 alldeplibs=yes
2340 continue
2342 esac # case $deplib
2343 if test "$found" = yes || test -f "$lib"; then :
2344 else
2345 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2346 exit $EXIT_FAILURE
2349 # Check to see that this really is a libtool archive.
2350 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2351 else
2352 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2353 exit $EXIT_FAILURE
2356 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2357 test "X$ladir" = "X$lib" && ladir="."
2359 dlname=
2360 dlopen=
2361 dlpreopen=
2362 libdir=
2363 library_names=
2364 old_library=
2365 # If the library was installed with an old release of libtool,
2366 # it will not redefine variables installed, or shouldnotlink
2367 installed=yes
2368 shouldnotlink=no
2369 avoidtemprpath=
2372 # Read the .la file
2373 case $lib in
2374 */* | *\\*) . $lib ;;
2375 *) . ./$lib ;;
2376 esac
2378 if test "$linkmode,$pass" = "lib,link" ||
2379 test "$linkmode,$pass" = "prog,scan" ||
2380 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2381 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2382 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2385 if test "$pass" = conv; then
2386 # Only check for convenience libraries
2387 deplibs="$lib $deplibs"
2388 if test -z "$libdir"; then
2389 if test -z "$old_library"; then
2390 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2391 exit $EXIT_FAILURE
2393 # It is a libtool convenience library, so add in its objects.
2394 convenience="$convenience $ladir/$objdir/$old_library"
2395 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2396 tmp_libs=
2397 for deplib in $dependency_libs; do
2398 deplibs="$deplib $deplibs"
2399 if test "X$duplicate_deps" = "Xyes" ; then
2400 case "$tmp_libs " in
2401 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2402 esac
2404 tmp_libs="$tmp_libs $deplib"
2405 done
2406 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2407 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2408 exit $EXIT_FAILURE
2410 continue
2411 fi # $pass = conv
2414 # Get the name of the library we link against.
2415 linklib=
2416 for l in $old_library $library_names; do
2417 linklib="$l"
2418 done
2419 if test -z "$linklib"; then
2420 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2421 exit $EXIT_FAILURE
2424 # This library was specified with -dlopen.
2425 if test "$pass" = dlopen; then
2426 if test -z "$libdir"; then
2427 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2428 exit $EXIT_FAILURE
2430 if test -z "$dlname" ||
2431 test "$dlopen_support" != yes ||
2432 test "$build_libtool_libs" = no; then
2433 # If there is no dlname, no dlopen support or we're linking
2434 # statically, we need to preload. We also need to preload any
2435 # dependent libraries so libltdl's deplib preloader doesn't
2436 # bomb out in the load deplibs phase.
2437 dlprefiles="$dlprefiles $lib $dependency_libs"
2438 else
2439 newdlfiles="$newdlfiles $lib"
2441 continue
2442 fi # $pass = dlopen
2444 # We need an absolute path.
2445 case $ladir in
2446 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2448 abs_ladir=`cd "$ladir" && pwd`
2449 if test -z "$abs_ladir"; then
2450 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2451 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2452 abs_ladir="$ladir"
2455 esac
2456 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2458 # Find the relevant object directory and library name.
2459 if test "X$installed" = Xyes; then
2460 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2461 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2462 dir="$ladir"
2463 absdir="$abs_ladir"
2464 libdir="$abs_ladir"
2465 else
2466 dir="$libdir"
2467 absdir="$libdir"
2469 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2470 else
2471 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2472 dir="$ladir"
2473 absdir="$abs_ladir"
2474 # Remove this search path later
2475 notinst_path="$notinst_path $abs_ladir"
2476 else
2477 dir="$ladir/$objdir"
2478 absdir="$abs_ladir/$objdir"
2479 # Remove this search path later
2480 notinst_path="$notinst_path $abs_ladir"
2482 fi # $installed = yes
2483 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2485 # This library was specified with -dlpreopen.
2486 if test "$pass" = dlpreopen; then
2487 if test -z "$libdir"; then
2488 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2489 exit $EXIT_FAILURE
2491 # Prefer using a static library (so that no silly _DYNAMIC symbols
2492 # are required to link).
2493 if test -n "$old_library"; then
2494 newdlprefiles="$newdlprefiles $dir/$old_library"
2495 # Otherwise, use the dlname, so that lt_dlopen finds it.
2496 elif test -n "$dlname"; then
2497 newdlprefiles="$newdlprefiles $dir/$dlname"
2498 else
2499 newdlprefiles="$newdlprefiles $dir/$linklib"
2501 fi # $pass = dlpreopen
2503 if test -z "$libdir"; then
2504 # Link the convenience library
2505 if test "$linkmode" = lib; then
2506 deplibs="$dir/$old_library $deplibs"
2507 elif test "$linkmode,$pass" = "prog,link"; then
2508 compile_deplibs="$dir/$old_library $compile_deplibs"
2509 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2510 else
2511 deplibs="$lib $deplibs" # used for prog,scan pass
2513 continue
2517 if test "$linkmode" = prog && test "$pass" != link; then
2518 newlib_search_path="$newlib_search_path $ladir"
2519 deplibs="$lib $deplibs"
2521 linkalldeplibs=no
2522 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2523 test "$build_libtool_libs" = no; then
2524 linkalldeplibs=yes
2527 tmp_libs=
2528 for deplib in $dependency_libs; do
2529 case $deplib in
2530 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2531 esac
2532 # Need to link against all dependency_libs?
2533 if test "$linkalldeplibs" = yes; then
2534 deplibs="$deplib $deplibs"
2535 else
2536 # Need to hardcode shared library paths
2537 # or/and link against static libraries
2538 newdependency_libs="$deplib $newdependency_libs"
2540 if test "X$duplicate_deps" = "Xyes" ; then
2541 case "$tmp_libs " in
2542 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2543 esac
2545 tmp_libs="$tmp_libs $deplib"
2546 done # for deplib
2547 continue
2548 fi # $linkmode = prog...
2550 if test "$linkmode,$pass" = "prog,link"; then
2551 if test -n "$library_names" &&
2552 { { test "$prefer_static_libs" = no ||
2553 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2554 test -z "$old_library"; }; then
2555 # We need to hardcode the library path
2556 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2557 # Make sure the rpath contains only unique directories.
2558 case "$temp_rpath " in
2559 *" $dir "*) ;;
2560 *" $absdir "*) ;;
2561 *) temp_rpath="$temp_rpath $absdir" ;;
2562 esac
2565 # Hardcode the library path.
2566 # Skip directories that are in the system default run-time
2567 # search path.
2568 case " $sys_lib_dlsearch_path " in
2569 *" $absdir "*) ;;
2571 case "$compile_rpath " in
2572 *" $absdir "*) ;;
2573 *) compile_rpath="$compile_rpath $absdir"
2574 esac
2576 esac
2577 case " $sys_lib_dlsearch_path " in
2578 *" $libdir "*) ;;
2580 case "$finalize_rpath " in
2581 *" $libdir "*) ;;
2582 *) finalize_rpath="$finalize_rpath $libdir"
2583 esac
2585 esac
2586 fi # $linkmode,$pass = prog,link...
2588 if test "$alldeplibs" = yes &&
2589 { test "$deplibs_check_method" = pass_all ||
2590 { test "$build_libtool_libs" = yes &&
2591 test -n "$library_names"; }; }; then
2592 # We only need to search for static libraries
2593 continue
2597 link_static=no # Whether the deplib will be linked statically
2598 use_static_libs=$prefer_static_libs
2599 if test "$use_static_libs" = built && test "$installed" = yes ; then
2600 use_static_libs=no
2602 if test -n "$library_names" &&
2603 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2604 if test "$installed" = no; then
2605 notinst_deplibs="$notinst_deplibs $lib"
2606 need_relink=yes
2608 # This is a shared library
2610 # Warn about portability, can't link against -module's on
2611 # some systems (darwin)
2612 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2613 $echo
2614 if test "$linkmode" = prog; then
2615 $echo "*** Warning: Linking the executable $output against the loadable module"
2616 else
2617 $echo "*** Warning: Linking the shared library $output against the loadable module"
2619 $echo "*** $linklib is not portable!"
2621 if test "$linkmode" = lib &&
2622 test "$hardcode_into_libs" = yes; then
2623 # Hardcode the library path.
2624 # Skip directories that are in the system default run-time
2625 # search path.
2626 case " $sys_lib_dlsearch_path " in
2627 *" $absdir "*) ;;
2629 case "$compile_rpath " in
2630 *" $absdir "*) ;;
2631 *) compile_rpath="$compile_rpath $absdir"
2632 esac
2634 esac
2635 case " $sys_lib_dlsearch_path " in
2636 *" $libdir "*) ;;
2638 case "$finalize_rpath " in
2639 *" $libdir "*) ;;
2640 *) finalize_rpath="$finalize_rpath $libdir"
2641 esac
2643 esac
2646 if test -n "$old_archive_from_expsyms_cmds"; then
2647 # figure out the soname
2648 set dummy $library_names
2649 realname="$2"
2650 shift; shift
2651 libname=`eval \\$echo \"$libname_spec\"`
2652 # use dlname if we got it. it's perfectly good, no?
2653 if test -n "$dlname"; then
2654 soname="$dlname"
2655 elif test -n "$soname_spec"; then
2656 # bleh windows
2657 case $host in
2658 *cygwin* | mingw*)
2659 major=`expr $current - $age`
2660 versuffix="-$major"
2662 esac
2663 eval soname=\"$soname_spec\"
2664 else
2665 soname="$realname"
2668 # Make a new name for the extract_expsyms_cmds to use
2669 soroot="$soname"
2670 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2671 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2673 # If the library has no export list, then create one now
2674 if test -f "$output_objdir/$soname-def"; then :
2675 else
2676 $show "extracting exported symbol list from \`$soname'"
2677 save_ifs="$IFS"; IFS='~'
2678 cmds=$extract_expsyms_cmds
2679 for cmd in $cmds; do
2680 IFS="$save_ifs"
2681 eval cmd=\"$cmd\"
2682 $show "$cmd"
2683 $run eval "$cmd" || exit $?
2684 done
2685 IFS="$save_ifs"
2688 # Create $newlib
2689 if test -f "$output_objdir/$newlib"; then :; else
2690 $show "generating import library for \`$soname'"
2691 save_ifs="$IFS"; IFS='~'
2692 cmds=$old_archive_from_expsyms_cmds
2693 for cmd in $cmds; do
2694 IFS="$save_ifs"
2695 eval cmd=\"$cmd\"
2696 $show "$cmd"
2697 $run eval "$cmd" || exit $?
2698 done
2699 IFS="$save_ifs"
2701 # make sure the library variables are pointing to the new library
2702 dir=$output_objdir
2703 linklib=$newlib
2704 fi # test -n "$old_archive_from_expsyms_cmds"
2706 if test "$linkmode" = prog || test "$mode" != relink; then
2707 add_shlibpath=
2708 add_dir=
2709 add=
2710 lib_linked=yes
2711 case $hardcode_action in
2712 immediate | unsupported)
2713 if test "$hardcode_direct" = no; then
2714 add="$dir/$linklib"
2715 case $host in
2716 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2717 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2718 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2719 *-*-unixware7*) add_dir="-L$dir" ;;
2720 *-*-darwin* )
2721 # if the lib is a module then we can not link against
2722 # it, someone is ignoring the new warnings I added
2723 if /usr/bin/file -L $add 2> /dev/null |
2724 $EGREP ": [^:]* bundle" >/dev/null ; then
2725 $echo "** Warning, lib $linklib is a module, not a shared library"
2726 if test -z "$old_library" ; then
2727 $echo
2728 $echo "** And there doesn't seem to be a static archive available"
2729 $echo "** The link will probably fail, sorry"
2730 else
2731 add="$dir/$old_library"
2734 esac
2735 elif test "$hardcode_minus_L" = no; then
2736 case $host in
2737 *-*-sunos*) add_shlibpath="$dir" ;;
2738 esac
2739 add_dir="-L$dir"
2740 add="-l$name"
2741 elif test "$hardcode_shlibpath_var" = no; then
2742 add_shlibpath="$dir"
2743 add="-l$name"
2744 else
2745 lib_linked=no
2748 relink)
2749 if test "$hardcode_direct" = yes; then
2750 add="$dir/$linklib"
2751 elif test "$hardcode_minus_L" = yes; then
2752 add_dir="-L$dir"
2753 # Try looking first in the location we're being installed to.
2754 if test -n "$inst_prefix_dir"; then
2755 case $libdir in
2756 [\\/]*)
2757 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2759 esac
2761 add="-l$name"
2762 elif test "$hardcode_shlibpath_var" = yes; then
2763 add_shlibpath="$dir"
2764 add="-l$name"
2765 else
2766 lib_linked=no
2769 *) lib_linked=no ;;
2770 esac
2772 if test "$lib_linked" != yes; then
2773 $echo "$modename: configuration error: unsupported hardcode properties"
2774 exit $EXIT_FAILURE
2777 if test -n "$add_shlibpath"; then
2778 case :$compile_shlibpath: in
2779 *":$add_shlibpath:"*) ;;
2780 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2781 esac
2783 if test "$linkmode" = prog; then
2784 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2785 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2786 else
2787 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2788 test -n "$add" && deplibs="$add $deplibs"
2789 if test "$hardcode_direct" != yes && \
2790 test "$hardcode_minus_L" != yes && \
2791 test "$hardcode_shlibpath_var" = yes; then
2792 case :$finalize_shlibpath: in
2793 *":$libdir:"*) ;;
2794 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2795 esac
2800 if test "$linkmode" = prog || test "$mode" = relink; then
2801 add_shlibpath=
2802 add_dir=
2803 add=
2804 # Finalize command for both is simple: just hardcode it.
2805 if test "$hardcode_direct" = yes; then
2806 add="$libdir/$linklib"
2807 elif test "$hardcode_minus_L" = yes; then
2808 add_dir="-L$libdir"
2809 add="-l$name"
2810 elif test "$hardcode_shlibpath_var" = yes; then
2811 case :$finalize_shlibpath: in
2812 *":$libdir:"*) ;;
2813 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2814 esac
2815 add="-l$name"
2816 elif test "$hardcode_automatic" = yes; then
2817 if test -n "$inst_prefix_dir" &&
2818 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2819 add="$inst_prefix_dir$libdir/$linklib"
2820 else
2821 add="$libdir/$linklib"
2823 else
2824 # We cannot seem to hardcode it, guess we'll fake it.
2825 add_dir="-L$libdir"
2826 # Try looking first in the location we're being installed to.
2827 if test -n "$inst_prefix_dir"; then
2828 case $libdir in
2829 [\\/]*)
2830 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2832 esac
2834 add="-l$name"
2837 if test "$linkmode" = prog; then
2838 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2839 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2840 else
2841 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2842 test -n "$add" && deplibs="$add $deplibs"
2845 elif test "$linkmode" = prog; then
2846 # Here we assume that one of hardcode_direct or hardcode_minus_L
2847 # is not unsupported. This is valid on all known static and
2848 # shared platforms.
2849 if test "$hardcode_direct" != unsupported; then
2850 test -n "$old_library" && linklib="$old_library"
2851 compile_deplibs="$dir/$linklib $compile_deplibs"
2852 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2853 else
2854 compile_deplibs="-l$name -L$dir $compile_deplibs"
2855 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2857 elif test "$build_libtool_libs" = yes; then
2858 # Not a shared library
2859 if test "$deplibs_check_method" != pass_all; then
2860 # We're trying link a shared library against a static one
2861 # but the system doesn't support it.
2863 # Just print a warning and add the library to dependency_libs so
2864 # that the program can be linked against the static library.
2865 $echo
2866 $echo "*** Warning: This system can not link to static lib archive $lib."
2867 $echo "*** I have the capability to make that library automatically link in when"
2868 $echo "*** you link to this library. But I can only do this if you have a"
2869 $echo "*** shared version of the library, which you do not appear to have."
2870 if test "$module" = yes; then
2871 $echo "*** But as you try to build a module library, libtool will still create "
2872 $echo "*** a static module, that should work as long as the dlopening application"
2873 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2874 if test -z "$global_symbol_pipe"; then
2875 $echo
2876 $echo "*** However, this would only work if libtool was able to extract symbol"
2877 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2878 $echo "*** not find such a program. So, this module is probably useless."
2879 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2881 if test "$build_old_libs" = no; then
2882 build_libtool_libs=module
2883 build_old_libs=yes
2884 else
2885 build_libtool_libs=no
2888 else
2889 deplibs="$dir/$old_library $deplibs"
2890 link_static=yes
2892 fi # link shared/static library?
2894 if test "$linkmode" = lib; then
2895 if test -n "$dependency_libs" &&
2896 { test "$hardcode_into_libs" != yes ||
2897 test "$build_old_libs" = yes ||
2898 test "$link_static" = yes; }; then
2899 # Extract -R from dependency_libs
2900 temp_deplibs=
2901 for libdir in $dependency_libs; do
2902 case $libdir in
2903 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2904 case " $xrpath " in
2905 *" $temp_xrpath "*) ;;
2906 *) xrpath="$xrpath $temp_xrpath";;
2907 esac;;
2908 *) temp_deplibs="$temp_deplibs $libdir";;
2909 esac
2910 done
2911 dependency_libs="$temp_deplibs"
2914 newlib_search_path="$newlib_search_path $absdir"
2915 # Link against this library
2916 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2917 # ... and its dependency_libs
2918 tmp_libs=
2919 for deplib in $dependency_libs; do
2920 newdependency_libs="$deplib $newdependency_libs"
2921 if test "X$duplicate_deps" = "Xyes" ; then
2922 case "$tmp_libs " in
2923 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2924 esac
2926 tmp_libs="$tmp_libs $deplib"
2927 done
2929 if test "$link_all_deplibs" != no; then
2930 # Add the search paths of all dependency libraries
2931 for deplib in $dependency_libs; do
2932 case $deplib in
2933 -L*) path="$deplib" ;;
2934 *.la)
2935 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2936 test "X$dir" = "X$deplib" && dir="."
2937 # We need an absolute path.
2938 case $dir in
2939 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2941 absdir=`cd "$dir" && pwd`
2942 if test -z "$absdir"; then
2943 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2944 absdir="$dir"
2947 esac
2948 if grep "^installed=no" $deplib > /dev/null; then
2949 path="$absdir/$objdir"
2950 else
2951 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2952 if test -z "$libdir"; then
2953 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2954 exit $EXIT_FAILURE
2956 if test "$absdir" != "$libdir"; then
2957 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2959 path="$absdir"
2961 depdepl=
2962 case $host in
2963 *-*-darwin*)
2964 # we do not want to link against static libs,
2965 # but need to link against shared
2966 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2967 eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2968 if test -n "$deplibrary_names" ; then
2969 for tmp in $deplibrary_names ; do
2970 depdepl=$tmp
2971 done
2972 if test -f "$deplibdir/$depdepl" ; then
2973 depdepl="$deplibdir/$depdepl"
2974 elif test -f "$path/$depdepl" ; then
2975 depdepl="$path/$depdepl"
2976 else
2977 # Can't find it, oh well...
2978 depdepl=
2980 # do not add paths which are already there
2981 case " $newlib_search_path " in
2982 *" $path "*) ;;
2983 *) newlib_search_path="$newlib_search_path $path";;
2984 esac
2986 path=""
2989 path="-L$path"
2991 esac
2993 -l*)
2994 case $host in
2995 *-*-darwin*)
2996 # Again, we only want to link against shared libraries
2997 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2998 for tmp in $newlib_search_path ; do
2999 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3000 eval depdepl="$tmp/lib$tmp_libs.dylib"
3001 break
3003 done
3004 path=""
3006 *) continue ;;
3007 esac
3009 *) continue ;;
3010 esac
3011 case " $deplibs " in
3012 *" $path "*) ;;
3013 *) deplibs="$path $deplibs" ;;
3014 esac
3015 case " $deplibs " in
3016 *" $depdepl "*) ;;
3017 *) deplibs="$depdepl $deplibs" ;;
3018 esac
3019 done
3020 fi # link_all_deplibs != no
3021 fi # linkmode = lib
3022 done # for deplib in $libs
3023 dependency_libs="$newdependency_libs"
3024 if test "$pass" = dlpreopen; then
3025 # Link the dlpreopened libraries before other libraries
3026 for deplib in $save_deplibs; do
3027 deplibs="$deplib $deplibs"
3028 done
3030 if test "$pass" != dlopen; then
3031 if test "$pass" != conv; then
3032 # Make sure lib_search_path contains only unique directories.
3033 lib_search_path=
3034 for dir in $newlib_search_path; do
3035 case "$lib_search_path " in
3036 *" $dir "*) ;;
3037 *) lib_search_path="$lib_search_path $dir" ;;
3038 esac
3039 done
3040 newlib_search_path=
3043 if test "$linkmode,$pass" != "prog,link"; then
3044 vars="deplibs"
3045 else
3046 vars="compile_deplibs finalize_deplibs"
3048 for var in $vars dependency_libs; do
3049 # Add libraries to $var in reverse order
3050 eval tmp_libs=\"\$$var\"
3051 new_libs=
3052 for deplib in $tmp_libs; do
3053 # FIXME: Pedantically, this is the right thing to do, so
3054 # that some nasty dependency loop isn't accidentally
3055 # broken:
3056 #new_libs="$deplib $new_libs"
3057 # Pragmatically, this seems to cause very few problems in
3058 # practice:
3059 case $deplib in
3060 -L*) new_libs="$deplib $new_libs" ;;
3061 -R*) ;;
3063 # And here is the reason: when a library appears more
3064 # than once as an explicit dependence of a library, or
3065 # is implicitly linked in more than once by the
3066 # compiler, it is considered special, and multiple
3067 # occurrences thereof are not removed. Compare this
3068 # with having the same library being listed as a
3069 # dependency of multiple other libraries: in this case,
3070 # we know (pedantically, we assume) the library does not
3071 # need to be listed more than once, so we keep only the
3072 # last copy. This is not always right, but it is rare
3073 # enough that we require users that really mean to play
3074 # such unportable linking tricks to link the library
3075 # using -Wl,-lname, so that libtool does not consider it
3076 # for duplicate removal.
3077 case " $specialdeplibs " in
3078 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3080 case " $new_libs " in
3081 *" $deplib "*) ;;
3082 *) new_libs="$deplib $new_libs" ;;
3083 esac
3085 esac
3087 esac
3088 done
3089 tmp_libs=
3090 for deplib in $new_libs; do
3091 case $deplib in
3092 -L*)
3093 case " $tmp_libs " in
3094 *" $deplib "*) ;;
3095 *) tmp_libs="$tmp_libs $deplib" ;;
3096 esac
3098 *) tmp_libs="$tmp_libs $deplib" ;;
3099 esac
3100 done
3101 eval $var=\"$tmp_libs\"
3102 done # for var
3104 # Last step: remove runtime libs from dependency_libs
3105 # (they stay in deplibs)
3106 tmp_libs=
3107 for i in $dependency_libs ; do
3108 case " $predeps $postdeps $compiler_lib_search_path " in
3109 *" $i "*)
3110 i=""
3112 esac
3113 if test -n "$i" ; then
3114 tmp_libs="$tmp_libs $i"
3116 done
3117 dependency_libs=$tmp_libs
3118 done # for pass
3119 if test "$linkmode" = prog; then
3120 dlfiles="$newdlfiles"
3121 dlprefiles="$newdlprefiles"
3124 case $linkmode in
3125 oldlib)
3126 case " $deplibs" in
3127 *\ -l* | *\ -L*)
3128 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
3129 esac
3131 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3132 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3135 if test -n "$rpath"; then
3136 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3139 if test -n "$xrpath"; then
3140 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3143 if test -n "$vinfo"; then
3144 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3147 if test -n "$release"; then
3148 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3151 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3152 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3155 # Now set the variables for building old libraries.
3156 build_libtool_libs=no
3157 oldlibs="$output"
3158 objs="$objs$old_deplibs"
3161 lib)
3162 # Make sure we only generate libraries of the form `libNAME.la'.
3163 case $outputname in
3164 lib*)
3165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3166 eval shared_ext=\"$shrext_cmds\"
3167 eval libname=\"$libname_spec\"
3170 if test "$module" = no; then
3171 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3172 $echo "$help" 1>&2
3173 exit $EXIT_FAILURE
3175 if test "$need_lib_prefix" != no; then
3176 # Add the "lib" prefix for modules if required
3177 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3178 eval shared_ext=\"$shrext_cmds\"
3179 eval libname=\"$libname_spec\"
3180 else
3181 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3184 esac
3186 if test -n "$objs"; then
3187 if test "$deplibs_check_method" != pass_all; then
3188 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3189 exit $EXIT_FAILURE
3190 else
3191 $echo
3192 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3193 $echo "*** objects $objs is not portable!"
3194 libobjs="$libobjs $objs"
3198 if test "$dlself" != no; then
3199 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3202 set dummy $rpath
3203 if test "$#" -gt 2; then
3204 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3206 install_libdir="$2"
3208 oldlibs=
3209 if test -z "$rpath"; then
3210 if test "$build_libtool_libs" = yes; then
3211 # Building a libtool convenience library.
3212 # Some compilers have problems with a `.al' extension so
3213 # convenience libraries should have the same extension an
3214 # archive normally would.
3215 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3216 build_libtool_libs=convenience
3217 build_old_libs=yes
3220 if test -n "$vinfo"; then
3221 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3224 if test -n "$release"; then
3225 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3227 else
3229 # Parse the version information argument.
3230 save_ifs="$IFS"; IFS=':'
3231 set dummy $vinfo 0 0 0
3232 IFS="$save_ifs"
3234 if test -n "$8"; then
3235 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3236 $echo "$help" 1>&2
3237 exit $EXIT_FAILURE
3240 # convert absolute version numbers to libtool ages
3241 # this retains compatibility with .la files and attempts
3242 # to make the code below a bit more comprehensible
3244 case $vinfo_number in
3245 yes)
3246 number_major="$2"
3247 number_minor="$3"
3248 number_revision="$4"
3250 # There are really only two kinds -- those that
3251 # use the current revision as the major version
3252 # and those that subtract age and use age as
3253 # a minor version. But, then there is irix
3254 # which has an extra 1 added just for fun
3256 case $version_type in
3257 darwin|linux|osf|windows|none)
3258 current=`expr $number_major + $number_minor`
3259 age="$number_minor"
3260 revision="$number_revision"
3262 freebsd-aout|freebsd-elf|sunos)
3263 current="$number_major"
3264 revision="$number_minor"
3265 age="0"
3267 irix|nonstopux)
3268 current=`expr $number_major + $number_minor`
3269 age="$number_minor"
3270 revision="$number_minor"
3271 lt_irix_increment=no
3273 esac
3276 current="$2"
3277 revision="$3"
3278 age="$4"
3280 esac
3282 # Check that each of the things are valid numbers.
3283 case $current in
3284 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3286 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3287 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3288 exit $EXIT_FAILURE
3290 esac
3292 case $revision in
3293 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]) ;;
3295 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3296 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3297 exit $EXIT_FAILURE
3299 esac
3301 case $age in
3302 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]) ;;
3304 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3305 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3306 exit $EXIT_FAILURE
3308 esac
3310 if test "$age" -gt "$current"; then
3311 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3312 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3313 exit $EXIT_FAILURE
3316 # Calculate the version variables.
3317 major=
3318 versuffix=
3319 verstring=
3320 case $version_type in
3321 none) ;;
3323 darwin)
3324 # Like Linux, but with the current version available in
3325 # verstring for coding it into the library header
3326 major=.`expr $current - $age`
3327 versuffix="$major.$age.$revision"
3328 # Darwin ld doesn't like 0 for these options...
3329 minor_current=`expr $current + 1`
3330 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3331 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3334 freebsd-aout)
3335 major=".$current"
3336 versuffix=".$current.$revision";
3339 freebsd-elf)
3340 major=".$current"
3341 versuffix=".$current";
3344 irix | nonstopux)
3345 if test "X$lt_irix_increment" = "Xno"; then
3346 major=`expr $current - $age`
3347 else
3348 major=`expr $current - $age + 1`
3350 case $version_type in
3351 nonstopux) verstring_prefix=nonstopux ;;
3352 *) verstring_prefix=sgi ;;
3353 esac
3354 verstring="$verstring_prefix$major.$revision"
3356 # Add in all the interfaces that we are compatible with.
3357 loop=$revision
3358 while test "$loop" -ne 0; do
3359 iface=`expr $revision - $loop`
3360 loop=`expr $loop - 1`
3361 verstring="$verstring_prefix$major.$iface:$verstring"
3362 done
3364 # Before this point, $major must not contain `.'.
3365 major=.$major
3366 versuffix="$major.$revision"
3369 linux)
3370 major=.`expr $current - $age`
3371 versuffix="$major.$age.$revision"
3374 osf)
3375 major=.`expr $current - $age`
3376 versuffix=".$current.$age.$revision"
3377 verstring="$current.$age.$revision"
3379 # Add in all the interfaces that we are compatible with.
3380 loop=$age
3381 while test "$loop" -ne 0; do
3382 iface=`expr $current - $loop`
3383 loop=`expr $loop - 1`
3384 verstring="$verstring:${iface}.0"
3385 done
3387 # Make executables depend on our current version.
3388 verstring="$verstring:${current}.0"
3391 sunos)
3392 major=".$current"
3393 versuffix=".$current.$revision"
3396 windows)
3397 # Use '-' rather than '.', since we only want one
3398 # extension on DOS 8.3 filesystems.
3399 major=`expr $current - $age`
3400 versuffix="-$major"
3404 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3405 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3406 exit $EXIT_FAILURE
3408 esac
3410 # Clear the version info if we defaulted, and they specified a release.
3411 if test -z "$vinfo" && test -n "$release"; then
3412 major=
3413 case $version_type in
3414 darwin)
3415 # we can't check for "0.0" in archive_cmds due to quoting
3416 # problems, so we reset it completely
3417 verstring=
3420 verstring="0.0"
3422 esac
3423 if test "$need_version" = no; then
3424 versuffix=
3425 else
3426 versuffix=".0.0"
3430 # Remove version info from name if versioning should be avoided
3431 if test "$avoid_version" = yes && test "$need_version" = no; then
3432 major=
3433 versuffix=
3434 verstring=""
3437 # Check to see if the archive will have undefined symbols.
3438 if test "$allow_undefined" = yes; then
3439 if test "$allow_undefined_flag" = unsupported; then
3440 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3441 build_libtool_libs=no
3442 build_old_libs=yes
3444 else
3445 # Don't allow undefined symbols.
3446 allow_undefined_flag="$no_undefined_flag"
3450 if test "$mode" != relink; then
3451 # Remove our outputs, but don't remove object files since they
3452 # may have been created when compiling PIC objects.
3453 removelist=
3454 tempremovelist=`$echo "$output_objdir/*"`
3455 for p in $tempremovelist; do
3456 case $p in
3457 *.$objext)
3459 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3460 if test "X$precious_files_regex" != "X"; then
3461 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3462 then
3463 continue
3466 removelist="$removelist $p"
3468 *) ;;
3469 esac
3470 done
3471 if test -n "$removelist"; then
3472 $show "${rm}r $removelist"
3473 $run ${rm}r $removelist
3477 # Now set the variables for building old libraries.
3478 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3479 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3481 # Transform .lo files to .o files.
3482 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3485 # Eliminate all temporary directories.
3486 #for path in $notinst_path; do
3487 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3488 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3489 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3490 #done
3492 if test -n "$xrpath"; then
3493 # If the user specified any rpath flags, then add them.
3494 temp_xrpath=
3495 for libdir in $xrpath; do
3496 temp_xrpath="$temp_xrpath -R$libdir"
3497 case "$finalize_rpath " in
3498 *" $libdir "*) ;;
3499 *) finalize_rpath="$finalize_rpath $libdir" ;;
3500 esac
3501 done
3502 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3503 dependency_libs="$temp_xrpath $dependency_libs"
3507 # Make sure dlfiles contains only unique files that won't be dlpreopened
3508 old_dlfiles="$dlfiles"
3509 dlfiles=
3510 for lib in $old_dlfiles; do
3511 case " $dlprefiles $dlfiles " in
3512 *" $lib "*) ;;
3513 *) dlfiles="$dlfiles $lib" ;;
3514 esac
3515 done
3517 # Make sure dlprefiles contains only unique files
3518 old_dlprefiles="$dlprefiles"
3519 dlprefiles=
3520 for lib in $old_dlprefiles; do
3521 case "$dlprefiles " in
3522 *" $lib "*) ;;
3523 *) dlprefiles="$dlprefiles $lib" ;;
3524 esac
3525 done
3527 if test "$build_libtool_libs" = yes; then
3528 if test -n "$rpath"; then
3529 case $host in
3530 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3531 # these systems don't actually have a c library (as such)!
3533 *-*-rhapsody* | *-*-darwin1.[012])
3534 # Rhapsody C library is in the System framework
3535 deplibs="$deplibs -framework System"
3537 *-*-netbsd*)
3538 # Don't link with libc until the a.out ld.so is fixed.
3540 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3541 # Do not include libc due to us having libc/libc_r.
3543 *-*-sco3.2v5* | *-*-sco5v6*)
3544 # Causes problems with __ctype
3546 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3547 # Compiler inserts libc in the correct place for threads to work
3550 # Add libc to deplibs on all other systems if necessary.
3551 if test "$build_libtool_need_lc" = "yes"; then
3552 deplibs="$deplibs -lc"
3555 esac
3558 # Transform deplibs into only deplibs that can be linked in shared.
3559 name_save=$name
3560 libname_save=$libname
3561 release_save=$release
3562 versuffix_save=$versuffix
3563 major_save=$major
3564 # I'm not sure if I'm treating the release correctly. I think
3565 # release should show up in the -l (ie -lgmp5) so we don't want to
3566 # add it in twice. Is that correct?
3567 release=""
3568 versuffix=""
3569 major=""
3570 newdeplibs=
3571 droppeddeps=no
3572 case $deplibs_check_method in
3573 pass_all)
3574 # Don't check for shared/static. Everything works.
3575 # This might be a little naive. We might want to check
3576 # whether the library exists or not. But this is on
3577 # osf3 & osf4 and I'm not really sure... Just
3578 # implementing what was already the behavior.
3579 newdeplibs=$deplibs
3581 test_compile)
3582 # This code stresses the "libraries are programs" paradigm to its
3583 # limits. Maybe even breaks it. We compile a program, linking it
3584 # against the deplibs as a proxy for the library. Then we can check
3585 # whether they linked in statically or dynamically with ldd.
3586 $rm conftest.c
3587 cat > conftest.c <<EOF
3588 int main() { return 0; }
3590 $rm conftest
3591 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3592 ldd_output=`ldd conftest`
3593 for i in $deplibs; do
3594 name=`expr $i : '-l\(.*\)'`
3595 # If $name is empty we are operating on a -L argument.
3596 if test "$name" != "" && test "$name" != "0"; then
3597 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3598 case " $predeps $postdeps " in
3599 *" $i "*)
3600 newdeplibs="$newdeplibs $i"
3601 i=""
3603 esac
3605 if test -n "$i" ; then
3606 libname=`eval \\$echo \"$libname_spec\"`
3607 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3608 set dummy $deplib_matches
3609 deplib_match=$2
3610 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3611 newdeplibs="$newdeplibs $i"
3612 else
3613 droppeddeps=yes
3614 $echo
3615 $echo "*** Warning: dynamic linker does not accept needed library $i."
3616 $echo "*** I have the capability to make that library automatically link in when"
3617 $echo "*** you link to this library. But I can only do this if you have a"
3618 $echo "*** shared version of the library, which I believe you do not have"
3619 $echo "*** because a test_compile did reveal that the linker did not use it for"
3620 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3623 else
3624 newdeplibs="$newdeplibs $i"
3626 done
3627 else
3628 # Error occurred in the first compile. Let's try to salvage
3629 # the situation: Compile a separate program for each library.
3630 for i in $deplibs; do
3631 name=`expr $i : '-l\(.*\)'`
3632 # If $name is empty we are operating on a -L argument.
3633 if test "$name" != "" && test "$name" != "0"; then
3634 $rm conftest
3635 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3636 ldd_output=`ldd conftest`
3637 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3638 case " $predeps $postdeps " in
3639 *" $i "*)
3640 newdeplibs="$newdeplibs $i"
3641 i=""
3643 esac
3645 if test -n "$i" ; then
3646 libname=`eval \\$echo \"$libname_spec\"`
3647 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3648 set dummy $deplib_matches
3649 deplib_match=$2
3650 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3651 newdeplibs="$newdeplibs $i"
3652 else
3653 droppeddeps=yes
3654 $echo
3655 $echo "*** Warning: dynamic linker does not accept needed library $i."
3656 $echo "*** I have the capability to make that library automatically link in when"
3657 $echo "*** you link to this library. But I can only do this if you have a"
3658 $echo "*** shared version of the library, which you do not appear to have"
3659 $echo "*** because a test_compile did reveal that the linker did not use this one"
3660 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3663 else
3664 droppeddeps=yes
3665 $echo
3666 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3667 $echo "*** make it link in! You will probably need to install it or some"
3668 $echo "*** library that it depends on before this library will be fully"
3669 $echo "*** functional. Installing it before continuing would be even better."
3671 else
3672 newdeplibs="$newdeplibs $i"
3674 done
3677 file_magic*)
3678 set dummy $deplibs_check_method
3679 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3680 for a_deplib in $deplibs; do
3681 name=`expr $a_deplib : '-l\(.*\)'`
3682 # If $name is empty we are operating on a -L argument.
3683 if test "$name" != "" && test "$name" != "0"; then
3684 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3685 case " $predeps $postdeps " in
3686 *" $a_deplib "*)
3687 newdeplibs="$newdeplibs $a_deplib"
3688 a_deplib=""
3690 esac
3692 if test -n "$a_deplib" ; then
3693 libname=`eval \\$echo \"$libname_spec\"`
3694 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3695 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3696 for potent_lib in $potential_libs; do
3697 # Follow soft links.
3698 if ls -lLd "$potent_lib" 2>/dev/null \
3699 | grep " -> " >/dev/null; then
3700 continue
3702 # The statement above tries to avoid entering an
3703 # endless loop below, in case of cyclic links.
3704 # We might still enter an endless loop, since a link
3705 # loop can be closed while we follow links,
3706 # but so what?
3707 potlib="$potent_lib"
3708 while test -h "$potlib" 2>/dev/null; do
3709 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3710 case $potliblink in
3711 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3712 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3713 esac
3714 done
3715 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3716 | ${SED} 10q \
3717 | $EGREP "$file_magic_regex" > /dev/null; then
3718 newdeplibs="$newdeplibs $a_deplib"
3719 a_deplib=""
3720 break 2
3722 done
3723 done
3725 if test -n "$a_deplib" ; then
3726 droppeddeps=yes
3727 $echo
3728 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3729 $echo "*** I have the capability to make that library automatically link in when"
3730 $echo "*** you link to this library. But I can only do this if you have a"
3731 $echo "*** shared version of the library, which you do not appear to have"
3732 $echo "*** because I did check the linker path looking for a file starting"
3733 if test -z "$potlib" ; then
3734 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3735 else
3736 $echo "*** with $libname and none of the candidates passed a file format test"
3737 $echo "*** using a file magic. Last file checked: $potlib"
3740 else
3741 # Add a -L argument.
3742 newdeplibs="$newdeplibs $a_deplib"
3744 done # Gone through all deplibs.
3746 match_pattern*)
3747 set dummy $deplibs_check_method
3748 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3749 for a_deplib in $deplibs; do
3750 name=`expr $a_deplib : '-l\(.*\)'`
3751 # If $name is empty we are operating on a -L argument.
3752 if test -n "$name" && test "$name" != "0"; then
3753 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3754 case " $predeps $postdeps " in
3755 *" $a_deplib "*)
3756 newdeplibs="$newdeplibs $a_deplib"
3757 a_deplib=""
3759 esac
3761 if test -n "$a_deplib" ; then
3762 libname=`eval \\$echo \"$libname_spec\"`
3763 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3764 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3765 for potent_lib in $potential_libs; do
3766 potlib="$potent_lib" # see symlink-check above in file_magic test
3767 if eval $echo \"$potent_lib\" 2>/dev/null \
3768 | ${SED} 10q \
3769 | $EGREP "$match_pattern_regex" > /dev/null; then
3770 newdeplibs="$newdeplibs $a_deplib"
3771 a_deplib=""
3772 break 2
3774 done
3775 done
3777 if test -n "$a_deplib" ; then
3778 droppeddeps=yes
3779 $echo
3780 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3781 $echo "*** I have the capability to make that library automatically link in when"
3782 $echo "*** you link to this library. But I can only do this if you have a"
3783 $echo "*** shared version of the library, which you do not appear to have"
3784 $echo "*** because I did check the linker path looking for a file starting"
3785 if test -z "$potlib" ; then
3786 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3787 else
3788 $echo "*** with $libname and none of the candidates passed a file format test"
3789 $echo "*** using a regex pattern. Last file checked: $potlib"
3792 else
3793 # Add a -L argument.
3794 newdeplibs="$newdeplibs $a_deplib"
3796 done # Gone through all deplibs.
3798 none | unknown | *)
3799 newdeplibs=""
3800 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3801 -e 's/ -[LR][^ ]*//g'`
3802 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3803 for i in $predeps $postdeps ; do
3804 # can't use Xsed below, because $i might contain '/'
3805 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3806 done
3808 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3809 | grep . >/dev/null; then
3810 $echo
3811 if test "X$deplibs_check_method" = "Xnone"; then
3812 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3813 else
3814 $echo "*** Warning: inter-library dependencies are not known to be supported."
3816 $echo "*** All declared inter-library dependencies are being dropped."
3817 droppeddeps=yes
3820 esac
3821 versuffix=$versuffix_save
3822 major=$major_save
3823 release=$release_save
3824 libname=$libname_save
3825 name=$name_save
3827 case $host in
3828 *-*-rhapsody* | *-*-darwin1.[012])
3829 # On Rhapsody replace the C library is the System framework
3830 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3832 esac
3834 if test "$droppeddeps" = yes; then
3835 if test "$module" = yes; then
3836 $echo
3837 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3838 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3839 $echo "*** a static module, that should work as long as the dlopening"
3840 $echo "*** application is linked with the -dlopen flag."
3841 if test -z "$global_symbol_pipe"; then
3842 $echo
3843 $echo "*** However, this would only work if libtool was able to extract symbol"
3844 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3845 $echo "*** not find such a program. So, this module is probably useless."
3846 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3848 if test "$build_old_libs" = no; then
3849 oldlibs="$output_objdir/$libname.$libext"
3850 build_libtool_libs=module
3851 build_old_libs=yes
3852 else
3853 build_libtool_libs=no
3855 else
3856 $echo "*** The inter-library dependencies that have been dropped here will be"
3857 $echo "*** automatically added whenever a program is linked with this library"
3858 $echo "*** or is declared to -dlopen it."
3860 if test "$allow_undefined" = no; then
3861 $echo
3862 $echo "*** Since this library must not contain undefined symbols,"
3863 $echo "*** because either the platform does not support them or"
3864 $echo "*** it was explicitly requested with -no-undefined,"
3865 $echo "*** libtool will only create a static version of it."
3866 if test "$build_old_libs" = no; then
3867 oldlibs="$output_objdir/$libname.$libext"
3868 build_libtool_libs=module
3869 build_old_libs=yes
3870 else
3871 build_libtool_libs=no
3876 # Done checking deplibs!
3877 deplibs=$newdeplibs
3881 # move library search paths that coincide with paths to not yet
3882 # installed libraries to the beginning of the library search list
3883 new_libs=
3884 for path in $notinst_path; do
3885 case " $new_libs " in
3886 *" -L$path/$objdir "*) ;;
3888 case " $deplibs " in
3889 *" -L$path/$objdir "*)
3890 new_libs="$new_libs -L$path/$objdir" ;;
3891 esac
3893 esac
3894 done
3895 for deplib in $deplibs; do
3896 case $deplib in
3897 -L*)
3898 case " $new_libs " in
3899 *" $deplib "*) ;;
3900 *) new_libs="$new_libs $deplib" ;;
3901 esac
3903 *) new_libs="$new_libs $deplib" ;;
3904 esac
3905 done
3906 deplibs="$new_libs"
3909 # All the library-specific variables (install_libdir is set above).
3910 library_names=
3911 old_library=
3912 dlname=
3914 # Test again, we may have decided not to build it any more
3915 if test "$build_libtool_libs" = yes; then
3916 if test "$hardcode_into_libs" = yes; then
3917 # Hardcode the library paths
3918 hardcode_libdirs=
3919 dep_rpath=
3920 rpath="$finalize_rpath"
3921 test "$mode" != relink && rpath="$compile_rpath$rpath"
3922 for libdir in $rpath; do
3923 if test -n "$hardcode_libdir_flag_spec"; then
3924 if test -n "$hardcode_libdir_separator"; then
3925 if test -z "$hardcode_libdirs"; then
3926 hardcode_libdirs="$libdir"
3927 else
3928 # Just accumulate the unique libdirs.
3929 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3930 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3933 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3935 esac
3937 else
3938 eval flag=\"$hardcode_libdir_flag_spec\"
3939 dep_rpath="$dep_rpath $flag"
3941 elif test -n "$runpath_var"; then
3942 case "$perm_rpath " in
3943 *" $libdir "*) ;;
3944 *) perm_rpath="$perm_rpath $libdir" ;;
3945 esac
3947 done
3948 # Substitute the hardcoded libdirs into the rpath.
3949 if test -n "$hardcode_libdir_separator" &&
3950 test -n "$hardcode_libdirs"; then
3951 libdir="$hardcode_libdirs"
3952 if test -n "$hardcode_libdir_flag_spec_ld"; then
3953 case $archive_cmds in
3954 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3955 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3956 esac
3957 else
3958 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3961 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3962 # We should set the runpath_var.
3963 rpath=
3964 for dir in $perm_rpath; do
3965 rpath="$rpath$dir:"
3966 done
3967 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3969 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3972 shlibpath="$finalize_shlibpath"
3973 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3974 if test -n "$shlibpath"; then
3975 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3978 # Get the real and link names of the library.
3979 eval shared_ext=\"$shrext_cmds\"
3980 eval library_names=\"$library_names_spec\"
3981 set dummy $library_names
3982 realname="$2"
3983 shift; shift
3985 if test -n "$soname_spec"; then
3986 eval soname=\"$soname_spec\"
3987 else
3988 soname="$realname"
3990 if test -z "$dlname"; then
3991 dlname=$soname
3994 lib="$output_objdir/$realname"
3995 linknames=
3996 for link
3998 linknames="$linknames $link"
3999 done
4001 # Use standard objects if they are pic
4002 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4004 # Prepare the list of exported symbols
4005 if test -z "$export_symbols"; then
4006 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4007 $show "generating symbol list for \`$libname.la'"
4008 export_symbols="$output_objdir/$libname.exp"
4009 $run $rm $export_symbols
4010 cmds=$export_symbols_cmds
4011 save_ifs="$IFS"; IFS='~'
4012 for cmd in $cmds; do
4013 IFS="$save_ifs"
4014 eval cmd=\"$cmd\"
4015 if len=`expr "X$cmd" : ".*"` &&
4016 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4017 $show "$cmd"
4018 $run eval "$cmd" || exit $?
4019 skipped_export=false
4020 else
4021 # The command line is too long to execute in one step.
4022 $show "using reloadable object file for export list..."
4023 skipped_export=:
4024 # Break out early, otherwise skipped_export may be
4025 # set to false by a later but shorter cmd.
4026 break
4028 done
4029 IFS="$save_ifs"
4030 if test -n "$export_symbols_regex"; then
4031 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4032 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4033 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4034 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4039 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4040 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4043 tmp_deplibs=
4044 for test_deplib in $deplibs; do
4045 case " $convenience " in
4046 *" $test_deplib "*) ;;
4048 tmp_deplibs="$tmp_deplibs $test_deplib"
4050 esac
4051 done
4052 deplibs="$tmp_deplibs"
4054 if test -n "$convenience"; then
4055 if test -n "$whole_archive_flag_spec"; then
4056 save_libobjs=$libobjs
4057 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4058 else
4059 gentop="$output_objdir/${outputname}x"
4060 generated="$generated $gentop"
4062 func_extract_archives $gentop $convenience
4063 libobjs="$libobjs $func_extract_archives_result"
4067 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4068 eval flag=\"$thread_safe_flag_spec\"
4069 linker_flags="$linker_flags $flag"
4072 # Make a backup of the uninstalled library when relinking
4073 if test "$mode" = relink; then
4074 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4077 # Do each of the archive commands.
4078 if test "$module" = yes && test -n "$module_cmds" ; then
4079 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4080 eval test_cmds=\"$module_expsym_cmds\"
4081 cmds=$module_expsym_cmds
4082 else
4083 eval test_cmds=\"$module_cmds\"
4084 cmds=$module_cmds
4086 else
4087 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4088 eval test_cmds=\"$archive_expsym_cmds\"
4089 cmds=$archive_expsym_cmds
4090 else
4091 eval test_cmds=\"$archive_cmds\"
4092 cmds=$archive_cmds
4096 if test "X$skipped_export" != "X:" &&
4097 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4098 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4100 else
4101 # The command line is too long to link in one step, link piecewise.
4102 $echo "creating reloadable object files..."
4104 # Save the value of $output and $libobjs because we want to
4105 # use them later. If we have whole_archive_flag_spec, we
4106 # want to use save_libobjs as it was before
4107 # whole_archive_flag_spec was expanded, because we can't
4108 # assume the linker understands whole_archive_flag_spec.
4109 # This may have to be revisited, in case too many
4110 # convenience libraries get linked in and end up exceeding
4111 # the spec.
4112 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4113 save_libobjs=$libobjs
4115 save_output=$output
4116 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4118 # Clear the reloadable object creation command queue and
4119 # initialize k to one.
4120 test_cmds=
4121 concat_cmds=
4122 objlist=
4123 delfiles=
4124 last_robj=
4126 output=$output_objdir/$output_la-${k}.$objext
4127 # Loop over the list of objects to be linked.
4128 for obj in $save_libobjs
4130 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4131 if test "X$objlist" = X ||
4132 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4133 test "$len" -le "$max_cmd_len"; }; then
4134 objlist="$objlist $obj"
4135 else
4136 # The command $test_cmds is almost too long, add a
4137 # command to the queue.
4138 if test "$k" -eq 1 ; then
4139 # The first file doesn't have a previous command to add.
4140 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4141 else
4142 # All subsequent reloadable object files will link in
4143 # the last one created.
4144 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4146 last_robj=$output_objdir/$output_la-${k}.$objext
4147 k=`expr $k + 1`
4148 output=$output_objdir/$output_la-${k}.$objext
4149 objlist=$obj
4150 len=1
4152 done
4153 # Handle the remaining objects by creating one last
4154 # reloadable object file. All subsequent reloadable object
4155 # files will link in the last one created.
4156 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4157 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4159 if ${skipped_export-false}; then
4160 $show "generating symbol list for \`$libname.la'"
4161 export_symbols="$output_objdir/$libname.exp"
4162 $run $rm $export_symbols
4163 libobjs=$output
4164 # Append the command to create the export file.
4165 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4168 # Set up a command to remove the reloadable object files
4169 # after they are used.
4171 while test "$i" -lt "$k"
4173 i=`expr $i + 1`
4174 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4175 done
4177 $echo "creating a temporary reloadable object file: $output"
4179 # Loop through the commands generated above and execute them.
4180 save_ifs="$IFS"; IFS='~'
4181 for cmd in $concat_cmds; do
4182 IFS="$save_ifs"
4183 $show "$cmd"
4184 $run eval "$cmd" || exit $?
4185 done
4186 IFS="$save_ifs"
4188 libobjs=$output
4189 # Restore the value of output.
4190 output=$save_output
4192 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4193 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4195 # Expand the library linking commands again to reset the
4196 # value of $libobjs for piecewise linking.
4198 # Do each of the archive commands.
4199 if test "$module" = yes && test -n "$module_cmds" ; then
4200 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4201 cmds=$module_expsym_cmds
4202 else
4203 cmds=$module_cmds
4205 else
4206 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4207 cmds=$archive_expsym_cmds
4208 else
4209 cmds=$archive_cmds
4213 # Append the command to remove the reloadable object files
4214 # to the just-reset $cmds.
4215 eval cmds=\"\$cmds~\$rm $delfiles\"
4217 save_ifs="$IFS"; IFS='~'
4218 for cmd in $cmds; do
4219 IFS="$save_ifs"
4220 eval cmd=\"$cmd\"
4221 $show "$cmd"
4222 $run eval "$cmd" || {
4223 lt_exit=$?
4225 # Restore the uninstalled library and exit
4226 if test "$mode" = relink; then
4227 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4230 exit $lt_exit
4232 done
4233 IFS="$save_ifs"
4235 # Restore the uninstalled library and exit
4236 if test "$mode" = relink; then
4237 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4239 if test -n "$convenience"; then
4240 if test -z "$whole_archive_flag_spec"; then
4241 $show "${rm}r $gentop"
4242 $run ${rm}r "$gentop"
4246 exit $EXIT_SUCCESS
4249 # Create links to the real library.
4250 for linkname in $linknames; do
4251 if test "$realname" != "$linkname"; then
4252 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4253 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4255 done
4257 # If -module or -export-dynamic was specified, set the dlname.
4258 if test "$module" = yes || test "$export_dynamic" = yes; then
4259 # On all known operating systems, these are identical.
4260 dlname="$soname"
4265 obj)
4266 case " $deplibs" in
4267 *\ -l* | *\ -L*)
4268 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
4269 esac
4271 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4272 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4275 if test -n "$rpath"; then
4276 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4279 if test -n "$xrpath"; then
4280 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4283 if test -n "$vinfo"; then
4284 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4287 if test -n "$release"; then
4288 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4291 case $output in
4292 *.lo)
4293 if test -n "$objs$old_deplibs"; then
4294 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4295 exit $EXIT_FAILURE
4297 libobj="$output"
4298 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4301 libobj=
4302 obj="$output"
4304 esac
4306 # Delete the old objects.
4307 $run $rm $obj $libobj
4309 # Objects from convenience libraries. This assumes
4310 # single-version convenience libraries. Whenever we create
4311 # different ones for PIC/non-PIC, this we'll have to duplicate
4312 # the extraction.
4313 reload_conv_objs=
4314 gentop=
4315 # reload_cmds runs $LD directly, so let us get rid of
4316 # -Wl from whole_archive_flag_spec and hope we can get by with
4317 # turning comma into space..
4320 if test -n "$convenience"; then
4321 if test -n "$whole_archive_flag_spec"; then
4322 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4323 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4324 else
4325 gentop="$output_objdir/${obj}x"
4326 generated="$generated $gentop"
4328 func_extract_archives $gentop $convenience
4329 reload_conv_objs="$reload_objs $func_extract_archives_result"
4333 # Create the old-style object.
4334 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
4336 output="$obj"
4337 cmds=$reload_cmds
4338 save_ifs="$IFS"; IFS='~'
4339 for cmd in $cmds; do
4340 IFS="$save_ifs"
4341 eval cmd=\"$cmd\"
4342 $show "$cmd"
4343 $run eval "$cmd" || exit $?
4344 done
4345 IFS="$save_ifs"
4347 # Exit if we aren't doing a library object file.
4348 if test -z "$libobj"; then
4349 if test -n "$gentop"; then
4350 $show "${rm}r $gentop"
4351 $run ${rm}r $gentop
4354 exit $EXIT_SUCCESS
4357 if test "$build_libtool_libs" != yes; then
4358 if test -n "$gentop"; then
4359 $show "${rm}r $gentop"
4360 $run ${rm}r $gentop
4363 # Create an invalid libtool object if no PIC, so that we don't
4364 # accidentally link it into a program.
4365 # $show "echo timestamp > $libobj"
4366 # $run eval "echo timestamp > $libobj" || exit $?
4367 exit $EXIT_SUCCESS
4370 if test -n "$pic_flag" || test "$pic_mode" != default; then
4371 # Only do commands if we really have different PIC objects.
4372 reload_objs="$libobjs $reload_conv_objs"
4373 output="$libobj"
4374 cmds=$reload_cmds
4375 save_ifs="$IFS"; IFS='~'
4376 for cmd in $cmds; do
4377 IFS="$save_ifs"
4378 eval cmd=\"$cmd\"
4379 $show "$cmd"
4380 $run eval "$cmd" || exit $?
4381 done
4382 IFS="$save_ifs"
4385 if test -n "$gentop"; then
4386 $show "${rm}r $gentop"
4387 $run ${rm}r $gentop
4390 exit $EXIT_SUCCESS
4393 prog)
4394 case $host in
4395 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4396 esac
4397 if test -n "$vinfo"; then
4398 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4401 if test -n "$release"; then
4402 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4405 if test "$preload" = yes; then
4406 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4407 test "$dlopen_self_static" = unknown; then
4408 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4412 case $host in
4413 *-*-rhapsody* | *-*-darwin1.[012])
4414 # On Rhapsody replace the C library is the System framework
4415 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4416 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4418 esac
4420 case $host in
4421 *darwin*)
4422 # Don't allow lazy linking, it breaks C++ global constructors
4423 if test "$tagname" = CXX ; then
4424 compile_command="$compile_command ${wl}-bind_at_load"
4425 finalize_command="$finalize_command ${wl}-bind_at_load"
4428 esac
4431 # move library search paths that coincide with paths to not yet
4432 # installed libraries to the beginning of the library search list
4433 new_libs=
4434 for path in $notinst_path; do
4435 case " $new_libs " in
4436 *" -L$path/$objdir "*) ;;
4438 case " $compile_deplibs " in
4439 *" -L$path/$objdir "*)
4440 new_libs="$new_libs -L$path/$objdir" ;;
4441 esac
4443 esac
4444 done
4445 for deplib in $compile_deplibs; do
4446 case $deplib in
4447 -L*)
4448 case " $new_libs " in
4449 *" $deplib "*) ;;
4450 *) new_libs="$new_libs $deplib" ;;
4451 esac
4453 *) new_libs="$new_libs $deplib" ;;
4454 esac
4455 done
4456 compile_deplibs="$new_libs"
4459 compile_command="$compile_command $compile_deplibs"
4460 finalize_command="$finalize_command $finalize_deplibs"
4462 if test -n "$rpath$xrpath"; then
4463 # If the user specified any rpath flags, then add them.
4464 for libdir in $rpath $xrpath; do
4465 # This is the magic to use -rpath.
4466 case "$finalize_rpath " in
4467 *" $libdir "*) ;;
4468 *) finalize_rpath="$finalize_rpath $libdir" ;;
4469 esac
4470 done
4473 # Now hardcode the library paths
4474 rpath=
4475 hardcode_libdirs=
4476 for libdir in $compile_rpath $finalize_rpath; do
4477 if test -n "$hardcode_libdir_flag_spec"; then
4478 if test -n "$hardcode_libdir_separator"; then
4479 if test -z "$hardcode_libdirs"; then
4480 hardcode_libdirs="$libdir"
4481 else
4482 # Just accumulate the unique libdirs.
4483 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4484 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4487 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4489 esac
4491 else
4492 eval flag=\"$hardcode_libdir_flag_spec\"
4493 rpath="$rpath $flag"
4495 elif test -n "$runpath_var"; then
4496 case "$perm_rpath " in
4497 *" $libdir "*) ;;
4498 *) perm_rpath="$perm_rpath $libdir" ;;
4499 esac
4501 case $host in
4502 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4503 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4504 case :$dllsearchpath: in
4505 *":$libdir:"*) ;;
4506 *) dllsearchpath="$dllsearchpath:$libdir";;
4507 esac
4508 case :$dllsearchpath: in
4509 *":$testbindir:"*) ;;
4510 *) dllsearchpath="$dllsearchpath:$testbindir";;
4511 esac
4513 esac
4514 done
4515 # Substitute the hardcoded libdirs into the rpath.
4516 if test -n "$hardcode_libdir_separator" &&
4517 test -n "$hardcode_libdirs"; then
4518 libdir="$hardcode_libdirs"
4519 eval rpath=\" $hardcode_libdir_flag_spec\"
4521 compile_rpath="$rpath"
4523 rpath=
4524 hardcode_libdirs=
4525 for libdir in $finalize_rpath; do
4526 if test -n "$hardcode_libdir_flag_spec"; then
4527 if test -n "$hardcode_libdir_separator"; then
4528 if test -z "$hardcode_libdirs"; then
4529 hardcode_libdirs="$libdir"
4530 else
4531 # Just accumulate the unique libdirs.
4532 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4533 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4536 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4538 esac
4540 else
4541 eval flag=\"$hardcode_libdir_flag_spec\"
4542 rpath="$rpath $flag"
4544 elif test -n "$runpath_var"; then
4545 case "$finalize_perm_rpath " in
4546 *" $libdir "*) ;;
4547 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4548 esac
4550 done
4551 # Substitute the hardcoded libdirs into the rpath.
4552 if test -n "$hardcode_libdir_separator" &&
4553 test -n "$hardcode_libdirs"; then
4554 libdir="$hardcode_libdirs"
4555 eval rpath=\" $hardcode_libdir_flag_spec\"
4557 finalize_rpath="$rpath"
4559 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4560 # Transform all the library objects into standard objects.
4561 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4562 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4565 dlsyms=
4566 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4567 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4568 dlsyms="${outputname}S.c"
4569 else
4570 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4574 if test -n "$dlsyms"; then
4575 case $dlsyms in
4576 "") ;;
4577 *.c)
4578 # Discover the nlist of each of the dlfiles.
4579 nlist="$output_objdir/${outputname}.nm"
4581 $show "$rm $nlist ${nlist}S ${nlist}T"
4582 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4584 # Parse the name list into a source file.
4585 $show "creating $output_objdir/$dlsyms"
4587 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4588 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4589 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4591 #ifdef __cplusplus
4592 extern \"C\" {
4593 #endif
4595 /* Prevent the only kind of declaration conflicts we can make. */
4596 #define lt_preloaded_symbols some_other_symbol
4598 /* External symbol declarations for the compiler. */\
4601 if test "$dlself" = yes; then
4602 $show "generating symbol list for \`$output'"
4604 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4606 # Add our own program objects to the symbol list.
4607 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4608 for arg in $progfiles; do
4609 $show "extracting global C symbols from \`$arg'"
4610 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4611 done
4613 if test -n "$exclude_expsyms"; then
4614 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4615 $run eval '$mv "$nlist"T "$nlist"'
4618 if test -n "$export_symbols_regex"; then
4619 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4620 $run eval '$mv "$nlist"T "$nlist"'
4623 # Prepare the list of exported symbols
4624 if test -z "$export_symbols"; then
4625 export_symbols="$output_objdir/$outputname.exp"
4626 $run $rm $export_symbols
4627 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4628 case $host in
4629 *cygwin* | *mingw* )
4630 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4631 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4633 esac
4634 else
4635 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4636 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4637 $run eval 'mv "$nlist"T "$nlist"'
4638 case $host in
4639 *cygwin* | *mingw* )
4640 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4641 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4643 esac
4647 for arg in $dlprefiles; do
4648 $show "extracting global C symbols from \`$arg'"
4649 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4650 $run eval '$echo ": $name " >> "$nlist"'
4651 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4652 done
4654 if test -z "$run"; then
4655 # Make sure we have at least an empty file.
4656 test -f "$nlist" || : > "$nlist"
4658 if test -n "$exclude_expsyms"; then
4659 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4660 $mv "$nlist"T "$nlist"
4663 # Try sorting and uniquifying the output.
4664 if grep -v "^: " < "$nlist" |
4665 if sort -k 3 </dev/null >/dev/null 2>&1; then
4666 sort -k 3
4667 else
4668 sort +2
4669 fi |
4670 uniq > "$nlist"S; then
4672 else
4673 grep -v "^: " < "$nlist" > "$nlist"S
4676 if test -f "$nlist"S; then
4677 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4678 else
4679 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4682 $echo >> "$output_objdir/$dlsyms" "\
4684 #undef lt_preloaded_symbols
4686 #if defined (__STDC__) && __STDC__
4687 # define lt_ptr void *
4688 #else
4689 # define lt_ptr char *
4690 # define const
4691 #endif
4693 /* The mapping between symbol names and symbols. */
4696 case $host in
4697 *cygwin* | *mingw* )
4698 $echo >> "$output_objdir/$dlsyms" "\
4699 /* DATA imports from DLLs on WIN32 can't be const, because
4700 runtime relocations are performed -- see ld's documentation
4701 on pseudo-relocs */
4702 struct {
4706 $echo >> "$output_objdir/$dlsyms" "\
4707 const struct {
4710 esac
4713 $echo >> "$output_objdir/$dlsyms" "\
4714 const char *name;
4715 lt_ptr address;
4717 lt_preloaded_symbols[] =
4721 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4723 $echo >> "$output_objdir/$dlsyms" "\
4724 {0, (lt_ptr) 0}
4727 /* This works around a problem in FreeBSD linker */
4728 #ifdef FREEBSD_WORKAROUND
4729 static const void *lt_preloaded_setup() {
4730 return lt_preloaded_symbols;
4732 #endif
4734 #ifdef __cplusplus
4736 #endif\
4740 pic_flag_for_symtable=
4741 case $host in
4742 # compiling the symbol table file with pic_flag works around
4743 # a FreeBSD bug that causes programs to crash when -lm is
4744 # linked before any other PIC object. But we must not use
4745 # pic_flag when linking with -static. The problem exists in
4746 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4747 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4748 case "$compile_command " in
4749 *" -static "*) ;;
4750 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4751 esac;;
4752 *-*-hpux*)
4753 case "$compile_command " in
4754 *" -static "*) ;;
4755 *) pic_flag_for_symtable=" $pic_flag";;
4756 esac
4757 esac
4759 # Now compile the dynamic symbol file.
4760 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4761 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4763 # Clean up the generated files.
4764 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4765 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4767 # Transform the symbol file into the correct name.
4768 case $host in
4769 *cygwin* | *mingw* )
4770 if test -f "$output_objdir/${outputname}.def" ; then
4771 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4772 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4773 else
4774 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4775 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4779 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4780 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4782 esac
4785 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4786 exit $EXIT_FAILURE
4788 esac
4789 else
4790 # We keep going just in case the user didn't refer to
4791 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4792 # really was required.
4794 # Nullify the symbol file.
4795 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4796 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4799 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4800 # Replace the output file specification.
4801 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4802 link_command="$compile_command$compile_rpath"
4804 # We have no uninstalled library dependencies, so finalize right now.
4805 $show "$link_command"
4806 $run eval "$link_command"
4807 exit_status=$?
4809 # Delete the generated files.
4810 if test -n "$dlsyms"; then
4811 $show "$rm $output_objdir/${outputname}S.${objext}"
4812 $run $rm "$output_objdir/${outputname}S.${objext}"
4815 exit $exit_status
4818 if test -n "$shlibpath_var"; then
4819 # We should set the shlibpath_var
4820 rpath=
4821 for dir in $temp_rpath; do
4822 case $dir in
4823 [\\/]* | [A-Za-z]:[\\/]*)
4824 # Absolute path.
4825 rpath="$rpath$dir:"
4828 # Relative path: add a thisdir entry.
4829 rpath="$rpath\$thisdir/$dir:"
4831 esac
4832 done
4833 temp_rpath="$rpath"
4836 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4837 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4839 if test -n "$finalize_shlibpath"; then
4840 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4843 compile_var=
4844 finalize_var=
4845 if test -n "$runpath_var"; then
4846 if test -n "$perm_rpath"; then
4847 # We should set the runpath_var.
4848 rpath=
4849 for dir in $perm_rpath; do
4850 rpath="$rpath$dir:"
4851 done
4852 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4854 if test -n "$finalize_perm_rpath"; then
4855 # We should set the runpath_var.
4856 rpath=
4857 for dir in $finalize_perm_rpath; do
4858 rpath="$rpath$dir:"
4859 done
4860 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4864 if test "$no_install" = yes; then
4865 # We don't need to create a wrapper script.
4866 link_command="$compile_var$compile_command$compile_rpath"
4867 # Replace the output file specification.
4868 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4869 # Delete the old output file.
4870 $run $rm $output
4871 # Link the executable and exit
4872 $show "$link_command"
4873 $run eval "$link_command" || exit $?
4874 exit $EXIT_SUCCESS
4877 if test "$hardcode_action" = relink; then
4878 # Fast installation is not supported
4879 link_command="$compile_var$compile_command$compile_rpath"
4880 relink_command="$finalize_var$finalize_command$finalize_rpath"
4882 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4883 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4884 else
4885 if test "$fast_install" != no; then
4886 link_command="$finalize_var$compile_command$finalize_rpath"
4887 if test "$fast_install" = yes; then
4888 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4889 else
4890 # fast_install is set to needless
4891 relink_command=
4893 else
4894 link_command="$compile_var$compile_command$compile_rpath"
4895 relink_command="$finalize_var$finalize_command$finalize_rpath"
4899 # Replace the output file specification.
4900 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4902 # Delete the old output files.
4903 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4905 $show "$link_command"
4906 $run eval "$link_command" || exit $?
4908 # Now create the wrapper script.
4909 $show "creating $output"
4911 # Quote the relink command for shipping.
4912 if test -n "$relink_command"; then
4913 # Preserve any variables that may affect compiler behavior
4914 for var in $variables_saved_for_relink; do
4915 if eval test -z \"\${$var+set}\"; then
4916 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4917 elif eval var_value=\$$var; test -z "$var_value"; then
4918 relink_command="$var=; export $var; $relink_command"
4919 else
4920 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4921 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4923 done
4924 relink_command="(cd `pwd`; $relink_command)"
4925 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4928 # Quote $echo for shipping.
4929 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4930 case $progpath in
4931 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4932 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4933 esac
4934 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4935 else
4936 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4939 # Only actually do things if our run command is non-null.
4940 if test -z "$run"; then
4941 # win32 will think the script is a binary if it has
4942 # a .exe suffix, so we strip it off here.
4943 case $output in
4944 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4945 esac
4946 # test for cygwin because mv fails w/o .exe extensions
4947 case $host in
4948 *cygwin*)
4949 exeext=.exe
4950 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4951 *) exeext= ;;
4952 esac
4953 case $host in
4954 *cygwin* | *mingw* )
4955 output_name=`basename $output`
4956 output_path=`dirname $output`
4957 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4958 cwrapper="$output_path/$output_name.exe"
4959 $rm $cwrappersource $cwrapper
4960 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4962 cat > $cwrappersource <<EOF
4964 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4965 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4967 The $output program cannot be directly executed until all the libtool
4968 libraries that it depends on are installed.
4970 This wrapper executable should never be moved out of the build directory.
4971 If it is, it will not operate correctly.
4973 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4974 but could eventually absorb all of the scripts functionality and
4975 exec $objdir/$outputname directly.
4978 cat >> $cwrappersource<<"EOF"
4979 #include <stdio.h>
4980 #include <stdlib.h>
4981 #include <unistd.h>
4982 #include <malloc.h>
4983 #include <stdarg.h>
4984 #include <assert.h>
4985 #include <string.h>
4986 #include <ctype.h>
4987 #include <sys/stat.h>
4989 #if defined(PATH_MAX)
4990 # define LT_PATHMAX PATH_MAX
4991 #elif defined(MAXPATHLEN)
4992 # define LT_PATHMAX MAXPATHLEN
4993 #else
4994 # define LT_PATHMAX 1024
4995 #endif
4997 #ifndef DIR_SEPARATOR
4998 # define DIR_SEPARATOR '/'
4999 # define PATH_SEPARATOR ':'
5000 #endif
5002 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5003 defined (__OS2__)
5004 # define HAVE_DOS_BASED_FILE_SYSTEM
5005 # ifndef DIR_SEPARATOR_2
5006 # define DIR_SEPARATOR_2 '\\'
5007 # endif
5008 # ifndef PATH_SEPARATOR_2
5009 # define PATH_SEPARATOR_2 ';'
5010 # endif
5011 #endif
5013 #ifndef DIR_SEPARATOR_2
5014 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5015 #else /* DIR_SEPARATOR_2 */
5016 # define IS_DIR_SEPARATOR(ch) \
5017 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5018 #endif /* DIR_SEPARATOR_2 */
5020 #ifndef PATH_SEPARATOR_2
5021 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5022 #else /* PATH_SEPARATOR_2 */
5023 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5024 #endif /* PATH_SEPARATOR_2 */
5026 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5027 #define XFREE(stale) do { \
5028 if (stale) { free ((void *) stale); stale = 0; } \
5029 } while (0)
5031 /* -DDEBUG is fairly common in CFLAGS. */
5032 #undef DEBUG
5033 #if defined DEBUGWRAPPER
5034 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5035 #else
5036 # define DEBUG(format, ...)
5037 #endif
5039 const char *program_name = NULL;
5041 void * xmalloc (size_t num);
5042 char * xstrdup (const char *string);
5043 const char * base_name (const char *name);
5044 char * find_executable(const char *wrapper);
5045 int check_executable(const char *path);
5046 char * strendzap(char *str, const char *pat);
5047 void lt_fatal (const char *message, ...);
5050 main (int argc, char *argv[])
5052 char **newargz;
5053 int i;
5055 program_name = (char *) xstrdup (base_name (argv[0]));
5056 DEBUG("(main) argv[0] : %s\n",argv[0]);
5057 DEBUG("(main) program_name : %s\n",program_name);
5058 newargz = XMALLOC(char *, argc+2);
5061 cat >> $cwrappersource <<EOF
5062 newargz[0] = (char *) xstrdup("$SHELL");
5065 cat >> $cwrappersource <<"EOF"
5066 newargz[1] = find_executable(argv[0]);
5067 if (newargz[1] == NULL)
5068 lt_fatal("Couldn't find %s", argv[0]);
5069 DEBUG("(main) found exe at : %s\n",newargz[1]);
5070 /* we know the script has the same name, without the .exe */
5071 /* so make sure newargz[1] doesn't end in .exe */
5072 strendzap(newargz[1],".exe");
5073 for (i = 1; i < argc; i++)
5074 newargz[i+1] = xstrdup(argv[i]);
5075 newargz[argc+1] = NULL;
5077 for (i=0; i<argc+1; i++)
5079 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5085 case $host_os in
5086 mingw*)
5087 cat >> $cwrappersource <<EOF
5088 execv("$SHELL",(char const **)newargz);
5092 cat >> $cwrappersource <<EOF
5093 execv("$SHELL",newargz);
5096 esac
5098 cat >> $cwrappersource <<"EOF"
5099 return 127;
5102 void *
5103 xmalloc (size_t num)
5105 void * p = (void *) malloc (num);
5106 if (!p)
5107 lt_fatal ("Memory exhausted");
5109 return p;
5112 char *
5113 xstrdup (const char *string)
5115 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5119 const char *
5120 base_name (const char *name)
5122 const char *base;
5124 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5125 /* Skip over the disk name in MSDOS pathnames. */
5126 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5127 name += 2;
5128 #endif
5130 for (base = name; *name; name++)
5131 if (IS_DIR_SEPARATOR (*name))
5132 base = name + 1;
5133 return base;
5137 check_executable(const char * path)
5139 struct stat st;
5141 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5142 if ((!path) || (!*path))
5143 return 0;
5145 if ((stat (path, &st) >= 0) &&
5147 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5148 #if defined (S_IXOTH)
5149 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5150 #endif
5151 #if defined (S_IXGRP)
5152 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5153 #endif
5154 ((st.st_mode & S_IXUSR) == S_IXUSR))
5156 return 1;
5157 else
5158 return 0;
5161 /* Searches for the full path of the wrapper. Returns
5162 newly allocated full path name if found, NULL otherwise */
5163 char *
5164 find_executable (const char* wrapper)
5166 int has_slash = 0;
5167 const char* p;
5168 const char* p_next;
5169 /* static buffer for getcwd */
5170 char tmp[LT_PATHMAX + 1];
5171 int tmp_len;
5172 char* concat_name;
5174 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5176 if ((wrapper == NULL) || (*wrapper == '\0'))
5177 return NULL;
5179 /* Absolute path? */
5180 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5181 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5183 concat_name = xstrdup (wrapper);
5184 if (check_executable(concat_name))
5185 return concat_name;
5186 XFREE(concat_name);
5188 else
5190 #endif
5191 if (IS_DIR_SEPARATOR (wrapper[0]))
5193 concat_name = xstrdup (wrapper);
5194 if (check_executable(concat_name))
5195 return concat_name;
5196 XFREE(concat_name);
5198 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5200 #endif
5202 for (p = wrapper; *p; p++)
5203 if (*p == '/')
5205 has_slash = 1;
5206 break;
5208 if (!has_slash)
5210 /* no slashes; search PATH */
5211 const char* path = getenv ("PATH");
5212 if (path != NULL)
5214 for (p = path; *p; p = p_next)
5216 const char* q;
5217 size_t p_len;
5218 for (q = p; *q; q++)
5219 if (IS_PATH_SEPARATOR(*q))
5220 break;
5221 p_len = q - p;
5222 p_next = (*q == '\0' ? q : q + 1);
5223 if (p_len == 0)
5225 /* empty path: current directory */
5226 if (getcwd (tmp, LT_PATHMAX) == NULL)
5227 lt_fatal ("getcwd failed");
5228 tmp_len = strlen(tmp);
5229 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5230 memcpy (concat_name, tmp, tmp_len);
5231 concat_name[tmp_len] = '/';
5232 strcpy (concat_name + tmp_len + 1, wrapper);
5234 else
5236 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5237 memcpy (concat_name, p, p_len);
5238 concat_name[p_len] = '/';
5239 strcpy (concat_name + p_len + 1, wrapper);
5241 if (check_executable(concat_name))
5242 return concat_name;
5243 XFREE(concat_name);
5246 /* not found in PATH; assume curdir */
5248 /* Relative path | not found in path: prepend cwd */
5249 if (getcwd (tmp, LT_PATHMAX) == NULL)
5250 lt_fatal ("getcwd failed");
5251 tmp_len = strlen(tmp);
5252 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5253 memcpy (concat_name, tmp, tmp_len);
5254 concat_name[tmp_len] = '/';
5255 strcpy (concat_name + tmp_len + 1, wrapper);
5257 if (check_executable(concat_name))
5258 return concat_name;
5259 XFREE(concat_name);
5260 return NULL;
5263 char *
5264 strendzap(char *str, const char *pat)
5266 size_t len, patlen;
5268 assert(str != NULL);
5269 assert(pat != NULL);
5271 len = strlen(str);
5272 patlen = strlen(pat);
5274 if (patlen <= len)
5276 str += len - patlen;
5277 if (strcmp(str, pat) == 0)
5278 *str = '\0';
5280 return str;
5283 static void
5284 lt_error_core (int exit_status, const char * mode,
5285 const char * message, va_list ap)
5287 fprintf (stderr, "%s: %s: ", program_name, mode);
5288 vfprintf (stderr, message, ap);
5289 fprintf (stderr, ".\n");
5291 if (exit_status >= 0)
5292 exit (exit_status);
5295 void
5296 lt_fatal (const char *message, ...)
5298 va_list ap;
5299 va_start (ap, message);
5300 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5301 va_end (ap);
5304 # we should really use a build-platform specific compiler
5305 # here, but OTOH, the wrappers (shell script and this C one)
5306 # are only useful if you want to execute the "real" binary.
5307 # Since the "real" binary is built for $host, then this
5308 # wrapper might as well be built for $host, too.
5309 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5311 esac
5312 $rm $output
5313 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5315 $echo > $output "\
5316 #! $SHELL
5318 # $output - temporary wrapper script for $objdir/$outputname
5319 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5321 # The $output program cannot be directly executed until all the libtool
5322 # libraries that it depends on are installed.
5324 # This wrapper script should never be moved out of the build directory.
5325 # If it is, it will not operate correctly.
5327 # Sed substitution that helps us do robust quoting. It backslashifies
5328 # metacharacters that are still active within double-quoted strings.
5329 Xsed='${SED} -e 1s/^X//'
5330 sed_quote_subst='$sed_quote_subst'
5332 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5333 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5334 emulate sh
5335 NULLCMD=:
5336 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5337 # is contrary to our usage. Disable this feature.
5338 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5339 setopt NO_GLOB_SUBST
5340 else
5341 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5343 BIN_SH=xpg4; export BIN_SH # for Tru64
5344 DUALCASE=1; export DUALCASE # for MKS sh
5346 # The HP-UX ksh and POSIX shell print the target directory to stdout
5347 # if CDPATH is set.
5348 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5350 relink_command=\"$relink_command\"
5352 # This environment variable determines our operation mode.
5353 if test \"\$libtool_install_magic\" = \"$magic\"; then
5354 # install mode needs the following variable:
5355 notinst_deplibs='$notinst_deplibs'
5356 else
5357 # When we are sourced in execute mode, \$file and \$echo are already set.
5358 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5359 echo=\"$qecho\"
5360 file=\"\$0\"
5361 # Make sure echo works.
5362 if test \"X\$1\" = X--no-reexec; then
5363 # Discard the --no-reexec flag, and continue.
5364 shift
5365 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5366 # Yippee, \$echo works!
5368 else
5369 # Restart under the correct shell, and then maybe \$echo will work.
5370 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5374 $echo >> $output "\
5376 # Find the directory that this script lives in.
5377 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5378 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5380 # Follow symbolic links until we get to the real thisdir.
5381 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5382 while test -n \"\$file\"; do
5383 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5385 # If there was a directory component, then change thisdir.
5386 if test \"x\$destdir\" != \"x\$file\"; then
5387 case \"\$destdir\" in
5388 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5389 *) thisdir=\"\$thisdir/\$destdir\" ;;
5390 esac
5393 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5394 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5395 done
5397 # Try to get the absolute directory name.
5398 absdir=\`cd \"\$thisdir\" && pwd\`
5399 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5402 if test "$fast_install" = yes; then
5403 $echo >> $output "\
5404 program=lt-'$outputname'$exeext
5405 progdir=\"\$thisdir/$objdir\"
5407 if test ! -f \"\$progdir/\$program\" || \\
5408 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5409 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5411 file=\"\$\$-\$program\"
5413 if test ! -d \"\$progdir\"; then
5414 $mkdir \"\$progdir\"
5415 else
5416 $rm \"\$progdir/\$file\"
5419 $echo >> $output "\
5421 # relink executable if necessary
5422 if test -n \"\$relink_command\"; then
5423 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5424 else
5425 $echo \"\$relink_command_output\" >&2
5426 $rm \"\$progdir/\$file\"
5427 exit $EXIT_FAILURE
5431 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5432 { $rm \"\$progdir/\$program\";
5433 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5434 $rm \"\$progdir/\$file\"
5436 else
5437 $echo >> $output "\
5438 program='$outputname'
5439 progdir=\"\$thisdir/$objdir\"
5443 $echo >> $output "\
5445 if test -f \"\$progdir/\$program\"; then"
5447 # Export our shlibpath_var if we have one.
5448 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5449 $echo >> $output "\
5450 # Add our own library path to $shlibpath_var
5451 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5453 # Some systems cannot cope with colon-terminated $shlibpath_var
5454 # The second colon is a workaround for a bug in BeOS R4 sed
5455 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5457 export $shlibpath_var
5461 # fixup the dll searchpath if we need to.
5462 if test -n "$dllsearchpath"; then
5463 $echo >> $output "\
5464 # Add the dll search path components to the executable PATH
5465 PATH=$dllsearchpath:\$PATH
5469 $echo >> $output "\
5470 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5471 # Run the actual program with our arguments.
5473 case $host in
5474 # Backslashes separate directories on plain windows
5475 *-*-mingw | *-*-os2*)
5476 $echo >> $output "\
5477 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5482 $echo >> $output "\
5483 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5486 esac
5487 $echo >> $output "\
5488 \$echo \"\$0: cannot exec \$program \$*\"
5489 exit $EXIT_FAILURE
5491 else
5492 # The program doesn't exist.
5493 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5494 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5495 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5496 exit $EXIT_FAILURE
5500 chmod +x $output
5502 exit $EXIT_SUCCESS
5504 esac
5506 # See if we need to build an old-fashioned archive.
5507 for oldlib in $oldlibs; do
5509 if test "$build_libtool_libs" = convenience; then
5510 oldobjs="$libobjs_save"
5511 addlibs="$convenience"
5512 build_libtool_libs=no
5513 else
5514 if test "$build_libtool_libs" = module; then
5515 oldobjs="$libobjs_save"
5516 build_libtool_libs=no
5517 else
5518 oldobjs="$old_deplibs $non_pic_objects"
5520 addlibs="$old_convenience"
5523 if test -n "$addlibs"; then
5524 gentop="$output_objdir/${outputname}x"
5525 generated="$generated $gentop"
5527 func_extract_archives $gentop $addlibs
5528 oldobjs="$oldobjs $func_extract_archives_result"
5531 # Do each command in the archive commands.
5532 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5533 cmds=$old_archive_from_new_cmds
5534 else
5535 # POSIX demands no paths to be encoded in archives. We have
5536 # to avoid creating archives with duplicate basenames if we
5537 # might have to extract them afterwards, e.g., when creating a
5538 # static archive out of a convenience library, or when linking
5539 # the entirety of a libtool archive into another (currently
5540 # not supported by libtool).
5541 if (for obj in $oldobjs
5543 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5544 done | sort | sort -uc >/dev/null 2>&1); then
5546 else
5547 $echo "copying selected object files to avoid basename conflicts..."
5549 if test -z "$gentop"; then
5550 gentop="$output_objdir/${outputname}x"
5551 generated="$generated $gentop"
5553 $show "${rm}r $gentop"
5554 $run ${rm}r "$gentop"
5555 $show "$mkdir $gentop"
5556 $run $mkdir "$gentop"
5557 exit_status=$?
5558 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5559 exit $exit_status
5563 save_oldobjs=$oldobjs
5564 oldobjs=
5565 counter=1
5566 for obj in $save_oldobjs
5568 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5569 case " $oldobjs " in
5570 " ") oldobjs=$obj ;;
5571 *[\ /]"$objbase "*)
5572 while :; do
5573 # Make sure we don't pick an alternate name that also
5574 # overlaps.
5575 newobj=lt$counter-$objbase
5576 counter=`expr $counter + 1`
5577 case " $oldobjs " in
5578 *[\ /]"$newobj "*) ;;
5579 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5580 esac
5581 done
5582 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5583 $run ln "$obj" "$gentop/$newobj" ||
5584 $run cp "$obj" "$gentop/$newobj"
5585 oldobjs="$oldobjs $gentop/$newobj"
5587 *) oldobjs="$oldobjs $obj" ;;
5588 esac
5589 done
5592 eval cmds=\"$old_archive_cmds\"
5594 if len=`expr "X$cmds" : ".*"` &&
5595 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5596 cmds=$old_archive_cmds
5597 else
5598 # the command line is too long to link in one step, link in parts
5599 $echo "using piecewise archive linking..."
5600 save_RANLIB=$RANLIB
5601 RANLIB=:
5602 objlist=
5603 concat_cmds=
5604 save_oldobjs=$oldobjs
5606 # Is there a better way of finding the last object in the list?
5607 for obj in $save_oldobjs
5609 last_oldobj=$obj
5610 done
5611 for obj in $save_oldobjs
5613 oldobjs="$objlist $obj"
5614 objlist="$objlist $obj"
5615 eval test_cmds=\"$old_archive_cmds\"
5616 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5617 test "$len" -le "$max_cmd_len"; then
5619 else
5620 # the above command should be used before it gets too long
5621 oldobjs=$objlist
5622 if test "$obj" = "$last_oldobj" ; then
5623 RANLIB=$save_RANLIB
5625 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5626 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5627 objlist=
5629 done
5630 RANLIB=$save_RANLIB
5631 oldobjs=$objlist
5632 if test "X$oldobjs" = "X" ; then
5633 eval cmds=\"\$concat_cmds\"
5634 else
5635 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5639 save_ifs="$IFS"; IFS='~'
5640 for cmd in $cmds; do
5641 eval cmd=\"$cmd\"
5642 IFS="$save_ifs"
5643 $show "$cmd"
5644 $run eval "$cmd" || exit $?
5645 done
5646 IFS="$save_ifs"
5647 done
5649 if test -n "$generated"; then
5650 $show "${rm}r$generated"
5651 $run ${rm}r$generated
5654 # Now create the libtool archive.
5655 case $output in
5656 *.la)
5657 old_library=
5658 test "$build_old_libs" = yes && old_library="$libname.$libext"
5659 $show "creating $output"
5661 # Preserve any variables that may affect compiler behavior
5662 for var in $variables_saved_for_relink; do
5663 if eval test -z \"\${$var+set}\"; then
5664 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5665 elif eval var_value=\$$var; test -z "$var_value"; then
5666 relink_command="$var=; export $var; $relink_command"
5667 else
5668 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5669 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5671 done
5672 # Quote the link command for shipping.
5673 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5674 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5675 if test "$hardcode_automatic" = yes ; then
5676 relink_command=
5680 # Only create the output if not a dry run.
5681 if test -z "$run"; then
5682 for installed in no yes; do
5683 if test "$installed" = yes; then
5684 if test -z "$install_libdir"; then
5685 break
5687 output="$output_objdir/$outputname"i
5688 # Replace all uninstalled libtool libraries with the installed ones
5689 newdependency_libs=
5690 for deplib in $dependency_libs; do
5691 case $deplib in
5692 *.la)
5693 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5694 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5695 if test -z "$libdir"; then
5696 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5697 exit $EXIT_FAILURE
5699 newdependency_libs="$newdependency_libs $libdir/$name"
5701 *) newdependency_libs="$newdependency_libs $deplib" ;;
5702 esac
5703 done
5704 dependency_libs="$newdependency_libs"
5705 newdlfiles=
5706 for lib in $dlfiles; do
5707 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5708 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5709 if test -z "$libdir"; then
5710 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5711 exit $EXIT_FAILURE
5713 newdlfiles="$newdlfiles $libdir/$name"
5714 done
5715 dlfiles="$newdlfiles"
5716 newdlprefiles=
5717 for lib in $dlprefiles; do
5718 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5719 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5720 if test -z "$libdir"; then
5721 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5722 exit $EXIT_FAILURE
5724 newdlprefiles="$newdlprefiles $libdir/$name"
5725 done
5726 dlprefiles="$newdlprefiles"
5727 else
5728 newdlfiles=
5729 for lib in $dlfiles; do
5730 case $lib in
5731 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5732 *) abs=`pwd`"/$lib" ;;
5733 esac
5734 newdlfiles="$newdlfiles $abs"
5735 done
5736 dlfiles="$newdlfiles"
5737 newdlprefiles=
5738 for lib in $dlprefiles; do
5739 case $lib in
5740 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5741 *) abs=`pwd`"/$lib" ;;
5742 esac
5743 newdlprefiles="$newdlprefiles $abs"
5744 done
5745 dlprefiles="$newdlprefiles"
5747 $rm $output
5748 # place dlname in correct position for cygwin
5749 tdlname=$dlname
5750 case $host,$output,$installed,$module,$dlname in
5751 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5752 esac
5753 $echo > $output "\
5754 # $outputname - a libtool library file
5755 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5757 # Please DO NOT delete this file!
5758 # It is necessary for linking the library.
5760 # The name that we can dlopen(3).
5761 dlname='$tdlname'
5763 # Names of this library.
5764 library_names='$library_names'
5766 # The name of the static archive.
5767 old_library='$old_library'
5769 # Libraries that this one depends upon.
5770 dependency_libs='$dependency_libs'
5772 # Version information for $libname.
5773 current=$current
5774 age=$age
5775 revision=$revision
5777 # Is this an already installed library?
5778 installed=$installed
5780 # Should we warn about portability when linking against -modules?
5781 shouldnotlink=$module
5783 # Files to dlopen/dlpreopen
5784 dlopen='$dlfiles'
5785 dlpreopen='$dlprefiles'
5787 # Directory that this library needs to be installed in:
5788 libdir='$install_libdir'"
5789 if test "$installed" = no && test "$need_relink" = yes; then
5790 $echo >> $output "\
5791 relink_command=\"$relink_command\""
5793 done
5796 # Do a symbolic link so that the libtool archive can be found in
5797 # LD_LIBRARY_PATH before the program is installed.
5798 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5799 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5801 esac
5802 exit $EXIT_SUCCESS
5805 # libtool install mode
5806 install)
5807 modename="$modename: install"
5809 # There may be an optional sh(1) argument at the beginning of
5810 # install_prog (especially on Windows NT).
5811 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5812 # Allow the use of GNU shtool's install command.
5813 $echo "X$nonopt" | grep shtool > /dev/null; then
5814 # Aesthetically quote it.
5815 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5816 case $arg in
5817 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5818 arg="\"$arg\""
5820 esac
5821 install_prog="$arg "
5822 arg="$1"
5823 shift
5824 else
5825 install_prog=
5826 arg=$nonopt
5829 # The real first argument should be the name of the installation program.
5830 # Aesthetically quote it.
5831 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5832 case $arg in
5833 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5834 arg="\"$arg\""
5836 esac
5837 install_prog="$install_prog$arg"
5839 # We need to accept at least all the BSD install flags.
5840 dest=
5841 files=
5842 opts=
5843 prev=
5844 install_type=
5845 isdir=no
5846 stripme=
5847 for arg
5849 if test -n "$dest"; then
5850 files="$files $dest"
5851 dest=$arg
5852 continue
5855 case $arg in
5856 -d) isdir=yes ;;
5857 -f)
5858 case " $install_prog " in
5859 *[\\\ /]cp\ *) ;;
5860 *) prev=$arg ;;
5861 esac
5863 -g | -m | -o) prev=$arg ;;
5865 stripme=" -s"
5866 continue
5871 # If the previous option needed an argument, then skip it.
5872 if test -n "$prev"; then
5873 prev=
5874 else
5875 dest=$arg
5876 continue
5879 esac
5881 # Aesthetically quote the argument.
5882 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5883 case $arg in
5884 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5885 arg="\"$arg\""
5887 esac
5888 install_prog="$install_prog $arg"
5889 done
5891 if test -z "$install_prog"; then
5892 $echo "$modename: you must specify an install program" 1>&2
5893 $echo "$help" 1>&2
5894 exit $EXIT_FAILURE
5897 if test -n "$prev"; then
5898 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5899 $echo "$help" 1>&2
5900 exit $EXIT_FAILURE
5903 if test -z "$files"; then
5904 if test -z "$dest"; then
5905 $echo "$modename: no file or destination specified" 1>&2
5906 else
5907 $echo "$modename: you must specify a destination" 1>&2
5909 $echo "$help" 1>&2
5910 exit $EXIT_FAILURE
5913 # Strip any trailing slash from the destination.
5914 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5916 # Check to see that the destination is a directory.
5917 test -d "$dest" && isdir=yes
5918 if test "$isdir" = yes; then
5919 destdir="$dest"
5920 destname=
5921 else
5922 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5923 test "X$destdir" = "X$dest" && destdir=.
5924 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5926 # Not a directory, so check to see that there is only one file specified.
5927 set dummy $files
5928 if test "$#" -gt 2; then
5929 $echo "$modename: \`$dest' is not a directory" 1>&2
5930 $echo "$help" 1>&2
5931 exit $EXIT_FAILURE
5934 case $destdir in
5935 [\\/]* | [A-Za-z]:[\\/]*) ;;
5937 for file in $files; do
5938 case $file in
5939 *.lo) ;;
5941 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5942 $echo "$help" 1>&2
5943 exit $EXIT_FAILURE
5945 esac
5946 done
5948 esac
5950 # This variable tells wrapper scripts just to set variables rather
5951 # than running their programs.
5952 libtool_install_magic="$magic"
5954 staticlibs=
5955 future_libdirs=
5956 current_libdirs=
5957 for file in $files; do
5959 # Do each installation.
5960 case $file in
5961 *.$libext)
5962 # Do the static libraries later.
5963 staticlibs="$staticlibs $file"
5966 *.la)
5967 # Check to see that this really is a libtool archive.
5968 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5969 else
5970 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5971 $echo "$help" 1>&2
5972 exit $EXIT_FAILURE
5975 library_names=
5976 old_library=
5977 relink_command=
5978 # If there is no directory component, then add one.
5979 case $file in
5980 */* | *\\*) . $file ;;
5981 *) . ./$file ;;
5982 esac
5984 # Add the libdir to current_libdirs if it is the destination.
5985 if test "X$destdir" = "X$libdir"; then
5986 case "$current_libdirs " in
5987 *" $libdir "*) ;;
5988 *) current_libdirs="$current_libdirs $libdir" ;;
5989 esac
5990 else
5991 # Note the libdir as a future libdir.
5992 case "$future_libdirs " in
5993 *" $libdir "*) ;;
5994 *) future_libdirs="$future_libdirs $libdir" ;;
5995 esac
5998 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5999 test "X$dir" = "X$file/" && dir=
6000 dir="$dir$objdir"
6002 if test -n "$relink_command"; then
6003 # Determine the prefix the user has applied to our future dir.
6004 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6006 # Don't allow the user to place us outside of our expected
6007 # location b/c this prevents finding dependent libraries that
6008 # are installed to the same prefix.
6009 # At present, this check doesn't affect windows .dll's that
6010 # are installed into $libdir/../bin (currently, that works fine)
6011 # but it's something to keep an eye on.
6012 if test "$inst_prefix_dir" = "$destdir"; then
6013 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6014 exit $EXIT_FAILURE
6017 if test -n "$inst_prefix_dir"; then
6018 # Stick the inst_prefix_dir data into the link command.
6019 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6020 else
6021 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6024 $echo "$modename: warning: relinking \`$file'" 1>&2
6025 $show "$relink_command"
6026 if $run eval "$relink_command"; then :
6027 else
6028 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6029 exit $EXIT_FAILURE
6033 # See the names of the shared library.
6034 set dummy $library_names
6035 if test -n "$2"; then
6036 realname="$2"
6037 shift
6038 shift
6040 srcname="$realname"
6041 test -n "$relink_command" && srcname="$realname"T
6043 # Install the shared library and build the symlinks.
6044 $show "$install_prog $dir/$srcname $destdir/$realname"
6045 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6046 if test -n "$stripme" && test -n "$striplib"; then
6047 $show "$striplib $destdir/$realname"
6048 $run eval "$striplib $destdir/$realname" || exit $?
6051 if test "$#" -gt 0; then
6052 # Delete the old symlinks, and create new ones.
6053 # Try `ln -sf' first, because the `ln' binary might depend on
6054 # the symlink we replace! Solaris /bin/ln does not understand -f,
6055 # so we also need to try rm && ln -s.
6056 for linkname
6058 if test "$linkname" != "$realname"; then
6059 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6060 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6062 done
6065 # Do each command in the postinstall commands.
6066 lib="$destdir/$realname"
6067 cmds=$postinstall_cmds
6068 save_ifs="$IFS"; IFS='~'
6069 for cmd in $cmds; do
6070 IFS="$save_ifs"
6071 eval cmd=\"$cmd\"
6072 $show "$cmd"
6073 $run eval "$cmd" || {
6074 lt_exit=$?
6076 # Restore the uninstalled library and exit
6077 if test "$mode" = relink; then
6078 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6081 exit $lt_exit
6083 done
6084 IFS="$save_ifs"
6087 # Install the pseudo-library for information purposes.
6088 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6089 instname="$dir/$name"i
6090 $show "$install_prog $instname $destdir/$name"
6091 $run eval "$install_prog $instname $destdir/$name" || exit $?
6093 # Maybe install the static library, too.
6094 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6097 *.lo)
6098 # Install (i.e. copy) a libtool object.
6100 # Figure out destination file name, if it wasn't already specified.
6101 if test -n "$destname"; then
6102 destfile="$destdir/$destname"
6103 else
6104 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6105 destfile="$destdir/$destfile"
6108 # Deduce the name of the destination old-style object file.
6109 case $destfile in
6110 *.lo)
6111 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6113 *.$objext)
6114 staticdest="$destfile"
6115 destfile=
6118 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6119 $echo "$help" 1>&2
6120 exit $EXIT_FAILURE
6122 esac
6124 # Install the libtool object if requested.
6125 if test -n "$destfile"; then
6126 $show "$install_prog $file $destfile"
6127 $run eval "$install_prog $file $destfile" || exit $?
6130 # Install the old object if enabled.
6131 if test "$build_old_libs" = yes; then
6132 # Deduce the name of the old-style object file.
6133 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6135 $show "$install_prog $staticobj $staticdest"
6136 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6138 exit $EXIT_SUCCESS
6142 # Figure out destination file name, if it wasn't already specified.
6143 if test -n "$destname"; then
6144 destfile="$destdir/$destname"
6145 else
6146 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6147 destfile="$destdir/$destfile"
6150 # If the file is missing, and there is a .exe on the end, strip it
6151 # because it is most likely a libtool script we actually want to
6152 # install
6153 stripped_ext=""
6154 case $file in
6155 *.exe)
6156 if test ! -f "$file"; then
6157 file=`$echo $file|${SED} 's,.exe$,,'`
6158 stripped_ext=".exe"
6161 esac
6163 # Do a test to see if this is really a libtool program.
6164 case $host in
6165 *cygwin*|*mingw*)
6166 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6169 wrapper=$file
6171 esac
6172 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6173 notinst_deplibs=
6174 relink_command=
6176 # Note that it is not necessary on cygwin/mingw to append a dot to
6177 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6178 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6179 # `FILE.' does not work on cygwin managed mounts.
6181 # If there is no directory component, then add one.
6182 case $wrapper in
6183 */* | *\\*) . ${wrapper} ;;
6184 *) . ./${wrapper} ;;
6185 esac
6187 # Check the variables that should have been set.
6188 if test -z "$notinst_deplibs"; then
6189 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6190 exit $EXIT_FAILURE
6193 finalize=yes
6194 for lib in $notinst_deplibs; do
6195 # Check to see that each library is installed.
6196 libdir=
6197 if test -f "$lib"; then
6198 # If there is no directory component, then add one.
6199 case $lib in
6200 */* | *\\*) . $lib ;;
6201 *) . ./$lib ;;
6202 esac
6204 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6205 if test -n "$libdir" && test ! -f "$libfile"; then
6206 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6207 finalize=no
6209 done
6211 relink_command=
6212 # Note that it is not necessary on cygwin/mingw to append a dot to
6213 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6214 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6215 # `FILE.' does not work on cygwin managed mounts.
6217 # If there is no directory component, then add one.
6218 case $wrapper in
6219 */* | *\\*) . ${wrapper} ;;
6220 *) . ./${wrapper} ;;
6221 esac
6223 outputname=
6224 if test "$fast_install" = no && test -n "$relink_command"; then
6225 if test "$finalize" = yes && test -z "$run"; then
6226 tmpdir=`func_mktempdir`
6227 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6228 outputname="$tmpdir/$file"
6229 # Replace the output file specification.
6230 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6232 $show "$relink_command"
6233 if $run eval "$relink_command"; then :
6234 else
6235 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6236 ${rm}r "$tmpdir"
6237 continue
6239 file="$outputname"
6240 else
6241 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6243 else
6244 # Install the binary that we compiled earlier.
6245 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6249 # remove .exe since cygwin /usr/bin/install will append another
6250 # one anyway
6251 case $install_prog,$host in
6252 */usr/bin/install*,*cygwin*)
6253 case $file:$destfile in
6254 *.exe:*.exe)
6255 # this is ok
6257 *.exe:*)
6258 destfile=$destfile.exe
6260 *:*.exe)
6261 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6263 esac
6265 esac
6266 $show "$install_prog$stripme $file $destfile"
6267 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6268 test -n "$outputname" && ${rm}r "$tmpdir"
6270 esac
6271 done
6273 for file in $staticlibs; do
6274 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6276 # Set up the ranlib parameters.
6277 oldlib="$destdir/$name"
6279 $show "$install_prog $file $oldlib"
6280 $run eval "$install_prog \$file \$oldlib" || exit $?
6282 if test -n "$stripme" && test -n "$old_striplib"; then
6283 $show "$old_striplib $oldlib"
6284 $run eval "$old_striplib $oldlib" || exit $?
6287 # Do each command in the postinstall commands.
6288 cmds=$old_postinstall_cmds
6289 save_ifs="$IFS"; IFS='~'
6290 for cmd in $cmds; do
6291 IFS="$save_ifs"
6292 eval cmd=\"$cmd\"
6293 $show "$cmd"
6294 $run eval "$cmd" || exit $?
6295 done
6296 IFS="$save_ifs"
6297 done
6299 if test -n "$future_libdirs"; then
6300 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6303 if test -n "$current_libdirs"; then
6304 # Maybe just do a dry run.
6305 test -n "$run" && current_libdirs=" -n$current_libdirs"
6306 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6307 else
6308 exit $EXIT_SUCCESS
6312 # libtool finish mode
6313 finish)
6314 modename="$modename: finish"
6315 libdirs="$nonopt"
6316 admincmds=
6318 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6319 for dir
6321 libdirs="$libdirs $dir"
6322 done
6324 for libdir in $libdirs; do
6325 if test -n "$finish_cmds"; then
6326 # Do each command in the finish commands.
6327 cmds=$finish_cmds
6328 save_ifs="$IFS"; IFS='~'
6329 for cmd in $cmds; do
6330 IFS="$save_ifs"
6331 eval cmd=\"$cmd\"
6332 $show "$cmd"
6333 $run eval "$cmd" || admincmds="$admincmds
6334 $cmd"
6335 done
6336 IFS="$save_ifs"
6338 if test -n "$finish_eval"; then
6339 # Do the single finish_eval.
6340 eval cmds=\"$finish_eval\"
6341 $run eval "$cmds" || admincmds="$admincmds
6342 $cmds"
6344 done
6347 # Exit here if they wanted silent mode.
6348 test "$show" = : && exit $EXIT_SUCCESS
6350 $echo "X----------------------------------------------------------------------" | $Xsed
6351 $echo "Libraries have been installed in:"
6352 for libdir in $libdirs; do
6353 $echo " $libdir"
6354 done
6355 $echo
6356 $echo "If you ever happen to want to link against installed libraries"
6357 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6358 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6359 $echo "flag during linking and do at least one of the following:"
6360 if test -n "$shlibpath_var"; then
6361 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6362 $echo " during execution"
6364 if test -n "$runpath_var"; then
6365 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6366 $echo " during linking"
6368 if test -n "$hardcode_libdir_flag_spec"; then
6369 libdir=LIBDIR
6370 eval flag=\"$hardcode_libdir_flag_spec\"
6372 $echo " - use the \`$flag' linker flag"
6374 if test -n "$admincmds"; then
6375 $echo " - have your system administrator run these commands:$admincmds"
6377 if test -f /etc/ld.so.conf; then
6378 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6380 $echo
6381 $echo "See any operating system documentation about shared libraries for"
6382 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6383 $echo "X----------------------------------------------------------------------" | $Xsed
6384 exit $EXIT_SUCCESS
6387 # libtool execute mode
6388 execute)
6389 modename="$modename: execute"
6391 # The first argument is the command name.
6392 cmd="$nonopt"
6393 if test -z "$cmd"; then
6394 $echo "$modename: you must specify a COMMAND" 1>&2
6395 $echo "$help"
6396 exit $EXIT_FAILURE
6399 # Handle -dlopen flags immediately.
6400 for file in $execute_dlfiles; do
6401 if test ! -f "$file"; then
6402 $echo "$modename: \`$file' is not a file" 1>&2
6403 $echo "$help" 1>&2
6404 exit $EXIT_FAILURE
6407 dir=
6408 case $file in
6409 *.la)
6410 # Check to see that this really is a libtool archive.
6411 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6412 else
6413 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6414 $echo "$help" 1>&2
6415 exit $EXIT_FAILURE
6418 # Read the libtool library.
6419 dlname=
6420 library_names=
6422 # If there is no directory component, then add one.
6423 case $file in
6424 */* | *\\*) . $file ;;
6425 *) . ./$file ;;
6426 esac
6428 # Skip this library if it cannot be dlopened.
6429 if test -z "$dlname"; then
6430 # Warn if it was a shared library.
6431 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6432 continue
6435 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6436 test "X$dir" = "X$file" && dir=.
6438 if test -f "$dir/$objdir/$dlname"; then
6439 dir="$dir/$objdir"
6440 else
6441 if test ! -f "$dir/$dlname"; then
6442 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6443 exit $EXIT_FAILURE
6448 *.lo)
6449 # Just add the directory containing the .lo file.
6450 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6451 test "X$dir" = "X$file" && dir=.
6455 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6456 continue
6458 esac
6460 # Get the absolute pathname.
6461 absdir=`cd "$dir" && pwd`
6462 test -n "$absdir" && dir="$absdir"
6464 # Now add the directory to shlibpath_var.
6465 if eval "test -z \"\$$shlibpath_var\""; then
6466 eval "$shlibpath_var=\"\$dir\""
6467 else
6468 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6470 done
6472 # This variable tells wrapper scripts just to set shlibpath_var
6473 # rather than running their programs.
6474 libtool_execute_magic="$magic"
6476 # Check if any of the arguments is a wrapper script.
6477 args=
6478 for file
6480 case $file in
6481 -*) ;;
6483 # Do a test to see if this is really a libtool program.
6484 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6485 # If there is no directory component, then add one.
6486 case $file in
6487 */* | *\\*) . $file ;;
6488 *) . ./$file ;;
6489 esac
6491 # Transform arg to wrapped name.
6492 file="$progdir/$program"
6495 esac
6496 # Quote arguments (to preserve shell metacharacters).
6497 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6498 args="$args \"$file\""
6499 done
6501 if test -z "$run"; then
6502 if test -n "$shlibpath_var"; then
6503 # Export the shlibpath_var.
6504 eval "export $shlibpath_var"
6507 # Restore saved environment variables
6508 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6510 eval "if test \"\${save_$lt_var+set}\" = set; then
6511 $lt_var=\$save_$lt_var; export $lt_var
6513 done
6515 # Now prepare to actually exec the command.
6516 exec_cmd="\$cmd$args"
6517 else
6518 # Display what would be done.
6519 if test -n "$shlibpath_var"; then
6520 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6521 $echo "export $shlibpath_var"
6523 $echo "$cmd$args"
6524 exit $EXIT_SUCCESS
6528 # libtool clean and uninstall mode
6529 clean | uninstall)
6530 modename="$modename: $mode"
6531 rm="$nonopt"
6532 files=
6533 rmforce=
6534 exit_status=0
6536 # This variable tells wrapper scripts just to set variables rather
6537 # than running their programs.
6538 libtool_install_magic="$magic"
6540 for arg
6542 case $arg in
6543 -f) rm="$rm $arg"; rmforce=yes ;;
6544 -*) rm="$rm $arg" ;;
6545 *) files="$files $arg" ;;
6546 esac
6547 done
6549 if test -z "$rm"; then
6550 $echo "$modename: you must specify an RM program" 1>&2
6551 $echo "$help" 1>&2
6552 exit $EXIT_FAILURE
6555 rmdirs=
6557 origobjdir="$objdir"
6558 for file in $files; do
6559 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6560 if test "X$dir" = "X$file"; then
6561 dir=.
6562 objdir="$origobjdir"
6563 else
6564 objdir="$dir/$origobjdir"
6566 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6567 test "$mode" = uninstall && objdir="$dir"
6569 # Remember objdir for removal later, being careful to avoid duplicates
6570 if test "$mode" = clean; then
6571 case " $rmdirs " in
6572 *" $objdir "*) ;;
6573 *) rmdirs="$rmdirs $objdir" ;;
6574 esac
6577 # Don't error if the file doesn't exist and rm -f was used.
6578 if (test -L "$file") >/dev/null 2>&1 \
6579 || (test -h "$file") >/dev/null 2>&1 \
6580 || test -f "$file"; then
6582 elif test -d "$file"; then
6583 exit_status=1
6584 continue
6585 elif test "$rmforce" = yes; then
6586 continue
6589 rmfiles="$file"
6591 case $name in
6592 *.la)
6593 # Possibly a libtool archive, so verify it.
6594 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6595 . $dir/$name
6597 # Delete the libtool libraries and symlinks.
6598 for n in $library_names; do
6599 rmfiles="$rmfiles $objdir/$n"
6600 done
6601 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6603 case "$mode" in
6604 clean)
6605 case " $library_names " in
6606 # " " in the beginning catches empty $dlname
6607 *" $dlname "*) ;;
6608 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6609 esac
6610 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6612 uninstall)
6613 if test -n "$library_names"; then
6614 # Do each command in the postuninstall commands.
6615 cmds=$postuninstall_cmds
6616 save_ifs="$IFS"; IFS='~'
6617 for cmd in $cmds; do
6618 IFS="$save_ifs"
6619 eval cmd=\"$cmd\"
6620 $show "$cmd"
6621 $run eval "$cmd"
6622 if test "$?" -ne 0 && test "$rmforce" != yes; then
6623 exit_status=1
6625 done
6626 IFS="$save_ifs"
6629 if test -n "$old_library"; then
6630 # Do each command in the old_postuninstall commands.
6631 cmds=$old_postuninstall_cmds
6632 save_ifs="$IFS"; IFS='~'
6633 for cmd in $cmds; do
6634 IFS="$save_ifs"
6635 eval cmd=\"$cmd\"
6636 $show "$cmd"
6637 $run eval "$cmd"
6638 if test "$?" -ne 0 && test "$rmforce" != yes; then
6639 exit_status=1
6641 done
6642 IFS="$save_ifs"
6644 # FIXME: should reinstall the best remaining shared library.
6646 esac
6650 *.lo)
6651 # Possibly a libtool object, so verify it.
6652 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6654 # Read the .lo file
6655 . $dir/$name
6657 # Add PIC object to the list of files to remove.
6658 if test -n "$pic_object" \
6659 && test "$pic_object" != none; then
6660 rmfiles="$rmfiles $dir/$pic_object"
6663 # Add non-PIC object to the list of files to remove.
6664 if test -n "$non_pic_object" \
6665 && test "$non_pic_object" != none; then
6666 rmfiles="$rmfiles $dir/$non_pic_object"
6672 if test "$mode" = clean ; then
6673 noexename=$name
6674 case $file in
6675 *.exe)
6676 file=`$echo $file|${SED} 's,.exe$,,'`
6677 noexename=`$echo $name|${SED} 's,.exe$,,'`
6678 # $file with .exe has already been added to rmfiles,
6679 # add $file without .exe
6680 rmfiles="$rmfiles $file"
6682 esac
6683 # Do a test to see if this is a libtool program.
6684 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6685 relink_command=
6686 . $dir/$noexename
6688 # note $name still contains .exe if it was in $file originally
6689 # as does the version of $file that was added into $rmfiles
6690 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6691 if test "$fast_install" = yes && test -n "$relink_command"; then
6692 rmfiles="$rmfiles $objdir/lt-$name"
6694 if test "X$noexename" != "X$name" ; then
6695 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6700 esac
6701 $show "$rm $rmfiles"
6702 $run $rm $rmfiles || exit_status=1
6703 done
6704 objdir="$origobjdir"
6706 # Try to remove the ${objdir}s in the directories where we deleted files
6707 for dir in $rmdirs; do
6708 if test -d "$dir"; then
6709 $show "rmdir $dir"
6710 $run rmdir $dir >/dev/null 2>&1
6712 done
6714 exit $exit_status
6718 $echo "$modename: you must specify a MODE" 1>&2
6719 $echo "$generic_help" 1>&2
6720 exit $EXIT_FAILURE
6722 esac
6724 if test -z "$exec_cmd"; then
6725 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6726 $echo "$generic_help" 1>&2
6727 exit $EXIT_FAILURE
6729 fi # test -z "$show_help"
6731 if test -n "$exec_cmd"; then
6732 eval exec $exec_cmd
6733 exit $EXIT_FAILURE
6736 # We need to display help for each of the modes.
6737 case $mode in
6738 "") $echo \
6739 "Usage: $modename [OPTION]... [MODE-ARG]...
6741 Provide generalized library-building support services.
6743 --config show all configuration variables
6744 --debug enable verbose shell tracing
6745 -n, --dry-run display commands without modifying any files
6746 --features display basic configuration information and exit
6747 --finish same as \`--mode=finish'
6748 --help display this help message and exit
6749 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6750 --quiet same as \`--silent'
6751 --silent don't print informational messages
6752 --tag=TAG use configuration variables from tag TAG
6753 --version print version information
6755 MODE must be one of the following:
6757 clean remove files from the build directory
6758 compile compile a source file into a libtool object
6759 execute automatically set library path, then run a program
6760 finish complete the installation of libtool libraries
6761 install install libraries or executables
6762 link create a library or an executable
6763 uninstall remove libraries from an installed directory
6765 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6766 a more detailed description of MODE.
6768 Report bugs to <bug-libtool@gnu.org>."
6769 exit $EXIT_SUCCESS
6772 clean)
6773 $echo \
6774 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6776 Remove files from the build directory.
6778 RM is the name of the program to use to delete files associated with each FILE
6779 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6780 to RM.
6782 If FILE is a libtool library, object or program, all the files associated
6783 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6786 compile)
6787 $echo \
6788 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6790 Compile a source file into a libtool library object.
6792 This mode accepts the following additional options:
6794 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6795 -prefer-pic try to building PIC objects only
6796 -prefer-non-pic try to building non-PIC objects only
6797 -static always build a \`.o' file suitable for static linking
6799 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6800 from the given SOURCEFILE.
6802 The output file name is determined by removing the directory component from
6803 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6804 library object suffix, \`.lo'."
6807 execute)
6808 $echo \
6809 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6811 Automatically set library path, then run a program.
6813 This mode accepts the following additional options:
6815 -dlopen FILE add the directory containing FILE to the library path
6817 This mode sets the library path environment variable according to \`-dlopen'
6818 flags.
6820 If any of the ARGS are libtool executable wrappers, then they are translated
6821 into their corresponding uninstalled binary, and any of their required library
6822 directories are added to the library path.
6824 Then, COMMAND is executed, with ARGS as arguments."
6827 finish)
6828 $echo \
6829 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6831 Complete the installation of libtool libraries.
6833 Each LIBDIR is a directory that contains libtool libraries.
6835 The commands that this mode executes may require superuser privileges. Use
6836 the \`--dry-run' option if you just want to see what would be executed."
6839 install)
6840 $echo \
6841 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6843 Install executables or libraries.
6845 INSTALL-COMMAND is the installation command. The first component should be
6846 either the \`install' or \`cp' program.
6848 The rest of the components are interpreted as arguments to that command (only
6849 BSD-compatible install options are recognized)."
6852 link)
6853 $echo \
6854 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6856 Link object files or libraries together to form another library, or to
6857 create an executable program.
6859 LINK-COMMAND is a command using the C compiler that you would use to create
6860 a program from several object files.
6862 The following components of LINK-COMMAND are treated specially:
6864 -all-static do not do any dynamic linking at all
6865 -avoid-version do not add a version suffix if possible
6866 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6867 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6868 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6869 -export-symbols SYMFILE
6870 try to export only the symbols listed in SYMFILE
6871 -export-symbols-regex REGEX
6872 try to export only the symbols matching REGEX
6873 -LLIBDIR search LIBDIR for required installed libraries
6874 -lNAME OUTPUT-FILE requires the installed library libNAME
6875 -module build a library that can dlopened
6876 -no-fast-install disable the fast-install mode
6877 -no-install link a not-installable executable
6878 -no-undefined declare that a library does not refer to external symbols
6879 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6880 -objectlist FILE Use a list of object files found in FILE to specify objects
6881 -precious-files-regex REGEX
6882 don't remove output files matching REGEX
6883 -release RELEASE specify package release information
6884 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6885 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6886 -static do not do any dynamic linking of uninstalled libtool libraries
6887 -static-libtool-libs
6888 do not do any dynamic linking of libtool libraries
6889 -version-info CURRENT[:REVISION[:AGE]]
6890 specify library version info [each variable defaults to 0]
6892 All other options (arguments beginning with \`-') are ignored.
6894 Every other argument is treated as a filename. Files ending in \`.la' are
6895 treated as uninstalled libtool libraries, other files are standard or library
6896 object files.
6898 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6899 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6900 required, except when creating a convenience library.
6902 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6903 using \`ar' and \`ranlib', or on Windows using \`lib'.
6905 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6906 is created, otherwise an executable program is created."
6909 uninstall)
6910 $echo \
6911 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6913 Remove libraries from an installation directory.
6915 RM is the name of the program to use to delete files associated with each FILE
6916 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6917 to RM.
6919 If FILE is a libtool library, all the files associated with it are deleted.
6920 Otherwise, only FILE itself is deleted using RM."
6924 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6925 $echo "$help" 1>&2
6926 exit $EXIT_FAILURE
6928 esac
6930 $echo
6931 $echo "Try \`$modename --help' for more information about other modes."
6933 exit $?
6935 # The TAGs below are defined such that we never get into a situation
6936 # in which we disable both kinds of libraries. Given conflicting
6937 # choices, we go for a static library, that is the most portable,
6938 # since we can't tell whether shared libraries were disabled because
6939 # the user asked for that or because the platform doesn't support
6940 # them. This is particularly important on AIX, because we don't
6941 # support having both static and shared libraries enabled at the same
6942 # time on that platform, so we default to a shared-only configuration.
6943 # If a disable-shared tag is given, we'll fallback to a static-only
6944 # configuration. But we'll never go from static-only to shared-only.
6946 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6947 disable_libs=shared
6948 # ### END LIBTOOL TAG CONFIG: disable-shared
6950 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6951 disable_libs=static
6952 # ### END LIBTOOL TAG CONFIG: disable-static
6954 # Local Variables:
6955 # mode:shell-script
6956 # sh-indentation:2
6957 # End: