2007-06-25 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / ltmain.sh
blob9d8441856208704f76a36abd11d6923fb5951165
1 # Generated from ltmain.m4sh; do not edit by hand
3 # ltmain.sh (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a
4 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
29 # Usage: $progname [OPTION]... [MODE-ARG]...
31 # Provide generalized library-building support services.
33 # --config show all configuration variables
34 # --debug enable verbose shell tracing
35 # -n, --dry-run display commands without modifying any files
36 # --features display basic configuration information and exit
37 # --mode=MODE use operation mode MODE
38 # --preserve-dup-deps don't remove duplicate dependency libraries
39 # --quiet, --silent don't print informational messages
40 # --tag=TAG use configuration variables from tag TAG
41 # -v, --verbose print informational messages (default)
42 # --version print version information
43 # -h, --help print short or long help message
45 # MODE must be one of the following:
47 # clean remove files from the build directory
48 # compile compile a source file into a libtool object
49 # execute automatically set library path, then run a program
50 # finish complete the installation of libtool libraries
51 # install install libraries or executables
52 # link create a library or an executable
53 # uninstall remove libraries from an installed directory
55 # MODE-ARGS vary depending on the MODE.
56 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
58 # When reporting a bug, please describe a test case to reproduce it and
59 # include the following information:
61 # host-triplet: $host
62 # shell: $SHELL
63 # compiler: $LTCC
64 # compiler flags: $LTCFLAGS
65 # linker: $LD (gnu? $with_gnu_ld)
66 # $progname: (GNU libtool 1.2435 2007/03/18 18:44:42) 2.1a
67 # automake: $automake_version
68 # autoconf: $autoconf_version
70 # Report bugs to <bug-libtool@gnu.org>.
72 PROGRAM=ltmain.sh
73 PACKAGE=libtool
74 VERSION=2.1a
75 TIMESTAMP=" 1.2435 2007/03/18 18:44:42"
76 package_revision=1.2435
78 # Be Bourne compatible
79 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
80 emulate sh
81 NULLCMD=:
82 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
83 # is contrary to our usage. Disable this feature.
84 alias -g '${1+"$@"}'='"$@"'
85 setopt NO_GLOB_SUBST
86 else
87 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
89 BIN_SH=xpg4; export BIN_SH # for Tru64
90 DUALCASE=1; export DUALCASE # for MKS sh
92 # NLS nuisances: We save the old values to restore during execute mode.
93 # Only set LANG and LC_ALL to C if already set.
94 # These must not be set unconditionally because not all systems understand
95 # e.g. LANG=C (notably SCO).
96 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
98 eval "if test \"\${$lt_var+set}\" = set; then
99 save_$lt_var=\$$lt_var
100 $lt_var=C
101 export $lt_var
103 done
105 $lt_unset CDPATH
111 : ${CP="cp -f"}
112 : ${ECHO="echo"}
113 : ${EGREP="/bin/grep -E"}
114 : ${FGREP="/bin/grep -F"}
115 : ${GREP="/bin/grep"}
116 : ${LN_S="ln -s"}
117 : ${MAKE="make"}
118 : ${MKDIR="mkdir"}
119 : ${MV="mv -f"}
120 : ${RM="rm -f"}
121 : ${SED="/bin/sed"}
122 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
123 : ${Xsed="$SED -e 1s/^X//"}
125 # Global variables:
126 EXIT_SUCCESS=0
127 EXIT_FAILURE=1
128 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
129 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
131 exit_status=$EXIT_SUCCESS
133 # Make sure IFS has a sensible default
134 lt_nl='
136 IFS=" $lt_nl"
138 dirname="s,/[^/]*$,,"
139 basename="s,^.*/,,"
141 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
142 # is ksh but when the shell is invoked as "sh" and the current value of
143 # the _XPG environment variable is not equal to 1 (one), the special
144 # positional parameter $0, within a function call, is the name of the
145 # function.
146 progpath="$0"
148 # The name of this program:
149 # In the unlikely event $progname began with a '-', it would play havoc with
150 # func_echo (imagine progname=-n), so we prepend ./ in that case:
151 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
153 # Make sure we have an absolute path for reexecution:
154 case $progpath in
155 [\\/]*|[A-Za-z]:\\*) ;;
156 *[\\/]*)
157 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
158 progdir=`cd "$progdir" && pwd`
159 progpath="$progdir/$progname"
162 save_IFS="$IFS"
163 IFS=:
164 for progdir in $PATH; do
165 IFS="$save_IFS"
166 test -x "$progdir/$progname" && break
167 done
168 IFS="$save_IFS"
169 test -n "$progdir" || progdir=`pwd`
170 progpath="$progdir/$progname"
172 esac
174 # Sed substitution that helps us do robust quoting. It backslashifies
175 # metacharacters that are still active within double-quoted strings.
176 Xsed="${SED}"' -e 1s/^X//'
177 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
179 # Same as above, but do not quote variable references.
180 double_quote_subst='s/\(["`\\]\)/\\\1/g'
182 # Re-`\' parameter expansions in output of double_quote_subst that were
183 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
184 # in input to double_quote_subst, that '$' was protected from expansion.
185 # Since each input `\' is now two `\'s, look for any number of runs of
186 # four `\'s followed by two `\'s and then a '$'. `\' that '$'.
187 bs='\\'
188 bs2='\\\\'
189 bs4='\\\\\\\\'
190 dollar='\$'
191 sed_double_backslash="\
192 s/$bs4/&\\
194 s/^$bs2$dollar/$bs&/
195 s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
196 s/\n//g"
198 # Standard options:
199 opt_dry_run=false
200 opt_help=false
201 opt_quiet=false
202 opt_verbose=false
204 # func_echo arg...
205 # Echo program name prefixed message, along with the current mode
206 # name if it has been set yet.
207 func_echo ()
209 $ECHO "$progname${mode+: }$mode: "${1+"$@"}
212 # func_verbose arg...
213 # Echo program name prefixed message in verbose mode only.
214 func_verbose ()
216 $opt_verbose && func_echo ${1+"$@"}
218 # A bug in bash halts the script if the last line of a function
219 # fails when set -e is in force, so we need another command to
220 # work around that:
224 # func_error arg...
225 # Echo program name prefixed message to standard error.
226 func_error ()
228 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
231 # func_warning arg...
232 # Echo program name prefixed warning message to standard error.
233 func_warning ()
235 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
238 # func_fatal_error arg...
239 # Echo program name prefixed message to standard error, and exit.
240 func_fatal_error ()
242 func_error ${1+"$@"}
243 exit $EXIT_FAILURE
246 # func_fatal_help arg...
247 # Echo program name prefixed message to standard error, followed by
248 # a help hint, and exit.
249 func_fatal_help ()
251 func_error ${1+"$@"}
252 func_fatal_error "$help"
254 help="Try \`$progname --help' for more information." ## default
257 # func_grep expression filename
258 # Check whether EXPRESSION matches any line of FILENAME, without output.
259 func_grep ()
261 $GREP "$1" "$2" >/dev/null 2>&1
265 # func_mkdir_p directory-path
266 # Make sure the entire path to DIRECTORY-PATH is available.
267 func_mkdir_p ()
269 my_directory_path="$1"
270 my_dir_list=
272 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
274 # Protect directory names starting with `-'
275 case $my_directory_path in
276 -*) my_directory_path="./$my_directory_path" ;;
277 esac
279 # While some portion of DIR does not yet exist...
280 while test ! -d "$my_directory_path"; do
281 # ...make a list in topmost first order. Use a colon delimited
282 # list incase some portion of path contains whitespace.
283 my_dir_list="$my_directory_path:$my_dir_list"
285 # If the last portion added has no slash in it, the list is done
286 case $my_directory_path in */*) ;; *) break ;; esac
288 # ...otherwise throw away the child directory and loop
289 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
290 done
291 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
293 save_mkdir_p_IFS="$IFS"; IFS=':'
294 for my_dir in $my_dir_list; do
295 IFS="$save_mkdir_p_IFS"
296 # mkdir can fail with a `File exist' error if two processes
297 # try to create one of the directories concurrently. Don't
298 # stop in that case!
299 $MKDIR "$my_dir" 2>/dev/null || :
300 done
301 IFS="$save_mkdir_p_IFS"
303 # Bail out if we (or some other process) failed to create a directory.
304 test -d "$my_directory_path" || \
305 func_fatal_error "Failed to create \`$1'"
310 # func_mktempdir [string]
311 # Make a temporary directory that won't clash with other running
312 # libtool processes, and avoids race conditions if possible. If
313 # given, STRING is the basename for that directory.
314 func_mktempdir ()
316 my_template="${TMPDIR-/tmp}/${1-$progname}"
318 if test "$opt_dry_run" = ":"; then
319 # Return a directory name, but don't create it in dry-run mode
320 my_tmpdir="${my_template}-$$"
321 else
323 # If mktemp works, use that first and foremost
324 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
326 if test ! -d "$my_tmpdir"; then
327 # Failing that, at least try and use $RANDOM to avoid a race
328 my_tmpdir="${my_template}-${RANDOM-0}$$"
330 save_mktempdir_umask=`umask`
331 umask 0077
332 $MKDIR "$my_tmpdir"
333 umask $save_mktempdir_umask
336 # If we're not in dry-run mode, bomb out on failure
337 test -d "$my_tmpdir" || \
338 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
341 $ECHO "X$my_tmpdir" | $Xsed
345 # func_quote_for_eval arg
346 # Aesthetically quote ARG to be evaled later.
347 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
348 # is double-quoted, suitable for a subsequent eval, whereas
349 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
350 # which are still active within double quotes backslashified.
351 func_quote_for_eval ()
353 case $1 in
354 *[\\\`\"\$]*)
355 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
357 func_quote_for_eval_unquoted_result="$1" ;;
358 esac
360 case $func_quote_for_eval_unquoted_result in
361 # Double-quote args containing shell metacharacters to delay
362 # word splitting, command substitution and and variable
363 # expansion for a subsequent eval.
364 # Many Bourne shells cannot handle close brackets correctly
365 # in scan sets, so we specify it separately.
366 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
367 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
370 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
371 esac
375 # func_quote_for_expand arg
376 # Aesthetically quote ARG to be evaled later; same as above,
377 # but do not quote variable references.
378 func_quote_for_expand ()
380 case $1 in
381 *[\\\`\"]*)
382 my_arg=`$ECHO "X$1" | $Xsed \
383 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
385 my_arg="$1" ;;
386 esac
388 case $my_arg in
389 # Double-quote args containing shell metacharacters to delay
390 # word splitting and command substitution for a subsequent eval.
391 # Many Bourne shells cannot handle close brackets correctly
392 # in scan sets, so we specify it separately.
393 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
394 my_arg="\"$my_arg\""
396 esac
398 func_quote_for_expand_result="$my_arg"
402 # func_show_eval cmd [fail_exp]
403 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
404 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
405 # is given, then evaluate it.
406 func_show_eval ()
408 my_cmd="$1"
409 my_fail_exp="${2-:}"
411 ${opt_silent-false} || {
412 func_quote_for_expand "$my_cmd"
413 eval "func_echo $func_quote_for_expand_result"
416 if ${opt_dry_run-false}; then :; else
417 eval "$my_cmd"
418 my_status=$?
419 if test "$my_status" -eq 0; then :; else
420 eval "(exit $my_status); $my_fail_exp"
429 # func_version
430 # Echo version message to standard output and exit.
431 func_version ()
433 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
434 s/^# //
435 s/^# *$//
436 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
438 }' < "$progpath"
439 exit $?
442 # func_usage
443 # Echo short help message to standard output and exit.
444 func_usage ()
446 $SED -n '/^# Usage:/,/# -h/ {
447 s/^# //
448 s/^# *$//
449 s/\$progname/'$progname'/
451 }' < "$progpath"
452 $ECHO
453 $ECHO "run \`$progname --help | more' for full usage"
454 exit $?
457 # func_help
458 # Echo long help message to standard output and exit.
459 func_help ()
461 $SED -n '/^# Usage:/,/# Report bugs to/ {
462 s/^# //
463 s/^# *$//
464 s*\$progname*'$progname'*
465 s*\$host*'"$host"'*
466 s*\$SHELL*'"$SHELL"'*
467 s*\$LTCC*'"$LTCC"'*
468 s*\$LTCFLAGS*'"$LTCFLAGS"'*
469 s*\$LD*'"$LD"'*
470 s/\$with_gnu_ld/'"$with_gnu_ld"'/
471 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
472 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
474 }' < "$progpath"
475 exit $?
478 # func_missing_arg argname
479 # Echo program name prefixed message to standard error and set global
480 # exit_cmd.
481 func_missing_arg ()
483 func_error "missing argument for $1"
484 exit_cmd=exit
487 exit_cmd=:
493 # Check that we have a working $ECHO.
494 if test "X$1" = X--no-reexec; then
495 # Discard the --no-reexec flag, and continue.
496 shift
497 elif test "X$1" = X--fallback-echo; then
498 # Avoid inline document here, it may be left over
500 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
501 # Yippee, $ECHO works!
503 else
504 # Restart under the correct shell, and then maybe $ECHO will work.
505 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
508 if test "X$1" = X--fallback-echo; then
509 # used as fallback echo
510 shift
511 cat <<EOF
514 exit $EXIT_SUCCESS
517 magic="%%%MAGIC variable%%%"
520 # Global variables.
521 # $mode is unset
522 nonopt=
523 execute_dlfiles=
524 preserve_args=
525 lo2o="s/\\.lo\$/.${objext}/"
526 o2lo="s/\\.${objext}\$/.lo/"
527 extracted_archives=
528 extracted_serial=0
530 opt_dry_run=false
531 opt_duplicate_deps=false
532 opt_silent=false
533 opt_debug=:
535 # If this variable is set in any of the actions, the command in it
536 # will be execed at the end. This prevents here-documents from being
537 # left over by shells.
538 exec_cmd=
540 # func_fatal_configuration arg...
541 # Echo program name prefixed message to standard error, followed by
542 # a configuration failure hint, and exit.
543 func_fatal_configuration ()
545 func_error ${1+"$@"}
546 func_error "See the $PACKAGE documentation for more information."
547 func_fatal_error "Fatal configuration error."
551 # func_config
552 # Display the configuration for all the tags in this script.
553 func_config ()
555 re_begincf='^# ### BEGIN LIBTOOL'
556 re_endcf='^# ### END LIBTOOL'
558 # Default configuration.
559 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
561 # Now print the configurations for the tags.
562 for tagname in $taglist; do
563 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
564 done
566 exit $?
569 # func_features
570 # Display the features supported by this script.
571 func_features ()
573 $ECHO "host: $host"
574 if test "$build_libtool_libs" = yes; then
575 $ECHO "enable shared libraries"
576 else
577 $ECHO "disable shared libraries"
579 if test "$build_old_libs" = yes; then
580 $ECHO "enable static libraries"
581 else
582 $ECHO "disable static libraries"
585 exit $?
588 # func_enable_tag tagname
589 # Verify that TAGNAME is valid, and either flag an error and exit, or
590 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
591 # variable here.
592 func_enable_tag ()
594 # Global variable:
595 tagname="$1"
597 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
598 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
599 sed_extractcf="/$re_begincf/,/$re_endcf/p"
601 # Validate tagname.
602 case $tagname in
603 *[!-_A-Za-z0-9,/]*)
604 func_fatal_error "invalid tag name: $tagname"
606 esac
608 # Don't test for the "default" C tag, as we know it's
609 # there but not specially marked.
610 case $tagname in
611 CC) ;;
613 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
614 taglist="$taglist $tagname"
616 # Evaluate the configuration. Be careful to quote the path
617 # and the sed script, to avoid splitting on whitespace, but
618 # also don't use non-portable quotes within backquotes within
619 # quotes we have to do it in 2 steps:
620 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
621 eval "$extractedcf"
622 else
623 func_error "ignoring unknown tag $tagname"
626 esac
630 func_mode_help ()
632 # We need to display help for each of the modes.
633 case $mode in
635 # Generic help is extracted from the usage comments
636 # at the start of this file.
637 func_help
640 clean)
641 $ECHO \
642 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
644 Remove files from the build directory.
646 RM is the name of the program to use to delete files associated with each FILE
647 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
648 to RM.
650 If FILE is a libtool library, object or program, all the files associated
651 with it are deleted. Otherwise, only FILE itself is deleted using RM."
654 compile)
655 $ECHO \
656 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
658 Compile a source file into a libtool library object.
660 This mode accepts the following additional options:
662 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
663 -no-suppress do not suppress compiler output for multiple passes
664 -prefer-pic try to building PIC objects only
665 -prefer-non-pic try to building non-PIC objects only
666 -shared do not build a \`.o' file suitable for static linking
667 -static only build a \`.o' file suitable for static linking
669 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
670 from the given SOURCEFILE.
672 The output file name is determined by removing the directory component from
673 SOURCEFILE, then substituting the C source code suffix \`.c' with the
674 library object suffix, \`.lo'."
677 execute)
678 $ECHO \
679 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
681 Automatically set library path, then run a program.
683 This mode accepts the following additional options:
685 -dlopen FILE add the directory containing FILE to the library path
687 This mode sets the library path environment variable according to \`-dlopen'
688 flags.
690 If any of the ARGS are libtool executable wrappers, then they are translated
691 into their corresponding uninstalled binary, and any of their required library
692 directories are added to the library path.
694 Then, COMMAND is executed, with ARGS as arguments."
697 finish)
698 $ECHO \
699 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
701 Complete the installation of libtool libraries.
703 Each LIBDIR is a directory that contains libtool libraries.
705 The commands that this mode executes may require superuser privileges. Use
706 the \`--dry-run' option if you just want to see what would be executed."
709 install)
710 $ECHO \
711 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
713 Install executables or libraries.
715 INSTALL-COMMAND is the installation command. The first component should be
716 either the \`install' or \`cp' program.
718 The following components of INSTALL-COMMAND are treated specially:
720 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
722 The rest of the components are interpreted as arguments to that command (only
723 BSD-compatible install options are recognized)."
726 link)
727 $ECHO \
728 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
730 Link object files or libraries together to form another library, or to
731 create an executable program.
733 LINK-COMMAND is a command using the C compiler that you would use to create
734 a program from several object files.
736 The following components of LINK-COMMAND are treated specially:
738 -all-static do not do any dynamic linking at all
739 -avoid-version do not add a version suffix if possible
740 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
741 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
742 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
743 -export-symbols SYMFILE
744 try to export only the symbols listed in SYMFILE
745 -export-symbols-regex REGEX
746 try to export only the symbols matching REGEX
747 -LLIBDIR search LIBDIR for required installed libraries
748 -lNAME OUTPUT-FILE requires the installed library libNAME
749 -module build a library that can dlopened
750 -no-fast-install disable the fast-install mode
751 -no-install link a not-installable executable
752 -no-undefined declare that a library does not refer to external symbols
753 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
754 -objectlist FILE Use a list of object files found in FILE to specify objects
755 -precious-files-regex REGEX
756 don't remove output files matching REGEX
757 -release RELEASE specify package release information
758 -rpath LIBDIR the created library will eventually be installed in LIBDIR
759 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
760 -shared only do dynamic linking of libtool libraries
761 -shrext SUFFIX override the standard shared library file extension
762 -static do not do any dynamic linking of uninstalled libtool libraries
763 -static-libtool-libs
764 do not do any dynamic linking of libtool libraries
765 -version-info CURRENT[:REVISION[:AGE]]
766 specify library version info [each variable defaults to 0]
767 -weak LIBNAME declare that the target provides the LIBNAME interface
769 All other options (arguments beginning with \`-') are ignored.
771 Every other argument is treated as a filename. Files ending in \`.la' are
772 treated as uninstalled libtool libraries, other files are standard or library
773 object files.
775 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
776 only library objects (\`.lo' files) may be specified, and \`-rpath' is
777 required, except when creating a convenience library.
779 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
780 using \`ar' and \`ranlib', or on Windows using \`lib'.
782 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
783 is created, otherwise an executable program is created."
786 uninstall)
787 $ECHO \
788 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
790 Remove libraries from an installation directory.
792 RM is the name of the program to use to delete files associated with each FILE
793 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
794 to RM.
796 If FILE is a libtool library, all the files associated with it are deleted.
797 Otherwise, only FILE itself is deleted using RM."
801 func_fatal_help "invalid operation mode \`$mode'"
803 esac
805 $ECHO
806 $ECHO "Try \`$progname --help' for more information about other modes."
808 exit $?
811 # Generated shell functions inserted here.
814 # Parse options once, thoroughly. This comes as soon as possible in
815 # the script to make things like `libtool --version' happen quickly.
818 # Shorthand for --mode=foo, only valid as the first argument
819 case $1 in
820 clean|clea|cle|cl)
821 shift; set dummy --mode clean ${1+"$@"}; shift
823 compile|compil|compi|comp|com|co|c)
824 shift; set dummy --mode compile ${1+"$@"}; shift
826 execute|execut|execu|exec|exe|ex|e)
827 shift; set dummy --mode execute ${1+"$@"}; shift
829 finish|finis|fini|fin|fi|f)
830 shift; set dummy --mode finish ${1+"$@"}; shift
832 install|instal|insta|inst|ins|in|i)
833 shift; set dummy --mode install ${1+"$@"}; shift
835 link|lin|li|l)
836 shift; set dummy --mode link ${1+"$@"}; shift
838 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
839 shift; set dummy --mode uninstall ${1+"$@"}; shift
841 esac
843 # Parse non-mode specific arguments:
844 while test "$#" -gt 0; do
845 opt="$1"
846 shift
848 case $opt in
849 --config) func_config ;;
851 --debug) preserve_args="$preserve_args $opt"
852 func_echo "enabling shell trace mode"
853 opt_debug='set -x'
854 $opt_debug
857 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
858 execute_dlfiles="$execute_dlfiles $1"
859 shift
862 --dry-run | -n) opt_dry_run=: ;;
863 --features) func_features ;;
864 --finish) mode="finish" ;;
866 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
867 case $1 in
868 # Valid mode arguments:
869 clean) ;;
870 compile) ;;
871 execute) ;;
872 finish) ;;
873 install) ;;
874 link) ;;
875 relink) ;;
876 uninstall) ;;
878 # Catch anything else as an error
879 *) func_error "invalid argument for $opt"
880 exit_cmd=exit
881 break
883 esac
885 mode="$1"
886 shift
889 --preserve-dup-deps)
890 opt_duplicate_deps=: ;;
892 --quiet|--silent) preserve_args="$preserve_args $opt"
893 opt_silent=:
896 --verbose| -v) preserve_args="$preserve_args $opt"
897 opt_silent=false
900 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
901 preserve_args="$preserve_args $opt $1"
902 func_enable_tag "$1" # tagname is set here
903 shift
906 # Separate optargs to long options:
907 -dlopen=*|--mode=*|--tag=*)
908 func_opt_split "$opt"
909 set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
910 shift
913 -\?|-h) func_usage ;;
914 --help) opt_help=: ;;
915 --version) func_version ;;
917 -*) func_fatal_help "unrecognized option \`$opt'" ;;
919 *) nonopt="$opt"
920 break
922 esac
923 done
925 # Now that we've collected a possible --mode arg, show help if necessary
926 $opt_help && func_mode_help
928 case $host in
929 *cygwin* | *mingw* | *pw32*)
930 # don't eliminate duplications in $postdeps and $predeps
931 opt_duplicate_compiler_generated_deps=:
934 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
936 esac
938 # Having warned about all mis-specified options, bail out if
939 # anything was wrong.
940 $exit_cmd $EXIT_FAILURE
943 # func_check_version_match
944 # Ensure that we are using m4 macros, and libtool script from the same
945 # release of libtool.
946 func_check_version_match ()
948 if test "$package_revision" != "$macro_revision"; then
949 if test "$VERSION" != "$macro_version"; then
950 if test -z "$macro_version"; then
951 cat >&2 <<_LT_EOF
952 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
953 $progname: definition of this LT_INIT comes from an older release.
954 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
955 $progname: and run autoconf again.
956 _LT_EOF
957 else
958 cat >&2 <<_LT_EOF
959 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
960 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
961 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
962 $progname: and run autoconf again.
963 _LT_EOF
965 else
966 cat >&2 <<_LT_EOF
967 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
968 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
969 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
970 $progname: of $PACKAGE $VERSION and run autoconf again.
971 _LT_EOF
974 exit $EXIT_MISMATCH
979 ## ----------- ##
980 ## Main. ##
981 ## ----------- ##
984 # Sanity checks first:
985 func_check_version_match
987 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
988 func_fatal_configuration "not configured to build any kind of library"
991 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
994 # Darwin sucks
995 eval std_shrext=\"$shrext_cmds\"
998 # Only execute mode is allowed to have -dlopen flags.
999 if test -n "$execute_dlfiles" && test "$mode" != execute; then
1000 func_error "unrecognized option \`-dlopen'"
1001 $ECHO "$help" 1>&2
1002 exit $EXIT_FAILURE
1005 # Change the help message to a mode-specific one.
1006 generic_help="$help"
1007 help="Try \`$progname --help --mode=$mode' for more information."
1011 # func_lalib_p file
1012 # True iff FILE is a libtool `.la' library or `.lo' object file.
1013 # This function is only a basic sanity check; it will hardly flush out
1014 # determined imposters.
1015 func_lalib_p ()
1017 $SED -e 4q "$1" 2>/dev/null \
1018 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
1021 # func_lalib_unsafe_p file
1022 # True iff FILE is a libtool `.la' library or `.lo' object file.
1023 # This function implements the same check as func_lalib_p without
1024 # resorting to external programs. To this end, it redirects stdin and
1025 # closes it afterwards, without saving the original file descriptor.
1026 # As a safety measure, use it only where a negative result would be
1027 # fatal anyway. Works if `file' does not exist.
1028 func_lalib_unsafe_p ()
1030 lalib_p=no
1031 if test -r "$1" && exec 5<&1 <"$1"; then
1032 for lalib_p_l in 1 2 3 4
1034 read lalib_p_line
1035 case "$lalib_p_line" in
1036 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1037 esac
1038 done
1039 exec 1<&5 5<&-
1041 test "$lalib_p" = yes
1044 # func_ltwrapper_p file
1045 # True iff FILE is a libtool wrapper script.
1046 # This function is only a basic sanity check; it will hardly flush out
1047 # determined imposters.
1048 func_ltwrapper_p ()
1050 func_lalib_p "$1"
1054 # func_execute_cmds commands fail_cmd
1055 # Execute tilde-delimited COMMANDS.
1056 # If FAIL_CMD is given, eval that upon failure.
1057 # FAIL_CMD may read-access the current command in variable CMD!
1058 func_execute_cmds ()
1060 $opt_debug
1061 save_ifs=$IFS; IFS='~'
1062 for cmd in $1; do
1063 IFS=$save_ifs
1064 eval cmd=\"$cmd\"
1065 func_show_eval "$cmd" "${2-:}"
1066 done
1067 IFS=$save_ifs
1071 # func_source file
1072 # Source FILE, adding directory component if necessary.
1073 # Note that it is not necessary on cygwin/mingw to append a dot to
1074 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1075 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1076 # `FILE.' does not work on cygwin managed mounts.
1077 func_source ()
1079 $opt_debug
1080 case $1 in
1081 */* | *\\*) . "$1" ;;
1082 *) . "./$1" ;;
1083 esac
1087 # func_win32_libid arg
1088 # return the library type of file 'arg'
1090 # Need a lot of goo to handle *both* DLLs and import libs
1091 # Has to be a shell function in order to 'eat' the argument
1092 # that is supplied when $file_magic_command is called.
1093 func_win32_libid ()
1095 $opt_debug
1096 win32_libid_type="unknown"
1097 win32_fileres=`file -L $1 2>/dev/null`
1098 case $win32_fileres in
1099 *ar\ archive\ import\ library*) # definitely import
1100 win32_libid_type="x86 archive import"
1102 *ar\ archive*) # could be an import, or static
1103 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1104 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1105 win32_nmres=`eval $NM -f posix -A $1 |
1106 $SED -n -e '
1107 1,100{
1108 / I /{
1109 s,.*,import,
1114 case $win32_nmres in
1115 import*) win32_libid_type="x86 archive import";;
1116 *) win32_libid_type="x86 archive static";;
1117 esac
1120 *DLL*)
1121 win32_libid_type="x86 DLL"
1123 *executable*) # but shell scripts are "executable" too...
1124 case $win32_fileres in
1125 *MS\ Windows\ PE\ Intel*)
1126 win32_libid_type="x86 DLL"
1128 esac
1130 esac
1131 $ECHO "$win32_libid_type"
1136 # func_infer_tag arg
1137 # Infer tagged configuration to use if any are available and
1138 # if one wasn't chosen via the "--tag" command line option.
1139 # Only attempt this if the compiler in the base compile
1140 # command doesn't match the default compiler.
1141 # arg is usually of the form 'gcc ...'
1142 func_infer_tag ()
1144 $opt_debug
1145 if test -n "$available_tags" && test -z "$tagname"; then
1146 CC_quoted=
1147 for arg in $CC; do
1148 func_quote_for_eval "$arg"
1149 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1150 done
1151 case $@ in
1152 # Blanks in the command may have been stripped by the calling shell,
1153 # but not from the CC environment variable when configure was run.
1154 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1155 # Blanks at the start of $base_compile will cause this to fail
1156 # if we don't check for them as well.
1158 for z in $available_tags; do
1159 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1160 # Evaluate the configuration.
1161 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1162 CC_quoted=
1163 for arg in $CC; do
1164 # Double-quote args containing other shell metacharacters.
1165 func_quote_for_eval "$arg"
1166 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1167 done
1168 case "$@ " in
1169 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1170 # The compiler in the base compile command matches
1171 # the one in the tagged configuration.
1172 # Assume this is the tagged configuration we want.
1173 tagname=$z
1174 break
1176 esac
1178 done
1179 # If $tagname still isn't set, then no tagged configuration
1180 # was found and let the user know that the "--tag" command
1181 # line option must be used.
1182 if test -z "$tagname"; then
1183 func_echo "unable to infer tagged configuration"
1184 func_fatal_error "specify a tag with \`--tag'"
1185 # else
1186 # func_verbose "using $tagname tagged configuration"
1189 esac
1195 # func_generate_dlsyms outputname originator pic_p
1196 # Extract symbols from dlprefiles and create ${outputname}S.o with
1197 # a dlpreopen symbol table.
1198 func_generate_dlsyms ()
1200 $opt_debug
1201 my_outputname="$1"
1202 my_originator="$2"
1203 my_pic_p="${3-no}"
1204 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1205 my_dlsyms=
1207 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1208 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1209 my_dlsyms="${my_outputname}S.c"
1210 else
1211 func_error "not configured to extract global symbols from dlpreopened files"
1215 if test -n "$my_dlsyms"; then
1216 case $my_dlsyms in
1217 "") ;;
1218 *.c)
1219 # Discover the nlist of each of the dlfiles.
1220 nlist="$output_objdir/${my_outputname}.nm"
1222 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1224 # Parse the name list into a source file.
1225 func_echo "creating $output_objdir/$my_dlsyms"
1227 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1228 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1229 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1231 #ifdef __cplusplus
1232 extern \"C\" {
1233 #endif
1235 /* External symbol declarations for the compiler. */\
1238 if test "$dlself" = yes; then
1239 func_echo "generating symbol list for \`$output'"
1241 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1243 # Add our own program objects to the symbol list.
1244 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1245 for progfile in $progfiles; do
1246 func_echo "extracting global C symbols from \`$progfile'"
1247 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1248 done
1250 if test -n "$exclude_expsyms"; then
1251 $opt_dry_run || {
1252 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1253 eval '$MV "$nlist"T "$nlist"'
1257 if test -n "$export_symbols_regex"; then
1258 $opt_dry_run || {
1259 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1260 eval '$MV "$nlist"T "$nlist"'
1264 # Prepare the list of exported symbols
1265 if test -z "$export_symbols"; then
1266 export_symbols="$output_objdir/$outputname.exp"
1267 $opt_dry_run || {
1268 $RM $export_symbols
1269 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1270 case $host in
1271 *cygwin* | *mingw* )
1272 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1273 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1275 esac
1277 else
1278 $opt_dry_run || {
1279 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1280 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1281 eval '$MV "$nlist"T "$nlist"'
1282 case $host in
1283 *cygwin | *mingw* )
1284 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1285 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1287 esac
1292 for dlprefile in $dlprefiles; do
1293 func_echo "extracting global C symbols from \`$dlprefile'"
1294 func_basename "$dlprefile"
1295 name="$func_basename_result"
1296 $opt_dry_run || {
1297 eval '$ECHO ": $name " >> "$nlist"'
1298 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1300 done
1302 $opt_dry_run || {
1303 # Make sure we have at least an empty file.
1304 test -f "$nlist" || : > "$nlist"
1306 if test -n "$exclude_expsyms"; then
1307 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1308 $MV "$nlist"T "$nlist"
1311 # Try sorting and uniquifying the output.
1312 if $GREP -v "^: " < "$nlist" |
1313 if sort -k 3 </dev/null >/dev/null 2>&1; then
1314 sort -k 3
1315 else
1316 sort +2
1317 fi |
1318 uniq > "$nlist"S; then
1320 else
1321 $GREP -v "^: " < "$nlist" > "$nlist"S
1324 if test -f "$nlist"S; then
1325 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1326 else
1327 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1330 $ECHO >> "$output_objdir/$my_dlsyms" "\
1332 /* The mapping between symbol names and symbols. */
1333 typedef struct {
1334 const char *name;
1335 void *address;
1336 } lt_dlsymlist;
1338 case $host in
1339 *cygwin* | *mingw* )
1340 $ECHO >> "$output_objdir/$my_dlsyms" "\
1341 /* DATA imports from DLLs on WIN32 con't be const, because
1342 runtime relocations are performed -- see ld's documentation
1343 on pseudo-relocs. */"
1344 lt_dlsym_const= ;;
1345 *osf5*)
1346 echo >> "$output_objdir/$my_dlsyms" "\
1347 /* This system does not cope well with relocations in const data */"
1348 lt_dlsym_const= ;;
1350 lt_dlsym_const=const ;;
1351 esac
1353 $ECHO >> "$output_objdir/$my_dlsyms" "\
1354 extern $lt_dlsym_const lt_dlsymlist
1355 lt_${my_prefix}_LTX_preloaded_symbols[];
1356 $lt_dlsym_const lt_dlsymlist
1357 lt_${my_prefix}_LTX_preloaded_symbols[] =
1359 { \"$my_originator\", (void *) 0 },"
1361 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1363 $ECHO >> "$output_objdir/$my_dlsyms" "\
1364 {0, (void *) 0}
1367 /* This works around a problem in FreeBSD linker */
1368 #ifdef FREEBSD_WORKAROUND
1369 static const void *lt_preloaded_setup() {
1370 return lt_${my_prefix}_LTX_preloaded_symbols;
1372 #endif
1374 #ifdef __cplusplus
1376 #endif\
1378 } # !$opt_dry_run
1380 pic_flag_for_symtable=
1381 case "$compile_command " in
1382 *" -static "*) ;;
1384 case $host in
1385 # compiling the symbol table file with pic_flag works around
1386 # a FreeBSD bug that causes programs to crash when -lm is
1387 # linked before any other PIC object. But we must not use
1388 # pic_flag when linking with -static. The problem exists in
1389 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1390 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1391 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1392 *-*-hpux*)
1393 pic_flag_for_symtable=" $pic_flag" ;;
1395 if test "X$my_pic_p" != Xno; then
1396 pic_flag_for_symtable=" $pic_flag"
1399 esac
1401 esac
1402 symtab_cflags=
1403 for arg in $LTCFLAGS; do
1404 case $arg in
1405 -pie | -fpie | -fPIE) ;;
1406 *) symtab_cflags="$symtab_cflags $arg" ;;
1407 esac
1408 done
1410 # Now compile the dynamic symbol file.
1411 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1413 # Clean up the generated files.
1414 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1416 # Transform the symbol file into the correct name.
1417 symfileobj="$output_objdir/${my_outputname}S.$objext"
1418 case $host in
1419 *cygwin* | *mingw* )
1420 if test -f "$output_objdir/$my_outputname.def"; then
1421 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1422 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1423 else
1424 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1425 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1429 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1430 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1432 esac
1435 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1437 esac
1438 else
1439 # We keep going just in case the user didn't refer to
1440 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1441 # really was required.
1443 # Nullify the symbol file.
1444 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1445 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1449 # func_extract_an_archive dir oldlib
1450 func_extract_an_archive ()
1452 $opt_debug
1453 f_ex_an_ar_dir="$1"; shift
1454 f_ex_an_ar_oldlib="$1"
1455 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
1456 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1458 else
1459 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1464 # func_extract_archives gentop oldlib ...
1465 func_extract_archives ()
1467 $opt_debug
1468 my_gentop="$1"; shift
1469 my_oldlibs=${1+"$@"}
1470 my_oldobjs=""
1471 my_xlib=""
1472 my_xabs=""
1473 my_xdir=""
1475 for my_xlib in $my_oldlibs; do
1476 # Extract the objects.
1477 case $my_xlib in
1478 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1479 *) my_xabs=`pwd`"/$my_xlib" ;;
1480 esac
1481 func_basename "$my_xlib"
1482 my_xlib="$func_basename_result"
1483 my_xlib_u=$my_xlib
1484 while :; do
1485 case " $extracted_archives " in
1486 *" $my_xlib_u "*)
1487 extracted_serial=`expr $extracted_serial + 1`
1488 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1489 *) break ;;
1490 esac
1491 done
1492 extracted_archives="$extracted_archives $my_xlib_u"
1493 my_xdir="$my_gentop/$my_xlib_u"
1495 func_mkdir_p "$my_xdir"
1497 case $host in
1498 *-darwin*)
1499 func_echo "Extracting $my_xabs"
1500 # Do not bother doing anything if just a dry run
1501 $opt_dry_run || {
1502 darwin_orig_dir=`pwd`
1503 cd $my_xdir || exit $?
1504 darwin_archive=$my_xabs
1505 darwin_curdir=`pwd`
1506 darwin_base_archive=`basename $darwin_archive`
1507 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1508 if test -n "$darwin_arches"; then
1509 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1510 darwin_arch=
1511 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1512 for darwin_arch in $darwin_arches ; do
1513 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1514 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1515 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1516 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1517 cd "$darwin_curdir"
1518 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1519 done # $darwin_arches
1520 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1521 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1522 darwin_file=
1523 darwin_files=
1524 for darwin_file in $darwin_filelist; do
1525 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1526 lipo -create -output "$darwin_file" $darwin_files
1527 done # $darwin_filelist
1528 $RM -rf unfat-$$
1529 cd "$darwin_orig_dir"
1530 else
1531 cd $darwin_orig_dir
1532 func_extract_an_archive "$my_xdir" "$my_xabs"
1533 fi # $darwin_arches
1534 } # !$opt_dry_run
1537 func_extract_an_archive "$my_xdir" "$my_xabs"
1539 esac
1540 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1541 done
1543 func_extract_archives_result="$my_oldobjs"
1548 # func_write_libtool_object output_name pic_name nonpic_name
1549 # Create a libtool object file (analogous to a ".la" file),
1550 # but don't create it if we're doing a dry run.
1551 func_write_libtool_object ()
1553 write_libobj=${1}
1554 if test "$build_libtool_libs" = yes; then
1555 write_lobj=\'${2}\'
1556 else
1557 write_lobj=none
1560 if test "$build_old_libs" = yes; then
1561 write_oldobj=\'${3}\'
1562 else
1563 write_oldobj=none
1566 $opt_dry_run || {
1567 cat >${write_libobj}T <<EOF
1568 # $write_libobj - a libtool object file
1569 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1571 # Please DO NOT delete this file!
1572 # It is necessary for linking the library.
1574 # Name of the PIC object.
1575 pic_object=$write_lobj
1577 # Name of the non-PIC object
1578 non_pic_object=$write_oldobj
1581 mv -f "${write_libobj}T" "${write_libobj}"
1585 # func_mode_compile arg...
1586 func_mode_compile ()
1588 $opt_debug
1589 # Get the compilation command and the source file.
1590 base_compile=
1591 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1592 suppress_opt=yes
1593 suppress_output=
1594 arg_mode=normal
1595 libobj=
1596 later=
1597 pie_flag=
1599 for arg
1601 case $arg_mode in
1602 arg )
1603 # do not "continue". Instead, add this to base_compile
1604 lastarg="$arg"
1605 arg_mode=normal
1608 target )
1609 libobj="$arg"
1610 arg_mode=normal
1611 continue
1614 normal )
1615 # Accept any command-line options.
1616 case $arg in
1618 test -n "$libobj" && \
1619 func_fatal_error "you cannot specify \`-o' more than once"
1620 arg_mode=target
1621 continue
1624 -pie | -fpie | -fPIE)
1625 pie_flag="$pie_flag $arg"
1626 continue
1629 -shared | -static | -prefer-pic | -prefer-non-pic)
1630 later="$later $arg"
1631 continue
1634 -no-suppress)
1635 suppress_opt=no
1636 continue
1639 -Xcompiler)
1640 arg_mode=arg # the next one goes into the "base_compile" arg list
1641 continue # The current "srcfile" will either be retained or
1642 ;; # replaced later. I would guess that would be a bug.
1644 -Wc,*)
1645 func_stripname '-Wc,' '' "$arg"
1646 args=$func_stripname_result
1647 lastarg=
1648 save_ifs="$IFS"; IFS=','
1649 for arg in $args; do
1650 IFS="$save_ifs"
1651 func_quote_for_eval "$arg"
1652 lastarg="$lastarg $func_quote_for_eval_result"
1653 done
1654 IFS="$save_ifs"
1655 func_stripname ' ' '' "$lastarg"
1656 lastarg=$func_stripname_result
1658 # Add the arguments to base_compile.
1659 base_compile="$base_compile $lastarg"
1660 continue
1664 # Accept the current argument as the source file.
1665 # The previous "srcfile" becomes the current argument.
1667 lastarg="$srcfile"
1668 srcfile="$arg"
1670 esac # case $arg
1672 esac # case $arg_mode
1674 # Aesthetically quote the previous argument.
1675 func_quote_for_eval "$lastarg"
1676 base_compile="$base_compile $func_quote_for_eval_result"
1677 done # for arg
1679 case $arg_mode in
1680 arg)
1681 func_fatal_error "you must specify an argument for -Xcompile"
1683 target)
1684 func_fatal_error "you must specify a target with \`-o'"
1687 # Get the name of the library object.
1688 test -z "$libobj" && {
1689 func_basename "$srcfile"
1690 libobj="$func_basename_result"
1693 esac
1695 # Recognize several different file suffixes.
1696 # If the user specifies -o file.o, it is replaced with file.lo
1697 xform='[cCFSifmso]'
1698 case $libobj in
1699 *.ada) xform=ada ;;
1700 *.adb) xform=adb ;;
1701 *.ads) xform=ads ;;
1702 *.asm) xform=asm ;;
1703 *.c++) xform=c++ ;;
1704 *.cc) xform=cc ;;
1705 *.ii) xform=ii ;;
1706 *.class) xform=class ;;
1707 *.cpp) xform=cpp ;;
1708 *.cxx) xform=cxx ;;
1709 *.[fF][09]?) xform='[fF][09].' ;;
1710 *.for) xform=for ;;
1711 *.java) xform=java ;;
1712 *.obj) xform=obj ;;
1713 esac
1715 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1717 case $libobj in
1718 *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
1720 func_fatal_error "cannot determine name of library object from \`$libobj'"
1722 esac
1724 func_infer_tag $base_compile
1726 for arg in $later; do
1727 case $arg in
1728 -shared)
1729 test "$build_libtool_libs" != yes && \
1730 func_fatal_configuration "can not build a shared library"
1731 build_old_libs=no
1732 continue
1735 -static)
1736 build_libtool_libs=no
1737 build_old_libs=yes
1738 continue
1741 -prefer-pic)
1742 pic_mode=yes
1743 continue
1746 -prefer-non-pic)
1747 pic_mode=no
1748 continue
1750 esac
1751 done
1753 func_quote_for_eval "$libobj"
1754 test "X$libobj" != "X$func_quote_for_eval_result" \
1755 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1756 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1757 func_basename "$obj"
1758 objname="$func_basename_result"
1759 func_dirname "$obj" "/" ""
1760 xdir="$func_dirname_result"
1761 lobj=${xdir}$objdir/$objname
1763 test -z "$base_compile" && \
1764 func_fatal_help "you must specify a compilation command"
1766 # Delete any leftover library objects.
1767 if test "$build_old_libs" = yes; then
1768 removelist="$obj $lobj $libobj ${libobj}T"
1769 else
1770 removelist="$lobj $libobj ${libobj}T"
1773 $opt_dry_run || $RM $removelist
1774 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1776 # On Cygwin there's no "real" PIC flag so we must build both object types
1777 case $host_os in
1778 cygwin* | mingw* | pw32* | os2*)
1779 pic_mode=default
1781 esac
1782 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1783 # non-PIC code in shared libraries is not supported
1784 pic_mode=default
1787 # Calculate the filename of the output object if compiler does
1788 # not support -o with -c
1789 if test "$compiler_c_o" = no; then
1790 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1791 lockfile="$output_obj.lock"
1792 removelist="$removelist $output_obj $lockfile"
1793 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1794 else
1795 output_obj=
1796 need_locks=no
1797 lockfile=
1800 # Lock this critical section if it is needed
1801 # We use this script file to make the link, it avoids creating a new file
1802 if test "$need_locks" = yes; then
1803 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1804 func_echo "Waiting for $lockfile to be removed"
1805 sleep 2
1806 done
1807 elif test "$need_locks" = warn; then
1808 if test -f "$lockfile"; then
1809 $ECHO "\
1810 *** ERROR, $lockfile exists and contains:
1811 `cat $lockfile 2>/dev/null`
1813 This indicates that another process is trying to use the same
1814 temporary object file, and libtool could not work around it because
1815 your compiler does not support \`-c' and \`-o' together. If you
1816 repeat this compilation, it may succeed, by chance, but you had better
1817 avoid parallel builds (make -j) in this platform, or get a better
1818 compiler."
1820 $opt_dry_run || $RM $removelist
1821 exit $EXIT_FAILURE
1823 $ECHO "$srcfile" > "$lockfile"
1826 if test -n "$fix_srcfile_path"; then
1827 eval srcfile=\"$fix_srcfile_path\"
1829 func_quote_for_eval "$srcfile"
1830 qsrcfile=$func_quote_for_eval_result
1832 $opt_dry_run || $RM "$libobj" "${libobj}T"
1834 # Only build a PIC object if we are building libtool libraries.
1835 if test "$build_libtool_libs" = yes; then
1836 # Without this assignment, base_compile gets emptied.
1837 fbsd_hideous_sh_bug=$base_compile
1839 if test "$pic_mode" != no; then
1840 command="$base_compile $qsrcfile $pic_flag"
1841 else
1842 # Don't build PIC code
1843 command="$base_compile $qsrcfile"
1846 func_mkdir_p "$xdir$objdir"
1848 if test -z "$output_obj"; then
1849 # Place PIC objects in $objdir
1850 command="$command -o $lobj"
1853 $opt_dry_run || $RM "$lobj" "$output_obj"
1855 func_show_eval "$command" \
1856 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1858 if test "$need_locks" = warn &&
1859 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1860 $ECHO "\
1861 *** ERROR, $lockfile contains:
1862 `cat $lockfile 2>/dev/null`
1864 but it should contain:
1865 $srcfile
1867 This indicates that another process is trying to use the same
1868 temporary object file, and libtool could not work around it because
1869 your compiler does not support \`-c' and \`-o' together. If you
1870 repeat this compilation, it may succeed, by chance, but you had better
1871 avoid parallel builds (make -j) in this platform, or get a better
1872 compiler."
1874 $opt_dry_run || $RM $removelist
1875 exit $EXIT_FAILURE
1878 # Just move the object if needed, then go on to compile the next one
1879 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1880 func_show_eval '$MV "$output_obj" "$lobj"' \
1881 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1884 # Allow error messages only from the first compilation.
1885 if test "$suppress_opt" = yes; then
1886 suppress_output=' >/dev/null 2>&1'
1890 # Only build a position-dependent object if we build old libraries.
1891 if test "$build_old_libs" = yes; then
1892 if test "$pic_mode" != yes; then
1893 # Don't build PIC code
1894 command="$base_compile $qsrcfile$pie_flag"
1895 else
1896 command="$base_compile $qsrcfile $pic_flag"
1898 if test "$compiler_c_o" = yes; then
1899 command="$command -o $obj"
1902 # Suppress compiler output if we already did a PIC compilation.
1903 command="$command$suppress_output"
1904 $opt_dry_run || $RM "$obj" "$output_obj"
1905 func_show_eval "$command" \
1906 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1908 if test "$need_locks" = warn &&
1909 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1910 $ECHO "\
1911 *** ERROR, $lockfile contains:
1912 `cat $lockfile 2>/dev/null`
1914 but it should contain:
1915 $srcfile
1917 This indicates that another process is trying to use the same
1918 temporary object file, and libtool could not work around it because
1919 your compiler does not support \`-c' and \`-o' together. If you
1920 repeat this compilation, it may succeed, by chance, but you had better
1921 avoid parallel builds (make -j) in this platform, or get a better
1922 compiler."
1924 $opt_dry_run || $RM $removelist
1925 exit $EXIT_FAILURE
1928 # Just move the object if needed
1929 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1930 func_show_eval '$MV "$output_obj" "$obj"' \
1931 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1935 $opt_dry_run || {
1936 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1938 # Unlock the critical section if it was locked
1939 if test "$need_locks" != no; then
1940 $RM "$lockfile"
1944 exit $EXIT_SUCCESS
1947 test "$mode" = compile && func_mode_compile ${1+"$@"}
1950 # func_mode_execute arg...
1951 func_mode_execute ()
1953 $opt_debug
1954 # The first argument is the command name.
1955 cmd="$nonopt"
1956 test -z "$cmd" && \
1957 func_fatal_help "you must specify a COMMAND"
1959 # Handle -dlopen flags immediately.
1960 for file in $execute_dlfiles; do
1961 test -f "$file" \
1962 || func_fatal_help "\`$file' is not a file"
1964 dir=
1965 case $file in
1966 *.la)
1967 # Check to see that this really is a libtool archive.
1968 func_lalib_unsafe_p "$file" \
1969 || func_fatal_help "\`$lib' is not a valid libtool archive"
1971 # Read the libtool library.
1972 dlname=
1973 library_names=
1974 func_source "$file"
1976 # Skip this library if it cannot be dlopened.
1977 if test -z "$dlname"; then
1978 # Warn if it was a shared library.
1979 test -n "$library_names" && \
1980 func_warning "\`$file' was not linked with \`-export-dynamic'"
1981 continue
1984 func_dirname "$file" "" "."
1985 dir="$func_dirname_result"
1987 if test -f "$dir/$objdir/$dlname"; then
1988 dir="$dir/$objdir"
1989 else
1990 if test ! -f "$dir/$dlname"; then
1991 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1996 *.lo)
1997 # Just add the directory containing the .lo file.
1998 func_dirname "$file" "" "."
1999 dir="$func_dirname_result"
2003 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
2004 continue
2006 esac
2008 # Get the absolute pathname.
2009 absdir=`cd "$dir" && pwd`
2010 test -n "$absdir" && dir="$absdir"
2012 # Now add the directory to shlibpath_var.
2013 if eval "test -z \"\$$shlibpath_var\""; then
2014 eval "$shlibpath_var=\"\$dir\""
2015 else
2016 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
2018 done
2020 # This variable tells wrapper scripts just to set shlibpath_var
2021 # rather than running their programs.
2022 libtool_execute_magic="$magic"
2024 # Check if any of the arguments is a wrapper script.
2025 args=
2026 for file
2028 case $file in
2029 -*) ;;
2031 # Do a test to see if this is really a libtool program.
2032 if func_ltwrapper_p "$file"; then
2033 func_source "$file"
2035 # Transform arg to wrapped name.
2036 file="$progdir/$program"
2039 esac
2040 # Quote arguments (to preserve shell metacharacters).
2041 func_quote_for_eval "$file"
2042 args="$args $func_quote_for_eval_result"
2043 done
2045 if test "X$opt_dry_run" = Xfalse; then
2046 if test -n "$shlibpath_var"; then
2047 # Export the shlibpath_var.
2048 eval "export $shlibpath_var"
2051 # Restore saved environment variables
2052 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2054 eval "if test \"\${save_$lt_var+set}\" = set; then
2055 $lt_var=\$save_$lt_var; export $lt_var
2056 else
2057 $lt_unset $lt_var
2059 done
2061 # Now prepare to actually exec the command.
2062 exec_cmd="\$cmd$args"
2063 else
2064 # Display what would be done.
2065 if test -n "$shlibpath_var"; then
2066 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2067 $ECHO "export $shlibpath_var"
2069 $ECHO "$cmd$args"
2070 exit $EXIT_SUCCESS
2074 test "$mode" = execute && func_mode_execute ${1+"$@"}
2077 # func_mode_finish arg...
2078 func_mode_finish ()
2080 $opt_debug
2081 libdirs="$nonopt"
2082 admincmds=
2084 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2085 for dir
2087 libdirs="$libdirs $dir"
2088 done
2090 for libdir in $libdirs; do
2091 if test -n "$finish_cmds"; then
2092 # Do each command in the finish commands.
2093 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2094 '"$cmd"'"'
2096 if test -n "$finish_eval"; then
2097 # Do the single finish_eval.
2098 eval cmds=\"$finish_eval\"
2099 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2100 $cmds"
2102 done
2105 # Exit here if they wanted silent mode.
2106 $opt_silent && exit $EXIT_SUCCESS
2108 $ECHO "X----------------------------------------------------------------------" | $Xsed
2109 $ECHO "Libraries have been installed in:"
2110 for libdir in $libdirs; do
2111 $ECHO " $libdir"
2112 done
2113 $ECHO
2114 $ECHO "If you ever happen to want to link against installed libraries"
2115 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2116 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2117 $ECHO "flag during linking and do at least one of the following:"
2118 if test -n "$shlibpath_var"; then
2119 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2120 $ECHO " during execution"
2122 if test -n "$runpath_var"; then
2123 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2124 $ECHO " during linking"
2126 if test -n "$hardcode_libdir_flag_spec"; then
2127 libdir=LIBDIR
2128 eval flag=\"$hardcode_libdir_flag_spec\"
2130 $ECHO " - use the \`$flag' linker flag"
2132 if test -n "$admincmds"; then
2133 $ECHO " - have your system administrator run these commands:$admincmds"
2135 if test -f /etc/ld.so.conf; then
2136 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2138 $ECHO
2140 $ECHO "See any operating system documentation about shared libraries for"
2141 case $host in
2142 solaris2.[6789]|solaris2.1[0-9])
2143 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2144 $ECHO "pages."
2147 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2149 esac
2150 $ECHO "X----------------------------------------------------------------------" | $Xsed
2151 exit $EXIT_SUCCESS
2154 test "$mode" = finish && func_mode_finish ${1+"$@"}
2157 # func_mode_install arg...
2158 func_mode_install ()
2160 $opt_debug
2161 # There may be an optional sh(1) argument at the beginning of
2162 # install_prog (especially on Windows NT).
2163 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2164 # Allow the use of GNU shtool's install command.
2165 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2166 # Aesthetically quote it.
2167 func_quote_for_eval "$nonopt"
2168 install_prog="$func_quote_for_eval_result "
2169 arg=$1
2170 shift
2171 else
2172 install_prog=
2173 arg=$nonopt
2176 # The real first argument should be the name of the installation program.
2177 # Aesthetically quote it.
2178 func_quote_for_eval "$arg"
2179 install_prog="$install_prog$func_quote_for_eval_result"
2181 # We need to accept at least all the BSD install flags.
2182 dest=
2183 files=
2184 opts=
2185 prev=
2186 install_type=
2187 isdir=no
2188 stripme=
2189 for arg
2191 if test -n "$dest"; then
2192 files="$files $dest"
2193 dest=$arg
2194 continue
2197 case $arg in
2198 -d) isdir=yes ;;
2200 case " $install_prog " in
2201 *[\\\ /]cp\ *) ;;
2202 *) prev=$arg ;;
2203 esac
2205 -g | -m | -o)
2206 prev=$arg
2209 stripme=" -s"
2210 continue
2215 # If the previous option needed an argument, then skip it.
2216 if test -n "$prev"; then
2217 prev=
2218 else
2219 dest=$arg
2220 continue
2223 esac
2225 # Aesthetically quote the argument.
2226 func_quote_for_eval "$arg"
2227 install_prog="$install_prog $func_quote_for_eval_result"
2228 done
2230 test -z "$install_prog" && \
2231 func_fatal_help "you must specify an install program"
2233 test -n "$prev" && \
2234 func_fatal_help "the \`$prev' option requires an argument"
2236 if test -z "$files"; then
2237 if test -z "$dest"; then
2238 func_fatal_help "no file or destination specified"
2239 else
2240 func_fatal_help "you must specify a destination"
2244 # Strip any trailing slash from the destination.
2245 func_stripname '' '/' "$dest"
2246 dest=$func_stripname_result
2248 # Check to see that the destination is a directory.
2249 test -d "$dest" && isdir=yes
2250 if test "$isdir" = yes; then
2251 destdir="$dest"
2252 destname=
2253 else
2254 func_dirname "$dest" "" "."
2255 destdir="$func_dirname_result"
2256 func_basename "$dest"
2257 destname="$func_basename_result"
2259 # Not a directory, so check to see that there is only one file specified.
2260 set dummy $files; shift
2261 test "$#" -gt 1 && \
2262 func_fatal_help "\`$dest' is not a directory"
2264 case $destdir in
2265 [\\/]* | [A-Za-z]:[\\/]*) ;;
2267 for file in $files; do
2268 case $file in
2269 *.lo) ;;
2271 func_fatal_help "\`$destdir' must be an absolute directory name"
2273 esac
2274 done
2276 esac
2278 # This variable tells wrapper scripts just to set variables rather
2279 # than running their programs.
2280 libtool_install_magic="$magic"
2282 staticlibs=
2283 future_libdirs=
2284 current_libdirs=
2285 for file in $files; do
2287 # Do each installation.
2288 case $file in
2289 *.$libext)
2290 # Do the static libraries later.
2291 staticlibs="$staticlibs $file"
2294 *.la)
2295 # Check to see that this really is a libtool archive.
2296 func_lalib_unsafe_p "$file" \
2297 || func_fatal_help "\`$file' is not a valid libtool archive"
2299 library_names=
2300 old_library=
2301 relink_command=
2302 func_source "$file"
2304 # Add the libdir to current_libdirs if it is the destination.
2305 if test "X$destdir" = "X$libdir"; then
2306 case "$current_libdirs " in
2307 *" $libdir "*) ;;
2308 *) current_libdirs="$current_libdirs $libdir" ;;
2309 esac
2310 else
2311 # Note the libdir as a future libdir.
2312 case "$future_libdirs " in
2313 *" $libdir "*) ;;
2314 *) future_libdirs="$future_libdirs $libdir" ;;
2315 esac
2318 func_dirname "$file" "/" ""
2319 dir="$func_dirname_result"
2320 dir="$dir$objdir"
2322 if test -n "$relink_command"; then
2323 # Determine the prefix the user has applied to our future dir.
2324 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2326 # Don't allow the user to place us outside of our expected
2327 # location b/c this prevents finding dependent libraries that
2328 # are installed to the same prefix.
2329 # At present, this check doesn't affect windows .dll's that
2330 # are installed into $libdir/../bin (currently, that works fine)
2331 # but it's something to keep an eye on.
2332 test "$inst_prefix_dir" = "$destdir" && \
2333 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2335 if test -n "$inst_prefix_dir"; then
2336 # Stick the inst_prefix_dir data into the link command.
2337 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2338 else
2339 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2342 func_warning "relinking \`$file'"
2343 func_show_eval "$relink_command" \
2344 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2347 # See the names of the shared library.
2348 set dummy $library_names; shift
2349 if test -n "$1"; then
2350 realname="$1"
2351 shift
2353 srcname="$realname"
2354 test -n "$relink_command" && srcname="$realname"T
2356 # Install the shared library and build the symlinks.
2357 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2358 'exit $?'
2359 tstripme="$stripme"
2360 case $host_os in
2361 cygwin* | mingw* | pw32*)
2362 case $realname in
2363 *.dll.a)
2364 tstripme=""
2366 esac
2368 esac
2369 if test -n "$tstripme" && test -n "$striplib"; then
2370 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2373 if test "$#" -gt 0; then
2374 # Delete the old symlinks, and create new ones.
2375 # Try `ln -sf' first, because the `ln' binary might depend on
2376 # the symlink we replace! Solaris /bin/ln does not understand -f,
2377 # so we also need to try rm && ln -s.
2378 for linkname
2380 test "$linkname" != "$realname" \
2381 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2382 done
2385 # Do each command in the postinstall commands.
2386 lib="$destdir/$realname"
2387 func_execute_cmds "$postinstall_cmds" 'exit $?'
2390 # Install the pseudo-library for information purposes.
2391 func_basename "$file"
2392 name="$func_basename_result"
2393 instname="$dir/$name"i
2394 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2396 # Maybe install the static library, too.
2397 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2400 *.lo)
2401 # Install (i.e. copy) a libtool object.
2403 # Figure out destination file name, if it wasn't already specified.
2404 if test -n "$destname"; then
2405 destfile="$destdir/$destname"
2406 else
2407 func_basename "$file"
2408 destfile="$func_basename_result"
2409 destfile="$destdir/$destfile"
2412 # Deduce the name of the destination old-style object file.
2413 case $destfile in
2414 *.lo)
2415 func_lo2o "$destfile"
2416 staticdest=$func_lo2o_result
2418 *.$objext)
2419 staticdest="$destfile"
2420 destfile=
2423 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2425 esac
2427 # Install the libtool object if requested.
2428 test -n "$destfile" && \
2429 func_show_eval "$install_prog $file $destfile" 'exit $?'
2431 # Install the old object if enabled.
2432 if test "$build_old_libs" = yes; then
2433 # Deduce the name of the old-style object file.
2434 func_lo2o "$file"
2435 staticobj=$func_lo2o_result
2436 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2438 exit $EXIT_SUCCESS
2442 # Figure out destination file name, if it wasn't already specified.
2443 if test -n "$destname"; then
2444 destfile="$destdir/$destname"
2445 else
2446 func_basename "$file"
2447 destfile="$func_basename_result"
2448 destfile="$destdir/$destfile"
2451 # If the file is missing, and there is a .exe on the end, strip it
2452 # because it is most likely a libtool script we actually want to
2453 # install
2454 stripped_ext=""
2455 case $file in
2456 *.exe)
2457 if test ! -f "$file"; then
2458 func_stripname '' '.exe' "$file"
2459 file=$func_stripname_result
2460 stripped_ext=".exe"
2463 esac
2465 # Do a test to see if this is really a libtool program.
2466 case $host in
2467 *cygwin*|*mingw*)
2468 func_stripname '' '.exe' "$file"
2469 wrapper=$func_stripname_result
2472 wrapper=$file
2474 esac
2475 if func_ltwrapper_p "$wrapper"; then
2476 notinst_deplibs=
2477 relink_command=
2479 func_source "$wrapper"
2481 # Check the variables that should have been set.
2482 test -z "$generated_by_libtool_version" && \
2483 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2485 finalize=yes
2486 for lib in $notinst_deplibs; do
2487 # Check to see that each library is installed.
2488 libdir=
2489 if test -f "$lib"; then
2490 func_source "$lib"
2492 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2493 if test -n "$libdir" && test ! -f "$libfile"; then
2494 func_warning "\`$lib' has not been installed in \`$libdir'"
2495 finalize=no
2497 done
2499 relink_command=
2500 func_source "$wrapper"
2502 outputname=
2503 if test "$fast_install" = no && test -n "$relink_command"; then
2504 $opt_dry_run || {
2505 if test "$finalize" = yes; then
2506 tmpdir=`func_mktempdir`
2507 func_basename "$file$stripped_ext"
2508 file="$func_basename_result"
2509 outputname="$tmpdir/$file"
2510 # Replace the output file specification.
2511 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2513 $opt_silent || {
2514 func_quote_for_expand "$relink_command"
2515 eval "func_echo $func_quote_for_expand_result"
2517 if eval "$relink_command"; then :
2518 else
2519 func_error "error: relink \`$file' with the above command before installing it"
2520 $opt_dry_run || ${RM}r "$tmpdir"
2521 continue
2523 file="$outputname"
2524 else
2525 func_warning "cannot relink \`$file'"
2528 else
2529 # Install the binary that we compiled earlier.
2530 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2534 # remove .exe since cygwin /usr/bin/install will append another
2535 # one anyway
2536 case $install_prog,$host in
2537 */usr/bin/install*,*cygwin*)
2538 case $file:$destfile in
2539 *.exe:*.exe)
2540 # this is ok
2542 *.exe:*)
2543 destfile=$destfile.exe
2545 *:*.exe)
2546 func_stripname '' '.exe' "$destfile"
2547 destfile=$func_stripname_result
2549 esac
2551 esac
2552 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2553 $opt_dry_run || if test -n "$outputname"; then
2554 ${RM}r "$tmpdir"
2557 esac
2558 done
2560 for file in $staticlibs; do
2561 func_basename "$file"
2562 name="$func_basename_result"
2564 # Set up the ranlib parameters.
2565 oldlib="$destdir/$name"
2567 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2569 if test -n "$stripme" && test -n "$old_striplib"; then
2570 func_show_eval "$old_striplib $oldlib" 'exit $?'
2573 # Do each command in the postinstall commands.
2574 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2575 done
2577 test -n "$future_libdirs" && \
2578 func_warning "remember to run \`$progname --finish$future_libdirs'"
2580 if test -n "$current_libdirs"; then
2581 # Maybe just do a dry run.
2582 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2583 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2584 else
2585 exit $EXIT_SUCCESS
2589 test "$mode" = install && func_mode_install ${1+"$@"}
2592 # func_mode_link arg...
2593 func_mode_link ()
2595 $opt_debug
2596 case $host in
2597 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2598 # It is impossible to link a dll without this setting, and
2599 # we shouldn't force the makefile maintainer to figure out
2600 # which system we are compiling for in order to pass an extra
2601 # flag for every libtool invocation.
2602 # allow_undefined=no
2604 # FIXME: Unfortunately, there are problems with the above when trying
2605 # to make a dll which has undefined symbols, in which case not
2606 # even a static library is built. For now, we need to specify
2607 # -no-undefined on the libtool link line when we can be certain
2608 # that all symbols are satisfied, otherwise we get a static library.
2609 allow_undefined=yes
2612 allow_undefined=yes
2614 esac
2615 libtool_args=$nonopt
2616 base_compile="$nonopt $@"
2617 compile_command=$nonopt
2618 finalize_command=$nonopt
2620 compile_rpath=
2621 finalize_rpath=
2622 compile_shlibpath=
2623 finalize_shlibpath=
2624 convenience=
2625 old_convenience=
2626 deplibs=
2627 old_deplibs=
2628 compiler_flags=
2629 linker_flags=
2630 dllsearchpath=
2631 lib_search_path=`pwd`
2632 inst_prefix_dir=
2633 new_inherited_linker_flags=
2635 avoid_version=no
2636 dlfiles=
2637 dlprefiles=
2638 dlself=no
2639 export_dynamic=no
2640 export_symbols=
2641 export_symbols_regex=
2642 generated=
2643 libobjs=
2644 ltlibs=
2645 module=no
2646 no_install=no
2647 objs=
2648 non_pic_objects=
2649 precious_files_regex=
2650 prefer_static_libs=no
2651 preload=no
2652 prev=
2653 prevarg=
2654 release=
2655 rpath=
2656 xrpath=
2657 perm_rpath=
2658 temp_rpath=
2659 thread_safe=no
2660 vinfo=
2661 vinfo_number=no
2662 weak_libs=
2663 single_module="${wl}-single_module"
2664 func_infer_tag $base_compile
2666 # We need to know -static, to get the right output filenames.
2667 for arg
2669 case $arg in
2670 -shared)
2671 test "$build_libtool_libs" != yes && \
2672 func_fatal_configuration "can not build a shared library"
2673 build_old_libs=no
2674 break
2676 -all-static | -static | -static-libtool-libs)
2677 case $arg in
2678 -all-static)
2679 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2680 func_warning "complete static linking is impossible in this configuration"
2682 if test -n "$link_static_flag"; then
2683 dlopen_self=$dlopen_self_static
2684 # See comment for -static flag below, for more details.
2685 func_append compile_command " $link_static_flag"
2686 func_append finalize_command " $link_static_flag"
2688 prefer_static_libs=yes
2690 -static)
2691 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2692 dlopen_self=$dlopen_self_static
2694 prefer_static_libs=built
2696 -static-libtool-libs)
2697 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2698 dlopen_self=$dlopen_self_static
2700 prefer_static_libs=yes
2702 esac
2703 build_libtool_libs=no
2704 build_old_libs=yes
2705 break
2707 esac
2708 done
2710 # See if our shared archives depend on static archives.
2711 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2713 # Go through the arguments, transforming them on the way.
2714 while test "$#" -gt 0; do
2715 arg="$1"
2716 shift
2717 func_quote_for_eval "$arg"
2718 qarg=$func_quote_for_eval_unquoted_result
2719 func_append libtool_args " $func_quote_for_eval_result"
2721 # If the previous option needs an argument, assign it.
2722 if test -n "$prev"; then
2723 case $prev in
2724 output)
2725 func_append compile_command " @OUTPUT@"
2726 func_append finalize_command " @OUTPUT@"
2728 esac
2730 case $prev in
2731 dlfiles|dlprefiles)
2732 if test "$preload" = no; then
2733 # Add the symbol object into the linking commands.
2734 func_append compile_command " @SYMFILE@"
2735 func_append finalize_command " @SYMFILE@"
2736 preload=yes
2738 case $arg in
2739 *.la | *.lo) ;; # We handle these cases below.
2740 force)
2741 if test "$dlself" = no; then
2742 dlself=needless
2743 export_dynamic=yes
2745 prev=
2746 continue
2748 self)
2749 if test "$prev" = dlprefiles; then
2750 dlself=yes
2751 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2752 dlself=yes
2753 else
2754 dlself=needless
2755 export_dynamic=yes
2757 prev=
2758 continue
2761 if test "$prev" = dlfiles; then
2762 dlfiles="$dlfiles $arg"
2763 else
2764 dlprefiles="$dlprefiles $arg"
2766 prev=
2767 continue
2769 esac
2771 expsyms)
2772 export_symbols="$arg"
2773 test -f "$arg" \
2774 || func_fatal_error "symbol file \`$arg' does not exist"
2775 prev=
2776 continue
2778 expsyms_regex)
2779 export_symbols_regex="$arg"
2780 prev=
2781 continue
2783 framework)
2784 case $host in
2785 *-*-darwin*)
2786 case "$deplibs " in
2787 *" $qarg.ltframework "*) ;;
2788 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2790 esac
2792 esac
2793 prev=
2794 continue
2796 inst_prefix)
2797 inst_prefix_dir="$arg"
2798 prev=
2799 continue
2801 objectlist)
2802 if test -f "$arg"; then
2803 save_arg=$arg
2804 moreargs=
2805 for fil in `cat "$save_arg"`
2807 # moreargs="$moreargs $fil"
2808 arg=$fil
2809 # A libtool-controlled object.
2811 # Check to see that this really is a libtool object.
2812 if func_lalib_unsafe_p "$arg"; then
2813 pic_object=
2814 non_pic_object=
2816 # Read the .lo file
2817 func_source "$arg"
2819 if test -z "$pic_object" ||
2820 test -z "$non_pic_object" ||
2821 test "$pic_object" = none &&
2822 test "$non_pic_object" = none; then
2823 func_fatal_error "cannot find name of object for \`$arg'"
2826 # Extract subdirectory from the argument.
2827 func_dirname "$arg" "/" ""
2828 xdir="$func_dirname_result"
2830 if test "$pic_object" != none; then
2831 # Prepend the subdirectory the object is found in.
2832 pic_object="$xdir$pic_object"
2834 if test "$prev" = dlfiles; then
2835 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2836 dlfiles="$dlfiles $pic_object"
2837 prev=
2838 continue
2839 else
2840 # If libtool objects are unsupported, then we need to preload.
2841 prev=dlprefiles
2845 # CHECK ME: I think I busted this. -Ossama
2846 if test "$prev" = dlprefiles; then
2847 # Preload the old-style object.
2848 dlprefiles="$dlprefiles $pic_object"
2849 prev=
2852 # A PIC object.
2853 func_append libobjs " $pic_object"
2854 arg="$pic_object"
2857 # Non-PIC object.
2858 if test "$non_pic_object" != none; then
2859 # Prepend the subdirectory the object is found in.
2860 non_pic_object="$xdir$non_pic_object"
2862 # A standard non-PIC object
2863 func_append non_pic_objects " $non_pic_object"
2864 if test -z "$pic_object" || test "$pic_object" = none ; then
2865 arg="$non_pic_object"
2867 else
2868 # If the PIC object exists, use it instead.
2869 # $xdir was prepended to $pic_object above.
2870 non_pic_object="$pic_object"
2871 func_append non_pic_objects " $non_pic_object"
2873 else
2874 # Only an error if not doing a dry-run.
2875 if $opt_dry_run; then
2876 # Extract subdirectory from the argument.
2877 func_dirname "$arg" "/" ""
2878 xdir="$func_dirname_result"
2880 func_lo2o "$arg"
2881 pic_object=$xdir$objdir/$func_lo2o_result
2882 non_pic_object=$xdir$func_lo2o_result
2883 func_append libobjs " $pic_object"
2884 func_append non_pic_objects " $non_pic_object"
2885 else
2886 func_fatal_error "\`$arg' is not a valid libtool object"
2889 done
2890 else
2891 func_fatal_error "link input file \`$arg' does not exist"
2893 arg=$save_arg
2894 prev=
2895 continue
2897 precious_regex)
2898 precious_files_regex="$arg"
2899 prev=
2900 continue
2902 release)
2903 release="-$arg"
2904 prev=
2905 continue
2907 rpath | xrpath)
2908 # We need an absolute path.
2909 case $arg in
2910 [\\/]* | [A-Za-z]:[\\/]*) ;;
2912 func_fatal_error "only absolute run-paths are allowed"
2914 esac
2915 if test "$prev" = rpath; then
2916 case "$rpath " in
2917 *" $arg "*) ;;
2918 *) rpath="$rpath $arg" ;;
2919 esac
2920 else
2921 case "$xrpath " in
2922 *" $arg "*) ;;
2923 *) xrpath="$xrpath $arg" ;;
2924 esac
2926 prev=
2927 continue
2929 shrext)
2930 shrext_cmds="$arg"
2931 prev=
2932 continue
2934 weak)
2935 weak_libs="$weak_libs $arg"
2936 prev=
2937 continue
2939 xcclinker)
2940 linker_flags="$linker_flags $qarg"
2941 compiler_flags="$compiler_flags $qarg"
2942 prev=
2943 func_append compile_command " $qarg"
2944 func_append finalize_command " $qarg"
2945 continue
2947 xcompiler)
2948 compiler_flags="$compiler_flags $qarg"
2949 prev=
2950 func_append compile_command " $qarg"
2951 func_append finalize_command " $qarg"
2952 continue
2954 xlinker)
2955 linker_flags="$linker_flags $qarg"
2956 compiler_flags="$compiler_flags $wl$qarg"
2957 prev=
2958 func_append compile_command " $wl$qarg"
2959 func_append finalize_command " $wl$qarg"
2960 continue
2963 eval "$prev=\"\$arg\""
2964 prev=
2965 continue
2967 esac
2968 fi # test -n "$prev"
2970 prevarg="$arg"
2972 case $arg in
2973 -all-static)
2974 # The effects of -all-static are defined in a previous loop.
2975 continue
2978 -allow-undefined)
2979 # FIXME: remove this flag sometime in the future.
2980 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
2983 -avoid-version)
2984 avoid_version=yes
2985 continue
2988 -dlopen)
2989 prev=dlfiles
2990 continue
2993 -dlpreopen)
2994 prev=dlprefiles
2995 continue
2998 -export-dynamic)
2999 export_dynamic=yes
3000 continue
3003 -export-symbols | -export-symbols-regex)
3004 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3005 func_fatal_error "more than one -exported-symbols argument is not allowed"
3007 if test "X$arg" = "X-export-symbols"; then
3008 prev=expsyms
3009 else
3010 prev=expsyms_regex
3012 continue
3015 -framework)
3016 prev=framework
3017 continue
3020 -inst-prefix-dir)
3021 prev=inst_prefix
3022 continue
3025 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
3026 # so, if we see these flags be careful not to treat them like -L
3027 -L[A-Z][A-Z]*:*)
3028 case $with_gcc/$host in
3029 no/*-*-irix* | /*-*-irix*)
3030 func_append compile_command " $arg"
3031 func_append finalize_command " $arg"
3033 esac
3034 continue
3037 -L*)
3038 func_stripname '-L' '' "$arg"
3039 dir=$func_stripname_result
3040 # We need an absolute path.
3041 case $dir in
3042 [\\/]* | [A-Za-z]:[\\/]*) ;;
3044 absdir=`cd "$dir" && pwd`
3045 test -z "$absdir" && \
3046 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3047 dir="$absdir"
3049 esac
3050 case "$deplibs " in
3051 *" -L$dir "*) ;;
3053 deplibs="$deplibs -L$dir"
3054 lib_search_path="$lib_search_path $dir"
3056 esac
3057 case $host in
3058 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3059 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3060 case :$dllsearchpath: in
3061 *":$dir:"*) ;;
3062 *) dllsearchpath="$dllsearchpath:$dir";;
3063 esac
3064 case :$dllsearchpath: in
3065 *":$testbindir:"*) ;;
3066 *) dllsearchpath="$dllsearchpath:$testbindir";;
3067 esac
3069 esac
3070 continue
3073 -l*)
3074 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3075 case $host in
3076 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3077 # These systems don't actually have a C or math library (as such)
3078 continue
3080 *-*-os2*)
3081 # These systems don't actually have a C library (as such)
3082 test "X$arg" = "X-lc" && continue
3084 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3085 # Do not include libc due to us having libc/libc_r.
3086 test "X$arg" = "X-lc" && continue
3088 *-*-rhapsody* | *-*-darwin1.[012])
3089 # Rhapsody C and math libraries are in the System framework
3090 deplibs="$deplibs System.ltframework"
3091 continue
3093 *-*-sco3.2v5* | *-*-sco5v6*)
3094 # Causes problems with __ctype
3095 test "X$arg" = "X-lc" && continue
3097 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3098 # Compiler inserts libc in the correct place for threads to work
3099 test "X$arg" = "X-lc" && continue
3101 esac
3102 elif test "X$arg" = "X-lc_r"; then
3103 case $host in
3104 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3105 # Do not include libc_r directly, use -pthread flag.
3106 continue
3108 esac
3110 deplibs="$deplibs $arg"
3111 continue
3114 -module)
3115 module=yes
3116 continue
3119 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3120 # classes, name mangling, and exception handling.
3121 # Darwin uses the -arch flag to determine output architecture.
3122 -model|-arch|-isysroot)
3123 compiler_flags="$compiler_flags $arg"
3124 func_append compile_command " $arg"
3125 func_append finalize_command " $arg"
3126 prev=xcompiler
3127 continue
3130 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3131 compiler_flags="$compiler_flags $arg"
3132 func_append compile_command " $arg"
3133 func_append finalize_command " $arg"
3134 case "$new_inherited_linker_flags " in
3135 *" $arg "*) ;;
3136 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3137 esac
3138 continue
3141 -multi_module)
3142 single_module="${wl}-multi_module"
3143 continue
3146 -no-fast-install)
3147 fast_install=no
3148 continue
3151 -no-install)
3152 case $host in
3153 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3154 # The PATH hackery in wrapper scripts is required on Windows
3155 # in order for the loader to find any dlls it needs.
3156 func_warning "\`-no-install' is ignored for $host"
3157 func_warning "assuming \`-no-fast-install' instead"
3158 fast_install=no
3160 *) no_install=yes ;;
3161 esac
3162 continue
3165 -no-undefined)
3166 allow_undefined=no
3167 continue
3170 -objectlist)
3171 prev=objectlist
3172 continue
3175 -o) prev=output ;;
3177 -precious-files-regex)
3178 prev=precious_regex
3179 continue
3182 -release)
3183 prev=release
3184 continue
3187 -rpath)
3188 prev=rpath
3189 continue
3193 prev=xrpath
3194 continue
3197 -R*)
3198 func_stripname '-R' '' "$arg"
3199 dir=$func_stripname_result
3200 # We need an absolute path.
3201 case $dir in
3202 [\\/]* | [A-Za-z]:[\\/]*) ;;
3204 func_fatal_error "only absolute run-paths are allowed"
3206 esac
3207 case "$xrpath " in
3208 *" $dir "*) ;;
3209 *) xrpath="$xrpath $dir" ;;
3210 esac
3211 continue
3214 -shared)
3215 # The effects of -shared are defined in a previous loop.
3216 continue
3219 -shrext)
3220 prev=shrext
3221 continue
3224 -static | -static-libtool-libs)
3225 # The effects of -static are defined in a previous loop.
3226 # We used to do the same as -all-static on platforms that
3227 # didn't have a PIC flag, but the assumption that the effects
3228 # would be equivalent was wrong. It would break on at least
3229 # Digital Unix and AIX.
3230 continue
3233 -thread-safe)
3234 thread_safe=yes
3235 continue
3238 -version-info)
3239 prev=vinfo
3240 continue
3243 -version-number)
3244 prev=vinfo
3245 vinfo_number=yes
3246 continue
3249 -weak)
3250 prev=weak
3251 continue
3254 -Wc,*)
3255 func_stripname '-Wc,' '' "$arg"
3256 args=$func_stripname_result
3257 arg=
3258 save_ifs="$IFS"; IFS=','
3259 for flag in $args; do
3260 IFS="$save_ifs"
3261 func_quote_for_eval "$flag"
3262 arg="$arg $wl$func_quote_for_eval_result"
3263 compiler_flags="$compiler_flags $func_quote_for_eval_result"
3264 done
3265 IFS="$save_ifs"
3266 func_stripname ' ' '' "$arg"
3267 arg=$func_stripname_result
3270 -Wl,*)
3271 func_stripname '-Wl,' '' "$arg"
3272 args=$func_stripname_result
3273 arg=
3274 save_ifs="$IFS"; IFS=','
3275 for flag in $args; do
3276 IFS="$save_ifs"
3277 func_quote_for_eval "$flag"
3278 arg="$arg $wl$func_quote_for_eval_result"
3279 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
3280 linker_flags="$linker_flags $func_quote_for_eval_result"
3281 done
3282 IFS="$save_ifs"
3283 func_stripname ' ' '' "$arg"
3284 arg=$func_stripname_result
3287 -Xcompiler)
3288 prev=xcompiler
3289 continue
3292 -Xlinker)
3293 prev=xlinker
3294 continue
3297 -XCClinker)
3298 prev=xcclinker
3299 continue
3302 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
3303 # -r[0-9][0-9]* specifies the processor on the SGI compiler
3304 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
3305 # +DA*, +DD* enable 64-bit mode on the HP compiler
3306 # -q* pass through compiler args for the IBM compiler
3307 # -m*, -t[45]*, -txscale* pass through architecture-specific
3308 # compiler args for GCC
3309 # -F/path gives path to uninstalled frameworks, gcc on darwin
3310 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
3311 # @file GCC response files
3312 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
3313 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
3314 func_quote_for_eval "$arg"
3315 arg="$func_quote_for_eval_result"
3316 func_append compile_command " $arg"
3317 func_append finalize_command " $arg"
3318 compiler_flags="$compiler_flags $arg"
3319 continue
3322 # Some other compiler flag.
3323 -* | +*)
3324 func_quote_for_eval "$arg"
3325 arg="$func_quote_for_eval_result"
3328 *.$objext)
3329 # A standard object.
3330 objs="$objs $arg"
3333 *.lo)
3334 # A libtool-controlled object.
3336 # Check to see that this really is a libtool object.
3337 if func_lalib_unsafe_p "$arg"; then
3338 pic_object=
3339 non_pic_object=
3341 # Read the .lo file
3342 func_source "$arg"
3344 if test -z "$pic_object" ||
3345 test -z "$non_pic_object" ||
3346 test "$pic_object" = none &&
3347 test "$non_pic_object" = none; then
3348 func_fatal_error "cannot find name of object for \`$arg'"
3351 # Extract subdirectory from the argument.
3352 func_dirname "$arg" "/" ""
3353 xdir="$func_dirname_result"
3355 if test "$pic_object" != none; then
3356 # Prepend the subdirectory the object is found in.
3357 pic_object="$xdir$pic_object"
3359 if test "$prev" = dlfiles; then
3360 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3361 dlfiles="$dlfiles $pic_object"
3362 prev=
3363 continue
3364 else
3365 # If libtool objects are unsupported, then we need to preload.
3366 prev=dlprefiles
3370 # CHECK ME: I think I busted this. -Ossama
3371 if test "$prev" = dlprefiles; then
3372 # Preload the old-style object.
3373 dlprefiles="$dlprefiles $pic_object"
3374 prev=
3377 # A PIC object.
3378 func_append libobjs " $pic_object"
3379 arg="$pic_object"
3382 # Non-PIC object.
3383 if test "$non_pic_object" != none; then
3384 # Prepend the subdirectory the object is found in.
3385 non_pic_object="$xdir$non_pic_object"
3387 # A standard non-PIC object
3388 func_append non_pic_objects " $non_pic_object"
3389 if test -z "$pic_object" || test "$pic_object" = none ; then
3390 arg="$non_pic_object"
3392 else
3393 # If the PIC object exists, use it instead.
3394 # $xdir was prepended to $pic_object above.
3395 non_pic_object="$pic_object"
3396 func_append non_pic_objects " $non_pic_object"
3398 else
3399 # Only an error if not doing a dry-run.
3400 if $opt_dry_run; then
3401 # Extract subdirectory from the argument.
3402 func_dirname "$arg" "/" ""
3403 xdir="$func_dirname_result"
3405 func_lo2o "$arg"
3406 pic_object=$xdir$objdir/$func_lo2o_result
3407 non_pic_object=$xdir$func_lo2o_result
3408 func_append libobjs " $pic_object"
3409 func_append non_pic_objects " $non_pic_object"
3410 else
3411 func_fatal_error "\`$arg' is not a valid libtool object"
3416 *.$libext)
3417 # An archive.
3418 deplibs="$deplibs $arg"
3419 old_deplibs="$old_deplibs $arg"
3420 continue
3423 *.la)
3424 # A libtool-controlled library.
3426 if test "$prev" = dlfiles; then
3427 # This library was specified with -dlopen.
3428 dlfiles="$dlfiles $arg"
3429 prev=
3430 elif test "$prev" = dlprefiles; then
3431 # The library was specified with -dlpreopen.
3432 dlprefiles="$dlprefiles $arg"
3433 prev=
3434 else
3435 deplibs="$deplibs $arg"
3437 continue
3440 # Some other compiler argument.
3442 # Unknown arguments in both finalize_command and compile_command need
3443 # to be aesthetically quoted because they are evaled later.
3444 func_quote_for_eval "$arg"
3445 arg="$func_quote_for_eval_result"
3447 esac # arg
3449 # Now actually substitute the argument into the commands.
3450 if test -n "$arg"; then
3451 func_append compile_command " $arg"
3452 func_append finalize_command " $arg"
3454 done # argument parsing loop
3456 test -n "$prev" && \
3457 func_fatal_help "the \`$prevarg' option requires an argument"
3459 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
3460 eval arg=\"$export_dynamic_flag_spec\"
3461 func_append compile_command " $arg"
3462 func_append finalize_command " $arg"
3465 oldlibs=
3466 # calculate the name of the file, without its directory
3467 func_basename "$output"
3468 outputname="$func_basename_result"
3469 libobjs_save="$libobjs"
3471 if test -n "$shlibpath_var"; then
3472 # get the directories listed in $shlibpath_var
3473 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
3474 else
3475 shlib_search_path=
3477 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
3478 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
3480 func_dirname "$output" "/" ""
3481 output_objdir="$func_dirname_result$objdir"
3482 # Create the object directory.
3483 func_mkdir_p "$output_objdir"
3485 # Determine the type of output
3486 case $output in
3488 func_fatal_help "you must specify an output file"
3490 *.$libext) linkmode=oldlib ;;
3491 *.lo | *.$objext) linkmode=obj ;;
3492 *.la) linkmode=lib ;;
3493 *) linkmode=prog ;; # Anything else should be a program.
3494 esac
3496 specialdeplibs=
3498 libs=
3499 # Find all interdependent deplibs by searching for libraries
3500 # that are linked more than once (e.g. -la -lb -la)
3501 for deplib in $deplibs; do
3502 if $opt_duplicate_deps ; then
3503 case "$libs " in
3504 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3505 esac
3507 libs="$libs $deplib"
3508 done
3510 if test "$linkmode" = lib; then
3511 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3513 # Compute libraries that are listed more than once in $predeps
3514 # $postdeps and mark them as special (i.e., whose duplicates are
3515 # not to be eliminated).
3516 pre_post_deps=
3517 if $opt_duplicate_compiler_generated_deps; then
3518 for pre_post_dep in $predeps $postdeps; do
3519 case "$pre_post_deps " in
3520 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3521 esac
3522 pre_post_deps="$pre_post_deps $pre_post_dep"
3523 done
3525 pre_post_deps=
3528 deplibs=
3529 newdependency_libs=
3530 newlib_search_path=
3531 need_relink=no # whether we're linking any uninstalled libtool libraries
3532 notinst_deplibs= # not-installed libtool libraries
3533 notinst_path= # paths that contain not-installed libtool libraries
3535 case $linkmode in
3536 lib)
3537 passes="conv dlpreopen link"
3538 for file in $dlfiles $dlprefiles; do
3539 case $file in
3540 *.la) ;;
3542 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3544 esac
3545 done
3547 prog)
3548 compile_deplibs=
3549 finalize_deplibs=
3550 alldeplibs=no
3551 newdlfiles=
3552 newdlprefiles=
3553 passes="conv scan dlopen dlpreopen link"
3555 *) passes="conv"
3557 esac
3559 for pass in $passes; do
3560 # The preopen pass in lib mode reverses $deplibs; put it back here
3561 # so that -L comes before libs that need it for instance...
3562 if test "$linkmode,$pass" = "lib,link"; then
3563 ## FIXME: Find the place where the list is rebuilt in the wrong
3564 ## order, and fix it there properly
3565 tmp_deplibs=
3566 for deplib in $deplibs; do
3567 tmp_deplibs="$deplib $tmp_deplibs"
3568 done
3569 deplibs="$tmp_deplibs"
3572 if test "$linkmode,$pass" = "lib,link" ||
3573 test "$linkmode,$pass" = "prog,scan"; then
3574 libs="$deplibs"
3575 deplibs=
3577 if test "$linkmode" = prog; then
3578 case $pass in
3579 dlopen) libs="$dlfiles" ;;
3580 dlpreopen) libs="$dlprefiles" ;;
3581 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
3582 esac
3584 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3585 # Collect and forward deplibs of preopened libtool libs
3586 for lib in $dlprefiles; do
3587 # Ignore non-libtool-libs
3588 dependency_libs=
3589 case $lib in
3590 *.la) func_source "$lib" ;;
3591 esac
3593 # Collect preopened libtool deplibs, except any this library
3594 # has declared as weak libs
3595 for deplib in $dependency_libs; do
3596 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3597 case " $weak_libs " in
3598 *" $deplib_base "*) ;;
3599 *) deplibs="$deplibs $deplib" ;;
3600 esac
3601 done
3602 done
3603 libs="$dlprefiles"
3605 if test "$pass" = dlopen; then
3606 # Collect dlpreopened libraries
3607 save_deplibs="$deplibs"
3608 deplibs=
3611 for deplib in $libs; do
3612 lib=
3613 found=no
3614 case $deplib in
3615 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3616 if test "$linkmode,$pass" = "prog,link"; then
3617 compile_deplibs="$deplib $compile_deplibs"
3618 finalize_deplibs="$deplib $finalize_deplibs"
3619 else
3620 compiler_flags="$compiler_flags $deplib"
3621 if test "$linkmode" = lib ; then
3622 case "$new_inherited_linker_flags " in
3623 *" $deplib "*) ;;
3624 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3625 esac
3628 continue
3630 -l*)
3631 if test "$linkmode" != lib && test "$linkmode" != prog; then
3632 func_warning "\`-l' is ignored for archives/objects"
3633 continue
3635 func_stripname '-l' '' "$deplib"
3636 name=$func_stripname_result
3637 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3638 for search_ext in .la $std_shrext .so .a; do
3639 # Search the libtool library
3640 lib="$searchdir/lib${name}${search_ext}"
3641 if test -f "$lib"; then
3642 if test "$search_ext" = ".la"; then
3643 found=yes
3644 else
3645 found=no
3647 break 2
3649 done
3650 done
3651 if test "$found" != yes; then
3652 # deplib doesn't seem to be a libtool library
3653 if test "$linkmode,$pass" = "prog,link"; then
3654 compile_deplibs="$deplib $compile_deplibs"
3655 finalize_deplibs="$deplib $finalize_deplibs"
3656 else
3657 deplibs="$deplib $deplibs"
3658 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3660 continue
3661 else # deplib is a libtool library
3662 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3663 # We need to do some special things here, and not later.
3664 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3665 case " $predeps $postdeps " in
3666 *" $deplib "*)
3667 if func_lalib_p "$lib"; then
3668 library_names=
3669 old_library=
3670 func_source "$lib"
3671 for l in $old_library $library_names; do
3672 ll="$l"
3673 done
3674 if test "X$ll" = "X$old_library" ; then # only static version available
3675 found=no
3676 func_dirname "$lib" "" "."
3677 ladir="$func_dirname_result"
3678 lib=$ladir/$old_library
3679 if test "$linkmode,$pass" = "prog,link"; then
3680 compile_deplibs="$deplib $compile_deplibs"
3681 finalize_deplibs="$deplib $finalize_deplibs"
3682 else
3683 deplibs="$deplib $deplibs"
3684 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3686 continue
3690 *) ;;
3691 esac
3694 ;; # -l
3695 *.ltframework)
3696 if test "$linkmode,$pass" = "prog,link"; then
3697 compile_deplibs="$deplib $compile_deplibs"
3698 finalize_deplibs="$deplib $finalize_deplibs"
3699 else
3700 deplibs="$deplib $deplibs"
3701 if test "$linkmode" = lib ; then
3702 case "$new_inherited_linker_flags " in
3703 *" $deplib "*) ;;
3704 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3705 esac
3708 continue
3710 -L*)
3711 case $linkmode in
3712 lib)
3713 deplibs="$deplib $deplibs"
3714 test "$pass" = conv && continue
3715 newdependency_libs="$deplib $newdependency_libs"
3716 func_stripname '-L' '' "$deplib"
3717 newlib_search_path="$newlib_search_path $func_stripname_result"
3719 prog)
3720 if test "$pass" = conv; then
3721 deplibs="$deplib $deplibs"
3722 continue
3724 if test "$pass" = scan; then
3725 deplibs="$deplib $deplibs"
3726 else
3727 compile_deplibs="$deplib $compile_deplibs"
3728 finalize_deplibs="$deplib $finalize_deplibs"
3730 func_stripname '-L' '' "$deplib"
3731 newlib_search_path="$newlib_search_path $func_stripname_result"
3734 func_warning "\`-L' is ignored for archives/objects"
3736 esac # linkmode
3737 continue
3738 ;; # -L
3739 -R*)
3740 if test "$pass" = link; then
3741 func_stripname '-R' '' "$deplib"
3742 dir=$func_stripname_result
3743 # Make sure the xrpath contains only unique directories.
3744 case "$xrpath " in
3745 *" $dir "*) ;;
3746 *) xrpath="$xrpath $dir" ;;
3747 esac
3749 deplibs="$deplib $deplibs"
3750 continue
3752 *.la) lib="$deplib" ;;
3753 *.$libext)
3754 if test "$pass" = conv; then
3755 deplibs="$deplib $deplibs"
3756 continue
3758 case $linkmode in
3759 lib)
3760 # Linking convenience modules into shared libraries is allowed,
3761 # but linking other static libraries is non-portable.
3762 case " $dlpreconveniencelibs " in
3763 *" $deplib "*) ;;
3765 valid_a_lib=no
3766 case $deplibs_check_method in
3767 match_pattern*)
3768 set dummy $deplibs_check_method; shift
3769 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3770 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3771 | $EGREP "$match_pattern_regex" > /dev/null; then
3772 valid_a_lib=yes
3775 pass_all)
3776 valid_a_lib=yes
3778 esac
3779 if test "$valid_a_lib" != yes; then
3780 $ECHO
3781 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3782 $ECHO "*** I have the capability to make that library automatically link in when"
3783 $ECHO "*** you link to this library. But I can only do this if you have a"
3784 $ECHO "*** shared version of the library, which you do not appear to have"
3785 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3786 $ECHO "*** that it is just a static archive that I should not use here."
3787 else
3788 $ECHO
3789 $ECHO "*** Warning: Linking the shared library $output against the"
3790 $ECHO "*** static library $deplib is not portable!"
3791 deplibs="$deplib $deplibs"
3794 esac
3795 continue
3797 prog)
3798 if test "$pass" != link; then
3799 deplibs="$deplib $deplibs"
3800 else
3801 compile_deplibs="$deplib $compile_deplibs"
3802 finalize_deplibs="$deplib $finalize_deplibs"
3804 continue
3806 esac # linkmode
3807 ;; # *.$libext
3808 *.lo | *.$objext)
3809 if test "$pass" = conv; then
3810 deplibs="$deplib $deplibs"
3811 elif test "$linkmode" = prog; then
3812 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3813 # If there is no dlopen support or we're linking statically,
3814 # we need to preload.
3815 newdlprefiles="$newdlprefiles $deplib"
3816 compile_deplibs="$deplib $compile_deplibs"
3817 finalize_deplibs="$deplib $finalize_deplibs"
3818 else
3819 newdlfiles="$newdlfiles $deplib"
3822 continue
3824 %DEPLIBS%)
3825 alldeplibs=yes
3826 continue
3828 esac # case $deplib
3830 if test "$found" = yes || test -f "$lib"; then :
3831 else
3832 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3835 # Check to see that this really is a libtool archive.
3836 func_lalib_unsafe_p "$lib" \
3837 || func_fatal_error "\`$lib' is not a valid libtool archive"
3839 func_dirname "$lib" "" "."
3840 ladir="$func_dirname_result"
3842 dlname=
3843 dlopen=
3844 dlpreopen=
3845 libdir=
3846 library_names=
3847 old_library=
3848 inherited_linker_flags=
3849 # If the library was installed with an old release of libtool,
3850 # it will not redefine variables installed, or shouldnotlink
3851 installed=yes
3852 shouldnotlink=no
3853 avoidtemprpath=
3856 # Read the .la file
3857 func_source "$lib"
3859 # Convert "-framework foo" to "foo.ltframework"
3860 if test -n "$inherited_linker_flags"; then
3861 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
3862 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3863 case " $new_inherited_linker_flags " in
3864 *" $tmp_inherited_linker_flag "*) ;;
3865 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3866 esac
3867 done
3869 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3870 if test "$linkmode,$pass" = "prog,link"; then
3871 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3872 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3873 else
3874 compiler_flags="$compiler_flags $inherited_linker_flags"
3876 if test "$linkmode,$pass" = "lib,link" ||
3877 test "$linkmode,$pass" = "prog,scan" ||
3878 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3879 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3880 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3883 if test "$pass" = conv; then
3884 # Only check for convenience libraries
3885 deplibs="$lib $deplibs"
3886 if test -z "$libdir"; then
3887 if test -z "$old_library"; then
3888 func_fatal_error "cannot find name of link library for \`$lib'"
3890 # It is a libtool convenience library, so add in its objects.
3891 convenience="$convenience $ladir/$objdir/$old_library"
3892 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3893 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3894 func_fatal_error "\`$lib' is not a convenience library"
3896 tmp_libs=
3897 for deplib in $dependency_libs; do
3898 deplibs="$deplib $deplibs"
3899 if $opt_duplicate_deps ; then
3900 case "$tmp_libs " in
3901 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3902 esac
3904 tmp_libs="$tmp_libs $deplib"
3905 done
3906 continue
3907 fi # $pass = conv
3910 # Get the name of the library we link against.
3911 linklib=
3912 for l in $old_library $library_names; do
3913 linklib="$l"
3914 done
3915 if test -z "$linklib"; then
3916 func_fatal_error "cannot find name of link library for \`$lib'"
3919 # This library was specified with -dlopen.
3920 if test "$pass" = dlopen; then
3921 if test -z "$libdir"; then
3922 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3924 if test -z "$dlname" ||
3925 test "$dlopen_support" != yes ||
3926 test "$build_libtool_libs" = no; then
3927 # If there is no dlname, no dlopen support or we're linking
3928 # statically, we need to preload. We also need to preload any
3929 # dependent libraries so libltdl's deplib preloader doesn't
3930 # bomb out in the load deplibs phase.
3931 dlprefiles="$dlprefiles $lib $dependency_libs"
3932 else
3933 newdlfiles="$newdlfiles $lib"
3935 continue
3936 fi # $pass = dlopen
3938 # We need an absolute path.
3939 case $ladir in
3940 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
3942 abs_ladir=`cd "$ladir" && pwd`
3943 if test -z "$abs_ladir"; then
3944 func_warning "cannot determine absolute directory name of \`$ladir'"
3945 func_warning "passing it literally to the linker, although it might fail"
3946 abs_ladir="$ladir"
3949 esac
3950 func_basename "$lib"
3951 laname="$func_basename_result"
3953 # Find the relevant object directory and library name.
3954 if test "X$installed" = Xyes; then
3955 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3956 func_warning "library \`$lib' was moved."
3957 dir="$ladir"
3958 absdir="$abs_ladir"
3959 libdir="$abs_ladir"
3960 else
3961 dir="$libdir"
3962 absdir="$libdir"
3964 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3965 else
3966 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3967 dir="$ladir"
3968 absdir="$abs_ladir"
3969 # Remove this search path later
3970 notinst_path="$notinst_path $abs_ladir"
3971 else
3972 dir="$ladir/$objdir"
3973 absdir="$abs_ladir/$objdir"
3974 # Remove this search path later
3975 notinst_path="$notinst_path $abs_ladir"
3977 fi # $installed = yes
3978 func_stripname 'lib' '.la' "$laname"
3979 name=$func_stripname_result
3981 # This library was specified with -dlpreopen.
3982 if test "$pass" = dlpreopen; then
3983 if test -z "$libdir" && test "$linkmode" = prog; then
3984 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3986 # Prefer using a static library (so that no silly _DYNAMIC symbols
3987 # are required to link).
3988 if test -n "$old_library"; then
3989 newdlprefiles="$newdlprefiles $dir/$old_library"
3990 # Keep a list of preopened convenience libraries to check
3991 # that they are being used correctly in the link pass.
3992 test -z "$libdir" && \
3993 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3994 # Otherwise, use the dlname, so that lt_dlopen finds it.
3995 elif test -n "$dlname"; then
3996 newdlprefiles="$newdlprefiles $dir/$dlname"
3997 else
3998 newdlprefiles="$newdlprefiles $dir/$linklib"
4000 fi # $pass = dlpreopen
4002 if test -z "$libdir"; then
4003 # Link the convenience library
4004 if test "$linkmode" = lib; then
4005 deplibs="$dir/$old_library $deplibs"
4006 elif test "$linkmode,$pass" = "prog,link"; then
4007 compile_deplibs="$dir/$old_library $compile_deplibs"
4008 finalize_deplibs="$dir/$old_library $finalize_deplibs"
4009 else
4010 deplibs="$lib $deplibs" # used for prog,scan pass
4012 continue
4016 if test "$linkmode" = prog && test "$pass" != link; then
4017 newlib_search_path="$newlib_search_path $ladir"
4018 deplibs="$lib $deplibs"
4020 linkalldeplibs=no
4021 if test "$link_all_deplibs" != no || test -z "$library_names" ||
4022 test "$build_libtool_libs" = no; then
4023 linkalldeplibs=yes
4026 tmp_libs=
4027 for deplib in $dependency_libs; do
4028 case $deplib in
4029 -L*) func_stripname '-L' '' "$deplib"
4030 newlib_search_path="$newlib_search_path $func_stripname_result"
4032 esac
4033 # Need to link against all dependency_libs?
4034 if test "$linkalldeplibs" = yes; then
4035 deplibs="$deplib $deplibs"
4036 else
4037 # Need to hardcode shared library paths
4038 # or/and link against static libraries
4039 newdependency_libs="$deplib $newdependency_libs"
4041 if $opt_duplicate_deps ; then
4042 case "$tmp_libs " in
4043 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4044 esac
4046 tmp_libs="$tmp_libs $deplib"
4047 done # for deplib
4048 continue
4049 fi # $linkmode = prog...
4051 if test "$linkmode,$pass" = "prog,link"; then
4052 if test -n "$library_names" &&
4053 { { test "$prefer_static_libs" = no ||
4054 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4055 test -z "$old_library"; }; then
4056 # We need to hardcode the library path
4057 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4058 # Make sure the rpath contains only unique directories.
4059 case "$temp_rpath:" in
4060 *"$absdir:"*) ;;
4061 *) temp_rpath="$temp_rpath$absdir:" ;;
4062 esac
4065 # Hardcode the library path.
4066 # Skip directories that are in the system default run-time
4067 # search path.
4068 case " $sys_lib_dlsearch_path " in
4069 *" $absdir "*) ;;
4071 case "$compile_rpath " in
4072 *" $absdir "*) ;;
4073 *) compile_rpath="$compile_rpath $absdir"
4074 esac
4076 esac
4077 case " $sys_lib_dlsearch_path " in
4078 *" $libdir "*) ;;
4080 case "$finalize_rpath " in
4081 *" $libdir "*) ;;
4082 *) finalize_rpath="$finalize_rpath $libdir"
4083 esac
4085 esac
4086 fi # $linkmode,$pass = prog,link...
4088 if test "$alldeplibs" = yes &&
4089 { test "$deplibs_check_method" = pass_all ||
4090 { test "$build_libtool_libs" = yes &&
4091 test -n "$library_names"; }; }; then
4092 # We only need to search for static libraries
4093 continue
4097 link_static=no # Whether the deplib will be linked statically
4098 use_static_libs=$prefer_static_libs
4099 if test "$use_static_libs" = built && test "$installed" = yes; then
4100 use_static_libs=no
4102 if test -n "$library_names" &&
4103 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4104 case $host in
4105 *cygwin* | *mingw*)
4106 # No point in relinking DLLs because paths are not encoded
4107 notinst_deplibs="$notinst_deplibs $lib"
4108 need_relink=no
4111 if test "$installed" = no; then
4112 notinst_deplibs="$notinst_deplibs $lib"
4113 need_relink=yes
4116 esac
4117 # This is a shared library
4119 # Warn about portability, can't link against -module's on some
4120 # systems (darwin). Don't bleat about dlopened modules though!
4121 dlopenmodule=""
4122 for dlpremoduletest in $dlprefiles; do
4123 if test "X$dlpremoduletest" = "X$lib"; then
4124 dlopenmodule="$dlpremoduletest"
4125 break
4127 done
4128 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4129 $ECHO
4130 if test "$linkmode" = prog; then
4131 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4132 else
4133 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
4135 $ECHO "*** $linklib is not portable!"
4137 if test "$linkmode" = lib &&
4138 test "$hardcode_into_libs" = yes; then
4139 # Hardcode the library path.
4140 # Skip directories that are in the system default run-time
4141 # search path.
4142 case " $sys_lib_dlsearch_path " in
4143 *" $absdir "*) ;;
4145 case "$compile_rpath " in
4146 *" $absdir "*) ;;
4147 *) compile_rpath="$compile_rpath $absdir"
4148 esac
4150 esac
4151 case " $sys_lib_dlsearch_path " in
4152 *" $libdir "*) ;;
4154 case "$finalize_rpath " in
4155 *" $libdir "*) ;;
4156 *) finalize_rpath="$finalize_rpath $libdir"
4157 esac
4159 esac
4162 if test -n "$old_archive_from_expsyms_cmds"; then
4163 # figure out the soname
4164 set dummy $library_names
4165 shift
4166 realname="$1"
4167 shift
4168 libname=`eval "\\$ECHO \"$libname_spec\""`
4169 # use dlname if we got it. it's perfectly good, no?
4170 if test -n "$dlname"; then
4171 soname="$dlname"
4172 elif test -n "$soname_spec"; then
4173 # bleh windows
4174 case $host in
4175 *cygwin* | mingw*)
4176 major=`expr $current - $age`
4177 versuffix="-$major"
4179 esac
4180 eval soname=\"$soname_spec\"
4181 else
4182 soname="$realname"
4185 # Make a new name for the extract_expsyms_cmds to use
4186 soroot="$soname"
4187 func_basename "$soroot"
4188 soname="$func_basename_result"
4189 func_stripname 'lib' '.dll' "$soname"
4190 newlib=libimp-$func_stripname_result.a
4192 # If the library has no export list, then create one now
4193 if test -f "$output_objdir/$soname-def"; then :
4194 else
4195 func_echo "extracting exported symbol list from \`$soname'"
4196 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
4199 # Create $newlib
4200 if test -f "$output_objdir/$newlib"; then :; else
4201 func_echo "generating import library for \`$soname'"
4202 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
4204 # make sure the library variables are pointing to the new library
4205 dir=$output_objdir
4206 linklib=$newlib
4207 fi # test -n "$old_archive_from_expsyms_cmds"
4209 if test "$linkmode" = prog || test "$mode" != relink; then
4210 add_shlibpath=
4211 add_dir=
4212 add=
4213 lib_linked=yes
4214 case $hardcode_action in
4215 immediate | unsupported)
4216 if test "$hardcode_direct" = no; then
4217 add="$dir/$linklib"
4218 case $host in
4219 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
4220 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
4221 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
4222 *-*-unixware7*) add_dir="-L$dir" ;;
4223 *-*-darwin* )
4224 # if the lib is a (non-dlopened) module then we can not
4225 # link against it, someone is ignoring the earlier warnings
4226 if /usr/bin/file -L $add 2> /dev/null |
4227 $GREP ": [^:]* bundle" >/dev/null ; then
4228 if test "X$dlopenmodule" != "X$lib"; then
4229 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
4230 if test -z "$old_library" ; then
4231 $ECHO
4232 $ECHO "*** And there doesn't seem to be a static archive available"
4233 $ECHO "*** The link will probably fail, sorry"
4234 else
4235 add="$dir/$old_library"
4237 elif test -n "$old_library"; then
4238 add="$dir/$old_library"
4241 esac
4242 elif test "$hardcode_minus_L" = no; then
4243 case $host in
4244 *-*-sunos*) add_shlibpath="$dir" ;;
4245 esac
4246 add_dir="-L$dir"
4247 add="-l$name"
4248 elif test "$hardcode_shlibpath_var" = no; then
4249 add_shlibpath="$dir"
4250 add="-l$name"
4251 else
4252 lib_linked=no
4255 relink)
4256 if test "$hardcode_direct" = yes &&
4257 test "$hardcode_direct_absolute" = no; then
4258 add="$dir/$linklib"
4259 elif test "$hardcode_minus_L" = yes; then
4260 add_dir="-L$dir"
4261 # Try looking first in the location we're being installed to.
4262 if test -n "$inst_prefix_dir"; then
4263 case $libdir in
4264 [\\/]*)
4265 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4267 esac
4269 add="-l$name"
4270 elif test "$hardcode_shlibpath_var" = yes; then
4271 add_shlibpath="$dir"
4272 add="-l$name"
4273 else
4274 lib_linked=no
4277 *) lib_linked=no ;;
4278 esac
4280 if test "$lib_linked" != yes; then
4281 func_fatal_configuration "unsupported hardcode properties"
4284 if test -n "$add_shlibpath"; then
4285 case :$compile_shlibpath: in
4286 *":$add_shlibpath:"*) ;;
4287 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
4288 esac
4290 if test "$linkmode" = prog; then
4291 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
4292 test -n "$add" && compile_deplibs="$add $compile_deplibs"
4293 else
4294 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4295 test -n "$add" && deplibs="$add $deplibs"
4296 if test "$hardcode_direct" != yes &&
4297 test "$hardcode_minus_L" != yes &&
4298 test "$hardcode_shlibpath_var" = yes; then
4299 case :$finalize_shlibpath: in
4300 *":$libdir:"*) ;;
4301 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4302 esac
4307 if test "$linkmode" = prog || test "$mode" = relink; then
4308 add_shlibpath=
4309 add_dir=
4310 add=
4311 # Finalize command for both is simple: just hardcode it.
4312 if test "$hardcode_direct" = yes &&
4313 test "$hardcode_direct_absolute" = no; then
4314 add="$libdir/$linklib"
4315 elif test "$hardcode_minus_L" = yes; then
4316 add_dir="-L$libdir"
4317 add="-l$name"
4318 elif test "$hardcode_shlibpath_var" = yes; then
4319 case :$finalize_shlibpath: in
4320 *":$libdir:"*) ;;
4321 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4322 esac
4323 add="-l$name"
4324 elif test "$hardcode_automatic" = yes; then
4325 if test -n "$inst_prefix_dir" &&
4326 test -f "$inst_prefix_dir$libdir/$linklib" ; then
4327 add="$inst_prefix_dir$libdir/$linklib"
4328 else
4329 add="$libdir/$linklib"
4331 else
4332 # We cannot seem to hardcode it, guess we'll fake it.
4333 add_dir="-L$libdir"
4334 # Try looking first in the location we're being installed to.
4335 if test -n "$inst_prefix_dir"; then
4336 case $libdir in
4337 [\\/]*)
4338 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4340 esac
4342 add="-l$name"
4345 if test "$linkmode" = prog; then
4346 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
4347 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
4348 else
4349 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4350 test -n "$add" && deplibs="$add $deplibs"
4353 elif test "$linkmode" = prog; then
4354 # Here we assume that one of hardcode_direct or hardcode_minus_L
4355 # is not unsupported. This is valid on all known static and
4356 # shared platforms.
4357 if test "$hardcode_direct" != unsupported; then
4358 test -n "$old_library" && linklib="$old_library"
4359 compile_deplibs="$dir/$linklib $compile_deplibs"
4360 finalize_deplibs="$dir/$linklib $finalize_deplibs"
4361 else
4362 compile_deplibs="-l$name -L$dir $compile_deplibs"
4363 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
4365 elif test "$build_libtool_libs" = yes; then
4366 # Not a shared library
4367 if test "$deplibs_check_method" != pass_all; then
4368 # We're trying link a shared library against a static one
4369 # but the system doesn't support it.
4371 # Just print a warning and add the library to dependency_libs so
4372 # that the program can be linked against the static library.
4373 $ECHO
4374 $ECHO "*** Warning: This system can not link to static lib archive $lib."
4375 $ECHO "*** I have the capability to make that library automatically link in when"
4376 $ECHO "*** you link to this library. But I can only do this if you have a"
4377 $ECHO "*** shared version of the library, which you do not appear to have."
4378 if test "$module" = yes; then
4379 $ECHO "*** But as you try to build a module library, libtool will still create "
4380 $ECHO "*** a static module, that should work as long as the dlopening application"
4381 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
4382 if test -z "$global_symbol_pipe"; then
4383 $ECHO
4384 $ECHO "*** However, this would only work if libtool was able to extract symbol"
4385 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
4386 $ECHO "*** not find such a program. So, this module is probably useless."
4387 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
4389 if test "$build_old_libs" = no; then
4390 build_libtool_libs=module
4391 build_old_libs=yes
4392 else
4393 build_libtool_libs=no
4396 else
4397 deplibs="$dir/$old_library $deplibs"
4398 link_static=yes
4400 fi # link shared/static library?
4402 if test "$linkmode" = lib; then
4403 if test -n "$dependency_libs" &&
4404 { test "$hardcode_into_libs" != yes ||
4405 test "$build_old_libs" = yes ||
4406 test "$link_static" = yes; }; then
4407 # Extract -R from dependency_libs
4408 temp_deplibs=
4409 for libdir in $dependency_libs; do
4410 case $libdir in
4411 -R*) func_stripname '-R' '' "$libdir"
4412 temp_xrpath=$func_stripname_result
4413 case " $xrpath " in
4414 *" $temp_xrpath "*) ;;
4415 *) xrpath="$xrpath $temp_xrpath";;
4416 esac;;
4417 *) temp_deplibs="$temp_deplibs $libdir";;
4418 esac
4419 done
4420 dependency_libs="$temp_deplibs"
4423 newlib_search_path="$newlib_search_path $absdir"
4424 # Link against this library
4425 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
4426 # ... and its dependency_libs
4427 tmp_libs=
4428 for deplib in $dependency_libs; do
4429 newdependency_libs="$deplib $newdependency_libs"
4430 if $opt_duplicate_deps ; then
4431 case "$tmp_libs " in
4432 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4433 esac
4435 tmp_libs="$tmp_libs $deplib"
4436 done
4438 if test "$link_all_deplibs" != no; then
4439 # Add the search paths of all dependency libraries
4440 for deplib in $dependency_libs; do
4441 case $deplib in
4442 -L*) path="$deplib" ;;
4443 *.la)
4444 func_dirname "$deplib" "" "."
4445 dir="$func_dirname_result"
4446 # We need an absolute path.
4447 case $dir in
4448 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
4450 absdir=`cd "$dir" && pwd`
4451 if test -z "$absdir"; then
4452 func_warning "cannot determine absolute directory name of \`$dir'"
4453 absdir="$dir"
4456 esac
4457 if $GREP "^installed=no" $deplib > /dev/null; then
4458 case $host in
4459 *-*-darwin*)
4460 depdepl=
4461 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
4462 if test -n "$deplibrary_names" ; then
4463 for tmp in $deplibrary_names ; do
4464 depdepl=$tmp
4465 done
4466 if test -f "$absdir/$objdir/$depdepl" ; then
4467 depdepl="$absdir/$objdir/$depdepl"
4468 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4469 darwin_install_name=`$ECHO $darwin_install_name`
4470 if test -z "$darwin_install_name"; then
4471 darwin_install_name=`otool64 -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4472 darwin_install_name=`$ECHO $darwin_install_name`
4474 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
4475 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
4476 path=
4481 path="-L$absdir/$objdir"
4483 esac
4484 else
4485 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4486 test -z "$libdir" && \
4487 func_fatal_error "\`$deplib' is not a valid libtool archive"
4488 test "$absdir" != "$libdir" && \
4489 func_warning "\`$deplib' seems to be moved"
4491 path="-L$absdir"
4494 esac
4495 case " $deplibs " in
4496 *" $path "*) ;;
4497 *) deplibs="$path $deplibs" ;;
4498 esac
4499 done
4500 fi # link_all_deplibs != no
4501 fi # linkmode = lib
4502 done # for deplib in $libs
4503 dependency_libs="$newdependency_libs"
4504 if test "$pass" = dlpreopen; then
4505 # Link the dlpreopened libraries before other libraries
4506 for deplib in $save_deplibs; do
4507 deplibs="$deplib $deplibs"
4508 done
4510 if test "$pass" != dlopen; then
4511 if test "$pass" != conv; then
4512 # Make sure lib_search_path contains only unique directories.
4513 lib_search_path=
4514 for dir in $newlib_search_path; do
4515 case "$lib_search_path " in
4516 *" $dir "*) ;;
4517 *) lib_search_path="$lib_search_path $dir" ;;
4518 esac
4519 done
4520 newlib_search_path=
4523 if test "$linkmode,$pass" != "prog,link"; then
4524 vars="deplibs"
4525 else
4526 vars="compile_deplibs finalize_deplibs"
4528 for var in $vars dependency_libs; do
4529 # Add libraries to $var in reverse order
4530 eval tmp_libs=\"\$$var\"
4531 new_libs=
4532 for deplib in $tmp_libs; do
4533 # FIXME: Pedantically, this is the right thing to do, so
4534 # that some nasty dependency loop isn't accidentally
4535 # broken:
4536 #new_libs="$deplib $new_libs"
4537 # Pragmatically, this seems to cause very few problems in
4538 # practice:
4539 case $deplib in
4540 -L*) new_libs="$deplib $new_libs" ;;
4541 -R*) ;;
4543 # And here is the reason: when a library appears more
4544 # than once as an explicit dependence of a library, or
4545 # is implicitly linked in more than once by the
4546 # compiler, it is considered special, and multiple
4547 # occurrences thereof are not removed. Compare this
4548 # with having the same library being listed as a
4549 # dependency of multiple other libraries: in this case,
4550 # we know (pedantically, we assume) the library does not
4551 # need to be listed more than once, so we keep only the
4552 # last copy. This is not always right, but it is rare
4553 # enough that we require users that really mean to play
4554 # such unportable linking tricks to link the library
4555 # using -Wl,-lname, so that libtool does not consider it
4556 # for duplicate removal.
4557 case " $specialdeplibs " in
4558 *" $deplib "*) new_libs="$deplib $new_libs" ;;
4560 case " $new_libs " in
4561 *" $deplib "*) ;;
4562 *) new_libs="$deplib $new_libs" ;;
4563 esac
4565 esac
4567 esac
4568 done
4569 tmp_libs=
4570 for deplib in $new_libs; do
4571 case $deplib in
4572 -L*)
4573 case " $tmp_libs " in
4574 *" $deplib "*) ;;
4575 *) tmp_libs="$tmp_libs $deplib" ;;
4576 esac
4578 *) tmp_libs="$tmp_libs $deplib" ;;
4579 esac
4580 done
4581 eval $var=\"$tmp_libs\"
4582 done # for var
4584 # Last step: remove runtime libs from dependency_libs
4585 # (they stay in deplibs)
4586 tmp_libs=
4587 for i in $dependency_libs ; do
4588 case " $predeps $postdeps $compiler_lib_search_path " in
4589 *" $i "*)
4590 i=""
4592 esac
4593 if test -n "$i" ; then
4594 tmp_libs="$tmp_libs $i"
4596 done
4597 dependency_libs=$tmp_libs
4598 done # for pass
4599 if test "$linkmode" = prog; then
4600 dlfiles="$newdlfiles"
4602 if test "$linkmode" = prog || test "$linkmode" = lib; then
4603 dlprefiles="$newdlprefiles"
4606 case $linkmode in
4607 oldlib)
4608 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4609 func_warning "\`-dlopen' is ignored for archives"
4612 test -n "$deplibs" && \
4613 func_warning "\`-l' and \`-L' are ignored for archives"
4616 test -n "$rpath" && \
4617 func_warning "\`-rpath' is ignored for archives"
4619 test -n "$xrpath" && \
4620 func_warning "\`-R' is ignored for archives"
4622 test -n "$vinfo" && \
4623 func_warning "\`-version-info/-version-number' is ignored for archives"
4625 test -n "$release" && \
4626 func_warning "\`-release' is ignored for archives"
4628 test -n "$export_symbols$export_symbols_regex" && \
4629 func_warning "\`-export-symbols' is ignored for archives"
4631 # Now set the variables for building old libraries.
4632 build_libtool_libs=no
4633 oldlibs="$output"
4634 objs="$objs$old_deplibs"
4637 lib)
4638 # Make sure we only generate libraries of the form `libNAME.la'.
4639 case $outputname in
4640 lib*)
4641 func_stripname 'lib' '.la' "$outputname"
4642 name=$func_stripname_result
4643 eval shared_ext=\"$shrext_cmds\"
4644 eval libname=\"$libname_spec\"
4647 test "$module" = no && \
4648 func_fatal_help "libtool library \`$output' must begin with \`lib'"
4650 if test "$need_lib_prefix" != no; then
4651 # Add the "lib" prefix for modules if required
4652 func_stripname '' '.la' "$outputname"
4653 name=$func_stripname_result
4654 eval shared_ext=\"$shrext_cmds\"
4655 eval libname=\"$libname_spec\"
4656 else
4657 func_stripname '' '.la' "$outputname"
4658 libname=$func_stripname_result
4661 esac
4663 if test -n "$objs"; then
4664 if test "$deplibs_check_method" != pass_all; then
4665 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
4666 else
4667 $ECHO
4668 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
4669 $ECHO "*** objects $objs is not portable!"
4670 libobjs="$libobjs $objs"
4674 test "$dlself" != no && \
4675 func_warning "\`-dlopen self' is ignored for libtool libraries"
4677 set dummy $rpath
4678 shift
4679 test "$#" -gt 1 && \
4680 func_warning "ignoring multiple \`-rpath's for a libtool library"
4682 install_libdir="$1"
4684 oldlibs=
4685 if test -z "$rpath"; then
4686 if test "$build_libtool_libs" = yes; then
4687 # Building a libtool convenience library.
4688 # Some compilers have problems with a `.al' extension so
4689 # convenience libraries should have the same extension an
4690 # archive normally would.
4691 oldlibs="$output_objdir/$libname.$libext $oldlibs"
4692 build_libtool_libs=convenience
4693 build_old_libs=yes
4696 test -n "$vinfo" && \
4697 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
4699 test -n "$release" && \
4700 func_warning "\`-release' is ignored for convenience libraries"
4701 else
4703 # Parse the version information argument.
4704 save_ifs="$IFS"; IFS=':'
4705 set dummy $vinfo 0 0 0
4706 shift
4707 IFS="$save_ifs"
4709 test -n "$7" && \
4710 func_fatal_help "too many parameters to \`-version-info'"
4712 # convert absolute version numbers to libtool ages
4713 # this retains compatibility with .la files and attempts
4714 # to make the code below a bit more comprehensible
4716 case $vinfo_number in
4717 yes)
4718 number_major="$1"
4719 number_minor="$2"
4720 number_revision="$3"
4722 # There are really only two kinds -- those that
4723 # use the current revision as the major version
4724 # and those that subtract age and use age as
4725 # a minor version. But, then there is irix
4726 # which has an extra 1 added just for fun
4728 case $version_type in
4729 darwin|linux|osf|windows|none)
4730 current=`expr $number_major + $number_minor`
4731 age="$number_minor"
4732 revision="$number_revision"
4734 freebsd-aout|freebsd-elf|sunos)
4735 current="$number_major"
4736 revision="$number_minor"
4737 age="0"
4739 irix|nonstopux)
4740 current=`expr $number_major + $number_minor - 1`
4741 age="$number_minor"
4742 revision="$number_minor"
4744 esac
4747 current="$1"
4748 revision="$2"
4749 age="$3"
4751 esac
4753 # Check that each of the things are valid numbers.
4754 case $current in
4755 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]) ;;
4757 func_error "CURRENT \`$current' must be a nonnegative integer"
4758 func_fatal_error "\`$vinfo' is not valid version information"
4760 esac
4762 case $revision in
4763 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]) ;;
4765 func_error "REVISION \`$revision' must be a nonnegative integer"
4766 func_fatal_error "\`$vinfo' is not valid version information"
4768 esac
4770 case $age in
4771 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]) ;;
4773 func_error "AGE \`$age' must be a nonnegative integer"
4774 func_fatal_error "\`$vinfo' is not valid version information"
4776 esac
4778 if test "$age" -gt "$current"; then
4779 func_error "AGE \`$age' is greater than the current interface number \`$current'"
4780 func_fatal_error "\`$vinfo' is not valid version information"
4783 # Calculate the version variables.
4784 major=
4785 versuffix=
4786 verstring=
4787 case $version_type in
4788 none) ;;
4790 darwin)
4791 # Like Linux, but with the current version available in
4792 # verstring for coding it into the library header
4793 major=.`expr $current - $age`
4794 versuffix="$major.$age.$revision"
4795 # Darwin ld doesn't like 0 for these options...
4796 minor_current=`expr $current + 1`
4797 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
4800 freebsd-aout)
4801 major=".$current"
4802 versuffix=".$current.$revision";
4805 freebsd-elf)
4806 major=".$current"
4807 versuffix=".$current"
4810 irix | nonstopux)
4811 major=`expr $current - $age + 1`
4813 case $version_type in
4814 nonstopux) verstring_prefix=nonstopux ;;
4815 *) verstring_prefix=sgi ;;
4816 esac
4817 verstring="$verstring_prefix$major.$revision"
4819 # Add in all the interfaces that we are compatible with.
4820 loop=$revision
4821 while test "$loop" -ne 0; do
4822 iface=`expr $revision - $loop`
4823 loop=`expr $loop - 1`
4824 verstring="$verstring_prefix$major.$iface:$verstring"
4825 done
4827 # Before this point, $major must not contain `.'.
4828 major=.$major
4829 versuffix="$major.$revision"
4832 linux)
4833 major=.`expr $current - $age`
4834 versuffix="$major.$age.$revision"
4837 osf)
4838 major=.`expr $current - $age`
4839 versuffix=".$current.$age.$revision"
4840 verstring="$current.$age.$revision"
4842 # Add in all the interfaces that we are compatible with.
4843 loop=$age
4844 while test "$loop" -ne 0; do
4845 iface=`expr $current - $loop`
4846 loop=`expr $loop - 1`
4847 verstring="$verstring:${iface}.0"
4848 done
4850 # Make executables depend on our current version.
4851 verstring="$verstring:${current}.0"
4854 qnx)
4855 major=".$current"
4856 versuffix=".$current"
4859 sunos)
4860 major=".$current"
4861 versuffix=".$current.$revision"
4864 windows)
4865 # Use '-' rather than '.', since we only want one
4866 # extension on DOS 8.3 filesystems.
4867 major=`expr $current - $age`
4868 versuffix="-$major"
4872 func_fatal_configuration "unknown library version type \`$version_type'"
4874 esac
4876 # Clear the version info if we defaulted, and they specified a release.
4877 if test -z "$vinfo" && test -n "$release"; then
4878 major=
4879 case $version_type in
4880 darwin)
4881 # we can't check for "0.0" in archive_cmds due to quoting
4882 # problems, so we reset it completely
4883 verstring=
4886 verstring="0.0"
4888 esac
4889 if test "$need_version" = no; then
4890 versuffix=
4891 else
4892 versuffix=".0.0"
4896 # Remove version info from name if versioning should be avoided
4897 if test "$avoid_version" = yes && test "$need_version" = no; then
4898 major=
4899 versuffix=
4900 verstring=""
4903 # Check to see if the archive will have undefined symbols.
4904 if test "$allow_undefined" = yes; then
4905 if test "$allow_undefined_flag" = unsupported; then
4906 func_warning "undefined symbols not allowed in $host shared libraries"
4907 build_libtool_libs=no
4908 build_old_libs=yes
4910 else
4911 # Don't allow undefined symbols.
4912 allow_undefined_flag="$no_undefined_flag"
4917 func_generate_dlsyms "$libname" "$libname" "yes"
4918 libobjs="$libobjs $symfileobj"
4919 test "X$libobjs" = "X " && libobjs=
4921 if test "$mode" != relink; then
4922 # Remove our outputs, but don't remove object files since they
4923 # may have been created when compiling PIC objects.
4924 removelist=
4925 tempremovelist=`$ECHO "$output_objdir/*"`
4926 for p in $tempremovelist; do
4927 case $p in
4928 *.$objext)
4930 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
4931 if test "X$precious_files_regex" != "X"; then
4932 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
4933 then
4934 continue
4937 removelist="$removelist $p"
4939 *) ;;
4940 esac
4941 done
4942 test -n "$removelist" && \
4943 func_show_eval "${RM}r \$removelist"
4946 # Now set the variables for building old libraries.
4947 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
4948 oldlibs="$oldlibs $output_objdir/$libname.$libext"
4950 # Transform .lo files to .o files.
4951 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
4954 # Eliminate all temporary directories.
4955 #for path in $notinst_path; do
4956 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
4957 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
4958 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
4959 #done
4961 if test -n "$xrpath"; then
4962 # If the user specified any rpath flags, then add them.
4963 temp_xrpath=
4964 for libdir in $xrpath; do
4965 temp_xrpath="$temp_xrpath -R$libdir"
4966 case "$finalize_rpath " in
4967 *" $libdir "*) ;;
4968 *) finalize_rpath="$finalize_rpath $libdir" ;;
4969 esac
4970 done
4971 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
4972 dependency_libs="$temp_xrpath $dependency_libs"
4976 # Make sure dlfiles contains only unique files that won't be dlpreopened
4977 old_dlfiles="$dlfiles"
4978 dlfiles=
4979 for lib in $old_dlfiles; do
4980 case " $dlprefiles $dlfiles " in
4981 *" $lib "*) ;;
4982 *) dlfiles="$dlfiles $lib" ;;
4983 esac
4984 done
4986 # Make sure dlprefiles contains only unique files
4987 old_dlprefiles="$dlprefiles"
4988 dlprefiles=
4989 for lib in $old_dlprefiles; do
4990 case "$dlprefiles " in
4991 *" $lib "*) ;;
4992 *) dlprefiles="$dlprefiles $lib" ;;
4993 esac
4994 done
4996 if test "$build_libtool_libs" = yes; then
4997 if test -n "$rpath"; then
4998 case $host in
4999 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
5000 # these systems don't actually have a c library (as such)!
5002 *-*-rhapsody* | *-*-darwin1.[012])
5003 # Rhapsody C library is in the System framework
5004 deplibs="$deplibs System.ltframework"
5006 *-*-netbsd*)
5007 # Don't link with libc until the a.out ld.so is fixed.
5009 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
5010 # Do not include libc due to us having libc/libc_r.
5012 *-*-sco3.2v5* | *-*-sco5v6*)
5013 # Causes problems with __ctype
5015 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
5016 # Compiler inserts libc in the correct place for threads to work
5019 # Add libc to deplibs on all other systems if necessary.
5020 if test "$build_libtool_need_lc" = "yes"; then
5021 deplibs="$deplibs -lc"
5024 esac
5027 # Transform deplibs into only deplibs that can be linked in shared.
5028 name_save=$name
5029 libname_save=$libname
5030 release_save=$release
5031 versuffix_save=$versuffix
5032 major_save=$major
5033 # I'm not sure if I'm treating the release correctly. I think
5034 # release should show up in the -l (ie -lgmp5) so we don't want to
5035 # add it in twice. Is that correct?
5036 release=""
5037 versuffix=""
5038 major=""
5039 newdeplibs=
5040 droppeddeps=no
5041 case $deplibs_check_method in
5042 pass_all)
5043 # Don't check for shared/static. Everything works.
5044 # This might be a little naive. We might want to check
5045 # whether the library exists or not. But this is on
5046 # osf3 & osf4 and I'm not really sure... Just
5047 # implementing what was already the behavior.
5048 newdeplibs=$deplibs
5050 test_compile)
5051 # This code stresses the "libraries are programs" paradigm to its
5052 # limits. Maybe even breaks it. We compile a program, linking it
5053 # against the deplibs as a proxy for the library. Then we can check
5054 # whether they linked in statically or dynamically with ldd.
5055 $opt_dry_run || $RM conftest.c
5056 cat > conftest.c <<EOF
5057 int main() { return 0; }
5059 $opt_dry_run || $RM conftest
5060 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5061 ldd_output=`ldd conftest`
5062 for i in $deplibs; do
5063 name=`expr $i : '-l\(.*\)'`
5064 # If $name is empty we are operating on a -L argument.
5065 if test "$name" != "" && test "$name" != "0"; then
5066 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5067 case " $predeps $postdeps " in
5068 *" $i "*)
5069 newdeplibs="$newdeplibs $i"
5070 i=""
5072 esac
5074 if test -n "$i" ; then
5075 libname=`eval "\\$ECHO \"$libname_spec\""`
5076 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5077 set dummy $deplib_matches; shift
5078 deplib_match=$1
5079 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5080 newdeplibs="$newdeplibs $i"
5081 else
5082 droppeddeps=yes
5083 $ECHO
5084 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5085 $ECHO "*** I have the capability to make that library automatically link in when"
5086 $ECHO "*** you link to this library. But I can only do this if you have a"
5087 $ECHO "*** shared version of the library, which I believe you do not have"
5088 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
5089 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
5092 else
5093 newdeplibs="$newdeplibs $i"
5095 done
5096 else
5097 # Error occurred in the first compile. Let's try to salvage
5098 # the situation: Compile a separate program for each library.
5099 for i in $deplibs; do
5100 name=`expr $i : '-l\(.*\)'`
5101 # If $name is empty we are operating on a -L argument.
5102 if test "$name" != "" && test "$name" != "0"; then
5103 $opt_dry_run || $RM conftest
5104 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5105 ldd_output=`ldd conftest`
5106 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5107 case " $predeps $postdeps " in
5108 *" $i "*)
5109 newdeplibs="$newdeplibs $i"
5110 i=""
5112 esac
5114 if test -n "$i" ; then
5115 libname=`eval "\\$ECHO \"$libname_spec\""`
5116 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5117 set dummy $deplib_matches; shift
5118 deplib_match=$1
5119 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5120 newdeplibs="$newdeplibs $i"
5121 else
5122 droppeddeps=yes
5123 $ECHO
5124 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5125 $ECHO "*** I have the capability to make that library automatically link in when"
5126 $ECHO "*** you link to this library. But I can only do this if you have a"
5127 $ECHO "*** shared version of the library, which you do not appear to have"
5128 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
5129 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
5132 else
5133 droppeddeps=yes
5134 $ECHO
5135 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
5136 $ECHO "*** make it link in! You will probably need to install it or some"
5137 $ECHO "*** library that it depends on before this library will be fully"
5138 $ECHO "*** functional. Installing it before continuing would be even better."
5140 else
5141 newdeplibs="$newdeplibs $i"
5143 done
5146 file_magic*)
5147 set dummy $deplibs_check_method; shift
5148 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5149 for a_deplib in $deplibs; do
5150 name=`expr $a_deplib : '-l\(.*\)'`
5151 # If $name is empty we are operating on a -L argument.
5152 if test "$name" != "" && test "$name" != "0"; then
5153 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5154 case " $predeps $postdeps " in
5155 *" $a_deplib "*)
5156 newdeplibs="$newdeplibs $a_deplib"
5157 a_deplib=""
5159 esac
5161 if test -n "$a_deplib" ; then
5162 libname=`eval "\\$ECHO \"$libname_spec\""`
5163 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5164 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5165 for potent_lib in $potential_libs; do
5166 # Follow soft links.
5167 if ls -lLd "$potent_lib" 2>/dev/null |
5168 $GREP " -> " >/dev/null; then
5169 continue
5171 # The statement above tries to avoid entering an
5172 # endless loop below, in case of cyclic links.
5173 # We might still enter an endless loop, since a link
5174 # loop can be closed while we follow links,
5175 # but so what?
5176 potlib="$potent_lib"
5177 while test -h "$potlib" 2>/dev/null; do
5178 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
5179 case $potliblink in
5180 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
5181 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
5182 esac
5183 done
5184 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
5185 $SED -e 10q |
5186 $EGREP "$file_magic_regex" > /dev/null; then
5187 newdeplibs="$newdeplibs $a_deplib"
5188 a_deplib=""
5189 break 2
5191 done
5192 done
5194 if test -n "$a_deplib" ; then
5195 droppeddeps=yes
5196 $ECHO
5197 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5198 $ECHO "*** I have the capability to make that library automatically link in when"
5199 $ECHO "*** you link to this library. But I can only do this if you have a"
5200 $ECHO "*** shared version of the library, which you do not appear to have"
5201 $ECHO "*** because I did check the linker path looking for a file starting"
5202 if test -z "$potlib" ; then
5203 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
5204 else
5205 $ECHO "*** with $libname and none of the candidates passed a file format test"
5206 $ECHO "*** using a file magic. Last file checked: $potlib"
5209 else
5210 # Add a -L argument.
5211 newdeplibs="$newdeplibs $a_deplib"
5213 done # Gone through all deplibs.
5215 match_pattern*)
5216 set dummy $deplibs_check_method; shift
5217 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5218 for a_deplib in $deplibs; do
5219 name=`expr $a_deplib : '-l\(.*\)'`
5220 # If $name is empty we are operating on a -L argument.
5221 if test -n "$name" && test "$name" != "0"; then
5222 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5223 case " $predeps $postdeps " in
5224 *" $a_deplib "*)
5225 newdeplibs="$newdeplibs $a_deplib"
5226 a_deplib=""
5228 esac
5230 if test -n "$a_deplib" ; then
5231 libname=`eval "\\$ECHO \"$libname_spec\""`
5232 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5233 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5234 for potent_lib in $potential_libs; do
5235 potlib="$potent_lib" # see symlink-check above in file_magic test
5236 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
5237 $EGREP "$match_pattern_regex" > /dev/null; then
5238 newdeplibs="$newdeplibs $a_deplib"
5239 a_deplib=""
5240 break 2
5242 done
5243 done
5245 if test -n "$a_deplib" ; then
5246 droppeddeps=yes
5247 $ECHO
5248 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5249 $ECHO "*** I have the capability to make that library automatically link in when"
5250 $ECHO "*** you link to this library. But I can only do this if you have a"
5251 $ECHO "*** shared version of the library, which you do not appear to have"
5252 $ECHO "*** because I did check the linker path looking for a file starting"
5253 if test -z "$potlib" ; then
5254 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
5255 else
5256 $ECHO "*** with $libname and none of the candidates passed a file format test"
5257 $ECHO "*** using a regex pattern. Last file checked: $potlib"
5260 else
5261 # Add a -L argument.
5262 newdeplibs="$newdeplibs $a_deplib"
5264 done # Gone through all deplibs.
5266 none | unknown | *)
5267 newdeplibs=""
5268 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
5269 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
5270 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5271 for i in $predeps $postdeps ; do
5272 # can't use Xsed below, because $i might contain '/'
5273 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
5274 done
5276 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
5277 $GREP . >/dev/null; then
5278 $ECHO
5279 if test "X$deplibs_check_method" = "Xnone"; then
5280 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
5281 else
5282 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
5284 $ECHO "*** All declared inter-library dependencies are being dropped."
5285 droppeddeps=yes
5288 esac
5289 versuffix=$versuffix_save
5290 major=$major_save
5291 release=$release_save
5292 libname=$libname_save
5293 name=$name_save
5295 case $host in
5296 *-*-rhapsody* | *-*-darwin1.[012])
5297 # On Rhapsody replace the C library with the System framework
5298 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5300 esac
5302 if test "$droppeddeps" = yes; then
5303 if test "$module" = yes; then
5304 $ECHO
5305 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
5306 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
5307 $ECHO "*** a static module, that should work as long as the dlopening"
5308 $ECHO "*** application is linked with the -dlopen flag."
5309 if test -z "$global_symbol_pipe"; then
5310 $ECHO
5311 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5312 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5313 $ECHO "*** not find such a program. So, this module is probably useless."
5314 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5316 if test "$build_old_libs" = no; then
5317 oldlibs="$output_objdir/$libname.$libext"
5318 build_libtool_libs=module
5319 build_old_libs=yes
5320 else
5321 build_libtool_libs=no
5323 else
5324 $ECHO "*** The inter-library dependencies that have been dropped here will be"
5325 $ECHO "*** automatically added whenever a program is linked with this library"
5326 $ECHO "*** or is declared to -dlopen it."
5328 if test "$allow_undefined" = no; then
5329 $ECHO
5330 $ECHO "*** Since this library must not contain undefined symbols,"
5331 $ECHO "*** because either the platform does not support them or"
5332 $ECHO "*** it was explicitly requested with -no-undefined,"
5333 $ECHO "*** libtool will only create a static version of it."
5334 if test "$build_old_libs" = no; then
5335 oldlibs="$output_objdir/$libname.$libext"
5336 build_libtool_libs=module
5337 build_old_libs=yes
5338 else
5339 build_libtool_libs=no
5344 # Done checking deplibs!
5345 deplibs=$newdeplibs
5347 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5348 case $host in
5349 *-*-darwin*)
5350 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5351 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5352 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5354 esac
5356 # move library search paths that coincide with paths to not yet
5357 # installed libraries to the beginning of the library search list
5358 new_libs=
5359 for path in $notinst_path; do
5360 case " $new_libs " in
5361 *" -L$path/$objdir "*) ;;
5363 case " $deplibs " in
5364 *" -L$path/$objdir "*)
5365 new_libs="$new_libs -L$path/$objdir" ;;
5366 esac
5368 esac
5369 done
5370 for deplib in $deplibs; do
5371 case $deplib in
5372 -L*)
5373 case " $new_libs " in
5374 *" $deplib "*) ;;
5375 *) new_libs="$new_libs $deplib" ;;
5376 esac
5378 *) new_libs="$new_libs $deplib" ;;
5379 esac
5380 done
5381 deplibs="$new_libs"
5383 # All the library-specific variables (install_libdir is set above).
5384 library_names=
5385 old_library=
5386 dlname=
5388 # Test again, we may have decided not to build it any more
5389 if test "$build_libtool_libs" = yes; then
5390 if test "$hardcode_into_libs" = yes; then
5391 # Hardcode the library paths
5392 hardcode_libdirs=
5393 dep_rpath=
5394 rpath="$finalize_rpath"
5395 test "$mode" != relink && rpath="$compile_rpath$rpath"
5396 for libdir in $rpath; do
5397 if test -n "$hardcode_libdir_flag_spec"; then
5398 if test -n "$hardcode_libdir_separator"; then
5399 if test -z "$hardcode_libdirs"; then
5400 hardcode_libdirs="$libdir"
5401 else
5402 # Just accumulate the unique libdirs.
5403 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5404 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5407 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5409 esac
5411 else
5412 eval flag=\"$hardcode_libdir_flag_spec\"
5413 dep_rpath="$dep_rpath $flag"
5415 elif test -n "$runpath_var"; then
5416 case "$perm_rpath " in
5417 *" $libdir "*) ;;
5418 *) perm_rpath="$perm_rpath $libdir" ;;
5419 esac
5421 done
5422 # Substitute the hardcoded libdirs into the rpath.
5423 if test -n "$hardcode_libdir_separator" &&
5424 test -n "$hardcode_libdirs"; then
5425 libdir="$hardcode_libdirs"
5426 if test -n "$hardcode_libdir_flag_spec_ld"; then
5427 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
5428 else
5429 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
5432 if test -n "$runpath_var" && test -n "$perm_rpath"; then
5433 # We should set the runpath_var.
5434 rpath=
5435 for dir in $perm_rpath; do
5436 rpath="$rpath$dir:"
5437 done
5438 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
5440 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
5443 shlibpath="$finalize_shlibpath"
5444 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
5445 if test -n "$shlibpath"; then
5446 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
5449 # Get the real and link names of the library.
5450 eval shared_ext=\"$shrext_cmds\"
5451 eval library_names=\"$library_names_spec\"
5452 set dummy $library_names
5453 shift
5454 realname="$1"
5455 shift
5457 if test -n "$soname_spec"; then
5458 eval soname=\"$soname_spec\"
5459 else
5460 soname="$realname"
5462 if test -z "$dlname"; then
5463 dlname=$soname
5466 lib="$output_objdir/$realname"
5467 linknames=
5468 for link
5470 linknames="$linknames $link"
5471 done
5473 # Use standard objects if they are pic
5474 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5475 test "X$libobjs" = "X " && libobjs=
5477 delfiles=
5478 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5479 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
5480 export_symbols="$output_objdir/$libname.uexp"
5481 delfiles="$delfiles $export_symbols"
5484 orig_export_symbols=
5485 case $host_os in
5486 cygwin* | mingw*)
5487 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
5488 # exporting using user supplied symfile
5489 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
5490 # and it's NOT already a .def file. Must figure out
5491 # which of the given symbols are data symbols and tag
5492 # them as such. So, trigger use of export_symbols_cmds.
5493 # export_symbols gets reassigned inside the "prepare
5494 # the list of exported symbols" if statement, so the
5495 # include_expsyms logic still works.
5496 orig_export_symbols="$export_symbols"
5497 export_symbols=
5498 always_export_symbols=yes
5502 esac
5504 # Prepare the list of exported symbols
5505 if test -z "$export_symbols"; then
5506 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
5507 func_echo "generating symbol list for \`$libname.la'"
5508 export_symbols="$output_objdir/$libname.exp"
5509 $opt_dry_run || $RM $export_symbols
5510 cmds=$export_symbols_cmds
5511 save_ifs="$IFS"; IFS='~'
5512 for cmd in $cmds; do
5513 IFS="$save_ifs"
5514 eval cmd=\"$cmd\"
5515 if len=`expr "X$cmd" : ".*"` &&
5516 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5517 func_show_eval "$cmd" 'exit $?'
5518 skipped_export=false
5519 else
5520 # The command line is too long to execute in one step.
5521 func_echo "using reloadable object file for export list..."
5522 skipped_export=:
5523 # Break out early, otherwise skipped_export may be
5524 # set to false by a later but shorter cmd.
5525 break
5527 done
5528 IFS="$save_ifs"
5529 if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
5530 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5531 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5536 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5537 tmp_export_symbols="$export_symbols"
5538 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5539 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5542 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
5543 # The given exports_symbols file has to be filtered, so filter it.
5544 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5545 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5546 # 's' commands which not all seds can handle. GNU sed should be fine
5547 # though. Also, the filter scales superlinearly with the number of
5548 # global variables. join(1) would be nice here, but unfortunately
5549 # isn't a blessed tool.
5550 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5551 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5552 export_symbols=$output_objdir/$libname.def
5553 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5556 tmp_deplibs=
5557 for test_deplib in $deplibs; do
5558 case " $convenience " in
5559 *" $test_deplib "*) ;;
5561 tmp_deplibs="$tmp_deplibs $test_deplib"
5563 esac
5564 done
5565 deplibs="$tmp_deplibs"
5567 if test -n "$convenience"; then
5568 if test -n "$whole_archive_flag_spec" &&
5569 test "$compiler_needs_object" = yes &&
5570 test -z "$libobjs"; then
5571 # extract the archives, so we have objects to list.
5572 # TODO: could optimize this to just extract one archive.
5573 whole_archive_flag_spec=
5575 if test -n "$whole_archive_flag_spec"; then
5576 save_libobjs=$libobjs
5577 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5578 test "X$libobjs" = "X " && libobjs=
5579 else
5580 gentop="$output_objdir/${outputname}x"
5581 generated="$generated $gentop"
5583 func_extract_archives $gentop $convenience
5584 libobjs="$libobjs $func_extract_archives_result"
5585 test "X$libobjs" = "X " && libobjs=
5589 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
5590 eval flag=\"$thread_safe_flag_spec\"
5591 linker_flags="$linker_flags $flag"
5594 # Make a backup of the uninstalled library when relinking
5595 if test "$mode" = relink; then
5596 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5599 # Do each of the archive commands.
5600 if test "$module" = yes && test -n "$module_cmds" ; then
5601 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5602 eval test_cmds=\"$module_expsym_cmds\"
5603 cmds=$module_expsym_cmds
5604 else
5605 eval test_cmds=\"$module_cmds\"
5606 cmds=$module_cmds
5608 else
5609 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5610 eval test_cmds=\"$archive_expsym_cmds\"
5611 cmds=$archive_expsym_cmds
5612 else
5613 eval test_cmds=\"$archive_cmds\"
5614 cmds=$archive_cmds
5618 if test "X$skipped_export" != "X:" &&
5619 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5620 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5622 else
5623 # The command line is too long to link in one step, link piecewise
5624 # or, if using GNU ld and skipped_export is not :, use a linker
5625 # script.
5627 # Save the value of $output and $libobjs because we want to
5628 # use them later. If we have whole_archive_flag_spec, we
5629 # want to use save_libobjs as it was before
5630 # whole_archive_flag_spec was expanded, because we can't
5631 # assume the linker understands whole_archive_flag_spec.
5632 # This may have to be revisited, in case too many
5633 # convenience libraries get linked in and end up exceeding
5634 # the spec.
5635 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5636 save_libobjs=$libobjs
5638 save_output=$output
5639 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
5641 # Clear the reloadable object creation command queue and
5642 # initialize k to one.
5643 test_cmds=
5644 concat_cmds=
5645 objlist=
5646 last_robj=
5649 if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
5650 output=${output_objdir}/${output_la}.lnkscript
5651 func_echo "creating GNU ld script: $output"
5652 $ECHO 'INPUT (' > $output
5653 for obj in $save_libobjs
5655 $ECHO "$obj" >> $output
5656 done
5657 $ECHO ')' >> $output
5658 delfiles="$delfiles $output"
5659 elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
5660 output=${output_objdir}/${output_la}.lnk
5661 func_echo "creating linker input file list: $output"
5662 : > $output
5663 set x $save_libobjs
5664 shift
5665 firstobj=
5666 if test "$compiler_needs_object" = yes; then
5667 firstobj="$1 "
5668 shift
5670 for obj
5672 $ECHO "$obj" >> $output
5673 done
5674 delfiles="$delfiles $output"
5675 output=$firstobj\"$file_list_spec$output\"
5676 else
5677 if test -n "$save_libobjs"; then
5678 func_echo "creating reloadable object files..."
5679 output=$output_objdir/$output_la-${k}.$objext
5680 # Loop over the list of objects to be linked.
5681 for obj in $save_libobjs
5683 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
5684 if test "X$objlist" = X ||
5685 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5686 test "$len" -le "$max_cmd_len"; }; then
5687 objlist="$objlist $obj"
5688 else
5689 # The command $test_cmds is almost too long, add a
5690 # command to the queue.
5691 if test "$k" -eq 1 ; then
5692 # The first file doesn't have a previous command to add.
5693 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
5694 else
5695 # All subsequent reloadable object files will link in
5696 # the last one created.
5697 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
5699 last_robj=$output_objdir/$output_la-${k}.$objext
5700 k=`expr $k + 1`
5701 output=$output_objdir/$output_la-${k}.$objext
5702 objlist=$obj
5703 len=1
5705 done
5706 # Handle the remaining objects by creating one last
5707 # reloadable object file. All subsequent reloadable object
5708 # files will link in the last one created.
5709 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5710 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
5712 # Set up a command to remove the reloadable object files
5713 # after they are used.
5715 while test "$i" -lt "$k"
5717 i=`expr $i + 1`
5718 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
5719 done
5720 else
5721 output=
5724 if ${skipped_export-false}; then
5725 func_echo "generating symbol list for \`$libname.la'"
5726 export_symbols="$output_objdir/$libname.exp"
5727 $opt_dry_run || $RM $export_symbols
5728 libobjs=$output
5729 # Append the command to create the export file.
5730 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5731 eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
5734 test -n "$save_libobjs" &&
5735 func_echo "creating a temporary reloadable object file: $output"
5737 # Loop through the commands generated above and execute them.
5738 save_ifs="$IFS"; IFS='~'
5739 for cmd in $concat_cmds; do
5740 IFS="$save_ifs"
5741 $opt_silent || {
5742 func_quote_for_expand "$cmd"
5743 eval "func_echo $func_quote_for_expand_result"
5745 $opt_dry_run || eval "$cmd" || {
5746 lt_exit=$?
5748 # Restore the uninstalled library and exit
5749 if test "$mode" = relink; then
5750 ( cd "$output_objdir" && \
5751 $RM "${realname}T" && \
5752 $MV "${realname}U" "$realname" )
5755 exit $lt_exit
5757 done
5758 IFS="$save_ifs"
5760 if test -n "$export_symbols_regex" && ${skipped_export-false}; then
5761 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5762 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5766 if ${skipped_export-false}; then
5767 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5768 tmp_export_symbols="$export_symbols"
5769 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5770 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5773 if test -n "$orig_export_symbols"; then
5774 # The given exports_symbols file has to be filtered, so filter it.
5775 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5776 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5777 # 's' commands which not all seds can handle. GNU sed should be fine
5778 # though. Also, the filter scales superlinearly with the number of
5779 # global variables. join(1) would be nice here, but unfortunately
5780 # isn't a blessed tool.
5781 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5782 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5783 export_symbols=$output_objdir/$libname.def
5784 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5788 libobjs=$output
5789 # Restore the value of output.
5790 output=$save_output
5792 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5793 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5794 test "X$libobjs" = "X " && libobjs=
5796 # Expand the library linking commands again to reset the
5797 # value of $libobjs for piecewise linking.
5799 # Do each of the archive commands.
5800 if test "$module" = yes && test -n "$module_cmds" ; then
5801 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5802 cmds=$module_expsym_cmds
5803 else
5804 cmds=$module_cmds
5806 else
5807 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5808 cmds=$archive_expsym_cmds
5809 else
5810 cmds=$archive_cmds
5815 if test -n "$delfiles"; then
5816 # Append the command to remove temporary files to $cmds.
5817 eval cmds=\"\$cmds~\$RM $delfiles\"
5820 # Add any objects from preloaded convenience libraries
5821 if test -n "$dlprefiles"; then
5822 gentop="$output_objdir/${outputname}x"
5823 generated="$generated $gentop"
5825 func_extract_archives $gentop $dlprefiles
5826 libobjs="$libobjs $func_extract_archives_result"
5827 test "X$libobjs" = "X " && libobjs=
5830 save_ifs="$IFS"; IFS='~'
5831 for cmd in $cmds; do
5832 IFS="$save_ifs"
5833 eval cmd=\"$cmd\"
5834 $opt_silent || {
5835 func_quote_for_expand "$cmd"
5836 eval "func_echo $func_quote_for_expand_result"
5838 $opt_dry_run || eval "$cmd" || {
5839 lt_exit=$?
5841 # Restore the uninstalled library and exit
5842 if test "$mode" = relink; then
5843 ( cd "$output_objdir" && \
5844 $RM "${realname}T" && \
5845 $MV "${realname}U" "$realname" )
5848 exit $lt_exit
5850 done
5851 IFS="$save_ifs"
5853 # Restore the uninstalled library and exit
5854 if test "$mode" = relink; then
5855 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5857 if test -n "$convenience"; then
5858 if test -z "$whole_archive_flag_spec"; then
5859 func_show_eval '${RM}r "$gentop"'
5863 exit $EXIT_SUCCESS
5866 # Create links to the real library.
5867 for linkname in $linknames; do
5868 if test "$realname" != "$linkname"; then
5869 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5871 done
5873 # If -module or -export-dynamic was specified, set the dlname.
5874 if test "$module" = yes || test "$export_dynamic" = yes; then
5875 # On all known operating systems, these are identical.
5876 dlname="$soname"
5881 obj)
5882 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5883 func_warning "\`-dlopen' is ignored for objects"
5886 test -n "$deplibs" && \
5887 func_warning "\`-l' and \`-L' are ignored for objects"
5889 test -n "$rpath" && \
5890 func_warning "\`-rpath' is ignored for objects"
5892 test -n "$xrpath" && \
5893 func_warning "\`-R' is ignored for objects"
5895 test -n "$vinfo" && \
5896 func_warning "\`-version-info' is ignored for objects"
5898 test -n "$release" && \
5899 func_warning "\`-release' is ignored for objects"
5901 case $output in
5902 *.lo)
5903 test -n "$objs$old_deplibs" && \
5904 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
5906 libobj=$output
5907 func_lo2o "$libobj"
5908 obj=$func_lo2o_result
5911 libobj=
5912 obj="$output"
5914 esac
5916 # Delete the old objects.
5917 $opt_dry_run || $RM $obj $libobj
5919 # Objects from convenience libraries. This assumes
5920 # single-version convenience libraries. Whenever we create
5921 # different ones for PIC/non-PIC, this we'll have to duplicate
5922 # the extraction.
5923 reload_conv_objs=
5924 gentop=
5925 # reload_cmds runs $LD directly, so let us get rid of
5926 # -Wl from whole_archive_flag_spec and hope we can get by with
5927 # turning comma into space..
5930 if test -n "$convenience"; then
5931 if test -n "$whole_archive_flag_spec"; then
5932 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
5933 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
5934 else
5935 gentop="$output_objdir/${obj}x"
5936 generated="$generated $gentop"
5938 func_extract_archives $gentop $convenience
5939 reload_conv_objs="$reload_objs $func_extract_archives_result"
5943 # Create the old-style object.
5944 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
5946 output="$obj"
5947 func_execute_cmds "$reload_cmds" 'exit $?'
5949 # Exit if we aren't doing a library object file.
5950 if test -z "$libobj"; then
5951 if test -n "$gentop"; then
5952 func_show_eval '${RM}r "$gentop"'
5955 exit $EXIT_SUCCESS
5958 if test "$build_libtool_libs" != yes; then
5959 if test -n "$gentop"; then
5960 func_show_eval '${RM}r "$gentop"'
5963 # Create an invalid libtool object if no PIC, so that we don't
5964 # accidentally link it into a program.
5965 # $show "echo timestamp > $libobj"
5966 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5967 exit $EXIT_SUCCESS
5970 if test -n "$pic_flag" || test "$pic_mode" != default; then
5971 # Only do commands if we really have different PIC objects.
5972 reload_objs="$libobjs $reload_conv_objs"
5973 output="$libobj"
5974 func_execute_cmds "$reload_cmds" 'exit $?'
5977 if test -n "$gentop"; then
5978 func_show_eval '${RM}r "$gentop"'
5981 exit $EXIT_SUCCESS
5984 prog)
5985 case $host in
5986 *cygwin*) func_stripname '' '.exe' "$output"
5987 output=$func_stripname_result.exe;;
5988 esac
5989 test -n "$vinfo" && \
5990 func_warning "\`-version-info' is ignored for programs"
5992 test -n "$release" && \
5993 func_warning "\`-release' is ignored for programs"
5995 test "$preload" = yes \
5996 && test "$dlopen_support" = unknown \
5997 && test "$dlopen_self" = unknown \
5998 && test "$dlopen_self_static" = unknown && \
5999 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
6001 case $host in
6002 *-*-rhapsody* | *-*-darwin1.[012])
6003 # On Rhapsody replace the C library is the System framework
6004 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6005 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
6007 esac
6009 case $host in
6010 *-*-darwin*)
6011 # Don't allow lazy linking, it breaks C++ global constructors
6012 # But is supposedly fixed on 10.4 or later (yay!).
6013 if test "$tagname" = CXX ; then
6014 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
6015 10.[0123])
6016 compile_command="$compile_command ${wl}-bind_at_load"
6017 finalize_command="$finalize_command ${wl}-bind_at_load"
6019 esac
6021 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
6022 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6023 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
6025 esac
6028 # move library search paths that coincide with paths to not yet
6029 # installed libraries to the beginning of the library search list
6030 new_libs=
6031 for path in $notinst_path; do
6032 case " $new_libs " in
6033 *" -L$path/$objdir "*) ;;
6035 case " $compile_deplibs " in
6036 *" -L$path/$objdir "*)
6037 new_libs="$new_libs -L$path/$objdir" ;;
6038 esac
6040 esac
6041 done
6042 for deplib in $compile_deplibs; do
6043 case $deplib in
6044 -L*)
6045 case " $new_libs " in
6046 *" $deplib "*) ;;
6047 *) new_libs="$new_libs $deplib" ;;
6048 esac
6050 *) new_libs="$new_libs $deplib" ;;
6051 esac
6052 done
6053 compile_deplibs="$new_libs"
6056 compile_command="$compile_command $compile_deplibs"
6057 finalize_command="$finalize_command $finalize_deplibs"
6059 if test -n "$rpath$xrpath"; then
6060 # If the user specified any rpath flags, then add them.
6061 for libdir in $rpath $xrpath; do
6062 # This is the magic to use -rpath.
6063 case "$finalize_rpath " in
6064 *" $libdir "*) ;;
6065 *) finalize_rpath="$finalize_rpath $libdir" ;;
6066 esac
6067 done
6070 # Now hardcode the library paths
6071 rpath=
6072 hardcode_libdirs=
6073 for libdir in $compile_rpath $finalize_rpath; do
6074 if test -n "$hardcode_libdir_flag_spec"; then
6075 if test -n "$hardcode_libdir_separator"; then
6076 if test -z "$hardcode_libdirs"; then
6077 hardcode_libdirs="$libdir"
6078 else
6079 # Just accumulate the unique libdirs.
6080 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6081 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6084 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6086 esac
6088 else
6089 eval flag=\"$hardcode_libdir_flag_spec\"
6090 rpath="$rpath $flag"
6092 elif test -n "$runpath_var"; then
6093 case "$perm_rpath " in
6094 *" $libdir "*) ;;
6095 *) perm_rpath="$perm_rpath $libdir" ;;
6096 esac
6098 case $host in
6099 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
6100 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
6101 case :$dllsearchpath: in
6102 *":$libdir:"*) ;;
6103 *) dllsearchpath="$dllsearchpath:$libdir";;
6104 esac
6105 case :$dllsearchpath: in
6106 *":$testbindir:"*) ;;
6107 *) dllsearchpath="$dllsearchpath:$testbindir";;
6108 esac
6110 esac
6111 done
6112 # Substitute the hardcoded libdirs into the rpath.
6113 if test -n "$hardcode_libdir_separator" &&
6114 test -n "$hardcode_libdirs"; then
6115 libdir="$hardcode_libdirs"
6116 eval rpath=\" $hardcode_libdir_flag_spec\"
6118 compile_rpath="$rpath"
6120 rpath=
6121 hardcode_libdirs=
6122 for libdir in $finalize_rpath; do
6123 if test -n "$hardcode_libdir_flag_spec"; then
6124 if test -n "$hardcode_libdir_separator"; then
6125 if test -z "$hardcode_libdirs"; then
6126 hardcode_libdirs="$libdir"
6127 else
6128 # Just accumulate the unique libdirs.
6129 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6130 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6133 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6135 esac
6137 else
6138 eval flag=\"$hardcode_libdir_flag_spec\"
6139 rpath="$rpath $flag"
6141 elif test -n "$runpath_var"; then
6142 case "$finalize_perm_rpath " in
6143 *" $libdir "*) ;;
6144 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
6145 esac
6147 done
6148 # Substitute the hardcoded libdirs into the rpath.
6149 if test -n "$hardcode_libdir_separator" &&
6150 test -n "$hardcode_libdirs"; then
6151 libdir="$hardcode_libdirs"
6152 eval rpath=\" $hardcode_libdir_flag_spec\"
6154 finalize_rpath="$rpath"
6156 if test -n "$libobjs" && test "$build_old_libs" = yes; then
6157 # Transform all the library objects into standard objects.
6158 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6159 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6162 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
6164 # template prelinking step
6165 if test -n "$prelink_cmds"; then
6166 func_execute_cmds "$prelink_cmds" 'exit $?'
6169 wrappers_required=yes
6170 case $host in
6171 *cygwin* | *mingw* )
6172 if test "$build_libtool_libs" != yes; then
6173 wrappers_required=no
6177 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
6178 wrappers_required=no
6181 esac
6182 if test "$wrappers_required" = no; then
6183 # Replace the output file specification.
6184 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6185 link_command="$compile_command$compile_rpath"
6187 # We have no uninstalled library dependencies, so finalize right now.
6188 exit_status=0
6189 func_show_eval "$link_command" 'exit_status=$?'
6191 # Delete the generated files.
6192 if test -f "$output_objdir/${outputname}S.${objext}"; then
6193 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
6196 exit $exit_status
6199 if test -n "$compile_shlibpath$finalize_shlibpath"; then
6200 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
6202 if test -n "$finalize_shlibpath"; then
6203 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
6206 compile_var=
6207 finalize_var=
6208 if test -n "$runpath_var"; then
6209 if test -n "$perm_rpath"; then
6210 # We should set the runpath_var.
6211 rpath=
6212 for dir in $perm_rpath; do
6213 rpath="$rpath$dir:"
6214 done
6215 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
6217 if test -n "$finalize_perm_rpath"; then
6218 # We should set the runpath_var.
6219 rpath=
6220 for dir in $finalize_perm_rpath; do
6221 rpath="$rpath$dir:"
6222 done
6223 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
6227 if test "$no_install" = yes; then
6228 # We don't need to create a wrapper script.
6229 link_command="$compile_var$compile_command$compile_rpath"
6230 # Replace the output file specification.
6231 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6232 # Delete the old output file.
6233 $opt_dry_run || $RM $output
6234 # Link the executable and exit
6235 func_show_eval "$link_command" 'exit $?'
6236 exit $EXIT_SUCCESS
6239 if test "$hardcode_action" = relink; then
6240 # Fast installation is not supported
6241 link_command="$compile_var$compile_command$compile_rpath"
6242 relink_command="$finalize_var$finalize_command$finalize_rpath"
6244 func_warning "this platform does not like uninstalled shared libraries"
6245 func_warning "\`$output' will be relinked during installation"
6246 else
6247 if test "$fast_install" != no; then
6248 link_command="$finalize_var$compile_command$finalize_rpath"
6249 if test "$fast_install" = yes; then
6250 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
6251 else
6252 # fast_install is set to needless
6253 relink_command=
6255 else
6256 link_command="$compile_var$compile_command$compile_rpath"
6257 relink_command="$finalize_var$finalize_command$finalize_rpath"
6261 # Replace the output file specification.
6262 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
6264 # Delete the old output files.
6265 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
6267 func_show_eval "$link_command" 'exit $?'
6269 # Now create the wrapper script.
6270 func_echo "creating $output"
6272 # Quote the relink command for shipping.
6273 if test -n "$relink_command"; then
6274 # Preserve any variables that may affect compiler behavior
6275 for var in $variables_saved_for_relink; do
6276 if eval test -z \"\${$var+set}\"; then
6277 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
6278 elif eval var_value=\$$var; test -z "$var_value"; then
6279 relink_command="$var=; export $var; $relink_command"
6280 else
6281 func_quote_for_eval "$var_value"
6282 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6284 done
6285 relink_command="(cd `pwd`; $relink_command)"
6286 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6289 # Quote $ECHO for shipping.
6290 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
6291 case $progpath in
6292 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
6293 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
6294 esac
6295 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
6296 else
6297 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
6300 # Only actually do things if not in dry run mode.
6301 $opt_dry_run || {
6302 # win32 will think the script is a binary if it has
6303 # a .exe suffix, so we strip it off here.
6304 case $output in
6305 *.exe) func_stripname '' '.exe' "$output"
6306 output=$func_stripname_result ;;
6307 esac
6308 # test for cygwin because mv fails w/o .exe extensions
6309 case $host in
6310 *cygwin*)
6311 exeext=.exe
6312 func_stripname '' '.exe' "$outputname"
6313 outputname=$func_stripname_result ;;
6314 *) exeext= ;;
6315 esac
6316 case $host in
6317 *cygwin* | *mingw* )
6318 output_name=`basename $output`
6319 output_path=`dirname $output`
6320 cwrappersource="$output_path/$objdir/lt-$output_name.c"
6321 cwrapper="$output_path/$output_name.exe"
6322 $RM $cwrappersource $cwrapper
6323 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
6325 cat > $cwrappersource <<EOF
6327 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6328 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6330 The $output program cannot be directly executed until all the libtool
6331 libraries that it depends on are installed.
6333 This wrapper executable should never be moved out of the build directory.
6334 If it is, it will not operate correctly.
6336 Currently, it simply execs the wrapper *script* "/bin/sh $output",
6337 but could eventually absorb all of the scripts functionality and
6338 exec $objdir/$outputname directly.
6341 cat >> $cwrappersource<<"EOF"
6342 #include <stdio.h>
6343 #include <stdlib.h>
6344 #include <unistd.h>
6345 #include <malloc.h>
6346 #include <stdarg.h>
6347 #include <assert.h>
6348 #include <string.h>
6349 #include <ctype.h>
6350 #include <sys/stat.h>
6352 #if defined(PATH_MAX)
6353 # define LT_PATHMAX PATH_MAX
6354 #elif defined(MAXPATHLEN)
6355 # define LT_PATHMAX MAXPATHLEN
6356 #else
6357 # define LT_PATHMAX 1024
6358 #endif
6360 #ifndef DIR_SEPARATOR
6361 # define DIR_SEPARATOR '/'
6362 # define PATH_SEPARATOR ':'
6363 #endif
6365 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
6366 defined (__OS2__)
6367 # define HAVE_DOS_BASED_FILE_SYSTEM
6368 # ifndef DIR_SEPARATOR_2
6369 # define DIR_SEPARATOR_2 '\\'
6370 # endif
6371 # ifndef PATH_SEPARATOR_2
6372 # define PATH_SEPARATOR_2 ';'
6373 # endif
6374 #endif
6376 #ifndef DIR_SEPARATOR_2
6377 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6378 #else /* DIR_SEPARATOR_2 */
6379 # define IS_DIR_SEPARATOR(ch) \
6380 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6381 #endif /* DIR_SEPARATOR_2 */
6383 #ifndef PATH_SEPARATOR_2
6384 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6385 #else /* PATH_SEPARATOR_2 */
6386 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6387 #endif /* PATH_SEPARATOR_2 */
6389 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6390 #define XFREE(stale) do { \
6391 if (stale) { free ((void *) stale); stale = 0; } \
6392 } while (0)
6394 /* -DDEBUG is fairly common in CFLAGS. */
6395 #undef DEBUG
6396 #if defined DEBUGWRAPPER
6397 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
6398 #else
6399 # define DEBUG(format, ...)
6400 #endif
6402 const char *program_name = NULL;
6404 void * xmalloc (size_t num);
6405 char * xstrdup (const char *string);
6406 const char * base_name (const char *name);
6407 char * find_executable(const char *wrapper);
6408 int check_executable(const char *path);
6409 char * strendzap(char *str, const char *pat);
6410 void lt_fatal (const char *message, ...);
6413 main (int argc, char *argv[])
6415 char **newargz;
6416 int i;
6418 program_name = (char *) xstrdup (base_name (argv[0]));
6419 DEBUG("(main) argv[0] : %s\n",argv[0]);
6420 DEBUG("(main) program_name : %s\n",program_name);
6421 newargz = XMALLOC(char *, argc+2);
6424 cat >> $cwrappersource <<EOF
6425 newargz[0] = (char *) xstrdup("$SHELL");
6428 cat >> $cwrappersource <<"EOF"
6429 newargz[1] = find_executable(argv[0]);
6430 if (newargz[1] == NULL)
6431 lt_fatal("Couldn't find %s", argv[0]);
6432 DEBUG("(main) found exe at : %s\n",newargz[1]);
6433 /* we know the script has the same name, without the .exe */
6434 /* so make sure newargz[1] doesn't end in .exe */
6435 strendzap(newargz[1],".exe");
6436 for (i = 1; i < argc; i++)
6437 newargz[i+1] = xstrdup(argv[i]);
6438 newargz[argc+1] = NULL;
6440 for (i=0; i<argc+1; i++)
6442 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
6448 case $host_os in
6449 mingw*)
6450 cat >> $cwrappersource <<EOF
6451 execv("$SHELL",(char const **)newargz);
6455 cat >> $cwrappersource <<EOF
6456 execv("$SHELL",newargz);
6459 esac
6461 cat >> $cwrappersource <<"EOF"
6462 return 127;
6465 void *
6466 xmalloc (size_t num)
6468 void * p = (void *) malloc (num);
6469 if (!p)
6470 lt_fatal ("Memory exhausted");
6472 return p;
6475 char *
6476 xstrdup (const char *string)
6478 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
6482 const char *
6483 base_name (const char *name)
6485 const char *base;
6487 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6488 /* Skip over the disk name in MSDOS pathnames. */
6489 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
6490 name += 2;
6491 #endif
6493 for (base = name; *name; name++)
6494 if (IS_DIR_SEPARATOR (*name))
6495 base = name + 1;
6496 return base;
6500 check_executable(const char * path)
6502 struct stat st;
6504 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
6505 if ((!path) || (!*path))
6506 return 0;
6508 if ((stat (path, &st) >= 0) &&
6510 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
6511 #if defined (S_IXOTH)
6512 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
6513 #endif
6514 #if defined (S_IXGRP)
6515 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
6516 #endif
6517 ((st.st_mode & S_IXUSR) == S_IXUSR))
6519 return 1;
6520 else
6521 return 0;
6524 /* Searches for the full path of the wrapper. Returns
6525 newly allocated full path name if found, NULL otherwise */
6526 char *
6527 find_executable (const char* wrapper)
6529 int has_slash = 0;
6530 const char* p;
6531 const char* p_next;
6532 /* static buffer for getcwd */
6533 char tmp[LT_PATHMAX + 1];
6534 int tmp_len;
6535 char* concat_name;
6537 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
6539 if ((wrapper == NULL) || (*wrapper == '\0'))
6540 return NULL;
6542 /* Absolute path? */
6543 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6544 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
6546 concat_name = xstrdup (wrapper);
6547 if (check_executable(concat_name))
6548 return concat_name;
6549 XFREE(concat_name);
6551 else
6553 #endif
6554 if (IS_DIR_SEPARATOR (wrapper[0]))
6556 concat_name = xstrdup (wrapper);
6557 if (check_executable(concat_name))
6558 return concat_name;
6559 XFREE(concat_name);
6561 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6563 #endif
6565 for (p = wrapper; *p; p++)
6566 if (*p == '/')
6568 has_slash = 1;
6569 break;
6571 if (!has_slash)
6573 /* no slashes; search PATH */
6574 const char* path = getenv ("PATH");
6575 if (path != NULL)
6577 for (p = path; *p; p = p_next)
6579 const char* q;
6580 size_t p_len;
6581 for (q = p; *q; q++)
6582 if (IS_PATH_SEPARATOR(*q))
6583 break;
6584 p_len = q - p;
6585 p_next = (*q == '\0' ? q : q + 1);
6586 if (p_len == 0)
6588 /* empty path: current directory */
6589 if (getcwd (tmp, LT_PATHMAX) == NULL)
6590 lt_fatal ("getcwd failed");
6591 tmp_len = strlen(tmp);
6592 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6593 memcpy (concat_name, tmp, tmp_len);
6594 concat_name[tmp_len] = '/';
6595 strcpy (concat_name + tmp_len + 1, wrapper);
6597 else
6599 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
6600 memcpy (concat_name, p, p_len);
6601 concat_name[p_len] = '/';
6602 strcpy (concat_name + p_len + 1, wrapper);
6604 if (check_executable(concat_name))
6605 return concat_name;
6606 XFREE(concat_name);
6609 /* not found in PATH; assume curdir */
6611 /* Relative path | not found in path: prepend cwd */
6612 if (getcwd (tmp, LT_PATHMAX) == NULL)
6613 lt_fatal ("getcwd failed");
6614 tmp_len = strlen(tmp);
6615 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6616 memcpy (concat_name, tmp, tmp_len);
6617 concat_name[tmp_len] = '/';
6618 strcpy (concat_name + tmp_len + 1, wrapper);
6620 if (check_executable(concat_name))
6621 return concat_name;
6622 XFREE(concat_name);
6623 return NULL;
6626 char *
6627 strendzap(char *str, const char *pat)
6629 size_t len, patlen;
6631 assert(str != NULL);
6632 assert(pat != NULL);
6634 len = strlen(str);
6635 patlen = strlen(pat);
6637 if (patlen <= len)
6639 str += len - patlen;
6640 if (strcmp(str, pat) == 0)
6641 *str = '\0';
6643 return str;
6646 static void
6647 lt_error_core (int exit_status, const char * mode,
6648 const char * message, va_list ap)
6650 fprintf (stderr, "%s: %s: ", program_name, mode);
6651 vfprintf (stderr, message, ap);
6652 fprintf (stderr, ".\n");
6654 if (exit_status >= 0)
6655 exit (exit_status);
6658 void
6659 lt_fatal (const char *message, ...)
6661 va_list ap;
6662 va_start (ap, message);
6663 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
6664 va_end (ap);
6667 # we should really use a build-platform specific compiler
6668 # here, but OTOH, the wrappers (shell script and this C one)
6669 # are only useful if you want to execute the "real" binary.
6670 # Since the "real" binary is built for $host, then this
6671 # wrapper might as well be built for $host, too.
6672 $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
6674 esac
6675 $RM $output
6676 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
6678 $ECHO > $output "\
6679 #! $SHELL
6681 # $output - temporary wrapper script for $objdir/$outputname
6682 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6684 # The $output program cannot be directly executed until all the libtool
6685 # libraries that it depends on are installed.
6687 # This wrapper script should never be moved out of the build directory.
6688 # If it is, it will not operate correctly.
6690 # Sed substitution that helps us do robust quoting. It backslashifies
6691 # metacharacters that are still active within double-quoted strings.
6692 Xsed='${SED} -e 1s/^X//'
6693 sed_quote_subst='$sed_quote_subst'
6695 # Be Bourne compatible
6696 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
6697 emulate sh
6698 NULLCMD=:
6699 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
6700 # is contrary to our usage. Disable this feature.
6701 alias -g '\${1+\"\$@\"}'='\"\$@\"'
6702 setopt NO_GLOB_SUBST
6703 else
6704 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
6706 BIN_SH=xpg4; export BIN_SH # for Tru64
6707 DUALCASE=1; export DUALCASE # for MKS sh
6709 # The HP-UX ksh and POSIX shell print the target directory to stdout
6710 # if CDPATH is set.
6711 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
6713 relink_command=\"$relink_command\"
6715 # This environment variable determines our operation mode.
6716 if test \"\$libtool_install_magic\" = \"$magic\"; then
6717 # install mode needs the following variables:
6718 generated_by_libtool_version='$macro_version'
6719 notinst_deplibs='$notinst_deplibs'
6720 else
6721 # When we are sourced in execute mode, \$file and \$ECHO are already set.
6722 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6723 ECHO=\"$qecho\"
6724 file=\"\$0\"
6725 # Make sure echo works.
6726 if test \"X\$1\" = X--no-reexec; then
6727 # Discard the --no-reexec flag, and continue.
6728 shift
6729 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
6730 # Yippee, \$ECHO works!
6732 else
6733 # Restart under the correct shell, and then maybe \$ECHO will work.
6734 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
6738 $ECHO >> $output "\
6740 # Find the directory that this script lives in.
6741 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
6742 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
6744 # Follow symbolic links until we get to the real thisdir.
6745 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
6746 while test -n \"\$file\"; do
6747 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
6749 # If there was a directory component, then change thisdir.
6750 if test \"x\$destdir\" != \"x\$file\"; then
6751 case \"\$destdir\" in
6752 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
6753 *) thisdir=\"\$thisdir/\$destdir\" ;;
6754 esac
6757 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
6758 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
6759 done
6761 # Try to get the absolute directory name.
6762 absdir=\`cd \"\$thisdir\" && pwd\`
6763 test -n \"\$absdir\" && thisdir=\"\$absdir\"
6766 if test "$fast_install" = yes; then
6767 $ECHO >> $output "\
6768 program=lt-'$outputname'$exeext
6769 progdir=\"\$thisdir/$objdir\"
6771 if test ! -f \"\$progdir/\$program\" ||
6772 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
6773 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
6775 file=\"\$\$-\$program\"
6777 if test ! -d \"\$progdir\"; then
6778 $MKDIR \"\$progdir\"
6779 else
6780 $RM \"\$progdir/\$file\"
6783 $ECHO >> $output "\
6785 # relink executable if necessary
6786 if test -n \"\$relink_command\"; then
6787 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
6788 else
6789 $ECHO \"\$relink_command_output\" >&2
6790 $RM \"\$progdir/\$file\"
6791 exit 1
6795 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
6796 { $RM \"\$progdir/\$program\";
6797 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
6798 $RM \"\$progdir/\$file\"
6800 else
6801 $ECHO >> $output "\
6802 program='$outputname'
6803 progdir=\"\$thisdir/$objdir\"
6807 $ECHO >> $output "\
6809 if test -f \"\$progdir/\$program\"; then"
6811 # Export our shlibpath_var if we have one.
6812 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6813 $ECHO >> $output "\
6814 # Add our own library path to $shlibpath_var
6815 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6817 # Some systems cannot cope with colon-terminated $shlibpath_var
6818 # The second colon is a workaround for a bug in BeOS R4 sed
6819 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
6821 export $shlibpath_var
6825 # fixup the dll searchpath if we need to.
6826 if test -n "$dllsearchpath"; then
6827 $ECHO >> $output "\
6828 # Add the dll search path components to the executable PATH
6829 PATH=$dllsearchpath:\$PATH
6833 $ECHO >> $output "\
6834 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6835 # Run the actual program with our arguments.
6837 case $host in
6838 # Backslashes separate directories on plain windows
6839 *-*-mingw | *-*-os2*)
6840 $ECHO >> $output "\
6841 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
6846 $ECHO >> $output "\
6847 exec \"\$progdir/\$program\" \${1+\"\$@\"}
6850 esac
6851 $ECHO >> $output "\
6852 \$ECHO \"\$0: cannot exec \$program \$*\"
6853 exit 1
6855 else
6856 # The program doesn't exist.
6857 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
6858 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6859 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6860 exit 1
6864 chmod +x $output
6866 exit $EXIT_SUCCESS
6868 esac
6870 # See if we need to build an old-fashioned archive.
6871 for oldlib in $oldlibs; do
6873 if test "$build_libtool_libs" = convenience; then
6874 oldobjs="$libobjs_save $symfileobj"
6875 addlibs="$convenience"
6876 build_libtool_libs=no
6877 else
6878 if test "$build_libtool_libs" = module; then
6879 oldobjs="$libobjs_save"
6880 build_libtool_libs=no
6881 else
6882 oldobjs="$old_deplibs $non_pic_objects"
6883 if test "$preload" = yes && test -f "$symfileobj"; then
6884 oldobjs="$oldobjs $symfileobj"
6887 addlibs="$old_convenience"
6890 if test -n "$addlibs"; then
6891 gentop="$output_objdir/${outputname}x"
6892 generated="$generated $gentop"
6894 func_extract_archives $gentop $addlibs
6895 oldobjs="$oldobjs $func_extract_archives_result"
6898 # Do each command in the archive commands.
6899 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
6900 cmds=$old_archive_from_new_cmds
6901 else
6903 # Add any objects from preloaded convenience libraries
6904 if test -n "$dlprefiles"; then
6905 gentop="$output_objdir/${outputname}x"
6906 generated="$generated $gentop"
6908 func_extract_archives $gentop $dlprefiles
6909 oldobjs="$oldobjs $func_extract_archives_result"
6912 # POSIX demands no paths to be encoded in archives. We have
6913 # to avoid creating archives with duplicate basenames if we
6914 # might have to extract them afterwards, e.g., when creating a
6915 # static archive out of a convenience library, or when linking
6916 # the entirety of a libtool archive into another (currently
6917 # not supported by libtool).
6918 if (for obj in $oldobjs
6920 func_basename "$obj"
6921 $ECHO "$func_basename_result"
6922 done | sort | sort -uc >/dev/null 2>&1); then
6924 else
6925 $ECHO "copying selected object files to avoid basename conflicts..."
6926 gentop="$output_objdir/${outputname}x"
6927 generated="$generated $gentop"
6928 func_mkdir_p "$gentop"
6929 save_oldobjs=$oldobjs
6930 oldobjs=
6931 counter=1
6932 for obj in $save_oldobjs
6934 func_basename "$obj"
6935 objbase="$func_basename_result"
6936 case " $oldobjs " in
6937 " ") oldobjs=$obj ;;
6938 *[\ /]"$objbase "*)
6939 while :; do
6940 # Make sure we don't pick an alternate name that also
6941 # overlaps.
6942 newobj=lt$counter-$objbase
6943 counter=`expr $counter + 1`
6944 case " $oldobjs " in
6945 *[\ /]"$newobj "*) ;;
6946 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
6947 esac
6948 done
6949 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
6950 oldobjs="$oldobjs $gentop/$newobj"
6952 *) oldobjs="$oldobjs $obj" ;;
6953 esac
6954 done
6956 eval cmds=\"$old_archive_cmds\"
6958 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
6959 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6960 cmds=$old_archive_cmds
6961 else
6962 # the command line is too long to link in one step, link in parts
6963 func_echo "using piecewise archive linking..."
6964 save_RANLIB=$RANLIB
6965 RANLIB=:
6966 objlist=
6967 concat_cmds=
6968 save_oldobjs=$oldobjs
6969 # Is there a better way of finding the last object in the list?
6970 for obj in $save_oldobjs
6972 last_oldobj=$obj
6973 done
6974 for obj in $save_oldobjs
6976 oldobjs="$objlist $obj"
6977 objlist="$objlist $obj"
6978 eval test_cmds=\"$old_archive_cmds\"
6979 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6980 test "$len" -le "$max_cmd_len"; then
6982 else
6983 # the above command should be used before it gets too long
6984 oldobjs=$objlist
6985 if test "$obj" = "$last_oldobj" ; then
6986 RANLIB=$save_RANLIB
6988 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6989 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
6990 objlist=
6992 done
6993 RANLIB=$save_RANLIB
6994 oldobjs=$objlist
6995 if test "X$oldobjs" = "X" ; then
6996 eval cmds=\"\$concat_cmds\"
6997 else
6998 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
7002 func_execute_cmds "$cmds" 'exit $?'
7003 done
7005 test -n "$generated" && \
7006 func_show_eval "${RM}r$generated"
7008 # Now create the libtool archive.
7009 case $output in
7010 *.la)
7011 old_library=
7012 test "$build_old_libs" = yes && old_library="$libname.$libext"
7013 func_echo "creating $output"
7015 # Preserve any variables that may affect compiler behavior
7016 for var in $variables_saved_for_relink; do
7017 if eval test -z \"\${$var+set}\"; then
7018 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
7019 elif eval var_value=\$$var; test -z "$var_value"; then
7020 relink_command="$var=; export $var; $relink_command"
7021 else
7022 func_quote_for_eval "$var_value"
7023 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
7025 done
7026 # Quote the link command for shipping.
7027 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
7028 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
7029 if test "$hardcode_automatic" = yes ; then
7030 relink_command=
7033 # Only create the output if not a dry run.
7034 $opt_dry_run || {
7035 for installed in no yes; do
7036 if test "$installed" = yes; then
7037 if test -z "$install_libdir"; then
7038 break
7040 output="$output_objdir/$outputname"i
7041 # Replace all uninstalled libtool libraries with the installed ones
7042 newdependency_libs=
7043 for deplib in $dependency_libs; do
7044 case $deplib in
7045 *.la)
7046 func_basename "$deplib"
7047 name="$func_basename_result"
7048 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7049 test -z "$libdir" && \
7050 func_fatal_error "\`$deplib' is not a valid libtool archive"
7051 newdependency_libs="$newdependency_libs $libdir/$name"
7053 *) newdependency_libs="$newdependency_libs $deplib" ;;
7054 esac
7055 done
7056 dependency_libs="$newdependency_libs"
7057 newdlfiles=
7059 for lib in $dlfiles; do
7060 case $lib in
7061 *.la)
7062 func_basename "$lib"
7063 name="$func_basename_result"
7064 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7065 test -z "$libdir" && \
7066 func_fatal_error "\`$lib' is not a valid libtool archive"
7067 newdlfiles="$newdlfiles $libdir/$name"
7069 *) newdlfiles="$newdlfiles $lib" ;;
7070 esac
7071 done
7072 dlfiles="$newdlfiles"
7073 newdlprefiles=
7074 for lib in $dlprefiles; do
7075 case $lib in
7076 *.la)
7077 # Only pass preopened files to the pseudo-archive (for
7078 # eventual linking with the app. that links it) if we
7079 # didn't already link the preopened objects directly into
7080 # the library:
7081 func_basename "$lib"
7082 name="$func_basename_result"
7083 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7084 test -z "$libdir" && \
7085 func_fatal_error "\`$lib' is not a valid libtool archive"
7086 newdlprefiles="$newdlprefiles $libdir/$name"
7088 esac
7089 done
7090 dlprefiles="$newdlprefiles"
7091 else
7092 newdlfiles=
7093 for lib in $dlfiles; do
7094 case $lib in
7095 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7096 *) abs=`pwd`"/$lib" ;;
7097 esac
7098 newdlfiles="$newdlfiles $abs"
7099 done
7100 dlfiles="$newdlfiles"
7101 newdlprefiles=
7102 for lib in $dlprefiles; do
7103 case $lib in
7104 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7105 *) abs=`pwd`"/$lib" ;;
7106 esac
7107 newdlprefiles="$newdlprefiles $abs"
7108 done
7109 dlprefiles="$newdlprefiles"
7111 $RM $output
7112 # place dlname in correct position for cygwin
7113 tdlname=$dlname
7114 case $host,$output,$installed,$module,$dlname in
7115 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7116 esac
7117 $ECHO > $output "\
7118 # $outputname - a libtool library file
7119 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7121 # Please DO NOT delete this file!
7122 # It is necessary for linking the library.
7124 # The name that we can dlopen(3).
7125 dlname='$tdlname'
7127 # Names of this library.
7128 library_names='$library_names'
7130 # The name of the static archive.
7131 old_library='$old_library'
7133 # Linker flags that can not go in dependency_libs.
7134 inherited_linker_flags='$new_inherited_linker_flags'
7136 # Libraries that this one depends upon.
7137 dependency_libs='$dependency_libs'
7139 # Names of additional weak libraries provided by this library
7140 weak_library_names='$weak_libs'
7142 # Version information for $libname.
7143 current=$current
7144 age=$age
7145 revision=$revision
7147 # Is this an already installed library?
7148 installed=$installed
7150 # Should we warn about portability when linking against -modules?
7151 shouldnotlink=$module
7153 # Files to dlopen/dlpreopen
7154 dlopen='$dlfiles'
7155 dlpreopen='$dlprefiles'
7157 # Directory that this library needs to be installed in:
7158 libdir='$install_libdir'"
7159 if test "$installed" = no && test "$need_relink" = yes; then
7160 $ECHO >> $output "\
7161 relink_command=\"$relink_command\""
7163 done
7166 # Do a symbolic link so that the libtool archive can be found in
7167 # LD_LIBRARY_PATH before the program is installed.
7168 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7170 esac
7171 exit $EXIT_SUCCESS
7174 { test "$mode" = link || test "$mode" = relink; } &&
7175 func_mode_link ${1+"$@"}
7178 # func_mode_uninstall arg...
7179 func_mode_uninstall ()
7181 $opt_debug
7182 RM="$nonopt"
7183 files=
7184 rmforce=
7185 exit_status=0
7187 # This variable tells wrapper scripts just to set variables rather
7188 # than running their programs.
7189 libtool_install_magic="$magic"
7191 for arg
7193 case $arg in
7194 -f) RM="$RM $arg"; rmforce=yes ;;
7195 -*) RM="$RM $arg" ;;
7196 *) files="$files $arg" ;;
7197 esac
7198 done
7200 test -z "$RM" && \
7201 func_fatal_help "you must specify an RM program"
7203 rmdirs=
7205 origobjdir="$objdir"
7206 for file in $files; do
7207 func_dirname "$file" "" "."
7208 dir="$func_dirname_result"
7209 if test "X$dir" = X.; then
7210 objdir="$origobjdir"
7211 else
7212 objdir="$dir/$origobjdir"
7214 func_basename "$file"
7215 name="$func_basename_result"
7216 test "$mode" = uninstall && objdir="$dir"
7218 # Remember objdir for removal later, being careful to avoid duplicates
7219 if test "$mode" = clean; then
7220 case " $rmdirs " in
7221 *" $objdir "*) ;;
7222 *) rmdirs="$rmdirs $objdir" ;;
7223 esac
7226 # Don't error if the file doesn't exist and rm -f was used.
7227 if { test -L "$file"; } >/dev/null 2>&1 ||
7228 { test -h "$file"; } >/dev/null 2>&1 ||
7229 test -f "$file"; then
7231 elif test -d "$file"; then
7232 exit_status=1
7233 continue
7234 elif test "$rmforce" = yes; then
7235 continue
7238 rmfiles="$file"
7240 case $name in
7241 *.la)
7242 # Possibly a libtool archive, so verify it.
7243 if func_lalib_p "$file"; then
7244 func_source $dir/$name
7246 # Delete the libtool libraries and symlinks.
7247 for n in $library_names; do
7248 rmfiles="$rmfiles $objdir/$n"
7249 done
7250 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7252 case "$mode" in
7253 clean)
7254 case " $library_names " in
7255 # " " in the beginning catches empty $dlname
7256 *" $dlname "*) ;;
7257 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7258 esac
7259 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7261 uninstall)
7262 if test -n "$library_names"; then
7263 # Do each command in the postuninstall commands.
7264 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7267 if test -n "$old_library"; then
7268 # Do each command in the old_postuninstall commands.
7269 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7271 # FIXME: should reinstall the best remaining shared library.
7273 esac
7277 *.lo)
7278 # Possibly a libtool object, so verify it.
7279 if func_lalib_p "$file"; then
7281 # Read the .lo file
7282 func_source $dir/$name
7284 # Add PIC object to the list of files to remove.
7285 if test -n "$pic_object" &&
7286 test "$pic_object" != none; then
7287 rmfiles="$rmfiles $dir/$pic_object"
7290 # Add non-PIC object to the list of files to remove.
7291 if test -n "$non_pic_object" &&
7292 test "$non_pic_object" != none; then
7293 rmfiles="$rmfiles $dir/$non_pic_object"
7299 if test "$mode" = clean ; then
7300 noexename=$name
7301 case $file in
7302 *.exe)
7303 func_stripname '' '.exe' "$file"
7304 file=$func_stripname_result
7305 func_stripname '' '.exe' "$name"
7306 noexename=$func_stripname_result
7307 # $file with .exe has already been added to rmfiles,
7308 # add $file without .exe
7309 rmfiles="$rmfiles $file"
7311 esac
7312 # Do a test to see if this is a libtool program.
7313 if func_ltwrapper_p "$file"; then
7314 relink_command=
7315 func_source $dir/$noexename
7317 # note $name still contains .exe if it was in $file originally
7318 # as does the version of $file that was added into $rmfiles
7319 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7320 if test "$fast_install" = yes && test -n "$relink_command"; then
7321 rmfiles="$rmfiles $objdir/lt-$name"
7323 if test "X$noexename" != "X$name" ; then
7324 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7329 esac
7330 func_show_eval "$RM $rmfiles" 'exit_status=1'
7331 done
7332 objdir="$origobjdir"
7334 # Try to remove the ${objdir}s in the directories where we deleted files
7335 for dir in $rmdirs; do
7336 if test -d "$dir"; then
7337 func_show_eval "rmdir $dir >/dev/null 2>&1"
7339 done
7341 exit $exit_status
7344 { test "$mode" = uninstall || test "$mode" = clean; } &&
7345 func_mode_uninstall ${1+"$@"}
7347 test -z "$mode" && {
7348 help="$generic_help"
7349 func_fatal_help "you must specify a MODE"
7352 test -z "$exec_cmd" && \
7353 func_fatal_help "invalid operation mode \`$mode'"
7355 if test -n "$exec_cmd"; then
7356 eval exec "$exec_cmd"
7357 exit $EXIT_FAILURE
7360 exit $exit_status
7363 # The TAGs below are defined such that we never get into a situation
7364 # in which we disable both kinds of libraries. Given conflicting
7365 # choices, we go for a static library, that is the most portable,
7366 # since we can't tell whether shared libraries were disabled because
7367 # the user asked for that or because the platform doesn't support
7368 # them. This is particularly important on AIX, because we don't
7369 # support having both static and shared libraries enabled at the same
7370 # time on that platform, so we default to a shared-only configuration.
7371 # If a disable-shared tag is given, we'll fallback to a static-only
7372 # configuration. But we'll never go from static-only to shared-only.
7374 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7375 build_libtool_libs=no
7376 build_old_libs=yes
7377 # ### END LIBTOOL TAG CONFIG: disable-shared
7379 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7380 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7381 # ### END LIBTOOL TAG CONFIG: disable-static
7383 # Local Variables:
7384 # mode:shell-script
7385 # sh-indentation:2
7386 # End:
7387 # vi:sw=2