I cast, therefore I think I know what I'm doing.
[llvm/msp430.git] / autoconf / ltmain.sh
blob06823e057a578f95dabd0f233875dcf0553173c7
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 basename="s,^.*/,,g"
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
33 # function.
34 progpath="$0"
36 # 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.22
47 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
49 # See if we are running on zsh, and set the options which allow our
50 # commands through without removal of \ escapes.
51 if test -n "${ZSH_VERSION+set}" ; then
52 setopt NO_GLOB_SUBST
55 # Check that we have a working $echo.
56 if test "X$1" = X--no-reexec; then
57 # Discard the --no-reexec flag, and continue.
58 shift
59 elif test "X$1" = X--fallback-echo; then
60 # Avoid inline document here, it may be left over
62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63 # Yippee, $echo works!
65 else
66 # Restart under the correct shell, and then maybe $echo will work.
67 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
70 if test "X$1" = X--fallback-echo; then
71 # used as fallback echo
72 shift
73 cat <<EOF
75 EOF
76 exit $EXIT_SUCCESS
79 default_mode=
80 help="Try \`$progname --help' for more information."
81 magic="%%%MAGIC variable%%%"
82 mkdir="mkdir"
83 mv="mv -f"
84 rm="rm -f"
86 # Sed substitution that helps us do robust quoting. It backslashifies
87 # metacharacters that are still active within double-quoted strings.
88 Xsed="${SED}"' -e 1s/^X//'
89 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90 # test EBCDIC or ASCII
91 case `echo X|tr X '\101'` in
92 A) # ASCII based system
93 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
94 SP2NL='tr \040 \012'
95 NL2SP='tr \015\012 \040\040'
97 *) # EBCDIC based system
98 SP2NL='tr \100 \n'
99 NL2SP='tr \r\n \100\100'
101 esac
103 # NLS nuisances.
104 # Only set LANG and LC_ALL to C if already set.
105 # These must not be set unconditionally because not all systems understand
106 # e.g. LANG=C (notably SCO).
107 # We save the old values to restore during execute mode.
108 if test "${LC_ALL+set}" = set; then
109 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
111 if test "${LANG+set}" = set; then
112 save_LANG="$LANG"; LANG=C; export LANG
115 # Make sure IFS has a sensible default
116 lt_nl='
118 IFS=" $lt_nl"
120 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
121 $echo "$modename: not configured to build any kind of library" 1>&2
122 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
123 exit $EXIT_FAILURE
126 # Global variables.
127 mode=$default_mode
128 nonopt=
129 prev=
130 prevopt=
131 run=
132 show="$echo"
133 show_help=
134 execute_dlfiles=
135 duplicate_deps=no
136 preserve_args=
137 lo2o="s/\\.lo\$/.${objext}/"
138 o2lo="s/\\.${objext}\$/.lo/"
140 #####################################
141 # Shell function definitions:
142 # This seems to be the best place for them
144 # func_mktempdir [string]
145 # Make a temporary directory that won't clash with other running
146 # libtool processes, and avoids race conditions if possible. If
147 # given, STRING is the basename for that directory.
148 func_mktempdir ()
150 my_template="${TMPDIR-/tmp}/${1-$progname}"
152 if test "$run" = ":"; then
153 # Return a directory name, but don't create it in dry-run mode
154 my_tmpdir="${my_template}-$$"
155 else
157 # If mktemp works, use that first and foremost
158 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
160 if test ! -d "$my_tmpdir"; then
161 # Failing that, at least try and use $RANDOM to avoid a race
162 my_tmpdir="${my_template}-${RANDOM-0}$$"
164 save_mktempdir_umask=`umask`
165 umask 0077
166 $mkdir "$my_tmpdir"
167 umask $save_mktempdir_umask
170 # If we're not in dry-run mode, bomb out on failure
171 test -d "$my_tmpdir" || {
172 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
173 exit $EXIT_FAILURE
177 $echo "X$my_tmpdir" | $Xsed
181 # func_win32_libid arg
182 # return the library type of file 'arg'
184 # Need a lot of goo to handle *both* DLLs and import libs
185 # Has to be a shell function in order to 'eat' the argument
186 # that is supplied when $file_magic_command is called.
187 func_win32_libid ()
189 win32_libid_type="unknown"
190 win32_fileres=`file -L $1 2>/dev/null`
191 case $win32_fileres in
192 *ar\ archive\ import\ library*) # definitely import
193 win32_libid_type="x86 archive import"
195 *ar\ archive*) # could be an import, or static
196 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
197 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
198 win32_nmres=`eval $NM -f posix -A $1 | \
199 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
200 case $win32_nmres in
201 import*) win32_libid_type="x86 archive import";;
202 *) win32_libid_type="x86 archive static";;
203 esac
206 *DLL*)
207 win32_libid_type="x86 DLL"
209 *executable*) # but shell scripts are "executable" too...
210 case $win32_fileres in
211 *MS\ Windows\ PE\ Intel*)
212 win32_libid_type="x86 DLL"
214 esac
216 esac
217 $echo $win32_libid_type
221 # func_infer_tag arg
222 # Infer tagged configuration to use if any are available and
223 # if one wasn't chosen via the "--tag" command line option.
224 # Only attempt this if the compiler in the base compile
225 # command doesn't match the default compiler.
226 # arg is usually of the form 'gcc ...'
227 func_infer_tag ()
229 if test -n "$available_tags" && test -z "$tagname"; then
230 CC_quoted=
231 for arg in $CC; do
232 case $arg in
233 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
234 arg="\"$arg\""
236 esac
237 CC_quoted="$CC_quoted $arg"
238 done
239 case $@ in
240 # Blanks in the command may have been stripped by the calling shell,
241 # but not from the CC environment variable when configure was run.
242 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
243 # Blanks at the start of $base_compile will cause this to fail
244 # if we don't check for them as well.
246 for z in $available_tags; do
247 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
248 # Evaluate the configuration.
249 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
250 CC_quoted=
251 for arg in $CC; do
252 # Double-quote args containing other shell metacharacters.
253 case $arg in
254 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
255 arg="\"$arg\""
257 esac
258 CC_quoted="$CC_quoted $arg"
259 done
260 case "$@ " in
261 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
262 # The compiler in the base compile command matches
263 # the one in the tagged configuration.
264 # Assume this is the tagged configuration we want.
265 tagname=$z
266 break
268 esac
270 done
271 # If $tagname still isn't set, then no tagged configuration
272 # was found and let the user know that the "--tag" command
273 # line option must be used.
274 if test -z "$tagname"; then
275 $echo "$modename: unable to infer tagged configuration"
276 $echo "$modename: specify a tag with \`--tag'" 1>&2
277 exit $EXIT_FAILURE
278 # else
279 # $echo "$modename: using $tagname tagged configuration"
282 esac
287 # func_extract_an_archive dir oldlib
288 func_extract_an_archive ()
290 f_ex_an_ar_dir="$1"; shift
291 f_ex_an_ar_oldlib="$1"
293 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
294 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
295 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
297 else
298 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
299 exit $EXIT_FAILURE
303 # func_extract_archives gentop oldlib ...
304 func_extract_archives ()
306 my_gentop="$1"; shift
307 my_oldlibs=${1+"$@"}
308 my_oldobjs=""
309 my_xlib=""
310 my_xabs=""
311 my_xdir=""
312 my_status=""
314 $show "${rm}r $my_gentop"
315 $run ${rm}r "$my_gentop"
316 $show "$mkdir $my_gentop"
317 $run $mkdir "$my_gentop"
318 my_status=$?
319 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
320 exit $my_status
323 for my_xlib in $my_oldlibs; do
324 # Extract the objects.
325 case $my_xlib in
326 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
327 *) my_xabs=`pwd`"/$my_xlib" ;;
328 esac
329 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
330 my_xdir="$my_gentop/$my_xlib"
332 $show "${rm}r $my_xdir"
333 $run ${rm}r "$my_xdir"
334 $show "$mkdir $my_xdir"
335 $run $mkdir "$my_xdir"
336 exit_status=$?
337 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
338 exit $exit_status
340 case $host in
341 *-darwin*)
342 $show "Extracting $my_xabs"
343 # Do not bother doing anything if just a dry run
344 if test -z "$run"; then
345 darwin_orig_dir=`pwd`
346 cd $my_xdir || exit $?
347 darwin_archive=$my_xabs
348 darwin_curdir=`pwd`
349 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
350 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
351 if test -n "$darwin_arches"; then
352 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
353 darwin_arch=
354 $show "$darwin_base_archive has multiple architectures $darwin_arches"
355 for darwin_arch in $darwin_arches ; do
356 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
357 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
358 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
360 cd "$darwin_curdir"
361 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
362 done # $darwin_arches
363 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
364 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
365 darwin_file=
366 darwin_files=
367 for darwin_file in $darwin_filelist; do
368 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
369 lipo -create -output "$darwin_file" $darwin_files
370 done # $darwin_filelist
371 ${rm}r unfat-$$
372 cd "$darwin_orig_dir"
373 else
374 cd "$darwin_orig_dir"
375 func_extract_an_archive "$my_xdir" "$my_xabs"
376 fi # $darwin_arches
377 fi # $run
380 func_extract_an_archive "$my_xdir" "$my_xabs"
382 esac
383 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
384 done
385 func_extract_archives_result="$my_oldobjs"
387 # End of Shell function definitions
388 #####################################
390 # Darwin sucks
391 eval std_shrext=\"$shrext_cmds\"
393 disable_libs=no
395 # Parse our command line options once, thoroughly.
396 while test "$#" -gt 0
398 arg="$1"
399 shift
401 case $arg in
402 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
403 *) optarg= ;;
404 esac
406 # If the previous option needs an argument, assign it.
407 if test -n "$prev"; then
408 case $prev in
409 execute_dlfiles)
410 execute_dlfiles="$execute_dlfiles $arg"
412 tag)
413 tagname="$arg"
414 preserve_args="${preserve_args}=$arg"
416 # Check whether tagname contains only valid characters
417 case $tagname in
418 *[!-_A-Za-z0-9,/]*)
419 $echo "$progname: invalid tag name: $tagname" 1>&2
420 exit $EXIT_FAILURE
422 esac
424 case $tagname in
426 # Don't test for the "default" C tag, as we know, it's there, but
427 # not specially marked.
430 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
431 taglist="$taglist $tagname"
432 # Evaluate the configuration.
433 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
434 else
435 $echo "$progname: ignoring unknown tag $tagname" 1>&2
438 esac
441 eval "$prev=\$arg"
443 esac
445 prev=
446 prevopt=
447 continue
450 # Have we seen a non-optional argument yet?
451 case $arg in
452 --help)
453 show_help=yes
456 --version)
457 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
458 $echo
459 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
460 $echo "This is free software; see the source for copying conditions. There is NO"
461 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
462 exit $?
465 --config)
466 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
467 # Now print the configurations for the tags.
468 for tagname in $taglist; do
469 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
470 done
471 exit $?
474 --debug)
475 $echo "$progname: enabling shell trace mode"
476 set -x
477 preserve_args="$preserve_args $arg"
480 --dry-run | -n)
481 run=:
484 --features)
485 $echo "host: $host"
486 if test "$build_libtool_libs" = yes; then
487 $echo "enable shared libraries"
488 else
489 $echo "disable shared libraries"
491 if test "$build_old_libs" = yes; then
492 $echo "enable static libraries"
493 else
494 $echo "disable static libraries"
496 exit $?
499 --finish) mode="finish" ;;
501 --mode) prevopt="--mode" prev=mode ;;
502 --mode=*) mode="$optarg" ;;
504 --preserve-dup-deps) duplicate_deps="yes" ;;
506 --quiet | --silent)
507 show=:
508 preserve_args="$preserve_args $arg"
511 --tag)
512 prevopt="--tag"
513 prev=tag
514 preserve_args="$preserve_args --tag"
516 --tag=*)
517 set tag "$optarg" ${1+"$@"}
518 shift
519 prev=tag
520 preserve_args="$preserve_args --tag"
523 -dlopen)
524 prevopt="-dlopen"
525 prev=execute_dlfiles
529 $echo "$modename: unrecognized option \`$arg'" 1>&2
530 $echo "$help" 1>&2
531 exit $EXIT_FAILURE
535 nonopt="$arg"
536 break
538 esac
539 done
541 if test -n "$prevopt"; then
542 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
543 $echo "$help" 1>&2
544 exit $EXIT_FAILURE
547 case $disable_libs in
548 no)
550 shared)
551 build_libtool_libs=no
552 build_old_libs=yes
554 static)
555 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
557 esac
559 # If this variable is set in any of the actions, the command in it
560 # will be execed at the end. This prevents here-documents from being
561 # left over by shells.
562 exec_cmd=
564 if test -z "$show_help"; then
566 # Infer the operation mode.
567 if test -z "$mode"; then
568 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
569 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
570 case $nonopt in
571 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
572 mode=link
573 for arg
575 case $arg in
577 mode=compile
578 break
580 esac
581 done
583 *db | *dbx | *strace | *truss)
584 mode=execute
586 *install*|cp|mv)
587 mode=install
589 *rm)
590 mode=uninstall
593 # If we have no mode, but dlfiles were specified, then do execute mode.
594 test -n "$execute_dlfiles" && mode=execute
596 # Just use the default operation mode.
597 if test -z "$mode"; then
598 if test -n "$nonopt"; then
599 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
600 else
601 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
605 esac
608 # Only execute mode is allowed to have -dlopen flags.
609 if test -n "$execute_dlfiles" && test "$mode" != execute; then
610 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
611 $echo "$help" 1>&2
612 exit $EXIT_FAILURE
615 # Change the help message to a mode-specific one.
616 generic_help="$help"
617 help="Try \`$modename --help --mode=$mode' for more information."
619 # These modes are in order of execution frequency so that they run quickly.
620 case $mode in
621 # libtool compile mode
622 compile)
623 modename="$modename: compile"
624 # Get the compilation command and the source file.
625 base_compile=
626 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
627 suppress_opt=yes
628 suppress_output=
629 arg_mode=normal
630 libobj=
631 later=
633 for arg
635 case $arg_mode in
636 arg )
637 # do not "continue". Instead, add this to base_compile
638 lastarg="$arg"
639 arg_mode=normal
642 target )
643 libobj="$arg"
644 arg_mode=normal
645 continue
648 normal )
649 # Accept any command-line options.
650 case $arg in
652 if test -n "$libobj" ; then
653 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
654 exit $EXIT_FAILURE
656 arg_mode=target
657 continue
660 -static | -prefer-pic | -prefer-non-pic)
661 later="$later $arg"
662 continue
665 -no-suppress)
666 suppress_opt=no
667 continue
670 -Xcompiler)
671 arg_mode=arg # the next one goes into the "base_compile" arg list
672 continue # The current "srcfile" will either be retained or
673 ;; # replaced later. I would guess that would be a bug.
675 -Wc,*)
676 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
677 lastarg=
678 save_ifs="$IFS"; IFS=','
679 for arg in $args; do
680 IFS="$save_ifs"
682 # Double-quote args containing other shell metacharacters.
683 # Many Bourne shells cannot handle close brackets correctly
684 # in scan sets, so we specify it separately.
685 case $arg in
686 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
687 arg="\"$arg\""
689 esac
690 lastarg="$lastarg $arg"
691 done
692 IFS="$save_ifs"
693 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
695 # Add the arguments to base_compile.
696 base_compile="$base_compile $lastarg"
697 continue
701 # Accept the current argument as the source file.
702 # The previous "srcfile" becomes the current argument.
704 lastarg="$srcfile"
705 srcfile="$arg"
707 esac # case $arg
709 esac # case $arg_mode
711 # Aesthetically quote the previous argument.
712 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
714 case $lastarg in
715 # Double-quote args containing other shell metacharacters.
716 # Many Bourne shells cannot handle close brackets correctly
717 # in scan sets, and some SunOS ksh mistreat backslash-escaping
718 # in scan sets (worked around with variable expansion),
719 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
720 # at all, so we specify them separately.
721 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
722 lastarg="\"$lastarg\""
724 esac
726 base_compile="$base_compile $lastarg"
727 done # for arg
729 case $arg_mode in
730 arg)
731 $echo "$modename: you must specify an argument for -Xcompile"
732 exit $EXIT_FAILURE
734 target)
735 $echo "$modename: you must specify a target with \`-o'" 1>&2
736 exit $EXIT_FAILURE
739 # Get the name of the library object.
740 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
742 esac
744 # Recognize several different file suffixes.
745 # If the user specifies -o file.o, it is replaced with file.lo
746 xform='[cCFSifmso]'
747 case $libobj in
748 *.ada) xform=ada ;;
749 *.adb) xform=adb ;;
750 *.ads) xform=ads ;;
751 *.asm) xform=asm ;;
752 *.c++) xform=c++ ;;
753 *.cc) xform=cc ;;
754 *.ii) xform=ii ;;
755 *.class) xform=class ;;
756 *.cpp) xform=cpp ;;
757 *.cxx) xform=cxx ;;
758 *.f90) xform=f90 ;;
759 *.for) xform=for ;;
760 *.java) xform=java ;;
761 esac
763 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
765 case $libobj in
766 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
768 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
769 exit $EXIT_FAILURE
771 esac
773 func_infer_tag $base_compile
775 for arg in $later; do
776 case $arg in
777 -static)
778 build_old_libs=yes
779 continue
782 -prefer-pic)
783 pic_mode=yes
784 continue
787 -prefer-non-pic)
788 pic_mode=no
789 continue
791 esac
792 done
794 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
795 case $qlibobj in
796 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
797 qlibobj="\"$qlibobj\"" ;;
798 esac
799 test "X$libobj" != "X$qlibobj" \
800 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
801 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
802 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
803 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
804 if test "X$xdir" = "X$obj"; then
805 xdir=
806 else
807 xdir=$xdir/
809 lobj=${xdir}$objdir/$objname
811 if test -z "$base_compile"; then
812 $echo "$modename: you must specify a compilation command" 1>&2
813 $echo "$help" 1>&2
814 exit $EXIT_FAILURE
817 # Delete any leftover library objects.
818 if test "$build_old_libs" = yes; then
819 removelist="$obj $lobj $libobj ${libobj}T"
820 else
821 removelist="$lobj $libobj ${libobj}T"
824 $run $rm $removelist
825 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
827 # On Cygwin there's no "real" PIC flag so we must build both object types
828 case $host_os in
829 cygwin* | mingw* | pw32* | os2*)
830 pic_mode=default
832 esac
833 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
834 # non-PIC code in shared libraries is not supported
835 pic_mode=default
838 # Calculate the filename of the output object if compiler does
839 # not support -o with -c
840 if test "$compiler_c_o" = no; then
841 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
842 lockfile="$output_obj.lock"
843 removelist="$removelist $output_obj $lockfile"
844 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
845 else
846 output_obj=
847 need_locks=no
848 lockfile=
851 # Lock this critical section if it is needed
852 # We use this script file to make the link, it avoids creating a new file
853 if test "$need_locks" = yes; then
854 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
855 $show "Waiting for $lockfile to be removed"
856 sleep 2
857 done
858 elif test "$need_locks" = warn; then
859 if test -f "$lockfile"; then
860 $echo "\
861 *** ERROR, $lockfile exists and contains:
862 `cat $lockfile 2>/dev/null`
864 This indicates that another process is trying to use the same
865 temporary object file, and libtool could not work around it because
866 your compiler does not support \`-c' and \`-o' together. If you
867 repeat this compilation, it may succeed, by chance, but you had better
868 avoid parallel builds (make -j) in this platform, or get a better
869 compiler."
871 $run $rm $removelist
872 exit $EXIT_FAILURE
874 $echo "$srcfile" > "$lockfile"
877 if test -n "$fix_srcfile_path"; then
878 eval srcfile=\"$fix_srcfile_path\"
880 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
881 case $qsrcfile in
882 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
883 qsrcfile="\"$qsrcfile\"" ;;
884 esac
886 $run $rm "$libobj" "${libobj}T"
888 # Create a libtool object file (analogous to a ".la" file),
889 # but don't create it if we're doing a dry run.
890 test -z "$run" && cat > ${libobj}T <<EOF
891 # $libobj - a libtool object file
892 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
894 # Please DO NOT delete this file!
895 # It is necessary for linking the library.
897 # Name of the PIC object.
900 # Only build a PIC object if we are building libtool libraries.
901 if test "$build_libtool_libs" = yes; then
902 # Without this assignment, base_compile gets emptied.
903 fbsd_hideous_sh_bug=$base_compile
905 if test "$pic_mode" != no; then
906 command="$base_compile $qsrcfile $pic_flag"
907 else
908 # Don't build PIC code
909 command="$base_compile $qsrcfile"
912 if test ! -d "${xdir}$objdir"; then
913 $show "$mkdir ${xdir}$objdir"
914 $run $mkdir ${xdir}$objdir
915 exit_status=$?
916 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
917 exit $exit_status
921 if test -z "$output_obj"; then
922 # Place PIC objects in $objdir
923 command="$command -o $lobj"
926 $run $rm "$lobj" "$output_obj"
928 $show "$command"
929 if $run eval "$command"; then :
930 else
931 test -n "$output_obj" && $run $rm $removelist
932 exit $EXIT_FAILURE
935 if test "$need_locks" = warn &&
936 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
937 $echo "\
938 *** ERROR, $lockfile contains:
939 `cat $lockfile 2>/dev/null`
941 but it should contain:
942 $srcfile
944 This indicates that another process is trying to use the same
945 temporary object file, and libtool could not work around it because
946 your compiler does not support \`-c' and \`-o' together. If you
947 repeat this compilation, it may succeed, by chance, but you had better
948 avoid parallel builds (make -j) in this platform, or get a better
949 compiler."
951 $run $rm $removelist
952 exit $EXIT_FAILURE
955 # Just move the object if needed, then go on to compile the next one
956 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
957 $show "$mv $output_obj $lobj"
958 if $run $mv $output_obj $lobj; then :
959 else
960 error=$?
961 $run $rm $removelist
962 exit $error
966 # Append the name of the PIC object to the libtool object file.
967 test -z "$run" && cat >> ${libobj}T <<EOF
968 pic_object='$objdir/$objname'
972 # Allow error messages only from the first compilation.
973 if test "$suppress_opt" = yes; then
974 suppress_output=' >/dev/null 2>&1'
976 else
977 # No PIC object so indicate it doesn't exist in the libtool
978 # object file.
979 test -z "$run" && cat >> ${libobj}T <<EOF
980 pic_object=none
985 # Only build a position-dependent object if we build old libraries.
986 if test "$build_old_libs" = yes; then
987 if test "$pic_mode" != yes; then
988 # Don't build PIC code
989 command="$base_compile $qsrcfile"
990 else
991 command="$base_compile $qsrcfile $pic_flag"
993 if test "$compiler_c_o" = yes; then
994 command="$command -o $obj"
997 # Suppress compiler output if we already did a PIC compilation.
998 command="$command$suppress_output"
999 $run $rm "$obj" "$output_obj"
1000 $show "$command"
1001 if $run eval "$command"; then :
1002 else
1003 $run $rm $removelist
1004 exit $EXIT_FAILURE
1007 if test "$need_locks" = warn &&
1008 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1009 $echo "\
1010 *** ERROR, $lockfile contains:
1011 `cat $lockfile 2>/dev/null`
1013 but it should contain:
1014 $srcfile
1016 This indicates that another process is trying to use the same
1017 temporary object file, and libtool could not work around it because
1018 your compiler does not support \`-c' and \`-o' together. If you
1019 repeat this compilation, it may succeed, by chance, but you had better
1020 avoid parallel builds (make -j) in this platform, or get a better
1021 compiler."
1023 $run $rm $removelist
1024 exit $EXIT_FAILURE
1027 # Just move the object if needed
1028 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1029 $show "$mv $output_obj $obj"
1030 if $run $mv $output_obj $obj; then :
1031 else
1032 error=$?
1033 $run $rm $removelist
1034 exit $error
1038 # Append the name of the non-PIC object the libtool object file.
1039 # Only append if the libtool object file exists.
1040 test -z "$run" && cat >> ${libobj}T <<EOF
1041 # Name of the non-PIC object.
1042 non_pic_object='$objname'
1045 else
1046 # Append the name of the non-PIC object the libtool object file.
1047 # Only append if the libtool object file exists.
1048 test -z "$run" && cat >> ${libobj}T <<EOF
1049 # Name of the non-PIC object.
1050 non_pic_object=none
1055 $run $mv "${libobj}T" "${libobj}"
1057 # Unlock the critical section if it was locked
1058 if test "$need_locks" != no; then
1059 $run $rm "$lockfile"
1062 exit $EXIT_SUCCESS
1065 # libtool link mode
1066 link | relink)
1067 modename="$modename: link"
1068 case $host in
1069 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1070 # It is impossible to link a dll without this setting, and
1071 # we shouldn't force the makefile maintainer to figure out
1072 # which system we are compiling for in order to pass an extra
1073 # flag for every libtool invocation.
1074 # allow_undefined=no
1076 # FIXME: Unfortunately, there are problems with the above when trying
1077 # to make a dll which has undefined symbols, in which case not
1078 # even a static library is built. For now, we need to specify
1079 # -no-undefined on the libtool link line when we can be certain
1080 # that all symbols are satisfied, otherwise we get a static library.
1081 allow_undefined=yes
1084 allow_undefined=yes
1086 esac
1087 libtool_args="$nonopt"
1088 base_compile="$nonopt $@"
1089 compile_command="$nonopt"
1090 finalize_command="$nonopt"
1092 compile_rpath=
1093 finalize_rpath=
1094 compile_shlibpath=
1095 finalize_shlibpath=
1096 convenience=
1097 old_convenience=
1098 deplibs=
1099 old_deplibs=
1100 compiler_flags=
1101 linker_flags=
1102 dllsearchpath=
1103 lib_search_path=`pwd`
1104 inst_prefix_dir=
1106 avoid_version=no
1107 dlfiles=
1108 dlprefiles=
1109 dlself=no
1110 export_dynamic=no
1111 export_symbols=
1112 export_symbols_regex=
1113 generated=
1114 libobjs=
1115 ltlibs=
1116 module=no
1117 no_install=no
1118 objs=
1119 non_pic_objects=
1120 notinst_path= # paths that contain not-installed libtool libraries
1121 precious_files_regex=
1122 prefer_static_libs=no
1123 preload=no
1124 prev=
1125 prevarg=
1126 release=
1127 rpath=
1128 xrpath=
1129 perm_rpath=
1130 temp_rpath=
1131 thread_safe=no
1132 vinfo=
1133 vinfo_number=no
1135 func_infer_tag $base_compile
1137 # We need to know -static, to get the right output filenames.
1138 for arg
1140 case $arg in
1141 -all-static | -static)
1142 if test "X$arg" = "X-all-static"; then
1143 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1144 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1146 if test -n "$link_static_flag"; then
1147 dlopen_self=$dlopen_self_static
1149 prefer_static_libs=yes
1150 else
1151 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1152 dlopen_self=$dlopen_self_static
1154 prefer_static_libs=built
1156 build_libtool_libs=no
1157 build_old_libs=yes
1158 break
1160 esac
1161 done
1163 # See if our shared archives depend on static archives.
1164 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1166 # Go through the arguments, transforming them on the way.
1167 while test "$#" -gt 0; do
1168 arg="$1"
1169 shift
1170 case $arg in
1171 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1172 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1174 *) qarg=$arg ;;
1175 esac
1176 libtool_args="$libtool_args $qarg"
1178 # If the previous option needs an argument, assign it.
1179 if test -n "$prev"; then
1180 case $prev in
1181 output)
1182 compile_command="$compile_command @OUTPUT@"
1183 finalize_command="$finalize_command @OUTPUT@"
1185 esac
1187 case $prev in
1188 dlfiles|dlprefiles)
1189 if test "$preload" = no; then
1190 # Add the symbol object into the linking commands.
1191 compile_command="$compile_command @SYMFILE@"
1192 finalize_command="$finalize_command @SYMFILE@"
1193 preload=yes
1195 case $arg in
1196 *.la | *.lo) ;; # We handle these cases below.
1197 force)
1198 if test "$dlself" = no; then
1199 dlself=needless
1200 export_dynamic=yes
1202 prev=
1203 continue
1205 self)
1206 if test "$prev" = dlprefiles; then
1207 dlself=yes
1208 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1209 dlself=yes
1210 else
1211 dlself=needless
1212 export_dynamic=yes
1214 prev=
1215 continue
1218 if test "$prev" = dlfiles; then
1219 dlfiles="$dlfiles $arg"
1220 else
1221 dlprefiles="$dlprefiles $arg"
1223 prev=
1224 continue
1226 esac
1228 expsyms)
1229 export_symbols="$arg"
1230 if test ! -f "$arg"; then
1231 $echo "$modename: symbol file \`$arg' does not exist"
1232 exit $EXIT_FAILURE
1234 prev=
1235 continue
1237 expsyms_regex)
1238 export_symbols_regex="$arg"
1239 prev=
1240 continue
1242 inst_prefix)
1243 inst_prefix_dir="$arg"
1244 prev=
1245 continue
1247 precious_regex)
1248 precious_files_regex="$arg"
1249 prev=
1250 continue
1252 release)
1253 release="-$arg"
1254 prev=
1255 continue
1257 objectlist)
1258 if test -f "$arg"; then
1259 save_arg=$arg
1260 moreargs=
1261 for fil in `cat $save_arg`
1263 # moreargs="$moreargs $fil"
1264 arg=$fil
1265 # A libtool-controlled object.
1267 # Check to see that this really is a libtool object.
1268 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1269 pic_object=
1270 non_pic_object=
1272 # Read the .lo file
1273 # If there is no directory component, then add one.
1274 case $arg in
1275 */* | *\\*) . $arg ;;
1276 *) . ./$arg ;;
1277 esac
1279 if test -z "$pic_object" || \
1280 test -z "$non_pic_object" ||
1281 test "$pic_object" = none && \
1282 test "$non_pic_object" = none; then
1283 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1284 exit $EXIT_FAILURE
1287 # Extract subdirectory from the argument.
1288 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1289 if test "X$xdir" = "X$arg"; then
1290 xdir=
1291 else
1292 xdir="$xdir/"
1295 if test "$pic_object" != none; then
1296 # Prepend the subdirectory the object is found in.
1297 pic_object="$xdir$pic_object"
1299 if test "$prev" = dlfiles; then
1300 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1301 dlfiles="$dlfiles $pic_object"
1302 prev=
1303 continue
1304 else
1305 # If libtool objects are unsupported, then we need to preload.
1306 prev=dlprefiles
1310 # CHECK ME: I think I busted this. -Ossama
1311 if test "$prev" = dlprefiles; then
1312 # Preload the old-style object.
1313 dlprefiles="$dlprefiles $pic_object"
1314 prev=
1317 # A PIC object.
1318 libobjs="$libobjs $pic_object"
1319 arg="$pic_object"
1322 # Non-PIC object.
1323 if test "$non_pic_object" != none; then
1324 # Prepend the subdirectory the object is found in.
1325 non_pic_object="$xdir$non_pic_object"
1327 # A standard non-PIC object
1328 non_pic_objects="$non_pic_objects $non_pic_object"
1329 if test -z "$pic_object" || test "$pic_object" = none ; then
1330 arg="$non_pic_object"
1332 else
1333 # If the PIC object exists, use it instead.
1334 # $xdir was prepended to $pic_object above.
1335 non_pic_object="$pic_object"
1336 non_pic_objects="$non_pic_objects $non_pic_object"
1338 else
1339 # Only an error if not doing a dry-run.
1340 if test -z "$run"; then
1341 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1342 exit $EXIT_FAILURE
1343 else
1344 # Dry-run case.
1346 # Extract subdirectory from the argument.
1347 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1348 if test "X$xdir" = "X$arg"; then
1349 xdir=
1350 else
1351 xdir="$xdir/"
1354 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1355 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1356 libobjs="$libobjs $pic_object"
1357 non_pic_objects="$non_pic_objects $non_pic_object"
1360 done
1361 else
1362 $echo "$modename: link input file \`$save_arg' does not exist"
1363 exit $EXIT_FAILURE
1365 arg=$save_arg
1366 prev=
1367 continue
1369 rpath | xrpath)
1370 # We need an absolute path.
1371 case $arg in
1372 [\\/]* | [A-Za-z]:[\\/]*) ;;
1374 $echo "$modename: only absolute run-paths are allowed" 1>&2
1375 exit $EXIT_FAILURE
1377 esac
1378 if test "$prev" = rpath; then
1379 case "$rpath " in
1380 *" $arg "*) ;;
1381 *) rpath="$rpath $arg" ;;
1382 esac
1383 else
1384 case "$xrpath " in
1385 *" $arg "*) ;;
1386 *) xrpath="$xrpath $arg" ;;
1387 esac
1389 prev=
1390 continue
1392 xcompiler)
1393 compiler_flags="$compiler_flags $qarg"
1394 prev=
1395 compile_command="$compile_command $qarg"
1396 finalize_command="$finalize_command $qarg"
1397 continue
1399 xlinker)
1400 linker_flags="$linker_flags $qarg"
1401 compiler_flags="$compiler_flags $wl$qarg"
1402 prev=
1403 compile_command="$compile_command $wl$qarg"
1404 finalize_command="$finalize_command $wl$qarg"
1405 continue
1407 xcclinker)
1408 linker_flags="$linker_flags $qarg"
1409 compiler_flags="$compiler_flags $qarg"
1410 prev=
1411 compile_command="$compile_command $qarg"
1412 finalize_command="$finalize_command $qarg"
1413 continue
1415 shrext)
1416 shrext_cmds="$arg"
1417 prev=
1418 continue
1420 darwin_framework|darwin_framework_skip)
1421 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1422 compile_command="$compile_command $arg"
1423 finalize_command="$finalize_command $arg"
1424 prev=
1425 continue
1428 eval "$prev=\"\$arg\""
1429 prev=
1430 continue
1432 esac
1433 fi # test -n "$prev"
1435 prevarg="$arg"
1437 case $arg in
1438 -all-static)
1439 if test -n "$link_static_flag"; then
1440 compile_command="$compile_command $link_static_flag"
1441 finalize_command="$finalize_command $link_static_flag"
1443 continue
1446 -allow-undefined)
1447 # FIXME: remove this flag sometime in the future.
1448 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1449 continue
1452 -avoid-version)
1453 avoid_version=yes
1454 continue
1457 -dlopen)
1458 prev=dlfiles
1459 continue
1462 -dlpreopen)
1463 prev=dlprefiles
1464 continue
1467 -export-dynamic)
1468 export_dynamic=yes
1469 continue
1472 -export-symbols | -export-symbols-regex)
1473 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1474 $echo "$modename: more than one -exported-symbols argument is not allowed"
1475 exit $EXIT_FAILURE
1477 if test "X$arg" = "X-export-symbols"; then
1478 prev=expsyms
1479 else
1480 prev=expsyms_regex
1482 continue
1485 -framework|-arch|-isysroot)
1486 case " $CC " in
1487 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1488 prev=darwin_framework_skip ;;
1489 *) compiler_flags="$compiler_flags $arg"
1490 prev=darwin_framework ;;
1491 esac
1492 compile_command="$compile_command $arg"
1493 finalize_command="$finalize_command $arg"
1494 continue
1497 -inst-prefix-dir)
1498 prev=inst_prefix
1499 continue
1502 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1503 # so, if we see these flags be careful not to treat them like -L
1504 -L[A-Z][A-Z]*:*)
1505 case $with_gcc/$host in
1506 no/*-*-irix* | /*-*-irix*)
1507 compile_command="$compile_command $arg"
1508 finalize_command="$finalize_command $arg"
1510 esac
1511 continue
1514 -L*)
1515 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1516 # We need an absolute path.
1517 case $dir in
1518 [\\/]* | [A-Za-z]:[\\/]*) ;;
1520 absdir=`cd "$dir" && pwd`
1521 if test -z "$absdir"; then
1522 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1523 absdir="$dir"
1524 notinst_path="$notinst_path $dir"
1526 dir="$absdir"
1528 esac
1529 case "$deplibs " in
1530 *" -L$dir "*) ;;
1532 deplibs="$deplibs -L$dir"
1533 lib_search_path="$lib_search_path $dir"
1535 esac
1536 case $host in
1537 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1538 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1539 case :$dllsearchpath: in
1540 *":$dir:"*) ;;
1541 *) dllsearchpath="$dllsearchpath:$dir";;
1542 esac
1543 case :$dllsearchpath: in
1544 *":$testbindir:"*) ;;
1545 *) dllsearchpath="$dllsearchpath:$testbindir";;
1546 esac
1548 esac
1549 continue
1552 -l*)
1553 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1554 case $host in
1555 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1556 # These systems don't actually have a C or math library (as such)
1557 continue
1559 *-*-os2*)
1560 # These systems don't actually have a C library (as such)
1561 test "X$arg" = "X-lc" && continue
1563 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1564 # Do not include libc due to us having libc/libc_r.
1565 test "X$arg" = "X-lc" && continue
1567 *-*-rhapsody* | *-*-darwin1.[012])
1568 # Rhapsody C and math libraries are in the System framework
1569 deplibs="$deplibs -framework System"
1570 continue
1572 *-*-sco3.2v5* | *-*-sco5v6*)
1573 # Causes problems with __ctype
1574 test "X$arg" = "X-lc" && continue
1576 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1577 # Compiler inserts libc in the correct place for threads to work
1578 test "X$arg" = "X-lc" && continue
1580 esac
1581 elif test "X$arg" = "X-lc_r"; then
1582 case $host in
1583 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1584 # Do not include libc_r directly, use -pthread flag.
1585 continue
1587 esac
1589 deplibs="$deplibs $arg"
1590 continue
1593 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1594 # classes, name mangling, and exception handling.
1595 -model)
1596 compile_command="$compile_command $arg"
1597 compiler_flags="$compiler_flags $arg"
1598 finalize_command="$finalize_command $arg"
1599 prev=xcompiler
1600 continue
1603 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1604 compiler_flags="$compiler_flags $arg"
1605 compile_command="$compile_command $arg"
1606 finalize_command="$finalize_command $arg"
1607 continue
1610 -module)
1611 module=yes
1612 continue
1615 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1616 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1617 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1618 # +DA*, +DD* enable 64-bit mode on the HP compiler
1619 # -q* pass through compiler args for the IBM compiler
1620 # -m* pass through architecture-specific compiler args for GCC
1621 # -m*, -t[45]*, -txscale* pass through architecture-specific
1622 # compiler args for GCC
1623 # -pg pass through profiling flag for GCC
1624 # @file GCC response files
1625 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1626 -t[45]*|-txscale*|@*)
1628 # Unknown arguments in both finalize_command and compile_command need
1629 # to be aesthetically quoted because they are evaled later.
1630 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1631 case $arg in
1632 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1633 arg="\"$arg\""
1635 esac
1636 compile_command="$compile_command $arg"
1637 finalize_command="$finalize_command $arg"
1638 compiler_flags="$compiler_flags $arg"
1639 continue
1642 -shrext)
1643 prev=shrext
1644 continue
1647 -no-fast-install)
1648 fast_install=no
1649 continue
1652 -no-install)
1653 case $host in
1654 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1655 # The PATH hackery in wrapper scripts is required on Windows
1656 # in order for the loader to find any dlls it needs.
1657 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1658 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1659 fast_install=no
1661 *) no_install=yes ;;
1662 esac
1663 continue
1666 -no-undefined)
1667 allow_undefined=no
1668 continue
1671 -objectlist)
1672 prev=objectlist
1673 continue
1676 -o) prev=output ;;
1678 -precious-files-regex)
1679 prev=precious_regex
1680 continue
1683 -release)
1684 prev=release
1685 continue
1688 -rpath)
1689 prev=rpath
1690 continue
1694 prev=xrpath
1695 continue
1698 -R*)
1699 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1700 # We need an absolute path.
1701 case $dir in
1702 [\\/]* | [A-Za-z]:[\\/]*) ;;
1704 $echo "$modename: only absolute run-paths are allowed" 1>&2
1705 exit $EXIT_FAILURE
1707 esac
1708 case "$xrpath " in
1709 *" $dir "*) ;;
1710 *) xrpath="$xrpath $dir" ;;
1711 esac
1712 continue
1715 -static)
1716 # The effects of -static are defined in a previous loop.
1717 # We used to do the same as -all-static on platforms that
1718 # didn't have a PIC flag, but the assumption that the effects
1719 # would be equivalent was wrong. It would break on at least
1720 # Digital Unix and AIX.
1721 continue
1724 -thread-safe)
1725 thread_safe=yes
1726 continue
1729 -version-info)
1730 prev=vinfo
1731 continue
1733 -version-number)
1734 prev=vinfo
1735 vinfo_number=yes
1736 continue
1739 -Wc,*)
1740 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1741 arg=
1742 save_ifs="$IFS"; IFS=','
1743 for flag in $args; do
1744 IFS="$save_ifs"
1745 case $flag in
1746 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1747 flag="\"$flag\""
1749 esac
1750 arg="$arg $wl$flag"
1751 compiler_flags="$compiler_flags $flag"
1752 done
1753 IFS="$save_ifs"
1754 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1757 -Wl,*)
1758 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1759 arg=
1760 save_ifs="$IFS"; IFS=','
1761 for flag in $args; do
1762 IFS="$save_ifs"
1763 case $flag in
1764 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1765 flag="\"$flag\""
1767 esac
1768 arg="$arg $wl$flag"
1769 compiler_flags="$compiler_flags $wl$flag"
1770 linker_flags="$linker_flags $flag"
1771 done
1772 IFS="$save_ifs"
1773 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1776 -Xcompiler)
1777 prev=xcompiler
1778 continue
1781 -Xlinker)
1782 prev=xlinker
1783 continue
1786 -XCClinker)
1787 prev=xcclinker
1788 continue
1791 # Some other compiler flag.
1792 -* | +*)
1793 # Unknown arguments in both finalize_command and compile_command need
1794 # to be aesthetically quoted because they are evaled later.
1795 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1796 case $arg in
1797 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1798 arg="\"$arg\""
1800 esac
1803 *.$objext)
1804 # A standard object.
1805 objs="$objs $arg"
1808 *.lo)
1809 # A libtool-controlled object.
1811 # Check to see that this really is a libtool object.
1812 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1813 pic_object=
1814 non_pic_object=
1816 # Read the .lo file
1817 # If there is no directory component, then add one.
1818 case $arg in
1819 */* | *\\*) . $arg ;;
1820 *) . ./$arg ;;
1821 esac
1823 if test -z "$pic_object" || \
1824 test -z "$non_pic_object" ||
1825 test "$pic_object" = none && \
1826 test "$non_pic_object" = none; then
1827 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1828 exit $EXIT_FAILURE
1831 # Extract subdirectory from the argument.
1832 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1833 if test "X$xdir" = "X$arg"; then
1834 xdir=
1835 else
1836 xdir="$xdir/"
1839 if test "$pic_object" != none; then
1840 # Prepend the subdirectory the object is found in.
1841 pic_object="$xdir$pic_object"
1843 if test "$prev" = dlfiles; then
1844 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1845 dlfiles="$dlfiles $pic_object"
1846 prev=
1847 continue
1848 else
1849 # If libtool objects are unsupported, then we need to preload.
1850 prev=dlprefiles
1854 # CHECK ME: I think I busted this. -Ossama
1855 if test "$prev" = dlprefiles; then
1856 # Preload the old-style object.
1857 dlprefiles="$dlprefiles $pic_object"
1858 prev=
1861 # A PIC object.
1862 libobjs="$libobjs $pic_object"
1863 arg="$pic_object"
1866 # Non-PIC object.
1867 if test "$non_pic_object" != none; then
1868 # Prepend the subdirectory the object is found in.
1869 non_pic_object="$xdir$non_pic_object"
1871 # A standard non-PIC object
1872 non_pic_objects="$non_pic_objects $non_pic_object"
1873 if test -z "$pic_object" || test "$pic_object" = none ; then
1874 arg="$non_pic_object"
1876 else
1877 # If the PIC object exists, use it instead.
1878 # $xdir was prepended to $pic_object above.
1879 non_pic_object="$pic_object"
1880 non_pic_objects="$non_pic_objects $non_pic_object"
1882 else
1883 # Only an error if not doing a dry-run.
1884 if test -z "$run"; then
1885 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1886 exit $EXIT_FAILURE
1887 else
1888 # Dry-run case.
1890 # Extract subdirectory from the argument.
1891 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1892 if test "X$xdir" = "X$arg"; then
1893 xdir=
1894 else
1895 xdir="$xdir/"
1898 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1899 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1900 libobjs="$libobjs $pic_object"
1901 non_pic_objects="$non_pic_objects $non_pic_object"
1906 *.$libext)
1907 # An archive.
1908 deplibs="$deplibs $arg"
1909 old_deplibs="$old_deplibs $arg"
1910 continue
1913 *.la)
1914 # A libtool-controlled library.
1916 if test "$prev" = dlfiles; then
1917 # This library was specified with -dlopen.
1918 dlfiles="$dlfiles $arg"
1919 prev=
1920 elif test "$prev" = dlprefiles; then
1921 # The library was specified with -dlpreopen.
1922 dlprefiles="$dlprefiles $arg"
1923 prev=
1924 else
1925 deplibs="$deplibs $arg"
1927 continue
1930 # Some other compiler argument.
1932 # Unknown arguments in both finalize_command and compile_command need
1933 # to be aesthetically quoted because they are evaled later.
1934 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1935 case $arg in
1936 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1937 arg="\"$arg\""
1939 esac
1941 esac # arg
1943 # Now actually substitute the argument into the commands.
1944 if test -n "$arg"; then
1945 compile_command="$compile_command $arg"
1946 finalize_command="$finalize_command $arg"
1948 done # argument parsing loop
1950 if test -n "$prev"; then
1951 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1952 $echo "$help" 1>&2
1953 exit $EXIT_FAILURE
1956 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1957 eval arg=\"$export_dynamic_flag_spec\"
1958 compile_command="$compile_command $arg"
1959 finalize_command="$finalize_command $arg"
1962 oldlibs=
1963 # calculate the name of the file, without its directory
1964 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1965 libobjs_save="$libobjs"
1967 if test -n "$shlibpath_var"; then
1968 # get the directories listed in $shlibpath_var
1969 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1970 else
1971 shlib_search_path=
1973 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1974 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1976 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1977 if test "X$output_objdir" = "X$output"; then
1978 output_objdir="$objdir"
1979 else
1980 output_objdir="$output_objdir/$objdir"
1982 # Create the object directory.
1983 if test ! -d "$output_objdir"; then
1984 $show "$mkdir $output_objdir"
1985 $run $mkdir $output_objdir
1986 exit_status=$?
1987 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1988 exit $exit_status
1992 # Determine the type of output
1993 case $output in
1995 $echo "$modename: you must specify an output file" 1>&2
1996 $echo "$help" 1>&2
1997 exit $EXIT_FAILURE
1999 *.$libext) linkmode=oldlib ;;
2000 *.lo | *.$objext) linkmode=obj ;;
2001 *.la) linkmode=lib ;;
2002 *) linkmode=prog ;; # Anything else should be a program.
2003 esac
2005 case $host in
2006 *cygwin* | *mingw* | *pw32*)
2007 # don't eliminate duplications in $postdeps and $predeps
2008 duplicate_compiler_generated_deps=yes
2011 duplicate_compiler_generated_deps=$duplicate_deps
2013 esac
2014 specialdeplibs=
2016 libs=
2017 # Find all interdependent deplibs by searching for libraries
2018 # that are linked more than once (e.g. -la -lb -la)
2019 for deplib in $deplibs; do
2020 if test "X$duplicate_deps" = "Xyes" ; then
2021 case "$libs " in
2022 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2023 esac
2025 libs="$libs $deplib"
2026 done
2028 if test "$linkmode" = lib; then
2029 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2031 # Compute libraries that are listed more than once in $predeps
2032 # $postdeps and mark them as special (i.e., whose duplicates are
2033 # not to be eliminated).
2034 pre_post_deps=
2035 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2036 for pre_post_dep in $predeps $postdeps; do
2037 case "$pre_post_deps " in
2038 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2039 esac
2040 pre_post_deps="$pre_post_deps $pre_post_dep"
2041 done
2043 pre_post_deps=
2046 deplibs=
2047 newdependency_libs=
2048 newlib_search_path=
2049 need_relink=no # whether we're linking any uninstalled libtool libraries
2050 notinst_deplibs= # not-installed libtool libraries
2051 case $linkmode in
2052 lib)
2053 passes="conv link"
2054 for file in $dlfiles $dlprefiles; do
2055 case $file in
2056 *.la) ;;
2058 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2059 exit $EXIT_FAILURE
2061 esac
2062 done
2064 prog)
2065 compile_deplibs=
2066 finalize_deplibs=
2067 alldeplibs=no
2068 newdlfiles=
2069 newdlprefiles=
2070 passes="conv scan dlopen dlpreopen link"
2072 *) passes="conv"
2074 esac
2075 for pass in $passes; do
2076 if test "$linkmode,$pass" = "lib,link" ||
2077 test "$linkmode,$pass" = "prog,scan"; then
2078 libs="$deplibs"
2079 deplibs=
2081 if test "$linkmode" = prog; then
2082 case $pass in
2083 dlopen) libs="$dlfiles" ;;
2084 dlpreopen) libs="$dlprefiles" ;;
2085 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2086 esac
2088 if test "$pass" = dlopen; then
2089 # Collect dlpreopened libraries
2090 save_deplibs="$deplibs"
2091 deplibs=
2093 for deplib in $libs; do
2094 lib=
2095 found=no
2096 case $deplib in
2097 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2098 if test "$linkmode,$pass" = "prog,link"; then
2099 compile_deplibs="$deplib $compile_deplibs"
2100 finalize_deplibs="$deplib $finalize_deplibs"
2101 else
2102 compiler_flags="$compiler_flags $deplib"
2104 continue
2106 -l*)
2107 if test "$linkmode" != lib && test "$linkmode" != prog; then
2108 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2109 continue
2111 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2112 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2113 for search_ext in .la $std_shrext .so .a; do
2114 # Search the libtool library
2115 lib="$searchdir/lib${name}${search_ext}"
2116 if test -f "$lib"; then
2117 if test "$search_ext" = ".la"; then
2118 found=yes
2119 else
2120 found=no
2122 break 2
2124 done
2125 done
2126 if test "$found" != yes; then
2127 # deplib doesn't seem to be a libtool library
2128 if test "$linkmode,$pass" = "prog,link"; then
2129 compile_deplibs="$deplib $compile_deplibs"
2130 finalize_deplibs="$deplib $finalize_deplibs"
2131 else
2132 deplibs="$deplib $deplibs"
2133 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2135 continue
2136 else # deplib is a libtool library
2137 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2138 # We need to do some special things here, and not later.
2139 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2140 case " $predeps $postdeps " in
2141 *" $deplib "*)
2142 if (${SED} -e '2q' $lib |
2143 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2144 library_names=
2145 old_library=
2146 case $lib in
2147 */* | *\\*) . $lib ;;
2148 *) . ./$lib ;;
2149 esac
2150 for l in $old_library $library_names; do
2151 ll="$l"
2152 done
2153 if test "X$ll" = "X$old_library" ; then # only static version available
2154 found=no
2155 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2156 test "X$ladir" = "X$lib" && ladir="."
2157 lib=$ladir/$old_library
2158 if test "$linkmode,$pass" = "prog,link"; then
2159 compile_deplibs="$deplib $compile_deplibs"
2160 finalize_deplibs="$deplib $finalize_deplibs"
2161 else
2162 deplibs="$deplib $deplibs"
2163 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2165 continue
2169 *) ;;
2170 esac
2173 ;; # -l
2174 -L*)
2175 case $linkmode in
2176 lib)
2177 deplibs="$deplib $deplibs"
2178 test "$pass" = conv && continue
2179 newdependency_libs="$deplib $newdependency_libs"
2180 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2182 prog)
2183 if test "$pass" = conv; then
2184 deplibs="$deplib $deplibs"
2185 continue
2187 if test "$pass" = scan; then
2188 deplibs="$deplib $deplibs"
2189 else
2190 compile_deplibs="$deplib $compile_deplibs"
2191 finalize_deplibs="$deplib $finalize_deplibs"
2193 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2196 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2198 esac # linkmode
2199 continue
2200 ;; # -L
2201 -R*)
2202 if test "$pass" = link; then
2203 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2204 # Make sure the xrpath contains only unique directories.
2205 case "$xrpath " in
2206 *" $dir "*) ;;
2207 *) xrpath="$xrpath $dir" ;;
2208 esac
2210 deplibs="$deplib $deplibs"
2211 continue
2213 *.la) lib="$deplib" ;;
2214 *.$libext)
2215 if test "$pass" = conv; then
2216 deplibs="$deplib $deplibs"
2217 continue
2219 case $linkmode in
2220 lib)
2221 valid_a_lib=no
2222 case $deplibs_check_method in
2223 match_pattern*)
2224 set dummy $deplibs_check_method
2225 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2226 if eval $echo \"$deplib\" 2>/dev/null \
2227 | $SED 10q \
2228 | $EGREP "$match_pattern_regex" > /dev/null; then
2229 valid_a_lib=yes
2232 pass_all)
2233 valid_a_lib=yes
2235 esac
2236 if test "$valid_a_lib" != yes; then
2237 $echo
2238 $echo "*** Warning: Trying to link with static lib archive $deplib."
2239 $echo "*** I have the capability to make that library automatically link in when"
2240 $echo "*** you link to this library. But I can only do this if you have a"
2241 $echo "*** shared version of the library, which you do not appear to have"
2242 $echo "*** because the file extensions .$libext of this argument makes me believe"
2243 $echo "*** that it is just a static archive that I should not used here."
2244 else
2245 $echo
2246 $echo "*** Warning: Linking the shared library $output against the"
2247 $echo "*** static library $deplib is not portable!"
2248 deplibs="$deplib $deplibs"
2250 continue
2252 prog)
2253 if test "$pass" != link; then
2254 deplibs="$deplib $deplibs"
2255 else
2256 compile_deplibs="$deplib $compile_deplibs"
2257 finalize_deplibs="$deplib $finalize_deplibs"
2259 continue
2261 esac # linkmode
2262 ;; # *.$libext
2263 *.lo | *.$objext)
2264 if test "$pass" = conv; then
2265 deplibs="$deplib $deplibs"
2266 elif test "$linkmode" = prog; then
2267 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2268 # If there is no dlopen support or we're linking statically,
2269 # we need to preload.
2270 newdlprefiles="$newdlprefiles $deplib"
2271 compile_deplibs="$deplib $compile_deplibs"
2272 finalize_deplibs="$deplib $finalize_deplibs"
2273 else
2274 newdlfiles="$newdlfiles $deplib"
2277 continue
2279 %DEPLIBS%)
2280 alldeplibs=yes
2281 continue
2283 esac # case $deplib
2284 if test "$found" = yes || test -f "$lib"; then :
2285 else
2286 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2287 exit $EXIT_FAILURE
2290 # Check to see that this really is a libtool archive.
2291 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2292 else
2293 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2294 exit $EXIT_FAILURE
2297 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2298 test "X$ladir" = "X$lib" && ladir="."
2300 dlname=
2301 dlopen=
2302 dlpreopen=
2303 libdir=
2304 library_names=
2305 old_library=
2306 # If the library was installed with an old release of libtool,
2307 # it will not redefine variables installed, or shouldnotlink
2308 installed=yes
2309 shouldnotlink=no
2310 avoidtemprpath=
2313 # Read the .la file
2314 case $lib in
2315 */* | *\\*) . $lib ;;
2316 *) . ./$lib ;;
2317 esac
2319 if test "$linkmode,$pass" = "lib,link" ||
2320 test "$linkmode,$pass" = "prog,scan" ||
2321 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2322 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2323 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2326 if test "$pass" = conv; then
2327 # Only check for convenience libraries
2328 deplibs="$lib $deplibs"
2329 if test -z "$libdir"; then
2330 if test -z "$old_library"; then
2331 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2332 exit $EXIT_FAILURE
2334 # It is a libtool convenience library, so add in its objects.
2335 convenience="$convenience $ladir/$objdir/$old_library"
2336 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2337 tmp_libs=
2338 for deplib in $dependency_libs; do
2339 deplibs="$deplib $deplibs"
2340 if test "X$duplicate_deps" = "Xyes" ; then
2341 case "$tmp_libs " in
2342 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2343 esac
2345 tmp_libs="$tmp_libs $deplib"
2346 done
2347 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2348 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2349 exit $EXIT_FAILURE
2351 continue
2352 fi # $pass = conv
2355 # Get the name of the library we link against.
2356 linklib=
2357 for l in $old_library $library_names; do
2358 linklib="$l"
2359 done
2360 if test -z "$linklib"; then
2361 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2362 exit $EXIT_FAILURE
2365 # This library was specified with -dlopen.
2366 if test "$pass" = dlopen; then
2367 if test -z "$libdir"; then
2368 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2369 exit $EXIT_FAILURE
2371 if test -z "$dlname" ||
2372 test "$dlopen_support" != yes ||
2373 test "$build_libtool_libs" = no; then
2374 # If there is no dlname, no dlopen support or we're linking
2375 # statically, we need to preload. We also need to preload any
2376 # dependent libraries so libltdl's deplib preloader doesn't
2377 # bomb out in the load deplibs phase.
2378 dlprefiles="$dlprefiles $lib $dependency_libs"
2379 else
2380 newdlfiles="$newdlfiles $lib"
2382 continue
2383 fi # $pass = dlopen
2385 # We need an absolute path.
2386 case $ladir in
2387 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2389 abs_ladir=`cd "$ladir" && pwd`
2390 if test -z "$abs_ladir"; then
2391 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2392 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2393 abs_ladir="$ladir"
2396 esac
2397 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2399 # Find the relevant object directory and library name.
2400 if test "X$installed" = Xyes; then
2401 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2402 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2403 dir="$ladir"
2404 absdir="$abs_ladir"
2405 libdir="$abs_ladir"
2406 else
2407 dir="$libdir"
2408 absdir="$libdir"
2410 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2411 else
2412 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2413 dir="$ladir"
2414 absdir="$abs_ladir"
2415 # Remove this search path later
2416 notinst_path="$notinst_path $abs_ladir"
2417 else
2418 dir="$ladir/$objdir"
2419 absdir="$abs_ladir/$objdir"
2420 # Remove this search path later
2421 notinst_path="$notinst_path $abs_ladir"
2423 fi # $installed = yes
2424 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2426 # This library was specified with -dlpreopen.
2427 if test "$pass" = dlpreopen; then
2428 if test -z "$libdir"; then
2429 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2430 exit $EXIT_FAILURE
2432 # Prefer using a static library (so that no silly _DYNAMIC symbols
2433 # are required to link).
2434 if test -n "$old_library"; then
2435 newdlprefiles="$newdlprefiles $dir/$old_library"
2436 # Otherwise, use the dlname, so that lt_dlopen finds it.
2437 elif test -n "$dlname"; then
2438 newdlprefiles="$newdlprefiles $dir/$dlname"
2439 else
2440 newdlprefiles="$newdlprefiles $dir/$linklib"
2442 fi # $pass = dlpreopen
2444 if test -z "$libdir"; then
2445 # Link the convenience library
2446 if test "$linkmode" = lib; then
2447 deplibs="$dir/$old_library $deplibs"
2448 elif test "$linkmode,$pass" = "prog,link"; then
2449 compile_deplibs="$dir/$old_library $compile_deplibs"
2450 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2451 else
2452 deplibs="$lib $deplibs" # used for prog,scan pass
2454 continue
2458 if test "$linkmode" = prog && test "$pass" != link; then
2459 newlib_search_path="$newlib_search_path $ladir"
2460 deplibs="$lib $deplibs"
2462 linkalldeplibs=no
2463 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2464 test "$build_libtool_libs" = no; then
2465 linkalldeplibs=yes
2468 tmp_libs=
2469 for deplib in $dependency_libs; do
2470 case $deplib in
2471 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2472 esac
2473 # Need to link against all dependency_libs?
2474 if test "$linkalldeplibs" = yes; then
2475 deplibs="$deplib $deplibs"
2476 else
2477 # Need to hardcode shared library paths
2478 # or/and link against static libraries
2479 newdependency_libs="$deplib $newdependency_libs"
2481 if test "X$duplicate_deps" = "Xyes" ; then
2482 case "$tmp_libs " in
2483 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2484 esac
2486 tmp_libs="$tmp_libs $deplib"
2487 done # for deplib
2488 continue
2489 fi # $linkmode = prog...
2491 if test "$linkmode,$pass" = "prog,link"; then
2492 if test -n "$library_names" &&
2493 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2494 # We need to hardcode the library path
2495 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2496 # Make sure the rpath contains only unique directories.
2497 case "$temp_rpath " in
2498 *" $dir "*) ;;
2499 *" $absdir "*) ;;
2500 *) temp_rpath="$temp_rpath $absdir" ;;
2501 esac
2504 # Hardcode the library path.
2505 # Skip directories that are in the system default run-time
2506 # search path.
2507 case " $sys_lib_dlsearch_path " in
2508 *" $absdir "*) ;;
2510 case "$compile_rpath " in
2511 *" $absdir "*) ;;
2512 *) compile_rpath="$compile_rpath $absdir"
2513 esac
2515 esac
2516 case " $sys_lib_dlsearch_path " in
2517 *" $libdir "*) ;;
2519 case "$finalize_rpath " in
2520 *" $libdir "*) ;;
2521 *) finalize_rpath="$finalize_rpath $libdir"
2522 esac
2524 esac
2525 fi # $linkmode,$pass = prog,link...
2527 if test "$alldeplibs" = yes &&
2528 { test "$deplibs_check_method" = pass_all ||
2529 { test "$build_libtool_libs" = yes &&
2530 test -n "$library_names"; }; }; then
2531 # We only need to search for static libraries
2532 continue
2536 link_static=no # Whether the deplib will be linked statically
2537 use_static_libs=$prefer_static_libs
2538 if test "$use_static_libs" = built && test "$installed" = yes ; then
2539 use_static_libs=no
2541 if test -n "$library_names" &&
2542 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2543 if test "$installed" = no; then
2544 notinst_deplibs="$notinst_deplibs $lib"
2545 need_relink=yes
2547 # This is a shared library
2549 # Warn about portability, can't link against -module's on
2550 # some systems (darwin)
2551 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2552 $echo
2553 if test "$linkmode" = prog; then
2554 $echo "*** Warning: Linking the executable $output against the loadable module"
2555 else
2556 $echo "*** Warning: Linking the shared library $output against the loadable module"
2558 $echo "*** $linklib is not portable!"
2560 if test "$linkmode" = lib &&
2561 test "$hardcode_into_libs" = yes; then
2562 # Hardcode the library path.
2563 # Skip directories that are in the system default run-time
2564 # search path.
2565 case " $sys_lib_dlsearch_path " in
2566 *" $absdir "*) ;;
2568 case "$compile_rpath " in
2569 *" $absdir "*) ;;
2570 *) compile_rpath="$compile_rpath $absdir"
2571 esac
2573 esac
2574 case " $sys_lib_dlsearch_path " in
2575 *" $libdir "*) ;;
2577 case "$finalize_rpath " in
2578 *" $libdir "*) ;;
2579 *) finalize_rpath="$finalize_rpath $libdir"
2580 esac
2582 esac
2585 if test -n "$old_archive_from_expsyms_cmds"; then
2586 # figure out the soname
2587 set dummy $library_names
2588 realname="$2"
2589 shift; shift
2590 libname=`eval \\$echo \"$libname_spec\"`
2591 # use dlname if we got it. it's perfectly good, no?
2592 if test -n "$dlname"; then
2593 soname="$dlname"
2594 elif test -n "$soname_spec"; then
2595 # bleh windows
2596 case $host in
2597 *cygwin* | mingw*)
2598 major=`expr $current - $age`
2599 versuffix="-$major"
2601 esac
2602 eval soname=\"$soname_spec\"
2603 else
2604 soname="$realname"
2607 # Make a new name for the extract_expsyms_cmds to use
2608 soroot="$soname"
2609 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2610 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2612 # If the library has no export list, then create one now
2613 if test -f "$output_objdir/$soname-def"; then :
2614 else
2615 $show "extracting exported symbol list from \`$soname'"
2616 save_ifs="$IFS"; IFS='~'
2617 cmds=$extract_expsyms_cmds
2618 for cmd in $cmds; do
2619 IFS="$save_ifs"
2620 eval cmd=\"$cmd\"
2621 $show "$cmd"
2622 $run eval "$cmd" || exit $?
2623 done
2624 IFS="$save_ifs"
2627 # Create $newlib
2628 if test -f "$output_objdir/$newlib"; then :; else
2629 $show "generating import library for \`$soname'"
2630 save_ifs="$IFS"; IFS='~'
2631 cmds=$old_archive_from_expsyms_cmds
2632 for cmd in $cmds; do
2633 IFS="$save_ifs"
2634 eval cmd=\"$cmd\"
2635 $show "$cmd"
2636 $run eval "$cmd" || exit $?
2637 done
2638 IFS="$save_ifs"
2640 # make sure the library variables are pointing to the new library
2641 dir=$output_objdir
2642 linklib=$newlib
2643 fi # test -n "$old_archive_from_expsyms_cmds"
2645 if test "$linkmode" = prog || test "$mode" != relink; then
2646 add_shlibpath=
2647 add_dir=
2648 add=
2649 lib_linked=yes
2650 case $hardcode_action in
2651 immediate | unsupported)
2652 if test "$hardcode_direct" = no; then
2653 add="$dir/$linklib"
2654 case $host in
2655 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2656 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2657 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2658 *-*-unixware7*) add_dir="-L$dir" ;;
2659 *-*-darwin* )
2660 # if the lib is a module then we can not link against
2661 # it, someone is ignoring the new warnings I added
2662 if /usr/bin/file -L $add 2> /dev/null |
2663 $EGREP ": [^:]* bundle" >/dev/null ; then
2664 $echo "** Warning, lib $linklib is a module, not a shared library"
2665 if test -z "$old_library" ; then
2666 $echo
2667 $echo "** And there doesn't seem to be a static archive available"
2668 $echo "** The link will probably fail, sorry"
2669 else
2670 add="$dir/$old_library"
2673 esac
2674 elif test "$hardcode_minus_L" = no; then
2675 case $host in
2676 *-*-sunos*) add_shlibpath="$dir" ;;
2677 esac
2678 add_dir="-L$dir"
2679 add="-l$name"
2680 elif test "$hardcode_shlibpath_var" = no; then
2681 add_shlibpath="$dir"
2682 add="-l$name"
2683 else
2684 lib_linked=no
2687 relink)
2688 if test "$hardcode_direct" = yes; then
2689 add="$dir/$linklib"
2690 elif test "$hardcode_minus_L" = yes; then
2691 add_dir="-L$dir"
2692 # Try looking first in the location we're being installed to.
2693 if test -n "$inst_prefix_dir"; then
2694 case $libdir in
2695 [\\/]*)
2696 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2698 esac
2700 add="-l$name"
2701 elif test "$hardcode_shlibpath_var" = yes; then
2702 add_shlibpath="$dir"
2703 add="-l$name"
2704 else
2705 lib_linked=no
2708 *) lib_linked=no ;;
2709 esac
2711 if test "$lib_linked" != yes; then
2712 $echo "$modename: configuration error: unsupported hardcode properties"
2713 exit $EXIT_FAILURE
2716 if test -n "$add_shlibpath"; then
2717 case :$compile_shlibpath: in
2718 *":$add_shlibpath:"*) ;;
2719 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2720 esac
2722 if test "$linkmode" = prog; then
2723 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2724 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2725 else
2726 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2727 test -n "$add" && deplibs="$add $deplibs"
2728 if test "$hardcode_direct" != yes && \
2729 test "$hardcode_minus_L" != yes && \
2730 test "$hardcode_shlibpath_var" = yes; then
2731 case :$finalize_shlibpath: in
2732 *":$libdir:"*) ;;
2733 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2734 esac
2739 if test "$linkmode" = prog || test "$mode" = relink; then
2740 add_shlibpath=
2741 add_dir=
2742 add=
2743 # Finalize command for both is simple: just hardcode it.
2744 if test "$hardcode_direct" = yes; then
2745 add="$libdir/$linklib"
2746 elif test "$hardcode_minus_L" = yes; then
2747 add_dir="-L$libdir"
2748 add="-l$name"
2749 elif test "$hardcode_shlibpath_var" = yes; then
2750 case :$finalize_shlibpath: in
2751 *":$libdir:"*) ;;
2752 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2753 esac
2754 add="-l$name"
2755 elif test "$hardcode_automatic" = yes; then
2756 if test -n "$inst_prefix_dir" &&
2757 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2758 add="$inst_prefix_dir$libdir/$linklib"
2759 else
2760 add="$libdir/$linklib"
2762 else
2763 # We cannot seem to hardcode it, guess we'll fake it.
2764 add_dir="-L$libdir"
2765 # Try looking first in the location we're being installed to.
2766 if test -n "$inst_prefix_dir"; then
2767 case $libdir in
2768 [\\/]*)
2769 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2771 esac
2773 add="-l$name"
2776 if test "$linkmode" = prog; then
2777 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2778 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2779 else
2780 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2781 test -n "$add" && deplibs="$add $deplibs"
2784 elif test "$linkmode" = prog; then
2785 # Here we assume that one of hardcode_direct or hardcode_minus_L
2786 # is not unsupported. This is valid on all known static and
2787 # shared platforms.
2788 if test "$hardcode_direct" != unsupported; then
2789 test -n "$old_library" && linklib="$old_library"
2790 compile_deplibs="$dir/$linklib $compile_deplibs"
2791 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2792 else
2793 compile_deplibs="-l$name -L$dir $compile_deplibs"
2794 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2796 elif test "$build_libtool_libs" = yes; then
2797 # Not a shared library
2798 if test "$deplibs_check_method" != pass_all; then
2799 # We're trying link a shared library against a static one
2800 # but the system doesn't support it.
2802 # Just print a warning and add the library to dependency_libs so
2803 # that the program can be linked against the static library.
2804 $echo
2805 $echo "*** Warning: This system can not link to static lib archive $lib."
2806 $echo "*** I have the capability to make that library automatically link in when"
2807 $echo "*** you link to this library. But I can only do this if you have a"
2808 $echo "*** shared version of the library, which you do not appear to have."
2809 if test "$module" = yes; then
2810 $echo "*** But as you try to build a module library, libtool will still create "
2811 $echo "*** a static module, that should work as long as the dlopening application"
2812 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2813 if test -z "$global_symbol_pipe"; then
2814 $echo
2815 $echo "*** However, this would only work if libtool was able to extract symbol"
2816 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2817 $echo "*** not find such a program. So, this module is probably useless."
2818 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2820 if test "$build_old_libs" = no; then
2821 build_libtool_libs=module
2822 build_old_libs=yes
2823 else
2824 build_libtool_libs=no
2827 else
2828 deplibs="$dir/$old_library $deplibs"
2829 link_static=yes
2831 fi # link shared/static library?
2833 if test "$linkmode" = lib; then
2834 if test -n "$dependency_libs" &&
2835 { test "$hardcode_into_libs" != yes ||
2836 test "$build_old_libs" = yes ||
2837 test "$link_static" = yes; }; then
2838 # Extract -R from dependency_libs
2839 temp_deplibs=
2840 for libdir in $dependency_libs; do
2841 case $libdir in
2842 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2843 case " $xrpath " in
2844 *" $temp_xrpath "*) ;;
2845 *) xrpath="$xrpath $temp_xrpath";;
2846 esac;;
2847 *) temp_deplibs="$temp_deplibs $libdir";;
2848 esac
2849 done
2850 dependency_libs="$temp_deplibs"
2853 newlib_search_path="$newlib_search_path $absdir"
2854 # Link against this library
2855 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2856 # ... and its dependency_libs
2857 tmp_libs=
2858 for deplib in $dependency_libs; do
2859 newdependency_libs="$deplib $newdependency_libs"
2860 if test "X$duplicate_deps" = "Xyes" ; then
2861 case "$tmp_libs " in
2862 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2863 esac
2865 tmp_libs="$tmp_libs $deplib"
2866 done
2868 if test "$link_all_deplibs" != no; then
2869 # Add the search paths of all dependency libraries
2870 for deplib in $dependency_libs; do
2871 case $deplib in
2872 -L*) path="$deplib" ;;
2873 *.la)
2874 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2875 test "X$dir" = "X$deplib" && dir="."
2876 # We need an absolute path.
2877 case $dir in
2878 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2880 absdir=`cd "$dir" && pwd`
2881 if test -z "$absdir"; then
2882 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2883 absdir="$dir"
2886 esac
2887 if grep "^installed=no" $deplib > /dev/null; then
2888 path="$absdir/$objdir"
2889 else
2890 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2891 if test -z "$libdir"; then
2892 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2893 exit $EXIT_FAILURE
2895 if test "$absdir" != "$libdir"; then
2896 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2898 path="$absdir"
2900 depdepl=
2901 case $host in
2902 *-*-darwin*)
2903 # we do not want to link against static libs,
2904 # but need to link against shared
2905 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2906 if test -n "$deplibrary_names" ; then
2907 for tmp in $deplibrary_names ; do
2908 depdepl=$tmp
2909 done
2910 if test -f "$path/$depdepl" ; then
2911 depdepl="$path/$depdepl"
2913 # do not add paths which are already there
2914 case " $newlib_search_path " in
2915 *" $path "*) ;;
2916 *) newlib_search_path="$newlib_search_path $path";;
2917 esac
2919 path=""
2922 path="-L$path"
2924 esac
2926 -l*)
2927 case $host in
2928 *-*-darwin*)
2929 # Again, we only want to link against shared libraries
2930 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2931 for tmp in $newlib_search_path ; do
2932 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2933 eval depdepl="$tmp/lib$tmp_libs.dylib"
2934 break
2936 done
2937 path=""
2939 *) continue ;;
2940 esac
2942 *) continue ;;
2943 esac
2944 case " $deplibs " in
2945 *" $path "*) ;;
2946 *) deplibs="$path $deplibs" ;;
2947 esac
2948 case " $deplibs " in
2949 *" $depdepl "*) ;;
2950 *) deplibs="$depdepl $deplibs" ;;
2951 esac
2952 done
2953 fi # link_all_deplibs != no
2954 fi # linkmode = lib
2955 done # for deplib in $libs
2956 dependency_libs="$newdependency_libs"
2957 if test "$pass" = dlpreopen; then
2958 # Link the dlpreopened libraries before other libraries
2959 for deplib in $save_deplibs; do
2960 deplibs="$deplib $deplibs"
2961 done
2963 if test "$pass" != dlopen; then
2964 if test "$pass" != conv; then
2965 # Make sure lib_search_path contains only unique directories.
2966 lib_search_path=
2967 for dir in $newlib_search_path; do
2968 case "$lib_search_path " in
2969 *" $dir "*) ;;
2970 *) lib_search_path="$lib_search_path $dir" ;;
2971 esac
2972 done
2973 newlib_search_path=
2976 if test "$linkmode,$pass" != "prog,link"; then
2977 vars="deplibs"
2978 else
2979 vars="compile_deplibs finalize_deplibs"
2981 for var in $vars dependency_libs; do
2982 # Add libraries to $var in reverse order
2983 eval tmp_libs=\"\$$var\"
2984 new_libs=
2985 for deplib in $tmp_libs; do
2986 # FIXME: Pedantically, this is the right thing to do, so
2987 # that some nasty dependency loop isn't accidentally
2988 # broken:
2989 #new_libs="$deplib $new_libs"
2990 # Pragmatically, this seems to cause very few problems in
2991 # practice:
2992 case $deplib in
2993 -L*) new_libs="$deplib $new_libs" ;;
2994 -R*) ;;
2996 # And here is the reason: when a library appears more
2997 # than once as an explicit dependence of a library, or
2998 # is implicitly linked in more than once by the
2999 # compiler, it is considered special, and multiple
3000 # occurrences thereof are not removed. Compare this
3001 # with having the same library being listed as a
3002 # dependency of multiple other libraries: in this case,
3003 # we know (pedantically, we assume) the library does not
3004 # need to be listed more than once, so we keep only the
3005 # last copy. This is not always right, but it is rare
3006 # enough that we require users that really mean to play
3007 # such unportable linking tricks to link the library
3008 # using -Wl,-lname, so that libtool does not consider it
3009 # for duplicate removal.
3010 case " $specialdeplibs " in
3011 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3013 case " $new_libs " in
3014 *" $deplib "*) ;;
3015 *) new_libs="$deplib $new_libs" ;;
3016 esac
3018 esac
3020 esac
3021 done
3022 tmp_libs=
3023 for deplib in $new_libs; do
3024 case $deplib in
3025 -L*)
3026 case " $tmp_libs " in
3027 *" $deplib "*) ;;
3028 *) tmp_libs="$tmp_libs $deplib" ;;
3029 esac
3031 *) tmp_libs="$tmp_libs $deplib" ;;
3032 esac
3033 done
3034 eval $var=\"$tmp_libs\"
3035 done # for var
3037 # Last step: remove runtime libs from dependency_libs
3038 # (they stay in deplibs)
3039 tmp_libs=
3040 for i in $dependency_libs ; do
3041 case " $predeps $postdeps $compiler_lib_search_path " in
3042 *" $i "*)
3043 i=""
3045 esac
3046 if test -n "$i" ; then
3047 tmp_libs="$tmp_libs $i"
3049 done
3050 dependency_libs=$tmp_libs
3051 done # for pass
3052 if test "$linkmode" = prog; then
3053 dlfiles="$newdlfiles"
3054 dlprefiles="$newdlprefiles"
3057 case $linkmode in
3058 oldlib)
3059 if test -n "$deplibs"; then
3060 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3063 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3064 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3067 if test -n "$rpath"; then
3068 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3071 if test -n "$xrpath"; then
3072 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3075 if test -n "$vinfo"; then
3076 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3079 if test -n "$release"; then
3080 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3083 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3084 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3087 # Now set the variables for building old libraries.
3088 build_libtool_libs=no
3089 oldlibs="$output"
3090 objs="$objs$old_deplibs"
3093 lib)
3094 # Make sure we only generate libraries of the form `libNAME.la'.
3095 case $outputname in
3096 lib*)
3097 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3098 eval shared_ext=\"$shrext_cmds\"
3099 eval libname=\"$libname_spec\"
3102 if test "$module" = no; then
3103 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3104 $echo "$help" 1>&2
3105 exit $EXIT_FAILURE
3107 if test "$need_lib_prefix" != no; then
3108 # Add the "lib" prefix for modules if required
3109 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3110 eval shared_ext=\"$shrext_cmds\"
3111 eval libname=\"$libname_spec\"
3112 else
3113 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3116 esac
3118 if test -n "$objs"; then
3119 if test "$deplibs_check_method" != pass_all; then
3120 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3121 exit $EXIT_FAILURE
3122 else
3123 $echo
3124 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3125 $echo "*** objects $objs is not portable!"
3126 libobjs="$libobjs $objs"
3130 if test "$dlself" != no; then
3131 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3134 set dummy $rpath
3135 if test "$#" -gt 2; then
3136 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3138 install_libdir="$2"
3140 oldlibs=
3141 if test -z "$rpath"; then
3142 if test "$build_libtool_libs" = yes; then
3143 # Building a libtool convenience library.
3144 # Some compilers have problems with a `.al' extension so
3145 # convenience libraries should have the same extension an
3146 # archive normally would.
3147 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3148 build_libtool_libs=convenience
3149 build_old_libs=yes
3152 if test -n "$vinfo"; then
3153 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3156 if test -n "$release"; then
3157 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3159 else
3161 # Parse the version information argument.
3162 save_ifs="$IFS"; IFS=':'
3163 set dummy $vinfo 0 0 0
3164 IFS="$save_ifs"
3166 if test -n "$8"; then
3167 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3168 $echo "$help" 1>&2
3169 exit $EXIT_FAILURE
3172 # convert absolute version numbers to libtool ages
3173 # this retains compatibility with .la files and attempts
3174 # to make the code below a bit more comprehensible
3176 case $vinfo_number in
3177 yes)
3178 number_major="$2"
3179 number_minor="$3"
3180 number_revision="$4"
3182 # There are really only two kinds -- those that
3183 # use the current revision as the major version
3184 # and those that subtract age and use age as
3185 # a minor version. But, then there is irix
3186 # which has an extra 1 added just for fun
3188 case $version_type in
3189 darwin|linux|osf|windows)
3190 current=`expr $number_major + $number_minor`
3191 age="$number_minor"
3192 revision="$number_revision"
3194 freebsd-aout|freebsd-elf|sunos)
3195 current="$number_major"
3196 revision="$number_minor"
3197 age="0"
3199 irix|nonstopux)
3200 current=`expr $number_major + $number_minor - 1`
3201 age="$number_minor"
3202 revision="$number_minor"
3204 esac
3207 current="$2"
3208 revision="$3"
3209 age="$4"
3211 esac
3213 # Check that each of the things are valid numbers.
3214 case $current in
3215 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]) ;;
3217 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3218 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3219 exit $EXIT_FAILURE
3221 esac
3223 case $revision in
3224 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]) ;;
3226 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3227 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3228 exit $EXIT_FAILURE
3230 esac
3232 case $age in
3233 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]) ;;
3235 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3236 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3237 exit $EXIT_FAILURE
3239 esac
3241 if test "$age" -gt "$current"; then
3242 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3243 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3244 exit $EXIT_FAILURE
3247 # Calculate the version variables.
3248 major=
3249 versuffix=
3250 verstring=
3251 case $version_type in
3252 none) ;;
3254 darwin)
3255 # Like Linux, but with the current version available in
3256 # verstring for coding it into the library header
3257 major=.`expr $current - $age`
3258 versuffix="$major.$age.$revision"
3259 # Darwin ld doesn't like 0 for these options...
3260 minor_current=`expr $current + 1`
3261 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3264 freebsd-aout)
3265 major=".$current"
3266 versuffix=".$current.$revision";
3269 freebsd-elf)
3270 major=".$current"
3271 versuffix=".$current";
3274 irix | nonstopux)
3275 major=`expr $current - $age + 1`
3277 case $version_type in
3278 nonstopux) verstring_prefix=nonstopux ;;
3279 *) verstring_prefix=sgi ;;
3280 esac
3281 verstring="$verstring_prefix$major.$revision"
3283 # Add in all the interfaces that we are compatible with.
3284 loop=$revision
3285 while test "$loop" -ne 0; do
3286 iface=`expr $revision - $loop`
3287 loop=`expr $loop - 1`
3288 verstring="$verstring_prefix$major.$iface:$verstring"
3289 done
3291 # Before this point, $major must not contain `.'.
3292 major=.$major
3293 versuffix="$major.$revision"
3296 linux)
3297 major=.`expr $current - $age`
3298 versuffix="$major.$age.$revision"
3301 osf)
3302 major=.`expr $current - $age`
3303 versuffix=".$current.$age.$revision"
3304 verstring="$current.$age.$revision"
3306 # Add in all the interfaces that we are compatible with.
3307 loop=$age
3308 while test "$loop" -ne 0; do
3309 iface=`expr $current - $loop`
3310 loop=`expr $loop - 1`
3311 verstring="$verstring:${iface}.0"
3312 done
3314 # Make executables depend on our current version.
3315 verstring="$verstring:${current}.0"
3318 sunos)
3319 major=".$current"
3320 versuffix=".$current.$revision"
3323 windows)
3324 # Use '-' rather than '.', since we only want one
3325 # extension on DOS 8.3 filesystems.
3326 major=`expr $current - $age`
3327 versuffix="-$major"
3331 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3332 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3333 exit $EXIT_FAILURE
3335 esac
3337 # Clear the version info if we defaulted, and they specified a release.
3338 if test -z "$vinfo" && test -n "$release"; then
3339 major=
3340 case $version_type in
3341 darwin)
3342 # we can't check for "0.0" in archive_cmds due to quoting
3343 # problems, so we reset it completely
3344 verstring=
3347 verstring="0.0"
3349 esac
3350 if test "$need_version" = no; then
3351 versuffix=
3352 else
3353 versuffix=".0.0"
3357 # Remove version info from name if versioning should be avoided
3358 if test "$avoid_version" = yes && test "$need_version" = no; then
3359 major=
3360 versuffix=
3361 verstring=""
3364 # Check to see if the archive will have undefined symbols.
3365 if test "$allow_undefined" = yes; then
3366 if test "$allow_undefined_flag" = unsupported; then
3367 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3368 build_libtool_libs=no
3369 build_old_libs=yes
3371 else
3372 # Don't allow undefined symbols.
3373 allow_undefined_flag="$no_undefined_flag"
3377 if test "$mode" != relink; then
3378 # Remove our outputs, but don't remove object files since they
3379 # may have been created when compiling PIC objects.
3380 removelist=
3381 tempremovelist=`$echo "$output_objdir/*"`
3382 for p in $tempremovelist; do
3383 case $p in
3384 *.$objext)
3386 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3387 if test "X$precious_files_regex" != "X"; then
3388 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3389 then
3390 continue
3393 removelist="$removelist $p"
3395 *) ;;
3396 esac
3397 done
3398 if test -n "$removelist"; then
3399 $show "${rm}r $removelist"
3400 $run ${rm}r $removelist
3404 # Now set the variables for building old libraries.
3405 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3406 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3408 # Transform .lo files to .o files.
3409 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3412 # Eliminate all temporary directories.
3413 for path in $notinst_path; do
3414 lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3415 deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3416 dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3417 done
3419 if test -n "$xrpath"; then
3420 # If the user specified any rpath flags, then add them.
3421 temp_xrpath=
3422 for libdir in $xrpath; do
3423 temp_xrpath="$temp_xrpath -R$libdir"
3424 case "$finalize_rpath " in
3425 *" $libdir "*) ;;
3426 *) finalize_rpath="$finalize_rpath $libdir" ;;
3427 esac
3428 done
3429 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3430 dependency_libs="$temp_xrpath $dependency_libs"
3434 # Make sure dlfiles contains only unique files that won't be dlpreopened
3435 old_dlfiles="$dlfiles"
3436 dlfiles=
3437 for lib in $old_dlfiles; do
3438 case " $dlprefiles $dlfiles " in
3439 *" $lib "*) ;;
3440 *) dlfiles="$dlfiles $lib" ;;
3441 esac
3442 done
3444 # Make sure dlprefiles contains only unique files
3445 old_dlprefiles="$dlprefiles"
3446 dlprefiles=
3447 for lib in $old_dlprefiles; do
3448 case "$dlprefiles " in
3449 *" $lib "*) ;;
3450 *) dlprefiles="$dlprefiles $lib" ;;
3451 esac
3452 done
3454 if test "$build_libtool_libs" = yes; then
3455 if test -n "$rpath"; then
3456 case $host in
3457 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3458 # these systems don't actually have a c library (as such)!
3460 *-*-rhapsody* | *-*-darwin1.[012])
3461 # Rhapsody C library is in the System framework
3462 deplibs="$deplibs -framework System"
3464 *-*-netbsd*)
3465 # Don't link with libc until the a.out ld.so is fixed.
3467 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3468 # Do not include libc due to us having libc/libc_r.
3470 *-*-sco3.2v5* | *-*-sco5v6*)
3471 # Causes problems with __ctype
3473 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3474 # Compiler inserts libc in the correct place for threads to work
3477 # Add libc to deplibs on all other systems if necessary.
3478 if test "$build_libtool_need_lc" = "yes"; then
3479 deplibs="$deplibs -lc"
3482 esac
3485 # Transform deplibs into only deplibs that can be linked in shared.
3486 name_save=$name
3487 libname_save=$libname
3488 release_save=$release
3489 versuffix_save=$versuffix
3490 major_save=$major
3491 # I'm not sure if I'm treating the release correctly. I think
3492 # release should show up in the -l (ie -lgmp5) so we don't want to
3493 # add it in twice. Is that correct?
3494 release=""
3495 versuffix=""
3496 major=""
3497 newdeplibs=
3498 droppeddeps=no
3499 case $deplibs_check_method in
3500 pass_all)
3501 # Don't check for shared/static. Everything works.
3502 # This might be a little naive. We might want to check
3503 # whether the library exists or not. But this is on
3504 # osf3 & osf4 and I'm not really sure... Just
3505 # implementing what was already the behavior.
3506 newdeplibs=$deplibs
3508 test_compile)
3509 # This code stresses the "libraries are programs" paradigm to its
3510 # limits. Maybe even breaks it. We compile a program, linking it
3511 # against the deplibs as a proxy for the library. Then we can check
3512 # whether they linked in statically or dynamically with ldd.
3513 $rm conftest.c
3514 cat > conftest.c <<EOF
3515 int main() { return 0; }
3517 $rm conftest
3518 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
3519 if test "$?" -eq 0 ; then
3520 ldd_output=`ldd conftest`
3521 for i in $deplibs; do
3522 name=`expr $i : '-l\(.*\)'`
3523 # If $name is empty we are operating on a -L argument.
3524 if test "$name" != "" && test "$name" -ne "0"; then
3525 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3526 case " $predeps $postdeps " in
3527 *" $i "*)
3528 newdeplibs="$newdeplibs $i"
3529 i=""
3531 esac
3533 if test -n "$i" ; then
3534 libname=`eval \\$echo \"$libname_spec\"`
3535 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3536 set dummy $deplib_matches
3537 deplib_match=$2
3538 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3539 newdeplibs="$newdeplibs $i"
3540 else
3541 droppeddeps=yes
3542 $echo
3543 $echo "*** Warning: dynamic linker does not accept needed library $i."
3544 $echo "*** I have the capability to make that library automatically link in when"
3545 $echo "*** you link to this library. But I can only do this if you have a"
3546 $echo "*** shared version of the library, which I believe you do not have"
3547 $echo "*** because a test_compile did reveal that the linker did not use it for"
3548 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3551 else
3552 newdeplibs="$newdeplibs $i"
3554 done
3555 else
3556 # Error occurred in the first compile. Let's try to salvage
3557 # the situation: Compile a separate program for each library.
3558 for i in $deplibs; do
3559 name=`expr $i : '-l\(.*\)'`
3560 # If $name is empty we are operating on a -L argument.
3561 if test "$name" != "" && test "$name" != "0"; then
3562 $rm conftest
3563 $LTCC $LTCFLAGS -o conftest conftest.c $i
3564 # Did it work?
3565 if test "$?" -eq 0 ; then
3566 ldd_output=`ldd conftest`
3567 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3568 case " $predeps $postdeps " in
3569 *" $i "*)
3570 newdeplibs="$newdeplibs $i"
3571 i=""
3573 esac
3575 if test -n "$i" ; then
3576 libname=`eval \\$echo \"$libname_spec\"`
3577 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3578 set dummy $deplib_matches
3579 deplib_match=$2
3580 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3581 newdeplibs="$newdeplibs $i"
3582 else
3583 droppeddeps=yes
3584 $echo
3585 $echo "*** Warning: dynamic linker does not accept needed library $i."
3586 $echo "*** I have the capability to make that library automatically link in when"
3587 $echo "*** you link to this library. But I can only do this if you have a"
3588 $echo "*** shared version of the library, which you do not appear to have"
3589 $echo "*** because a test_compile did reveal that the linker did not use this one"
3590 $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3593 else
3594 droppeddeps=yes
3595 $echo
3596 $echo "*** Warning! Library $i is needed by this library but I was not able to"
3597 $echo "*** make it link in! You will probably need to install it or some"
3598 $echo "*** library that it depends on before this library will be fully"
3599 $echo "*** functional. Installing it before continuing would be even better."
3601 else
3602 newdeplibs="$newdeplibs $i"
3604 done
3607 file_magic*)
3608 set dummy $deplibs_check_method
3609 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3610 for a_deplib in $deplibs; do
3611 name=`expr $a_deplib : '-l\(.*\)'`
3612 # If $name is empty we are operating on a -L argument.
3613 if test "$name" != "" && test "$name" != "0"; then
3614 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3615 case " $predeps $postdeps " in
3616 *" $a_deplib "*)
3617 newdeplibs="$newdeplibs $a_deplib"
3618 a_deplib=""
3620 esac
3622 if test -n "$a_deplib" ; then
3623 libname=`eval \\$echo \"$libname_spec\"`
3624 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3625 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3626 for potent_lib in $potential_libs; do
3627 # Follow soft links.
3628 if ls -lLd "$potent_lib" 2>/dev/null \
3629 | grep " -> " >/dev/null; then
3630 continue
3632 # The statement above tries to avoid entering an
3633 # endless loop below, in case of cyclic links.
3634 # We might still enter an endless loop, since a link
3635 # loop can be closed while we follow links,
3636 # but so what?
3637 potlib="$potent_lib"
3638 while test -h "$potlib" 2>/dev/null; do
3639 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3640 case $potliblink in
3641 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3642 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3643 esac
3644 done
3645 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3646 | ${SED} 10q \
3647 | $EGREP "$file_magic_regex" > /dev/null; then
3648 newdeplibs="$newdeplibs $a_deplib"
3649 a_deplib=""
3650 break 2
3652 done
3653 done
3655 if test -n "$a_deplib" ; then
3656 droppeddeps=yes
3657 $echo
3658 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3659 $echo "*** I have the capability to make that library automatically link in when"
3660 $echo "*** you link to this library. But I can only do this if you have a"
3661 $echo "*** shared version of the library, which you do not appear to have"
3662 $echo "*** because I did check the linker path looking for a file starting"
3663 if test -z "$potlib" ; then
3664 $echo "*** with $libname but no candidates were found. (...for file magic test)"
3665 else
3666 $echo "*** with $libname and none of the candidates passed a file format test"
3667 $echo "*** using a file magic. Last file checked: $potlib"
3670 else
3671 # Add a -L argument.
3672 newdeplibs="$newdeplibs $a_deplib"
3674 done # Gone through all deplibs.
3676 match_pattern*)
3677 set dummy $deplibs_check_method
3678 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3679 for a_deplib in $deplibs; do
3680 name=`expr $a_deplib : '-l\(.*\)'`
3681 # If $name is empty we are operating on a -L argument.
3682 if test -n "$name" && test "$name" != "0"; then
3683 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3684 case " $predeps $postdeps " in
3685 *" $a_deplib "*)
3686 newdeplibs="$newdeplibs $a_deplib"
3687 a_deplib=""
3689 esac
3691 if test -n "$a_deplib" ; then
3692 libname=`eval \\$echo \"$libname_spec\"`
3693 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3694 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3695 for potent_lib in $potential_libs; do
3696 potlib="$potent_lib" # see symlink-check above in file_magic test
3697 if eval $echo \"$potent_lib\" 2>/dev/null \
3698 | ${SED} 10q \
3699 | $EGREP "$match_pattern_regex" > /dev/null; then
3700 newdeplibs="$newdeplibs $a_deplib"
3701 a_deplib=""
3702 break 2
3704 done
3705 done
3707 if test -n "$a_deplib" ; then
3708 droppeddeps=yes
3709 $echo
3710 $echo "*** Warning: linker path does not have real file for library $a_deplib."
3711 $echo "*** I have the capability to make that library automatically link in when"
3712 $echo "*** you link to this library. But I can only do this if you have a"
3713 $echo "*** shared version of the library, which you do not appear to have"
3714 $echo "*** because I did check the linker path looking for a file starting"
3715 if test -z "$potlib" ; then
3716 $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3717 else
3718 $echo "*** with $libname and none of the candidates passed a file format test"
3719 $echo "*** using a regex pattern. Last file checked: $potlib"
3722 else
3723 # Add a -L argument.
3724 newdeplibs="$newdeplibs $a_deplib"
3726 done # Gone through all deplibs.
3728 none | unknown | *)
3729 newdeplibs=""
3730 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3731 -e 's/ -[LR][^ ]*//g'`
3732 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3733 for i in $predeps $postdeps ; do
3734 # can't use Xsed below, because $i might contain '/'
3735 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3736 done
3738 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
3739 | grep . >/dev/null; then
3740 $echo
3741 if test "X$deplibs_check_method" = "Xnone"; then
3742 $echo "*** Warning: inter-library dependencies are not supported in this platform."
3743 else
3744 $echo "*** Warning: inter-library dependencies are not known to be supported."
3746 $echo "*** All declared inter-library dependencies are being dropped."
3747 droppeddeps=yes
3750 esac
3751 versuffix=$versuffix_save
3752 major=$major_save
3753 release=$release_save
3754 libname=$libname_save
3755 name=$name_save
3757 case $host in
3758 *-*-rhapsody* | *-*-darwin1.[012])
3759 # On Rhapsody replace the C library is the System framework
3760 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3762 esac
3764 if test "$droppeddeps" = yes; then
3765 if test "$module" = yes; then
3766 $echo
3767 $echo "*** Warning: libtool could not satisfy all declared inter-library"
3768 $echo "*** dependencies of module $libname. Therefore, libtool will create"
3769 $echo "*** a static module, that should work as long as the dlopening"
3770 $echo "*** application is linked with the -dlopen flag."
3771 if test -z "$global_symbol_pipe"; then
3772 $echo
3773 $echo "*** However, this would only work if libtool was able to extract symbol"
3774 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3775 $echo "*** not find such a program. So, this module is probably useless."
3776 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3778 if test "$build_old_libs" = no; then
3779 oldlibs="$output_objdir/$libname.$libext"
3780 build_libtool_libs=module
3781 build_old_libs=yes
3782 else
3783 build_libtool_libs=no
3785 else
3786 $echo "*** The inter-library dependencies that have been dropped here will be"
3787 $echo "*** automatically added whenever a program is linked with this library"
3788 $echo "*** or is declared to -dlopen it."
3790 if test "$allow_undefined" = no; then
3791 $echo
3792 $echo "*** Since this library must not contain undefined symbols,"
3793 $echo "*** because either the platform does not support them or"
3794 $echo "*** it was explicitly requested with -no-undefined,"
3795 $echo "*** libtool will only create a static version of it."
3796 if test "$build_old_libs" = no; then
3797 oldlibs="$output_objdir/$libname.$libext"
3798 build_libtool_libs=module
3799 build_old_libs=yes
3800 else
3801 build_libtool_libs=no
3806 # Done checking deplibs!
3807 deplibs=$newdeplibs
3811 # move library search paths that coincide with paths to not yet
3812 # installed libraries to the beginning of the library search list
3813 new_libs=
3814 for path in $notinst_path; do
3815 case " $new_libs " in
3816 *" -L$path/$objdir "*) ;;
3818 case " $deplibs " in
3819 *" -L$path/$objdir "*)
3820 new_libs="$new_libs -L$path/$objdir" ;;
3821 esac
3823 esac
3824 done
3825 for deplib in $deplibs; do
3826 case $deplib in
3827 -L*)
3828 case " $new_libs " in
3829 *" $deplib "*) ;;
3830 *) new_libs="$new_libs $deplib" ;;
3831 esac
3833 *) new_libs="$new_libs $deplib" ;;
3834 esac
3835 done
3836 deplibs="$new_libs"
3839 # All the library-specific variables (install_libdir is set above).
3840 library_names=
3841 old_library=
3842 dlname=
3844 # Test again, we may have decided not to build it any more
3845 if test "$build_libtool_libs" = yes; then
3846 if test "$hardcode_into_libs" = yes; then
3847 # Hardcode the library paths
3848 hardcode_libdirs=
3849 dep_rpath=
3850 rpath="$finalize_rpath"
3851 test "$mode" != relink && rpath="$compile_rpath$rpath"
3852 for libdir in $rpath; do
3853 if test -n "$hardcode_libdir_flag_spec"; then
3854 if test -n "$hardcode_libdir_separator"; then
3855 if test -z "$hardcode_libdirs"; then
3856 hardcode_libdirs="$libdir"
3857 else
3858 # Just accumulate the unique libdirs.
3859 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3860 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3863 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3865 esac
3867 else
3868 eval flag=\"$hardcode_libdir_flag_spec\"
3869 dep_rpath="$dep_rpath $flag"
3871 elif test -n "$runpath_var"; then
3872 case "$perm_rpath " in
3873 *" $libdir "*) ;;
3874 *) perm_rpath="$perm_rpath $libdir" ;;
3875 esac
3877 done
3878 # Substitute the hardcoded libdirs into the rpath.
3879 if test -n "$hardcode_libdir_separator" &&
3880 test -n "$hardcode_libdirs"; then
3881 libdir="$hardcode_libdirs"
3882 if test -n "$hardcode_libdir_flag_spec_ld"; then
3883 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3884 else
3885 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3888 if test -n "$runpath_var" && test -n "$perm_rpath"; then
3889 # We should set the runpath_var.
3890 rpath=
3891 for dir in $perm_rpath; do
3892 rpath="$rpath$dir:"
3893 done
3894 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3896 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3899 shlibpath="$finalize_shlibpath"
3900 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3901 if test -n "$shlibpath"; then
3902 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3905 # Get the real and link names of the library.
3906 eval shared_ext=\"$shrext_cmds\"
3907 eval library_names=\"$library_names_spec\"
3908 set dummy $library_names
3909 realname="$2"
3910 shift; shift
3912 if test -n "$soname_spec"; then
3913 eval soname=\"$soname_spec\"
3914 else
3915 soname="$realname"
3917 if test -z "$dlname"; then
3918 dlname=$soname
3921 lib="$output_objdir/$realname"
3922 linknames=
3923 for link
3925 linknames="$linknames $link"
3926 done
3928 # Use standard objects if they are pic
3929 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3931 # Prepare the list of exported symbols
3932 if test -z "$export_symbols"; then
3933 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3934 $show "generating symbol list for \`$libname.la'"
3935 export_symbols="$output_objdir/$libname.exp"
3936 $run $rm $export_symbols
3937 cmds=$export_symbols_cmds
3938 save_ifs="$IFS"; IFS='~'
3939 for cmd in $cmds; do
3940 IFS="$save_ifs"
3941 eval cmd=\"$cmd\"
3942 if len=`expr "X$cmd" : ".*"` &&
3943 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3944 $show "$cmd"
3945 $run eval "$cmd" || exit $?
3946 skipped_export=false
3947 else
3948 # The command line is too long to execute in one step.
3949 $show "using reloadable object file for export list..."
3950 skipped_export=:
3951 # Break out early, otherwise skipped_export may be
3952 # set to false by a later but shorter cmd.
3953 break
3955 done
3956 IFS="$save_ifs"
3957 if test -n "$export_symbols_regex"; then
3958 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3959 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3960 $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3961 $run eval '$mv "${export_symbols}T" "$export_symbols"'
3966 if test -n "$export_symbols" && test -n "$include_expsyms"; then
3967 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3970 tmp_deplibs=
3971 for test_deplib in $deplibs; do
3972 case " $convenience " in
3973 *" $test_deplib "*) ;;
3975 tmp_deplibs="$tmp_deplibs $test_deplib"
3977 esac
3978 done
3979 deplibs="$tmp_deplibs"
3981 if test -n "$convenience"; then
3982 if test -n "$whole_archive_flag_spec"; then
3983 save_libobjs=$libobjs
3984 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3985 else
3986 gentop="$output_objdir/${outputname}x"
3987 generated="$generated $gentop"
3989 func_extract_archives $gentop $convenience
3990 libobjs="$libobjs $func_extract_archives_result"
3994 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3995 eval flag=\"$thread_safe_flag_spec\"
3996 linker_flags="$linker_flags $flag"
3999 # Make a backup of the uninstalled library when relinking
4000 if test "$mode" = relink; then
4001 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
4004 # Do each of the archive commands.
4005 if test "$module" = yes && test -n "$module_cmds" ; then
4006 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4007 eval test_cmds=\"$module_expsym_cmds\"
4008 cmds=$module_expsym_cmds
4009 else
4010 eval test_cmds=\"$module_cmds\"
4011 cmds=$module_cmds
4013 else
4014 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4015 eval test_cmds=\"$archive_expsym_cmds\"
4016 cmds=$archive_expsym_cmds
4017 else
4018 eval test_cmds=\"$archive_cmds\"
4019 cmds=$archive_cmds
4023 if test "X$skipped_export" != "X:" &&
4024 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4025 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4027 else
4028 # The command line is too long to link in one step, link piecewise.
4029 $echo "creating reloadable object files..."
4031 # Save the value of $output and $libobjs because we want to
4032 # use them later. If we have whole_archive_flag_spec, we
4033 # want to use save_libobjs as it was before
4034 # whole_archive_flag_spec was expanded, because we can't
4035 # assume the linker understands whole_archive_flag_spec.
4036 # This may have to be revisited, in case too many
4037 # convenience libraries get linked in and end up exceeding
4038 # the spec.
4039 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
4040 save_libobjs=$libobjs
4042 save_output=$output
4043 output_la=`$echo "X$output" | $Xsed -e "$basename"`
4045 # Clear the reloadable object creation command queue and
4046 # initialize k to one.
4047 test_cmds=
4048 concat_cmds=
4049 objlist=
4050 delfiles=
4051 last_robj=
4053 output=$output_objdir/$output_la-${k}.$objext
4054 # Loop over the list of objects to be linked.
4055 for obj in $save_libobjs
4057 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
4058 if test "X$objlist" = X ||
4059 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
4060 test "$len" -le "$max_cmd_len"; }; then
4061 objlist="$objlist $obj"
4062 else
4063 # The command $test_cmds is almost too long, add a
4064 # command to the queue.
4065 if test "$k" -eq 1 ; then
4066 # The first file doesn't have a previous command to add.
4067 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
4068 else
4069 # All subsequent reloadable object files will link in
4070 # the last one created.
4071 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
4073 last_robj=$output_objdir/$output_la-${k}.$objext
4074 k=`expr $k + 1`
4075 output=$output_objdir/$output_la-${k}.$objext
4076 objlist=$obj
4077 len=1
4079 done
4080 # Handle the remaining objects by creating one last
4081 # reloadable object file. All subsequent reloadable object
4082 # files will link in the last one created.
4083 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4084 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
4086 if ${skipped_export-false}; then
4087 $show "generating symbol list for \`$libname.la'"
4088 export_symbols="$output_objdir/$libname.exp"
4089 $run $rm $export_symbols
4090 libobjs=$output
4091 # Append the command to create the export file.
4092 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
4095 # Set up a command to remove the reloadable object files
4096 # after they are used.
4098 while test "$i" -lt "$k"
4100 i=`expr $i + 1`
4101 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
4102 done
4104 $echo "creating a temporary reloadable object file: $output"
4106 # Loop through the commands generated above and execute them.
4107 save_ifs="$IFS"; IFS='~'
4108 for cmd in $concat_cmds; do
4109 IFS="$save_ifs"
4110 $show "$cmd"
4111 $run eval "$cmd" || exit $?
4112 done
4113 IFS="$save_ifs"
4115 libobjs=$output
4116 # Restore the value of output.
4117 output=$save_output
4119 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
4120 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
4122 # Expand the library linking commands again to reset the
4123 # value of $libobjs for piecewise linking.
4125 # Do each of the archive commands.
4126 if test "$module" = yes && test -n "$module_cmds" ; then
4127 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
4128 cmds=$module_expsym_cmds
4129 else
4130 cmds=$module_cmds
4132 else
4133 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
4134 cmds=$archive_expsym_cmds
4135 else
4136 cmds=$archive_cmds
4140 # Append the command to remove the reloadable object files
4141 # to the just-reset $cmds.
4142 eval cmds=\"\$cmds~\$rm $delfiles\"
4144 save_ifs="$IFS"; IFS='~'
4145 for cmd in $cmds; do
4146 IFS="$save_ifs"
4147 eval cmd=\"$cmd\"
4148 $show "$cmd"
4149 $run eval "$cmd" || {
4150 lt_exit=$?
4152 # Restore the uninstalled library and exit
4153 if test "$mode" = relink; then
4154 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4157 exit $lt_exit
4159 done
4160 IFS="$save_ifs"
4162 # Restore the uninstalled library and exit
4163 if test "$mode" = relink; then
4164 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4166 if test -n "$convenience"; then
4167 if test -z "$whole_archive_flag_spec"; then
4168 $show "${rm}r $gentop"
4169 $run ${rm}r "$gentop"
4173 exit $EXIT_SUCCESS
4176 # Create links to the real library.
4177 for linkname in $linknames; do
4178 if test "$realname" != "$linkname"; then
4179 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4180 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4182 done
4184 # If -module or -export-dynamic was specified, set the dlname.
4185 if test "$module" = yes || test "$export_dynamic" = yes; then
4186 # On all known operating systems, these are identical.
4187 dlname="$soname"
4192 obj)
4193 if test -n "$deplibs"; then
4194 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4197 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4198 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4201 if test -n "$rpath"; then
4202 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4205 if test -n "$xrpath"; then
4206 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4209 if test -n "$vinfo"; then
4210 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4213 if test -n "$release"; then
4214 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4217 case $output in
4218 *.lo)
4219 if test -n "$objs$old_deplibs"; then
4220 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4221 exit $EXIT_FAILURE
4223 libobj="$output"
4224 obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4227 libobj=
4228 obj="$output"
4230 esac
4232 # Delete the old objects.
4233 $run $rm $obj $libobj
4235 # Objects from convenience libraries. This assumes
4236 # single-version convenience libraries. Whenever we create
4237 # different ones for PIC/non-PIC, this we'll have to duplicate
4238 # the extraction.
4239 reload_conv_objs=
4240 gentop=
4241 # reload_cmds runs $LD directly, so let us get rid of
4242 # -Wl from whole_archive_flag_spec
4245 if test -n "$convenience"; then
4246 if test -n "$whole_archive_flag_spec"; then
4247 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4248 else
4249 gentop="$output_objdir/${obj}x"
4250 generated="$generated $gentop"
4252 func_extract_archives $gentop $convenience
4253 reload_conv_objs="$reload_objs $func_extract_archives_result"
4257 # Create the old-style object.
4258 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
4260 output="$obj"
4261 cmds=$reload_cmds
4262 save_ifs="$IFS"; IFS='~'
4263 for cmd in $cmds; do
4264 IFS="$save_ifs"
4265 eval cmd=\"$cmd\"
4266 $show "$cmd"
4267 $run eval "$cmd" || exit $?
4268 done
4269 IFS="$save_ifs"
4271 # Exit if we aren't doing a library object file.
4272 if test -z "$libobj"; then
4273 if test -n "$gentop"; then
4274 $show "${rm}r $gentop"
4275 $run ${rm}r $gentop
4278 exit $EXIT_SUCCESS
4281 if test "$build_libtool_libs" != yes; then
4282 if test -n "$gentop"; then
4283 $show "${rm}r $gentop"
4284 $run ${rm}r $gentop
4287 # Create an invalid libtool object if no PIC, so that we don't
4288 # accidentally link it into a program.
4289 # $show "echo timestamp > $libobj"
4290 # $run eval "echo timestamp > $libobj" || exit $?
4291 exit $EXIT_SUCCESS
4294 if test -n "$pic_flag" || test "$pic_mode" != default; then
4295 # Only do commands if we really have different PIC objects.
4296 reload_objs="$libobjs $reload_conv_objs"
4297 output="$libobj"
4298 cmds=$reload_cmds
4299 save_ifs="$IFS"; IFS='~'
4300 for cmd in $cmds; do
4301 IFS="$save_ifs"
4302 eval cmd=\"$cmd\"
4303 $show "$cmd"
4304 $run eval "$cmd" || exit $?
4305 done
4306 IFS="$save_ifs"
4309 if test -n "$gentop"; then
4310 $show "${rm}r $gentop"
4311 $run ${rm}r $gentop
4314 exit $EXIT_SUCCESS
4317 prog)
4318 case $host in
4319 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4320 esac
4321 if test -n "$vinfo"; then
4322 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4325 if test -n "$release"; then
4326 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4329 if test "$preload" = yes; then
4330 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4331 test "$dlopen_self_static" = unknown; then
4332 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4336 case $host in
4337 *-*-rhapsody* | *-*-darwin1.[012])
4338 # On Rhapsody replace the C library is the System framework
4339 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4340 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4342 esac
4344 case $host in
4345 *darwin*)
4346 # Don't allow lazy linking, it breaks C++ global constructors
4347 if test "$tagname" = CXX ; then
4348 compile_command="$compile_command ${wl}-bind_at_load"
4349 finalize_command="$finalize_command ${wl}-bind_at_load"
4352 esac
4355 # move library search paths that coincide with paths to not yet
4356 # installed libraries to the beginning of the library search list
4357 new_libs=
4358 for path in $notinst_path; do
4359 case " $new_libs " in
4360 *" -L$path/$objdir "*) ;;
4362 case " $compile_deplibs " in
4363 *" -L$path/$objdir "*)
4364 new_libs="$new_libs -L$path/$objdir" ;;
4365 esac
4367 esac
4368 done
4369 for deplib in $compile_deplibs; do
4370 case $deplib in
4371 -L*)
4372 case " $new_libs " in
4373 *" $deplib "*) ;;
4374 *) new_libs="$new_libs $deplib" ;;
4375 esac
4377 *) new_libs="$new_libs $deplib" ;;
4378 esac
4379 done
4380 compile_deplibs="$new_libs"
4383 compile_command="$compile_command $compile_deplibs"
4384 finalize_command="$finalize_command $finalize_deplibs"
4386 if test -n "$rpath$xrpath"; then
4387 # If the user specified any rpath flags, then add them.
4388 for libdir in $rpath $xrpath; do
4389 # This is the magic to use -rpath.
4390 case "$finalize_rpath " in
4391 *" $libdir "*) ;;
4392 *) finalize_rpath="$finalize_rpath $libdir" ;;
4393 esac
4394 done
4397 # Now hardcode the library paths
4398 rpath=
4399 hardcode_libdirs=
4400 for libdir in $compile_rpath $finalize_rpath; do
4401 if test -n "$hardcode_libdir_flag_spec"; then
4402 if test -n "$hardcode_libdir_separator"; then
4403 if test -z "$hardcode_libdirs"; then
4404 hardcode_libdirs="$libdir"
4405 else
4406 # Just accumulate the unique libdirs.
4407 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4408 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4411 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4413 esac
4415 else
4416 eval flag=\"$hardcode_libdir_flag_spec\"
4417 rpath="$rpath $flag"
4419 elif test -n "$runpath_var"; then
4420 case "$perm_rpath " in
4421 *" $libdir "*) ;;
4422 *) perm_rpath="$perm_rpath $libdir" ;;
4423 esac
4425 case $host in
4426 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4427 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
4428 case :$dllsearchpath: in
4429 *":$libdir:"*) ;;
4430 *) dllsearchpath="$dllsearchpath:$libdir";;
4431 esac
4432 case :$dllsearchpath: in
4433 *":$testbindir:"*) ;;
4434 *) dllsearchpath="$dllsearchpath:$testbindir";;
4435 esac
4437 esac
4438 done
4439 # Substitute the hardcoded libdirs into the rpath.
4440 if test -n "$hardcode_libdir_separator" &&
4441 test -n "$hardcode_libdirs"; then
4442 libdir="$hardcode_libdirs"
4443 eval rpath=\" $hardcode_libdir_flag_spec\"
4445 compile_rpath="$rpath"
4447 rpath=
4448 hardcode_libdirs=
4449 for libdir in $finalize_rpath; do
4450 if test -n "$hardcode_libdir_flag_spec"; then
4451 if test -n "$hardcode_libdir_separator"; then
4452 if test -z "$hardcode_libdirs"; then
4453 hardcode_libdirs="$libdir"
4454 else
4455 # Just accumulate the unique libdirs.
4456 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4457 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4460 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4462 esac
4464 else
4465 eval flag=\"$hardcode_libdir_flag_spec\"
4466 rpath="$rpath $flag"
4468 elif test -n "$runpath_var"; then
4469 case "$finalize_perm_rpath " in
4470 *" $libdir "*) ;;
4471 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4472 esac
4474 done
4475 # Substitute the hardcoded libdirs into the rpath.
4476 if test -n "$hardcode_libdir_separator" &&
4477 test -n "$hardcode_libdirs"; then
4478 libdir="$hardcode_libdirs"
4479 eval rpath=\" $hardcode_libdir_flag_spec\"
4481 finalize_rpath="$rpath"
4483 if test -n "$libobjs" && test "$build_old_libs" = yes; then
4484 # Transform all the library objects into standard objects.
4485 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4486 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4489 dlsyms=
4490 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4491 if test -n "$NM" && test -n "$global_symbol_pipe"; then
4492 dlsyms="${outputname}S.c"
4493 else
4494 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4498 if test -n "$dlsyms"; then
4499 case $dlsyms in
4500 "") ;;
4501 *.c)
4502 # Discover the nlist of each of the dlfiles.
4503 nlist="$output_objdir/${outputname}.nm"
4505 $show "$rm $nlist ${nlist}S ${nlist}T"
4506 $run $rm "$nlist" "${nlist}S" "${nlist}T"
4508 # Parse the name list into a source file.
4509 $show "creating $output_objdir/$dlsyms"
4511 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4512 /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4513 /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4515 #ifdef __cplusplus
4516 extern \"C\" {
4517 #endif
4519 /* Prevent the only kind of declaration conflicts we can make. */
4520 #define lt_preloaded_symbols some_other_symbol
4522 /* External symbol declarations for the compiler. */\
4525 if test "$dlself" = yes; then
4526 $show "generating symbol list for \`$output'"
4528 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4530 # Add our own program objects to the symbol list.
4531 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4532 for arg in $progfiles; do
4533 $show "extracting global C symbols from \`$arg'"
4534 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4535 done
4537 if test -n "$exclude_expsyms"; then
4538 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4539 $run eval '$mv "$nlist"T "$nlist"'
4542 if test -n "$export_symbols_regex"; then
4543 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4544 $run eval '$mv "$nlist"T "$nlist"'
4547 # Prepare the list of exported symbols
4548 if test -z "$export_symbols"; then
4549 export_symbols="$output_objdir/$outputname.exp"
4550 $run $rm $export_symbols
4551 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4552 case $host in
4553 *cygwin* | *mingw* )
4554 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4555 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4557 esac
4558 else
4559 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4560 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
4561 $run eval 'mv "$nlist"T "$nlist"'
4562 case $host in
4563 *cygwin* | *mingw* )
4564 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4565 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4567 esac
4571 for arg in $dlprefiles; do
4572 $show "extracting global C symbols from \`$arg'"
4573 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4574 $run eval '$echo ": $name " >> "$nlist"'
4575 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4576 done
4578 if test -z "$run"; then
4579 # Make sure we have at least an empty file.
4580 test -f "$nlist" || : > "$nlist"
4582 if test -n "$exclude_expsyms"; then
4583 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4584 $mv "$nlist"T "$nlist"
4587 # Try sorting and uniquifying the output.
4588 if grep -v "^: " < "$nlist" |
4589 if sort -k 3 </dev/null >/dev/null 2>&1; then
4590 sort -k 3
4591 else
4592 sort +2
4593 fi |
4594 uniq > "$nlist"S; then
4596 else
4597 grep -v "^: " < "$nlist" > "$nlist"S
4600 if test -f "$nlist"S; then
4601 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4602 else
4603 $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4606 $echo >> "$output_objdir/$dlsyms" "\
4608 #undef lt_preloaded_symbols
4610 #if defined (__STDC__) && __STDC__
4611 # define lt_ptr void *
4612 #else
4613 # define lt_ptr char *
4614 # define const
4615 #endif
4617 /* The mapping between symbol names and symbols. */
4620 case $host in
4621 *cygwin* | *mingw* )
4622 $echo >> "$output_objdir/$dlsyms" "\
4623 /* DATA imports from DLLs on WIN32 can't be const, because
4624 runtime relocations are performed -- see ld's documentation
4625 on pseudo-relocs */
4626 struct {
4630 $echo >> "$output_objdir/$dlsyms" "\
4631 const struct {
4634 esac
4637 $echo >> "$output_objdir/$dlsyms" "\
4638 const char *name;
4639 lt_ptr address;
4641 lt_preloaded_symbols[] =
4645 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4647 $echo >> "$output_objdir/$dlsyms" "\
4648 {0, (lt_ptr) 0}
4651 /* This works around a problem in FreeBSD linker */
4652 #ifdef FREEBSD_WORKAROUND
4653 static const void *lt_preloaded_setup() {
4654 return lt_preloaded_symbols;
4656 #endif
4658 #ifdef __cplusplus
4660 #endif\
4664 pic_flag_for_symtable=
4665 case $host in
4666 # compiling the symbol table file with pic_flag works around
4667 # a FreeBSD bug that causes programs to crash when -lm is
4668 # linked before any other PIC object. But we must not use
4669 # pic_flag when linking with -static. The problem exists in
4670 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4671 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4672 case "$compile_command " in
4673 *" -static "*) ;;
4674 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4675 esac;;
4676 *-*-hpux*)
4677 case "$compile_command " in
4678 *" -static "*) ;;
4679 *) pic_flag_for_symtable=" $pic_flag";;
4680 esac
4681 esac
4683 # Now compile the dynamic symbol file.
4684 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4685 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4687 # Clean up the generated files.
4688 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4689 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4691 # Transform the symbol file into the correct name.
4692 case $host in
4693 *cygwin* | *mingw* )
4694 if test -f "$output_objdir/${outputname}.def" ; then
4695 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4696 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4697 else
4698 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4699 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4703 compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4704 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4706 esac
4709 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4710 exit $EXIT_FAILURE
4712 esac
4713 else
4714 # We keep going just in case the user didn't refer to
4715 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
4716 # really was required.
4718 # Nullify the symbol file.
4719 compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4720 finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4723 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4724 # Replace the output file specification.
4725 compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4726 link_command="$compile_command$compile_rpath"
4728 # We have no uninstalled library dependencies, so finalize right now.
4729 $show "$link_command"
4730 $run eval "$link_command"
4731 exit_status=$?
4733 # Delete the generated files.
4734 if test -n "$dlsyms"; then
4735 $show "$rm $output_objdir/${outputname}S.${objext}"
4736 $run $rm "$output_objdir/${outputname}S.${objext}"
4739 exit $exit_status
4742 if test -n "$shlibpath_var"; then
4743 # We should set the shlibpath_var
4744 rpath=
4745 for dir in $temp_rpath; do
4746 case $dir in
4747 [\\/]* | [A-Za-z]:[\\/]*)
4748 # Absolute path.
4749 rpath="$rpath$dir:"
4752 # Relative path: add a thisdir entry.
4753 rpath="$rpath\$thisdir/$dir:"
4755 esac
4756 done
4757 temp_rpath="$rpath"
4760 if test -n "$compile_shlibpath$finalize_shlibpath"; then
4761 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4763 if test -n "$finalize_shlibpath"; then
4764 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4767 compile_var=
4768 finalize_var=
4769 if test -n "$runpath_var"; then
4770 if test -n "$perm_rpath"; then
4771 # We should set the runpath_var.
4772 rpath=
4773 for dir in $perm_rpath; do
4774 rpath="$rpath$dir:"
4775 done
4776 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4778 if test -n "$finalize_perm_rpath"; then
4779 # We should set the runpath_var.
4780 rpath=
4781 for dir in $finalize_perm_rpath; do
4782 rpath="$rpath$dir:"
4783 done
4784 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4788 if test "$no_install" = yes; then
4789 # We don't need to create a wrapper script.
4790 link_command="$compile_var$compile_command$compile_rpath"
4791 # Replace the output file specification.
4792 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4793 # Delete the old output file.
4794 $run $rm $output
4795 # Link the executable and exit
4796 $show "$link_command"
4797 $run eval "$link_command" || exit $?
4798 exit $EXIT_SUCCESS
4801 if test "$hardcode_action" = relink; then
4802 # Fast installation is not supported
4803 link_command="$compile_var$compile_command$compile_rpath"
4804 relink_command="$finalize_var$finalize_command$finalize_rpath"
4806 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4807 $echo "$modename: \`$output' will be relinked during installation" 1>&2
4808 else
4809 if test "$fast_install" != no; then
4810 link_command="$finalize_var$compile_command$finalize_rpath"
4811 if test "$fast_install" = yes; then
4812 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4813 else
4814 # fast_install is set to needless
4815 relink_command=
4817 else
4818 link_command="$compile_var$compile_command$compile_rpath"
4819 relink_command="$finalize_var$finalize_command$finalize_rpath"
4823 # Replace the output file specification.
4824 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4826 # Delete the old output files.
4827 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4829 $show "$link_command"
4830 $run eval "$link_command" || exit $?
4832 # Now create the wrapper script.
4833 $show "creating $output"
4835 # Quote the relink command for shipping.
4836 if test -n "$relink_command"; then
4837 # Preserve any variables that may affect compiler behavior
4838 for var in $variables_saved_for_relink; do
4839 if eval test -z \"\${$var+set}\"; then
4840 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4841 elif eval var_value=\$$var; test -z "$var_value"; then
4842 relink_command="$var=; export $var; $relink_command"
4843 else
4844 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4845 relink_command="$var=\"$var_value\"; export $var; $relink_command"
4847 done
4848 relink_command="(cd `pwd`; $relink_command)"
4849 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4852 # Quote $echo for shipping.
4853 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4854 case $progpath in
4855 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4856 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4857 esac
4858 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4859 else
4860 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4863 # Only actually do things if our run command is non-null.
4864 if test -z "$run"; then
4865 # win32 will think the script is a binary if it has
4866 # a .exe suffix, so we strip it off here.
4867 case $output in
4868 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4869 esac
4870 # test for cygwin because mv fails w/o .exe extensions
4871 case $host in
4872 *cygwin*)
4873 exeext=.exe
4874 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4875 *) exeext= ;;
4876 esac
4877 case $host in
4878 *cygwin* | *mingw* )
4879 output_name=`basename $output`
4880 output_path=`dirname $output`
4881 cwrappersource="$output_path/$objdir/lt-$output_name.c"
4882 cwrapper="$output_path/$output_name.exe"
4883 $rm $cwrappersource $cwrapper
4884 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4886 cat > $cwrappersource <<EOF
4888 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4889 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4891 The $output program cannot be directly executed until all the libtool
4892 libraries that it depends on are installed.
4894 This wrapper executable should never be moved out of the build directory.
4895 If it is, it will not operate correctly.
4897 Currently, it simply execs the wrapper *script* "/bin/sh $output",
4898 but could eventually absorb all of the scripts functionality and
4899 exec $objdir/$outputname directly.
4902 cat >> $cwrappersource<<"EOF"
4903 #include <stdio.h>
4904 #include <stdlib.h>
4905 #include <unistd.h>
4906 #include <malloc.h>
4907 #include <stdarg.h>
4908 #include <assert.h>
4909 #include <string.h>
4910 #include <ctype.h>
4911 #include <sys/stat.h>
4913 #if defined(PATH_MAX)
4914 # define LT_PATHMAX PATH_MAX
4915 #elif defined(MAXPATHLEN)
4916 # define LT_PATHMAX MAXPATHLEN
4917 #else
4918 # define LT_PATHMAX 1024
4919 #endif
4921 #ifndef DIR_SEPARATOR
4922 # define DIR_SEPARATOR '/'
4923 # define PATH_SEPARATOR ':'
4924 #endif
4926 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4927 defined (__OS2__)
4928 # define HAVE_DOS_BASED_FILE_SYSTEM
4929 # ifndef DIR_SEPARATOR_2
4930 # define DIR_SEPARATOR_2 '\\'
4931 # endif
4932 # ifndef PATH_SEPARATOR_2
4933 # define PATH_SEPARATOR_2 ';'
4934 # endif
4935 #endif
4937 #ifndef DIR_SEPARATOR_2
4938 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4939 #else /* DIR_SEPARATOR_2 */
4940 # define IS_DIR_SEPARATOR(ch) \
4941 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4942 #endif /* DIR_SEPARATOR_2 */
4944 #ifndef PATH_SEPARATOR_2
4945 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4946 #else /* PATH_SEPARATOR_2 */
4947 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4948 #endif /* PATH_SEPARATOR_2 */
4950 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
4951 #define XFREE(stale) do { \
4952 if (stale) { free ((void *) stale); stale = 0; } \
4953 } while (0)
4955 /* -DDEBUG is fairly common in CFLAGS. */
4956 #undef DEBUG
4957 #if defined DEBUGWRAPPER
4958 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4959 #else
4960 # define DEBUG(format, ...)
4961 #endif
4963 const char *program_name = NULL;
4965 void * xmalloc (size_t num);
4966 char * xstrdup (const char *string);
4967 const char * base_name (const char *name);
4968 char * find_executable(const char *wrapper);
4969 int check_executable(const char *path);
4970 char * strendzap(char *str, const char *pat);
4971 void lt_fatal (const char *message, ...);
4974 main (int argc, char *argv[])
4976 char **newargz;
4977 int i;
4979 program_name = (char *) xstrdup (base_name (argv[0]));
4980 DEBUG("(main) argv[0] : %s\n",argv[0]);
4981 DEBUG("(main) program_name : %s\n",program_name);
4982 newargz = XMALLOC(char *, argc+2);
4985 cat >> $cwrappersource <<EOF
4986 newargz[0] = (char *) xstrdup("$SHELL");
4989 cat >> $cwrappersource <<"EOF"
4990 newargz[1] = find_executable(argv[0]);
4991 if (newargz[1] == NULL)
4992 lt_fatal("Couldn't find %s", argv[0]);
4993 DEBUG("(main) found exe at : %s\n",newargz[1]);
4994 /* we know the script has the same name, without the .exe */
4995 /* so make sure newargz[1] doesn't end in .exe */
4996 strendzap(newargz[1],".exe");
4997 for (i = 1; i < argc; i++)
4998 newargz[i+1] = xstrdup(argv[i]);
4999 newargz[argc+1] = NULL;
5001 for (i=0; i<argc+1; i++)
5003 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
5009 case $host_os in
5010 mingw*)
5011 cat >> $cwrappersource <<EOF
5012 execv("$SHELL",(char const **)newargz);
5016 cat >> $cwrappersource <<EOF
5017 execv("$SHELL",newargz);
5020 esac
5022 cat >> $cwrappersource <<"EOF"
5023 return 127;
5026 void *
5027 xmalloc (size_t num)
5029 void * p = (void *) malloc (num);
5030 if (!p)
5031 lt_fatal ("Memory exhausted");
5033 return p;
5036 char *
5037 xstrdup (const char *string)
5039 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5043 const char *
5044 base_name (const char *name)
5046 const char *base;
5048 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5049 /* Skip over the disk name in MSDOS pathnames. */
5050 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
5051 name += 2;
5052 #endif
5054 for (base = name; *name; name++)
5055 if (IS_DIR_SEPARATOR (*name))
5056 base = name + 1;
5057 return base;
5061 check_executable(const char * path)
5063 struct stat st;
5065 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5066 if ((!path) || (!*path))
5067 return 0;
5069 if ((stat (path, &st) >= 0) &&
5071 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5072 #if defined (S_IXOTH)
5073 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5074 #endif
5075 #if defined (S_IXGRP)
5076 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5077 #endif
5078 ((st.st_mode & S_IXUSR) == S_IXUSR))
5080 return 1;
5081 else
5082 return 0;
5085 /* Searches for the full path of the wrapper. Returns
5086 newly allocated full path name if found, NULL otherwise */
5087 char *
5088 find_executable (const char* wrapper)
5090 int has_slash = 0;
5091 const char* p;
5092 const char* p_next;
5093 /* static buffer for getcwd */
5094 char tmp[LT_PATHMAX + 1];
5095 int tmp_len;
5096 char* concat_name;
5098 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5100 if ((wrapper == NULL) || (*wrapper == '\0'))
5101 return NULL;
5103 /* Absolute path? */
5104 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5105 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5107 concat_name = xstrdup (wrapper);
5108 if (check_executable(concat_name))
5109 return concat_name;
5110 XFREE(concat_name);
5112 else
5114 #endif
5115 if (IS_DIR_SEPARATOR (wrapper[0]))
5117 concat_name = xstrdup (wrapper);
5118 if (check_executable(concat_name))
5119 return concat_name;
5120 XFREE(concat_name);
5122 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5124 #endif
5126 for (p = wrapper; *p; p++)
5127 if (*p == '/')
5129 has_slash = 1;
5130 break;
5132 if (!has_slash)
5134 /* no slashes; search PATH */
5135 const char* path = getenv ("PATH");
5136 if (path != NULL)
5138 for (p = path; *p; p = p_next)
5140 const char* q;
5141 size_t p_len;
5142 for (q = p; *q; q++)
5143 if (IS_PATH_SEPARATOR(*q))
5144 break;
5145 p_len = q - p;
5146 p_next = (*q == '\0' ? q : q + 1);
5147 if (p_len == 0)
5149 /* empty path: current directory */
5150 if (getcwd (tmp, LT_PATHMAX) == NULL)
5151 lt_fatal ("getcwd failed");
5152 tmp_len = strlen(tmp);
5153 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5154 memcpy (concat_name, tmp, tmp_len);
5155 concat_name[tmp_len] = '/';
5156 strcpy (concat_name + tmp_len + 1, wrapper);
5158 else
5160 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5161 memcpy (concat_name, p, p_len);
5162 concat_name[p_len] = '/';
5163 strcpy (concat_name + p_len + 1, wrapper);
5165 if (check_executable(concat_name))
5166 return concat_name;
5167 XFREE(concat_name);
5170 /* not found in PATH; assume curdir */
5172 /* Relative path | not found in path: prepend cwd */
5173 if (getcwd (tmp, LT_PATHMAX) == NULL)
5174 lt_fatal ("getcwd failed");
5175 tmp_len = strlen(tmp);
5176 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5177 memcpy (concat_name, tmp, tmp_len);
5178 concat_name[tmp_len] = '/';
5179 strcpy (concat_name + tmp_len + 1, wrapper);
5181 if (check_executable(concat_name))
5182 return concat_name;
5183 XFREE(concat_name);
5184 return NULL;
5187 char *
5188 strendzap(char *str, const char *pat)
5190 size_t len, patlen;
5192 assert(str != NULL);
5193 assert(pat != NULL);
5195 len = strlen(str);
5196 patlen = strlen(pat);
5198 if (patlen <= len)
5200 str += len - patlen;
5201 if (strcmp(str, pat) == 0)
5202 *str = '\0';
5204 return str;
5207 static void
5208 lt_error_core (int exit_status, const char * mode,
5209 const char * message, va_list ap)
5211 fprintf (stderr, "%s: %s: ", program_name, mode);
5212 vfprintf (stderr, message, ap);
5213 fprintf (stderr, ".\n");
5215 if (exit_status >= 0)
5216 exit (exit_status);
5219 void
5220 lt_fatal (const char *message, ...)
5222 va_list ap;
5223 va_start (ap, message);
5224 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
5225 va_end (ap);
5228 # we should really use a build-platform specific compiler
5229 # here, but OTOH, the wrappers (shell script and this C one)
5230 # are only useful if you want to execute the "real" binary.
5231 # Since the "real" binary is built for $host, then this
5232 # wrapper might as well be built for $host, too.
5233 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5235 esac
5236 $rm $output
5237 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
5239 $echo > $output "\
5240 #! $SHELL
5242 # $output - temporary wrapper script for $objdir/$outputname
5243 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5245 # The $output program cannot be directly executed until all the libtool
5246 # libraries that it depends on are installed.
5248 # This wrapper script should never be moved out of the build directory.
5249 # If it is, it will not operate correctly.
5251 # Sed substitution that helps us do robust quoting. It backslashifies
5252 # metacharacters that are still active within double-quoted strings.
5253 Xsed='${SED} -e 1s/^X//'
5254 sed_quote_subst='$sed_quote_subst'
5256 # The HP-UX ksh and POSIX shell print the target directory to stdout
5257 # if CDPATH is set.
5258 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
5260 relink_command=\"$relink_command\"
5262 # This environment variable determines our operation mode.
5263 if test \"\$libtool_install_magic\" = \"$magic\"; then
5264 # install mode needs the following variable:
5265 notinst_deplibs='$notinst_deplibs'
5266 else
5267 # When we are sourced in execute mode, \$file and \$echo are already set.
5268 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5269 echo=\"$qecho\"
5270 file=\"\$0\"
5271 # Make sure echo works.
5272 if test \"X\$1\" = X--no-reexec; then
5273 # Discard the --no-reexec flag, and continue.
5274 shift
5275 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
5276 # Yippee, \$echo works!
5278 else
5279 # Restart under the correct shell, and then maybe \$echo will work.
5280 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
5284 $echo >> $output "\
5286 # Find the directory that this script lives in.
5287 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
5288 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
5290 # Follow symbolic links until we get to the real thisdir.
5291 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
5292 while test -n \"\$file\"; do
5293 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
5295 # If there was a directory component, then change thisdir.
5296 if test \"x\$destdir\" != \"x\$file\"; then
5297 case \"\$destdir\" in
5298 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
5299 *) thisdir=\"\$thisdir/\$destdir\" ;;
5300 esac
5303 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
5304 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
5305 done
5307 # Try to get the absolute directory name.
5308 absdir=\`cd \"\$thisdir\" && pwd\`
5309 test -n \"\$absdir\" && thisdir=\"\$absdir\"
5312 if test "$fast_install" = yes; then
5313 $echo >> $output "\
5314 program=lt-'$outputname'$exeext
5315 progdir=\"\$thisdir/$objdir\"
5317 if test ! -f \"\$progdir/\$program\" || \\
5318 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
5319 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
5321 file=\"\$\$-\$program\"
5323 if test ! -d \"\$progdir\"; then
5324 $mkdir \"\$progdir\"
5325 else
5326 $rm \"\$progdir/\$file\"
5329 $echo >> $output "\
5331 # relink executable if necessary
5332 if test -n \"\$relink_command\"; then
5333 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
5334 else
5335 $echo \"\$relink_command_output\" >&2
5336 $rm \"\$progdir/\$file\"
5337 exit $EXIT_FAILURE
5341 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
5342 { $rm \"\$progdir/\$program\";
5343 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
5344 $rm \"\$progdir/\$file\"
5346 else
5347 $echo >> $output "\
5348 program='$outputname'
5349 progdir=\"\$thisdir/$objdir\"
5353 $echo >> $output "\
5355 if test -f \"\$progdir/\$program\"; then"
5357 # Export our shlibpath_var if we have one.
5358 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
5359 $echo >> $output "\
5360 # Add our own library path to $shlibpath_var
5361 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
5363 # Some systems cannot cope with colon-terminated $shlibpath_var
5364 # The second colon is a workaround for a bug in BeOS R4 sed
5365 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
5367 export $shlibpath_var
5371 # fixup the dll searchpath if we need to.
5372 if test -n "$dllsearchpath"; then
5373 $echo >> $output "\
5374 # Add the dll search path components to the executable PATH
5375 PATH=$dllsearchpath:\$PATH
5379 $echo >> $output "\
5380 if test \"\$libtool_execute_magic\" != \"$magic\"; then
5381 # Run the actual program with our arguments.
5383 case $host in
5384 # Backslashes separate directories on plain windows
5385 *-*-mingw | *-*-os2*)
5386 $echo >> $output "\
5387 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
5392 $echo >> $output "\
5393 exec \"\$progdir/\$program\" \${1+\"\$@\"}
5396 esac
5397 $echo >> $output "\
5398 \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
5399 exit $EXIT_FAILURE
5401 else
5402 # The program doesn't exist.
5403 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
5404 \$echo \"This script is just a wrapper for \$program.\" 1>&2
5405 $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5406 exit $EXIT_FAILURE
5410 chmod +x $output
5412 exit $EXIT_SUCCESS
5414 esac
5416 # See if we need to build an old-fashioned archive.
5417 for oldlib in $oldlibs; do
5419 if test "$build_libtool_libs" = convenience; then
5420 oldobjs="$libobjs_save"
5421 addlibs="$convenience"
5422 build_libtool_libs=no
5423 else
5424 if test "$build_libtool_libs" = module; then
5425 oldobjs="$libobjs_save"
5426 build_libtool_libs=no
5427 else
5428 oldobjs="$old_deplibs $non_pic_objects"
5430 addlibs="$old_convenience"
5433 if test -n "$addlibs"; then
5434 gentop="$output_objdir/${outputname}x"
5435 generated="$generated $gentop"
5437 func_extract_archives $gentop $addlibs
5438 oldobjs="$oldobjs $func_extract_archives_result"
5441 # Do each command in the archive commands.
5442 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5443 cmds=$old_archive_from_new_cmds
5444 else
5445 # POSIX demands no paths to be encoded in archives. We have
5446 # to avoid creating archives with duplicate basenames if we
5447 # might have to extract them afterwards, e.g., when creating a
5448 # static archive out of a convenience library, or when linking
5449 # the entirety of a libtool archive into another (currently
5450 # not supported by libtool).
5451 if (for obj in $oldobjs
5453 $echo "X$obj" | $Xsed -e 's%^.*/%%'
5454 done | sort | sort -uc >/dev/null 2>&1); then
5456 else
5457 $echo "copying selected object files to avoid basename conflicts..."
5459 if test -z "$gentop"; then
5460 gentop="$output_objdir/${outputname}x"
5461 generated="$generated $gentop"
5463 $show "${rm}r $gentop"
5464 $run ${rm}r "$gentop"
5465 $show "$mkdir $gentop"
5466 $run $mkdir "$gentop"
5467 exit_status=$?
5468 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5469 exit $exit_status
5473 save_oldobjs=$oldobjs
5474 oldobjs=
5475 counter=1
5476 for obj in $save_oldobjs
5478 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5479 case " $oldobjs " in
5480 " ") oldobjs=$obj ;;
5481 *[\ /]"$objbase "*)
5482 while :; do
5483 # Make sure we don't pick an alternate name that also
5484 # overlaps.
5485 newobj=lt$counter-$objbase
5486 counter=`expr $counter + 1`
5487 case " $oldobjs " in
5488 *[\ /]"$newobj "*) ;;
5489 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
5490 esac
5491 done
5492 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5493 $run ln "$obj" "$gentop/$newobj" ||
5494 $run cp "$obj" "$gentop/$newobj"
5495 oldobjs="$oldobjs $gentop/$newobj"
5497 *) oldobjs="$oldobjs $obj" ;;
5498 esac
5499 done
5502 eval cmds=\"$old_archive_cmds\"
5504 if len=`expr "X$cmds" : ".*"` &&
5505 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5506 cmds=$old_archive_cmds
5507 else
5508 # the command line is too long to link in one step, link in parts
5509 $echo "using piecewise archive linking..."
5510 save_RANLIB=$RANLIB
5511 RANLIB=:
5512 objlist=
5513 concat_cmds=
5514 save_oldobjs=$oldobjs
5516 # Is there a better way of finding the last object in the list?
5517 for obj in $save_oldobjs
5519 last_oldobj=$obj
5520 done
5521 for obj in $save_oldobjs
5523 oldobjs="$objlist $obj"
5524 objlist="$objlist $obj"
5525 eval test_cmds=\"$old_archive_cmds\"
5526 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5527 test "$len" -le "$max_cmd_len"; then
5529 else
5530 # the above command should be used before it gets too long
5531 oldobjs=$objlist
5532 if test "$obj" = "$last_oldobj" ; then
5533 RANLIB=$save_RANLIB
5535 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5536 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5537 objlist=
5539 done
5540 RANLIB=$save_RANLIB
5541 oldobjs=$objlist
5542 if test "X$oldobjs" = "X" ; then
5543 eval cmds=\"\$concat_cmds\"
5544 else
5545 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5549 save_ifs="$IFS"; IFS='~'
5550 for cmd in $cmds; do
5551 eval cmd=\"$cmd\"
5552 IFS="$save_ifs"
5553 $show "$cmd"
5554 $run eval "$cmd" || exit $?
5555 done
5556 IFS="$save_ifs"
5557 done
5559 if test -n "$generated"; then
5560 $show "${rm}r$generated"
5561 $run ${rm}r$generated
5564 # Now create the libtool archive.
5565 case $output in
5566 *.la)
5567 old_library=
5568 test "$build_old_libs" = yes && old_library="$libname.$libext"
5569 $show "creating $output"
5571 # Preserve any variables that may affect compiler behavior
5572 for var in $variables_saved_for_relink; do
5573 if eval test -z \"\${$var+set}\"; then
5574 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5575 elif eval var_value=\$$var; test -z "$var_value"; then
5576 relink_command="$var=; export $var; $relink_command"
5577 else
5578 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5579 relink_command="$var=\"$var_value\"; export $var; $relink_command"
5581 done
5582 # Quote the link command for shipping.
5583 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5584 relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5585 if test "$hardcode_automatic" = yes ; then
5586 relink_command=
5590 # Only create the output if not a dry run.
5591 if test -z "$run"; then
5592 for installed in no yes; do
5593 if test "$installed" = yes; then
5594 if test -z "$install_libdir"; then
5595 break
5597 output="$output_objdir/$outputname"i
5598 # Replace all uninstalled libtool libraries with the installed ones
5599 newdependency_libs=
5600 for deplib in $dependency_libs; do
5601 case $deplib in
5602 *.la)
5603 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5604 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5605 if test -z "$libdir"; then
5606 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5607 exit $EXIT_FAILURE
5609 newdependency_libs="$newdependency_libs $libdir/$name"
5611 *) newdependency_libs="$newdependency_libs $deplib" ;;
5612 esac
5613 done
5614 dependency_libs="$newdependency_libs"
5615 newdlfiles=
5616 for lib in $dlfiles; do
5617 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5618 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5619 if test -z "$libdir"; then
5620 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5621 exit $EXIT_FAILURE
5623 newdlfiles="$newdlfiles $libdir/$name"
5624 done
5625 dlfiles="$newdlfiles"
5626 newdlprefiles=
5627 for lib in $dlprefiles; do
5628 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5629 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5630 if test -z "$libdir"; then
5631 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5632 exit $EXIT_FAILURE
5634 newdlprefiles="$newdlprefiles $libdir/$name"
5635 done
5636 dlprefiles="$newdlprefiles"
5637 else
5638 newdlfiles=
5639 for lib in $dlfiles; do
5640 case $lib in
5641 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5642 *) abs=`pwd`"/$lib" ;;
5643 esac
5644 newdlfiles="$newdlfiles $abs"
5645 done
5646 dlfiles="$newdlfiles"
5647 newdlprefiles=
5648 for lib in $dlprefiles; do
5649 case $lib in
5650 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5651 *) abs=`pwd`"/$lib" ;;
5652 esac
5653 newdlprefiles="$newdlprefiles $abs"
5654 done
5655 dlprefiles="$newdlprefiles"
5657 $rm $output
5658 # place dlname in correct position for cygwin
5659 tdlname=$dlname
5660 case $host,$output,$installed,$module,$dlname in
5661 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5662 esac
5663 $echo > $output "\
5664 # $outputname - a libtool library file
5665 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5667 # Please DO NOT delete this file!
5668 # It is necessary for linking the library.
5670 # The name that we can dlopen(3).
5671 dlname='$tdlname'
5673 # Names of this library.
5674 library_names='$library_names'
5676 # The name of the static archive.
5677 old_library='$old_library'
5679 # Libraries that this one depends upon.
5680 dependency_libs='$dependency_libs'
5682 # Version information for $libname.
5683 current=$current
5684 age=$age
5685 revision=$revision
5687 # Is this an already installed library?
5688 installed=$installed
5690 # Should we warn about portability when linking against -modules?
5691 shouldnotlink=$module
5693 # Files to dlopen/dlpreopen
5694 dlopen='$dlfiles'
5695 dlpreopen='$dlprefiles'
5697 # Directory that this library needs to be installed in:
5698 libdir='$install_libdir'"
5699 if test "$installed" = no && test "$need_relink" = yes; then
5700 $echo >> $output "\
5701 relink_command=\"$relink_command\""
5703 done
5706 # Do a symbolic link so that the libtool archive can be found in
5707 # LD_LIBRARY_PATH before the program is installed.
5708 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5709 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5711 esac
5712 exit $EXIT_SUCCESS
5715 # libtool install mode
5716 install)
5717 modename="$modename: install"
5719 # There may be an optional sh(1) argument at the beginning of
5720 # install_prog (especially on Windows NT).
5721 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5722 # Allow the use of GNU shtool's install command.
5723 $echo "X$nonopt" | grep shtool > /dev/null; then
5724 # Aesthetically quote it.
5725 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5726 case $arg in
5727 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5728 arg="\"$arg\""
5730 esac
5731 install_prog="$arg "
5732 arg="$1"
5733 shift
5734 else
5735 install_prog=
5736 arg=$nonopt
5739 # The real first argument should be the name of the installation program.
5740 # Aesthetically quote it.
5741 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5742 case $arg in
5743 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5744 arg="\"$arg\""
5746 esac
5747 install_prog="$install_prog$arg"
5749 # We need to accept at least all the BSD install flags.
5750 dest=
5751 files=
5752 opts=
5753 prev=
5754 install_type=
5755 isdir=no
5756 stripme=
5757 for arg
5759 if test -n "$dest"; then
5760 files="$files $dest"
5761 dest=$arg
5762 continue
5765 case $arg in
5766 -d) isdir=yes ;;
5767 -f)
5768 case " $install_prog " in
5769 *[\\\ /]cp\ *) ;;
5770 *) prev=$arg ;;
5771 esac
5773 -g | -m | -o) prev=$arg ;;
5775 stripme=" -s"
5776 continue
5781 # If the previous option needed an argument, then skip it.
5782 if test -n "$prev"; then
5783 prev=
5784 else
5785 dest=$arg
5786 continue
5789 esac
5791 # Aesthetically quote the argument.
5792 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5793 case $arg in
5794 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
5795 arg="\"$arg\""
5797 esac
5798 install_prog="$install_prog $arg"
5799 done
5801 if test -z "$install_prog"; then
5802 $echo "$modename: you must specify an install program" 1>&2
5803 $echo "$help" 1>&2
5804 exit $EXIT_FAILURE
5807 if test -n "$prev"; then
5808 $echo "$modename: the \`$prev' option requires an argument" 1>&2
5809 $echo "$help" 1>&2
5810 exit $EXIT_FAILURE
5813 if test -z "$files"; then
5814 if test -z "$dest"; then
5815 $echo "$modename: no file or destination specified" 1>&2
5816 else
5817 $echo "$modename: you must specify a destination" 1>&2
5819 $echo "$help" 1>&2
5820 exit $EXIT_FAILURE
5823 # Strip any trailing slash from the destination.
5824 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5826 # Check to see that the destination is a directory.
5827 test -d "$dest" && isdir=yes
5828 if test "$isdir" = yes; then
5829 destdir="$dest"
5830 destname=
5831 else
5832 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5833 test "X$destdir" = "X$dest" && destdir=.
5834 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5836 # Not a directory, so check to see that there is only one file specified.
5837 set dummy $files
5838 if test "$#" -gt 2; then
5839 $echo "$modename: \`$dest' is not a directory" 1>&2
5840 $echo "$help" 1>&2
5841 exit $EXIT_FAILURE
5844 case $destdir in
5845 [\\/]* | [A-Za-z]:[\\/]*) ;;
5847 for file in $files; do
5848 case $file in
5849 *.lo) ;;
5851 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5852 $echo "$help" 1>&2
5853 exit $EXIT_FAILURE
5855 esac
5856 done
5858 esac
5860 # This variable tells wrapper scripts just to set variables rather
5861 # than running their programs.
5862 libtool_install_magic="$magic"
5864 staticlibs=
5865 future_libdirs=
5866 current_libdirs=
5867 for file in $files; do
5869 # Do each installation.
5870 case $file in
5871 *.$libext)
5872 # Do the static libraries later.
5873 staticlibs="$staticlibs $file"
5876 *.la)
5877 # Check to see that this really is a libtool archive.
5878 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5879 else
5880 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5881 $echo "$help" 1>&2
5882 exit $EXIT_FAILURE
5885 library_names=
5886 old_library=
5887 relink_command=
5888 # If there is no directory component, then add one.
5889 case $file in
5890 */* | *\\*) . $file ;;
5891 *) . ./$file ;;
5892 esac
5894 # Add the libdir to current_libdirs if it is the destination.
5895 if test "X$destdir" = "X$libdir"; then
5896 case "$current_libdirs " in
5897 *" $libdir "*) ;;
5898 *) current_libdirs="$current_libdirs $libdir" ;;
5899 esac
5900 else
5901 # Note the libdir as a future libdir.
5902 case "$future_libdirs " in
5903 *" $libdir "*) ;;
5904 *) future_libdirs="$future_libdirs $libdir" ;;
5905 esac
5908 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5909 test "X$dir" = "X$file/" && dir=
5910 dir="$dir$objdir"
5912 if test -n "$relink_command"; then
5913 # Determine the prefix the user has applied to our future dir.
5914 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5916 # Don't allow the user to place us outside of our expected
5917 # location b/c this prevents finding dependent libraries that
5918 # are installed to the same prefix.
5919 # At present, this check doesn't affect windows .dll's that
5920 # are installed into $libdir/../bin (currently, that works fine)
5921 # but it's something to keep an eye on.
5922 if test "$inst_prefix_dir" = "$destdir"; then
5923 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5924 exit $EXIT_FAILURE
5927 if test -n "$inst_prefix_dir"; then
5928 # Stick the inst_prefix_dir data into the link command.
5929 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5930 else
5931 relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5934 $echo "$modename: warning: relinking \`$file'" 1>&2
5935 $show "$relink_command"
5936 if $run eval "$relink_command"; then :
5937 else
5938 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5939 exit $EXIT_FAILURE
5943 # See the names of the shared library.
5944 set dummy $library_names
5945 if test -n "$2"; then
5946 realname="$2"
5947 shift
5948 shift
5950 srcname="$realname"
5951 test -n "$relink_command" && srcname="$realname"T
5953 # Install the shared library and build the symlinks.
5954 $show "$install_prog $dir/$srcname $destdir/$realname"
5955 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5956 if test -n "$stripme" && test -n "$striplib"; then
5957 $show "$striplib $destdir/$realname"
5958 $run eval "$striplib $destdir/$realname" || exit $?
5961 if test "$#" -gt 0; then
5962 # Delete the old symlinks, and create new ones.
5963 # Try `ln -sf' first, because the `ln' binary might depend on
5964 # the symlink we replace! Solaris /bin/ln does not understand -f,
5965 # so we also need to try rm && ln -s.
5966 for linkname
5968 if test "$linkname" != "$realname"; then
5969 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5970 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5972 done
5975 # Do each command in the postinstall commands.
5976 lib="$destdir/$realname"
5977 cmds=$postinstall_cmds
5978 save_ifs="$IFS"; IFS='~'
5979 for cmd in $cmds; do
5980 IFS="$save_ifs"
5981 eval cmd=\"$cmd\"
5982 $show "$cmd"
5983 $run eval "$cmd" || {
5984 lt_exit=$?
5986 # Restore the uninstalled library and exit
5987 if test "$mode" = relink; then
5988 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5991 exit $lt_exit
5993 done
5994 IFS="$save_ifs"
5997 # Install the pseudo-library for information purposes.
5998 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5999 instname="$dir/$name"i
6000 $show "$install_prog $instname $destdir/$name"
6001 $run eval "$install_prog $instname $destdir/$name" || exit $?
6003 # Maybe install the static library, too.
6004 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
6007 *.lo)
6008 # Install (i.e. copy) a libtool object.
6010 # Figure out destination file name, if it wasn't already specified.
6011 if test -n "$destname"; then
6012 destfile="$destdir/$destname"
6013 else
6014 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6015 destfile="$destdir/$destfile"
6018 # Deduce the name of the destination old-style object file.
6019 case $destfile in
6020 *.lo)
6021 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
6023 *.$objext)
6024 staticdest="$destfile"
6025 destfile=
6028 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
6029 $echo "$help" 1>&2
6030 exit $EXIT_FAILURE
6032 esac
6034 # Install the libtool object if requested.
6035 if test -n "$destfile"; then
6036 $show "$install_prog $file $destfile"
6037 $run eval "$install_prog $file $destfile" || exit $?
6040 # Install the old object if enabled.
6041 if test "$build_old_libs" = yes; then
6042 # Deduce the name of the old-style object file.
6043 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
6045 $show "$install_prog $staticobj $staticdest"
6046 $run eval "$install_prog \$staticobj \$staticdest" || exit $?
6048 exit $EXIT_SUCCESS
6052 # Figure out destination file name, if it wasn't already specified.
6053 if test -n "$destname"; then
6054 destfile="$destdir/$destname"
6055 else
6056 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6057 destfile="$destdir/$destfile"
6060 # If the file is missing, and there is a .exe on the end, strip it
6061 # because it is most likely a libtool script we actually want to
6062 # install
6063 stripped_ext=""
6064 case $file in
6065 *.exe)
6066 if test ! -f "$file"; then
6067 file=`$echo $file|${SED} 's,.exe$,,'`
6068 stripped_ext=".exe"
6071 esac
6073 # Do a test to see if this is really a libtool program.
6074 case $host in
6075 *cygwin*|*mingw*)
6076 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
6079 wrapper=$file
6081 esac
6082 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
6083 notinst_deplibs=
6084 relink_command=
6086 # Note that it is not necessary on cygwin/mingw to append a dot to
6087 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6088 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6089 # `FILE.' does not work on cygwin managed mounts.
6091 # If there is no directory component, then add one.
6092 case $wrapper in
6093 */* | *\\*) . ${wrapper} ;;
6094 *) . ./${wrapper} ;;
6095 esac
6097 # Check the variables that should have been set.
6098 if test -z "$notinst_deplibs"; then
6099 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
6100 exit $EXIT_FAILURE
6103 finalize=yes
6104 for lib in $notinst_deplibs; do
6105 # Check to see that each library is installed.
6106 libdir=
6107 if test -f "$lib"; then
6108 # If there is no directory component, then add one.
6109 case $lib in
6110 */* | *\\*) . $lib ;;
6111 *) . ./$lib ;;
6112 esac
6114 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
6115 if test -n "$libdir" && test ! -f "$libfile"; then
6116 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
6117 finalize=no
6119 done
6121 relink_command=
6122 # Note that it is not necessary on cygwin/mingw to append a dot to
6123 # foo even if both foo and FILE.exe exist: automatic-append-.exe
6124 # behavior happens only for exec(3), not for open(2)! Also, sourcing
6125 # `FILE.' does not work on cygwin managed mounts.
6127 # If there is no directory component, then add one.
6128 case $wrapper in
6129 */* | *\\*) . ${wrapper} ;;
6130 *) . ./${wrapper} ;;
6131 esac
6133 outputname=
6134 if test "$fast_install" = no && test -n "$relink_command"; then
6135 if test "$finalize" = yes && test -z "$run"; then
6136 tmpdir=`func_mktempdir`
6137 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
6138 outputname="$tmpdir/$file"
6139 # Replace the output file specification.
6140 relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
6142 $show "$relink_command"
6143 if $run eval "$relink_command"; then :
6144 else
6145 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
6146 ${rm}r "$tmpdir"
6147 continue
6149 file="$outputname"
6150 else
6151 $echo "$modename: warning: cannot relink \`$file'" 1>&2
6153 else
6154 # Install the binary that we compiled earlier.
6155 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
6159 # remove .exe since cygwin /usr/bin/install will append another
6160 # one anyway
6161 case $install_prog,$host in
6162 */usr/bin/install*,*cygwin*)
6163 case $file:$destfile in
6164 *.exe:*.exe)
6165 # this is ok
6167 *.exe:*)
6168 destfile=$destfile.exe
6170 *:*.exe)
6171 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
6173 esac
6175 esac
6176 $show "$install_prog$stripme $file $destfile"
6177 $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
6178 test -n "$outputname" && ${rm}r "$tmpdir"
6180 esac
6181 done
6183 for file in $staticlibs; do
6184 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6186 # Set up the ranlib parameters.
6187 oldlib="$destdir/$name"
6189 $show "$install_prog $file $oldlib"
6190 $run eval "$install_prog \$file \$oldlib" || exit $?
6192 if test -n "$stripme" && test -n "$old_striplib"; then
6193 $show "$old_striplib $oldlib"
6194 $run eval "$old_striplib $oldlib" || exit $?
6197 # Do each command in the postinstall commands.
6198 cmds=$old_postinstall_cmds
6199 save_ifs="$IFS"; IFS='~'
6200 for cmd in $cmds; do
6201 IFS="$save_ifs"
6202 eval cmd=\"$cmd\"
6203 $show "$cmd"
6204 $run eval "$cmd" || exit $?
6205 done
6206 IFS="$save_ifs"
6207 done
6209 if test -n "$future_libdirs"; then
6210 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
6213 if test -n "$current_libdirs"; then
6214 # Maybe just do a dry run.
6215 test -n "$run" && current_libdirs=" -n$current_libdirs"
6216 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
6217 else
6218 exit $EXIT_SUCCESS
6222 # libtool finish mode
6223 finish)
6224 modename="$modename: finish"
6225 libdirs="$nonopt"
6226 admincmds=
6228 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
6229 for dir
6231 libdirs="$libdirs $dir"
6232 done
6234 for libdir in $libdirs; do
6235 if test -n "$finish_cmds"; then
6236 # Do each command in the finish commands.
6237 cmds=$finish_cmds
6238 save_ifs="$IFS"; IFS='~'
6239 for cmd in $cmds; do
6240 IFS="$save_ifs"
6241 eval cmd=\"$cmd\"
6242 $show "$cmd"
6243 $run eval "$cmd" || admincmds="$admincmds
6244 $cmd"
6245 done
6246 IFS="$save_ifs"
6248 if test -n "$finish_eval"; then
6249 # Do the single finish_eval.
6250 eval cmds=\"$finish_eval\"
6251 $run eval "$cmds" || admincmds="$admincmds
6252 $cmds"
6254 done
6257 # Exit here if they wanted silent mode.
6258 test "$show" = : && exit $EXIT_SUCCESS
6260 $echo "X----------------------------------------------------------------------" | $Xsed
6261 $echo "Libraries have been installed in:"
6262 for libdir in $libdirs; do
6263 $echo " $libdir"
6264 done
6265 $echo
6266 $echo "If you ever happen to want to link against installed libraries"
6267 $echo "in a given directory, LIBDIR, you must either use libtool, and"
6268 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
6269 $echo "flag during linking and do at least one of the following:"
6270 if test -n "$shlibpath_var"; then
6271 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
6272 $echo " during execution"
6274 if test -n "$runpath_var"; then
6275 $echo " - add LIBDIR to the \`$runpath_var' environment variable"
6276 $echo " during linking"
6278 if test -n "$hardcode_libdir_flag_spec"; then
6279 libdir=LIBDIR
6280 eval flag=\"$hardcode_libdir_flag_spec\"
6282 $echo " - use the \`$flag' linker flag"
6284 if test -n "$admincmds"; then
6285 $echo " - have your system administrator run these commands:$admincmds"
6287 if test -f /etc/ld.so.conf; then
6288 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
6290 $echo
6291 $echo "See any operating system documentation about shared libraries for"
6292 $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6293 $echo "X----------------------------------------------------------------------" | $Xsed
6294 exit $EXIT_SUCCESS
6297 # libtool execute mode
6298 execute)
6299 modename="$modename: execute"
6301 # The first argument is the command name.
6302 cmd="$nonopt"
6303 if test -z "$cmd"; then
6304 $echo "$modename: you must specify a COMMAND" 1>&2
6305 $echo "$help"
6306 exit $EXIT_FAILURE
6309 # Handle -dlopen flags immediately.
6310 for file in $execute_dlfiles; do
6311 if test ! -f "$file"; then
6312 $echo "$modename: \`$file' is not a file" 1>&2
6313 $echo "$help" 1>&2
6314 exit $EXIT_FAILURE
6317 dir=
6318 case $file in
6319 *.la)
6320 # Check to see that this really is a libtool archive.
6321 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
6322 else
6323 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
6324 $echo "$help" 1>&2
6325 exit $EXIT_FAILURE
6328 # Read the libtool library.
6329 dlname=
6330 library_names=
6332 # If there is no directory component, then add one.
6333 case $file in
6334 */* | *\\*) . $file ;;
6335 *) . ./$file ;;
6336 esac
6338 # Skip this library if it cannot be dlopened.
6339 if test -z "$dlname"; then
6340 # Warn if it was a shared library.
6341 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
6342 continue
6345 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6346 test "X$dir" = "X$file" && dir=.
6348 if test -f "$dir/$objdir/$dlname"; then
6349 dir="$dir/$objdir"
6350 else
6351 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
6352 exit $EXIT_FAILURE
6356 *.lo)
6357 # Just add the directory containing the .lo file.
6358 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6359 test "X$dir" = "X$file" && dir=.
6363 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
6364 continue
6366 esac
6368 # Get the absolute pathname.
6369 absdir=`cd "$dir" && pwd`
6370 test -n "$absdir" && dir="$absdir"
6372 # Now add the directory to shlibpath_var.
6373 if eval "test -z \"\$$shlibpath_var\""; then
6374 eval "$shlibpath_var=\"\$dir\""
6375 else
6376 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
6378 done
6380 # This variable tells wrapper scripts just to set shlibpath_var
6381 # rather than running their programs.
6382 libtool_execute_magic="$magic"
6384 # Check if any of the arguments is a wrapper script.
6385 args=
6386 for file
6388 case $file in
6389 -*) ;;
6391 # Do a test to see if this is really a libtool program.
6392 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6393 # If there is no directory component, then add one.
6394 case $file in
6395 */* | *\\*) . $file ;;
6396 *) . ./$file ;;
6397 esac
6399 # Transform arg to wrapped name.
6400 file="$progdir/$program"
6403 esac
6404 # Quote arguments (to preserve shell metacharacters).
6405 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
6406 args="$args \"$file\""
6407 done
6409 if test -z "$run"; then
6410 if test -n "$shlibpath_var"; then
6411 # Export the shlibpath_var.
6412 eval "export $shlibpath_var"
6415 # Restore saved environment variables
6416 if test "${save_LC_ALL+set}" = set; then
6417 LC_ALL="$save_LC_ALL"; export LC_ALL
6419 if test "${save_LANG+set}" = set; then
6420 LANG="$save_LANG"; export LANG
6423 # Now prepare to actually exec the command.
6424 exec_cmd="\$cmd$args"
6425 else
6426 # Display what would be done.
6427 if test -n "$shlibpath_var"; then
6428 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
6429 $echo "export $shlibpath_var"
6431 $echo "$cmd$args"
6432 exit $EXIT_SUCCESS
6436 # libtool clean and uninstall mode
6437 clean | uninstall)
6438 modename="$modename: $mode"
6439 rm="$nonopt"
6440 files=
6441 rmforce=
6442 exit_status=0
6444 # This variable tells wrapper scripts just to set variables rather
6445 # than running their programs.
6446 libtool_install_magic="$magic"
6448 for arg
6450 case $arg in
6451 -f) rm="$rm $arg"; rmforce=yes ;;
6452 -*) rm="$rm $arg" ;;
6453 *) files="$files $arg" ;;
6454 esac
6455 done
6457 if test -z "$rm"; then
6458 $echo "$modename: you must specify an RM program" 1>&2
6459 $echo "$help" 1>&2
6460 exit $EXIT_FAILURE
6463 rmdirs=
6465 origobjdir="$objdir"
6466 for file in $files; do
6467 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6468 if test "X$dir" = "X$file"; then
6469 dir=.
6470 objdir="$origobjdir"
6471 else
6472 objdir="$dir/$origobjdir"
6474 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6475 test "$mode" = uninstall && objdir="$dir"
6477 # Remember objdir for removal later, being careful to avoid duplicates
6478 if test "$mode" = clean; then
6479 case " $rmdirs " in
6480 *" $objdir "*) ;;
6481 *) rmdirs="$rmdirs $objdir" ;;
6482 esac
6485 # Don't error if the file doesn't exist and rm -f was used.
6486 if (test -L "$file") >/dev/null 2>&1 \
6487 || (test -h "$file") >/dev/null 2>&1 \
6488 || test -f "$file"; then
6490 elif test -d "$file"; then
6491 exit_status=1
6492 continue
6493 elif test "$rmforce" = yes; then
6494 continue
6497 rmfiles="$file"
6499 case $name in
6500 *.la)
6501 # Possibly a libtool archive, so verify it.
6502 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6503 . $dir/$name
6505 # Delete the libtool libraries and symlinks.
6506 for n in $library_names; do
6507 rmfiles="$rmfiles $objdir/$n"
6508 done
6509 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6511 case "$mode" in
6512 clean)
6513 case " $library_names " in
6514 # " " in the beginning catches empty $dlname
6515 *" $dlname "*) ;;
6516 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6517 esac
6518 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6520 uninstall)
6521 if test -n "$library_names"; then
6522 # Do each command in the postuninstall commands.
6523 cmds=$postuninstall_cmds
6524 save_ifs="$IFS"; IFS='~'
6525 for cmd in $cmds; do
6526 IFS="$save_ifs"
6527 eval cmd=\"$cmd\"
6528 $show "$cmd"
6529 $run eval "$cmd"
6530 if test "$?" -ne 0 && test "$rmforce" != yes; then
6531 exit_status=1
6533 done
6534 IFS="$save_ifs"
6537 if test -n "$old_library"; then
6538 # Do each command in the old_postuninstall commands.
6539 cmds=$old_postuninstall_cmds
6540 save_ifs="$IFS"; IFS='~'
6541 for cmd in $cmds; do
6542 IFS="$save_ifs"
6543 eval cmd=\"$cmd\"
6544 $show "$cmd"
6545 $run eval "$cmd"
6546 if test "$?" -ne 0 && test "$rmforce" != yes; then
6547 exit_status=1
6549 done
6550 IFS="$save_ifs"
6552 # FIXME: should reinstall the best remaining shared library.
6554 esac
6558 *.lo)
6559 # Possibly a libtool object, so verify it.
6560 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6562 # Read the .lo file
6563 . $dir/$name
6565 # Add PIC object to the list of files to remove.
6566 if test -n "$pic_object" \
6567 && test "$pic_object" != none; then
6568 rmfiles="$rmfiles $dir/$pic_object"
6571 # Add non-PIC object to the list of files to remove.
6572 if test -n "$non_pic_object" \
6573 && test "$non_pic_object" != none; then
6574 rmfiles="$rmfiles $dir/$non_pic_object"
6580 if test "$mode" = clean ; then
6581 noexename=$name
6582 case $file in
6583 *.exe)
6584 file=`$echo $file|${SED} 's,.exe$,,'`
6585 noexename=`$echo $name|${SED} 's,.exe$,,'`
6586 # $file with .exe has already been added to rmfiles,
6587 # add $file without .exe
6588 rmfiles="$rmfiles $file"
6590 esac
6591 # Do a test to see if this is a libtool program.
6592 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6593 relink_command=
6594 . $dir/$noexename
6596 # note $name still contains .exe if it was in $file originally
6597 # as does the version of $file that was added into $rmfiles
6598 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6599 if test "$fast_install" = yes && test -n "$relink_command"; then
6600 rmfiles="$rmfiles $objdir/lt-$name"
6602 if test "X$noexename" != "X$name" ; then
6603 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6608 esac
6609 $show "$rm $rmfiles"
6610 $run $rm $rmfiles || exit_status=1
6611 done
6612 objdir="$origobjdir"
6614 # Try to remove the ${objdir}s in the directories where we deleted files
6615 for dir in $rmdirs; do
6616 if test -d "$dir"; then
6617 $show "rmdir $dir"
6618 $run rmdir $dir >/dev/null 2>&1
6620 done
6622 exit $exit_status
6626 $echo "$modename: you must specify a MODE" 1>&2
6627 $echo "$generic_help" 1>&2
6628 exit $EXIT_FAILURE
6630 esac
6632 if test -z "$exec_cmd"; then
6633 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6634 $echo "$generic_help" 1>&2
6635 exit $EXIT_FAILURE
6637 fi # test -z "$show_help"
6639 if test -n "$exec_cmd"; then
6640 eval exec $exec_cmd
6641 exit $EXIT_FAILURE
6644 # We need to display help for each of the modes.
6645 case $mode in
6646 "") $echo \
6647 "Usage: $modename [OPTION]... [MODE-ARG]...
6649 Provide generalized library-building support services.
6651 --config show all configuration variables
6652 --debug enable verbose shell tracing
6653 -n, --dry-run display commands without modifying any files
6654 --features display basic configuration information and exit
6655 --finish same as \`--mode=finish'
6656 --help display this help message and exit
6657 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
6658 --quiet same as \`--silent'
6659 --silent don't print informational messages
6660 --tag=TAG use configuration variables from tag TAG
6661 --version print version information
6663 MODE must be one of the following:
6665 clean remove files from the build directory
6666 compile compile a source file into a libtool object
6667 execute automatically set library path, then run a program
6668 finish complete the installation of libtool libraries
6669 install install libraries or executables
6670 link create a library or an executable
6671 uninstall remove libraries from an installed directory
6673 MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
6674 a more detailed description of MODE.
6676 Report bugs to <bug-libtool@gnu.org>."
6677 exit $EXIT_SUCCESS
6680 clean)
6681 $echo \
6682 "Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6684 Remove files from the build directory.
6686 RM is the name of the program to use to delete files associated with each FILE
6687 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6688 to RM.
6690 If FILE is a libtool library, object or program, all the files associated
6691 with it are deleted. Otherwise, only FILE itself is deleted using RM."
6694 compile)
6695 $echo \
6696 "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6698 Compile a source file into a libtool library object.
6700 This mode accepts the following additional options:
6702 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
6703 -prefer-pic try to building PIC objects only
6704 -prefer-non-pic try to building non-PIC objects only
6705 -static always build a \`.o' file suitable for static linking
6707 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6708 from the given SOURCEFILE.
6710 The output file name is determined by removing the directory component from
6711 SOURCEFILE, then substituting the C source code suffix \`.c' with the
6712 library object suffix, \`.lo'."
6715 execute)
6716 $echo \
6717 "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6719 Automatically set library path, then run a program.
6721 This mode accepts the following additional options:
6723 -dlopen FILE add the directory containing FILE to the library path
6725 This mode sets the library path environment variable according to \`-dlopen'
6726 flags.
6728 If any of the ARGS are libtool executable wrappers, then they are translated
6729 into their corresponding uninstalled binary, and any of their required library
6730 directories are added to the library path.
6732 Then, COMMAND is executed, with ARGS as arguments."
6735 finish)
6736 $echo \
6737 "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6739 Complete the installation of libtool libraries.
6741 Each LIBDIR is a directory that contains libtool libraries.
6743 The commands that this mode executes may require superuser privileges. Use
6744 the \`--dry-run' option if you just want to see what would be executed."
6747 install)
6748 $echo \
6749 "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6751 Install executables or libraries.
6753 INSTALL-COMMAND is the installation command. The first component should be
6754 either the \`install' or \`cp' program.
6756 The rest of the components are interpreted as arguments to that command (only
6757 BSD-compatible install options are recognized)."
6760 link)
6761 $echo \
6762 "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6764 Link object files or libraries together to form another library, or to
6765 create an executable program.
6767 LINK-COMMAND is a command using the C compiler that you would use to create
6768 a program from several object files.
6770 The following components of LINK-COMMAND are treated specially:
6772 -all-static do not do any dynamic linking at all
6773 -avoid-version do not add a version suffix if possible
6774 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
6775 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
6776 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6777 -export-symbols SYMFILE
6778 try to export only the symbols listed in SYMFILE
6779 -export-symbols-regex REGEX
6780 try to export only the symbols matching REGEX
6781 -LLIBDIR search LIBDIR for required installed libraries
6782 -lNAME OUTPUT-FILE requires the installed library libNAME
6783 -module build a library that can dlopened
6784 -no-fast-install disable the fast-install mode
6785 -no-install link a not-installable executable
6786 -no-undefined declare that a library does not refer to external symbols
6787 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
6788 -objectlist FILE Use a list of object files found in FILE to specify objects
6789 -precious-files-regex REGEX
6790 don't remove output files matching REGEX
6791 -release RELEASE specify package release information
6792 -rpath LIBDIR the created library will eventually be installed in LIBDIR
6793 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
6794 -static do not do any dynamic linking of libtool libraries
6795 -version-info CURRENT[:REVISION[:AGE]]
6796 specify library version info [each variable defaults to 0]
6798 All other options (arguments beginning with \`-') are ignored.
6800 Every other argument is treated as a filename. Files ending in \`.la' are
6801 treated as uninstalled libtool libraries, other files are standard or library
6802 object files.
6804 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6805 only library objects (\`.lo' files) may be specified, and \`-rpath' is
6806 required, except when creating a convenience library.
6808 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6809 using \`ar' and \`ranlib', or on Windows using \`lib'.
6811 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6812 is created, otherwise an executable program is created."
6815 uninstall)
6816 $echo \
6817 "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6819 Remove libraries from an installation directory.
6821 RM is the name of the program to use to delete files associated with each FILE
6822 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
6823 to RM.
6825 If FILE is a libtool library, all the files associated with it are deleted.
6826 Otherwise, only FILE itself is deleted using RM."
6830 $echo "$modename: invalid operation mode \`$mode'" 1>&2
6831 $echo "$help" 1>&2
6832 exit $EXIT_FAILURE
6834 esac
6836 $echo
6837 $echo "Try \`$modename --help' for more information about other modes."
6839 exit $?
6841 # The TAGs below are defined such that we never get into a situation
6842 # in which we disable both kinds of libraries. Given conflicting
6843 # choices, we go for a static library, that is the most portable,
6844 # since we can't tell whether shared libraries were disabled because
6845 # the user asked for that or because the platform doesn't support
6846 # them. This is particularly important on AIX, because we don't
6847 # support having both static and shared libraries enabled at the same
6848 # time on that platform, so we default to a shared-only configuration.
6849 # If a disable-shared tag is given, we'll fallback to a static-only
6850 # configuration. But we'll never go from static-only to shared-only.
6852 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6853 disable_libs=shared
6854 # ### END LIBTOOL TAG CONFIG: disable-shared
6856 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6857 disable_libs=static
6858 # ### END LIBTOOL TAG CONFIG: disable-static
6860 # Local Variables:
6861 # mode:shell-script
6862 # sh-indentation:2
6863 # End: