+2000-03-13 Akim Demaille <akim@epita.fr>
+
+ Simplify the diversions naming system.
+ Suggested by Alexandre Oliva and Lars J. Aas
+
+ * libm4.m4 (ifndef): New macro.
+ * acgeneral.m4 (AC_DIVERT): New macro, maps a diversion name to
+ its value. The diversions now have a short name, e.g., `NOTICE',
+ instead of the former macros which had long names, e.g.,
+ `AC_DIVERSION_NOTICE'.
+ (AC_DIVERT_PUSH): Adjust.
+ (AC_DIVERT_POP): Use ifndef.
+ (AC_DIVERSION_CURRENT): Rename as `AC_DIVERT_DIVERSION' to stay
+ within the `AC_DIVERT' name domain.
+ Adjust all callers.
+ * acspecific.m4: Adjust all callers.
+
2000-03-13 Akim Demaille <akim@epita.fr>
* doc/autoconf.texi (Invoking autoconf): Update documentation of
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
#
+m4_namespace_push(autoconf)
+
+
## ---------------- ##
## The diversions. ##
## ---------------- ##
-m4_namespace_push(autoconf)
-# m4 output diversions. We let m4 output them all in order at the end,
-# except that we explicitly undivert AC_DIVERSION_ICMDS.
-
-define(AC_DIVERSION_KILL, -1)# suppress output
-define(AC_DIVERSION_BINSH, 0)# AC_REQUIRE'd #! /bin/sh line
-define(AC_DIVERSION_NOTICE, 1)# copyright notice
-define(AC_DIVERSION_DEFAULTS, 2)# early initializations (defaults)
-define(AC_DIVERSION_INIT_PARSE_ARGS, 3)# initialization code
-define(AC_DIVERSION_HELP_BEGIN, 4)# Handling `configure --help'
-define(AC_DIVERSION_HELP_ENABLE, 5)# Help msg from AC_ARG_ENABLE
-define(AC_DIVERSION_HELP_WITH, 6)# Help msg from AC_ARG_WITH
-define(AC_DIVERSION_HELP_VAR, 7)# Help msg from AC_ARG_VAR
-define(AC_DIVERSION_HELP_END, 8)# Tail of the handling of --help
-define(AC_DIVERSION_VERSION_BEGIN, 9)# Copyright notice for --version.
-define(AC_DIVERSION_VERSION_END, 10)# Tail of the handling of --version.
-define(AC_DIVERSION_INIT_PREPARE, 11)# trail of initialization code
-define(AC_DIVERSION_NORMAL_4, 12)# AC_REQUIRE'd code, 4 level deep
-define(AC_DIVERSION_NORMAL_3, 13)# AC_REQUIRE'd code, 3 level deep
-define(AC_DIVERSION_NORMAL_2, 14)# AC_REQUIRE'd code, 2 level deep
-define(AC_DIVERSION_NORMAL_1, 15)# AC_REQUIRE'd code, 1 level deep
-define(AC_DIVERSION_NORMAL, 16)# the tests and output code
-define(AC_DIVERSION_ICMDS, 17)# extra initialization in config.status
-
-
-# AC_DIVERT_PUSH(STREAM)
-# ----------------------
-# Change the diversion stream to STREAM, while stacking old values.
+# We heavily use m4's diversions both for the initializations and for
+# required macros (see AC_REQUIRE), because in both cases we have to
+# issue high in `configure' something which is discovered late.
+#
+# KILL is only used to suppress output.
+#
+# The initialization layers of `configure'. We let m4 undivert them
+# by itself, when it reaches the end of `configure.in'. They are.
+#
+# - BINSH
+# AC_REQUIRE'd #! /bin/sh line
+# - NOTICE
+# copyright notice(s)
+# - DEFAULTS
+# early initializations (defaults)
+# - INIT_PARSE_ARGS
+# initialization code, option handling loop.
+# - HELP_BEGIN
+# Handling `configure --help'.
+# - HELP_ENABLE
+# Help msg from AC_ARG_ENABLE.
+# - HELP_WITH
+# Help msg from AC_ARG_WITH.
+# - HELP_VAR
+# Help msg from AC_ARG_VAR.
+# - HELP_END
+# Tail of the handling of --help.
+# - VERSION_BEGIN
+# Copyright notice for --version.
+# - VERSION_END
+# Tail of the handling of --version.
+# - INIT_PREPARE
+# Tail of initialization code.
+#
+#
+# These diversions are used by AC_REQUIRE.
+#
+# - NORMAL_4
+# AC_REQUIRE'd code, 4 level deep
+# - NORMAL_3
+# AC_REQUIRE'd code, 3 level deep
+# - NORMAL_2
+# AC_REQUIRE'd code, 2 level deep
+# - NORMAL_1
+# AC_REQUIRE'd code, 1 level deep
+# - NORMAL
+# the tests and output code
+#
+# Finally, this is just a convenience diversions. Undiverted by hand.
+# - ICMDS
+# extra initialization in config.status
+
+
+# AC_DIVERT(DIVERSION-NAME)
+# -------------------------
+# Convert a diversion name into its number. Otherwise, return
+# DIVERSION-NAME which is supposed to be an actual diversion number.
+define([AC_DIVERT],
+[m4_case([$1],
+ [KILL], -1,
+
+ [BINSH], 0,
+ [NOTICE], 1,
+ [DEFAULTS], 2,
+ [INIT_PARSE_ARGS], 3,
+ [HELP_BEGIN], 4,
+ [HELP_ENABLE], 5,
+ [HELP_WITH], 6,
+ [HELP_VAR], 7,
+ [HELP_END], 8,
+ [VERSION_BEGIN], 9,
+ [VERSION_END], 10,
+ [INIT_PREPARE], 11,
+
+ [NORMAL_4], 20,
+ [NORMAL_3], 21,
+ [NORMAL_2], 22,
+ [NORMAL_1], 23,
+ [NORMAL], 24,
+
+ [ICMDS], 30,
+ [$1])])
+
+
+# AC_DIVERT_PUSH(DIVERSION-NAME)
+# ------------------------------
+# Change the diversion stream to DIVERSION-NAME, while stacking old values.
define(AC_DIVERT_PUSH,
-[pushdef([AC_DIVERSION_CURRENT], $1)dnl
-divert(AC_DIVERSION_CURRENT)dnl
+[pushdef([AC_DIVERT_DIVERSION], AC_DIVERT([$1]))dnl
+divert(AC_DIVERT_DIVERSION)dnl
])
# -------------
# Change the diversion stream to its previous value, unstacking it.
define(AC_DIVERT_POP,
-[popdef([AC_DIVERSION_CURRENT])dnl
-ifelse(AC_DIVERSION_CURRENT,
- [AC_DIVERSION_CURRENT],
- [AC_FATAL([too many AC_DIVERT_POP])])dnl
-divert(AC_DIVERSION_CURRENT)dnl
+[popdef([AC_DIVERT_DIVERSION])dnl
+ifndef([AC_DIVERT_DIVERSION], [AC_FATAL([too many AC_DIVERT_POP])])dnl
+divert(AC_DIVERT_DIVERSION)dnl
])
# Initialize the diversion setup.
-define([AC_DIVERSION_CURRENT], AC_DIVERSION_NORMAL)
+define([AC_DIVERT_DIVERSION], AC_DIVERT([NORMAL]))
# Throw away output until AC_INIT is called.
-pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_KILL)
+pushdef([AC_DIVERT_DIVERSION], AC_DIVERT([KILL]))
# The prologue for Autoconf macros.
define(AC_PRO,
[AC_PROVIDE([$1])dnl
-ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
- [AC_DIVERT_PUSH(m4_eval(AC_DIVERSION_CURRENT - 1))],
- [pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl
+ifelse(AC_DIVERT_DIVERSION, AC_DIVERT([NORMAL]),
+ [AC_DIVERT_PUSH(m4_eval(AC_DIVERT_DIVERSION - 1))],
+ [pushdef([AC_DIVERT_DIVERSION], AC_DIVERT_DIVERSION)])dnl
])
# The Epilogue for Autoconf macros.
define(AC_EPI,
[AC_DIVERT_POP()dnl
-ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
-[undivert(AC_DIVERSION_NORMAL_4)dnl
-undivert(AC_DIVERSION_NORMAL_3)dnl
-undivert(AC_DIVERSION_NORMAL_2)dnl
-undivert(AC_DIVERSION_NORMAL_1)dnl
+ifelse(AC_DIVERT_DIVERSION, AC_DIVERT([NORMAL]),
+[undivert(AC_DIVERT([NORMAL_4]))dnl
+undivert(AC_DIVERT([NORMAL_3]))dnl
+undivert(AC_DIVERT([NORMAL_2]))dnl
+undivert(AC_DIVERT([NORMAL_1]))dnl
])dnl
])
define(AC_REQUIRE,
[AC_PROVIDE_IF([$1],
[],
- [AC_DIVERT_PUSH(m4_eval(AC_DIVERSION_CURRENT - 1))dnl
+ [AC_DIVERT_PUSH(m4_eval(AC_DIVERT_DIVERSION - 1))dnl
$1
AC_DIVERT_POP()dnl
])])
# Try to have only one #! line, so the script doesn't look funny
# for users of AC_REVISION.
AC_DEFUN(_AC_INIT_BINSH,
-[AC_DIVERT_PUSH(AC_DIVERSION_BINSH)dnl
+[AC_DIVERT_PUSH([BINSH])dnl
#! /bin/sh
AC_DIVERT_POP()dnl to KILL
])
# must be run before AC_REVISION.
AC_DEFUN(AC_COPYRIGHT,
[AC_REQUIRE([_AC_INIT_VERSION])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+AC_DIVERT_PUSH([NOTICE])dnl
patsubst([$1], [^], [@%:@ ])
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_VERSION_BEGIN)dnl
+AC_DIVERT_PUSH([VERSION_BEGIN])dnl
$1
AC_DIVERT_POP()dnl
])# _AC_INIT_COPYRIGHT
# -----------------
# Values which defaults can be set from `configure.in'.
AC_DEFUN(_AC_INIT_DEFAULTS,
-[AC_DIVERT_PUSH(AC_DIVERSION_DEFAULTS)dnl
+[AC_DIVERT_PUSH([DEFAULTS])dnl
# Defaults:
ac_default_prefix=/usr/local
@%:@ Any additions from configure.in:
# AC_PREFIX_DEFAULT(PREFIX)
# -------------------------
AC_DEFUN(AC_PREFIX_DEFAULT,
-[AC_DIVERT_PUSH(AC_DIVERSION_DEFAULTS)dnl
+[AC_DIVERT_PUSH([DEFAULTS])dnl
ac_default_prefix=$1
AC_DIVERT_POP()])
# _AC_INIT_PARSE_ARGS
# -------------------
AC_DEFUN(_AC_INIT_PARSE_ARGS,
-[AC_DIVERT_PUSH(AC_DIVERSION_INIT_PARSE_ARGS)dnl
+[AC_DIVERT_PUSH([INIT_PARSE_ARGS])dnl
[
# Initialize some variables set by options.
ac_init_help=false
# -------------
# Handle the `configure --help' message.
define([_AC_INIT_HELP],
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+[AC_DIVERT_PUSH([HELP_BEGIN])dnl
[if $ac_init_help; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<\EOF]
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_HELP_END)dnl
+AC_DIVERT_PUSH([HELP_END])dnl
EOF
exit 0
fi
# ----------------
# Handle the `configure --version' message.
AC_DEFUN([_AC_INIT_VERSION],
-[AC_DIVERT_PUSH(AC_DIVERSION_VERSION_BEGIN)dnl
+[AC_DIVERT_PUSH([VERSION_BEGIN])dnl
if $ac_init_version; then
cat <<\EOF
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_VERSION_END)dnl
+AC_DIVERT_PUSH([VERSION_END])dnl
EOF
exit 0
fi
# UNIQUE-FILE-IN-SOURCE-DIR.
# 6. Required macros (cache, default AC_SUBST etc.)
AC_DEFUN([_AC_INIT_PREPARE],
-[AC_DIVERT_PUSH(AC_DIVERSION_INIT_PREPARE)dnl
+[AC_DIVERT_PUSH([INIT_PREPARE])dnl
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
# File descriptor usage:
[m4_sinclude(acsite.m4)dnl
m4_sinclude(./aclocal.m4)dnl
AC_REQUIRE([_AC_INIT_BINSH])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+AC_DIVERT_PUSH([NOTICE])dnl
# Guess values for system-dependent variables and create Makefiles.
AC_DIVERT_POP()dnl
AC_COPYRIGHT(
# AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ------------------------------------------------------------------------
AC_DEFUN(AC_ARG_ENABLE,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_ENABLE)dnl
+[AC_DIVERT_PUSH([HELP_ENABLE])dnl
AC_EXPAND_ONCE([
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
# AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE])
# --------------------------------------------------------------------
AC_DEFUN(AC_ARG_WITH,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_WITH)dnl
+[AC_DIVERT_PUSH([HELP_WITH])dnl
AC_EXPAND_ONCE([
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
# Register VARNAME as a variable configure should remember, and
# document it in `configure --help'.
AC_DEFUN(AC_ARG_VAR,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_VAR)dnl
+[AC_DIVERT_PUSH([HELP_VAR])dnl
AC_EXPAND_ONCE([
Some influent environment variables:
])[]dnl
# FIXME: Must be run only once. Introduce AC_DEFUN_ONCE?
AC_DEFUN(AC_ARG_PROGRAM,
[dnl Document the options.
-AC_EXPAND_ONCE([AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+AC_EXPAND_ONCE([AC_DIVERT_PUSH([HELP_BEGIN])dnl
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
# --------------------------
AC_DEFUN(AC_REVISION,
[AC_REQUIRE([_AC_INIT_BINSH])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_BINSH)dnl
+AC_DIVERT_PUSH([BINSH])dnl
[# From configure.in] translit([$1], $")
AC_DIVERT_POP()dnl to KILL
])
# Note that this macro does not check if the list $[1] itself
# contains doubles.
define(_AC_CONFIG_UNIQUE,
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
AC_FOREACH([AC_File], [$1],
[pushdef([AC_Dest], patsubst(AC_File, [:.*]))
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS],
# was the case in AC_OUTPUT_COMMANDS.
define(_AC_CONFIG_COMMANDS_INIT,
[ifval([$1],
-[AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl
+[AC_DIVERT_PUSH([ICMDS])dnl
$1
AC_DIVERT_POP()])])
# commands must be associated with a NAME, which should be thought
# as the name of a file the COMMANDS create.
AC_DEFUN([AC_CONFIG_COMMANDS],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_COMMANDS], [ $1])
# AC_LIST_HEADERS_COMMANDS
# esac
AC_DEFUN([AC_CONFIG_HEADERS],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_HEADERS], [ $1])
dnl Register the commands
# Reject DEST=., because it is makes it hard for ./config.status
# to guess the links to establish (`./config.status .').
AC_DEFUN(AC_CONFIG_LINKS,
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
ifelse(regexp([$1], [^\.:\| \.:]), -1,,
[AC_FATAL([$0: invalid destination: `.'])])
# AC_LIST_FILES_COMMANDS
# esac
AC_DEFUN([AC_CONFIG_FILES],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_FILES], [ $1])
dnl Register the commands.
# INIT-COMMANDS section.
#
-undivert(AC_DIVERSION_ICMDS)dnl
+undivert(AC_DIVERT([ICMDS]))dnl
EOF
dnl than not calling it at all
ifset([AC_LIST_FILES],
[AC_OUTPUT_FILES()],
- [AC_DIVERT_PUSH(AC_DIVERSION_KILL)dnl
+ [AC_DIVERT_PUSH([KILL])dnl
AC_OUTPUT_FILES()dnl
AC_DIVERT_POP()])dnl
ifset([AC_LIST_HEADERS],
AC_MSG_CHECKING(for X)
dnl Document the X abnormal options inherited from history.
-AC_EXPAND_ONCE([AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+AC_EXPAND_ONCE([AC_DIVERT_PUSH([HELP_BEGIN])dnl
X features:
--x-includes=DIR X include files are in DIR
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
#
+m4_namespace_push(autoconf)
+
+
## ---------------- ##
## The diversions. ##
## ---------------- ##
-m4_namespace_push(autoconf)
-# m4 output diversions. We let m4 output them all in order at the end,
-# except that we explicitly undivert AC_DIVERSION_ICMDS.
-
-define(AC_DIVERSION_KILL, -1)# suppress output
-define(AC_DIVERSION_BINSH, 0)# AC_REQUIRE'd #! /bin/sh line
-define(AC_DIVERSION_NOTICE, 1)# copyright notice
-define(AC_DIVERSION_DEFAULTS, 2)# early initializations (defaults)
-define(AC_DIVERSION_INIT_PARSE_ARGS, 3)# initialization code
-define(AC_DIVERSION_HELP_BEGIN, 4)# Handling `configure --help'
-define(AC_DIVERSION_HELP_ENABLE, 5)# Help msg from AC_ARG_ENABLE
-define(AC_DIVERSION_HELP_WITH, 6)# Help msg from AC_ARG_WITH
-define(AC_DIVERSION_HELP_VAR, 7)# Help msg from AC_ARG_VAR
-define(AC_DIVERSION_HELP_END, 8)# Tail of the handling of --help
-define(AC_DIVERSION_VERSION_BEGIN, 9)# Copyright notice for --version.
-define(AC_DIVERSION_VERSION_END, 10)# Tail of the handling of --version.
-define(AC_DIVERSION_INIT_PREPARE, 11)# trail of initialization code
-define(AC_DIVERSION_NORMAL_4, 12)# AC_REQUIRE'd code, 4 level deep
-define(AC_DIVERSION_NORMAL_3, 13)# AC_REQUIRE'd code, 3 level deep
-define(AC_DIVERSION_NORMAL_2, 14)# AC_REQUIRE'd code, 2 level deep
-define(AC_DIVERSION_NORMAL_1, 15)# AC_REQUIRE'd code, 1 level deep
-define(AC_DIVERSION_NORMAL, 16)# the tests and output code
-define(AC_DIVERSION_ICMDS, 17)# extra initialization in config.status
-
-
-# AC_DIVERT_PUSH(STREAM)
-# ----------------------
-# Change the diversion stream to STREAM, while stacking old values.
+# We heavily use m4's diversions both for the initializations and for
+# required macros (see AC_REQUIRE), because in both cases we have to
+# issue high in `configure' something which is discovered late.
+#
+# KILL is only used to suppress output.
+#
+# The initialization layers of `configure'. We let m4 undivert them
+# by itself, when it reaches the end of `configure.in'. They are.
+#
+# - BINSH
+# AC_REQUIRE'd #! /bin/sh line
+# - NOTICE
+# copyright notice(s)
+# - DEFAULTS
+# early initializations (defaults)
+# - INIT_PARSE_ARGS
+# initialization code, option handling loop.
+# - HELP_BEGIN
+# Handling `configure --help'.
+# - HELP_ENABLE
+# Help msg from AC_ARG_ENABLE.
+# - HELP_WITH
+# Help msg from AC_ARG_WITH.
+# - HELP_VAR
+# Help msg from AC_ARG_VAR.
+# - HELP_END
+# Tail of the handling of --help.
+# - VERSION_BEGIN
+# Copyright notice for --version.
+# - VERSION_END
+# Tail of the handling of --version.
+# - INIT_PREPARE
+# Tail of initialization code.
+#
+#
+# These diversions are used by AC_REQUIRE.
+#
+# - NORMAL_4
+# AC_REQUIRE'd code, 4 level deep
+# - NORMAL_3
+# AC_REQUIRE'd code, 3 level deep
+# - NORMAL_2
+# AC_REQUIRE'd code, 2 level deep
+# - NORMAL_1
+# AC_REQUIRE'd code, 1 level deep
+# - NORMAL
+# the tests and output code
+#
+# Finally, this is just a convenience diversions. Undiverted by hand.
+# - ICMDS
+# extra initialization in config.status
+
+
+# AC_DIVERT(DIVERSION-NAME)
+# -------------------------
+# Convert a diversion name into its number. Otherwise, return
+# DIVERSION-NAME which is supposed to be an actual diversion number.
+define([AC_DIVERT],
+[m4_case([$1],
+ [KILL], -1,
+
+ [BINSH], 0,
+ [NOTICE], 1,
+ [DEFAULTS], 2,
+ [INIT_PARSE_ARGS], 3,
+ [HELP_BEGIN], 4,
+ [HELP_ENABLE], 5,
+ [HELP_WITH], 6,
+ [HELP_VAR], 7,
+ [HELP_END], 8,
+ [VERSION_BEGIN], 9,
+ [VERSION_END], 10,
+ [INIT_PREPARE], 11,
+
+ [NORMAL_4], 20,
+ [NORMAL_3], 21,
+ [NORMAL_2], 22,
+ [NORMAL_1], 23,
+ [NORMAL], 24,
+
+ [ICMDS], 30,
+ [$1])])
+
+
+# AC_DIVERT_PUSH(DIVERSION-NAME)
+# ------------------------------
+# Change the diversion stream to DIVERSION-NAME, while stacking old values.
define(AC_DIVERT_PUSH,
-[pushdef([AC_DIVERSION_CURRENT], $1)dnl
-divert(AC_DIVERSION_CURRENT)dnl
+[pushdef([AC_DIVERT_DIVERSION], AC_DIVERT([$1]))dnl
+divert(AC_DIVERT_DIVERSION)dnl
])
# -------------
# Change the diversion stream to its previous value, unstacking it.
define(AC_DIVERT_POP,
-[popdef([AC_DIVERSION_CURRENT])dnl
-ifelse(AC_DIVERSION_CURRENT,
- [AC_DIVERSION_CURRENT],
- [AC_FATAL([too many AC_DIVERT_POP])])dnl
-divert(AC_DIVERSION_CURRENT)dnl
+[popdef([AC_DIVERT_DIVERSION])dnl
+ifndef([AC_DIVERT_DIVERSION], [AC_FATAL([too many AC_DIVERT_POP])])dnl
+divert(AC_DIVERT_DIVERSION)dnl
])
# Initialize the diversion setup.
-define([AC_DIVERSION_CURRENT], AC_DIVERSION_NORMAL)
+define([AC_DIVERT_DIVERSION], AC_DIVERT([NORMAL]))
# Throw away output until AC_INIT is called.
-pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_KILL)
+pushdef([AC_DIVERT_DIVERSION], AC_DIVERT([KILL]))
# The prologue for Autoconf macros.
define(AC_PRO,
[AC_PROVIDE([$1])dnl
-ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
- [AC_DIVERT_PUSH(m4_eval(AC_DIVERSION_CURRENT - 1))],
- [pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl
+ifelse(AC_DIVERT_DIVERSION, AC_DIVERT([NORMAL]),
+ [AC_DIVERT_PUSH(m4_eval(AC_DIVERT_DIVERSION - 1))],
+ [pushdef([AC_DIVERT_DIVERSION], AC_DIVERT_DIVERSION)])dnl
])
# The Epilogue for Autoconf macros.
define(AC_EPI,
[AC_DIVERT_POP()dnl
-ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL,
-[undivert(AC_DIVERSION_NORMAL_4)dnl
-undivert(AC_DIVERSION_NORMAL_3)dnl
-undivert(AC_DIVERSION_NORMAL_2)dnl
-undivert(AC_DIVERSION_NORMAL_1)dnl
+ifelse(AC_DIVERT_DIVERSION, AC_DIVERT([NORMAL]),
+[undivert(AC_DIVERT([NORMAL_4]))dnl
+undivert(AC_DIVERT([NORMAL_3]))dnl
+undivert(AC_DIVERT([NORMAL_2]))dnl
+undivert(AC_DIVERT([NORMAL_1]))dnl
])dnl
])
define(AC_REQUIRE,
[AC_PROVIDE_IF([$1],
[],
- [AC_DIVERT_PUSH(m4_eval(AC_DIVERSION_CURRENT - 1))dnl
+ [AC_DIVERT_PUSH(m4_eval(AC_DIVERT_DIVERSION - 1))dnl
$1
AC_DIVERT_POP()dnl
])])
# Try to have only one #! line, so the script doesn't look funny
# for users of AC_REVISION.
AC_DEFUN(_AC_INIT_BINSH,
-[AC_DIVERT_PUSH(AC_DIVERSION_BINSH)dnl
+[AC_DIVERT_PUSH([BINSH])dnl
#! /bin/sh
AC_DIVERT_POP()dnl to KILL
])
# must be run before AC_REVISION.
AC_DEFUN(AC_COPYRIGHT,
[AC_REQUIRE([_AC_INIT_VERSION])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+AC_DIVERT_PUSH([NOTICE])dnl
patsubst([$1], [^], [@%:@ ])
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_VERSION_BEGIN)dnl
+AC_DIVERT_PUSH([VERSION_BEGIN])dnl
$1
AC_DIVERT_POP()dnl
])# _AC_INIT_COPYRIGHT
# -----------------
# Values which defaults can be set from `configure.in'.
AC_DEFUN(_AC_INIT_DEFAULTS,
-[AC_DIVERT_PUSH(AC_DIVERSION_DEFAULTS)dnl
+[AC_DIVERT_PUSH([DEFAULTS])dnl
# Defaults:
ac_default_prefix=/usr/local
@%:@ Any additions from configure.in:
# AC_PREFIX_DEFAULT(PREFIX)
# -------------------------
AC_DEFUN(AC_PREFIX_DEFAULT,
-[AC_DIVERT_PUSH(AC_DIVERSION_DEFAULTS)dnl
+[AC_DIVERT_PUSH([DEFAULTS])dnl
ac_default_prefix=$1
AC_DIVERT_POP()])
# _AC_INIT_PARSE_ARGS
# -------------------
AC_DEFUN(_AC_INIT_PARSE_ARGS,
-[AC_DIVERT_PUSH(AC_DIVERSION_INIT_PARSE_ARGS)dnl
+[AC_DIVERT_PUSH([INIT_PARSE_ARGS])dnl
[
# Initialize some variables set by options.
ac_init_help=false
# -------------
# Handle the `configure --help' message.
define([_AC_INIT_HELP],
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+[AC_DIVERT_PUSH([HELP_BEGIN])dnl
[if $ac_init_help; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<\EOF]
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_HELP_END)dnl
+AC_DIVERT_PUSH([HELP_END])dnl
EOF
exit 0
fi
# ----------------
# Handle the `configure --version' message.
AC_DEFUN([_AC_INIT_VERSION],
-[AC_DIVERT_PUSH(AC_DIVERSION_VERSION_BEGIN)dnl
+[AC_DIVERT_PUSH([VERSION_BEGIN])dnl
if $ac_init_version; then
cat <<\EOF
AC_DIVERT_POP()dnl
-AC_DIVERT_PUSH(AC_DIVERSION_VERSION_END)dnl
+AC_DIVERT_PUSH([VERSION_END])dnl
EOF
exit 0
fi
# UNIQUE-FILE-IN-SOURCE-DIR.
# 6. Required macros (cache, default AC_SUBST etc.)
AC_DEFUN([_AC_INIT_PREPARE],
-[AC_DIVERT_PUSH(AC_DIVERSION_INIT_PREPARE)dnl
+[AC_DIVERT_PUSH([INIT_PREPARE])dnl
trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
# File descriptor usage:
[m4_sinclude(acsite.m4)dnl
m4_sinclude(./aclocal.m4)dnl
AC_REQUIRE([_AC_INIT_BINSH])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+AC_DIVERT_PUSH([NOTICE])dnl
# Guess values for system-dependent variables and create Makefiles.
AC_DIVERT_POP()dnl
AC_COPYRIGHT(
# AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
# ------------------------------------------------------------------------
AC_DEFUN(AC_ARG_ENABLE,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_ENABLE)dnl
+[AC_DIVERT_PUSH([HELP_ENABLE])dnl
AC_EXPAND_ONCE([
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
# AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE])
# --------------------------------------------------------------------
AC_DEFUN(AC_ARG_WITH,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_WITH)dnl
+[AC_DIVERT_PUSH([HELP_WITH])dnl
AC_EXPAND_ONCE([
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
# Register VARNAME as a variable configure should remember, and
# document it in `configure --help'.
AC_DEFUN(AC_ARG_VAR,
-[AC_DIVERT_PUSH(AC_DIVERSION_HELP_VAR)dnl
+[AC_DIVERT_PUSH([HELP_VAR])dnl
AC_EXPAND_ONCE([
Some influent environment variables:
])[]dnl
# FIXME: Must be run only once. Introduce AC_DEFUN_ONCE?
AC_DEFUN(AC_ARG_PROGRAM,
[dnl Document the options.
-AC_EXPAND_ONCE([AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+AC_EXPAND_ONCE([AC_DIVERT_PUSH([HELP_BEGIN])dnl
Program names:
--program-prefix=PREFIX prepend PREFIX to installed program names
# --------------------------
AC_DEFUN(AC_REVISION,
[AC_REQUIRE([_AC_INIT_BINSH])dnl
-AC_DIVERT_PUSH(AC_DIVERSION_BINSH)dnl
+AC_DIVERT_PUSH([BINSH])dnl
[# From configure.in] translit([$1], $")
AC_DIVERT_POP()dnl to KILL
])
# Note that this macro does not check if the list $[1] itself
# contains doubles.
define(_AC_CONFIG_UNIQUE,
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
AC_FOREACH([AC_File], [$1],
[pushdef([AC_Dest], patsubst(AC_File, [:.*]))
AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS],
# was the case in AC_OUTPUT_COMMANDS.
define(_AC_CONFIG_COMMANDS_INIT,
[ifval([$1],
-[AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl
+[AC_DIVERT_PUSH([ICMDS])dnl
$1
AC_DIVERT_POP()])])
# commands must be associated with a NAME, which should be thought
# as the name of a file the COMMANDS create.
AC_DEFUN([AC_CONFIG_COMMANDS],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_COMMANDS], [ $1])
# AC_LIST_HEADERS_COMMANDS
# esac
AC_DEFUN([AC_CONFIG_HEADERS],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_HEADERS], [ $1])
dnl Register the commands
# Reject DEST=., because it is makes it hard for ./config.status
# to guess the links to establish (`./config.status .').
AC_DEFUN(AC_CONFIG_LINKS,
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
ifelse(regexp([$1], [^\.:\| \.:]), -1,,
[AC_FATAL([$0: invalid destination: `.'])])
# AC_LIST_FILES_COMMANDS
# esac
AC_DEFUN([AC_CONFIG_FILES],
-[AC_DIVERT_PUSH(AC_DIVERSION_KILL)
+[AC_DIVERT_PUSH([KILL])
_AC_CONFIG_UNIQUE([$1])
m4_append([AC_LIST_FILES], [ $1])
dnl Register the commands.
# INIT-COMMANDS section.
#
-undivert(AC_DIVERSION_ICMDS)dnl
+undivert(AC_DIVERT([ICMDS]))dnl
EOF
dnl than not calling it at all
ifset([AC_LIST_FILES],
[AC_OUTPUT_FILES()],
- [AC_DIVERT_PUSH(AC_DIVERSION_KILL)dnl
+ [AC_DIVERT_PUSH([KILL])dnl
AC_OUTPUT_FILES()dnl
AC_DIVERT_POP()])dnl
ifset([AC_LIST_HEADERS],
AC_MSG_CHECKING(for X)
dnl Document the X abnormal options inherited from history.
-AC_EXPAND_ONCE([AC_DIVERT_PUSH(AC_DIVERSION_HELP_BEGIN)dnl
+AC_EXPAND_ONCE([AC_DIVERT_PUSH([HELP_BEGIN])dnl
X features:
--x-includes=DIR X include files are in DIR
# it runs TRUE etc.
-# ifval(COND, IF-TRUE[, IF-FALSE])
-# --------------------------------
+# ifval(COND, [IF-TRUE], [IF-FALSE])
+# ----------------------------------
# If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE.
# Comparable to ifdef.
define([ifval], [ifelse([$1],[],[$3],[$2])])
-# ifset(MACRO, IF-TRUE[, IF-FALSE])
-# --------------------------------
+# ifset(MACRO, [IF-TRUE], [IF-FALSE])
+# -----------------------------------
# If MACRO has no definition, or of its definition is the empty string,
# expand IF-FALSE, otherwise IF-TRUE.
define([ifset],
[$3])])
+# ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED])
+# --------------------------------------------
+define([ifndef],
+[ifdef([$1], [$3], [$2])])
+
+
# m4_default(EXP1, EXP2)
# ----------------------
# Returns EXP1 if non empty, otherwise EXP2.