>>>>> "Akim" == Akim Demaille <[EMAIL PROTECTED]> writes:
Akim> I'm working on it at home, Monday I should bring something which
Akim> should be close to a solution + explanation :)
So I think the four next patches will solve your problem. Well, I
hope so :(
Those patches are based on a solution provided by Axel Thimm a while
ago:
http://sourceware.cygnus.com/ml/autoconf/1999-01/msg00041.html
To: [EMAIL PROTECTED]
Subject: Delayed macro expansion bug with AC_REQUIRE and diversions
From: Axel Thimm <[EMAIL PROTECTED]>
Date: Mon, 25 Jan 1999 03:39:08 +0100
I over split the patch so that it remains understandable. The third
patch explains it in all the details.
IMNSHO, Axel did an excellent job on this, his approach is fine, and
the bug he fixed was not an easy one. In addition, you really need to
perfectly understand m4 to write such a good patch.
Index: 0.346/ChangeLog
--- 0.346/ChangeLog Tue, 13 Jun 2000 22:59:01 +0200 akim (ace/34_ChangeLog 1.313 666)
+++ 0.346(w)/ChangeLog Thu, 22 Jun 2000 20:49:41 +0200 akim (ace/34_ChangeLog 1.313
+666)
@@ -1,3 +1,20 @@
+2000-06-21 Akim Demaille <[EMAIL PROTECTED]>
+
+ Various cleanups.
+
+ * acgeneral.m4 (AC_PRO, AC_EPI): Rename as _AC_DEFUN_PRO and
+ _AC_DEFUN_EPI.
+ Adjust dependencies.
+ (AC_DEFUN): Remove the not-to-be-released specializing mechanism.
+ (AC_SPECIALIZE): Remove for the same reasons.
+ Adjust dependencies.
+ (_AC_INIT_DEFAULTS, _AC_INIT_PARSE_ARGS, _AC_INIT_VERSION,
+ _AC_INIT_PREPARE, _AC_CANONICAL_SPLIT, _AC_CHECK_TYPE_NEW,
+ _AC_CHECK_TYPE_OLD): Define via `define' instead of `AC_DEFUN':
+ they are not related to AC_REQUIRE in any way.
+ * acspecific.m4 (AC_PROG_ECHO, _AC_DECL_YYTEXT, _AC_PATH_X_XMKMF,
+ _AC_PATH_X_DIRECT): Define via `define' instead of `AC_DEFUN'.
+
2000-06-13 Akim Demaille <[EMAIL PROTECTED]>
`./config.status -d' is buggy.
Index: 0.346/acgeneral.m4
--- 0.346/acgeneral.m4 Tue, 13 Jun 2000 22:59:01 +0200 akim (ace/27_acgeneral.
1.169.8.38 664)
+++ 0.346(w)/acgeneral.m4 Thu, 22 Jun 2000 20:47:51 +0200 akim (ace/27_acgeneral.
+1.169.8.38 664)
@@ -1,4 +1,4 @@
- This file is part of Autoconf. -*- Autoconf -*-
+# This file is part of Autoconf. -*- Autoconf -*-
# Parameterized macros.
# Copyright (C) 1992, 93, 94, 95, 96, 98, 99, 2000
# Free Software Foundation, Inc.
@@ -188,10 +188,10 @@ define([AC_DIVERT_DIVERSION], _AC_DIVERT
## ------------------------------- ##
-# AC_PRO(MACRO-NAME)
-# ------------------
+# _AC_DEFUN_PRO(MACRO-NAME)
+# -------------------------
# The prologue for Autoconf macros.
-define([AC_PRO],
+define([_AC_DEFUN_PRO],
[AC_PROVIDE([$1])dnl
ifelse(AC_DIVERT_DIVERSION, _AC_DIVERT([NORMAL]),
[AC_DIVERT_PUSH(m4_eval(AC_DIVERT_DIVERSION - 1))],
@@ -199,10 +199,11 @@ define([AC_PRO],
])
-# AC_EPI
-# ------
-# The Epilogue for Autoconf macros.
-define([AC_EPI],
+# _AC_DEFUN_EPI(MACRO-NAME)
+# -------------------------
+# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing
+# the PRO/EPI pairs.
+define([_AC_DEFUN_EPI],
[AC_DIVERT_POP()dnl
ifelse(AC_DIVERT_DIVERSION, _AC_DIVERT([NORMAL]),
[undivert(_AC_DIVERT([NORMAL_4]))dnl
@@ -213,8 +214,8 @@ define([AC_EPI],
])
-# AC_DEFUN(NAME, [REPLACED-FUNCTION, ARGUMENT, ]EXPANSION)
-# --------------------------------------------------------
+# AC_DEFUN(NAME, EXPANSION)
+# -------------------------
#
# Define a macro which automatically provides itself. Add machinery
# so the macro automatically switches expansion to the diversion
@@ -224,19 +225,8 @@ define([AC_EPI],
# macros. We don't use this macro to define some frequently called
# macros that are not involved in ordering constraints, to save m4
# processing.
-#
-# If the REPLACED-FUNCTION and ARGUMENT are defined, then declare that
-# NAME is a specialized version of REPLACED-FUNCTION when its first
-# argument is ARGUMENT. For instance AC_TYPE_SIZE_T is a specialization
-# of AC_CHECK_TYPE applied to `size_t'.
-#
-# This feature is not documented on purpose. It might change in the
-# future.
define([AC_DEFUN],
-[ifelse([$3],,
- [define([$1], [AC_PRO([$1])$2[]AC_EPI()])],
- [define([$2-$3], [$1])
-define([$1], [AC_PRO([$1])$4[]AC_EPI()])])])
+[define([$1], [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])
# AC_DEFUN_ONCE(NAME, EXPANSION)
@@ -247,7 +237,7 @@ define([AC_DEFUN_ONCE],
[define([$1],
[AC_PROVIDE_IFELSE([$1],
[AC_DIAGNOSE([syntax], [$1 invoked multiple times])],
- [AC_PRO([$1])$2[]AC_EPI()])])])
+ [_AC_DEFUN_PRO([$1])$2[]_AC_DEFUN_EPI([$1])])])])
# AC_DEFUNCT(NAME, COMMENT)
@@ -263,18 +253,6 @@ define([AC_OBSOLETE],
[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])])
-# AC_SPECIALIZE(MACRO, ARG1 [, ARGS...])
-# --------------------------------------
-#
-# Basically calls the macro MACRO with arguments ARG1, ARGS... But if
-# there exist a specialized version of MACRO for ARG1, use this macro
-# instead with arguments ARGS (i.e., ARG1 is *not* given). See the
-# definition of `AC_DEFUN'.
-define([AC_SPECIALIZE],
-[ifdef([$1-$2],
- [indir([$1-$2], m4_shift(m4_shift($@)))],
- [$1(m4_shift($@))])])
-
@@ -822,7 +800,7 @@ define([AC_PREREQ],
# _AC_INIT_DEFAULTS
# -----------------
# Values which defaults can be set from `configure.in'.
-AC_DEFUN([_AC_INIT_DEFAULTS],
+define([_AC_INIT_DEFAULTS],
[AC_DIVERT_PUSH([DEFAULTS])dnl
#
@@ -931,7 +909,7 @@ define([_AC_INIT_SRCDIR],
# _AC_INIT_PARSE_ARGS
# -------------------
-AC_DEFUN([_AC_INIT_PARSE_ARGS],
+define([_AC_INIT_PARSE_ARGS],
[AC_DIVERT_PUSH([INIT_PARSE_ARGS])dnl
# Initialize some variables set by options.
@@ -1439,7 +1417,7 @@ define([_AC_INIT_HELP],
# _AC_INIT_VERSION
# ----------------
# Handle the `configure --version' message.
-AC_DEFUN([_AC_INIT_VERSION],
+define([_AC_INIT_VERSION],
[AC_DIVERT([VERSION_BEGIN],
[if $ac_init_version; then
cat <<\EOF])dnl
@@ -1497,7 +1475,7 @@ define([_AC_INIT_PREPARE_ENVIRONMENT],
# 3. Remember the options given to `configure' for `config.status --recheck'.
# 4. Ensure a correct environment
# 5. Required macros (cache, default AC_SUBST etc.)
-AC_DEFUN([_AC_INIT_PREPARE],
+define([_AC_INIT_PREPARE],
[AC_DIVERT_PUSH([INIT_PREPARE])dnl
_AC_INIT_PREPARE_ENVIRONMENT
@@ -1727,7 +1705,7 @@ AC_DEFUN([AC_ARG_VAR],
# --------------
# This macro is expanded only once, to avoid that `foo' ends up being
# installed as `ggfoo'.
-AC_DEFUN_ONCE(AC_ARG_PROGRAM,
+AC_DEFUN_ONCE([AC_ARG_PROGRAM],
[dnl Document the options.
AC_DIVERT_PUSH([HELP_BEGIN])dnl
@@ -1833,7 +1811,7 @@ AC_DEFUN([AC_CONFIG_AUX_DIRS],
# _AC_CANONICAL_SPLIT(THING)
# --------------------------
# Generate the variables THING, THING_{alias cpu vendor os}.
-AC_DEFUN([_AC_CANONICAL_SPLIT],
+define([_AC_CANONICAL_SPLIT],
[AC_SUBST([$1], [$ac_cv_$1])dnl
dnl FIXME: AC_SUBST([$1_alias], [$ac_cv_$1_alias])dnl
AC_SUBST([$1_cpu],
@@ -2424,7 +2402,7 @@ AC_DEFUN([AC_CHECK_MEMBER],
# The first argument is an m4 list.
AC_DEFUN([AC_CHECK_MEMBERS],
[m4_foreach([AC_Member], [$1],
- [AC_SPECIALIZE([AC_CHECK_MEMBER], AC_Member,
+ [AC_CHECK_MEMBER(AC_Member,
[AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Member), 1,
[Define if `]patsubst(AC_Member, [^[^.]*\.])[' is
member of `]patsubst(AC_Member, [\..*])['.])
@@ -3038,7 +3016,7 @@ AC_DEFUN([AC_CHECK_FILE],
# -----------------------------------------------------------------
AC_DEFUN([AC_CHECK_FILES],
[AC_FOREACH([AC_FILE_NAME], [$1],
- [AC_SPECIALIZE([AC_CHECK_FILE], AC_FILE_NAME,
+ [AC_CHECK_FILE(AC_FILE_NAME,
[AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_FILE_NAME), 1,
[Define if you have the file `]AC_File['.])
$2],
@@ -3079,7 +3057,7 @@ AC_DEFUN([AC_CHECK_DECL],
# other AC_CHECK_*S macros. SYMBOLS is an m4 list.
AC_DEFUN([AC_CHECK_DECLS],
[m4_foreach([AC_Symbol], [$1],
- [AC_SPECIALIZE([AC_CHECK_DECL], AC_Symbol,
+ [AC_CHECK_DECL(AC_Symbol,
[AC_DEFINE_UNQUOTED(AC_TR_CPP([HAVE_DECL_]AC_Symbol), 1,
[Define to 1 if you have the declaration
of `]AC_Symbol[', and to 0 if you don't.])
@@ -3312,7 +3290,7 @@ AC_DEFUN([AC_CHECK_SIZEOF],
# (not necessarily size_t etc.). Equally, instead of defining an unused
# variable, we just use a cast to avoid warnings from the compiler.
# Suggested by Paul Eggert.
-AC_DEFUN([_AC_CHECK_TYPE_NEW],
+define([_AC_CHECK_TYPE_NEW],
[AC_REQUIRE([AC_HEADER_STDC])dnl
AC_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
AC_CACHE_CHECK([for $1], ac_Type,
@@ -3337,13 +3315,13 @@ AC_DEFUN([_AC_CHECK_TYPE_NEW],
# AC_CHECK_TYPE.
AC_DEFUN([AC_CHECK_TYPES],
[m4_foreach([AC_Type], [$1],
- [AC_SPECIALIZE([_AC_CHECK_TYPE_NEW], AC_Type,
- [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type), 1,
- [Define if the system has the type
- `]AC_Type['.])
+ [_AC_CHECK_TYPE_NEW(AC_Type,
+ [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_[]AC_Type), 1,
+ [Define if the system has the type
+ `]AC_Type['.])
$2],
- [$3],
- [$4])])])
+ [$3],
+ [$4])])])
# _AC_CHECK_TYPE_OLD(TYPE, DEFAULT)
@@ -3351,7 +3329,7 @@ AC_DEFUN([AC_CHECK_TYPES],
# FIXME: This is an extremely badly chosen name, since this
# macro actually performs an AC_REPLACE_TYPE. Some day we
# have to clean this up.
-AC_DEFUN([_AC_CHECK_TYPE_OLD],
+define([_AC_CHECK_TYPE_OLD],
[_AC_CHECK_TYPE_NEW([$1],,
[AC_DEFINE_UNQUOTED([$1], [$2],
[Define to `$2' if <sys/types.h> does not define.])])dnl
Index: 0.346/acspecific.m4
--- 0.346/acspecific.m4 Tue, 13 Jun 2000 22:59:01 +0200 akim (ace/25_acspecific 1.89
666)
+++ 0.346(w)/acspecific.m4 Thu, 22 Jun 2000 20:35:18 +0200 akim (ace/25_acspecific
+1.89 666)
@@ -63,7 +63,7 @@
# display the checking message. In addition, caching something used once
# has little interest.
# Idea borrowed from dist 3.0.
-AC_DEFUN([_AC_PROG_ECHO],
+define([_AC_PROG_ECHO],
[if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says Kaveh R. Ghazi.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -149,7 +149,7 @@ AC_DEFUN([AC_PROG_LEX],
# _AC_DECL_YYTEXT
# ---------------
# Check if lex declares yytext as a char * by default, not a char[].
-AC_DEFUN([_AC_DECL_YYTEXT],
+define([_AC_DECL_YYTEXT],
[AC_REQUIRE_CPP()dnl
AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,
[# The minimal lex program is just a single line: %%. But some broken lexes
@@ -2361,7 +2361,7 @@ AC_DEFUN([AC_PATH_X],
# ---------------
# Internal subroutine of AC_PATH_X.
# Set ac_x_includes and/or ac_x_libraries.
-AC_DEFUN([_AC_PATH_X_XMKMF],
+define([_AC_PATH_X_XMKMF],
[rm -fr conftestdir
if mkdir conftestdir; then
cd conftestdir
@@ -2402,7 +2402,7 @@ AC_DEFUN([_AC_PATH_X_XMKMF],
# ----------------
# Internal subroutine of AC_PATH_X.
# Set ac_x_includes and/or ac_x_libraries.
-AC_DEFUN([_AC_PATH_X_DIRECT],
+define([_AC_PATH_X_DIRECT],
[# Standard set of common directories for X headers.
# Check X11 before X11Rn because it is often a symlink to the current release.
ac_x_header_dirs='