autoconf-patches
[Top][All Lists]
Advanced

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

30-m4sh-diversions.patch


From: Akim Demaille
Subject: 30-m4sh-diversions.patch
Date: Mon, 20 Aug 2001 16:47:37 +0200

This is a preliminary to having a better interaction between M4sh and
its client layers, such as Autotest.


Index: ChangeLog
from  Akim Demaille  <address@hidden>

        Let M4sh have its own diversions.

        * lib/autoconf/general.m4 (_m4_divert(BINSH), _m4_divert(REVISION))
        (_m4_divert(NOTICE)): Rename as...
        * lib/m4sugar/m4msh.m4 (_m4_divert(BINSH), _m4_divert(HEADER-REVISION))
        (_m4_divert(HEADER-COMMENT)): these.
        (_m4_divert(HEADER-COPYRIGHT), _m4_divert(HEADER-COPYRIGHT)): New.
        (_m4_divert(NOTICE)): New, for Libtool.
        * lib/autoconf/general.m4 (_m4_divert(PREPARE)): Remove, replaced
        long ago with `_m4_divert(GROW)'.
        (AC_COPYRIGHT, AC_REVISION, _AC_INIT_NOTICE): Adjust.

Index: lib/autoconf/general.m4
--- lib/autoconf/general.m4 Tue, 14 Aug 2001 01:47:02 +0200 akim
+++ lib/autoconf/general.m4 Sun, 19 Aug 2001 11:25:54 +0200 akim
@@ -2,7 +2,7 @@
 # Parameterized macros.
 # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
 # Free Software Foundation, Inc.
-#
+
 # 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)
@@ -17,7 +17,7 @@
 # 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
@@ -65,11 +65,16 @@
 # it reaches the end of `configure.ac'.
 #
 # - BINSH
-#   AC_REQUIRE'd #! /bin/sh line
-# - REVISION
+#   #! /bin/sh
+# - HEADER-REVISION
 #   Sent by AC_REVISION
-# - NOTICE
-#   copyright notice(s)
+# - HEADER-COMMENT
+#   Purpose of the script.
+# - HEADER-COPYRIGHT
+#   Copyright notice(s)
+# - M4SH-INIT
+#   Initialization of bottom layers.
+#
 # - DEFAULTS
 #   early initializations (defaults)
 # - PARSE_ARGS
@@ -113,30 +118,36 @@
 # 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(REVISION)],        1)
-m4_define([_m4_divert(NOTICE)],          2)
-m4_define([_m4_divert(DEFAULTS)],        3)
-m4_define([_m4_divert(PARSE_ARGS)],      4)
-
-m4_define([_m4_divert(HELP_BEGIN)],     10)
-m4_define([_m4_divert(HELP_CANON)],     11)
-m4_define([_m4_divert(HELP_ENABLE)],    12)
-m4_define([_m4_divert(HELP_WITH)],      13)
-m4_define([_m4_divert(HELP_VAR)],       14)
-m4_define([_m4_divert(HELP_VAR_END)],   15)
-m4_define([_m4_divert(HELP_END)],       16)
-
-m4_define([_m4_divert(VERSION_BEGIN)],  20)
-m4_define([_m4_divert(VERSION_FSF)],    21)
-m4_define([_m4_divert(VERSION_USER)],   22)
-m4_define([_m4_divert(VERSION_END)],    23)
-
-m4_define([_m4_divert(INIT_PREPARE)],   30)
+#
+# From M4sugar:
+# -1. KILL
+#
+# From M4sh:
+#  0. BINSH
+#  1. HEADER-REVISION
+#  2. HEADER-COMMENT
+#  3. HEADER-COPYRIGHT
+#  4. M4SH-INIT
+
+m4_define([_m4_divert(DEFAULTS)],        10)
+m4_define([_m4_divert(PARSE_ARGS)],      20)
+
+m4_define([_m4_divert(HELP_BEGIN)],     100)
+m4_define([_m4_divert(HELP_CANON)],     101)
+m4_define([_m4_divert(HELP_ENABLE)],    102)
+m4_define([_m4_divert(HELP_WITH)],      103)
+m4_define([_m4_divert(HELP_VAR)],       104)
+m4_define([_m4_divert(HELP_VAR_END)],   105)
+m4_define([_m4_divert(HELP_END)],       106)
+
+m4_define([_m4_divert(VERSION_BEGIN)],  200)
+m4_define([_m4_divert(VERSION_FSF)],    201)
+m4_define([_m4_divert(VERSION_USER)],   202)
+m4_define([_m4_divert(VERSION_END)],    203)

-m4_define([_m4_divert(BODY)],           40)
+m4_define([_m4_divert(INIT_PREPARE)],   300)

-m4_define([_m4_divert(PREPARE)],       100)
+m4_define([_m4_divert(BODY)],           400)



@@ -466,7 +477,7 @@ m4_define([AC_PACKAGE_BUGREPORT], [$3])
 #
 #     m4_patsubst(m4_quote($1), [^], [# ])
 m4_define([AC_COPYRIGHT],
-[m4_divert_text([NOTICE],
+[m4_divert_text([HEADER-COPYRIGHT],
 [m4_patsubst([
 $1], [^], address@hidden:@ ])])dnl
 m4_divert_text(m4_default([$2], [VERSION_USER]),
@@ -480,7 +491,7 @@ m4_define([AC_COPYRIGHT],
 # The second quote in the translit is just to cope with font-lock-mode
 # which sees the opening of a string.
 m4_define([AC_REVISION],
-[m4_divert_text([REVISION],
+[m4_divert_text([HEADER-REVISION],
                 address@hidden:@ From __file__ m4_translit([$1], [$""]).])dnl
 ])

@@ -534,13 +545,13 @@ m4_define([AC_PREREQ],
 # _AC_INIT_NOTICE
 # ---------------
 m4_define([_AC_INIT_NOTICE],
-[m4_divert_text([NOTICE],
+[m4_divert_text([HEADER-COMMENT],
 address@hidden:@ Guess values for system-dependent variables and create 
Makefiles.
 @%:@ Generated by Autoconf AC_ACVERSION[]dnl
 m4_ifset([AC_PACKAGE_STRING], [ for AC_PACKAGE_STRING]).])

 m4_ifset([AC_PACKAGE_BUGREPORT],
-         [m4_divert_text([NOTICE],
+         [m4_divert_text([HEADER-COMMENT],
                          address@hidden:@
 @%:@ Report bugs to <AC_PACKAGE_BUGREPORT>.])])
 ])
@@ -1385,7 +1396,7 @@ m4_define([_AC_INIT_PREPARE],
 # AC_PLAIN_SCRIPT
 # ---------------
 # Simulate AC_INIT, i.e., pretend this is the beginning of the `configure'
-# generation.  This is used by some tests, and let `autoconf' be used to
+# generation.  This is used by some tests, and lets `autoconf' be used to
 # generate other scripts than `configure'.
 m4_define([AC_PLAIN_SCRIPT],
 [AS_INIT
Index: lib/m4sugar/m4sh.m4
--- lib/m4sugar/m4sh.m4 Thu, 26 Jul 2001 21:23:21 +0200 akim
+++ lib/m4sugar/m4sh.m4 Sun, 19 Aug 2001 11:25:54 +0200 akim
@@ -50,6 +50,44 @@
 # and many other people.


+# We heavily use m4's diversions both for the initializations and for
+# required macros (see m4_require), because in both cases we have to
+# issue high in `configure' something which is discovered late.
+#
+# 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)
+# - M4SH-INIT
+#   M4sh's initializations
+
+
+
+# _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)
+m4_define([_m4_divert(M4SH-INIT)],         4)
+
+# 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)])
+
+
+
 ## ------------------------- ##
 ## 1. Sanitizing the shell.  ##
 ## ------------------------- ##
@@ -58,7 +96,12 @@
 # -----------------
 # Try to be as Bourne and/or POSIX as possible.
 m4_defun([AS_SHELL_SANITIZE],
-[# Be Bourne compatible
+[
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
@@ -127,6 +170,8 @@ m4_define([AS_EXIT],
 # |   IF-FALSE
 # | fi
 # with simplifications is IF-TRUE and/or IF-FALSE is empty.
+#
+# FIXME: Be n-ary, just as m4_if.
 m4_define([AS_IF],
 [m4_ifval([$2$3],
 [if $1; then
Index: lib/m4sugar/m4sugar.m4
--- lib/m4sugar/m4sugar.m4 Sun, 05 Aug 2001 22:21:13 +0200 akim
+++ lib/m4sugar/m4sugar.m4 Sun, 19 Aug 2001 11:25:54 +0200 akim
@@ -766,8 +766,6 @@ m4_define([m4_undivert],
 [m4_builtin([undivert], _m4_divert([$1]))])


-
-
 ## -------------------------------------------- ##
 ## 8. Defining macros with bells and whistles.  ##
 ## -------------------------------------------- ##



reply via email to

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