autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

21-m4-require.patch


From: Akim Demaille
Subject: 21-m4-require.patch
Date: 12 Nov 2000 18:59:40 +0100
User-agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        A single m4_require is enough.
        
        * m4sugar.m4 (_m4_require): $2 defaults to $1.
        Rename as...
        (m4_require): this.
        * acgeneral.m4 (_AC_REQUIRE): Remove, use m4_require if you want
        to get into the gory details.
        
        
Index: acgeneral.m4
--- acgeneral.m4 Sun, 12 Nov 2000 16:11:30 +0100 akim (ace/27_acgeneral. 
1.169.8.92 644)
+++ acgeneral.m4 Sun, 12 Nov 2000 16:24:20 +0100 akim (ace/27_acgeneral. 
1.169.8.92 644)
@@ -167,20 +167,14 @@ m4_define([_m4_divert_diversion], _m4_di
 ## Defining macros in autoconf::.  ##
 ## ------------------------------- ##
 
-# `AC_DEFUN' is basically `define' but it equips the macro with the
-# needed machinery for `AC_REQUIRE'.  A macro must be AC_DEFUN'd if
-# either it is AC_REQUIRE'd, or it AC_REQUIRE's.
 
 # AC_DEFUN(NAME, EXPANSION)
 # -------------------------
-# Define a macro which automatically provides itself.  Add machinery
-# so the macro automatically switches expansion to the diversion
-# stack if it is not already using it.  In this case, once finished,
-# it will bring back all the code accumulated in the diversion stack.
-# This, combined with AC_REQUIRE, achieves the topological ordering of
-# macros.  We don't use this macro to define some frequently called
-# macros that are not involved in ordering constraints, to save m4
-# processing.
+# Same as `m4_define' but equip the macro with the needed machinery
+# for `AC_REQUIRE'.
+#
+# We don't use this macro to define some frequently called macros that
+# are not involved in ordering constraints, to save m4 processing.
 m4_define([AC_DEFUN],
 [m4_defun([$1], [$2[]AC_PROVIDE([$1])])])
 
@@ -213,44 +207,12 @@ m4_define([AC_BEFORE],
 [AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])])
 
 
-# _AC_REQUIRE(NAME-TO-CHECK, BODY-TO-EXPAND)
-# ------------------------------------------
-# If NAME-TO-CHECK has never been expanded (actually, if it is not
-# AC_PROVIDE'd), expand BODY-TO-EXPAND *before* the current macro
-# expansion.  Once expanded, emit it in _m4_divert_dump.  Keep track
-# of the AC_REQUIRE chain in _AC_EXPANSION_STACK.
-#
-# The normal cases are:
-#
-# - NAME-TO-CHECK == BODY-TO-EXPAND
-#   Which you can use for regular macros with or without arguments, e.g.,
-#     _AC_REQUIRE([AC_PROG_CC], [AC_PROG_CC])
-#     _AC_REQUIRE([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)])
-#
-# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK])
-#   In the case of macros with irregular names.  For instance:
-#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [m4_indir([AC_LANG_COMPILER(C)])])
-#   which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are
-#   part of the name, it is not an argument) has not been run, then
-#   call it.'
-#   Had you used
-#     _AC_REQUIRE([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
-#   then _AC_REQUIRE would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
-#   call the macro `AC_LANG_COMPILER' with `C' as argument.
-#
-#   You could argue that `AC_LANG_COMPILER', when it receives an argument
-#   such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'.  But this
-#   `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
-#   it passes to `AC_LANG_COMPILER(C)'.
-m4_define([_AC_REQUIRE],
-[_m4_require($@)])
-
-
 # AC_REQUIRE(STRING)
 # ------------------
-# If STRING has never been AC_PROVIDE'd, then expand it.
+# If STRING has never been AC_PROVIDE'd, then expand it. A macro must
+# be AC_DEFUN'd if either it is AC_REQUIRE'd, or it AC_REQUIRE's.
 m4_define([AC_REQUIRE],
-[m4_require($@)])
+[m4_require([$1])])
 
 
 # AC_EXPAND_ONCE(TEXT)
Index: aclang.m4
--- aclang.m4 Sun, 12 Nov 2000 12:34:34 +0100 akim (ace/b/32_aclang.m4 1.5.3.48 
644)
+++ aclang.m4 Sun, 12 Nov 2000 16:17:45 +0100 akim (ace/b/32_aclang.m4 1.5.3.48 
644)
@@ -508,8 +508,8 @@ m4_define([AC_LANG_COMPILER],
 # ------------------------
 # Ensure we have a compiler for the current LANG.
 AC_DEFUN([AC_LANG_COMPILER_REQUIRE],
-[_AC_REQUIRE([AC_LANG_COMPILER(]_AC_LANG[)],
-             [AC_LANG_COMPILER])])
+[m4_require([AC_LANG_COMPILER(]_AC_LANG[)],
+            [AC_LANG_COMPILER])])
 
 
 # _AC_LANG_COMPILER_WORKS
@@ -570,8 +570,8 @@ m4_define([AC_LANG_PREPROC],
 # -----------------------
 # Ensure we have a preprocessor for the current language.
 AC_DEFUN([AC_LANG_PREPROC_REQUIRE],
-[_AC_REQUIRE([AC_LANG_PREPROC(]_AC_LANG[)],
-             [AC_LANG_PREPROC])])
+[m4_require([AC_LANG_PREPROC(]_AC_LANG[)],
+            [AC_LANG_PREPROC])])
 
 
 # AC_REQUIRE_CPP
Index: m4sugar.m4
--- m4sugar.m4 Sun, 12 Nov 2000 15:15:02 +0100 akim (ace/b/27_libm4.m4 1.33 644)
+++ m4sugar.m4 Sun, 12 Nov 2000 16:17:34 +0100 akim (ace/b/27_libm4.m4 1.33 644)
@@ -1106,8 +1106,8 @@ m4_define([m4_before],
                    [m4_warn([syntax], [$2 was called before $1])])])
 
 
-# _m4_require(NAME-TO-CHECK, BODY-TO-EXPAND)
-# ------------------------------------------
+# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK])
+# -----------------------------------------------------------
 # If NAME-TO-CHECK has never been expanded (actually, if it is not
 # m4_provide'd), expand BODY-TO-EXPAND *before* the current macro
 # expansion.  Once expanded, emit it in _m4_divert_dump.  Keep track
@@ -1117,35 +1117,38 @@ m4_define([m4_before],
 #
 # - NAME-TO-CHECK == BODY-TO-EXPAND
 #   Which you can use for regular macros with or without arguments, e.g.,
-#     _m4_require([AC_PROG_CC], [AC_PROG_CC])
-#     _m4_require([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)])
+#     m4_require([AC_PROG_CC], [AC_PROG_CC])
+#     m4_require([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)])
+#   which is just the same as
+#     m4_require([AC_PROG_CC])
+#     m4_require([AC_CHECK_HEADERS(limits.h)])
 #
 # - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK])
 #   In the case of macros with irregular names.  For instance:
-#     _m4_require([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])])
+#     m4_require([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])])
 #   which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are
 #   part of the name, it is not an argument) has not been run, then
 #   call it.'
 #   Had you used
-#     _m4_require([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
-#   then _m4_require would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
+#     m4_require([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)])
+#   then m4_require would have tried to expand `AC_LANG_COMPILER(C)', i.e.,
 #   call the macro `AC_LANG_COMPILER' with `C' as argument.
 #
 #   You could argue that `AC_LANG_COMPILER', when it receives an argument
 #   such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'.  But this
 #   `extension' prevents `AC_LANG_COMPILER' from having actual arguments that
 #   it passes to `AC_LANG_COMPILER(C)'.
-m4_define([_m4_require],
+m4_define([m4_require],
 [m4_pushdef([_m4_expansion_stack],
             m4_location[: $1 is required by...])dnl
 ifdef([_m4_expanding($1)],
-      [m4_fatal([m4_require: circular dependency of $1])])dnl
+      [m4_fatal([$0: circular dependency of $1])])dnl
 ifndef([_m4_divert_dump],
-    [m4_fatal([m4_require: cannot be used outside of an m4_defun'd macro])])dnl
+    [m4_fatal([$0: cannot be used outside of an m4_defun'd macro])])dnl
 m4_provide_ifelse([$1],
                   [],
                   [m4_divert_push(m4_eval(_m4_divert_diversion - 1))dnl
-$2
+m4_default([$2], [$1])
 divert(_m4_divert_dump)undivert(_m4_divert_diversion)dnl
 m4_divert_pop()])dnl
 m4_provide_ifelse([$1],
@@ -1154,13 +1157,6 @@ m4_define([_m4_require],
                            [$1 is m4_require'd but is not m4_defun'd])])dnl
 m4_popdef([_m4_expansion_stack])dnl
 ])
-
-
-# m4_require(STRING)
-# ------------------
-# If STRING has never been m4_provide'd, then expand it.
-m4_define([m4_require],
-[_m4_require([$1], [$1])])
 
 
 # m4_expand_once(TEXT)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]