Expand PMF_FN_* macros.
[netbsd-mini2440.git] / dist / openpam / ltmain.sh
blobc9698e72c335dbf0cc82087f4e709c65e83818ea
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.455 2007/06/24 02:13:29)"
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 # FreeBSD-specific: where we install compilers with non-standard names
248 tag_compilers_CC="*cc cc* *gcc gcc*"
249 tag_compilers_CXX="*c++ c++* *g++ g++*"
250 base_compiler=`set -- "$@"; echo $1`
252 # If $tagname isn't set, then try to infer if the default "CC" tag applies
253 if test -z "$tagname"; then
254 for zp in $tag_compilers_CC; do
255 case $base_compiler in
256 $zp) tagname="CC"; break;;
257 esac
258 done
261 if test -n "$available_tags" && test -z "$tagname"; then
262 CC_quoted=
263 for arg in $CC; do
264 case $arg in
265 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
266 arg="\"$arg\""
268 esac
269 CC_quoted="$CC_quoted $arg"
270 done
271 case $@ in
272 # Blanks in the command may have been stripped by the calling shell,
273 # but not from the CC environment variable when configure was run.
274 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
275 # Blanks at the start of $base_compile will cause this to fail
276 # if we don't check for them as well.
278 for z in $available_tags; do
279 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
280 # Evaluate the configuration.
281 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
282 CC_quoted=
283 for arg in $CC; do
284 # Double-quote args containing other shell metacharacters.
285 case $arg in
286 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
287 arg="\"$arg\""
289 esac
290 CC_quoted="$CC_quoted $arg"
291 done
292 case "$@ " in
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 # FreeBSD-specific: try compilers based on inferred tag
303 if test -z "$tagname"; then
304 eval "tag_compilers=\$tag_compilers_${z}"
305 if test -n "$tag_compilers"; then
306 for zp in $tag_compilers; do
307 case $base_compiler in
308 $zp) tagname=$z; break;;
309 esac
310 done
311 if test -n "$tagname"; then
312 break
317 done
318 # If $tagname still isn't set, then no tagged configuration
319 # was found and let the user know that the "--tag" command
320 # line option must be used.
321 if test -z "$tagname"; then
322 $echo "$modename: unable to infer tagged configuration"
323 $echo "$modename: specify a tag with \`--tag'" 1>&2
324 exit $EXIT_FAILURE
325 # else
326 # $echo "$modename: using $tagname tagged configuration"
329 esac
334 # func_extract_an_archive dir oldlib
335 func_extract_an_archive ()
337 f_ex_an_ar_dir="$1"; shift
338 f_ex_an_ar_oldlib="$1"
340 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
341 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
342 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
344 else
345 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
346 exit $EXIT_FAILURE
350 # func_extract_archives gentop oldlib ...
351 func_extract_archives ()
353 my_gentop="$1"; shift
354 my_oldlibs=${1+"$@"}
355 my_oldobjs=""
356 my_xlib=""
357 my_xabs=""
358 my_xdir=""
359 my_status=""
361 $show "${rm}r $my_gentop"
362 $run ${rm}r "$my_gentop"
363 $show "$mkdir $my_gentop"
364 $run $mkdir "$my_gentop"
365 my_status=$?
366 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
367 exit $my_status
370 for my_xlib in $my_oldlibs; do
371 # Extract the objects.
372 case $my_xlib in
373 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
374 *) my_xabs=`pwd`"/$my_xlib" ;;
375 esac
376 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
377 my_xlib_u=$my_xlib
378 while :; do
379 case " $extracted_archives " in
380 *" $my_xlib_u "*)
381 extracted_serial=`expr $extracted_serial + 1`
382 my_xlib_u=lt$extracted_serial-$my_xlib ;;
383 *) break ;;
384 esac
385 done
386 extracted_archives="$extracted_archives $my_xlib_u"
387 my_xdir="$my_gentop/$my_xlib_u"
389 $show "${rm}r $my_xdir"
390 $run ${rm}r "$my_xdir"
391 $show "$mkdir $my_xdir"
392 $run $mkdir "$my_xdir"
393 exit_status=$?
394 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
395 exit $exit_status
397 case $host in
398 *-darwin*)
399 $show "Extracting $my_xabs"
400 # Do not bother doing anything if just a dry run
401 if test -z "$run"; then
402 darwin_orig_dir=`pwd`
403 cd $my_xdir || exit $?
404 darwin_archive=$my_xabs
405 darwin_curdir=`pwd`
406 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
407 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
408 if test -n "$darwin_arches"; then
409 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
410 darwin_arch=
411 $show "$darwin_base_archive has multiple architectures $darwin_arches"
412 for darwin_arch in $darwin_arches ; do
413 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
414 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
415 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
416 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
417 cd "$darwin_curdir"
418 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
419 done # $darwin_arches
420 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
421 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
422 darwin_file=
423 darwin_files=
424 for darwin_file in $darwin_filelist; do
425 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
426 lipo -create -output "$darwin_file" $darwin_files
427 done # $darwin_filelist
428 ${rm}r unfat-$$
429 cd "$darwin_orig_dir"
430 else
431 cd "$darwin_orig_dir"
432 func_extract_an_archive "$my_xdir" "$my_xabs"
433 fi # $darwin_arches
434 fi # $run
437 func_extract_an_archive "$my_xdir" "$my_xabs"
439 esac
440 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
441 done
442 func_extract_archives_result="$my_oldobjs"
444 # End of Shell function definitions
445 #####################################
447 # Darwin sucks
448 eval std_shrext=\"$shrext_cmds\"
450 disable_libs=no
452 # Parse our command line options once, thoroughly.
453 while test "$#" -gt 0
455 arg="$1"
456 shift
458 case $arg in
459 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
460 *) optarg= ;;
461 esac
463 # If the previous option needs an argument, assign it.
464 if test -n "$prev"; then
465 case $prev in
466 execute_dlfiles)
467 execute_dlfiles="$execute_dlfiles $arg"
469 tag)
470 tagname="$arg"
471 preserve_args="${preserve_args}=$arg"
473 # Check whether tagname contains only valid characters
474 case $tagname in
475 *[!-_A-Za-z0-9,/]*)
476 $echo "$progname: invalid tag name: $tagname" 1>&2
477 exit $EXIT_FAILURE
479 esac
481 case $tagname in
483 # Don't test for the "default" C tag, as we know, it's there, but
484 # not specially marked.
487 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
488 taglist="$taglist $tagname"
489 # Evaluate the configuration.
490 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
491 else
492 $echo "$progname: ignoring unknown tag $tagname" 1>&2
495 esac
498 eval "$prev=\$arg"
500 esac
502 prev=
503 prevopt=
504 continue
507 # Have we seen a non-optional argument yet?
508 case $arg in
509 --help)
510 show_help=yes
513 --version)
514 echo "\
515 $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
517 Copyright (C) 2007 Free Software Foundation, Inc.
518 This is free software; see the source for copying conditions. There is NO
519 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
520 exit $?
523 --config)
524 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
525 # Now print the configurations for the tags.
526 for tagname in $taglist; do
527 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
528 done
529 exit $?
532 --debug)
533 $echo "$progname: enabling shell trace mode"
534 set -x
535 preserve_args="$preserve_args $arg"
538 --dry-run | -n)
539 run=:
542 --features)
543 $echo "host: $host"
544 if test "$build_libtool_libs" = yes; then
545 $echo "enable shared libraries"
546 else
547 $echo "disable shared libraries"
549 if test "$build_old_libs" = yes; then
550 $echo "enable static libraries"
551 else
552 $echo "disable static libraries"
554 exit $?
557 --finish) mode="finish" ;;
559 --mode) prevopt="--mode" prev=mode ;;
560 --mode=*) mode="$optarg" ;;
562 --preserve-dup-deps) duplicate_deps="yes" ;;
564 --quiet | --silent)
565 show=:
566 preserve_args="$preserve_args $arg"
569 --tag)
570 prevopt="--tag"
571 prev=tag
572 preserve_args="$preserve_args --tag"
574 --tag=*)
575 set tag "$optarg" ${1+"$@"}
576 shift
577 prev=tag
578 preserve_args="$preserve_args --tag"
581 -dlopen)
582 prevopt="-dlopen"
583 prev=execute_dlfiles
587 $echo "$modename: unrecognized option \`$arg'" 1>&2
588 $echo "$help" 1>&2
589 exit $EXIT_FAILURE
593 nonopt="$arg"
594 break
596 esac
597 done
599 if test -n "$prevopt"; then
600 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
601 $echo "$help" 1>&2
602 exit $EXIT_FAILURE
605 case $disable_libs in
606 no)
608 shared)
609 build_libtool_libs=no
610 build_old_libs=yes
612 static)
613 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
615 esac
617 # If this variable is set in any of the actions, the command in it
618 # will be execed at the end. This prevents here-documents from being
619 # left over by shells.
620 exec_cmd=
622 if test -z "$show_help"; then
624 # Infer the operation mode.
625 if test -z "$mode"; then
626 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
627 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
628 case $nonopt in
629 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
630 mode=link
631 for arg
633 case $arg in
635 mode=compile
636 break
638 esac
639 done
641 *db | *dbx | *strace | *truss)
642 mode=execute
644 *install*|cp|mv)
645 mode=install
647 *rm)
648 mode=uninstall
651 # If we have no mode, but dlfiles were specified, then do execute mode.
652 test -n "$execute_dlfiles" && mode=execute
654 # Just use the default operation mode.
655 if test -z "$mode"; then
656 if test -n "$nonopt"; then
657 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
658 else
659 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
663 esac
666 # Only execute mode is allowed to have -dlopen flags.
667 if test -n "$execute_dlfiles" && test "$mode" != execute; then
668 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
669 $echo "$help" 1>&2
670 exit $EXIT_FAILURE
673 # Change the help message to a mode-specific one.
674 generic_help="$help"
675 help="Try \`$modename --help --mode=$mode' for more information."
677 # These modes are in order of execution frequency so that they run quickly.
678 case $mode in
679 # libtool compile mode
680 compile)
681 modename="$modename: compile"
682 # Get the compilation command and the source file.
683 base_compile=
684 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
685 suppress_opt=yes
686 suppress_output=
687 arg_mode=normal
688 libobj=
689 later=
691 for arg
693 case $arg_mode in
694 arg )
695 # do not "continue". Instead, add this to base_compile
696 lastarg="$arg"
697 arg_mode=normal
700 target )
701 libobj="$arg"
702 arg_mode=normal
703 continue
706 normal )
707 # Accept any command-line options.
708 case $arg in
710 if test -n "$libobj" ; then
711 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
712 exit $EXIT_FAILURE
714 arg_mode=target
715 continue
718 -static | -prefer-pic | -prefer-non-pic)
719 later="$later $arg"
720 continue
723 -no-suppress)
724 suppress_opt=no
725 continue
728 -Xcompiler)
729 arg_mode=arg # the next one goes into the "base_compile" arg list
730 continue # The current "srcfile" will either be retained or
731 ;; # replaced later. I would guess that would be a bug.
733 -Wc,*)
734 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
735 lastarg=
736 save_ifs="$IFS"; IFS=','
737 for arg in $args; do
738 IFS="$save_ifs"
740 # Double-quote args containing other shell metacharacters.
741 # Many Bourne shells cannot handle close brackets correctly
742 # in scan sets, so we specify it separately.
743 case $arg in
744 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
745 arg="\"$arg\""
747 esac
748 lastarg="$lastarg $arg"
749 done
750 IFS="$save_ifs"
751 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
753 # Add the arguments to base_compile.
754 base_compile="$base_compile $lastarg"
755 continue
759 # Accept the current argument as the source file.
760 # The previous "srcfile" becomes the current argument.
762 lastarg="$srcfile"
763 srcfile="$arg"
765 esac # case $arg
767 esac # case $arg_mode
769 # Aesthetically quote the previous argument.
770 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
772 case $lastarg in
773 # Double-quote args containing other shell metacharacters.
774 # Many Bourne shells cannot handle close brackets correctly
775 # in scan sets, and some SunOS ksh mistreat backslash-escaping
776 # in scan sets (worked around with variable expansion),
777 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
778 # at all, so we specify them separately.
779 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
780 lastarg="\"$lastarg\""
782 esac
784 base_compile="$base_compile $lastarg"
785 done # for arg
787 case $arg_mode in
788 arg)
789 $echo "$modename: you must specify an argument for -Xcompile"
790 exit $EXIT_FAILURE
792 target)
793 $echo "$modename: you must specify a target with \`-o'" 1>&2
794 exit $EXIT_FAILURE
797 # Get the name of the library object.
798 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
800 esac
802 # Recognize several different file suffixes.
803 # If the user specifies -o file.o, it is replaced with file.lo
804 xform='[cCFSifmso]'
805 case $libobj in
806 *.ada) xform=ada ;;
807 *.adb) xform=adb ;;
808 *.ads) xform=ads ;;
809 *.asm) xform=asm ;;
810 *.c++) xform=c++ ;;
811 *.cc) xform=cc ;;
812 *.ii) xform=ii ;;
813 *.class) xform=class ;;
814 *.cpp) xform=cpp ;;
815 *.cxx) xform=cxx ;;
816 *.[fF][09]?) xform=[fF][09]. ;;
817 *.for) xform=for ;;
818 *.java) xform=java ;;
819 *.obj) xform=obj ;;
820 esac
822 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
824 case $libobj in
825 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
827 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
828 exit $EXIT_FAILURE
830 esac
832 func_infer_tag $base_compile
834 for arg in $later; do
835 case $arg in
836 -static)
837 build_old_libs=yes
838 continue
841 -prefer-pic)
842 pic_mode=yes
843 continue
846 -prefer-non-pic)
847 pic_mode=no
848 continue
850 esac
851 done
853 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
854 case $qlibobj in
855 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
856 qlibobj="\"$qlibobj\"" ;;
857 esac
858 test "X$libobj" != "X$qlibobj" \
859 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
860 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
861 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
862 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
863 if test "X$xdir" = "X$obj"; then
864 xdir=
865 else
866 xdir=$xdir/
868 lobj=${xdir}$objdir/$objname
870 if test -z "$base_compile"; then
871 $echo "$modename: you must specify a compilation command" 1>&2
872 $echo "$help" 1>&2
873 exit $EXIT_FAILURE
876 # Delete any leftover library objects.
877 if test "$build_old_libs" = yes; then
878 removelist="$obj $lobj $libobj ${libobj}T"
879 else
880 removelist="$lobj $libobj ${libobj}T"
883 $run $rm $removelist
884 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
886 # On Cygwin there's no "real" PIC flag so we must build both object types
887 case $host_os in
888 cygwin* | mingw* | pw32* | os2*)
889 pic_mode=default
891 esac
892 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
893 # non-PIC code in shared libraries is not supported
894 pic_mode=default
897 # Calculate the filename of the output object if compiler does
898 # not support -o with -c
899 if test "$compiler_c_o" = no; then
900 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
901 lockfile="$output_obj.lock"
902 removelist="$removelist $output_obj $lockfile"
903 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
904 else
905 output_obj=
906 need_locks=no
907 lockfile=
910 # Lock this critical section if it is needed
911 # We use this script file to make the link, it avoids creating a new file
912 if test "$need_locks" = yes; then
913 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
914 $show "Waiting for $lockfile to be removed"
915 sleep 2
916 done
917 elif test "$need_locks" = warn; then
918 if test -f "$lockfile"; then
919 $echo "\
920 *** ERROR, $lockfile exists and contains:
921 `cat $lockfile 2>/dev/null`
923 This indicates that another process is trying to use the same
924 temporary object file, and libtool could not work around it because
925 your compiler does not support \`-c' and \`-o' together. If you
926 repeat this compilation, it may succeed, by chance, but you had better
927 avoid parallel builds (make -j) in this platform, or get a better
928 compiler."
930 $run $rm $removelist
931 exit $EXIT_FAILURE
933 $echo "$srcfile" > "$lockfile"
936 if test -n "$fix_srcfile_path"; then
937 eval srcfile=\"$fix_srcfile_path\"
939 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
940 case $qsrcfile in
941 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
942 qsrcfile="\"$qsrcfile\"" ;;
943 esac
945 $run $rm "$libobj" "${libobj}T"
947 # Create a libtool object file (analogous to a ".la" file),
948 # but don't create it if we're doing a dry run.
949 test -z "$run" && cat > ${libobj}T <<EOF
950 # $libobj - a libtool object file
951 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
953 # Please DO NOT delete this file!
954 # It is necessary for linking the library.
956 # Name of the PIC object.
959 # Only build a PIC object if we are building libtool libraries.
960 if test "$build_libtool_libs" = yes; then
961 # Without this assignment, base_compile gets emptied.
962 fbsd_hideous_sh_bug=$base_compile
964 if test "$pic_mode" != no; then
965 command="$base_compile $qsrcfile $pic_flag"
966 else
967 # Don't build PIC code
968 command="$base_compile $qsrcfile"
971 if test ! -d "${xdir}$objdir"; then
972 $show "$mkdir ${xdir}$objdir"
973 $run $mkdir ${xdir}$objdir
974 exit_status=$?
975 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
976 exit $exit_status
980 if test -z "$output_obj"; then
981 # Place PIC objects in $objdir
982 command="$command -o $lobj"
985 $run $rm "$lobj" "$output_obj"
987 $show "$command"
988 if $run eval "$command"; then :
989 else
990 test -n "$output_obj" && $run $rm $removelist
991 exit $EXIT_FAILURE
994 if test "$need_locks" = warn &&
995 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
996 $echo "\
997 *** ERROR, $lockfile contains:
998 `cat $lockfile 2>/dev/null`
1000 but it should contain:
1001 $srcfile
1003 This indicates that another process is trying to use the same
1004 temporary object file, and libtool could not work around it because
1005 your compiler does not support \`-c' and \`-o' together. If you
1006 repeat this compilation, it may succeed, by chance, but you had better
1007 avoid parallel builds (make -j) in this platform, or get a better
1008 compiler."
1010 $run $rm $removelist
1011 exit $EXIT_FAILURE
1014 # Just move the object if needed, then go on to compile the next one
1015 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1016 $show "$mv $output_obj $lobj"
1017 if $run $mv $output_obj $lobj; then :
1018 else
1019 error=$?
1020 $run $rm $removelist
1021 exit $error
1025 # Append the name of the PIC object to the libtool object file.
1026 test -z "$run" && cat >> ${libobj}T <<EOF
1027 pic_object='$objdir/$objname'
1031 # Allow error messages only from the first compilation.
1032 if test "$suppress_opt" = yes; then
1033 suppress_output=' >/dev/null 2>&1'
1035 else
1036 # No PIC object so indicate it doesn't exist in the libtool
1037 # object file.
1038 test -z "$run" && cat >> ${libobj}T <<EOF
1039 pic_object=none
1044 # Only build a position-dependent object if we build old libraries.
1045 if test "$build_old_libs" = yes; then
1046 if test "$pic_mode" != yes; then
1047 # Don't build PIC code
1048 command="$base_compile $qsrcfile"
1049 else
1050 command="$base_compile $qsrcfile $pic_flag"
1052 if test "$compiler_c_o" = yes; then
1053 command="$command -o $obj"
1056 # Suppress compiler output if we already did a PIC compilation.
1057 command="$command$suppress_output"
1058 $run $rm "$obj" "$output_obj"
1059 $show "$command"
1060 if $run eval "$command"; then :
1061 else
1062 $run $rm $removelist
1063 exit $EXIT_FAILURE
1066 if test "$need_locks" = warn &&
1067 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1068 $echo "\
1069 *** ERROR, $lockfile contains:
1070 `cat $lockfile 2>/dev/null`
1072 but it should contain:
1073 $srcfile
1075 This indicates that another process is trying to use the same
1076 temporary object file, and libtool could not work around it because
1077 your compiler does not support \`-c' and \`-o' together. If you
1078 repeat this compilation, it may succeed, by chance, but you had better
1079 avoid parallel builds (make -j) in this platform, or get a better
1080 compiler."
1082 $run $rm $removelist
1083 exit $EXIT_FAILURE
1086 # Just move the object if needed
1087 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1088 $show "$mv $output_obj $obj"
1089 if $run $mv $output_obj $obj; then :
1090 else
1091 error=$?
1092 $run $rm $removelist
1093 exit $error
1097 # Append the name of the non-PIC object the libtool object file.
1098 # Only append if the libtool object file exists.
1099 test -z "$run" && cat >> ${libobj}T <<EOF
1100 # Name of the non-PIC object.
1101 non_pic_object='$objname'
1104 else
1105 # Append the name of the non-PIC object the libtool object file.
1106 # Only append if the libtool object file exists.
1107 test -z "$run" && cat >> ${libobj}T <<EOF
1108 # Name of the non-PIC object.
1109 non_pic_object=none
1114 $run $mv "${libobj}T" "${libobj}"
1116 # Unlock the critical section if it was locked
1117 if test "$need_locks" != no; then
1118 $run $rm "$lockfile"
1121 exit $EXIT_SUCCESS
1124 # libtool link mode
1125 link | relink)
1126 modename="$modename: link"
1127 case $host in
1128 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1129 # It is impossible to link a dll without this setting, and
1130 # we shouldn't force the makefile maintainer to figure out
1131 # which system we are compiling for in order to pass an extra
1132 # flag for every libtool invocation.
1133 # allow_undefined=no
1135 # FIXME: Unfortunately, there are problems with the above when trying
1136 # to make a dll which has undefined symbols, in which case not
1137 # even a static library is built. For now, we need to specify
1138 # -no-undefined on the libtool link line when we can be certain
1139 # that all symbols are satisfied, otherwise we get a static library.
1140 allow_undefined=yes
1143 allow_undefined=yes
1145 esac
1146 libtool_args="$nonopt"
1147 base_compile="$nonopt $@"
1148 compile_command="$nonopt"
1149 finalize_command="$nonopt"
1151 compile_rpath=
1152 finalize_rpath=
1153 compile_shlibpath=
1154 finalize_shlibpath=
1155 convenience=
1156 old_convenience=
1157 deplibs=
1158 old_deplibs=
1159 compiler_flags=
1160 linker_flags=
1161 dllsearchpath=
1162 lib_search_path=`pwd`
1163 inst_prefix_dir=
1165 avoid_version=no
1166 dlfiles=
1167 dlprefiles=
1168 dlself=no
1169 export_dynamic=no
1170 export_symbols=
1171 export_symbols_regex=
1172 generated=
1173 libobjs=
1174 ltlibs=
1175 module=no
1176 no_install=no
1177 objs=
1178 non_pic_objects=
1179 notinst_path= # paths that contain not-installed libtool libraries
1180 precious_files_regex=
1181 prefer_static_libs=no
1182 preload=no
1183 prev=
1184 prevarg=
1185 release=
1186 rpath=
1187 xrpath=
1188 perm_rpath=
1189 temp_rpath=
1190 thread_safe=no
1191 vinfo=
1192 vinfo_number=no
1194 func_infer_tag $base_compile
1196 # We need to know -static, to get the right output filenames.
1197 for arg
1199 case $arg in
1200 -all-static | -static | -static-libtool-libs)
1201 case $arg in
1202 -all-static)
1203 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1204 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1206 if test -n "$link_static_flag"; then
1207 dlopen_self=$dlopen_self_static
1209 prefer_static_libs=yes
1211 -static)
1212 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1213 dlopen_self=$dlopen_self_static
1215 prefer_static_libs=built
1217 -static-libtool-libs)
1218 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1219 dlopen_self=$dlopen_self_static
1221 prefer_static_libs=yes
1223 esac
1224 build_libtool_libs=no
1225 build_old_libs=yes
1226 break
1228 esac
1229 done
1231 # See if our shared archives depend on static archives.
1232 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1234 # Go through the arguments, transforming them on the way.
1235 while test "$#" -gt 0; do
1236 arg="$1"
1237 shift
1238 case $arg in
1239 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1240 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1242 *) qarg=$arg ;;
1243 esac
1244 libtool_args="$libtool_args $qarg"
1246 # If the previous option needs an argument, assign it.
1247 if test -n "$prev"; then
1248 case $prev in
1249 output)
1250 compile_command="$compile_command @OUTPUT@"
1251 finalize_command="$finalize_command @OUTPUT@"
1253 esac
1255 case $prev in
1256 dlfiles|dlprefiles)
1257 if test "$preload" = no; then
1258 # Add the symbol object into the linking commands.
1259 compile_command="$compile_command @SYMFILE@"
1260 finalize_command="$finalize_command @SYMFILE@"
1261 preload=yes
1263 case $arg in
1264 *.la | *.lo) ;; # We handle these cases below.
1265 force)
1266 if test "$dlself" = no; then
1267 dlself=needless
1268 export_dynamic=yes
1270 prev=
1271 continue
1273 self)
1274 if test "$prev" = dlprefiles; then
1275 dlself=yes
1276 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1277 dlself=yes
1278 else
1279 dlself=needless
1280 export_dynamic=yes
1282 prev=
1283 continue
1286 if test "$prev" = dlfiles; then
1287 dlfiles="$dlfiles $arg"
1288 else
1289 dlprefiles="$dlprefiles $arg"
1291 prev=
1292 continue
1294 esac
1296 expsyms)
1297 export_symbols="$arg"
1298 if test ! -f "$arg"; then
1299 $echo "$modename: symbol file \`$arg' does not exist"
1300 exit $EXIT_FAILURE
1302 prev=
1303 continue
1305 expsyms_regex)
1306 export_symbols_regex="$arg"
1307 prev=
1308 continue
1310 inst_prefix)
1311 inst_prefix_dir="$arg"
1312 prev=
1313 continue
1315 precious_regex)
1316 precious_files_regex="$arg"
1317 prev=
1318 continue
1320 release)
1321 release="-$arg"
1322 prev=
1323 continue
1325 objectlist)
1326 if test -f "$arg"; then
1327 save_arg=$arg
1328 moreargs=
1329 for fil in `cat $save_arg`
1331 # moreargs="$moreargs $fil"
1332 arg=$fil
1333 # A libtool-controlled object.
1335 # Check to see that this really is a libtool object.
1336 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1337 pic_object=
1338 non_pic_object=
1340 # Read the .lo file
1341 # If there is no directory component, then add one.
1342 case $arg in
1343 */* | *\\*) . $arg ;;
1344 *) . ./$arg ;;
1345 esac
1347 if test -z "$pic_object" || \
1348 test -z "$non_pic_object" ||
1349 test "$pic_object" = none && \
1350 test "$non_pic_object" = none; then
1351 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1352 exit $EXIT_FAILURE
1355 # Extract subdirectory from the argument.
1356 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1357 if test "X$xdir" = "X$arg"; then
1358 xdir=
1359 else
1360 xdir="$xdir/"
1363 if test "$pic_object" != none; then
1364 # Prepend the subdirectory the object is found in.
1365 pic_object="$xdir$pic_object"
1367 if test "$prev" = dlfiles; then
1368 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1369 dlfiles="$dlfiles $pic_object"
1370 prev=
1371 continue
1372 else
1373 # If libtool objects are unsupported, then we need to preload.
1374 prev=dlprefiles
1378 # CHECK ME: I think I busted this. -Ossama
1379 if test "$prev" = dlprefiles; then
1380 # Preload the old-style object.
1381 dlprefiles="$dlprefiles $pic_object"
1382 prev=
1385 # A PIC object.
1386 libobjs="$libobjs $pic_object"
1387 arg="$pic_object"
1390 # Non-PIC object.
1391 if test "$non_pic_object" != none; then
1392 # Prepend the subdirectory the object is found in.
1393 non_pic_object="$xdir$non_pic_object"
1395 # A standard non-PIC object
1396 non_pic_objects="$non_pic_objects $non_pic_object"
1397 if test -z "$pic_object" || test "$pic_object" = none ; then
1398 arg="$non_pic_object"
1400 else
1401 # If the PIC object exists, use it instead.
1402 # $xdir was prepended to $pic_object above.
1403 non_pic_object="$pic_object"
1404 non_pic_objects="$non_pic_objects $non_pic_object"
1406 else
1407 # Only an error if not doing a dry-run.
1408 if test -z "$run"; then
1409 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1410 exit $EXIT_FAILURE
1411 else
1412 # Dry-run case.
1414 # Extract subdirectory from the argument.
1415 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1416 if test "X$xdir" = "X$arg"; then
1417 xdir=
1418 else
1419 xdir="$xdir/"
1422 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1423 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1424 libobjs="$libobjs $pic_object"
1425 non_pic_objects="$non_pic_objects $non_pic_object"
1428 done
1429 else
1430 $echo "$modename: link input file \`$save_arg' does not exist"
1431 exit $EXIT_FAILURE
1433 arg=$save_arg
1434 prev=
1435 continue
1437 rpath | xrpath)
1438 # We need an absolute path.
1439 case $arg in
1440 [\\/]* | [A-Za-z]:[\\/]*) ;;
1442 $echo "$modename: only absolute run-paths are allowed" 1>&2
1443 exit $EXIT_FAILURE
1445 esac
1446 if test "$prev" = rpath; then
1447 case "$rpath " in
1448 *" $arg "*) ;;
1449 *) rpath="$rpath $arg" ;;
1450 esac
1451 else
1452 case "$xrpath " in
1453 *" $arg "*) ;;
1454 *) xrpath="$xrpath $arg" ;;
1455 esac
1457 prev=
1458 continue
1460 xcompiler)
1461 compiler_flags="$compiler_flags $qarg"
1462 prev=
1463 compile_command="$compile_command $qarg"
1464 finalize_command="$finalize_command $qarg"
1465 continue
1467 xlinker)
1468 linker_flags="$linker_flags $qarg"
1469 compiler_flags="$compiler_flags $wl$qarg"
1470 prev=
1471 compile_command="$compile_command $wl$qarg"
1472 finalize_command="$finalize_command $wl$qarg"
1473 continue
1475 xcclinker)
1476 linker_flags="$linker_flags $qarg"
1477 compiler_flags="$compiler_flags $qarg"
1478 prev=
1479 compile_command="$compile_command $qarg"
1480 finalize_command="$finalize_command $qarg"
1481 continue
1483 shrext)
1484 shrext_cmds="$arg"
1485 prev=
1486 continue
1488 darwin_framework|darwin_framework_skip)
1489 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1490 compile_command="$compile_command $arg"
1491 finalize_command="$finalize_command $arg"
1492 prev=
1493 continue
1496 eval "$prev=\"\$arg\""
1497 prev=
1498 continue
1500 esac
1501 fi # test -n "$prev"
1503 prevarg="$arg"
1505 case $arg in
1506 -all-static)
1507 if test -n "$link_static_flag"; then
1508 compile_command="$compile_command $link_static_flag"
1509 finalize_command="$finalize_command $link_static_flag"
1511 continue
1514 -allow-undefined)
1515 # FIXME: remove this flag sometime in the future.
1516 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1517 continue
1520 -avoid-version)
1521 avoid_version=yes
1522 continue
1525 -dlopen)
1526 prev=dlfiles
1527 continue
1530 -dlpreopen)
1531 prev=dlprefiles
1532 continue
1535 -export-dynamic)
1536 export_dynamic=yes
1537 continue
1540 -export-symbols | -export-symbols-regex)
1541 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1542 $echo "$modename: more than one -exported-symbols argument is not allowed"
1543 exit $EXIT_FAILURE
1545 if test "X$arg" = "X-export-symbols"; then
1546 prev=expsyms
1547 else
1548 prev=expsyms_regex
1550 continue
1553 -framework|-arch|-isysroot)
1554 case " $CC " in
1555 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1556 prev=darwin_framework_skip ;;
1557 *) compiler_flags="$compiler_flags $arg"
1558 prev=darwin_framework ;;
1559 esac
1560 compile_command="$compile_command $arg"
1561 finalize_command="$finalize_command $arg"
1562 continue
1565 -inst-prefix-dir)
1566 prev=inst_prefix
1567 continue
1570 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1571 # so, if we see these flags be careful not to treat them like -L
1572 -L[A-Z][A-Z]*:*)
1573 case $with_gcc/$host in
1574 no/*-*-irix* | /*-*-irix*)
1575 compile_command="$compile_command $arg"
1576 finalize_command="$finalize_command $arg"
1578 esac
1579 continue
1582 -L*)
1583 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1584 # We need an absolute path.
1585 case $dir in
1586 [\\/]* | [A-Za-z]:[\\/]*) ;;
1588 absdir=`cd "$dir" && pwd`
1589 if test -z "$absdir"; then
1590 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1591 absdir="$dir"
1592 notinst_path="$notinst_path $dir"
1594 dir="$absdir"
1596 esac
1597 case "$deplibs " in
1598 *" -L$dir "*) ;;
1600 deplibs="$deplibs -L$dir"
1601 lib_search_path="$lib_search_path $dir"
1603 esac
1604 case $host in
1605 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1606 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1607 case :$dllsearchpath: in
1608 *":$dir:"*) ;;
1609 *) dllsearchpath="$dllsearchpath:$dir";;
1610 esac
1611 case :$dllsearchpath: in
1612 *":$testbindir:"*) ;;
1613 *) dllsearchpath="$dllsearchpath:$testbindir";;
1614 esac
1616 esac
1617 continue
1620 -l*)
1621 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1622 case $host in
1623 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1624 # These systems don't actually have a C or math library (as such)
1625 continue
1627 *-*-os2*)
1628 # These systems don't actually have a C library (as such)
1629 test "X$arg" = "X-lc" && continue
1631 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1632 # Do not include libc due to us having libc/libc_r.
1633 test "X$arg" = "X-lc" && continue
1635 *-*-rhapsody* | *-*-darwin1.[012])
1636 # Rhapsody C and math libraries are in the System framework
1637 deplibs="$deplibs -framework System"
1638 continue
1640 *-*-sco3.2v5* | *-*-sco5v6*)
1641 # Causes problems with __ctype
1642 test "X$arg" = "X-lc" && continue
1644 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1645 # Compiler inserts libc in the correct place for threads to work
1646 test "X$arg" = "X-lc" && continue
1648 esac
1649 elif test "X$arg" = "X-lc_r"; then
1650 case $host in
1651 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1652 # Do not include libc_r directly, use -pthread flag.
1653 continue
1655 esac
1657 deplibs="$deplibs $arg"
1658 continue
1661 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1662 # classes, name mangling, and exception handling.
1663 -model)
1664 compile_command="$compile_command $arg"
1665 compiler_flags="$compiler_flags $arg"
1666 finalize_command="$finalize_command $arg"
1667 prev=xcompiler
1668 continue
1671 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1672 compiler_flags="$compiler_flags $arg"
1673 compile_command="$compile_command $arg"
1674 finalize_command="$finalize_command $arg"
1675 deplibs="$deplibs $arg"
1676 continue
1679 -module)
1680 module=yes
1681 continue
1684 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1685 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1686 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1687 # +DA*, +DD* enable 64-bit mode on the HP compiler
1688 # -q* pass through compiler args for the IBM compiler
1689 # -m* pass through architecture-specific compiler args for GCC
1690 # -m*, -t[45]*, -txscale* pass through architecture-specific
1691 # compiler args for GCC
1692 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1693 # -F/path gives path to uninstalled frameworks, gcc on darwin
1694 # @file GCC response files
1695 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1696 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1698 # Unknown arguments in both finalize_command and compile_command need
1699 # to be aesthetically quoted because they are evaled later.
1700 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1701 case $arg in
1702 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1703 arg="\"$arg\""
1705 esac
1706 compile_command="$compile_command $arg"
1707 finalize_command="$finalize_command $arg"
1708 compiler_flags="$compiler_flags $arg"
1709 continue
1712 -shrext)
1713 prev=shrext
1714 continue
1717 -no-fast-install)
1718 fast_install=no
1719 continue
1722 -no-install)
1723 case $host in
1724 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1725 # The PATH hackery in wrapper scripts is required on Windows
1726 # and Darwin in order for the loader to find any dlls it needs.
1727 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1728 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1729 fast_install=no
1731 *) no_install=yes ;;
1732 esac
1733 continue
1736 -no-undefined)
1737 allow_undefined=no
1738 continue
1741 -objectlist)
1742 prev=objectlist
1743 continue
1746 -o) prev=output ;;
1748 -precious-files-regex)
1749 prev=precious_regex
1750 continue
1753 -release)
1754 prev=release
1755 continue
1758 -rpath)
1759 prev=rpath
1760 continue
1764 prev=xrpath
1765 continue
1768 -R*)
1769 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1770 # We need an absolute path.
1771 case $dir in
1772 [\\/]* | [A-Za-z]:[\\/]*) ;;
1774 $echo "$modename: only absolute run-paths are allowed" 1>&2
1775 exit $EXIT_FAILURE
1777 esac
1778 case "$xrpath " in
1779 *" $dir "*) ;;
1780 *) xrpath="$xrpath $dir" ;;
1781 esac
1782 continue
1785 -static | -static-libtool-libs)
1786 # The effects of -static are defined in a previous loop.
1787 # We used to do the same as -all-static on platforms that
1788 # didn't have a PIC flag, but the assumption that the effects
1789 # would be equivalent was wrong. It would break on at least
1790 # Digital Unix and AIX.
1791 continue
1794 -thread-safe)
1795 thread_safe=yes
1796 continue
1799 -version-info)
1800 prev=vinfo
1801 continue
1803 -version-number)
1804 prev=vinfo
1805 vinfo_number=yes
1806 continue
1809 -Wc,*)
1810 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1811 arg=
1812 save_ifs="$IFS"; IFS=','
1813 for flag in $args; do
1814 IFS="$save_ifs"
1815 case $flag in
1816 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1817 flag="\"$flag\""
1819 esac
1820 arg="$arg $wl$flag"
1821 compiler_flags="$compiler_flags $flag"
1822 done
1823 IFS="$save_ifs"
1824 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1827 -Wl,*)
1828 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1829 arg=
1830 save_ifs="$IFS"; IFS=','
1831 for flag in $args; do
1832 IFS="$save_ifs"
1833 case $flag in
1834 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1835 flag="\"$flag\""
1837 esac
1838 arg="$arg $wl$flag"
1839 compiler_flags="$compiler_flags $wl$flag"
1840 linker_flags="$linker_flags $flag"
1841 done
1842 IFS="$save_ifs"
1843 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1846 -Xcompiler)
1847 prev=xcompiler
1848 continue
1851 -Xlinker)
1852 prev=xlinker
1853 continue
1856 -XCClinker)
1857 prev=xcclinker
1858 continue
1861 # Some other compiler flag.
1862 -* | +*)
1863 # Unknown arguments in both finalize_command and compile_command need
1864 # to be aesthetically quoted because they are evaled later.
1865 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1866 case $arg in
1867 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1868 arg="\"$arg\""
1870 esac
1873 *.$objext)
1874 # A standard object.
1875 objs="$objs $arg"
1878 *.lo)
1879 # A libtool-controlled object.
1881 # Check to see that this really is a libtool object.
1882 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1883 pic_object=
1884 non_pic_object=
1886 # Read the .lo file
1887 # If there is no directory component, then add one.
1888 case $arg in
1889 */* | *\\*) . $arg ;;
1890 *) . ./$arg ;;
1891 esac
1893 if test -z "$pic_object" || \
1894 test -z "$non_pic_object" ||
1895 test "$pic_object" = none && \
1896 test "$non_pic_object" = none; then
1897 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1898 exit $EXIT_FAILURE
1901 # Extract subdirectory from the argument.
1902 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1903 if test "X$xdir" = "X$arg"; then
1904 xdir=
1905 else
1906 xdir="$xdir/"
1909 if test "$pic_object" != none; then
1910 # Prepend the subdirectory the object is found in.
1911 pic_object="$xdir$pic_object"
1913 if test "$prev" = dlfiles; then
1914 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1915 dlfiles="$dlfiles $pic_object"
1916 prev=
1917 continue
1918 else
1919 # If libtool objects are unsupported, then we need to preload.
1920 prev=dlprefiles
1924 # CHECK ME: I think I busted this. -Ossama
1925 if test "$prev" = dlprefiles; then
1926 # Preload the old-style object.
1927 dlprefiles="$dlprefiles $pic_object"
1928 prev=
1931 # A PIC object.
1932 libobjs="$libobjs $pic_object"
1933 arg="$pic_object"
1936 # Non-PIC object.
1937 if test "$non_pic_object" != none; then
1938 # Prepend the subdirectory the object is found in.
1939 non_pic_object="$xdir$non_pic_object"
1941 # A standard non-PIC object
1942 non_pic_objects="$non_pic_objects $non_pic_object"
1943 if test -z "$pic_object" || test "$pic_object" = none ; then
1944 arg="$non_pic_object"
1946 else
1947 # If the PIC object exists, use it instead.
1948 # $xdir was prepended to $pic_object above.
1949 non_pic_object="$pic_object"
1950 non_pic_objects="$non_pic_objects $non_pic_object"
1952 else
1953 # Only an error if not doing a dry-run.
1954 if test -z "$run"; then
1955 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1956 exit $EXIT_FAILURE
1957 else
1958 # Dry-run case.
1960 # Extract subdirectory from the argument.
1961 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1962 if test "X$xdir" = "X$arg"; then
1963 xdir=
1964 else
1965 xdir="$xdir/"
1968 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1969 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1970 libobjs="$libobjs $pic_object"
1971 non_pic_objects="$non_pic_objects $non_pic_object"
1976 *.$libext)
1977 # An archive.
1978 deplibs="$deplibs $arg"
1979 old_deplibs="$old_deplibs $arg"
1980 continue
1983 *.la)
1984 # A libtool-controlled library.
1986 if test "$prev" = dlfiles; then
1987 # This library was specified with -dlopen.
1988 dlfiles="$dlfiles $arg"
1989 prev=
1990 elif test "$prev" = dlprefiles; then
1991 # The library was specified with -dlpreopen.
1992 dlprefiles="$dlprefiles $arg"
1993 prev=
1994 else
1995 deplibs="$deplibs $arg"
1997 continue
2000 # Some other compiler argument.
2002 # Unknown arguments in both finalize_command and compile_command need
2003 # to be aesthetically quoted because they are evaled later.
2004 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
2005 case $arg in
2006 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
2007 arg="\"$arg\""
2009 esac
2011 esac # arg
2013 # Now actually substitute the argument into the commands.
2014 if test -n "$arg"; then
2015 compile_command="$compile_command $arg"
2016 finalize_command="$finalize_command $arg"
2018 done # argument parsing loop
2020 if test -n "$prev"; then
2021 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
2022 $echo "$help" 1>&2
2023 exit $EXIT_FAILURE
2026 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2027 eval arg=\"$export_dynamic_flag_spec\"
2028 compile_command="$compile_command $arg"
2029 finalize_command="$finalize_command $arg"
2032 oldlibs=
2033 # calculate the name of the file, without its directory
2034 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2035 libobjs_save="$libobjs"
2037 if test -n "$shlibpath_var"; then
2038 # get the directories listed in $shlibpath_var
2039 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2040 else
2041 shlib_search_path=
2043 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2044 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2046 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2047 if test "X$output_objdir" = "X$output"; then
2048 output_objdir="$objdir"
2049 else
2050 output_objdir="$output_objdir/$objdir"
2052 # Create the object directory.
2053 if test ! -d "$output_objdir"; then
2054 $show "$mkdir $output_objdir"
2055 $run $mkdir $output_objdir
2056 exit_status=$?
2057 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2058 exit $exit_status
2062 # Determine the type of output
2063 case $output in
2065 $echo "$modename: you must specify an output file" 1>&2
2066 $echo "$help" 1>&2
2067 exit $EXIT_FAILURE
2069 *.$libext) linkmode=oldlib ;;
2070 *.lo | *.$objext) linkmode=obj ;;
2071 *.la) linkmode=lib ;;
2072 *) linkmode=prog ;; # Anything else should be a program.
2073 esac
2075 case $host in
2076 *cygwin* | *mingw* | *pw32*)
2077 # don't eliminate duplications in $postdeps and $predeps
2078 duplicate_compiler_generated_deps=yes
2081 duplicate_compiler_generated_deps=$duplicate_deps
2083 esac
2084 specialdeplibs=
2086 libs=
2087 # Find all interdependent deplibs by searching for libraries
2088 # that are linked more than once (e.g. -la -lb -la)
2089 for deplib in $deplibs; do
2090 if test "X$duplicate_deps" = "Xyes" ; then
2091 case "$libs " in
2092 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2093 esac
2095 libs="$libs $deplib"
2096 done
2098 if test "$linkmode" = lib; then
2099 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2101 # Compute libraries that are listed more than once in $predeps
2102 # $postdeps and mark them as special (i.e., whose duplicates are
2103 # not to be eliminated).
2104 pre_post_deps=
2105 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2106 for pre_post_dep in $predeps $postdeps; do
2107 case "$pre_post_deps " in
2108 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2109 esac
2110 pre_post_deps="$pre_post_deps $pre_post_dep"
2111 done
2113 pre_post_deps=
2116 deplibs=
2117 newdependency_libs=
2118 newlib_search_path=
2119 need_relink=no # whether we're linking any uninstalled libtool libraries
2120 notinst_deplibs= # not-installed libtool libraries
2121 case $linkmode in
2122 lib)
2123 passes="conv link"
2124 for file in $dlfiles $dlprefiles; do
2125 case $file in
2126 *.la) ;;
2128 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2129 exit $EXIT_FAILURE
2131 esac
2132 done
2134 prog)
2135 compile_deplibs=
2136 finalize_deplibs=
2137 alldeplibs=no
2138 newdlfiles=
2139 newdlprefiles=
2140 passes="conv scan dlopen dlpreopen link"
2142 *) passes="conv"
2144 esac
2145 for pass in $passes; do
2146 if test "$linkmode,$pass" = "lib,link" ||
2147 test "$linkmode,$pass" = "prog,scan"; then
2148 libs="$deplibs"
2149 deplibs=
2151 if test "$linkmode" = prog; then
2152 case $pass in
2153 dlopen) libs="$dlfiles" ;;
2154 dlpreopen) libs="$dlprefiles" ;;
2155 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2156 esac
2158 if test "$pass" = dlopen; then
2159 # Collect dlpreopened libraries
2160 save_deplibs="$deplibs"
2161 deplibs=
2163 for deplib in $libs; do
2164 lib=
2165 found=no
2166 case $deplib in
2167 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2168 if test "$linkmode,$pass" = "prog,link"; then
2169 compile_deplibs="$deplib $compile_deplibs"
2170 finalize_deplibs="$deplib $finalize_deplibs"
2171 else
2172 compiler_flags="$compiler_flags $deplib"
2175 case $linkmode in
2176 lib)
2177 deplibs="$deplib $deplibs"
2178 test "$pass" = conv && continue
2179 newdependency_libs="$deplib $newdependency_libs"
2181 prog)
2182 if test "$pass" = conv; then
2183 deplibs="$deplib $deplibs"
2184 continue
2186 if test "$pass" = scan; then
2187 deplibs="$deplib $deplibs"
2188 else
2189 compile_deplibs="$deplib $compile_deplibs"
2190 finalize_deplibs="$deplib $finalize_deplibs"
2195 esac # linkmode
2197 continue
2199 -l*)
2200 if test "$linkmode" != lib && test "$linkmode" != prog; then
2201 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2202 continue
2204 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2205 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2206 for search_ext in .la $std_shrext .so .a; do
2207 # Search the libtool library
2208 lib="$searchdir/lib${name}${search_ext}"
2209 if test -f "$lib"; then
2210 if test "$search_ext" = ".la"; then
2211 found=yes
2212 else
2213 found=no
2215 break 2
2217 done
2218 done
2219 if test "$found" != yes; then
2220 # deplib doesn't seem to be a libtool library
2221 if test "$linkmode,$pass" = "prog,link"; then
2222 compile_deplibs="$deplib $compile_deplibs"
2223 finalize_deplibs="$deplib $finalize_deplibs"
2224 else
2225 deplibs="$deplib $deplibs"
2226 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2228 continue
2229 else # deplib is a libtool library
2230 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2231 # We need to do some special things here, and not later.
2232 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2233 case " $predeps $postdeps " in
2234 *" $deplib "*)
2235 if (${SED} -e '2q' $lib |
2236 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2237 library_names=
2238 old_library=
2239 case $lib in
2240 */* | *\\*) . $lib ;;
2241 *) . ./$lib ;;
2242 esac
2243 for l in $old_library $library_names; do
2244 ll="$l"
2245 done
2246 if test "X$ll" = "X$old_library" ; then # only static version available
2247 found=no
2248 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2249 test "X$ladir" = "X$lib" && ladir="."
2250 lib=$ladir/$old_library
2251 if test "$linkmode,$pass" = "prog,link"; then
2252 compile_deplibs="$deplib $compile_deplibs"
2253 finalize_deplibs="$deplib $finalize_deplibs"
2254 else
2255 deplibs="$deplib $deplibs"
2256 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2258 continue
2262 *) ;;
2263 esac
2266 ;; # -l
2267 -L*)
2268 case $linkmode in
2269 lib)
2270 deplibs="$deplib $deplibs"
2271 test "$pass" = conv && continue
2272 newdependency_libs="$deplib $newdependency_libs"
2273 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2275 prog)
2276 if test "$pass" = conv; then
2277 deplibs="$deplib $deplibs"
2278 continue
2280 if test "$pass" = scan; then
2281 deplibs="$deplib $deplibs"
2282 else
2283 compile_deplibs="$deplib $compile_deplibs"
2284 finalize_deplibs="$deplib $finalize_deplibs"
2286 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2289 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2291 esac # linkmode
2292 continue
2293 ;; # -L
2294 -R*)
2295 if test "$pass" = link; then
2296 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2297 # Make sure the xrpath contains only unique directories.
2298 case "$xrpath " in
2299 *" $dir "*) ;;
2300 *) xrpath="$xrpath $dir" ;;
2301 esac
2303 deplibs="$deplib $deplibs"
2304 continue
2306 *.la) lib="$deplib" ;;
2307 *.$libext)
2308 if test "$pass" = conv; then
2309 deplibs="$deplib $deplibs"
2310 continue
2312 case $linkmode in
2313 lib)
2314 valid_a_lib=no
2315 case $deplibs_check_method in
2316 match_pattern*)
2317 set dummy $deplibs_check_method
2318 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2319 if eval $echo \"$deplib\" 2>/dev/null \
2320 | $SED 10q \
2321 | $EGREP "$match_pattern_regex" > /dev/null; then
2322 valid_a_lib=yes
2325 pass_all)
2326 valid_a_lib=yes
2328 esac
2329 if test "$valid_a_lib" != yes; then
2330 $echo
2331 $echo "*** Warning: Trying to link with static lib archive $deplib."
2332 $echo "*** I have the capability to make that library automatically link in when"
2333 $echo "*** you link to this library. But I can only do this if you have a"
2334 $echo "*** shared version of the library, which you do not appear to have"
2335 $echo "*** because the file extensions .$libext of this argument makes me believe"
2336 $echo "*** that it is just a static archive that I should not used here."
2337 else
2338 $echo
2339 $echo "*** Warning: Linking the shared library $output against the"
2340 $echo "*** static library $deplib is not portable!"
2341 deplibs="$deplib $deplibs"
2343 continue
2345 prog)
2346 if test "$pass" != link; then
2347 deplibs="$deplib $deplibs"
2348 else
2349 compile_deplibs="$deplib $compile_deplibs"
2350 finalize_deplibs="$deplib $finalize_deplibs"
2352 continue
2354 esac # linkmode
2355 ;; # *.$libext
2356 *.lo | *.$objext)
2357 if test "$pass" = conv; then
2358 deplibs="$deplib $deplibs"
2359 elif test "$linkmode" = prog; then
2360 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2361 # If there is no dlopen support or we're linking statically,
2362 # we need to preload.
2363 newdlprefiles="$newdlprefiles $deplib"
2364 compile_deplibs="$deplib $compile_deplibs"
2365 finalize_deplibs="$deplib $finalize_deplibs"
2366 else
2367 newdlfiles="$newdlfiles $deplib"
2370 continue
2372 %DEPLIBS%)
2373 alldeplibs=yes
2374 continue
2376 esac # case $deplib
2377 if test "$found" = yes || test -f "$lib"; then :
2378 else
2379 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2380 exit $EXIT_FAILURE
2383 # Check to see that this really is a libtool archive.
2384 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2385 else
2386 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2387 exit $EXIT_FAILURE
2390 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2391 test "X$ladir" = "X$lib" && ladir="."
2393 dlname=
2394 dlopen=
2395 dlpreopen=
2396 libdir=
2397 library_names=
2398 old_library=
2399 # If the library was installed with an old release of libtool,
2400 # it will not redefine variables installed, or shouldnotlink
2401 installed=yes
2402 shouldnotlink=no
2403 avoidtemprpath=
2406 # Read the .la file
2407 case $lib in
2408 */* | *\\*) . $lib ;;
2409 *) . ./$lib ;;
2410 esac
2412 if test "$linkmode,$pass" = "lib,link" ||
2413 test "$linkmode,$pass" = "prog,scan" ||
2414 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2415 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2416 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2419 if test "$pass" = conv; then
2420 # Only check for convenience libraries
2421 deplibs="$lib $deplibs"
2422 if test -z "$libdir"; then
2423 if test -z "$old_library"; then
2424 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2425 exit $EXIT_FAILURE
2427 # It is a libtool convenience library, so add in its objects.
2428 convenience="$convenience $ladir/$objdir/$old_library"
2429 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2430 tmp_libs=
2431 for deplib in $dependency_libs; do
2432 deplibs="$deplib $deplibs"
2433 if test "X$duplicate_deps" = "Xyes" ; then
2434 case "$tmp_libs " in
2435 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2436 esac
2438 tmp_libs="$tmp_libs $deplib"
2439 done
2440 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2441 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2442 exit $EXIT_FAILURE
2444 continue
2445 fi # $pass = conv
2448 # Get the name of the library we link against.
2449 linklib=
2450 for l in $old_library $library_names; do
2451 linklib="$l"
2452 done
2453 if test -z "$linklib"; then
2454 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2455 exit $EXIT_FAILURE
2458 # This library was specified with -dlopen.
2459 if test "$pass" = dlopen; then
2460 if test -z "$libdir"; then
2461 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2462 exit $EXIT_FAILURE
2464 if test -z "$dlname" ||
2465 test "$dlopen_support" != yes ||
2466 test "$build_libtool_libs" = no; then
2467 # If there is no dlname, no dlopen support or we're linking
2468 # statically, we need to preload. We also need to preload any
2469 # dependent libraries so libltdl's deplib preloader doesn't
2470 # bomb out in the load deplibs phase.
2471 dlprefiles="$dlprefiles $lib $dependency_libs"
2472 else
2473 newdlfiles="$newdlfiles $lib"
2475 continue
2476 fi # $pass = dlopen
2478 # We need an absolute path.
2479 case $ladir in
2480 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2482 abs_ladir=`cd "$ladir" && pwd`
2483 if test -z "$abs_ladir"; then
2484 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2485 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2486 abs_ladir="$ladir"
2489 esac
2490 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2492 # Find the relevant object directory and library name.
2493 if test "X$installed" = Xyes; then
2494 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2495 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2496 dir="$ladir"
2497 absdir="$abs_ladir"
2498 libdir="$abs_ladir"
2499 else
2500 dir="$libdir"
2501 absdir="$libdir"
2503 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2504 else
2505 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2506 dir="$ladir"
2507 absdir="$abs_ladir"
2508 # Remove this search path later
2509 notinst_path="$notinst_path $abs_ladir"
2510 else
2511 dir="$ladir/$objdir"
2512 absdir="$abs_ladir/$objdir"
2513 # Remove this search path later
2514 notinst_path="$notinst_path $abs_ladir"
2516 fi # $installed = yes
2517 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2519 # This library was specified with -dlpreopen.
2520 if test "$pass" = dlpreopen; then
2521 if test -z "$libdir"; then
2522 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2523 exit $EXIT_FAILURE
2525 # Prefer using a static library (so that no silly _DYNAMIC symbols
2526 # are required to link).
2527 if test -n "$old_library"; then
2528 newdlprefiles="$newdlprefiles $dir/$old_library"
2529 # Otherwise, use the dlname, so that lt_dlopen finds it.
2530 elif test -n "$dlname"; then
2531 newdlprefiles="$newdlprefiles $dir/$dlname"
2532 else
2533 newdlprefiles="$newdlprefiles $dir/$linklib"
2535 fi # $pass = dlpreopen
2537 if test -z "$libdir"; then
2538 # Link the convenience library
2539 if test "$linkmode" = lib; then
2540 deplibs="$dir/$old_library $deplibs"
2541 elif test "$linkmode,$pass" = "prog,link"; then
2542 compile_deplibs="$dir/$old_library $compile_deplibs"
2543 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2544 else
2545 deplibs="$lib $deplibs" # used for prog,scan pass
2547 continue
2551 if test "$linkmode" = prog && test "$pass" != link; then
2552 newlib_search_path="$newlib_search_path $ladir"
2553 deplibs="$lib $deplibs"
2555 linkalldeplibs=no
2556 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2557 test "$build_libtool_libs" = no; then
2558 linkalldeplibs=yes
2561 tmp_libs=
2562 for deplib in $dependency_libs; do
2563 case $deplib in
2564 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2565 esac
2566 # Need to link against all dependency_libs?
2567 if test "$linkalldeplibs" = yes; then
2568 deplibs="$deplib $deplibs"
2569 else
2570 # Need to hardcode shared library paths
2571 # or/and link against static libraries
2572 newdependency_libs="$deplib $newdependency_libs"
2574 if test "X$duplicate_deps" = "Xyes" ; then
2575 case "$tmp_libs " in
2576 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2577 esac
2579 tmp_libs="$tmp_libs $deplib"
2580 done # for deplib
2581 continue
2582 fi # $linkmode = prog...
2584 if test "$linkmode,$pass" = "prog,link"; then
2585 if test -n "$library_names" &&
2586 { { test "$prefer_static_libs" = no ||
2587 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2588 test -z "$old_library"; }; then
2589 # We need to hardcode the library path
2590 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2591 # Make sure the rpath contains only unique directories.
2592 case "$temp_rpath " in
2593 *" $dir "*) ;;
2594 *" $absdir "*) ;;
2595 *) temp_rpath="$temp_rpath $absdir" ;;
2596 esac
2599 # Hardcode the library path.
2600 # Skip directories that are in the system default run-time
2601 # search path.
2602 case " $sys_lib_dlsearch_path " in
2603 *" $absdir "*) ;;
2605 case "$compile_rpath " in
2606 *" $absdir "*) ;;
2607 *) compile_rpath="$compile_rpath $absdir"
2608 esac
2610 esac
2611 case " $sys_lib_dlsearch_path " in
2612 *" $libdir "*) ;;
2614 case "$finalize_rpath " in
2615 *" $libdir "*) ;;
2616 *) finalize_rpath="$finalize_rpath $libdir"
2617 esac
2619 esac
2620 fi # $linkmode,$pass = prog,link...
2622 if test "$alldeplibs" = yes &&
2623 { test "$deplibs_check_method" = pass_all ||
2624 { test "$build_libtool_libs" = yes &&
2625 test -n "$library_names"; }; }; then
2626 # We only need to search for static libraries
2627 continue
2631 link_static=no # Whether the deplib will be linked statically
2632 use_static_libs=$prefer_static_libs
2633 if test "$use_static_libs" = built && test "$installed" = yes ; then
2634 use_static_libs=no
2636 if test -n "$library_names" &&
2637 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2638 if test "$installed" = no; then
2639 notinst_deplibs="$notinst_deplibs $lib"
2640 need_relink=yes
2642 # This is a shared library
2644 # Warn about portability, can't link against -module's on
2645 # some systems (darwin)
2646 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2647 $echo
2648 if test "$linkmode" = prog; then
2649 $echo "*** Warning: Linking the executable $output against the loadable module"
2650 else
2651 $echo "*** Warning: Linking the shared library $output against the loadable module"
2653 $echo "*** $linklib is not portable!"
2655 if test "$linkmode" = lib &&
2656 test "$hardcode_into_libs" = yes; then
2657 # Hardcode the library path.
2658 # Skip directories that are in the system default run-time
2659 # search path.
2660 case " $sys_lib_dlsearch_path " in
2661 *" $absdir "*) ;;
2663 case "$compile_rpath " in
2664 *" $absdir "*) ;;
2665 *) compile_rpath="$compile_rpath $absdir"
2666 esac
2668 esac
2669 case " $sys_lib_dlsearch_path " in
2670 *" $libdir "*) ;;
2672 case "$finalize_rpath " in
2673 *" $libdir "*) ;;
2674 *) finalize_rpath="$finalize_rpath $libdir"
2675 esac
2677 esac
2680 if test -n "$old_archive_from_expsyms_cmds"; then
2681 # figure out the soname
2682 set dummy $library_names
2683 realname="$2"
2684 shift; shift
2685 libname=`eval \\$echo \"$libname_spec\"`
2686 # use dlname if we got it. it's perfectly good, no?
2687 if test -n "$dlname"; then
2688 soname="$dlname"
2689 elif test -n "$soname_spec"; then
2690 # bleh windows
2691 case $host in
2692 *cygwin* | mingw*)
2693 major=`expr $current - $age`
2694 versuffix="-$major"
2696 esac
2697 eval soname=\"$soname_spec\"
2698 else
2699 soname="$realname"
2702 # Make a new name for the extract_expsyms_cmds to use
2703 soroot="$soname"
2704 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2705 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2707 # If the library has no export list, then create one now
2708 if test -f "$output_objdir/$soname-def"; then :
2709 else
2710 $show "extracting exported symbol list from \`$soname'"
2711 save_ifs="$IFS"; IFS='~'
2712 cmds=$extract_expsyms_cmds
2713 for cmd in $cmds; do
2714 IFS="$save_ifs"
2715 eval cmd=\"$cmd\"
2716 $show "$cmd"
2717 $run eval "$cmd" || exit $?
2718 done
2719 IFS="$save_ifs"
2722 # Create $newlib
2723 if test -f "$output_objdir/$newlib"; then :; else
2724 $show "generating import library for \`$soname'"
2725 save_ifs="$IFS"; IFS='~'
2726 cmds=$old_archive_from_expsyms_cmds
2727 for cmd in $cmds; do
2728 IFS="$save_ifs"
2729 eval cmd=\"$cmd\"
2730 $show "$cmd"
2731 $run eval "$cmd" || exit $?
2732 done
2733 IFS="$save_ifs"
2735 # make sure the library variables are pointing to the new library
2736 dir=$output_objdir
2737 linklib=$newlib
2738 fi # test -n "$old_archive_from_expsyms_cmds"
2740 if test "$linkmode" = prog || test "$mode" != relink; then
2741 add_shlibpath=
2742 add_dir=
2743 add=
2744 lib_linked=yes
2745 case $hardcode_action in
2746 immediate | unsupported)
2747 if test "$hardcode_direct" = no; then
2748 add="$dir/$linklib"
2749 case $host in
2750 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2751 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2752 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2753 *-*-unixware7*) add_dir="-L$dir" ;;
2754 *-*-darwin* )
2755 # if the lib is a module then we can not link against
2756 # it, someone is ignoring the new warnings I added
2757 if /usr/bin/file -L $add 2> /dev/null |
2758 $EGREP ": [^:]* bundle" >/dev/null ; then
2759 $echo "** Warning, lib $linklib is a module, not a shared library"
2760 if test -z "$old_library" ; then
2761 $echo
2762 $echo "** And there doesn't seem to be a static archive available"
2763 $echo "** The link will probably fail, sorry"
2764 else
2765 add="$dir/$old_library"
2768 esac
2769 elif test "$hardcode_minus_L" = no; then
2770 case $host in
2771 *-*-sunos*) add_shlibpath="$dir" ;;
2772 esac
2773 add_dir="-L$dir"
2774 add="-l$name"
2775 elif test "$hardcode_shlibpath_var" = no; then
2776 add_shlibpath="$dir"
2777 add="-l$name"
2778 else
2779 lib_linked=no
2782 relink)
2783 if test "$hardcode_direct" = yes; then
2784 add="$dir/$linklib"
2785 elif test "$hardcode_minus_L" = yes; then
2786 add_dir="-L$dir"
2787 # Try looking first in the location we're being installed to.
2788 if test -n "$inst_prefix_dir"; then
2789 case $libdir in
2790 [\\/]*)
2791 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2793 esac
2795 add="-l$name"
2796 elif test "$hardcode_shlibpath_var" = yes; then
2797 add_shlibpath="$dir"
2798 add="-l$name"
2799 else
2800 lib_linked=no
2803 *) lib_linked=no ;;
2804 esac
2806 if test "$lib_linked" != yes; then
2807 $echo "$modename: configuration error: unsupported hardcode properties"
2808 exit $EXIT_FAILURE
2811 if test -n "$add_shlibpath"; then
2812 case :$compile_shlibpath: in
2813 *":$add_shlibpath:"*) ;;
2814 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2815 esac
2817 if test "$linkmode" = prog; then
2818 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2819 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2820 else
2821 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2822 test -n "$add" && deplibs="$add $deplibs"
2823 if test "$hardcode_direct" != yes && \
2824 test "$hardcode_minus_L" != yes && \
2825 test "$hardcode_shlibpath_var" = yes; then
2826 case :$finalize_shlibpath: in
2827 *":$libdir:"*) ;;
2828 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2829 esac
2834 if test "$linkmode" = prog || test "$mode" = relink; then
2835 add_shlibpath=
2836 add_dir=
2837 add=
2838 # Finalize command for both is simple: just hardcode it.
2839 if test "$hardcode_direct" = yes; then
2840 add="$libdir/$linklib"
2841 elif test "$hardcode_minus_L" = yes; then
2842 add_dir="-L$libdir"
2843 add="-l$name"
2844 elif test "$hardcode_shlibpath_var" = yes; then
2845 case :$finalize_shlibpath: in
2846 *":$libdir:"*) ;;
2847 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2848 esac
2849 add="-l$name"
2850 elif test "$hardcode_automatic" = yes; then
2851 if test -n "$inst_prefix_dir" &&
2852 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2853 add="$inst_prefix_dir$libdir/$linklib"
2854 else
2855 add="$libdir/$linklib"
2857 else
2858 # We cannot seem to hardcode it, guess we'll fake it.
2859 add_dir="-L$libdir"
2860 # Try looking first in the location we're being installed to.
2861 if test -n "$inst_prefix_dir"; then
2862 case $libdir in
2863 [\\/]*)
2864 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2866 esac
2868 add="-l$name"
2871 if test "$linkmode" = prog; then
2872 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2873 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2874 else
2875 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2876 test -n "$add" && deplibs="$add $deplibs"
2879 elif test "$linkmode" = prog; then
2880 # Here we assume that one of hardcode_direct or hardcode_minus_L
2881 # is not unsupported. This is valid on all known static and
2882 # shared platforms.
2883 if test "$hardcode_direct" != unsupported; then
2884 test -n "$old_library" && linklib="$old_library"
2885 compile_deplibs="$dir/$linklib $compile_deplibs"
2886 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2887 else
2888 compile_deplibs="-l$name -L$dir $compile_deplibs"
2889 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2891 elif test "$build_libtool_libs" = yes; then
2892 # Not a shared library
2893 if test "$deplibs_check_method" != pass_all; then
2894 # We're trying link a shared library against a static one
2895 # but the system doesn't support it.
2897 # Just print a warning and add the library to dependency_libs so
2898 # that the program can be linked against the static library.
2899 $echo
2900 $echo "*** Warning: This system can not link to static lib archive $lib."
2901 $echo "*** I have the capability to make that library automatically link in when"
2902 $echo "*** you link to this library. But I can only do this if you have a"
2903 $echo "*** shared version of the library, which you do not appear to have."
2904 if test "$module" = yes; then
2905 $echo "*** But as you try to build a module library, libtool will still create "
2906 $echo "*** a static module, that should work as long as the dlopening application"
2907 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2908 if test -z "$global_symbol_pipe"; then
2909 $echo
2910 $echo "*** However, this would only work if libtool was able to extract symbol"
2911 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2912 $echo "*** not find such a program. So, this module is probably useless."
2913 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2915 if test "$build_old_libs" = no; then
2916 build_libtool_libs=module
2917 build_old_libs=yes
2918 else
2919 build_libtool_libs=no
2922 else
2923 deplibs="$dir/$old_library $deplibs"
2924 link_static=yes
2926 fi # link shared/static library?
2928 if test "$linkmode" = lib; then
2929 if test -n "$dependency_libs" &&
2930 { test "$hardcode_into_libs" != yes ||
2931 test "$build_old_libs" = yes ||
2932 test "$link_static" = yes; }; then
2933 # Extract -R from dependency_libs
2934 temp_deplibs=
2935 for libdir in $dependency_libs; do
2936 case $libdir in
2937 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2938 case " $xrpath " in
2939 *" $temp_xrpath "*) ;;
2940 *) xrpath="$xrpath $temp_xrpath";;
2941 esac;;
2942 *) temp_deplibs="$temp_deplibs $libdir";;
2943 esac
2944 done
2945 dependency_libs="$temp_deplibs"
2948 newlib_search_path="$newlib_search_path $absdir"
2949 # Link against this library
2950 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2951 # ... and its dependency_libs
2952 tmp_libs=
2953 for deplib in $dependency_libs; do
2954 newdependency_libs="$deplib $newdependency_libs"
2955 if test "X$duplicate_deps" = "Xyes" ; then
2956 case "$tmp_libs " in
2957 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2958 esac
2960 tmp_libs="$tmp_libs $deplib"
2961 done
2963 if test "$link_all_deplibs" != no; then
2964 # Add the search paths of all dependency libraries
2965 for deplib in $dependency_libs; do
2966 case $deplib in
2967 -L*) path="$deplib" ;;
2968 *.la)
2969 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2970 test "X$dir" = "X$deplib" && dir="."
2971 # We need an absolute path.
2972 case $dir in
2973 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2975 absdir=`cd "$dir" && pwd`
2976 if test -z "$absdir"; then
2977 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2978 absdir="$dir"
2981 esac
2982 if grep "^installed=no" $deplib > /dev/null; then
2983 path="$absdir/$objdir"
2984 else
2985 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2986 if test -z "$libdir"; then
2987 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2988 exit $EXIT_FAILURE
2990 if test "$absdir" != "$libdir"; then
2991 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2993 path="$absdir"
2995 depdepl=
2996 case $host in
2997 *-*-darwin*)
2998 # we do not want to link against static libs,
2999 # but need to link against shared
3000 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3001 if test -n "$deplibrary_names" ; then
3002 for tmp in $deplibrary_names ; do
3003 depdepl=$tmp
3004 done
3005 if test -f "$path/$depdepl" ; then
3006 depdepl="$path/$depdepl"
3008 # do not add paths which are already there
3009 case " $newlib_search_path " in
3010 *" $path "*) ;;
3011 *) newlib_search_path="$newlib_search_path $path";;
3012 esac
3014 path=""
3017 path="-L$path"
3019 esac
3021 -l*)
3022 case $host in
3023 *-*-darwin*)
3024 # Again, we only want to link against shared libraries
3025 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
3026 for tmp in $newlib_search_path ; do
3027 if test -f "$tmp/lib$tmp_libs.dylib" ; then
3028 eval depdepl="$tmp/lib$tmp_libs.dylib"
3029 break
3031 done
3032 path=""
3034 *) continue ;;
3035 esac
3037 *) continue ;;
3038 esac
3039 case " $deplibs " in
3040 *" $path "*) ;;
3041 *) deplibs="$path $deplibs" ;;
3042 esac
3043 case " $deplibs " in
3044 *" $depdepl "*) ;;
3045 *) deplibs="$depdepl $deplibs" ;;
3046 esac
3047 done
3048 fi # link_all_deplibs != no
3049 fi # linkmode = lib
3050 done # for deplib in $libs
3051 dependency_libs="$newdependency_libs"
3052 if test "$pass" = dlpreopen; then
3053 # Link the dlpreopened libraries before other libraries
3054 for deplib in $save_deplibs; do
3055 deplibs="$deplib $deplibs"
3056 done
3058 if test "$pass" != dlopen; then
3059 if test "$pass" != conv; then
3060 # Make sure lib_search_path contains only unique directories.
3061 lib_search_path=
3062 for dir in $newlib_search_path; do
3063 case "$lib_search_path " in
3064 *" $dir "*) ;;
3065 *) lib_search_path="$lib_search_path $dir" ;;
3066 esac
3067 done
3068 newlib_search_path=
3071 if test "$linkmode,$pass" != "prog,link"; then
3072 vars="deplibs"
3073 else
3074 vars="compile_deplibs finalize_deplibs"
3076 for var in $vars dependency_libs; do
3077 # Add libraries to $var in reverse order
3078 eval tmp_libs=\"\$$var\"
3079 new_libs=
3080 for deplib in $tmp_libs; do
3081 # FIXME: Pedantically, this is the right thing to do, so
3082 # that some nasty dependency loop isn't accidentally
3083 # broken:
3084 #new_libs="$deplib $new_libs"
3085 # Pragmatically, this seems to cause very few problems in
3086 # practice:
3087 case $deplib in
3088 -L*) new_libs="$deplib $new_libs" ;;
3089 -R*) ;;
3091 # And here is the reason: when a library appears more
3092 # than once as an explicit dependence of a library, or
3093 # is implicitly linked in more than once by the
3094 # compiler, it is considered special, and multiple
3095 # occurrences thereof are not removed. Compare this
3096 # with having the same library being listed as a
3097 # dependency of multiple other libraries: in this case,
3098 # we know (pedantically, we assume) the library does not
3099 # need to be listed more than once, so we keep only the
3100 # last copy. This is not always right, but it is rare
3101 # enough that we require users that really mean to play
3102 # such unportable linking tricks to link the library
3103 # using -Wl,-lname, so that libtool does not consider it
3104 # for duplicate removal.
3105 case " $specialdeplibs " in
3106 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3108 case " $new_libs " in
3109 *" $deplib "*) ;;
3110 *) new_libs="$deplib $new_libs" ;;
3111 esac
3113 esac
3115 esac
3116 done
3117 tmp_libs=
3118 for deplib in $new_libs; do
3119 case $deplib in
3120 -L*)
3121 case " $tmp_libs " in
3122 *" $deplib "*) ;;
3123 *) tmp_libs="$tmp_libs $deplib" ;;
3124 esac
3126 *) tmp_libs="$tmp_libs $deplib" ;;
3127 esac
3128 done
3129 eval $var=\"$tmp_libs\"
3130 done # for var
3132 # Last step: remove runtime libs from dependency_libs
3133 # (they stay in deplibs)
3134 tmp_libs=
3135 for i in $dependency_libs ; do
3136 case " $predeps $postdeps $compiler_lib_search_path " in
3137 *" $i "*)
3138 i=""
3140 esac
3141 if test -n "$i" ; then
3142 tmp_libs="$tmp_libs $i"
3144 done
3145 dependency_libs=$tmp_libs
3146 done # for pass
3147 if test "$linkmode" = prog; then
3148 dlfiles="$newdlfiles"
3149 dlprefiles="$newdlprefiles"
3152 case $linkmode in
3153 oldlib)
3154 if test -n "$deplibs"; then
3155 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3158 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3159 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3162 if test -n "$rpath"; then
3163 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3166 if test -n "$xrpath"; then
3167 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3170 if test -n "$vinfo"; then
3171 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3174 if test -n "$release"; then
3175 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3178 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3179 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3182 # Now set the variables for building old libraries.
3183 build_libtool_libs=no
3184 oldlibs="$output"
3185 objs="$objs$old_deplibs"
3188 lib)
3189 # Make sure we only generate libraries of the form `libNAME.la'.
3190 case $outputname in
3191 lib*)
3192 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3193 eval shared_ext=\"$shrext_cmds\"
3194 eval libname=\"$libname_spec\"
3197 if test "$module" = no; then
3198 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3199 $echo "$help" 1>&2
3200 exit $EXIT_FAILURE
3202 if test "$need_lib_prefix" != no; then
3203 # Add the "lib" prefix for modules if required
3204 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3205 eval shared_ext=\"$shrext_cmds\"
3206 eval libname=\"$libname_spec\"
3207 else
3208 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3211 esac
3213 if test -n "$objs"; then
3214 if test "$deplibs_check_method" != pass_all; then
3215 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3216 exit $EXIT_FAILURE
3217 else
3218 $echo
3219 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3220 $echo "*** objects $objs is not portable!"
3221 libobjs="$libobjs $objs"
3225 if test "$dlself" != no; then
3226 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3229 set dummy $rpath
3230 if test "$#" -gt 2; then
3231 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3233 install_libdir="$2"
3235 oldlibs=
3236 if test -z "$rpath"; then
3237 if test "$build_libtool_libs" = yes; then
3238 # Building a libtool convenience library.
3239 # Some compilers have problems with a `.al' extension so
3240 # convenience libraries should have the same extension an
3241 # archive normally would.
3242 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3243 build_libtool_libs=convenience
3244 build_old_libs=yes
3247 if test -n "$vinfo"; then
3248 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3251 if test -n "$release"; then
3252 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3254 else
3256 # Parse the version information argument.
3257 save_ifs="$IFS"; IFS=':'
3258 set dummy $vinfo 0 0 0
3259 IFS="$save_ifs"
3261 if test -n "$8"; then
3262 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3263 $echo "$help" 1>&2
3264 exit $EXIT_FAILURE
3267 # convert absolute version numbers to libtool ages
3268 # this retains compatibility with .la files and attempts
3269 # to make the code below a bit more comprehensible
3271 case $vinfo_number in
3272 yes)
3273 number_major="$2"
3274 number_minor="$3"
3275 number_revision="$4"
3277 # There are really only two kinds -- those that
3278 # use the current revision as the major version
3279 # and those that subtract age and use age as
3280 # a minor version. But, then there is irix
3281 # which has an extra 1 added just for fun
3283 case $version_type in
3284 darwin|linux|osf|windows|none)
3285 current=`expr $number_major + $number_minor`
3286 age="$number_minor"
3287 revision="$number_revision"
3289 freebsd-aout|freebsd-elf|sunos)
3290 current="$number_major"
3291 revision="$number_minor"
3292 age="0"
3294 irix|nonstopux)
3295 current=`expr $number_major + $number_minor`
3296 age="$number_minor"
3297 revision="$number_minor"
3298 lt_irix_increment=no
3300 esac
3303 current="$2"
3304 revision="$3"
3305 age="$4"
3307 esac
3309 # Check that each of the things are valid numbers.
3310 case $current in
3311 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]) ;;
3313 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3314 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3315 exit $EXIT_FAILURE
3317 esac
3319 case $revision in
3320 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]) ;;
3322 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3323 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3324 exit $EXIT_FAILURE
3326 esac
3328 case $age in
3329 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]) ;;
3331 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3332 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3333 exit $EXIT_FAILURE
3335 esac
3337 if test "$age" -gt "$current"; then
3338 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3339 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3340 exit $EXIT_FAILURE
3343 # Calculate the version variables.
3344 major=
3345 versuffix=
3346 verstring=
3347 case $version_type in
3348 none) ;;
3350 darwin)
3351 # Like Linux, but with the current version available in
3352 # verstring for coding it into the library header
3353 major=.`expr $current - $age`
3354 versuffix="$major.$age.$revision"
3355 # Darwin ld doesn't like 0 for these options...
3356 minor_current=`expr $current + 1`
3357 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3358 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
3361 freebsd-aout)
3362 major=".$current"
3363 versuffix=".$current.$revision";
3366 freebsd-elf)
3367 major=".$current"
3368 versuffix=".$current";
3371 irix | nonstopux)
3372 if test "X$lt_irix_increment" = "Xno"; then
3373 major=`expr $current - $age`
3374 else
3375 major=`expr $current - $age + 1`
3377 case $version_type in
3378 nonstopux) verstring_prefix=nonstopux ;;
3379 *) verstring_prefix=sgi ;;
3380 esac
3381 verstring="$verstring_prefix$major.$revision"
3383 # Add in all the interfaces that we are compatible with.
3384 loop=$revision
3385 while test "$loop" -ne 0; do
3386 iface=`expr $revision - $loop`
3387 loop=`expr $loop - 1`
3388 verstring="$verstring_prefix$major.$iface:$verstring"
3389 done
3391 # Before this point, $major must not contain `.'.
3392 major=.$major
3393 versuffix="$major.$revision"
3396 linux)
3397 major=.`expr $current - $age`
3398 versuffix="$major.$age.$revision"
3401 osf)
3402 major=.`expr $current - $age`
3403 versuffix=".$current.$age.$revision"
3404 verstring="$current.$age.$revision"
3406 # Add in all the interfaces that we are compatible with.
3407 loop=$age
3408 while test "$loop" -ne 0; do
3409 iface=`expr $current - $loop`
3410 loop=`expr $loop - 1`
3411 verstring="$verstring:${iface}.0"
3412 done
3414 # Make executables depend on our current version.
3415 verstring="$verstring:${current}.0"
3418 sunos)
3419 major=".$current"
3420 versuffix=".$current.$revision"
3423 windows)
3424 # Use '-' rather than '.', since we only want one
3425 # extension on DOS 8.3 filesystems.
3426 major=`expr $current - $age`
3427 versuffix="-$major"
3431 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3432 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3433 exit $EXIT_FAILURE
3435 esac
3437 # Clear the version info if we defaulted, and they specified a release.
3438 if test -z "$vinfo" && test -n "$release"; then
3439 major=
3440 case $version_type in
3441 darwin)
3442 # we can't check for "0.0" in archive_cmds due to quoting
3443 # problems, so we reset it completely
3444 verstring=
3447 verstring="0.0"
3449 esac
3450 if test "$need_version" = no; then
3451 versuffix=
3452 else
3453 versuffix=".0.0"
3457 # Remove version info from name if versioning should be avoided
3458 if test "$avoid_version" = yes && test "$need_version" = no; then
3459 major=
3460 versuffix=
3461 verstring=""
3464 # Check to see if the archive will have undefined symbols.
3465 if test "$allow_undefined" = yes; then
3466 if test "$allow_undefined_flag" = unsupported; then
3467 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3468 build_libtool_libs=no
3469 build_old_libs=yes
3471 else
3472 # Don't allow undefined symbols.
3473 allow_undefined_flag="$no_undefined_flag"
3477 if test "$mode" != relink; then
3478 # Remove our outputs, but don't remove object files since they
3479 # may have been created when compiling PIC objects.
3480 removelist=
3481 tempremovelist=`$echo "$output_objdir/*"`
3482 for p in $tempremovelist; do
3483 case $p in
3484 *.$objext)
3486 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3487 if test "X$precious_files_regex" != "X"; then
3488 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3489 then
3490 continue
3493 removelist="$removelist $p"
3495 *) ;;
3496 esac
3497 done
3498 if test -n "$removelist"; then
3499 $show "${rm}r $removelist"
3500 $run ${rm}r $removelist
3504 # Now set the variables for building old libraries.
3505 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3506 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3508 # Transform .lo files to .o files.
3509 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3512 # Eliminate all temporary directories.
3513 #for path in $notinst_path; do
3514 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3515 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3516 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3517 #done
3519 if test -n "$xrpath"; then
3520 # If the user specified any rpath flags, then add them.
3521 temp_xrpath=
3522 for libdir in $xrpath; do
3523 temp_xrpath="$temp_xrpath -R$libdir"
3524 case "$finalize_rpath " in
3525 *" $libdir "*) ;;
3526 *) finalize_rpath="$finalize_rpath $libdir" ;;
3527 esac
3528 done
3529 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3530 dependency_libs="$temp_xrpath $dependency_libs"
3534 # Make sure dlfiles contains only unique files that won't be dlpreopened
3535 old_dlfiles="$dlfiles"
3536 dlfiles=
3537 for lib in $old_dlfiles; do
3538 case " $dlprefiles $dlfiles " in
3539 *" $lib "*) ;;
3540 *) dlfiles="$dlfiles $lib" ;;
3541 esac
3542 done
3544 # Make sure dlprefiles contains only unique files
3545 old_dlprefiles="$dlprefiles"
3546 dlprefiles=
3547 for lib in $old_dlprefiles; do
3548 case "$dlprefiles " in
3549 *" $lib "*) ;;
3550 *) dlprefiles="$dlprefiles $lib" ;;
3551 esac
3552 done
3554 if test "$build_libtool_libs" = yes; then
3555 if test -n "$rpath"; then
3556 case $host in
3557 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3558 # these systems don't actually have a c library (as such)!
3560 *-*-rhapsody* | *-*-darwin1.[012])
3561 # Rhapsody C library is in the System framework
3562 deplibs="$deplibs -framework System"
3564 *-*-netbsd*)
3565 # Don't link with libc until the a.out ld.so is fixed.
3567 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3568 # Do not include libc due to us having libc/libc_r.
3570 *-*-sco3.2v5* | *-*-sco5v6*)
3571 # Causes problems with __ctype
3573 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3574 # Compiler inserts libc in the correct place for threads to work
3577 # Add libc to deplibs on all other systems if necessary.
3578 if test "$build_libtool_need_lc" = "yes"; then
3579 deplibs="$deplibs -lc"
3582 esac
3585 # Transform deplibs into only deplibs that can be linked in shared.
3586 name_save=$name
3587 libname_save=$libname
3588 release_save=$release
3589 versuffix_save=$versuffix
3590 major_save=$major
3591 # I'm not sure if I'm treating the release correctly. I think
3592 # release should show up in the -l (ie -lgmp5) so we don't want to
3593 # add it in twice. Is that correct?
3594 release=""
3595 versuffix=""
3596 major=""
3597 newdeplibs=
3598 droppeddeps=no
3599 case $deplibs_check_method in
3600 pass_all)
3601 # Don't check for shared/static. Everything works.
3602 # This might be a little naive. We might want to check
3603 # whether the library exists or not. But this is on
3604 # osf3 & osf4 and I'm not really sure... Just
3605 # implementing what was already the behavior.
3606 newdeplibs=$deplibs
3608 test_compile)
3609 # This code stresses the "libraries are programs" paradigm to its
3610 # limits. Maybe even breaks it. We compile a program, linking it
3611 # against the deplibs as a proxy for the library. Then we can check
3612 # whether they linked in statically or dynamically with ldd.
3613 $rm conftest.c
3614 cat > conftest.c <<EOF
3615 int main() { return 0; }
3617 $rm conftest
3618 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3619 ldd_output=`ldd conftest`
3620 for i in $deplibs; do
3621 name=`expr $i : '-l\(.*\)'`
3622 # If $name is empty we are operating on a -L argument.
3623 if test "$name" != "" && test "$name" != "0"; then
3624 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3625 case " $predeps $postdeps " in
3626 *" $i "*)
3627 newdeplibs="$newdeplibs $i"
3628 i=""
3630 esac
3632 if test -n "$i" ; then
3633 libname=`eval \\$echo \"$libname_spec\"`
3634 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3635 set dummy $deplib_matches
3636 deplib_match=$2
3637 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3638 newdeplibs="$newdeplibs $i"
3639 else
3640 droppeddeps=yes
3641 $echo
3642 $echo "*** Warning: dynamic linker does not accept needed library $i."
3643 $echo "*** I have the capability to make that library automatically link in when"
3644 $echo "*** you link to this library. But I can only do this if you have a"
3645 $echo "*** shared version of the library, which I believe you do not have"
3646 $echo "*** because a test_compile did reveal that the linker did not use it for"
3647 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3650 else
3651 newdeplibs="$newdeplibs $i"
3653 done
3654 else
3655 # Error occurred in the first compile. Let's try to salvage
3656 # the situation: Compile a separate program for each library.
3657 for i in $deplibs; do
3658 name=`expr $i : '-l\(.*\)'`
3659 # If $name is empty we are operating on a -L argument.
3660 if test "$name" != "" && test "$name" != "0"; then
3661 $rm conftest
3662 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3663 ldd_output=`ldd conftest`
3664 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3665 case " $predeps $postdeps " in
3666 *" $i "*)
3667 newdeplibs="$newdeplibs $i"
3668 i=""
3670 esac
3672 if test -n "$i" ; then
3673 libname=`eval \\$echo \"$libname_spec\"`
3674 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3675 set dummy $deplib_matches
3676 deplib_match=$2
3677 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3678 newdeplibs="$newdeplibs $i"
3679 else
3680 droppeddeps=yes
3681 $echo
3682 $echo "*** Warning: dynamic linker does not accept needed library $i."
3683 $echo "*** I have the capability to make that library automatically link in when"
3684 $echo "*** you link to this library. But I can only do this if you have a"
3685 $echo "*** shared version of the library, which you do not appear to have"
3686 $echo "*** because a test_compile did reveal that the linker did not use this one"
3687 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3690 else
3691 droppeddeps=yes
3692 $echo
3693 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3694 $echo "*** make it link in! You will probably need to install it or some"
3695 $echo "*** library that it depends on before this library will be fully"
3696 $echo "*** functional. Installing it before continuing would be even better."
3698 else
3699 newdeplibs="$newdeplibs $i"
3701 done
3704 file_magic*)
3705 set dummy $deplibs_check_method
3706 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3707 for a_deplib in $deplibs; do
3708 name=`expr $a_deplib : '-l\(.*\)'`
3709 # If $name is empty we are operating on a -L argument.
3710 if test "$name" != "" && test "$name" != "0"; then
3711 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3712 case " $predeps $postdeps " in
3713 *" $a_deplib "*)
3714 newdeplibs="$newdeplibs $a_deplib"
3715 a_deplib=""
3717 esac
3719 if test -n "$a_deplib" ; then
3720 libname=`eval \\$echo \"$libname_spec\"`
3721 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3722 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3723 for potent_lib in $potential_libs; do
3724 # Follow soft links.
3725 if ls -lLd "$potent_lib" 2>/dev/null \
3726 | grep " -> " >/dev/null; then
3727 continue
3729 # The statement above tries to avoid entering an
3730 # endless loop below, in case of cyclic links.
3731 # We might still enter an endless loop, since a link
3732 # loop can be closed while we follow links,
3733 # but so what?
3734 potlib="$potent_lib"
3735 while test -h "$potlib" 2>/dev/null; do
3736 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3737 case $potliblink in
3738 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3739 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3740 esac
3741 done
3742 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3743 | ${SED} 10q \
3744 | $EGREP "$file_magic_regex" > /dev/null; then
3745 newdeplibs="$newdeplibs $a_deplib"
3746 a_deplib=""
3747 break 2
3749 done
3750 done
3752 if test -n "$a_deplib" ; then
3753 droppeddeps=yes
3754 $echo
3755 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3756 $echo "*** I have the capability to make that library automatically link in when"
3757 $echo "*** you link to this library. But I can only do this if you have a"
3758 $echo "*** shared version of the library, which you do not appear to have"
3759 $echo "*** because I did check the linker path looking for a file starting"
3760 if test -z "$potlib" ; then
3761 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3762 else
3763 $echo "*** with $libname and none of the candidates passed a file format test"
3764 $echo "*** using a file magic. Last file checked: $potlib"
3767 else
3768 # Add a -L argument.
3769 newdeplibs="$newdeplibs $a_deplib"
3771 done # Gone through all deplibs.
3773 match_pattern*)
3774 set dummy $deplibs_check_method
3775 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3776 for a_deplib in $deplibs; do
3777 name=`expr $a_deplib : '-l\(.*\)'`
3778 # If $name is empty we are operating on a -L argument.
3779 if test -n "$name" && test "$name" != "0"; then
3780 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3781 case " $predeps $postdeps " in
3782 *" $a_deplib "*)
3783 newdeplibs="$newdeplibs $a_deplib"
3784 a_deplib=""
3786 esac
3788 if test -n "$a_deplib" ; then
3789 libname=`eval \\$echo \"$libname_spec\"`
3790 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3791 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3792 for potent_lib in $potential_libs; do
3793 potlib="$potent_lib" # see symlink-check above in file_magic test
3794 if eval $echo \"$potent_lib\" 2>/dev/null \
3795 | ${SED} 10q \
3796 | $EGREP "$match_pattern_regex" > /dev/null; then
3797 newdeplibs="$newdeplibs $a_deplib"
3798 a_deplib=""
3799 break 2
3801 done
3802 done
3804 if test -n "$a_deplib" ; then
3805 droppeddeps=yes
3806 $echo
3807 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3808 $echo "*** I have the capability to make that library automatically link in when"
3809 $echo "*** you link to this library. But I can only do this if you have a"
3810 $echo "*** shared version of the library, which you do not appear to have"
3811 $echo "*** because I did check the linker path looking for a file starting"
3812 if test -z "$potlib" ; then
3813 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3814 else
3815 $echo "*** with $libname and none of the candidates passed a file format test"
3816 $echo "*** using a regex pattern. Last file checked: $potlib"
3819 else
3820 # Add a -L argument.
3821 newdeplibs="$newdeplibs $a_deplib"
3823 done # Gone through all deplibs.
3825 none | unknown | *)
3826 newdeplibs=""
3827 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3828 -e 's/ -[LR][^ ]*//g'`
3829 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3830 for i in $predeps $postdeps ; do
3831 # can't use Xsed below, because $i might contain '/'
3832 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3833 done
3835 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3836 | grep . >/dev/null; then
3837 $echo
3838 if test "X$deplibs_check_method" = "Xnone"; then
3839 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3840 else
3841 $echo "*** Warning: inter-library dependencies are not known to be supported."
3843 $echo "*** All declared inter-library dependencies are being dropped."
3844 droppeddeps=yes
3847 esac
3848 versuffix=$versuffix_save
3849 major=$major_save
3850 release=$release_save
3851 libname=$libname_save
3852 name=$name_save
3854 case $host in
3855 *-*-rhapsody* | *-*-darwin1.[012])
3856 # On Rhapsody replace the C library is the System framework
3857 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3859 esac
3861 if test "$droppeddeps" = yes; then
3862 if test "$module" = yes; then
3863 $echo
3864 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3865 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3866 $echo "*** a static module, that should work as long as the dlopening"
3867 $echo "*** application is linked with the -dlopen flag."
3868 if test -z "$global_symbol_pipe"; then
3869 $echo
3870 $echo "*** However, this would only work if libtool was able to extract symbol"
3871 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3872 $echo "*** not find such a program. So, this module is probably useless."
3873 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3875 if test "$build_old_libs" = no; then
3876 oldlibs="$output_objdir/$libname.$libext"
3877 build_libtool_libs=module
3878 build_old_libs=yes
3879 else
3880 build_libtool_libs=no
3882 else
3883 $echo "*** The inter-library dependencies that have been dropped here will be"
3884 $echo "*** automatically added whenever a program is linked with this library"
3885 $echo "*** or is declared to -dlopen it."
3887 if test "$allow_undefined" = no; then
3888 $echo
3889 $echo "*** Since this library must not contain undefined symbols,"
3890 $echo "*** because either the platform does not support them or"
3891 $echo "*** it was explicitly requested with -no-undefined,"
3892 $echo "*** libtool will only create a static version of it."
3893 if test "$build_old_libs" = no; then
3894 oldlibs="$output_objdir/$libname.$libext"
3895 build_libtool_libs=module
3896 build_old_libs=yes
3897 else
3898 build_libtool_libs=no
3903 # Done checking deplibs!
3904 deplibs=$newdeplibs
3908 # move library search paths that coincide with paths to not yet
3909 # installed libraries to the beginning of the library search list
3910 new_libs=
3911 for path in $notinst_path; do
3912 case " $new_libs " in
3913 *" -L$path/$objdir "*) ;;
3915 case " $deplibs " in
3916 *" -L$path/$objdir "*)
3917 new_libs="$new_libs -L$path/$objdir" ;;
3918 esac
3920 esac
3921 done
3922 for deplib in $deplibs; do
3923 case $deplib in
3924 -L*)
3925 case " $new_libs " in
3926 *" $deplib "*) ;;
3927 *) new_libs="$new_libs $deplib" ;;
3928 esac
3930 *) new_libs="$new_libs $deplib" ;;
3931 esac
3932 done
3933 deplibs="$new_libs"
3936 # All the library-specific variables (install_libdir is set above).
3937 library_names=
3938 old_library=
3939 dlname=
3941 # Test again, we may have decided not to build it any more
3942 if test "$build_libtool_libs" = yes; then
3943 if test "$hardcode_into_libs" = yes; then
3944 # Hardcode the library paths
3945 hardcode_libdirs=
3946 dep_rpath=
3947 rpath="$finalize_rpath"
3948 test "$mode" != relink && rpath="$compile_rpath$rpath"
3949 for libdir in $rpath; do
3950 if test -n "$hardcode_libdir_flag_spec"; then
3951 if test -n "$hardcode_libdir_separator"; then
3952 if test -z "$hardcode_libdirs"; then
3953 hardcode_libdirs="$libdir"
3954 else
3955 # Just accumulate the unique libdirs.
3956 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3957 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3960 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3962 esac
3964 else
3965 eval flag=\"$hardcode_libdir_flag_spec\"
3966 dep_rpath="$dep_rpath $flag"
3968 elif test -n "$runpath_var"; then
3969 case "$perm_rpath " in
3970 *" $libdir "*) ;;
3971 *) perm_rpath="$perm_rpath $libdir" ;;
3972 esac
3974 done
3975 # Substitute the hardcoded libdirs into the rpath.
3976 if test -n "$hardcode_libdir_separator" &&
3977 test -n "$hardcode_libdirs"; then
3978 libdir="$hardcode_libdirs"
3979 if test -n "$hardcode_libdir_flag_spec_ld"; then
3980 case $archive_cmds in
3981 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
3982 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
3983 esac
3984 else
3985 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3988 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3989 # We should set the runpath_var.
3990 rpath=
3991 for dir in $perm_rpath; do
3992 rpath="$rpath$dir:"
3993 done
3994 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3996 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3999 shlibpath="$finalize_shlibpath"
4000 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4001 if test -n "$shlibpath"; then
4002 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4005 # Get the real and link names of the library.
4006 eval shared_ext=\"$shrext_cmds\"
4007 eval library_names=\"$library_names_spec\"
4008 set dummy $library_names
4009 realname="$2"
4010 shift; shift
4012 if test -n "$soname_spec"; then
4013 eval soname=\"$soname_spec\"
4014 else
4015 soname="$realname"
4017 if test -z "$dlname"; then
4018 dlname=$soname
4021 lib="$output_objdir/$realname"
4022 linknames=
4023 for link
4025 linknames="$linknames $link"
4026 done
4028 # Use standard objects if they are pic
4029 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4031 # Prepare the list of exported symbols
4032 if test -z "$export_symbols"; then
4033 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4034 $show "generating symbol list for \`$libname.la'"
4035 export_symbols="$output_objdir/$libname.exp"
4036 $run $rm $export_symbols
4037 cmds=$export_symbols_cmds
4038 save_ifs="$IFS"; IFS='~'
4039 for cmd in $cmds; do
4040 IFS="$save_ifs"
4041 eval cmd=\"$cmd\"
4042 if len=`expr "X$cmd" : ".*"` &&
4043 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4044 $show "$cmd"
4045 $run eval "$cmd" || exit $?
4046 skipped_export=false
4047 else
4048 # The command line is too long to execute in one step.
4049 $show "using reloadable object file for export list..."
4050 skipped_export=:
4051 # Break out early, otherwise skipped_export may be
4052 # set to false by a later but shorter cmd.
4053 break
4055 done
4056 IFS="$save_ifs"
4057 if test -n "$export_symbols_regex"; then
4058 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
4059 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
4060 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
4061 $run eval '$mv "${export_symbols}T" "$export_symbols"'
4066 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4067 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
4070 tmp_deplibs=
4071 for test_deplib in $deplibs; do
4072 case " $convenience " in
4073 *" $test_deplib "*) ;;
4075 tmp_deplibs="$tmp_deplibs $test_deplib"
4077 esac
4078 done
4079 deplibs="$tmp_deplibs"
4081 if test -n "$convenience"; then
4082 if test -n "$whole_archive_flag_spec"; then
4083 save_libobjs=$libobjs
4084 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4085 else
4086 gentop="$output_objdir/${outputname}x"
4087 generated="$generated $gentop"
4089 func_extract_archives $gentop $convenience
4090 libobjs="$libobjs $func_extract_archives_result"
4094 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
4095 eval flag=\"$thread_safe_flag_spec\"
4096 linker_flags="$linker_flags $flag"
4099 # Make a backup of the uninstalled library when relinking
4100 if test "$mode" = relink; then
4101 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4104 # Do each of the archive commands.
4105 if test "$module" = yes && test -n "$module_cmds" ; then
4106 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4107 eval test_cmds=\"$module_expsym_cmds\"
4108 cmds=$module_expsym_cmds
4109 else
4110 eval test_cmds=\"$module_cmds\"
4111 cmds=$module_cmds
4113 else
4114 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4115 eval test_cmds=\"$archive_expsym_cmds\"
4116 cmds=$archive_expsym_cmds
4117 else
4118 eval test_cmds=\"$archive_cmds\"
4119 cmds=$archive_cmds
4123 if test "X$skipped_export" != "X:" &&
4124 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4125 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4127 else
4128 # The command line is too long to link in one step, link piecewise.
4129 $echo "creating reloadable object files..."
4131 # Save the value of $output and $libobjs because we want to
4132 # use them later. If we have whole_archive_flag_spec, we
4133 # want to use save_libobjs as it was before
4134 # whole_archive_flag_spec was expanded, because we can't
4135 # assume the linker understands whole_archive_flag_spec.
4136 # This may have to be revisited, in case too many
4137 # convenience libraries get linked in and end up exceeding
4138 # the spec.
4139 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4140 save_libobjs=$libobjs
4142 save_output=$output
4143 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4145 # Clear the reloadable object creation command queue and
4146 # initialize k to one.
4147 test_cmds=
4148 concat_cmds=
4149 objlist=
4150 delfiles=
4151 last_robj=
4153 output=$output_objdir/$output_la-${k}.$objext
4154 # Loop over the list of objects to be linked.
4155 for obj in $save_libobjs
4157 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4158 if test "X$objlist" = X ||
4159 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4160 test "$len" -le "$max_cmd_len"; }; then
4161 objlist="$objlist $obj"
4162 else
4163 # The command $test_cmds is almost too long, add a
4164 # command to the queue.
4165 if test "$k" -eq 1 ; then
4166 # The first file doesn't have a previous command to add.
4167 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4168 else
4169 # All subsequent reloadable object files will link in
4170 # the last one created.
4171 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4173 last_robj=$output_objdir/$output_la-${k}.$objext
4174 k=`expr $k + 1`
4175 output=$output_objdir/$output_la-${k}.$objext
4176 objlist=$obj
4177 len=1
4179 done
4180 # Handle the remaining objects by creating one last
4181 # reloadable object file. All subsequent reloadable object
4182 # files will link in the last one created.
4183 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4184 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4186 if ${skipped_export-false}; then
4187 $show "generating symbol list for \`$libname.la'"
4188 export_symbols="$output_objdir/$libname.exp"
4189 $run $rm $export_symbols
4190 libobjs=$output
4191 # Append the command to create the export file.
4192 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4195 # Set up a command to remove the reloadable object files
4196 # after they are used.
4198 while test "$i" -lt "$k"
4200 i=`expr $i + 1`
4201 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4202 done
4204 $echo "creating a temporary reloadable object file: $output"
4206 # Loop through the commands generated above and execute them.
4207 save_ifs="$IFS"; IFS='~'
4208 for cmd in $concat_cmds; do
4209 IFS="$save_ifs"
4210 $show "$cmd"
4211 $run eval "$cmd" || exit $?
4212 done
4213 IFS="$save_ifs"
4215 libobjs=$output
4216 # Restore the value of output.
4217 output=$save_output
4219 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4220 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4222 # Expand the library linking commands again to reset the
4223 # value of $libobjs for piecewise linking.
4225 # Do each of the archive commands.
4226 if test "$module" = yes && test -n "$module_cmds" ; then
4227 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4228 cmds=$module_expsym_cmds
4229 else
4230 cmds=$module_cmds
4232 else
4233 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4234 cmds=$archive_expsym_cmds
4235 else
4236 cmds=$archive_cmds
4240 # Append the command to remove the reloadable object files
4241 # to the just-reset $cmds.
4242 eval cmds=\"\$cmds~\$rm $delfiles\"
4244 save_ifs="$IFS"; IFS='~'
4245 for cmd in $cmds; do
4246 IFS="$save_ifs"
4247 eval cmd=\"$cmd\"
4248 $show "$cmd"
4249 $run eval "$cmd" || {
4250 lt_exit=$?
4252 # Restore the uninstalled library and exit
4253 if test "$mode" = relink; then
4254 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4257 exit $lt_exit
4259 done
4260 IFS="$save_ifs"
4262 # Restore the uninstalled library and exit
4263 if test "$mode" = relink; then
4264 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4266 if test -n "$convenience"; then
4267 if test -z "$whole_archive_flag_spec"; then
4268 $show "${rm}r $gentop"
4269 $run ${rm}r "$gentop"
4273 exit $EXIT_SUCCESS
4276 # Create links to the real library.
4277 for linkname in $linknames; do
4278 if test "$realname" != "$linkname"; then
4279 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4280 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4282 done
4284 # If -module or -export-dynamic was specified, set the dlname.
4285 if test "$module" = yes || test "$export_dynamic" = yes; then
4286 # On all known operating systems, these are identical.
4287 dlname="$soname"
4292 obj)
4293 if test -n "$deplibs"; then
4294 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4297 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4298 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4301 if test -n "$rpath"; then
4302 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4305 if test -n "$xrpath"; then
4306 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4309 if test -n "$vinfo"; then
4310 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4313 if test -n "$release"; then
4314 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4317 case $output in
4318 *.lo)
4319 if test -n "$objs$old_deplibs"; then
4320 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4321 exit $EXIT_FAILURE
4323 libobj="$output"
4324 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4327 libobj=
4328 obj="$output"
4330 esac
4332 # Delete the old objects.
4333 $run $rm $obj $libobj
4335 # Objects from convenience libraries. This assumes
4336 # single-version convenience libraries. Whenever we create
4337 # different ones for PIC/non-PIC, this we'll have to duplicate
4338 # the extraction.
4339 reload_conv_objs=
4340 gentop=
4341 # reload_cmds runs $LD directly, so let us get rid of
4342 # -Wl from whole_archive_flag_spec and hope we can get by with
4343 # turning comma into space..
4346 if test -n "$convenience"; then
4347 if test -n "$whole_archive_flag_spec"; then
4348 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
4349 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
4350 else
4351 gentop="$output_objdir/${obj}x"
4352 generated="$generated $gentop"
4354 func_extract_archives $gentop $convenience
4355 reload_conv_objs="$reload_objs $func_extract_archives_result"
4359 # Create the old-style object.
4360 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
4362 output="$obj"
4363 cmds=$reload_cmds
4364 save_ifs="$IFS"; IFS='~'
4365 for cmd in $cmds; do
4366 IFS="$save_ifs"
4367 eval cmd=\"$cmd\"
4368 $show "$cmd"
4369 $run eval "$cmd" || exit $?
4370 done
4371 IFS="$save_ifs"
4373 # Exit if we aren't doing a library object file.
4374 if test -z "$libobj"; then
4375 if test -n "$gentop"; then
4376 $show "${rm}r $gentop"
4377 $run ${rm}r $gentop
4380 exit $EXIT_SUCCESS
4383 if test "$build_libtool_libs" != yes; then
4384 if test -n "$gentop"; then
4385 $show "${rm}r $gentop"
4386 $run ${rm}r $gentop
4389 # Create an invalid libtool object if no PIC, so that we don't
4390 # accidentally link it into a program.
4391 # $show "echo timestamp > $libobj"
4392 # $run eval "echo timestamp > $libobj" || exit $?
4393 exit $EXIT_SUCCESS
4396 if test -n "$pic_flag" || test "$pic_mode" != default; then
4397 # Only do commands if we really have different PIC objects.
4398 reload_objs="$libobjs $reload_conv_objs"
4399 output="$libobj"
4400 cmds=$reload_cmds
4401 save_ifs="$IFS"; IFS='~'
4402 for cmd in $cmds; do
4403 IFS="$save_ifs"
4404 eval cmd=\"$cmd\"
4405 $show "$cmd"
4406 $run eval "$cmd" || exit $?
4407 done
4408 IFS="$save_ifs"
4411 if test -n "$gentop"; then
4412 $show "${rm}r $gentop"
4413 $run ${rm}r $gentop
4416 exit $EXIT_SUCCESS
4419 prog)
4420 case $host in
4421 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4422 esac
4423 if test -n "$vinfo"; then
4424 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4427 if test -n "$release"; then
4428 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4431 if test "$preload" = yes; then
4432 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4433 test "$dlopen_self_static" = unknown; then
4434 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4438 case $host in
4439 *-*-rhapsody* | *-*-darwin1.[012])
4440 # On Rhapsody replace the C library is the System framework
4441 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4442 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4444 esac
4446 case $host in
4447 *darwin*)
4448 # Don't allow lazy linking, it breaks C++ global constructors
4449 if test "$tagname" = CXX ; then
4450 compile_command="$compile_command ${wl}-bind_at_load"
4451 finalize_command="$finalize_command ${wl}-bind_at_load"
4454 esac
4457 # move library search paths that coincide with paths to not yet
4458 # installed libraries to the beginning of the library search list
4459 new_libs=
4460 for path in $notinst_path; do
4461 case " $new_libs " in
4462 *" -L$path/$objdir "*) ;;
4464 case " $compile_deplibs " in
4465 *" -L$path/$objdir "*)
4466 new_libs="$new_libs -L$path/$objdir" ;;
4467 esac
4469 esac
4470 done
4471 for deplib in $compile_deplibs; do
4472 case $deplib in
4473 -L*)
4474 case " $new_libs " in
4475 *" $deplib "*) ;;
4476 *) new_libs="$new_libs $deplib" ;;
4477 esac
4479 *) new_libs="$new_libs $deplib" ;;
4480 esac
4481 done
4482 compile_deplibs="$new_libs"
4485 compile_command="$compile_command $compile_deplibs"
4486 finalize_command="$finalize_command $finalize_deplibs"
4488 if test -n "$rpath$xrpath"; then
4489 # If the user specified any rpath flags, then add them.
4490 for libdir in $rpath $xrpath; do
4491 # This is the magic to use -rpath.
4492 case "$finalize_rpath " in
4493 *" $libdir "*) ;;
4494 *) finalize_rpath="$finalize_rpath $libdir" ;;
4495 esac
4496 done
4499 # Now hardcode the library paths
4500 rpath=
4501 hardcode_libdirs=
4502 for libdir in $compile_rpath $finalize_rpath; do
4503 if test -n "$hardcode_libdir_flag_spec"; then
4504 if test -n "$hardcode_libdir_separator"; then
4505 if test -z "$hardcode_libdirs"; then
4506 hardcode_libdirs="$libdir"
4507 else
4508 # Just accumulate the unique libdirs.
4509 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4510 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4513 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4515 esac
4517 else
4518 eval flag=\"$hardcode_libdir_flag_spec\"
4519 rpath="$rpath $flag"
4521 elif test -n "$runpath_var"; then
4522 case "$perm_rpath " in
4523 *" $libdir "*) ;;
4524 *) perm_rpath="$perm_rpath $libdir" ;;
4525 esac
4527 case $host in
4528 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4529 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4530 case :$dllsearchpath: in
4531 *":$libdir:"*) ;;
4532 *) dllsearchpath="$dllsearchpath:$libdir";;
4533 esac
4534 case :$dllsearchpath: in
4535 *":$testbindir:"*) ;;
4536 *) dllsearchpath="$dllsearchpath:$testbindir";;
4537 esac
4539 esac
4540 done
4541 # Substitute the hardcoded libdirs into the rpath.
4542 if test -n "$hardcode_libdir_separator" &&
4543 test -n "$hardcode_libdirs"; then
4544 libdir="$hardcode_libdirs"
4545 eval rpath=\" $hardcode_libdir_flag_spec\"
4547 compile_rpath="$rpath"
4549 rpath=
4550 hardcode_libdirs=
4551 for libdir in $finalize_rpath; do
4552 if test -n "$hardcode_libdir_flag_spec"; then
4553 if test -n "$hardcode_libdir_separator"; then
4554 if test -z "$hardcode_libdirs"; then
4555 hardcode_libdirs="$libdir"
4556 else
4557 # Just accumulate the unique libdirs.
4558 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4559 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4562 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4564 esac
4566 else
4567 eval flag=\"$hardcode_libdir_flag_spec\"
4568 rpath="$rpath $flag"
4570 elif test -n "$runpath_var"; then
4571 case "$finalize_perm_rpath " in
4572 *" $libdir "*) ;;
4573 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4574 esac
4576 done
4577 # Substitute the hardcoded libdirs into the rpath.
4578 if test -n "$hardcode_libdir_separator" &&
4579 test -n "$hardcode_libdirs"; then
4580 libdir="$hardcode_libdirs"
4581 eval rpath=\" $hardcode_libdir_flag_spec\"
4583 finalize_rpath="$rpath"
4585 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4586 # Transform all the library objects into standard objects.
4587 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4588 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4591 dlsyms=
4592 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4593 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4594 dlsyms="${outputname}S.c"
4595 else
4596 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4600 if test -n "$dlsyms"; then
4601 case $dlsyms in
4602 "") ;;
4603 *.c)
4604 # Discover the nlist of each of the dlfiles.
4605 nlist="$output_objdir/${outputname}.nm"
4607 $show "$rm $nlist ${nlist}S ${nlist}T"
4608 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4610 # Parse the name list into a source file.
4611 $show "creating $output_objdir/$dlsyms"
4613 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4614 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4615 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4617 #ifdef __cplusplus
4618 extern \"C\" {
4619 #endif
4621 /* Prevent the only kind of declaration conflicts we can make. */
4622 #define lt_preloaded_symbols some_other_symbol
4624 /* External symbol declarations for the compiler. */\
4627 if test "$dlself" = yes; then
4628 $show "generating symbol list for \`$output'"
4630 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4632 # Add our own program objects to the symbol list.
4633 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4634 for arg in $progfiles; do
4635 $show "extracting global C symbols from \`$arg'"
4636 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4637 done
4639 if test -n "$exclude_expsyms"; then
4640 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4641 $run eval '$mv "$nlist"T "$nlist"'
4644 if test -n "$export_symbols_regex"; then
4645 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4646 $run eval '$mv "$nlist"T "$nlist"'
4649 # Prepare the list of exported symbols
4650 if test -z "$export_symbols"; then
4651 export_symbols="$output_objdir/$outputname.exp"
4652 $run $rm $export_symbols
4653 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4654 case $host in
4655 *cygwin* | *mingw* )
4656 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4657 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4659 esac
4660 else
4661 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4662 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4663 $run eval 'mv "$nlist"T "$nlist"'
4664 case $host in
4665 *cygwin* | *mingw* )
4666 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4667 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4669 esac
4673 for arg in $dlprefiles; do
4674 $show "extracting global C symbols from \`$arg'"
4675 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4676 $run eval '$echo ": $name " >> "$nlist"'
4677 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4678 done
4680 if test -z "$run"; then
4681 # Make sure we have at least an empty file.
4682 test -f "$nlist" || : > "$nlist"
4684 if test -n "$exclude_expsyms"; then
4685 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4686 $mv "$nlist"T "$nlist"
4689 # Try sorting and uniquifying the output.
4690 if grep -v "^: " < "$nlist" |
4691 if sort -k 3 </dev/null >/dev/null 2>&1; then
4692 sort -k 3
4693 else
4694 sort +2
4695 fi |
4696 uniq > "$nlist"S; then
4698 else
4699 grep -v "^: " < "$nlist" > "$nlist"S
4702 if test -f "$nlist"S; then
4703 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4704 else
4705 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4708 $echo >> "$output_objdir/$dlsyms" "\
4710 #undef lt_preloaded_symbols
4712 #if defined (__STDC__) && __STDC__
4713 # define lt_ptr void *
4714 #else
4715 # define lt_ptr char *
4716 # define const
4717 #endif
4719 /* The mapping between symbol names and symbols. */
4722 case $host in
4723 *cygwin* | *mingw* )
4724 $echo >> "$output_objdir/$dlsyms" "\
4725 /* DATA imports from DLLs on WIN32 can't be const, because
4726 runtime relocations are performed -- see ld's documentation
4727 on pseudo-relocs */
4728 struct {
4732 $echo >> "$output_objdir/$dlsyms" "\
4733 const struct {
4736 esac
4739 $echo >> "$output_objdir/$dlsyms" "\
4740 const char *name;
4741 lt_ptr address;
4743 lt_preloaded_symbols[] =
4747 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4749 $echo >> "$output_objdir/$dlsyms" "\
4750 {0, (lt_ptr) 0}
4753 /* This works around a problem in FreeBSD linker */
4754 #ifdef FREEBSD_WORKAROUND
4755 static const void *lt_preloaded_setup() {
4756 return lt_preloaded_symbols;
4758 #endif
4760 #ifdef __cplusplus
4762 #endif\
4766 pic_flag_for_symtable=
4767 case $host in
4768 # compiling the symbol table file with pic_flag works around
4769 # a FreeBSD bug that causes programs to crash when -lm is
4770 # linked before any other PIC object. But we must not use
4771 # pic_flag when linking with -static. The problem exists in
4772 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4773 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4774 case "$compile_command " in
4775 *" -static "*) ;;
4776 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4777 esac;;
4778 *-*-hpux*)
4779 case "$compile_command " in
4780 *" -static "*) ;;
4781 *) pic_flag_for_symtable=" $pic_flag";;
4782 esac
4783 esac
4785 # Now compile the dynamic symbol file.
4786 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4787 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4789 # Clean up the generated files.
4790 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4791 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4793 # Transform the symbol file into the correct name.
4794 case $host in
4795 *cygwin* | *mingw* )
4796 if test -f "$output_objdir/${outputname}.def" ; then
4797 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4798 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
4799 else
4800 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4801 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4805 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4806 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
4808 esac
4810 *-*-freebsd*)
4811 # FreeBSD doesn't need this...
4814 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4815 exit $EXIT_FAILURE
4817 esac
4818 else
4819 # We keep going just in case the user didn't refer to
4820 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4821 # really was required.
4823 # Nullify the symbol file.
4824 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4825 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
4828 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4829 # Replace the output file specification.
4830 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
4831 link_command="$compile_command$compile_rpath"
4833 # We have no uninstalled library dependencies, so finalize right now.
4834 $show "$link_command"
4835 $run eval "$link_command"
4836 exit_status=$?
4838 # Delete the generated files.
4839 if test -n "$dlsyms"; then
4840 $show "$rm $output_objdir/${outputname}S.${objext}"
4841 $run $rm "$output_objdir/${outputname}S.${objext}"
4844 exit $exit_status
4847 if test -n "$shlibpath_var"; then
4848 # We should set the shlibpath_var
4849 rpath=
4850 for dir in $temp_rpath; do
4851 case $dir in
4852 [\\/]* | [A-Za-z]:[\\/]*)
4853 # Absolute path.
4854 rpath="$rpath$dir:"
4857 # Relative path: add a thisdir entry.
4858 rpath="$rpath\$thisdir/$dir:"
4860 esac
4861 done
4862 temp_rpath="$rpath"
4865 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4866 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4868 if test -n "$finalize_shlibpath"; then
4869 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4872 compile_var=
4873 finalize_var=
4874 if test -n "$runpath_var"; then
4875 if test -n "$perm_rpath"; then
4876 # We should set the runpath_var.
4877 rpath=
4878 for dir in $perm_rpath; do
4879 rpath="$rpath$dir:"
4880 done
4881 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4883 if test -n "$finalize_perm_rpath"; then
4884 # We should set the runpath_var.
4885 rpath=
4886 for dir in $finalize_perm_rpath; do
4887 rpath="$rpath$dir:"
4888 done
4889 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4893 if test "$no_install" = yes; then
4894 # We don't need to create a wrapper script.
4895 link_command="$compile_var$compile_command$compile_rpath"
4896 # Replace the output file specification.
4897 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4898 # Delete the old output file.
4899 $run $rm $output
4900 # Link the executable and exit
4901 $show "$link_command"
4902 $run eval "$link_command" || exit $?
4903 exit $EXIT_SUCCESS
4906 if test "$hardcode_action" = relink; then
4907 # Fast installation is not supported
4908 link_command="$compile_var$compile_command$compile_rpath"
4909 relink_command="$finalize_var$finalize_command$finalize_rpath"
4911 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4912 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4913 else
4914 if test "$fast_install" != no; then
4915 link_command="$finalize_var$compile_command$finalize_rpath"
4916 if test "$fast_install" = yes; then
4917 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
4918 else
4919 # fast_install is set to needless
4920 relink_command=
4922 else
4923 link_command="$compile_var$compile_command$compile_rpath"
4924 relink_command="$finalize_var$finalize_command$finalize_rpath"
4928 # Replace the output file specification.
4929 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4931 # Delete the old output files.
4932 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4934 $show "$link_command"
4935 $run eval "$link_command" || exit $?
4937 # Now create the wrapper script.
4938 $show "creating $output"
4940 # Quote the relink command for shipping.
4941 if test -n "$relink_command"; then
4942 # Preserve any variables that may affect compiler behavior
4943 for var in $variables_saved_for_relink; do
4944 if eval test -z \"\${$var+set}\"; then
4945 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4946 elif eval var_value=\$$var; test -z "$var_value"; then
4947 relink_command="$var=; export $var; $relink_command"
4948 else
4949 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4950 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4952 done
4953 relink_command="(cd `pwd`; $relink_command)"
4954 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
4957 # Quote $echo for shipping.
4958 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4959 case $progpath in
4960 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4961 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4962 esac
4963 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4964 else
4965 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4968 # Only actually do things if our run command is non-null.
4969 if test -z "$run"; then
4970 # win32 will think the script is a binary if it has
4971 # a .exe suffix, so we strip it off here.
4972 case $output in
4973 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4974 esac
4975 # test for cygwin because mv fails w/o .exe extensions
4976 case $host in
4977 *cygwin*)
4978 exeext=.exe
4979 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4980 *) exeext= ;;
4981 esac
4982 case $host in
4983 *cygwin* | *mingw* )
4984 output_name=`basename $output`
4985 output_path=`dirname $output`
4986 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4987 cwrapper="$output_path/$output_name.exe"
4988 $rm $cwrappersource $cwrapper
4989 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4991 cat > $cwrappersource <<EOF
4993 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4994 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4996 The $output program cannot be directly executed until all the libtool
4997 libraries that it depends on are installed.
4999 This wrapper executable should never be moved out of the build directory.
5000 If it is, it will not operate correctly.
5002 Currently, it simply execs the wrapper *script* "/bin/sh $output",
5003 but could eventually absorb all of the scripts functionality and
5004 exec $objdir/$outputname directly.
5007 cat >> $cwrappersource<<"EOF"
5008 #include <stdio.h>
5009 #include <stdlib.h>
5010 #include <unistd.h>
5011 #include <malloc.h>
5012 #include <stdarg.h>
5013 #include <assert.h>
5014 #include <string.h>
5015 #include <ctype.h>
5016 #include <sys/stat.h>
5018 #if defined(PATH_MAX)
5019 # define LT_PATHMAX PATH_MAX
5020 #elif defined(MAXPATHLEN)
5021 # define LT_PATHMAX MAXPATHLEN
5022 #else
5023 # define LT_PATHMAX 1024
5024 #endif
5026 #ifndef DIR_SEPARATOR
5027 # define DIR_SEPARATOR '/'
5028 # define PATH_SEPARATOR ':'
5029 #endif
5031 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5032 defined (__OS2__)
5033 # define HAVE_DOS_BASED_FILE_SYSTEM
5034 # ifndef DIR_SEPARATOR_2
5035 # define DIR_SEPARATOR_2 '\\'
5036 # endif
5037 # ifndef PATH_SEPARATOR_2
5038 # define PATH_SEPARATOR_2 ';'
5039 # endif
5040 #endif
5042 #ifndef DIR_SEPARATOR_2
5043 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5044 #else /* DIR_SEPARATOR_2 */
5045 # define IS_DIR_SEPARATOR(ch) \
5046 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5047 #endif /* DIR_SEPARATOR_2 */
5049 #ifndef PATH_SEPARATOR_2
5050 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5051 #else /* PATH_SEPARATOR_2 */
5052 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5053 #endif /* PATH_SEPARATOR_2 */
5055 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5056 #define XFREE(stale) do { \
5057 if (stale) { free ((void *) stale); stale = 0; } \
5058 } while (0)
5060 /* -DDEBUG is fairly common in CFLAGS. */
5061 #undef DEBUG
5062 #if defined DEBUGWRAPPER
5063 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5064 #else
5065 # define DEBUG(format, ...)
5066 #endif
5068 const char *program_name = NULL;
5070 void * xmalloc (size_t num);
5071 char * xstrdup (const char *string);
5072 const char * base_name (const char *name);
5073 char * find_executable(const char *wrapper);
5074 int check_executable(const char *path);
5075 char * strendzap(char *str, const char *pat);
5076 void lt_fatal (const char *message, ...);
5079 main (int argc, char *argv[])
5081 char **newargz;
5082 int i;
5084 program_name = (char *) xstrdup (base_name (argv[0]));
5085 DEBUG("(main) argv[0] : %s\n",argv[0]);
5086 DEBUG("(main) program_name : %s\n",program_name);
5087 newargz = XMALLOC(char *, argc+2);
5090 cat >> $cwrappersource <<EOF
5091 newargz[0] = (char *) xstrdup("$SHELL");
5094 cat >> $cwrappersource <<"EOF"
5095 newargz[1] = find_executable(argv[0]);
5096 if (newargz[1] == NULL)
5097 lt_fatal("Couldn't find %s", argv[0]);
5098 DEBUG("(main) found exe at : %s\n",newargz[1]);
5099 /* we know the script has the same name, without the .exe */
5100 /* so make sure newargz[1] doesn't end in .exe */
5101 strendzap(newargz[1],".exe");
5102 for (i = 1; i < argc; i++)
5103 newargz[i+1] = xstrdup(argv[i]);
5104 newargz[argc+1] = NULL;
5106 for (i=0; i<argc+1; i++)
5108 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5114 case $host_os in
5115 mingw*)
5116 cat >> $cwrappersource <<EOF
5117 execv("$SHELL",(char const **)newargz);
5121 cat >> $cwrappersource <<EOF
5122 execv("$SHELL",newargz);
5125 esac
5127 cat >> $cwrappersource <<"EOF"
5128 return 127;
5131 void *
5132 xmalloc (size_t num)
5134 void * p = (void *) malloc (num);
5135 if (!p)
5136 lt_fatal ("Memory exhausted");
5138 return p;
5141 char *
5142 xstrdup (const char *string)
5144 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5148 const char *
5149 base_name (const char *name)
5151 const char *base;
5153 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5154 /* Skip over the disk name in MSDOS pathnames. */
5155 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5156 name += 2;
5157 #endif
5159 for (base = name; *name; name++)
5160 if (IS_DIR_SEPARATOR (*name))
5161 base = name + 1;
5162 return base;
5166 check_executable(const char * path)
5168 struct stat st;
5170 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5171 if ((!path) || (!*path))
5172 return 0;
5174 if ((stat (path, &st) >= 0) &&
5176 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5177 #if defined (S_IXOTH)
5178 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5179 #endif
5180 #if defined (S_IXGRP)
5181 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5182 #endif
5183 ((st.st_mode & S_IXUSR) == S_IXUSR))
5185 return 1;
5186 else
5187 return 0;
5190 /* Searches for the full path of the wrapper. Returns
5191 newly allocated full path name if found, NULL otherwise */
5192 char *
5193 find_executable (const char* wrapper)
5195 int has_slash = 0;
5196 const char* p;
5197 const char* p_next;
5198 /* static buffer for getcwd */
5199 char tmp[LT_PATHMAX + 1];
5200 int tmp_len;
5201 char* concat_name;
5203 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5205 if ((wrapper == NULL) || (*wrapper == '\0'))
5206 return NULL;
5208 /* Absolute path? */
5209 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5210 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5212 concat_name = xstrdup (wrapper);
5213 if (check_executable(concat_name))
5214 return concat_name;
5215 XFREE(concat_name);
5217 else
5219 #endif
5220 if (IS_DIR_SEPARATOR (wrapper[0]))
5222 concat_name = xstrdup (wrapper);
5223 if (check_executable(concat_name))
5224 return concat_name;
5225 XFREE(concat_name);
5227 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5229 #endif
5231 for (p = wrapper; *p; p++)
5232 if (*p == '/')
5234 has_slash = 1;
5235 break;
5237 if (!has_slash)
5239 /* no slashes; search PATH */
5240 const char* path = getenv ("PATH");
5241 if (path != NULL)
5243 for (p = path; *p; p = p_next)
5245 const char* q;
5246 size_t p_len;
5247 for (q = p; *q; q++)
5248 if (IS_PATH_SEPARATOR(*q))
5249 break;
5250 p_len = q - p;
5251 p_next = (*q == '\0' ? q : q + 1);
5252 if (p_len == 0)
5254 /* empty path: current directory */
5255 if (getcwd (tmp, LT_PATHMAX) == NULL)
5256 lt_fatal ("getcwd failed");
5257 tmp_len = strlen(tmp);
5258 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5259 memcpy (concat_name, tmp, tmp_len);
5260 concat_name[tmp_len] = '/';
5261 strcpy (concat_name + tmp_len + 1, wrapper);
5263 else
5265 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5266 memcpy (concat_name, p, p_len);
5267 concat_name[p_len] = '/';
5268 strcpy (concat_name + p_len + 1, wrapper);
5270 if (check_executable(concat_name))
5271 return concat_name;
5272 XFREE(concat_name);
5275 /* not found in PATH; assume curdir */
5277 /* Relative path | not found in path: prepend cwd */
5278 if (getcwd (tmp, LT_PATHMAX) == NULL)
5279 lt_fatal ("getcwd failed");
5280 tmp_len = strlen(tmp);
5281 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5282 memcpy (concat_name, tmp, tmp_len);
5283 concat_name[tmp_len] = '/';
5284 strcpy (concat_name + tmp_len + 1, wrapper);
5286 if (check_executable(concat_name))
5287 return concat_name;
5288 XFREE(concat_name);
5289 return NULL;
5292 char *
5293 strendzap(char *str, const char *pat)
5295 size_t len, patlen;
5297 assert(str != NULL);
5298 assert(pat != NULL);
5300 len = strlen(str);
5301 patlen = strlen(pat);
5303 if (patlen <= len)
5305 str += len - patlen;
5306 if (strcmp(str, pat) == 0)
5307 *str = '\0';
5309 return str;
5312 static void
5313 lt_error_core (int exit_status, const char * mode,
5314 const char * message, va_list ap)
5316 fprintf (stderr, "%s: %s: ", program_name, mode);
5317 vfprintf (stderr, message, ap);
5318 fprintf (stderr, ".\n");
5320 if (exit_status >= 0)
5321 exit (exit_status);
5324 void
5325 lt_fatal (const char *message, ...)
5327 va_list ap;
5328 va_start (ap, message);
5329 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5330 va_end (ap);
5333 # we should really use a build-platform specific compiler
5334 # here, but OTOH, the wrappers (shell script and this C one)
5335 # are only useful if you want to execute the "real" binary.
5336 # Since the "real" binary is built for $host, then this
5337 # wrapper might as well be built for $host, too.
5338 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5340 esac
5341 $rm $output
5342 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5344 $echo > $output "\
5345 #! $SHELL
5347 # $output - temporary wrapper script for $objdir/$outputname
5348 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5350 # The $output program cannot be directly executed until all the libtool
5351 # libraries that it depends on are installed.
5353 # This wrapper script should never be moved out of the build directory.
5354 # If it is, it will not operate correctly.
5356 # Sed substitution that helps us do robust quoting. It backslashifies
5357 # metacharacters that are still active within double-quoted strings.
5358 Xsed='${SED} -e 1s/^X//'
5359 sed_quote_subst='$sed_quote_subst'
5361 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5362 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
5363 emulate sh
5364 NULLCMD=:
5365 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
5366 # is contrary to our usage. Disable this feature.
5367 alias -g '\${1+\"\$@\"}'='\"\$@\"'
5368 setopt NO_GLOB_SUBST
5369 else
5370 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
5372 BIN_SH=xpg4; export BIN_SH # for Tru64
5373 DUALCASE=1; export DUALCASE # for MKS sh
5375 # The HP-UX ksh and POSIX shell print the target directory to stdout
5376 # if CDPATH is set.
5377 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5379 relink_command=\"$relink_command\"
5381 # This environment variable determines our operation mode.
5382 if test \"\$libtool_install_magic\" = \"$magic\"; then
5383 # install mode needs the following variable:
5384 notinst_deplibs='$notinst_deplibs'
5385 else
5386 # When we are sourced in execute mode, \$file and \$echo are already set.
5387 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5388 echo=\"$qecho\"
5389 file=\"\$0\"
5390 # Make sure echo works.
5391 if test \"X\$1\" = X--no-reexec; then
5392 # Discard the --no-reexec flag, and continue.
5393 shift
5394 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5395 # Yippee, \$echo works!
5397 else
5398 # Restart under the correct shell, and then maybe \$echo will work.
5399 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5403 $echo >> $output "\
5405 # Find the directory that this script lives in.
5406 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5407 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5409 # Follow symbolic links until we get to the real thisdir.
5410 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5411 while test -n \"\$file\"; do
5412 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5414 # If there was a directory component, then change thisdir.
5415 if test \"x\$destdir\" != \"x\$file\"; then
5416 case \"\$destdir\" in
5417 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5418 *) thisdir=\"\$thisdir/\$destdir\" ;;
5419 esac
5422 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5423 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5424 done
5426 # Try to get the absolute directory name.
5427 absdir=\`cd \"\$thisdir\" && pwd\`
5428 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5431 if test "$fast_install" = yes; then
5432 $echo >> $output "\
5433 program=lt-'$outputname'$exeext
5434 progdir=\"\$thisdir/$objdir\"
5436 if test ! -f \"\$progdir/\$program\" || \\
5437 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5438 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5440 file=\"\$\$-\$program\"
5442 if test ! -d \"\$progdir\"; then
5443 $mkdir \"\$progdir\"
5444 else
5445 $rm \"\$progdir/\$file\"
5448 $echo >> $output "\
5450 # relink executable if necessary
5451 if test -n \"\$relink_command\"; then
5452 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5453 else
5454 $echo \"\$relink_command_output\" >&2
5455 $rm \"\$progdir/\$file\"
5456 exit $EXIT_FAILURE
5460 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5461 { $rm \"\$progdir/\$program\";
5462 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5463 $rm \"\$progdir/\$file\"
5465 else
5466 $echo >> $output "\
5467 program='$outputname'
5468 progdir=\"\$thisdir/$objdir\"
5472 $echo >> $output "\
5474 if test -f \"\$progdir/\$program\"; then"
5476 # Export our shlibpath_var if we have one.
5477 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5478 $echo >> $output "\
5479 # Add our own library path to $shlibpath_var
5480 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5482 # Some systems cannot cope with colon-terminated $shlibpath_var
5483 # The second colon is a workaround for a bug in BeOS R4 sed
5484 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5486 export $shlibpath_var
5490 # fixup the dll searchpath if we need to.
5491 if test -n "$dllsearchpath"; then
5492 $echo >> $output "\
5493 # Add the dll search path components to the executable PATH
5494 PATH=$dllsearchpath:\$PATH
5498 $echo >> $output "\
5499 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5500 # Run the actual program with our arguments.
5502 case $host in
5503 # Backslashes separate directories on plain windows
5504 *-*-mingw | *-*-os2*)
5505 $echo >> $output "\
5506 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5511 $echo >> $output "\
5512 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5515 esac
5516 $echo >> $output "\
5517 \$echo \"\$0: cannot exec \$program \$*\"
5518 exit $EXIT_FAILURE
5520 else
5521 # The program doesn't exist.
5522 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5523 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5524 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5525 exit $EXIT_FAILURE
5529 chmod +x $output
5531 exit $EXIT_SUCCESS
5533 esac
5535 # See if we need to build an old-fashioned archive.
5536 for oldlib in $oldlibs; do
5538 if test "$build_libtool_libs" = convenience; then
5539 oldobjs="$libobjs_save"
5540 addlibs="$convenience"
5541 build_libtool_libs=no
5542 else
5543 if test "$build_libtool_libs" = module; then
5544 oldobjs="$libobjs_save"
5545 build_libtool_libs=no
5546 else
5547 oldobjs="$old_deplibs $non_pic_objects"
5549 addlibs="$old_convenience"
5552 if test -n "$addlibs"; then
5553 gentop="$output_objdir/${outputname}x"
5554 generated="$generated $gentop"
5556 func_extract_archives $gentop $addlibs
5557 oldobjs="$oldobjs $func_extract_archives_result"
5560 # Do each command in the archive commands.
5561 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5562 cmds=$old_archive_from_new_cmds
5563 else
5564 # POSIX demands no paths to be encoded in archives. We have
5565 # to avoid creating archives with duplicate basenames if we
5566 # might have to extract them afterwards, e.g., when creating a
5567 # static archive out of a convenience library, or when linking
5568 # the entirety of a libtool archive into another (currently
5569 # not supported by libtool).
5570 if (for obj in $oldobjs
5572 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5573 done | sort | sort -uc >/dev/null 2>&1); then
5575 else
5576 $echo "copying selected object files to avoid basename conflicts..."
5578 if test -z "$gentop"; then
5579 gentop="$output_objdir/${outputname}x"
5580 generated="$generated $gentop"
5582 $show "${rm}r $gentop"
5583 $run ${rm}r "$gentop"
5584 $show "$mkdir $gentop"
5585 $run $mkdir "$gentop"
5586 exit_status=$?
5587 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5588 exit $exit_status
5592 save_oldobjs=$oldobjs
5593 oldobjs=
5594 counter=1
5595 for obj in $save_oldobjs
5597 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5598 case " $oldobjs " in
5599 " ") oldobjs=$obj ;;
5600 *[\ /]"$objbase "*)
5601 while :; do
5602 # Make sure we don't pick an alternate name that also
5603 # overlaps.
5604 newobj=lt$counter-$objbase
5605 counter=`expr $counter + 1`
5606 case " $oldobjs " in
5607 *[\ /]"$newobj "*) ;;
5608 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5609 esac
5610 done
5611 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5612 $run ln "$obj" "$gentop/$newobj" ||
5613 $run cp "$obj" "$gentop/$newobj"
5614 oldobjs="$oldobjs $gentop/$newobj"
5616 *) oldobjs="$oldobjs $obj" ;;
5617 esac
5618 done
5621 eval cmds=\"$old_archive_cmds\"
5623 if len=`expr "X$cmds" : ".*"` &&
5624 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5625 cmds=$old_archive_cmds
5626 else
5627 # the command line is too long to link in one step, link in parts
5628 $echo "using piecewise archive linking..."
5629 save_RANLIB=$RANLIB
5630 RANLIB=:
5631 objlist=
5632 concat_cmds=
5633 save_oldobjs=$oldobjs
5635 # Is there a better way of finding the last object in the list?
5636 for obj in $save_oldobjs
5638 last_oldobj=$obj
5639 done
5640 for obj in $save_oldobjs
5642 oldobjs="$objlist $obj"
5643 objlist="$objlist $obj"
5644 eval test_cmds=\"$old_archive_cmds\"
5645 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5646 test "$len" -le "$max_cmd_len"; then
5648 else
5649 # the above command should be used before it gets too long
5650 oldobjs=$objlist
5651 if test "$obj" = "$last_oldobj" ; then
5652 RANLIB=$save_RANLIB
5654 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5655 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5656 objlist=
5658 done
5659 RANLIB=$save_RANLIB
5660 oldobjs=$objlist
5661 if test "X$oldobjs" = "X" ; then
5662 eval cmds=\"\$concat_cmds\"
5663 else
5664 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5668 save_ifs="$IFS"; IFS='~'
5669 for cmd in $cmds; do
5670 eval cmd=\"$cmd\"
5671 IFS="$save_ifs"
5672 $show "$cmd"
5673 $run eval "$cmd" || exit $?
5674 done
5675 IFS="$save_ifs"
5676 done
5678 if test -n "$generated"; then
5679 $show "${rm}r$generated"
5680 $run ${rm}r$generated
5683 # Now create the libtool archive.
5684 case $output in
5685 *.la)
5686 old_library=
5687 test "$build_old_libs" = yes && old_library="$libname.$libext"
5688 $show "creating $output"
5690 # Preserve any variables that may affect compiler behavior
5691 for var in $variables_saved_for_relink; do
5692 if eval test -z \"\${$var+set}\"; then
5693 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5694 elif eval var_value=\$$var; test -z "$var_value"; then
5695 relink_command="$var=; export $var; $relink_command"
5696 else
5697 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5698 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5700 done
5701 # Quote the link command for shipping.
5702 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5703 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
5704 if test "$hardcode_automatic" = yes ; then
5705 relink_command=
5709 # Only create the output if not a dry run.
5710 if test -z "$run"; then
5711 for installed in no yes; do
5712 if test "$installed" = yes; then
5713 if test -z "$install_libdir"; then
5714 break
5716 output="$output_objdir/$outputname"i
5717 # Replace all uninstalled libtool libraries with the installed ones
5718 newdependency_libs=
5719 for deplib in $dependency_libs; do
5720 case $deplib in
5721 *.la)
5722 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5723 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5724 if test -z "$libdir"; then
5725 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5726 exit $EXIT_FAILURE
5728 newdependency_libs="$newdependency_libs $libdir/$name"
5730 *) newdependency_libs="$newdependency_libs $deplib" ;;
5731 esac
5732 done
5733 dependency_libs="$newdependency_libs"
5734 newdlfiles=
5735 for lib in $dlfiles; do
5736 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5737 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5738 if test -z "$libdir"; then
5739 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5740 exit $EXIT_FAILURE
5742 newdlfiles="$newdlfiles $libdir/$name"
5743 done
5744 dlfiles="$newdlfiles"
5745 newdlprefiles=
5746 for lib in $dlprefiles; do
5747 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5748 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5749 if test -z "$libdir"; then
5750 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5751 exit $EXIT_FAILURE
5753 newdlprefiles="$newdlprefiles $libdir/$name"
5754 done
5755 dlprefiles="$newdlprefiles"
5756 else
5757 newdlfiles=
5758 for lib in $dlfiles; do
5759 case $lib in
5760 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5761 *) abs=`pwd`"/$lib" ;;
5762 esac
5763 newdlfiles="$newdlfiles $abs"
5764 done
5765 dlfiles="$newdlfiles"
5766 newdlprefiles=
5767 for lib in $dlprefiles; do
5768 case $lib in
5769 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5770 *) abs=`pwd`"/$lib" ;;
5771 esac
5772 newdlprefiles="$newdlprefiles $abs"
5773 done
5774 dlprefiles="$newdlprefiles"
5776 $rm $output
5777 # place dlname in correct position for cygwin
5778 tdlname=$dlname
5779 case $host,$output,$installed,$module,$dlname in
5780 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5781 esac
5782 $echo > $output "\
5783 # $outputname - a libtool library file
5784 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5786 # Please DO NOT delete this file!
5787 # It is necessary for linking the library.
5789 # The name that we can dlopen(3).
5790 dlname='$tdlname'
5792 # Names of this library.
5793 library_names='$library_names'
5795 # The name of the static archive.
5796 old_library='$old_library'
5798 # Libraries that this one depends upon.
5799 dependency_libs='$dependency_libs'
5801 # Version information for $libname.
5802 current=$current
5803 age=$age
5804 revision=$revision
5806 # Is this an already installed library?
5807 installed=$installed
5809 # Should we warn about portability when linking against -modules?
5810 shouldnotlink=$module
5812 # Files to dlopen/dlpreopen
5813 dlopen='$dlfiles'
5814 dlpreopen='$dlprefiles'
5816 # Directory that this library needs to be installed in:
5817 libdir='$install_libdir'"
5818 if test "$installed" = no && test "$need_relink" = yes; then
5819 $echo >> $output "\
5820 relink_command=\"$relink_command\""
5822 done
5825 # Do a symbolic link so that the libtool archive can be found in
5826 # LD_LIBRARY_PATH before the program is installed.
5827 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5828 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5830 esac
5831 exit $EXIT_SUCCESS
5834 # libtool install mode
5835 install)
5836 modename="$modename: install"
5838 # There may be an optional sh(1) argument at the beginning of
5839 # install_prog (especially on Windows NT).
5840 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5841 # Allow the use of GNU shtool's install command.
5842 $echo "X$nonopt" | grep shtool > /dev/null; then
5843 # Aesthetically quote it.
5844 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5845 case $arg in
5846 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5847 arg="\"$arg\""
5849 esac
5850 install_prog="$arg "
5851 arg="$1"
5852 shift
5853 else
5854 install_prog=
5855 arg=$nonopt
5858 # The real first argument should be the name of the installation program.
5859 # Aesthetically quote it.
5860 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5861 case $arg in
5862 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5863 arg="\"$arg\""
5865 esac
5866 install_prog="$install_prog$arg"
5868 # We need to accept at least all the BSD install flags.
5869 dest=
5870 files=
5871 opts=
5872 prev=
5873 install_type=
5874 isdir=no
5875 stripme=
5876 for arg
5878 if test -n "$dest"; then
5879 files="$files $dest"
5880 dest=$arg
5881 continue
5884 case $arg in
5885 -d) isdir=yes ;;
5886 -f)
5887 case " $install_prog " in
5888 *[\\\ /]cp\ *) ;;
5889 *) prev=$arg ;;
5890 esac
5892 -g | -m | -o) prev=$arg ;;
5894 stripme=" -s"
5895 continue
5900 # If the previous option needed an argument, then skip it.
5901 if test -n "$prev"; then
5902 prev=
5903 else
5904 dest=$arg
5905 continue
5908 esac
5910 # Aesthetically quote the argument.
5911 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5912 case $arg in
5913 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5914 arg="\"$arg\""
5916 esac
5917 install_prog="$install_prog $arg"
5918 done
5920 if test -z "$install_prog"; then
5921 $echo "$modename: you must specify an install program" 1>&2
5922 $echo "$help" 1>&2
5923 exit $EXIT_FAILURE
5926 if test -n "$prev"; then
5927 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5928 $echo "$help" 1>&2
5929 exit $EXIT_FAILURE
5932 if test -z "$files"; then
5933 if test -z "$dest"; then
5934 $echo "$modename: no file or destination specified" 1>&2
5935 else
5936 $echo "$modename: you must specify a destination" 1>&2
5938 $echo "$help" 1>&2
5939 exit $EXIT_FAILURE
5942 # Strip any trailing slash from the destination.
5943 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5945 # Check to see that the destination is a directory.
5946 test -d "$dest" && isdir=yes
5947 if test "$isdir" = yes; then
5948 destdir="$dest"
5949 destname=
5950 else
5951 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5952 test "X$destdir" = "X$dest" && destdir=.
5953 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5955 # Not a directory, so check to see that there is only one file specified.
5956 set dummy $files
5957 if test "$#" -gt 2; then
5958 $echo "$modename: \`$dest' is not a directory" 1>&2
5959 $echo "$help" 1>&2
5960 exit $EXIT_FAILURE
5963 case $destdir in
5964 [\\/]* | [A-Za-z]:[\\/]*) ;;
5966 for file in $files; do
5967 case $file in
5968 *.lo) ;;
5970 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5971 $echo "$help" 1>&2
5972 exit $EXIT_FAILURE
5974 esac
5975 done
5977 esac
5979 # This variable tells wrapper scripts just to set variables rather
5980 # than running their programs.
5981 libtool_install_magic="$magic"
5983 staticlibs=
5984 future_libdirs=
5985 current_libdirs=
5986 for file in $files; do
5988 # Do each installation.
5989 case $file in
5990 *.$libext)
5991 # Do the static libraries later.
5992 staticlibs="$staticlibs $file"
5995 *.la)
5996 # Check to see that this really is a libtool archive.
5997 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5998 else
5999 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
6000 $echo "$help" 1>&2
6001 exit $EXIT_FAILURE
6004 library_names=
6005 old_library=
6006 relink_command=
6007 # If there is no directory component, then add one.
6008 case $file in
6009 */* | *\\*) . $file ;;
6010 *) . ./$file ;;
6011 esac
6013 # Add the libdir to current_libdirs if it is the destination.
6014 if test "X$destdir" = "X$libdir"; then
6015 case "$current_libdirs " in
6016 *" $libdir "*) ;;
6017 *) current_libdirs="$current_libdirs $libdir" ;;
6018 esac
6019 else
6020 # Note the libdir as a future libdir.
6021 case "$future_libdirs " in
6022 *" $libdir "*) ;;
6023 *) future_libdirs="$future_libdirs $libdir" ;;
6024 esac
6027 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
6028 test "X$dir" = "X$file/" && dir=
6029 dir="$dir$objdir"
6031 if test -n "$relink_command"; then
6032 # Determine the prefix the user has applied to our future dir.
6033 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
6035 # Don't allow the user to place us outside of our expected
6036 # location b/c this prevents finding dependent libraries that
6037 # are installed to the same prefix.
6038 # At present, this check doesn't affect windows .dll's that
6039 # are installed into $libdir/../bin (currently, that works fine)
6040 # but it's something to keep an eye on.
6041 if test "$inst_prefix_dir" = "$destdir"; then
6042 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
6043 exit $EXIT_FAILURE
6046 if test -n "$inst_prefix_dir"; then
6047 # Stick the inst_prefix_dir data into the link command.
6048 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
6049 else
6050 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
6053 $echo "$modename: warning: relinking \`$file'" 1>&2
6054 $show "$relink_command"
6055 if $run eval "$relink_command"; then :
6056 else
6057 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6058 exit $EXIT_FAILURE
6062 # See the names of the shared library.
6063 set dummy $library_names
6064 if test -n "$2"; then
6065 realname="$2"
6066 shift
6067 shift
6069 srcname="$realname"
6070 test -n "$relink_command" && srcname="$realname"T
6072 # Install the shared library and build the symlinks.
6073 $show "$install_prog $dir/$srcname $destdir/$realname"
6074 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
6075 if test -n "$stripme" && test -n "$striplib"; then
6076 $show "$striplib $destdir/$realname"
6077 $run eval "$striplib $destdir/$realname" || exit $?
6080 if test "$#" -gt 0; then
6081 # Delete the old symlinks, and create new ones.
6082 # Try `ln -sf' first, because the `ln' binary might depend on
6083 # the symlink we replace! Solaris /bin/ln does not understand -f,
6084 # so we also need to try rm && ln -s.
6085 for linkname
6087 if test "$linkname" != "$realname"; then
6088 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6089 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
6091 done
6094 # Do each command in the postinstall commands.
6095 lib="$destdir/$realname"
6096 cmds=$postinstall_cmds
6097 save_ifs="$IFS"; IFS='~'
6098 for cmd in $cmds; do
6099 IFS="$save_ifs"
6100 eval cmd=\"$cmd\"
6101 $show "$cmd"
6102 $run eval "$cmd" || {
6103 lt_exit=$?
6105 # Restore the uninstalled library and exit
6106 if test "$mode" = relink; then
6107 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
6110 exit $lt_exit
6112 done
6113 IFS="$save_ifs"
6116 # Install the pseudo-library for information purposes.
6117 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6118 instname="$dir/$name"i
6119 $show "$install_prog $instname $destdir/$name"
6120 $run eval "$install_prog $instname $destdir/$name" || exit $?
6122 # Maybe install the static library, too.
6123 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6126 *.lo)
6127 # Install (i.e. copy) a libtool object.
6129 # Figure out destination file name, if it wasn't already specified.
6130 if test -n "$destname"; then
6131 destfile="$destdir/$destname"
6132 else
6133 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6134 destfile="$destdir/$destfile"
6137 # Deduce the name of the destination old-style object file.
6138 case $destfile in
6139 *.lo)
6140 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6142 *.$objext)
6143 staticdest="$destfile"
6144 destfile=
6147 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6148 $echo "$help" 1>&2
6149 exit $EXIT_FAILURE
6151 esac
6153 # Install the libtool object if requested.
6154 if test -n "$destfile"; then
6155 $show "$install_prog $file $destfile"
6156 $run eval "$install_prog $file $destfile" || exit $?
6159 # Install the old object if enabled.
6160 if test "$build_old_libs" = yes; then
6161 # Deduce the name of the old-style object file.
6162 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6164 $show "$install_prog $staticobj $staticdest"
6165 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6167 exit $EXIT_SUCCESS
6171 # Figure out destination file name, if it wasn't already specified.
6172 if test -n "$destname"; then
6173 destfile="$destdir/$destname"
6174 else
6175 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6176 destfile="$destdir/$destfile"
6179 # If the file is missing, and there is a .exe on the end, strip it
6180 # because it is most likely a libtool script we actually want to
6181 # install
6182 stripped_ext=""
6183 case $file in
6184 *.exe)
6185 if test ! -f "$file"; then
6186 file=`$echo $file|${SED} 's,.exe$,,'`
6187 stripped_ext=".exe"
6190 esac
6192 # Do a test to see if this is really a libtool program.
6193 case $host in
6194 *cygwin*|*mingw*)
6195 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6198 wrapper=$file
6200 esac
6201 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6202 notinst_deplibs=
6203 relink_command=
6205 # Note that it is not necessary on cygwin/mingw to append a dot to
6206 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6207 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6208 # `FILE.' does not work on cygwin managed mounts.
6210 # If there is no directory component, then add one.
6211 case $wrapper in
6212 */* | *\\*) . ${wrapper} ;;
6213 *) . ./${wrapper} ;;
6214 esac
6216 # Check the variables that should have been set.
6217 if test -z "$notinst_deplibs"; then
6218 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6219 exit $EXIT_FAILURE
6222 finalize=yes
6223 for lib in $notinst_deplibs; do
6224 # Check to see that each library is installed.
6225 libdir=
6226 if test -f "$lib"; then
6227 # If there is no directory component, then add one.
6228 case $lib in
6229 */* | *\\*) . $lib ;;
6230 *) . ./$lib ;;
6231 esac
6233 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6234 if test -n "$libdir" && test ! -f "$libfile"; then
6235 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6236 finalize=no
6238 done
6240 relink_command=
6241 # Note that it is not necessary on cygwin/mingw to append a dot to
6242 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6243 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6244 # `FILE.' does not work on cygwin managed mounts.
6246 # If there is no directory component, then add one.
6247 case $wrapper in
6248 */* | *\\*) . ${wrapper} ;;
6249 *) . ./${wrapper} ;;
6250 esac
6252 outputname=
6253 if test "$fast_install" = no && test -n "$relink_command"; then
6254 if test "$finalize" = yes && test -z "$run"; then
6255 tmpdir=`func_mktempdir`
6256 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6257 outputname="$tmpdir/$file"
6258 # Replace the output file specification.
6259 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
6261 $show "$relink_command"
6262 if $run eval "$relink_command"; then :
6263 else
6264 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6265 ${rm}r "$tmpdir"
6266 continue
6268 file="$outputname"
6269 else
6270 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6272 else
6273 # Install the binary that we compiled earlier.
6274 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6278 # remove .exe since cygwin /usr/bin/install will append another
6279 # one anyway
6280 case $install_prog,$host in
6281 */usr/bin/install*,*cygwin*)
6282 case $file:$destfile in
6283 *.exe:*.exe)
6284 # this is ok
6286 *.exe:*)
6287 destfile=$destfile.exe
6289 *:*.exe)
6290 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6292 esac
6294 esac
6295 $show "$install_prog$stripme $file $destfile"
6296 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6297 test -n "$outputname" && ${rm}r "$tmpdir"
6299 esac
6300 done
6302 for file in $staticlibs; do
6303 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6305 # Set up the ranlib parameters.
6306 oldlib="$destdir/$name"
6308 $show "$install_prog $file $oldlib"
6309 $run eval "$install_prog \$file \$oldlib" || exit $?
6311 if test -n "$stripme" && test -n "$old_striplib"; then
6312 $show "$old_striplib $oldlib"
6313 $run eval "$old_striplib $oldlib" || exit $?
6316 # Do each command in the postinstall commands.
6317 cmds=$old_postinstall_cmds
6318 save_ifs="$IFS"; IFS='~'
6319 for cmd in $cmds; do
6320 IFS="$save_ifs"
6321 eval cmd=\"$cmd\"
6322 $show "$cmd"
6323 $run eval "$cmd" || exit $?
6324 done
6325 IFS="$save_ifs"
6326 done
6328 if test -n "$future_libdirs"; then
6329 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6332 if test -n "$current_libdirs"; then
6333 # Maybe just do a dry run.
6334 test -n "$run" && current_libdirs=" -n$current_libdirs"
6335 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6336 else
6337 exit $EXIT_SUCCESS
6341 # libtool finish mode
6342 finish)
6343 modename="$modename: finish"
6344 libdirs="$nonopt"
6345 admincmds=
6347 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6348 for dir
6350 libdirs="$libdirs $dir"
6351 done
6353 for libdir in $libdirs; do
6354 if test -n "$finish_cmds"; then
6355 # Do each command in the finish commands.
6356 cmds=$finish_cmds
6357 save_ifs="$IFS"; IFS='~'
6358 for cmd in $cmds; do
6359 IFS="$save_ifs"
6360 eval cmd=\"$cmd\"
6361 $show "$cmd"
6362 $run eval "$cmd" || admincmds="$admincmds
6363 $cmd"
6364 done
6365 IFS="$save_ifs"
6367 if test -n "$finish_eval"; then
6368 # Do the single finish_eval.
6369 eval cmds=\"$finish_eval\"
6370 $run eval "$cmds" || admincmds="$admincmds
6371 $cmds"
6373 done
6376 # Exit here if they wanted silent mode.
6377 test "$show" = : && exit $EXIT_SUCCESS
6379 $echo "X----------------------------------------------------------------------" | $Xsed
6380 $echo "Libraries have been installed in:"
6381 for libdir in $libdirs; do
6382 $echo " $libdir"
6383 done
6384 $echo
6385 $echo "If you ever happen to want to link against installed libraries"
6386 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6387 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6388 $echo "flag during linking and do at least one of the following:"
6389 if test -n "$shlibpath_var"; then
6390 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6391 $echo " during execution"
6393 if test -n "$runpath_var"; then
6394 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6395 $echo " during linking"
6397 if test -n "$hardcode_libdir_flag_spec"; then
6398 libdir=LIBDIR
6399 eval flag=\"$hardcode_libdir_flag_spec\"
6401 $echo " - use the \`$flag' linker flag"
6403 if test -n "$admincmds"; then
6404 $echo " - have your system administrator run these commands:$admincmds"
6406 if test -f /etc/ld.so.conf; then
6407 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6409 $echo
6410 $echo "See any operating system documentation about shared libraries for"
6411 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6412 $echo "X----------------------------------------------------------------------" | $Xsed
6413 exit $EXIT_SUCCESS
6416 # libtool execute mode
6417 execute)
6418 modename="$modename: execute"
6420 # The first argument is the command name.
6421 cmd="$nonopt"
6422 if test -z "$cmd"; then
6423 $echo "$modename: you must specify a COMMAND" 1>&2
6424 $echo "$help"
6425 exit $EXIT_FAILURE
6428 # Handle -dlopen flags immediately.
6429 for file in $execute_dlfiles; do
6430 if test ! -f "$file"; then
6431 $echo "$modename: \`$file' is not a file" 1>&2
6432 $echo "$help" 1>&2
6433 exit $EXIT_FAILURE
6436 dir=
6437 case $file in
6438 *.la)
6439 # Check to see that this really is a libtool archive.
6440 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6441 else
6442 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6443 $echo "$help" 1>&2
6444 exit $EXIT_FAILURE
6447 # Read the libtool library.
6448 dlname=
6449 library_names=
6451 # If there is no directory component, then add one.
6452 case $file in
6453 */* | *\\*) . $file ;;
6454 *) . ./$file ;;
6455 esac
6457 # Skip this library if it cannot be dlopened.
6458 if test -z "$dlname"; then
6459 # Warn if it was a shared library.
6460 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6461 continue
6464 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6465 test "X$dir" = "X$file" && dir=.
6467 if test -f "$dir/$objdir/$dlname"; then
6468 dir="$dir/$objdir"
6469 else
6470 if test ! -f "$dir/$dlname"; then
6471 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6472 exit $EXIT_FAILURE
6477 *.lo)
6478 # Just add the directory containing the .lo file.
6479 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6480 test "X$dir" = "X$file" && dir=.
6484 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6485 continue
6487 esac
6489 # Get the absolute pathname.
6490 absdir=`cd "$dir" && pwd`
6491 test -n "$absdir" && dir="$absdir"
6493 # Now add the directory to shlibpath_var.
6494 if eval "test -z \"\$$shlibpath_var\""; then
6495 eval "$shlibpath_var=\"\$dir\""
6496 else
6497 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6499 done
6501 # This variable tells wrapper scripts just to set shlibpath_var
6502 # rather than running their programs.
6503 libtool_execute_magic="$magic"
6505 # Check if any of the arguments is a wrapper script.
6506 args=
6507 for file
6509 case $file in
6510 -*) ;;
6512 # Do a test to see if this is really a libtool program.
6513 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6514 # If there is no directory component, then add one.
6515 case $file in
6516 */* | *\\*) . $file ;;
6517 *) . ./$file ;;
6518 esac
6520 # Transform arg to wrapped name.
6521 file="$progdir/$program"
6524 esac
6525 # Quote arguments (to preserve shell metacharacters).
6526 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6527 args="$args \"$file\""
6528 done
6530 if test -z "$run"; then
6531 if test -n "$shlibpath_var"; then
6532 # Export the shlibpath_var.
6533 eval "export $shlibpath_var"
6536 # Restore saved environment variables
6537 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
6539 eval "if test \"\${save_$lt_var+set}\" = set; then
6540 $lt_var=\$save_$lt_var; export $lt_var
6542 done
6544 # Now prepare to actually exec the command.
6545 exec_cmd="\$cmd$args"
6546 else
6547 # Display what would be done.
6548 if test -n "$shlibpath_var"; then
6549 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6550 $echo "export $shlibpath_var"
6552 $echo "$cmd$args"
6553 exit $EXIT_SUCCESS
6557 # libtool clean and uninstall mode
6558 clean | uninstall)
6559 modename="$modename: $mode"
6560 rm="$nonopt"
6561 files=
6562 rmforce=
6563 exit_status=0
6565 # This variable tells wrapper scripts just to set variables rather
6566 # than running their programs.
6567 libtool_install_magic="$magic"
6569 for arg
6571 case $arg in
6572 -f) rm="$rm $arg"; rmforce=yes ;;
6573 -*) rm="$rm $arg" ;;
6574 *) files="$files $arg" ;;
6575 esac
6576 done
6578 if test -z "$rm"; then
6579 $echo "$modename: you must specify an RM program" 1>&2
6580 $echo "$help" 1>&2
6581 exit $EXIT_FAILURE
6584 rmdirs=
6586 origobjdir="$objdir"
6587 for file in $files; do
6588 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6589 if test "X$dir" = "X$file"; then
6590 dir=.
6591 objdir="$origobjdir"
6592 else
6593 objdir="$dir/$origobjdir"
6595 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6596 test "$mode" = uninstall && objdir="$dir"
6598 # Remember objdir for removal later, being careful to avoid duplicates
6599 if test "$mode" = clean; then
6600 case " $rmdirs " in
6601 *" $objdir "*) ;;
6602 *) rmdirs="$rmdirs $objdir" ;;
6603 esac
6606 # Don't error if the file doesn't exist and rm -f was used.
6607 if (test -L "$file") >/dev/null 2>&1 \
6608 || (test -h "$file") >/dev/null 2>&1 \
6609 || test -f "$file"; then
6611 elif test -d "$file"; then
6612 exit_status=1
6613 continue
6614 elif test "$rmforce" = yes; then
6615 continue
6618 rmfiles="$file"
6620 case $name in
6621 *.la)
6622 # Possibly a libtool archive, so verify it.
6623 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6624 . $dir/$name
6626 # Delete the libtool libraries and symlinks.
6627 for n in $library_names; do
6628 rmfiles="$rmfiles $objdir/$n"
6629 done
6630 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6632 case "$mode" in
6633 clean)
6634 case " $library_names " in
6635 # " " in the beginning catches empty $dlname
6636 *" $dlname "*) ;;
6637 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6638 esac
6639 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6641 uninstall)
6642 if test -n "$library_names"; then
6643 # Do each command in the postuninstall commands.
6644 cmds=$postuninstall_cmds
6645 save_ifs="$IFS"; IFS='~'
6646 for cmd in $cmds; do
6647 IFS="$save_ifs"
6648 eval cmd=\"$cmd\"
6649 $show "$cmd"
6650 $run eval "$cmd"
6651 if test "$?" -ne 0 && test "$rmforce" != yes; then
6652 exit_status=1
6654 done
6655 IFS="$save_ifs"
6658 if test -n "$old_library"; then
6659 # Do each command in the old_postuninstall commands.
6660 cmds=$old_postuninstall_cmds
6661 save_ifs="$IFS"; IFS='~'
6662 for cmd in $cmds; do
6663 IFS="$save_ifs"
6664 eval cmd=\"$cmd\"
6665 $show "$cmd"
6666 $run eval "$cmd"
6667 if test "$?" -ne 0 && test "$rmforce" != yes; then
6668 exit_status=1
6670 done
6671 IFS="$save_ifs"
6673 # FIXME: should reinstall the best remaining shared library.
6675 esac
6679 *.lo)
6680 # Possibly a libtool object, so verify it.
6681 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6683 # Read the .lo file
6684 . $dir/$name
6686 # Add PIC object to the list of files to remove.
6687 if test -n "$pic_object" \
6688 && test "$pic_object" != none; then
6689 rmfiles="$rmfiles $dir/$pic_object"
6692 # Add non-PIC object to the list of files to remove.
6693 if test -n "$non_pic_object" \
6694 && test "$non_pic_object" != none; then
6695 rmfiles="$rmfiles $dir/$non_pic_object"
6701 if test "$mode" = clean ; then
6702 noexename=$name
6703 case $file in
6704 *.exe)
6705 file=`$echo $file|${SED} 's,.exe$,,'`
6706 noexename=`$echo $name|${SED} 's,.exe$,,'`
6707 # $file with .exe has already been added to rmfiles,
6708 # add $file without .exe
6709 rmfiles="$rmfiles $file"
6711 esac
6712 # Do a test to see if this is a libtool program.
6713 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6714 relink_command=
6715 . $dir/$noexename
6717 # note $name still contains .exe if it was in $file originally
6718 # as does the version of $file that was added into $rmfiles
6719 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6720 if test "$fast_install" = yes && test -n "$relink_command"; then
6721 rmfiles="$rmfiles $objdir/lt-$name"
6723 if test "X$noexename" != "X$name" ; then
6724 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6729 esac
6730 $show "$rm $rmfiles"
6731 $run $rm $rmfiles || exit_status=1
6732 done
6733 objdir="$origobjdir"
6735 # Try to remove the ${objdir}s in the directories where we deleted files
6736 for dir in $rmdirs; do
6737 if test -d "$dir"; then
6738 $show "rmdir $dir"
6739 $run rmdir $dir >/dev/null 2>&1
6741 done
6743 exit $exit_status
6747 $echo "$modename: you must specify a MODE" 1>&2
6748 $echo "$generic_help" 1>&2
6749 exit $EXIT_FAILURE
6751 esac
6753 if test -z "$exec_cmd"; then
6754 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6755 $echo "$generic_help" 1>&2
6756 exit $EXIT_FAILURE
6758 fi # test -z "$show_help"
6760 if test -n "$exec_cmd"; then
6761 eval exec $exec_cmd
6762 exit $EXIT_FAILURE
6765 # We need to display help for each of the modes.
6766 case $mode in
6767 "") $echo \
6768 "Usage: $modename [OPTION]... [MODE-ARG]...
6770 Provide generalized library-building support services.
6772 --config show all configuration variables
6773 --debug enable verbose shell tracing
6774 -n, --dry-run display commands without modifying any files
6775 --features display basic configuration information and exit
6776 --finish same as \`--mode=finish'
6777 --help display this help message and exit
6778 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6779 --quiet same as \`--silent'
6780 --silent don't print informational messages
6781 --tag=TAG use configuration variables from tag TAG
6782 --version print version information
6784 MODE must be one of the following:
6786 clean remove files from the build directory
6787 compile compile a source file into a libtool object
6788 execute automatically set library path, then run a program
6789 finish complete the installation of libtool libraries
6790 install install libraries or executables
6791 link create a library or an executable
6792 uninstall remove libraries from an installed directory
6794 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6795 a more detailed description of MODE.
6797 Report bugs to <bug-libtool@gnu.org>."
6798 exit $EXIT_SUCCESS
6801 clean)
6802 $echo \
6803 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6805 Remove files from the build directory.
6807 RM is the name of the program to use to delete files associated with each FILE
6808 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6809 to RM.
6811 If FILE is a libtool library, object or program, all the files associated
6812 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6815 compile)
6816 $echo \
6817 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6819 Compile a source file into a libtool library object.
6821 This mode accepts the following additional options:
6823 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6824 -prefer-pic try to building PIC objects only
6825 -prefer-non-pic try to building non-PIC objects only
6826 -static always build a \`.o' file suitable for static linking
6828 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6829 from the given SOURCEFILE.
6831 The output file name is determined by removing the directory component from
6832 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6833 library object suffix, \`.lo'."
6836 execute)
6837 $echo \
6838 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6840 Automatically set library path, then run a program.
6842 This mode accepts the following additional options:
6844 -dlopen FILE add the directory containing FILE to the library path
6846 This mode sets the library path environment variable according to \`-dlopen'
6847 flags.
6849 If any of the ARGS are libtool executable wrappers, then they are translated
6850 into their corresponding uninstalled binary, and any of their required library
6851 directories are added to the library path.
6853 Then, COMMAND is executed, with ARGS as arguments."
6856 finish)
6857 $echo \
6858 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6860 Complete the installation of libtool libraries.
6862 Each LIBDIR is a directory that contains libtool libraries.
6864 The commands that this mode executes may require superuser privileges. Use
6865 the \`--dry-run' option if you just want to see what would be executed."
6868 install)
6869 $echo \
6870 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6872 Install executables or libraries.
6874 INSTALL-COMMAND is the installation command. The first component should be
6875 either the \`install' or \`cp' program.
6877 The rest of the components are interpreted as arguments to that command (only
6878 BSD-compatible install options are recognized)."
6881 link)
6882 $echo \
6883 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6885 Link object files or libraries together to form another library, or to
6886 create an executable program.
6888 LINK-COMMAND is a command using the C compiler that you would use to create
6889 a program from several object files.
6891 The following components of LINK-COMMAND are treated specially:
6893 -all-static do not do any dynamic linking at all
6894 -avoid-version do not add a version suffix if possible
6895 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6896 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6897 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6898 -export-symbols SYMFILE
6899 try to export only the symbols listed in SYMFILE
6900 -export-symbols-regex REGEX
6901 try to export only the symbols matching REGEX
6902 -LLIBDIR search LIBDIR for required installed libraries
6903 -lNAME OUTPUT-FILE requires the installed library libNAME
6904 -module build a library that can dlopened
6905 -no-fast-install disable the fast-install mode
6906 -no-install link a not-installable executable
6907 -no-undefined declare that a library does not refer to external symbols
6908 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6909 -objectlist FILE Use a list of object files found in FILE to specify objects
6910 -precious-files-regex REGEX
6911 don't remove output files matching REGEX
6912 -release RELEASE specify package release information
6913 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6914 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6915 -static do not do any dynamic linking of uninstalled libtool libraries
6916 -static-libtool-libs
6917 do not do any dynamic linking of libtool libraries
6918 -version-info CURRENT[:REVISION[:AGE]]
6919 specify library version info [each variable defaults to 0]
6921 All other options (arguments beginning with \`-') are ignored.
6923 Every other argument is treated as a filename. Files ending in \`.la' are
6924 treated as uninstalled libtool libraries, other files are standard or library
6925 object files.
6927 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6928 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6929 required, except when creating a convenience library.
6931 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6932 using \`ar' and \`ranlib', or on Windows using \`lib'.
6934 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6935 is created, otherwise an executable program is created."
6938 uninstall)
6939 $echo \
6940 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6942 Remove libraries from an installation directory.
6944 RM is the name of the program to use to delete files associated with each FILE
6945 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6946 to RM.
6948 If FILE is a libtool library, all the files associated with it are deleted.
6949 Otherwise, only FILE itself is deleted using RM."
6953 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6954 $echo "$help" 1>&2
6955 exit $EXIT_FAILURE
6957 esac
6959 $echo
6960 $echo "Try \`$modename --help' for more information about other modes."
6962 exit $?
6964 # The TAGs below are defined such that we never get into a situation
6965 # in which we disable both kinds of libraries. Given conflicting
6966 # choices, we go for a static library, that is the most portable,
6967 # since we can't tell whether shared libraries were disabled because
6968 # the user asked for that or because the platform doesn't support
6969 # them. This is particularly important on AIX, because we don't
6970 # support having both static and shared libraries enabled at the same
6971 # time on that platform, so we default to a shared-only configuration.
6972 # If a disable-shared tag is given, we'll fallback to a static-only
6973 # configuration. But we'll never go from static-only to shared-only.
6975 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6976 disable_libs=shared
6977 # ### END LIBTOOL TAG CONFIG: disable-shared
6979 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6980 disable_libs=static
6981 # ### END LIBTOOL TAG CONFIG: disable-static
6983 # Local Variables:
6984 # mode:shell-script
6985 # sh-indentation:2
6986 # End: