This repository has been archived on 2023-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
libpng/ltmain.sh

7877 lines
220 KiB
Bash
Raw Normal View History

2008-05-01 23:10:45 -05:00
# Generated from ltmain.m4sh.
# ltmain.sh (GNU libtool 1.2971 2008-04-29) 2.2.3a
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# GNU Libtool is free software; you can redistribute it and/or modify
2004-12-02 18:14:51 -06:00
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
2008-05-01 23:10:45 -05:00
# As a special exception to the GNU General Public License,
# if you distribute this file as part of a program or library that
# is built using GNU Libtool, you may include this file under the
# same distribution terms that you use for the rest of that program.
#
# GNU Libtool is distributed in the hope that it will be useful, but
2004-12-02 18:14:51 -06:00
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
2008-05-01 23:10:45 -05:00
# along with GNU Libtool; see the file COPYING. If not, a copy
# can be downloaded from http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Usage: $progname [OPTION]... [MODE-ARG]...
#
# Provide generalized library-building support services.
2004-12-02 18:14:51 -06:00
#
2008-05-01 23:10:45 -05:00
# --config show all configuration variables
# --debug enable verbose shell tracing
# -n, --dry-run display commands without modifying any files
# --features display basic configuration information and exit
# --mode=MODE use operation mode MODE
# --preserve-dup-deps don't remove duplicate dependency libraries
# --quiet, --silent don't print informational messages
# --tag=TAG use configuration variables from tag TAG
# -v, --verbose print informational messages (default)
# --version print version information
# -h, --help print short or long help message
#
# MODE must be one of the following:
#
# clean remove files from the build directory
# compile compile a source file into a libtool object
# execute automatically set library path, then run a program
# finish complete the installation of libtool libraries
# install install libraries or executables
# link create a library or an executable
# uninstall remove libraries from an installed directory
#
# MODE-ARGS vary depending on the MODE.
# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
#
# When reporting a bug, please describe a test case to reproduce it and
# include the following information:
#
# host-triplet: $host
# shell: $SHELL
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool 1.2971 2008-04-29) 2.2.3a
# automake: $automake_version
# autoconf: $autoconf_version
#
# Report bugs to <bug-libtool@gnu.org>.
PROGRAM=ltmain.sh
PACKAGE=libtool
VERSION=2.2.3a
TIMESTAMP=" 1.2971 2008-04-29"
package_revision=1.2971
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# NLS nuisances: We save the old values to restore during execute mode.
# Only set LANG and LC_ALL to C if already set.
# These must not be set unconditionally because not all systems understand
# e.g. LANG=C (notably SCO).
lt_user_locale=
lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
save_$lt_var=\$$lt_var
$lt_var=C
export $lt_var
lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
$lt_unset CDPATH
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
: ${CP="cp -f"}
: ${ECHO="echo"}
: ${EGREP="/usr/sfw/bin/ggrep -E"}
: ${FGREP="/usr/sfw/bin/ggrep -F"}
: ${GREP="/usr/sfw/bin/ggrep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
: ${SED="/usr/local/bin/sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
2006-03-02 07:23:18 -06:00
# Global variables:
EXIT_SUCCESS=0
EXIT_FAILURE=1
2008-05-01 23:10:45 -05:00
EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
exit_status=$EXIT_SUCCESS
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
dirname="s,/[^/]*$,,"
basename="s,^.*/,,"
# func_dirname_and_basename file append nondir_replacement
# perform func_basename and func_dirname in a single function
# call:
# dirname: Compute the dirname of FILE. If nonempty,
# add APPEND to the result, otherwise set result
# to NONDIR_REPLACEMENT.
# value returned in "$func_dirname_result"
# basename: Compute filename of FILE.
# value retuned in "$func_basename_result"
# Implementation must be kept synchronized with func_dirname
# and func_basename. For efficiency, we do not delegate to
# those functions but instead duplicate the functionality here.
func_dirname_and_basename ()
{
# Extract subdirectory from the argument.
func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
if test "X$func_dirname_result" = "X${1}"; then
func_dirname_result="${3}"
else
func_dirname_result="$func_dirname_result${2}"
fi
func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# Generated shell functions inserted here.
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
# is ksh but when the shell is invoked as "sh" and the current value of
# the _XPG environment variable is not equal to 1 (one), the special
# positional parameter $0, within a function call, is the name of the
# function.
progpath="$0"
# The name of this program:
# In the unlikely event $progname began with a '-', it would play havoc with
# func_echo (imagine progname=-n), so we prepend ./ in that case:
func_dirname_and_basename "$progpath"
progname=$func_basename_result
case $progname in
-*) progname=./$progname ;;
esac
# Make sure we have an absolute path for reexecution:
case $progpath in
[\\/]*|[A-Za-z]:\\*) ;;
*[\\/]*)
progdir=$func_dirname_result
progdir=`cd "$progdir" && pwd`
progpath="$progdir/$progname"
;;
*)
save_IFS="$IFS"
IFS=:
for progdir in $PATH; do
IFS="$save_IFS"
test -x "$progdir/$progname" && break
done
IFS="$save_IFS"
test -n "$progdir" || progdir=`pwd`
progpath="$progdir/$progname"
;;
esac
2004-12-02 18:14:51 -06:00
# Sed substitution that helps us do robust quoting. It backslashifies
# metacharacters that are still active within double-quoted strings.
Xsed="${SED}"' -e 1s/^X//'
2008-05-01 23:10:45 -05:00
sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
# Same as above, but do not quote variable references.
double_quote_subst='s/\(["`\\]\)/\\\1/g'
# Re-`\' parameter expansions in output of double_quote_subst that were
# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
# in input to double_quote_subst, that '$' was protected from expansion.
# Since each input `\' is now two `\'s, look for any number of runs of
# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
bs='\\'
bs2='\\\\'
bs4='\\\\\\\\'
dollar='\$'
sed_double_backslash="\
s/$bs4/&\\
/g
s/^$bs2$dollar/$bs&/
s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
s/\n//g"
# Standard options:
opt_dry_run=false
opt_help=false
opt_quiet=false
opt_verbose=false
opt_warning=:
# func_echo arg...
# Echo program name prefixed message, along with the current mode
# name if it has been set yet.
func_echo ()
{
$ECHO "$progname${mode+: }$mode: $*"
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_verbose arg...
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
$opt_verbose && func_echo ${1+"$@"}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# A bug in bash halts the script if the last line of a function
# fails when set -e is in force, so we need another command to
# work around that:
:
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_error arg...
# Echo program name prefixed message to standard error.
func_error ()
{
$ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_warning arg...
# Echo program name prefixed warning message to standard error.
func_warning ()
{
$opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# bash bug again:
:
}
# func_fatal_error arg...
# Echo program name prefixed message to standard error, and exit.
func_fatal_error ()
{
func_error ${1+"$@"}
exit $EXIT_FAILURE
}
# func_fatal_help arg...
# Echo program name prefixed message to standard error, followed by
# a help hint, and exit.
func_fatal_help ()
{
func_error ${1+"$@"}
func_fatal_error "$help"
}
help="Try \`$progname --help' for more information." ## default
# func_grep expression filename
# Check whether EXPRESSION matches any line of FILENAME, without output.
func_grep ()
{
$GREP "$1" "$2" >/dev/null 2>&1
}
# func_mkdir_p directory-path
# Make sure the entire path to DIRECTORY-PATH is available.
func_mkdir_p ()
{
my_directory_path="$1"
my_dir_list=
if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
# Protect directory names starting with `-'
case $my_directory_path in
-*) my_directory_path="./$my_directory_path" ;;
esac
# While some portion of DIR does not yet exist...
while test ! -d "$my_directory_path"; do
# ...make a list in topmost first order. Use a colon delimited
# list incase some portion of path contains whitespace.
my_dir_list="$my_directory_path:$my_dir_list"
# If the last portion added has no slash in it, the list is done
case $my_directory_path in */*) ;; *) break ;; esac
# ...otherwise throw away the child directory and loop
my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
done
my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
save_mkdir_p_IFS="$IFS"; IFS=':'
for my_dir in $my_dir_list; do
IFS="$save_mkdir_p_IFS"
# mkdir can fail with a `File exist' error if two processes
# try to create one of the directories concurrently. Don't
# stop in that case!
$MKDIR "$my_dir" 2>/dev/null || :
done
IFS="$save_mkdir_p_IFS"
# Bail out if we (or some other process) failed to create a directory.
test -d "$my_directory_path" || \
func_fatal_error "Failed to create \`$1'"
fi
}
2006-03-02 07:23:18 -06:00
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
# libtool processes, and avoids race conditions if possible. If
# given, STRING is the basename for that directory.
func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
2008-05-01 23:10:45 -05:00
if test "$opt_dry_run" = ":"; then
2006-03-02 07:23:18 -06:00
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
# If mktemp works, use that first and foremost
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
2008-05-01 23:10:45 -05:00
# Failing that, at least try and use $RANDOM to avoid a race
my_tmpdir="${my_template}-${RANDOM-0}$$"
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
save_mktempdir_umask=`umask`
umask 0077
$MKDIR "$my_tmpdir"
umask $save_mktempdir_umask
2006-03-02 07:23:18 -06:00
fi
# If we're not in dry-run mode, bomb out on failure
2008-05-01 23:10:45 -05:00
test -d "$my_tmpdir" || \
func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
2006-03-02 07:23:18 -06:00
fi
2008-05-01 23:10:45 -05:00
$ECHO "X$my_tmpdir" | $Xsed
2006-03-02 07:23:18 -06:00
}
2008-05-01 23:10:45 -05:00
# func_quote_for_eval arg
# Aesthetically quote ARG to be evaled later.
# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
# is double-quoted, suitable for a subsequent eval, whereas
# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
# which are still active within double quotes backslashified.
func_quote_for_eval ()
2006-03-02 07:23:18 -06:00
{
2008-05-01 23:10:45 -05:00
case $1 in
*[\\\`\"\$]*)
func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
*)
func_quote_for_eval_unquoted_result="$1" ;;
esac
case $func_quote_for_eval_unquoted_result in
# Double-quote args containing shell metacharacters to delay
# word splitting, command substitution and and variable
# expansion for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
;;
*)
func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
2006-03-02 07:23:18 -06:00
esac
}
2008-05-01 23:10:45 -05:00
# func_quote_for_expand arg
# Aesthetically quote ARG to be evaled later; same as above,
# but do not quote variable references.
func_quote_for_expand ()
2006-03-02 07:23:18 -06:00
{
2008-05-01 23:10:45 -05:00
case $1 in
*[\\\`\"]*)
my_arg=`$ECHO "X$1" | $Xsed \
-e "$double_quote_subst" -e "$sed_double_backslash"` ;;
2006-03-02 07:23:18 -06:00
*)
2008-05-01 23:10:45 -05:00
my_arg="$1" ;;
esac
case $my_arg in
# Double-quote args containing shell metacharacters to delay
# word splitting and command substitution for a subsequent eval.
# Many Bourne shells cannot handle close brackets correctly
# in scan sets, so we specify it separately.
*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
my_arg="\"$my_arg\""
;;
esac
func_quote_for_expand_result="$my_arg"
2006-03-02 07:23:18 -06:00
}
2008-05-01 23:10:45 -05:00
# func_show_eval cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it.
func_show_eval ()
2006-03-02 07:23:18 -06:00
{
2008-05-01 23:10:45 -05:00
my_cmd="$1"
my_fail_exp="${2-:}"
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$my_cmd"
my_status=$?
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
fi
2006-03-02 07:23:18 -06:00
fi
}
2008-05-01 23:10:45 -05:00
# func_show_eval_locale cmd [fail_exp]
# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
# is given, then evaluate it. Use the saved locale for evaluation.
func_show_eval_locale ()
2006-03-02 07:23:18 -06:00
{
2008-05-01 23:10:45 -05:00
my_cmd="$1"
my_fail_exp="${2-:}"
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
${opt_silent-false} || {
func_quote_for_expand "$my_cmd"
eval "func_echo $func_quote_for_expand_result"
}
if ${opt_dry_run-false}; then :; else
eval "$lt_user_locale
$my_cmd"
my_status=$?
eval "$lt_safe_locale"
if test "$my_status" -eq 0; then :; else
eval "(exit $my_status); $my_fail_exp"
2006-03-02 07:23:18 -06:00
fi
2008-05-01 23:10:45 -05:00
fi
2006-03-02 07:23:18 -06:00
}
2008-05-01 23:10:45 -05:00
# func_version
# Echo version message to standard output and exit.
func_version ()
{
$SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
s/^# //
s/^# *$//
s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
p
}' < "$progpath"
exit $?
}
# func_usage
# Echo short help message to standard output and exit.
func_usage ()
{
$SED -n '/^# Usage:/,/# -h/ {
s/^# //
s/^# *$//
s/\$progname/'$progname'/
p
}' < "$progpath"
$ECHO
$ECHO "run \`$progname --help | more' for full usage"
exit $?
}
# func_help
# Echo long help message to standard output and exit.
func_help ()
{
$SED -n '/^# Usage:/,/# Report bugs to/ {
s/^# //
s/^# *$//
s*\$progname*'$progname'*
s*\$host*'"$host"'*
s*\$SHELL*'"$SHELL"'*
s*\$LTCC*'"$LTCC"'*
s*\$LTCFLAGS*'"$LTCFLAGS"'*
s*\$LD*'"$LD"'*
s/\$with_gnu_ld/'"$with_gnu_ld"'/
s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
p
}' < "$progpath"
exit $?
}
# func_missing_arg argname
# Echo program name prefixed message to standard error and set global
# exit_cmd.
func_missing_arg ()
{
func_error "missing argument for $1"
exit_cmd=exit
}
exit_cmd=:
# Check that we have a working $ECHO.
if test "X$1" = X--no-reexec; then
# Discard the --no-reexec flag, and continue.
2004-12-02 18:14:51 -06:00
shift
2008-05-01 23:10:45 -05:00
elif test "X$1" = X--fallback-echo; then
# Avoid inline document here, it may be left over
:
elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
# Yippee, $ECHO works!
:
else
# Restart under the correct shell, and then maybe $ECHO will work.
exec $SHELL "$progpath" --no-reexec ${1+"$@"}
fi
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
cat <<EOF
$*
EOF
exit $EXIT_SUCCESS
fi
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
magic="%%%MAGIC variable%%%"
magic_exe="%%%MAGIC EXE variable%%%"
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
# Global variables.
# $mode is unset
nonopt=
execute_dlfiles=
preserve_args=
lo2o="s/\\.lo\$/.${objext}/"
o2lo="s/\\.${objext}\$/.lo/"
extracted_archives=
extracted_serial=0
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
opt_dry_run=false
opt_duplicate_deps=false
opt_silent=false
opt_debug=:
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# If this variable is set in any of the actions, the command in it
# will be execed at the end. This prevents here-documents from being
# left over by shells.
exec_cmd=
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_fatal_configuration arg...
# Echo program name prefixed message to standard error, followed by
# a configuration failure hint, and exit.
func_fatal_configuration ()
{
func_error ${1+"$@"}
func_error "See the $PACKAGE documentation for more information."
func_fatal_error "Fatal configuration error."
}
# func_config
# Display the configuration for all the tags in this script.
func_config ()
{
re_begincf='^# ### BEGIN LIBTOOL'
re_endcf='^# ### END LIBTOOL'
# Default configuration.
$SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
2004-12-02 18:14:51 -06:00
2006-03-02 07:23:18 -06:00
# Now print the configurations for the tags.
for tagname in $taglist; do
2008-05-01 23:10:45 -05:00
$SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
2006-03-02 07:23:18 -06:00
done
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
exit $?
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_features
# Display the features supported by this script.
func_features ()
{
$ECHO "host: $host"
2004-12-02 18:14:51 -06:00
if test "$build_libtool_libs" = yes; then
2008-05-01 23:10:45 -05:00
$ECHO "enable shared libraries"
2004-12-02 18:14:51 -06:00
else
2008-05-01 23:10:45 -05:00
$ECHO "disable shared libraries"
2004-12-02 18:14:51 -06:00
fi
if test "$build_old_libs" = yes; then
2008-05-01 23:10:45 -05:00
$ECHO "enable static libraries"
2004-12-02 18:14:51 -06:00
else
2008-05-01 23:10:45 -05:00
$ECHO "disable static libraries"
2004-12-02 18:14:51 -06:00
fi
2008-05-01 23:10:45 -05:00
2006-03-02 07:23:18 -06:00
exit $?
2008-05-01 23:10:45 -05:00
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_enable_tag tagname
# Verify that TAGNAME is valid, and either flag an error and exit, or
# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
# variable here.
func_enable_tag ()
{
# Global variable:
tagname="$1"
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
sed_extractcf="/$re_begincf/,/$re_endcf/p"
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# Validate tagname.
case $tagname in
*[!-_A-Za-z0-9,/]*)
func_fatal_error "invalid tag name: $tagname"
;;
esac
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# Don't test for the "default" C tag, as we know it's
# there but not specially marked.
case $tagname in
CC) ;;
*)
if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
taglist="$taglist $tagname"
# Evaluate the configuration. Be careful to quote the path
# and the sed script, to avoid splitting on whitespace, but
# also don't use non-portable quotes within backquotes within
# quotes we have to do it in 2 steps:
extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
eval "$extractedcf"
else
func_error "ignoring unknown tag $tagname"
fi
;;
esac
}
# Parse options once, thoroughly. This comes as soon as possible in
# the script to make things like `libtool --version' happen quickly.
{
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
# Shorthand for --mode=foo, only valid as the first argument
case $1 in
clean|clea|cle|cl)
shift; set dummy --mode clean ${1+"$@"}; shift
2006-03-02 07:23:18 -06:00
;;
2008-05-01 23:10:45 -05:00
compile|compil|compi|comp|com|co|c)
shift; set dummy --mode compile ${1+"$@"}; shift
2004-12-02 18:14:51 -06:00
;;
2008-05-01 23:10:45 -05:00
execute|execut|execu|exec|exe|ex|e)
shift; set dummy --mode execute ${1+"$@"}; shift
2004-12-02 18:14:51 -06:00
;;
2008-05-01 23:10:45 -05:00
finish|finis|fini|fin|fi|f)
shift; set dummy --mode finish ${1+"$@"}; shift
2004-12-02 18:14:51 -06:00
;;
2008-05-01 23:10:45 -05:00
install|instal|insta|inst|ins|in|i)
shift; set dummy --mode install ${1+"$@"}; shift
;;
link|lin|li|l)
shift; set dummy --mode link ${1+"$@"}; shift
;;
uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
shift; set dummy --mode uninstall ${1+"$@"}; shift
2004-12-02 18:14:51 -06:00
;;
esac
2008-05-01 23:10:45 -05:00
# Parse non-mode specific arguments:
while test "$#" -gt 0; do
opt="$1"
shift
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
case $opt in
--config) func_config ;;
2006-03-02 07:23:18 -06:00
2008-05-01 23:10:45 -05:00
--debug) preserve_args="$preserve_args $opt"
func_echo "enabling shell trace mode"
opt_debug='set -x'
$opt_debug
;;
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
-dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
execute_dlfiles="$execute_dlfiles $1"
shift
;;
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
--dry-run | -n) opt_dry_run=: ;;
--features) func_features ;;
--finish) mode="finish" ;;
--mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
case $1 in
# Valid mode arguments:
clean) ;;
compile) ;;
execute) ;;
finish) ;;
install) ;;
link) ;;
relink) ;;
uninstall) ;;
# Catch anything else as an error
*) func_error "invalid argument for $opt"
exit_cmd=exit
break
;;
esac
mode="$1"
shift
;;
--preserve-dup-deps)
opt_duplicate_deps=: ;;
--quiet|--silent) preserve_args="$preserve_args $opt"
opt_silent=:
;;
--verbose| -v) preserve_args="$preserve_args $opt"
opt_silent=false
;;
--tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
preserve_args="$preserve_args $opt $1"
func_enable_tag "$1" # tagname is set here
shift
;;
# Separate optargs to long options:
-dlopen=*|--mode=*|--tag=*)
func_opt_split "$opt"
set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
shift
;;
-\?|-h) func_usage ;;
--help) opt_help=: ;;
--version) func_version ;;
-*) func_fatal_help "unrecognized option \`$opt'" ;;
*) nonopt="$opt"
break
;;
esac
done
case $host in
*cygwin* | *mingw* | *pw32*)
# don't eliminate duplications in $postdeps and $predeps
opt_duplicate_compiler_generated_deps=:
2004-12-02 18:14:51 -06:00
;;
*)
2008-05-01 23:10:45 -05:00
opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
;;
esac
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# Having warned about all mis-specified options, bail out if
# anything was wrong.
$exit_cmd $EXIT_FAILURE
}
# func_check_version_match
# Ensure that we are using m4 macros, and libtool script from the same
# release of libtool.
func_check_version_match ()
{
if test "$package_revision" != "$macro_revision"; then
if test "$VERSION" != "$macro_version"; then
if test -z "$macro_version"; then
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from an older release.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
$progname: and run autoconf again.
_LT_EOF
2004-12-02 18:14:51 -06:00
fi
2008-05-01 23:10:45 -05:00
else
cat >&2 <<_LT_EOF
$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
$progname: of $PACKAGE $VERSION and run autoconf again.
_LT_EOF
fi
exit $EXIT_MISMATCH
fi
}
## ----------- ##
## Main. ##
## ----------- ##
$opt_help || {
# Sanity checks first:
func_check_version_match
if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
func_fatal_configuration "not configured to build any kind of library"
2004-12-02 18:14:51 -06:00
fi
2008-05-01 23:10:45 -05:00
test -z "$mode" && func_fatal_error "error: you must specify a MODE."
# Darwin sucks
eval std_shrext=\"$shrext_cmds\"
2004-12-02 18:14:51 -06:00
# Only execute mode is allowed to have -dlopen flags.
if test -n "$execute_dlfiles" && test "$mode" != execute; then
2008-05-01 23:10:45 -05:00
func_error "unrecognized option \`-dlopen'"
$ECHO "$help" 1>&2
2006-03-02 07:23:18 -06:00
exit $EXIT_FAILURE
2004-12-02 18:14:51 -06:00
fi
# Change the help message to a mode-specific one.
generic_help="$help"
2008-05-01 23:10:45 -05:00
help="Try \`$progname --help --mode=$mode' for more information."
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_lalib_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_lalib_p ()
{
$SED -e 4q "$1" 2>/dev/null \
| $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_lalib_unsafe_p file
# True iff FILE is a libtool `.la' library or `.lo' object file.
# This function implements the same check as func_lalib_p without
# resorting to external programs. To this end, it redirects stdin and
# closes it afterwards, without saving the original file descriptor.
# As a safety measure, use it only where a negative result would be
# fatal anyway. Works if `file' does not exist.
func_lalib_unsafe_p ()
{
lalib_p=no
if test -r "$1" && exec 5<&0 <"$1"; then
for lalib_p_l in 1 2 3 4
do
read lalib_p_line
case "$lalib_p_line" in
\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
esac
done
exec 0<&5 5<&-
fi
test "$lalib_p" = yes
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_ltwrapper_script_p file
# True iff FILE is a libtool wrapper script
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_script_p ()
{
func_lalib_p "$1"
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_ltwrapper_executable_p file
# True iff FILE is a libtool wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_executable_p ()
{
func_ltwrapper_exec_suffix=
case $1 in
*.exe) ;;
*) func_ltwrapper_exec_suffix=.exe ;;
esac
$GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_ltwrapper_scriptname file
# Assumes file is an ltwrapper_executable
# uses $file to determine the appropriate filename for a
# temporary ltwrapper_script.
func_ltwrapper_scriptname ()
{
func_ltwrapper_scriptname_result=""
if func_ltwrapper_executable_p "$1"; then
func_dirname_and_basename "$1" "" "."
func_stripname '' '.exe' "$func_basename_result"
func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
fi
}
2004-12-02 18:14:51 -06:00
2008-05-01 23:10:45 -05:00
# func_ltwrapper_p file
# True iff FILE is a libtool wrapper script or wrapper executable
# This function is only a basic sanity check; it will hardly flush out
# determined imposters.
func_ltwrapper_p ()
{
func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
}
# func_execute_cmds commands fail_cmd
# Execute tilde-delimited COMMANDS.
# If FAIL_CMD is given, eval that upon failure.
# FAIL_CMD may read-access the current command in variable CMD!
func_execute_cmds ()
{
$opt_debug
save_ifs=$IFS; IFS='~'
for cmd in $1; do
IFS=$save_ifs
eval cmd=\"$cmd\"
func_show_eval "$cmd" "${2-:}"
done
IFS=$save_ifs
}
# func_source file
# Source FILE, adding directory component if necessary.
# Note that it is not necessary on cygwin/mingw to append a dot to
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
# behavior happens only for exec(3), not for open(2)! Also, sourcing
# `FILE.' does not work on cygwin managed mounts.
func_source ()
{
$opt_debug
case $1 in
*/* | *\\*) . "$1" ;;
*) . "./$1" ;;
<