1 m4_define([_m4_divert(SCRIPT)], 100)
2 m4_divert_push([SCRIPT])# @configure_input@
4 # ltmain.sh (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
5 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 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_triplet@
65 # compiler flags: $LTCFLAGS
66 # linker: $LD (gnu? $with_gnu_ld)
67 # $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
68 # automake: $automake_version
69 # autoconf: $autoconf_version
71 # Report bugs to <bug-libtool@gnu.org>.
76 TIMESTAMP="@TIMESTAMP@"
77 package_revision=@package_revision@
82 m4_include([getopt.m4sh])
84 # Check that we have a working $ECHO.
85 if test "X$1" = X--no-reexec; then
86 # Discard the --no-reexec flag, and continue.
88 elif test "X$1" = X--fallback-echo; then
89 # Avoid inline document here, it may be left over
91 elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
92 # Yippee, $ECHO works!
95 # Restart under the correct shell, and then maybe $ECHO will work.
96 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
99 if test "X$1" = X--fallback-echo; then
100 # used as fallback echo
108 magic="%%%MAGIC variable%%%"
115 lo2o="s/\\.lo\$/.${objext}/"
116 o2lo="s/\\.${objext}\$/.lo/"
119 opt_duplicate_deps=false
123 # If this variable is set in any of the actions, the command in it
124 # will be execed at the end. This prevents here-documents from being
125 # left over by shells.
128 # func_fatal_configuration arg...
129 # Echo program name prefixed message to standard error, followed by
130 # a configuration failure hint, and exit.
131 func_fatal_configuration ()
134 func_error "See the $PACKAGE documentation for more information."
135 func_fatal_error "Fatal configuration error."
140 # Display the configuration for all the tags in this script.
143 re_begincf='^# ### BEGIN LIBTOOL'
144 re_endcf='^# ### END LIBTOOL'
146 # Default configuration.
147 $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
149 # Now print the configurations for the tags.
150 for tagname in $taglist; do
151 $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
158 # Display the features supported by this script.
162 if test "$build_libtool_libs" = yes; then
163 $ECHO "enable shared libraries"
165 $ECHO "disable shared libraries"
167 if test "$build_old_libs" = yes; then
168 $ECHO "enable static libraries"
170 $ECHO "disable static libraries"
176 # func_enable_tag tagname
177 # Verify that TAGNAME is valid, and either flag an error and exit, or
178 # enable the TAGNAME tag. We also add TAGNAME to the global $taglist
185 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
186 re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
187 sed_extractcf="/$re_begincf/,/$re_endcf/p"
191 *[[!-_A-Za-z0-9,/]]*)
192 func_fatal_error "invalid tag name: $tagname"
196 # Don't test for the "default" C tag, as we know it's
197 # there but not specially marked.
201 if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
202 taglist="$taglist $tagname"
204 # Evaluate the configuration. Be careful to quote the path
205 # and the sed script, to avoid splitting on whitespace, but
206 # also don't use non-portable quotes within backquotes within
207 # quotes we have to do it in 2 steps:
208 extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
211 func_error "ignoring unknown tag $tagname"
220 # We need to display help for each of the modes.
223 # Generic help is extracted from the usage comments
224 # at the start of this file.
230 "Usage: $progname [[OPTION]]... --mode=clean RM [[RM-OPTION]]... FILE...
232 Remove files from the build directory.
234 RM is the name of the program to use to delete files associated with each FILE
235 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
238 If FILE is a libtool library, object or program, all the files associated
239 with it are deleted. Otherwise, only FILE itself is deleted using RM."
244 "Usage: $progname [[OPTION]]... --mode=compile COMPILE-COMMAND... SOURCEFILE
246 Compile a source file into a libtool library object.
248 This mode accepts the following additional options:
250 -o OUTPUT-FILE set the output file name to OUTPUT-FILE
251 -no-suppress do not suppress compiler output for multiple passes
252 -prefer-pic try to building PIC objects only
253 -prefer-non-pic try to building non-PIC objects only
254 -shared do not build a \`.o' file suitable for static linking
255 -static only build a \`.o' file suitable for static linking
257 COMPILE-COMMAND is a command to be used in creating a \`standard' object file
258 from the given SOURCEFILE.
260 The output file name is determined by removing the directory component from
261 SOURCEFILE, then substituting the C source code suffix \`.c' with the
262 library object suffix, \`.lo'."
267 "Usage: $progname [[OPTION]]... --mode=execute COMMAND [[ARGS]]...
269 Automatically set library path, then run a program.
271 This mode accepts the following additional options:
273 -dlopen FILE add the directory containing FILE to the library path
275 This mode sets the library path environment variable according to \`-dlopen'
278 If any of the ARGS are libtool executable wrappers, then they are translated
279 into their corresponding uninstalled binary, and any of their required library
280 directories are added to the library path.
282 Then, COMMAND is executed, with ARGS as arguments."
287 "Usage: $progname [[OPTION]]... --mode=finish [[LIBDIR]]...
289 Complete the installation of libtool libraries.
291 Each LIBDIR is a directory that contains libtool libraries.
293 The commands that this mode executes may require superuser privileges. Use
294 the \`--dry-run' option if you just want to see what would be executed."
299 "Usage: $progname [[OPTION]]... --mode=install INSTALL-COMMAND...
301 Install executables or libraries.
303 INSTALL-COMMAND is the installation command. The first component should be
304 either the \`install' or \`cp' program.
306 The following components of INSTALL-COMMAND are treated specially:
308 -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
310 The rest of the components are interpreted as arguments to that command (only
311 BSD-compatible install options are recognized)."
316 "Usage: $progname [[OPTION]]... --mode=link LINK-COMMAND...
318 Link object files or libraries together to form another library, or to
319 create an executable program.
321 LINK-COMMAND is a command using the C compiler that you would use to create
322 a program from several object files.
324 The following components of LINK-COMMAND are treated specially:
326 -all-static do not do any dynamic linking at all
327 -avoid-version do not add a version suffix if possible
328 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
329 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
330 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
331 -export-symbols SYMFILE
332 try to export only the symbols listed in SYMFILE
333 -export-symbols-regex REGEX
334 try to export only the symbols matching REGEX
335 -LLIBDIR search LIBDIR for required installed libraries
336 -lNAME OUTPUT-FILE requires the installed library libNAME
337 -module build a library that can dlopened
338 -no-fast-install disable the fast-install mode
339 -no-install link a not-installable executable
340 -no-undefined declare that a library does not refer to external symbols
341 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
342 -objectlist FILE Use a list of object files found in FILE to specify objects
343 -precious-files-regex REGEX
344 don't remove output files matching REGEX
345 -release RELEASE specify package release information
346 -rpath LIBDIR the created library will eventually be installed in LIBDIR
347 -R[[ ]]LIBDIR add LIBDIR to the runtime path of programs and libraries
348 -shared only do dynamic linking of libtool libraries
349 -shrext SUFFIX override the standard shared library file extension
350 -static do not do any dynamic linking of libtool libraries
351 -version-info CURRENT[[:REVISION[:AGE]]]
352 specify library version info [[each variable defaults to 0]]
353 -weak LIBNAME declare that the target provides the LIBNAME interface
355 All other options (arguments beginning with \`-') are ignored.
357 Every other argument is treated as a filename. Files ending in \`.la' are
358 treated as uninstalled libtool libraries, other files are standard or library
361 If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
362 only library objects (\`.lo' files) may be specified, and \`-rpath' is
363 required, except when creating a convenience library.
365 If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
366 using \`ar' and \`ranlib', or on Windows using \`lib'.
368 If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
369 is created, otherwise an executable program is created."
374 "Usage: $progname [[OPTION]]... --mode=uninstall RM [[RM-OPTION]]... FILE...
376 Remove libraries from an installation directory.
378 RM is the name of the program to use to delete files associated with each FILE
379 (typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
382 If FILE is a libtool library, all the files associated with it are deleted.
383 Otherwise, only FILE itself is deleted using RM."
387 func_fatal_help "invalid operation mode \`$mode'"
392 $ECHO "Try \`$progname --help' for more information about other modes."
397 # TEST SUITE MARKER ## NON-FUNCTION
398 # Parse options once, thoroughly. This comes as soon as possible in
399 # the script to make things like `libtool --version' happen quickly.
402 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
403 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
404 my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
405 my_sed_long_arg='1s/^-[[^=]]*=//'
407 # Shorthand for --mode=foo, only valid as the first argument
410 shift; set dummy --mode clean ${1+"$@"}; shift
412 compile|compil|compi|comp|com|co|c)
413 shift; set dummy --mode compile ${1+"$@"}; shift
415 execute|execut|execu|exec|exe|ex|e)
416 shift; set dummy --mode execute ${1+"$@"}; shift
418 finish|finis|fini|fin|fi|f)
419 shift; set dummy --mode finish ${1+"$@"}; shift
421 install|instal|insta|inst|ins|in|i)
422 shift; set dummy --mode install ${1+"$@"}; shift
425 shift; set dummy --mode link ${1+"$@"}; shift
427 uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
428 shift; set dummy --mode uninstall ${1+"$@"}; shift
432 # Parse non-mode specific arguments:
433 while test "$#" -gt 0; do
438 --config) func_config ;;
440 --debug) preserve_args="$preserve_args $opt"
441 func_echo "enabling shell trace mode"
446 -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
447 execute_dlfiles="$execute_dlfiles $1"
451 --dry-run | -n) opt_dry_run=: ;;
452 --features) func_features ;;
453 --finish) mode="finish" ;;
455 --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
457 # Valid mode arguments:
467 # Catch anything else as an error
468 *) func_error "invalid argument for $opt"
479 opt_duplicate_deps=: ;;
481 --quiet|--silent) preserve_args="$preserve_args $opt"
485 --verbose| -v) preserve_args="$preserve_args $opt"
489 --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
490 preserve_args="$preserve_args $opt $1"
491 func_enable_tag "$1" # tagname is set here
495 # Separate optargs to long options:
496 -dlopen=*|--mode=*|--tag=*)
497 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
498 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
499 set dummy "$opt" "$arg" ${1+"$@"}
503 # Separate optargs to short options:
505 # arg=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
506 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
507 # set dummy "$opt" "$arg" ${1+"$@"}
511 # Separate non-argument short options:
513 # rest=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_rest"`
514 # opt=`$ECHO "X$opt" |$Xsed -e "$my_sed_single_opt"`
515 # set dummy "$opt" "-$rest" ${1+"$@"}
519 -\?|-h) func_usage ;;
520 --help) opt_help=: ;;
521 --version) func_version ;;
523 -*) func_fatal_help "unrecognized option \`$opt'" ;;
531 # Now that we've collected a possible --mode arg, show help if necessary
532 $opt_help && func_mode_help
535 *cygwin* | *mingw* | *pw32*)
536 # don't eliminate duplications in $postdeps and $predeps
537 opt_duplicate_compiler_generated_deps=:
540 opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
544 # Having warned about all mis-specified options, bail out if
545 # anything was wrong.
546 $exit_cmd $EXIT_FAILURE
548 # TEST SUITE MARKER ## BEGIN SOURCABLE
550 # func_check_version_match
551 # Ensure that we are using m4 macros, and libtool script from the same
552 # release of libtool.
553 func_check_version_match ()
555 if test "$package_revision" != "$macro_revision"; then
556 if test "$VERSION" != "$macro_version"; then
557 if test -z "$macro_version"; then
559 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
560 $progname: definition of this LT_INIT comes from an older release.
561 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
562 $progname: and run autoconf again.
566 $progname: Version mismatch error. This is $PACKAGE $VERSION, but the
567 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
568 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
569 $progname: and run autoconf again.
574 $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
575 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
576 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
577 $progname: of $PACKAGE $VERSION and run autoconf again.
587 # True iff FILE is a libtool `.la' library or `.lo' object file.
588 # This function is only a basic sanity check; it will hardly flush out
589 # determined imposters.
592 $SED -e 4q "$1" 2>/dev/null \
593 | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
596 # func_lalib_unsafe_p file
597 # True iff FILE is a libtool `.la' library or `.lo' object file.
598 # This function implements the same check as func_lalib_p without
599 # resorting to external programs. To this end, it redirects stdin and
600 # closes it afterwards, without saving the original file descriptor.
601 # As a safety measure, use it only where a negative result would be
602 # fatal anyway. Works if `file' does not exist.
603 func_lalib_unsafe_p ()
606 if test -r "$1" && exec 5<&1 <"$1"; then
607 for lalib_p_l in 1 2 3 4
610 case "$lalib_p_line" in
611 \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
616 test "$lalib_p" = yes
619 # func_ltwrapper_p file
620 # True iff FILE is a libtool wrapper script.
621 # This function is only a basic sanity check; it will hardly flush out
622 # determined imposters.
629 # func_execute_cmds commands fail_cmd
630 # Execute tilde-delimited COMMANDS.
631 # If FAIL_CMD is given, eval that upon failure.
632 # FAIL_CMD may read-access the current command in variable CMD!
636 save_ifs=$IFS; IFS='~'
640 func_show_eval "$cmd" "${2-:}"
647 # Source FILE, adding directory component if necessary.
648 # Note that it is not necessary on cygwin/mingw to append a dot to
649 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
650 # behavior happens only for exec(3), not for open(2)! Also, sourcing
651 # `FILE.' does not work on cygwin managed mounts.
656 */* | *\\*) . "$1" ;;
662 # Generated shell functions inserted here.
665 # func_win32_libid arg
666 # return the library type of file 'arg'
668 # Need a lot of goo to handle *both* DLLs and import libs
669 # Has to be a shell function in order to 'eat' the argument
670 # that is supplied when $file_magic_command is called.
674 win32_libid_type="unknown"
675 win32_fileres=`file -L $1 2>/dev/null`
676 case $win32_fileres in
677 *ar\ archive\ import\ library*) # definitely import
678 win32_libid_type="x86 archive import"
680 *ar\ archive*) # could be an import, or static
681 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
682 $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
683 win32_nmres=`eval $NM -f posix -A $1 |
684 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
686 import*) win32_libid_type="x86 archive import";;
687 *) win32_libid_type="x86 archive static";;
692 win32_libid_type="x86 DLL"
694 *executable*) # but shell scripts are "executable" too...
695 case $win32_fileres in
696 *MS\ Windows\ PE\ Intel*)
697 win32_libid_type="x86 DLL"
702 $ECHO "$win32_libid_type"
708 # Infer tagged configuration to use if any are available and
709 # if one wasn't chosen via the "--tag" command line option.
710 # Only attempt this if the compiler in the base compile
711 # command doesn't match the default compiler.
712 # arg is usually of the form 'gcc ...'
716 if test -n "$available_tags" && test -z "$tagname"; then
719 func_quote_for_eval "$arg"
720 CC_quoted="$CC_quoted $func_quote_for_eval_result"
723 # Blanks in the command may have been stripped by the calling shell,
724 # but not from the CC environment variable when configure was run.
725 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
726 # Blanks at the start of $base_compile will cause this to fail
727 # if we don't check for them as well.
729 for z in $available_tags; do
730 if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
731 # Evaluate the configuration.
732 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
735 # Double-quote args containing other shell metacharacters.
736 func_quote_for_eval "$arg"
737 CC_quoted="$CC_quoted $func_quote_for_eval_result"
740 " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
741 # The compiler in the base compile command matches
742 # the one in the tagged configuration.
743 # Assume this is the tagged configuration we want.
750 # If $tagname still isn't set, then no tagged configuration
751 # was found and let the user know that the "--tag" command
752 # line option must be used.
753 if test -z "$tagname"; then
754 func_echo "unable to infer tagged configuration"
755 func_fatal_error "specify a tag with \`--tag'"
757 # func_verbose "using $tagname tagged configuration"
766 # func_generate_dlsyms outputname originator pic_p
767 # Extract symbols from dlprefiles and create ${outputname}S.o with
768 # a dlpreopen symbol table.
769 func_generate_dlsyms ()
775 my_prefix=`$ECHO "$my_originator" | sed 's%[[^a-zA-Z0-9]]%_%g'`
778 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
779 if test -n "$NM" && test -n "$global_symbol_pipe"; then
780 my_dlsyms="${my_outputname}S.c"
782 func_error "not configured to extract global symbols from dlpreopened files"
786 if test -n "$my_dlsyms"; then
790 # Discover the nlist of each of the dlfiles.
791 nlist="$output_objdir/${my_outputname}.nm"
793 func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
795 # Parse the name list into a source file.
796 func_echo "creating $output_objdir/$my_dlsyms"
798 $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
799 /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
800 /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
806 /* External symbol declarations for the compiler. */\
809 if test "$dlself" = yes; then
810 func_echo "generating symbol list for \`$output'"
812 $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
814 # Add our own program objects to the symbol list.
815 progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
816 for progfile in $progfiles; do
817 func_echo "extracting global C symbols from \`$progfile'"
818 $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
821 if test -n "$exclude_expsyms"; then
823 eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
824 eval '$MV "$nlist"T "$nlist"'
828 if test -n "$export_symbols_regex"; then
830 eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
831 eval '$MV "$nlist"T "$nlist"'
835 # Prepare the list of exported symbols
836 if test -z "$export_symbols"; then
837 export_symbols="$output_objdir/$outputname.exp"
840 eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
843 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
844 eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
850 eval "${SED} -e 's/\([[].[*^$]]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
851 eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
852 eval '$MV "$nlist"T "$nlist"'
855 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
856 eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
863 for dlprefile in $dlprefiles; do
864 func_echo "extracting global C symbols from \`$dlprefile'"
865 func_basename "$dlprefile"
866 name="$func_basename_result"
868 eval '$ECHO ": $name " >> "$nlist"'
869 eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
874 # Make sure we have at least an empty file.
875 test -f "$nlist" || : > "$nlist"
877 if test -n "$exclude_expsyms"; then
878 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
879 $MV "$nlist"T "$nlist"
882 # Try sorting and uniquifying the output.
883 if $GREP -v "^: " < "$nlist" |
884 if sort -k 3 </dev/null >/dev/null 2>&1; then
889 uniq > "$nlist"S; then
892 $GREP -v "^: " < "$nlist" > "$nlist"S
895 if test -f "$nlist"S; then
896 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
898 $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
901 $ECHO >> "$output_objdir/$my_dlsyms" "\
903 /* The mapping between symbol names and symbols. */
907 $ECHO >> "$output_objdir/$my_dlsyms" "\
908 /* DATA imports from DLLs on WIN32 con't be const, because
909 runtime relocations are performed -- see ld's documentation
915 $ECHO >> "$output_objdir/$my_dlsyms" "\
921 $ECHO >> "$output_objdir/$my_dlsyms" "\
925 lt_${my_prefix}_LTX_preloaded_symbols[[]] =
927 { \"$my_originator\", (void *) 0 },
930 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
932 $ECHO >> "$output_objdir/$my_dlsyms" "\
936 /* This works around a problem in FreeBSD linker */
937 #ifdef FREEBSD_WORKAROUND
938 static const void *lt_preloaded_setup() {
939 return lt_${my_prefix}_LTX_preloaded_symbols;
949 pic_flag_for_symtable=
950 case "$compile_command " in
954 # compiling the symbol table file with pic_flag works around
955 # a FreeBSD bug that causes programs to crash when -lm is
956 # linked before any other PIC object. But we must not use
957 # pic_flag when linking with -static. The problem exists in
958 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
959 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
960 pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
962 pic_flag_for_symtable=" $pic_flag" ;;
964 if test "X$my_pic_p" != Xno; then
965 pic_flag_for_symtable=" $pic_flag"
972 # Now compile the dynamic symbol file.
973 func_show_eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
975 # Clean up the generated files.
976 func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
978 # Transform the symbol file into the correct name.
979 symfileobj="$output_objdir/${my_outputname}S.$objext"
982 if test -f "$output_objdir/$my_outputname.def"; then
983 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
984 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
986 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
987 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
991 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
992 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
997 func_fatal_error "unknown suffix for \`$my_dlsyms'"
1001 # We keep going just in case the user didn't refer to
1002 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
1003 # really was required.
1005 # Nullify the symbol file.
1006 compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
1007 finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
1011 # func_extract_an_archive dir oldlib
1012 func_extract_an_archive ()
1015 f_ex_an_ar_dir="$1"; shift
1016 f_ex_an_ar_oldlib="$1"
1017 func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
1018 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
1021 func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
1026 # func_extract_archives gentop oldlib ...
1027 func_extract_archives ()
1030 my_gentop="$1"; shift
1031 my_oldlibs=${1+"$@"}
1037 for my_xlib in $my_oldlibs; do
1038 # Extract the objects.
1040 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) my_xabs="$my_xlib" ;;
1041 *) my_xabs=`pwd`"/$my_xlib" ;;
1043 func_basename "$my_xlib"
1044 my_xlib="$func_basename_result"
1045 my_xdir="$my_gentop/$my_xlib"
1047 func_mkdir_p "$my_xdir"
1051 func_echo "Extracting $my_xabs"
1052 # Do not bother doing anything if just a dry run
1054 darwin_orig_dir=`pwd`
1055 cd $my_xdir || exit $?
1056 darwin_archive=$my_xabs
1058 darwin_base_archive=`basename $darwin_archive`
1059 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
1060 if test -n "$darwin_arches"; then
1061 darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
1063 func_echo "$darwin_base_archive has multiple architectures $darwin_arches"
1064 for darwin_arch in $darwin_arches ; do
1065 func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1066 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
1067 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
1068 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
1070 $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
1071 done # $darwin_arches
1072 ## Okay now we've a bunch of thin objects, gotta fatten them up :)
1073 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
1076 for darwin_file in $darwin_filelist; do
1077 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
1078 lipo -create -output "$darwin_file" $darwin_files
1079 done # $darwin_filelist
1081 cd "$darwin_orig_dir"
1084 func_extract_an_archive "$my_xdir" "$my_xabs"
1089 func_extract_an_archive "$my_xdir" "$my_xabs"
1092 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
1095 func_extract_archives_result="$my_oldobjs"
1099 # func_mode_compile arg...
1100 func_mode_compile ()
1103 # Get the compilation command and the source file.
1105 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
1116 # do not "continue". Instead, add this to base_compile
1128 # Accept any command-line options.
1131 test -n "$libobj" && \
1132 func_fatal_error "you cannot specify \`-o' more than once"
1137 -shared | -static | -prefer-pic | -prefer-non-pic)
1148 arg_mode=arg # the next one goes into the "base_compile" arg list
1149 continue # The current "srcfile" will either be retained or
1150 ;; # replaced later. I would guess that would be a bug.
1153 func_stripname '-Wc,' '' "$arg"
1154 args=$func_stripname_result
1156 save_ifs="$IFS"; IFS=','
1157 for arg in $args; do
1159 func_quote_for_eval "$arg"
1160 lastarg="$lastarg $func_quote_for_eval_result"
1163 func_stripname ' ' '' "$lastarg"
1164 lastarg=$func_stripname_result
1166 # Add the arguments to base_compile.
1167 base_compile="$base_compile $lastarg"
1172 # Accept the current argument as the source file.
1173 # The previous "srcfile" becomes the current argument.
1180 esac # case $arg_mode
1182 # Aesthetically quote the previous argument.
1183 func_quote_for_eval "$lastarg"
1184 base_compile="$base_compile $func_quote_for_eval_result"
1189 func_fatal_error "you must specify an argument for -Xcompile"
1192 func_fatal_error "you must specify a target with \`-o'"
1195 # Get the name of the library object.
1196 test -z "$libobj" && {
1197 func_basename "$srcfile"
1198 libobj="$func_basename_result"
1203 # Recognize several different file suffixes.
1204 # If the user specifies -o file.o, it is replaced with file.lo
1205 xform='[[cCFSifmso]]'
1214 *.class) xform=class ;;
1219 *.java) xform=java ;;
1222 libobj=`$ECHO "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
1225 *.lo) obj=`$ECHO "X$libobj" | $Xsed -e "$lo2o"` ;;
1227 func_fatal_error "cannot determine name of library object from \`$libobj'"
1231 func_infer_tag $base_compile
1233 for arg in $later; do
1236 test "$build_libtool_libs" != yes && \
1237 func_fatal_configuration "can not build a shared library"
1243 build_libtool_libs=no
1260 func_quote_for_eval "$libobj"
1261 test "X$libobj" != "X$func_quote_for_eval_result" \
1262 && $ECHO "X$libobj" | $GREP ['[@:>@~#^*{};<>?"'"'"' &()|`$@<:@]'] \
1263 && func_warning "libobj name \`$libobj' may not contain shell special characters."
1264 func_basename "$obj"
1265 objname="$func_basename_result"
1266 func_dirname "$obj" "/" ""
1267 xdir="$func_dirname_result"
1268 lobj=${xdir}$objdir/$objname
1270 test -z "$base_compile" && \
1271 func_fatal_help "you must specify a compilation command"
1273 # Delete any leftover library objects.
1274 if test "$build_old_libs" = yes; then
1275 removelist="$obj $lobj $libobj ${libobj}T"
1277 removelist="$lobj $libobj ${libobj}T"
1280 $opt_dry_run || $RM $removelist
1281 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1283 # On Cygwin there's no "real" PIC flag so we must build both object types
1285 cygwin* | mingw* | pw32* | os2*)
1289 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
1290 # non-PIC code in shared libraries is not supported
1294 # Calculate the filename of the output object if compiler does
1295 # not support -o with -c
1296 if test "$compiler_c_o" = no; then
1297 output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[[^.]]*$%%'`.${objext}
1298 lockfile="$output_obj.lock"
1299 removelist="$removelist $output_obj $lockfile"
1300 trap "$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE" 1 2 15
1307 # Lock this critical section if it is needed
1308 # We use this script file to make the link, it avoids creating a new file
1309 if test "$need_locks" = yes; then
1310 until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
1311 func_echo "Waiting for $lockfile to be removed"
1314 elif test "$need_locks" = warn; then
1315 if test -f "$lockfile"; then
1317 *** ERROR, $lockfile exists and contains:
1318 `cat $lockfile 2>/dev/null`
1320 This indicates that another process is trying to use the same
1321 temporary object file, and libtool could not work around it because
1322 your compiler does not support \`-c' and \`-o' together. If you
1323 repeat this compilation, it may succeed, by chance, but you had better
1324 avoid parallel builds (make -j) in this platform, or get a better
1327 $opt_dry_run || $RM $removelist
1330 $ECHO "$srcfile" > "$lockfile"
1333 if test -n "$fix_srcfile_path"; then
1334 eval srcfile=\"$fix_srcfile_path\"
1336 func_quote_for_eval "$srcfile"
1337 qsrcfile=$func_quote_for_eval_result
1339 $opt_dry_run || $RM "$libobj" "${libobj}T"
1341 # Create a libtool object file (analogous to a ".la" file),
1342 # but don't create it if we're doing a dry run.
1343 $opt_dry_run || cat > ${libobj}T <<EOF
1344 # $libobj - a libtool object file
1345 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
1347 # Please DO NOT delete this file!
1348 # It is necessary for linking the library.
1350 # Name of the PIC object.
1353 # Only build a PIC object if we are building libtool libraries.
1354 if test "$build_libtool_libs" = yes; then
1355 # Without this assignment, base_compile gets emptied.
1356 fbsd_hideous_sh_bug=$base_compile
1358 if test "$pic_mode" != no; then
1359 command="$base_compile $qsrcfile $pic_flag"
1361 # Don't build PIC code
1362 command="$base_compile $qsrcfile"
1365 func_mkdir_p "$xdir$objdir"
1367 if test -z "$output_obj"; then
1368 # Place PIC objects in $objdir
1369 command="$command -o $lobj"
1372 $opt_dry_run || $RM "$lobj" "$output_obj"
1374 func_show_eval "$command" \
1375 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
1377 if test "$need_locks" = warn &&
1378 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1380 *** ERROR, $lockfile contains:
1381 `cat $lockfile 2>/dev/null`
1383 but it should contain:
1386 This indicates that another process is trying to use the same
1387 temporary object file, and libtool could not work around it because
1388 your compiler does not support \`-c' and \`-o' together. If you
1389 repeat this compilation, it may succeed, by chance, but you had better
1390 avoid parallel builds (make -j) in this platform, or get a better
1393 $opt_dry_run || $RM $removelist
1397 # Just move the object if needed, then go on to compile the next one
1398 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
1399 func_show_eval '$MV "$output_obj" "$lobj"' \
1400 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1403 # Append the name of the PIC object to the libtool object file.
1404 $opt_dry_run || cat >> ${libobj}T <<EOF
1405 pic_object='$objdir/$objname'
1409 # Allow error messages only from the first compilation.
1410 if test "$suppress_opt" = yes; then
1411 suppress_output=' >/dev/null 2>&1'
1414 # No PIC object so indicate it doesn't exist in the libtool
1416 $opt_dry_run || cat >> ${libobj}T <<EOF
1422 # Only build a position-dependent object if we build old libraries.
1423 if test "$build_old_libs" = yes; then
1424 if test "$pic_mode" != yes; then
1425 # Don't build PIC code
1426 command="$base_compile $qsrcfile"
1428 command="$base_compile $qsrcfile $pic_flag"
1430 if test "$compiler_c_o" = yes; then
1431 command="$command -o $obj"
1434 # Suppress compiler output if we already did a PIC compilation.
1435 command="$command$suppress_output"
1436 $opt_dry_run || $RM "$obj" "$output_obj"
1437 func_show_eval "$command" \
1438 '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
1440 if test "$need_locks" = warn &&
1441 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1443 *** ERROR, $lockfile contains:
1444 `cat $lockfile 2>/dev/null`
1446 but it should contain:
1449 This indicates that another process is trying to use the same
1450 temporary object file, and libtool could not work around it because
1451 your compiler does not support \`-c' and \`-o' together. If you
1452 repeat this compilation, it may succeed, by chance, but you had better
1453 avoid parallel builds (make -j) in this platform, or get a better
1456 $opt_dry_run || $RM $removelist
1460 # Just move the object if needed
1461 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1462 func_show_eval '$MV "$output_obj" "$obj"' \
1463 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
1466 # Append the name of the non-PIC object the libtool object file.
1467 # Only append if the libtool object file exists.
1468 $opt_dry_run || cat >> ${libobj}T <<EOF
1469 # Name of the non-PIC object.
1470 non_pic_object='$objname'
1474 # Append the name of the non-PIC object the libtool object file.
1475 # Only append if the libtool object file exists.
1476 $opt_dry_run || cat >> ${libobj}T <<EOF
1477 # Name of the non-PIC object.
1484 $MV "${libobj}T" "${libobj}"
1486 # Unlock the critical section if it was locked
1487 if test "$need_locks" != no; then
1496 # func_mode_execute arg...
1497 func_mode_execute ()
1500 # The first argument is the command name.
1503 func_fatal_help "you must specify a COMMAND"
1505 # Handle -dlopen flags immediately.
1506 for file in $execute_dlfiles; do
1508 || func_fatal_help "\`$file' is not a file"
1513 # Check to see that this really is a libtool archive.
1514 func_lalib_unsafe_p "$file" \
1515 || func_fatal_help "\`$lib' is not a valid libtool archive"
1517 # Read the libtool library.
1522 # Skip this library if it cannot be dlopened.
1523 if test -z "$dlname"; then
1524 # Warn if it was a shared library.
1525 test -n "$library_names" && \
1526 func_warning "\`$file' was not linked with \`-export-dynamic'"
1530 func_dirname "$file" "" "."
1531 dir="$func_dirname_result"
1533 if test -f "$dir/$objdir/$dlname"; then
1536 func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
1541 # Just add the directory containing the .lo file.
1542 func_dirname "$file" "" "."
1543 dir="$func_dirname_result"
1547 func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
1552 # Get the absolute pathname.
1553 absdir=`cd "$dir" && pwd`
1554 test -n "$absdir" && dir="$absdir"
1556 # Now add the directory to shlibpath_var.
1557 if eval "test -z \"\$$shlibpath_var\""; then
1558 eval "$shlibpath_var=\"\$dir\""
1560 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
1564 # This variable tells wrapper scripts just to set shlibpath_var
1565 # rather than running their programs.
1566 libtool_execute_magic="$magic"
1568 # Check if any of the arguments is a wrapper script.
1575 # Do a test to see if this is really a libtool program.
1576 if func_ltwrapper_p "$file"; then
1579 # Transform arg to wrapped name.
1580 file="$progdir/$program"
1584 # Quote arguments (to preserve shell metacharacters).
1585 func_quote_for_eval "$file"
1586 args="$args $func_quote_for_eval_result"
1589 if test "X$opt_dry_run" = Xfalse; then
1590 if test -n "$shlibpath_var"; then
1591 # Export the shlibpath_var.
1592 eval "export $shlibpath_var"
1595 # Restore saved environment variables
1596 if test "${save_LC_ALL+set}" = set; then
1597 LC_ALL="$save_LC_ALL"; export LC_ALL
1599 if test "${save_LANG+set}" = set; then
1600 LANG="$save_LANG"; export LANG
1603 # Now prepare to actually exec the command.
1604 exec_cmd="\$cmd$args"
1606 # Display what would be done.
1607 if test -n "$shlibpath_var"; then
1608 eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
1609 $ECHO "export $shlibpath_var"
1617 # func_mode_finish arg...
1624 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
1627 libdirs="$libdirs $dir"
1630 for libdir in $libdirs; do
1631 if test -n "$finish_cmds"; then
1632 # Do each command in the finish commands.
1633 func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
1636 if test -n "$finish_eval"; then
1637 # Do the single finish_eval.
1638 eval cmds=\"$finish_eval\"
1639 $opt_dry_run || eval "$cmds" || admincmds="$admincmds
1645 # Exit here if they wanted silent mode.
1646 $opt_silent && exit $EXIT_SUCCESS
1648 $ECHO "X----------------------------------------------------------------------" | $Xsed
1649 $ECHO "Libraries have been installed in:"
1650 for libdir in $libdirs; do
1654 $ECHO "If you ever happen to want to link against installed libraries"
1655 $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
1656 $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
1657 $ECHO "flag during linking and do at least one of the following:"
1658 if test -n "$shlibpath_var"; then
1659 $ECHO " - add LIBDIR to the \`$shlibpath_var' environment variable"
1660 $ECHO " during execution"
1662 if test -n "$runpath_var"; then
1663 $ECHO " - add LIBDIR to the \`$runpath_var' environment variable"
1664 $ECHO " during linking"
1666 if test -n "$hardcode_libdir_flag_spec"; then
1668 eval flag=\"$hardcode_libdir_flag_spec\"
1670 $ECHO " - use the \`$flag' linker flag"
1672 if test -n "$admincmds"; then
1673 $ECHO " - have your system administrator run these commands:$admincmds"
1675 if test -f /etc/ld.so.conf; then
1676 $ECHO " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
1680 $ECHO "See any operating system documentation about shared libraries for"
1682 solaris2.[[6789]]|solaris2.1[[0-9]])
1683 $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
1687 $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
1690 $ECHO "X----------------------------------------------------------------------" | $Xsed
1695 # func_mode_install arg...
1696 func_mode_install ()
1699 # There may be an optional sh(1) argument at the beginning of
1700 # install_prog (especially on Windows NT).
1701 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
1702 # Allow the use of GNU shtool's install command.
1703 $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
1704 # Aesthetically quote it.
1705 func_quote_for_eval "$nonopt"
1706 install_prog="$func_quote_for_eval_result "
1714 # The real first argument should be the name of the installation program.
1715 # Aesthetically quote it.
1716 func_quote_for_eval "$arg"
1717 install_prog="$install_prog$func_quote_for_eval_result"
1719 # We need to accept at least all the BSD install flags.
1729 if test -n "$dest"; then
1730 files="$files $dest"
1738 case " $install_prog " in
1753 # If the previous option needed an argument, then skip it.
1754 if test -n "$prev"; then
1763 # Aesthetically quote the argument.
1764 func_quote_for_eval "$arg"
1765 install_prog="$install_prog $func_quote_for_eval_result"
1768 test -z "$install_prog" && \
1769 func_fatal_help "you must specify an install program"
1771 test -n "$prev" && \
1772 func_fatal_help "the \`$prev' option requires an argument"
1774 if test -z "$files"; then
1775 if test -z "$dest"; then
1776 func_fatal_help "no file or destination specified"
1778 func_fatal_help "you must specify a destination"
1782 # Strip any trailing slash from the destination.
1783 func_stripname '' '/' "$dest"
1784 dest=$func_stripname_result
1786 # Check to see that the destination is a directory.
1787 test -d "$dest" && isdir=yes
1788 if test "$isdir" = yes; then
1792 func_dirname "$dest" "" "."
1793 destdir="$func_dirname_result"
1794 func_basename "$dest"
1795 destname="$func_basename_result"
1797 # Not a directory, so check to see that there is only one file specified.
1798 set dummy $files; shift
1799 test "$#" -gt 1 && \
1800 func_fatal_help "\`$dest' is not a directory"
1803 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) ;;
1805 for file in $files; do
1809 func_fatal_help "\`$destdir' must be an absolute directory name"
1816 # This variable tells wrapper scripts just to set variables rather
1817 # than running their programs.
1818 libtool_install_magic="$magic"
1823 for file in $files; do
1825 # Do each installation.
1828 # Do the static libraries later.
1829 staticlibs="$staticlibs $file"
1833 # Check to see that this really is a libtool archive.
1834 func_lalib_unsafe_p "$file" \
1835 || func_fatal_help "\`$file' is not a valid libtool archive"
1842 # Add the libdir to current_libdirs if it is the destination.
1843 if test "X$destdir" = "X$libdir"; then
1844 case "$current_libdirs " in
1846 *) current_libdirs="$current_libdirs $libdir" ;;
1849 # Note the libdir as a future libdir.
1850 case "$future_libdirs " in
1852 *) future_libdirs="$future_libdirs $libdir" ;;
1856 func_dirname "$file" "/" ""
1857 dir="$func_dirname_result"
1860 if test -n "$relink_command"; then
1861 # Determine the prefix the user has applied to our future dir.
1862 inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
1864 # Don't allow the user to place us outside of our expected
1865 # location b/c this prevents finding dependent libraries that
1866 # are installed to the same prefix.
1867 # At present, this check doesn't affect windows .dll's that
1868 # are installed into $libdir/../bin (currently, that works fine)
1869 # but it's something to keep an eye on.
1870 test "$inst_prefix_dir" = "$destdir" && \
1871 func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
1873 if test -n "$inst_prefix_dir"; then
1874 # Stick the inst_prefix_dir data into the link command.
1875 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
1877 relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
1880 func_warning "relinking \`$file'"
1881 func_show_eval "$relink_command" \
1882 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
1885 # See the names of the shared library.
1886 set dummy $library_names; shift
1887 if test -n "$1"; then
1892 test -n "$relink_command" && srcname="$realname"T
1894 # Install the shared library and build the symlinks.
1895 func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
1899 cygwin* | mingw* | pw32*)
1907 if test -n "$tstripme" && test -n "$striplib"; then
1908 func_show_eval "$striplib $destdir/$realname" 'exit $?'
1911 if test "$#" -gt 0; then
1912 # Delete the old symlinks, and create new ones.
1913 # Try `ln -sf' first, because the `ln' binary might depend on
1914 # the symlink we replace! Solaris /bin/ln does not understand -f,
1915 # so we also need to try rm && ln -s.
1918 test "$linkname" != "$realname" \
1919 && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
1923 # Do each command in the postinstall commands.
1924 lib="$destdir/$realname"
1925 func_execute_cmds "$postinstall_cmds" 'exit $?'
1928 # Install the pseudo-library for information purposes.
1929 func_basename "$file"
1930 name="$func_basename_result"
1931 instname="$dir/$name"i
1932 func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
1934 # Maybe install the static library, too.
1935 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
1939 # Install (i.e. copy) a libtool object.
1941 # Figure out destination file name, if it wasn't already specified.
1942 if test -n "$destname"; then
1943 destfile="$destdir/$destname"
1945 func_basename "$file"
1946 destfile="$func_basename_result"
1947 destfile="$destdir/$destfile"
1950 # Deduce the name of the destination old-style object file.
1953 staticdest=`$ECHO "X$destfile" | $Xsed -e "$lo2o"`
1956 staticdest="$destfile"
1960 func_fatal_help "cannot copy a libtool object to \`$destfile'"
1964 # Install the libtool object if requested.
1965 test -n "$destfile" && \
1966 func_show_eval "$install_prog $file $destfile" 'exit $?'
1968 # Install the old object if enabled.
1969 if test "$build_old_libs" = yes; then
1970 # Deduce the name of the old-style object file.
1971 staticobj=`$ECHO "X$file" | $Xsed -e "$lo2o"`
1972 func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
1978 # Figure out destination file name, if it wasn't already specified.
1979 if test -n "$destname"; then
1980 destfile="$destdir/$destname"
1982 func_basename "$file"
1983 destfile="$func_basename_result"
1984 destfile="$destdir/$destfile"
1987 # If the file is missing, and there is a .exe on the end, strip it
1988 # because it is most likely a libtool script we actually want to
1993 if test ! -f "$file"; then
1994 func_stripname '' '.exe' "$file"
1995 file=$func_stripname_result
2001 # Do a test to see if this is really a libtool program.
2004 func_stripname '' '.exe' "$file"
2005 wrapper=$func_stripname_result
2011 if func_ltwrapper_p "$wrapper"; then
2015 func_source "$wrapper"
2017 # Check the variables that should have been set.
2018 test -z "$generated_by_libtool_version" && \
2019 func_fatal_error "invalid libtool wrapper script \`$wrapper'"
2022 for lib in $notinst_deplibs; do
2023 # Check to see that each library is installed.
2025 if test -f "$lib"; then
2028 libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
2029 if test -n "$libdir" && test ! -f "$libfile"; then
2030 func_warning "\`$lib' has not been installed in \`$libdir'"
2036 func_source "$wrapper"
2039 if test "$fast_install" = no && test -n "$relink_command"; then
2041 if test "$finalize" = yes; then
2042 tmpdir=`func_mktempdir`
2043 func_basename "$file$stripped_ext"
2044 file="$func_basename_result"
2045 outputname="$tmpdir/$file"
2046 # Replace the output file specification.
2047 relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
2050 func_quote_for_expand "$relink_command"
2051 eval "func_echo $func_quote_for_expand_result"
2053 if eval "$relink_command"; then :
2055 func_error "error: relink \`$file' with the above command before installing it"
2056 $opt_dry_run || ${RM}r "$tmpdir"
2061 func_warning "cannot relink \`$file'"
2065 # Install the binary that we compiled earlier.
2066 file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([[^/]]*\)$%$objdir/\1%"`
2070 # remove .exe since cygwin /usr/bin/install will append another
2072 case $install_prog,$host in
2073 */usr/bin/install*,*cygwin*)
2074 case $file:$destfile in
2079 destfile=$destfile.exe
2082 func_stripname '' '.exe' "$destfile"
2083 destfile=$func_stripname_result
2088 func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
2089 $opt_dry_run || if test -n "$outputname"; then
2096 for file in $staticlibs; do
2097 func_basename "$file"
2098 name="$func_basename_result"
2100 # Set up the ranlib parameters.
2101 oldlib="$destdir/$name"
2103 func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
2105 if test -n "$stripme" && test -n "$old_striplib"; then
2106 func_show_eval "$old_striplib $oldlib" 'exit $?'
2109 # Do each command in the postinstall commands.
2110 func_execute_cmds "$old_postinstall_cmds" 'exit $?'
2113 test -n "$future_libdirs" && \
2114 func_warning "remember to run \`$progname --finish$future_libdirs'"
2116 if test -n "$current_libdirs"; then
2117 # Maybe just do a dry run.
2118 $opt_dry_run && current_libdirs=" -n$current_libdirs"
2119 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
2126 # func_mode_link arg...
2131 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2132 # It is impossible to link a dll without this setting, and
2133 # we shouldn't force the makefile maintainer to figure out
2134 # which system we are compiling for in order to pass an extra
2135 # flag for every libtool invocation.
2136 # allow_undefined=no
2138 # FIXME: Unfortunately, there are problems with the above when trying
2139 # to make a dll which has undefined symbols, in which case not
2140 # even a static library is built. For now, we need to specify
2141 # -no-undefined on the libtool link line when we can be certain
2142 # that all symbols are satisfied, otherwise we get a static library.
2149 libtool_args="$nonopt"
2150 base_compile="$nonopt $@"
2151 compile_command="$nonopt"
2152 finalize_command="$nonopt"
2165 lib_search_path=`pwd`
2167 new_inherited_linker_flags=
2175 export_symbols_regex=
2183 precious_files_regex=
2184 prefer_static_libs=no
2198 func_infer_tag $base_compile
2200 # We need to know -static, to get the right output filenames.
2205 test "$build_libtool_libs" != yes && \
2206 func_fatal_configuration "can not build a shared library"
2210 -all-static | -static)
2211 if test "X$arg" = "X-all-static"; then
2212 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
2213 func_warning "complete static linking is impossible in this configuration"
2215 if test -n "$link_static_flag"; then
2216 dlopen_self=$dlopen_self_static
2217 # See comment for -static flag below, for more details.
2218 compile_command="$compile_command $link_static_flag"
2219 finalize_command="$finalize_command $link_static_flag"
2221 prefer_static_libs=yes
2223 if test -z "$pic_flag" && test -n "$link_static_flag"; then
2224 dlopen_self=$dlopen_self_static
2226 prefer_static_libs=built
2228 build_libtool_libs=no
2235 # See if our shared archives depend on static archives.
2236 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
2238 # Go through the arguments, transforming them on the way.
2239 while test "$#" -gt 0; do
2242 func_quote_for_eval "$arg"
2243 qarg="$func_quote_for_eval_unquoted_result"
2244 libtool_args="$libtool_args $func_quote_for_eval_result"
2246 # If the previous option needs an argument, assign it.
2247 if test -n "$prev"; then
2250 compile_command="$compile_command @OUTPUT@"
2251 finalize_command="$finalize_command @OUTPUT@"
2257 if test "$preload" = no; then
2258 # Add the symbol object into the linking commands.
2259 compile_command="$compile_command @SYMFILE@"
2260 finalize_command="$finalize_command @SYMFILE@"
2264 *.la | *.lo) ;; # We handle these cases below.
2266 if test "$dlself" = no; then
2274 if test "$prev" = dlprefiles; then
2276 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
2286 if test "$prev" = dlfiles; then
2287 dlfiles="$dlfiles $arg"
2289 dlprefiles="$dlprefiles $arg"
2297 export_symbols="$arg"
2299 || func_fatal_error "symbol file \`$arg' does not exist"
2304 export_symbols_regex="$arg"
2312 *" $qarg.ltframework "*) ;;
2313 *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
2322 inst_prefix_dir="$arg"
2327 if test -f "$arg"; then
2330 for fil in `cat "$save_arg"`
2332 # moreargs="$moreargs $fil"
2334 # A libtool-controlled object.
2336 # Check to see that this really is a libtool object.
2337 if func_lalib_unsafe_p "$arg"; then
2344 if test -z "$pic_object" ||
2345 test -z "$non_pic_object" ||
2346 test "$pic_object" = none &&
2347 test "$non_pic_object" = none; then
2348 func_fatal_error "cannot find name of object for \`$arg'"
2351 # Extract subdirectory from the argument.
2352 func_dirname "$arg" "/" ""
2353 xdir="$func_dirname_result"
2355 if test "$pic_object" != none; then
2356 # Prepend the subdirectory the object is found in.
2357 pic_object="$xdir$pic_object"
2359 if test "$prev" = dlfiles; then
2360 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2361 dlfiles="$dlfiles $pic_object"
2365 # If libtool objects are unsupported, then we need to preload.
2370 # CHECK ME: I think I busted this. -Ossama
2371 if test "$prev" = dlprefiles; then
2372 # Preload the old-style object.
2373 dlprefiles="$dlprefiles $pic_object"
2378 libobjs="$libobjs $pic_object"
2383 if test "$non_pic_object" != none; then
2384 # Prepend the subdirectory the object is found in.
2385 non_pic_object="$xdir$non_pic_object"
2387 # A standard non-PIC object
2388 non_pic_objects="$non_pic_objects $non_pic_object"
2389 if test -z "$pic_object" || test "$pic_object" = none ; then
2390 arg="$non_pic_object"
2393 # If the PIC object exists, use it instead.
2394 # $xdir was prepended to $pic_object above.
2395 non_pic_object="$pic_object"
2396 non_pic_objects="$non_pic_objects $non_pic_object"
2399 # Only an error if not doing a dry-run.
2400 if $opt_dry_run; then
2401 # Extract subdirectory from the argument.
2402 func_dirname "$arg" "/" ""
2403 xdir="$func_dirname_result"
2405 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2406 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2407 libobjs="$libobjs $pic_object"
2408 non_pic_objects="$non_pic_objects $non_pic_object"
2410 func_fatal_error "\`$arg' is not a valid libtool object"
2415 func_fatal_error "link input file \`$arg' does not exist"
2422 precious_files_regex="$arg"
2432 # We need an absolute path.
2434 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) ;;
2436 func_fatal_error "only absolute run-paths are allowed"
2439 if test "$prev" = rpath; then
2442 *) rpath="$rpath $arg" ;;
2447 *) xrpath="$xrpath $arg" ;;
2459 weak_libs="$weak_libs $arg"
2464 linker_flags="$linker_flags $qarg"
2465 compiler_flags="$compiler_flags $qarg"
2467 compile_command="$compile_command $qarg"
2468 finalize_command="$finalize_command $qarg"
2472 compiler_flags="$compiler_flags $qarg"
2474 compile_command="$compile_command $qarg"
2475 finalize_command="$finalize_command $qarg"
2479 linker_flags="$linker_flags $qarg"
2480 compiler_flags="$compiler_flags $wl$qarg"
2482 compile_command="$compile_command $wl$qarg"
2483 finalize_command="$finalize_command $wl$qarg"
2487 eval "$prev=\"\$arg\""
2492 fi # test -n "$prev"
2498 # The effects of -all-static are defined in a previous loop.
2503 # FIXME: remove this flag sometime in the future.
2504 func_fatal_error "\`-allow-undefined' must not be used because it is the default"
2527 -export-symbols | -export-symbols-regex)
2528 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2529 func_fatal_error "more than one -exported-symbols argument is not allowed"
2531 if test "X$arg" = "X-export-symbols"; then
2549 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
2550 # so, if we see these flags be careful not to treat them like -L
2551 -L[[A-Z]][[A-Z]]*:*)
2552 case $with_gcc/$host in
2553 no/*-*-irix* | /*-*-irix*)
2554 compile_command="$compile_command $arg"
2555 finalize_command="$finalize_command $arg"
2562 func_stripname '-L' '' "$arg"
2563 dir=$func_stripname_result
2564 # We need an absolute path.
2566 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) ;;
2568 absdir=`cd "$dir" && pwd`
2569 test -z "$absdir" && \
2570 func_fatal_error "cannot determine absolute directory name of \`$dir'"
2577 deplibs="$deplibs -L$dir"
2578 lib_search_path="$lib_search_path $dir"
2582 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2583 testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
2584 case :$dllsearchpath: in
2586 *) dllsearchpath="$dllsearchpath:$dir";;
2588 case :$dllsearchpath: in
2589 *":$testbindir:"*) ;;
2590 *) dllsearchpath="$dllsearchpath:$testbindir";;
2598 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
2600 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
2601 # These systems don't actually have a C or math library (as such)
2605 # These systems don't actually have a C library (as such)
2606 test "X$arg" = "X-lc" && continue
2608 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2609 # Do not include libc due to us having libc/libc_r.
2610 test "X$arg" = "X-lc" && continue
2612 *-*-rhapsody* | *-*-darwin1.[[012]])
2613 # Rhapsody C and math libraries are in the System framework
2614 deplibs="$deplibs System.ltframework"
2617 *-*-sco3.2v5* | *-*-sco5v6*)
2618 # Causes problems with __ctype
2619 test "X$arg" = "X-lc" && continue
2621 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
2622 # Compiler inserts libc in the correct place for threads to work
2623 test "X$arg" = "X-lc" && continue
2626 elif test "X$arg" = "X-lc_r"; then
2628 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
2629 # Do not include libc_r directly, use -pthread flag.
2634 deplibs="$deplibs $arg"
2643 # Tru64 UNIX uses -model [arg] to determine the layout of C++
2644 # classes, name mangling, and exception handling.
2645 # Darwin uses the -arch flag to determine output architecture.
2646 -model|-arch|-isysroot)
2647 compile_command="$compile_command $arg"
2648 compiler_flags="$compiler_flags $arg"
2649 finalize_command="$finalize_command $arg"
2654 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2655 compiler_flags="$compiler_flags $arg"
2656 compile_command="$compile_command $arg"
2657 finalize_command="$finalize_command $arg"
2658 case "$new_inherited_linker_flags " in
2660 * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
2672 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
2673 # The PATH hackery in wrapper scripts is required on Windows
2674 # in order for the loader to find any dlls it needs.
2675 func_warning "\`-no-install' is ignored for $host"
2676 func_warning "assuming \`-no-fast-install' instead"
2679 *) no_install=yes ;;
2696 -precious-files-regex)
2717 func_stripname '-R' '' "$arg"
2718 dir=$func_stripname_result
2719 # We need an absolute path.
2721 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) ;;
2723 func_fatal_error "only absolute run-paths are allowed"
2728 *) xrpath="$xrpath $dir" ;;
2734 # The effects of -shared are defined in a previous loop.
2744 # The effects of -static are defined in a previous loop.
2745 # We used to do the same as -all-static on platforms that
2746 # didn't have a PIC flag, but the assumption that the effects
2747 # would be equivalent was wrong. It would break on at least
2748 # Digital Unix and AIX.
2774 func_stripname '-Wc,' '' "$arg"
2775 args=$func_stripname_result
2777 save_ifs="$IFS"; IFS=','
2778 for flag in $args; do
2780 func_quote_for_eval "$flag"
2781 arg="$arg $wl$func_quote_for_eval_result"
2782 compiler_flags="$compiler_flags $func_quote_for_eval_result"
2785 func_stripname ' ' '' "$arg"
2786 arg=$func_stripname_result
2790 func_stripname '-Wl,' '' "$arg"
2791 args=$func_stripname_result
2793 save_ifs="$IFS"; IFS=','
2794 for flag in $args; do
2796 func_quote_for_eval "$flag"
2797 arg="$arg $wl$func_quote_for_eval_result"
2798 compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
2799 linker_flags="$linker_flags $func_quote_for_eval_result"
2802 func_stripname ' ' '' "$arg"
2803 arg=$func_stripname_result
2821 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
2822 # -r[0-9][0-9]* specifies the processor on the SGI compiler
2823 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
2824 # +DA*, +DD* enable 64-bit mode on the HP compiler
2825 # -q* pass through compiler args for the IBM compiler
2826 # -m*, -t[45]*, -txscale* pass through architecture-specific
2827 # compiler args for GCC
2828 -64|-mips[[0-9]]|-r[[0-9]][[0-9]]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
2829 -t[[45]]*|-txscale*)
2830 func_quote_for_eval "$arg"
2831 arg="$func_quote_for_eval_result"
2832 compile_command="$compile_command $arg"
2833 finalize_command="$finalize_command $arg"
2834 compiler_flags="$compiler_flags $arg"
2838 # Some other compiler flag.
2840 func_quote_for_eval "$arg"
2841 arg="$func_quote_for_eval_result"
2845 # A standard object.
2850 # A libtool-controlled object.
2852 # Check to see that this really is a libtool object.
2853 if func_lalib_unsafe_p "$arg"; then
2860 if test -z "$pic_object" ||
2861 test -z "$non_pic_object" ||
2862 test "$pic_object" = none &&
2863 test "$non_pic_object" = none; then
2864 func_fatal_error "cannot find name of object for \`$arg'"
2867 # Extract subdirectory from the argument.
2868 func_dirname "$arg" "/" ""
2869 xdir="$func_dirname_result"
2871 if test "$pic_object" != none; then
2872 # Prepend the subdirectory the object is found in.
2873 pic_object="$xdir$pic_object"
2875 if test "$prev" = dlfiles; then
2876 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
2877 dlfiles="$dlfiles $pic_object"
2881 # If libtool objects are unsupported, then we need to preload.
2886 # CHECK ME: I think I busted this. -Ossama
2887 if test "$prev" = dlprefiles; then
2888 # Preload the old-style object.
2889 dlprefiles="$dlprefiles $pic_object"
2894 libobjs="$libobjs $pic_object"
2899 if test "$non_pic_object" != none; then
2900 # Prepend the subdirectory the object is found in.
2901 non_pic_object="$xdir$non_pic_object"
2903 # A standard non-PIC object
2904 non_pic_objects="$non_pic_objects $non_pic_object"
2905 if test -z "$pic_object" || test "$pic_object" = none ; then
2906 arg="$non_pic_object"
2909 # If the PIC object exists, use it instead.
2910 # $xdir was prepended to $pic_object above.
2911 non_pic_object="$pic_object"
2912 non_pic_objects="$non_pic_objects $non_pic_object"
2915 # Only an error if not doing a dry-run.
2916 if $opt_dry_run; then
2917 # Extract subdirectory from the argument.
2918 func_dirname "$arg" "/" ""
2919 xdir="$func_dirname_result"
2921 pic_object=`$ECHO "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
2922 non_pic_object=`$ECHO "X${xdir}${arg}" | $Xsed -e "$lo2o"`
2923 libobjs="$libobjs $pic_object"
2924 non_pic_objects="$non_pic_objects $non_pic_object"
2926 func_fatal_error "\`$arg' is not a valid libtool object"
2933 deplibs="$deplibs $arg"
2934 old_deplibs="$old_deplibs $arg"
2939 # A libtool-controlled library.
2941 if test "$prev" = dlfiles; then
2942 # This library was specified with -dlopen.
2943 dlfiles="$dlfiles $arg"
2945 elif test "$prev" = dlprefiles; then
2946 # The library was specified with -dlpreopen.
2947 dlprefiles="$dlprefiles $arg"
2950 deplibs="$deplibs $arg"
2955 # Some other compiler argument.
2957 # Unknown arguments in both finalize_command and compile_command need
2958 # to be aesthetically quoted because they are evaled later.
2959 func_quote_for_eval "$arg"
2960 arg="$func_quote_for_eval_result"
2964 # Now actually substitute the argument into the commands.
2965 if test -n "$arg"; then
2966 compile_command="$compile_command $arg"
2967 finalize_command="$finalize_command $arg"
2969 done # argument parsing loop
2971 test -n "$prev" && \
2972 func_fatal_help "the \`$prevarg' option requires an argument"
2974 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
2975 eval arg=\"$export_dynamic_flag_spec\"
2976 compile_command="$compile_command $arg"
2977 finalize_command="$finalize_command $arg"
2981 # calculate the name of the file, without its directory
2982 func_basename "$output"
2983 outputname="$func_basename_result"
2984 libobjs_save="$libobjs"
2986 if test -n "$shlibpath_var"; then
2987 # get the directories listed in $shlibpath_var
2988 eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2992 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2993 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2995 func_dirname "$output" "/" ""
2996 output_objdir="$func_dirname_result$objdir"
2997 # Create the object directory.
2998 func_mkdir_p "$output_objdir"
3000 # Determine the type of output
3003 func_fatal_help "you must specify an output file"
3005 *.$libext) linkmode=oldlib ;;
3006 *.lo | *.$objext) linkmode=obj ;;
3007 *.la) linkmode=lib ;;
3008 *) linkmode=prog ;; # Anything else should be a program.
3014 # Find all interdependent deplibs by searching for libraries
3015 # that are linked more than once (e.g. -la -lb -la)
3016 for deplib in $deplibs; do
3017 if $opt_duplicate_deps ; then
3019 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3022 libs="$libs $deplib"
3025 if test "$linkmode" = lib; then
3026 libs="$predeps $libs $compiler_lib_search_path $postdeps"
3028 # Compute libraries that are listed more than once in $predeps
3029 # $postdeps and mark them as special (i.e., whose duplicates are
3030 # not to be eliminated).
3032 if $opt_duplicate_compiler_generated_deps; then
3033 for pre_post_dep in $predeps $postdeps; do
3034 case "$pre_post_deps " in
3035 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
3037 pre_post_deps="$pre_post_deps $pre_post_dep"
3046 need_relink=no # whether we're linking any uninstalled libtool libraries
3047 notinst_deplibs= # not-installed libtool libraries
3048 notinst_path= # paths that contain not-installed libtool libraries
3052 passes="conv dlpreopen link"
3053 for file in $dlfiles $dlprefiles; do
3057 func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
3068 passes="conv scan dlopen dlpreopen link"
3074 for pass in $passes; do
3075 # The preopen pass in lib mode reverses $deplibs; put it back here
3076 # so that -L comes before libs that need it for instance...
3077 if test "$linkmode,$pass" = "lib,link"; then
3078 ## FIXME: Find the place where the list is rebuilt in the wrong
3079 ## order, and fix it there properly
3081 for deplib in $deplibs; do
3082 tmp_deplibs="$deplib $tmp_deplibs"
3084 deplibs="$tmp_deplibs"
3087 if test "$linkmode,$pass" = "lib,link" ||
3088 test "$linkmode,$pass" = "prog,scan"; then
3092 if test "$linkmode" = prog; then
3094 dlopen) libs="$dlfiles" ;;
3095 dlpreopen) libs="$dlprefiles" ;;
3096 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
3099 if test "$linkmode,$pass" = "lib,dlpreopen"; then
3100 # Collect and forward deplibs of preopened libtool libs
3101 for lib in $dlprefiles; do
3102 # Ignore non-libtool-libs
3105 *.la) func_source "$lib" ;;
3108 # Collect preopened libtool deplibs, except any this library
3109 # has declared as weak libs
3110 for deplib in $dependency_libs; do
3111 deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
3112 case " $weak_libs " in
3113 *" $deplib_base "*) ;;
3114 *) deplibs="$deplibs $deplib" ;;
3120 if test "$pass" = dlopen; then
3121 # Collect dlpreopened libraries
3122 save_deplibs="$deplibs"
3126 for deplib in $libs; do
3130 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
3131 if test "$linkmode,$pass" = "prog,link"; then
3132 compile_deplibs="$deplib $compile_deplibs"
3133 finalize_deplibs="$deplib $finalize_deplibs"
3135 compiler_flags="$compiler_flags $deplib"
3136 if test "$linkmode" = lib ; then
3137 case "$new_inherited_linker_flags " in
3139 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3146 if test "$linkmode" != lib && test "$linkmode" != prog; then
3147 func_warning "\`-l' is ignored for archives/objects"
3150 func_stripname '-l' '' "$deplib"
3151 name=$func_stripname_result
3152 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
3153 for search_ext in .la $std_shrext .so .a; do
3154 # Search the libtool library
3155 lib="$searchdir/lib${name}${search_ext}"
3156 if test -f "$lib"; then
3157 if test "$search_ext" = ".la"; then
3166 if test "$found" != yes; then
3167 # deplib doesn't seem to be a libtool library
3168 if test "$linkmode,$pass" = "prog,link"; then
3169 compile_deplibs="$deplib $compile_deplibs"
3170 finalize_deplibs="$deplib $finalize_deplibs"
3172 deplibs="$deplib $deplibs"
3173 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3176 else # deplib is a libtool library
3177 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
3178 # We need to do some special things here, and not later.
3179 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3180 case " $predeps $postdeps " in
3182 if func_lalib_p "$lib"; then
3186 for l in $old_library $library_names; do
3189 if test "X$ll" = "X$old_library" ; then # only static version available
3191 func_dirname "$lib" "" "."
3192 ladir="$func_dirname_result"
3193 lib=$ladir/$old_library
3194 if test "$linkmode,$pass" = "prog,link"; then
3195 compile_deplibs="$deplib $compile_deplibs"
3196 finalize_deplibs="$deplib $finalize_deplibs"
3198 deplibs="$deplib $deplibs"
3199 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
3211 if test "$linkmode,$pass" = "prog,link"; then
3212 compile_deplibs="$deplib $compile_deplibs"
3213 finalize_deplibs="$deplib $finalize_deplibs"
3215 deplibs="$deplib $deplibs"
3216 if test "$linkmode" = lib ; then
3217 case "$new_inherited_linker_flags " in
3219 * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
3228 deplibs="$deplib $deplibs"
3229 test "$pass" = conv && continue
3230 newdependency_libs="$deplib $newdependency_libs"
3231 func_stripname '-L' '' "$deplib"
3232 newlib_search_path="$newlib_search_path $func_stripname_result"
3235 if test "$pass" = conv; then
3236 deplibs="$deplib $deplibs"
3239 if test "$pass" = scan; then
3240 deplibs="$deplib $deplibs"
3242 compile_deplibs="$deplib $compile_deplibs"
3243 finalize_deplibs="$deplib $finalize_deplibs"
3245 func_stripname '-L' '' "$deplib"
3246 newlib_search_path="$newlib_search_path $func_stripname_result"
3249 func_warning "\`-L' is ignored for archives/objects"
3255 if test "$pass" = link; then
3256 func_stripname '-R' '' "$deplib"
3257 dir=$func_stripname_result
3258 # Make sure the xrpath contains only unique directories.
3261 *) xrpath="$xrpath $dir" ;;
3264 deplibs="$deplib $deplibs"
3267 *.la) lib="$deplib" ;;
3269 if test "$pass" = conv; then
3270 deplibs="$deplib $deplibs"
3275 # Linking convenience modules into shared libraries is allowed,
3276 # but linking other static libraries is non-portable.
3277 case " $dlpreconveniencelibs " in
3281 case $deplibs_check_method in
3283 set dummy $deplibs_check_method; shift
3284 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
3285 if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
3286 | $EGREP "$match_pattern_regex" > /dev/null; then
3294 if test "$valid_a_lib" != yes; then
3296 $ECHO "*** Warning: Trying to link with static lib archive $deplib."
3297 $ECHO "*** I have the capability to make that library automatically link in when"
3298 $ECHO "*** you link to this library. But I can only do this if you have a"
3299 $ECHO "*** shared version of the library, which you do not appear to have"
3300 $ECHO "*** because the file extensions .$libext of this argument makes me believe"
3301 $ECHO "*** that it is just a static archive that I should not use here."
3304 $ECHO "*** Warning: Linking the shared library $output against the"
3305 $ECHO "*** static library $deplib is not portable!"
3306 deplibs="$deplib $deplibs"
3313 if test "$pass" != link; then
3314 deplibs="$deplib $deplibs"
3316 compile_deplibs="$deplib $compile_deplibs"
3317 finalize_deplibs="$deplib $finalize_deplibs"
3324 if test "$pass" = conv; then
3325 deplibs="$deplib $deplibs"
3326 elif test "$linkmode" = prog; then
3327 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
3328 # If there is no dlopen support or we're linking statically,
3329 # we need to preload.
3330 newdlprefiles="$newdlprefiles $deplib"
3331 compile_deplibs="$deplib $compile_deplibs"
3332 finalize_deplibs="$deplib $finalize_deplibs"
3334 newdlfiles="$newdlfiles $deplib"
3345 if test "$found" = yes || test -f "$lib"; then :
3347 func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
3350 # Check to see that this really is a libtool archive.
3351 func_lalib_unsafe_p "$lib" \
3352 || func_fatal_error "\`$lib' is not a valid libtool archive"
3354 func_dirname "$lib" "" "."
3355 ladir="$func_dirname_result"
3363 inherited_linker_flags=
3364 # If the library was installed with an old release of libtool,
3365 # it will not redefine variables installed, or shouldnotlink
3374 # Convert "-framework foo" to "foo.ltframework"
3375 if test -n "$inherited_linker_flags"; then
3376 tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([[^ $]]*\)/\1.ltframework/g'`
3377 for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
3378 case " $new_inherited_linker_flags " in
3379 *" $tmp_inherited_linker_flag "*) ;;
3380 *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
3384 dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
3385 if test "$linkmode,$pass" = "prog,link"; then
3386 compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
3387 finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
3389 compiler_flags="$compiler_flags $inherited_linker_flags"
3391 if test "$linkmode,$pass" = "lib,link" ||
3392 test "$linkmode,$pass" = "prog,scan" ||
3393 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
3394 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
3395 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
3398 if test "$pass" = conv; then
3399 # Only check for convenience libraries
3400 deplibs="$lib $deplibs"
3401 if test -z "$libdir"; then
3402 if test -z "$old_library"; then
3403 func_fatal_error "cannot find name of link library for \`$lib'"
3405 # It is a libtool convenience library, so add in its objects.
3406 convenience="$convenience $ladir/$objdir/$old_library"
3407 old_convenience="$old_convenience $ladir/$objdir/$old_library"
3408 elif test "$linkmode" != prog && test "$linkmode" != lib; then
3409 func_fatal_error "\`$lib' is not a convenience library"
3412 for deplib in $dependency_libs; do
3413 deplibs="$deplib $deplibs"
3414 if $opt_duplicate_deps ; then
3415 case "$tmp_libs " in
3416 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3419 tmp_libs="$tmp_libs $deplib"
3425 # Get the name of the library we link against.
3427 for l in $old_library $library_names; do
3430 if test -z "$linklib"; then
3431 func_fatal_error "cannot find name of link library for \`$lib'"
3434 # This library was specified with -dlopen.
3435 if test "$pass" = dlopen; then
3436 if test -z "$libdir"; then
3437 func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
3439 if test -z "$dlname" ||
3440 test "$dlopen_support" != yes ||
3441 test "$build_libtool_libs" = no; then
3442 # If there is no dlname, no dlopen support or we're linking
3443 # statically, we need to preload. We also need to preload any
3444 # dependent libraries so libltdl's deplib preloader doesn't
3445 # bomb out in the load deplibs phase.
3446 dlprefiles="$dlprefiles $lib $dependency_libs"
3448 newdlfiles="$newdlfiles $lib"
3453 # We need an absolute path.
3455 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) abs_ladir="$ladir" ;;
3457 abs_ladir=`cd "$ladir" && pwd`
3458 if test -z "$abs_ladir"; then
3459 func_warning "cannot determine absolute directory name of \`$ladir'"
3460 func_warning "passing it literally to the linker, although it might fail"
3465 func_basename "$lib"
3466 laname="$func_basename_result"
3468 # Find the relevant object directory and library name.
3469 if test "X$installed" = Xyes; then
3470 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3471 func_warning "library \`$lib' was moved."
3479 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
3481 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
3484 # Remove this search path later
3485 notinst_path="$notinst_path $abs_ladir"
3487 dir="$ladir/$objdir"
3488 absdir="$abs_ladir/$objdir"
3489 # Remove this search path later
3490 notinst_path="$notinst_path $abs_ladir"
3492 fi # $installed = yes
3493 func_stripname 'lib' '.la' "$laname"
3494 name=$func_stripname_result
3496 # This library was specified with -dlpreopen.
3497 if test "$pass" = dlpreopen; then
3498 if test -z "$libdir" && test "$linkmode" = prog; then
3499 func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
3501 # Prefer using a static library (so that no silly _DYNAMIC symbols
3502 # are required to link).
3503 if test -n "$old_library"; then
3504 newdlprefiles="$newdlprefiles $dir/$old_library"
3505 # Keep a list of preopened convenience libraries to check
3506 # that they are being used correctly in the link pass.
3507 test -z "$libdir" && \
3508 dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
3509 # Otherwise, use the dlname, so that lt_dlopen finds it.
3510 elif test -n "$dlname"; then
3511 newdlprefiles="$newdlprefiles $dir/$dlname"
3513 newdlprefiles="$newdlprefiles $dir/$linklib"
3515 fi # $pass = dlpreopen
3517 if test -z "$libdir"; then
3518 # Link the convenience library
3519 if test "$linkmode" = lib; then
3520 deplibs="$dir/$old_library $deplibs"
3521 elif test "$linkmode,$pass" = "prog,link"; then
3522 compile_deplibs="$dir/$old_library $compile_deplibs"
3523 finalize_deplibs="$dir/$old_library $finalize_deplibs"
3525 deplibs="$lib $deplibs" # used for prog,scan pass
3531 if test "$linkmode" = prog && test "$pass" != link; then
3532 newlib_search_path="$newlib_search_path $ladir"
3533 deplibs="$lib $deplibs"
3536 if test "$link_all_deplibs" != no || test -z "$library_names" ||
3537 test "$build_libtool_libs" = no; then
3542 for deplib in $dependency_libs; do
3544 -L*) func_stripname '-L' '' "$deplib"
3545 newlib_search_path="$newlib_search_path $func_stripname_result"
3548 # Need to link against all dependency_libs?
3549 if test "$linkalldeplibs" = yes; then
3550 deplibs="$deplib $deplibs"
3552 # Need to hardcode shared library paths
3553 # or/and link against static libraries
3554 newdependency_libs="$deplib $newdependency_libs"
3556 if $opt_duplicate_deps ; then
3557 case "$tmp_libs " in
3558 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3561 tmp_libs="$tmp_libs $deplib"
3564 fi # $linkmode = prog...
3566 if test "$linkmode,$pass" = "prog,link"; then
3567 if test -n "$library_names" &&
3568 { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
3569 # We need to hardcode the library path
3570 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
3571 # Make sure the rpath contains only unique directories.
3572 case "$temp_rpath " in
3574 *) temp_rpath="$temp_rpath:$absdir" ;;
3578 # Hardcode the library path.
3579 # Skip directories that are in the system default run-time
3581 case " $sys_lib_dlsearch_path " in
3584 case "$compile_rpath " in
3586 *) compile_rpath="$compile_rpath $absdir"
3590 case " $sys_lib_dlsearch_path " in
3593 case "$finalize_rpath " in
3595 *) finalize_rpath="$finalize_rpath $libdir"
3599 fi # $linkmode,$pass = prog,link...
3601 if test "$alldeplibs" = yes &&
3602 { test "$deplibs_check_method" = pass_all ||
3603 { test "$build_libtool_libs" = yes &&
3604 test -n "$library_names"; }; }; then
3605 # We only need to search for static libraries
3610 link_static=no # Whether the deplib will be linked statically
3611 use_static_libs=$prefer_static_libs
3612 if test "$use_static_libs" = built && test "$installed" = yes; then
3615 if test -n "$library_names" &&
3616 { test "$use_static_libs" = no || test -z "$old_library"; }; then
3619 # No point in relinking DLLs because paths are not encoded
3620 notinst_deplibs="$notinst_deplibs $lib"
3624 if test "$installed" = no; then
3625 notinst_deplibs="$notinst_deplibs $lib"
3630 # This is a shared library
3632 # Warn about portability, can't link against -module's on some
3633 # systems (darwin). Don't bleat about dlopened modules though!
3635 for dlpremoduletest in $dlprefiles; do
3636 if test "X$dlpremoduletest" = "X$lib"; then
3637 dlopenmodule="$dlpremoduletest"
3641 if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
3643 if test "$linkmode" = prog; then
3644 $ECHO "*** Warning: Linking the executable $output against the loadable module"
3646 $ECHO "*** Warning: Linking the shared library $output against the loadable module"
3648 $ECHO "*** $linklib is not portable!"
3650 if test "$linkmode" = lib &&
3651 test "$hardcode_into_libs" = yes; then
3652 # Hardcode the library path.
3653 # Skip directories that are in the system default run-time
3655 case " $sys_lib_dlsearch_path " in
3658 case "$compile_rpath " in
3660 *) compile_rpath="$compile_rpath $absdir"
3664 case " $sys_lib_dlsearch_path " in
3667 case "$finalize_rpath " in
3669 *) finalize_rpath="$finalize_rpath $libdir"
3675 if test -n "$old_archive_from_expsyms_cmds"; then
3676 # figure out the soname
3677 set dummy $library_names
3681 libname=`eval "\\$ECHO \"$libname_spec\""`
3682 # use dlname if we got it. it's perfectly good, no?
3683 if test -n "$dlname"; then
3685 elif test -n "$soname_spec"; then
3689 major=`expr $current - $age`
3693 eval soname=\"$soname_spec\"
3698 # Make a new name for the extract_expsyms_cmds to use
3700 func_basename "$soroot"
3701 soname="$func_basename_result"
3702 func_stripname 'lib' '.dll' "$soname"
3703 newlib=libimp-$func_stripname_result.a
3705 # If the library has no export list, then create one now
3706 if test -f "$output_objdir/$soname-def"; then :
3708 func_echo "extracting exported symbol list from \`$soname'"
3709 func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
3713 if test -f "$output_objdir/$newlib"; then :; else
3714 func_echo "generating import library for \`$soname'"
3715 func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
3717 # make sure the library variables are pointing to the new library
3720 fi # test -n "$old_archive_from_expsyms_cmds"
3722 if test "$linkmode" = prog || test "$mode" != relink; then
3727 case $hardcode_action in
3728 immediate | unsupported)
3729 if test "$hardcode_direct" = no; then
3732 *-*-sco3.2v5.0.[[024]]*) add_dir="-L$dir" ;;
3733 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
3734 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[[01]].[[10]]* | \
3735 *-*-unixware7*) add_dir="-L$dir" ;;
3737 # if the lib is a (non-dlopened) module then we can not
3738 # link against it, someone is ignoring the earlier warnings
3739 if /usr/bin/file -L $add 2> /dev/null |
3740 $GREP ": [[^:]]* bundle" >/dev/null ; then
3741 if test "X$dlopenmodule" != "X$lib"; then
3742 $ECHO "*** Warning: lib $linklib is a module, not a shared library"
3743 if test -z "$old_library" ; then
3745 $ECHO "*** And there doesn't seem to be a static archive available"
3746 $ECHO "*** The link will probably fail, sorry"
3748 add="$dir/$old_library"
3750 elif test -n "$old_library"; then
3751 add="$dir/$old_library"
3755 elif test "$hardcode_minus_L" = no; then
3757 *-*-sunos*) add_shlibpath="$dir" ;;
3761 elif test "$hardcode_shlibpath_var" = no; then
3762 add_shlibpath="$dir"
3769 if test "$hardcode_direct" = yes; then
3771 elif test "$hardcode_minus_L" = yes; then
3773 # Try looking first in the location we're being installed to.
3774 if test -n "$inst_prefix_dir"; then
3777 add_dir="$add_dir -L$inst_prefix_dir$libdir"
3782 elif test "$hardcode_shlibpath_var" = yes; then
3783 add_shlibpath="$dir"
3792 if test "$lib_linked" != yes; then
3793 func_fatal_configuration "unsupported hardcode properties"
3796 if test -n "$add_shlibpath"; then
3797 case :$compile_shlibpath: in
3798 *":$add_shlibpath:"*) ;;
3799 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
3802 if test "$linkmode" = prog; then
3803 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
3804 test -n "$add" && compile_deplibs="$add $compile_deplibs"
3806 test -n "$add_dir" && deplibs="$add_dir $deplibs"
3807 test -n "$add" && deplibs="$add $deplibs"
3808 if test "$hardcode_direct" != yes &&
3809 test "$hardcode_minus_L" != yes &&
3810 test "$hardcode_shlibpath_var" = yes; then
3811 case :$finalize_shlibpath: in
3813 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
3819 if test "$linkmode" = prog || test "$mode" = relink; then
3823 # Finalize command for both is simple: just hardcode it.
3824 if test "$hardcode_direct" = yes; then
3825 add="$libdir/$linklib"
3826 elif test "$hardcode_minus_L" = yes; then
3829 elif test "$hardcode_shlibpath_var" = yes; then
3830 case :$finalize_shlibpath: in
3832 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
3835 elif test "$hardcode_automatic" = yes; then
3836 if test -n "$inst_prefix_dir" &&
3837 test -f "$inst_prefix_dir$libdir/$linklib" ; then
3838 add="$inst_prefix_dir$libdir/$linklib"
3840 add="$libdir/$linklib"
3843 # We cannot seem to hardcode it, guess we'll fake it.
3845 # Try looking first in the location we're being installed to.
3846 if test -n "$inst_prefix_dir"; then
3849 add_dir="$add_dir -L$inst_prefix_dir$libdir"
3856 if test "$linkmode" = prog; then
3857 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
3858 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
3860 test -n "$add_dir" && deplibs="$add_dir $deplibs"
3861 test -n "$add" && deplibs="$add $deplibs"
3864 elif test "$linkmode" = prog; then
3865 # Here we assume that one of hardcode_direct or hardcode_minus_L
3866 # is not unsupported. This is valid on all known static and
3868 if test "$hardcode_direct" != unsupported; then
3869 test -n "$old_library" && linklib="$old_library"
3870 compile_deplibs="$dir/$linklib $compile_deplibs"
3871 finalize_deplibs="$dir/$linklib $finalize_deplibs"
3873 compile_deplibs="-l$name -L$dir $compile_deplibs"
3874 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
3876 elif test "$build_libtool_libs" = yes; then
3877 # Not a shared library
3878 if test "$deplibs_check_method" != pass_all; then
3879 # We're trying link a shared library against a static one
3880 # but the system doesn't support it.
3882 # Just print a warning and add the library to dependency_libs so
3883 # that the program can be linked against the static library.
3885 $ECHO "*** Warning: This system can not link to static lib archive $lib."
3886 $ECHO "*** I have the capability to make that library automatically link in when"
3887 $ECHO "*** you link to this library. But I can only do this if you have a"
3888 $ECHO "*** shared version of the library, which you do not appear to have."
3889 if test "$module" = yes; then
3890 $ECHO "*** But as you try to build a module library, libtool will still create "
3891 $ECHO "*** a static module, that should work as long as the dlopening application"
3892 $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
3893 if test -z "$global_symbol_pipe"; then
3895 $ECHO "*** However, this would only work if libtool was able to extract symbol"
3896 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
3897 $ECHO "*** not find such a program. So, this module is probably useless."
3898 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
3900 if test "$build_old_libs" = no; then
3901 build_libtool_libs=module
3904 build_libtool_libs=no
3908 deplibs="$dir/$old_library $deplibs"
3911 fi # link shared/static library?
3913 if test "$linkmode" = lib; then
3914 if test -n "$dependency_libs" &&
3915 { test "$hardcode_into_libs" != yes ||
3916 test "$build_old_libs" = yes ||
3917 test "$link_static" = yes; }; then
3918 # Extract -R from dependency_libs
3920 for libdir in $dependency_libs; do
3922 -R*) func_stripname '-R' '' "$libdir"
3923 temp_xrpath=$func_stripname_result
3925 *" $temp_xrpath "*) ;;
3926 *) xrpath="$xrpath $temp_xrpath";;
3928 *) temp_deplibs="$temp_deplibs $libdir";;
3931 dependency_libs="$temp_deplibs"
3934 newlib_search_path="$newlib_search_path $absdir"
3935 # Link against this library
3936 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
3937 # ... and its dependency_libs
3939 for deplib in $dependency_libs; do
3940 newdependency_libs="$deplib $newdependency_libs"
3941 if $opt_duplicate_deps ; then
3942 case "$tmp_libs " in
3943 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
3946 tmp_libs="$tmp_libs $deplib"
3949 if test "$link_all_deplibs" != no; then
3950 # Add the search paths of all dependency libraries
3951 for deplib in $dependency_libs; do
3953 -L*) path="$deplib" ;;
3955 func_dirname "$deplib" "" "."
3956 dir="$func_dirname_result"
3957 # We need an absolute path.
3959 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) absdir="$dir" ;;
3961 absdir=`cd "$dir" && pwd`
3962 if test -z "$absdir"; then
3963 func_warning "cannot determine absolute directory name of \`$dir'"
3968 if $GREP "^installed=no" $deplib > /dev/null; then
3972 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
3973 if test -n "$deplibrary_names" ; then
3974 for tmp in $deplibrary_names ; do
3977 if test -f "$absdir/$objdir/$depdepl" ; then
3978 depdepl="$absdir/$objdir/$depdepl"
3979 darwin_install_name=`otool -L $depdepl | $SED -n -e '3q;2,2p' | $SED -e 's/(.*//'`
3980 darwin_install_name=`$ECHO $darwin_install_name`
3981 compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
3982 linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
3988 path="-L$absdir/$objdir"
3992 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3993 test -z "$libdir" && \
3994 func_fatal_error "\`$deplib' is not a valid libtool archive"
3995 test "$absdir" != "$libdir" && \
3996 func_warning "\`$deplib' seems to be moved"
4002 case " $deplibs " in
4004 *) deplibs="$path $deplibs" ;;
4007 fi # link_all_deplibs != no
4009 done # for deplib in $libs
4010 dependency_libs="$newdependency_libs"
4011 if test "$pass" = dlpreopen; then
4012 # Link the dlpreopened libraries before other libraries
4013 for deplib in $save_deplibs; do
4014 deplibs="$deplib $deplibs"
4017 if test "$pass" != dlopen; then
4018 if test "$pass" != conv; then
4019 # Make sure lib_search_path contains only unique directories.
4021 for dir in $newlib_search_path; do
4022 case "$lib_search_path " in
4024 *) lib_search_path="$lib_search_path $dir" ;;
4030 if test "$linkmode,$pass" != "prog,link"; then
4033 vars="compile_deplibs finalize_deplibs"
4035 for var in $vars dependency_libs; do
4036 # Add libraries to $var in reverse order
4037 eval tmp_libs=\"\$$var\"
4039 for deplib in $tmp_libs; do
4040 # FIXME: Pedantically, this is the right thing to do, so
4041 # that some nasty dependency loop isn't accidentally
4043 #new_libs="$deplib $new_libs"
4044 # Pragmatically, this seems to cause very few problems in
4047 -L*) new_libs="$deplib $new_libs" ;;
4050 # And here is the reason: when a library appears more
4051 # than once as an explicit dependence of a library, or
4052 # is implicitly linked in more than once by the
4053 # compiler, it is considered special, and multiple
4054 # occurrences thereof are not removed. Compare this
4055 # with having the same library being listed as a
4056 # dependency of multiple other libraries: in this case,
4057 # we know (pedantically, we assume) the library does not
4058 # need to be listed more than once, so we keep only the
4059 # last copy. This is not always right, but it is rare
4060 # enough that we require users that really mean to play
4061 # such unportable linking tricks to link the library
4062 # using -Wl,-lname, so that libtool does not consider it
4063 # for duplicate removal.
4064 case " $specialdeplibs " in
4065 *" $deplib "*) new_libs="$deplib $new_libs" ;;
4067 case " $new_libs " in
4069 *) new_libs="$deplib $new_libs" ;;
4077 for deplib in $new_libs; do
4080 case " $tmp_libs " in
4082 *) tmp_libs="$tmp_libs $deplib" ;;
4085 *) tmp_libs="$tmp_libs $deplib" ;;
4088 eval $var=\"$tmp_libs\"
4091 # Last step: remove runtime libs from dependency_libs
4092 # (they stay in deplibs)
4094 for i in $dependency_libs ; do
4095 case " $predeps $postdeps $compiler_lib_search_path " in
4100 if test -n "$i" ; then
4101 tmp_libs="$tmp_libs $i"
4104 dependency_libs=$tmp_libs
4106 if test "$linkmode" = prog; then
4107 dlfiles="$newdlfiles"
4109 if test "$linkmode" = prog || test "$linkmode" = lib; then
4110 dlprefiles="$newdlprefiles"
4115 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4116 func_warning "\`-dlopen' is ignored for archives"
4119 test -n "$deplibs" && \
4120 func_warning "\`-l' and \`-L' are ignored for archives"
4123 test -n "$rpath" && \
4124 func_warning "\`-rpath' is ignored for archives"
4126 test -n "$xrpath" && \
4127 func_warning "\`-R' is ignored for archives"
4129 test -n "$vinfo" && \
4130 func_warning "\`-version-info/-version-number' is ignored for archives"
4132 test -n "$release" && \
4133 func_warning "\`-release' is ignored for archives"
4135 test -n "$export_symbols$export_symbols_regex" && \
4136 func_warning "\`-export-symbols' is ignored for archives"
4138 # Now set the variables for building old libraries.
4139 build_libtool_libs=no
4141 objs="$objs$old_deplibs"
4145 # Make sure we only generate libraries of the form `libNAME.la'.
4148 func_stripname 'lib' '.la' "$outputname"
4149 name=$func_stripname_result
4150 eval shared_ext=\"$shrext_cmds\"
4151 eval libname=\"$libname_spec\"
4154 test "$module" = no && \
4155 func_fatal_help "libtool library \`$output' must begin with \`lib'"
4157 if test "$need_lib_prefix" != no; then
4158 # Add the "lib" prefix for modules if required
4159 func_stripname '' '.la' "$outputname"
4160 name=$func_stripname_result
4161 eval shared_ext=\"$shrext_cmds\"
4162 eval libname=\"$libname_spec\"
4164 func_stripname '' '.la' "$outputname"
4165 libname=$func_stripname_result
4170 if test -n "$objs"; then
4171 if test "$deplibs_check_method" != pass_all; then
4172 func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
4175 $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
4176 $ECHO "*** objects $objs is not portable!"
4177 libobjs="$libobjs $objs"
4181 test "$dlself" != no && \
4182 func_warning "\`-dlopen self' is ignored for libtool libraries"
4186 test "$#" -gt 1 && \
4187 func_warning "ignoring multiple \`-rpath's for a libtool library"
4192 if test -z "$rpath"; then
4193 if test "$build_libtool_libs" = yes; then
4194 # Building a libtool convenience library.
4195 # Some compilers have problems with a `.al' extension so
4196 # convenience libraries should have the same extension an
4197 # archive normally would.
4198 oldlibs="$output_objdir/$libname.$libext $oldlibs"
4199 build_libtool_libs=convenience
4203 test -n "$vinfo" && \
4204 func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
4206 test -n "$release" && \
4207 func_warning "\`-release' is ignored for convenience libraries"
4210 # Parse the version information argument.
4211 save_ifs="$IFS"; IFS=':'
4212 set dummy $vinfo 0 0 0
4217 func_fatal_help "too many parameters to \`-version-info'"
4219 # convert absolute version numbers to libtool ages
4220 # this retains compatibility with .la files and attempts
4221 # to make the code below a bit more comprehensible
4223 case $vinfo_number in
4227 number_revision="$3"
4229 # There are really only two kinds -- those that
4230 # use the current revision as the major version
4231 # and those that subtract age and use age as
4232 # a minor version. But, then there is irix
4233 # which has an extra 1 added just for fun
4235 case $version_type in
4236 darwin|linux|osf|windows)
4237 current=`expr $number_major + $number_minor`
4239 revision="$number_revision"
4241 freebsd-aout|freebsd-elf|sunos)
4242 current="$number_major"
4243 revision="$number_minor"
4247 current=`expr $number_major + $number_minor - 1`
4249 revision="$number_minor"
4260 # Check that each of the things are valid numbers.
4262 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]]) ;;
4264 func_error "CURRENT \`$current' must be a nonnegative integer"
4265 func_fatal_error "\`$vinfo' is not valid version information"
4270 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]]) ;;
4272 func_error "REVISION \`$revision' must be a nonnegative integer"
4273 func_fatal_error "\`$vinfo' is not valid version information"
4278 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]]) ;;
4280 func_error "AGE \`$age' must be a nonnegative integer"
4281 func_fatal_error "\`$vinfo' is not valid version information"
4285 if test "$age" -gt "$current"; then
4286 func_error "AGE \`$age' is greater than the current interface number \`$current'"
4287 func_fatal_error "\`$vinfo' is not valid version information"
4290 # Calculate the version variables.
4294 case $version_type in
4298 # Like Linux, but with the current version available in
4299 # verstring for coding it into the library header
4300 major=.`expr $current - $age`
4301 versuffix="$major.$age.$revision"
4302 # Darwin ld doesn't like 0 for these options...
4303 minor_current=`expr $current + 1`
4304 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
4309 versuffix=".$current.$revision";
4314 versuffix=".$current"
4318 major=`expr $current - $age + 1`
4320 case $version_type in
4321 nonstopux) verstring_prefix=nonstopux ;;
4322 *) verstring_prefix=sgi ;;
4324 verstring="$verstring_prefix$major.$revision"
4326 # Add in all the interfaces that we are compatible with.
4328 while test "$loop" -ne 0; do
4329 iface=`expr $revision - $loop`
4330 loop=`expr $loop - 1`
4331 verstring="$verstring_prefix$major.$iface:$verstring"
4334 # Before this point, $major must not contain `.'.
4336 versuffix="$major.$revision"
4340 major=.`expr $current - $age`
4341 versuffix="$major.$age.$revision"
4345 major=.`expr $current - $age`
4346 versuffix=".$current.$age.$revision"
4347 verstring="$current.$age.$revision"
4349 # Add in all the interfaces that we are compatible with.
4351 while test "$loop" -ne 0; do
4352 iface=`expr $current - $loop`
4353 loop=`expr $loop - 1`
4354 verstring="$verstring:${iface}.0"
4357 # Make executables depend on our current version.
4358 verstring="$verstring:${current}.0"
4363 versuffix=".$current"
4368 versuffix=".$current.$revision"
4372 # Use '-' rather than '.', since we only want one
4373 # extension on DOS 8.3 filesystems.
4374 major=`expr $current - $age`
4379 func_fatal_configuration "unknown library version type \`$version_type'"
4383 # Clear the version info if we defaulted, and they specified a release.
4384 if test -z "$vinfo" && test -n "$release"; then
4386 case $version_type in
4388 # we can't check for "0.0" in archive_cmds due to quoting
4389 # problems, so we reset it completely
4396 if test "$need_version" = no; then
4403 # Remove version info from name if versioning should be avoided
4404 if test "$avoid_version" = yes && test "$need_version" = no; then
4410 # Check to see if the archive will have undefined symbols.
4411 if test "$allow_undefined" = yes; then
4412 if test "$allow_undefined_flag" = unsupported; then
4413 func_warning "undefined symbols not allowed in $host shared libraries"
4414 build_libtool_libs=no
4418 # Don't allow undefined symbols.
4419 allow_undefined_flag="$no_undefined_flag"
4424 func_generate_dlsyms "$libname" "$libname" "yes"
4425 libobjs="$libobjs $symfileobj"
4427 if test "$mode" != relink; then
4428 # Remove our outputs, but don't remove object files since they
4429 # may have been created when compiling PIC objects.
4431 tempremovelist=`$ECHO "$output_objdir/*"`
4432 for p in $tempremovelist; do
4436 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
4437 if test "X$precious_files_regex" != "X"; then
4438 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
4443 removelist="$removelist $p"
4448 test -n "$removelist" && \
4449 func_show_eval "${RM}r \$removelist"
4452 # Now set the variables for building old libraries.
4453 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
4454 oldlibs="$oldlibs $output_objdir/$libname.$libext"
4456 # Transform .lo files to .o files.
4457 oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
4460 # Eliminate all temporary directories.
4461 for path in $notinst_path; do
4462 lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e 's% $path % %g'`
4463 deplibs=`$ECHO "X$deplibs " | $Xsed -e 's% -L$path % %g'`
4464 dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e 's% -L$path % %g'`
4467 if test -n "$xrpath"; then
4468 # If the user specified any rpath flags, then add them.
4470 for libdir in $xrpath; do
4471 temp_xrpath="$temp_xrpath -R$libdir"
4472 case "$finalize_rpath " in
4474 *) finalize_rpath="$finalize_rpath $libdir" ;;
4477 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
4478 dependency_libs="$temp_xrpath $dependency_libs"
4482 # Make sure dlfiles contains only unique files that won't be dlpreopened
4483 old_dlfiles="$dlfiles"
4485 for lib in $old_dlfiles; do
4486 case " $dlprefiles $dlfiles " in
4488 *) dlfiles="$dlfiles $lib" ;;
4492 # Make sure dlprefiles contains only unique files
4493 old_dlprefiles="$dlprefiles"
4495 for lib in $old_dlprefiles; do
4496 case "$dlprefiles " in
4498 *) dlprefiles="$dlprefiles $lib" ;;
4502 if test "$build_libtool_libs" = yes; then
4503 if test -n "$rpath"; then
4505 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
4506 # these systems don't actually have a c library (as such)!
4508 *-*-rhapsody* | *-*-darwin1.[[012]])
4509 # Rhapsody C library is in the System framework
4510 deplibs="$deplibs System.ltframework"
4513 # Don't link with libc until the a.out ld.so is fixed.
4515 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
4516 # Do not include libc due to us having libc/libc_r.
4518 *-*-sco3.2v5* | *-*-sco5v6*)
4519 # Causes problems with __ctype
4521 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
4522 # Compiler inserts libc in the correct place for threads to work
4525 # Add libc to deplibs on all other systems if necessary.
4526 if test "$build_libtool_need_lc" = "yes"; then
4527 deplibs="$deplibs -lc"
4533 # Transform deplibs into only deplibs that can be linked in shared.
4535 libname_save=$libname
4536 release_save=$release
4537 versuffix_save=$versuffix
4539 # I'm not sure if I'm treating the release correctly. I think
4540 # release should show up in the -l (ie -lgmp5) so we don't want to
4541 # add it in twice. Is that correct?
4547 case $deplibs_check_method in
4549 # Don't check for shared/static. Everything works.
4550 # This might be a little naive. We might want to check
4551 # whether the library exists or not. But this is on
4552 # osf3 & osf4 and I'm not really sure... Just
4553 # implementing what was already the behavior.
4557 # This code stresses the "libraries are programs" paradigm to its
4558 # limits. Maybe even breaks it. We compile a program, linking it
4559 # against the deplibs as a proxy for the library. Then we can check
4560 # whether they linked in statically or dynamically with ldd.
4561 $opt_dry_run || $RM conftest.c
4562 cat > conftest.c <<EOF
4563 int main() { return 0; }
4565 $opt_dry_run || $RM conftest
4566 $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
4567 if test "$?" -eq 0 ; then
4568 ldd_output=`ldd conftest`
4569 for i in $deplibs; do
4570 name=`expr $i : '-l\(.*\)'`
4571 # If $name is empty we are operating on a -L argument.
4572 if test "$name" != "" && test "$name" -ne "0"; then
4573 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4574 case " $predeps $postdeps " in
4576 newdeplibs="$newdeplibs $i"
4581 if test -n "$i" ; then
4582 libname=`eval "\\$ECHO \"$libname_spec\""`
4583 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
4584 set dummy $deplib_matches; shift
4586 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
4587 newdeplibs="$newdeplibs $i"
4591 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
4592 $ECHO "*** I have the capability to make that library automatically link in when"
4593 $ECHO "*** you link to this library. But I can only do this if you have a"
4594 $ECHO "*** shared version of the library, which I believe you do not have"
4595 $ECHO "*** because a test_compile did reveal that the linker did not use it for"
4596 $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
4600 newdeplibs="$newdeplibs $i"
4604 # Error occurred in the first compile. Let's try to salvage
4605 # the situation: Compile a separate program for each library.
4606 for i in $deplibs; do
4607 name=`expr $i : '-l\(.*\)'`
4608 # If $name is empty we are operating on a -L argument.
4609 if test "$name" != "" && test "$name" != "0"; then
4610 $opt_dry_run || $RM conftest
4611 $LTCC $LTCFLAGS -o conftest conftest.c $i
4613 if test "$?" -eq 0 ; then
4614 ldd_output=`ldd conftest`
4615 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4616 case " $predeps $postdeps " in
4618 newdeplibs="$newdeplibs $i"
4623 if test -n "$i" ; then
4624 libname=`eval "\\$ECHO \"$libname_spec\""`
4625 deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
4626 set dummy $deplib_matches; shift
4628 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
4629 newdeplibs="$newdeplibs $i"
4633 $ECHO "*** Warning: dynamic linker does not accept needed library $i."
4634 $ECHO "*** I have the capability to make that library automatically link in when"
4635 $ECHO "*** you link to this library. But I can only do this if you have a"
4636 $ECHO "*** shared version of the library, which you do not appear to have"
4637 $ECHO "*** because a test_compile did reveal that the linker did not use this one"
4638 $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
4644 $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
4645 $ECHO "*** make it link in! You will probably need to install it or some"
4646 $ECHO "*** library that it depends on before this library will be fully"
4647 $ECHO "*** functional. Installing it before continuing would be even better."
4650 newdeplibs="$newdeplibs $i"
4656 set dummy $deplibs_check_method; shift
4657 file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
4658 for a_deplib in $deplibs; do
4659 name=`expr $a_deplib : '-l\(.*\)'`
4660 # If $name is empty we are operating on a -L argument.
4661 if test "$name" != "" && test "$name" != "0"; then
4662 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4663 case " $predeps $postdeps " in
4665 newdeplibs="$newdeplibs $a_deplib"
4670 if test -n "$a_deplib" ; then
4671 libname=`eval "\\$ECHO \"$libname_spec\""`
4672 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
4673 potential_libs=`ls $i/$libname[[.-]]* 2>/dev/null`
4674 for potent_lib in $potential_libs; do
4675 # Follow soft links.
4676 if ls -lLd "$potent_lib" 2>/dev/null |
4677 $GREP " -> " >/dev/null; then
4680 # The statement above tries to avoid entering an
4681 # endless loop below, in case of cyclic links.
4682 # We might still enter an endless loop, since a link
4683 # loop can be closed while we follow links,
4685 potlib="$potent_lib"
4686 while test -h "$potlib" 2>/dev/null; do
4687 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
4689 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) potlib="$potliblink";;
4690 *) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[[^/]]*$,,'`"$potliblink";;
4693 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
4695 $EGREP "$file_magic_regex" > /dev/null; then
4696 newdeplibs="$newdeplibs $a_deplib"
4703 if test -n "$a_deplib" ; then
4706 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
4707 $ECHO "*** I have the capability to make that library automatically link in when"
4708 $ECHO "*** you link to this library. But I can only do this if you have a"
4709 $ECHO "*** shared version of the library, which you do not appear to have"
4710 $ECHO "*** because I did check the linker path looking for a file starting"
4711 if test -z "$potlib" ; then
4712 $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
4714 $ECHO "*** with $libname and none of the candidates passed a file format test"
4715 $ECHO "*** using a file magic. Last file checked: $potlib"
4719 # Add a -L argument.
4720 newdeplibs="$newdeplibs $a_deplib"
4722 done # Gone through all deplibs.
4725 set dummy $deplibs_check_method; shift
4726 match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
4727 for a_deplib in $deplibs; do
4728 name=`expr $a_deplib : '-l\(.*\)'`
4729 # If $name is empty we are operating on a -L argument.
4730 if test -n "$name" && test "$name" != "0"; then
4731 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4732 case " $predeps $postdeps " in
4734 newdeplibs="$newdeplibs $a_deplib"
4739 if test -n "$a_deplib" ; then
4740 libname=`eval "\\$ECHO \"$libname_spec\""`
4741 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
4742 potential_libs=`ls $i/$libname[[.-]]* 2>/dev/null`
4743 for potent_lib in $potential_libs; do
4744 potlib="$potent_lib" # see symlink-check above in file_magic test
4745 if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
4746 $EGREP "$match_pattern_regex" > /dev/null; then
4747 newdeplibs="$newdeplibs $a_deplib"
4754 if test -n "$a_deplib" ; then
4757 $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
4758 $ECHO "*** I have the capability to make that library automatically link in when"
4759 $ECHO "*** you link to this library. But I can only do this if you have a"
4760 $ECHO "*** shared version of the library, which you do not appear to have"
4761 $ECHO "*** because I did check the linker path looking for a file starting"
4762 if test -z "$potlib" ; then
4763 $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
4765 $ECHO "*** with $libname and none of the candidates passed a file format test"
4766 $ECHO "*** using a regex pattern. Last file checked: $potlib"
4770 # Add a -L argument.
4771 newdeplibs="$newdeplibs $a_deplib"
4773 done # Gone through all deplibs.
4777 tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
4778 -e 's/ -lc$//' -e 's/ -[[LR]][[^ ]]*//g'`
4779 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
4780 for i in $predeps $postdeps ; do
4781 # can't use Xsed below, because $i might contain '/'
4782 tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
4785 if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[[ ]]//g' |
4786 $GREP . >/dev/null; then
4788 if test "X$deplibs_check_method" = "Xnone"; then
4789 $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
4791 $ECHO "*** Warning: inter-library dependencies are not known to be supported."
4793 $ECHO "*** All declared inter-library dependencies are being dropped."
4798 versuffix=$versuffix_save
4800 release=$release_save
4801 libname=$libname_save
4805 *-*-rhapsody* | *-*-darwin1.[[012]])
4806 # On Rhapsody replace the C library with the System framework
4807 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4811 if test "$droppeddeps" = yes; then
4812 if test "$module" = yes; then
4814 $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
4815 $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
4816 $ECHO "*** a static module, that should work as long as the dlopening"
4817 $ECHO "*** application is linked with the -dlopen flag."
4818 if test -z "$global_symbol_pipe"; then
4820 $ECHO "*** However, this would only work if libtool was able to extract symbol"
4821 $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
4822 $ECHO "*** not find such a program. So, this module is probably useless."
4823 $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
4825 if test "$build_old_libs" = no; then
4826 oldlibs="$output_objdir/$libname.$libext"
4827 build_libtool_libs=module
4830 build_libtool_libs=no
4833 $ECHO "*** The inter-library dependencies that have been dropped here will be"
4834 $ECHO "*** automatically added whenever a program is linked with this library"
4835 $ECHO "*** or is declared to -dlopen it."
4837 if test "$allow_undefined" = no; then
4839 $ECHO "*** Since this library must not contain undefined symbols,"
4840 $ECHO "*** because either the platform does not support them or"
4841 $ECHO "*** it was explicitly requested with -no-undefined,"
4842 $ECHO "*** libtool will only create a static version of it."
4843 if test "$build_old_libs" = no; then
4844 oldlibs="$output_objdir/$libname.$libext"
4845 build_libtool_libs=module
4848 build_libtool_libs=no
4853 # Done checking deplibs!
4856 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
4859 newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
4860 new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
4861 deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
4865 # All the library-specific variables (install_libdir is set above).
4870 # Test again, we may have decided not to build it any more
4871 if test "$build_libtool_libs" = yes; then
4872 if test "$hardcode_into_libs" = yes; then
4873 # Hardcode the library paths
4876 rpath="$finalize_rpath"
4877 test "$mode" != relink && rpath="$compile_rpath$rpath"
4878 for libdir in $rpath; do
4879 if test -n "$hardcode_libdir_flag_spec"; then
4880 if test -n "$hardcode_libdir_separator"; then
4881 if test -z "$hardcode_libdirs"; then
4882 hardcode_libdirs="$libdir"
4884 # Just accumulate the unique libdirs.
4885 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4886 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4889 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4894 eval flag=\"$hardcode_libdir_flag_spec\"
4895 dep_rpath="$dep_rpath $flag"
4897 elif test -n "$runpath_var"; then
4898 case "$perm_rpath " in
4900 *) perm_rpath="$perm_rpath $libdir" ;;
4904 # Substitute the hardcoded libdirs into the rpath.
4905 if test -n "$hardcode_libdir_separator" &&
4906 test -n "$hardcode_libdirs"; then
4907 libdir="$hardcode_libdirs"
4908 if test -n "$hardcode_libdir_flag_spec_ld"; then
4909 eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
4911 eval dep_rpath=\"$hardcode_libdir_flag_spec\"
4914 if test -n "$runpath_var" && test -n "$perm_rpath"; then
4915 # We should set the runpath_var.
4917 for dir in $perm_rpath; do
4920 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
4922 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
4925 shlibpath="$finalize_shlibpath"
4926 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
4927 if test -n "$shlibpath"; then
4928 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
4931 # Get the real and link names of the library.
4932 eval shared_ext=\"$shrext_cmds\"
4933 eval library_names=\"$library_names_spec\"
4934 set dummy $library_names
4939 if test -n "$soname_spec"; then
4940 eval soname=\"$soname_spec\"
4944 if test -z "$dlname"; then
4948 lib="$output_objdir/$realname"
4951 linknames="$linknames $link"
4954 # Use standard objects if they are pic
4955 test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4958 if test -n "$export_symbols" && test -n "$include_expsyms"; then
4959 $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
4960 export_symbols="$output_objdir/$libname.uexp"
4961 delfiles="$delfiles $export_symbols"
4964 orig_export_symbols=
4967 if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
4968 # exporting using user supplied symfile
4969 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
4970 # and it's NOT already a .def file. Must figure out
4971 # which of the given symbols are data symbols and tag
4972 # them as such. So, trigger use of export_symbols_cmds.
4973 # export_symbols gets reassigned inside the "prepare
4974 # the list of exported symbols" if statement, so the
4975 # include_expsyms logic still works.
4976 orig_export_symbols="$export_symbols"
4978 always_export_symbols=yes
4984 # Prepare the list of exported symbols
4985 if test -z "$export_symbols"; then
4986 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
4987 func_echo "generating symbol list for \`$libname.la'"
4988 export_symbols="$output_objdir/$libname.exp"
4989 $opt_dry_run || $RM $export_symbols
4990 cmds=$export_symbols_cmds
4991 save_ifs="$IFS"; IFS='~'
4992 for cmd in $cmds; do
4995 if len=`expr "X$cmd" : ".*"` &&
4996 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4997 func_show_eval "$cmd" 'exit $?'
4998 skipped_export=false
5000 # The command line is too long to execute in one step.
5001 func_echo "using reloadable object file for export list..."
5003 # Break out early, otherwise skipped_export may be
5004 # set to false by a later but shorter cmd.
5009 if test -n "$export_symbols_regex"; then
5010 func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
5011 func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
5016 if test -n "$export_symbols" && test -n "$include_expsyms"; then
5017 tmp_export_symbols="$export_symbols"
5018 test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
5019 $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
5022 if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
5023 # The given exports_symbols file has to be filtered, so filter it.
5024 func_echo "filter symbol list for \`$libname.la' to tag DATA exports"
5025 # FIXME: $output_objdir/$libname.filter potentially contains lots of
5026 # 's' commands which not all seds can handle. GNU sed should be fine
5027 # though. Also, the filter scales superlinearly with the number of
5028 # global variables. join(1) would be nice here, but unfortunately
5029 # isn't a blessed tool.
5030 $opt_dry_run || $SED -e '/[[ ,]]DATA/!d;s,\(.*\)\([[ \,]].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
5031 delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
5032 export_symbols=$output_objdir/$libname.def
5033 $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
5037 for test_deplib in $deplibs; do
5038 case " $convenience " in
5039 *" $test_deplib "*) ;;
5041 tmp_deplibs="$tmp_deplibs $test_deplib"
5045 deplibs="$tmp_deplibs"
5047 if test -n "$convenience"; then
5048 if test -n "$whole_archive_flag_spec"; then
5049 save_libobjs=$libobjs
5050 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5052 gentop="$output_objdir/${outputname}x"
5053 generated="$generated $gentop"
5055 func_extract_archives $gentop $convenience
5056 libobjs="$libobjs $func_extract_archives_result"
5060 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
5061 eval flag=\"$thread_safe_flag_spec\"
5062 linker_flags="$linker_flags $flag"
5065 # Make a backup of the uninstalled library when relinking
5066 if test "$mode" = relink; then
5067 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
5070 # Do each of the archive commands.
5071 if test "$module" = yes && test -n "$module_cmds" ; then
5072 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5073 eval test_cmds=\"$module_expsym_cmds\"
5074 cmds=$module_expsym_cmds
5076 eval test_cmds=\"$module_cmds\"
5080 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5081 eval test_cmds=\"$archive_expsym_cmds\"
5082 cmds=$archive_expsym_cmds
5084 eval test_cmds=\"$archive_cmds\"
5089 if test "X$skipped_export" != "X:" &&
5090 len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5091 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5094 # The command line is too long to link in one step, link piecewise
5095 # or, if using GNU ld and skipped_export is not :, use a linker
5098 # Save the value of $output and $libobjs because we want to
5099 # use them later. If we have whole_archive_flag_spec, we
5100 # want to use save_libobjs as it was before
5101 # whole_archive_flag_spec was expanded, because we can't
5102 # assume the linker understands whole_archive_flag_spec.
5103 # This may have to be revisited, in case too many
5104 # convenience libraries get linked in and end up exceeding
5106 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
5107 save_libobjs=$libobjs
5110 output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
5112 # Clear the reloadable object creation command queue and
5113 # initialize k to one.
5120 if test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
5121 output=${output_objdir}/${output_la}.lnkscript
5122 func_echo "creating GNU ld script: $output"
5123 $ECHO 'INPUT (' > $output
5124 for obj in $save_libobjs
5126 $ECHO \""$obj"\" >> $output
5128 $ECHO ')' >> $output
5129 delfiles="$delfiles $output"
5130 elif test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
5131 output=${output_objdir}/${output_la}.lnk
5132 func_echo "creating linker input file list: $output"
5134 for obj in $save_libobjs
5136 $ECHO "$obj" >> $output
5138 delfiles="$delfiles $output"
5139 output=\"$file_list_spec$output\"
5141 func_echo "creating reloadable object files..."
5142 output=$output_objdir/$output_la-${k}.$objext
5143 # Loop over the list of objects to be linked.
5144 for obj in $save_libobjs
5146 eval test_cmds=\"$reload_cmds $objlist $last_robj\"
5147 if test "X$objlist" = X ||
5148 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
5149 test "$len" -le "$max_cmd_len"; }; then
5150 objlist="$objlist $obj"
5152 # The command $test_cmds is almost too long, add a
5153 # command to the queue.
5154 if test "$k" -eq 1 ; then
5155 # The first file doesn't have a previous command to add.
5156 eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
5158 # All subsequent reloadable object files will link in
5159 # the last one created.
5160 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
5162 last_robj=$output_objdir/$output_la-${k}.$objext
5164 output=$output_objdir/$output_la-${k}.$objext
5169 # Handle the remaining objects by creating one last
5170 # reloadable object file. All subsequent reloadable object
5171 # files will link in the last one created.
5172 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5173 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
5175 if ${skipped_export-false}; then
5176 func_echo "generating symbol list for \`$libname.la'"
5177 export_symbols="$output_objdir/$libname.exp"
5178 $opt_dry_run || $RM $export_symbols
5180 # Append the command to create the export file.
5181 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
5184 # Set up a command to remove the reloadable object files
5185 # after they are used.
5187 while test "$i" -lt "$k"
5190 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
5193 func_echo "creating a temporary reloadable object file: $output"
5195 # Loop through the commands generated above and execute them.
5196 save_ifs="$IFS"; IFS='~'
5197 for cmd in $concat_cmds; do
5200 func_quote_for_expand "$cmd"
5201 eval "func_echo $func_quote_for_expand_result"
5203 $opt_dry_run || eval "$cmd" || {
5206 # Restore the uninstalled library and exit
5207 if test "$mode" = relink; then
5208 ( cd "$output_objdir" && \
5209 $RM "${realname}T" && \
5210 $MV "${realname}U" "$realname" )
5220 # Restore the value of output.
5223 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
5224 eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
5226 # Expand the library linking commands again to reset the
5227 # value of $libobjs for piecewise linking.
5229 # Do each of the archive commands.
5230 if test "$module" = yes && test -n "$module_cmds" ; then
5231 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
5232 cmds=$module_expsym_cmds
5237 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
5238 cmds=$archive_expsym_cmds
5245 if test -n "$delfiles"; then
5246 # Append the command to remove temporary files to $cmds.
5247 eval cmds=\"\$cmds~\$RM $delfiles\"
5250 # Add any objects from preloaded convenience libraries
5251 if test -n "$dlprefiles"; then
5252 gentop="$output_objdir/${outputname}x"
5253 generated="$generated $gentop"
5255 func_extract_archives $gentop $dlprefiles
5256 libobjs="$libobjs $func_extract_archives_result"
5259 save_ifs="$IFS"; IFS='~'
5260 for cmd in $cmds; do
5264 func_quote_for_expand "$cmd"
5265 eval "func_echo $func_quote_for_expand_result"
5267 $opt_dry_run || eval "$cmd" || {
5270 # Restore the uninstalled library and exit
5271 if test "$mode" = relink; then
5272 ( cd "$output_objdir" && \
5273 $RM "${realname}T" && \
5274 $MV "${realname}U" "$realname" )
5282 # Restore the uninstalled library and exit
5283 if test "$mode" = relink; then
5284 $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
5286 if test -n "$convenience"; then
5287 if test -z "$whole_archive_flag_spec"; then
5288 func_show_eval '${RM}r "$gentop"'
5295 # Create links to the real library.
5296 for linkname in $linknames; do
5297 if test "$realname" != "$linkname"; then
5298 func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
5302 # If -module or -export-dynamic was specified, set the dlname.
5303 if test "$module" = yes || test "$export_dynamic" = yes; then
5304 # On all known operating systems, these are identical.
5311 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
5312 func_warning "\`-dlopen' is ignored for objects"
5315 test -n "$deplibs" && \
5316 func_warning "\`-l' and \`-L' are ignored for objects"
5318 test -n "$rpath" && \
5319 func_warning "\`-rpath' is ignored for objects"
5321 test -n "$xrpath" && \
5322 func_warning "\`-R' is ignored for objects"
5324 test -n "$vinfo" && \
5325 func_warning "\`-version-info' is ignored for objects"
5327 test -n "$release" && \
5328 func_warning "\`-release' is ignored for objects"
5332 test -n "$objs$old_deplibs" && \
5333 func_fatal_error "cannot build library object \`$output' from non-libtool objects"
5336 obj=`$ECHO "X$output" | $Xsed -e "$lo2o"`
5344 # Delete the old objects.
5345 $opt_dry_run || $RM $obj $libobj
5347 # Objects from convenience libraries. This assumes
5348 # single-version convenience libraries. Whenever we create
5349 # different ones for PIC/non-PIC, this we'll have to duplicate
5353 # reload_cmds runs $LD directly, so let us get rid of
5354 # -Wl from whole_archive_flag_spec
5357 if test -n "$convenience"; then
5358 if test -n "$whole_archive_flag_spec"; then
5359 eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
5361 gentop="$output_objdir/${obj}x"
5362 generated="$generated $gentop"
5364 func_extract_archives $gentop $convenience
5365 reload_conv_objs="$reload_objs $func_extract_archives_result"
5369 # Create the old-style object.
5370 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
5373 func_execute_cmds "$reload_cmds" 'exit $?'
5375 # Exit if we aren't doing a library object file.
5376 if test -z "$libobj"; then
5377 if test -n "$gentop"; then
5378 func_show_eval '${RM}r "$gentop"'
5384 if test "$build_libtool_libs" != yes; then
5385 if test -n "$gentop"; then
5386 func_show_eval '${RM}r "$gentop"'
5389 # Create an invalid libtool object if no PIC, so that we don't
5390 # accidentally link it into a program.
5391 # $show "echo timestamp > $libobj"
5392 # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
5396 if test -n "$pic_flag" || test "$pic_mode" != default; then
5397 # Only do commands if we really have different PIC objects.
5398 reload_objs="$libobjs $reload_conv_objs"
5400 func_execute_cmds "$reload_cmds" 'exit $?'
5403 if test -n "$gentop"; then
5404 func_show_eval '${RM}r "$gentop"'
5412 *cygwin*) func_stripname '' '.exe' "$output"
5413 output=$func_stripname_result.exe;;
5415 test -n "$vinfo" && \
5416 func_warning "\`-version-info' is ignored for programs"
5418 test -n "$release" && \
5419 func_warning "\`-release' is ignored for programs"
5421 test "$preload" = yes \
5422 && test "$dlopen_support" = unknown \
5423 && test "$dlopen_self" = unknown \
5424 && test "$dlopen_self_static" = unknown && \
5425 func_warning "\`LT_INIT([[dlopen]])' not used. Assuming no dlopen support."
5428 *-*-rhapsody* | *-*-darwin1.[[012]])
5429 # On Rhapsody replace the C library is the System framework
5430 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5431 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
5437 # Don't allow lazy linking, it breaks C++ global constructors
5438 # But is supposedly fixed on 10.4 or later (yay!).
5439 if test "$tagname" = CXX ; then
5440 case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
5442 compile_command="$compile_command ${wl}-bind_at_load"
5443 finalize_command="$finalize_command ${wl}-bind_at_load"
5447 # Time to change all our "foo.ltframework" stuff back to "-framework foo"
5448 compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
5449 finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([[^ $]]*\).ltframework% -framework \1%g'`
5453 compile_command="$compile_command $compile_deplibs"
5454 finalize_command="$finalize_command $finalize_deplibs"
5456 if test -n "$rpath$xrpath"; then
5457 # If the user specified any rpath flags, then add them.
5458 for libdir in $rpath $xrpath; do
5459 # This is the magic to use -rpath.
5460 case "$finalize_rpath " in
5462 *) finalize_rpath="$finalize_rpath $libdir" ;;
5467 # Now hardcode the library paths
5470 for libdir in $compile_rpath $finalize_rpath; do
5471 if test -n "$hardcode_libdir_flag_spec"; then
5472 if test -n "$hardcode_libdir_separator"; then
5473 if test -z "$hardcode_libdirs"; then
5474 hardcode_libdirs="$libdir"
5476 # Just accumulate the unique libdirs.
5477 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5478 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5481 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5486 eval flag=\"$hardcode_libdir_flag_spec\"
5487 rpath="$rpath $flag"
5489 elif test -n "$runpath_var"; then
5490 case "$perm_rpath " in
5492 *) perm_rpath="$perm_rpath $libdir" ;;
5496 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
5497 testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
5498 case :$dllsearchpath: in
5500 *) dllsearchpath="$dllsearchpath:$libdir";;
5502 case :$dllsearchpath: in
5503 *":$testbindir:"*) ;;
5504 *) dllsearchpath="$dllsearchpath:$testbindir";;
5509 # Substitute the hardcoded libdirs into the rpath.
5510 if test -n "$hardcode_libdir_separator" &&
5511 test -n "$hardcode_libdirs"; then
5512 libdir="$hardcode_libdirs"
5513 eval rpath=\" $hardcode_libdir_flag_spec\"
5515 compile_rpath="$rpath"
5519 for libdir in $finalize_rpath; do
5520 if test -n "$hardcode_libdir_flag_spec"; then
5521 if test -n "$hardcode_libdir_separator"; then
5522 if test -z "$hardcode_libdirs"; then
5523 hardcode_libdirs="$libdir"
5525 # Just accumulate the unique libdirs.
5526 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
5527 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
5530 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
5535 eval flag=\"$hardcode_libdir_flag_spec\"
5536 rpath="$rpath $flag"
5538 elif test -n "$runpath_var"; then
5539 case "$finalize_perm_rpath " in
5541 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
5545 # Substitute the hardcoded libdirs into the rpath.
5546 if test -n "$hardcode_libdir_separator" &&
5547 test -n "$hardcode_libdirs"; then
5548 libdir="$hardcode_libdirs"
5549 eval rpath=\" $hardcode_libdir_flag_spec\"
5551 finalize_rpath="$rpath"
5553 if test -n "$libobjs" && test "$build_old_libs" = yes; then
5554 # Transform all the library objects into standard objects.
5555 compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5556 finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
5559 func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
5561 # template prelinking step
5562 if test -n "$prelink_cmds"; then
5563 func_execute_cmds "$prelink_cmds" 'exit $?'
5566 wrappers_required=yes
5568 *cygwin* | *mingw* )
5569 if test "$build_libtool_libs" != yes; then
5570 wrappers_required=no
5574 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
5575 wrappers_required=no
5579 if test "$wrappers_required" = no; then
5580 # Replace the output file specification.
5581 compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
5582 link_command="$compile_command$compile_rpath"
5584 # We have no uninstalled library dependencies, so finalize right now.
5585 func_show_eval "$link_command"
5588 # Delete the generated files.
5589 if test -f "$output_objdir/${outputname}S.${objext}"; then
5590 func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
5596 if test -n "$compile_shlibpath$finalize_shlibpath"; then
5597 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
5599 if test -n "$finalize_shlibpath"; then
5600 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
5605 if test -n "$runpath_var"; then
5606 if test -n "$perm_rpath"; then
5607 # We should set the runpath_var.
5609 for dir in $perm_rpath; do
5612 compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
5614 if test -n "$finalize_perm_rpath"; then
5615 # We should set the runpath_var.
5617 for dir in $finalize_perm_rpath; do
5620 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
5624 if test "$no_install" = yes; then
5625 # We don't need to create a wrapper script.
5626 link_command="$compile_var$compile_command$compile_rpath"
5627 # Replace the output file specification.
5628 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
5629 # Delete the old output file.
5630 $opt_dry_run || $RM $output
5631 # Link the executable and exit
5632 func_show_eval "$link_command" 'exit $?'
5636 if test "$hardcode_action" = relink; then
5637 # Fast installation is not supported
5638 link_command="$compile_var$compile_command$compile_rpath"
5639 relink_command="$finalize_var$finalize_command$finalize_rpath"
5641 func_warning "this platform does not like uninstalled shared libraries"
5642 func_warning "\`$output' will be relinked during installation"
5644 if test "$fast_install" != no; then
5645 link_command="$finalize_var$compile_command$finalize_rpath"
5646 if test "$fast_install" = yes; then
5647 relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
5649 # fast_install is set to needless
5653 link_command="$compile_var$compile_command$compile_rpath"
5654 relink_command="$finalize_var$finalize_command$finalize_rpath"
5658 # Replace the output file specification.
5659 link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
5661 # Delete the old output files.
5662 $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
5664 func_show_eval "$link_command" 'exit $?'
5666 # Now create the wrapper script.
5667 func_echo "creating $output"
5669 # Quote the relink command for shipping.
5670 if test -n "$relink_command"; then
5671 # Preserve any variables that may affect compiler behavior
5672 for var in $variables_saved_for_relink; do
5673 if eval test -z \"\${$var+set}\"; then
5674 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5675 elif eval var_value=\$$var; test -z "$var_value"; then
5676 relink_command="$var=; export $var; $relink_command"
5678 func_quote_for_eval "$var_value"
5679 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
5682 relink_command="(cd `pwd`; $relink_command)"
5683 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5686 # Quote $ECHO for shipping.
5687 if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
5689 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) qecho="$SHELL $progpath --fallback-echo";;
5690 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
5692 qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
5694 qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
5697 # Only actually do things if not in dry run mode.
5699 # win32 will think the script is a binary if it has
5700 # a .exe suffix, so we strip it off here.
5702 *.exe) func_stripname '' '.exe' "$output"
5703 output=$func_stripname_result ;;
5705 # test for cygwin because mv fails w/o .exe extensions
5709 func_stripname '' '.exe' "$outputname"
5710 outputname=$func_stripname_result ;;
5714 *cygwin* | *mingw* )
5715 output_name=`basename $output`
5716 output_path=`dirname $output`
5717 cwrappersource="$output_path/$objdir/lt-$output_name.c"
5718 cwrapper="$output_path/$output_name.exe"
5719 $RM $cwrappersource $cwrapper
5720 trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
5722 cat > $cwrappersource <<EOF
5724 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
5725 Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
5727 The $output program cannot be directly executed until all the libtool
5728 libraries that it depends on are installed.
5730 This wrapper executable should never be moved out of the build directory.
5731 If it is, it will not operate correctly.
5733 Currently, it simply execs the wrapper *script* "/bin/sh $output",
5734 but could eventually absorb all of the scripts functionality and
5735 exec $objdir/$outputname directly.
5738 cat >> $cwrappersource<<"EOF"
5747 #include <sys/stat.h>
5749 #if defined(PATH_MAX)
5750 # define LT_PATHMAX PATH_MAX
5751 #elif defined(MAXPATHLEN)
5752 # define LT_PATHMAX MAXPATHLEN
5754 # define LT_PATHMAX 1024
5757 #ifndef DIR_SEPARATOR
5758 # define DIR_SEPARATOR '/'
5759 # define PATH_SEPARATOR ':'
5762 #if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
5764 # define HAVE_DOS_BASED_FILE_SYSTEM
5765 # ifndef DIR_SEPARATOR_2
5766 # define DIR_SEPARATOR_2 '\\'
5768 # ifndef PATH_SEPARATOR_2
5769 # define PATH_SEPARATOR_2 ';'
5773 #ifndef DIR_SEPARATOR_2
5774 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
5775 #else /* DIR_SEPARATOR_2 */
5776 # define IS_DIR_SEPARATOR(ch) \
5777 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
5778 #endif /* DIR_SEPARATOR_2 */
5780 #ifndef PATH_SEPARATOR_2
5781 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
5782 #else /* PATH_SEPARATOR_2 */
5783 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
5784 #endif /* PATH_SEPARATOR_2 */
5786 #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
5787 #define XFREE(stale) do { \
5788 if (stale) { free ((void *) stale); stale = 0; } \
5791 /* -DDEBUG is fairly common in CFLAGS. */
5793 #if defined DEBUGWRAPPER
5794 # define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
5796 # define DEBUG(format, ...)
5799 const char *program_name = NULL;
5801 void * xmalloc (size_t num);
5802 char * xstrdup (const char *string);
5803 const char * base_name (const char *name);
5804 char * find_executable(const char *wrapper);
5805 int check_executable(const char *path);
5806 char * strendzap(char *str, const char *pat);
5807 void lt_fatal (const char *message, ...);
5810 main (int argc, char *argv[[]])
5815 program_name = (char *) xstrdup (base_name (argv[[0]]));
5816 DEBUG("(main) argv[[0]] : %s\n",argv[[0]]);
5817 DEBUG("(main) program_name : %s\n",program_name);
5818 newargz = XMALLOC(char *, argc+2);
5821 cat >> $cwrappersource <<EOF
5822 newargz[[0]] = (char *) xstrdup("$SHELL");
5825 cat >> $cwrappersource <<"EOF"
5826 newargz[[1]] = find_executable(argv[[0]]);
5827 if (newargz[[1]] == NULL)
5828 lt_fatal("Couldn't find %s", argv[[0]]);
5829 DEBUG("(main) found exe at : %s\n",newargz[[1]]);
5830 /* we know the script has the same name, without the .exe */
5831 /* so make sure newargz[[1]] doesn't end in .exe */
5832 strendzap(newargz[[1]],".exe");
5833 for (i = 1; i < argc; i++)
5834 newargz[[i+1]] = xstrdup(argv[[i]]);
5835 newargz[[argc+1]] = NULL;
5837 for (i=0; i<argc+1; i++)
5839 DEBUG("(main) newargz[[%d]] : %s\n",i,newargz[[i]]);
5847 cat >> $cwrappersource <<EOF
5848 execv("$SHELL",(char const **)newargz);
5852 cat >> $cwrappersource <<EOF
5853 execv("$SHELL",newargz);
5858 cat >> $cwrappersource <<"EOF"
5863 xmalloc (size_t num)
5865 void * p = (void *) malloc (num);
5867 lt_fatal ("Memory exhausted");
5873 xstrdup (const char *string)
5875 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
5880 base_name (const char *name)
5884 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5885 /* Skip over the disk name in MSDOS pathnames. */
5886 if (isalpha ((unsigned char)name[[0]]) && name[[1]] == ':')
5890 for (base = name; *name; name++)
5891 if (IS_DIR_SEPARATOR (*name))
5897 check_executable(const char * path)
5901 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5902 if ((!path) || (!*path))
5905 if ((stat (path, &st) >= 0) &&
5907 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5908 #if defined (S_IXOTH)
5909 ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5911 #if defined (S_IXGRP)
5912 ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5914 ((st.st_mode & S_IXUSR) == S_IXUSR))
5921 /* Searches for the full path of the wrapper. Returns
5922 newly allocated full path name if found, NULL otherwise */
5924 find_executable (const char* wrapper)
5929 /* static buffer for getcwd */
5930 char tmp[[LT_PATHMAX + 1]];
5934 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
5936 if ((wrapper == NULL) || (*wrapper == '\0'))
5939 /* Absolute path? */
5940 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5941 if (isalpha ((unsigned char)wrapper[[0]]) && wrapper[[1]] == ':')
5943 concat_name = xstrdup (wrapper);
5944 if (check_executable(concat_name))
5951 if (IS_DIR_SEPARATOR (wrapper[[0]]))
5953 concat_name = xstrdup (wrapper);
5954 if (check_executable(concat_name))
5958 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5962 for (p = wrapper; *p; p++)
5970 /* no slashes; search PATH */
5971 const char* path = getenv ("PATH");
5974 for (p = path; *p; p = p_next)
5978 for (q = p; *q; q++)
5979 if (IS_PATH_SEPARATOR(*q))
5982 p_next = (*q == '\0' ? q : q + 1);
5985 /* empty path: current directory */
5986 if (getcwd (tmp, LT_PATHMAX) == NULL)
5987 lt_fatal ("getcwd failed");
5988 tmp_len = strlen(tmp);
5989 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5990 memcpy (concat_name, tmp, tmp_len);
5991 concat_name[[tmp_len]] = '/';
5992 strcpy (concat_name + tmp_len + 1, wrapper);
5996 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5997 memcpy (concat_name, p, p_len);
5998 concat_name[[p_len]] = '/';
5999 strcpy (concat_name + p_len + 1, wrapper);
6001 if (check_executable(concat_name))
6006 /* not found in PATH; assume curdir */
6008 /* Relative path | not found in path: prepend cwd */
6009 if (getcwd (tmp, LT_PATHMAX) == NULL)
6010 lt_fatal ("getcwd failed");
6011 tmp_len = strlen(tmp);
6012 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
6013 memcpy (concat_name, tmp, tmp_len);
6014 concat_name[[tmp_len]] = '/';
6015 strcpy (concat_name + tmp_len + 1, wrapper);
6017 if (check_executable(concat_name))
6024 strendzap(char *str, const char *pat)
6028 assert(str != NULL);
6029 assert(pat != NULL);
6032 patlen = strlen(pat);
6036 str += len - patlen;
6037 if (strcmp(str, pat) == 0)
6044 lt_error_core (int exit_status, const char * mode,
6045 const char * message, va_list ap)
6047 fprintf (stderr, "%s: %s: ", program_name, mode);
6048 vfprintf (stderr, message, ap);
6049 fprintf (stderr, ".\n");
6051 if (exit_status >= 0)
6056 lt_fatal (const char *message, ...)
6059 va_start (ap, message);
6060 lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
6064 # we should really use a build-platform specific compiler
6065 # here, but OTOH, the wrappers (shell script and this C one)
6066 # are only useful if you want to execute the "real" binary.
6067 # Since the "real" binary is built for $host, then this
6068 # wrapper might as well be built for $host, too.
6069 $opt_dry_run || $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
6073 trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
6078 # $output - temporary wrapper script for $objdir/$outputname
6079 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6081 # The $output program cannot be directly executed until all the libtool
6082 # libraries that it depends on are installed.
6084 # This wrapper script should never be moved out of the build directory.
6085 # If it is, it will not operate correctly.
6087 # Sed substitution that helps us do robust quoting. It backslashifies
6088 # metacharacters that are still active within double-quoted strings.
6089 Xsed='${SED} -e 1s/^X//'
6090 sed_quote_subst='$sed_quote_subst'
6092 # The HP-UX ksh and POSIX shell print the target directory to stdout
6094 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
6096 relink_command=\"$relink_command\"
6098 # This environment variable determines our operation mode.
6099 if test \"\$libtool_install_magic\" = \"$magic\"; then
6100 # install mode needs the following variables:
6101 generated_by_libtool_version='$macro_version'
6102 notinst_deplibs='$notinst_deplibs'
6104 # When we are sourced in execute mode, \$file and \$ECHO are already set.
6105 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6108 # Make sure echo works.
6109 if test \"X\$1\" = X--no-reexec; then
6110 # Discard the --no-reexec flag, and continue.
6112 elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
6113 # Yippee, \$ECHO works!
6116 # Restart under the correct shell, and then maybe \$ECHO will work.
6117 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
6123 # Find the directory that this script lives in.
6124 thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[[^/]]*$%%'\`
6125 test \"x\$thisdir\" = \"x\$file\" && thisdir=.
6127 # Follow symbolic links until we get to the real thisdir.
6128 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
6129 while test -n \"\$file\"; do
6130 destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[[^/]]*\$%%'\`
6132 # If there was a directory component, then change thisdir.
6133 if test \"x\$destdir\" != \"x\$file\"; then
6134 case \"\$destdir\" in
6135 [[\\\\/]]* | [[A-Za-z]]:[[\\\\/]]*) thisdir=\"\$destdir\" ;;
6136 *) thisdir=\"\$thisdir/\$destdir\" ;;
6140 file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
6141 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
6144 # Try to get the absolute directory name.
6145 absdir=\`cd \"\$thisdir\" && pwd\`
6146 test -n \"\$absdir\" && thisdir=\"\$absdir\"
6149 if test "$fast_install" = yes; then
6151 program=lt-'$outputname'$exeext
6152 progdir=\"\$thisdir/$objdir\"
6154 if test ! -f \"\$progdir/\$program\" ||
6155 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
6156 test \"X\$file\" != \"X\$progdir/\$program\"; }; then
6158 file=\"\$\$-\$program\"
6160 if test ! -d \"\$progdir\"; then
6161 $MKDIR \"\$progdir\"
6163 $RM \"\$progdir/\$file\"
6168 # relink executable if necessary
6169 if test -n \"\$relink_command\"; then
6170 if relink_command_output=\`eval \$relink_command 2>&1\`; then :
6172 $ECHO \"\$relink_command_output\" >&2
6173 $RM \"\$progdir/\$file\"
6178 $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
6179 { $RM \"\$progdir/\$program\";
6180 $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
6181 $RM \"\$progdir/\$file\"
6185 program='$outputname'
6186 progdir=\"\$thisdir/$objdir\"
6192 if test -f \"\$progdir/\$program\"; then"
6194 # Export our shlibpath_var if we have one.
6195 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
6197 # Add our own library path to $shlibpath_var
6198 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
6200 # Some systems cannot cope with colon-terminated $shlibpath_var
6201 # The second colon is a workaround for a bug in BeOS R4 sed
6202 $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
6204 export $shlibpath_var
6208 # fixup the dll searchpath if we need to.
6209 if test -n "$dllsearchpath"; then
6211 # Add the dll search path components to the executable PATH
6212 PATH=$dllsearchpath:\$PATH
6217 if test \"\$libtool_execute_magic\" != \"$magic\"; then
6218 # Run the actual program with our arguments.
6221 # Backslashes separate directories on plain windows
6222 *-*-mingw | *-*-os2*)
6224 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
6230 exec \"\$progdir/\$program\" \${1+\"\$@\"}
6235 \$ECHO \"\$0: cannot exec \$program \${1+\"\$@\"}\"
6239 # The program doesn't exist.
6240 \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
6241 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
6242 $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
6253 # See if we need to build an old-fashioned archive.
6254 for oldlib in $oldlibs; do
6256 if test "$build_libtool_libs" = convenience; then
6257 oldobjs="$libobjs_save $symfileobj"
6258 addlibs="$convenience"
6259 build_libtool_libs=no
6261 if test "$build_libtool_libs" = module; then
6262 oldobjs="$libobjs_save"
6263 build_libtool_libs=no
6265 oldobjs="$old_deplibs $non_pic_objects"
6266 if test "$preload" = yes && test -f "$symfileobj"; then
6267 oldobjs="$oldobjs $symfileobj"
6270 addlibs="$old_convenience"
6273 if test -n "$addlibs"; then
6274 gentop="$output_objdir/${outputname}x"
6275 generated="$generated $gentop"
6277 func_extract_archives $gentop $addlibs
6278 oldobjs="$oldobjs $func_extract_archives_result"
6281 # Do each command in the archive commands.
6282 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
6283 cmds=$old_archive_from_new_cmds
6286 # Add any objects from preloaded convenience libraries
6287 if test -n "$dlprefiles"; then
6288 gentop="$output_objdir/${outputname}x"
6289 generated="$generated $gentop"
6291 func_extract_archives $gentop $dlprefiles
6292 oldobjs="$oldobjs $func_extract_archives_result"
6295 # POSIX demands no paths to be encoded in archives. We have
6296 # to avoid creating archives with duplicate basenames if we
6297 # might have to extract them afterwards, e.g., when creating a
6298 # static archive out of a convenience library, or when linking
6299 # the entirety of a libtool archive into another (currently
6300 # not supported by libtool).
6301 if (for obj in $oldobjs
6303 func_basename "$obj"
6304 $ECHO "$func_basename_result"
6305 done | sort | sort -uc >/dev/null 2>&1); then
6308 $ECHO "copying selected object files to avoid basename conflicts..."
6309 gentop="$output_objdir/${outputname}x"
6310 generated="$generated $gentop"
6311 func_mkdir_p "$gentop"
6312 save_oldobjs=$oldobjs
6315 for obj in $save_oldobjs
6317 func_basename "$obj"
6318 objbase="$func_basename_result"
6319 case " $oldobjs " in
6320 " ") oldobjs=$obj ;;
6321 *[[\ /]]"$objbase "*)
6323 # Make sure we don't pick an alternate name that also
6325 newobj=lt$counter-$objbase
6326 counter=`expr $counter + 1`
6327 case " $oldobjs " in
6328 *[[\ /]]"$newobj "*) ;;
6329 *) if test ! -f "$gentop/$newobj"; then break; fi ;;
6332 func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
6333 oldobjs="$oldobjs $gentop/$newobj"
6335 *) oldobjs="$oldobjs $obj" ;;
6339 eval cmds=\"$old_archive_cmds\"
6341 if len=`expr "X$cmds" : ".*" 2>/dev/null` &&
6342 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
6343 cmds=$old_archive_cmds
6345 # the command line is too long to link in one step, link in parts
6346 func_echo "using piecewise archive linking..."
6351 save_oldobjs=$oldobjs
6352 # Is there a better way of finding the last object in the list?
6353 for obj in $save_oldobjs
6357 for obj in $save_oldobjs
6359 oldobjs="$objlist $obj"
6360 objlist="$objlist $obj"
6361 eval test_cmds=\"$old_archive_cmds\"
6362 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
6363 test "$len" -le "$max_cmd_len"; then
6366 # the above command should be used before it gets too long
6368 if test "$obj" = "$last_oldobj" ; then
6371 test -z "$concat_cmds" || concat_cmds=$concat_cmds~
6372 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
6378 if test "X$oldobjs" = "X" ; then
6379 eval cmds=\"\$concat_cmds\"
6381 eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
6385 func_execute_cmds "$cmds" 'exit $?'
6388 test -n "$generated" && \
6389 func_show_eval "${RM}r$generated"
6391 # Now create the libtool archive.
6395 test "$build_old_libs" = yes && old_library="$libname.$libext"
6396 func_echo "creating $output"
6398 # Preserve any variables that may affect compiler behavior
6399 for var in $variables_saved_for_relink; do
6400 if eval test -z \"\${$var+set}\"; then
6401 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
6402 elif eval var_value=\$$var; test -z "$var_value"; then
6403 relink_command="$var=; export $var; $relink_command"
6405 func_quote_for_eval "$var_value"
6406 relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
6409 # Quote the link command for shipping.
6410 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
6411 relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
6412 if test "$hardcode_automatic" = yes ; then
6416 # Only create the output if not a dry run.
6418 for installed in no yes; do
6419 if test "$installed" = yes; then
6420 if test -z "$install_libdir"; then
6423 output="$output_objdir/$outputname"i
6424 # Replace all uninstalled libtool libraries with the installed ones
6426 for deplib in $dependency_libs; do
6429 func_basename "$deplib"
6430 name="$func_basename_result"
6431 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
6432 test -z "$libdir" && \
6433 func_fatal_error "\`$deplib' is not a valid libtool archive"
6434 newdependency_libs="$newdependency_libs $libdir/$name"
6436 *) newdependency_libs="$newdependency_libs $deplib" ;;
6439 dependency_libs="$newdependency_libs"
6442 for lib in $dlfiles; do
6445 func_basename "$lib"
6446 name="$func_basename_result"
6447 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6448 test -z "$libdir" && \
6449 func_fatal_error "\`$lib' is not a valid libtool archive"
6450 newdlfiles="$newdlfiles $libdir/$name"
6452 *) newdlfiles="$newdlfiles $lib" ;;
6455 dlfiles="$newdlfiles"
6457 for lib in $dlprefiles; do
6460 # Only pass preopened files to the pseudo-archive (for
6461 # eventual linking with the app. that links it) if we
6462 # didn't already link the preopened objects directly into
6464 func_basename "$lib"
6465 name="$func_basename_result"
6466 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
6467 test -z "$libdir" && \
6468 func_fatal_error "\`$lib' is not a valid libtool archive"
6469 newdlprefiles="$newdlprefiles $libdir/$name"
6473 dlprefiles="$newdlprefiles"
6476 for lib in $dlfiles; do
6478 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) abs="$lib" ;;
6479 *) abs=`pwd`"/$lib" ;;
6481 newdlfiles="$newdlfiles $abs"
6483 dlfiles="$newdlfiles"
6485 for lib in $dlprefiles; do
6487 [[\\/]]* | [[A-Za-z]]:[[\\/]]*) abs="$lib" ;;
6488 *) abs=`pwd`"/$lib" ;;
6490 newdlprefiles="$newdlprefiles $abs"
6492 dlprefiles="$newdlprefiles"
6495 # place dlname in correct position for cygwin
6497 case $host,$output,$installed,$module,$dlname in
6498 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
6501 # $outputname - a libtool library file
6502 # Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
6504 # Please DO NOT delete this file!
6505 # It is necessary for linking the library.
6507 # The name that we can dlopen(3).
6510 # Names of this library.
6511 library_names='$library_names'
6513 # The name of the static archive.
6514 old_library='$old_library'
6516 # Linker flags that can not go in dependency_libs.
6517 inherited_linker_flags='$new_inherited_linker_flags'
6519 # Libraries that this one depends upon.
6520 dependency_libs='$dependency_libs'
6522 # Names of additional weak libraries provided by this library
6523 weak_library_names='$weak_libs'
6525 # Version information for $libname.
6530 # Is this an already installed library?
6531 installed=$installed
6533 # Should we warn about portability when linking against -modules?
6534 shouldnotlink=$module
6536 # Files to dlopen/dlpreopen
6538 dlpreopen='$dlprefiles'
6540 # Directory that this library needs to be installed in:
6541 libdir='$install_libdir'"
6542 if test "$installed" = no && test "$need_relink" = yes; then
6544 relink_command=\"$relink_command\""
6549 # Do a symbolic link so that the libtool archive can be found in
6550 # LD_LIBRARY_PATH before the program is installed.
6551 func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
6558 # func_mode_uninstall arg...
6559 func_mode_uninstall ()
6567 # This variable tells wrapper scripts just to set variables rather
6568 # than running their programs.
6569 libtool_install_magic="$magic"
6574 -f) RM="$RM $arg"; rmforce=yes ;;
6575 -*) RM="$RM $arg" ;;
6576 *) files="$files $arg" ;;
6581 func_fatal_help "you must specify an RM program"
6585 origobjdir="$objdir"
6586 for file in $files; do
6587 func_dirname "$file" "" "."
6588 dir="$func_dirname_result"
6589 if test "X$dir" = X.; then
6590 objdir="$origobjdir"
6592 objdir="$dir/$origobjdir"
6594 func_basename "$file"
6595 name="$func_basename_result"
6596 test "$mode" = uninstall && objdir="$dir"
6598 # Remember objdir for removal later, being careful to avoid duplicates
6599 if test "$mode" = clean; then
6602 *) rmdirs="$rmdirs $objdir" ;;
6606 # Don't error if the file doesn't exist and rm -f was used.
6607 if { test -L "$file"; } >/dev/null 2>&1 ||
6608 { test -h "$file"; } >/dev/null 2>&1 ||
6609 test -f "$file"; then
6611 elif test -d "$file"; then
6614 elif test "$rmforce" = yes; then
6622 # Possibly a libtool archive, so verify it.
6623 if func_lalib_p "$file"; then
6626 # Delete the libtool libraries and symlinks.
6627 for n in $library_names; do
6628 rmfiles="$rmfiles $objdir/$n"
6630 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6634 case " $library_names " in
6635 # " " in the beginning catches empty $dlname
6637 *) rmfiles="$rmfiles $objdir/$dlname" ;;
6639 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6642 if test -n "$library_names"; then
6643 # Do each command in the postuninstall commands.
6644 func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
6647 if test -n "$old_library"; then
6648 # Do each command in the old_postuninstall commands.
6649 func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
6651 # FIXME: should reinstall the best remaining shared library.
6658 # Possibly a libtool object, so verify it.
6659 if func_lalib_p "$file"; then
6664 # Add PIC object to the list of files to remove.
6665 if test -n "$pic_object" &&
6666 test "$pic_object" != none; then
6667 rmfiles="$rmfiles $dir/$pic_object"
6670 # Add non-PIC object to the list of files to remove.
6671 if test -n "$non_pic_object" &&
6672 test "$non_pic_object" != none; then
6673 rmfiles="$rmfiles $dir/$non_pic_object"
6679 if test "$mode" = clean ; then
6683 func_stripname '' '.exe' "$file"
6684 file=$func_stripname_result
6685 func_stripname '' '.exe' "$name"
6686 noexename=$func_stripname_result
6687 # $file with .exe has already been added to rmfiles,
6688 # add $file without .exe
6689 rmfiles="$rmfiles $file"
6692 # Do a test to see if this is a libtool program.
6693 if func_ltwrapper_p "$file"; then
6697 # note $name still contains .exe if it was in $file originally
6698 # as does the version of $file that was added into $rmfiles
6699 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6700 if test "$fast_install" = yes && test -n "$relink_command"; then
6701 rmfiles="$rmfiles $objdir/lt-$name"
6703 if test "X$noexename" != "X$name" ; then
6704 rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6710 func_show_eval "$RM $rmfiles" 'exit_status=1'
6712 objdir="$origobjdir"
6714 # Try to remove the ${objdir}s in the directories where we deleted files
6715 for dir in $rmdirs; do
6716 if test -d "$dir"; then
6717 func_show_eval "rmdir $dir >/dev/null 2>&1"
6725 # TEST SUITE MARKER ## NON-FUNCTION
6731 # Sanity checks first:
6732 func_check_version_match
6734 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
6735 func_fatal_configuration "not configured to build any kind of library"
6738 test -z "$mode" && func_fatal_error "error: you must specify a MODE."
6742 eval std_shrext=\"$shrext_cmds\"
6745 # Only execute mode is allowed to have -dlopen flags.
6746 if test -n "$execute_dlfiles" && test "$mode" != execute; then
6747 func_error "unrecognized option \`-dlopen'"
6752 # Change the help message to a mode-specific one.
6753 generic_help="$help"
6754 help="Try \`$progname --help --mode=$mode' for more information."
6757 compile) func_mode_compile ${1+"$@"} ;;
6758 execute) func_mode_execute ${1+"$@"} ;;
6759 finish) func_mode_finish ${1+"$@"} ;;
6760 install) func_mode_install ${1+"$@"} ;;
6761 link|relink) func_mode_link ${1+"$@"} ;;
6762 uninstall|clean) func_mode_uninstall ${1+"$@"} ;;
6764 "") help="$generic_help"
6765 func_fatal_help "you must specify a MODE"
6769 test -z "$exec_cmd" && \
6770 func_fatal_help "invalid operation mode \`$mode'"
6772 if test -n "$exec_cmd"; then
6773 eval exec "$exec_cmd"
6781 # The TAGs below are defined such that we never get into a situation
6782 # in which we disable both kinds of libraries. Given conflicting
6783 # choices, we go for a static library, that is the most portable,
6784 # since we can't tell whether shared libraries were disabled because
6785 # the user asked for that or because the platform doesn't support
6786 # them. This is particularly important on AIX, because we don't
6787 # support having both static and shared libraries enabled at the same
6788 # time on that platform, so we default to a shared-only configuration.
6789 # If a disable-shared tag is given, we'll fallback to a static-only
6790 # configuration. But we'll never go from static-only to shared-only.
6792 # ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6793 build_libtool_libs=no
6795 # ### END LIBTOOL TAG CONFIG: disable-shared
6797 # ### BEGIN LIBTOOL TAG CONFIG: disable-static
6798 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
6799 # ### END LIBTOOL TAG CONFIG: disable-static