autoconf-patches
[Top][All Lists]
Advanced

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

07-cleanups.patch


From: Akim Demaille
Subject: 07-cleanups.patch
Date: Thu, 18 Jan 2001 01:02:59 +0100

I intend to apply those patches tomorrow morning.  Good night everybody!

        Akim

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        Various cleanups and consistency checks.
        
        * m4sugar.m4: Formatting changes.
        * acgeneral.m4 (AC_DIVERT_PUSH, AC_DIVERT_POP, AC_REQUIRE)
        (AC_DIAGNOSE, AC_FATAL, AC_MSG_WARN, AC_MSG_NOTICE, AC_MSG_ERROR):
        Use m4_copy to define them, in order to keep a good $0.
        (AC_INIT): AC_LANG_PUSH C, not AC_LANG, to initialize the stack.
        * aclang.m4 (AC_LANG_PUSH): Dont't use m4_defn on undefined macros.
        (AC_LANG_POP): Admit an argument specifying the language we quit
        when popping.
        Adjust Autoconf's AC_LANG_POPs.
        * tests/tools.at (AWK portability): Don't depend on AC_INIT.
        (autoconf --trace: user macros): Obviously I
        meant TRACE1, not AC_TRACE1.
        
Index: acgeneral.m4
--- acgeneral.m4 Wed, 17 Jan 2001 18:57:24 +0100 akim (ace/27_acgeneral. 
1.169.8.115 644)
+++ acgeneral.m4 Wed, 17 Jan 2001 21:28:17 +0100 akim (ace/27_acgeneral. 
1.169.8.115 644)
@@ -143,15 +143,10 @@ m4_define([AC_DIVERT_ONCE],
 
 
 # AC_DIVERT_PUSH(DIVERSION-NAME)
-# ------------------------------
-m4_define([AC_DIVERT_PUSH],
-[m4_divert_push($@)])
-
-
 # AC_DIVERT_POP
-# -------------
-m4_define([AC_DIVERT_POP],
-[m4_divert_pop($@)])
+# ------------------------------
+m4_copy([m4_divert_push],[AC_DIVERT_PUSH])
+m4_copy([m4_divert_pop], [AC_DIVERT_POP])
 
 
 # Throw away output until AC_INIT is called.
@@ -209,8 +204,7 @@ m4_define([AC_BEFORE],
 # ------------------
 # 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([$1])])
+m4_copy([m4_require], [AC_REQUIRE])
 
 
 # AC_EXPAND_ONCE(TEXT)
@@ -1491,7 +1485,7 @@ m4_define([_AC_INIT_PREPARE],
 _AC_ARG_VAR_PRECIOUS(build_alias)dnl
 _AC_ARG_VAR_PRECIOUS(host_alias)dnl
 _AC_ARG_VAR_PRECIOUS(target_alias)dnl
-AC_LANG(C)
+AC_LANG_PUSH(C)
 
 _AC_PROG_ECHO()dnl
 dnl Substitute for predefined variables.
@@ -2139,11 +2133,10 @@ m4_define([AC_SUBST_FILE],
 
 
 # AC_DIAGNOSE(CATEGORY, MESSAGE)
-# ------------------------------
-# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was
-# specified.
-m4_define([AC_DIAGNOSE],
-[m4_warn($@)])
+# AC_FATAL(MESSAGE, [EXIT-STATUS])
+# --------------------------------
+m4_copy([m4_warn],  [AC_DIAGNOSE])
+m4_copy([m4_fatal], [AC_FATAL])
 
 
 # AC_WARNING(MESSAGE)
@@ -2154,12 +2147,6 @@ m4_define([AC_WARNING],
 [AC_DIAGNOSE([syntax], [$1])])
 
 
-# AC_FATAL(MESSAGE, [EXIT-STATUS])
-# --------------------------------
-m4_define([AC_FATAL],
-[m4_fatal($@)])
-
-
 
 
 ## ---------------------------------------- ##
@@ -2204,9 +2191,9 @@ m4_define([AC_MSG_RESULT_UNQUOTED],
 # AC_MSG_NOTICE(STRING)
 # AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1])
 # --------------------------------------
-m4_define([AC_MSG_WARN],   [AS_WARN($@)])
-m4_define([AC_MSG_NOTICE], [AS_MESSAGE($@)])
-m4_define([AC_MSG_ERROR],  [AS_ERROR($@)])
+m4_copy([AS_WARN],    [AC_MSG_WARN])
+m4_copy([AS_MESSAGE], [AC_MSG_NOTICE])
+m4_copy([AS_ERROR],   [AC_MSG_ERROR])
 
 
 # AU::AC_CHECKING(FEATURE)
Index: aclang.m4
--- aclang.m4 Tue, 16 Jan 2001 21:46:21 +0100 akim (ace/b/32_aclang.m4 1.5.3.69 
644)
+++ aclang.m4 Wed, 17 Jan 2001 21:32:47 +0100 akim (ace/b/32_aclang.m4 1.5.3.69 
644)
@@ -111,14 +111,10 @@ m4_define([_AC_LANG_DISPATCH],
 # AC_LANG(LANG)
 # -------------
 # Set the current language to LANG.
-#
-# Do *not* write AC_LANG([$1]), because this pair of parens does not
-# correspond to an evaluation, rather, they are just part of the name.
-# If you add quotes here, they will be part of the name too, yielding
-# `AC_LANG([C])' for instance, which does not exist.
 AC_DEFUN([AC_LANG],
-[m4_if(m4_defn([_AC_LANG]), [$1], [],
-       [m4_define([_AC_LANG], [$1])dnl
+[m4_ifdef([_AC_LANG],
+          [m4_if(m4_defn([_AC_LANG]), [$1], [],
+                 [m4_define([_AC_LANG], [$1])])dnl
 _AC_LANG_DISPATCH([$0], _AC_LANG, $@)])])
 
 
@@ -126,15 +122,21 @@ AC_DEFUN([AC_LANG],
 # ------------------
 # Save the current language, and use LANG.
 m4_define([AC_LANG_PUSH],
-[m4_pushdef([_AC_LANG], m4_defn([_AC_LANG]))dnl
+[m4_pushdef([_AC_LANG],
+            m4_ifdef([_AC_LANG],
+                     [m4_defn([_AC_LANG])]))dnl
 AC_LANG([$1])])
 
 
-# AC_LANG_POP
-# -----------
-# Restore the previous language.
+# AC_LANG_POP([LANG])
+# -------------------
+# If given, check that the current language is LANG, and restore the
+# previous language.
 m4_define([AC_LANG_POP],
-[m4_popdef([_AC_LANG])dnl
+[m4_ifval([$1],
+     [m4_if([$1], m4_defn([_AC_LANG]), [],
+            [m4_fatal([$0($1): unexpected current language: ]_AC_LANG)])])dnl
+m4_popdef([_AC_LANG])dnl
 m4_if(_AC_LANG, [_AC_LANG], [AC_FATAL([too many $0])])dnl
 AC_LANG(_AC_LANG)])
 
@@ -822,7 +824,7 @@ AC_DEFUN([AC_PROG_CPP],
   AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])
 fi
 AC_SUBST(CPP)dnl
-AC_LANG_POP()dnl
+AC_LANG_POP(C)dnl
 ])# AC_PROG_CPP
 
 
@@ -846,7 +848,7 @@ AC_DEFUN([AC_LANG_COMPILER(C)],
 # This just gives the user an opportunity to specify an alternative
 # search list for the C compiler.
 AC_DEFUN([AC_PROG_CC],
-[AC_LANG_PUSH(C)
+[AC_LANG_PUSH(C)dnl
 AC_ARG_VAR([CC], [C compiler command])
 AC_ARG_VAR([CFLAGS], [C compiler flags])
 m4_ifval([$1],
@@ -879,7 +881,7 @@ AC_DEFUN([AC_PROG_CC],
   choke me
 @%:@endif],
                    [_AC_PROG_CXX_EXIT_DECLARATION])
-AC_LANG_POP
+AC_LANG_POP(C)dnl
 ])# AC_PROG_CC
 
 
@@ -1031,7 +1033,7 @@ AC_DEFUN([AC_PROG_CXXCPP],
   AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])
 fi
 AC_SUBST(CXXCPP)dnl
-AC_LANG_POP()dnl
+AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXXCPP
 
 
@@ -1076,7 +1078,7 @@ AC_DEFUN([AC_PROG_CXX],
 AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
 _AC_PROG_CXX_G
 _AC_PROG_CXX_EXIT_DECLARATION
-AC_LANG_POP
+AC_LANG_POP(C++)dnl
 ])# AC_PROG_CXX
 
 
@@ -1201,7 +1203,7 @@ AC_DEFUN([AC_PROG_F77],
 AC_EXPAND_ONCE([_AC_COMPILER_OBJEXT])[]dnl
 AC_EXPAND_ONCE([_AC_COMPILER_EXEEXT])[]dnl
 _AC_PROG_F77_G
-AC_LANG_POP
+AC_LANG_POP(Fortran 77)dnl
 ])# AC_PROG_F77
 
 
@@ -1641,7 +1643,7 @@ AC_DEFUN([_AC_PROG_F77_V_OUTPUT],
 FFLAGS=$ac_save_FFLAGS
 
 rm -f conftest.*
-AC_LANG_POP()dnl
+AC_LANG_POP(Fortran 77)dnl
 
 # If we are using xlf then replace all the commas with spaces.
 if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then
@@ -1796,7 +1798,7 @@ AC_DEFUN([AC_F77_LIBRARY_LDFLAGS],
 ])
 FLIBS="$ac_cv_flibs"
 AC_SUBST(FLIBS)
-AC_LANG_POP()dnl
+AC_LANG_POP(Fortran 77)dnl
 ])# AC_F77_LIBRARY_LDFLAGS
 
 
@@ -1882,9 +1884,9 @@ AC_DEFUN([_AC_F77_NAME_MANGLING],
   fi
 
   LIBS=$ac_save_LIBS
-  AC_LANG_POP()dnl
+  AC_LANG_POP(C)dnl
   rm -f cf77_test* conftest*])
-AC_LANG_POP()dnl
+AC_LANG_POP(Fortran 77)dnl
 ])
 ])# _AC_F77_NAME_MANGLING
 
Index: doc/autoconf.texi
--- doc/autoconf.texi Wed, 17 Jan 2001 18:57:24 +0100 akim (ace/16_autoconf.t 
1.61.2.102 644)
+++ doc/autoconf.texi Wed, 17 Jan 2001 21:37:25 +0100 akim (ace/16_autoconf.t 
1.61.2.102 644)
@@ -6498,10 +6498,21 @@ @node Language Choice,  , Multiple Cases
 in macros that need to temporarily switch to a particular language.
 @end defmac
 
address@hidden AC_LANG_POP
address@hidden AC_LANG_POP (@ovar{language})
 @maindex LANG_POP
 Select the language that is saved on the top of the stack, as set by
 @code{AC_LANG_PUSH}, and remove it from the stack.
+
+If given, @var{language} specifies the language we just @emph{quit}.  It
+is a good idea to specify it when it's known (which should be the
+case...), since Autoconf will track inconsistencies.
+
address@hidden
+AC_LANG_PUSH(Fortran 77)
+# Perform some tests on Fortran 77.
+# ...
+AC_LANG_POP(Fortran 77)
address@hidden example
 @end defmac
 
 @defmac AC_REQUIRE_CPP
Index: m4sugar.m4
--- m4sugar.m4 Wed, 17 Jan 2001 18:57:24 +0100 akim (ace/b/27_libm4.m4 1.50 644)
+++ m4sugar.m4 Wed, 17 Jan 2001 21:16:09 +0100 akim (ace/b/27_libm4.m4 1.50 644)
@@ -81,6 +81,14 @@
 # m4_copy(SRC, DST)
 # -----------------
 # Define DST as the definition of SRC.
+# What's the difference between:
+# 1. m4_copy([from], [to])
+# 2. m4_define([from], [to($@)])
+# Well, obviously 1 is more expansive in space.  Maybe 2 is more expansive
+# in time, but because of the space cost of 1, it's not that obvious.
+# Nevertheless, one huge difference is the handling of `$0'.  If `from'
+# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2.
+# The user will certainly prefer see `from'.
 m4_define([m4_copy],
 [m4_define([$2], m4_defn([$1]))])
 
@@ -534,8 +550,7 @@ m4_define([m4_undefine],
 # m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION)
 # --------------------------------------------------------
 # Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO.
-# Both limits are included.
-
+# Both limits are included, and bounds are checked for consistency.
 m4_define([m4_for],
 [m4_case(m4_sign(m4_eval($3 - $2)),
          1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)],
@@ -546,6 +561,10 @@ m4_define([m4_for],
       [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl
 m4_popdef([$1])])
 
+
+# _m4_for(VARIABLE, FIRST, LAST, STEP, EXPRESSION)
+# ------------------------------------------------
+# Core of the loop, no consistency checks.
 m4_define([_m4_for],
 [$4[]dnl
 m4_if($1, [$2], [],
@@ -666,10 +685,10 @@ m4_define([_m4_foreach],
 ## --------------------------- ##
 
 
-# _m4_divert(DIBERSION-NAME or NUMBER)
+# _m4_divert(DIVERSION-NAME or NUMBER)
 # ------------------------------------
-# If DIVERSION-NAME is the name of a diversion, return its number, otherwise
-# return makeNUMBER.
+# If DIVERSION-NAME is the name of a diversion, return its number,
+# otherwise if is a NUMBER return it.
 m4_define([_m4_divert],
 [m4_ifdef([_m4_divert($1)],
           [m4_indir([_m4_divert($1)])],
@@ -1064,8 +1083,8 @@ m4_define([m4_divert_text],
 # -----------------------------
 m4_define([m4_expansion_stack_push],
 [m4_pushdef([m4_expansion_stack],
-            [$1]
-m4_defn([m4_expansion_stack]))])
+            [$1]m4_ifdef([m4_expansion_stack], [
+m4_defn([m4_expansion_stack])]))])
 
 
 # m4_expansion_stack_pop
@@ -1079,7 +1098,8 @@ m4_define([m4_expansion_stack_pop],
 # -----------------------
 # Dump the expansion stack.
 m4_define([m4_expansion_stack_dump],
-[m4_errprint(m4_defn([m4_expansion_stack]))dnl
+[m4_ifdef([m4_expansion_stack],
+          [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl
 m4_errprintn(m4_location[: the top level])])
 
 
Index: tests/tools.at
--- tests/tools.at Sat, 23 Dec 2000 11:36:46 +0100 akim (ace/b/30_tools.m4 1.30 
644)
+++ tests/tools.at Wed, 17 Jan 2001 21:10:39 +0100 akim (ace/b/30_tools.m4 1.30 
644)
@@ -75,8 +75,7 @@
 AT_SETUP([AWK portability])
 
 AT_DATA([configure.ac],
-[[AC_INIT
-]])
+[])
 
 if (gawk --version) >/dev/null 2>&1; then
   # Generation of the script.
@@ -111,7 +110,7 @@
 AC_DEFUN([TRACE1], [TRACE2(m4_shift($@))])
 AC_DEFUN([TRACE2], [[$2], $1])
 TRACE1(foo, bar, baz)
-TRACE1(foo, AC_TRACE1(bar, baz))
+TRACE1(foo, TRACE1(bar, baz))
 TRACE1(foo, active, baz)
 TRACE1(foo, [active], TRACE1(active, [active]))
 ]])
@@ -120,8 +119,10 @@ AC_DEFUN([TRACE2], [[$2], $1])
 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1 -t TRACE2], 0,
 [[configure.ac:4:TRACE1:foo:bar:baz
 configure.ac:4:TRACE2:bar:baz
-configure.ac:5:TRACE1:foo:AC_TRACE1(bar, baz)
-configure.ac:5:TRACE2:AC_TRACE1(bar, baz)
+configure.ac:5:TRACE1:bar:baz
+configure.ac:5:TRACE2:baz
+configure.ac:5:TRACE1:foo::baz
+configure.ac:5:TRACE2::baz
 configure.ac:6:TRACE1:foo:ACTIVE:baz
 configure.ac:6:TRACE2:ACTIVE:baz
 configure.ac:7:TRACE1:ACTIVE:active
@@ -136,7 +137,9 @@ AC_DEFUN([TRACE2], [[$2], $1])
 [[
 [foo], [bar], [baz].
 
-[foo], [AC_TRACE1(bar, baz)], [].
+[bar], [baz], [].
+
+[foo], [], [baz].
 
 [foo], [ACTIVE], [baz].
 
@@ -148,7 +151,8 @@ AC_DEFUN([TRACE2], [[$2], $1])
 # address@hidden
 AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE2:'${)===(}@'], 0,
 [[[bar])===([baz]
-[AC_TRACE1(bar, baz)]
+[baz]
+[])===([baz]
 [ACTIVE])===([baz]
 [active]
 [active])===([])===([ACTIVE]



reply via email to

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