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