63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# libtool (GNU libtool) 2.4.2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This is free software; see the source for copying conditions. There is NO
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# GNU Libtool is free software; you can redistribute it and/or modify
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# it under the terms of the GNU General Public License as published by
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# the Free Software Foundation; either version 2 of the License, or
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# (at your option) any later version.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# As a special exception to the GNU General Public License,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# if you distribute this file as part of a program or library that
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# is built using GNU Libtool, you may include this file under the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# same distribution terms that you use for the rest of that program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# GNU Libtool is distributed in the hope that it will be useful, but
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# WITHOUT ANY WARRANTY; without even the implied warranty of
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# General Public License for more details.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# You should have received a copy of the GNU General Public License
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# along with GNU Libtool; see the file COPYING. If not, a copy
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# can be downloaded from http://www.gnu.org/licenses/gpl.html,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# or obtained by writing to the Free Software Foundation, Inc.,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Usage: $progname [OPTION]... [MODE-ARG]...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Provide generalized library-building support services.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --config show all configuration variables
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --debug enable verbose shell tracing
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# -n, --dry-run display commands without modifying any files
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --features display basic configuration information and exit
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --mode=MODE use operation mode MODE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --preserve-dup-deps don't remove duplicate dependency libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --quiet, --silent don't print informational messages
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --no-quiet, --no-silent
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# print informational messages (default)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --no-warn don't display warning messages
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --tag=TAG use configuration variables from tag TAG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# -v, --verbose print more informational messages than default
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --no-verbose don't print the extra informational messages
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --version print version information
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# -h, --help, --help-all print short, long, or detailed help message
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# MODE must be one of the following:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# clean remove files from the build directory
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# compile compile a source file into a libtool object
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# execute automatically set library path, then run a program
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# finish complete the installation of libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# install install libraries or executables
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# link create a library or an executable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# uninstall remove libraries from an installed directory
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# MODE-ARGS vary depending on the MODE. When passed as first option,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# When reporting a bug, please describe a test case to reproduce it and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# include the following information:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# host-triplet: $host
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# shell: $SHELL
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# compiler: $LTCC
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# compiler flags: $LTCFLAGS
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# linker: $LD (gnu? $with_gnu_ld)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $progname: (GNU libtool) 2.4.2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# automake: $automake_version
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# autoconf: $autoconf_version
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Report bugs to <bug-libtool@gnu.org>.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# General help using GNU software: <http://www.gnu.org/gethelp/>.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Be Bourne compatible
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrewsif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews # is contrary to our usage. Disable this feature.
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# A function that is used when there is no print builtin or printf.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# NLS nuisances: We save the old values to restore during execute mode.
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrewsfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews eval "if test \"\${$lt_var+set}\" = set; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# is ksh but when the shell is invoked as "sh" and the current value of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# the _XPG environment variable is not equal to 1 (one), the special
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# positional parameter $0, within a function call, is the name of the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstest "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Global variables:
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsEXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsEXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
0bd1b2fbfed4aa489e9d5fcbc7f48acb96ba7248Mark Andrews# Make sure IFS has a sensible default
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_dirname file append nondir_replacement
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Compute the dirname of FILE. If nonempty, add APPEND to the result,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# otherwise set result to NONDIR_REPLACEMENT.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$func_dirname_result" = "X${1}"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_dirname may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_basename file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_basename_result=`$ECHO "${1}" | $SED "$basename"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_basename may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_dirname_and_basename file append nondir_replacement
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# perform func_basename and func_dirname in a single function
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# dirname: Compute the dirname of FILE. If nonempty,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# add APPEND to the result, otherwise set result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# to NONDIR_REPLACEMENT.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# value returned in "$func_dirname_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# basename: Compute filename of FILE.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# value retuned in "$func_basename_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Implementation must be kept synchronized with func_dirname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# and func_basename. For efficiency, we do not delegate to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# those functions but instead duplicate the functionality here.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$func_dirname_result" = "X${1}"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_dirname_and_basename may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_stripname prefix suffix name
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# strip PREFIX and SUFFIX off of NAME.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# PREFIX and SUFFIX must not contain globbing or regex special
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# characters, hashes, percent signs, but SUFFIX may contain a leading
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# dot (in which case that matches only a dot).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_strip_suffix prefix name
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_stripname may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# These SED scripts presuppose an absolute path with a trailing slash.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_normal_abspath PATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Remove doubled-up and trailing slashes, "." path components,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# and cancel out any ".." path components in PATH after making
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# it an absolute path.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# value returned in "$func_normal_abspath_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_result=$func_stripname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The next three entries are used to spot a run of precisely
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # two leading slashes without using negated character classes;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # we take advantage of case's first-match behaviour.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Not necessarily an ordinary path; POSIX reserves leading '//'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # and for example Cygwin uses it to access remote file shares
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # over CIFS/SMB, so we conserve a leading double slash if found.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Cancel out all the simple stuff to save iterations. We also want
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the path to end with a slash for ease of parsing, so make sure
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$func_normal_abspath_tpath" = / ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If we ascended to the root using ".." the result may be empty now.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$func_normal_abspath_result" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Parent dir; strip last assembled component from result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_result=$func_dirname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Restore leading double-slash if one was found on entry.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_relative_path SRCDIR DSTDIR
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# generates a relative path from SRCDIR to DSTDIR, with a trailing
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# slash if non-empty, suitable for immediately appending a filename
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# without needing to append a separator.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# value returned in "$func_relative_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_tlibdir=$func_normal_abspath_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_tbindir=$func_normal_abspath_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_tcancelled=$func_stripname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_tlibdir=${func_dirname_result}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "x$func_relative_path_tlibdir" = x ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_result=../$func_relative_path_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_tcancelled=$func_relative_path_tbindir
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_result=../$func_relative_path_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Now calculate path; take care to avoid doubling-up slashes.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname '' '/' "$func_relative_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_result=$func_stripname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname '/' '/' "$func_relative_path_tcancelled"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Normalisation. If bindir is libdir, return empty string,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # else relative path ending with a slash; either way, target
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test ! -z "$func_relative_path_result"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname './' '' "$func_relative_path_result/"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_relative_path_result=$func_stripname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The name of this program:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Make sure we have an absolute path for reexecution:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]*|[A-Za-z]:\\*) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -x "$progdir/$progname" && break
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Sed substitution that helps us do robust quoting. It backslashifies
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# metacharacters that are still active within double-quoted strings.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Same as above, but do not quote variable references.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Sed substitution that turns a string into a regex matching for the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# string literally.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Sed substitution that converts a w32 file name or path
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# which contains forward slashes, into one that contains
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# (escaped) backslashes. A very naive implementation.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Re-`\' parameter expansions in output of double_quote_subst that were
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in input to double_quote_subst, that '$' was protected from expansion.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Since each input `\' is now two `\'s, look for any number of runs of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewssed_double_backslash="\
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/^$bs2$dollar/$bs&/
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Standard options:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsopt_dry_run=false
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsopt_help=false
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsopt_quiet=false
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsopt_verbose=false
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsopt_warning=:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_echo arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message, along with the current mode
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# name if it has been set yet.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_verbose arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message in verbose mode only.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_verbose ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_verbose && func_echo ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # A bug in bash halts the script if the last line of a function
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # fails when set -e is in force, so we need another command to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # work around that:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_echo_all arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Invoke $ECHO with all args, space-separated.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_echo_all ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_error arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message to standard error.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_error ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_warning arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed warning message to standard error.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_warning ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # bash bug again:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_fatal_error arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message to standard error, and exit.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_fatal_error ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews exit $EXIT_FAILURE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_fatal_help arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message to standard error, followed by
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# a help hint, and exit.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_fatal_help ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "$help"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewshelp="Try \`$progname --help' for more information." ## default
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_grep expression filename
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Check whether EXPRESSION matches any line of FILENAME, without output.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mkdir_p directory-path
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Make sure the entire path to DIRECTORY-PATH is available.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_mkdir_p ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_dir_list=
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $my_directory_path in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -*) my_directory_path="./$my_directory_path" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # While some portion of DIR does not yet exist...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while test ! -d "$my_directory_path"; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # ...make a list in topmost first order. Use a colon delimited
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # list incase some portion of path contains whitespace.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_dir_list="$my_directory_path:$my_dir_list"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the last portion added has no slash in it, the list is done
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $my_directory_path in */*) ;; *) break ;; esac
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # ...otherwise throw away the child directory and loop
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for my_dir in $my_dir_list; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews IFS="$save_mkdir_p_IFS"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # mkdir can fail with a `File exist' error if two processes
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # try to create one of the directories concurrently. Don't
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Bail out if we (or some other process) failed to create a directory.
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews# func_mktempdir [string]
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews# Make a temporary directory that won't clash with other running
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews# libtool processes, and avoids race conditions if possible. If
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews# given, STRING is the basename for that directory.
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews # Return a directory name, but don't create it in dry-run mode
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Failing that, at least try and use $RANDOM to avoid a race
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews # If we're not in dry-run mode, bomb out on failure
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_quote_for_eval arg
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Aesthetically quote ARG to be evaled later.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# is double-quoted, suitable for a subsequent eval, whereas
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# which are still active within double quotes backslashified.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *[\\\`\"\$]*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Double-quote args containing shell metacharacters to delay
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # word splitting, command substitution and and variable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Many Bourne shells cannot handle close brackets correctly
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_quote_for_expand arg
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Aesthetically quote ARG to be evaled later; same as above,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# but do not quote variable references.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Double-quote args containing shell metacharacters to delay
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # word splitting and command substitution for a subsequent eval.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Many Bourne shells cannot handle close brackets correctly
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_show_eval cmd [fail_exp]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# is given, then evaluate it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ${opt_dry_run-false}; then :; else
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_show_eval_locale cmd [fail_exp]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# is given, then evaluate it. Use the saved locale for evaluation.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ${opt_dry_run-false}; then :; else
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Turn $1 into a string suitable for a shell variable name.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result is stored in $func_tr_sh_result. All characters
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# if $1 begins with a digit, a '_' is prepended as well.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [0-9]* | *[!a-zA-Z0-9_]*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_version
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo version message to standard output and exit.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo short help message to standard output and exit.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "run \`$progname --help | more' for full usage"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_help [NOEXIT]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo long help message to standard output and exit,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# unless 'noexit' is passed as argument.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^# .* home page:/b print
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^# General help using/b print
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_missing_arg argname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message to standard error and set global
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_split_short_opt shortopt
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Set func_split_short_opt_name and func_split_short_opt_arg shell
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# variables after splitting SHORTOPT after the 2nd character.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_split_short_opt may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_split_long_opt longopt
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Set func_split_long_opt_name and func_split_long_opt_arg shell
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# variables after splitting LONGOPT at the `=' sign.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_split_long_opt may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Global variables.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# If this variable is set in any of the actions, the command in it
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# will be execed at the end. This prevents here-documents from being
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# left over by shells.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_append var value
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Append VALUE to the end of shell variable VAR.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_append may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_append_quoted var value
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Quote VALUE and append to the end of shell variable VAR, separated
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# by a space.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_append_quoted may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_arith arithmetic-term...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_arith may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_len string
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# STRING may not start with a hyphen.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_len may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_lo2o object
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_lo2o may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_xform libobj-or-source
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} # func_xform may be replaced by extended shell implementation
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_fatal_configuration arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echo program name prefixed message to standard error, followed by
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# a configuration failure hint, and exit.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "See the $PACKAGE documentation for more information."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_config
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Display the configuration for all the tags in this script.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_features
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Display the features supported by this script.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_enable_tag tagname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Verify that TAGNAME is valid, and either flag an error and exit, or
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# variable here.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Don't test for the "default" C tag, as we know it's
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Evaluate the configuration. Be careful to quote the path
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # and the sed script, to avoid splitting on whitespace, but
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # also don't use non-portable quotes within backquotes within
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_check_version_match
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Ensure that we are using m4 macros, and libtool script from the same
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# release of libtool.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$package_revision" != "$macro_revision"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cat >&2 <<_LT_EOF
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: definition of this LT_INIT comes from an older release.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: and run autoconf again.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cat >&2 <<_LT_EOF
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: and run autoconf again.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cat >&2 <<_LT_EOF
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: but the definition of this LT_INIT comes from revision $macro_revision.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: You should recreate aclocal.m4 with macros from revision $package_revision
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews$progname: of $PACKAGE $VERSION and run autoconf again.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Shorthand for --mode=foo, only valid as the first argument
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews shift; set dummy --mode compile ${1+"$@"}; shift
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews shift; set dummy --mode execute ${1+"$@"}; shift
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews shift; set dummy --mode finish ${1+"$@"}; shift
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews shift; set dummy --mode install ${1+"$@"}; shift
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsuninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews shift; set dummy --mode uninstall ${1+"$@"}; shift
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Option defaults:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Parse options once, thoroughly. This comes as soon as possible in the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# script to make things like `--version' happen as quickly as we can.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while test $# -gt 0; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test $# = 0 && func_missing_arg $opt && break
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews clean|compile|execute|finish|install|link|relink|uninstall) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test $# = 0 && func_missing_arg $opt && break
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -\?*|-h*|-n*|-v*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews --) break ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -*) func_fatal_help "unrecognized option \`$opt'" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$opt_debug" = : || func_append preserve_args " --debug"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *cygwin* | *mingw* | *pw32* | *cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # don't eliminate duplications in $postdeps and $predeps
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_configuration "not configured to build any kind of library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Only execute mode is allowed to have -dlopen flags.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Change the help message to a mode-specific one.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews help="Try \`$progname --help --mode=$opt_mode' for more information."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews## ----------- ##
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews## ----------- ##
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_lalib_p file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True iff FILE is a libtool `.la' library or `.lo' object file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function is only a basic sanity check; it will hardly flush out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# determined imposters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_lalib_unsafe_p file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True iff FILE is a libtool `.la' library or `.lo' object file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function implements the same check as func_lalib_p without
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# resorting to external programs. To this end, it redirects stdin and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# closes it afterwards, without saving the original file descriptor.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# As a safety measure, use it only where a negative result would be
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# fatal anyway. Works if `file' does not exist.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews exec 0<&5 5<&-
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_ltwrapper_script_p file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True iff FILE is a libtool wrapper script
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function is only a basic sanity check; it will hardly flush out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# determined imposters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_ltwrapper_executable_p file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True iff FILE is a libtool wrapper executable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function is only a basic sanity check; it will hardly flush out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# determined imposters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_ltwrapper_scriptname file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Assumes file is an ltwrapper_executable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# uses $file to determine the appropriate filename for a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# temporary ltwrapper_script.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname '' '.exe' "$func_basename_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_ltwrapper_p file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True iff FILE is a libtool wrapper script or wrapper executable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This function is only a basic sanity check; it will hardly flush out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# determined imposters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_execute_cmds commands fail_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Execute tilde-delimited COMMANDS.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# If FAIL_CMD is given, eval that upon failure.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# FAIL_CMD may read-access the current command in variable CMD!
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_source file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Source FILE, adding directory component if necessary.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Note that it is not necessary on cygwin/mingw to append a dot to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# behavior happens only for exec(3), not for open(2)! Also, sourcing
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# `FILE.' does not work on cygwin managed mounts.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_resolve_sysroot PATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Replace a leading = in PATH with a sysroot. Store the result into
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_resolve_sysroot_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname '=' '' "$func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_replace_sysroot PATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# If PATH begins with the sysroot, replace it with = and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# store the result into func_replace_sysroot_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_replace_sysroot_result="=$func_stripname_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_infer_tag arg
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Infer tagged configuration to use if any are available and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# if one wasn't chosen via the "--tag" command line option.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Only attempt this if the compiler in the base compile
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# command doesn't match the default compiler.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# arg is usually of the form 'gcc ...'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FreeBSD-specific: where we install compilers with non-standard names
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tag_compilers_CXX="*c++ c++* *g++ g++* clang++"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If $tagname isn't set, then try to infer if the default "CC" tag applies
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews if test -n "$available_tags" && test -z "$tagname"; then
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # Blanks in the command may have been stripped by the calling shell,
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # but not from the CC environment variable when configure was run.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # Blanks at the start of $base_compile will cause this to fail
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Double-quote args containing other shell metacharacters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # The compiler in the base compile command matches
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # Assume this is the tagged configuration we want.
914eeb33149a0008e26741d9e7d89dcd6f8b6d0bMark Andrews # FreeBSD-specific: try compilers based on inferred tag
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # If $tagname still isn't set, then no tagged configuration
7c8662961e2876e22e34c96d41dad0cd70e3ce4cMark Andrews # was found and let the user know that the "--tag" command
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_echo "unable to infer tagged configuration"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_verbose "using $tagname tagged configuration"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_write_libtool_object output_name pic_name nonpic_name
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Create a libtool object file (analogous to a ".la" file),
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# but don't create it if we're doing a dry run.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $write_libobj - a libtool object file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Please DO NOT delete this file!
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# It is necessary for linking the library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Name of the PIC object.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewspic_object=$write_lobj
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Name of the non-PIC object
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsnon_pic_object=$write_oldobj
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews##################################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews##################################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_core_file_wine_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Helper function used by file name conversion functions when $build is *nix,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# and $host is mingw, cygwin, or some other w32 environment. Relies on a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# correctly configured wine environment available, with the winepath program
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in $build's $PATH.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG is the $build file name to be converted to w32 format.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result is available in $func_convert_core_file_wine_to_w32_result, and will
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# be empty on error (or when ARG is empty)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Unfortunately, winepath does not exit with a non-zero error code, so we
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # are forced to check the contents of stdout. On the other hand, if the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # command is not found, the shell will set an exit code of 127 and print
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # *an error message* to stdout. So we must check for both error code of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # zero AND non-empty stdout, which explains the odd construction:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end: func_convert_core_file_wine_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_core_path_wine_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Helper function used by path conversion functions when $build is *nix, and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# configured wine environment available, with the winepath program in $build's
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $PATH. Assumes ARG has no leading or trailing path separator characters.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG is path to be converted from $build format to win32.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result is available in $func_convert_core_path_wine_to_w32_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Unconvertible file (directory) names in ARG are skipped; if no directory names
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# are convertible, then the result may be empty.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # unfortunately, winepath doesn't convert paths, only file names
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for func_convert_core_path_wine_to_w32_f in $1; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$func_convert_core_file_wine_to_w32_result" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$func_convert_core_path_wine_to_w32_result"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end: func_convert_core_path_wine_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygpath ARGS...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# (2), returns the Cygwin file name or path in func_cygpath_result (input
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# file name or path is assumed to be in w32 format, as previously converted
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# from $build's *nix or MSYS format). In case (3), returns the w32 file name
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# or path in func_cygpath_result (input file name or path is assumed to be in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Cygwin format). Returns an empty string on error.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARGS are passed to cygpath, with the last one being the file name or path to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# be converted.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# environment variable; do not put it in $PATH.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#end: func_cygpath
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_core_msys_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name or path ARG from MSYS format to w32 format. Return
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# result in func_convert_core_msys_to_w32_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#end: func_convert_core_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_check ARG1 ARG2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Verify that ARG1 (a file name in $build format) was converted to $host
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# format in ARG2. Otherwise, emit an error message, but continue (resetting
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result to ARG1).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "Could not determine host file name corresponding to"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "Continuing, but uninstalled executables may not work."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Verify that FROM_PATH (a path in $build format) was converted to $host
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result to a simplistic fallback value (see below).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "Could not determine the host path corresponding to"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "Continuing, but uninstalled executables may not work."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Fallback. This is a deliberately simplistic "conversion" and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# and appending REPL if ORIG matches BACKPAT.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $1 ) func_to_host_path_result="$3$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_front_back_pathsep
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews##################################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $build to $host FILE NAME CONVERSION FUNCTIONS #
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews##################################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# invoked via `$to_host_file_cmd ARG'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# In each case, ARG is the path to be converted from $build to $host format.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result will be available in $func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Converts the file name ARG from $build format to $host format. Return result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_to_host_file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_tool_file ARG LAZY
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# converts the file name ARG from $build format to toolchain format. Return
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# result in func_to_tool_file_result. If the conversion in use is listed
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in (the comma separated) LAZY, no conversion takes place.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file_result=$func_to_host_file_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_to_tool_file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_noop ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Copy ARG to func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_noop
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_msys_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# conversion to w32 is not available inside the cwrapper. Returns result in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_file_result="$func_convert_core_msys_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_file_check "$1" "$func_to_host_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_cygwin_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name ARG from Cygwin to w32 format. Returns result in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_file_check "$1" "$func_to_host_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_cygwin_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_nix_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name ARG from *nix to w32 format. Requires a wine environment
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# and a working winepath. Returns result in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_file_check "$1" "$func_to_host_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_nix_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_msys_to_cygwin ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Returns result in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygpath -u "$func_convert_core_msys_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_file_result="$func_cygpath_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_file_check "$1" "$func_to_host_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_msys_to_cygwin
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_file_nix_to_cygwin ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_file_result="$func_cygpath_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_file_check "$1" "$func_to_host_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_file_nix_to_cygwin
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#############################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $build to $host PATH CONVERSION FUNCTIONS #
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#############################################
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# invoked via `$to_host_path_cmd ARG'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# In each case, ARG is the path to be converted from $build to $host format.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The result will be available in $func_to_host_path_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Path separators are also converted from $build format to $host format. If
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG begins or ends with a path separator character, it is preserved (but
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# converted to $host format) on output.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# All path conversion functions are named using the following convention:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# file name conversion function : func_convert_file_X_to_Y ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# path conversion function : func_convert_path_X_to_Y ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# where, for any given $build/$host combination the 'X_to_Y' value is the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# same. If conversion functions are added for new $build/$host combinations,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# the two new functions must follow this pattern, or func_init_to_host_path_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# will break.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_init_to_host_path_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Ensures that function "pointer" variable $to_host_path_cmd is set to the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# appropriate value, based on the value of $to_host_file_cmd.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews to_host_path_cmd="func_convert_path_${func_stripname_result}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_path ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Converts the path ARG from $build format to $host format. Return result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# in func_to_host_path_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_to_host_path
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_noop ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Copy ARG to func_to_host_path_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_noop
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_msys_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# conversion to w32 is not available inside the cwrapper. Returns result in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_path_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove leading and trailing path separator characters from ARG. MSYS
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_path_result="$func_convert_core_msys_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "$func_to_host_path_tmp1" "$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_cygwin_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert path ARG from Cygwin to w32 format. Returns result in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "$func_to_host_path_tmp1" "$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_cygwin_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_nix_to_w32 ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert path ARG from *nix to w32 format. Requires a wine environment and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# a working winepath. Returns result in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "$func_to_host_path_tmp1" "$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_nix_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_msys_to_cygwin ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Returns result in func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_path_result="$func_cygpath_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "$func_to_host_path_tmp1" "$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_path_front_back_pathsep ":*" "*:" : "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_msys_to_cygwin
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_convert_path_nix_to_cygwin ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_to_host_file_result.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove leading and trailing path separator characters from
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # ARG. msys behavior is inconsistent here, cygpath turns them
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # into '.;' and ';.', and winepath ignores them completely.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_host_path_result="$func_cygpath_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "$func_to_host_path_tmp1" "$func_to_host_path_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_convert_path_front_back_pathsep ":*" "*:" : "$1"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end func_convert_path_nix_to_cygwin
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_compile arg...
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Get the compilation command and the source file.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews srcfile="$nonopt" # always keep a non-empty value in "srcfile"
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # do not "continue". Instead, add this to base_compile
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "you cannot specify \`-o' more than once"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -shared | -static | -prefer-pic | -prefer-non-pic)
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews arg_mode=arg # the next one goes into the "base_compile" arg list
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews continue # The current "srcfile" will either be retained or
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews ;; # replaced later. I would guess that would be a bug.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # Accept the current argument as the source file.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # The previous "srcfile" becomes the current argument.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "you must specify an argument for -Xcompile"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "you must specify a target with \`-o'"
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # If the user specifies -o file.o, it is replaced with file.lo
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *.ada | *.adb | *.ads | *.asm | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot determine name of library object from \`$libobj'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_configuration "can not build a shared library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "X$libobj" != "X$func_quote_for_eval_result" \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews && func_warning "libobj name \`$libobj' may not contain shell special characters."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "you must specify a compilation command"
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # On Cygwin there's no "real" PIC flag so we must build both object types
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cygwin* | mingw* | pw32* | os2* | cegcc*)
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # non-PIC code in shared libraries is not supported
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Calculate the filename of the output object if compiler does
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # We use this script file to make the link, it avoids creating a new file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_echo "Waiting for $lockfile to be removed"
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley*** ERROR, $lockfile exists and contains:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob HalleyThis indicates that another process is trying to use the same
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleytemporary object file, and libtool could not work around it because
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyyour compiler does not support \`-c' and \`-o' together. If you
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyrepeat this compilation, it may succeed, by chance, but you had better
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyavoid parallel builds (make -j) in this platform, or get a better
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Only build a PIC object if we are building libtool libraries.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Without this assignment, base_compile gets emptied.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley*** ERROR, $lockfile contains:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleybut it should contain:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob HalleyThis indicates that another process is trying to use the same
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleytemporary object file, and libtool could not work around it because
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyyour compiler does not support \`-c' and \`-o' together. If you
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyrepeat this compilation, it may succeed, by chance, but you had better
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyavoid parallel builds (make -j) in this platform, or get a better
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Just move the object if needed, then go on to compile the next one
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # Allow error messages only from the first compilation.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Only build a position-dependent object if we build old libraries.
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley # Suppress compiler output if we already did a PIC compilation.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley*** ERROR, $lockfile contains:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleybut it should contain:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob HalleyThis indicates that another process is trying to use the same
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleytemporary object file, and libtool could not work around it because
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyyour compiler does not support \`-c' and \`-o' together. If you
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyrepeat this compilation, it may succeed, by chance, but you had better
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyavoid parallel builds (make -j) in this platform, or get a better
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We need to display help for each of the modes.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Generic help is extracted from the usage comments
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsRemove files from the build directory.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsRM is the name of the program to use to delete files associated with each FILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf FILE is a libtool library, object or program, all the files associated
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewswith it are deleted. Otherwise, only FILE itself is deleted using RM."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsCompile a source file into a libtool library object.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThis mode accepts the following additional options:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -o OUTPUT-FILE set the output file name to OUTPUT-FILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -no-suppress do not suppress compiler output for multiple passes
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -prefer-pic try to build PIC objects only
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -prefer-non-pic try to build non-PIC objects only
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -shared do not build a \`.o' file suitable for static linking
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -static only build a \`.o' file suitable for static linking
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -Wc,FLAG pass FLAG directly to the compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfrom the given SOURCEFILE.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThe output file name is determined by removing the directory component from
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsSOURCEFILE, then substituting the C source code suffix \`.c' with the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslibrary object suffix, \`.lo'."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsAutomatically set library path, then run a program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThis mode accepts the following additional options:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -dlopen FILE add the directory containing FILE to the library path
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThis mode sets the library path environment variable according to \`-dlopen'
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf any of the ARGS are libtool executable wrappers, then they are translated
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsinto their corresponding uninstalled binary, and any of their required library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsdirectories are added to the library path.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThen, COMMAND is executed, with ARGS as arguments."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsComplete the installation of libtool libraries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsEach LIBDIR is a directory that contains libtool libraries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThe commands that this mode executes may require superuser privileges. Use
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsthe \`--dry-run' option if you just want to see what would be executed."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsInstall executables or libraries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsINSTALL-COMMAND is the installation command. The first component should be
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewseither the \`install' or \`cp' program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThe following components of INSTALL-COMMAND are treated specially:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThe rest of the components are interpreted as arguments to that command (only
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsBSD-compatible install options are recognized)."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsLink object files or libraries together to form another library, or to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewscreate an executable program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsLINK-COMMAND is a command using the C compiler that you would use to create
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsa program from several object files.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsThe following components of LINK-COMMAND are treated specially:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -all-static do not do any dynamic linking at all
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -avoid-version do not add a version suffix if possible
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -bindir BINDIR specify path to binaries directory (for systems where
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libraries must be found in the PATH setting at runtime)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -export-symbols SYMFILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews try to export only the symbols listed in SYMFILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -export-symbols-regex REGEX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews try to export only the symbols matching REGEX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -LLIBDIR search LIBDIR for required installed libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -lNAME OUTPUT-FILE requires the installed library libNAME
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -module build a library that can dlopened
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -no-fast-install disable the fast-install mode
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -no-install link a not-installable executable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -no-undefined declare that a library does not refer to external symbols
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -objectlist FILE Use a list of object files found in FILE to specify objects
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -precious-files-regex REGEX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews don't remove output files matching REGEX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -release RELEASE specify package release information
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -rpath LIBDIR the created library will eventually be installed in LIBDIR
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -shared only do dynamic linking of libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -shrext SUFFIX override the standard shared library file extension
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -static do not do any dynamic linking of uninstalled libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -static-libtool-libs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews do not do any dynamic linking of libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -version-info CURRENT[:REVISION[:AGE]]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews specify library version info [each variable defaults to 0]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -weak LIBNAME declare that the target provides the LIBNAME interface
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -Xlinker FLAG pass linker-specific FLAG directly to the linker
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsAll other options (arguments beginning with \`-') are ignored.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsEvery other argument is treated as a filename. Files ending in \`.la' are
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstreated as uninstalled libtool libraries, other files are standard or library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsobject files.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsonly library objects (\`.lo' files) may be specified, and \`-rpath' is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsrequired, except when creating a convenience library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsusing \`ar' and \`ranlib', or on Windows using \`lib'.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsis created, otherwise an executable program is created."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsRemove libraries from an installation directory.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsRM is the name of the program to use to delete files associated with each FILE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsIf FILE is a libtool library, all the files associated with it are deleted.
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsOtherwise, only FILE itself is deleted using RM."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "invalid operation mode \`$opt_mode'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "Try \`$progname --help' for more information about other modes."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Now that we've collected a possible --mode arg, show help if necessary
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for opt_mode in compile link execute install finish uninstall clean; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for opt_mode in compile link execute install finish uninstall clean; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^When reporting/,/^Report/{
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /information about other modes/d
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /more detailed .*MODE/d
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_execute arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that this really is a libtool archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews || func_fatal_help "\`$lib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`$file' was not linked with \`-export-dynamic'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Just add the directory containing the .lo file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # This variable tells wrapper scripts just to set shlibpath_var
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check if any of the arguments is a wrapper script.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -* | *.la | *.lo ) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do a test to see if this is really a libtool program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_source "$func_ltwrapper_scriptname_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Quote arguments (to preserve shell metacharacters).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "if test \"\${save_$lt_var+set}\" = set; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstest "$opt_mode" = execute && func_mode_execute ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_finish arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`$opt' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval "$cmds" || func_append admincmds "
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "----------------------------------------------------------------------"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "If you ever happen to want to link against installed libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "in a given directory, LIBDIR, you must either use libtool, and"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "flag during linking and do at least one of the following:"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo " - add LIBDIR to the \`$runpath_var' environment variable"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO " - have your system administrator run these commands:$admincmds"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f /etc/ld.so.conf; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "See any operating system documentation about shared libraries for"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews solaris2.[6789]|solaris2.1[0-9])
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "more information, such as the ld(1) and ld.so(8) manual pages."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "----------------------------------------------------------------------"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstest "$opt_mode" = finish && func_mode_finish ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_install arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # There may be an optional sh(1) argument at the beginning of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Allow the use of GNU shtool's install command.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $nonopt in *shtool*) :;; *) false;; esac; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The real first argument should be the name of the installation program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append install_prog "$func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *[\\\ /]cp\ *) install_cp=: ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We need to accept at least all the BSD install flags.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $install_cp; then :; else
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -g | -m | -o)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the previous option needed an argument, then skip it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "x$prev" = x-m && test -n "$install_override_mode"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append install_prog " $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append install_shared_prog " $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "you must specify an install program"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "the \`$prev' option requires an argument"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$install_override_mode" && $no_mode; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $install_cp; then :; else
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append install_shared_prog " -m $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "no file or destination specified"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "you must specify a destination"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Strip any trailing slash from the destination.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that the destination is a directory.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Not a directory, so check to see that there is only one file specified.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "\`$destdir' must be an absolute directory name"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # This variable tells wrapper scripts just to set variables rather
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that this really is a libtool archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews || func_fatal_help "\`$file' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add the libdir to current_libdirs if it is the destination.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Determine the prefix the user has applied to our future dir.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Don't allow the user to place us outside of our expected
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # location b/c this prevents finding dependent libraries that
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # At present, this check doesn't affect windows .dll's that
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # are installed into $libdir/../bin (currently, that works fine)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Stick the inst_prefix_dir data into the link command.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$relink_command" && srcname="$realname"T
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Install the shared library and build the symlinks.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$tstripme" && test -n "$striplib"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$striplib $destdir/$realname" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Delete the old symlinks, and create new ones.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Try `ln -sf' first, because the `ln' binary might depend on
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the symlink we replace! Solaris /bin/ln does not understand -f,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$postinstall_cmds" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Install the pseudo-library for information purposes.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$old_library" && func_append staticlibs " $dir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Figure out destination file name, if it wasn't already specified.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Deduce the name of the destination old-style object file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "cannot copy a libtool object to \`$destfile'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_prog $file $destfile" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Deduce the name of the old-style object file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Figure out destination file name, if it wasn't already specified.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the file is missing, and there is a .exe on the end, strip it
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # because it is most likely a libtool script we actually want to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do a test to see if this is really a libtool program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check the variables that should have been set.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "invalid libtool wrapper script \`$wrapper'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$libdir" && test ! -f "$libfile"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`$lib' has not been installed in \`$libdir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$fast_install" = no && test -n "$relink_command"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "error: relink \`$file' with the above command before installing it"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # remove .exe since cygwin /usr/bin/install will append another
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$stripme" && test -n "$old_striplib"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$old_postinstall_cmds" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "remember to run \`$progname --finish$future_libdirs'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run && current_libdirs=" -n$current_libdirs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstest "$opt_mode" = install && func_mode_install ${1+"$@"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_generate_dlsyms outputname originator pic_p
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Extract symbols from dlprefiles and create ${outputname}S.o with
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# a dlpreopen symbol table.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$NM" && test -n "$global_symbol_pipe"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "not configured to extract global symbols from dlpreopened files"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "creating $output_objdir/$my_dlsyms"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef __cplusplus
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsextern \"C\" {
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* DATA imports from DLLs on WIN32 con't be const, because runtime
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relocations are performed -- see ld's documentation on pseudo-relocs. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_DLSYM_CONST
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#elif defined(__osf__)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* This system does not cope well with relocations in const data. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_DLSYM_CONST
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_DLSYM_CONST const
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* External symbol declarations for the compiler. */\
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "generating symbol list for \`$output'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add our own program objects to the symbol list.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$progfile" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews export_symbols="$output_objdir/$outputname.exp"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "extracting global C symbols from \`$dlprefile'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # if an import library, we need to obtain dlname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "curr_lafile=\$libfile_$func_tr_sh_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Use subshell, to avoid clobbering current variable values
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # no lafile. user explicitly requested -dlpreopen <import library>.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews dlprefile_dlbasename=$sharedlib_from_linklib_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "Could not compute DLL name from $name"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if sort -k 3 </dev/null >/dev/null 2>&1; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* The mapping between symbol names and symbols. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewstypedef struct {
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *name;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews void *address;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews} lt_dlsymlist;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsextern LT_DLSYM_CONST lt_dlsymlist
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_${my_prefix}_LTX_preloaded_symbols[];
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsLT_DLSYM_CONST lt_dlsymlist
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_${my_prefix}_LTX_preloaded_symbols[] =
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews { \"$my_originator\", (void *) 0 },"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews {0, (void *) 0}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* This works around a problem in FreeBSD linker */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef FREEBSD_WORKAROUND
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsstatic const void *lt_preloaded_setup() {
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews return lt_${my_prefix}_LTX_preloaded_symbols;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef __cplusplus
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # compiling the symbol table file with pic_flag works around
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # a FreeBSD bug that causes programs to crash when -lm is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # linked before any other PIC object. But we must not use
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # pic_flag when linking with -static. The problem exists in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Transform the symbol file into the correct name.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews symfileobj="$output_objdir/${my_outputname}S.$objext"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f "$output_objdir/$my_outputname.def"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "unknown suffix for \`$my_dlsyms'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We keep going just in case the user didn't refer to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_win32_libid arg
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# return the library type of file 'arg'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Need a lot of goo to handle *both* DLLs and import libs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Has to be a shell function in order to 'eat' the argument
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# that is supplied when $file_magic_command is called.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Despite the name, also deal with 64 bit binaries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *ar\ archive\ import\ library*) # definitely import
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$1" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s,.*,import,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews import*) win32_libid_type="x86 archive import";;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *executable*) # but shell scripts are "executable" too...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygming_dll_for_implib ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Platform-specific function to extract the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# name of the DLL associated with the specified
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# import library ARG.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Invoked by eval'ing the libtool variable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $sharedlib_from_linklib_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result is available in the variable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $sharedlib_from_linklib_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The is the core of a fallback implementation of a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# platform-specific function to extract the name of the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# DLL associated with the specified import library LIBNAME.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# SECTION_NAME is either .idata$6 or .idata$7, depending
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# on the platform and compiler that created the implib.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Echos the name of the DLL associated with the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# specified import library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $SED '/^Contents of section '"$match_literal"':/{
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Place marker at beginning of archive member dllname section
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/.*/====MARK====/
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # These lines can sometimes be longer than 43 characters, but
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # are always uninteresting
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /:[ ]*file format pe[i]\{,1\}-/d
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^In archive [^:]*:/d
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Ensure marker is printed
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^====MARK====/p
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove all lines with less than 43 characters
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^.\{43\}/!d
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # From remaining lines, remove first 43 characters
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Join marker and all lines until next marker into a single line
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /^====MARK====/ b para
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove the marker
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/^====MARK====//
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove trailing dots and whitespace
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews s/[\. \t]*$//
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # we now have a list, one entry per line, of the stringified
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # contents of the appropriate section of all members of the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # archive which possess that section. Heuristic: eliminate
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # all those which have a first or second character that is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # a '.' (that is, objdump's representation of an unprintable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # character.) This should work for all archives with less than
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # 0x302f exports -- but will fail for DLLs whose name actually
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # begins with a literal '.' or a single character followed by
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygming_gnu_implib_p ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This predicate returns with zero status (TRUE) if
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG is a GNU/binutils-style import library. Returns
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# with nonzero status (FALSE) otherwise.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$1" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygming_ms_implib_p ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This predicate returns with zero status (TRUE) if
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG is an MS-style import library. Returns
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# with nonzero status (FALSE) otherwise.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$1" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_cygming_dll_for_implib_fallback ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Platform-specific function to extract the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# name of the DLL associated with the specified
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# import library ARG.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This fallback implementation is for use when $DLLTOOL
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# does not support the --identify-strict option.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Invoked by eval'ing the libtool variable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $sharedlib_from_linklib_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Result is available in the variable
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $sharedlib_from_linklib_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_extract_an_archive dir oldlib
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$lock_old_archive_extraction" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_echo "Waiting for $lockfile to be removed"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$lock_old_archive_extraction" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_extract_archives gentop oldlib ...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews extracted_archives="$extracted_archives $my_xlib_u"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do not bother doing anything if just a dry run
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cd $my_xdir || exit $?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_base_archive=`basename "$darwin_archive"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_extract_an_archive "`pwd`" "${darwin_base_archive}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews ## Okay now we've a bunch of thin objects, gotta fatten them up :)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $LIPO -create -output "$darwin_file" $darwin_files
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_emit_wrapper [arg=no]
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Emit a libtool wrapper script on stdout.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Don't directly open a file because we may want to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# incorporate the script contents within a cygwin/mingw
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# wrapper executable. Must ONLY be called from within
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_link because it depends on a number of variables
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# set therein.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# variable will take. If 'yes', then the emitted script
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# will assume that the directory in which it is stored is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# the $objdir directory. This is a cygwin/mingw-specific
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $output - temporary wrapper script for $objdir/$outputname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The $output program cannot be directly executed until all the libtool
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# libraries that it depends on are installed.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This wrapper script should never be moved out of the build directory.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# If it is, it will not operate correctly.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Sed substitution that helps us do robust quoting. It backslashifies
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# metacharacters that are still active within double-quoted strings.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewssed_quote_subst='$sed_quote_subst'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Be Bourne compatible
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # is contrary to our usage. Disable this feature.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews alias -g '\${1+\"\$@\"}'='\"\$@\"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews setopt NO_GLOB_SUBST
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsBIN_SH=xpg4; export BIN_SH # for Tru64
63dd46733010bb9622810faa17d88c3e3c28b730Mark AndrewsDUALCASE=1; export DUALCASE # for MKS sh
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The HP-UX ksh and POSIX shell print the target directory to stdout
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# if CDPATH is set.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsrelink_command=\"$relink_command\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# This environment variable determines our operation mode.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsif test \"\$libtool_install_magic\" = \"$magic\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # install mode needs the following variables:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews generated_by_libtool_version='$macro_version'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews notinst_deplibs='$notinst_deplibs'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # When we are sourced in execute mode, \$file and \$ECHO are already set.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test \"\$libtool_execute_magic\" != \"$magic\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=\"\$0\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# A function that is used when there is no print builtin or printf.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_fallback_echo ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval 'cat <<_LTECHO_EOF
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Very basic option parsing. These options are (a) specific to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# the libtool wrapper, (b) are identical between the wrapper
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# /script/ and the wrapper /executable/ which is used only on
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# windows platforms, and (c) all begin with the string "--lt-"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# (application programs are unlikely to have options which match
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# this pattern).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# There are only two supported options: --lt-debug and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# --lt-dump-script. There is, deliberately, no --lt-help.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The first argument to this parsing function should be the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_option_debug=
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_parse_lt_options ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_script_arg0=\$0
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \"\$lt_opt\" in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews --lt-debug) lt_option_debug=1 ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews --lt-dump-script)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cat \"\$lt_dump_D/\$lt_dump_F\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Print the debug banner immediately:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n \"\$lt_option_debug\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Used when --lt-debug. Prints its arguments to stdout
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# (redirection is the responsibility of the caller)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_lt_dump_args ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_dump_args_N=1;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Core function for launching the target application
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_exec_program_core ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Backslashes separate directories on plain windows
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-mingw | *-*-os2* | *-cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n \"\$lt_option_debug\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_lt_dump_args \${1+\"\$@\"} 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n \"\$lt_option_debug\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_lt_dump_args \${1+\"\$@\"} 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews exec \"\$progdir/\$program\" \${1+\"\$@\"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# A function to encapsulate launching the target application
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Strips options in the --lt-* namespace from \$@ and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# launches target application with the remaining arguments.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_exec_program ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \" \$* \" in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for lt_wr_arg
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \$lt_wr_arg in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_exec_program_core \${1+\"\$@\"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Parse options
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_parse_lt_options \"\$0\" \${1+\"\$@\"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Find the directory that this script lives in.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test \"x\$thisdir\" = \"x\$file\" && thisdir=.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Follow symbolic links until we get to the real thisdir.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while test -n \"\$file\"; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If there was a directory component, then change thisdir.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test \"x\$destdir\" != \"x\$file\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \"\$destdir\" in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) thisdir=\"\$thisdir/\$destdir\" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Usually 'no', except on cygwin/mingw when embedded into
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the cwrapper.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # special case for '.'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test \"\$thisdir\" = \".\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews thisdir=\`pwd\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # remove .libs from thisdir
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case \"\$thisdir\" in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $objdir ) thisdir=. ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Try to get the absolute directory name.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews absdir=\`cd \"\$thisdir\" && pwd\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n \"\$absdir\" && thisdir=\"\$absdir\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews progdir=\"\$thisdir/$objdir\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test ! -f \"\$progdir/\$program\" ||
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test \"X\$file\" != \"X\$progdir/\$program\"; }; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file=\"\$\$-\$program\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test ! -d \"\$progdir\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $MKDIR \"\$progdir\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $RM \"\$progdir/\$file\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # relink executable if necessary
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n \"\$relink_command\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if relink_command_output=\`eval \$relink_command 2>&1\`; then :
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO \"\$relink_command_output\" >&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $RM \"\$progdir/\$file\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews { $RM \"\$progdir/\$program\";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $RM \"\$progdir/\$file\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews progdir=\"\$thisdir/$objdir\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f \"\$progdir/\$program\"; then"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Fix the DLL searchpath if we need to. Do this before prepending
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # to shlibpath, because on Windows, both are PATH and uninstalled
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add the dll search path components to the executable PATH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add our own library path to $shlibpath_var
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Some systems cannot cope with colon-terminated $shlibpath_var
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The second colon is a workaround for a bug in BeOS R4 sed
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test \"\$libtool_execute_magic\" != \"$magic\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Run the actual program with our arguments.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_exec_program \${1+\"\$@\"}
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The program doesn't exist.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_emit_cwrapperexe_src
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# emit the source code for a wrapper executable on stdout
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Must ONLY be called from within func_mode_link because
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# it depends on a number of variable set therein.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews The $output program cannot be directly executed until all the libtool
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libraries that it depends on are installed.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews This wrapper executable should never be moved out of the build directory.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews If it is, it will not operate correctly.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef _MSC_VER
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define _CRT_SECURE_NO_DEPRECATE 1
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef _MSC_VER
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifdef __CYGWIN__
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(__MINGW32__)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifdef __STRICT_ANSI__
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#elif defined(__CYGWIN__)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifdef __STRICT_ANSI__
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* portability defines, excluding path handling macros */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(_MSC_VER)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define setmode _setmode
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define stat _stat
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define chmod _chmod
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define getcwd _getcwd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define putenv _putenv
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define S_IXUSR _S_IEXEC
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifndef _INTPTR_T_DEFINED
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define _INTPTR_T_DEFINED
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define intptr_t int
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#elif defined(__MINGW32__)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define setmode _setmode
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define stat _stat
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define chmod _chmod
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define getcwd _getcwd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define putenv _putenv
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#elif defined(__CYGWIN__)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define HAVE_SETENV
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define FOPEN_WB "wb"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(PATH_MAX)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_PATHMAX PATH_MAX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#elif defined(MAXPATHLEN)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_PATHMAX MAXPATHLEN
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define LT_PATHMAX 1024
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef S_IXOTH
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define S_IXOTH 0
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef S_IXGRP
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define S_IXGRP 0
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef DIR_SEPARATOR
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define DIR_SEPARATOR '/'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define PATH_SEPARATOR ':'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define HAVE_DOS_BASED_FILE_SYSTEM
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define FOPEN_WB "wb"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifndef DIR_SEPARATOR_2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define DIR_SEPARATOR_2 '\\'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# ifndef PATH_SEPARATOR_2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define PATH_SEPARATOR_2 ';'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef DIR_SEPARATOR_2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#else /* DIR_SEPARATOR_2 */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define IS_DIR_SEPARATOR(ch) \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#endif /* DIR_SEPARATOR_2 */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef PATH_SEPARATOR_2
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#else /* PATH_SEPARATOR_2 */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#endif /* PATH_SEPARATOR_2 */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef FOPEN_WB
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define FOPEN_WB "w"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef _O_BINARY
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# define _O_BINARY 0
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#define XFREE(stale) do { \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (stale) { free ((void *) stale); stale = 0; } \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined(LT_DEBUGWRAPPER)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_debugprintf (const char *file, int line, const char *fmt, ...);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_fatal (const char *file, int line, const char *message, ...);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_setenv (const char *name, const char *value);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewschar *lt_extend_str (const char *orig_value, const char *add, int to_end);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_update_exe_path (const char *name, const char *value);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_update_lib_path (const char *name, const char *value);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvolatile const char * MAGIC_EXE = "$magic_exe";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * LIB_PATH_VARNAME = "$shlibpath_var";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * LIB_PATH_VALUE = "$func_to_host_path_result";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * EXE_PATH_VARNAME = "PATH";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * EXE_PATH_VALUE = "$func_to_host_path_result";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsconst char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#define LTWRAPPER_OPTION_PREFIX "--lt-"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsstatic const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsstatic const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsstatic const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews program_name = (char *) xstrdup (base_name (argv[0]));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* very simple arg parsing; don't want to rely on getopt
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews * also, copy all non cwrapper options to newargz, except
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews * argz[0], which is handled differently
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (i = 1; i < argc; i++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (strcmp (argv[i], dumpscript_opt) == 0)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case "$host" in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *mingw* | *cygwin* )
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # make stdout use "unix" line endings
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo " setmode(1,_O_BINARY);"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_dump_script (stdout);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (strcmp (argv[i], debug_opt) == 0)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debug = 1;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews namespace, but it is not one of the ones we know about and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews have already dealt with, above (inluding dump-script), then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews report an error. Otherwise, targets might begin to believe
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews namespace. The first time any user complains about this, we'll
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews need to make LTWRAPPER_OPTION_PREFIX a configure-time option
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* The GNU banner must be the first non-error debug message */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "(main) found exe (before symlink chase) at: %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews actual_cwrapper_path = chase_symlinks (tmp_pathspec);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "(main) found exe (after symlink chase) at: %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strendzap (actual_cwrapper_path, actual_cwrapper_name);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* target_name transforms -- use actual target program name; might have lt- prefix */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newargz[0] =
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XMALLOC (char, (strlen (actual_cwrapper_path) +
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strcpy (newargz[0], actual_cwrapper_path);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strcat (newargz[0], "$objdir");
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strcat (newargz[0], "/");
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* stop here, and copy so we don't have to do this twice */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_pathspec = xstrdup (newargz[0]);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews strcat (newargz[0], actual_cwrapper_name);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* DO want the lt- prefix here if it exists, so use target_name */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XFREE (tmp_pathspec);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_pathspec = NULL;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $host_os in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while ((p = strchr (newargz[0], '\\')) != NULL)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while ((p = strchr (lt_argv_zero, '\\')) != NULL)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XFREE (target_name);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XFREE (actual_cwrapper_path);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XFREE (actual_cwrapper_name);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_setenv ("DUALCASE", "1"); /* for MSK sh */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews because on Windows, both *_VARNAMEs are PATH but uninstalled
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libraries must come first. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews nonnull (lt_argv_zero));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (i = 0; i < newargc; i++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews i, nonnull (newargz[i]));
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $host_os in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* execv doesn't actually work on mingw as expected on unix */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews return rval; /* =127, but avoids unused variable warning */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_fatal (__FILE__, __LINE__, "memory exhausted");
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *base;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Skip over the disk name in MSDOS pathnames. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (isalpha ((unsigned char) name[0]) && name[1] == ':')
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* Searches for the full path of the wrapper. Returns
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newly allocated full path name if found, NULL otherwise
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews Does not chase symlinks, even on platforms that support them.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *p;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *q;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Relative path | not found in path: prepend cwd */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifndef S_ISLNK
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_debugprintf (const char *file, int line, const char *fmt, ...)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_error_core (int exit_status, const char *file,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews int line, const char *mode,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *message, va_list ap)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_fatal (const char *file, int line, const char *message, ...)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#ifdef HAVE_SETENV
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* always make a copy, for consistency with !HAVE_SETENV */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews int len = strlen (name) + 1 + strlen (value) + 1;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_extend_str (const char *orig_value, const char *add, int to_end)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_value = XMALLOC (char, add_len + orig_value_len + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_update_exe_path (const char *name, const char *value)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char *new_value = lt_extend_str (getenv (name), value, 0);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* some systems can't cope with a ':'-terminated path #' */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewslt_update_lib_path (const char *name, const char *value)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char *new_value = lt_extend_str (getenv (name), value, 0);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews/* Prepares an argument vector before calling spawn().
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews Note that spawn() does not by itself call the command interpreter
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews Instead it simply concatenates the arguments, separated by ' ', and calls
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews CreateProcess(). We must quote the arguments since Win32 CreateProcess()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews special way:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews - Space and tab are interpreted as delimiters. They are not treated as
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews delimiters if they are surrounded by double quotes: "...".
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews - Unescaped double quotes are removed from the input. Their only effect is
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews that within double quotes, space and tab are treated like normal
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews - Backslashes not followed by double quotes are not special.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews - But 2*n+1 backslashes followed by a double quote become
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews n backslashes followed by a double quote (n >= 0):
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsprepare_spawn (char **argv)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews size_t argc;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char **new_argv;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Count number of arguments. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (argc = 0; argv[argc] != NULL; argc++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Allocate new argument vector. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_argv = XMALLOC (char *, argc + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews /* Put quoted arguments into the new argument vector. */
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (i = 0; i < argc; i++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *string = argv[i];
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (string[0] == '\0')
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews size_t length;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews unsigned int backslashes;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews const char *s;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char *quoted_string;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes = 0;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (quote_around)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (s = string; *s != '\0'; s++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char c = *s;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews length += backslashes + 1;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes++;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes = 0;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (quote_around)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews length += backslashes + 1;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews quoted_string = XMALLOC (char, length + 1);
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews p = quoted_string;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes = 0;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (quote_around)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (s = string; *s != '\0'; s++)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews char c = *s;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews unsigned int j;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (j = backslashes + 1; j > 0; j--)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes++;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews backslashes = 0;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if (quote_around)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews unsigned int j;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for (j = backslashes; j > 0; j--)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_argv[i] = quoted_string;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_argv[i] = (char *) string;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_argv[argc] = NULL;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews return new_argv;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsvoid lt_dump_script (FILE* f)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_emit_wrapper yes |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewss/^\(.\{79\}\)\(..*\)/\1\
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# end: func_emit_cwrapperexe_src
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_win32_import_lib_p ARG
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# True if ARG is an import lib, as indicated by $file_magic_cmd
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_win32_import_lib_p ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *import*) : ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_link arg...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsfunc_mode_link ()
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $host in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # It is impossible to link a dll without this setting, and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # we shouldn't force the makefile maintainer to figure out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # which system we are compiling for in order to pass an extra
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FIXME: Unfortunately, there are problems with the above when trying
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # to make a dll which has undefined symbols, in which case not
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # even a static library is built. For now, we need to specify
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -no-undefined on the libtool link line when we can be certain
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that all symbols are satisfied, otherwise we get a static library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We need to know -static, to get the right output filenames.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_configuration "can not build a shared library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "complete static linking is impossible in this configuration"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$pic_flag" && test -n "$link_static_flag"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$pic_flag" && test -n "$link_static_flag"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # See if our shared archives depend on static archives.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$old_archive_from_new_cmds" && build_old_libs=yes
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Go through the arguments, transforming them on the way.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append libtool_args " $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the previous option needs an argument, assign it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add the symbol object into the linking commands.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews || func_fatal_error "symbol file \`$arg' does not exist"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append deplibs " $qarg.ltframework" # this is fixed later
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_append moreargs " $fil"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that this really is a libtool object.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find name of object for \`$arg'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Prepend the subdirectory the object is found in.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If libtool objects are unsupported, then we need to preload.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Prepend the subdirectory the object is found in.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$pic_object" || test "$pic_object" = none ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$arg' is not a valid libtool object"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "link input file \`$arg' does not exist"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "only absolute run-paths are allowed"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # See comment for -static flag below, for more details.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compile_command " $link_static_flag"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append finalize_command " $link_static_flag"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FIXME: remove this flag sometime in the future.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`-allow-undefined' must not be used because it is the default"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -export-symbols | -export-symbols-regex)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "more than one -exported-symbols argument is not allowed"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # so, if we see these flags be careful not to treat them like -L
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -L[A-Z][A-Z]*:*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews no/*-*-irix* | /*-*-irix*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "require no space between \`-L' and \`$1'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot determine absolute directory name of \`$dir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Will only happen for absolute or sysroot arguments
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Preserve sysroot, but never include relative directories
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # These systems don't actually have a C or math library (as such)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # These systems don't actually have a C library (as such)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do not include libc due to us having libc/libc_r.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-rhapsody* | *-*-darwin1.[012])
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Rhapsody C and math libraries are in the System framework
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-sco3.2v5* | *-*-sco5v6*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Compiler inserts libc in the correct place for threads to work
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do not include libc_r directly, use -pthread flag.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Tru64 UNIX uses -model [arg] to determine the layout of C++
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # classes, name mangling, and exception handling.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Darwin uses the -arch flag to determine output architecture.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews * ) func_append new_inherited_linker_flags " $arg" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The PATH hackery in wrapper scripts is required on Windows
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # and Darwin in order for the loader to find any dlls it needs.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-no-install' is ignored for $host"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "assuming \`-no-fast-install' instead"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "only absolute run-paths are allowed"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The effects of -shared are defined in a previous loop.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The effects of -static are defined in a previous loop.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We used to do the same as -all-static on platforms that
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # didn't have a PIC flag, but the assumption that the effects
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # would be equivalent was wrong. It would break on at least
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compiler_flags " $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append arg " $wl$func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compiler_flags " $wl$func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append linker_flags " $func_quote_for_eval_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Flags to be passed through unchanged, with rationale:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -r[0-9][0-9]* specify processor for the SGI compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # +DA*, +DD* enable 64-bit mode for the HP compiler
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -F/path path to uninstalled frameworks, gcc on darwin
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -tp=* Portland pgcc target processor selection
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that this really is a libtool object.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find name of object for \`$arg'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Prepend the subdirectory the object is found in.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If libtool objects are unsupported, then we need to preload.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Prepend the subdirectory the object is found in.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$pic_object" || test "$pic_object" = none ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$arg' is not a valid libtool object"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append dlfiles " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append dlprefiles " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append deplibs " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Unknown arguments in both finalize_command and compile_command need
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # to be aesthetically quoted because they are evaled later.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Now actually substitute the argument into the commands.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "the \`$prevarg' option requires an argument"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # calculate the name of the file, without its directory
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "you must specify an output file"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) linkmode=prog ;; # Anything else should be a program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Find all interdependent deplibs by searching for libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that are linked more than once (e.g. -la -lb -la)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *" $deplib "*) func_append specialdeplibs " $deplib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libs="$predeps $libs $compiler_lib_search_path $postdeps"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Compute libraries that are listed more than once in $predeps
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # $postdeps and mark them as special (i.e., whose duplicates are
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $opt_duplicate_compiler_generated_deps; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews need_relink=no # whether we're linking any uninstalled libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews notinst_deplibs= # not-installed libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews notinst_path= # paths that contain not-installed libtool libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The preopen pass in lib mode reverses $deplibs; put it back here
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # so that -L comes before libs that need it for instance...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews ## FIXME: Find the place where the list is rebuilt in the wrong
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode,$pass" = "lib,dlpreopen"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Collect and forward deplibs of preopened libtool libs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *.la) func_source "$func_resolve_sysroot_result" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Collect preopened libtool deplibs, except any this library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode" != lib && test "$linkmode" != prog; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-l' is ignored for archives/objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We need to do some special things here, and not later.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$ll" = "X$old_library" ; then # only static version available
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews * ) func_append new_inherited_linker_flags " $deplib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newlib_search_path " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newlib_search_path " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-L' is ignored for archives/objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure the xrpath contains only unique directories.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Linking convenience modules into shared libraries is allowed,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # but linking other static libraries is non-portable.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews | $EGREP "$match_pattern_regex" > /dev/null; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: Trying to link with static lib archive $deplib."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which you do not appear to have"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because the file extensions .$libext of this argument makes me believe"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** that it is just a static archive that I should not use here."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: Linking the shared library $output against the"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** static library $deplib is not portable!"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If there is no dlopen support or we're linking statically,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$found" = yes || test -f "$lib"; then :
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see that this really is a libtool archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews || func_fatal_error "\`$lib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the library was installed with an old release of libtool,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # it will not redefine variables installed, or shouldnotlink
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Convert "-framework foo" to "foo.ltframework"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews { test "$linkmode" != prog && test "$linkmode" != lib; }; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$dlopen" && func_append dlfiles " $dlopen"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find name of link library for \`$lib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # It is a libtool convenience library, so add in its objects.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append convenience " $ladir/$objdir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append old_convenience " $ladir/$objdir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test "$linkmode" != prog && test "$linkmode" != lib; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$lib' is not a convenience library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *" $deplib "*) func_append specialdeplibs " $deplib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$prefer_static_libs,$installed" = "built,no"; }; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot find name of link library for \`$lib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If there is no dlname, no dlopen support or we're linking
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # statically, we need to preload. We also need to preload any
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # dependent libraries so libltdl's deplib preloader doesn't
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append dlprefiles " $lib $dependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "cannot determine absolute directory name of \`$ladir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "passing it literally to the linker, although it might fail"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Find the relevant object directory and library name.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$libdir" && test "$linkmode" = prog; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Linker will automatically link against shared library if both
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # static and shared are present. Therefore, ensure we extract
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # symbols from the import library if a shared library is present
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # (otherwise, the dlopen module name will be incorrect). We do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # this by putting the import library name into $newdlprefiles.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We recover the dlopen module name by 'saving' the la file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # name in a special purpose variable, and (later) extracting the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Keep a list of preopened convenience libraries to check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that they are being used correctly in the link pass.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append dlpreconveniencelibs " $dir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Prefer using a static library (so that no silly _DYNAMIC symbols
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Keep a list of preopened convenience libraries to check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that they are being used correctly in the link pass.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append dlpreconveniencelibs " $dir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Otherwise, use the dlname, so that lt_dlopen finds it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test "$linkmode,$pass" = "prog,link"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs="$dir/$old_library $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs="$dir/$old_library $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews deplibs="$lib $deplibs" # used for prog,scan pass
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode" = prog && test "$pass" != link; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$link_all_deplibs" != no || test -z "$library_names" ||
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newlib_search_path " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *" $deplib "*) func_append specialdeplibs " $deplib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$prefer_static_libs,$installed" = "built,yes"; } ||
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure the rpath contains only unique directories.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Skip directories that are in the system default run-time
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_static=no # Whether the deplib will be linked statically
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$use_static_libs" = built && test "$installed" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews { test "$use_static_libs" = no || test -z "$old_library"; }; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # No point in relinking DLLs because paths are not encoded
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Warn about portability, can't link against -module's on some
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # systems (darwin). Don't bleat about dlopened modules though!
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: Linking the executable $output against the loadable module"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: Linking the shared library $output against the loadable module"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Skip directories that are in the system default run-time
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$old_archive_from_expsyms_cmds"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # use dlname if we got it. it's perfectly good, no?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make a new name for the extract_expsyms_cmds to use
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the library has no export list, then create one now
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f "$output_objdir/$soname-def"; then :
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "extracting exported symbol list from \`$soname'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f "$output_objdir/$newlib"; then :; else
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "generating import library for \`$soname'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # make sure the library variables are pointing to the new library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode" = prog || test "$opt_mode" != relink; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # if the lib is a (non-dlopened) module then we can not
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # link against it, someone is ignoring the earlier warnings
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if /usr/bin/file -L $add 2> /dev/null |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: lib $linklib is a module, not a shared library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** And there doesn't seem to be a static archive available"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Try looking first in the location we're being installed to.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append add_dir " -L$inst_prefix_dir$libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test "$hardcode_shlibpath_var" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_configuration "unsupported hardcode properties"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append compile_shlibpath "$add_shlibpath:" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add" && compile_deplibs="$add $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add_dir" && deplibs="$add_dir $deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append finalize_shlibpath "$libdir:" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode" = prog || test "$opt_mode" = relink; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Finalize command for both is simple: just hardcode it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test "$hardcode_shlibpath_var" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append finalize_shlibpath "$libdir:" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -f "$inst_prefix_dir$libdir/$linklib" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We cannot seem to hardcode it, guess we'll fake it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Try looking first in the location we're being installed to.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append add_dir " -L$inst_prefix_dir$libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$add_dir" && deplibs="$add_dir $deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Here we assume that one of hardcode_direct or hardcode_minus_L
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # is not unsupported. This is valid on all known static and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$hardcode_direct" != unsupported; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$old_library" && linklib="$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs="$dir/$linklib $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs="$dir/$linklib $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs="-l$name -L$dir $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs="-l$name -L$dir $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$deplibs_check_method" != pass_all; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We're trying link a shared library against a static one
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Just print a warning and add the library to dependency_libs so
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that the program can be linked against the static library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: This system can not link to static lib archive $lib."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which you do not appear to have."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** But as you try to build a module library, libtool will still create "
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** a static module, that should work as long as the dlopening application"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** However, this would only work if libtool was able to extract symbol"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** not find such a program. So, this module is probably useless."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** \`nm' from GNU binutils and a full rebuild may help."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdependency_libs="$deplib $newdependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_resolve_sysroot "$func_stripname_result";;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append specialdeplibs " $func_resolve_sysroot_result" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append tmp_libs " $func_resolve_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add the search paths of all dependency libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "cannot determine absolute directory name of \`$dir'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $GREP "^installed=no" $deplib > /dev/null; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$deplib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Link the dlpreopened libraries before other libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure lib_search_path contains only unique directories.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FIXME: Pedantically, this is the right thing to do, so
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # that some nasty dependency loop isn't accidentally
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Pragmatically, this seems to cause very few problems in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # And here is the reason: when a library appears more
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # than once as an explicit dependence of a library, or
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # is implicitly linked in more than once by the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # compiler, it is considered special, and multiple
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # occurrences thereof are not removed. Compare this
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # with having the same library being listed as a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # dependency of multiple other libraries: in this case,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # we know (pedantically, we assume) the library does not
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # need to be listed more than once, so we keep only the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # last copy. This is not always right, but it is rare
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # enough that we require users that really mean to play
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # such unportable linking tricks to link the library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # using -Wl,-lname, so that libtool does not consider it
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Last step: remove runtime libs from dependency_libs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case " $predeps $postdeps $compiler_lib_search_path " in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$linkmode" = prog || test "$linkmode" = lib; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-dlopen' is ignored for archives"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *\ -l* | *\ -L*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-l' and \`-L' are ignored for archives" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-rpath' is ignored for archives"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-version-info/-version-number' is ignored for archives"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-release' is ignored for archives"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$export_symbols$export_symbols_regex" && \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-export-symbols' is ignored for archives"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Now set the variables for building old libraries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure we only generate libraries of the form `libNAME.la'.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "libtool library \`$output' must begin with \`lib'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$deplibs_check_method" != pass_all; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-dlopen self' is ignored for libtool libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "ignoring multiple \`-rpath's for a libtool library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Some compilers have problems with a `.al' extension so
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # convenience libraries should have the same extension an
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews oldlibs="$output_objdir/$libname.$libext $oldlibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-release' is ignored for convenience libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "too many parameters to \`-version-info'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # convert absolute version numbers to libtool ages
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # this retains compatibility with .la files and attempts
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # to make the code below a bit more comprehensible
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # There are really only two kinds -- those that
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # use the current revision as the major version
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # correct linux to gnu/linux during the next big refactor
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check that each of the things are valid numbers.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 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]) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "CURRENT \`$current' must be a nonnegative integer"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$vinfo' is not valid version information"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 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]) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "REVISION \`$revision' must be a nonnegative integer"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$vinfo' is not valid version information"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews 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]) ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "AGE \`$age' must be a nonnegative integer"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$vinfo' is not valid version information"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_error "AGE \`$age' is greater than the current interface number \`$current'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$vinfo' is not valid version information"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Like Linux, but with the current version available in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # verstring for coding it into the library header
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Darwin ld doesn't like 0 for these options...
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add in all the interfaces that we are compatible with.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews verstring="$verstring_prefix$major.$iface:$verstring"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Before this point, $major must not contain `.'.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews linux) # correct to gnu/linux during the next big refactor
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add in all the interfaces that we are compatible with.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make executables depend on our current version.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Use '-' rather than '.', since we only want one
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_configuration "unknown library version type \`$version_type'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Clear the version info if we defaulted, and they specified a release.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$vinfo" && test -n "$release"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # we can't check for "0.0" in archive_cmds due to quoting
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove version info from name if versioning should be avoided
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$avoid_version" = yes && test "$need_version" = no; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Check to see if the archive will have undefined symbols.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$allow_undefined_flag" = unsupported; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "undefined symbols not allowed in $host shared libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_generate_dlsyms "$libname" "$libname" "yes"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remove our outputs, but don't remove object files since they
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # may have been created when compiling PIC objects.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Now set the variables for building old libraries.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append oldlibs " $output_objdir/$libname.$libext"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the user specified any rpath flags, then add them.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append temp_xrpath " -R$func_replace_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews dependency_libs="$temp_xrpath $dependency_libs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure dlfiles contains only unique files that won't be dlpreopened
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure dlprefiles contains only unique files
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # these systems don't actually have a c library (as such)!
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-rhapsody* | *-*-darwin1.[012])
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Rhapsody C library is in the System framework
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Don't link with libc until the a.out ld.so is fixed.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do not include libc due to us having libc/libc_r.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-sco3.2v5* | *-*-sco5v6*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Compiler inserts libc in the correct place for threads to work
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add libc to deplibs on all other systems if necessary.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Transform deplibs into only deplibs that can be linked in shared.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # I'm not sure if I'm treating the release correctly. I think
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # release should show up in the -l (ie -lgmp5) so we don't want to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Don't check for shared/static. Everything works.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # This might be a little naive. We might want to check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # whether the library exists or not. But this is on
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # This code stresses the "libraries are programs" paradigm to its
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # limits. Maybe even breaks it. We compile a program, linking it
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # against the deplibs as a proxy for the library. Then we can check
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # whether they linked in statically or dynamically with ldd.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews int main() { return 0; }
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: dynamic linker does not accept needed library $i."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which I believe you do not have"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because a test_compile did reveal that the linker did not use it for"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** its dynamic dependency list that programs get resolved with at runtime."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Error occurred in the first compile. Let's try to salvage
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the situation: Compile a separate program for each library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: dynamic linker does not accept needed library $i."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which you do not appear to have"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because a test_compile did reveal that the linker did not use this one"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** as a dynamic dependency that programs can get resolved with at runtime."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** make it link in! You will probably need to install it or some"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** library that it depends on before this library will be fully"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** functional. Installing it before continuing would be even better."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The statement above tries to avoid entering an
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We might still enter an endless loop, since a link
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which you do not appear to have"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because I did check the linker path looking for a file starting"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** with $libname and none of the candidates passed a file format test"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** using a file magic. Last file checked: $potlib"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews potlib="$potent_lib" # see symlink-check above in file_magic test
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $EGREP "$match_pattern_regex" > /dev/null; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** I have the capability to make that library automatically link in when"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** you link to this library. But I can only do this if you have a"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** shared version of the library, which you do not appear to have"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because I did check the linker path looking for a file starting"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** with $libname and none of the candidates passed a file format test"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** using a regex pattern. Last file checked: $potlib"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # can't use Xsed below, because $i might contain '/'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$deplibs_check_method" = "Xnone"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** Warning: inter-library dependencies are not supported in this platform."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** Warning: inter-library dependencies are not known to be supported."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** All declared inter-library dependencies are being dropped."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-rhapsody* | *-*-darwin1.[012])
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # On Rhapsody replace the C library with the System framework
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** Warning: libtool could not satisfy all declared inter-library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** a static module, that should work as long as the dlopening"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** application is linked with the -dlopen flag."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** However, this would only work if libtool was able to extract symbol"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** not find such a program. So, this module is probably useless."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** \`nm' from GNU binutils and a full rebuild may help."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** The inter-library dependencies that have been dropped here will be"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** automatically added whenever a program is linked with this library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** Since this library must not contain undefined symbols,"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** because either the platform does not support them or"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** it was explicitly requested with -no-undefined,"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "*** libtool will only create a static version of it."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Time to change all our "foo.ltframework" stuff back to "-framework foo"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # move library search paths that coincide with paths to not yet
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # installed libraries to the beginning of the library search list
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # All the library-specific variables (install_libdir is set above).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Test again, we may have decided not to build it any more
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Substitute the hardcoded libdirs into the rpath.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$runpath_var" && test -n "$perm_rpath"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$include_expsyms"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # and it's NOT already a .def file. Must figure out
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # which of the given symbols are data symbols and tag
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # them as such. So, trigger use of export_symbols_cmds.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # export_symbols gets reassigned inside the "prepare
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the list of exported symbols" if statement, so the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "generating symbol list for \`$libname.la'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Take the normal branch if the nm_file_list_spec branch
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # doesn't work or if tool conversion is not needed.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews libobjs=$nm_file_list_spec$func_to_tool_file_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "creating $NM input file list: $output"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The command line is too long to execute in one step.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "using reloadable object file for export list..."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Break out early, otherwise skipped_export may be
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$include_expsyms"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The given exports_symbols file has to be filtered, so filter it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FIXME: $output_objdir/$libname.filter potentially contains lots of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # 's' commands which not all seds can handle. GNU sed should be fine
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # though. Also, the filter scales superlinearly with the number of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # global variables. join(1) would be nice here, but unfortunately
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append delfiles " $export_symbols $output_objdir/$libname.filter"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # extract the archives, so we have objects to list.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # TODO: could optimize this to just extract one archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append libobjs " $func_extract_archives_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make a backup of the uninstalled library when relinking
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$module" = yes && test -n "$module_cmds" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The command line is too long to link in one step, link piecewise
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # or, if using GNU ld and skipped_export is not :, use a linker
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Save the value of $output and $libobjs because we want to
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # use them later. If we have whole_archive_flag_spec, we
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # whole_archive_flag_spec was expanded, because we can't
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # assume the linker understands whole_archive_flag_spec.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # This may have to be revisited, in case too many
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # convenience libraries get linked in and end up exceeding
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Clear the reloadable object creation command queue and
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "creating linker input file list: $output"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "creating reloadable object files..."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The command $test_cmds is almost too long, add a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The first file doesn't have a previous command to add.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # All subsequent reloadable object files will link in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews last_robj=$output_objdir/$output_la-${k}.$objext
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Handle the remaining objects by creating one last
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # reloadable object file. All subsequent reloadable object
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -z "$concat_cmds" || concat_cmds=$concat_cmds~
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ${skipped_export-false}; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "generating symbol list for \`$libname.la'"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Append the command to create the export file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -z "$concat_cmds" || concat_cmds=$concat_cmds~
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "creating a temporary reloadable object file: $output"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Loop through the commands generated above and execute them.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols_regex" && ${skipped_export-false}; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if ${skipped_export-false}; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$include_expsyms"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The given exports_symbols file has to be filtered, so filter it.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # FIXME: $output_objdir/$libname.filter potentially contains lots of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # 's' commands which not all seds can handle. GNU sed should be fine
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # though. Also, the filter scales superlinearly with the number of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # global variables. join(1) would be nice here, but unfortunately
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append delfiles " $export_symbols $output_objdir/$libname.filter"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Expand the library linking commands again to reset the
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$module" = yes && test -n "$module_cmds" ; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Append the command to remove temporary files to $cmds.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add any objects from preloaded convenience libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append libobjs " $func_extract_archives_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If -module or -export-dynamic was specified, set the dlname.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$module" = yes || test "$export_dynamic" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # On all known operating systems, these are identical.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-dlopen' is ignored for objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *\ -l* | *\ -L*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-l' and \`-L' are ignored for objects" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-rpath' is ignored for objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-version-info' is ignored for objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-release' is ignored for objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "cannot build library object \`$output' from non-libtool objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Objects from convenience libraries. This assumes
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # single-version convenience libraries. Whenever we create
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # different ones for PIC/non-PIC, this we'll have to duplicate
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # reload_cmds runs $LD directly, so let us get rid of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # -Wl from whole_archive_flag_spec and hope we can get by with
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews reload_conv_objs="$reload_objs $func_extract_archives_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If we're not building shared, we need to use non_pic_objs
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Exit if we aren't doing a library object file.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Create an invalid libtool object if no PIC, so that we don't
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$pic_flag" || test "$pic_mode" != default; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Only do commands if we really have different PIC objects.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-version-info' is ignored for programs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`-release' is ignored for programs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-rhapsody* | *-*-darwin1.[012])
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # On Rhapsody replace the C library is the System framework
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Don't allow lazy linking, it breaks C++ global constructors
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # But is supposedly fixed on 10.4 or later (yay!).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compile_command " ${wl}-bind_at_load"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append finalize_command " ${wl}-bind_at_load"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Time to change all our "foo.ltframework" stuff back to "-framework foo"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # move library search paths that coincide with paths to not yet
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # installed libraries to the beginning of the library search list
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append compile_command " $compile_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append finalize_command " $finalize_deplibs"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If the user specified any rpath flags, then add them.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews for libdir in $compile_rpath $finalize_rpath; do
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Substitute the hardcoded libdirs into the rpath.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append finalize_perm_rpath " $libdir" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Substitute the hardcoded libdirs into the rpath.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$libobjs" && test "$build_old_libs" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Transform all the library objects into standard objects.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # We have no uninstalled library dependencies, so finalize right now.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "$link_command" 'exit_status=$?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -f "$output_objdir/${outputname}S.${objext}"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$compile_shlibpath$finalize_shlibpath"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command="$compile_var$compile_command$compile_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command="$compile_var$compile_command$compile_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$finalize_var$finalize_command$finalize_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "this platform does not like uninstalled shared libraries"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_warning "\`$output' will be relinked during installation"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command="$finalize_var$compile_command$finalize_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command="$compile_var$compile_command$compile_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$finalize_var$finalize_command$finalize_rpath"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Preserve any variables that may affect compiler behavior
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval test -z \"\${$var+set}\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif eval var_value=\$$var; test -z "$var_value"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$var=; export $var; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Only actually do things if not in dry run mode.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # win32 will think the script is a binary if it has
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # test for cygwin because mv fails w/o .exe extensions
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews cwrappersource="$output_path/$objdir/lt-$output_name.c"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # The wrapper executable is built using the $host compiler,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # because it contains $host paths and files. If cross-
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # compiling, it, like the target executable, must be
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # executed on the $host or under an emulation environment.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Now, create the wrapper script for func_source use:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # note: this script will not be executed, so do not chmod.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_emit_wrapper no > $func_ltwrapper_scriptname_result
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # See if we need to build an old-fashioned archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$build_libtool_libs" = convenience; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$preload" = yes && test -f "$symfileobj"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append oldobjs " $func_extract_archives_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Add any objects from preloaded convenience libraries
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append oldobjs " $func_extract_archives_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # POSIX demands no paths to be encoded in archives. We have
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # to avoid creating archives with duplicate basenames if we
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # might have to extract them afterwards, e.g., when creating a
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # static archive out of a convenience library, or when linking
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the entirety of a libtool archive into another (currently
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews echo "copying selected object files to avoid basename conflicts..."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Make sure we don't pick an alternate name that also
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) if test ! -f "$gentop/$newobj"; then break; fi ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "using command file archive linking..."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_to_tool_file "$output_objdir/$libname.libcmd"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews oldobjs=" $archiver_list_spec$func_to_tool_file_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the command line is too long to link in one step, link in parts
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_verbose "using piecewise archive linking..."
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Is there a better way of finding the last object in the list?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # the above command should be used before it gets too long
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -z "$concat_cmds" || concat_cmds=$concat_cmds~
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test "$build_old_libs" = yes && old_library="$libname.$libext"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Preserve any variables that may affect compiler behavior
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if eval test -z \"\${$var+set}\"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews elif eval var_value=\$$var; test -z "$var_value"; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$var=; export $var; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Replace all uninstalled libtool libraries with the installed ones
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$deplib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newdependency_libs " -L$func_replace_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newdependency_libs " -R$func_replace_sysroot_result"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) func_append newdependency_libs " $deplib" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$lib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Only pass preopened files to the pseudo-archive (for
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # eventual linking with the app. that links it) if we
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # didn't already link the preopened objects directly into
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_error "\`$lib' is not a valid libtool archive"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # In fact, it would be nice if we could use this code for all target
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # systems that can't hard-code library paths into their executables
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # and that have no shared library path variable independent of PATH,
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # but it turns out we can't easily determine that from inspecting
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # libtool variables, so we have to hard-code the OSs to which it
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # applies here; at the moment, that means platforms that use the PE
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # object format with DLL files. See the long comment at the top of
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews case $host,$output,$installed,$module,$dlname in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # If a -bindir argument was supplied, place the dll there.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# $outputname - a libtool library file
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Please DO NOT delete this file!
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# It is necessary for linking the library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The name that we can dlopen(3).
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Names of this library.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# The name of the static archive.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Linker flags that can not go in dependency_libs.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsinherited_linker_flags='$new_inherited_linker_flags'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Libraries that this one depends upon.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsdependency_libs='$dependency_libs'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Names of additional weak libraries provided by this library
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsweak_library_names='$weak_libs'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Version information for $libname.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Is this an already installed library?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Should we warn about portability when linking against -modules?
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# Directory that this library needs to be installed in:
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews if test "$installed" = no && test "$need_relink" = yes; then
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsrelink_command=\"$relink_command\""
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Do a symbolic link so that the libtool archive can be found in
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # LD_LIBRARY_PATH before the program is installed.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews# func_mode_uninstall arg...
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # This variable tells wrapper scripts just to set variables rather
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "you must specify an RM program"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews # Remember odir for removal later, being careful to avoid duplicates
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # Don't error if the file doesn't exist and rm -f was used.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$old_library" && func_append rmfiles " $odir/$old_library"
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # Do each command in the postuninstall commands.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # Do each command in the old_postuninstall commands.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # FIXME: should reinstall the best remaining shared library.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # Add PIC object to the list of files to remove.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # Add non-PIC object to the list of files to remove.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # $file with .exe has already been added to rmfiles,
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # Do a test to see if this is a libtool program.
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append rmfiles " $func_ltwrapper_scriptname_result"
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # note $name still contains .exe if it was in $file originally
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews # as does the version of $file that was added into $rmfiles
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews if test "$fast_install" = yes && test -n "$relink_command"; then
0b135de5a52acec5bb42f96b4e79484d1629fd93Brian Wellington # Try to remove the ${objdir}s in the directories where we deleted files
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrews func_fatal_help "invalid operation mode \`$opt_mode'"
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# The TAGs below are defined such that we never get into a situation
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# in which we disable both kinds of libraries. Given conflicting
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# choices, we go for a static library, that is the most portable,
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# since we can't tell whether shared libraries were disabled because
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# the user asked for that or because the platform doesn't support
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# them. This is particularly important on AIX, because we don't
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# support having both static and shared libraries enabled at the same
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# time on that platform, so we default to a shared-only configuration.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# If a disable-shared tag is given, we'll fallback to a static-only
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# configuration. But we'll never go from static-only to shared-only.
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# ### END LIBTOOL TAG CONFIG: disable-shared
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# ### BEGIN LIBTOOL TAG CONFIG: disable-static
63dd46733010bb9622810faa17d88c3e3c28b730Mark Andrewsbuild_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
74cb99072c4b0ebd2ccafcfa284288fa760f7a1aMark Andrews# ### END LIBTOOL TAG CONFIG: disable-static
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# Local Variables:
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# mode:shell-script
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley# sh-indentation:2