idk
[openDashboard.git] / ltmain.sh
blobd74b5a67afb39d1e0ff7fcfeb85b119125ece0f3
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 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.24
47 TIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
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 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118 eval "if test \"\${$lt_var+set}\" = set; then
119 save_$lt_var=\$$lt_var
120 $lt_var=C
121 export $lt_var
123 done
125 # Make sure IFS has a sensible default
126 lt_nl='
128 IFS=" $lt_nl"
130 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131 $echo "$modename: not configured to build any kind of library" 1>&2
132 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
133 exit $EXIT_FAILURE
136 # Global variables.
137 mode=$default_mode
138 nonopt=
139 prev=
140 prevopt=
141 run=
142 show="$echo"
143 show_help=
144 execute_dlfiles=
145 duplicate_deps=no
146 preserve_args=
147 lo2o="s/\\.lo\$/.${objext}/"
148 o2lo="s/\\.${objext}\$/.lo/"
149 extracted_archives=
150 extracted_serial=0
152 #####################################
153 # Shell function definitions:
154 # This seems to be the best place for them
156 # func_mktempdir [string]
157 # Make a temporary directory that won't clash with other running
158 # libtool processes, and avoids race conditions if possible. If
159 # given, STRING is the basename for that directory.
160 func_mktempdir ()
162 my_template="${TMPDIR-/tmp}/${1-$progname}"
164 if test "$run" = ":"; then
165 # Return a directory name, but don't create it in dry-run mode
166 my_tmpdir="${my_template}-$$"
167 else
169 # If mktemp works, use that first and foremost
170 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
172 if test ! -d "$my_tmpdir"; then
173 # Failing that, at least try and use $RANDOM to avoid a race
174 my_tmpdir="${my_template}-${RANDOM-0}$$"
176 save_mktempdir_umask=`umask`
177 umask 0077
178 $mkdir "$my_tmpdir"
179 umask $save_mktempdir_umask
182 # If we're not in dry-run mode, bomb out on failure
183 test -d "$my_tmpdir" || {
184 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
185 exit $EXIT_FAILURE
189 $echo "X$my_tmpdir" | $Xsed
193 # func_win32_libid arg
194 # return the library type of file 'arg'
196 # Need a lot of goo to handle *both* DLLs and import libs
197 # Has to be a shell function in order to 'eat' the argument
198 # that is supplied when $file_magic_command is called.
199 func_win32_libid ()
201 win32_libid_type="unknown"
202 win32_fileres=`file -L $1 2>/dev/null`
203 case $win32_fileres in
204 *ar\ archive\ import\ library*) # definitely import
205 win32_libid_type="x86 archive import"
207 *ar\ archive*) # could be an import, or static
208 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210 win32_nmres=`eval $NM -f posix -A $1 | \
211 $SED -n -e '1,100{
212 / I /{
213 s,.*,import,
218 case $win32_nmres in
219 import*) win32_libid_type="x86 archive import";;
220 *) win32_libid_type="x86 archive static";;
221 esac
224 *DLL*)
225 win32_libid_type="x86 DLL"
227 *executable*) # but shell scripts are "executable" too...
228 case $win32_fileres in
229 *MS\ Windows\ PE\ Intel*)
230 win32_libid_type="x86 DLL"
232 esac
234 esac
235 $echo $win32_libid_type
239 # func_infer_tag arg
240 # Infer tagged configuration to use if any are available and
241 # if one wasn't chosen via the "--tag" command line option.
242 # Only attempt this if the compiler in the base compile
243 # command doesn't match the default compiler.
244 # arg is usually of the form 'gcc ...'
245 func_infer_tag ()
247 if test -n "$available_tags" && test -z "$tagname"; then
248 CC_quoted=
249 for arg in $CC; do
250 case $arg in
251 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
252 arg="\"$arg\""
254 esac
255 CC_quoted="$CC_quoted $arg"
256 done
257 case $@ in
258 # Blanks in the command may have been stripped by the calling shell,
259 # but not from the CC environment variable when configure was run.
260 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261 # Blanks at the start of $base_compile will cause this to fail
262 # if we don't check for them as well.
264 for z in $available_tags; do
265 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266 # Evaluate the configuration.
267 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
268 CC_quoted=
269 for arg in $CC; do
270 # Double-quote args containing other shell metacharacters.
271 case $arg in
272 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
273 arg="\"$arg\""
275 esac
276 CC_quoted="$CC_quoted $arg"
277 done
278 # user sometimes does CC=<HOST>-gcc so we need to match that to 'gcc'
279 trimedcc=`echo ${CC} | $SED -e "s/${host}-//g"`
280 # and sometimes libtool has CC=<HOST>-gcc but user does CC=gcc
281 extendcc=${host}-${CC}
282 # and sometimes libtool has CC=<OLDHOST>-gcc but user has CC=<NEWHOST>-gcc
283 # (Gentoo-specific hack because we always export $CHOST)
284 mungedcc=${CHOST-${host}}-${trimedcc}
285 case "$@ " in
286 "cc "* | " cc "* | "${host}-cc "* | " ${host}-cc "*|\
287 "gcc "* | " gcc "* | "${host}-gcc "* | " ${host}-gcc "*)
288 tagname=CC
289 break ;;
290 "$trimedcc "* | " $trimedcc "* | "`$echo $trimedcc` "* | " `$echo $trimedcc` "*|\
291 "$extendcc "* | " $extendcc "* | "`$echo $extendcc` "* | " `$echo $extendcc` "*|\
292 "$mungedcc "* | " $mungedcc "* | "`$echo $mungedcc` "* | " `$echo $mungedcc` "*|\
293 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
294 # The compiler in the base compile command matches
295 # the one in the tagged configuration.
296 # Assume this is the tagged configuration we want.
297 tagname=$z
298 break
300 esac
302 done
303 # If $tagname still isn't set, then no tagged configuration
304 # was found and let the user know that the "--tag" command
305 # line option must be used.
306 if test -z "$tagname"; then
307 $echo "$modename: unable to infer tagged configuration"
308 $echo "$modename: specify a tag with \`--tag'" 1>&2
309 exit $EXIT_FAILURE
310 # else
311 # $echo "$modename: using $tagname tagged configuration"
314 esac
319 # func_extract_an_archive dir oldlib
320 func_extract_an_archive ()
322 f_ex_an_ar_dir="$1"; shift
323 f_ex_an_ar_oldlib="$1"
325 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
326 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
327 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
329 else
330 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
331 exit $EXIT_FAILURE
335 # func_extract_archives gentop oldlib ...
336 func_extract_archives ()
338 my_gentop="$1"; shift
339 my_oldlibs=${1+"$@"}
340 my_oldobjs=""
341 my_xlib=""
342 my_xabs=""
343 my_xdir=""
344 my_status=""
346 $show "${rm}r $my_gentop"
347 $run ${rm}r "$my_gentop"
348 $show "$mkdir $my_gentop"
349 $run $mkdir "$my_gentop"
350 my_status=$?
351 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
352 exit $my_status
355 for my_xlib in $my_oldlibs; do
356 # Extract the objects.
357 case $my_xlib in
358 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
359 *) my_xabs=`pwd`"/$my_xlib" ;;
360 esac
361 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
362 my_xlib_u=$my_xlib
363 while :; do
364 case " $extracted_archives " in
365 *" $my_xlib_u "*)
366 extracted_serial=`expr $extracted_serial + 1`
367 my_xlib_u=lt$extracted_serial-$my_xlib ;;
368 *) break ;;
369 esac
370 done
371 extracted_archives="$extracted_archives $my_xlib_u"
372 my_xdir="$my_gentop/$my_xlib_u"
374 $show "${rm}r $my_xdir"
375 $run ${rm}r "$my_xdir"
376 $show "$mkdir $my_xdir"
377 $run $mkdir "$my_xdir"
378 exit_status=$?
379 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
380 exit $exit_status
382 case $host in
383 *-darwin*)
384 $show "Extracting $my_xabs"
385 # Do not bother doing anything if just a dry run
386 if test -z "$run"; then
387 darwin_orig_dir=`pwd`
388 cd $my_xdir || exit $?
389 darwin_archive=$my_xabs
390 darwin_curdir=`pwd`
391 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
392 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
393 if test -n "$darwin_arches"; then
394 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
395 darwin_arch=
396 $show "$darwin_base_archive has multiple architectures $darwin_arches"
397 for darwin_arch in $darwin_arches ; do
398 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
399 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
400 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
401 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
402 cd "$darwin_curdir"
403 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
404 done # $darwin_arches
405 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
406 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
407 darwin_file=
408 darwin_files=
409 for darwin_file in $darwin_filelist; do
410 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
411 lipo -create -output "$darwin_file" $darwin_files
412 done # $darwin_filelist
413 ${rm}r unfat-$$
414 cd "$darwin_orig_dir"
415 else
416 cd "$darwin_orig_dir"
417 func_extract_an_archive "$my_xdir" "$my_xabs"
418 fi # $darwin_arches
419 fi # $run
422 func_extract_an_archive "$my_xdir" "$my_xabs"
424 esac
425 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
426 done
427 func_extract_archives_result="$my_oldobjs"
429 # End of Shell function definitions
430 #####################################
432 # Darwin sucks
433 eval std_shrext=\"$shrext_cmds\"
435 disable_libs=no
437 # Parse our command line options once, thoroughly.
438 while test "$#" -gt 0
440 arg="$1"
441 shift
443 case $arg in
444 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
445 *) optarg= ;;
446 esac
448 # If the previous option needs an argument, assign it.
449 if test -n "$prev"; then
450 case $prev in
451 execute_dlfiles)
452 execute_dlfiles="$execute_dlfiles $arg"
454 tag)
455 tagname="$arg"
456 preserve_args="${preserve_args}=$arg"
458 # Check whether tagname contains only valid characters
459 case $tagname in
460 *[!-_A-Za-z0-9,/]*)
461 $echo "$progname: invalid tag name: $tagname" 1>&2
462 exit $EXIT_FAILURE
464 esac
466 case $tagname in
468 # Don't test for the "default" C tag, as we know, it's there, but
469 # not specially marked.
472 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
473 taglist="$taglist $tagname"
474 # Evaluate the configuration.
475 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
476 else
477 $echo "$progname: ignoring unknown tag $tagname" 1>&2
480 esac
483 eval "$prev=\$arg"
485 esac
487 prev=
488 prevopt=
489 continue
492 # Have we seen a non-optional argument yet?
493 case $arg in
494 --help)
495 show_help=yes
498 --version)
499 echo "\
500 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
502 Copyright (C) 2007 Free Software Foundation, Inc.
503 This is free software; see the source for copying conditions. There is NO
504 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
505 exit $?
508 --config)
509 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
510 # Now print the configurations for the tags.
511 for tagname in $taglist; do
512 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
513 done
514 exit $?
517 --debug)
518 $echo "$progname: enabling shell trace mode"
519 set -x
520 preserve_args="$preserve_args $arg"
523 --dry-run | -n)
524 run=:
527 --features)
528 $echo "host: $host"
529 if test "$build_libtool_libs" = yes; then
530 $echo "enable shared libraries"
531 else
532 $echo "disable shared libraries"
534 if test "$build_old_libs" = yes; then
535 $echo "enable static libraries"
536 else
537 $echo "disable static libraries"
539 exit $?
542 --finish) mode="finish" ;;
544 --mode) prevopt="--mode" prev=mode ;;
545 --mode=*) mode="$optarg" ;;
547 --preserve-dup-deps) duplicate_deps="yes" ;;
549 --quiet | --silent)
550 show=:
551 preserve_args="$preserve_args $arg"
554 --tag)
555 prevopt="--tag"
556 prev=tag
557 preserve_args="$preserve_args --tag"
559 --tag=*)
560 set tag "$optarg" ${1+"$@"}
561 shift
562 prev=tag
563 preserve_args="$preserve_args --tag"
566 -dlopen)
567 prevopt="-dlopen"
568 prev=execute_dlfiles
572 $echo "$modename: unrecognized option \`$arg'" 1>&2
573 $echo "$help" 1>&2
574 exit $EXIT_FAILURE
578 nonopt="$arg"
579 break
581 esac
582 done
584 if test -n "$prevopt"; then
585 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
586 $echo "$help" 1>&2
587 exit $EXIT_FAILURE
590 case $disable_libs in
591 no)
593 shared)
594 build_libtool_libs=no
595 build_old_libs=yes
597 static)
598 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
600 esac
602 # If this variable is set in any of the actions, the command in it
603 # will be execed at the end. This prevents here-documents from being
604 # left over by shells.
605 exec_cmd=
607 if test -z "$show_help"; then
609 # Infer the operation mode.
610 if test -z "$mode"; then
611 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
612 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
613 case $nonopt in
614 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
615 mode=link
616 for arg
618 case $arg in
620 mode=compile
621 break
623 esac
624 done
626 *db | *dbx | *strace | *truss)
627 mode=execute
629 *install*|cp|mv)
630 mode=install
632 *rm)
633 mode=uninstall
636 # If we have no mode, but dlfiles were specified, then do execute mode.
637 test -n "$execute_dlfiles" && mode=execute
639 # Just use the default operation mode.
640 if test -z "$mode"; then
641 if test -n "$nonopt"; then
642 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
643 else
644 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
648 esac
651 # Only execute mode is allowed to have -dlopen flags.
652 if test -n "$execute_dlfiles" && test "$mode" != execute; then
653 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
654 $echo "$help" 1>&2
655 exit $EXIT_FAILURE
658 # Change the help message to a mode-specific one.
659 generic_help="$help"
660 help="Try \`$modename --help --mode=$mode' for more information."
662 # These modes are in order of execution frequency so that they run quickly.
663 case $mode in
664 # libtool compile mode
665 compile)
666 modename="$modename: compile"
667 # Get the compilation command and the source file.
668 base_compile=
669 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
670 suppress_opt=yes
671 suppress_output=
672 arg_mode=normal
673 libobj=
674 later=
676 for arg
678 case $arg_mode in
679 arg )
680 # do not "continue". Instead, add this to base_compile
681 lastarg="$arg"
682 arg_mode=normal
685 target )
686 libobj="$arg"
687 arg_mode=normal
688 continue
691 normal )
692 # Accept any command-line options.
693 case $arg in
695 if test -n "$libobj" ; then
696 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
697 exit $EXIT_FAILURE
699 arg_mode=target
700 continue
703 -static | -prefer-pic | -prefer-non-pic)
704 later="$later $arg"
705 continue
708 -no-suppress)
709 suppress_opt=no
710 continue
713 -Xcompiler)
714 arg_mode=arg # the next one goes into the "base_compile" arg list
715 continue # The current "srcfile" will either be retained or
716 ;; # replaced later. I would guess that would be a bug.
718 -Wc,*)
719 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
720 lastarg=
721 save_ifs="$IFS"; IFS=','
722 for arg in $args; do
723 IFS="$save_ifs"
725 # Double-quote args containing other shell metacharacters.
726 # Many Bourne shells cannot handle close brackets correctly
727 # in scan sets, so we specify it separately.
728 case $arg in
729 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
730 arg="\"$arg\""
732 esac
733 lastarg="$lastarg $arg"
734 done
735 IFS="$save_ifs"
736 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
738 # Add the arguments to base_compile.
739 base_compile="$base_compile $lastarg"
740 continue
744 # Accept the current argument as the source file.
745 # The previous "srcfile" becomes the current argument.
747 lastarg="$srcfile"
748 srcfile="$arg"
750 esac # case $arg
752 esac # case $arg_mode
754 # Aesthetically quote the previous argument.
755 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
757 case $lastarg in
758 # Double-quote args containing other shell metacharacters.
759 # Many Bourne shells cannot handle close brackets correctly
760 # in scan sets, and some SunOS ksh mistreat backslash-escaping
761 # in scan sets (worked around with variable expansion),
762 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
763 # at all, so we specify them separately.
764 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
765 lastarg="\"$lastarg\""
767 esac
769 base_compile="$base_compile $lastarg"
770 done # for arg
772 case $arg_mode in
773 arg)
774 $echo "$modename: you must specify an argument for -Xcompile"
775 exit $EXIT_FAILURE
777 target)
778 $echo "$modename: you must specify a target with \`-o'" 1>&2
779 exit $EXIT_FAILURE
782 # Get the name of the library object.
783 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
785 esac
787 # Recognize several different file suffixes.
788 # If the user specifies -o file.o, it is replaced with file.lo
789 xform='[cCFSifmso]'
790 case $libobj in
791 *.ada) xform=ada ;;
792 *.adb) xform=adb ;;
793 *.ads) xform=ads ;;
794 *.asm) xform=asm ;;
795 *.c++) xform=c++ ;;
796 *.cc) xform=cc ;;
797 *.ii) xform=ii ;;
798 *.class) xform=class ;;
799 *.cpp) xform=cpp ;;
800 *.cxx) xform=cxx ;;
801 *.[fF][09]?) xform=[fF][09]. ;;
802 *.for) xform=for ;;
803 *.java) xform=java ;;
804 *.obj) xform=obj ;;
805 esac
807 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
809 case $libobj in
810 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
812 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
813 exit $EXIT_FAILURE
815 esac
817 func_infer_tag $base_compile
819 for arg in $later; do
820 case $arg in
821 -static)
822 build_old_libs=yes
823 continue
826 -prefer-pic)
827 pic_mode=yes
828 continue
831 -prefer-non-pic)
832 pic_mode=no
833 continue
835 esac
836 done
838 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
839 case $qlibobj in
840 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
841 qlibobj="\"$qlibobj\"" ;;
842 esac
843 test "X$libobj" != "X$qlibobj" \
844 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
845 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
846 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
847 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
848 if test "X$xdir" = "X$obj"; then
849 xdir=
850 else
851 xdir=$xdir/
853 lobj=${xdir}$objdir/$objname
855 if test -z "$base_compile"; then
856 $echo "$modename: you must specify a compilation command" 1>&2
857 $echo "$help" 1>&2
858 exit $EXIT_FAILURE
861 # Delete any leftover library objects.
862 if test "$build_old_libs" = yes; then
863 removelist="$obj $lobj $libobj ${libobj}T"
864 else
865 removelist="$lobj $libobj ${libobj}T"
868 $run $rm $removelist
869 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
871 # On Cygwin there's no "real" PIC flag so we must build both object types
872 case $host_os in
873 cygwin* | mingw* | pw32* | os2*)
874 pic_mode=default
876 esac
877 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
878 # non-PIC code in shared libraries is not supported
879 pic_mode=default
882 # Calculate the filename of the output object if compiler does
883 # not support -o with -c
884 if test "$compiler_c_o" = no; then
885 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
886 lockfile="$output_obj.lock"
887 removelist="$removelist $output_obj $lockfile"
888 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
889 else
890 output_obj=
891 need_locks=no
892 lockfile=
895 # Lock this critical section if it is needed
896 # We use this script file to make the link, it avoids creating a new file
897 if test "$need_locks" = yes; then
898 until $run ln "$srcfile" "$lockfile" 2>/dev/null; do
899 $show "Waiting for $lockfile to be removed"
900 sleep 2
901 done
902 elif test "$need_locks" = warn; then
903 if test -f "$lockfile"; then
904 $echo "\
905 *** ERROR, $lockfile exists and contains:
906 `cat $lockfile 2>/dev/null`
908 This indicates that another process is trying to use the same
909 temporary object file, and libtool could not work around it because
910 your compiler does not support \`-c' and \`-o' together. If you
911 repeat this compilation, it may succeed, by chance, but you had better
912 avoid parallel builds (make -j) in this platform, or get a better
913 compiler."
915 $run $rm $removelist
916 exit $EXIT_FAILURE
918 $echo "$srcfile" > "$lockfile"
921 if test -n "$fix_srcfile_path"; then
922 eval srcfile=\"$fix_srcfile_path\"
924 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
925 case $qsrcfile in
926 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
927 qsrcfile="\"$qsrcfile\"" ;;
928 esac
930 $run $rm "$libobj" "${libobj}T"
932 # Create a libtool object file (analogous to a ".la" file),
933 # but don't create it if we're doing a dry run.
934 test -z "$run" && cat > ${libobj}T <<EOF
935 # $libobj - a libtool object file
936 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
938 # Please DO NOT delete this file!
939 # It is necessary for linking the library.
941 # Name of the PIC object.
944 # Only build a PIC object if we are building libtool libraries.
945 if test "$build_libtool_libs" = yes; then
946 # Without this assignment, base_compile gets emptied.
947 fbsd_hideous_sh_bug=$base_compile
949 if test "$pic_mode" != no; then
950 command="$base_compile $qsrcfile $pic_flag"
951 else
952 # Don't build PIC code
953 command="$base_compile $qsrcfile"
956 if test ! -d "${xdir}$objdir"; then
957 $show "$mkdir ${xdir}$objdir"
958 $run $mkdir ${xdir}$objdir
959 exit_status=$?
960 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
961 exit $exit_status
965 if test -z "$output_obj"; then
966 # Place PIC objects in $objdir
967 command="$command -o $lobj"
970 $run $rm "$lobj" "$output_obj"
972 $show "$command"
973 if $run eval "$command"; then :
974 else
975 test -n "$output_obj" && $run $rm $removelist
976 exit $EXIT_FAILURE
979 if test "$need_locks" = warn &&
980 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
981 $echo "\
982 *** ERROR, $lockfile contains:
983 `cat $lockfile 2>/dev/null`
985 but it should contain:
986 $srcfile
988 This indicates that another process is trying to use the same
989 temporary object file, and libtool could not work around it because
990 your compiler does not support \`-c' and \`-o' together. If you
991 repeat this compilation, it may succeed, by chance, but you had better
992 avoid parallel builds (make -j) in this platform, or get a better
993 compiler."
995 $run $rm $removelist
996 exit $EXIT_FAILURE
999 # Just move the object if needed, then go on to compile the next one
1000 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1001 $show "$mv $output_obj $lobj"
1002 if $run $mv $output_obj $lobj; then :
1003 else
1004 error=$?
1005 $run $rm $removelist
1006 exit $error
1010 # Append the name of the PIC object to the libtool object file.
1011 test -z "$run" && cat >> ${libobj}T <<EOF
1012 pic_object='$objdir/$objname'
1016 # Allow error messages only from the first compilation.
1017 if test "$suppress_opt" = yes; then
1018 suppress_output=' >/dev/null 2>&1'
1020 else
1021 # No PIC object so indicate it doesn't exist in the libtool
1022 # object file.
1023 test -z "$run" && cat >> ${libobj}T <<EOF
1024 pic_object=none
1029 # Only build a position-dependent object if we build old libraries.
1030 if test "$build_old_libs" = yes; then
1031 if test "$pic_mode" != yes; then
1032 # Don't build PIC code
1033 command="$base_compile $qsrcfile"
1034 else
1035 command="$base_compile $qsrcfile $pic_flag"
1037 if test "$compiler_c_o" = yes; then
1038 command="$command -o $obj"
1041 # Suppress compiler output if we already did a PIC compilation.
1042 command="$command$suppress_output"
1043 $run $rm "$obj" "$output_obj"
1044 $show "$command"
1045 if $run eval "$command"; then :
1046 else
1047 $run $rm $removelist
1048 exit $EXIT_FAILURE
1051 if test "$need_locks" = warn &&
1052 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1053 $echo "\
1054 *** ERROR, $lockfile contains:
1055 `cat $lockfile 2>/dev/null`
1057 but it should contain:
1058 $srcfile
1060 This indicates that another process is trying to use the same
1061 temporary object file, and libtool could not work around it because
1062 your compiler does not support \`-c' and \`-o' together. If you
1063 repeat this compilation, it may succeed, by chance, but you had better
1064 avoid parallel builds (make -j) in this platform, or get a better
1065 compiler."
1067 $run $rm $removelist
1068 exit $EXIT_FAILURE
1071 # Just move the object if needed
1072 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1073 $show "$mv $output_obj $obj"
1074 if $run $mv $output_obj $obj; then :
1075 else
1076 error=$?
1077 $run $rm $removelist
1078 exit $error
1082 # Append the name of the non-PIC object the libtool object file.
1083 # Only append if the libtool object file exists.
1084 test -z "$run" && cat >> ${libobj}T <<EOF
1085 # Name of the non-PIC object.
1086 non_pic_object='$objname'
1089 else
1090 # Append the name of the non-PIC object the libtool object file.
1091 # Only append if the libtool object file exists.
1092 test -z "$run" && cat >> ${libobj}T <<EOF
1093 # Name of the non-PIC object.
1094 non_pic_object=none
1099 $run $mv "${libobj}T" "${libobj}"
1101 # Unlock the critical section if it was locked
1102 if test "$need_locks" != no; then
1103 $run $rm "$lockfile"
1106 exit $EXIT_SUCCESS
1109 # libtool link mode
1110 link | relink)
1111 modename="$modename: link"
1112 case $host in
1113 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1114 # It is impossible to link a dll without this setting, and
1115 # we shouldn't force the makefile maintainer to figure out
1116 # which system we are compiling for in order to pass an extra
1117 # flag for every libtool invocation.
1118 # allow_undefined=no
1120 # FIXME: Unfortunately, there are problems with the above when trying
1121 # to make a dll which has undefined symbols, in which case not
1122 # even a static library is built. For now, we need to specify
1123 # -no-undefined on the libtool link line when we can be certain
1124 # that all symbols are satisfied, otherwise we get a static library.
1125 allow_undefined=yes
1128 allow_undefined=yes
1130 esac
1131 libtool_args="$nonopt"
1132 base_compile="$nonopt $@"
1133 compile_command="$nonopt"
1134 finalize_command="$nonopt"
1136 compile_rpath=
1137 finalize_rpath=
1138 compile_shlibpath=
1139 finalize_shlibpath=
1140 convenience=
1141 old_convenience=
1142 deplibs=
1143 old_deplibs=
1144 compiler_flags=
1145 linker_flags=
1146 dllsearchpath=
1147 lib_search_path=`pwd`
1148 inst_prefix_dir=
1150 avoid_version=no
1151 dlfiles=
1152 dlprefiles=
1153 dlself=no
1154 export_dynamic=no
1155 export_symbols=
1156 export_symbols_regex=
1157 generated=
1158 libobjs=
1159 ltlibs=
1160 module=no
1161 no_install=no
1162 objs=
1163 non_pic_objects=
1164 notinst_path= # paths that contain not-installed libtool libraries
1165 precious_files_regex=
1166 prefer_static_libs=no
1167 preload=no
1168 prev=
1169 prevarg=
1170 release=
1171 rpath=
1172 xrpath=
1173 perm_rpath=
1174 temp_rpath=
1175 thread_safe=no
1176 vinfo=
1177 vinfo_number=no
1179 func_infer_tag $base_compile
1181 # We need to know -static, to get the right output filenames.
1182 for arg
1184 case $arg in
1185 -all-static | -static | -static-libtool-libs)
1186 case $arg in
1187 -all-static)
1188 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1189 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1191 if test -n "$link_static_flag"; then
1192 dlopen_self=$dlopen_self_static
1194 prefer_static_libs=yes
1196 -static)
1197 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1198 dlopen_self=$dlopen_self_static
1200 prefer_static_libs=built
1202 -static-libtool-libs)
1203 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1204 dlopen_self=$dlopen_self_static
1206 prefer_static_libs=yes
1208 esac
1209 build_libtool_libs=no
1210 build_old_libs=yes
1211 break
1213 esac
1214 done
1216 # See if our shared archives depend on static archives.
1217 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1219 # Go through the arguments, transforming them on the way.
1220 while test "$#" -gt 0; do
1221 arg="$1"
1222 shift
1223 case $arg in
1224 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1225 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1227 *) qarg=$arg ;;
1228 esac
1229 libtool_args="$libtool_args $qarg"
1231 # If the previous option needs an argument, assign it.
1232 if test -n "$prev"; then
1233 case $prev in
1234 output)
1235 compile_command="$compile_command @OUTPUT@"
1236 finalize_command="$finalize_command @OUTPUT@"
1238 esac
1240 case $prev in
1241 dlfiles|dlprefiles)
1242 if test "$preload" = no; then
1243 # Add the symbol object into the linking commands.
1244 compile_command="$compile_command @SYMFILE@"
1245 finalize_command="$finalize_command @SYMFILE@"
1246 preload=yes
1248 case $arg in
1249 *.la | *.lo) ;; # We handle these cases below.
1250 force)
1251 if test "$dlself" = no; then
1252 dlself=needless
1253 export_dynamic=yes
1255 prev=
1256 continue
1258 self)
1259 if test "$prev" = dlprefiles; then
1260 dlself=yes
1261 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1262 dlself=yes
1263 else
1264 dlself=needless
1265 export_dynamic=yes
1267 prev=
1268 continue
1271 if test "$prev" = dlfiles; then
1272 dlfiles="$dlfiles $arg"
1273 else
1274 dlprefiles="$dlprefiles $arg"
1276 prev=
1277 continue
1279 esac
1281 expsyms)
1282 export_symbols="$arg"
1283 if test ! -f "$arg"; then
1284 $echo "$modename: symbol file \`$arg' does not exist"
1285 exit $EXIT_FAILURE
1287 prev=
1288 continue
1290 expsyms_regex)
1291 export_symbols_regex="$arg"
1292 prev=
1293 continue
1295 inst_prefix)
1296 inst_prefix_dir="$arg"
1297 prev=
1298 continue
1300 precious_regex)
1301 precious_files_regex="$arg"
1302 prev=
1303 continue
1305 release)
1306 release="-$arg"
1307 prev=
1308 continue
1310 objectlist)
1311 if test -f "$arg"; then
1312 save_arg=$arg
1313 moreargs=
1314 for fil in `cat $save_arg`
1316 # moreargs="$moreargs $fil"
1317 arg=$fil
1318 # A libtool-controlled object.
1320 # Check to see that this really is a libtool object.
1321 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1322 pic_object=
1323 non_pic_object=
1325 # Read the .lo file
1326 # If there is no directory component, then add one.
1327 case $arg in
1328 */* | *\\*) . $arg ;;
1329 *) . ./$arg ;;
1330 esac
1332 if test -z "$pic_object" || \
1333 test -z "$non_pic_object" ||
1334 test "$pic_object" = none && \
1335 test "$non_pic_object" = none; then
1336 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1337 exit $EXIT_FAILURE
1340 # Extract subdirectory from the argument.
1341 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1342 if test "X$xdir" = "X$arg"; then
1343 xdir=
1344 else
1345 xdir="$xdir/"
1348 if test "$pic_object" != none; then
1349 # Prepend the subdirectory the object is found in.
1350 pic_object="$xdir$pic_object"
1352 if test "$prev" = dlfiles; then
1353 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1354 dlfiles="$dlfiles $pic_object"
1355 prev=
1356 continue
1357 else
1358 # If libtool objects are unsupported, then we need to preload.
1359 prev=dlprefiles
1363 # CHECK ME: I think I busted this. -Ossama
1364 if test "$prev" = dlprefiles; then
1365 # Preload the old-style object.
1366 dlprefiles="$dlprefiles $pic_object"
1367 prev=
1370 # A PIC object.
1371 libobjs="$libobjs $pic_object"
1372 arg="$pic_object"
1375 # Non-PIC object.
1376 if test "$non_pic_object" != none; then
1377 # Prepend the subdirectory the object is found in.
1378 non_pic_object="$xdir$non_pic_object"
1380 # A standard non-PIC object
1381 non_pic_objects="$non_pic_objects $non_pic_object"
1382 if test -z "$pic_object" || test "$pic_object" = none ; then
1383 arg="$non_pic_object"
1385 else
1386 # If the PIC object exists, use it instead.
1387 # $xdir was prepended to $pic_object above.
1388 non_pic_object="$pic_object"
1389 non_pic_objects="$non_pic_objects $non_pic_object"
1391 else
1392 # Only an error if not doing a dry-run.
1393 if test -z "$run"; then
1394 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1395 exit $EXIT_FAILURE
1396 else
1397 # Dry-run case.
1399 # Extract subdirectory from the argument.
1400 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1401 if test "X$xdir" = "X$arg"; then
1402 xdir=
1403 else
1404 xdir="$xdir/"
1407 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1408 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1409 libobjs="$libobjs $pic_object"
1410 non_pic_objects="$non_pic_objects $non_pic_object"
1413 done
1414 else
1415 $echo "$modename: link input file \`$save_arg' does not exist"
1416 exit $EXIT_FAILURE
1418 arg=$save_arg
1419 prev=
1420 continue
1422 rpath | xrpath)
1423 # We need an absolute path.
1424 case $arg in
1425 [\\/]* | [A-Za-z]:[\\/]*) ;;
1427 $echo "$modename: only absolute run-paths are allowed" 1>&2
1428 exit $EXIT_FAILURE
1430 esac
1431 if test "$prev" = rpath; then
1432 case "$rpath " in
1433 *" $arg "*) ;;
1434 *) rpath="$rpath $arg" ;;
1435 esac
1436 else
1437 case "$xrpath " in
1438 *" $arg "*) ;;
1439 *) xrpath="$xrpath $arg" ;;
1440 esac
1442 prev=
1443 continue
1445 xcompiler)
1446 compiler_flags="$compiler_flags $qarg"
1447 prev=
1448 compile_command="$compile_command $qarg"
1449 finalize_command="$finalize_command $qarg"
1450 continue
1452 xlinker)
1453 linker_flags="$linker_flags $qarg"
1454 compiler_flags="$compiler_flags $wl$qarg"
1455 prev=
1456 compile_command="$compile_command $wl$qarg"
1457 finalize_command="$finalize_command $wl$qarg"
1458 continue
1460 xcclinker)
1461 linker_flags="$linker_flags $qarg"
1462 compiler_flags="$compiler_flags $qarg"
1463 prev=
1464 compile_command="$compile_command $qarg"
1465 finalize_command="$finalize_command $qarg"
1466 continue
1468 shrext)
1469 shrext_cmds="$arg"
1470 prev=
1471 continue
1473 darwin_framework|darwin_framework_skip)
1474 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1475 compile_command="$compile_command $arg"
1476 finalize_command="$finalize_command $arg"
1477 prev=
1478 continue
1481 eval "$prev=\"\$arg\""
1482 prev=
1483 continue
1485 esac
1486 fi # test -n "$prev"
1488 prevarg="$arg"
1490 case $arg in
1491 -all-static)
1492 if test -n "$link_static_flag"; then
1493 compile_command="$compile_command $link_static_flag"
1494 finalize_command="$finalize_command $link_static_flag"
1496 continue
1499 -allow-undefined)
1500 # FIXME: remove this flag sometime in the future.
1501 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1502 continue
1505 -avoid-version)
1506 avoid_version=yes
1507 continue
1510 -dlopen)
1511 prev=dlfiles
1512 continue
1515 -dlpreopen)
1516 prev=dlprefiles
1517 continue
1520 -export-dynamic)
1521 export_dynamic=yes
1522 continue
1525 -export-symbols | -export-symbols-regex)
1526 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1527 $echo "$modename: more than one -exported-symbols argument is not allowed"
1528 exit $EXIT_FAILURE
1530 if test "X$arg" = "X-export-symbols"; then
1531 prev=expsyms
1532 else
1533 prev=expsyms_regex
1535 continue
1538 -framework|-arch|-isysroot)
1539 case " $CC " in
1540 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1541 prev=darwin_framework_skip ;;
1542 *) compiler_flags="$compiler_flags $arg"
1543 prev=darwin_framework ;;
1544 esac
1545 compile_command="$compile_command $arg"
1546 finalize_command="$finalize_command $arg"
1547 continue
1550 -inst-prefix-dir)
1551 prev=inst_prefix
1552 continue
1555 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1556 # so, if we see these flags be careful not to treat them like -L
1557 -L[A-Z][A-Z]*:*)
1558 case $with_gcc/$host in
1559 no/*-*-irix* | /*-*-irix*)
1560 compile_command="$compile_command $arg"
1561 finalize_command="$finalize_command $arg"
1563 esac
1564 continue
1567 -L*)
1568 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1569 # We need an absolute path.
1570 case $dir in
1571 [\\/]* | [A-Za-z]:[\\/]*) ;;
1573 absdir=`cd "$dir" && pwd`
1574 if test -z "$absdir"; then
1575 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1576 absdir="$dir"
1577 notinst_path="$notinst_path $dir"
1579 dir="$absdir"
1581 esac
1582 case "$deplibs " in
1583 *" -L$dir "*) ;;
1585 deplibs="$deplibs -L$dir"
1586 lib_search_path="$lib_search_path $dir"
1588 esac
1589 case $host in
1590 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1591 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1592 case :$dllsearchpath: in
1593 *":$dir:"*) ;;
1594 *) dllsearchpath="$dllsearchpath:$dir";;
1595 esac
1596 case :$dllsearchpath: in
1597 *":$testbindir:"*) ;;
1598 *) dllsearchpath="$dllsearchpath:$testbindir";;
1599 esac
1601 esac
1602 continue
1605 -l*)
1606 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1607 case $host in
1608 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1609 # These systems don't actually have a C or math library (as such)
1610 continue
1612 *-*-os2*)
1613 # These systems don't actually have a C library (as such)
1614 test "X$arg" = "X-lc" && continue
1616 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1617 # Do not include libc due to us having libc/libc_r.
1618 test "X$arg" = "X-lc" && continue
1620 *-*-rhapsody* | *-*-darwin1.[012])
1621 # Rhapsody C and math libraries are in the System framework
1622 deplibs="$deplibs -framework System"
1623 continue
1625 *-*-sco3.2v5* | *-*-sco5v6*)
1626 # Causes problems with __ctype
1627 test "X$arg" = "X-lc" && continue
1629 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1630 # Compiler inserts libc in the correct place for threads to work
1631 test "X$arg" = "X-lc" && continue
1633 esac
1634 elif test "X$arg" = "X-lc_r"; then
1635 case $host in
1636 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1637 # Do not include libc_r directly, use -pthread flag.
1638 continue
1640 esac
1642 deplibs="$deplibs $arg"
1643 continue
1646 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1647 # classes, name mangling, and exception handling.
1648 -model)
1649 compile_command="$compile_command $arg"
1650 compiler_flags="$compiler_flags $arg"
1651 finalize_command="$finalize_command $arg"
1652 prev=xcompiler
1653 continue
1656 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1657 compiler_flags="$compiler_flags $arg"
1658 compile_command="$compile_command $arg"
1659 finalize_command="$finalize_command $arg"
1660 continue
1663 -module)
1664 module=yes
1665 continue
1668 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1669 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1670 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1671 # +DA*, +DD* enable 64-bit mode on the HP compiler
1672 # -q* pass through compiler args for the IBM compiler
1673 # -m* pass through architecture-specific compiler args for GCC
1674 # -m*, -t[45]*, -txscale* pass through architecture-specific
1675 # compiler args for GCC
1676 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1677 # -F/path gives path to uninstalled frameworks, gcc on darwin
1678 # @file GCC response files
1679 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1680 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1682 # Unknown arguments in both finalize_command and compile_command need
1683 # to be aesthetically quoted because they are evaled later.
1684 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1685 case $arg in
1686 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1687 arg="\"$arg\""
1689 esac
1690 compile_command="$compile_command $arg"
1691 finalize_command="$finalize_command $arg"
1692 compiler_flags="$compiler_flags $arg"
1693 continue
1696 -shrext)
1697 prev=shrext
1698 continue
1701 -no-fast-install)
1702 fast_install=no
1703 continue
1706 -no-install)
1707 case $host in
1708 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1709 # The PATH hackery in wrapper scripts is required on Windows
1710 # and Darwin in order for the loader to find any dlls it needs.
1711 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1712 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1713 fast_install=no
1715 *) no_install=yes ;;
1716 esac
1717 continue
1720 -no-undefined)
1721 allow_undefined=no
1722 continue
1725 -objectlist)
1726 prev=objectlist
1727 continue
1730 -o) prev=output ;;
1732 -precious-files-regex)
1733 prev=precious_regex
1734 continue
1737 -release)
1738 prev=release
1739 continue
1742 -rpath)
1743 prev=rpath
1744 continue
1748 prev=xrpath
1749 continue
1752 -R*)
1753 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1754 # We need an absolute path.
1755 case $dir in
1756 [\\/]* | [A-Za-z]:[\\/]*) ;;
1758 $echo "$modename: only absolute run-paths are allowed" 1>&2
1759 exit $EXIT_FAILURE
1761 esac
1762 case "$xrpath " in
1763 *" $dir "*) ;;
1764 *) xrpath="$xrpath $dir" ;;
1765 esac
1766 continue
1769 -static | -static-libtool-libs)
1770 # The effects of -static are defined in a previous loop.
1771 # We used to do the same as -all-static on platforms that
1772 # didn't have a PIC flag, but the assumption that the effects
1773 # would be equivalent was wrong. It would break on at least
1774 # Digital Unix and AIX.
1775 continue
1778 -thread-safe)
1779 thread_safe=yes
1780 continue
1783 -version-info)
1784 prev=vinfo
1785 continue
1787 -version-number)
1788 prev=vinfo
1789 vinfo_number=yes
1790 continue
1793 -Wc,*)
1794 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1795 arg=
1796 save_ifs="$IFS"; IFS=','
1797 for flag in $args; do
1798 IFS="$save_ifs"
1799 case $flag in
1800 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1801 flag="\"$flag\""
1803 esac
1804 arg="$arg $wl$flag"
1805 compiler_flags="$compiler_flags $flag"
1806 done
1807 IFS="$save_ifs"
1808 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1811 -Wl,*)
1812 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1813 arg=
1814 save_ifs="$IFS"; IFS=','
1815 for flag in $args; do
1816 IFS="$save_ifs"
1817 case $flag in
1818 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1819 flag="\"$flag\""
1821 esac
1822 arg="$arg $wl$flag"
1823 compiler_flags="$compiler_flags $wl$flag"
1824 linker_flags="$linker_flags $flag"
1825 done
1826 IFS="$save_ifs"
1827 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1830 -Xcompiler)
1831 prev=xcompiler
1832 continue
1835 -Xlinker)
1836 prev=xlinker
1837 continue
1840 -XCClinker)
1841 prev=xcclinker
1842 continue
1845 # Some other compiler flag.
1846 -* | +*)
1847 # Unknown arguments in both finalize_command and compile_command need
1848 # to be aesthetically quoted because they are evaled later.
1849 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1850 case $arg in
1851 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1852 arg="\"$arg\""
1854 esac
1857 *.$objext)
1858 # A standard object.
1859 objs="$objs $arg"
1862 *.lo)
1863 # A libtool-controlled object.
1865 # Check to see that this really is a libtool object.
1866 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1867 pic_object=
1868 non_pic_object=
1870 # Read the .lo file
1871 # If there is no directory component, then add one.
1872 case $arg in
1873 */* | *\\*) . $arg ;;
1874 *) . ./$arg ;;
1875 esac
1877 if test -z "$pic_object" || \
1878 test -z "$non_pic_object" ||
1879 test "$pic_object" = none && \
1880 test "$non_pic_object" = none; then
1881 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1882 exit $EXIT_FAILURE
1885 # Extract subdirectory from the argument.
1886 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1887 if test "X$xdir" = "X$arg"; then
1888 xdir=
1889 else
1890 xdir="$xdir/"
1893 if test "$pic_object" != none; then
1894 # Prepend the subdirectory the object is found in.
1895 pic_object="$xdir$pic_object"
1897 if test "$prev" = dlfiles; then
1898 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1899 dlfiles="$dlfiles $pic_object"
1900 prev=
1901 continue
1902 else
1903 # If libtool objects are unsupported, then we need to preload.
1904 prev=dlprefiles
1908 # CHECK ME: I think I busted this. -Ossama
1909 if test "$prev" = dlprefiles; then
1910 # Preload the old-style object.
1911 dlprefiles="$dlprefiles $pic_object"
1912 prev=
1915 # A PIC object.
1916 libobjs="$libobjs $pic_object"
1917 arg="$pic_object"
1920 # Non-PIC object.
1921 if test "$non_pic_object" != none; then
1922 # Prepend the subdirectory the object is found in.
1923 non_pic_object="$xdir$non_pic_object"
1925 # A standard non-PIC object
1926 non_pic_objects="$non_pic_objects $non_pic_object"
1927 if test -z "$pic_object" || test "$pic_object" = none ; then
1928 arg="$non_pic_object"
1930 else
1931 # If the PIC object exists, use it instead.
1932 # $xdir was prepended to $pic_object above.
1933 non_pic_object="$pic_object"
1934 non_pic_objects="$non_pic_objects $non_pic_object"
1936 else
1937 # Only an error if not doing a dry-run.
1938 if test -z "$run"; then
1939 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1940 exit $EXIT_FAILURE
1941 else
1942 # Dry-run case.
1944 # Extract subdirectory from the argument.
1945 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1946 if test "X$xdir" = "X$arg"; then
1947 xdir=
1948 else
1949 xdir="$xdir/"
1952 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1953 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1954 libobjs="$libobjs $pic_object"
1955 non_pic_objects="$non_pic_objects $non_pic_object"
1960 *.$libext)
1961 # An archive.
1962 deplibs="$deplibs $arg"
1963 old_deplibs="$old_deplibs $arg"
1964 continue
1967 *.la)
1968 # A libtool-controlled library.
1970 if test "$prev" = dlfiles; then
1971 # This library was specified with -dlopen.
1972 dlfiles="$dlfiles $arg"
1973 prev=
1974 elif test "$prev" = dlprefiles; then
1975 # The library was specified with -dlpreopen.
1976 dlprefiles="$dlprefiles $arg"
1977 prev=
1978 else
1979 deplibs="$deplibs $arg"
1981 continue
1984 # Some other compiler argument.
1986 # Unknown arguments in both finalize_command and compile_command need
1987 # to be aesthetically quoted because they are evaled later.
1988 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1989 case $arg in
1990 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1991 arg="\"$arg\""
1993 esac
1995 esac # arg
1997 # Now actually substitute the argument into the commands.
1998 if test -n "$arg"; then
1999 compile_command="$compile_command $arg"
2000 finalize_command="$finalize_command $arg"
2002 done # argument parsing loop
2004 if test -n "$prev"; then
2005 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2006 $echo "$help" 1>&2
2007 exit $EXIT_FAILURE
2010 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2011 eval arg=\"$export_dynamic_flag_spec\"
2012 compile_command="$compile_command $arg"
2013 finalize_command="$finalize_command $arg"
2016 oldlibs=
2017 # calculate the name of the file, without its directory
2018 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2019 libobjs_save="$libobjs"
2021 if test -n "$shlibpath_var"; then
2022 # get the directories listed in $shlibpath_var
2023 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2024 else
2025 shlib_search_path=
2027 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2028 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2030 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2031 if test "X$output_objdir" = "X$output"; then
2032 output_objdir="$objdir"
2033 else
2034 output_objdir="$output_objdir/$objdir"
2036 # Create the object directory.
2037 if test ! -d "$output_objdir"; then
2038 $show "$mkdir $output_objdir"
2039 $run $mkdir $output_objdir
2040 exit_status=$?
2041 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2042 exit $exit_status
2046 # Determine the type of output
2047 case $output in
2049 $echo "$modename: you must specify an output file" 1>&2
2050 $echo "$help" 1>&2
2051 exit $EXIT_FAILURE
2053 *.$libext) linkmode=oldlib ;;
2054 *.lo | *.$objext) linkmode=obj ;;
2055 *.la) linkmode=lib ;;
2056 *) linkmode=prog ;; # Anything else should be a program.
2057 esac
2059 case $host in
2060 *cygwin* | *mingw* | *pw32*)
2061 # don't eliminate duplications in $postdeps and $predeps
2062 duplicate_compiler_generated_deps=yes
2065 duplicate_compiler_generated_deps=$duplicate_deps
2067 esac
2068 specialdeplibs=
2070 libs=
2071 # Find all interdependent deplibs by searching for libraries
2072 # that are linked more than once (e.g. -la -lb -la)
2073 for deplib in $deplibs; do
2074 if test "X$duplicate_deps" = "Xyes" ; then
2075 case "$libs " in
2076 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2077 esac
2079 libs="$libs $deplib"
2080 done
2082 if test "$linkmode" = lib; then
2083 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2085 # Compute libraries that are listed more than once in $predeps
2086 # $postdeps and mark them as special (i.e., whose duplicates are
2087 # not to be eliminated).
2088 pre_post_deps=
2089 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2090 for pre_post_dep in $predeps $postdeps; do
2091 case "$pre_post_deps " in
2092 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2093 esac
2094 pre_post_deps="$pre_post_deps $pre_post_dep"
2095 done
2097 pre_post_deps=
2100 deplibs=
2101 newdependency_libs=
2102 newlib_search_path=
2103 need_relink=no # whether we're linking any uninstalled libtool libraries
2104 notinst_deplibs= # not-installed libtool libraries
2105 case $linkmode in
2106 lib)
2107 passes="conv link"
2108 for file in $dlfiles $dlprefiles; do
2109 case $file in
2110 *.la) ;;
2112 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2113 exit $EXIT_FAILURE
2115 esac
2116 done
2118 prog)
2119 compile_deplibs=
2120 finalize_deplibs=
2121 alldeplibs=no
2122 newdlfiles=
2123 newdlprefiles=
2124 passes="conv scan dlopen dlpreopen link"
2126 *) passes="conv"
2128 esac
2129 for pass in $passes; do
2130 if test "$linkmode,$pass" = "lib,link" ||
2131 test "$linkmode,$pass" = "prog,scan"; then
2132 libs="$deplibs"
2133 deplibs=
2135 if test "$linkmode" = prog; then
2136 case $pass in
2137 dlopen) libs="$dlfiles" ;;
2138 dlpreopen) libs="$dlprefiles" ;;
2139 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2140 esac
2142 if test "$pass" = dlopen; then
2143 # Collect dlpreopened libraries
2144 save_deplibs="$deplibs"
2145 deplibs=
2147 for deplib in $libs; do
2148 lib=
2149 found=no
2150 case $deplib in
2151 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2152 if test "$linkmode,$pass" = "prog,link"; then
2153 compile_deplibs="$deplib $compile_deplibs"
2154 finalize_deplibs="$deplib $finalize_deplibs"
2155 else
2156 compiler_flags="$compiler_flags $deplib"
2158 continue
2160 -l*)
2161 if test "$linkmode" != lib && test "$linkmode" != prog; then
2162 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2163 continue
2165 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2166 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2167 for search_ext in .la $std_shrext .so .a; do
2168 # Search the libtool library
2169 lib="$searchdir/lib${name}${search_ext}"
2170 if test -f "$lib"; then
2171 if test "$search_ext" = ".la"; then
2172 found=yes
2173 else
2174 found=no
2176 break 2
2178 done
2179 done
2180 if test "$found" != yes; then
2181 # deplib doesn't seem to be a libtool library
2182 if test "$linkmode,$pass" = "prog,link"; then
2183 compile_deplibs="$deplib $compile_deplibs"
2184 finalize_deplibs="$deplib $finalize_deplibs"
2185 else
2186 deplibs="$deplib $deplibs"
2187 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2189 continue
2190 else # deplib is a libtool library
2191 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2192 # We need to do some special things here, and not later.
2193 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2194 case " $predeps $postdeps " in
2195 *" $deplib "*)
2196 if (${SED} -e '2q' $lib |
2197 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2198 library_names=
2199 old_library=
2200 case $lib in
2201 */* | *\\*) . $lib ;;
2202 *) . ./$lib ;;
2203 esac
2204 for l in $old_library $library_names; do
2205 ll="$l"
2206 done
2207 if test "X$ll" = "X$old_library" ; then # only static version available
2208 found=no
2209 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2210 test "X$ladir" = "X$lib" && ladir="."
2211 lib=$ladir/$old_library
2212 if test "$linkmode,$pass" = "prog,link"; then
2213 compile_deplibs="$deplib $compile_deplibs"
2214 finalize_deplibs="$deplib $finalize_deplibs"
2215 else
2216 deplibs="$deplib $deplibs"
2217 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2219 continue
2223 *) ;;
2224 esac
2227 ;; # -l
2228 -L*)
2229 case $linkmode in
2230 lib)
2231 deplibs="$deplib $deplibs"
2232 test "$pass" = conv && continue
2233 newdependency_libs="$deplib $newdependency_libs"
2234 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2236 prog)
2237 if test "$pass" = conv; then
2238 deplibs="$deplib $deplibs"
2239 continue
2241 if test "$pass" = scan; then
2242 deplibs="$deplib $deplibs"
2243 else
2244 compile_deplibs="$deplib $compile_deplibs"
2245 finalize_deplibs="$deplib $finalize_deplibs"
2247 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2250 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2252 esac # linkmode
2253 continue
2254 ;; # -L
2255 -R*)
2256 if test "$pass" = link; then
2257 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2258 # Make sure the xrpath contains only unique directories.
2259 case "$xrpath " in
2260 *" $dir "*) ;;
2261 *) xrpath="$xrpath $dir" ;;
2262 esac
2264 deplibs="$deplib $deplibs"
2265 continue
2267 *.la) lib="$deplib" ;;
2268 *.$libext)
2269 if test "$pass" = conv; then
2270 deplibs="$deplib $deplibs"
2271 continue
2273 case $linkmode in
2274 lib)
2275 valid_a_lib=no
2276 case $deplibs_check_method in
2277 match_pattern*)
2278 set dummy $deplibs_check_method
2279 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2280 if eval $echo \"$deplib\" 2>/dev/null \
2281 | $SED 10q \
2282 | $EGREP "$match_pattern_regex" > /dev/null; then
2283 valid_a_lib=yes
2286 pass_all)
2287 valid_a_lib=yes
2289 esac
2290 if test "$valid_a_lib" != yes; then
2291 $echo
2292 $echo "*** Warning: Trying to link with static lib archive $deplib."
2293 $echo "*** I have the capability to make that library automatically link in when"
2294 $echo "*** you link to this library. But I can only do this if you have a"
2295 $echo "*** shared version of the library, which you do not appear to have"
2296 $echo "*** because the file extensions .$libext of this argument makes me believe"
2297 $echo "*** that it is just a static archive that I should not used here."
2298 else
2299 $echo
2300 $echo "*** Warning: Linking the shared library $output against the"
2301 $echo "*** static library $deplib is not portable!"
2302 deplibs="$deplib $deplibs"
2304 continue
2306 prog)
2307 if test "$pass" != link; then
2308 deplibs="$deplib $deplibs"
2309 else
2310 compile_deplibs="$deplib $compile_deplibs"
2311 finalize_deplibs="$deplib $finalize_deplibs"
2313 continue
2315 esac # linkmode
2316 ;; # *.$libext
2317 *.lo | *.$objext)
2318 if test "$pass" = conv; then
2319 deplibs="$deplib $deplibs"
2320 elif test "$linkmode" = prog; then
2321 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2322 # If there is no dlopen support or we're linking statically,
2323 # we need to preload.
2324 newdlprefiles="$newdlprefiles $deplib"
2325 compile_deplibs="$deplib $compile_deplibs"
2326 finalize_deplibs="$deplib $finalize_deplibs"
2327 else
2328 newdlfiles="$newdlfiles $deplib"
2331 continue
2333 %DEPLIBS%)
2334 alldeplibs=yes
2335 continue
2337 esac # case $deplib
2338 if test "$found" = yes || test -f "$lib"; then :
2339 else
2340 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2341 exit $EXIT_FAILURE
2344 # Check to see that this really is a libtool archive.
2345 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2346 else
2347 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2348 exit $EXIT_FAILURE
2351 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2352 test "X$ladir" = "X$lib" && ladir="."
2354 dlname=
2355 dlopen=
2356 dlpreopen=
2357 libdir=
2358 library_names=
2359 old_library=
2360 # If the library was installed with an old release of libtool,
2361 # it will not redefine variables installed, or shouldnotlink
2362 installed=yes
2363 shouldnotlink=no
2364 avoidtemprpath=
2367 # Read the .la file
2368 case $lib in
2369 */* | *\\*) . $lib ;;
2370 *) . ./$lib ;;
2371 esac
2373 if test "$linkmode,$pass" = "lib,link" ||
2374 test "$linkmode,$pass" = "prog,scan" ||
2375 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2376 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2377 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2380 if test "$pass" = conv; then
2381 # Only check for convenience libraries
2382 deplibs="$lib $deplibs"
2383 if test -z "$libdir"; then
2384 if test -z "$old_library"; then
2385 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2386 exit $EXIT_FAILURE
2388 # It is a libtool convenience library, so add in its objects.
2389 convenience="$convenience $ladir/$objdir/$old_library"
2390 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2391 tmp_libs=
2392 for deplib in $dependency_libs; do
2393 deplibs="$deplib $deplibs"
2394 if test "X$duplicate_deps" = "Xyes" ; then
2395 case "$tmp_libs " in
2396 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2397 esac
2399 tmp_libs="$tmp_libs $deplib"
2400 done
2401 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2402 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2403 exit $EXIT_FAILURE
2405 continue
2406 fi # $pass = conv
2409 # Get the name of the library we link against.
2410 linklib=
2411 for l in $old_library $library_names; do
2412 linklib="$l"
2413 done
2414 if test -z "$linklib"; then
2415 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2416 exit $EXIT_FAILURE
2419 # This library was specified with -dlopen.
2420 if test "$pass" = dlopen; then
2421 if test -z "$libdir"; then
2422 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2423 exit $EXIT_FAILURE
2425 if test -z "$dlname" ||
2426 test "$dlopen_support" != yes ||
2427 test "$build_libtool_libs" = no; then
2428 # If there is no dlname, no dlopen support or we're linking
2429 # statically, we need to preload. We also need to preload any
2430 # dependent libraries so libltdl's deplib preloader doesn't
2431 # bomb out in the load deplibs phase.
2432 dlprefiles="$dlprefiles $lib $dependency_libs"
2433 else
2434 newdlfiles="$newdlfiles $lib"
2436 continue
2437 fi # $pass = dlopen
2439 # We need an absolute path.
2440 case $ladir in
2441 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2443 abs_ladir=`cd "$ladir" && pwd`
2444 if test -z "$abs_ladir"; then
2445 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2446 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2447 abs_ladir="$ladir"
2450 esac
2451 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2453 # Find the relevant object directory and library name.
2454 if test "X$installed" = Xyes; then
2455 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2456 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2457 dir="$ladir"
2458 absdir="$abs_ladir"
2459 libdir="$abs_ladir"
2460 else
2461 dir="$libdir"
2462 absdir="$libdir"
2464 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2465 else
2466 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2467 dir="$ladir"
2468 absdir="$abs_ladir"
2469 # Remove this search path later
2470 notinst_path="$notinst_path $abs_ladir"
2471 else
2472 dir="$ladir/$objdir"
2473 absdir="$abs_ladir/$objdir"
2474 # Remove this search path later
2475 notinst_path="$notinst_path $abs_ladir"
2477 fi # $installed = yes
2478 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2480 # This library was specified with -dlpreopen.
2481 if test "$pass" = dlpreopen; then
2482 if test -z "$libdir"; then
2483 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2484 exit $EXIT_FAILURE
2486 # Prefer using a static library (so that no silly _DYNAMIC symbols
2487 # are required to link).
2488 if test -n "$old_library"; then
2489 newdlprefiles="$newdlprefiles $dir/$old_library"
2490 # Otherwise, use the dlname, so that lt_dlopen finds it.
2491 elif test -n "$dlname"; then
2492 newdlprefiles="$newdlprefiles $dir/$dlname"
2493 else
2494 newdlprefiles="$newdlprefiles $dir/$linklib"
2496 fi # $pass = dlpreopen
2498 if test -z "$libdir"; then
2499 # Link the convenience library
2500 if test "$linkmode" = lib; then
2501 deplibs="$dir/$old_library $deplibs"
2502 elif test "$linkmode,$pass" = "prog,link"; then
2503 compile_deplibs="$dir/$old_library $compile_deplibs"
2504 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2505 else
2506 deplibs="$lib $deplibs" # used for prog,scan pass
2508 continue
2512 if test "$linkmode" = prog && test "$pass" != link; then
2513 newlib_search_path="$newlib_search_path $ladir"
2514 deplibs="$lib $deplibs"
2516 linkalldeplibs=no
2517 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2518 test "$build_libtool_libs" = no; then
2519 linkalldeplibs=yes
2522 tmp_libs=
2523 for deplib in $dependency_libs; do
2524 case $deplib in
2525 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2526 esac
2527 # Need to link against all dependency_libs?
2528 if test "$linkalldeplibs" = yes; then
2529 deplibs="$deplib $deplibs"
2530 else
2531 # Need to hardcode shared library paths
2532 # or/and link against static libraries
2533 newdependency_libs="$deplib $newdependency_libs"
2535 if test "X$duplicate_deps" = "Xyes" ; then
2536 case "$tmp_libs " in
2537 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2538 esac
2540 tmp_libs="$tmp_libs $deplib"
2541 done # for deplib
2542 continue
2543 fi # $linkmode = prog...
2545 if test "$linkmode,$pass" = "prog,link"; then
2546 if test -n "$library_names" &&
2547 { { test "$prefer_static_libs" = no ||
2548 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2549 test -z "$old_library"; }; then
2550 # We need to hardcode the library path
2551 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2552 # Make sure the rpath contains only unique directories.
2553 case "$temp_rpath " in
2554 *" $dir "*) ;;
2555 *" $absdir "*) ;;
2556 *) temp_rpath="$temp_rpath $absdir" ;;
2557 esac
2560 # Hardcode the library path.
2561 # Skip directories that are in the system default run-time
2562 # search path.
2563 case " $sys_lib_dlsearch_path " in
2564 *" $absdir "*) ;;
2566 case "$compile_rpath " in
2567 *" $absdir "*) ;;
2568 *) compile_rpath="$compile_rpath $absdir"
2569 esac
2571 esac
2572 case " $sys_lib_dlsearch_path " in
2573 *" $libdir "*) ;;
2575 case "$finalize_rpath " in
2576 *" $libdir "*) ;;
2577 *) finalize_rpath="$finalize_rpath $libdir"
2578 esac
2580 esac
2581 fi # $linkmode,$pass = prog,link...
2583 if test "$alldeplibs" = yes &&
2584 { test "$deplibs_check_method" = pass_all ||
2585 { test "$build_libtool_libs" = yes &&
2586 test -n "$library_names"; }; }; then
2587 # We only need to search for static libraries
2588 continue
2592 link_static=no # Whether the deplib will be linked statically
2593 use_static_libs=$prefer_static_libs
2594 if test "$use_static_libs" = built && test "$installed" = yes ; then
2595 use_static_libs=no
2597 if test -n "$library_names" &&
2598 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2599 if test "$installed" = no; then
2600 notinst_deplibs="$notinst_deplibs $lib"
2601 need_relink=yes
2603 # This is a shared library
2605 # Warn about portability, can't link against -module's on
2606 # some systems (darwin)
2607 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2608 $echo
2609 if test "$linkmode" = prog; then
2610 $echo "*** Warning: Linking the executable $output against the loadable module"
2611 else
2612 $echo "*** Warning: Linking the shared library $output against the loadable module"
2614 $echo "*** $linklib is not portable!"
2616 if test "$linkmode" = lib &&
2617 test "$hardcode_into_libs" = yes; then
2618 # Hardcode the library path.
2619 # Skip directories that are in the system default run-time
2620 # search path.
2621 case " $sys_lib_dlsearch_path " in
2622 *" $absdir "*) ;;
2624 case "$compile_rpath " in
2625 *" $absdir "*) ;;
2626 *) compile_rpath="$compile_rpath $absdir"
2627 esac
2629 esac
2630 case " $sys_lib_dlsearch_path " in
2631 *" $libdir "*) ;;
2633 case "$finalize_rpath " in
2634 *" $libdir "*) ;;
2635 *) finalize_rpath="$finalize_rpath $libdir"
2636 esac
2638 esac
2641 if test -n "$old_archive_from_expsyms_cmds"; then
2642 # figure out the soname
2643 set dummy $library_names
2644 realname="$2"
2645 shift; shift
2646 libname=`eval \\$echo \"$libname_spec\"`
2647 # use dlname if we got it. it's perfectly good, no?
2648 if test -n "$dlname"; then
2649 soname="$dlname"
2650 elif test -n "$soname_spec"; then
2651 # bleh windows
2652 case $host in
2653 *cygwin* | mingw*)
2654 major=`expr $current - $age`
2655 versuffix="-$major"
2657 esac
2658 eval soname=\"$soname_spec\"
2659 else
2660 soname="$realname"
2663 # Make a new name for the extract_expsyms_cmds to use
2664 soroot="$soname"
2665 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2666 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2668 # If the library has no export list, then create one now
2669 if test -f "$output_objdir/$soname-def"; then :
2670 else
2671 $show "extracting exported symbol list from \`$soname'"
2672 save_ifs="$IFS"; IFS='~'
2673 cmds=$extract_expsyms_cmds
2674 for cmd in $cmds; do
2675 IFS="$save_ifs"
2676 eval cmd=\"$cmd\"
2677 $show "$cmd"
2678 $run eval "$cmd" || exit $?
2679 done
2680 IFS="$save_ifs"
2683 # Create $newlib
2684 if test -f "$output_objdir/$newlib"; then :; else
2685 $show "generating import library for \`$soname'"
2686 save_ifs="$IFS"; IFS='~'
2687 cmds=$old_archive_from_expsyms_cmds
2688 for cmd in $cmds; do
2689 IFS="$save_ifs"
2690 eval cmd=\"$cmd\"
2691 $show "$cmd"
2692 $run eval "$cmd" || exit $?
2693 done
2694 IFS="$save_ifs"
2696 # make sure the library variables are pointing to the new library
2697 dir=$output_objdir
2698 linklib=$newlib
2699 fi # test -n "$old_archive_from_expsyms_cmds"
2701 if test "$linkmode" = prog || test "$mode" != relink; then
2702 add_shlibpath=
2703 add_dir=
2704 add=
2705 lib_linked=yes
2706 case $hardcode_action in
2707 immediate | unsupported)
2708 if test "$hardcode_direct" = no; then
2709 add="$dir/$linklib"
2710 case $host in
2711 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2712 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2713 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2714 *-*-unixware7*) add_dir="-L$dir" ;;
2715 *-*-darwin* )
2716 # if the lib is a module then we can not link against
2717 # it, someone is ignoring the new warnings I added
2718 if /usr/bin/file -L $add 2> /dev/null |
2719 $EGREP ": [^:]* bundle" >/dev/null ; then
2720 $echo "** Warning, lib $linklib is a module, not a shared library"
2721 if test -z "$old_library" ; then
2722 $echo
2723 $echo "** And there doesn't seem to be a static archive available"
2724 $echo "** The link will probably fail, sorry"
2725 else
2726 add="$dir/$old_library"
2729 esac
2730 elif test "$hardcode_minus_L" = no; then
2731 case $host in
2732 *-*-sunos*) add_shlibpath="$dir" ;;
2733 esac
2734 add_dir="-L$dir"
2735 add="-l$name"
2736 elif test "$hardcode_shlibpath_var" = no; then
2737 add_shlibpath="$dir"
2738 add="-l$name"
2739 else
2740 lib_linked=no
2743 relink)
2744 if test "$hardcode_direct" = yes; then
2745 add="$dir/$linklib"
2746 elif test "$hardcode_minus_L" = yes; then
2747 add_dir="-L$dir"
2748 # Try looking first in the location we're being installed to.
2749 if test -n "$inst_prefix_dir"; then
2750 case $libdir in
2751 [\\/]*)
2752 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2754 esac
2756 add="-l$name"
2757 elif test "$hardcode_shlibpath_var" = yes; then
2758 add_shlibpath="$dir"
2759 add="-l$name"
2760 else
2761 lib_linked=no
2764 *) lib_linked=no ;;
2765 esac
2767 if test "$lib_linked" != yes; then
2768 $echo "$modename: configuration error: unsupported hardcode properties"
2769 exit $EXIT_FAILURE
2772 if test -n "$add_shlibpath"; then
2773 case :$compile_shlibpath: in
2774 *":$add_shlibpath:"*) ;;
2775 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2776 esac
2778 if test "$linkmode" = prog; then
2779 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2780 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2781 else
2782 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2783 test -n "$add" && deplibs="$add $deplibs"
2784 if test "$hardcode_direct" != yes && \
2785 test "$hardcode_minus_L" != yes && \
2786 test "$hardcode_shlibpath_var" = yes; then
2787 case :$finalize_shlibpath: in
2788 *":$libdir:"*) ;;
2789 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2790 esac
2795 if test "$linkmode" = prog || test "$mode" = relink; then
2796 add_shlibpath=
2797 add_dir=
2798 add=
2799 # Finalize command for both is simple: just hardcode it.
2800 if test "$hardcode_direct" = yes; then
2801 add="$libdir/$linklib"
2802 elif test "$hardcode_minus_L" = yes; then
2803 add_dir="-L$libdir"
2804 add="-l$name"
2805 elif test "$hardcode_shlibpath_var" = yes; then
2806 case :$finalize_shlibpath: in
2807 *":$libdir:"*) ;;
2808 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2809 esac
2810 add="-l$name"
2811 elif test "$hardcode_automatic" = yes; then
2812 if test -n "$inst_prefix_dir" &&
2813 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2814 add="$inst_prefix_dir$libdir/$linklib"
2815 else
2816 add="$libdir/$linklib"
2818 else
2819 # We cannot seem to hardcode it, guess we'll fake it.
2820 add_dir="-L$libdir"
2821 # Try looking first in the location we're being installed to.
2822 if test -n "$inst_prefix_dir"; then
2823 case $libdir in
2824 [\\/]*)
2825 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2827 esac
2829 add="-l$name"
2832 if test "$linkmode" = prog; then
2833 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2834 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2835 else
2836 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2837 test -n "$add" && deplibs="$add $deplibs"
2840 elif test "$linkmode" = prog; then
2841 # Here we assume that one of hardcode_direct or hardcode_minus_L
2842 # is not unsupported. This is valid on all known static and
2843 # shared platforms.
2844 if test "$hardcode_direct" != unsupported; then
2845 test -n "$old_library" && linklib="$old_library"
2846 compile_deplibs="$dir/$linklib $compile_deplibs"
2847 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2848 else
2849 compile_deplibs="-l$name -L$dir $compile_deplibs"
2850 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2852 elif test "$build_libtool_libs" = yes; then
2853 # Not a shared library
2854 if test "$deplibs_check_method" != pass_all; then
2855 # We're trying link a shared library against a static one
2856 # but the system doesn't support it.
2858 # Just print a warning and add the library to dependency_libs so
2859 # that the program can be linked against the static library.
2860 $echo
2861 $echo "*** Warning: This system can not link to static lib archive $lib."
2862 $echo "*** I have the capability to make that library automatically link in when"
2863 $echo "*** you link to this library. But I can only do this if you have a"
2864 $echo "*** shared version of the library, which you do not appear to have."
2865 if test "$module" = yes; then
2866 $echo "*** But as you try to build a module library, libtool will still create "
2867 $echo "*** a static module, that should work as long as the dlopening application"
2868 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2869 if test -z "$global_symbol_pipe"; then
2870 $echo
2871 $echo "*** However, this would only work if libtool was able to extract symbol"
2872 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2873 $echo "*** not find such a program. So, this module is probably useless."
2874 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2876 if test "$build_old_libs" = no; then
2877 build_libtool_libs=module
2878 build_old_libs=yes
2879 else
2880 build_libtool_libs=no
2883 else
2884 deplibs="$dir/$old_library $deplibs"
2885 link_static=yes
2887 fi # link shared/static library?
2889 if test "$linkmode" = lib; then
2890 if test -n "$dependency_libs" &&
2891 { test "$hardcode_into_libs" != yes ||
2892 test "$build_old_libs" = yes ||
2893 test "$link_static" = yes; }; then
2894 # Extract -R from dependency_libs
2895 temp_deplibs=
2896 for libdir in $dependency_libs; do
2897 case $libdir in
2898 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2899 case " $xrpath " in
2900 *" $temp_xrpath "*) ;;
2901 *) xrpath="$xrpath $temp_xrpath";;
2902 esac;;
2903 *) temp_deplibs="$temp_deplibs $libdir";;
2904 esac
2905 done
2906 dependency_libs="$temp_deplibs"
2909 newlib_search_path="$newlib_search_path $absdir"
2910 # Link against this library
2911 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2912 # ... and its dependency_libs
2913 tmp_libs=
2914 for deplib in $dependency_libs; do
2915 newdependency_libs="$deplib $newdependency_libs"
2916 if test "X$duplicate_deps" = "Xyes" ; then
2917 case "$tmp_libs " in
2918 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2919 esac
2921 tmp_libs="$tmp_libs $deplib"
2922 done
2924 if test "$link_all_deplibs" != no; then
2925 # Add the search paths of all dependency libraries
2926 for deplib in $dependency_libs; do
2927 case $deplib in
2928 -L*) path="$deplib" ;;
2929 *.la)
2930 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2931 test "X$dir" = "X$deplib" && dir="."
2932 # We need an absolute path.
2933 case $dir in
2934 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2936 absdir=`cd "$dir" && pwd`
2937 if test -z "$absdir"; then
2938 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2939 absdir="$dir"
2942 esac
2943 if grep "^installed=no" $deplib > /dev/null; then
2944 path="$absdir/$objdir"
2945 else
2946 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2947 if test -z "$libdir"; then
2948 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2949 exit $EXIT_FAILURE
2951 if test "$absdir" != "$libdir"; then
2952 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2954 path="$absdir"
2956 depdepl=
2957 case $host in
2958 *-*-darwin*)
2959 # we do not want to link against static libs,
2960 # but need to link against shared
2961 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2962 if test -n "$deplibrary_names" ; then
2963 for tmp in $deplibrary_names ; do
2964 depdepl=$tmp
2965 done
2966 if test -f "$path/$depdepl" ; then
2967 depdepl="$path/$depdepl"
2969 # do not add paths which are already there
2970 case " $newlib_search_path " in
2971 *" $path "*) ;;
2972 *) newlib_search_path="$newlib_search_path $path";;
2973 esac
2975 path=""
2978 path="-L$path"
2980 esac
2982 -l*)
2983 case $host in
2984 *-*-darwin*)
2985 # Again, we only want to link against shared libraries
2986 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2987 for tmp in $newlib_search_path ; do
2988 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2989 eval depdepl="$tmp/lib$tmp_libs.dylib"
2990 break
2992 done
2993 path=""
2995 *) continue ;;
2996 esac
2998 *) continue ;;
2999 esac
3000 case " $deplibs " in
3001 *" $path "*) ;;
3002 *) deplibs="$path $deplibs" ;;
3003 esac
3004 case " $deplibs " in
3005 *" $depdepl "*) ;;
3006 *) deplibs="$depdepl $deplibs" ;;
3007 esac
3008 done
3009 fi # link_all_deplibs != no
3010 fi # linkmode = lib
3011 done # for deplib in $libs
3012 dependency_libs="$newdependency_libs"
3013 if test "$pass" = dlpreopen; then
3014 # Link the dlpreopened libraries before other libraries
3015 for deplib in $save_deplibs; do
3016 deplibs="$deplib $deplibs"
3017 done
3019 if test "$pass" != dlopen; then
3020 if test "$pass" != conv; then
3021 # Make sure lib_search_path contains only unique directories.
3022 lib_search_path=
3023 for dir in $newlib_search_path; do
3024 case "$lib_search_path " in
3025 *" $dir "*) ;;
3026 *) lib_search_path="$lib_search_path $dir" ;;
3027 esac
3028 done
3029 newlib_search_path=
3032 if test "$linkmode,$pass" != "prog,link"; then
3033 vars="deplibs"
3034 else
3035 vars="compile_deplibs finalize_deplibs"
3037 for var in $vars dependency_libs; do
3038 # Add libraries to $var in reverse order
3039 eval tmp_libs=\"\$$var\"
3040 new_libs=
3041 for deplib in $tmp_libs; do
3042 # FIXME: Pedantically, this is the right thing to do, so
3043 # that some nasty dependency loop isn't accidentally
3044 # broken:
3045 #new_libs="$deplib $new_libs"
3046 # Pragmatically, this seems to cause very few problems in
3047 # practice:
3048 case $deplib in
3049 -L*) new_libs="$deplib $new_libs" ;;
3050 -R*) ;;
3052 # And here is the reason: when a library appears more
3053 # than once as an explicit dependence of a library, or
3054 # is implicitly linked in more than once by the
3055 # compiler, it is considered special, and multiple
3056 # occurrences thereof are not removed. Compare this
3057 # with having the same library being listed as a
3058 # dependency of multiple other libraries: in this case,
3059 # we know (pedantically, we assume) the library does not
3060 # need to be listed more than once, so we keep only the
3061 # last copy. This is not always right, but it is rare
3062 # enough that we require users that really mean to play
3063 # such unportable linking tricks to link the library
3064 # using -Wl,-lname, so that libtool does not consider it
3065 # for duplicate removal.
3066 case " $specialdeplibs " in
3067 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3069 case " $new_libs " in
3070 *" $deplib "*) ;;
3071 *) new_libs="$deplib $new_libs" ;;
3072 esac
3074 esac
3076 esac
3077 done
3078 tmp_libs=
3079 for deplib in $new_libs; do
3080 case $deplib in
3081 -L*)
3082 case " $tmp_libs " in
3083 *" $deplib "*) ;;
3084 *) tmp_libs="$tmp_libs $deplib" ;;
3085 esac
3087 *) tmp_libs="$tmp_libs $deplib" ;;
3088 esac
3089 done
3090 eval $var=\"$tmp_libs\"
3091 done # for var
3093 # Last step: remove runtime libs from dependency_libs
3094 # (they stay in deplibs)
3095 tmp_libs=
3096 for i in $dependency_libs ; do
3097 case " $predeps $postdeps $compiler_lib_search_path " in
3098 *" $i "*)
3099 i=""
3101 esac
3102 if test -n "$i" ; then
3103 tmp_libs="$tmp_libs $i"
3105 done
3106 dependency_libs=$tmp_libs
3107 done # for pass
3108 if test "$linkmode" = prog; then
3109 dlfiles="$newdlfiles"
3110 dlprefiles="$newdlprefiles"
3113 case $linkmode in
3114 oldlib)
3115 if test -n "$deplibs"; then
3116 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3119 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3120 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3123 if test -n "$rpath"; then
3124 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3127 if test -n "$xrpath"; then
3128 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3131 if test -n "$vinfo"; then
3132 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3135 if test -n "$release"; then
3136 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3139 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3140 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3143 # Now set the variables for building old libraries.
3144 build_libtool_libs=no
3145 oldlibs="$output"
3146 objs="$objs$old_deplibs"
3149 lib)
3150 # Make sure we only generate libraries of the form `libNAME.la'.
3151 case $outputname in
3152 lib*)
3153 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3154 eval shared_ext=\"$shrext_cmds\"
3155 eval libname=\"$libname_spec\"
3158 if test "$module" = no; then
3159 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3160 $echo "$help" 1>&2
3161 exit $EXIT_FAILURE
3163 if test "$need_lib_prefix" != no; then
3164 # Add the "lib" prefix for modules if required
3165 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3166 eval shared_ext=\"$shrext_cmds\"
3167 eval libname=\"$libname_spec\"
3168 else
3169 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3172 esac
3174 if test -n "$objs"; then
3175 if test "$deplibs_check_method" != pass_all; then
3176 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3177 exit $EXIT_FAILURE
3178 else
3179 $echo
3180 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3181 $echo "*** objects $objs is not portable!"
3182 libobjs="$libobjs $objs"
3186 if test "$dlself" != no; then
3187 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3190 set dummy $rpath
3191 if test "$#" -gt 2; then
3192 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3194 install_libdir="$2"
3196 oldlibs=
3197 if test -z "$rpath"; then
3198 if test "$build_libtool_libs" = yes; then
3199 # Building a libtool convenience library.
3200 # Some compilers have problems with a `.al' extension so
3201 # convenience libraries should have the same extension an
3202 # archive normally would.
3203 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3204 build_libtool_libs=convenience
3205 build_old_libs=yes
3208 if test -n "$vinfo"; then
3209 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3212 if test -n "$release"; then
3213 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3215 else
3217 # Parse the version information argument.
3218 save_ifs="$IFS"; IFS=':'
3219 set dummy $vinfo 0 0 0
3220 IFS="$save_ifs"
3222 if test -n "$8"; then
3223 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3224 $echo "$help" 1>&2
3225 exit $EXIT_FAILURE
3228 # convert absolute version numbers to libtool ages
3229 # this retains compatibility with .la files and attempts
3230 # to make the code below a bit more comprehensible
3232 case $vinfo_number in
3233 yes)
3234 number_major="$2"
3235 number_minor="$3"
3236 number_revision="$4"
3238 # There are really only two kinds -- those that
3239 # use the current revision as the major version
3240 # and those that subtract age and use age as
3241 # a minor version. But, then there is irix
3242 # which has an extra 1 added just for fun
3244 case $version_type in
3245 darwin|linux|osf|windows|none)
3246 current=`expr $number_major + $number_minor`
3247 age="$number_minor"
3248 revision="$number_revision"
3250 freebsd-aout|freebsd-elf|sunos)
3251 current="$number_major"
3252 revision="$number_minor"
3253 age="0"
3255 irix|nonstopux)
3256 current=`expr $number_major + $number_minor`
3257 age="$number_minor"
3258 revision="$number_minor"
3259 lt_irix_increment=no
3261 esac
3264 current="$2"
3265 revision="$3"
3266 age="$4"
3268 esac
3270 # Check that each of the things are valid numbers.
3271 case $current in
3272 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]) ;;
3274 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3275 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3276 exit $EXIT_FAILURE
3278 esac
3280 case $revision in
3281 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]) ;;
3283 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3284 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3285 exit $EXIT_FAILURE
3287 esac
3289 case $age in
3290 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]) ;;
3292 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3293 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3294 exit $EXIT_FAILURE
3296 esac
3298 if test "$age" -gt "$current"; then
3299 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3300 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3301 exit $EXIT_FAILURE
3304 # Calculate the version variables.
3305 major=
3306 versuffix=
3307 verstring=
3308 case $version_type in
3309 none) ;;
3311 darwin)
3312 # Like Linux, but with the current version available in
3313 # verstring for coding it into the library header
3314 major=.`expr $current - $age`
3315 versuffix="$major.$age.$revision"
3316 # Darwin ld doesn't like 0 for these options...
3317 minor_current=`expr $current + 1`
3318 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3319 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3322 freebsd-aout)
3323 major=".$current"
3324 versuffix=".$current.$revision";
3327 freebsd-elf)
3328 major=".$current"
3329 versuffix=".$current";
3332 irix | nonstopux)
3333 if test "X$lt_irix_increment" = "Xno"; then
3334 major=`expr $current - $age`
3335 else
3336 major=`expr $current - $age + 1`
3338 case $version_type in
3339 nonstopux) verstring_prefix=nonstopux ;;
3340 *) verstring_prefix=sgi ;;
3341 esac
3342 verstring="$verstring_prefix$major.$revision"
3344 # Add in all the interfaces that we are compatible with.
3345 loop=$revision
3346 while test "$loop" -ne 0; do
3347 iface=`expr $revision - $loop`
3348 loop=`expr $loop - 1`
3349 verstring="$verstring_prefix$major.$iface:$verstring"
3350 done
3352 # Before this point, $major must not contain `.'.
3353 major=.$major
3354 versuffix="$major.$revision"
3357 linux)
3358 major=.`expr $current - $age`
3359 versuffix="$major.$age.$revision"
3362 osf)
3363 major=.`expr $current - $age`
3364 versuffix=".$current.$age.$revision"
3365 verstring="$current.$age.$revision"
3367 # Add in all the interfaces that we are compatible with.
3368 loop=$age
3369 while test "$loop" -ne 0; do
3370 iface=`expr $current - $loop`
3371 loop=`expr $loop - 1`
3372 verstring="$verstring:${iface}.0"
3373 done
3375 # Make executables depend on our current version.
3376 verstring="$verstring:${current}.0"
3379 sunos)
3380 major=".$current"
3381 versuffix=".$current.$revision"
3384 windows)
3385 # Use '-' rather than '.', since we only want one
3386 # extension on DOS 8.3 filesystems.
3387 major=`expr $current - $age`
3388 versuffix="-$major"
3392 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3393 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3394 exit $EXIT_FAILURE
3396 esac
3398 # Clear the version info if we defaulted, and they specified a release.
3399 if test -z "$vinfo" && test -n "$release"; then
3400 major=
3401 case $version_type in
3402 darwin)
3403 # we can't check for "0.0" in archive_cmds due to quoting
3404 # problems, so we reset it completely
3405 verstring=
3408 verstring="0.0"
3410 esac
3411 if test "$need_version" = no; then
3412 versuffix=
3413 else
3414 versuffix=".0.0"
3418 # Remove version info from name if versioning should be avoided
3419 if test "$avoid_version" = yes && test "$need_version" = no; then
3420 major=
3421 versuffix=
3422 verstring=""
3425 # Check to see if the archive will have undefined symbols.
3426 if test "$allow_undefined" = yes; then
3427 if test "$allow_undefined_flag" = unsupported; then
3428 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3429 build_libtool_libs=no
3430 build_old_libs=yes
3432 else
3433 # Don't allow undefined symbols.
3434 allow_undefined_flag="$no_undefined_flag"
3438 if test "$mode" != relink; then
3439 # Remove our outputs, but don't remove object files since they
3440 # may have been created when compiling PIC objects.
3441 removelist=
3442 tempremovelist=`$echo "$output_objdir/*"`
3443 for p in $tempremovelist; do
3444 case $p in
3445 *.$objext)
3447 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3448 if test "X$precious_files_regex" != "X"; then
3449 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3450 then
3451 continue
3454 removelist="$removelist $p"
3456 *) ;;
3457 esac
3458 done
3459 if test -n "$removelist"; then
3460 $show "${rm}r $removelist"
3461 $run ${rm}r $removelist
3465 # Now set the variables for building old libraries.
3466 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3467 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3469 # Transform .lo files to .o files.
3470 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3473 # Eliminate all temporary directories.
3474 #for path in $notinst_path; do
3475 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3476 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3477 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3478 #done
3480 if test -n "$xrpath"; then
3481 # If the user specified any rpath flags, then add them.
3482 temp_xrpath=
3483 for libdir in $xrpath; do
3484 temp_xrpath="$temp_xrpath -R$libdir"
3485 case "$finalize_rpath " in
3486 *" $libdir "*) ;;
3487 *) finalize_rpath="$finalize_rpath $libdir" ;;
3488 esac
3489 done
3490 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3491 dependency_libs="$temp_xrpath $dependency_libs"
3495 # Make sure dlfiles contains only unique files that won't be dlpreopened
3496 old_dlfiles="$dlfiles"
3497 dlfiles=
3498 for lib in $old_dlfiles; do
3499 case " $dlprefiles $dlfiles " in
3500 *" $lib "*) ;;
3501 *) dlfiles="$dlfiles $lib" ;;
3502 esac
3503 done
3505 # Make sure dlprefiles contains only unique files
3506 old_dlprefiles="$dlprefiles"
3507 dlprefiles=
3508 for lib in $old_dlprefiles; do
3509 case "$dlprefiles " in
3510 *" $lib "*) ;;
3511 *) dlprefiles="$dlprefiles $lib" ;;
3512 esac
3513 done
3515 if test "$build_libtool_libs" = yes; then
3516 if test -n "$rpath"; then
3517 case $host in
3518 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3519 # these systems don't actually have a c library (as such)!
3521 *-*-rhapsody* | *-*-darwin1.[012])
3522 # Rhapsody C library is in the System framework
3523 deplibs="$deplibs -framework System"
3525 *-*-netbsd*)
3526 # Don't link with libc until the a.out ld.so is fixed.
3528 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3529 # Do not include libc due to us having libc/libc_r.
3531 *-*-sco3.2v5* | *-*-sco5v6*)
3532 # Causes problems with __ctype
3534 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3535 # Compiler inserts libc in the correct place for threads to work
3538 # Add libc to deplibs on all other systems if necessary.
3539 if test "$build_libtool_need_lc" = "yes"; then
3540 deplibs="$deplibs -lc"
3543 esac
3546 # Transform deplibs into only deplibs that can be linked in shared.
3547 name_save=$name
3548 libname_save=$libname
3549 release_save=$release
3550 versuffix_save=$versuffix
3551 major_save=$major
3552 # I'm not sure if I'm treating the release correctly. I think
3553 # release should show up in the -l (ie -lgmp5) so we don't want to
3554 # add it in twice. Is that correct?
3555 release=""
3556 versuffix=""
3557 major=""
3558 newdeplibs=
3559 droppeddeps=no
3560 case $deplibs_check_method in
3561 pass_all)
3562 # Don't check for shared/static. Everything works.
3563 # This might be a little naive. We might want to check
3564 # whether the library exists or not. But this is on
3565 # osf3 & osf4 and I'm not really sure... Just
3566 # implementing what was already the behavior.
3567 newdeplibs=$deplibs
3569 test_compile)
3570 # This code stresses the "libraries are programs" paradigm to its
3571 # limits. Maybe even breaks it. We compile a program, linking it
3572 # against the deplibs as a proxy for the library. Then we can check
3573 # whether they linked in statically or dynamically with ldd.
3574 $rm conftest.c
3575 cat > conftest.c <<EOF
3576 int main() { return 0; }
3578 $rm conftest
3579 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3580 ldd_output=`ldd conftest`
3581 for i in $deplibs; do
3582 name=`expr $i : '-l\(.*\)'`
3583 # If $name is empty we are operating on a -L argument.
3584 if test "$name" != "" && test "$name" != "0"; then
3585 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3586 case " $predeps $postdeps " in
3587 *" $i "*)
3588 newdeplibs="$newdeplibs $i"
3589 i=""
3591 esac
3593 if test -n "$i" ; then
3594 libname=`eval \\$echo \"$libname_spec\"`
3595 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3596 set dummy $deplib_matches
3597 deplib_match=$2
3598 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3599 newdeplibs="$newdeplibs $i"
3600 else
3601 droppeddeps=yes
3602 $echo
3603 $echo "*** Warning: dynamic linker does not accept needed library $i."
3604 $echo "*** I have the capability to make that library automatically link in when"
3605 $echo "*** you link to this library. But I can only do this if you have a"
3606 $echo "*** shared version of the library, which I believe you do not have"
3607 $echo "*** because a test_compile did reveal that the linker did not use it for"
3608 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3611 else
3612 newdeplibs="$newdeplibs $i"
3614 done
3615 else
3616 # Error occurred in the first compile. Let's try to salvage
3617 # the situation: Compile a separate program for each library.
3618 for i in $deplibs; do
3619 name=`expr $i : '-l\(.*\)'`
3620 # If $name is empty we are operating on a -L argument.
3621 if test "$name" != "" && test "$name" != "0"; then
3622 $rm conftest
3623 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3624 ldd_output=`ldd conftest`
3625 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3626 case " $predeps $postdeps " in
3627 *" $i "*)
3628 newdeplibs="$newdeplibs $i"
3629 i=""
3631 esac
3633 if test -n "$i" ; then
3634 libname=`eval \\$echo \"$libname_spec\"`
3635 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3636 set dummy $deplib_matches
3637 deplib_match=$2
3638 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3639 newdeplibs="$newdeplibs $i"
3640 else
3641 droppeddeps=yes
3642 $echo
3643 $echo "*** Warning: dynamic linker does not accept needed library $i."
3644 $echo "*** I have the capability to make that library automatically link in when"
3645 $echo "*** you link to this library. But I can only do this if you have a"
3646 $echo "*** shared version of the library, which you do not appear to have"
3647 $echo "*** because a test_compile did reveal that the linker did not use this one"
3648 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3651 else
3652 droppeddeps=yes
3653 $echo
3654 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3655 $echo "*** make it link in! You will probably need to install it or some"
3656 $echo "*** library that it depends on before this library will be fully"
3657 $echo "*** functional. Installing it before continuing would be even better."
3659 else
3660 newdeplibs="$newdeplibs $i"
3662 done
3665 file_magic*)
3666 set dummy $deplibs_check_method
3667 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3668 for a_deplib in $deplibs; do
3669 name=`expr $a_deplib : '-l\(.*\)'`
3670 # If $name is empty we are operating on a -L argument.
3671 if test "$name" != "" && test "$name" != "0"; then
3672 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3673 case " $predeps $postdeps " in
3674 *" $a_deplib "*)
3675 newdeplibs="$newdeplibs $a_deplib"
3676 a_deplib=""
3678 esac
3680 if test -n "$a_deplib" ; then
3681 libname=`eval \\$echo \"$libname_spec\"`
3682 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3683 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3684 for potent_lib in $potential_libs; do
3685 # Follow soft links.
3686 if ls -lLd "$potent_lib" 2>/dev/null \
3687 | grep " -> " >/dev/null; then
3688 continue
3690 # The statement above tries to avoid entering an
3691 # endless loop below, in case of cyclic links.
3692 # We might still enter an endless loop, since a link
3693 # loop can be closed while we follow links,
3694 # but so what?
3695 potlib="$potent_lib"
3696 while test -h "$potlib" 2>/dev/null; do
3697 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3698 case $potliblink in
3699 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3700 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3701 esac
3702 done
3703 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3704 | ${SED} 10q \
3705 | $EGREP "$file_magic_regex" > /dev/null; then
3706 newdeplibs="$newdeplibs $a_deplib"
3707 a_deplib=""
3708 break 2
3710 done
3711 done
3713 if test -n "$a_deplib" ; then
3714 droppeddeps=yes
3715 $echo
3716 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3717 $echo "*** I have the capability to make that library automatically link in when"
3718 $echo "*** you link to this library. But I can only do this if you have a"
3719 $echo "*** shared version of the library, which you do not appear to have"
3720 $echo "*** because I did check the linker path looking for a file starting"
3721 if test -z "$potlib" ; then
3722 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3723 else
3724 $echo "*** with $libname and none of the candidates passed a file format test"
3725 $echo "*** using a file magic. Last file checked: $potlib"
3728 else
3729 # Add a -L argument.
3730 newdeplibs="$newdeplibs $a_deplib"
3732 done # Gone through all deplibs.
3734 match_pattern*)
3735 set dummy $deplibs_check_method
3736 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3737 for a_deplib in $deplibs; do
3738 name=`expr $a_deplib : '-l\(.*\)'`
3739 # If $name is empty we are operating on a -L argument.
3740 if test -n "$name" && test "$name" != "0"; then
3741 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3742 case " $predeps $postdeps " in
3743 *" $a_deplib "*)
3744 newdeplibs="$newdeplibs $a_deplib"
3745 a_deplib=""
3747 esac
3749 if test -n "$a_deplib" ; then
3750 libname=`eval \\$echo \"$libname_spec\"`
3751 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3752 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3753 for potent_lib in $potential_libs; do
3754 potlib="$potent_lib" # see symlink-check above in file_magic test
3755 if eval $echo \"$potent_lib\" 2>/dev/null \
3756 | ${SED} 10q \
3757 | $EGREP "$match_pattern_regex" > /dev/null; then
3758 newdeplibs="$newdeplibs $a_deplib"
3759 a_deplib=""
3760 break 2
3762 done
3763 done
3765 if test -n "$a_deplib" ; then
3766 droppeddeps=yes
3767 $echo
3768 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3769 $echo "*** I have the capability to make that library automatically link in when"
3770 $echo "*** you link to this library. But I can only do this if you have a"
3771 $echo "*** shared version of the library, which you do not appear to have"
3772 $echo "*** because I did check the linker path looking for a file starting"
3773 if test -z "$potlib" ; then
3774 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3775 else
3776 $echo "*** with $libname and none of the candidates passed a file format test"
3777 $echo "*** using a regex pattern. Last file checked: $potlib"
3780 else
3781 # Add a -L argument.
3782 newdeplibs="$newdeplibs $a_deplib"
3784 done # Gone through all deplibs.
3786 none | unknown | *)
3787 newdeplibs=""
3788 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3789 -e 's/ -[LR][^ ]*//g'`
3790 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3791 for i in $predeps $postdeps ; do
3792 # can't use Xsed below, because $i might contain '/'
3793 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3794 done
3796 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3797 | grep . >/dev/null; then
3798 $echo
3799 if test "X$deplibs_check_method" = "Xnone"; then
3800 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3801 else
3802 $echo "*** Warning: inter-library dependencies are not known to be supported."
3804 $echo "*** All declared inter-library dependencies are being dropped."
3805 droppeddeps=yes
3808 esac
3809 versuffix=$versuffix_save
3810 major=$major_save
3811 release=$release_save
3812 libname=$libname_save
3813 name=$name_save
3815 case $host in
3816 *-*-rhapsody* | *-*-darwin1.[012])
3817 # On Rhapsody replace the C library is the System framework
3818 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3820 esac
3822 if test "$droppeddeps" = yes; then
3823 if test "$module" = yes; then
3824 $echo
3825 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3826 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3827 $echo "*** a static module, that should work as long as the dlopening"
3828 $echo "*** application is linked with the -dlopen flag."
3829 if test -z "$global_symbol_pipe"; then
3830 $echo
3831 $echo "*** However, this would only work if libtool was able to extract symbol"
3832 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3833 $echo "*** not find such a program. So, this module is probably useless."
3834 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3836 if test "$build_old_libs" = no; then
3837 oldlibs="$output_objdir/$libname.$libext"
3838 build_libtool_libs=module
3839 build_old_libs=yes
3840 else
3841 build_libtool_libs=no
3843 else
3844 $echo "*** The inter-library dependencies that have been dropped here will be"
3845 $echo "*** automatically added whenever a program is linked with this library"
3846 $echo "*** or is declared to -dlopen it."
3848 if test "$allow_undefined" = no; then
3849 $echo
3850 $echo "*** Since this library must not contain undefined symbols,"
3851 $echo "*** because either the platform does not support them or"
3852 $echo "*** it was explicitly requested with -no-undefined,"
3853 $echo "*** libtool will only create a static version of it."
3854 if test "$build_old_libs" = no; then
3855 oldlibs="$output_objdir/$libname.$libext"
3856 build_libtool_libs=module
3857 build_old_libs=yes
3858 else
3859 build_libtool_libs=no
3864 # Done checking deplibs!
3865 deplibs=$newdeplibs
3869 # move library search paths that coincide with paths to not yet
3870 # installed libraries to the beginning of the library search list
3871 new_libs=
3872 for path in $notinst_path; do
3873 case " $new_libs " in
3874 *" -L$path/$objdir "*) ;;
3876 case " $deplibs " in
3877 *" -L$path/$objdir "*)
3878 new_libs="$new_libs -L$path/$objdir" ;;
3879 esac
3881 esac
3882 done
3883 for deplib in $deplibs; do
3884 case $deplib in
3885 -L*)
3886 case " $new_libs " in
3887 *" $deplib "*) ;;
3888 *) new_libs="$new_libs $deplib" ;;
3889 esac
3891 *) new_libs="$new_libs $deplib" ;;
3892 esac
3893 done
3894 deplibs="$new_libs"
3897 # All the library-specific variables (install_libdir is set above).
3898 library_names=
3899 old_library=
3900 dlname=
3902 # Test again, we may have decided not to build it any more
3903 if test "$build_libtool_libs" = yes; then
3904 if test "$hardcode_into_libs" = yes; then
3905 # Hardcode the library paths
3906 hardcode_libdirs=
3907 dep_rpath=
3908 rpath="$finalize_rpath"
3909 test "$mode" != relink && rpath="$compile_rpath$rpath"
3910 for libdir in $rpath; do
3911 if test -n "$hardcode_libdir_flag_spec"; then
3912 if test -n "$hardcode_libdir_separator"; then
3913 if test -z "$hardcode_libdirs"; then
3914 hardcode_libdirs="$libdir"
3915 else
3916 # Just accumulate the unique libdirs.
3917 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3918 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3921 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3923 esac
3925 else
3926 eval flag=\"$hardcode_libdir_flag_spec\"
3927 dep_rpath="$dep_rpath $flag"
3929 elif test -n "$runpath_var"; then
3930 case "$perm_rpath " in
3931 *" $libdir "*) ;;
3932 *) perm_rpath="$perm_rpath $libdir" ;;
3933 esac
3935 done
3936 # Substitute the hardcoded libdirs into the rpath.
3937 if test -n "$hardcode_libdir_separator" &&
3938 test -n "$hardcode_libdirs"; then
3939 libdir="$hardcode_libdirs"
3940 if test -n "$hardcode_libdir_flag_spec_ld"; then
3941 case $archive_cmds in
3942 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3943 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3944 esac
3945 else
3946 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3949 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3950 # We should set the runpath_var.
3951 rpath=
3952 for dir in $perm_rpath; do
3953 rpath="$rpath$dir:"
3954 done
3955 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3957 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3960 shlibpath="$finalize_shlibpath"
3961 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3962 if test -n "$shlibpath"; then
3963 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3966 # Get the real and link names of the library.
3967 eval shared_ext=\"$shrext_cmds\"
3968 eval library_names=\"$library_names_spec\"
3969 set dummy $library_names
3970 realname="$2"
3971 shift; shift
3973 if test -n "$soname_spec"; then
3974 eval soname=\"$soname_spec\"
3975 else
3976 soname="$realname"
3978 if test -z "$dlname"; then
3979 dlname=$soname
3982 lib="$output_objdir/$realname"
3983 linknames=
3984 for link
3986 linknames="$linknames $link"
3987 done
3989 # Use standard objects if they are pic
3990 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3992 # Prepare the list of exported symbols
3993 if test -z "$export_symbols"; then
3994 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3995 $show "generating symbol list for \`$libname.la'"
3996 export_symbols="$output_objdir/$libname.exp"
3997 $run $rm $export_symbols
3998 cmds=$export_symbols_cmds
3999 save_ifs="$IFS"; IFS='~'
4000 for cmd in $cmds; do
4001 IFS="$save_ifs"
4002 eval cmd=\"$cmd\"
4003 if len=`expr "X$cmd" : ".*"` &&
4004 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4005 $show "$cmd"
4006 $run eval "$cmd" || exit $?
4007 skipped_export=false
4008 else
4009 # The command line is too long to execute in one step.
4010 $show "using reloadable object file for export list..."
4011 skipped_export=:
4012 # Break out early, otherwise skipped_export may be
4013 # set to false by a later but shorter cmd.
4014 break
4016 done
4017 IFS="$save_ifs"
4018 if test -n "$export_symbols_regex"; then
4019 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4020 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4021 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4022 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4027 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4028 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4031 tmp_deplibs=
4032 for test_deplib in $deplibs; do
4033 case " $convenience " in
4034 *" $test_deplib "*) ;;
4036 tmp_deplibs="$tmp_deplibs $test_deplib"
4038 esac
4039 done
4040 deplibs="$tmp_deplibs"
4042 if test -n "$convenience"; then
4043 if test -n "$whole_archive_flag_spec"; then
4044 save_libobjs=$libobjs
4045 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4046 else
4047 gentop="$output_objdir/${outputname}x"
4048 generated="$generated $gentop"
4050 func_extract_archives $gentop $convenience
4051 libobjs="$libobjs $func_extract_archives_result"
4055 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4056 eval flag=\"$thread_safe_flag_spec\"
4057 linker_flags="$linker_flags $flag"
4060 # Make a backup of the uninstalled library when relinking
4061 if test "$mode" = relink; then
4062 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4065 # Do each of the archive commands.
4066 if test "$module" = yes && test -n "$module_cmds" ; then
4067 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4068 eval test_cmds=\"$module_expsym_cmds\"
4069 cmds=$module_expsym_cmds
4070 else
4071 eval test_cmds=\"$module_cmds\"
4072 cmds=$module_cmds
4074 else
4075 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4076 eval test_cmds=\"$archive_expsym_cmds\"
4077 cmds=$archive_expsym_cmds
4078 else
4079 eval test_cmds=\"$archive_cmds\"
4080 cmds=$archive_cmds
4084 if test "X$skipped_export" != "X:" &&
4085 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4086 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4088 else
4089 # The command line is too long to link in one step, link piecewise.
4090 $echo "creating reloadable object files..."
4092 # Save the value of $output and $libobjs because we want to
4093 # use them later. If we have whole_archive_flag_spec, we
4094 # want to use save_libobjs as it was before
4095 # whole_archive_flag_spec was expanded, because we can't
4096 # assume the linker understands whole_archive_flag_spec.
4097 # This may have to be revisited, in case too many
4098 # convenience libraries get linked in and end up exceeding
4099 # the spec.
4100 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4101 save_libobjs=$libobjs
4103 save_output=$output
4104 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4106 # Clear the reloadable object creation command queue and
4107 # initialize k to one.
4108 test_cmds=
4109 concat_cmds=
4110 objlist=
4111 delfiles=
4112 last_robj=
4114 output=$output_objdir/$output_la-${k}.$objext
4115 # Loop over the list of objects to be linked.
4116 for obj in $save_libobjs
4118 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4119 if test "X$objlist" = X ||
4120 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4121 test "$len" -le "$max_cmd_len"; }; then
4122 objlist="$objlist $obj"
4123 else
4124 # The command $test_cmds is almost too long, add a
4125 # command to the queue.
4126 if test "$k" -eq 1 ; then
4127 # The first file doesn't have a previous command to add.
4128 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4129 else
4130 # All subsequent reloadable object files will link in
4131 # the last one created.
4132 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4134 last_robj=$output_objdir/$output_la-${k}.$objext
4135 k=`expr $k + 1`
4136 output=$output_objdir/$output_la-${k}.$objext
4137 objlist=$obj
4138 len=1
4140 done
4141 # Handle the remaining objects by creating one last
4142 # reloadable object file. All subsequent reloadable object
4143 # files will link in the last one created.
4144 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4145 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4147 if ${skipped_export-false}; then
4148 $show "generating symbol list for \`$libname.la'"
4149 export_symbols="$output_objdir/$libname.exp"
4150 $run $rm $export_symbols
4151 libobjs=$output
4152 # Append the command to create the export file.
4153 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4156 # Set up a command to remove the reloadable object files
4157 # after they are used.
4159 while test "$i" -lt "$k"
4161 i=`expr $i + 1`
4162 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4163 done
4165 $echo "creating a temporary reloadable object file: $output"
4167 # Loop through the commands generated above and execute them.
4168 save_ifs="$IFS"; IFS='~'
4169 for cmd in $concat_cmds; do
4170 IFS="$save_ifs"
4171 $show "$cmd"
4172 $run eval "$cmd" || exit $?
4173 done
4174 IFS="$save_ifs"
4176 libobjs=$output
4177 # Restore the value of output.
4178 output=$save_output
4180 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4181 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4183 # Expand the library linking commands again to reset the
4184 # value of $libobjs for piecewise linking.
4186 # Do each of the archive commands.
4187 if test "$module" = yes && test -n "$module_cmds" ; then
4188 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4189 cmds=$module_expsym_cmds
4190 else
4191 cmds=$module_cmds
4193 else
4194 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4195 cmds=$archive_expsym_cmds
4196 else
4197 cmds=$archive_cmds
4201 # Append the command to remove the reloadable object files
4202 # to the just-reset $cmds.
4203 eval cmds=\"\$cmds~\$rm $delfiles\"
4205 save_ifs="$IFS"; IFS='~'
4206 for cmd in $cmds; do
4207 IFS="$save_ifs"
4208 eval cmd=\"$cmd\"
4209 $show "$cmd"
4210 $run eval "$cmd" || {
4211 lt_exit=$?
4213 # Restore the uninstalled library and exit
4214 if test "$mode" = relink; then
4215 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4218 exit $lt_exit
4220 done
4221 IFS="$save_ifs"
4223 # Restore the uninstalled library and exit
4224 if test "$mode" = relink; then
4225 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4227 if test -n "$convenience"; then
4228 if test -z "$whole_archive_flag_spec"; then
4229 $show "${rm}r $gentop"
4230 $run ${rm}r "$gentop"
4234 exit $EXIT_SUCCESS
4237 # Create links to the real library.
4238 for linkname in $linknames; do
4239 if test "$realname" != "$linkname"; then
4240 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4241 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4243 done
4245 # If -module or -export-dynamic was specified, set the dlname.
4246 if test "$module" = yes || test "$export_dynamic" = yes; then
4247 # On all known operating systems, these are identical.
4248 dlname="$soname"
4253 obj)
4254 if test -n "$deplibs"; then
4255 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4258 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4259 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4262 if test -n "$rpath"; then
4263 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4266 if test -n "$xrpath"; then
4267 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4270 if test -n "$vinfo"; then
4271 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4274 if test -n "$release"; then
4275 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4278 case $output in
4279 *.lo)
4280 if test -n "$objs$old_deplibs"; then
4281 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4282 exit $EXIT_FAILURE
4284 libobj="$output"
4285 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4288 libobj=
4289 obj="$output"
4291 esac
4293 # Delete the old objects.
4294 $run $rm $obj $libobj
4296 # Objects from convenience libraries. This assumes
4297 # single-version convenience libraries. Whenever we create
4298 # different ones for PIC/non-PIC, this we'll have to duplicate
4299 # the extraction.
4300 reload_conv_objs=
4301 gentop=
4302 # reload_cmds runs $LD directly, so let us get rid of
4303 # -Wl from whole_archive_flag_spec and hope we can get by with
4304 # turning comma into space..
4307 if test -n "$convenience"; then
4308 if test -n "$whole_archive_flag_spec"; then
4309 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4310 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4311 else
4312 gentop="$output_objdir/${obj}x"
4313 generated="$generated $gentop"
4315 func_extract_archives $gentop $convenience
4316 reload_conv_objs="$reload_objs $func_extract_archives_result"
4320 # Create the old-style object.
4321 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
4323 output="$obj"
4324 cmds=$reload_cmds
4325 save_ifs="$IFS"; IFS='~'
4326 for cmd in $cmds; do
4327 IFS="$save_ifs"
4328 eval cmd=\"$cmd\"
4329 $show "$cmd"
4330 $run eval "$cmd" || exit $?
4331 done
4332 IFS="$save_ifs"
4334 # Exit if we aren't doing a library object file.
4335 if test -z "$libobj"; then
4336 if test -n "$gentop"; then
4337 $show "${rm}r $gentop"
4338 $run ${rm}r $gentop
4341 exit $EXIT_SUCCESS
4344 if test "$build_libtool_libs" != yes; then
4345 if test -n "$gentop"; then
4346 $show "${rm}r $gentop"
4347 $run ${rm}r $gentop
4350 # Create an invalid libtool object if no PIC, so that we don't
4351 # accidentally link it into a program.
4352 # $show "echo timestamp > $libobj"
4353 # $run eval "echo timestamp > $libobj" || exit $?
4354 exit $EXIT_SUCCESS
4357 if test -n "$pic_flag" || test "$pic_mode" != default; then
4358 # Only do commands if we really have different PIC objects.
4359 reload_objs="$libobjs $reload_conv_objs"
4360 output="$libobj"
4361 cmds=$reload_cmds
4362 save_ifs="$IFS"; IFS='~'
4363 for cmd in $cmds; do
4364 IFS="$save_ifs"
4365 eval cmd=\"$cmd\"
4366 $show "$cmd"
4367 $run eval "$cmd" || exit $?
4368 done
4369 IFS="$save_ifs"
4372 if test -n "$gentop"; then
4373 $show "${rm}r $gentop"
4374 $run ${rm}r $gentop
4377 exit $EXIT_SUCCESS
4380 prog)
4381 case $host in
4382 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4383 esac
4384 if test -n "$vinfo"; then
4385 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4388 if test -n "$release"; then
4389 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4392 if test "$preload" = yes; then
4393 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4394 test "$dlopen_self_static" = unknown; then
4395 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4399 case $host in
4400 *-*-rhapsody* | *-*-darwin1.[012])
4401 # On Rhapsody replace the C library is the System framework
4402 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4403 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4405 esac
4407 case $host in
4408 *darwin*)
4409 # Don't allow lazy linking, it breaks C++ global constructors
4410 if test "$tagname" = CXX ; then
4411 compile_command="$compile_command ${wl}-bind_at_load"
4412 finalize_command="$finalize_command ${wl}-bind_at_load"
4415 esac
4418 # move library search paths that coincide with paths to not yet
4419 # installed libraries to the beginning of the library search list
4420 new_libs=
4421 for path in $notinst_path; do
4422 case " $new_libs " in
4423 *" -L$path/$objdir "*) ;;
4425 case " $compile_deplibs " in
4426 *" -L$path/$objdir "*)
4427 new_libs="$new_libs -L$path/$objdir" ;;
4428 esac
4430 esac
4431 done
4432 for deplib in $compile_deplibs; do
4433 case $deplib in
4434 -L*)
4435 case " $new_libs " in
4436 *" $deplib "*) ;;
4437 *) new_libs="$new_libs $deplib" ;;
4438 esac
4440 *) new_libs="$new_libs $deplib" ;;
4441 esac
4442 done
4443 compile_deplibs="$new_libs"
4446 compile_command="$compile_command $compile_deplibs"
4447 finalize_command="$finalize_command $finalize_deplibs"
4449 if test -n "$rpath$xrpath"; then
4450 # If the user specified any rpath flags, then add them.
4451 for libdir in $rpath $xrpath; do
4452 # This is the magic to use -rpath.
4453 case "$finalize_rpath " in
4454 *" $libdir "*) ;;
4455 *) finalize_rpath="$finalize_rpath $libdir" ;;
4456 esac
4457 done
4460 # Now hardcode the library paths
4461 rpath=
4462 hardcode_libdirs=
4463 for libdir in $compile_rpath $finalize_rpath; do
4464 if test -n "$hardcode_libdir_flag_spec"; then
4465 if test -n "$hardcode_libdir_separator"; then
4466 if test -z "$hardcode_libdirs"; then
4467 hardcode_libdirs="$libdir"
4468 else
4469 # Just accumulate the unique libdirs.
4470 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4471 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4474 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4476 esac
4478 else
4479 eval flag=\"$hardcode_libdir_flag_spec\"
4480 rpath="$rpath $flag"
4482 elif test -n "$runpath_var"; then
4483 case "$perm_rpath " in
4484 *" $libdir "*) ;;
4485 *) perm_rpath="$perm_rpath $libdir" ;;
4486 esac
4488 case $host in
4489 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4490 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4491 case :$dllsearchpath: in
4492 *":$libdir:"*) ;;
4493 *) dllsearchpath="$dllsearchpath:$libdir";;
4494 esac
4495 case :$dllsearchpath: in
4496 *":$testbindir:"*) ;;
4497 *) dllsearchpath="$dllsearchpath:$testbindir";;
4498 esac
4500 esac
4501 done
4502 # Substitute the hardcoded libdirs into the rpath.
4503 if test -n "$hardcode_libdir_separator" &&
4504 test -n "$hardcode_libdirs"; then
4505 libdir="$hardcode_libdirs"
4506 eval rpath=\" $hardcode_libdir_flag_spec\"
4508 compile_rpath="$rpath"
4510 rpath=
4511 hardcode_libdirs=
4512 for libdir in $finalize_rpath; do
4513 if test -n "$hardcode_libdir_flag_spec"; then
4514 if test -n "$hardcode_libdir_separator"; then
4515 if test -z "$hardcode_libdirs"; then
4516 hardcode_libdirs="$libdir"
4517 else
4518 # Just accumulate the unique libdirs.
4519 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4520 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4523 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4525 esac
4527 else
4528 eval flag=\"$hardcode_libdir_flag_spec\"
4529 rpath="$rpath $flag"
4531 elif test -n "$runpath_var"; then
4532 case "$finalize_perm_rpath " in
4533 *" $libdir "*) ;;
4534 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4535 esac
4537 done
4538 # Substitute the hardcoded libdirs into the rpath.
4539 if test -n "$hardcode_libdir_separator" &&
4540 test -n "$hardcode_libdirs"; then
4541 libdir="$hardcode_libdirs"
4542 eval rpath=\" $hardcode_libdir_flag_spec\"
4544 finalize_rpath="$rpath"
4546 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4547 # Transform all the library objects into standard objects.
4548 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4549 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4552 dlsyms=
4553 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4554 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4555 dlsyms="${outputname}S.c"
4556 else
4557 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4561 if test -n "$dlsyms"; then
4562 case $dlsyms in
4563 "") ;;
4564 *.c)
4565 # Discover the nlist of each of the dlfiles.
4566 nlist="$output_objdir/${outputname}.nm"
4568 $show "$rm $nlist ${nlist}S ${nlist}T"
4569 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4571 # Parse the name list into a source file.
4572 $show "creating $output_objdir/$dlsyms"
4574 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4575 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4576 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4578 #ifdef __cplusplus
4579 extern \"C\" {
4580 #endif
4582 /* Prevent the only kind of declaration conflicts we can make. */
4583 #define lt_preloaded_symbols some_other_symbol
4585 /* External symbol declarations for the compiler. */\
4588 if test "$dlself" = yes; then
4589 $show "generating symbol list for \`$output'"
4591 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4593 # Add our own program objects to the symbol list.
4594 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4595 for arg in $progfiles; do
4596 $show "extracting global C symbols from \`$arg'"
4597 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4598 done
4600 if test -n "$exclude_expsyms"; then
4601 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4602 $run eval '$mv "$nlist"T "$nlist"'
4605 if test -n "$export_symbols_regex"; then
4606 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4607 $run eval '$mv "$nlist"T "$nlist"'
4610 # Prepare the list of exported symbols
4611 if test -z "$export_symbols"; then
4612 export_symbols="$output_objdir/$outputname.exp"
4613 $run $rm $export_symbols
4614 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4615 case $host in
4616 *cygwin* | *mingw* )
4617 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4618 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4620 esac
4621 else
4622 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4623 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4624 $run eval 'mv "$nlist"T "$nlist"'
4625 case $host in
4626 *cygwin* | *mingw* )
4627 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4628 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4630 esac
4634 for arg in $dlprefiles; do
4635 $show "extracting global C symbols from \`$arg'"
4636 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4637 $run eval '$echo ": $name " >> "$nlist"'
4638 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4639 done
4641 if test -z "$run"; then
4642 # Make sure we have at least an empty file.
4643 test -f "$nlist" || : > "$nlist"
4645 if test -n "$exclude_expsyms"; then
4646 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4647 $mv "$nlist"T "$nlist"
4650 # Try sorting and uniquifying the output.
4651 if grep -v "^: " < "$nlist" |
4652 if sort -k 3 </dev/null >/dev/null 2>&1; then
4653 sort -k 3
4654 else
4655 sort +2
4656 fi |
4657 uniq > "$nlist"S; then
4659 else
4660 grep -v "^: " < "$nlist" > "$nlist"S
4663 if test -f "$nlist"S; then
4664 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4665 else
4666 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4669 $echo >> "$output_objdir/$dlsyms" "\
4671 #undef lt_preloaded_symbols
4673 #if defined (__STDC__) && __STDC__
4674 # define lt_ptr void *
4675 #else
4676 # define lt_ptr char *
4677 # define const
4678 #endif
4680 /* The mapping between symbol names and symbols. */
4683 case $host in
4684 *cygwin* | *mingw* )
4685 $echo >> "$output_objdir/$dlsyms" "\
4686 /* DATA imports from DLLs on WIN32 can't be const, because
4687 runtime relocations are performed -- see ld's documentation
4688 on pseudo-relocs */
4689 struct {
4693 $echo >> "$output_objdir/$dlsyms" "\
4694 const struct {
4697 esac
4700 $echo >> "$output_objdir/$dlsyms" "\
4701 const char *name;
4702 lt_ptr address;
4704 lt_preloaded_symbols[] =
4708 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4710 $echo >> "$output_objdir/$dlsyms" "\
4711 {0, (lt_ptr) 0}
4714 /* This works around a problem in FreeBSD linker */
4715 #ifdef FREEBSD_WORKAROUND
4716 static const void *lt_preloaded_setup() {
4717 return lt_preloaded_symbols;
4719 #endif
4721 #ifdef __cplusplus
4723 #endif\
4727 pic_flag_for_symtable=
4728 case $host in
4729 # compiling the symbol table file with pic_flag works around
4730 # a FreeBSD bug that causes programs to crash when -lm is
4731 # linked before any other PIC object. But we must not use
4732 # pic_flag when linking with -static. The problem exists in
4733 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4734 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4735 case "$compile_command " in
4736 *" -static "*) ;;
4737 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4738 esac;;
4739 *-*-hpux*)
4740 case "$compile_command " in
4741 *" -static "*) ;;
4742 *) pic_flag_for_symtable=" $pic_flag";;
4743 esac
4744 esac
4746 # Now compile the dynamic symbol file.
4747 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4748 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4750 # Clean up the generated files.
4751 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4752 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4754 # Transform the symbol file into the correct name.
4755 case $host in
4756 *cygwin* | *mingw* )
4757 if test -f "$output_objdir/${outputname}.def" ; then
4758 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4759 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4760 else
4761 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4762 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4766 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4767 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4769 esac
4772 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4773 exit $EXIT_FAILURE
4775 esac
4776 else
4777 # We keep going just in case the user didn't refer to
4778 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4779 # really was required.
4781 # Nullify the symbol file.
4782 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4783 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4786 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4787 # Replace the output file specification.
4788 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4789 link_command="$compile_command$compile_rpath"
4791 # We have no uninstalled library dependencies, so finalize right now.
4792 $show "$link_command"
4793 $run eval "$link_command"
4794 exit_status=$?
4796 # Delete the generated files.
4797 if test -n "$dlsyms"; then
4798 $show "$rm $output_objdir/${outputname}S.${objext}"
4799 $run $rm "$output_objdir/${outputname}S.${objext}"
4802 exit $exit_status
4805 if test -n "$shlibpath_var"; then
4806 # We should set the shlibpath_var
4807 rpath=
4808 for dir in $temp_rpath; do
4809 case $dir in
4810 [\\/]* | [A-Za-z]:[\\/]*)
4811 # Absolute path.
4812 rpath="$rpath$dir:"
4815 # Relative path: add a thisdir entry.
4816 rpath="$rpath\$thisdir/$dir:"
4818 esac
4819 done
4820 temp_rpath="$rpath"
4823 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4824 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4826 if test -n "$finalize_shlibpath"; then
4827 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4830 compile_var=
4831 finalize_var=
4832 if test -n "$runpath_var"; then
4833 if test -n "$perm_rpath"; then
4834 # We should set the runpath_var.
4835 rpath=
4836 for dir in $perm_rpath; do
4837 rpath="$rpath$dir:"
4838 done
4839 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4841 if test -n "$finalize_perm_rpath"; then
4842 # We should set the runpath_var.
4843 rpath=
4844 for dir in $finalize_perm_rpath; do
4845 rpath="$rpath$dir:"
4846 done
4847 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4851 if test "$no_install" = yes; then
4852 # We don't need to create a wrapper script.
4853 link_command="$compile_var$compile_command$compile_rpath"
4854 # Replace the output file specification.
4855 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4856 # Delete the old output file.
4857 $run $rm $output
4858 # Link the executable and exit
4859 $show "$link_command"
4860 $run eval "$link_command" || exit $?
4861 exit $EXIT_SUCCESS
4864 if test "$hardcode_action" = relink; then
4865 # Fast installation is not supported
4866 link_command="$compile_var$compile_command$compile_rpath"
4867 relink_command="$finalize_var$finalize_command$finalize_rpath"
4869 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4870 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4871 else
4872 if test "$fast_install" != no; then
4873 link_command="$finalize_var$compile_command$finalize_rpath"
4874 if test "$fast_install" = yes; then
4875 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4876 else
4877 # fast_install is set to needless
4878 relink_command=
4880 else
4881 link_command="$compile_var$compile_command$compile_rpath"
4882 relink_command="$finalize_var$finalize_command$finalize_rpath"
4886 # Replace the output file specification.
4887 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4889 # Delete the old output files.
4890 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4892 $show "$link_command"
4893 $run eval "$link_command" || exit $?
4895 # Now create the wrapper script.
4896 $show "creating $output"
4898 # Quote the relink command for shipping.
4899 if test -n "$relink_command"; then
4900 # Preserve any variables that may affect compiler behavior
4901 for var in $variables_saved_for_relink; do
4902 if eval test -z \"\${$var+set}\"; then
4903 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4904 elif eval var_value=\$$var; test -z "$var_value"; then
4905 relink_command="$var=; export $var; $relink_command"
4906 else
4907 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4908 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4910 done
4911 relink_command="(cd `pwd`; $relink_command)"
4912 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4915 # Quote $echo for shipping.
4916 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4917 case $progpath in
4918 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4919 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4920 esac
4921 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4922 else
4923 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4926 # Only actually do things if our run command is non-null.
4927 if test -z "$run"; then
4928 # win32 will think the script is a binary if it has
4929 # a .exe suffix, so we strip it off here.
4930 case $output in
4931 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4932 esac
4933 # test for cygwin because mv fails w/o .exe extensions
4934 case $host in
4935 *cygwin*)
4936 exeext=.exe
4937 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4938 *) exeext= ;;
4939 esac
4940 case $host in
4941 *cygwin* | *mingw* )
4942 output_name=`basename $output`
4943 output_path=`dirname $output`
4944 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4945 cwrapper="$output_path/$output_name.exe"
4946 $rm $cwrappersource $cwrapper
4947 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4949 cat > $cwrappersource <<EOF
4951 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4952 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4954 The $output program cannot be directly executed until all the libtool
4955 libraries that it depends on are installed.
4957 This wrapper executable should never be moved out of the build directory.
4958 If it is, it will not operate correctly.
4960 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4961 but could eventually absorb all of the scripts functionality and
4962 exec $objdir/$outputname directly.
4965 cat >> $cwrappersource<<"EOF"
4966 #include <stdio.h>
4967 #include <stdlib.h>
4968 #include <unistd.h>
4969 #include <malloc.h>
4970 #include <stdarg.h>
4971 #include <assert.h>
4972 #include <string.h>
4973 #include <ctype.h>
4974 #include <sys/stat.h>
4976 #if defined(PATH_MAX)
4977 # define LT_PATHMAX PATH_MAX
4978 #elif defined(MAXPATHLEN)
4979 # define LT_PATHMAX MAXPATHLEN
4980 #else
4981 # define LT_PATHMAX 1024
4982 #endif
4984 #ifndef DIR_SEPARATOR
4985 # define DIR_SEPARATOR '/'
4986 # define PATH_SEPARATOR ':'
4987 #endif
4989 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4990 defined (__OS2__)
4991 # define HAVE_DOS_BASED_FILE_SYSTEM
4992 # ifndef DIR_SEPARATOR_2
4993 # define DIR_SEPARATOR_2 '\\'
4994 # endif
4995 # ifndef PATH_SEPARATOR_2
4996 # define PATH_SEPARATOR_2 ';'
4997 # endif
4998 #endif
5000 #ifndef DIR_SEPARATOR_2
5001 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5002 #else /* DIR_SEPARATOR_2 */
5003 # define IS_DIR_SEPARATOR(ch) \
5004 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5005 #endif /* DIR_SEPARATOR_2 */
5007 #ifndef PATH_SEPARATOR_2
5008 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5009 #else /* PATH_SEPARATOR_2 */
5010 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5011 #endif /* PATH_SEPARATOR_2 */
5013 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5014 #define XFREE(stale) do { \
5015 if (stale) { free ((void *) stale); stale = 0; } \
5016 } while (0)
5018 /* -DDEBUG is fairly common in CFLAGS. */
5019 #undef DEBUG
5020 #if defined DEBUGWRAPPER
5021 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5022 #else
5023 # define DEBUG(format, ...)
5024 #endif
5026 const char *program_name = NULL;
5028 void * xmalloc (size_t num);
5029 char * xstrdup (const char *string);
5030 const char * base_name (const char *name);
5031 char * find_executable(const char *wrapper);
5032 int check_executable(const char *path);
5033 char * strendzap(char *str, const char *pat);
5034 void lt_fatal (const char *message, ...);
5037 main (int argc, char *argv[])
5039 char **newargz;
5040 int i;
5042 program_name = (char *) xstrdup (base_name (argv[0]));
5043 DEBUG("(main) argv[0] : %s\n",argv[0]);
5044 DEBUG("(main) program_name : %s\n",program_name);
5045 newargz = XMALLOC(char *, argc+2);
5048 cat >> $cwrappersource <<EOF
5049 newargz[0] = (char *) xstrdup("$SHELL");
5052 cat >> $cwrappersource <<"EOF"
5053 newargz[1] = find_executable(argv[0]);
5054 if (newargz[1] == NULL)
5055 lt_fatal("Couldn't find %s", argv[0]);
5056 DEBUG("(main) found exe at : %s\n",newargz[1]);
5057 /* we know the script has the same name, without the .exe */
5058 /* so make sure newargz[1] doesn't end in .exe */
5059 strendzap(newargz[1],".exe");
5060 for (i = 1; i < argc; i++)
5061 newargz[i+1] = xstrdup(argv[i]);
5062 newargz[argc+1] = NULL;
5064 for (i=0; i<argc+1; i++)
5066 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5072 case $host_os in
5073 mingw*)
5074 cat >> $cwrappersource <<EOF
5075 execv("$SHELL",(char const **)newargz);
5079 cat >> $cwrappersource <<EOF
5080 execv("$SHELL",newargz);
5083 esac
5085 cat >> $cwrappersource <<"EOF"
5086 return 127;
5089 void *
5090 xmalloc (size_t num)
5092 void * p = (void *) malloc (num);
5093 if (!p)
5094 lt_fatal ("Memory exhausted");
5096 return p;
5099 char *
5100 xstrdup (const char *string)
5102 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5106 const char *
5107 base_name (const char *name)
5109 const char *base;
5111 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5112 /* Skip over the disk name in MSDOS pathnames. */
5113 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5114 name += 2;
5115 #endif
5117 for (base = name; *name; name++)
5118 if (IS_DIR_SEPARATOR (*name))
5119 base = name + 1;
5120 return base;
5124 check_executable(const char * path)
5126 struct stat st;
5128 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5129 if ((!path) || (!*path))
5130 return 0;
5132 if ((stat (path, &st) >= 0) &&
5134 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5135 #if defined (S_IXOTH)
5136 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5137 #endif
5138 #if defined (S_IXGRP)
5139 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5140 #endif
5141 ((st.st_mode & S_IXUSR) == S_IXUSR))
5143 return 1;
5144 else
5145 return 0;
5148 /* Searches for the full path of the wrapper. Returns
5149 newly allocated full path name if found, NULL otherwise */
5150 char *
5151 find_executable (const char* wrapper)
5153 int has_slash = 0;
5154 const char* p;
5155 const char* p_next;
5156 /* static buffer for getcwd */
5157 char tmp[LT_PATHMAX + 1];
5158 int tmp_len;
5159 char* concat_name;
5161 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5163 if ((wrapper == NULL) || (*wrapper == '\0'))
5164 return NULL;
5166 /* Absolute path? */
5167 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5168 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5170 concat_name = xstrdup (wrapper);
5171 if (check_executable(concat_name))
5172 return concat_name;
5173 XFREE(concat_name);
5175 else
5177 #endif
5178 if (IS_DIR_SEPARATOR (wrapper[0]))
5180 concat_name = xstrdup (wrapper);
5181 if (check_executable(concat_name))
5182 return concat_name;
5183 XFREE(concat_name);
5185 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5187 #endif
5189 for (p = wrapper; *p; p++)
5190 if (*p == '/')
5192 has_slash = 1;
5193 break;
5195 if (!has_slash)
5197 /* no slashes; search PATH */
5198 const char* path = getenv ("PATH");
5199 if (path != NULL)
5201 for (p = path; *p; p = p_next)
5203 const char* q;
5204 size_t p_len;
5205 for (q = p; *q; q++)
5206 if (IS_PATH_SEPARATOR(*q))
5207 break;
5208 p_len = q - p;
5209 p_next = (*q == '\0' ? q : q + 1);
5210 if (p_len == 0)
5212 /* empty path: current directory */
5213 if (getcwd (tmp, LT_PATHMAX) == NULL)
5214 lt_fatal ("getcwd failed");
5215 tmp_len = strlen(tmp);
5216 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5217 memcpy (concat_name, tmp, tmp_len);
5218 concat_name[tmp_len] = '/';
5219 strcpy (concat_name + tmp_len + 1, wrapper);
5221 else
5223 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5224 memcpy (concat_name, p, p_len);
5225 concat_name[p_len] = '/';
5226 strcpy (concat_name + p_len + 1, wrapper);
5228 if (check_executable(concat_name))
5229 return concat_name;
5230 XFREE(concat_name);
5233 /* not found in PATH; assume curdir */
5235 /* Relative path | not found in path: prepend cwd */
5236 if (getcwd (tmp, LT_PATHMAX) == NULL)
5237 lt_fatal ("getcwd failed");
5238 tmp_len = strlen(tmp);
5239 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5240 memcpy (concat_name, tmp, tmp_len);
5241 concat_name[tmp_len] = '/';
5242 strcpy (concat_name + tmp_len + 1, wrapper);
5244 if (check_executable(concat_name))
5245 return concat_name;
5246 XFREE(concat_name);
5247 return NULL;
5250 char *
5251 strendzap(char *str, const char *pat)
5253 size_t len, patlen;
5255 assert(str != NULL);
5256 assert(pat != NULL);
5258 len = strlen(str);
5259 patlen = strlen(pat);
5261 if (patlen <= len)
5263 str += len - patlen;
5264 if (strcmp(str, pat) == 0)
5265 *str = '\0';
5267 return str;
5270 static void
5271 lt_error_core (int exit_status, const char * mode,
5272 const char * message, va_list ap)
5274 fprintf (stderr, "%s: %s: ", program_name, mode);
5275 vfprintf (stderr, message, ap);
5276 fprintf (stderr, ".\n");
5278 if (exit_status >= 0)
5279 exit (exit_status);
5282 void
5283 lt_fatal (const char *message, ...)
5285 va_list ap;
5286 va_start (ap, message);
5287 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5288 va_end (ap);
5291 # we should really use a build-platform specific compiler
5292 # here, but OTOH, the wrappers (shell script and this C one)
5293 # are only useful if you want to execute the "real" binary.
5294 # Since the "real" binary is built for $host, then this
5295 # wrapper might as well be built for $host, too.
5296 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5298 esac
5299 $rm $output
5300 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5302 $echo > $output "\
5303 #! $SHELL
5305 # $output - temporary wrapper script for $objdir/$outputname
5306 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5308 # The $output program cannot be directly executed until all the libtool
5309 # libraries that it depends on are installed.
5311 # This wrapper script should never be moved out of the build directory.
5312 # If it is, it will not operate correctly.
5314 # Sed substitution that helps us do robust quoting. It backslashifies
5315 # metacharacters that are still active within double-quoted strings.
5316 Xsed='${SED} -e 1s/^X//'
5317 sed_quote_subst='$sed_quote_subst'
5319 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5320 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5321 emulate sh
5322 NULLCMD=:
5323 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5324 # is contrary to our usage. Disable this feature.
5325 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5326 setopt NO_GLOB_SUBST
5327 else
5328 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5330 BIN_SH=xpg4; export BIN_SH # for Tru64
5331 DUALCASE=1; export DUALCASE # for MKS sh
5333 # The HP-UX ksh and POSIX shell print the target directory to stdout
5334 # if CDPATH is set.
5335 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5337 relink_command=\"$relink_command\"
5339 # This environment variable determines our operation mode.
5340 if test \"\$libtool_install_magic\" = \"$magic\"; then
5341 # install mode needs the following variable:
5342 notinst_deplibs='$notinst_deplibs'
5343 else
5344 # When we are sourced in execute mode, \$file and \$echo are already set.
5345 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5346 echo=\"$qecho\"
5347 file=\"\$0\"
5348 # Make sure echo works.
5349 if test \"X\$1\" = X--no-reexec; then
5350 # Discard the --no-reexec flag, and continue.
5351 shift
5352 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5353 # Yippee, \$echo works!
5355 else
5356 # Restart under the correct shell, and then maybe \$echo will work.
5357 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5361 $echo >> $output "\
5363 # Find the directory that this script lives in.
5364 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5365 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5367 # Follow symbolic links until we get to the real thisdir.
5368 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5369 while test -n \"\$file\"; do
5370 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5372 # If there was a directory component, then change thisdir.
5373 if test \"x\$destdir\" != \"x\$file\"; then
5374 case \"\$destdir\" in
5375 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5376 *) thisdir=\"\$thisdir/\$destdir\" ;;
5377 esac
5380 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5381 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5382 done
5384 # Try to get the absolute directory name.
5385 absdir=\`cd \"\$thisdir\" && pwd\`
5386 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5389 if test "$fast_install" = yes; then
5390 $echo >> $output "\
5391 program=lt-'$outputname'$exeext
5392 progdir=\"\$thisdir/$objdir\"
5394 if test ! -f \"\$progdir/\$program\" || \\
5395 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5396 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5398 file=\"\$\$-\$program\"
5400 if test ! -d \"\$progdir\"; then
5401 $mkdir \"\$progdir\"
5402 else
5403 $rm \"\$progdir/\$file\"
5406 $echo >> $output "\
5408 # relink executable if necessary
5409 if test -n \"\$relink_command\"; then
5410 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5411 else
5412 $echo \"\$relink_command_output\" >&2
5413 $rm \"\$progdir/\$file\"
5414 exit $EXIT_FAILURE
5418 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5419 { $rm \"\$progdir/\$program\";
5420 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5421 $rm \"\$progdir/\$file\"
5423 else
5424 $echo >> $output "\
5425 program='$outputname'
5426 progdir=\"\$thisdir/$objdir\"
5430 $echo >> $output "\
5432 if test -f \"\$progdir/\$program\"; then"
5434 # Export our shlibpath_var if we have one.
5435 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5436 $echo >> $output "\
5437 # Add our own library path to $shlibpath_var
5438 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5440 # Some systems cannot cope with colon-terminated $shlibpath_var
5441 # The second colon is a workaround for a bug in BeOS R4 sed
5442 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5444 export $shlibpath_var
5448 # fixup the dll searchpath if we need to.
5449 if test -n "$dllsearchpath"; then
5450 $echo >> $output "\
5451 # Add the dll search path components to the executable PATH
5452 PATH=$dllsearchpath:\$PATH
5456 $echo >> $output "\
5457 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5458 # Run the actual program with our arguments.
5460 # Make sure env LD_LIBRARY_PATH does not mess us up
5461 if test -n \"\${LD_LIBRARY_PATH+set}\"; then
5462 export LD_LIBRARY_PATH=\$progdir:\$LD_LIBRARY_PATH
5465 case $host in
5466 # Backslashes separate directories on plain windows
5467 *-*-mingw | *-*-os2*)
5468 $echo >> $output "\
5469 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5474 $echo >> $output "\
5475 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5478 esac
5479 $echo >> $output "\
5480 \$echo \"\$0: cannot exec \$program \$*\"
5481 exit $EXIT_FAILURE
5483 else
5484 # The program doesn't exist.
5485 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5486 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5487 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5488 exit $EXIT_FAILURE
5492 chmod +x $output
5494 exit $EXIT_SUCCESS
5496 esac
5498 # See if we need to build an old-fashioned archive.
5499 for oldlib in $oldlibs; do
5501 if test "$build_libtool_libs" = convenience; then
5502 oldobjs="$libobjs_save"
5503 addlibs="$convenience"
5504 build_libtool_libs=no
5505 else
5506 if test "$build_libtool_libs" = module; then
5507 oldobjs="$libobjs_save"
5508 build_libtool_libs=no
5509 else
5510 oldobjs="$old_deplibs $non_pic_objects"
5512 addlibs="$old_convenience"
5515 if test -n "$addlibs"; then
5516 gentop="$output_objdir/${outputname}x"
5517 generated="$generated $gentop"
5519 func_extract_archives $gentop $addlibs
5520 oldobjs="$oldobjs $func_extract_archives_result"
5523 # Do each command in the archive commands.
5524 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5525 cmds=$old_archive_from_new_cmds
5526 else
5527 # POSIX demands no paths to be encoded in archives. We have
5528 # to avoid creating archives with duplicate basenames if we
5529 # might have to extract them afterwards, e.g., when creating a
5530 # static archive out of a convenience library, or when linking
5531 # the entirety of a libtool archive into another (currently
5532 # not supported by libtool).
5533 if (for obj in $oldobjs
5535 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5536 done | sort | sort -uc >/dev/null 2>&1); then
5538 else
5539 $echo "copying selected object files to avoid basename conflicts..."
5541 if test -z "$gentop"; then
5542 gentop="$output_objdir/${outputname}x"
5543 generated="$generated $gentop"
5545 $show "${rm}r $gentop"
5546 $run ${rm}r "$gentop"
5547 $show "$mkdir $gentop"
5548 $run $mkdir "$gentop"
5549 exit_status=$?
5550 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5551 exit $exit_status
5555 save_oldobjs=$oldobjs
5556 oldobjs=
5557 counter=1
5558 for obj in $save_oldobjs
5560 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5561 case " $oldobjs " in
5562 " ") oldobjs=$obj ;;
5563 *[\ /]"$objbase "*)
5564 while :; do
5565 # Make sure we don't pick an alternate name that also
5566 # overlaps.
5567 newobj=lt$counter-$objbase
5568 counter=`expr $counter + 1`
5569 case " $oldobjs " in
5570 *[\ /]"$newobj "*) ;;
5571 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5572 esac
5573 done
5574 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5575 $run ln "$obj" "$gentop/$newobj" ||
5576 $run cp "$obj" "$gentop/$newobj"
5577 oldobjs="$oldobjs $gentop/$newobj"
5579 *) oldobjs="$oldobjs $obj" ;;
5580 esac
5581 done
5584 eval cmds=\"$old_archive_cmds\"
5586 if len=`expr "X$cmds" : ".*"` &&
5587 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5588 cmds=$old_archive_cmds
5589 else
5590 # the command line is too long to link in one step, link in parts
5591 $echo "using piecewise archive linking..."
5592 save_RANLIB=$RANLIB
5593 RANLIB=:
5594 objlist=
5595 concat_cmds=
5596 save_oldobjs=$oldobjs
5598 # Is there a better way of finding the last object in the list?
5599 for obj in $save_oldobjs
5601 last_oldobj=$obj
5602 done
5603 for obj in $save_oldobjs
5605 oldobjs="$objlist $obj"
5606 objlist="$objlist $obj"
5607 eval test_cmds=\"$old_archive_cmds\"
5608 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5609 test "$len" -le "$max_cmd_len"; then
5611 else
5612 # the above command should be used before it gets too long
5613 oldobjs=$objlist
5614 if test "$obj" = "$last_oldobj" ; then
5615 RANLIB=$save_RANLIB
5617 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5618 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5619 objlist=
5621 done
5622 RANLIB=$save_RANLIB
5623 oldobjs=$objlist
5624 if test "X$oldobjs" = "X" ; then
5625 eval cmds=\"\$concat_cmds\"
5626 else
5627 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5631 save_ifs="$IFS"; IFS='~'
5632 for cmd in $cmds; do
5633 eval cmd=\"$cmd\"
5634 IFS="$save_ifs"
5635 $show "$cmd"
5636 $run eval "$cmd" || exit $?
5637 done
5638 IFS="$save_ifs"
5639 done
5641 if test -n "$generated"; then
5642 $show "${rm}r$generated"
5643 $run ${rm}r$generated
5646 # Now create the libtool archive.
5647 case $output in
5648 *.la)
5649 old_library=
5650 test "$build_old_libs" = yes && old_library="$libname.$libext"
5651 $show "creating $output"
5653 # Preserve any variables that may affect compiler behavior
5654 for var in $variables_saved_for_relink; do
5655 if eval test -z \"\${$var+set}\"; then
5656 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5657 elif eval var_value=\$$var; test -z "$var_value"; then
5658 relink_command="$var=; export $var; $relink_command"
5659 else
5660 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5661 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5663 done
5664 # Quote the link command for shipping.
5665 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5666 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5667 if test "$hardcode_automatic" = yes ; then
5668 relink_command=
5672 # Only create the output if not a dry run.
5673 if test -z "$run"; then
5674 for installed in no yes; do
5675 if test "$installed" = yes; then
5676 if test -z "$install_libdir"; then
5677 break
5679 output="$output_objdir/$outputname"i
5680 # Replace all uninstalled libtool libraries with the installed ones
5681 newdependency_libs=
5682 for deplib in $dependency_libs; do
5683 case $deplib in
5684 *.la)
5685 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5686 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5687 if test -z "$libdir"; then
5688 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5689 exit $EXIT_FAILURE
5691 if test "X$EGREP" = X ; then
5692 EGREP=egrep
5694 # We do not want portage's install root ($D) present. Check only for
5695 # this if the .la is being installed.
5696 if test "$installed" = yes && test "$D"; then
5697 eval mynewdependency_lib=`echo "$libdir/$name" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5698 else
5699 mynewdependency_lib="$libdir/$name"
5701 # Do not add duplicates
5702 if test "$mynewdependency_lib"; then
5703 my_little_ninja_foo_1=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5704 if test -z "$my_little_ninja_foo_1"; then
5705 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5710 if test "$installed" = yes; then
5711 # Rather use S=WORKDIR if our version of portage supports it.
5712 # This is because some ebuild (gcc) do not use $S as buildroot.
5713 if test "$PWORKDIR"; then
5714 S="$PWORKDIR"
5716 # We do not want portage's build root ($S) present.
5717 my_little_ninja_foo_2=`echo $deplib |$EGREP -e "$S"`
5718 # We do not want portage's install root ($D) present.
5719 my_little_ninja_foo_3=`echo $deplib |$EGREP -e "$D"`
5720 if test -n "$my_little_ninja_foo_2" && test "$S"; then
5721 mynewdependency_lib=""
5722 elif test -n "$my_little_ninja_foo_3" && test "$D"; then
5723 eval mynewdependency_lib=`echo "$deplib" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5724 else
5725 mynewdependency_lib="$deplib"
5727 else
5728 mynewdependency_lib="$deplib"
5730 # Do not add duplicates
5731 if test "$mynewdependency_lib"; then
5732 my_little_ninja_foo_4=`echo $newdependency_libs |$EGREP -e "$mynewdependency_lib"`
5733 if test -z "$my_little_ninja_foo_4"; then
5734 newdependency_libs="$newdependency_libs $mynewdependency_lib"
5738 esac
5739 done
5740 dependency_libs="$newdependency_libs"
5741 newdlfiles=
5742 for lib in $dlfiles; do
5743 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5744 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5745 if test -z "$libdir"; then
5746 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5747 exit $EXIT_FAILURE
5749 newdlfiles="$newdlfiles $libdir/$name"
5750 done
5751 dlfiles="$newdlfiles"
5752 newdlprefiles=
5753 for lib in $dlprefiles; do
5754 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5755 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5756 if test -z "$libdir"; then
5757 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5758 exit $EXIT_FAILURE
5760 newdlprefiles="$newdlprefiles $libdir/$name"
5761 done
5762 dlprefiles="$newdlprefiles"
5763 else
5764 newdlfiles=
5765 for lib in $dlfiles; do
5766 case $lib in
5767 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5768 *) abs=`pwd`"/$lib" ;;
5769 esac
5770 newdlfiles="$newdlfiles $abs"
5771 done
5772 dlfiles="$newdlfiles"
5773 newdlprefiles=
5774 for lib in $dlprefiles; do
5775 case $lib in
5776 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5777 *) abs=`pwd`"/$lib" ;;
5778 esac
5779 newdlprefiles="$newdlprefiles $abs"
5780 done
5781 dlprefiles="$newdlprefiles"
5783 $rm $output
5784 # place dlname in correct position for cygwin
5785 tdlname=$dlname
5786 case $host,$output,$installed,$module,$dlname in
5787 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5788 esac
5789 # Do not add duplicates
5790 if test "$installed" = yes && test "$D"; then
5791 install_libdir=`echo "$install_libdir" |sed -e "s:$D:/:g" -e 's:/\+:/:g'`
5793 $echo > $output "\
5794 # $outputname - a libtool library file
5795 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5797 # Please DO NOT delete this file!
5798 # It is necessary for linking the library.
5800 # The name that we can dlopen(3).
5801 dlname='$tdlname'
5803 # Names of this library.
5804 library_names='$library_names'
5806 # The name of the static archive.
5807 old_library='$old_library'
5809 # Libraries that this one depends upon.
5810 dependency_libs='$dependency_libs'
5812 # Version information for $libname.
5813 current=$current
5814 age=$age
5815 revision=$revision
5817 # Is this an already installed library?
5818 installed=$installed
5820 # Should we warn about portability when linking against -modules?
5821 shouldnotlink=$module
5823 # Files to dlopen/dlpreopen
5824 dlopen='$dlfiles'
5825 dlpreopen='$dlprefiles'
5827 # Directory that this library needs to be installed in:
5828 libdir='$install_libdir'"
5829 if test "$installed" = no && test "$need_relink" = yes; then
5830 $echo >> $output "\
5831 relink_command=\"$relink_command\""
5833 done
5836 # Do a symbolic link so that the libtool archive can be found in
5837 # LD_LIBRARY_PATH before the program is installed.
5838 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5839 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5841 esac
5842 exit $EXIT_SUCCESS
5845 # libtool install mode
5846 install)
5847 modename="$modename: install"
5849 # There may be an optional sh(1) argument at the beginning of
5850 # install_prog (especially on Windows NT).
5851 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5852 # Allow the use of GNU shtool's install command.
5853 $echo "X$nonopt" | grep shtool > /dev/null; then
5854 # Aesthetically quote it.
5855 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5856 case $arg in
5857 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5858 arg="\"$arg\""
5860 esac
5861 install_prog="$arg "
5862 arg="$1"
5863 shift
5864 else
5865 install_prog=
5866 arg=$nonopt
5869 # The real first argument should be the name of the installation program.
5870 # Aesthetically quote it.
5871 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5872 case $arg in
5873 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5874 arg="\"$arg\""
5876 esac
5877 install_prog="$install_prog$arg"
5879 # We need to accept at least all the BSD install flags.
5880 dest=
5881 files=
5882 opts=
5883 prev=
5884 install_type=
5885 isdir=no
5886 stripme=
5887 for arg
5889 if test -n "$dest"; then
5890 files="$files $dest"
5891 dest=$arg
5892 continue
5895 case $arg in
5896 -d) isdir=yes ;;
5897 -f)
5898 case " $install_prog " in
5899 *[\\\ /]cp\ *) ;;
5900 *) prev=$arg ;;
5901 esac
5903 -g | -m | -o) prev=$arg ;;
5905 stripme=" -s"
5906 continue
5911 # If the previous option needed an argument, then skip it.
5912 if test -n "$prev"; then
5913 prev=
5914 else
5915 dest=$arg
5916 continue
5919 esac
5921 # Aesthetically quote the argument.
5922 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5923 case $arg in
5924 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5925 arg="\"$arg\""
5927 esac
5928 install_prog="$install_prog $arg"
5929 done
5931 if test -z "$install_prog"; then
5932 $echo "$modename: you must specify an install program" 1>&2
5933 $echo "$help" 1>&2
5934 exit $EXIT_FAILURE
5937 if test -n "$prev"; then
5938 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5939 $echo "$help" 1>&2
5940 exit $EXIT_FAILURE
5943 if test -z "$files"; then
5944 if test -z "$dest"; then
5945 $echo "$modename: no file or destination specified" 1>&2
5946 else
5947 $echo "$modename: you must specify a destination" 1>&2
5949 $echo "$help" 1>&2
5950 exit $EXIT_FAILURE
5953 # Strip any trailing slash from the destination.
5954 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5956 # Check to see that the destination is a directory.
5957 test -d "$dest" && isdir=yes
5958 if test "$isdir" = yes; then
5959 destdir="$dest"
5960 destname=
5961 else
5962 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5963 test "X$destdir" = "X$dest" && destdir=.
5964 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5966 # Not a directory, so check to see that there is only one file specified.
5967 set dummy $files
5968 if test "$#" -gt 2; then
5969 $echo "$modename: \`$dest' is not a directory" 1>&2
5970 $echo "$help" 1>&2
5971 exit $EXIT_FAILURE
5974 case $destdir in
5975 [\\/]* | [A-Za-z]:[\\/]*) ;;
5977 for file in $files; do
5978 case $file in
5979 *.lo) ;;
5981 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5982 $echo "$help" 1>&2
5983 exit $EXIT_FAILURE
5985 esac
5986 done
5988 esac
5990 # This variable tells wrapper scripts just to set variables rather
5991 # than running their programs.
5992 libtool_install_magic="$magic"
5994 staticlibs=
5995 future_libdirs=
5996 current_libdirs=
5997 for file in $files; do
5999 # Do each installation.
6000 case $file in
6001 *.$libext)
6002 # Do the static libraries later.
6003 staticlibs="$staticlibs $file"
6006 *.la)
6007 # Check to see that this really is a libtool archive.
6008 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6009 else
6010 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6011 $echo "$help" 1>&2
6012 exit $EXIT_FAILURE
6015 library_names=
6016 old_library=
6017 relink_command=
6018 # If there is no directory component, then add one.
6019 case $file in
6020 */* | *\\*) . $file ;;
6021 *) . ./$file ;;
6022 esac
6024 # Add the libdir to current_libdirs if it is the destination.
6025 if test "X$destdir" = "X$libdir"; then
6026 case "$current_libdirs " in
6027 *" $libdir "*) ;;
6028 *) current_libdirs="$current_libdirs $libdir" ;;
6029 esac
6030 else
6031 # Note the libdir as a future libdir.
6032 case "$future_libdirs " in
6033 *" $libdir "*) ;;
6034 *) future_libdirs="$future_libdirs $libdir" ;;
6035 esac
6038 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6039 test "X$dir" = "X$file/" && dir=
6040 dir="$dir$objdir"
6042 if test -n "$relink_command"; then
6043 # Determine the prefix the user has applied to our future dir.
6044 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6046 # Don't allow the user to place us outside of our expected
6047 # location b/c this prevents finding dependent libraries that
6048 # are installed to the same prefix.
6049 # At present, this check doesn't affect windows .dll's that
6050 # are installed into $libdir/../bin (currently, that works fine)
6051 # but it's something to keep an eye on.
6052 if test "$inst_prefix_dir" = "$destdir"; then
6053 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6054 exit $EXIT_FAILURE
6057 if test -n "$inst_prefix_dir"; then
6058 # Stick the inst_prefix_dir data into the link command.
6059 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6060 else
6061 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6064 $echo "$modename: warning: relinking \`$file'" 1>&2
6065 $show "$relink_command"
6066 if $run eval "$relink_command"; then :
6067 else
6068 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6069 exit $EXIT_FAILURE
6073 # See the names of the shared library.
6074 set dummy $library_names
6075 if test -n "$2"; then
6076 realname="$2"
6077 shift
6078 shift
6080 srcname="$realname"
6081 test -n "$relink_command" && srcname="$realname"T
6083 # Install the shared library and build the symlinks.
6084 $show "$install_prog $dir/$srcname $destdir/$realname"
6085 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6086 if test -n "$stripme" && test -n "$striplib"; then
6087 $show "$striplib $destdir/$realname"
6088 $run eval "$striplib $destdir/$realname" || exit $?
6091 if test "$#" -gt 0; then
6092 # Delete the old symlinks, and create new ones.
6093 # Try `ln -sf' first, because the `ln' binary might depend on
6094 # the symlink we replace! Solaris /bin/ln does not understand -f,
6095 # so we also need to try rm && ln -s.
6096 for linkname
6098 if test "$linkname" != "$realname"; then
6099 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6100 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6102 done
6105 # Do each command in the postinstall commands.
6106 lib="$destdir/$realname"
6107 cmds=$postinstall_cmds
6108 save_ifs="$IFS"; IFS='~'
6109 for cmd in $cmds; do
6110 IFS="$save_ifs"
6111 eval cmd=\"$cmd\"
6112 $show "$cmd"
6113 $run eval "$cmd" || {
6114 lt_exit=$?
6116 # Restore the uninstalled library and exit
6117 if test "$mode" = relink; then
6118 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6121 exit $lt_exit
6123 done
6124 IFS="$save_ifs"
6127 # Install the pseudo-library for information purposes.
6128 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6129 instname="$dir/$name"i
6130 $show "$install_prog $instname $destdir/$name"
6131 $run eval "$install_prog $instname $destdir/$name" || exit $?
6133 # Maybe install the static library, too.
6134 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6137 *.lo)
6138 # Install (i.e. copy) a libtool object.
6140 # Figure out destination file name, if it wasn't already specified.
6141 if test -n "$destname"; then
6142 destfile="$destdir/$destname"
6143 else
6144 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6145 destfile="$destdir/$destfile"
6148 # Deduce the name of the destination old-style object file.
6149 case $destfile in
6150 *.lo)
6151 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6153 *.$objext)
6154 staticdest="$destfile"
6155 destfile=
6158 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6159 $echo "$help" 1>&2
6160 exit $EXIT_FAILURE
6162 esac
6164 # Install the libtool object if requested.
6165 if test -n "$destfile"; then
6166 $show "$install_prog $file $destfile"
6167 $run eval "$install_prog $file $destfile" || exit $?
6170 # Install the old object if enabled.
6171 if test "$build_old_libs" = yes; then
6172 # Deduce the name of the old-style object file.
6173 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6175 $show "$install_prog $staticobj $staticdest"
6176 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6178 exit $EXIT_SUCCESS
6182 # Figure out destination file name, if it wasn't already specified.
6183 if test -n "$destname"; then
6184 destfile="$destdir/$destname"
6185 else
6186 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6187 destfile="$destdir/$destfile"
6190 # If the file is missing, and there is a .exe on the end, strip it
6191 # because it is most likely a libtool script we actually want to
6192 # install
6193 stripped_ext=""
6194 case $file in
6195 *.exe)
6196 if test ! -f "$file"; then
6197 file=`$echo $file|${SED} 's,.exe$,,'`
6198 stripped_ext=".exe"
6201 esac
6203 # Do a test to see if this is really a libtool program.
6204 case $host in
6205 *cygwin*|*mingw*)
6206 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6209 wrapper=$file
6211 esac
6212 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6213 notinst_deplibs=
6214 relink_command=
6216 # Note that it is not necessary on cygwin/mingw to append a dot to
6217 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6218 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6219 # `FILE.' does not work on cygwin managed mounts.
6221 # If there is no directory component, then add one.
6222 case $wrapper in
6223 */* | *\\*) . ${wrapper} ;;
6224 *) . ./${wrapper} ;;
6225 esac
6227 # Check the variables that should have been set.
6228 if test -z "$notinst_deplibs"; then
6229 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6230 exit $EXIT_FAILURE
6233 finalize=yes
6234 for lib in $notinst_deplibs; do
6235 # Check to see that each library is installed.
6236 libdir=
6237 if test -f "$lib"; then
6238 # If there is no directory component, then add one.
6239 case $lib in
6240 */* | *\\*) . $lib ;;
6241 *) . ./$lib ;;
6242 esac
6244 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6245 if test -n "$libdir" && test ! -f "$libfile"; then
6246 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6247 finalize=no
6249 done
6251 relink_command=
6252 # Note that it is not necessary on cygwin/mingw to append a dot to
6253 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6254 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6255 # `FILE.' does not work on cygwin managed mounts.
6257 # If there is no directory component, then add one.
6258 case $wrapper in
6259 */* | *\\*) . ${wrapper} ;;
6260 *) . ./${wrapper} ;;
6261 esac
6263 outputname=
6264 if test "$fast_install" = no && test -n "$relink_command"; then
6265 if test "$finalize" = yes && test -z "$run"; then
6266 tmpdir=`func_mktempdir`
6267 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6268 outputname="$tmpdir/$file"
6269 # Replace the output file specification.
6270 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6272 $show "$relink_command"
6273 if $run eval "$relink_command"; then :
6274 else
6275 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6276 ${rm}r "$tmpdir"
6277 continue
6279 file="$outputname"
6280 else
6281 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6283 else
6284 # Install the binary that we compiled earlier.
6285 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6289 # remove .exe since cygwin /usr/bin/install will append another
6290 # one anyway
6291 case $install_prog,$host in
6292 */usr/bin/install*,*cygwin*)
6293 case $file:$destfile in
6294 *.exe:*.exe)
6295 # this is ok
6297 *.exe:*)
6298 destfile=$destfile.exe
6300 *:*.exe)
6301 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6303 esac
6305 esac
6306 $show "$install_prog$stripme $file $destfile"
6307 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6308 test -n "$outputname" && ${rm}r "$tmpdir"
6310 esac
6311 done
6313 for file in $staticlibs; do
6314 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6316 # Set up the ranlib parameters.
6317 oldlib="$destdir/$name"
6319 $show "$install_prog $file $oldlib"
6320 $run eval "$install_prog \$file \$oldlib" || exit $?
6322 if test -n "$stripme" && test -n "$old_striplib"; then
6323 $show "$old_striplib $oldlib"
6324 $run eval "$old_striplib $oldlib" || exit $?
6327 # Do each command in the postinstall commands.
6328 cmds=$old_postinstall_cmds
6329 save_ifs="$IFS"; IFS='~'
6330 for cmd in $cmds; do
6331 IFS="$save_ifs"
6332 eval cmd=\"$cmd\"
6333 $show "$cmd"
6334 $run eval "$cmd" || exit $?
6335 done
6336 IFS="$save_ifs"
6337 done
6339 if test -n "$future_libdirs"; then
6340 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6343 if test -n "$current_libdirs"; then
6344 # Maybe just do a dry run.
6345 test -n "$run" && current_libdirs=" -n$current_libdirs"
6346 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6347 else
6348 exit $EXIT_SUCCESS
6352 # libtool finish mode
6353 finish)
6354 modename="$modename: finish"
6355 libdirs="$nonopt"
6356 admincmds=
6358 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6359 for dir
6361 libdirs="$libdirs $dir"
6362 done
6364 for libdir in $libdirs; do
6365 if test -n "$finish_cmds"; then
6366 # Do each command in the finish commands.
6367 cmds=$finish_cmds
6368 save_ifs="$IFS"; IFS='~'
6369 for cmd in $cmds; do
6370 IFS="$save_ifs"
6371 eval cmd=\"$cmd\"
6372 $show "$cmd"
6373 $run eval "$cmd" || admincmds="$admincmds
6374 $cmd"
6375 done
6376 IFS="$save_ifs"
6378 if test -n "$finish_eval"; then
6379 # Do the single finish_eval.
6380 eval cmds=\"$finish_eval\"
6381 $run eval "$cmds" || admincmds="$admincmds
6382 $cmds"
6384 done
6387 # Exit here if they wanted silent mode.
6388 test "$show" = : && exit $EXIT_SUCCESS
6390 $echo "X----------------------------------------------------------------------" | $Xsed
6391 $echo "Libraries have been installed in:"
6392 for libdir in $libdirs; do
6393 $echo " $libdir"
6394 done
6395 $echo
6396 $echo "If you ever happen to want to link against installed libraries"
6397 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6398 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6399 $echo "flag during linking and do at least one of the following:"
6400 if test -n "$shlibpath_var"; then
6401 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6402 $echo " during execution"
6404 if test -n "$runpath_var"; then
6405 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6406 $echo " during linking"
6408 if test -n "$hardcode_libdir_flag_spec"; then
6409 libdir=LIBDIR
6410 eval flag=\"$hardcode_libdir_flag_spec\"
6412 $echo " - use the \`$flag' linker flag"
6414 if test -n "$admincmds"; then
6415 $echo " - have your system administrator run these commands:$admincmds"
6417 if test -f /etc/ld.so.conf; then
6418 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6420 $echo
6421 $echo "See any operating system documentation about shared libraries for"
6422 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6423 $echo "X----------------------------------------------------------------------" | $Xsed
6424 exit $EXIT_SUCCESS
6427 # libtool execute mode
6428 execute)
6429 modename="$modename: execute"
6431 # The first argument is the command name.
6432 cmd="$nonopt"
6433 if test -z "$cmd"; then
6434 $echo "$modename: you must specify a COMMAND" 1>&2
6435 $echo "$help"
6436 exit $EXIT_FAILURE
6439 # Handle -dlopen flags immediately.
6440 for file in $execute_dlfiles; do
6441 if test ! -f "$file"; then
6442 $echo "$modename: \`$file' is not a file" 1>&2
6443 $echo "$help" 1>&2
6444 exit $EXIT_FAILURE
6447 dir=
6448 case $file in
6449 *.la)
6450 # Check to see that this really is a libtool archive.
6451 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6452 else
6453 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6454 $echo "$help" 1>&2
6455 exit $EXIT_FAILURE
6458 # Read the libtool library.
6459 dlname=
6460 library_names=
6462 # If there is no directory component, then add one.
6463 case $file in
6464 */* | *\\*) . $file ;;
6465 *) . ./$file ;;
6466 esac
6468 # Skip this library if it cannot be dlopened.
6469 if test -z "$dlname"; then
6470 # Warn if it was a shared library.
6471 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6472 continue
6475 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6476 test "X$dir" = "X$file" && dir=.
6478 if test -f "$dir/$objdir/$dlname"; then
6479 dir="$dir/$objdir"
6480 else
6481 if test ! -f "$dir/$dlname"; then
6482 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6483 exit $EXIT_FAILURE
6488 *.lo)
6489 # Just add the directory containing the .lo file.
6490 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6491 test "X$dir" = "X$file" && dir=.
6495 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6496 continue
6498 esac
6500 # Get the absolute pathname.
6501 absdir=`cd "$dir" && pwd`
6502 test -n "$absdir" && dir="$absdir"
6504 # Now add the directory to shlibpath_var.
6505 if eval "test -z \"\$$shlibpath_var\""; then
6506 eval "$shlibpath_var=\"\$dir\""
6507 else
6508 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6510 done
6512 # This variable tells wrapper scripts just to set shlibpath_var
6513 # rather than running their programs.
6514 libtool_execute_magic="$magic"
6516 # Check if any of the arguments is a wrapper script.
6517 args=
6518 for file
6520 case $file in
6521 -*) ;;
6523 # Do a test to see if this is really a libtool program.
6524 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6525 # If there is no directory component, then add one.
6526 case $file in
6527 */* | *\\*) . $file ;;
6528 *) . ./$file ;;
6529 esac
6531 # Transform arg to wrapped name.
6532 file="$progdir/$program"
6535 esac
6536 # Quote arguments (to preserve shell metacharacters).
6537 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6538 args="$args \"$file\""
6539 done
6541 if test -z "$run"; then
6542 if test -n "$shlibpath_var"; then
6543 # Export the shlibpath_var.
6544 eval "export $shlibpath_var"
6547 # Restore saved environment variables
6548 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6550 eval "if test \"\${save_$lt_var+set}\" = set; then
6551 $lt_var=\$save_$lt_var; export $lt_var
6553 done
6555 # Now prepare to actually exec the command.
6556 exec_cmd="\$cmd$args"
6557 else
6558 # Display what would be done.
6559 if test -n "$shlibpath_var"; then
6560 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6561 $echo "export $shlibpath_var"
6563 $echo "$cmd$args"
6564 exit $EXIT_SUCCESS
6568 # libtool clean and uninstall mode
6569 clean | uninstall)
6570 modename="$modename: $mode"
6571 rm="$nonopt"
6572 files=
6573 rmforce=
6574 exit_status=0
6576 # This variable tells wrapper scripts just to set variables rather
6577 # than running their programs.
6578 libtool_install_magic="$magic"
6580 for arg
6582 case $arg in
6583 -f) rm="$rm $arg"; rmforce=yes ;;
6584 -*) rm="$rm $arg" ;;
6585 *) files="$files $arg" ;;
6586 esac
6587 done
6589 if test -z "$rm"; then
6590 $echo "$modename: you must specify an RM program" 1>&2
6591 $echo "$help" 1>&2
6592 exit $EXIT_FAILURE
6595 rmdirs=
6597 origobjdir="$objdir"
6598 for file in $files; do
6599 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6600 if test "X$dir" = "X$file"; then
6601 dir=.
6602 objdir="$origobjdir"
6603 else
6604 objdir="$dir/$origobjdir"
6606 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6607 test "$mode" = uninstall && objdir="$dir"
6609 # Remember objdir for removal later, being careful to avoid duplicates
6610 if test "$mode" = clean; then
6611 case " $rmdirs " in
6612 *" $objdir "*) ;;
6613 *) rmdirs="$rmdirs $objdir" ;;
6614 esac
6617 # Don't error if the file doesn't exist and rm -f was used.
6618 if (test -L "$file") >/dev/null 2>&1 \
6619 || (test -h "$file") >/dev/null 2>&1 \
6620 || test -f "$file"; then
6622 elif test -d "$file"; then
6623 exit_status=1
6624 continue
6625 elif test "$rmforce" = yes; then
6626 continue
6629 rmfiles="$file"
6631 case $name in
6632 *.la)
6633 # Possibly a libtool archive, so verify it.
6634 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6635 . $dir/$name
6637 # Delete the libtool libraries and symlinks.
6638 for n in $library_names; do
6639 rmfiles="$rmfiles $objdir/$n"
6640 done
6641 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6643 case "$mode" in
6644 clean)
6645 case " $library_names " in
6646 # " " in the beginning catches empty $dlname
6647 *" $dlname "*) ;;
6648 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6649 esac
6650 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6652 uninstall)
6653 if test -n "$library_names"; then
6654 # Do each command in the postuninstall commands.
6655 cmds=$postuninstall_cmds
6656 save_ifs="$IFS"; IFS='~'
6657 for cmd in $cmds; do
6658 IFS="$save_ifs"
6659 eval cmd=\"$cmd\"
6660 $show "$cmd"
6661 $run eval "$cmd"
6662 if test "$?" -ne 0 && test "$rmforce" != yes; then
6663 exit_status=1
6665 done
6666 IFS="$save_ifs"
6669 if test -n "$old_library"; then
6670 # Do each command in the old_postuninstall commands.
6671 cmds=$old_postuninstall_cmds
6672 save_ifs="$IFS"; IFS='~'
6673 for cmd in $cmds; do
6674 IFS="$save_ifs"
6675 eval cmd=\"$cmd\"
6676 $show "$cmd"
6677 $run eval "$cmd"
6678 if test "$?" -ne 0 && test "$rmforce" != yes; then
6679 exit_status=1
6681 done
6682 IFS="$save_ifs"
6684 # FIXME: should reinstall the best remaining shared library.
6686 esac
6690 *.lo)
6691 # Possibly a libtool object, so verify it.
6692 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6694 # Read the .lo file
6695 . $dir/$name
6697 # Add PIC object to the list of files to remove.
6698 if test -n "$pic_object" \
6699 && test "$pic_object" != none; then
6700 rmfiles="$rmfiles $dir/$pic_object"
6703 # Add non-PIC object to the list of files to remove.
6704 if test -n "$non_pic_object" \
6705 && test "$non_pic_object" != none; then
6706 rmfiles="$rmfiles $dir/$non_pic_object"
6712 if test "$mode" = clean ; then
6713 noexename=$name
6714 case $file in
6715 *.exe)
6716 file=`$echo $file|${SED} 's,.exe$,,'`
6717 noexename=`$echo $name|${SED} 's,.exe$,,'`
6718 # $file with .exe has already been added to rmfiles,
6719 # add $file without .exe
6720 rmfiles="$rmfiles $file"
6722 esac
6723 # Do a test to see if this is a libtool program.
6724 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6725 relink_command=
6726 . $dir/$noexename
6728 # note $name still contains .exe if it was in $file originally
6729 # as does the version of $file that was added into $rmfiles
6730 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6731 if test "$fast_install" = yes && test -n "$relink_command"; then
6732 rmfiles="$rmfiles $objdir/lt-$name"
6734 if test "X$noexename" != "X$name" ; then
6735 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6740 esac
6741 $show "$rm $rmfiles"
6742 $run $rm $rmfiles || exit_status=1
6743 done
6744 objdir="$origobjdir"
6746 # Try to remove the ${objdir}s in the directories where we deleted files
6747 for dir in $rmdirs; do
6748 if test -d "$dir"; then
6749 $show "rmdir $dir"
6750 $run rmdir $dir >/dev/null 2>&1
6752 done
6754 exit $exit_status
6758 $echo "$modename: you must specify a MODE" 1>&2
6759 $echo "$generic_help" 1>&2
6760 exit $EXIT_FAILURE
6762 esac
6764 if test -z "$exec_cmd"; then
6765 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6766 $echo "$generic_help" 1>&2
6767 exit $EXIT_FAILURE
6769 fi # test -z "$show_help"
6771 if test -n "$exec_cmd"; then
6772 eval exec $exec_cmd
6773 exit $EXIT_FAILURE
6776 # We need to display help for each of the modes.
6777 case $mode in
6778 "") $echo \
6779 "Usage: $modename [OPTION]... [MODE-ARG]...
6781 Provide generalized library-building support services.
6783 --config show all configuration variables
6784 --debug enable verbose shell tracing
6785 -n, --dry-run display commands without modifying any files
6786 --features display basic configuration information and exit
6787 --finish same as \`--mode=finish'
6788 --help display this help message and exit
6789 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6790 --quiet same as \`--silent'
6791 --silent don't print informational messages
6792 --tag=TAG use configuration variables from tag TAG
6793 --version print version information
6795 MODE must be one of the following:
6797 clean remove files from the build directory
6798 compile compile a source file into a libtool object
6799 execute automatically set library path, then run a program
6800 finish complete the installation of libtool libraries
6801 install install libraries or executables
6802 link create a library or an executable
6803 uninstall remove libraries from an installed directory
6805 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6806 a more detailed description of MODE.
6808 Report bugs to <bug-libtool@gnu.org>."
6809 exit $EXIT_SUCCESS
6812 clean)
6813 $echo \
6814 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6816 Remove files from the build directory.
6818 RM is the name of the program to use to delete files associated with each FILE
6819 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6820 to RM.
6822 If FILE is a libtool library, object or program, all the files associated
6823 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6826 compile)
6827 $echo \
6828 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6830 Compile a source file into a libtool library object.
6832 This mode accepts the following additional options:
6834 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6835 -prefer-pic try to building PIC objects only
6836 -prefer-non-pic try to building non-PIC objects only
6837 -static always build a \`.o' file suitable for static linking
6839 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6840 from the given SOURCEFILE.
6842 The output file name is determined by removing the directory component from
6843 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6844 library object suffix, \`.lo'."
6847 execute)
6848 $echo \
6849 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6851 Automatically set library path, then run a program.
6853 This mode accepts the following additional options:
6855 -dlopen FILE add the directory containing FILE to the library path
6857 This mode sets the library path environment variable according to \`-dlopen'
6858 flags.
6860 If any of the ARGS are libtool executable wrappers, then they are translated
6861 into their corresponding uninstalled binary, and any of their required library
6862 directories are added to the library path.
6864 Then, COMMAND is executed, with ARGS as arguments."
6867 finish)
6868 $echo \
6869 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6871 Complete the installation of libtool libraries.
6873 Each LIBDIR is a directory that contains libtool libraries.
6875 The commands that this mode executes may require superuser privileges. Use
6876 the \`--dry-run' option if you just want to see what would be executed."
6879 install)
6880 $echo \
6881 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6883 Install executables or libraries.
6885 INSTALL-COMMAND is the installation command. The first component should be
6886 either the \`install' or \`cp' program.
6888 The rest of the components are interpreted as arguments to that command (only
6889 BSD-compatible install options are recognized)."
6892 link)
6893 $echo \
6894 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6896 Link object files or libraries together to form another library, or to
6897 create an executable program.
6899 LINK-COMMAND is a command using the C compiler that you would use to create
6900 a program from several object files.
6902 The following components of LINK-COMMAND are treated specially:
6904 -all-static do not do any dynamic linking at all
6905 -avoid-version do not add a version suffix if possible
6906 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6907 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6908 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6909 -export-symbols SYMFILE
6910 try to export only the symbols listed in SYMFILE
6911 -export-symbols-regex REGEX
6912 try to export only the symbols matching REGEX
6913 -LLIBDIR search LIBDIR for required installed libraries
6914 -lNAME OUTPUT-FILE requires the installed library libNAME
6915 -module build a library that can dlopened
6916 -no-fast-install disable the fast-install mode
6917 -no-install link a not-installable executable
6918 -no-undefined declare that a library does not refer to external symbols
6919 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6920 -objectlist FILE Use a list of object files found in FILE to specify objects
6921 -precious-files-regex REGEX
6922 don't remove output files matching REGEX
6923 -release RELEASE specify package release information
6924 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6925 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6926 -static do not do any dynamic linking of uninstalled libtool libraries
6927 -static-libtool-libs
6928 do not do any dynamic linking of libtool libraries
6929 -version-info CURRENT[:REVISION[:AGE]]
6930 specify library version info [each variable defaults to 0]
6932 All other options (arguments beginning with \`-') are ignored.
6934 Every other argument is treated as a filename. Files ending in \`.la' are
6935 treated as uninstalled libtool libraries, other files are standard or library
6936 object files.
6938 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6939 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6940 required, except when creating a convenience library.
6942 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6943 using \`ar' and \`ranlib', or on Windows using \`lib'.
6945 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6946 is created, otherwise an executable program is created."
6949 uninstall)
6950 $echo \
6951 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6953 Remove libraries from an installation directory.
6955 RM is the name of the program to use to delete files associated with each FILE
6956 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6957 to RM.
6959 If FILE is a libtool library, all the files associated with it are deleted.
6960 Otherwise, only FILE itself is deleted using RM."
6964 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6965 $echo "$help" 1>&2
6966 exit $EXIT_FAILURE
6968 esac
6970 $echo
6971 $echo "Try \`$modename --help' for more information about other modes."
6973 exit $?
6975 # The TAGs below are defined such that we never get into a situation
6976 # in which we disable both kinds of libraries. Given conflicting
6977 # choices, we go for a static library, that is the most portable,
6978 # since we can't tell whether shared libraries were disabled because
6979 # the user asked for that or because the platform doesn't support
6980 # them. This is particularly important on AIX, because we don't
6981 # support having both static and shared libraries enabled at the same
6982 # time on that platform, so we default to a shared-only configuration.
6983 # If a disable-shared tag is given, we'll fallback to a static-only
6984 # configuration. But we'll never go from static-only to shared-only.
6986 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6987 disable_libs=shared
6988 # ### END LIBTOOL TAG CONFIG: disable-shared
6990 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6991 disable_libs=static
6992 # ### END LIBTOOL TAG CONFIG: disable-static
6994 # Local Variables:
6995 # mode:shell-script
6996 # sh-indentation:2
6997 # End: