Import code from my Subversion repository
[black_box_cellml.git] / ltmain.sh
blob1005b64ca800b5a8c051e4287533748f9f1874b7
1 # Generated from ltmain.m4sh; do not edit by hand
3 # ltmain.sh (GNU libtool 1.2317 2006/08/07 16:25:08) 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
7 # Free Software Foundation, Inc.
8 # This is free software; see the source for copying conditions. There is NO
9 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 # As a special exception to the GNU General Public License, if you
26 # distribute this file as part of a program that contains a
27 # configuration script generated by Autoconf, you may include it under
28 # the same distribution terms that you use for the rest of that program.
30 # Usage: $progname [OPTION]... [MODE-ARG]...
32 # Provide generalized library-building support services.
34 # --config show all configuration variables
35 # --debug enable verbose shell tracing
36 # -n, --dry-run display commands without modifying any files
37 # --features display basic configuration information and exit
38 # --mode=MODE use operation mode MODE
39 # --preserve-dup-deps don't remove duplicate dependency libraries
40 # --quiet, --silent don't print informational messages
41 # --tag=TAG use configuration variables from tag TAG
42 # -v, --verbose print informational messages (default)
43 # --version print version information
44 # -h, --help print short or long help message
46 # MODE must be one of the following:
48 # clean remove files from the build directory
49 # compile compile a source file into a libtool object
50 # execute automatically set library path, then run a program
51 # finish complete the installation of libtool libraries
52 # install install libraries or executables
53 # link create a library or an executable
54 # uninstall remove libraries from an installed directory
56 # MODE-ARGS vary depending on the MODE.
57 # Try `$progname --help --mode=MODE' for a more detailed description of MODE.
59 # When reporting a bug, please describe a test case to reproduce it and
60 # include the following information:
62 # host-triplet: $host
63 # shell: $SHELL
64 # compiler: $LTCC
65 # compiler flags: $LTCFLAGS
66 # linker: $LD (gnu? $with_gnu_ld)
67 # $progname: (GNU libtool 1.2317 2006/08/07 16:25:08) 2.1a
68 # automake: $automake_version
69 # autoconf: $autoconf_version
71 # Report bugs to <bug-libtool@gnu.org>.
73 PROGRAM=ltmain.sh
74 PACKAGE=libtool
75 VERSION=2.1a
76 TIMESTAMP=" 1.2317 2006/08/07 16:25:08"
77 package_revision=1.2317
79 # Be Bourne compatible
80 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
81 emulate sh
82 NULLCMD=:
83 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
84 # is contrary to our usage. Disable this feature.
85 alias -g '${1+"$@"}'='"$@"'
86 setopt NO_GLOB_SUBST
87 else
88 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
90 BIN_SH=xpg4; export BIN_SH # for Tru64
91 DUALCASE=1; export DUALCASE # for MKS sh
93 # NLS nuisances: We save the old values to restore during execute mode.
94 # Only set LANG and LC_ALL to C if already set.
95 # These must not be set unconditionally because not all systems understand
96 # e.g. LANG=C (notably SCO).
97 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
99 eval "if test \"\${$lt_var+set}\" = set; then
100 save_$lt_var=\$$lt_var
101 $lt_var=C
102 export $lt_var
104 done
106 $lt_unset CDPATH
110 : ${CP="cp -f"}
111 : ${ECHO="echo"}
112 : ${EGREP="grep -E"}
113 : ${FGREP="grep -F"}
114 : ${GREP="grep"}
115 : ${LN_S="ln -s"}
116 : ${MAKE="make"}
117 : ${MKDIR="mkdir"}
118 : ${MV="mv -f"}
119 : ${RM="rm -f"}
120 : ${SED="/usr/bin/sed"}
121 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
122 : ${Xsed="$SED -e 1s/^X//"}
124 # Global variables:
125 EXIT_SUCCESS=0
126 EXIT_FAILURE=1
127 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
128 EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
130 exit_status=$EXIT_SUCCESS
132 # Make sure IFS has a sensible default
133 lt_nl='
135 IFS=" $lt_nl"
137 dirname="s,/[^/]*$,,"
138 basename="s,^.*/,,"
140 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
141 # is ksh but when the shell is invoked as "sh" and the current value of
142 # the _XPG environment variable is not equal to 1 (one), the special
143 # positional parameter $0, within a function call, is the name of the
144 # function.
145 progpath="$0"
147 # The name of this program:
148 # In the unlikely event $progname began with a '-', it would play havoc with
149 # func_echo (imagine progname=-n), so we prepend ./ in that case:
150 progname=`$ECHO "X$progpath" | $Xsed -e "$basename" -e 's,^-,./-,'`
152 # Make sure we have an absolute path for reexecution:
153 case $progpath in
154 [\\/]*|[A-Za-z]:\\*) ;;
155 *[\\/]*)
156 progdir=`$ECHO "X$progpath" | $Xsed -e "$dirname"`
157 progdir=`cd "$progdir" && pwd`
158 progpath="$progdir/$progname"
161 save_IFS="$IFS"
162 IFS=:
163 for progdir in $PATH; do
164 IFS="$save_IFS"
165 test -x "$progdir/$progname" && break
166 done
167 IFS="$save_IFS"
168 test -n "$progdir" || progdir=`pwd`
169 progpath="$progdir/$progname"
171 esac
173 # Sed substitution that helps us do robust quoting. It backslashifies
174 # metacharacters that are still active within double-quoted strings.
175 Xsed="${SED}"' -e 1s/^X//'
176 sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
178 # Same as above, but do not quote variable references.
179 double_quote_subst='s/\(["`\\]\)/\\\1/g'
181 # Re-`\' parameter expansions in output of double_quote_subst that were
182 # `\'-ed in input to the same. If an odd number of `\' preceded a '$'
183 # in input to double_quote_subst, that '$' was protected from expansion.
184 # Since each input `\' is now two `\'s, look for any number of runs of
185 # four `\'s followed by two `\'s and then a '$'. `\' that '$'. Note
186 # that the embedded single quotes serve only to enhance readability.
187 sed_double_backslash='s/^\(\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/;
188 s/\([^\\]\(''\\\\''\\\\''\)*''\\\\''\)\$/\1\\$/g'
190 # Standard options:
191 opt_dry_run=false
192 opt_help=false
193 opt_quiet=false
194 opt_verbose=false
196 # func_echo arg...
197 # Echo program name prefixed message, along with the current mode
198 # name if it has been set yet.
199 func_echo ()
201 $ECHO "$progname${mode+: }$mode: "${1+"$@"}
204 # func_verbose arg...
205 # Echo program name prefixed message in verbose mode only.
206 func_verbose ()
208 $opt_verbose && func_echo ${1+"$@"}
210 # A bug in bash halts the script if the last line of a function
211 # fails when set -e is in force, so we need another command to
212 # work around that:
216 # func_error arg...
217 # Echo program name prefixed message to standard error.
218 func_error ()
220 $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
223 # func_warning arg...
224 # Echo program name prefixed warning message to standard error.
225 func_warning ()
227 $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
230 # func_fatal_error arg...
231 # Echo program name prefixed message to standard error, and exit.
232 func_fatal_error ()
234 func_error ${1+"$@"}
235 exit $EXIT_FAILURE
238 # func_fatal_help arg...
239 # Echo program name prefixed message to standard error, followed by
240 # a help hint, and exit.
241 func_fatal_help ()
243 func_error ${1+"$@"}
244 func_fatal_error "$help"
246 help="Try \`$progname --help' for more information." ## default
249 # func_grep expression filename
250 # Check whether EXPRESSION matches any line of FILENAME, without output.
251 func_grep ()
253 $GREP "$1" "$2" >/dev/null 2>&1
257 # func_mkdir_p directory-path
258 # Make sure the entire path to DIRECTORY-PATH is available.
259 func_mkdir_p ()
261 my_directory_path="$1"
262 my_dir_list=
264 if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
266 # Protect directory names starting with `-'
267 case $my_directory_path in
268 -*) my_directory_path="./$my_directory_path" ;;
269 esac
271 # While some portion of DIR does not yet exist...
272 while test ! -d "$my_directory_path"; do
273 # ...make a list in topmost first order. Use a colon delimited
274 # list incase some portion of path contains whitespace.
275 my_dir_list="$my_directory_path:$my_dir_list"
277 # If the last portion added has no slash in it, the list is done
278 case $my_directory_path in */*) ;; *) break ;; esac
280 # ...otherwise throw away the child directory and loop
281 my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
282 done
283 my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
285 save_mkdir_p_IFS="$IFS"; IFS=':'
286 for my_dir in $my_dir_list; do
287 IFS="$save_mkdir_p_IFS"
288 # mkdir can fail with a `File exist' error if two processes
289 # try to create one of the directories concurrently. Don't
290 # stop in that case!
291 $MKDIR "$my_dir" 2>/dev/null || :
292 done
293 IFS="$save_mkdir_p_IFS"
295 # Bail out if we (or some other process) failed to create a directory.
296 test -d "$my_directory_path" || \
297 func_fatal_error "Failed to create \`$1'"
302 # func_mktempdir [string]
303 # Make a temporary directory that won't clash with other running
304 # libtool processes, and avoids race conditions if possible. If
305 # given, STRING is the basename for that directory.
306 func_mktempdir ()
308 my_template="${TMPDIR-/tmp}/${1-$progname}"
310 if test "$opt_dry_run" = ":"; then
311 # Return a directory name, but don't create it in dry-run mode
312 my_tmpdir="${my_template}-$$"
313 else
315 # If mktemp works, use that first and foremost
316 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
318 if test ! -d "$my_tmpdir"; then
319 # Failing that, at least try and use $RANDOM to avoid a race
320 my_tmpdir="${my_template}-${RANDOM-0}$$"
322 save_mktempdir_umask=`umask`
323 umask 0077
324 $MKDIR "$my_tmpdir"
325 umask $save_mktempdir_umask
328 # If we're not in dry-run mode, bomb out on failure
329 test -d "$my_tmpdir" || \
330 func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
333 $ECHO "X$my_tmpdir" | $Xsed
337 # func_quote_for_eval arg
338 # Aesthetically quote ARG to be evaled later.
339 # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
340 # is double-quoted, suitable for a subsequent eval, whereas
341 # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
342 # which are still active within double quotes backslashified.
343 func_quote_for_eval ()
345 case $1 in
346 *[\\\`\"\$]*)
347 func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
349 func_quote_for_eval_unquoted_result="$1" ;;
350 esac
352 case $func_quote_for_eval_unquoted_result in
353 # Double-quote args containing shell metacharacters to delay
354 # word splitting, command substitution and and variable
355 # expansion for a subsequent eval.
356 # Many Bourne shells cannot handle close brackets correctly
357 # in scan sets, so we specify it separately.
358 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
359 func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
362 func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
363 esac
367 # func_quote_for_expand arg
368 # Aesthetically quote ARG to be evaled later; same as above,
369 # but do not quote variable references.
370 func_quote_for_expand ()
372 case $1 in
373 *[\\\`\"]*)
374 my_arg=`$ECHO "X$1" | $Xsed \
375 -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
377 my_arg="$1" ;;
378 esac
380 case $my_arg in
381 # Double-quote args containing shell metacharacters to delay
382 # word splitting and command substitution for a subsequent eval.
383 # Many Bourne shells cannot handle close brackets correctly
384 # in scan sets, so we specify it separately.
385 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
386 my_arg="\"$my_arg\""
388 esac
390 func_quote_for_expand_result="$my_arg"
394 # func_show_eval cmd [fail_exp]
395 # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
396 # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
397 # is given, then evaluate it.
398 func_show_eval ()
400 my_cmd="$1"
401 my_fail_exp="${2-:}"
403 ${opt_silent-false} || {
404 func_quote_for_expand "$my_cmd"
405 eval "func_echo $func_quote_for_expand_result"
408 if ${opt_dry_run-false}; then :; else
409 eval "$my_cmd"
410 my_status=$?
411 if test "$my_status" -eq 0; then :; else
412 eval "(exit $my_status); $my_fail_exp"
418 # func_version
419 # Echo version message to standard output and exit.
420 func_version ()
422 $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
423 s/^# //
424 s/^# *$//
425 s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
427 }' < "$progpath"
428 exit $?
431 # func_usage
432 # Echo short help message to standard output and exit.
433 func_usage ()
435 $SED -n '/^# Usage:/,/# -h/ {
436 s/^# //
437 s/^# *$//
438 s/\$progname/'$progname'/
440 }' < "$progpath"
441 $ECHO
442 $ECHO "run \`$progname --help | more' for full usage"
443 exit $?
446 # func_help
447 # Echo long help message to standard output and exit.
448 func_help ()
450 $SED -n '/^# Usage:/,/# Report bugs to/ {
451 s/^# //
452 s/^# *$//
453 s*\$progname*'$progname'*
454 s*\$host*'"$host"'*
455 s*\$SHELL*'"$SHELL"'*
456 s*\$LTCC*'"$LTCC"'*
457 s*\$LTCFLAGS*'"$LTCFLAGS"'*
458 s*\$LD*'"$LD"'*
459 s/\$with_gnu_ld/'"$with_gnu_ld"'/
460 s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
461 s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
463 }' < "$progpath"
464 exit $?
467 # func_missing_arg argname
468 # Echo program name prefixed message to standard error and set global
469 # exit_cmd.
470 func_missing_arg ()
472 func_error "missing argument for $1"
473 exit_cmd=exit
476 exit_cmd=:
479 # Check that we have a working $ECHO.
480 if test "X$1" = X--no-reexec; then
481 # Discard the --no-reexec flag, and continue.
482 shift
483 elif test "X$1" = X--fallback-echo; then
484 # Avoid inline document here, it may be left over
486 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
487 # Yippee, $ECHO works!
489 else
490 # Restart under the correct shell, and then maybe $ECHO will work.
491 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
494 if test "X$1" = X--fallback-echo; then
495 # used as fallback echo
496 shift
497 cat <<EOF
500 exit $EXIT_SUCCESS
503 magic="%%%MAGIC variable%%%"
506 # Global variables.
507 # $mode is unset
508 nonopt=
509 execute_dlfiles=
510 preserve_args=
511 lo2o="s/\\.lo\$/.${objext}/"
512 o2lo="s/\\.${objext}\$/.lo/"
513 extracted_archives=
514 extracted_serial=0
516 opt_dry_run=false
517 opt_duplicate_deps=false
518 opt_silent=false
519 opt_debug=:
521 # If this variable is set in any of the actions, the command in it
522 # will be execed at the end. This prevents here-documents from being
523 # left over by shells.
524 exec_cmd=
526 # func_fatal_configuration arg...
527 # Echo program name prefixed message to standard error, followed by
528 # a configuration failure hint, and exit.
529 func_fatal_configuration ()
531 func_error ${1+"$@"}
532 func_error "See the $PACKAGE documentation for more information."
533 func_fatal_error "Fatal configuration error."
537 # func_config
538 # Display the configuration for all the tags in this script.
539 func_config ()
541 re_begincf='^# ### BEGIN LIBTOOL'
542 re_endcf='^# ### END LIBTOOL'
544 # Default configuration.
545 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
547 # Now print the configurations for the tags.
548 for tagname in $taglist; do
549 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
550 done
552 exit $?
555 # func_features
556 # Display the features supported by this script.
557 func_features ()
559 $ECHO "host: $host"
560 if test "$build_libtool_libs" = yes; then
561 $ECHO "enable shared libraries"
562 else
563 $ECHO "disable shared libraries"
565 if test "$build_old_libs" = yes; then
566 $ECHO "enable static libraries"
567 else
568 $ECHO "disable static libraries"
571 exit $?
574 # func_enable_tag tagname
575 # Verify that TAGNAME is valid, and either flag an error and exit, or
576 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
577 # variable here.
578 func_enable_tag ()
580 # Global variable:
581 tagname="$1"
583 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
584 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
585 sed_extractcf="/$re_begincf/,/$re_endcf/p"
587 # Validate tagname.
588 case $tagname in
589 *[!-_A-Za-z0-9,/]*)
590 func_fatal_error "invalid tag name: $tagname"
592 esac
594 # Don't test for the "default" C tag, as we know it's
595 # there but not specially marked.
596 case $tagname in
597 CC) ;;
599 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
600 taglist="$taglist $tagname"
602 # Evaluate the configuration. Be careful to quote the path
603 # and the sed script, to avoid splitting on whitespace, but
604 # also don't use non-portable quotes within backquotes within
605 # quotes we have to do it in 2 steps:
606 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
607 eval "$extractedcf"
608 else
609 func_error "ignoring unknown tag $tagname"
612 esac
616 func_mode_help ()
618 # We need to display help for each of the modes.
619 case $mode in
621 # Generic help is extracted from the usage comments
622 # at the start of this file.
623 func_help
626 clean)
627 $ECHO \
628 "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
630 Remove files from the build directory.
632 RM is the name of the program to use to delete files associated with each FILE
633 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
634 to RM.
636 If FILE is a libtool library, object or program, all the files associated
637 with it are deleted. Otherwise, only FILE itself is deleted using RM."
640 compile)
641 $ECHO \
642 "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
644 Compile a source file into a libtool library object.
646 This mode accepts the following additional options:
648 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
649 -no-suppress do not suppress compiler output for multiple passes
650 -prefer-pic try to building PIC objects only
651 -prefer-non-pic try to building non-PIC objects only
652 -shared do not build a \`.o' file suitable for static linking
653 -static only build a \`.o' file suitable for static linking
655 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
656 from the given SOURCEFILE.
658 The output file name is determined by removing the directory component from
659 SOURCEFILE, then substituting the C source code suffix \`.c' with the
660 library object suffix, \`.lo'."
663 execute)
664 $ECHO \
665 "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
667 Automatically set library path, then run a program.
669 This mode accepts the following additional options:
671 -dlopen FILE add the directory containing FILE to the library path
673 This mode sets the library path environment variable according to \`-dlopen'
674 flags.
676 If any of the ARGS are libtool executable wrappers, then they are translated
677 into their corresponding uninstalled binary, and any of their required library
678 directories are added to the library path.
680 Then, COMMAND is executed, with ARGS as arguments."
683 finish)
684 $ECHO \
685 "Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
687 Complete the installation of libtool libraries.
689 Each LIBDIR is a directory that contains libtool libraries.
691 The commands that this mode executes may require superuser privileges. Use
692 the \`--dry-run' option if you just want to see what would be executed."
695 install)
696 $ECHO \
697 "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
699 Install executables or libraries.
701 INSTALL-COMMAND is the installation command. The first component should be
702 either the \`install' or \`cp' program.
704 The following components of INSTALL-COMMAND are treated specially:
706 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
708 The rest of the components are interpreted as arguments to that command (only
709 BSD-compatible install options are recognized)."
712 link)
713 $ECHO \
714 "Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
716 Link object files or libraries together to form another library, or to
717 create an executable program.
719 LINK-COMMAND is a command using the C compiler that you would use to create
720 a program from several object files.
722 The following components of LINK-COMMAND are treated specially:
724 -all-static do not do any dynamic linking at all
725 -avoid-version do not add a version suffix if possible
726 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
727 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
728 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
729 -export-symbols SYMFILE
730 try to export only the symbols listed in SYMFILE
731 -export-symbols-regex REGEX
732 try to export only the symbols matching REGEX
733 -LLIBDIR search LIBDIR for required installed libraries
734 -lNAME OUTPUT-FILE requires the installed library libNAME
735 -module build a library that can dlopened
736 -no-fast-install disable the fast-install mode
737 -no-install link a not-installable executable
738 -no-undefined declare that a library does not refer to external symbols
739 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
740 -objectlist FILE Use a list of object files found in FILE to specify objects
741 -precious-files-regex REGEX
742 don't remove output files matching REGEX
743 -release RELEASE specify package release information
744 -rpath LIBDIR the created library will eventually be installed in LIBDIR
745 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
746 -shared only do dynamic linking of libtool libraries
747 -shrext SUFFIX override the standard shared library file extension
748 -static do not do any dynamic linking of uninstalled libtool libraries
749 -static-libtool-libs
750 do not do any dynamic linking of libtool libraries
751 -version-info CURRENT[:REVISION[:AGE]]
752 specify library version info [each variable defaults to 0]
753 -weak LIBNAME declare that the target provides the LIBNAME interface
755 All other options (arguments beginning with \`-') are ignored.
757 Every other argument is treated as a filename. Files ending in \`.la' are
758 treated as uninstalled libtool libraries, other files are standard or library
759 object files.
761 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
762 only library objects (\`.lo' files) may be specified, and \`-rpath' is
763 required, except when creating a convenience library.
765 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
766 using \`ar' and \`ranlib', or on Windows using \`lib'.
768 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
769 is created, otherwise an executable program is created."
772 uninstall)
773 $ECHO \
774 "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
776 Remove libraries from an installation directory.
778 RM is the name of the program to use to delete files associated with each FILE
779 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
780 to RM.
782 If FILE is a libtool library, all the files associated with it are deleted.
783 Otherwise, only FILE itself is deleted using RM."
787 func_fatal_help "invalid operation mode \`$mode'"
789 esac
791 $ECHO
792 $ECHO "Try \`$progname --help' for more information about other modes."
794 exit $?
797 # TEST SUITE MARKER ## NON-FUNCTION
798 # Parse options once, thoroughly. This comes as soon as possible in
799 # the script to make things like `libtool --version' happen quickly.
801 # sed scripts:
802 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
803 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
804 my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
805 my_sed_long_arg='1s/^-[^=]*=//'
807 # Shorthand for --mode=foo, only valid as the first argument
808 case $1 in
809 clean|clea|cle|cl)
810 shift; set dummy --mode clean ${1+"$@"}; shift
812 compile|compil|compi|comp|com|co|c)
813 shift; set dummy --mode compile ${1+"$@"}; shift
815 execute|execut|execu|exec|exe|ex|e)
816 shift; set dummy --mode execute ${1+"$@"}; shift
818 finish|finis|fini|fin|fi|f)
819 shift; set dummy --mode finish ${1+"$@"}; shift
821 install|instal|insta|inst|ins|in|i)
822 shift; set dummy --mode install ${1+"$@"}; shift
824 link|lin|li|l)
825 shift; set dummy --mode link ${1+"$@"}; shift
827 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
828 shift; set dummy --mode uninstall ${1+"$@"}; shift
830 esac
832 # Parse non-mode specific arguments:
833 while test "$#" -gt 0; do
834 opt="$1"
835 shift
837 case $opt in
838 --config) func_config ;;
840 --debug) preserve_args="$preserve_args $opt"
841 func_echo "enabling shell trace mode"
842 opt_debug='set -x'
843 $opt_debug
846 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
847 execute_dlfiles="$execute_dlfiles $1"
848 shift
851 --dry-run | -n) opt_dry_run=: ;;
852 --features) func_features ;;
853 --finish) mode="finish" ;;
855 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
856 case $1 in
857 # Valid mode arguments:
858 clean) ;;
859 compile) ;;
860 execute) ;;
861 finish) ;;
862 install) ;;
863 link) ;;
864 relink) ;;
865 uninstall) ;;
867 # Catch anything else as an error
868 *) func_error "invalid argument for $opt"
869 exit_cmd=exit
870 break
872 esac
874 mode="$1"
875 shift
878 --preserve-dup-deps)
879 opt_duplicate_deps=: ;;
881 --quiet|--silent) preserve_args="$preserve_args $opt"
882 opt_silent=:
885 --verbose| -v) preserve_args="$preserve_args $opt"
886 opt_silent=false
889 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
890 preserve_args="$preserve_args $opt $1"
891 func_enable_tag "$1" # tagname is set here
892 shift
895 # Separate optargs to long options:
896 -dlopen=*|--mode=*|--tag=*)
897 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
898 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
899 set dummy "$opt" "$arg" ${1+"$@"}
900 shift
903 # Separate optargs to short options:
904 # -x*|-y*)
905 # arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
906 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
907 # set dummy "$opt" "$arg" ${1+"$@"}
908 # shift
909 # ;;
911 # Separate non-argument short options:
912 # -z*|-z*|-y*)
913 # rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
914 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
915 # set dummy "$opt" "-$rest" ${1+"$@"}
916 # shift
917 # ;;
919 -\?|-h) func_usage ;;
920 --help) opt_help=: ;;
921 --version) func_version ;;
923 -*) func_fatal_help "unrecognized option \`$opt'" ;;
925 *) nonopt="$opt"
926 break
928 esac
929 done
931 # Now that we've collected a possible --mode arg, show help if necessary
932 $opt_help && func_mode_help
934 case $host in
935 *cygwin* | *mingw* | *pw32*)
936 # don't eliminate duplications in $postdeps and $predeps
937 opt_duplicate_compiler_generated_deps=:
940 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
942 esac
944 # Having warned about all mis-specified options, bail out if
945 # anything was wrong.
946 $exit_cmd $EXIT_FAILURE
948 # TEST SUITE MARKER ## BEGIN SOURCABLE
950 # func_check_version_match
951 # Ensure that we are using m4 macros, and libtool script from the same
952 # release of libtool.
953 func_check_version_match ()
955 if test "$package_revision" != "$macro_revision"; then
956 if test "$VERSION" != "$macro_version"; then
957 if test -z "$macro_version"; then
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 an older release.
961 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
962 $progname: and run autoconf again.
963 _LT_EOF
964 else
965 cat >&2 <<_LT_EOF
966 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
967 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
968 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
969 $progname: and run autoconf again.
970 _LT_EOF
972 else
973 cat >&2 <<_LT_EOF
974 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
975 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
976 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
977 $progname: of $PACKAGE $VERSION and run autoconf again.
978 _LT_EOF
981 exit $EXIT_MISMATCH
986 # func_lalib_p file
987 # True iff FILE is a libtool `.la' library or `.lo' object file.
988 # This function is only a basic sanity check; it will hardly flush out
989 # determined imposters.
990 func_lalib_p ()
992 $SED -e 4q "$1" 2>/dev/null \
993 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
996 # func_lalib_unsafe_p file
997 # True iff FILE is a libtool `.la' library or `.lo' object file.
998 # This function implements the same check as func_lalib_p without
999 # resorting to external programs. To this end, it redirects stdin and
1000 # closes it afterwards, without saving the original file descriptor.
1001 # As a safety measure, use it only where a negative result would be
1002 # fatal anyway. Works if `file' does not exist.
1003 func_lalib_unsafe_p ()
1005 lalib_p=no
1006 if test -r "$1" && exec 5<&1 <"$1"; then
1007 for lalib_p_l in 1 2 3 4
1009 read lalib_p_line
1010 case "$lalib_p_line" in
1011 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
1012 esac
1013 done
1014 exec 1<&5 5<&-
1016 test "$lalib_p" = yes
1019 # func_ltwrapper_p file
1020 # True iff FILE is a libtool wrapper script.
1021 # This function is only a basic sanity check; it will hardly flush out
1022 # determined imposters.
1023 func_ltwrapper_p ()
1025 func_lalib_p "$1"
1029 # func_execute_cmds commands fail_cmd
1030 # Execute tilde-delimited COMMANDS.
1031 # If FAIL_CMD is given, eval that upon failure.
1032 # FAIL_CMD may read-access the current command in variable CMD!
1033 func_execute_cmds ()
1035 $opt_debug
1036 save_ifs=$IFS; IFS='~'
1037 for cmd in $1; do
1038 IFS=$save_ifs
1039 eval cmd=\"$cmd\"
1040 func_show_eval "$cmd" "${2-:}"
1041 done
1042 IFS=$save_ifs
1046 # func_source file
1047 # Source FILE, adding directory component if necessary.
1048 # Note that it is not necessary on cygwin/mingw to append a dot to
1049 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
1050 # behavior happens only for exec(3), not for open(2)! Also, sourcing
1051 # `FILE.' does not work on cygwin managed mounts.
1052 func_source ()
1054 $opt_debug
1055 case $1 in
1056 */* | *\\*) . "$1" ;;
1057 *) . "./$1" ;;
1058 esac
1062 # Generated shell functions inserted here.
1065 # func_win32_libid arg
1066 # return the library type of file 'arg'
1068 # Need a lot of goo to handle *both* DLLs and import libs
1069 # Has to be a shell function in order to 'eat' the argument
1070 # that is supplied when $file_magic_command is called.
1071 func_win32_libid ()
1073 $opt_debug
1074 win32_libid_type="unknown"
1075 win32_fileres=`file -L $1 2>/dev/null`
1076 case $win32_fileres in
1077 *ar\ archive\ import\ library*) # definitely import
1078 win32_libid_type="x86 archive import"
1080 *ar\ archive*) # could be an import, or static
1081 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
1082 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1083 win32_nmres=`eval $NM -f posix -A $1 |
1084 $SED -n -e '
1085 1,100{
1086 / I /{
1087 s,.*,import,
1092 case $win32_nmres in
1093 import*) win32_libid_type="x86 archive import";;
1094 *) win32_libid_type="x86 archive static";;
1095 esac
1098 *DLL*)
1099 win32_libid_type="x86 DLL"
1101 *executable*) # but shell scripts are "executable" too...
1102 case $win32_fileres in
1103 *MS\ Windows\ PE\ Intel*)
1104 win32_libid_type="x86 DLL"
1106 esac
1108 esac
1109 $ECHO "$win32_libid_type"
1114 # func_infer_tag arg
1115 # Infer tagged configuration to use if any are available and
1116 # if one wasn't chosen via the "--tag" command line option.
1117 # Only attempt this if the compiler in the base compile
1118 # command doesn't match the default compiler.
1119 # arg is usually of the form 'gcc ...'
1120 func_infer_tag ()
1122 $opt_debug
1123 if test -n "$available_tags" && test -z "$tagname"; then
1124 CC_quoted=
1125 for arg in $CC; do
1126 func_quote_for_eval "$arg"
1127 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1128 done
1129 case $@ in
1130 # Blanks in the command may have been stripped by the calling shell,
1131 # but not from the CC environment variable when configure was run.
1132 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
1133 # Blanks at the start of $base_compile will cause this to fail
1134 # if we don't check for them as well.
1136 for z in $available_tags; do
1137 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
1138 # Evaluate the configuration.
1139 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
1140 CC_quoted=
1141 for arg in $CC; do
1142 # Double-quote args containing other shell metacharacters.
1143 func_quote_for_eval "$arg"
1144 CC_quoted="$CC_quoted $func_quote_for_eval_result"
1145 done
1146 case "$@ " in
1147 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
1148 # The compiler in the base compile command matches
1149 # the one in the tagged configuration.
1150 # Assume this is the tagged configuration we want.
1151 tagname=$z
1152 break
1154 esac
1156 done
1157 # If $tagname still isn't set, then no tagged configuration
1158 # was found and let the user know that the "--tag" command
1159 # line option must be used.
1160 if test -z "$tagname"; then
1161 func_echo "unable to infer tagged configuration"
1162 func_fatal_error "specify a tag with \`--tag'"
1163 # else
1164 # func_verbose "using $tagname tagged configuration"
1167 esac
1173 # func_generate_dlsyms outputname originator pic_p
1174 # Extract symbols from dlprefiles and create ${outputname}S.o with
1175 # a dlpreopen symbol table.
1176 func_generate_dlsyms ()
1178 $opt_debug
1179 my_outputname="$1"
1180 my_originator="$2"
1181 my_pic_p="${3-no}"
1182 my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
1183 my_dlsyms=
1185 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
1186 if test -n "$NM" && test -n "$global_symbol_pipe"; then
1187 my_dlsyms="${my_outputname}S.c"
1188 else
1189 func_error "not configured to extract global symbols from dlpreopened files"
1193 if test -n "$my_dlsyms"; then
1194 case $my_dlsyms in
1195 "") ;;
1196 *.c)
1197 # Discover the nlist of each of the dlfiles.
1198 nlist="$output_objdir/${my_outputname}.nm"
1200 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
1202 # Parse the name list into a source file.
1203 func_echo "creating $output_objdir/$my_dlsyms"
1205 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
1206 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
1207 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
1209 #ifdef __cplusplus
1210 extern \"C\" {
1211 #endif
1213 /* External symbol declarations for the compiler. */\
1216 if test "$dlself" = yes; then
1217 func_echo "generating symbol list for \`$output'"
1219 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
1221 # Add our own program objects to the symbol list.
1222 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
1223 for progfile in $progfiles; do
1224 func_echo "extracting global C symbols from \`$progfile'"
1225 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
1226 done
1228 if test -n "$exclude_expsyms"; then
1229 $opt_dry_run || {
1230 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
1231 eval '$MV "$nlist"T "$nlist"'
1235 if test -n "$export_symbols_regex"; then
1236 $opt_dry_run || {
1237 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
1238 eval '$MV "$nlist"T "$nlist"'
1242 # Prepare the list of exported symbols
1243 if test -z "$export_symbols"; then
1244 export_symbols="$output_objdir/$outputname.exp"
1245 $opt_dry_run || {
1246 $RM $export_symbols
1247 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
1248 case $host in
1249 *cygwin* | *mingw* )
1250 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1251 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
1253 esac
1255 else
1256 $opt_dry_run || {
1257 eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
1258 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
1259 eval '$MV "$nlist"T "$nlist"'
1260 case $host in
1261 *cygwin | *mingw* )
1262 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
1263 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
1265 esac
1270 for dlprefile in $dlprefiles; do
1271 func_echo "extracting global C symbols from \`$dlprefile'"
1272 func_basename "$dlprefile"
1273 name="$func_basename_result"
1274 $opt_dry_run || {
1275 eval '$ECHO ": $name " >> "$nlist"'
1276 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
1278 done
1280 $opt_dry_run || {
1281 # Make sure we have at least an empty file.
1282 test -f "$nlist" || : > "$nlist"
1284 if test -n "$exclude_expsyms"; then
1285 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
1286 $MV "$nlist"T "$nlist"
1289 # Try sorting and uniquifying the output.
1290 if $GREP -v "^: " < "$nlist" |
1291 if sort -k 3 </dev/null >/dev/null 2>&1; then
1292 sort -k 3
1293 else
1294 sort +2
1295 fi |
1296 uniq > "$nlist"S; then
1298 else
1299 $GREP -v "^: " < "$nlist" > "$nlist"S
1302 if test -f "$nlist"S; then
1303 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
1304 else
1305 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
1308 $ECHO >> "$output_objdir/$my_dlsyms" "\
1310 /* The mapping between symbol names and symbols. */
1312 case $host in
1313 *cygwin* | *mingw* )
1314 $ECHO >> "$output_objdir/$my_dlsyms" "\
1315 /* DATA imports from DLLs on WIN32 con't be const, because
1316 runtime relocations are performed -- see ld's documentation
1317 on pseudo-relocs. */
1318 struct {
1322 $ECHO >> "$output_objdir/$my_dlsyms" "\
1323 const struct {
1326 esac
1328 $ECHO >> "$output_objdir/$my_dlsyms" "\
1329 const char *name;
1330 void *address;
1332 lt_${my_prefix}_LTX_preloaded_symbols[] =
1334 { \"$my_originator\", (void *) 0 },
1337 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
1339 $ECHO >> "$output_objdir/$my_dlsyms" "\
1340 {0, (void *) 0}
1343 /* This works around a problem in FreeBSD linker */
1344 #ifdef FREEBSD_WORKAROUND
1345 static const void *lt_preloaded_setup() {
1346 return lt_${my_prefix}_LTX_preloaded_symbols;
1348 #endif
1350 #ifdef __cplusplus
1352 #endif\
1354 } # !$opt_dry_run
1356 pic_flag_for_symtable=
1357 case "$compile_command " in
1358 *" -static "*) ;;
1360 case $host in
1361 # compiling the symbol table file with pic_flag works around
1362 # a FreeBSD bug that causes programs to crash when -lm is
1363 # linked before any other PIC object. But we must not use
1364 # pic_flag when linking with -static. The problem exists in
1365 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
1366 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
1367 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
1368 *-*-hpux*)
1369 pic_flag_for_symtable=" $pic_flag" ;;
1371 if test "X$my_pic_p" != Xno; then
1372 pic_flag_for_symtable=" $pic_flag"
1375 esac
1377 esac
1378 symtab_cflags=
1379 for arg in $LTCFLAGS; do
1380 case $arg in
1381 -pie | -fpie | -fPIE) ;;
1382 *) symtab_cflags="$symtab_cflags $arg" ;;
1383 esac
1384 done
1386 # Now compile the dynamic symbol file.
1387 func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
1389 # Clean up the generated files.
1390 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
1392 # Transform the symbol file into the correct name.
1393 symfileobj="$output_objdir/${my_outputname}S.$objext"
1394 case $host in
1395 *cygwin* | *mingw* )
1396 if test -f "$output_objdir/$my_outputname.def"; then
1397 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1398 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
1399 else
1400 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1401 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1405 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1406 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
1408 esac
1411 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1413 esac
1414 else
1415 # We keep going just in case the user didn't refer to
1416 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1417 # really was required.
1419 # Nullify the symbol file.
1420 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1421 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1425 # func_extract_an_archive dir oldlib
1426 func_extract_an_archive ()
1428 $opt_debug
1429 f_ex_an_ar_dir="$1"; shift
1430 f_ex_an_ar_oldlib="$1"
1431 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" 'exit $?'
1432 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1434 else
1435 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1440 # func_extract_archives gentop oldlib ...
1441 func_extract_archives ()
1443 $opt_debug
1444 my_gentop="$1"; shift
1445 my_oldlibs=${1+"$@"}
1446 my_oldobjs=""
1447 my_xlib=""
1448 my_xabs=""
1449 my_xdir=""
1451 for my_xlib in $my_oldlibs; do
1452 # Extract the objects.
1453 case $my_xlib in
1454 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
1455 *) my_xabs=`pwd`"/$my_xlib" ;;
1456 esac
1457 func_basename "$my_xlib"
1458 my_xlib="$func_basename_result"
1459 my_xlib_u=$my_xlib
1460 while :; do
1461 case " $extracted_archives " in
1462 *" $my_xlib_u "*)
1463 extracted_serial=`expr $extracted_serial + 1`
1464 my_xlib_u=lt$extracted_serial-$my_xlib ;;
1465 *) break ;;
1466 esac
1467 done
1468 extracted_archives="$extracted_archives $my_xlib_u"
1469 my_xdir="$my_gentop/$my_xlib_u"
1471 func_mkdir_p "$my_xdir"
1473 case $host in
1474 *-darwin*)
1475 func_echo "Extracting $my_xabs"
1476 # Do not bother doing anything if just a dry run
1477 $opt_dry_run || {
1478 darwin_orig_dir=`pwd`
1479 cd $my_xdir || exit $?
1480 darwin_archive=$my_xabs
1481 darwin_curdir=`pwd`
1482 darwin_base_archive=`basename $darwin_archive`
1483 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1484 if test -n "$darwin_arches"; then
1485 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1486 darwin_arch=
1487 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1488 for darwin_arch in $darwin_arches ; do
1489 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1490 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1491 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1492 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1493 cd "$darwin_curdir"
1494 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1495 done # $darwin_arches
1496 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1497 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1498 darwin_file=
1499 darwin_files=
1500 for darwin_file in $darwin_filelist; do
1501 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1502 lipo -create -output "$darwin_file" $darwin_files
1503 done # $darwin_filelist
1504 $RM -rf unfat-$$
1505 cd "$darwin_orig_dir"
1506 else
1507 cd $darwin_orig_dir
1508 func_extract_an_archive "$my_xdir" "$my_xabs"
1509 fi # $darwin_arches
1510 } # !$opt_dry_run
1513 func_extract_an_archive "$my_xdir" "$my_xabs"
1515 esac
1516 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1517 done
1519 func_extract_archives_result="$my_oldobjs"
1524 # func_write_libtool_object output_name pic_name nonpic_name
1525 # Create a libtool object file (analogous to a ".la" file),
1526 # but don't create it if we're doing a dry run.
1527 func_write_libtool_object ()
1529 write_libobj=${1}
1530 if test "$build_libtool_libs" = yes; then
1531 write_lobj=\'${2}\'
1532 else
1533 write_lobj=none
1536 if test "$build_old_libs" = yes; then
1537 write_oldobj=\'${3}\'
1538 else
1539 write_oldobj=none
1542 $opt_dry_run || {
1543 cat >${write_libobj}T <<EOF
1544 # $write_libobj - a libtool object file
1545 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1547 # Please DO NOT delete this file!
1548 # It is necessary for linking the library.
1550 # Name of the PIC object.
1551 pic_object=$write_lobj
1553 # Name of the non-PIC object
1554 non_pic_object=$write_oldobj
1557 mv -f "${write_libobj}T" "${write_libobj}"
1561 # func_mode_compile arg...
1562 func_mode_compile ()
1564 $opt_debug
1565 # Get the compilation command and the source file.
1566 base_compile=
1567 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1568 suppress_opt=yes
1569 suppress_output=
1570 arg_mode=normal
1571 libobj=
1572 later=
1573 pie_flag=
1575 for arg
1577 case $arg_mode in
1578 arg )
1579 # do not "continue". Instead, add this to base_compile
1580 lastarg="$arg"
1581 arg_mode=normal
1584 target )
1585 libobj="$arg"
1586 arg_mode=normal
1587 continue
1590 normal )
1591 # Accept any command-line options.
1592 case $arg in
1594 test -n "$libobj" && \
1595 func_fatal_error "you cannot specify \`-o' more than once"
1596 arg_mode=target
1597 continue
1600 -pie | -fpie | -fPIE)
1601 pie_flag="$pie_flag $arg"
1602 continue
1605 -shared | -static | -prefer-pic | -prefer-non-pic)
1606 later="$later $arg"
1607 continue
1610 -no-suppress)
1611 suppress_opt=no
1612 continue
1615 -Xcompiler)
1616 arg_mode=arg # the next one goes into the "base_compile" arg list
1617 continue # The current "srcfile" will either be retained or
1618 ;; # replaced later. I would guess that would be a bug.
1620 -Wc,*)
1621 func_stripname '-Wc,' '' "$arg"
1622 args=$func_stripname_result
1623 lastarg=
1624 save_ifs="$IFS"; IFS=','
1625 for arg in $args; do
1626 IFS="$save_ifs"
1627 func_quote_for_eval "$arg"
1628 lastarg="$lastarg $func_quote_for_eval_result"
1629 done
1630 IFS="$save_ifs"
1631 func_stripname ' ' '' "$lastarg"
1632 lastarg=$func_stripname_result
1634 # Add the arguments to base_compile.
1635 base_compile="$base_compile $lastarg"
1636 continue
1640 # Accept the current argument as the source file.
1641 # The previous "srcfile" becomes the current argument.
1643 lastarg="$srcfile"
1644 srcfile="$arg"
1646 esac # case $arg
1648 esac # case $arg_mode
1650 # Aesthetically quote the previous argument.
1651 func_quote_for_eval "$lastarg"
1652 base_compile="$base_compile $func_quote_for_eval_result"
1653 done # for arg
1655 case $arg_mode in
1656 arg)
1657 func_fatal_error "you must specify an argument for -Xcompile"
1659 target)
1660 func_fatal_error "you must specify a target with \`-o'"
1663 # Get the name of the library object.
1664 test -z "$libobj" && {
1665 func_basename "$srcfile"
1666 libobj="$func_basename_result"
1669 esac
1671 # Recognize several different file suffixes.
1672 # If the user specifies -o file.o, it is replaced with file.lo
1673 xform='[cCFSifmso]'
1674 case $libobj in
1675 *.ada) xform=ada ;;
1676 *.adb) xform=adb ;;
1677 *.ads) xform=ads ;;
1678 *.asm) xform=asm ;;
1679 *.c++) xform=c++ ;;
1680 *.cc) xform=cc ;;
1681 *.ii) xform=ii ;;
1682 *.class) xform=class ;;
1683 *.cpp) xform=cpp ;;
1684 *.cxx) xform=cxx ;;
1685 *.f90) xform=f90 ;;
1686 *.for) xform=for ;;
1687 *.java) xform=java ;;
1688 *.obj) xform=obj ;;
1689 esac
1691 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1693 case $libobj in
1694 *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
1696 func_fatal_error "cannot determine name of library object from \`$libobj'"
1698 esac
1700 func_infer_tag $base_compile
1702 for arg in $later; do
1703 case $arg in
1704 -shared)
1705 test "$build_libtool_libs" != yes && \
1706 func_fatal_configuration "can not build a shared library"
1707 build_old_libs=no
1708 continue
1711 -static)
1712 build_libtool_libs=no
1713 build_old_libs=yes
1714 continue
1717 -prefer-pic)
1718 pic_mode=yes
1719 continue
1722 -prefer-non-pic)
1723 pic_mode=no
1724 continue
1726 esac
1727 done
1729 func_quote_for_eval "$libobj"
1730 test "X$libobj" != "X$func_quote_for_eval_result" \
1731 && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
1732 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1733 func_basename "$obj"
1734 objname="$func_basename_result"
1735 func_dirname "$obj" "/" ""
1736 xdir="$func_dirname_result"
1737 lobj=${xdir}$objdir/$objname
1739 test -z "$base_compile" && \
1740 func_fatal_help "you must specify a compilation command"
1742 # Delete any leftover library objects.
1743 if test "$build_old_libs" = yes; then
1744 removelist="$obj $lobj $libobj ${libobj}T"
1745 else
1746 removelist="$lobj $libobj ${libobj}T"
1749 $opt_dry_run || $RM $removelist
1750 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1752 # On Cygwin there's no "real" PIC flag so we must build both object types
1753 case $host_os in
1754 cygwin* | mingw* | pw32* | os2*)
1755 pic_mode=default
1757 esac
1758 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1759 # non-PIC code in shared libraries is not supported
1760 pic_mode=default
1763 # Calculate the filename of the output object if compiler does
1764 # not support -o with -c
1765 if test "$compiler_c_o" = no; then
1766 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
1767 lockfile="$output_obj.lock"
1768 removelist="$removelist $output_obj $lockfile"
1769 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1770 else
1771 output_obj=
1772 need_locks=no
1773 lockfile=
1776 # Lock this critical section if it is needed
1777 # We use this script file to make the link, it avoids creating a new file
1778 if test "$need_locks" = yes; then
1779 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1780 func_echo "Waiting for $lockfile to be removed"
1781 sleep 2
1782 done
1783 elif test "$need_locks" = warn; then
1784 if test -f "$lockfile"; then
1785 $ECHO "\
1786 *** ERROR, $lockfile exists and contains:
1787 `cat $lockfile 2>/dev/null`
1789 This indicates that another process is trying to use the same
1790 temporary object file, and libtool could not work around it because
1791 your compiler does not support \`-c' and \`-o' together. If you
1792 repeat this compilation, it may succeed, by chance, but you had better
1793 avoid parallel builds (make -j) in this platform, or get a better
1794 compiler."
1796 $opt_dry_run || $RM $removelist
1797 exit $EXIT_FAILURE
1799 $ECHO "$srcfile" > "$lockfile"
1802 if test -n "$fix_srcfile_path"; then
1803 eval srcfile=\"$fix_srcfile_path\"
1805 func_quote_for_eval "$srcfile"
1806 qsrcfile=$func_quote_for_eval_result
1808 $opt_dry_run || $RM "$libobj" "${libobj}T"
1810 # Only build a PIC object if we are building libtool libraries.
1811 if test "$build_libtool_libs" = yes; then
1812 # Without this assignment, base_compile gets emptied.
1813 fbsd_hideous_sh_bug=$base_compile
1815 if test "$pic_mode" != no; then
1816 command="$base_compile $qsrcfile $pic_flag"
1817 else
1818 # Don't build PIC code
1819 command="$base_compile $qsrcfile"
1822 func_mkdir_p "$xdir$objdir"
1824 if test -z "$output_obj"; then
1825 # Place PIC objects in $objdir
1826 command="$command -o $lobj"
1829 $opt_dry_run || $RM "$lobj" "$output_obj"
1831 func_show_eval "$command" \
1832 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1834 if test "$need_locks" = warn &&
1835 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1836 $ECHO "\
1837 *** ERROR, $lockfile contains:
1838 `cat $lockfile 2>/dev/null`
1840 but it should contain:
1841 $srcfile
1843 This indicates that another process is trying to use the same
1844 temporary object file, and libtool could not work around it because
1845 your compiler does not support \`-c' and \`-o' together. If you
1846 repeat this compilation, it may succeed, by chance, but you had better
1847 avoid parallel builds (make -j) in this platform, or get a better
1848 compiler."
1850 $opt_dry_run || $RM $removelist
1851 exit $EXIT_FAILURE
1854 # Just move the object if needed, then go on to compile the next one
1855 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1856 func_show_eval '$MV "$output_obj" "$lobj"' \
1857 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1860 # Allow error messages only from the first compilation.
1861 if test "$suppress_opt" = yes; then
1862 suppress_output=' >/dev/null 2>&1'
1866 # Only build a position-dependent object if we build old libraries.
1867 if test "$build_old_libs" = yes; then
1868 if test "$pic_mode" != yes; then
1869 # Don't build PIC code
1870 command="$base_compile $qsrcfile$pie_flag"
1871 else
1872 command="$base_compile $qsrcfile $pic_flag"
1874 if test "$compiler_c_o" = yes; then
1875 command="$command -o $obj"
1878 # Suppress compiler output if we already did a PIC compilation.
1879 command="$command$suppress_output"
1880 $opt_dry_run || $RM "$obj" "$output_obj"
1881 func_show_eval "$command" \
1882 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1884 if test "$need_locks" = warn &&
1885 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1886 $ECHO "\
1887 *** ERROR, $lockfile contains:
1888 `cat $lockfile 2>/dev/null`
1890 but it should contain:
1891 $srcfile
1893 This indicates that another process is trying to use the same
1894 temporary object file, and libtool could not work around it because
1895 your compiler does not support \`-c' and \`-o' together. If you
1896 repeat this compilation, it may succeed, by chance, but you had better
1897 avoid parallel builds (make -j) in this platform, or get a better
1898 compiler."
1900 $opt_dry_run || $RM $removelist
1901 exit $EXIT_FAILURE
1904 # Just move the object if needed
1905 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1906 func_show_eval '$MV "$output_obj" "$obj"' \
1907 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1911 $opt_dry_run || {
1912 func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
1914 # Unlock the critical section if it was locked
1915 if test "$need_locks" != no; then
1916 $RM "$lockfile"
1920 exit $EXIT_SUCCESS
1924 # func_mode_execute arg...
1925 func_mode_execute ()
1927 $opt_debug
1928 # The first argument is the command name.
1929 cmd="$nonopt"
1930 test -z "$cmd" && \
1931 func_fatal_help "you must specify a COMMAND"
1933 # Handle -dlopen flags immediately.
1934 for file in $execute_dlfiles; do
1935 test -f "$file" \
1936 || func_fatal_help "\`$file' is not a file"
1938 dir=
1939 case $file in
1940 *.la)
1941 # Check to see that this really is a libtool archive.
1942 func_lalib_unsafe_p "$file" \
1943 || func_fatal_help "\`$lib' is not a valid libtool archive"
1945 # Read the libtool library.
1946 dlname=
1947 library_names=
1948 func_source "$file"
1950 # Skip this library if it cannot be dlopened.
1951 if test -z "$dlname"; then
1952 # Warn if it was a shared library.
1953 test -n "$library_names" && \
1954 func_warning "\`$file' was not linked with \`-export-dynamic'"
1955 continue
1958 func_dirname "$file" "" "."
1959 dir="$func_dirname_result"
1961 if test -f "$dir/$objdir/$dlname"; then
1962 dir="$dir/$objdir"
1963 else
1964 if test ! -f "$dir/$dlname"; then
1965 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1970 *.lo)
1971 # Just add the directory containing the .lo file.
1972 func_dirname "$file" "" "."
1973 dir="$func_dirname_result"
1977 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1978 continue
1980 esac
1982 # Get the absolute pathname.
1983 absdir=`cd "$dir" && pwd`
1984 test -n "$absdir" && dir="$absdir"
1986 # Now add the directory to shlibpath_var.
1987 if eval "test -z \"\$$shlibpath_var\""; then
1988 eval "$shlibpath_var=\"\$dir\""
1989 else
1990 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1992 done
1994 # This variable tells wrapper scripts just to set shlibpath_var
1995 # rather than running their programs.
1996 libtool_execute_magic="$magic"
1998 # Check if any of the arguments is a wrapper script.
1999 args=
2000 for file
2002 case $file in
2003 -*) ;;
2005 # Do a test to see if this is really a libtool program.
2006 if func_ltwrapper_p "$file"; then
2007 func_source "$file"
2009 # Transform arg to wrapped name.
2010 file="$progdir/$program"
2013 esac
2014 # Quote arguments (to preserve shell metacharacters).
2015 func_quote_for_eval "$file"
2016 args="$args $func_quote_for_eval_result"
2017 done
2019 if test "X$opt_dry_run" = Xfalse; then
2020 if test -n "$shlibpath_var"; then
2021 # Export the shlibpath_var.
2022 eval "export $shlibpath_var"
2025 # Restore saved environment variables
2026 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
2028 eval "if test \"\${save_$lt_var+set}\" = set; then
2029 $lt_var=\$save_$lt_var; export $lt_var
2030 else
2031 $lt_unset $lt_var
2033 done
2035 # Now prepare to actually exec the command.
2036 exec_cmd="\$cmd$args"
2037 else
2038 # Display what would be done.
2039 if test -n "$shlibpath_var"; then
2040 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
2041 $ECHO "export $shlibpath_var"
2043 $ECHO "$cmd$args"
2044 exit $EXIT_SUCCESS
2049 # func_mode_finish arg...
2050 func_mode_finish ()
2052 $opt_debug
2053 libdirs="$nonopt"
2054 admincmds=
2056 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
2057 for dir
2059 libdirs="$libdirs $dir"
2060 done
2062 for libdir in $libdirs; do
2063 if test -n "$finish_cmds"; then
2064 # Do each command in the finish commands.
2065 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
2066 '"$cmd"'"'
2068 if test -n "$finish_eval"; then
2069 # Do the single finish_eval.
2070 eval cmds=\"$finish_eval\"
2071 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
2072 $cmds"
2074 done
2077 # Exit here if they wanted silent mode.
2078 $opt_silent && exit $EXIT_SUCCESS
2080 $ECHO "X----------------------------------------------------------------------" | $Xsed
2081 $ECHO "Libraries have been installed in:"
2082 for libdir in $libdirs; do
2083 $ECHO " $libdir"
2084 done
2085 $ECHO
2086 $ECHO "If you ever happen to want to link against installed libraries"
2087 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
2088 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
2089 $ECHO "flag during linking and do at least one of the following:"
2090 if test -n "$shlibpath_var"; then
2091 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
2092 $ECHO " during execution"
2094 if test -n "$runpath_var"; then
2095 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
2096 $ECHO " during linking"
2098 if test -n "$hardcode_libdir_flag_spec"; then
2099 libdir=LIBDIR
2100 eval flag=\"$hardcode_libdir_flag_spec\"
2102 $ECHO " - use the \`$flag' linker flag"
2104 if test -n "$admincmds"; then
2105 $ECHO " - have your system administrator run these commands:$admincmds"
2107 if test -f /etc/ld.so.conf; then
2108 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
2110 $ECHO
2112 $ECHO "See any operating system documentation about shared libraries for"
2113 case $host in
2114 solaris2.[6789]|solaris2.1[0-9])
2115 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
2116 $ECHO "pages."
2119 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
2121 esac
2122 $ECHO "X----------------------------------------------------------------------" | $Xsed
2123 exit $EXIT_SUCCESS
2127 # func_mode_install arg...
2128 func_mode_install ()
2130 $opt_debug
2131 # There may be an optional sh(1) argument at the beginning of
2132 # install_prog (especially on Windows NT).
2133 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
2134 # Allow the use of GNU shtool's install command.
2135 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
2136 # Aesthetically quote it.
2137 func_quote_for_eval "$nonopt"
2138 install_prog="$func_quote_for_eval_result "
2139 arg=$1
2140 shift
2141 else
2142 install_prog=
2143 arg=$nonopt
2146 # The real first argument should be the name of the installation program.
2147 # Aesthetically quote it.
2148 func_quote_for_eval "$arg"
2149 install_prog="$install_prog$func_quote_for_eval_result"
2151 # We need to accept at least all the BSD install flags.
2152 dest=
2153 files=
2154 opts=
2155 prev=
2156 install_type=
2157 isdir=no
2158 stripme=
2159 for arg
2161 if test -n "$dest"; then
2162 files="$files $dest"
2163 dest=$arg
2164 continue
2167 case $arg in
2168 -d) isdir=yes ;;
2170 case " $install_prog " in
2171 *[\\\ /]cp\ *) ;;
2172 *) prev=$arg ;;
2173 esac
2175 -g | -m | -o)
2176 prev=$arg
2179 stripme=" -s"
2180 continue
2185 # If the previous option needed an argument, then skip it.
2186 if test -n "$prev"; then
2187 prev=
2188 else
2189 dest=$arg
2190 continue
2193 esac
2195 # Aesthetically quote the argument.
2196 func_quote_for_eval "$arg"
2197 install_prog="$install_prog $func_quote_for_eval_result"
2198 done
2200 test -z "$install_prog" && \
2201 func_fatal_help "you must specify an install program"
2203 test -n "$prev" && \
2204 func_fatal_help "the \`$prev' option requires an argument"
2206 if test -z "$files"; then
2207 if test -z "$dest"; then
2208 func_fatal_help "no file or destination specified"
2209 else
2210 func_fatal_help "you must specify a destination"
2214 # Strip any trailing slash from the destination.
2215 func_stripname '' '/' "$dest"
2216 dest=$func_stripname_result
2218 # Check to see that the destination is a directory.
2219 test -d "$dest" && isdir=yes
2220 if test "$isdir" = yes; then
2221 destdir="$dest"
2222 destname=
2223 else
2224 func_dirname "$dest" "" "."
2225 destdir="$func_dirname_result"
2226 func_basename "$dest"
2227 destname="$func_basename_result"
2229 # Not a directory, so check to see that there is only one file specified.
2230 set dummy $files; shift
2231 test "$#" -gt 1 && \
2232 func_fatal_help "\`$dest' is not a directory"
2234 case $destdir in
2235 [\\/]* | [A-Za-z]:[\\/]*) ;;
2237 for file in $files; do
2238 case $file in
2239 *.lo) ;;
2241 func_fatal_help "\`$destdir' must be an absolute directory name"
2243 esac
2244 done
2246 esac
2248 # This variable tells wrapper scripts just to set variables rather
2249 # than running their programs.
2250 libtool_install_magic="$magic"
2252 staticlibs=
2253 future_libdirs=
2254 current_libdirs=
2255 for file in $files; do
2257 # Do each installation.
2258 case $file in
2259 *.$libext)
2260 # Do the static libraries later.
2261 staticlibs="$staticlibs $file"
2264 *.la)
2265 # Check to see that this really is a libtool archive.
2266 func_lalib_unsafe_p "$file" \
2267 || func_fatal_help "\`$file' is not a valid libtool archive"
2269 library_names=
2270 old_library=
2271 relink_command=
2272 func_source "$file"
2274 # Add the libdir to current_libdirs if it is the destination.
2275 if test "X$destdir" = "X$libdir"; then
2276 case "$current_libdirs " in
2277 *" $libdir "*) ;;
2278 *) current_libdirs="$current_libdirs $libdir" ;;
2279 esac
2280 else
2281 # Note the libdir as a future libdir.
2282 case "$future_libdirs " in
2283 *" $libdir "*) ;;
2284 *) future_libdirs="$future_libdirs $libdir" ;;
2285 esac
2288 func_dirname "$file" "/" ""
2289 dir="$func_dirname_result"
2290 dir="$dir$objdir"
2292 if test -n "$relink_command"; then
2293 # Determine the prefix the user has applied to our future dir.
2294 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
2296 # Don't allow the user to place us outside of our expected
2297 # location b/c this prevents finding dependent libraries that
2298 # are installed to the same prefix.
2299 # At present, this check doesn't affect windows .dll's that
2300 # are installed into $libdir/../bin (currently, that works fine)
2301 # but it's something to keep an eye on.
2302 test "$inst_prefix_dir" = "$destdir" && \
2303 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
2305 if test -n "$inst_prefix_dir"; then
2306 # Stick the inst_prefix_dir data into the link command.
2307 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
2308 else
2309 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
2312 func_warning "relinking \`$file'"
2313 func_show_eval "$relink_command" \
2314 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
2317 # See the names of the shared library.
2318 set dummy $library_names; shift
2319 if test -n "$1"; then
2320 realname="$1"
2321 shift
2323 srcname="$realname"
2324 test -n "$relink_command" && srcname="$realname"T
2326 # Install the shared library and build the symlinks.
2327 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
2328 'exit $?'
2329 tstripme="$stripme"
2330 case $host_os in
2331 cygwin* | mingw* | pw32*)
2332 case $realname in
2333 *.dll.a)
2334 tstripme=""
2336 esac
2338 esac
2339 if test -n "$tstripme" && test -n "$striplib"; then
2340 func_show_eval "$striplib $destdir/$realname" 'exit $?'
2343 if test "$#" -gt 0; then
2344 # Delete the old symlinks, and create new ones.
2345 # Try `ln -sf' first, because the `ln' binary might depend on
2346 # the symlink we replace! Solaris /bin/ln does not understand -f,
2347 # so we also need to try rm && ln -s.
2348 for linkname
2350 test "$linkname" != "$realname" \
2351 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
2352 done
2355 # Do each command in the postinstall commands.
2356 lib="$destdir/$realname"
2357 func_execute_cmds "$postinstall_cmds" 'exit $?'
2360 # Install the pseudo-library for information purposes.
2361 func_basename "$file"
2362 name="$func_basename_result"
2363 instname="$dir/$name"i
2364 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
2366 # Maybe install the static library, too.
2367 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
2370 *.lo)
2371 # Install (i.e. copy) a libtool object.
2373 # Figure out destination file name, if it wasn't already specified.
2374 if test -n "$destname"; then
2375 destfile="$destdir/$destname"
2376 else
2377 func_basename "$file"
2378 destfile="$func_basename_result"
2379 destfile="$destdir/$destfile"
2382 # Deduce the name of the destination old-style object file.
2383 case $destfile in
2384 *.lo)
2385 staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
2387 *.$objext)
2388 staticdest="$destfile"
2389 destfile=
2392 func_fatal_help "cannot copy a libtool object to \`$destfile'"
2394 esac
2396 # Install the libtool object if requested.
2397 test -n "$destfile" && \
2398 func_show_eval "$install_prog $file $destfile" 'exit $?'
2400 # Install the old object if enabled.
2401 if test "$build_old_libs" = yes; then
2402 # Deduce the name of the old-style object file.
2403 staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
2404 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
2406 exit $EXIT_SUCCESS
2410 # Figure out destination file name, if it wasn't already specified.
2411 if test -n "$destname"; then
2412 destfile="$destdir/$destname"
2413 else
2414 func_basename "$file"
2415 destfile="$func_basename_result"
2416 destfile="$destdir/$destfile"
2419 # If the file is missing, and there is a .exe on the end, strip it
2420 # because it is most likely a libtool script we actually want to
2421 # install
2422 stripped_ext=""
2423 case $file in
2424 *.exe)
2425 if test ! -f "$file"; then
2426 func_stripname '' '.exe' "$file"
2427 file=$func_stripname_result
2428 stripped_ext=".exe"
2431 esac
2433 # Do a test to see if this is really a libtool program.
2434 case $host in
2435 *cygwin*|*mingw*)
2436 func_stripname '' '.exe' "$file"
2437 wrapper=$func_stripname_result
2440 wrapper=$file
2442 esac
2443 if func_ltwrapper_p "$wrapper"; then
2444 notinst_deplibs=
2445 relink_command=
2447 func_source "$wrapper"
2449 # Check the variables that should have been set.
2450 test -z "$generated_by_libtool_version" && \
2451 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2453 finalize=yes
2454 for lib in $notinst_deplibs; do
2455 # Check to see that each library is installed.
2456 libdir=
2457 if test -f "$lib"; then
2458 func_source "$lib"
2460 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2461 if test -n "$libdir" && test ! -f "$libfile"; then
2462 func_warning "\`$lib' has not been installed in \`$libdir'"
2463 finalize=no
2465 done
2467 relink_command=
2468 func_source "$wrapper"
2470 outputname=
2471 if test "$fast_install" = no && test -n "$relink_command"; then
2472 $opt_dry_run || {
2473 if test "$finalize" = yes; then
2474 tmpdir=`func_mktempdir`
2475 func_basename "$file$stripped_ext"
2476 file="$func_basename_result"
2477 outputname="$tmpdir/$file"
2478 # Replace the output file specification.
2479 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2481 $opt_silent || {
2482 func_quote_for_expand "$relink_command"
2483 eval "func_echo $func_quote_for_expand_result"
2485 if eval "$relink_command"; then :
2486 else
2487 func_error "error: relink \`$file' with the above command before installing it"
2488 $opt_dry_run || ${RM}r "$tmpdir"
2489 continue
2491 file="$outputname"
2492 else
2493 func_warning "cannot relink \`$file'"
2496 else
2497 # Install the binary that we compiled earlier.
2498 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
2502 # remove .exe since cygwin /usr/bin/install will append another
2503 # one anyway
2504 case $install_prog,$host in
2505 */usr/bin/install*,*cygwin*)
2506 case $file:$destfile in
2507 *.exe:*.exe)
2508 # this is ok
2510 *.exe:*)
2511 destfile=$destfile.exe
2513 *:*.exe)
2514 func_stripname '' '.exe' "$destfile"
2515 destfile=$func_stripname_result
2517 esac
2519 esac
2520 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2521 $opt_dry_run || if test -n "$outputname"; then
2522 ${RM}r "$tmpdir"
2525 esac
2526 done
2528 for file in $staticlibs; do
2529 func_basename "$file"
2530 name="$func_basename_result"
2532 # Set up the ranlib parameters.
2533 oldlib="$destdir/$name"
2535 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2537 if test -n "$stripme" && test -n "$old_striplib"; then
2538 func_show_eval "$old_striplib $oldlib" 'exit $?'
2541 # Do each command in the postinstall commands.
2542 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2543 done
2545 test -n "$future_libdirs" && \
2546 func_warning "remember to run \`$progname --finish$future_libdirs'"
2548 if test -n "$current_libdirs"; then
2549 # Maybe just do a dry run.
2550 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2551 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2552 else
2553 exit $EXIT_SUCCESS
2558 # func_mode_link arg...
2559 func_mode_link ()
2561 $opt_debug
2562 case $host in
2563 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2564 # It is impossible to link a dll without this setting, and
2565 # we shouldn't force the makefile maintainer to figure out
2566 # which system we are compiling for in order to pass an extra
2567 # flag for every libtool invocation.
2568 # allow_undefined=no
2570 # FIXME: Unfortunately, there are problems with the above when trying
2571 # to make a dll which has undefined symbols, in which case not
2572 # even a static library is built. For now, we need to specify
2573 # -no-undefined on the libtool link line when we can be certain
2574 # that all symbols are satisfied, otherwise we get a static library.
2575 allow_undefined=yes
2578 allow_undefined=yes
2580 esac
2581 libtool_args=$nonopt
2582 base_compile="$nonopt $@"
2583 compile_command=$nonopt
2584 finalize_command=$nonopt
2586 compile_rpath=
2587 finalize_rpath=
2588 compile_shlibpath=
2589 finalize_shlibpath=
2590 convenience=
2591 old_convenience=
2592 deplibs=
2593 old_deplibs=
2594 compiler_flags=
2595 linker_flags=
2596 dllsearchpath=
2597 lib_search_path=`pwd`
2598 inst_prefix_dir=
2599 new_inherited_linker_flags=
2601 avoid_version=no
2602 dlfiles=
2603 dlprefiles=
2604 dlself=no
2605 export_dynamic=no
2606 export_symbols=
2607 export_symbols_regex=
2608 generated=
2609 libobjs=
2610 ltlibs=
2611 module=no
2612 no_install=no
2613 objs=
2614 non_pic_objects=
2615 precious_files_regex=
2616 prefer_static_libs=no
2617 preload=no
2618 prev=
2619 prevarg=
2620 release=
2621 rpath=
2622 xrpath=
2623 perm_rpath=
2624 temp_rpath=
2625 thread_safe=no
2626 vinfo=
2627 vinfo_number=no
2628 weak_libs=
2629 single_module="${wl}-single_module"
2630 func_infer_tag $base_compile
2632 # We need to know -static, to get the right output filenames.
2633 for arg
2635 case $arg in
2636 -shared)
2637 test "$build_libtool_libs" != yes && \
2638 func_fatal_configuration "can not build a shared library"
2639 build_old_libs=no
2640 break
2642 -all-static | -static | -static-libtool-libs)
2643 case $arg in
2644 -all-static)
2645 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2646 func_warning "complete static linking is impossible in this configuration"
2648 if test -n "$link_static_flag"; then
2649 dlopen_self=$dlopen_self_static
2650 # See comment for -static flag below, for more details.
2651 func_append compile_command " $link_static_flag"
2652 func_append finalize_command " $link_static_flag"
2654 prefer_static_libs=yes
2656 -static)
2657 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2658 dlopen_self=$dlopen_self_static
2660 prefer_static_libs=built
2662 -static-libtool-libs)
2663 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2664 dlopen_self=$dlopen_self_static
2666 prefer_static_libs=yes
2668 esac
2669 build_libtool_libs=no
2670 build_old_libs=yes
2671 break
2673 esac
2674 done
2676 # See if our shared archives depend on static archives.
2677 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2679 # Go through the arguments, transforming them on the way.
2680 while test "$#" -gt 0; do
2681 arg="$1"
2682 shift
2683 func_quote_for_eval "$arg"
2684 qarg=$func_quote_for_eval_unquoted_result
2685 func_append libtool_args " $func_quote_for_eval_result"
2687 # If the previous option needs an argument, assign it.
2688 if test -n "$prev"; then
2689 case $prev in
2690 output)
2691 func_append compile_command " @OUTPUT@"
2692 func_append finalize_command " @OUTPUT@"
2694 esac
2696 case $prev in
2697 dlfiles|dlprefiles)
2698 if test "$preload" = no; then
2699 # Add the symbol object into the linking commands.
2700 func_append compile_command " @SYMFILE@"
2701 func_append finalize_command " @SYMFILE@"
2702 preload=yes
2704 case $arg in
2705 *.la | *.lo) ;; # We handle these cases below.
2706 force)
2707 if test "$dlself" = no; then
2708 dlself=needless
2709 export_dynamic=yes
2711 prev=
2712 continue
2714 self)
2715 if test "$prev" = dlprefiles; then
2716 dlself=yes
2717 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2718 dlself=yes
2719 else
2720 dlself=needless
2721 export_dynamic=yes
2723 prev=
2724 continue
2727 if test "$prev" = dlfiles; then
2728 dlfiles="$dlfiles $arg"
2729 else
2730 dlprefiles="$dlprefiles $arg"
2732 prev=
2733 continue
2735 esac
2737 expsyms)
2738 export_symbols="$arg"
2739 test -f "$arg" \
2740 || func_fatal_error "symbol file \`$arg' does not exist"
2741 prev=
2742 continue
2744 expsyms_regex)
2745 export_symbols_regex="$arg"
2746 prev=
2747 continue
2749 framework)
2750 case $host in
2751 *-*-darwin*)
2752 case "$deplibs " in
2753 *" $qarg.ltframework "*) ;;
2754 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2756 esac
2758 esac
2759 prev=
2760 continue
2762 inst_prefix)
2763 inst_prefix_dir="$arg"
2764 prev=
2765 continue
2767 objectlist)
2768 if test -f "$arg"; then
2769 save_arg=$arg
2770 moreargs=
2771 for fil in `cat "$save_arg"`
2773 # moreargs="$moreargs $fil"
2774 arg=$fil
2775 # A libtool-controlled object.
2777 # Check to see that this really is a libtool object.
2778 if func_lalib_unsafe_p "$arg"; then
2779 pic_object=
2780 non_pic_object=
2782 # Read the .lo file
2783 func_source "$arg"
2785 if test -z "$pic_object" ||
2786 test -z "$non_pic_object" ||
2787 test "$pic_object" = none &&
2788 test "$non_pic_object" = none; then
2789 func_fatal_error "cannot find name of object for \`$arg'"
2792 # Extract subdirectory from the argument.
2793 func_dirname "$arg" "/" ""
2794 xdir="$func_dirname_result"
2796 if test "$pic_object" != none; then
2797 # Prepend the subdirectory the object is found in.
2798 pic_object="$xdir$pic_object"
2800 if test "$prev" = dlfiles; then
2801 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2802 dlfiles="$dlfiles $pic_object"
2803 prev=
2804 continue
2805 else
2806 # If libtool objects are unsupported, then we need to preload.
2807 prev=dlprefiles
2811 # CHECK ME: I think I busted this. -Ossama
2812 if test "$prev" = dlprefiles; then
2813 # Preload the old-style object.
2814 dlprefiles="$dlprefiles $pic_object"
2815 prev=
2818 # A PIC object.
2819 func_append libobjs " $pic_object"
2820 arg="$pic_object"
2823 # Non-PIC object.
2824 if test "$non_pic_object" != none; then
2825 # Prepend the subdirectory the object is found in.
2826 non_pic_object="$xdir$non_pic_object"
2828 # A standard non-PIC object
2829 func_append non_pic_objects " $non_pic_object"
2830 if test -z "$pic_object" || test "$pic_object" = none ; then
2831 arg="$non_pic_object"
2833 else
2834 # If the PIC object exists, use it instead.
2835 # $xdir was prepended to $pic_object above.
2836 non_pic_object="$pic_object"
2837 func_append non_pic_objects " $non_pic_object"
2839 else
2840 # Only an error if not doing a dry-run.
2841 if $opt_dry_run; then
2842 # Extract subdirectory from the argument.
2843 func_dirname "$arg" "/" ""
2844 xdir="$func_dirname_result"
2846 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2847 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2848 func_append libobjs " $pic_object"
2849 func_append non_pic_objects " $non_pic_object"
2850 else
2851 func_fatal_error "\`$arg' is not a valid libtool object"
2854 done
2855 else
2856 func_fatal_error "link input file \`$arg' does not exist"
2858 arg=$save_arg
2859 prev=
2860 continue
2862 precious_regex)
2863 precious_files_regex="$arg"
2864 prev=
2865 continue
2867 release)
2868 release="-$arg"
2869 prev=
2870 continue
2872 rpath | xrpath)
2873 # We need an absolute path.
2874 case $arg in
2875 [\\/]* | [A-Za-z]:[\\/]*) ;;
2877 func_fatal_error "only absolute run-paths are allowed"
2879 esac
2880 if test "$prev" = rpath; then
2881 case "$rpath " in
2882 *" $arg "*) ;;
2883 *) rpath="$rpath $arg" ;;
2884 esac
2885 else
2886 case "$xrpath " in
2887 *" $arg "*) ;;
2888 *) xrpath="$xrpath $arg" ;;
2889 esac
2891 prev=
2892 continue
2894 shrext)
2895 shrext_cmds="$arg"
2896 prev=
2897 continue
2899 weak)
2900 weak_libs="$weak_libs $arg"
2901 prev=
2902 continue
2904 xcclinker)
2905 linker_flags="$linker_flags $qarg"
2906 compiler_flags="$compiler_flags $qarg"
2907 prev=
2908 func_append compile_command " $qarg"
2909 func_append finalize_command " $qarg"
2910 continue
2912 xcompiler)
2913 compiler_flags="$compiler_flags $qarg"
2914 prev=
2915 func_append compile_command " $qarg"
2916 func_append finalize_command " $qarg"
2917 continue
2919 xlinker)
2920 linker_flags="$linker_flags $qarg"
2921 compiler_flags="$compiler_flags $wl$qarg"
2922 prev=
2923 func_append compile_command " $wl$qarg"
2924 func_append finalize_command " $wl$qarg"
2925 continue
2928 eval "$prev=\"\$arg\""
2929 prev=
2930 continue
2932 esac
2933 fi # test -n "$prev"
2935 prevarg="$arg"
2937 case $arg in
2938 -all-static)
2939 # The effects of -all-static are defined in a previous loop.
2940 continue
2943 -allow-undefined)
2944 # FIXME: remove this flag sometime in the future.
2945 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
2948 -avoid-version)
2949 avoid_version=yes
2950 continue
2953 -dlopen)
2954 prev=dlfiles
2955 continue
2958 -dlpreopen)
2959 prev=dlprefiles
2960 continue
2963 -export-dynamic)
2964 export_dynamic=yes
2965 continue
2968 -export-symbols | -export-symbols-regex)
2969 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2970 func_fatal_error "more than one -exported-symbols argument is not allowed"
2972 if test "X$arg" = "X-export-symbols"; then
2973 prev=expsyms
2974 else
2975 prev=expsyms_regex
2977 continue
2980 -framework)
2981 prev=framework
2982 continue
2985 -inst-prefix-dir)
2986 prev=inst_prefix
2987 continue
2990 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
2991 # so, if we see these flags be careful not to treat them like -L
2992 -L[A-Z][A-Z]*:*)
2993 case $with_gcc/$host in
2994 no/*-*-irix* | /*-*-irix*)
2995 func_append compile_command " $arg"
2996 func_append finalize_command " $arg"
2998 esac
2999 continue
3002 -L*)
3003 func_stripname '-L' '' "$arg"
3004 dir=$func_stripname_result
3005 # We need an absolute path.
3006 case $dir in
3007 [\\/]* | [A-Za-z]:[\\/]*) ;;
3009 absdir=`cd "$dir" && pwd`
3010 test -z "$absdir" && \
3011 func_fatal_error "cannot determine absolute directory name of \`$dir'"
3012 dir="$absdir"
3014 esac
3015 case "$deplibs " in
3016 *" -L$dir "*) ;;
3018 deplibs="$deplibs -L$dir"
3019 lib_search_path="$lib_search_path $dir"
3021 esac
3022 case $host in
3023 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3024 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
3025 case :$dllsearchpath: in
3026 *":$dir:"*) ;;
3027 *) dllsearchpath="$dllsearchpath:$dir";;
3028 esac
3029 case :$dllsearchpath: in
3030 *":$testbindir:"*) ;;
3031 *) dllsearchpath="$dllsearchpath:$testbindir";;
3032 esac
3034 esac
3035 continue
3038 -l*)
3039 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
3040 case $host in
3041 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
3042 # These systems don't actually have a C or math library (as such)
3043 continue
3045 *-*-os2*)
3046 # These systems don't actually have a C library (as such)
3047 test "X$arg" = "X-lc" && continue
3049 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3050 # Do not include libc due to us having libc/libc_r.
3051 test "X$arg" = "X-lc" && continue
3053 *-*-rhapsody* | *-*-darwin1.[012])
3054 # Rhapsody C and math libraries are in the System framework
3055 deplibs="$deplibs System.ltframework"
3056 continue
3058 *-*-sco3.2v5* | *-*-sco5v6*)
3059 # Causes problems with __ctype
3060 test "X$arg" = "X-lc" && continue
3062 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3063 # Compiler inserts libc in the correct place for threads to work
3064 test "X$arg" = "X-lc" && continue
3066 esac
3067 elif test "X$arg" = "X-lc_r"; then
3068 case $host in
3069 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3070 # Do not include libc_r directly, use -pthread flag.
3071 continue
3073 esac
3075 deplibs="$deplibs $arg"
3076 continue
3079 -module)
3080 module=yes
3081 continue
3084 # Tru64 UNIX uses -model [arg] to determine the layout of C++
3085 # classes, name mangling, and exception handling.
3086 # Darwin uses the -arch flag to determine output architecture.
3087 -model|-arch|-isysroot)
3088 compiler_flags="$compiler_flags $arg"
3089 func_append compile_command " $arg"
3090 func_append finalize_command " $arg"
3091 prev=xcompiler
3092 continue
3095 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3096 compiler_flags="$compiler_flags $arg"
3097 func_append compile_command " $arg"
3098 func_append finalize_command " $arg"
3099 case "$new_inherited_linker_flags " in
3100 *" $arg "*) ;;
3101 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
3102 esac
3103 continue
3106 -multi_module)
3107 single_module="${wl}-multi_module"
3108 continue
3111 -no-fast-install)
3112 fast_install=no
3113 continue
3116 -no-install)
3117 case $host in
3118 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3119 # The PATH hackery in wrapper scripts is required on Windows
3120 # in order for the loader to find any dlls it needs.
3121 func_warning "\`-no-install' is ignored for $host"
3122 func_warning "assuming \`-no-fast-install' instead"
3123 fast_install=no
3125 *) no_install=yes ;;
3126 esac
3127 continue
3130 -no-undefined)
3131 allow_undefined=no
3132 continue
3135 -objectlist)
3136 prev=objectlist
3137 continue
3140 -o) prev=output ;;
3142 -precious-files-regex)
3143 prev=precious_regex
3144 continue
3147 -release)
3148 prev=release
3149 continue
3152 -rpath)
3153 prev=rpath
3154 continue
3158 prev=xrpath
3159 continue
3162 -R*)
3163 func_stripname '-R' '' "$arg"
3164 dir=$func_stripname_result
3165 # We need an absolute path.
3166 case $dir in
3167 [\\/]* | [A-Za-z]:[\\/]*) ;;
3169 func_fatal_error "only absolute run-paths are allowed"
3171 esac
3172 case "$xrpath " in
3173 *" $dir "*) ;;
3174 *) xrpath="$xrpath $dir" ;;
3175 esac
3176 continue
3179 -shared)
3180 # The effects of -shared are defined in a previous loop.
3181 continue
3184 -shrext)
3185 prev=shrext
3186 continue
3189 -static | -static-libtool-libs)
3190 # The effects of -static are defined in a previous loop.
3191 # We used to do the same as -all-static on platforms that
3192 # didn't have a PIC flag, but the assumption that the effects
3193 # would be equivalent was wrong. It would break on at least
3194 # Digital Unix and AIX.
3195 continue
3198 -thread-safe)
3199 thread_safe=yes
3200 continue
3203 -version-info)
3204 prev=vinfo
3205 continue
3208 -version-number)
3209 prev=vinfo
3210 vinfo_number=yes
3211 continue
3214 -weak)
3215 prev=weak
3216 continue
3219 -Wc,*)
3220 func_stripname '-Wc,' '' "$arg"
3221 args=$func_stripname_result
3222 arg=
3223 save_ifs="$IFS"; IFS=','
3224 for flag in $args; do
3225 IFS="$save_ifs"
3226 func_quote_for_eval "$flag"
3227 arg="$arg $wl$func_quote_for_eval_result"
3228 compiler_flags="$compiler_flags $func_quote_for_eval_result"
3229 done
3230 IFS="$save_ifs"
3231 func_stripname ' ' '' "$arg"
3232 arg=$func_stripname_result
3235 -Wl,*)
3236 func_stripname '-Wl,' '' "$arg"
3237 args=$func_stripname_result
3238 arg=
3239 save_ifs="$IFS"; IFS=','
3240 for flag in $args; do
3241 IFS="$save_ifs"
3242 func_quote_for_eval "$flag"
3243 arg="$arg $wl$func_quote_for_eval_result"
3244 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
3245 linker_flags="$linker_flags $func_quote_for_eval_result"
3246 done
3247 IFS="$save_ifs"
3248 func_stripname ' ' '' "$arg"
3249 arg=$func_stripname_result
3252 -Xcompiler)
3253 prev=xcompiler
3254 continue
3257 -Xlinker)
3258 prev=xlinker
3259 continue
3262 -XCClinker)
3263 prev=xcclinker
3264 continue
3267 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
3268 # -r[0-9][0-9]* specifies the processor on the SGI compiler
3269 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
3270 # +DA*, +DD* enable 64-bit mode on the HP compiler
3271 # -q* pass through compiler args for the IBM compiler
3272 # -m*, -t[45]*, -txscale* pass through architecture-specific
3273 # compiler args for GCC
3274 # @file GCC response files
3275 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
3276 -t[45]*|-txscale*|@*)
3277 func_quote_for_eval "$arg"
3278 arg="$func_quote_for_eval_result"
3279 func_append compile_command " $arg"
3280 func_append finalize_command " $arg"
3281 compiler_flags="$compiler_flags $arg"
3282 continue
3285 # Some other compiler flag.
3286 -* | +*)
3287 func_quote_for_eval "$arg"
3288 arg="$func_quote_for_eval_result"
3291 *.$objext)
3292 # A standard object.
3293 objs="$objs $arg"
3296 *.lo)
3297 # A libtool-controlled object.
3299 # Check to see that this really is a libtool object.
3300 if func_lalib_unsafe_p "$arg"; then
3301 pic_object=
3302 non_pic_object=
3304 # Read the .lo file
3305 func_source "$arg"
3307 if test -z "$pic_object" ||
3308 test -z "$non_pic_object" ||
3309 test "$pic_object" = none &&
3310 test "$non_pic_object" = none; then
3311 func_fatal_error "cannot find name of object for \`$arg'"
3314 # Extract subdirectory from the argument.
3315 func_dirname "$arg" "/" ""
3316 xdir="$func_dirname_result"
3318 if test "$pic_object" != none; then
3319 # Prepend the subdirectory the object is found in.
3320 pic_object="$xdir$pic_object"
3322 if test "$prev" = dlfiles; then
3323 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
3324 dlfiles="$dlfiles $pic_object"
3325 prev=
3326 continue
3327 else
3328 # If libtool objects are unsupported, then we need to preload.
3329 prev=dlprefiles
3333 # CHECK ME: I think I busted this. -Ossama
3334 if test "$prev" = dlprefiles; then
3335 # Preload the old-style object.
3336 dlprefiles="$dlprefiles $pic_object"
3337 prev=
3340 # A PIC object.
3341 func_append libobjs " $pic_object"
3342 arg="$pic_object"
3345 # Non-PIC object.
3346 if test "$non_pic_object" != none; then
3347 # Prepend the subdirectory the object is found in.
3348 non_pic_object="$xdir$non_pic_object"
3350 # A standard non-PIC object
3351 func_append non_pic_objects " $non_pic_object"
3352 if test -z "$pic_object" || test "$pic_object" = none ; then
3353 arg="$non_pic_object"
3355 else
3356 # If the PIC object exists, use it instead.
3357 # $xdir was prepended to $pic_object above.
3358 non_pic_object="$pic_object"
3359 func_append non_pic_objects " $non_pic_object"
3361 else
3362 # Only an error if not doing a dry-run.
3363 if $opt_dry_run; then
3364 # Extract subdirectory from the argument.
3365 func_dirname "$arg" "/" ""
3366 xdir="$func_dirname_result"
3368 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
3369 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
3370 func_append libobjs " $pic_object"
3371 func_append non_pic_objects " $non_pic_object"
3372 else
3373 func_fatal_error "\`$arg' is not a valid libtool object"
3378 *.$libext)
3379 # An archive.
3380 deplibs="$deplibs $arg"
3381 old_deplibs="$old_deplibs $arg"
3382 continue
3385 *.la)
3386 # A libtool-controlled library.
3388 if test "$prev" = dlfiles; then
3389 # This library was specified with -dlopen.
3390 dlfiles="$dlfiles $arg"
3391 prev=
3392 elif test "$prev" = dlprefiles; then
3393 # The library was specified with -dlpreopen.
3394 dlprefiles="$dlprefiles $arg"
3395 prev=
3396 else
3397 deplibs="$deplibs $arg"
3399 continue
3402 # Some other compiler argument.
3404 # Unknown arguments in both finalize_command and compile_command need
3405 # to be aesthetically quoted because they are evaled later.
3406 func_quote_for_eval "$arg"
3407 arg="$func_quote_for_eval_result"
3409 esac # arg
3411 # Now actually substitute the argument into the commands.
3412 if test -n "$arg"; then
3413 func_append compile_command " $arg"
3414 func_append finalize_command " $arg"
3416 done # argument parsing loop
3418 test -n "$prev" && \
3419 func_fatal_help "the \`$prevarg' option requires an argument"
3421 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
3422 eval arg=\"$export_dynamic_flag_spec\"
3423 func_append compile_command " $arg"
3424 func_append finalize_command " $arg"
3427 oldlibs=
3428 # calculate the name of the file, without its directory
3429 func_basename "$output"
3430 outputname="$func_basename_result"
3431 libobjs_save="$libobjs"
3433 if test -n "$shlibpath_var"; then
3434 # get the directories listed in $shlibpath_var
3435 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
3436 else
3437 shlib_search_path=
3439 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
3440 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
3442 func_dirname "$output" "/" ""
3443 output_objdir="$func_dirname_result$objdir"
3444 # Create the object directory.
3445 func_mkdir_p "$output_objdir"
3447 # Determine the type of output
3448 case $output in
3450 func_fatal_help "you must specify an output file"
3452 *.$libext) linkmode=oldlib ;;
3453 *.lo | *.$objext) linkmode=obj ;;
3454 *.la) linkmode=lib ;;
3455 *) linkmode=prog ;; # Anything else should be a program.
3456 esac
3458 specialdeplibs=
3460 libs=
3461 # Find all interdependent deplibs by searching for libraries
3462 # that are linked more than once (e.g. -la -lb -la)
3463 for deplib in $deplibs; do
3464 if $opt_duplicate_deps ; then
3465 case "$libs " in
3466 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3467 esac
3469 libs="$libs $deplib"
3470 done
3472 if test "$linkmode" = lib; then
3473 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3475 # Compute libraries that are listed more than once in $predeps
3476 # $postdeps and mark them as special (i.e., whose duplicates are
3477 # not to be eliminated).
3478 pre_post_deps=
3479 if $opt_duplicate_compiler_generated_deps; then
3480 for pre_post_dep in $predeps $postdeps; do
3481 case "$pre_post_deps " in
3482 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3483 esac
3484 pre_post_deps="$pre_post_deps $pre_post_dep"
3485 done
3487 pre_post_deps=
3490 deplibs=
3491 newdependency_libs=
3492 newlib_search_path=
3493 need_relink=no # whether we're linking any uninstalled libtool libraries
3494 notinst_deplibs= # not-installed libtool libraries
3495 notinst_path= # paths that contain not-installed libtool libraries
3497 case $linkmode in
3498 lib)
3499 passes="conv dlpreopen link"
3500 for file in $dlfiles $dlprefiles; do
3501 case $file in
3502 *.la) ;;
3504 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3506 esac
3507 done
3509 prog)
3510 compile_deplibs=
3511 finalize_deplibs=
3512 alldeplibs=no
3513 newdlfiles=
3514 newdlprefiles=
3515 passes="conv scan dlopen dlpreopen link"
3517 *) passes="conv"
3519 esac
3521 for pass in $passes; do
3522 # The preopen pass in lib mode reverses $deplibs; put it back here
3523 # so that -L comes before libs that need it for instance...
3524 if test "$linkmode,$pass" = "lib,link"; then
3525 ## FIXME: Find the place where the list is rebuilt in the wrong
3526 ## order, and fix it there properly
3527 tmp_deplibs=
3528 for deplib in $deplibs; do
3529 tmp_deplibs="$deplib $tmp_deplibs"
3530 done
3531 deplibs="$tmp_deplibs"
3534 if test "$linkmode,$pass" = "lib,link" ||
3535 test "$linkmode,$pass" = "prog,scan"; then
3536 libs="$deplibs"
3537 deplibs=
3539 if test "$linkmode" = prog; then
3540 case $pass in
3541 dlopen) libs="$dlfiles" ;;
3542 dlpreopen) libs="$dlprefiles" ;;
3543 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
3544 esac
3546 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3547 # Collect and forward deplibs of preopened libtool libs
3548 for lib in $dlprefiles; do
3549 # Ignore non-libtool-libs
3550 dependency_libs=
3551 case $lib in
3552 *.la) func_source "$lib" ;;
3553 esac
3555 # Collect preopened libtool deplibs, except any this library
3556 # has declared as weak libs
3557 for deplib in $dependency_libs; do
3558 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3559 case " $weak_libs " in
3560 *" $deplib_base "*) ;;
3561 *) deplibs="$deplibs $deplib" ;;
3562 esac
3563 done
3564 done
3565 libs="$dlprefiles"
3567 if test "$pass" = dlopen; then
3568 # Collect dlpreopened libraries
3569 save_deplibs="$deplibs"
3570 deplibs=
3573 for deplib in $libs; do
3574 lib=
3575 found=no
3576 case $deplib in
3577 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
3578 if test "$linkmode,$pass" = "prog,link"; then
3579 compile_deplibs="$deplib $compile_deplibs"
3580 finalize_deplibs="$deplib $finalize_deplibs"
3581 else
3582 compiler_flags="$compiler_flags $deplib"
3583 if test "$linkmode" = lib ; then
3584 case "$new_inherited_linker_flags " in
3585 *" $deplib "*) ;;
3586 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3587 esac
3590 continue
3592 -l*)
3593 if test "$linkmode" != lib && test "$linkmode" != prog; then
3594 func_warning "\`-l' is ignored for archives/objects"
3595 continue
3597 func_stripname '-l' '' "$deplib"
3598 name=$func_stripname_result
3599 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3600 for search_ext in .la $std_shrext .so .a; do
3601 # Search the libtool library
3602 lib="$searchdir/lib${name}${search_ext}"
3603 if test -f "$lib"; then
3604 if test "$search_ext" = ".la"; then
3605 found=yes
3606 else
3607 found=no
3609 break 2
3611 done
3612 done
3613 if test "$found" != yes; then
3614 # deplib doesn't seem to be a libtool library
3615 if test "$linkmode,$pass" = "prog,link"; then
3616 compile_deplibs="$deplib $compile_deplibs"
3617 finalize_deplibs="$deplib $finalize_deplibs"
3618 else
3619 deplibs="$deplib $deplibs"
3620 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3622 continue
3623 else # deplib is a libtool library
3624 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3625 # We need to do some special things here, and not later.
3626 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3627 case " $predeps $postdeps " in
3628 *" $deplib "*)
3629 if func_lalib_p "$lib"; then
3630 library_names=
3631 old_library=
3632 func_source "$lib"
3633 for l in $old_library $library_names; do
3634 ll="$l"
3635 done
3636 if test "X$ll" = "X$old_library" ; then # only static version available
3637 found=no
3638 func_dirname "$lib" "" "."
3639 ladir="$func_dirname_result"
3640 lib=$ladir/$old_library
3641 if test "$linkmode,$pass" = "prog,link"; then
3642 compile_deplibs="$deplib $compile_deplibs"
3643 finalize_deplibs="$deplib $finalize_deplibs"
3644 else
3645 deplibs="$deplib $deplibs"
3646 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3648 continue
3652 *) ;;
3653 esac
3656 ;; # -l
3657 *.ltframework)
3658 if test "$linkmode,$pass" = "prog,link"; then
3659 compile_deplibs="$deplib $compile_deplibs"
3660 finalize_deplibs="$deplib $finalize_deplibs"
3661 else
3662 deplibs="$deplib $deplibs"
3663 if test "$linkmode" = lib ; then
3664 case "$new_inherited_linker_flags " in
3665 *" $deplib "*) ;;
3666 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3667 esac
3670 continue
3672 -L*)
3673 case $linkmode in
3674 lib)
3675 deplibs="$deplib $deplibs"
3676 test "$pass" = conv && continue
3677 newdependency_libs="$deplib $newdependency_libs"
3678 func_stripname '-L' '' "$deplib"
3679 newlib_search_path="$newlib_search_path $func_stripname_result"
3681 prog)
3682 if test "$pass" = conv; then
3683 deplibs="$deplib $deplibs"
3684 continue
3686 if test "$pass" = scan; then
3687 deplibs="$deplib $deplibs"
3688 else
3689 compile_deplibs="$deplib $compile_deplibs"
3690 finalize_deplibs="$deplib $finalize_deplibs"
3692 func_stripname '-L' '' "$deplib"
3693 newlib_search_path="$newlib_search_path $func_stripname_result"
3696 func_warning "\`-L' is ignored for archives/objects"
3698 esac # linkmode
3699 continue
3700 ;; # -L
3701 -R*)
3702 if test "$pass" = link; then
3703 func_stripname '-R' '' "$deplib"
3704 dir=$func_stripname_result
3705 # Make sure the xrpath contains only unique directories.
3706 case "$xrpath " in
3707 *" $dir "*) ;;
3708 *) xrpath="$xrpath $dir" ;;
3709 esac
3711 deplibs="$deplib $deplibs"
3712 continue
3714 *.la) lib="$deplib" ;;
3715 *.$libext)
3716 if test "$pass" = conv; then
3717 deplibs="$deplib $deplibs"
3718 continue
3720 case $linkmode in
3721 lib)
3722 # Linking convenience modules into shared libraries is allowed,
3723 # but linking other static libraries is non-portable.
3724 case " $dlpreconveniencelibs " in
3725 *" $lib "*) ;;
3727 valid_a_lib=no
3728 case $deplibs_check_method in
3729 match_pattern*)
3730 set dummy $deplibs_check_method; shift
3731 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3732 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3733 | $EGREP "$match_pattern_regex" > /dev/null; then
3734 valid_a_lib=yes
3737 pass_all)
3738 valid_a_lib=yes
3740 esac
3741 if test "$valid_a_lib" != yes; then
3742 $ECHO
3743 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3744 $ECHO "*** I have the capability to make that library automatically link in when"
3745 $ECHO "*** you link to this library. But I can only do this if you have a"
3746 $ECHO "*** shared version of the library, which you do not appear to have"
3747 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3748 $ECHO "*** that it is just a static archive that I should not use here."
3749 else
3750 $ECHO
3751 $ECHO "*** Warning: Linking the shared library $output against the"
3752 $ECHO "*** static library $deplib is not portable!"
3753 deplibs="$deplib $deplibs"
3756 esac
3757 continue
3759 prog)
3760 if test "$pass" != link; then
3761 deplibs="$deplib $deplibs"
3762 else
3763 compile_deplibs="$deplib $compile_deplibs"
3764 finalize_deplibs="$deplib $finalize_deplibs"
3766 continue
3768 esac # linkmode
3769 ;; # *.$libext
3770 *.lo | *.$objext)
3771 if test "$pass" = conv; then
3772 deplibs="$deplib $deplibs"
3773 elif test "$linkmode" = prog; then
3774 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3775 # If there is no dlopen support or we're linking statically,
3776 # we need to preload.
3777 newdlprefiles="$newdlprefiles $deplib"
3778 compile_deplibs="$deplib $compile_deplibs"
3779 finalize_deplibs="$deplib $finalize_deplibs"
3780 else
3781 newdlfiles="$newdlfiles $deplib"
3784 continue
3786 %DEPLIBS%)
3787 alldeplibs=yes
3788 continue
3790 esac # case $deplib
3792 if test "$found" = yes || test -f "$lib"; then :
3793 else
3794 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3797 # Check to see that this really is a libtool archive.
3798 func_lalib_unsafe_p "$lib" \
3799 || func_fatal_error "\`$lib' is not a valid libtool archive"
3801 func_dirname "$lib" "" "."
3802 ladir="$func_dirname_result"
3804 dlname=
3805 dlopen=
3806 dlpreopen=
3807 libdir=
3808 library_names=
3809 old_library=
3810 inherited_linker_flags=
3811 # If the library was installed with an old release of libtool,
3812 # it will not redefine variables installed, or shouldnotlink
3813 installed=yes
3814 shouldnotlink=no
3815 avoidtemprpath=
3818 # Read the .la file
3819 func_source "$lib"
3821 # Convert "-framework foo" to "foo.ltframework"
3822 if test -n "$inherited_linker_flags"; then
3823 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
3824 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3825 case " $new_inherited_linker_flags " in
3826 *" $tmp_inherited_linker_flag "*) ;;
3827 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3828 esac
3829 done
3831 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3832 if test "$linkmode,$pass" = "prog,link"; then
3833 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3834 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3835 else
3836 compiler_flags="$compiler_flags $inherited_linker_flags"
3838 if test "$linkmode,$pass" = "lib,link" ||
3839 test "$linkmode,$pass" = "prog,scan" ||
3840 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3841 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3842 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3845 if test "$pass" = conv; then
3846 # Only check for convenience libraries
3847 deplibs="$lib $deplibs"
3848 if test -z "$libdir"; then
3849 if test -z "$old_library"; then
3850 func_fatal_error "cannot find name of link library for \`$lib'"
3852 # It is a libtool convenience library, so add in its objects.
3853 convenience="$convenience $ladir/$objdir/$old_library"
3854 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3855 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3856 func_fatal_error "\`$lib' is not a convenience library"
3858 tmp_libs=
3859 for deplib in $dependency_libs; do
3860 deplibs="$deplib $deplibs"
3861 if $opt_duplicate_deps ; then
3862 case "$tmp_libs " in
3863 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3864 esac
3866 tmp_libs="$tmp_libs $deplib"
3867 done
3868 continue
3869 fi # $pass = conv
3872 # Get the name of the library we link against.
3873 linklib=
3874 for l in $old_library $library_names; do
3875 linklib="$l"
3876 done
3877 if test -z "$linklib"; then
3878 func_fatal_error "cannot find name of link library for \`$lib'"
3881 # This library was specified with -dlopen.
3882 if test "$pass" = dlopen; then
3883 if test -z "$libdir"; then
3884 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3886 if test -z "$dlname" ||
3887 test "$dlopen_support" != yes ||
3888 test "$build_libtool_libs" = no; then
3889 # If there is no dlname, no dlopen support or we're linking
3890 # statically, we need to preload. We also need to preload any
3891 # dependent libraries so libltdl's deplib preloader doesn't
3892 # bomb out in the load deplibs phase.
3893 dlprefiles="$dlprefiles $lib $dependency_libs"
3894 else
3895 newdlfiles="$newdlfiles $lib"
3897 continue
3898 fi # $pass = dlopen
3900 # We need an absolute path.
3901 case $ladir in
3902 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
3904 abs_ladir=`cd "$ladir" && pwd`
3905 if test -z "$abs_ladir"; then
3906 func_warning "cannot determine absolute directory name of \`$ladir'"
3907 func_warning "passing it literally to the linker, although it might fail"
3908 abs_ladir="$ladir"
3911 esac
3912 func_basename "$lib"
3913 laname="$func_basename_result"
3915 # Find the relevant object directory and library name.
3916 if test "X$installed" = Xyes; then
3917 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3918 func_warning "library \`$lib' was moved."
3919 dir="$ladir"
3920 absdir="$abs_ladir"
3921 libdir="$abs_ladir"
3922 else
3923 dir="$libdir"
3924 absdir="$libdir"
3926 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3927 else
3928 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3929 dir="$ladir"
3930 absdir="$abs_ladir"
3931 # Remove this search path later
3932 notinst_path="$notinst_path $abs_ladir"
3933 else
3934 dir="$ladir/$objdir"
3935 absdir="$abs_ladir/$objdir"
3936 # Remove this search path later
3937 notinst_path="$notinst_path $abs_ladir"
3939 fi # $installed = yes
3940 func_stripname 'lib' '.la' "$laname"
3941 name=$func_stripname_result
3943 # This library was specified with -dlpreopen.
3944 if test "$pass" = dlpreopen; then
3945 if test -z "$libdir" && test "$linkmode" = prog; then
3946 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3948 # Prefer using a static library (so that no silly _DYNAMIC symbols
3949 # are required to link).
3950 if test -n "$old_library"; then
3951 newdlprefiles="$newdlprefiles $dir/$old_library"
3952 # Keep a list of preopened convenience libraries to check
3953 # that they are being used correctly in the link pass.
3954 test -z "$libdir" && \
3955 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3956 # Otherwise, use the dlname, so that lt_dlopen finds it.
3957 elif test -n "$dlname"; then
3958 newdlprefiles="$newdlprefiles $dir/$dlname"
3959 else
3960 newdlprefiles="$newdlprefiles $dir/$linklib"
3962 fi # $pass = dlpreopen
3964 if test -z "$libdir"; then
3965 # Link the convenience library
3966 if test "$linkmode" = lib; then
3967 deplibs="$dir/$old_library $deplibs"
3968 elif test "$linkmode,$pass" = "prog,link"; then
3969 compile_deplibs="$dir/$old_library $compile_deplibs"
3970 finalize_deplibs="$dir/$old_library $finalize_deplibs"
3971 else
3972 deplibs="$lib $deplibs" # used for prog,scan pass
3974 continue
3978 if test "$linkmode" = prog && test "$pass" != link; then
3979 newlib_search_path="$newlib_search_path $ladir"
3980 deplibs="$lib $deplibs"
3982 linkalldeplibs=no
3983 if test "$link_all_deplibs" != no || test -z "$library_names" ||
3984 test "$build_libtool_libs" = no; then
3985 linkalldeplibs=yes
3988 tmp_libs=
3989 for deplib in $dependency_libs; do
3990 case $deplib in
3991 -L*) func_stripname '-L' '' "$deplib"
3992 newlib_search_path="$newlib_search_path $func_stripname_result"
3994 esac
3995 # Need to link against all dependency_libs?
3996 if test "$linkalldeplibs" = yes; then
3997 deplibs="$deplib $deplibs"
3998 else
3999 # Need to hardcode shared library paths
4000 # or/and link against static libraries
4001 newdependency_libs="$deplib $newdependency_libs"
4003 if $opt_duplicate_deps ; then
4004 case "$tmp_libs " in
4005 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4006 esac
4008 tmp_libs="$tmp_libs $deplib"
4009 done # for deplib
4010 continue
4011 fi # $linkmode = prog...
4013 if test "$linkmode,$pass" = "prog,link"; then
4014 if test -n "$library_names" &&
4015 { { test "$prefer_static_libs" = no ||
4016 test "$prefer_static_libs,$installed" = "built,yes"; } ||
4017 test -z "$old_library"; }; then
4018 # We need to hardcode the library path
4019 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
4020 # Make sure the rpath contains only unique directories.
4021 case "$temp_rpath:" in
4022 *"$absdir:"*) ;;
4023 *) temp_rpath="$temp_rpath$absdir:" ;;
4024 esac
4027 # Hardcode the library path.
4028 # Skip directories that are in the system default run-time
4029 # search path.
4030 case " $sys_lib_dlsearch_path " in
4031 *" $absdir "*) ;;
4033 case "$compile_rpath " in
4034 *" $absdir "*) ;;
4035 *) compile_rpath="$compile_rpath $absdir"
4036 esac
4038 esac
4039 case " $sys_lib_dlsearch_path " in
4040 *" $libdir "*) ;;
4042 case "$finalize_rpath " in
4043 *" $libdir "*) ;;
4044 *) finalize_rpath="$finalize_rpath $libdir"
4045 esac
4047 esac
4048 fi # $linkmode,$pass = prog,link...
4050 if test "$alldeplibs" = yes &&
4051 { test "$deplibs_check_method" = pass_all ||
4052 { test "$build_libtool_libs" = yes &&
4053 test -n "$library_names"; }; }; then
4054 # We only need to search for static libraries
4055 continue
4059 link_static=no # Whether the deplib will be linked statically
4060 use_static_libs=$prefer_static_libs
4061 if test "$use_static_libs" = built && test "$installed" = yes; then
4062 use_static_libs=no
4064 if test -n "$library_names" &&
4065 { test "$use_static_libs" = no || test -z "$old_library"; }; then
4066 case $host in
4067 *cygwin* | *mingw*)
4068 # No point in relinking DLLs because paths are not encoded
4069 notinst_deplibs="$notinst_deplibs $lib"
4070 need_relink=no
4073 if test "$installed" = no; then
4074 notinst_deplibs="$notinst_deplibs $lib"
4075 need_relink=yes
4078 esac
4079 # This is a shared library
4081 # Warn about portability, can't link against -module's on some
4082 # systems (darwin). Don't bleat about dlopened modules though!
4083 dlopenmodule=""
4084 for dlpremoduletest in $dlprefiles; do
4085 if test "X$dlpremoduletest" = "X$lib"; then
4086 dlopenmodule="$dlpremoduletest"
4087 break
4089 done
4090 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
4091 $ECHO
4092 if test "$linkmode" = prog; then
4093 $ECHO "*** Warning: Linking the executable $output against the loadable module"
4094 else
4095 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
4097 $ECHO "*** $linklib is not portable!"
4099 if test "$linkmode" = lib &&
4100 test "$hardcode_into_libs" = yes; then
4101 # Hardcode the library path.
4102 # Skip directories that are in the system default run-time
4103 # search path.
4104 case " $sys_lib_dlsearch_path " in
4105 *" $absdir "*) ;;
4107 case "$compile_rpath " in
4108 *" $absdir "*) ;;
4109 *) compile_rpath="$compile_rpath $absdir"
4110 esac
4112 esac
4113 case " $sys_lib_dlsearch_path " in
4114 *" $libdir "*) ;;
4116 case "$finalize_rpath " in
4117 *" $libdir "*) ;;
4118 *) finalize_rpath="$finalize_rpath $libdir"
4119 esac
4121 esac
4124 if test -n "$old_archive_from_expsyms_cmds"; then
4125 # figure out the soname
4126 set dummy $library_names
4127 shift
4128 realname="$1"
4129 shift
4130 libname=`eval "\\$ECHO \"$libname_spec\""`
4131 # use dlname if we got it. it's perfectly good, no?
4132 if test -n "$dlname"; then
4133 soname="$dlname"
4134 elif test -n "$soname_spec"; then
4135 # bleh windows
4136 case $host in
4137 *cygwin* | mingw*)
4138 major=`expr $current - $age`
4139 versuffix="-$major"
4141 esac
4142 eval soname=\"$soname_spec\"
4143 else
4144 soname="$realname"
4147 # Make a new name for the extract_expsyms_cmds to use
4148 soroot="$soname"
4149 func_basename "$soroot"
4150 soname="$func_basename_result"
4151 func_stripname 'lib' '.dll' "$soname"
4152 newlib=libimp-$func_stripname_result.a
4154 # If the library has no export list, then create one now
4155 if test -f "$output_objdir/$soname-def"; then :
4156 else
4157 func_echo "extracting exported symbol list from \`$soname'"
4158 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
4161 # Create $newlib
4162 if test -f "$output_objdir/$newlib"; then :; else
4163 func_echo "generating import library for \`$soname'"
4164 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
4166 # make sure the library variables are pointing to the new library
4167 dir=$output_objdir
4168 linklib=$newlib
4169 fi # test -n "$old_archive_from_expsyms_cmds"
4171 if test "$linkmode" = prog || test "$mode" != relink; then
4172 add_shlibpath=
4173 add_dir=
4174 add=
4175 lib_linked=yes
4176 case $hardcode_action in
4177 immediate | unsupported)
4178 if test "$hardcode_direct" = no; then
4179 add="$dir/$linklib"
4180 case $host in
4181 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
4182 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
4183 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
4184 *-*-unixware7*) add_dir="-L$dir" ;;
4185 *-*-darwin* )
4186 # if the lib is a (non-dlopened) module then we can not
4187 # link against it, someone is ignoring the earlier warnings
4188 if /usr/bin/file -L $add 2> /dev/null |
4189 $GREP ": [^:]* bundle" >/dev/null ; then
4190 if test "X$dlopenmodule" != "X$lib"; then
4191 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
4192 if test -z "$old_library" ; then
4193 $ECHO
4194 $ECHO "*** And there doesn't seem to be a static archive available"
4195 $ECHO "*** The link will probably fail, sorry"
4196 else
4197 add="$dir/$old_library"
4199 elif test -n "$old_library"; then
4200 add="$dir/$old_library"
4203 esac
4204 elif test "$hardcode_minus_L" = no; then
4205 case $host in
4206 *-*-sunos*) add_shlibpath="$dir" ;;
4207 esac
4208 add_dir="-L$dir"
4209 add="-l$name"
4210 elif test "$hardcode_shlibpath_var" = no; then
4211 add_shlibpath="$dir"
4212 add="-l$name"
4213 else
4214 lib_linked=no
4217 relink)
4218 if test "$hardcode_direct" = yes &&
4219 test "$hardcode_direct_absolute" = no; then
4220 add="$dir/$linklib"
4221 elif test "$hardcode_minus_L" = yes; then
4222 add_dir="-L$dir"
4223 # Try looking first in the location we're being installed to.
4224 if test -n "$inst_prefix_dir"; then
4225 case $libdir in
4226 [\\/]*)
4227 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4229 esac
4231 add="-l$name"
4232 elif test "$hardcode_shlibpath_var" = yes; then
4233 add_shlibpath="$dir"
4234 add="-l$name"
4235 else
4236 lib_linked=no
4239 *) lib_linked=no ;;
4240 esac
4242 if test "$lib_linked" != yes; then
4243 func_fatal_configuration "unsupported hardcode properties"
4246 if test -n "$add_shlibpath"; then
4247 case :$compile_shlibpath: in
4248 *":$add_shlibpath:"*) ;;
4249 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
4250 esac
4252 if test "$linkmode" = prog; then
4253 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
4254 test -n "$add" && compile_deplibs="$add $compile_deplibs"
4255 else
4256 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4257 test -n "$add" && deplibs="$add $deplibs"
4258 if test "$hardcode_direct" != yes &&
4259 test "$hardcode_minus_L" != yes &&
4260 test "$hardcode_shlibpath_var" = yes; then
4261 case :$finalize_shlibpath: in
4262 *":$libdir:"*) ;;
4263 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4264 esac
4269 if test "$linkmode" = prog || test "$mode" = relink; then
4270 add_shlibpath=
4271 add_dir=
4272 add=
4273 # Finalize command for both is simple: just hardcode it.
4274 if test "$hardcode_direct" = yes &&
4275 test "$hardcode_direct_absolute" = no; then
4276 add="$libdir/$linklib"
4277 elif test "$hardcode_minus_L" = yes; then
4278 add_dir="-L$libdir"
4279 add="-l$name"
4280 elif test "$hardcode_shlibpath_var" = yes; then
4281 case :$finalize_shlibpath: in
4282 *":$libdir:"*) ;;
4283 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
4284 esac
4285 add="-l$name"
4286 elif test "$hardcode_automatic" = yes; then
4287 if test -n "$inst_prefix_dir" &&
4288 test -f "$inst_prefix_dir$libdir/$linklib" ; then
4289 add="$inst_prefix_dir$libdir/$linklib"
4290 else
4291 add="$libdir/$linklib"
4293 else
4294 # We cannot seem to hardcode it, guess we'll fake it.
4295 add_dir="-L$libdir"
4296 # Try looking first in the location we're being installed to.
4297 if test -n "$inst_prefix_dir"; then
4298 case $libdir in
4299 [\\/]*)
4300 add_dir="$add_dir -L$inst_prefix_dir$libdir"
4302 esac
4304 add="-l$name"
4307 if test "$linkmode" = prog; then
4308 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
4309 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
4310 else
4311 test -n "$add_dir" && deplibs="$add_dir $deplibs"
4312 test -n "$add" && deplibs="$add $deplibs"
4315 elif test "$linkmode" = prog; then
4316 # Here we assume that one of hardcode_direct or hardcode_minus_L
4317 # is not unsupported. This is valid on all known static and
4318 # shared platforms.
4319 if test "$hardcode_direct" != unsupported; then
4320 test -n "$old_library" && linklib="$old_library"
4321 compile_deplibs="$dir/$linklib $compile_deplibs"
4322 finalize_deplibs="$dir/$linklib $finalize_deplibs"
4323 else
4324 compile_deplibs="-l$name -L$dir $compile_deplibs"
4325 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
4327 elif test "$build_libtool_libs" = yes; then
4328 # Not a shared library
4329 if test "$deplibs_check_method" != pass_all; then
4330 # We're trying link a shared library against a static one
4331 # but the system doesn't support it.
4333 # Just print a warning and add the library to dependency_libs so
4334 # that the program can be linked against the static library.
4335 $ECHO
4336 $ECHO "*** Warning: This system can not link to static lib archive $lib."
4337 $ECHO "*** I have the capability to make that library automatically link in when"
4338 $ECHO "*** you link to this library. But I can only do this if you have a"
4339 $ECHO "*** shared version of the library, which you do not appear to have."
4340 if test "$module" = yes; then
4341 $ECHO "*** But as you try to build a module library, libtool will still create "
4342 $ECHO "*** a static module, that should work as long as the dlopening application"
4343 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
4344 if test -z "$global_symbol_pipe"; then
4345 $ECHO
4346 $ECHO "*** However, this would only work if libtool was able to extract symbol"
4347 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
4348 $ECHO "*** not find such a program. So, this module is probably useless."
4349 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
4351 if test "$build_old_libs" = no; then
4352 build_libtool_libs=module
4353 build_old_libs=yes
4354 else
4355 build_libtool_libs=no
4358 else
4359 deplibs="$dir/$old_library $deplibs"
4360 link_static=yes
4362 fi # link shared/static library?
4364 if test "$linkmode" = lib; then
4365 if test -n "$dependency_libs" &&
4366 { test "$hardcode_into_libs" != yes ||
4367 test "$build_old_libs" = yes ||
4368 test "$link_static" = yes; }; then
4369 # Extract -R from dependency_libs
4370 temp_deplibs=
4371 for libdir in $dependency_libs; do
4372 case $libdir in
4373 -R*) func_stripname '-R' '' "$libdir"
4374 temp_xrpath=$func_stripname_result
4375 case " $xrpath " in
4376 *" $temp_xrpath "*) ;;
4377 *) xrpath="$xrpath $temp_xrpath";;
4378 esac;;
4379 *) temp_deplibs="$temp_deplibs $libdir";;
4380 esac
4381 done
4382 dependency_libs="$temp_deplibs"
4385 newlib_search_path="$newlib_search_path $absdir"
4386 # Link against this library
4387 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
4388 # ... and its dependency_libs
4389 tmp_libs=
4390 for deplib in $dependency_libs; do
4391 newdependency_libs="$deplib $newdependency_libs"
4392 if $opt_duplicate_deps ; then
4393 case "$tmp_libs " in
4394 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
4395 esac
4397 tmp_libs="$tmp_libs $deplib"
4398 done
4400 if test "$link_all_deplibs" != no; then
4401 # Add the search paths of all dependency libraries
4402 for deplib in $dependency_libs; do
4403 case $deplib in
4404 -L*) path="$deplib" ;;
4405 *.la)
4406 func_dirname "$deplib" "" "."
4407 dir="$func_dirname_result"
4408 # We need an absolute path.
4409 case $dir in
4410 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
4412 absdir=`cd "$dir" && pwd`
4413 if test -z "$absdir"; then
4414 func_warning "cannot determine absolute directory name of \`$dir'"
4415 absdir="$dir"
4418 esac
4419 if $GREP "^installed=no" $deplib > /dev/null; then
4420 case $host in
4421 *-*-darwin*)
4422 depdepl=
4423 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
4424 if test -n "$deplibrary_names" ; then
4425 for tmp in $deplibrary_names ; do
4426 depdepl=$tmp
4427 done
4428 if test -f "$absdir/$objdir/$depdepl" ; then
4429 depdepl="$absdir/$objdir/$depdepl"
4430 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
4431 darwin_install_name=`$ECHO $darwin_install_name`
4432 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
4433 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
4434 path=
4439 path="-L$absdir/$objdir"
4441 esac
4442 else
4443 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4444 test -z "$libdir" && \
4445 func_fatal_error "\`$deplib' is not a valid libtool archive"
4446 test "$absdir" != "$libdir" && \
4447 func_warning "\`$deplib' seems to be moved"
4449 path="-L$absdir"
4452 esac
4453 case " $deplibs " in
4454 *" $path "*) ;;
4455 *) deplibs="$path $deplibs" ;;
4456 esac
4457 done
4458 fi # link_all_deplibs != no
4459 fi # linkmode = lib
4460 done # for deplib in $libs
4461 dependency_libs="$newdependency_libs"
4462 if test "$pass" = dlpreopen; then
4463 # Link the dlpreopened libraries before other libraries
4464 for deplib in $save_deplibs; do
4465 deplibs="$deplib $deplibs"
4466 done
4468 if test "$pass" != dlopen; then
4469 if test "$pass" != conv; then
4470 # Make sure lib_search_path contains only unique directories.
4471 lib_search_path=
4472 for dir in $newlib_search_path; do
4473 case "$lib_search_path " in
4474 *" $dir "*) ;;
4475 *) lib_search_path="$lib_search_path $dir" ;;
4476 esac
4477 done
4478 newlib_search_path=
4481 if test "$linkmode,$pass" != "prog,link"; then
4482 vars="deplibs"
4483 else
4484 vars="compile_deplibs finalize_deplibs"
4486 for var in $vars dependency_libs; do
4487 # Add libraries to $var in reverse order
4488 eval tmp_libs=\"\$$var\"
4489 new_libs=
4490 for deplib in $tmp_libs; do
4491 # FIXME: Pedantically, this is the right thing to do, so
4492 # that some nasty dependency loop isn't accidentally
4493 # broken:
4494 #new_libs="$deplib $new_libs"
4495 # Pragmatically, this seems to cause very few problems in
4496 # practice:
4497 case $deplib in
4498 -L*) new_libs="$deplib $new_libs" ;;
4499 -R*) ;;
4501 # And here is the reason: when a library appears more
4502 # than once as an explicit dependence of a library, or
4503 # is implicitly linked in more than once by the
4504 # compiler, it is considered special, and multiple
4505 # occurrences thereof are not removed. Compare this
4506 # with having the same library being listed as a
4507 # dependency of multiple other libraries: in this case,
4508 # we know (pedantically, we assume) the library does not
4509 # need to be listed more than once, so we keep only the
4510 # last copy. This is not always right, but it is rare
4511 # enough that we require users that really mean to play
4512 # such unportable linking tricks to link the library
4513 # using -Wl,-lname, so that libtool does not consider it
4514 # for duplicate removal.
4515 case " $specialdeplibs " in
4516 *" $deplib "*) new_libs="$deplib $new_libs" ;;
4518 case " $new_libs " in
4519 *" $deplib "*) ;;
4520 *) new_libs="$deplib $new_libs" ;;
4521 esac
4523 esac
4525 esac
4526 done
4527 tmp_libs=
4528 for deplib in $new_libs; do
4529 case $deplib in
4530 -L*)
4531 case " $tmp_libs " in
4532 *" $deplib "*) ;;
4533 *) tmp_libs="$tmp_libs $deplib" ;;
4534 esac
4536 *) tmp_libs="$tmp_libs $deplib" ;;
4537 esac
4538 done
4539 eval $var=\"$tmp_libs\"
4540 done # for var
4542 # Last step: remove runtime libs from dependency_libs
4543 # (they stay in deplibs)
4544 tmp_libs=
4545 for i in $dependency_libs ; do
4546 case " $predeps $postdeps $compiler_lib_search_path " in
4547 *" $i "*)
4548 i=""
4550 esac
4551 if test -n "$i" ; then
4552 tmp_libs="$tmp_libs $i"
4554 done
4555 dependency_libs=$tmp_libs
4556 done # for pass
4557 if test "$linkmode" = prog; then
4558 dlfiles="$newdlfiles"
4560 if test "$linkmode" = prog || test "$linkmode" = lib; then
4561 dlprefiles="$newdlprefiles"
4564 case $linkmode in
4565 oldlib)
4566 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4567 func_warning "\`-dlopen' is ignored for archives"
4570 test -n "$deplibs" && \
4571 func_warning "\`-l' and \`-L' are ignored for archives"
4574 test -n "$rpath" && \
4575 func_warning "\`-rpath' is ignored for archives"
4577 test -n "$xrpath" && \
4578 func_warning "\`-R' is ignored for archives"
4580 test -n "$vinfo" && \
4581 func_warning "\`-version-info/-version-number' is ignored for archives"
4583 test -n "$release" && \
4584 func_warning "\`-release' is ignored for archives"
4586 test -n "$export_symbols$export_symbols_regex" && \
4587 func_warning "\`-export-symbols' is ignored for archives"
4589 # Now set the variables for building old libraries.
4590 build_libtool_libs=no
4591 oldlibs="$output"
4592 objs="$objs$old_deplibs"
4595 lib)
4596 # Make sure we only generate libraries of the form `libNAME.la'.
4597 case $outputname in
4598 lib*)
4599 func_stripname 'lib' '.la' "$outputname"
4600 name=$func_stripname_result
4601 eval shared_ext=\"$shrext_cmds\"
4602 eval libname=\"$libname_spec\"
4605 test "$module" = no && \
4606 func_fatal_help "libtool library \`$output' must begin with \`lib'"
4608 if test "$need_lib_prefix" != no; then
4609 # Add the "lib" prefix for modules if required
4610 func_stripname '' '.la' "$outputname"
4611 name=$func_stripname_result
4612 eval shared_ext=\"$shrext_cmds\"
4613 eval libname=\"$libname_spec\"
4614 else
4615 func_stripname '' '.la' "$outputname"
4616 libname=$func_stripname_result
4619 esac
4621 if test -n "$objs"; then
4622 if test "$deplibs_check_method" != pass_all; then
4623 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
4624 else
4625 $ECHO
4626 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
4627 $ECHO "*** objects $objs is not portable!"
4628 libobjs="$libobjs $objs"
4632 test "$dlself" != no && \
4633 func_warning "\`-dlopen self' is ignored for libtool libraries"
4635 set dummy $rpath
4636 shift
4637 test "$#" -gt 1 && \
4638 func_warning "ignoring multiple \`-rpath's for a libtool library"
4640 install_libdir="$1"
4642 oldlibs=
4643 if test -z "$rpath"; then
4644 if test "$build_libtool_libs" = yes; then
4645 # Building a libtool convenience library.
4646 # Some compilers have problems with a `.al' extension so
4647 # convenience libraries should have the same extension an
4648 # archive normally would.
4649 oldlibs="$output_objdir/$libname.$libext $oldlibs"
4650 build_libtool_libs=convenience
4651 build_old_libs=yes
4654 test -n "$vinfo" && \
4655 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
4657 test -n "$release" && \
4658 func_warning "\`-release' is ignored for convenience libraries"
4659 else
4661 # Parse the version information argument.
4662 save_ifs="$IFS"; IFS=':'
4663 set dummy $vinfo 0 0 0
4664 shift
4665 IFS="$save_ifs"
4667 test -n "$7" && \
4668 func_fatal_help "too many parameters to \`-version-info'"
4670 # convert absolute version numbers to libtool ages
4671 # this retains compatibility with .la files and attempts
4672 # to make the code below a bit more comprehensible
4674 case $vinfo_number in
4675 yes)
4676 number_major="$1"
4677 number_minor="$2"
4678 number_revision="$3"
4680 # There are really only two kinds -- those that
4681 # use the current revision as the major version
4682 # and those that subtract age and use age as
4683 # a minor version. But, then there is irix
4684 # which has an extra 1 added just for fun
4686 case $version_type in
4687 darwin|linux|osf|windows|none)
4688 current=`expr $number_major + $number_minor`
4689 age="$number_minor"
4690 revision="$number_revision"
4692 freebsd-aout|freebsd-elf|sunos)
4693 current="$number_major"
4694 revision="$number_minor"
4695 age="0"
4697 irix|nonstopux)
4698 current=`expr $number_major + $number_minor - 1`
4699 age="$number_minor"
4700 revision="$number_minor"
4702 esac
4705 current="$1"
4706 revision="$2"
4707 age="$3"
4709 esac
4711 # Check that each of the things are valid numbers.
4712 case $current in
4713 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]) ;;
4715 func_error "CURRENT \`$current' must be a nonnegative integer"
4716 func_fatal_error "\`$vinfo' is not valid version information"
4718 esac
4720 case $revision in
4721 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]) ;;
4723 func_error "REVISION \`$revision' must be a nonnegative integer"
4724 func_fatal_error "\`$vinfo' is not valid version information"
4726 esac
4728 case $age in
4729 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]) ;;
4731 func_error "AGE \`$age' must be a nonnegative integer"
4732 func_fatal_error "\`$vinfo' is not valid version information"
4734 esac
4736 if test "$age" -gt "$current"; then
4737 func_error "AGE \`$age' is greater than the current interface number \`$current'"
4738 func_fatal_error "\`$vinfo' is not valid version information"
4741 # Calculate the version variables.
4742 major=
4743 versuffix=
4744 verstring=
4745 case $version_type in
4746 none) ;;
4748 darwin)
4749 # Like Linux, but with the current version available in
4750 # verstring for coding it into the library header
4751 major=.`expr $current - $age`
4752 versuffix="$major.$age.$revision"
4753 # Darwin ld doesn't like 0 for these options...
4754 minor_current=`expr $current + 1`
4755 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
4758 freebsd-aout)
4759 major=".$current"
4760 versuffix=".$current.$revision";
4763 freebsd-elf)
4764 major=".$current"
4765 versuffix=".$current"
4768 irix | nonstopux)
4769 major=`expr $current - $age + 1`
4771 case $version_type in
4772 nonstopux) verstring_prefix=nonstopux ;;
4773 *) verstring_prefix=sgi ;;
4774 esac
4775 verstring="$verstring_prefix$major.$revision"
4777 # Add in all the interfaces that we are compatible with.
4778 loop=$revision
4779 while test "$loop" -ne 0; do
4780 iface=`expr $revision - $loop`
4781 loop=`expr $loop - 1`
4782 verstring="$verstring_prefix$major.$iface:$verstring"
4783 done
4785 # Before this point, $major must not contain `.'.
4786 major=.$major
4787 versuffix="$major.$revision"
4790 linux)
4791 major=.`expr $current - $age`
4792 versuffix="$major.$age.$revision"
4795 osf)
4796 major=.`expr $current - $age`
4797 versuffix=".$current.$age.$revision"
4798 verstring="$current.$age.$revision"
4800 # Add in all the interfaces that we are compatible with.
4801 loop=$age
4802 while test "$loop" -ne 0; do
4803 iface=`expr $current - $loop`
4804 loop=`expr $loop - 1`
4805 verstring="$verstring:${iface}.0"
4806 done
4808 # Make executables depend on our current version.
4809 verstring="$verstring:${current}.0"
4812 qnx)
4813 major=".$current"
4814 versuffix=".$current"
4817 sunos)
4818 major=".$current"
4819 versuffix=".$current.$revision"
4822 windows)
4823 # Use '-' rather than '.', since we only want one
4824 # extension on DOS 8.3 filesystems.
4825 major=`expr $current - $age`
4826 versuffix="-$major"
4830 func_fatal_configuration "unknown library version type \`$version_type'"
4832 esac
4834 # Clear the version info if we defaulted, and they specified a release.
4835 if test -z "$vinfo" && test -n "$release"; then
4836 major=
4837 case $version_type in
4838 darwin)
4839 # we can't check for "0.0" in archive_cmds due to quoting
4840 # problems, so we reset it completely
4841 verstring=
4844 verstring="0.0"
4846 esac
4847 if test "$need_version" = no; then
4848 versuffix=
4849 else
4850 versuffix=".0.0"
4854 # Remove version info from name if versioning should be avoided
4855 if test "$avoid_version" = yes && test "$need_version" = no; then
4856 major=
4857 versuffix=
4858 verstring=""
4861 # Check to see if the archive will have undefined symbols.
4862 if test "$allow_undefined" = yes; then
4863 if test "$allow_undefined_flag" = unsupported; then
4864 func_warning "undefined symbols not allowed in $host shared libraries"
4865 build_libtool_libs=no
4866 build_old_libs=yes
4868 else
4869 # Don't allow undefined symbols.
4870 allow_undefined_flag="$no_undefined_flag"
4875 func_generate_dlsyms "$libname" "$libname" "yes"
4876 libobjs="$libobjs $symfileobj"
4878 if test "$mode" != relink; then
4879 # Remove our outputs, but don't remove object files since they
4880 # may have been created when compiling PIC objects.
4881 removelist=
4882 tempremovelist=`$ECHO "$output_objdir/*"`
4883 for p in $tempremovelist; do
4884 case $p in
4885 *.$objext)
4887 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
4888 if test "X$precious_files_regex" != "X"; then
4889 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
4890 then
4891 continue
4894 removelist="$removelist $p"
4896 *) ;;
4897 esac
4898 done
4899 test -n "$removelist" && \
4900 func_show_eval "${RM}r \$removelist"
4903 # Now set the variables for building old libraries.
4904 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
4905 oldlibs="$oldlibs $output_objdir/$libname.$libext"
4907 # Transform .lo files to .o files.
4908 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
4911 # Eliminate all temporary directories.
4912 #for path in $notinst_path; do
4913 # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
4914 # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
4915 # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
4916 #done
4918 if test -n "$xrpath"; then
4919 # If the user specified any rpath flags, then add them.
4920 temp_xrpath=
4921 for libdir in $xrpath; do
4922 temp_xrpath="$temp_xrpath -R$libdir"
4923 case "$finalize_rpath " in
4924 *" $libdir "*) ;;
4925 *) finalize_rpath="$finalize_rpath $libdir" ;;
4926 esac
4927 done
4928 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
4929 dependency_libs="$temp_xrpath $dependency_libs"
4933 # Make sure dlfiles contains only unique files that won't be dlpreopened
4934 old_dlfiles="$dlfiles"
4935 dlfiles=
4936 for lib in $old_dlfiles; do
4937 case " $dlprefiles $dlfiles " in
4938 *" $lib "*) ;;
4939 *) dlfiles="$dlfiles $lib" ;;
4940 esac
4941 done
4943 # Make sure dlprefiles contains only unique files
4944 old_dlprefiles="$dlprefiles"
4945 dlprefiles=
4946 for lib in $old_dlprefiles; do
4947 case "$dlprefiles " in
4948 *" $lib "*) ;;
4949 *) dlprefiles="$dlprefiles $lib" ;;
4950 esac
4951 done
4953 if test "$build_libtool_libs" = yes; then
4954 if test -n "$rpath"; then
4955 case $host in
4956 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
4957 # these systems don't actually have a c library (as such)!
4959 *-*-rhapsody* | *-*-darwin1.[012])
4960 # Rhapsody C library is in the System framework
4961 deplibs="$deplibs System.ltframework"
4963 *-*-netbsd*)
4964 # Don't link with libc until the a.out ld.so is fixed.
4966 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4967 # Do not include libc due to us having libc/libc_r.
4969 *-*-sco3.2v5* | *-*-sco5v6*)
4970 # Causes problems with __ctype
4972 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4973 # Compiler inserts libc in the correct place for threads to work
4976 # Add libc to deplibs on all other systems if necessary.
4977 if test "$build_libtool_need_lc" = "yes"; then
4978 deplibs="$deplibs -lc"
4981 esac
4984 # Transform deplibs into only deplibs that can be linked in shared.
4985 name_save=$name
4986 libname_save=$libname
4987 release_save=$release
4988 versuffix_save=$versuffix
4989 major_save=$major
4990 # I'm not sure if I'm treating the release correctly. I think
4991 # release should show up in the -l (ie -lgmp5) so we don't want to
4992 # add it in twice. Is that correct?
4993 release=""
4994 versuffix=""
4995 major=""
4996 newdeplibs=
4997 droppeddeps=no
4998 case $deplibs_check_method in
4999 pass_all)
5000 # Don't check for shared/static. Everything works.
5001 # This might be a little naive. We might want to check
5002 # whether the library exists or not. But this is on
5003 # osf3 & osf4 and I'm not really sure... Just
5004 # implementing what was already the behavior.
5005 newdeplibs=$deplibs
5007 test_compile)
5008 # This code stresses the "libraries are programs" paradigm to its
5009 # limits. Maybe even breaks it. We compile a program, linking it
5010 # against the deplibs as a proxy for the library. Then we can check
5011 # whether they linked in statically or dynamically with ldd.
5012 $opt_dry_run || $RM conftest.c
5013 cat > conftest.c <<EOF
5014 int main() { return 0; }
5016 $opt_dry_run || $RM conftest
5017 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
5018 ldd_output=`ldd conftest`
5019 for i in $deplibs; do
5020 name=`expr $i : '-l\(.*\)'`
5021 # If $name is empty we are operating on a -L argument.
5022 if test "$name" != "" && test "$name" != "0"; then
5023 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5024 case " $predeps $postdeps " in
5025 *" $i "*)
5026 newdeplibs="$newdeplibs $i"
5027 i=""
5029 esac
5031 if test -n "$i" ; then
5032 libname=`eval "\\$ECHO \"$libname_spec\""`
5033 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5034 set dummy $deplib_matches; shift
5035 deplib_match=$1
5036 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5037 newdeplibs="$newdeplibs $i"
5038 else
5039 droppeddeps=yes
5040 $ECHO
5041 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5042 $ECHO "*** I have the capability to make that library automatically link in when"
5043 $ECHO "*** you link to this library. But I can only do this if you have a"
5044 $ECHO "*** shared version of the library, which I believe you do not have"
5045 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
5046 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
5049 else
5050 newdeplibs="$newdeplibs $i"
5052 done
5053 else
5054 # Error occurred in the first compile. Let's try to salvage
5055 # the situation: Compile a separate program for each library.
5056 for i in $deplibs; do
5057 name=`expr $i : '-l\(.*\)'`
5058 # If $name is empty we are operating on a -L argument.
5059 if test "$name" != "" && test "$name" != "0"; then
5060 $opt_dry_run || $RM conftest
5061 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
5062 ldd_output=`ldd conftest`
5063 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5064 case " $predeps $postdeps " in
5065 *" $i "*)
5066 newdeplibs="$newdeplibs $i"
5067 i=""
5069 esac
5071 if test -n "$i" ; then
5072 libname=`eval "\\$ECHO \"$libname_spec\""`
5073 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
5074 set dummy $deplib_matches; shift
5075 deplib_match=$1
5076 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
5077 newdeplibs="$newdeplibs $i"
5078 else
5079 droppeddeps=yes
5080 $ECHO
5081 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
5082 $ECHO "*** I have the capability to make that library automatically link in when"
5083 $ECHO "*** you link to this library. But I can only do this if you have a"
5084 $ECHO "*** shared version of the library, which you do not appear to have"
5085 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
5086 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
5089 else
5090 droppeddeps=yes
5091 $ECHO
5092 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
5093 $ECHO "*** make it link in! You will probably need to install it or some"
5094 $ECHO "*** library that it depends on before this library will be fully"
5095 $ECHO "*** functional. Installing it before continuing would be even better."
5097 else
5098 newdeplibs="$newdeplibs $i"
5100 done
5103 file_magic*)
5104 set dummy $deplibs_check_method; shift
5105 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5106 for a_deplib in $deplibs; do
5107 name=`expr $a_deplib : '-l\(.*\)'`
5108 # If $name is empty we are operating on a -L argument.
5109 if test "$name" != "" && test "$name" != "0"; then
5110 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5111 case " $predeps $postdeps " in
5112 *" $a_deplib "*)
5113 newdeplibs="$newdeplibs $a_deplib"
5114 a_deplib=""
5116 esac
5118 if test -n "$a_deplib" ; then
5119 libname=`eval "\\$ECHO \"$libname_spec\""`
5120 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5121 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5122 for potent_lib in $potential_libs; do
5123 # Follow soft links.
5124 if ls -lLd "$potent_lib" 2>/dev/null |
5125 $GREP " -> " >/dev/null; then
5126 continue
5128 # The statement above tries to avoid entering an
5129 # endless loop below, in case of cyclic links.
5130 # We might still enter an endless loop, since a link
5131 # loop can be closed while we follow links,
5132 # but so what?
5133 potlib="$potent_lib"
5134 while test -h "$potlib" 2>/dev/null; do
5135 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
5136 case $potliblink in
5137 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
5138 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
5139 esac
5140 done
5141 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
5142 $SED -e 10q |
5143 $EGREP "$file_magic_regex" > /dev/null; then
5144 newdeplibs="$newdeplibs $a_deplib"
5145 a_deplib=""
5146 break 2
5148 done
5149 done
5151 if test -n "$a_deplib" ; then
5152 droppeddeps=yes
5153 $ECHO
5154 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5155 $ECHO "*** I have the capability to make that library automatically link in when"
5156 $ECHO "*** you link to this library. But I can only do this if you have a"
5157 $ECHO "*** shared version of the library, which you do not appear to have"
5158 $ECHO "*** because I did check the linker path looking for a file starting"
5159 if test -z "$potlib" ; then
5160 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
5161 else
5162 $ECHO "*** with $libname and none of the candidates passed a file format test"
5163 $ECHO "*** using a file magic. Last file checked: $potlib"
5166 else
5167 # Add a -L argument.
5168 newdeplibs="$newdeplibs $a_deplib"
5170 done # Gone through all deplibs.
5172 match_pattern*)
5173 set dummy $deplibs_check_method; shift
5174 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
5175 for a_deplib in $deplibs; do
5176 name=`expr $a_deplib : '-l\(.*\)'`
5177 # If $name is empty we are operating on a -L argument.
5178 if test -n "$name" && test "$name" != "0"; then
5179 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5180 case " $predeps $postdeps " in
5181 *" $a_deplib "*)
5182 newdeplibs="$newdeplibs $a_deplib"
5183 a_deplib=""
5185 esac
5187 if test -n "$a_deplib" ; then
5188 libname=`eval "\\$ECHO \"$libname_spec\""`
5189 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
5190 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
5191 for potent_lib in $potential_libs; do
5192 potlib="$potent_lib" # see symlink-check above in file_magic test
5193 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
5194 $EGREP "$match_pattern_regex" > /dev/null; then
5195 newdeplibs="$newdeplibs $a_deplib"
5196 a_deplib=""
5197 break 2
5199 done
5200 done
5202 if test -n "$a_deplib" ; then
5203 droppeddeps=yes
5204 $ECHO
5205 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
5206 $ECHO "*** I have the capability to make that library automatically link in when"
5207 $ECHO "*** you link to this library. But I can only do this if you have a"
5208 $ECHO "*** shared version of the library, which you do not appear to have"
5209 $ECHO "*** because I did check the linker path looking for a file starting"
5210 if test -z "$potlib" ; then
5211 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
5212 else
5213 $ECHO "*** with $libname and none of the candidates passed a file format test"
5214 $ECHO "*** using a regex pattern. Last file checked: $potlib"
5217 else
5218 # Add a -L argument.
5219 newdeplibs="$newdeplibs $a_deplib"
5221 done # Gone through all deplibs.
5223 none | unknown | *)
5224 newdeplibs=""
5225 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
5226 -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
5227 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
5228 for i in $predeps $postdeps ; do
5229 # can't use Xsed below, because $i might contain '/'
5230 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
5231 done
5233 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' |
5234 $GREP . >/dev/null; then
5235 $ECHO
5236 if test "X$deplibs_check_method" = "Xnone"; then
5237 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
5238 else
5239 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
5241 $ECHO "*** All declared inter-library dependencies are being dropped."
5242 droppeddeps=yes
5245 esac
5246 versuffix=$versuffix_save
5247 major=$major_save
5248 release=$release_save
5249 libname=$libname_save
5250 name=$name_save
5252 case $host in
5253 *-*-rhapsody* | *-*-darwin1.[012])
5254 # On Rhapsody replace the C library with the System framework
5255 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5257 esac
5259 if test "$droppeddeps" = yes; then
5260 if test "$module" = yes; then
5261 $ECHO
5262 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
5263 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
5264 $ECHO "*** a static module, that should work as long as the dlopening"
5265 $ECHO "*** application is linked with the -dlopen flag."
5266 if test -z "$global_symbol_pipe"; then
5267 $ECHO
5268 $ECHO "*** However, this would only work if libtool was able to extract symbol"
5269 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
5270 $ECHO "*** not find such a program. So, this module is probably useless."
5271 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
5273 if test "$build_old_libs" = no; then
5274 oldlibs="$output_objdir/$libname.$libext"
5275 build_libtool_libs=module
5276 build_old_libs=yes
5277 else
5278 build_libtool_libs=no
5280 else
5281 $ECHO "*** The inter-library dependencies that have been dropped here will be"
5282 $ECHO "*** automatically added whenever a program is linked with this library"
5283 $ECHO "*** or is declared to -dlopen it."
5285 if test "$allow_undefined" = no; then
5286 $ECHO
5287 $ECHO "*** Since this library must not contain undefined symbols,"
5288 $ECHO "*** because either the platform does not support them or"
5289 $ECHO "*** it was explicitly requested with -no-undefined,"
5290 $ECHO "*** libtool will only create a static version of it."
5291 if test "$build_old_libs" = no; then
5292 oldlibs="$output_objdir/$libname.$libext"
5293 build_libtool_libs=module
5294 build_old_libs=yes
5295 else
5296 build_libtool_libs=no
5301 # Done checking deplibs!
5302 deplibs=$newdeplibs
5304 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5305 case $host in
5306 *-*-darwin*)
5307 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5308 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5309 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5311 esac
5313 # move library search paths that coincide with paths to not yet
5314 # installed libraries to the beginning of the library search list
5315 new_libs=
5316 for path in $notinst_path; do
5317 case " $new_libs " in
5318 *" -L$path/$objdir "*) ;;
5320 case " $deplibs " in
5321 *" -L$path/$objdir "*)
5322 new_libs="$new_libs -L$path/$objdir" ;;
5323 esac
5325 esac
5326 done
5327 for deplib in $deplibs; do
5328 case $deplib in
5329 -L*)
5330 case " $new_libs " in
5331 *" $deplib "*) ;;
5332 *) new_libs="$new_libs $deplib" ;;
5333 esac
5335 *) new_libs="$new_libs $deplib" ;;
5336 esac
5337 done
5338 deplibs="$new_libs"
5340 # All the library-specific variables (install_libdir is set above).
5341 library_names=
5342 old_library=
5343 dlname=
5345 # Test again, we may have decided not to build it any more
5346 if test "$build_libtool_libs" = yes; then
5347 if test "$hardcode_into_libs" = yes; then
5348 # Hardcode the library paths
5349 hardcode_libdirs=
5350 dep_rpath=
5351 rpath="$finalize_rpath"
5352 test "$mode" != relink && rpath="$compile_rpath$rpath"
5353 for libdir in $rpath; do
5354 if test -n "$hardcode_libdir_flag_spec"; then
5355 if test -n "$hardcode_libdir_separator"; then
5356 if test -z "$hardcode_libdirs"; then
5357 hardcode_libdirs="$libdir"
5358 else
5359 # Just accumulate the unique libdirs.
5360 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5361 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5364 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5366 esac
5368 else
5369 eval flag=\"$hardcode_libdir_flag_spec\"
5370 dep_rpath="$dep_rpath $flag"
5372 elif test -n "$runpath_var"; then
5373 case "$perm_rpath " in
5374 *" $libdir "*) ;;
5375 *) perm_rpath="$perm_rpath $libdir" ;;
5376 esac
5378 done
5379 # Substitute the hardcoded libdirs into the rpath.
5380 if test -n "$hardcode_libdir_separator" &&
5381 test -n "$hardcode_libdirs"; then
5382 libdir="$hardcode_libdirs"
5383 if test -n "$hardcode_libdir_flag_spec_ld"; then
5384 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
5385 else
5386 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
5389 if test -n "$runpath_var" && test -n "$perm_rpath"; then
5390 # We should set the runpath_var.
5391 rpath=
5392 for dir in $perm_rpath; do
5393 rpath="$rpath$dir:"
5394 done
5395 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
5397 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
5400 shlibpath="$finalize_shlibpath"
5401 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
5402 if test -n "$shlibpath"; then
5403 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
5406 # Get the real and link names of the library.
5407 eval shared_ext=\"$shrext_cmds\"
5408 eval library_names=\"$library_names_spec\"
5409 set dummy $library_names
5410 shift
5411 realname="$1"
5412 shift
5414 if test -n "$soname_spec"; then
5415 eval soname=\"$soname_spec\"
5416 else
5417 soname="$realname"
5419 if test -z "$dlname"; then
5420 dlname=$soname
5423 lib="$output_objdir/$realname"
5424 linknames=
5425 for link
5427 linknames="$linknames $link"
5428 done
5430 # Use standard objects if they are pic
5431 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5433 delfiles=
5434 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5435 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
5436 export_symbols="$output_objdir/$libname.uexp"
5437 delfiles="$delfiles $export_symbols"
5440 orig_export_symbols=
5441 case $host_os in
5442 cygwin* | mingw*)
5443 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
5444 # exporting using user supplied symfile
5445 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
5446 # and it's NOT already a .def file. Must figure out
5447 # which of the given symbols are data symbols and tag
5448 # them as such. So, trigger use of export_symbols_cmds.
5449 # export_symbols gets reassigned inside the "prepare
5450 # the list of exported symbols" if statement, so the
5451 # include_expsyms logic still works.
5452 orig_export_symbols="$export_symbols"
5453 export_symbols=
5454 always_export_symbols=yes
5458 esac
5460 # Prepare the list of exported symbols
5461 if test -z "$export_symbols"; then
5462 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
5463 func_echo "generating symbol list for \`$libname.la'"
5464 export_symbols="$output_objdir/$libname.exp"
5465 $opt_dry_run || $RM $export_symbols
5466 cmds=$export_symbols_cmds
5467 save_ifs="$IFS"; IFS='~'
5468 for cmd in $cmds; do
5469 IFS="$save_ifs"
5470 eval cmd=\"$cmd\"
5471 if len=`expr "X$cmd" : ".*"` &&
5472 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5473 func_show_eval "$cmd" 'exit $?'
5474 skipped_export=false
5475 else
5476 # The command line is too long to execute in one step.
5477 func_echo "using reloadable object file for export list..."
5478 skipped_export=:
5479 # Break out early, otherwise skipped_export may be
5480 # set to false by a later but shorter cmd.
5481 break
5483 done
5484 IFS="$save_ifs"
5485 if test -n "$export_symbols_regex"; then
5486 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5487 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5492 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5493 tmp_export_symbols="$export_symbols"
5494 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5495 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5498 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
5499 # The given exports_symbols file has to be filtered, so filter it.
5500 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5501 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5502 # 's' commands which not all seds can handle. GNU sed should be fine
5503 # though. Also, the filter scales superlinearly with the number of
5504 # global variables. join(1) would be nice here, but unfortunately
5505 # isn't a blessed tool.
5506 $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5507 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5508 export_symbols=$output_objdir/$libname.def
5509 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5512 tmp_deplibs=
5513 for test_deplib in $deplibs; do
5514 case " $convenience " in
5515 *" $test_deplib "*) ;;
5517 tmp_deplibs="$tmp_deplibs $test_deplib"
5519 esac
5520 done
5521 deplibs="$tmp_deplibs"
5523 if test -n "$convenience"; then
5524 if test -n "$whole_archive_flag_spec"; then
5525 save_libobjs=$libobjs
5526 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5527 else
5528 gentop="$output_objdir/${outputname}x"
5529 generated="$generated $gentop"
5531 func_extract_archives $gentop $convenience
5532 libobjs="$libobjs $func_extract_archives_result"
5536 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
5537 eval flag=\"$thread_safe_flag_spec\"
5538 linker_flags="$linker_flags $flag"
5541 # Make a backup of the uninstalled library when relinking
5542 if test "$mode" = relink; then
5543 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5546 # Do each of the archive commands.
5547 if test "$module" = yes && test -n "$module_cmds" ; then
5548 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5549 eval test_cmds=\"$module_expsym_cmds\"
5550 cmds=$module_expsym_cmds
5551 else
5552 eval test_cmds=\"$module_cmds\"
5553 cmds=$module_cmds
5555 else
5556 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5557 eval test_cmds=\"$archive_expsym_cmds\"
5558 cmds=$archive_expsym_cmds
5559 else
5560 eval test_cmds=\"$archive_cmds\"
5561 cmds=$archive_cmds
5565 if test "X$skipped_export" != "X:" &&
5566 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5567 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5569 else
5570 # The command line is too long to link in one step, link piecewise
5571 # or, if using GNU ld and skipped_export is not :, use a linker
5572 # script.
5574 # Save the value of $output and $libobjs because we want to
5575 # use them later. If we have whole_archive_flag_spec, we
5576 # want to use save_libobjs as it was before
5577 # whole_archive_flag_spec was expanded, because we can't
5578 # assume the linker understands whole_archive_flag_spec.
5579 # This may have to be revisited, in case too many
5580 # convenience libraries get linked in and end up exceeding
5581 # the spec.
5582 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5583 save_libobjs=$libobjs
5585 save_output=$output
5586 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
5588 # Clear the reloadable object creation command queue and
5589 # initialize k to one.
5590 test_cmds=
5591 concat_cmds=
5592 objlist=
5593 last_robj=
5596 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
5597 output=${output_objdir}/${output_la}.lnkscript
5598 func_echo "creating GNU ld script: $output"
5599 $ECHO 'INPUT (' > $output
5600 for obj in $save_libobjs
5602 $ECHO \""$obj"\" >> $output
5603 done
5604 $ECHO ')' >> $output
5605 delfiles="$delfiles $output"
5606 elif test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
5607 output=${output_objdir}/${output_la}.lnk
5608 func_echo "creating linker input file list: $output"
5609 : > $output
5610 for obj in $save_libobjs
5612 $ECHO "$obj" >> $output
5613 done
5614 delfiles="$delfiles $output"
5615 output=\"$file_list_spec$output\"
5616 else
5617 func_echo "creating reloadable object files..."
5618 output=$output_objdir/$output_la-${k}.$objext
5619 # Loop over the list of objects to be linked.
5620 for obj in $save_libobjs
5622 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
5623 if test "X$objlist" = X ||
5624 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5625 test "$len" -le "$max_cmd_len"; }; then
5626 objlist="$objlist $obj"
5627 else
5628 # The command $test_cmds is almost too long, add a
5629 # command to the queue.
5630 if test "$k" -eq 1 ; then
5631 # The first file doesn't have a previous command to add.
5632 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
5633 else
5634 # All subsequent reloadable object files will link in
5635 # the last one created.
5636 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
5638 last_robj=$output_objdir/$output_la-${k}.$objext
5639 k=`expr $k + 1`
5640 output=$output_objdir/$output_la-${k}.$objext
5641 objlist=$obj
5642 len=1
5644 done
5645 # Handle the remaining objects by creating one last
5646 # reloadable object file. All subsequent reloadable object
5647 # files will link in the last one created.
5648 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5649 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
5651 if ${skipped_export-false}; then
5652 func_echo "generating symbol list for \`$libname.la'"
5653 export_symbols="$output_objdir/$libname.exp"
5654 $opt_dry_run || $RM $export_symbols
5655 libobjs=$output
5656 # Append the command to create the export file.
5657 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
5660 # Set up a command to remove the reloadable object files
5661 # after they are used.
5663 while test "$i" -lt "$k"
5665 i=`expr $i + 1`
5666 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
5667 done
5669 func_echo "creating a temporary reloadable object file: $output"
5671 # Loop through the commands generated above and execute them.
5672 save_ifs="$IFS"; IFS='~'
5673 for cmd in $concat_cmds; do
5674 IFS="$save_ifs"
5675 $opt_silent || {
5676 func_quote_for_expand "$cmd"
5677 eval "func_echo $func_quote_for_expand_result"
5679 $opt_dry_run || eval "$cmd" || {
5680 lt_exit=$?
5682 # Restore the uninstalled library and exit
5683 if test "$mode" = relink; then
5684 ( cd "$output_objdir" && \
5685 $RM "${realname}T" && \
5686 $MV "${realname}U" "$realname" )
5689 exit $lt_exit
5691 done
5692 IFS="$save_ifs"
5695 libobjs=$output
5696 # Restore the value of output.
5697 output=$save_output
5699 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5700 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5702 # Expand the library linking commands again to reset the
5703 # value of $libobjs for piecewise linking.
5705 # Do each of the archive commands.
5706 if test "$module" = yes && test -n "$module_cmds" ; then
5707 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5708 cmds=$module_expsym_cmds
5709 else
5710 cmds=$module_cmds
5712 else
5713 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5714 cmds=$archive_expsym_cmds
5715 else
5716 cmds=$archive_cmds
5721 if test -n "$delfiles"; then
5722 # Append the command to remove temporary files to $cmds.
5723 eval cmds=\"\$cmds~\$RM $delfiles\"
5726 # Add any objects from preloaded convenience libraries
5727 if test -n "$dlprefiles"; then
5728 gentop="$output_objdir/${outputname}x"
5729 generated="$generated $gentop"
5731 func_extract_archives $gentop $dlprefiles
5732 libobjs="$libobjs $func_extract_archives_result"
5735 save_ifs="$IFS"; IFS='~'
5736 for cmd in $cmds; do
5737 IFS="$save_ifs"
5738 eval cmd=\"$cmd\"
5739 $opt_silent || {
5740 func_quote_for_expand "$cmd"
5741 eval "func_echo $func_quote_for_expand_result"
5743 $opt_dry_run || eval "$cmd" || {
5744 lt_exit=$?
5746 # Restore the uninstalled library and exit
5747 if test "$mode" = relink; then
5748 ( cd "$output_objdir" && \
5749 $RM "${realname}T" && \
5750 $MV "${realname}U" "$realname" )
5753 exit $lt_exit
5755 done
5756 IFS="$save_ifs"
5758 # Restore the uninstalled library and exit
5759 if test "$mode" = relink; then
5760 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5762 if test -n "$convenience"; then
5763 if test -z "$whole_archive_flag_spec"; then
5764 func_show_eval '${RM}r "$gentop"'
5768 exit $EXIT_SUCCESS
5771 # Create links to the real library.
5772 for linkname in $linknames; do
5773 if test "$realname" != "$linkname"; then
5774 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5776 done
5778 # If -module or -export-dynamic was specified, set the dlname.
5779 if test "$module" = yes || test "$export_dynamic" = yes; then
5780 # On all known operating systems, these are identical.
5781 dlname="$soname"
5786 obj)
5787 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5788 func_warning "\`-dlopen' is ignored for objects"
5791 test -n "$deplibs" && \
5792 func_warning "\`-l' and \`-L' are ignored for objects"
5794 test -n "$rpath" && \
5795 func_warning "\`-rpath' is ignored for objects"
5797 test -n "$xrpath" && \
5798 func_warning "\`-R' is ignored for objects"
5800 test -n "$vinfo" && \
5801 func_warning "\`-version-info' is ignored for objects"
5803 test -n "$release" && \
5804 func_warning "\`-release' is ignored for objects"
5806 case $output in
5807 *.lo)
5808 test -n "$objs$old_deplibs" && \
5809 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
5811 libobj="$output"
5812 obj=`$ECHO "X$output" | $Xsed -e "$lo2o"`
5815 libobj=
5816 obj="$output"
5818 esac
5820 # Delete the old objects.
5821 $opt_dry_run || $RM $obj $libobj
5823 # Objects from convenience libraries. This assumes
5824 # single-version convenience libraries. Whenever we create
5825 # different ones for PIC/non-PIC, this we'll have to duplicate
5826 # the extraction.
5827 reload_conv_objs=
5828 gentop=
5829 # reload_cmds runs $LD directly, so let us get rid of
5830 # -Wl from whole_archive_flag_spec and hope we can get by with
5831 # turning comma into space..
5834 if test -n "$convenience"; then
5835 if test -n "$whole_archive_flag_spec"; then
5836 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
5837 reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
5838 else
5839 gentop="$output_objdir/${obj}x"
5840 generated="$generated $gentop"
5842 func_extract_archives $gentop $convenience
5843 reload_conv_objs="$reload_objs $func_extract_archives_result"
5847 # Create the old-style object.
5848 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
5850 output="$obj"
5851 func_execute_cmds "$reload_cmds" 'exit $?'
5853 # Exit if we aren't doing a library object file.
5854 if test -z "$libobj"; then
5855 if test -n "$gentop"; then
5856 func_show_eval '${RM}r "$gentop"'
5859 exit $EXIT_SUCCESS
5862 if test "$build_libtool_libs" != yes; then
5863 if test -n "$gentop"; then
5864 func_show_eval '${RM}r "$gentop"'
5867 # Create an invalid libtool object if no PIC, so that we don't
5868 # accidentally link it into a program.
5869 # $show "echo timestamp > $libobj"
5870 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5871 exit $EXIT_SUCCESS
5874 if test -n "$pic_flag" || test "$pic_mode" != default; then
5875 # Only do commands if we really have different PIC objects.
5876 reload_objs="$libobjs $reload_conv_objs"
5877 output="$libobj"
5878 func_execute_cmds "$reload_cmds" 'exit $?'
5881 if test -n "$gentop"; then
5882 func_show_eval '${RM}r "$gentop"'
5885 exit $EXIT_SUCCESS
5888 prog)
5889 case $host in
5890 *cygwin*) func_stripname '' '.exe' "$output"
5891 output=$func_stripname_result.exe;;
5892 esac
5893 test -n "$vinfo" && \
5894 func_warning "\`-version-info' is ignored for programs"
5896 test -n "$release" && \
5897 func_warning "\`-release' is ignored for programs"
5899 test "$preload" = yes \
5900 && test "$dlopen_support" = unknown \
5901 && test "$dlopen_self" = unknown \
5902 && test "$dlopen_self_static" = unknown && \
5903 func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
5905 case $host in
5906 *-*-rhapsody* | *-*-darwin1.[012])
5907 # On Rhapsody replace the C library is the System framework
5908 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5909 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5911 esac
5913 case $host in
5914 *-*-darwin*)
5915 # Don't allow lazy linking, it breaks C++ global constructors
5916 # But is supposedly fixed on 10.4 or later (yay!).
5917 if test "$tagname" = CXX ; then
5918 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
5919 10.[0123])
5920 compile_command="$compile_command ${wl}-bind_at_load"
5921 finalize_command="$finalize_command ${wl}-bind_at_load"
5923 esac
5925 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5926 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5927 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
5929 esac
5932 # move library search paths that coincide with paths to not yet
5933 # installed libraries to the beginning of the library search list
5934 new_libs=
5935 for path in $notinst_path; do
5936 case " $new_libs " in
5937 *" -L$path/$objdir "*) ;;
5939 case " $compile_deplibs " in
5940 *" -L$path/$objdir "*)
5941 new_libs="$new_libs -L$path/$objdir" ;;
5942 esac
5944 esac
5945 done
5946 for deplib in $compile_deplibs; do
5947 case $deplib in
5948 -L*)
5949 case " $new_libs " in
5950 *" $deplib "*) ;;
5951 *) new_libs="$new_libs $deplib" ;;
5952 esac
5954 *) new_libs="$new_libs $deplib" ;;
5955 esac
5956 done
5957 compile_deplibs="$new_libs"
5960 compile_command="$compile_command $compile_deplibs"
5961 finalize_command="$finalize_command $finalize_deplibs"
5963 if test -n "$rpath$xrpath"; then
5964 # If the user specified any rpath flags, then add them.
5965 for libdir in $rpath $xrpath; do
5966 # This is the magic to use -rpath.
5967 case "$finalize_rpath " in
5968 *" $libdir "*) ;;
5969 *) finalize_rpath="$finalize_rpath $libdir" ;;
5970 esac
5971 done
5974 # Now hardcode the library paths
5975 rpath=
5976 hardcode_libdirs=
5977 for libdir in $compile_rpath $finalize_rpath; do
5978 if test -n "$hardcode_libdir_flag_spec"; then
5979 if test -n "$hardcode_libdir_separator"; then
5980 if test -z "$hardcode_libdirs"; then
5981 hardcode_libdirs="$libdir"
5982 else
5983 # Just accumulate the unique libdirs.
5984 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5985 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5988 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5990 esac
5992 else
5993 eval flag=\"$hardcode_libdir_flag_spec\"
5994 rpath="$rpath $flag"
5996 elif test -n "$runpath_var"; then
5997 case "$perm_rpath " in
5998 *" $libdir "*) ;;
5999 *) perm_rpath="$perm_rpath $libdir" ;;
6000 esac
6002 case $host in
6003 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
6004 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
6005 case :$dllsearchpath: in
6006 *":$libdir:"*) ;;
6007 *) dllsearchpath="$dllsearchpath:$libdir";;
6008 esac
6009 case :$dllsearchpath: in
6010 *":$testbindir:"*) ;;
6011 *) dllsearchpath="$dllsearchpath:$testbindir";;
6012 esac
6014 esac
6015 done
6016 # Substitute the hardcoded libdirs into the rpath.
6017 if test -n "$hardcode_libdir_separator" &&
6018 test -n "$hardcode_libdirs"; then
6019 libdir="$hardcode_libdirs"
6020 eval rpath=\" $hardcode_libdir_flag_spec\"
6022 compile_rpath="$rpath"
6024 rpath=
6025 hardcode_libdirs=
6026 for libdir in $finalize_rpath; do
6027 if test -n "$hardcode_libdir_flag_spec"; then
6028 if test -n "$hardcode_libdir_separator"; then
6029 if test -z "$hardcode_libdirs"; then
6030 hardcode_libdirs="$libdir"
6031 else
6032 # Just accumulate the unique libdirs.
6033 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
6034 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
6037 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
6039 esac
6041 else
6042 eval flag=\"$hardcode_libdir_flag_spec\"
6043 rpath="$rpath $flag"
6045 elif test -n "$runpath_var"; then
6046 case "$finalize_perm_rpath " in
6047 *" $libdir "*) ;;
6048 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
6049 esac
6051 done
6052 # Substitute the hardcoded libdirs into the rpath.
6053 if test -n "$hardcode_libdir_separator" &&
6054 test -n "$hardcode_libdirs"; then
6055 libdir="$hardcode_libdirs"
6056 eval rpath=\" $hardcode_libdir_flag_spec\"
6058 finalize_rpath="$rpath"
6060 if test -n "$libobjs" && test "$build_old_libs" = yes; then
6061 # Transform all the library objects into standard objects.
6062 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6063 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
6066 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
6068 # template prelinking step
6069 if test -n "$prelink_cmds"; then
6070 func_execute_cmds "$prelink_cmds" 'exit $?'
6073 wrappers_required=yes
6074 case $host in
6075 *cygwin* | *mingw* )
6076 if test "$build_libtool_libs" != yes; then
6077 wrappers_required=no
6081 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
6082 wrappers_required=no
6085 esac
6086 if test "$wrappers_required" = no; then
6087 # Replace the output file specification.
6088 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6089 link_command="$compile_command$compile_rpath"
6091 # We have no uninstalled library dependencies, so finalize right now.
6092 exit_status=0
6093 func_show_eval "$link_command" 'exit_status=$?'
6095 # Delete the generated files.
6096 if test -f "$output_objdir/${outputname}S.${objext}"; then
6097 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
6100 exit $exit_status
6103 if test -n "$compile_shlibpath$finalize_shlibpath"; then
6104 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
6106 if test -n "$finalize_shlibpath"; then
6107 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
6110 compile_var=
6111 finalize_var=
6112 if test -n "$runpath_var"; then
6113 if test -n "$perm_rpath"; then
6114 # We should set the runpath_var.
6115 rpath=
6116 for dir in $perm_rpath; do
6117 rpath="$rpath$dir:"
6118 done
6119 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
6121 if test -n "$finalize_perm_rpath"; then
6122 # We should set the runpath_var.
6123 rpath=
6124 for dir in $finalize_perm_rpath; do
6125 rpath="$rpath$dir:"
6126 done
6127 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
6131 if test "$no_install" = yes; then
6132 # We don't need to create a wrapper script.
6133 link_command="$compile_var$compile_command$compile_rpath"
6134 # Replace the output file specification.
6135 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
6136 # Delete the old output file.
6137 $opt_dry_run || $RM $output
6138 # Link the executable and exit
6139 func_show_eval "$link_command" 'exit $?'
6140 exit $EXIT_SUCCESS
6143 if test "$hardcode_action" = relink; then
6144 # Fast installation is not supported
6145 link_command="$compile_var$compile_command$compile_rpath"
6146 relink_command="$finalize_var$finalize_command$finalize_rpath"
6148 func_warning "this platform does not like uninstalled shared libraries"
6149 func_warning "\`$output' will be relinked during installation"
6150 else
6151 if test "$fast_install" != no; then
6152 link_command="$finalize_var$compile_command$finalize_rpath"
6153 if test "$fast_install" = yes; then
6154 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
6155 else
6156 # fast_install is set to needless
6157 relink_command=
6159 else
6160 link_command="$compile_var$compile_command$compile_rpath"
6161 relink_command="$finalize_var$finalize_command$finalize_rpath"
6165 # Replace the output file specification.
6166 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
6168 # Delete the old output files.
6169 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
6171 func_show_eval "$link_command" 'exit $?'
6173 # Now create the wrapper script.
6174 func_echo "creating $output"
6176 # Quote the relink command for shipping.
6177 if test -n "$relink_command"; then
6178 # Preserve any variables that may affect compiler behavior
6179 for var in $variables_saved_for_relink; do
6180 if eval test -z \"\${$var+set}\"; then
6181 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
6182 elif eval var_value=\$$var; test -z "$var_value"; then
6183 relink_command="$var=; export $var; $relink_command"
6184 else
6185 func_quote_for_eval "$var_value"
6186 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6188 done
6189 relink_command="(cd `pwd`; $relink_command)"
6190 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6193 # Quote $ECHO for shipping.
6194 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
6195 case $progpath in
6196 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
6197 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
6198 esac
6199 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
6200 else
6201 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
6204 # Only actually do things if not in dry run mode.
6205 $opt_dry_run || {
6206 # win32 will think the script is a binary if it has
6207 # a .exe suffix, so we strip it off here.
6208 case $output in
6209 *.exe) func_stripname '' '.exe' "$output"
6210 output=$func_stripname_result ;;
6211 esac
6212 # test for cygwin because mv fails w/o .exe extensions
6213 case $host in
6214 *cygwin*)
6215 exeext=.exe
6216 func_stripname '' '.exe' "$outputname"
6217 outputname=$func_stripname_result ;;
6218 *) exeext= ;;
6219 esac
6220 case $host in
6221 *cygwin* | *mingw* )
6222 output_name=`basename $output`
6223 output_path=`dirname $output`
6224 cwrappersource="$output_path/$objdir/lt-$output_name.c"
6225 cwrapper="$output_path/$output_name.exe"
6226 $RM $cwrappersource $cwrapper
6227 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
6229 cat > $cwrappersource <<EOF
6231 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
6232 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6234 The $output program cannot be directly executed until all the libtool
6235 libraries that it depends on are installed.
6237 This wrapper executable should never be moved out of the build directory.
6238 If it is, it will not operate correctly.
6240 Currently, it simply execs the wrapper *script* "/bin/sh $output",
6241 but could eventually absorb all of the scripts functionality and
6242 exec $objdir/$outputname directly.
6245 cat >> $cwrappersource<<"EOF"
6246 #include <stdio.h>
6247 #include <stdlib.h>
6248 /* #include <unistd.h> */
6249 #include <malloc.h>
6250 #include <stdarg.h>
6251 #include <assert.h>
6252 #include <string.h>
6253 #include <ctype.h>
6254 #include <sys/stat.h>
6255 #include <windows.h>
6257 #if defined(PATH_MAX)
6258 # define LT_PATHMAX PATH_MAX
6259 #elif defined(MAXPATHLEN)
6260 # define LT_PATHMAX MAXPATHLEN
6261 #else
6262 # define LT_PATHMAX 1024
6263 #endif
6265 #ifndef DIR_SEPARATOR
6266 # define DIR_SEPARATOR '/'
6267 # define PATH_SEPARATOR ':'
6268 #endif
6270 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
6271 defined (__OS2__)
6272 # define HAVE_DOS_BASED_FILE_SYSTEM
6273 # ifndef DIR_SEPARATOR_2
6274 # define DIR_SEPARATOR_2 '\\'
6275 # endif
6276 # ifndef PATH_SEPARATOR_2
6277 # define PATH_SEPARATOR_2 ';'
6278 # endif
6279 #endif
6281 #ifndef DIR_SEPARATOR_2
6282 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
6283 #else /* DIR_SEPARATOR_2 */
6284 # define IS_DIR_SEPARATOR(ch) \
6285 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
6286 #endif /* DIR_SEPARATOR_2 */
6288 #ifndef PATH_SEPARATOR_2
6289 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
6290 #else /* PATH_SEPARATOR_2 */
6291 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
6292 #endif /* PATH_SEPARATOR_2 */
6294 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
6295 #define XFREE(stale) do { \
6296 if (stale) { free ((void *) stale); stale = 0; } \
6297 } while (0)
6299 /* -DDEBUG is fairly common in CFLAGS. */
6300 #undef DEBUG
6301 #if defined DEBUGWRAPPER
6302 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
6303 #else
6304 # define DEBUG(format, ...)
6305 #endif
6307 const char *program_name = NULL;
6309 void * xmalloc (size_t num);
6310 char * xstrdup (const char *string);
6311 const char * base_name (const char *name);
6312 char * find_executable(const char *wrapper);
6313 int check_executable(const char *path);
6314 char * strendzap(char *str, const char *pat);
6315 void lt_fatal (const char *message, ...);
6317 void
6318 win32_execv(const char* path, char const** args)
6320 char cmdline[1024];
6321 int space = 1022;
6322 STARTUPINFO sinfo;
6323 PROCESS_INFORMATION pinfo;
6324 DWORD exCode;
6326 cmdline[0] = 0;
6327 while (*args != NULL)
6329 if (space < strlen(*args))
6330 break;
6331 if (space == 1022)
6333 strcpy(cmdline + (1022-space), *args);
6334 space -= strlen(*args);
6336 else
6338 cmdline[1022-space] = ' ';
6339 strcpy(cmdline + (1023-space), *args);
6340 space -= strlen(*args) + 1;
6342 args++;
6345 memset(&sinfo, 0, sizeof(sinfo));
6346 sinfo.cb = sizeof(sinfo);
6348 if (!CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL,
6349 &sinfo, &pinfo))
6350 return;
6352 WaitForSingleObject(pinfo.hProcess, INFINITE);
6353 GetExitCodeProcess(pinfo.hProcess, &exCode);
6354 ExitProcess(exCode);
6358 main (int argc, char *argv[])
6360 char **newargz, *p;
6361 int i;
6363 program_name = (char *) xstrdup (base_name (argv[0]));
6364 DEBUG("(main) argv[0] : %s\n",argv[0]);
6365 DEBUG("(main) program_name : %s\n",program_name);
6366 newargz = XMALLOC(char *, argc+2);
6369 cat >> $cwrappersource <<EOF
6370 newargz[0] = (char *) xstrdup("$SHELL");
6373 cat >> $cwrappersource <<"EOF"
6374 newargz[1] = find_executable(argv[0]);
6375 if (newargz[1] == NULL)
6376 lt_fatal("Couldn't find %s", argv[0]);
6377 p = newargz[1];
6378 while (*p)
6380 if (*p == '\\')
6381 *p = '/';
6382 p++;
6384 DEBUG("(main) found exe at : %s\n",newargz[1]);
6385 /* we know the script has the same name, without the .exe */
6386 /* so make sure newargz[1] doesn't end in .exe */
6387 strendzap(newargz[1],".exe");
6388 for (i = 1; i < argc; i++)
6389 newargz[i+1] = xstrdup(argv[i]);
6390 newargz[argc+1] = NULL;
6392 for (i=0; i<argc+1; i++)
6394 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
6400 case $host_os in
6401 mingw*)
6402 cat >> $cwrappersource <<EOF
6403 win32_execv("$SHELL",(char const **)newargz);
6407 cat >> $cwrappersource <<EOF
6408 win32_execv("$SHELL",newargz);
6411 esac
6413 cat >> $cwrappersource <<"EOF"
6414 return 127;
6417 void *
6418 xmalloc (size_t num)
6420 void * p = (void *) malloc (num);
6421 if (!p)
6422 lt_fatal ("Memory exhausted");
6424 return p;
6427 char *
6428 xstrdup (const char *string)
6430 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
6434 const char *
6435 base_name (const char *name)
6437 const char *base;
6439 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6440 /* Skip over the disk name in MSDOS pathnames. */
6441 if (isalpha ((unsigned char)name[0]) && name[1] == ':')
6442 name += 2;
6443 #endif
6445 for (base = name; *name; name++)
6446 if (IS_DIR_SEPARATOR (*name))
6447 base = name + 1;
6448 return base;
6452 check_executable(const char * path)
6454 struct stat st;
6456 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
6457 if ((!path) || (!*path))
6458 return 0;
6460 if ((stat (path, &st) >= 0) &&
6462 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
6463 #if defined (S_IXOTH)
6464 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
6465 #endif
6466 #if defined (S_IXGRP)
6467 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
6468 #endif
6469 #if defined(S_IXUSR)
6470 ((st.st_mode & S_IXUSR) == S_IXUSR))
6471 #else
6472 ((st.st_mode & _S_IEXEC) == _S_IEXEC))
6473 #endif
6475 return 1;
6476 else
6477 return 0;
6480 /* Searches for the full path of the wrapper. Returns
6481 newly allocated full path name if found, NULL otherwise */
6482 char *
6483 find_executable (const char* wrapper)
6485 int has_slash = 0;
6486 const char* p;
6487 const char* p_next;
6488 /* static buffer for getcwd */
6489 char tmp[LT_PATHMAX + 1];
6490 int tmp_len;
6491 char* concat_name;
6493 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
6495 if ((wrapper == NULL) || (*wrapper == '\0'))
6496 return NULL;
6498 /* Absolute path? */
6499 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6500 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
6502 concat_name = xstrdup (wrapper);
6503 if (check_executable(concat_name))
6504 return concat_name;
6505 XFREE(concat_name);
6507 else
6509 #endif
6510 if (IS_DIR_SEPARATOR (wrapper[0]))
6512 concat_name = xstrdup (wrapper);
6513 if (check_executable(concat_name))
6514 return concat_name;
6515 XFREE(concat_name);
6517 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
6519 #endif
6521 for (p = wrapper; *p; p++)
6522 if (*p == '/')
6524 has_slash = 1;
6525 break;
6527 if (!has_slash)
6529 /* no slashes; search PATH */
6530 const char* path = getenv ("PATH");
6531 if (path != NULL)
6533 for (p = path; *p; p = p_next)
6535 const char* q;
6536 size_t p_len;
6537 for (q = p; *q; q++)
6538 if (IS_PATH_SEPARATOR(*q))
6539 break;
6540 p_len = q - p;
6541 p_next = (*q == '\0' ? q : q + 1);
6542 if (p_len == 0)
6544 /* empty path: current directory */
6545 if (getcwd (tmp, LT_PATHMAX) == NULL)
6546 lt_fatal ("getcwd failed");
6547 tmp_len = strlen(tmp);
6548 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6549 memcpy (concat_name, tmp, tmp_len);
6550 concat_name[tmp_len] = '/';
6551 strcpy (concat_name + tmp_len + 1, wrapper);
6553 else
6555 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
6556 memcpy (concat_name, p, p_len);
6557 concat_name[p_len] = '/';
6558 strcpy (concat_name + p_len + 1, wrapper);
6560 if (check_executable(concat_name))
6561 return concat_name;
6562 XFREE(concat_name);
6565 /* not found in PATH; assume curdir */
6567 /* Relative path | not found in path: prepend cwd */
6568 if (getcwd (tmp, LT_PATHMAX) == NULL)
6569 lt_fatal ("getcwd failed");
6570 tmp_len = strlen(tmp);
6571 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6572 memcpy (concat_name, tmp, tmp_len);
6573 concat_name[tmp_len] = '/';
6574 strcpy (concat_name + tmp_len + 1, wrapper);
6576 if (check_executable(concat_name))
6577 return concat_name;
6578 XFREE(concat_name);
6579 return NULL;
6582 char *
6583 strendzap(char *str, const char *pat)
6585 size_t len, patlen;
6587 assert(str != NULL);
6588 assert(pat != NULL);
6590 len = strlen(str);
6591 patlen = strlen(pat);
6593 if (patlen <= len)
6595 str += len - patlen;
6596 if (strcmp(str, pat) == 0)
6597 *str = '\0';
6599 return str;
6602 static void
6603 lt_error_core (int exit_status, const char * mode,
6604 const char * message, va_list ap)
6606 fprintf (stderr, "%s: %s: ", program_name, mode);
6607 vfprintf (stderr, message, ap);
6608 fprintf (stderr, ".\n");
6610 if (exit_status >= 0)
6611 exit (exit_status);
6614 void
6615 lt_fatal (const char *message, ...)
6617 va_list ap;
6618 va_start (ap, message);
6619 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
6620 va_end (ap);
6623 # we should really use a build-platform specific compiler
6624 # here, but OTOH, the wrappers (shell script and this C one)
6625 # are only useful if you want to execute the "real" binary.
6626 # Since the "real" binary is built for $host, then this
6627 # wrapper might as well be built for $host, too.
6628 $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
6630 esac
6631 $RM $output
6632 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
6634 $ECHO > $output "\
6635 #! $SHELL
6637 # $output - temporary wrapper script for $objdir/$outputname
6638 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6640 # The $output program cannot be directly executed until all the libtool
6641 # libraries that it depends on are installed.
6643 # This wrapper script should never be moved out of the build directory.
6644 # If it is, it will not operate correctly.
6646 # Sed substitution that helps us do robust quoting. It backslashifies
6647 # metacharacters that are still active within double-quoted strings.
6648 Xsed='${SED} -e 1s/^X//'
6649 sed_quote_subst='$sed_quote_subst'
6651 # Be Bourne compatible
6652 if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
6653 emulate sh
6654 NULLCMD=:
6655 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
6656 # is contrary to our usage. Disable this feature.
6657 alias -g '\${1+\"\$@\"}'='\"\$@\"'
6658 setopt NO_GLOB_SUBST
6659 else
6660 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
6662 BIN_SH=xpg4; export BIN_SH # for Tru64
6663 DUALCASE=1; export DUALCASE # for MKS sh
6665 # The HP-UX ksh and POSIX shell print the target directory to stdout
6666 # if CDPATH is set.
6667 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
6669 relink_command=\"$relink_command\"
6671 # This environment variable determines our operation mode.
6672 if test \"\$libtool_install_magic\" = \"$magic\"; then
6673 # install mode needs the following variables:
6674 generated_by_libtool_version='$macro_version'
6675 notinst_deplibs='$notinst_deplibs'
6676 else
6677 # When we are sourced in execute mode, \$file and \$ECHO are already set.
6678 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6679 ECHO=\"$qecho\"
6680 file=\"\$0\"
6681 # Make sure echo works.
6682 if test \"X\$1\" = X--no-reexec; then
6683 # Discard the --no-reexec flag, and continue.
6684 shift
6685 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
6686 # Yippee, \$ECHO works!
6688 else
6689 # Restart under the correct shell, and then maybe \$ECHO will work.
6690 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
6694 $ECHO >> $output "\
6696 # Find the directory that this script lives in.
6697 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
6698 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
6700 # Follow symbolic links until we get to the real thisdir.
6701 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
6702 while test -n \"\$file\"; do
6703 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
6705 # If there was a directory component, then change thisdir.
6706 if test \"x\$destdir\" != \"x\$file\"; then
6707 case \"\$destdir\" in
6708 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
6709 *) thisdir=\"\$thisdir/\$destdir\" ;;
6710 esac
6713 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
6714 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
6715 done
6717 # Try to get the absolute directory name.
6718 absdir=\`cd \"\$thisdir\" && pwd\`
6719 test -n \"\$absdir\" && thisdir=\"\$absdir\"
6722 if test "$fast_install" = yes; then
6723 $ECHO >> $output "\
6724 program=lt-'$outputname'$exeext
6725 progdir=\"\$thisdir/$objdir\"
6727 if test ! -f \"\$progdir/\$program\" ||
6728 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
6729 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
6731 file=\"\$\$-\$program\"
6733 if test ! -d \"\$progdir\"; then
6734 $MKDIR \"\$progdir\"
6735 else
6736 $RM \"\$progdir/\$file\"
6739 $ECHO >> $output "\
6741 # relink executable if necessary
6742 if test -n \"\$relink_command\"; then
6743 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
6744 else
6745 $ECHO \"\$relink_command_output\" >&2
6746 $RM \"\$progdir/\$file\"
6747 exit 1
6751 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
6752 { $RM \"\$progdir/\$program\";
6753 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
6754 $RM \"\$progdir/\$file\"
6756 else
6757 $ECHO >> $output "\
6758 program='$outputname'
6759 progdir=\"\$thisdir/$objdir\"
6763 $ECHO >> $output "\
6765 if test -f \"\$progdir/\$program\"; then"
6767 # Export our shlibpath_var if we have one.
6768 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6769 $ECHO >> $output "\
6770 # Add our own library path to $shlibpath_var
6771 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6773 # Some systems cannot cope with colon-terminated $shlibpath_var
6774 # The second colon is a workaround for a bug in BeOS R4 sed
6775 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
6777 export $shlibpath_var
6781 # fixup the dll searchpath if we need to.
6782 if test -n "$dllsearchpath"; then
6783 $ECHO >> $output "\
6784 # Add the dll search path components to the executable PATH
6785 PATH=$dllsearchpath:\$PATH
6789 $ECHO >> $output "\
6790 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6791 # Run the actual program with our arguments.
6793 case $host in
6794 # Backslashes separate directories on plain windows
6795 *-*-mingw | *-*-os2*)
6796 $ECHO >> $output "\
6797 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
6802 $ECHO >> $output "\
6803 exec \"\$progdir/\$program\" \${1+\"\$@\"}
6806 esac
6807 $ECHO >> $output "\
6808 \$ECHO \"\$0: cannot exec \$program \$*\"
6809 exit 1
6811 else
6812 # The program doesn't exist.
6813 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
6814 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6815 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6816 exit 1
6820 chmod +x $output
6822 exit $EXIT_SUCCESS
6824 esac
6826 # See if we need to build an old-fashioned archive.
6827 for oldlib in $oldlibs; do
6829 if test "$build_libtool_libs" = convenience; then
6830 oldobjs="$libobjs_save $symfileobj"
6831 addlibs="$convenience"
6832 build_libtool_libs=no
6833 else
6834 if test "$build_libtool_libs" = module; then
6835 oldobjs="$libobjs_save"
6836 build_libtool_libs=no
6837 else
6838 oldobjs="$old_deplibs $non_pic_objects"
6839 if test "$preload" = yes && test -f "$symfileobj"; then
6840 oldobjs="$oldobjs $symfileobj"
6843 addlibs="$old_convenience"
6846 if test -n "$addlibs"; then
6847 gentop="$output_objdir/${outputname}x"
6848 generated="$generated $gentop"
6850 func_extract_archives $gentop $addlibs
6851 oldobjs="$oldobjs $func_extract_archives_result"
6854 # Do each command in the archive commands.
6855 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
6856 cmds=$old_archive_from_new_cmds
6857 else
6859 # Add any objects from preloaded convenience libraries
6860 if test -n "$dlprefiles"; then
6861 gentop="$output_objdir/${outputname}x"
6862 generated="$generated $gentop"
6864 func_extract_archives $gentop $dlprefiles
6865 oldobjs="$oldobjs $func_extract_archives_result"
6868 # POSIX demands no paths to be encoded in archives. We have
6869 # to avoid creating archives with duplicate basenames if we
6870 # might have to extract them afterwards, e.g., when creating a
6871 # static archive out of a convenience library, or when linking
6872 # the entirety of a libtool archive into another (currently
6873 # not supported by libtool).
6874 if (for obj in $oldobjs
6876 func_basename "$obj"
6877 $ECHO "$func_basename_result"
6878 done | sort | sort -uc >/dev/null 2>&1); then
6880 else
6881 $ECHO "copying selected object files to avoid basename conflicts..."
6882 gentop="$output_objdir/${outputname}x"
6883 generated="$generated $gentop"
6884 func_mkdir_p "$gentop"
6885 save_oldobjs=$oldobjs
6886 oldobjs=
6887 counter=1
6888 for obj in $save_oldobjs
6890 func_basename "$obj"
6891 objbase="$func_basename_result"
6892 case " $oldobjs " in
6893 " ") oldobjs=$obj ;;
6894 *[\ /]"$objbase "*)
6895 while :; do
6896 # Make sure we don't pick an alternate name that also
6897 # overlaps.
6898 newobj=lt$counter-$objbase
6899 counter=`expr $counter + 1`
6900 case " $oldobjs " in
6901 *[\ /]"$newobj "*) ;;
6902 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
6903 esac
6904 done
6905 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
6906 oldobjs="$oldobjs $gentop/$newobj"
6908 *) oldobjs="$oldobjs $obj" ;;
6909 esac
6910 done
6912 eval cmds=\"$old_archive_cmds\"
6914 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
6915 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6916 cmds=$old_archive_cmds
6917 else
6918 # the command line is too long to link in one step, link in parts
6919 func_echo "using piecewise archive linking..."
6920 save_RANLIB=$RANLIB
6921 RANLIB=:
6922 objlist=
6923 concat_cmds=
6924 save_oldobjs=$oldobjs
6925 # Is there a better way of finding the last object in the list?
6926 for obj in $save_oldobjs
6928 last_oldobj=$obj
6929 done
6930 for obj in $save_oldobjs
6932 oldobjs="$objlist $obj"
6933 objlist="$objlist $obj"
6934 eval test_cmds=\"$old_archive_cmds\"
6935 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6936 test "$len" -le "$max_cmd_len"; then
6938 else
6939 # the above command should be used before it gets too long
6940 oldobjs=$objlist
6941 if test "$obj" = "$last_oldobj" ; then
6942 RANLIB=$save_RANLIB
6944 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6945 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
6946 objlist=
6948 done
6949 RANLIB=$save_RANLIB
6950 oldobjs=$objlist
6951 if test "X$oldobjs" = "X" ; then
6952 eval cmds=\"\$concat_cmds\"
6953 else
6954 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
6958 func_execute_cmds "$cmds" 'exit $?'
6959 done
6961 test -n "$generated" && \
6962 func_show_eval "${RM}r$generated"
6964 # Now create the libtool archive.
6965 case $output in
6966 *.la)
6967 old_library=
6968 test "$build_old_libs" = yes && old_library="$libname.$libext"
6969 func_echo "creating $output"
6971 # Preserve any variables that may affect compiler behavior
6972 for var in $variables_saved_for_relink; do
6973 if eval test -z \"\${$var+set}\"; then
6974 relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
6975 elif eval var_value=\$$var; test -z "$var_value"; then
6976 relink_command="$var=; export $var; $relink_command"
6977 else
6978 func_quote_for_eval "$var_value"
6979 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6981 done
6982 # Quote the link command for shipping.
6983 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
6984 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6985 if test "$hardcode_automatic" = yes ; then
6986 relink_command=
6989 # Only create the output if not a dry run.
6990 $opt_dry_run || {
6991 for installed in no yes; do
6992 if test "$installed" = yes; then
6993 if test -z "$install_libdir"; then
6994 break
6996 output="$output_objdir/$outputname"i
6997 # Replace all uninstalled libtool libraries with the installed ones
6998 newdependency_libs=
6999 for deplib in $dependency_libs; do
7000 case $deplib in
7001 *.la)
7002 func_basename "$deplib"
7003 name="$func_basename_result"
7004 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
7005 test -z "$libdir" && \
7006 func_fatal_error "\`$deplib' is not a valid libtool archive"
7007 newdependency_libs="$newdependency_libs $libdir/$name"
7009 *) newdependency_libs="$newdependency_libs $deplib" ;;
7010 esac
7011 done
7012 dependency_libs="$newdependency_libs"
7013 newdlfiles=
7015 for lib in $dlfiles; do
7016 case $lib in
7017 *.la)
7018 func_basename "$lib"
7019 name="$func_basename_result"
7020 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7021 test -z "$libdir" && \
7022 func_fatal_error "\`$lib' is not a valid libtool archive"
7023 newdlfiles="$newdlfiles $libdir/$name"
7025 *) newdlfiles="$newdlfiles $lib" ;;
7026 esac
7027 done
7028 dlfiles="$newdlfiles"
7029 newdlprefiles=
7030 for lib in $dlprefiles; do
7031 case $lib in
7032 *.la)
7033 # Only pass preopened files to the pseudo-archive (for
7034 # eventual linking with the app. that links it) if we
7035 # didn't already link the preopened objects directly into
7036 # the library:
7037 func_basename "$lib"
7038 name="$func_basename_result"
7039 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
7040 test -z "$libdir" && \
7041 func_fatal_error "\`$lib' is not a valid libtool archive"
7042 newdlprefiles="$newdlprefiles $libdir/$name"
7044 esac
7045 done
7046 dlprefiles="$newdlprefiles"
7047 else
7048 newdlfiles=
7049 for lib in $dlfiles; do
7050 case $lib in
7051 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7052 *) abs=`pwd`"/$lib" ;;
7053 esac
7054 newdlfiles="$newdlfiles $abs"
7055 done
7056 dlfiles="$newdlfiles"
7057 newdlprefiles=
7058 for lib in $dlprefiles; do
7059 case $lib in
7060 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
7061 *) abs=`pwd`"/$lib" ;;
7062 esac
7063 newdlprefiles="$newdlprefiles $abs"
7064 done
7065 dlprefiles="$newdlprefiles"
7067 $RM $output
7068 # place dlname in correct position for cygwin
7069 tdlname=$dlname
7070 case $host,$output,$installed,$module,$dlname in
7071 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
7072 esac
7073 $ECHO > $output "\
7074 # $outputname - a libtool library file
7075 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
7077 # Please DO NOT delete this file!
7078 # It is necessary for linking the library.
7080 # The name that we can dlopen(3).
7081 dlname='$tdlname'
7083 # Names of this library.
7084 library_names='$library_names'
7086 # The name of the static archive.
7087 old_library='$old_library'
7089 # Linker flags that can not go in dependency_libs.
7090 inherited_linker_flags='$new_inherited_linker_flags'
7092 # Libraries that this one depends upon.
7093 dependency_libs='$dependency_libs'
7095 # Names of additional weak libraries provided by this library
7096 weak_library_names='$weak_libs'
7098 # Version information for $libname.
7099 current=$current
7100 age=$age
7101 revision=$revision
7103 # Is this an already installed library?
7104 installed=$installed
7106 # Should we warn about portability when linking against -modules?
7107 shouldnotlink=$module
7109 # Files to dlopen/dlpreopen
7110 dlopen='$dlfiles'
7111 dlpreopen='$dlprefiles'
7113 # Directory that this library needs to be installed in:
7114 libdir='$install_libdir'"
7115 if test "$installed" = no && test "$need_relink" = yes; then
7116 $ECHO >> $output "\
7117 relink_command=\"$relink_command\""
7119 done
7122 # Do a symbolic link so that the libtool archive can be found in
7123 # LD_LIBRARY_PATH before the program is installed.
7124 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
7126 esac
7127 exit $EXIT_SUCCESS
7131 # func_mode_uninstall arg...
7132 func_mode_uninstall ()
7134 $opt_debug
7135 RM="$nonopt"
7136 files=
7137 rmforce=
7138 exit_status=0
7140 # This variable tells wrapper scripts just to set variables rather
7141 # than running their programs.
7142 libtool_install_magic="$magic"
7144 for arg
7146 case $arg in
7147 -f) RM="$RM $arg"; rmforce=yes ;;
7148 -*) RM="$RM $arg" ;;
7149 *) files="$files $arg" ;;
7150 esac
7151 done
7153 test -z "$RM" && \
7154 func_fatal_help "you must specify an RM program"
7156 rmdirs=
7158 origobjdir="$objdir"
7159 for file in $files; do
7160 func_dirname "$file" "" "."
7161 dir="$func_dirname_result"
7162 if test "X$dir" = X.; then
7163 objdir="$origobjdir"
7164 else
7165 objdir="$dir/$origobjdir"
7167 func_basename "$file"
7168 name="$func_basename_result"
7169 test "$mode" = uninstall && objdir="$dir"
7171 # Remember objdir for removal later, being careful to avoid duplicates
7172 if test "$mode" = clean; then
7173 case " $rmdirs " in
7174 *" $objdir "*) ;;
7175 *) rmdirs="$rmdirs $objdir" ;;
7176 esac
7179 # Don't error if the file doesn't exist and rm -f was used.
7180 if { test -L "$file"; } >/dev/null 2>&1 ||
7181 { test -h "$file"; } >/dev/null 2>&1 ||
7182 test -f "$file"; then
7184 elif test -d "$file"; then
7185 exit_status=1
7186 continue
7187 elif test "$rmforce" = yes; then
7188 continue
7191 rmfiles="$file"
7193 case $name in
7194 *.la)
7195 # Possibly a libtool archive, so verify it.
7196 if func_lalib_p "$file"; then
7197 . $dir/$name
7199 # Delete the libtool libraries and symlinks.
7200 for n in $library_names; do
7201 rmfiles="$rmfiles $objdir/$n"
7202 done
7203 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
7205 case "$mode" in
7206 clean)
7207 case " $library_names " in
7208 # " " in the beginning catches empty $dlname
7209 *" $dlname "*) ;;
7210 *) rmfiles="$rmfiles $objdir/$dlname" ;;
7211 esac
7212 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
7214 uninstall)
7215 if test -n "$library_names"; then
7216 # Do each command in the postuninstall commands.
7217 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7220 if test -n "$old_library"; then
7221 # Do each command in the old_postuninstall commands.
7222 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
7224 # FIXME: should reinstall the best remaining shared library.
7226 esac
7230 *.lo)
7231 # Possibly a libtool object, so verify it.
7232 if func_lalib_p "$file"; then
7234 # Read the .lo file
7235 . $dir/$name
7237 # Add PIC object to the list of files to remove.
7238 if test -n "$pic_object" &&
7239 test "$pic_object" != none; then
7240 rmfiles="$rmfiles $dir/$pic_object"
7243 # Add non-PIC object to the list of files to remove.
7244 if test -n "$non_pic_object" &&
7245 test "$non_pic_object" != none; then
7246 rmfiles="$rmfiles $dir/$non_pic_object"
7252 if test "$mode" = clean ; then
7253 noexename=$name
7254 case $file in
7255 *.exe)
7256 func_stripname '' '.exe' "$file"
7257 file=$func_stripname_result
7258 func_stripname '' '.exe' "$name"
7259 noexename=$func_stripname_result
7260 # $file with .exe has already been added to rmfiles,
7261 # add $file without .exe
7262 rmfiles="$rmfiles $file"
7264 esac
7265 # Do a test to see if this is a libtool program.
7266 if func_ltwrapper_p "$file"; then
7267 relink_command=
7268 . $dir/$noexename
7270 # note $name still contains .exe if it was in $file originally
7271 # as does the version of $file that was added into $rmfiles
7272 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
7273 if test "$fast_install" = yes && test -n "$relink_command"; then
7274 rmfiles="$rmfiles $objdir/lt-$name"
7276 if test "X$noexename" != "X$name" ; then
7277 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
7282 esac
7283 func_show_eval "$RM $rmfiles" 'exit_status=1'
7284 done
7285 objdir="$origobjdir"
7287 # Try to remove the ${objdir}s in the directories where we deleted files
7288 for dir in $rmdirs; do
7289 if test -d "$dir"; then
7290 func_show_eval "rmdir $dir >/dev/null 2>&1"
7292 done
7294 exit $exit_status
7298 # TEST SUITE MARKER ## NON-FUNCTION
7299 ## ----------- ##
7300 ## Main. ##
7301 ## ----------- ##
7304 # Sanity checks first:
7305 func_check_version_match
7307 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
7308 func_fatal_configuration "not configured to build any kind of library"
7311 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
7314 # Darwin sucks
7315 eval std_shrext=\"$shrext_cmds\"
7318 # Only execute mode is allowed to have -dlopen flags.
7319 if test -n "$execute_dlfiles" && test "$mode" != execute; then
7320 func_error "unrecognized option \`-dlopen'"
7321 $ECHO "$help" 1>&2
7322 exit $EXIT_FAILURE
7325 # Change the help message to a mode-specific one.
7326 generic_help="$help"
7327 help="Try \`$progname --help --mode=$mode' for more information."
7329 case $mode in
7330 compile) func_mode_compile ${1+"$@"} ;;
7331 execute) func_mode_execute ${1+"$@"} ;;
7332 finish) func_mode_finish ${1+"$@"} ;;
7333 install) func_mode_install ${1+"$@"} ;;
7334 link|relink) func_mode_link ${1+"$@"} ;;
7335 uninstall|clean) func_mode_uninstall ${1+"$@"} ;;
7337 "") help="$generic_help"
7338 func_fatal_help "you must specify a MODE"
7340 esac
7342 test -z "$exec_cmd" && \
7343 func_fatal_help "invalid operation mode \`$mode'"
7345 if test -n "$exec_cmd"; then
7346 eval exec "$exec_cmd"
7347 exit $EXIT_FAILURE
7351 exit $exit_status
7354 # The TAGs below are defined such that we never get into a situation
7355 # in which we disable both kinds of libraries. Given conflicting
7356 # choices, we go for a static library, that is the most portable,
7357 # since we can't tell whether shared libraries were disabled because
7358 # the user asked for that or because the platform doesn't support
7359 # them. This is particularly important on AIX, because we don't
7360 # support having both static and shared libraries enabled at the same
7361 # time on that platform, so we default to a shared-only configuration.
7362 # If a disable-shared tag is given, we'll fallback to a static-only
7363 # configuration. But we'll never go from static-only to shared-only.
7365 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
7366 build_libtool_libs=no
7367 build_old_libs=yes
7368 # ### END LIBTOOL TAG CONFIG: disable-shared
7370 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
7371 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
7372 # ### END LIBTOOL TAG CONFIG: disable-static
7374 # Local Variables:
7375 # mode:shell-script
7376 # sh-indentation:2
7377 # End:
7378 # vi:sw=2