From: Akim Demaille Date: Mon, 20 Aug 2001 14:44:48 +0000 (+0000) Subject: Let M4sh have its own diversions. X-Git-Tag: AUTOCONF-2.52d~74 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0c375ab2671966191ce2cae173fdf96a2bb5568;p=thirdparty%2Fautoconf.git 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. --- diff --git a/ChangeLog b/ChangeLog index 95397601e..55c8c83ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-08-20 Akim Demaille + + 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. + 2001-08-20 Akim Demaille * tests/base.at, tests/compile.at, tests/foreign.at, diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index da785adaf..5507fd2da 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -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) +# +# From M4sugar: +# -1. KILL +# +# From M4sh: +# 0. BINSH +# 1. HEADER-REVISION +# 2. HEADER-COMMENT +# 3. HEADER-COPYRIGHT +# 4. M4SH-INIT -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(DEFAULTS)], 10) +m4_define([_m4_divert(PARSE_ARGS)], 20) -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(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(INIT_PREPARE)], 30) +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], [^], [@%:@ ])])dnl m4_divert_text(m4_default([$2], [VERSION_USER]), @@ -480,7 +491,7 @@ $1])dnl # 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], [@%:@ 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], [@%:@ 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], [@%:@ @%:@ Report bugs to .])]) ]) @@ -1385,7 +1396,7 @@ AC_CONFIG_SRCDIR([$1])], [[AC_INIT]])])[]dnl # 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 diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index a137d5196..ea732cfed 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -50,6 +50,44 @@ changequote()changequote([, ])include(m4sugar/m4sugar.m4)# -*- Autoconf -*- # 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 @@ changequote()changequote([, ])include(m4sugar/m4sugar.m4)# -*- Autoconf -*- # ----------------- # 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 diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 10472d88a..9aa6d6451 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -766,8 +766,6 @@ m4_define([m4_undivert], [m4_builtin([undivert], _m4_divert([$1]))]) - - ## -------------------------------------------- ## ## 8. Defining macros with bells and whistles. ## ## -------------------------------------------- ##