2002-02-05 16:12:46 +08:00
|
|
|
# This file is part of Autoconf. -*- Autoconf -*-
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
# M4 sugar for common shell constructs.
|
|
|
|
# Requires GNU M4 and M4sugar.
|
2004-01-05 15:05:22 +08:00
|
|
|
# Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but 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
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
# 02111-1307, USA.
|
|
|
|
#
|
|
|
|
# As a special exception, the Free Software Foundation gives unlimited
|
|
|
|
# permission to copy, distribute and modify the configure scripts that
|
|
|
|
# are the output of Autoconf. You need not follow the terms of the GNU
|
|
|
|
# General Public License when using or distributing such scripts, even
|
|
|
|
# though portions of the text of Autoconf appear in them. The GNU
|
|
|
|
# General Public License (GPL) does govern all other use of the material
|
|
|
|
# that constitutes the Autoconf program.
|
|
|
|
#
|
|
|
|
# Certain portions of the Autoconf source text are designed to be copied
|
|
|
|
# (in certain cases, depending on the input) into the output of
|
|
|
|
# Autoconf. We call these the "data" portions. The rest of the Autoconf
|
|
|
|
# source text consists of comments plus executable code that decides which
|
|
|
|
# of the data portions to output in any given case. We call these
|
|
|
|
# comments and executable code the "non-data" portions. Autoconf never
|
|
|
|
# copies any of the non-data portions into its output.
|
|
|
|
#
|
|
|
|
# This special exception to the GPL applies to versions of Autoconf
|
|
|
|
# released by the Free Software Foundation. When you make and
|
|
|
|
# distribute a modified version of Autoconf, you may extend this special
|
|
|
|
# exception to the GPL to apply to your modified version as well, *unless*
|
|
|
|
# your modified version has the potential to copy into its output some
|
|
|
|
# of the text that was the non-data portion of the version that you started
|
|
|
|
# with. (In other words, unless your change moves or copies text from
|
|
|
|
# the non-data portions to the data portions.) If your modification has
|
|
|
|
# such potential, you must delete any notice of this special exception
|
|
|
|
# to the GPL from your modified version.
|
|
|
|
#
|
|
|
|
# Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas
|
|
|
|
# and many other people.
|
|
|
|
|
|
|
|
|
2001-08-20 22:44:48 +08:00
|
|
|
# We heavily use m4's diversions both for the initializations and for
|
2001-10-08 16:22:09 +08:00
|
|
|
# required macros, because in both cases we have to issue soon in
|
|
|
|
# output something which is discovered late.
|
|
|
|
#
|
2001-08-20 22:44:48 +08:00
|
|
|
#
|
|
|
|
# KILL is only used to suppress output.
|
|
|
|
#
|
|
|
|
# - BINSH
|
|
|
|
# AC_REQUIRE'd #! /bin/sh line
|
|
|
|
# - HEADER-REVISION
|
|
|
|
# RCS keywords etc.
|
|
|
|
# - HEADER-COMMENT
|
|
|
|
# Purpose of the script etc.
|
|
|
|
# - HEADER-COPYRIGHT
|
|
|
|
# Copyright notice(s)
|
2004-01-30 22:29:18 +08:00
|
|
|
# - M4SH-SANITIZE
|
|
|
|
# M4sh's shell setup
|
2001-08-20 22:44:48 +08:00
|
|
|
# - M4SH-INIT
|
2004-01-30 22:29:18 +08:00
|
|
|
# M4sh initialization
|
2001-10-08 16:20:59 +08:00
|
|
|
# - BODY
|
|
|
|
# The body of the script.
|
2001-08-20 22:44:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
# _m4_divert(DIVERSION-NAME)
|
|
|
|
# --------------------------
|
|
|
|
# Convert a diversion name into its number. Otherwise, return
|
|
|
|
# DIVERSION-NAME which is supposed to be an actual diversion number.
|
|
|
|
# Of course it would be nicer to use m4_case here, instead of zillions
|
|
|
|
# of little macros, but it then takes twice longer to run `autoconf'!
|
|
|
|
m4_define([_m4_divert(BINSH)], 0)
|
|
|
|
m4_define([_m4_divert(HEADER-REVISION)], 1)
|
|
|
|
m4_define([_m4_divert(HEADER-COMMENT)], 2)
|
|
|
|
m4_define([_m4_divert(HEADER-COPYRIGHT)], 3)
|
2004-01-30 22:29:18 +08:00
|
|
|
m4_define([_m4_divert(M4SH-SANITIZE)], 4)
|
|
|
|
m4_define([_m4_divert(M4SH-INIT)], 5)
|
2001-10-08 16:20:59 +08:00
|
|
|
m4_define([_m4_divert(BODY)], 1000)
|
2001-08-20 22:44:48 +08:00
|
|
|
|
|
|
|
# Aaarg. Yet it starts with compatibility issues... Libtool wants to
|
|
|
|
# use NOTICE to insert its own LIBTOOL-INIT stuff. People should ask
|
|
|
|
# before diving into our internals :(
|
|
|
|
m4_copy([_m4_divert(M4SH-INIT)], [_m4_divert(NOTICE)])
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-14 19:01:44 +08:00
|
|
|
## ------------------------- ##
|
|
|
|
## 1. Sanitizing the shell. ##
|
|
|
|
## ------------------------- ##
|
|
|
|
|
2001-10-06 00:12:06 +08:00
|
|
|
|
2001-10-08 16:21:34 +08:00
|
|
|
# AS_REQUIRE(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
|
|
|
|
# -----------------------------------------------------------
|
|
|
|
# BODY-TO-EXPAND is some initialization which must be expanded in the
|
2002-03-13 00:08:01 +08:00
|
|
|
# M4SH-INIT section when expanded (required or not). This is very
|
|
|
|
# different from m4_require. For instance:
|
2001-10-08 16:21:34 +08:00
|
|
|
#
|
|
|
|
# m4_defun([_FOO_PREPARE], [foo=foo])
|
|
|
|
# m4_defun([FOO],
|
|
|
|
# [m4_require([_FOO_PREPARE])dnl
|
|
|
|
# echo $foo])
|
|
|
|
#
|
|
|
|
# m4_defun([_BAR_PREPARE], [bar=bar])
|
|
|
|
# m4_defun([BAR],
|
|
|
|
# [AS_REQUIRE([_BAR_PREPARE])dnl
|
|
|
|
# echo $bar])
|
|
|
|
#
|
|
|
|
# AS_INIT
|
|
|
|
# foo1=`FOO`
|
|
|
|
# foo2=`FOO`
|
|
|
|
# bar1=`BAR`
|
|
|
|
# bar2=`BAR`
|
|
|
|
#
|
|
|
|
# gives
|
|
|
|
#
|
|
|
|
# #! /bin/sh
|
|
|
|
# bar=bar
|
|
|
|
#
|
|
|
|
# foo1=`foo=foo
|
|
|
|
# echo $foo`
|
|
|
|
# foo2=`echo $foo`
|
|
|
|
# bar1=`echo $bar`
|
|
|
|
# bar2=`echo $bar`
|
|
|
|
#
|
|
|
|
m4_define([AS_REQUIRE],
|
|
|
|
[m4_provide_if([$1], [],
|
2003-05-23 05:39:45 +08:00
|
|
|
[m4_divert_text([M4SH-INIT], [m4_default([$2], [$1])])])])
|
2001-10-08 16:21:34 +08:00
|
|
|
|
|
|
|
|
2003-11-24 18:44:52 +08:00
|
|
|
# AS_REQUIRE_SHELL_FN(NAME-TO-CHECK, BODY-TO-EXPAND)
|
|
|
|
# --------------------------------------------------
|
|
|
|
# BODY-TO-EXPAND is the body of a shell function to be emitted in the
|
|
|
|
# M4SH-INIT section when expanded (required or not). Unlike other
|
|
|
|
# xx_REQUIRE macros, BODY-TO-EXPAND is mandatory.
|
|
|
|
#
|
|
|
|
m4_define([AS_REQUIRE_SHELL_FN],
|
2004-01-30 22:29:18 +08:00
|
|
|
[AS_DETECT_REQUIRED([_AS_SHELL_FN_WORK])dnl
|
2003-11-27 18:04:12 +08:00
|
|
|
m4_provide_if([AS_SHELL_FN_$1], [],
|
2003-11-24 18:44:52 +08:00
|
|
|
[m4_provide([AS_SHELL_FN_$1])m4_divert_text([M4SH-INIT], [$1() {
|
|
|
|
$2
|
|
|
|
}])])])
|
|
|
|
|
|
|
|
|
2003-11-27 18:04:12 +08:00
|
|
|
# _AS_BOURNE_COMPATIBLE
|
|
|
|
# ---------------------
|
2000-11-14 19:01:44 +08:00
|
|
|
# Try to be as Bourne and/or POSIX as possible.
|
2003-11-27 18:04:12 +08:00
|
|
|
m4_define([_AS_BOURNE_COMPATIBLE],
|
|
|
|
[# Be Bourne compatible
|
2000-11-14 19:01:44 +08:00
|
|
|
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
|
|
|
emulate sh
|
|
|
|
NULLCMD=:
|
2002-04-11 01:36:45 +08:00
|
|
|
[#] Zsh 3.x and 4.x performs word splitting on ${1+"$[@]"}, which
|
|
|
|
# is contrary to our usage. Disable this feature.
|
2002-04-10 23:58:19 +08:00
|
|
|
alias -g '${1+"$[@]"}'='"$[@]"'
|
2004-06-24 15:07:39 +08:00
|
|
|
setopt NO_GLOB_SUBST
|
2000-11-14 19:01:44 +08:00
|
|
|
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
|
|
|
|
set -o posix
|
|
|
|
fi
|
2003-09-29 02:53:50 +08:00
|
|
|
DUALCASE=1; export DUALCASE # for MKS sh
|
2003-11-27 18:04:12 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2004-01-30 22:29:18 +08:00
|
|
|
# _AS_RUN(TEST, [SHELL])
|
|
|
|
# ----------------------
|
|
|
|
# Run TEST under the current shell (if one parameter is used)
|
|
|
|
# or under the given SHELL, protecting it from syntax errors.
|
|
|
|
m4_define([_AS_RUN],
|
|
|
|
[m4_ifval([$2],
|
|
|
|
[{ $2 <<\_ASEOF
|
|
|
|
_AS_BOURNE_COMPATIBLE
|
|
|
|
$1
|
|
|
|
_ASEOF
|
|
|
|
}],
|
|
|
|
[(eval "AS_ESCAPE(m4_quote($1))")])])
|
|
|
|
|
|
|
|
# AS_DETECT_REQUIRED(TEST)
|
|
|
|
# ------------------------
|
|
|
|
# Refuse to execute under a shell that does not pass
|
|
|
|
# the given TEST.
|
|
|
|
m4_define([_AS_DETECT_REQUIRED_BODY], [:])
|
|
|
|
m4_defun([AS_DETECT_REQUIRED],
|
|
|
|
[m4_require([_AS_DETECT_BETTER_SHELL])dnl
|
|
|
|
m4_expand_once([m4_append([_AS_DETECT_REQUIRED_BODY], [
|
|
|
|
($1) || AS_EXIT(1)
|
|
|
|
])], [AS_DETECT_REQUIRED_provide($1)])])
|
|
|
|
|
|
|
|
# AS_DETECT_SUGGESTED(TEST)
|
|
|
|
# -------------------------
|
|
|
|
# Prefer to execute under a shell that passes the given TEST.
|
|
|
|
m4_define([_AS_DETECT_SUGGESTED_BODY], [:])
|
|
|
|
m4_defun([AS_DETECT_SUGGESTED],
|
|
|
|
[m4_require([_AS_DETECT_BETTER_SHELL])dnl
|
|
|
|
m4_expand_once([m4_append([_AS_DETECT_SUGGESTED_BODY], [
|
|
|
|
($1) || AS_EXIT(1)
|
|
|
|
])], [AS_DETECT_SUGGESTED_provide($1)])])
|
|
|
|
|
|
|
|
# _AS_DETECT_BETTER_SHELL
|
|
|
|
# -----------------------
|
|
|
|
# The real workhorse for detecting a shell with the correct
|
|
|
|
# features.
|
|
|
|
m4_defun_once([_AS_DETECT_BETTER_SHELL],
|
|
|
|
[m4_wrap([m4_divert_text([M4SH-SANITIZE], [
|
2004-06-24 23:00:29 +08:00
|
|
|
AS_REQUIRE([_AS_UNSET_PREPARE])dnl
|
2004-01-30 22:29:18 +08:00
|
|
|
if test "x$CONFIG_SHELL" = x; then
|
|
|
|
AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY]) 2>/dev/null],
|
|
|
|
[as_have_required=yes],
|
|
|
|
[as_have_required=no])
|
|
|
|
AS_IF([test $as_have_required = yes && dnl
|
|
|
|
_AS_RUN([_AS_DETECT_SUGGESTED_BODY]) 2> /dev/null],
|
|
|
|
[],
|
2004-05-03 11:47:19 +08:00
|
|
|
[as_candidate_shells=
|
2004-01-30 22:29:18 +08:00
|
|
|
_AS_PATH_WALK([/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH],
|
|
|
|
[case $as_dir in
|
|
|
|
/*)
|
|
|
|
for as_base in sh bash ksh sh5; do
|
|
|
|
as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
|
|
|
|
done
|
|
|
|
esac])
|
|
|
|
|
2004-05-03 11:49:22 +08:00
|
|
|
for as_shell in $as_candidate_shells $SHELL; do
|
2004-01-30 22:29:18 +08:00
|
|
|
AS_IF([_AS_RUN([_AS_DETECT_REQUIRED_BODY], [$as_shell 2> /dev/null])],
|
|
|
|
[CONFIG_SHELL=$as_shell
|
|
|
|
as_have_required=yes
|
|
|
|
AS_IF([_AS_RUN([_AS_DETECT_SUGGESTED_BODY], [$as_shell 2> /dev/null])],
|
|
|
|
[break])])
|
|
|
|
done
|
|
|
|
|
|
|
|
AS_IF([test "x$CONFIG_SHELL" != x],
|
2004-06-24 23:00:29 +08:00
|
|
|
[for as_var in BASH_ENV ENV
|
|
|
|
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
|
|
|
|
done
|
2004-01-30 22:29:18 +08:00
|
|
|
export CONFIG_SHELL
|
|
|
|
exec "$CONFIG_SHELL" "$as_myself" ${1+"$[@]"}])
|
|
|
|
|
|
|
|
AS_IF([test $as_have_required = no],
|
|
|
|
[echo This script requires a shell more modern than all the
|
|
|
|
echo shells that I found on your system. Please install a
|
|
|
|
echo modern shell, or manually run the script under such a
|
|
|
|
echo shell if you do have one.
|
|
|
|
AS_EXIT(1)])
|
|
|
|
])
|
|
|
|
fi
|
|
|
|
])])])
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_SHELL_FN_WORK
|
|
|
|
# -----------------
|
2003-11-27 18:04:12 +08:00
|
|
|
# This is a spy to detect "in the wild" shells that do not support shell
|
|
|
|
# functions correctly. It is based on the m4sh.at Autotest testcases.
|
|
|
|
m4_define([_AS_SHELL_FN_WORK],
|
2004-01-30 22:29:18 +08:00
|
|
|
[func_return () {
|
2003-11-27 18:04:12 +08:00
|
|
|
(exit [$]1)
|
|
|
|
}
|
|
|
|
func_success () {
|
|
|
|
func_return 0
|
|
|
|
}
|
|
|
|
func_failure () {
|
|
|
|
func_return 1
|
|
|
|
}
|
|
|
|
func_ret_success () {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
func_ret_failure () {
|
|
|
|
return 1
|
|
|
|
}
|
2000-11-14 19:01:44 +08:00
|
|
|
|
2003-11-27 18:04:12 +08:00
|
|
|
exitcode=0
|
2004-01-30 22:29:18 +08:00
|
|
|
AS_IF([func_success], [],
|
|
|
|
[exitcode=1
|
|
|
|
echo func_failure succeeded.])
|
|
|
|
AS_IF([func_failure],
|
|
|
|
[exitcode=1
|
|
|
|
echo func_success failed.])
|
|
|
|
AS_IF([func_ret_success], [],
|
|
|
|
[exitcode=1
|
|
|
|
echo func_ret_success failed.])
|
|
|
|
AS_IF([func_ret_failure],
|
|
|
|
[exitcode=1
|
|
|
|
echo func_ret_failure succeeded.])
|
|
|
|
test $exitcode = 0])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_SHELL_SANITIZE
|
|
|
|
# -----------------
|
2003-11-27 18:04:12 +08:00
|
|
|
m4_defun([AS_SHELL_SANITIZE],
|
|
|
|
[## --------------------- ##
|
|
|
|
## M4sh Initialization. ##
|
|
|
|
## --------------------- ##
|
|
|
|
|
|
|
|
_AS_BOURNE_COMPATIBLE
|
|
|
|
|
|
|
|
# PATH needs CR
|
|
|
|
_AS_CR_PREPARE
|
|
|
|
_AS_PATH_SEPARATOR_PREPARE
|
2001-11-02 03:44:57 +08:00
|
|
|
_AS_UNSET_PREPARE
|
2002-09-01 16:24:04 +08:00
|
|
|
|
2003-11-27 18:04:12 +08:00
|
|
|
# Find who we are. Look in the path if we contain no path at all
|
|
|
|
# relative or not.
|
|
|
|
case $[0] in
|
|
|
|
*[[\\/]]* ) as_myself=$[0] ;;
|
|
|
|
*) _AS_PATH_WALK([],
|
|
|
|
[test -r "$as_dir/$[0]" && as_myself=$as_dir/$[0] && break])
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
# We did not find ourselves, most probably we were run as `sh COMMAND'
|
|
|
|
# in which case we are not to be found in the path.
|
|
|
|
if test "x$as_myself" = x; then
|
|
|
|
as_myself=$[0]
|
|
|
|
fi
|
|
|
|
if test ! -f "$as_myself"; then
|
|
|
|
AS_ERROR([cannot find myself; rerun with an absolute path])
|
|
|
|
fi
|
|
|
|
|
2002-09-01 16:24:04 +08:00
|
|
|
# Work around bugs in pre-3.0 UWIN ksh.
|
2004-06-24 23:00:29 +08:00
|
|
|
for as_var in ENV MAIL MAILPATH
|
|
|
|
do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
|
|
|
|
done
|
2002-09-01 16:24:04 +08:00
|
|
|
PS1='$ '
|
|
|
|
PS2='> '
|
|
|
|
PS4='+ '
|
|
|
|
|
|
|
|
# NLS nuisances.
|
2002-11-05 15:09:14 +08:00
|
|
|
for as_var in \
|
|
|
|
LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
|
|
|
|
LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
|
|
|
|
LC_TELEPHONE LC_TIME
|
2002-09-01 16:24:04 +08:00
|
|
|
do
|
2003-02-25 14:45:05 +08:00
|
|
|
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
|
2002-09-01 16:24:04 +08:00
|
|
|
eval $as_var=C; export $as_var
|
|
|
|
else
|
2004-06-24 23:00:29 +08:00
|
|
|
($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
|
2002-09-01 16:24:04 +08:00
|
|
|
fi
|
|
|
|
done
|
2001-11-02 03:44:57 +08:00
|
|
|
|
2002-04-10 23:58:19 +08:00
|
|
|
# Required to use basename.
|
|
|
|
_AS_EXPR_PREPARE
|
2002-03-28 04:33:03 +08:00
|
|
|
_AS_BASENAME_PREPARE
|
2002-04-10 23:58:19 +08:00
|
|
|
|
|
|
|
# Name of the executable.
|
2001-10-19 08:20:03 +08:00
|
|
|
as_me=`AS_BASENAME("$[0]")`
|
2001-03-30 20:49:36 +08:00
|
|
|
|
2002-04-10 23:58:19 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_PREPARE
|
|
|
|
# -----------
|
|
|
|
# This macro has a very special status. Normal use of M4sh relies
|
2002-04-20 14:09:01 +08:00
|
|
|
# heavily on AS_REQUIRE, so that needed initializations (such as
|
2002-04-10 23:58:19 +08:00
|
|
|
# _AS_TEST_PREPARE) are performed on need, not on demand. But
|
|
|
|
# Autoconf is the first client of M4sh, and for two reasons: configure
|
|
|
|
# and config.status. Relying on AS_REQUIRE is of course fine for
|
|
|
|
# configure, but fails for config.status (which is created by
|
|
|
|
# configure). So we need a means to force the inclusion of the
|
|
|
|
# various _AS_PREPARE_* on top of config.status. That's basically why
|
|
|
|
# there are so many _AS_PREPARE_* below, and that's also why it is
|
|
|
|
# important not to forget some: config.status needs them.
|
|
|
|
m4_defun([_AS_PREPARE],
|
2003-11-27 18:04:12 +08:00
|
|
|
[_AS_LINENO_PREPARE
|
2001-09-22 23:20:44 +08:00
|
|
|
|
2001-09-13 14:56:31 +08:00
|
|
|
_AS_ECHO_N_PREPARE
|
2000-11-29 23:52:02 +08:00
|
|
|
_AS_EXPR_PREPARE
|
2001-01-27 21:19:14 +08:00
|
|
|
_AS_LN_S_PREPARE
|
2002-04-02 23:14:09 +08:00
|
|
|
_AS_MKDIR_P_PREPARE
|
2001-01-24 16:24:44 +08:00
|
|
|
_AS_TEST_PREPARE
|
2001-09-22 23:20:44 +08:00
|
|
|
_AS_TR_CPP_PREPARE
|
|
|
|
_AS_TR_SH_PREPARE
|
2000-11-14 19:01:44 +08:00
|
|
|
|
|
|
|
# IFS
|
|
|
|
# We need space, tab and new line, in precisely that order.
|
2001-01-27 21:19:14 +08:00
|
|
|
as_nl='
|
2000-11-14 19:01:44 +08:00
|
|
|
'
|
2001-01-27 21:19:14 +08:00
|
|
|
IFS=" $as_nl"
|
2000-11-14 19:01:44 +08:00
|
|
|
|
|
|
|
# CDPATH.
|
2002-08-31 13:48:04 +08:00
|
|
|
$as_unset CDPATH
|
2000-11-14 19:01:44 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
2002-04-10 23:58:19 +08:00
|
|
|
# AS_PREPARE
|
|
|
|
# ----------
|
|
|
|
# Output all the M4sh possible initialization into the initialization
|
|
|
|
# diversion.
|
|
|
|
m4_defun([AS_PREPARE],
|
|
|
|
[m4_divert_text([M4SH-INIT], [_AS_PREPARE])])
|
|
|
|
|
|
|
|
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
## ----------------------------- ##
|
2000-11-14 19:01:44 +08:00
|
|
|
## 2. Wrappers around builtins. ##
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
## ----------------------------- ##
|
|
|
|
|
|
|
|
# This section is lexicographically sorted.
|
|
|
|
|
2001-01-24 16:24:44 +08:00
|
|
|
|
2000-11-29 23:52:02 +08:00
|
|
|
# AS_EXIT([EXIT-CODE = 1])
|
|
|
|
# ------------------------
|
|
|
|
# Exit and set exit code to EXIT-CODE in the way that it's seen
|
|
|
|
# within "trap 0".
|
|
|
|
#
|
|
|
|
# We cannot simply use "exit N" because some shells (zsh and Solaris sh)
|
|
|
|
# will not set $? to N while running the code set by "trap 0"
|
|
|
|
# So we set $? by executing "exit N" in the subshell and then exit.
|
2001-01-16 18:27:19 +08:00
|
|
|
# Other shells don't use `$?' as default for `exit', hence just repeating
|
|
|
|
# the exit value can only help improving portability.
|
2000-11-29 23:52:02 +08:00
|
|
|
m4_define([AS_EXIT],
|
2001-01-16 18:27:19 +08:00
|
|
|
[{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }])
|
2000-11-29 23:52:02 +08:00
|
|
|
|
|
|
|
|
2001-01-15 15:29:24 +08:00
|
|
|
# AS_IF(TEST, [IF-TRUE], [IF-FALSE])
|
|
|
|
# ----------------------------------
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
# Expand into
|
|
|
|
# | if TEST; then
|
|
|
|
# | IF-TRUE
|
|
|
|
# | else
|
|
|
|
# | IF-FALSE
|
|
|
|
# | fi
|
|
|
|
# with simplifications is IF-TRUE and/or IF-FALSE is empty.
|
2001-08-20 22:44:48 +08:00
|
|
|
#
|
|
|
|
# FIXME: Be n-ary, just as m4_if.
|
2001-01-15 15:29:24 +08:00
|
|
|
m4_define([AS_IF],
|
2000-11-29 18:09:44 +08:00
|
|
|
[m4_ifval([$2$3],
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
[if $1; then
|
2000-11-29 18:09:44 +08:00
|
|
|
m4_ifval([$2], [$2], :)
|
|
|
|
m4_ifvaln([$3],
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
[else
|
|
|
|
$3])dnl
|
|
|
|
fi
|
|
|
|
])dnl
|
2001-01-15 15:29:24 +08:00
|
|
|
])# AS_IF
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
|
2000-11-03 17:16:21 +08:00
|
|
|
# _AS_UNSET_PREPARE
|
|
|
|
# -----------------
|
|
|
|
# AS_UNSET depends upon $as_unset: compute it.
|
2003-08-01 09:10:58 +08:00
|
|
|
# Use MAIL to trigger a bug in Bash 2.01;
|
|
|
|
# the "|| exit" suppresses the resulting "Segmentation fault" message.
|
2003-10-16 06:56:22 +08:00
|
|
|
# Avoid 'if ((', as that triggers a bug in pdksh 5.2.14.
|
2000-11-03 17:16:21 +08:00
|
|
|
m4_defun([_AS_UNSET_PREPARE],
|
|
|
|
[# Support unset when possible.
|
2003-10-16 06:56:22 +08:00
|
|
|
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
|
2000-11-03 17:16:21 +08:00
|
|
|
as_unset=unset
|
|
|
|
else
|
|
|
|
as_unset=false
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
# AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
|
|
|
|
# --------------------------------------------------
|
|
|
|
# Try to unset the env VAR, otherwise set it to
|
2001-01-27 21:19:14 +08:00
|
|
|
# VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed.
|
2000-11-03 17:16:21 +08:00
|
|
|
m4_defun([AS_UNSET],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_UNSET_PREPARE])dnl
|
2000-11-03 17:16:21 +08:00
|
|
|
$as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
|
2000-10-30 20:29:36 +08:00
|
|
|
|
|
|
|
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
## ------------------------------------------ ##
|
2000-11-14 19:01:44 +08:00
|
|
|
## 3. Error and warnings at the shell level. ##
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
## ------------------------------------------ ##
|
|
|
|
|
|
|
|
# If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there
|
|
|
|
# too.
|
|
|
|
|
|
|
|
|
2001-01-22 16:59:02 +08:00
|
|
|
# AS_ESCAPE(STRING, [CHARS = $"'\])
|
|
|
|
# ---------------------------------
|
|
|
|
# Escape the CHARS in STRING.
|
|
|
|
m4_define([AS_ESCAPE],
|
* lib/autoconf/autoconf.m4, lib/autoconf/general.m4,
* lib/autoconf/libs.m4, lib/autoconf/status.m4,
* lib/autoconf/types.m4, lib/autotest/general.m4,
* lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4, tests/atspecific.m4,
* tests/torture.at: Rename m4_regexp, m4_patsubst, and m4_match to
m4_bregexp, m4_bpatsubst, and m4_bmatch.
* doc/autoconf.texi (Redefined M4 Macros): Adjust.
2001-10-08 16:22:33 +08:00
|
|
|
[m4_bpatsubst([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
m4_ifval([$2], [[\([$2]\)]], [[\([\"$`]\)]]),
|
|
|
|
[\\\1])])
|
2001-01-22 16:59:02 +08:00
|
|
|
|
|
|
|
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
# _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION)
|
|
|
|
# ---------------------------------------------------------------
|
|
|
|
# Compatibility glue between the old AS_MSG suite which did not
|
|
|
|
# quote anything, and the modern suite which quotes the quotes.
|
|
|
|
# If STRING contains `\\' or `\$', it's modern.
|
|
|
|
# If STRING contains `\"' or `\`', it's old.
|
|
|
|
# Otherwise it's modern.
|
|
|
|
# We use two quotes in the pattern to keep highlighting tools at peace.
|
|
|
|
m4_define([_AS_QUOTE_IFELSE],
|
* lib/autoconf/autoconf.m4, lib/autoconf/general.m4,
* lib/autoconf/libs.m4, lib/autoconf/status.m4,
* lib/autoconf/types.m4, lib/autotest/general.m4,
* lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4, tests/atspecific.m4,
* tests/torture.at: Rename m4_regexp, m4_patsubst, and m4_match to
m4_bregexp, m4_bpatsubst, and m4_bmatch.
* doc/autoconf.texi (Redefined M4 Macros): Adjust.
2001-10-08 16:22:33 +08:00
|
|
|
[m4_bmatch([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[\\[\\$]], [$2],
|
|
|
|
[\\[`""]], [$3],
|
|
|
|
[$2])])
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
# _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD])
|
2000-12-12 18:53:41 +08:00
|
|
|
# -----------------------------------------------
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
# Perform shell expansions on STRING and echo the string to FD.
|
|
|
|
m4_define([_AS_ECHO_UNQUOTED],
|
|
|
|
[echo "$1" >&m4_default([$2], [AS_MESSAGE_FD])])
|
|
|
|
|
|
|
|
|
2002-10-22 16:20:19 +08:00
|
|
|
# _AS_QUOTE(STRING, [CHARS = `"])
|
|
|
|
# -------------------------------
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
# If there are quoted (via backslash) backquotes do nothing, else
|
|
|
|
# backslash all the quotes.
|
|
|
|
m4_define([_AS_QUOTE],
|
|
|
|
[_AS_QUOTE_IFELSE([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[AS_ESCAPE([$1], m4_default([$2], [`""]))],
|
|
|
|
[m4_warn([obsolete],
|
|
|
|
[back quotes and double quotes must not be escaped in: $1])dnl
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
$1])])
|
|
|
|
|
|
|
|
|
2001-06-21 17:18:16 +08:00
|
|
|
# _AS_ECHO(STRING, [FD = AS_MESSAGE_FD])
|
|
|
|
# --------------------------------------
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
# Protect STRING from backquote expansion, echo the result to FD.
|
|
|
|
m4_define([_AS_ECHO],
|
2000-12-12 18:53:41 +08:00
|
|
|
[_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])])
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
|
|
|
|
|
2001-09-13 14:56:31 +08:00
|
|
|
# _AS_ECHO_N_PREPARE
|
|
|
|
# ------------------
|
|
|
|
# Check whether to use -n, \c, or newline-tab to separate
|
|
|
|
# checking messages from result messages.
|
|
|
|
# Don't try to cache, since the results of this macro are needed to
|
|
|
|
# display the checking message. In addition, caching something used once
|
|
|
|
# has little interest.
|
|
|
|
# Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c'
|
|
|
|
# failed there is also a new-line to match.
|
2001-10-10 20:59:27 +08:00
|
|
|
m4_defun([_AS_ECHO_N_PREPARE],
|
2001-09-13 14:56:31 +08:00
|
|
|
[case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
|
|
|
|
*c*,-n*) ECHO_N= ECHO_C='
|
|
|
|
' ECHO_T=' ' ;;
|
|
|
|
*c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
|
|
|
|
*) ECHO_N= ECHO_C='\c' ECHO_T= ;;
|
|
|
|
esac
|
|
|
|
])# _AS_ECHO_N_PREPARE
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_ECHO_N(STRING, [FD = AS_MESSAGE_FD])
|
|
|
|
# ----------------------------------------
|
|
|
|
# Same as _AS_ECHO, but echo doesn't return to a new line.
|
|
|
|
m4_define([_AS_ECHO_N],
|
2001-10-10 20:59:27 +08:00
|
|
|
[AS_REQUIRE([_AS_ECHO_N_PREPARE])dnl
|
|
|
|
echo $ECHO_N "_AS_QUOTE([$1])$ECHO_C" >&m4_default([$2],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[AS_MESSAGE_FD])])
|
2001-09-13 14:56:31 +08:00
|
|
|
|
|
|
|
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
# AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD])
|
2000-12-12 18:53:41 +08:00
|
|
|
# ----------------------------------------
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
m4_define([AS_MESSAGE],
|
2000-11-29 18:09:44 +08:00
|
|
|
[m4_ifset([AS_MESSAGE_LOG_FD],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[{ _AS_ECHO([$as_me:$LINENO: $1], [AS_MESSAGE_LOG_FD])
|
2000-12-12 18:53:41 +08:00
|
|
|
_AS_ECHO([$as_me: $1], [$2]);}],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[_AS_ECHO([$as_me: $1], [$2])])[]dnl
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_WARN(PROBLEM)
|
|
|
|
# ----------------
|
|
|
|
m4_define([AS_WARN],
|
2000-12-12 18:53:41 +08:00
|
|
|
[AS_MESSAGE([WARNING: $1], [2])])# AS_WARN
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
# AS_ERROR(ERROR, [EXIT-STATUS = 1])
|
|
|
|
# ----------------------------------
|
|
|
|
m4_define([AS_ERROR],
|
2000-12-12 18:53:41 +08:00
|
|
|
[{ AS_MESSAGE([error: $1], [2])
|
2000-12-15 15:09:41 +08:00
|
|
|
AS_EXIT([$2]); }[]dnl
|
Move AC_MSG_* into M4sh.
* acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move
to...
* m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here.
(AS_MESSAGE, AS_WARN, AS_ERROR): New.
* acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them.
(AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of...
(AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new.
Adjust all dependencies.
2000-11-14 18:11:43 +08:00
|
|
|
])# AS_ERROR
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-29 23:52:02 +08:00
|
|
|
## -------------------------------------- ##
|
|
|
|
## 4. Portable versions of common tools. ##
|
|
|
|
## -------------------------------------- ##
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
# This section is lexicographically sorted.
|
|
|
|
|
|
|
|
|
|
|
|
# AS_DIRNAME(PATHNAME)
|
|
|
|
# --------------------
|
|
|
|
# Simulate running `dirname(1)' on PATHNAME, not all systems have it.
|
|
|
|
# This macro must be usable from inside ` `.
|
|
|
|
#
|
|
|
|
# Prefer expr to echo|sed, since expr is usually faster and it handles
|
|
|
|
# backslashes and newlines correctly. However, older expr
|
|
|
|
# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have
|
|
|
|
# a silly length limit that causes expr to fail if the matched
|
|
|
|
# substring is longer than 120 bytes. So fall back on echo|sed if
|
|
|
|
# expr fails.
|
2000-11-29 23:52:02 +08:00
|
|
|
m4_defun([AS_DIRNAME_EXPR],
|
2001-10-08 16:21:54 +08:00
|
|
|
[AS_REQUIRE([_AS_EXPR_PREPARE])dnl
|
2000-11-29 23:52:02 +08:00
|
|
|
$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
X[]$1 : 'X\(//\)[[^/]]' \| \
|
|
|
|
X[]$1 : 'X\(//\)$' \| \
|
|
|
|
X[]$1 : 'X\(/\)' \| \
|
|
|
|
. : '\(.\)'])
|
2000-11-29 23:52:02 +08:00
|
|
|
|
|
|
|
m4_defun([AS_DIRNAME_SED],
|
2000-11-10 18:14:44 +08:00
|
|
|
[echo X[]$1 |
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
|
|
|
|
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
|
|
|
|
/^X\(\/\/\)$/{ s//\1/; q; }
|
|
|
|
/^X\(\/\).*/{ s//\1/; q; }
|
|
|
|
s/.*/./; q']])
|
|
|
|
|
2000-11-29 23:52:02 +08:00
|
|
|
m4_defun([AS_DIRNAME],
|
2001-10-19 07:43:52 +08:00
|
|
|
[(dirname $1) 2>/dev/null ||
|
|
|
|
AS_DIRNAME_EXPR([$1]) 2>/dev/null ||
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
AS_DIRNAME_SED([$1])])
|
|
|
|
|
|
|
|
|
2001-03-30 20:49:36 +08:00
|
|
|
# AS_BASENAME(PATHNAME)
|
|
|
|
# --------------------
|
|
|
|
# Simulate running `basename(1)' on PATHNAME, not all systems have it.
|
2001-10-19 07:43:52 +08:00
|
|
|
# Also see the comments for AS_DIRNAME.
|
|
|
|
|
|
|
|
m4_defun([AS_BASENAME_EXPR],
|
2002-03-13 00:08:01 +08:00
|
|
|
[AS_REQUIRE([_AS_EXPR_PREPARE])dnl
|
2001-10-19 07:43:52 +08:00
|
|
|
$as_expr X/[]$1 : '.*/\([[^/][^/]*]\)/*$' \| \
|
|
|
|
X[]$1 : 'X\(//\)$' \| \
|
|
|
|
X[]$1 : 'X\(/\)$' \| \
|
|
|
|
. : '\(.\)'])
|
|
|
|
|
2001-09-18 20:26:36 +08:00
|
|
|
m4_defun([AS_BASENAME_SED],
|
2001-10-19 07:43:52 +08:00
|
|
|
[echo X/[]$1 |
|
|
|
|
sed ['/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
|
|
|
|
/^X\/\(\/\/\)$/{ s//\1/; q; }
|
|
|
|
/^X\/\(\/\).*/{ s//\1/; q; }
|
|
|
|
s/.*/./; q']])
|
2001-09-18 20:26:36 +08:00
|
|
|
|
2001-03-30 20:49:36 +08:00
|
|
|
m4_defun([AS_BASENAME],
|
2002-03-28 04:33:03 +08:00
|
|
|
[AS_REQUIRE([_$0_PREPARE])dnl
|
|
|
|
$as_basename $1 ||
|
2001-10-19 07:43:52 +08:00
|
|
|
AS_BASENAME_EXPR([$1]) 2>/dev/null ||
|
|
|
|
AS_BASENAME_SED([$1])])
|
2001-03-30 20:49:36 +08:00
|
|
|
|
2001-10-08 16:22:09 +08:00
|
|
|
|
2001-01-24 16:24:44 +08:00
|
|
|
# AS_EXECUTABLE_P
|
|
|
|
# ---------------
|
|
|
|
# Check whether a file is executable.
|
|
|
|
m4_defun([AS_EXECUTABLE_P],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_TEST_PREPARE])dnl
|
2001-01-24 16:24:44 +08:00
|
|
|
$as_executable_p $1[]dnl
|
|
|
|
])# AS_EXECUTABLE_P
|
|
|
|
|
|
|
|
|
2002-03-28 04:33:03 +08:00
|
|
|
# _AS_BASENAME_PREPARE
|
|
|
|
# --------------------
|
|
|
|
# Avoid Solaris 9 /usr/ucb/basename, as `basename /' outputs an empty line.
|
|
|
|
m4_defun([_AS_BASENAME_PREPARE],
|
|
|
|
[if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
|
|
|
|
as_basename=basename
|
|
|
|
else
|
|
|
|
as_basename=false
|
|
|
|
fi
|
|
|
|
])# _AS_BASENAME_PREPARE
|
|
|
|
|
2000-11-29 23:52:02 +08:00
|
|
|
# _AS_EXPR_PREPARE
|
|
|
|
# ----------------
|
|
|
|
# Some expr work properly (i.e. compute and issue the right result),
|
|
|
|
# but exit with failure. When a fall back to expr (as in AS_DIRNAME)
|
|
|
|
# is provided, you get twice the result. Prevent this.
|
|
|
|
m4_defun([_AS_EXPR_PREPARE],
|
2000-12-01 00:30:53 +08:00
|
|
|
[if expr a : '\(a\)' >/dev/null 2>&1; then
|
|
|
|
as_expr=expr
|
|
|
|
else
|
|
|
|
as_expr=false
|
2001-01-24 16:24:44 +08:00
|
|
|
fi
|
2000-11-29 23:52:02 +08:00
|
|
|
])# _AS_EXPR_PREPARE
|
|
|
|
|
2001-10-27 03:52:43 +08:00
|
|
|
# _AS_LINENO_WORKS
|
|
|
|
# ---------------
|
|
|
|
# Succeed if the currently executing shell supports LINENO.
|
2001-11-01 04:07:48 +08:00
|
|
|
# This macro does not expand to a single shell command, so be careful
|
|
|
|
# when using it. Surrounding the body of this macro with {} would
|
|
|
|
# cause "bash -c '_ASLINENO_WORKS'" to fail (with Bash 2.05, anyway),
|
|
|
|
# but that bug is irrelevant to our use of LINENO.
|
2001-10-27 03:52:43 +08:00
|
|
|
m4_define([_AS_LINENO_WORKS],
|
2001-11-01 04:07:48 +08:00
|
|
|
[
|
2001-10-27 03:52:43 +08:00
|
|
|
as_lineno_1=$LINENO
|
|
|
|
as_lineno_2=$LINENO
|
|
|
|
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
|
|
|
|
test "x$as_lineno_1" != "x$as_lineno_2" &&
|
2003-11-27 18:04:12 +08:00
|
|
|
test "x$as_lineno_3" = "x$as_lineno_2"])
|
2000-11-29 23:52:02 +08:00
|
|
|
|
2001-10-06 00:12:06 +08:00
|
|
|
# _AS_LINENO_PREPARE
|
|
|
|
# ------------------
|
|
|
|
# If LINENO is not supported by the shell, produce a version of this
|
2001-11-01 03:23:37 +08:00
|
|
|
# script where LINENO is hard coded.
|
2001-10-06 00:12:06 +08:00
|
|
|
# Comparing LINENO against _oline_ is not a good solution, since in
|
|
|
|
# the case of embedded executables (such as config.status within
|
|
|
|
# configure) you'd compare LINENO wrt config.status vs. _oline_ vs
|
2001-11-01 03:23:37 +08:00
|
|
|
# configure.
|
2001-10-06 00:12:06 +08:00
|
|
|
m4_define([_AS_LINENO_PREPARE],
|
2002-04-10 23:58:19 +08:00
|
|
|
[AS_REQUIRE([_AS_CR_PREPARE])dnl
|
2004-01-30 22:29:18 +08:00
|
|
|
AS_DETECT_SUGGESTED([_AS_LINENO_WORKS])
|
2002-04-10 23:58:19 +08:00
|
|
|
_AS_LINENO_WORKS || {
|
2001-11-01 03:23:37 +08:00
|
|
|
|
|
|
|
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
|
|
|
|
# uniformly replaced by the line number. The first 'sed' inserts a
|
2004-01-05 15:43:48 +08:00
|
|
|
# line-number line after each line using $LINENO; the second 'sed'
|
|
|
|
# does the real work. The second script uses 'N' to pair each
|
|
|
|
# line-number line with the line containing $LINENO, and appends
|
|
|
|
# trailing '-' during substitution so that $LINENO is not a special
|
|
|
|
# case at line end.
|
2001-11-01 03:23:37 +08:00
|
|
|
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
|
2004-01-05 15:43:48 +08:00
|
|
|
# scripts with optimization help from Paolo Bonzini. Blame Lee
|
|
|
|
# E. McMahon (1931-1989) for sed's syntax. :-)
|
|
|
|
sed -n '
|
|
|
|
p
|
|
|
|
/[[$]]LINENO/=
|
|
|
|
' <$as_myself |
|
2001-11-01 03:23:37 +08:00
|
|
|
sed '
|
2004-01-05 15:43:48 +08:00
|
|
|
s,[[$]]LINENO.*,&-,
|
|
|
|
t lineno
|
|
|
|
b
|
|
|
|
: lineno
|
2001-11-01 03:23:37 +08:00
|
|
|
N
|
|
|
|
: loop
|
2004-01-05 15:43:48 +08:00
|
|
|
s,[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\),\2\1\2,
|
2001-11-01 03:23:37 +08:00
|
|
|
t loop
|
2004-01-05 15:43:48 +08:00
|
|
|
s,-\n.*,,
|
2001-11-01 03:23:37 +08:00
|
|
|
' >$as_me.lineno &&
|
|
|
|
chmod +x $as_me.lineno ||
|
|
|
|
AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
|
2001-10-06 00:12:06 +08:00
|
|
|
|
|
|
|
# Don't try to exec as it changes $[0], causing all sort of problems
|
|
|
|
# (the dirname of $[0] is not the place where we might find the
|
|
|
|
# original and so on. Autoconf is especially sensible to this).
|
|
|
|
. ./$as_me.lineno
|
|
|
|
# Exit status is that of the last command.
|
|
|
|
exit
|
2001-10-27 03:52:43 +08:00
|
|
|
}
|
2001-10-06 00:12:06 +08:00
|
|
|
])# _AS_LINENO_PREPARE
|
|
|
|
|
|
|
|
|
2001-01-27 21:19:14 +08:00
|
|
|
# _AS_LN_S_PREPARE
|
|
|
|
# ----------------
|
|
|
|
# Don't use conftest.sym to avoid filename issues on DJGPP, where this
|
2001-03-30 20:49:36 +08:00
|
|
|
# would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest'
|
2001-02-25 18:44:37 +08:00
|
|
|
# as base name to avoid prohibiting concurrency (e.g., concurrent
|
|
|
|
# config.statuses).
|
2001-01-27 21:19:14 +08:00
|
|
|
m4_defun([_AS_LN_S_PREPARE],
|
2001-02-25 18:44:37 +08:00
|
|
|
[rm -f conf$$ conf$$.exe conf$$.file
|
|
|
|
echo >conf$$.file
|
|
|
|
if ln -s conf$$.file conf$$ 2>/dev/null; then
|
2001-01-27 21:19:14 +08:00
|
|
|
# We could just check for DJGPP; but this test a) works b) is more generic
|
|
|
|
# and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
|
2001-02-25 18:44:37 +08:00
|
|
|
if test -f conf$$.exe; then
|
2001-01-27 21:19:14 +08:00
|
|
|
# Don't use ln at all; we don't have any links
|
|
|
|
as_ln_s='cp -p'
|
|
|
|
else
|
|
|
|
as_ln_s='ln -s'
|
|
|
|
fi
|
2001-02-25 18:44:37 +08:00
|
|
|
elif ln conf$$.file conf$$ 2>/dev/null; then
|
2001-01-27 21:19:14 +08:00
|
|
|
as_ln_s=ln
|
|
|
|
else
|
|
|
|
as_ln_s='cp -p'
|
|
|
|
fi
|
2001-02-25 18:44:37 +08:00
|
|
|
rm -f conf$$ conf$$.exe conf$$.file
|
2001-01-27 21:19:14 +08:00
|
|
|
])# _AS_LN_S_PREPARE
|
|
|
|
|
|
|
|
|
2001-09-10 15:17:41 +08:00
|
|
|
# _AS_PATH_SEPARATOR_PREPARE
|
|
|
|
# --------------------------
|
|
|
|
# Compute the path separator.
|
2001-10-08 16:22:09 +08:00
|
|
|
m4_defun([_AS_PATH_SEPARATOR_PREPARE],
|
2001-09-10 15:17:41 +08:00
|
|
|
[# The user is always right.
|
|
|
|
if test "${PATH_SEPARATOR+set}" != set; then
|
2002-10-11 17:49:31 +08:00
|
|
|
echo "#! /bin/sh" >conf$$.sh
|
|
|
|
echo "exit 0" >>conf$$.sh
|
|
|
|
chmod +x conf$$.sh
|
|
|
|
if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
|
2001-09-10 15:17:41 +08:00
|
|
|
PATH_SEPARATOR=';'
|
|
|
|
else
|
|
|
|
PATH_SEPARATOR=:
|
|
|
|
fi
|
2002-10-11 17:49:31 +08:00
|
|
|
rm -f conf$$.sh
|
2001-09-10 15:17:41 +08:00
|
|
|
fi
|
|
|
|
])# _AS_PATH_SEPARATOR_PREPARE
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_PATH_WALK([PATH = $PATH], BODY)
|
|
|
|
# -----------------------------------
|
|
|
|
# Walk through PATH running BODY for each `as_dir'.
|
|
|
|
#
|
|
|
|
# Still very private as its interface looks quite bad.
|
|
|
|
#
|
|
|
|
# `$as_dummy' forces splitting on constant user-supplied paths.
|
2002-04-04 21:35:05 +08:00
|
|
|
# POSIX.2 field splitting is done only on the result of word
|
|
|
|
# expansions, not on literal text. This closes a longstanding sh security
|
|
|
|
# hole. Optimize it away when not needed, i.e., if there are no literal
|
|
|
|
# path separators.
|
2001-09-10 15:17:41 +08:00
|
|
|
m4_define([_AS_PATH_WALK],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
|
|
|
|
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
|
2002-04-04 21:35:05 +08:00
|
|
|
m4_bmatch([$1], [[:;]],
|
2001-09-10 15:17:41 +08:00
|
|
|
[as_dummy="$1"
|
|
|
|
for as_dir in $as_dummy],
|
|
|
|
[for as_dir in m4_default([$1], [$PATH])])
|
|
|
|
do
|
|
|
|
IFS=$as_save_IFS
|
|
|
|
test -z "$as_dir" && as_dir=.
|
|
|
|
$2
|
|
|
|
done
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2001-01-27 21:19:14 +08:00
|
|
|
# AS_LN_S(FILE, LINK)
|
|
|
|
# -------------------
|
|
|
|
# FIXME: Should we add the glue code to handle properly relative symlinks
|
|
|
|
# simulated with `ln' or `cp'?
|
|
|
|
m4_defun([AS_LN_S],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_LN_S_PREPARE])dnl
|
2001-01-27 21:19:14 +08:00
|
|
|
$as_ln_s $1 $2
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2002-03-19 14:23:15 +08:00
|
|
|
# _AS_MKDIR_P_PREPARE
|
|
|
|
# -------------------
|
|
|
|
m4_defun([_AS_MKDIR_P_PREPARE],
|
|
|
|
[if mkdir -p . 2>/dev/null; then
|
|
|
|
as_mkdir_p=:
|
|
|
|
else
|
2003-09-29 03:02:41 +08:00
|
|
|
test -d ./-p && rmdir ./-p
|
2002-03-19 14:23:15 +08:00
|
|
|
as_mkdir_p=false
|
|
|
|
fi
|
|
|
|
])# _AS_MKDIR_P_PREPARE
|
|
|
|
|
2000-11-29 23:52:02 +08:00
|
|
|
# AS_MKDIR_P(PATH)
|
|
|
|
# ----------------
|
|
|
|
# Emulate `mkdir -p' with plain `mkdir'.
|
|
|
|
m4_define([AS_MKDIR_P],
|
2002-03-19 14:23:15 +08:00
|
|
|
[AS_REQUIRE([_$0_PREPARE])dnl
|
|
|
|
{ if $as_mkdir_p; then
|
2004-01-15 04:27:30 +08:00
|
|
|
test -d $1 || mkdir -p $1
|
2002-03-19 14:23:15 +08:00
|
|
|
else
|
|
|
|
as_dir=$1
|
|
|
|
as_dirs=
|
|
|
|
while test ! -d "$as_dir"; do
|
|
|
|
as_dirs="$as_dir $as_dirs"
|
|
|
|
as_dir=`AS_DIRNAME("$as_dir")`
|
|
|
|
done
|
|
|
|
test ! -n "$as_dirs" || mkdir $as_dirs
|
|
|
|
fi || AS_ERROR([cannot create directory $1]); }
|
2000-11-29 23:52:02 +08:00
|
|
|
])# AS_MKDIR_P
|
|
|
|
|
|
|
|
|
2001-02-25 18:43:34 +08:00
|
|
|
# _AS_BROKEN_TEST_PREPARE
|
|
|
|
# -----------------------
|
|
|
|
# FIXME: This does not work and breaks way too many things.
|
|
|
|
#
|
2001-01-24 16:24:44 +08:00
|
|
|
# Find out ahead of time whether we want test -x (preferred) or test -f
|
|
|
|
# to check whether a file is executable.
|
2001-02-25 18:43:34 +08:00
|
|
|
m4_defun([_AS_BROKEN_TEST_PREPARE],
|
2001-01-24 16:24:44 +08:00
|
|
|
[# Find out how to test for executable files. Don't use a zero-byte file,
|
|
|
|
# as systems may use methods other than mode bits to determine executability.
|
2001-02-25 18:44:37 +08:00
|
|
|
cat >conf$$.file <<_ASEOF
|
2001-01-24 16:24:44 +08:00
|
|
|
@%:@! /bin/sh
|
|
|
|
exit 0
|
|
|
|
_ASEOF
|
2001-02-25 18:44:37 +08:00
|
|
|
chmod +x conf$$.file
|
|
|
|
if test -x conf$$.file >/dev/null 2>&1; then
|
2001-01-24 16:24:44 +08:00
|
|
|
as_executable_p="test -x"
|
2001-02-25 18:44:37 +08:00
|
|
|
elif test -f conf$$.file >/dev/null 2>&1; then
|
2001-01-24 16:24:44 +08:00
|
|
|
as_executable_p="test -f"
|
|
|
|
else
|
|
|
|
AS_ERROR([cannot check whether a file is executable on this system])
|
|
|
|
fi
|
2001-02-25 18:44:37 +08:00
|
|
|
rm -f conf$$.file
|
2001-02-25 18:43:34 +08:00
|
|
|
])# _AS_BROKEN_TEST_PREPARE
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_TEST_PREPARE
|
|
|
|
# ----------------
|
|
|
|
m4_defun([_AS_TEST_PREPARE],
|
|
|
|
[as_executable_p="test -f"
|
|
|
|
])# _AS_BROKEN_TEST_PREPARE
|
|
|
|
|
|
|
|
|
2003-11-04 16:32:06 +08:00
|
|
|
# AS_SET_CATFILE(VAR, DIR-NAME, FILE-NAME)
|
|
|
|
# ----------------------------------------
|
|
|
|
# Set VAR to DIR-NAME/FILE-NAME.
|
|
|
|
# Optimize the common case where $2 or $3 is '.'.
|
|
|
|
m4_define([AS_SET_CATFILE],
|
|
|
|
[case $2 in
|
|
|
|
.) $1=$3;;
|
|
|
|
*)
|
|
|
|
case $3 in
|
|
|
|
.) $1=$2;;
|
|
|
|
[[\\/]]* | ?:[[\\/]]* ) $1=$3;;
|
|
|
|
*) $1=$2/$3;;
|
|
|
|
esac;;
|
|
|
|
esac[]dnl
|
|
|
|
])# AS_SET_CATFILE
|
2001-02-25 18:43:34 +08:00
|
|
|
|
2001-01-24 16:24:44 +08:00
|
|
|
|
|
|
|
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
|
|
|
|
## ------------------ ##
|
2000-11-14 19:01:44 +08:00
|
|
|
## 5. Common idioms. ##
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
## ------------------ ##
|
|
|
|
|
|
|
|
# This section is lexicographically sorted.
|
|
|
|
|
2001-01-15 15:29:48 +08:00
|
|
|
|
2001-08-27 15:03:48 +08:00
|
|
|
# AS_BOX(MESSAGE, [FRAME-CHARACTER = `-'])
|
2001-01-15 15:29:48 +08:00
|
|
|
# ----------------------------------------
|
|
|
|
# Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which
|
|
|
|
# must not be `/').
|
|
|
|
m4_define([AS_BOX],
|
|
|
|
[AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[_AS_BOX_LITERAL($@)],
|
|
|
|
[_AS_BOX_INDIR($@)])])
|
2001-01-15 15:29:48 +08:00
|
|
|
|
2001-08-27 15:03:48 +08:00
|
|
|
# _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-'])
|
2001-01-15 15:29:48 +08:00
|
|
|
# -------------------------------------------------
|
|
|
|
m4_define([_AS_BOX_LITERAL],
|
|
|
|
[cat <<\_ASBOX
|
2001-08-27 15:03:48 +08:00
|
|
|
m4_text_box($@)
|
2001-01-15 15:29:48 +08:00
|
|
|
_ASBOX])
|
|
|
|
|
2001-08-27 15:03:48 +08:00
|
|
|
# _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-'])
|
2001-01-15 15:29:48 +08:00
|
|
|
# -----------------------------------------------
|
|
|
|
m4_define([_AS_BOX_INDIR],
|
2001-08-27 15:03:48 +08:00
|
|
|
[sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX
|
|
|
|
@%:@@%:@ $1 @%:@@%:@
|
2001-01-15 15:29:48 +08:00
|
|
|
_ASBOX])
|
|
|
|
|
|
|
|
|
2001-01-15 15:29:24 +08:00
|
|
|
# AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL)
|
|
|
|
# -----------------------------------------------------
|
|
|
|
# If EXPRESSION has shell indirections ($var or `expr`), expand
|
|
|
|
# IF-INDIR, else IF-NOT-INDIR.
|
|
|
|
# This is an *approximation*: for instance EXPRESSION = `\$' is
|
|
|
|
# definitely a literal, but will not be recognized as such.
|
|
|
|
m4_define([AS_LITERAL_IF],
|
* lib/autoconf/autoconf.m4, lib/autoconf/general.m4,
* lib/autoconf/libs.m4, lib/autoconf/status.m4,
* lib/autoconf/types.m4, lib/autotest/general.m4,
* lib/m4sugar/m4sh.m4, lib/m4sugar/m4sugar.m4, tests/atspecific.m4,
* tests/torture.at: Rename m4_regexp, m4_patsubst, and m4_match to
m4_bregexp, m4_bpatsubst, and m4_bmatch.
* doc/autoconf.texi (Redefined M4 Macros): Adjust.
2001-10-08 16:22:33 +08:00
|
|
|
[m4_bmatch([$1], [[`$]],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[$3], [$2])])
|
2001-01-15 15:29:24 +08:00
|
|
|
|
|
|
|
|
2002-09-27 16:20:26 +08:00
|
|
|
# AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]])
|
|
|
|
# -------------------------------------------------
|
|
|
|
# Create as safely as possible a temporary directory in DIRECTORY
|
|
|
|
# which name is inspired by PREFIX (should be 2-4 chars max), and set
|
|
|
|
# trap mechanisms to remove it.
|
2000-11-02 01:32:17 +08:00
|
|
|
m4_define([AS_TMPDIR],
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
[# Create a temporary directory, and hook for its removal unless debugging.
|
|
|
|
$debug ||
|
|
|
|
{
|
2004-01-05 15:05:22 +08:00
|
|
|
trap 'exit_status=$?; rm -f -r $tmp && exit $exit_status' 0
|
2001-06-02 13:49:54 +08:00
|
|
|
trap 'AS_EXIT([1])' 1 2 13 15
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Create a (secure) tmp directory for tmp files.
|
2002-09-27 16:20:26 +08:00
|
|
|
m4_if([$2], [], [: ${TMPDIR=/tmp}])
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
{
|
2002-09-27 16:20:26 +08:00
|
|
|
tmp=`(umask 077 && mktemp -d -q "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
test -n "$tmp" && test -d "$tmp"
|
|
|
|
} ||
|
|
|
|
{
|
2002-09-27 16:20:26 +08:00
|
|
|
tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
(umask 077 && mkdir $tmp)
|
|
|
|
} ||
|
|
|
|
{
|
2002-09-27 16:20:26 +08:00
|
|
|
echo "$me: cannot create a temporary directory in m4_default([$2], [$TMPDIR])" >&2
|
2000-10-30 20:29:36 +08:00
|
|
|
AS_EXIT
|
Move the Autoconf independent shell macros into the file
`shell.m4' and the name space `AS_*'.
* acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET)
(AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to...
* shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P)
(AS_DIRNAME): here, a new file.
Adjust all dependencies.
* tests/base.m4 (m4_wrap): Eve out into...
* tests/shell.m4: here, new file.
* tests/base.m4 (AC_SHELL_MKDIR_P)
(AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into...
* tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED):
here, new file.
Adjust the test suite.
2000-10-26 01:51:10 +08:00
|
|
|
}dnl
|
|
|
|
])# AS_TMPDIR
|
2001-01-16 18:25:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
# AS_UNAME
|
|
|
|
# --------
|
|
|
|
# Try to describe this machine. Meant for logs.
|
|
|
|
m4_define([AS_UNAME],
|
|
|
|
[{
|
|
|
|
cat <<_ASUNAME
|
2001-08-27 15:03:48 +08:00
|
|
|
m4_text_box([Platform.])
|
2001-01-16 18:25:57 +08:00
|
|
|
|
|
|
|
hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
|
|
|
|
uname -m = `(uname -m) 2>/dev/null || echo unknown`
|
|
|
|
uname -r = `(uname -r) 2>/dev/null || echo unknown`
|
|
|
|
uname -s = `(uname -s) 2>/dev/null || echo unknown`
|
|
|
|
uname -v = `(uname -v) 2>/dev/null || echo unknown`
|
|
|
|
|
|
|
|
/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
|
|
|
|
/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
|
|
|
|
|
|
|
|
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
|
|
|
|
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
|
|
|
|
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
|
|
|
|
hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
|
|
|
|
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
|
|
|
|
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
|
|
|
|
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
|
|
|
|
|
|
|
|
_ASUNAME
|
2001-09-07 15:20:26 +08:00
|
|
|
|
2001-09-10 15:17:41 +08:00
|
|
|
_AS_PATH_WALK([$PATH], [echo "PATH: $as_dir"])
|
2001-01-16 18:25:57 +08:00
|
|
|
}])
|
2001-01-19 22:35:06 +08:00
|
|
|
|
|
|
|
|
2003-03-27 21:18:34 +08:00
|
|
|
# AS_HELP_STRING(LHS, RHS, [COLUMN])
|
|
|
|
# ----------------------------------
|
|
|
|
#
|
|
|
|
# Format a help string so that it looks pretty when
|
|
|
|
# the user executes "script --help". This macro takes three
|
|
|
|
# arguments, a "left hand side" (LHS), a "right hand side" (RHS), and
|
|
|
|
# the COLUMN which is a string of white spaces which leads to the
|
|
|
|
# the RHS column (default: 26 white spaces).
|
|
|
|
#
|
|
|
|
# The resulting string is suitable for use in other macros that require
|
|
|
|
# a help string (e.g. AC_ARG_WITH).
|
|
|
|
#
|
|
|
|
# Here is the sample string from the Autoconf manual (Node: External
|
|
|
|
# Software) which shows the proper spacing for help strings.
|
|
|
|
#
|
|
|
|
# --with-readline support fancy command line editing
|
|
|
|
# ^ ^ ^
|
|
|
|
# | | |
|
|
|
|
# | column 2 column 26
|
|
|
|
# |
|
|
|
|
# column 0
|
|
|
|
#
|
|
|
|
# A help string is made up of a "left hand side" (LHS) and a "right
|
|
|
|
# hand side" (RHS). In the example above, the LHS is
|
|
|
|
# "--with-readline", while the RHS is "support fancy command line
|
|
|
|
# editing".
|
|
|
|
#
|
|
|
|
# If the LHS is contains more than (COLUMN - 3) characters, then the LHS
|
|
|
|
# is terminated with a newline so that the RHS starts on a line of its
|
|
|
|
# own beginning with COLUMN. In the default case, this corresponds to
|
|
|
|
# an LHS with more than 23 characters.
|
|
|
|
#
|
|
|
|
# Therefore, in the example, if the LHS were instead
|
|
|
|
# "--with-readline-blah-blah-blah", then the AS_HELP_STRING macro would
|
|
|
|
# expand into:
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# --with-readline-blah-blah-blah
|
|
|
|
# ^ ^ support fancy command line editing
|
|
|
|
# | | ^
|
|
|
|
# | column 2 |
|
|
|
|
# column 0 column 26
|
|
|
|
#
|
|
|
|
m4_define([AS_HELP_STRING],
|
|
|
|
[m4_pushdef([AS_Prefix], m4_default([$3], [ ]))dnl
|
|
|
|
m4_pushdef([AS_Prefix_Format],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[ %-]m4_eval(m4_len(AS_Prefix) - 3)[s ])dnl [ %-23s ]
|
2003-03-27 21:18:34 +08:00
|
|
|
m4_text_wrap([$2], AS_Prefix, m4_format(AS_Prefix_Format, [$1]))dnl
|
|
|
|
m4_popdef([AS_Prefix_Format])dnl
|
|
|
|
m4_popdef([AS_Prefix])dnl
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2001-01-19 22:35:06 +08:00
|
|
|
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
## ------------------------------------ ##
|
|
|
|
## Common m4/sh character translation. ##
|
|
|
|
## ------------------------------------ ##
|
|
|
|
|
|
|
|
# The point of this section is to provide high level macros comparable
|
|
|
|
# to m4's `translit' primitive, but m4/sh polymorphic.
|
|
|
|
# Transliteration of literal strings should be handled by m4, while
|
|
|
|
# shell variables' content will be translated at runtime (tr or sed).
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_CR_PREPARE
|
|
|
|
# --------------
|
|
|
|
# Output variables defining common character ranges.
|
|
|
|
# See m4_cr_letters etc.
|
|
|
|
m4_defun([_AS_CR_PREPARE],
|
|
|
|
[# Avoid depending upon Character Ranges.
|
|
|
|
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
|
|
|
|
as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
|
|
as_cr_Letters=$as_cr_letters$as_cr_LETTERS
|
|
|
|
as_cr_digits='0123456789'
|
|
|
|
as_cr_alnum=$as_cr_Letters$as_cr_digits
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# _AS_TR_SH_PREPARE
|
|
|
|
# -----------------
|
|
|
|
m4_defun([_AS_TR_SH_PREPARE],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_CR_PREPARE])dnl
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
# Sed expression to map a string onto a valid variable name.
|
2003-10-21 07:24:37 +08:00
|
|
|
as_tr_sh="eval sed 'y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g'"
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_TR_SH(EXPRESSION)
|
|
|
|
# --------------------
|
|
|
|
# Transform EXPRESSION into a valid shell variable name.
|
|
|
|
# sh/m4 polymorphic.
|
|
|
|
# Be sure to update the definition of `$as_tr_sh' if you change this.
|
|
|
|
m4_defun([AS_TR_SH],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_$0_PREPARE])dnl
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[m4_bpatsubst(m4_translit([[$1]], [*+], [pp]),
|
|
|
|
[[^a-zA-Z0-9_]], [_])],
|
|
|
|
[`echo "$1" | $as_tr_sh`])])
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# _AS_TR_CPP_PREPARE
|
|
|
|
# ------------------
|
|
|
|
m4_defun([_AS_TR_CPP_PREPARE],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_CR_PREPARE])dnl
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
# Sed expression to map a string onto a valid CPP name.
|
2003-10-21 07:24:37 +08:00
|
|
|
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g'"
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_TR_CPP(EXPRESSION)
|
|
|
|
# ---------------------
|
|
|
|
# Map EXPRESSION to an upper case string which is valid as rhs for a
|
|
|
|
# `#define'. sh/m4 polymorphic. Be sure to update the definition
|
|
|
|
# of `$as_tr_cpp' if you change this.
|
|
|
|
m4_defun([AS_TR_CPP],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_$0_PREPARE])dnl
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[m4_bpatsubst(m4_translit([[$1]],
|
|
|
|
[*abcdefghijklmnopqrstuvwxyz],
|
|
|
|
[PABCDEFGHIJKLMNOPQRSTUVWXYZ]),
|
|
|
|
[[^A-Z0-9_]], [_])],
|
|
|
|
[`echo "$1" | $as_tr_cpp`])])
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# _AS_TR_PREPARE
|
|
|
|
# --------------
|
|
|
|
m4_defun([_AS_TR_PREPARE],
|
2001-10-08 16:22:09 +08:00
|
|
|
[AS_REQUIRE([_AS_TR_SH_PREPARE])dnl
|
|
|
|
AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## --------------------------------------------------- ##
|
|
|
|
## Common m4/sh handling of variables (indirections). ##
|
|
|
|
## --------------------------------------------------- ##
|
|
|
|
|
|
|
|
|
|
|
|
# The purpose of this section is to provide a uniform API for
|
|
|
|
# reading/setting sh variables with or without indirection.
|
|
|
|
# Typically, one can write
|
|
|
|
# AS_VAR_SET(var, val)
|
|
|
|
# or
|
|
|
|
# AS_VAR_SET(as_$var, val)
|
|
|
|
# and expect the right thing to happen.
|
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_SET(VARIABLE, VALUE)
|
|
|
|
# ---------------------------
|
|
|
|
# Set the VALUE of the shell VARIABLE.
|
|
|
|
# If the variable contains indirections (e.g. `ac_cv_func_$ac_func')
|
|
|
|
# perform whenever possible at m4 level, otherwise sh level.
|
|
|
|
m4_define([AS_VAR_SET],
|
|
|
|
[AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[$1=$2],
|
|
|
|
[eval "$1=AS_ESCAPE([$2])"])])
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_GET(VARIABLE)
|
|
|
|
# --------------------
|
|
|
|
# Get the value of the shell VARIABLE.
|
|
|
|
# Evaluates to $VARIABLE if there are no indirection in VARIABLE,
|
|
|
|
# else into the appropriate `eval' sequence.
|
|
|
|
m4_define([AS_VAR_GET],
|
|
|
|
[AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[$$1],
|
|
|
|
[`eval echo '${'m4_bpatsubst($1, [[\\`]], [\\\&])'}'`])])
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_TEST_SET(VARIABLE)
|
|
|
|
# -------------------------
|
|
|
|
# Expands into the `test' expression which is true if VARIABLE
|
|
|
|
# is set. Polymorphic. Should be dnl'ed.
|
|
|
|
m4_define([AS_VAR_TEST_SET],
|
|
|
|
[AS_LITERAL_IF([$1],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[test "${$1+set}" = set],
|
|
|
|
[eval "test \"\${$1+set}\" = set"])])
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE)
|
|
|
|
# ------------------------------------------
|
|
|
|
# Implement a shell `if-then-else' depending whether VARIABLE is set
|
|
|
|
# or not. Polymorphic.
|
|
|
|
m4_define([AS_VAR_SET_IF],
|
|
|
|
[AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_PUSHDEF and AS_VAR_POPDEF
|
|
|
|
# --------------------------------
|
|
|
|
#
|
|
|
|
|
|
|
|
# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at
|
|
|
|
# other moments, the same code may have to get the value from a
|
|
|
|
# variable (e.g., `ac_header'). To have a uniform handling of both
|
|
|
|
# cases, when a new value is about to be processed, declare a local
|
|
|
|
# variable, e.g.:
|
|
|
|
#
|
|
|
|
# AS_VAR_PUSHDEF([header], [ac_cv_header_$1])
|
|
|
|
#
|
|
|
|
# and then in the body of the macro, use `header' as is. It is of
|
|
|
|
# first importance to use `AS_VAR_*' to access this variable. Don't
|
|
|
|
# quote its name: it must be used right away by m4.
|
|
|
|
#
|
|
|
|
# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is
|
|
|
|
# in fact the value `ac_cv_header_stdlib_h'. If `$1' was indirect,
|
|
|
|
# then `header's value in m4 is in fact `$ac_header', the shell
|
|
|
|
# variable that holds all of the magic to get the expansion right.
|
|
|
|
#
|
|
|
|
# At the end of the block, free the variable with
|
|
|
|
#
|
|
|
|
# AS_VAR_POPDEF([header])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_PUSHDEF(VARNAME, VALUE)
|
|
|
|
# ------------------------------
|
|
|
|
# Define the m4 macro VARNAME to an accessor to the shell variable
|
|
|
|
# named VALUE. VALUE does not need to be a valid shell variable name:
|
|
|
|
# the transliteration is handled here. To be dnl'ed.
|
|
|
|
m4_define([AS_VAR_PUSHDEF],
|
|
|
|
[AS_LITERAL_IF([$2],
|
* aclocal.m4, bin/autoconf.as, lib/autoconf/autoconf.m4,
* lib/autoconf/autoheader.m4, lib/autoconf/autoupdate.m4,
* lib/autoconf/c.m4, lib/autoconf/fortran.m4,
* lib/autoconf/general.m4, lib/autoconf/headers.m4,
* lib/autoconf/lang.m4, lib/autoconf/libs.m4,
* lib/autoconf/programs.m4, lib/autoconf/specific.m4,
* lib/autoconf/status.m4, lib/autoconf/types.m4,
* lib/autotest/general.m4, lib/m4sugar/m4sugar.m4,
* tests/atspecific.m4, tests/base.at, tests/compile.at,
* tests/foreign.at, tests/m4sh.at, tests/semantics.at,
* tests/tools.at, tests/torture.at:
Whitespace clean up.
Suggested by Jim Meyering.
2003-05-22 21:24:04 +08:00
|
|
|
[m4_pushdef([$1], [AS_TR_SH($2)])],
|
|
|
|
[as_$1=AS_TR_SH($2)
|
* acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET)
(AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP)
(AC_TR_SH): Move as...
* m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET)
(AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP)
(AS_TR_SH): these.
(_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE)
(_AS_TR_SH_PREPARE): New.
(AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE.
* tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified.
2001-06-05 00:07:23 +08:00
|
|
|
m4_pushdef([$1], [$as_[$1]])])])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_VAR_POPDEF(VARNAME)
|
|
|
|
# ----------------------
|
|
|
|
# Free the shell variable accessor VARNAME. To be dnl'ed.
|
|
|
|
m4_define([AS_VAR_POPDEF],
|
|
|
|
[m4_popdef([$1])])
|
|
|
|
|
|
|
|
|
2001-01-19 22:35:06 +08:00
|
|
|
## ----------------- ##
|
|
|
|
## Setting M4sh up. ##
|
|
|
|
## ----------------- ##
|
|
|
|
|
|
|
|
|
2004-01-30 22:29:18 +08:00
|
|
|
# _AS_SHELL_FN_SPY
|
|
|
|
# ----------------
|
|
|
|
# This temporary macro checks "in the wild" for shells that do
|
|
|
|
# not support shell functions.
|
|
|
|
m4_define([_AS_SHELL_FN_SPY],
|
|
|
|
[AS_DETECT_SUGGESTED([_AS_SHELL_FN_WORK])
|
|
|
|
_AS_RUN([_AS_SHELL_FN_WORK]) || {
|
|
|
|
echo No shell found that supports shell functions.
|
|
|
|
echo Please tell autoconf@gnu.org about your system,
|
|
|
|
echo including any error possibly output before this
|
|
|
|
echo message
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
# AS_INIT
|
|
|
|
# -------
|
|
|
|
# Initialize m4sh.
|
2001-01-19 22:35:06 +08:00
|
|
|
m4_define([AS_INIT],
|
|
|
|
[m4_init
|
|
|
|
|
|
|
|
# Forbidden tokens and exceptions.
|
|
|
|
m4_pattern_forbid([^_?AS_])
|
2001-10-08 16:20:59 +08:00
|
|
|
|
2002-04-10 23:58:19 +08:00
|
|
|
# Bangshe and minimal initialization.
|
2001-10-08 16:20:59 +08:00
|
|
|
m4_divert_text([BINSH], [@%:@! /bin/sh])
|
2004-01-30 22:29:18 +08:00
|
|
|
m4_divert_text([M4SH-SANITIZE], [AS_SHELL_SANITIZE])
|
|
|
|
AS_REQUIRE([_AS_SHELL_FN_SPY])
|
2001-10-08 16:20:59 +08:00
|
|
|
|
|
|
|
# Let's go!
|
|
|
|
m4_wrap([m4_divert_pop([BODY])[]])
|
|
|
|
m4_divert_push([BODY])[]dnl
|
2001-01-19 22:35:06 +08:00
|
|
|
])
|