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