* m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Unlike the

builtin, fail on undefined symbols.
* tests/torture.at (Torturing config.status): Stop playing nasty
tricks with changequote.
(AC_DEFUBST): Move here from...
* tests/aclocal.m4: there.
This commit is contained in:
Akim Demaille 2001-01-18 09:15:52 +00:00
parent 70b6f5cc93
commit f81b72c915
5 changed files with 93 additions and 67 deletions

View File

@ -1,3 +1,12 @@
2001-01-18 Akim Demaille <akim@epita.fr>
* m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Unlike the
builtin, fail on undefined symbols.
* tests/torture.at (Torturing config.status): Stop playing nasty
tricks with changequote.
(AC_DEFUBST): Move here from...
* tests/aclocal.m4: there.
2001-01-18 Akim Demaille <akim@epita.fr>
Various cleanups and consistency checks.

View File

@ -449,19 +449,14 @@ m4_define([m4_default],
[m4_ifval([$1], [$1], [$2])])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
m4_define([m4_shiftn],
[m4_assert(($1 >= 0) && ($# > $1))dnl
_m4_shiftn($@)])
m4_define([_m4_shiftn],
[m4_if([$1], 0,
[m4_shift($@)],
[_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
# m4_defn(NAME)
# -------------
# Unlike to the original, don't tolerate popping something which is
# undefined.
m4_define([m4_defn],
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([defn], $@)])
# _m4_dumpdefs_up(NAME)
@ -497,7 +492,7 @@ _m4_dumpdefs_down([$1])])
# Unlike to the original, don't tolerate popping something which is
# undefined.
m4_define([m4_popdef],
[m4_ifndef([$1]
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([popdef], $@)])
@ -524,12 +519,25 @@ m4_define([m4_noquote],
[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
m4_define([m4_shiftn],
[m4_assert(($1 >= 0) && ($# > $1))dnl
_m4_shiftn($@)])
m4_define([_m4_shiftn],
[m4_if([$1], 0,
[m4_shift($@)],
[_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
# m4_undefine(NAME)
# -----------------
# Unlike to the original, don't tolerate undefining something which is
# undefined.
m4_define([m4_undefine],
[m4_ifndef([$1]
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([undefine], $@)])

View File

@ -449,19 +449,14 @@ m4_define([m4_default],
[m4_ifval([$1], [$1], [$2])])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
m4_define([m4_shiftn],
[m4_assert(($1 >= 0) && ($# > $1))dnl
_m4_shiftn($@)])
m4_define([_m4_shiftn],
[m4_if([$1], 0,
[m4_shift($@)],
[_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
# m4_defn(NAME)
# -------------
# Unlike to the original, don't tolerate popping something which is
# undefined.
m4_define([m4_defn],
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([defn], $@)])
# _m4_dumpdefs_up(NAME)
@ -497,7 +492,7 @@ _m4_dumpdefs_down([$1])])
# Unlike to the original, don't tolerate popping something which is
# undefined.
m4_define([m4_popdef],
[m4_ifndef([$1]
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([popdef], $@)])
@ -524,12 +519,25 @@ m4_define([m4_noquote],
[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])])
# m4_shiftn(N, ...)
# -----------------
# Returns ... shifted N times. Useful for recursive "varargs" constructs.
m4_define([m4_shiftn],
[m4_assert(($1 >= 0) && ($# > $1))dnl
_m4_shiftn($@)])
m4_define([_m4_shiftn],
[m4_if([$1], 0,
[m4_shift($@)],
[_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])])
# m4_undefine(NAME)
# -----------------
# Unlike to the original, don't tolerate undefining something which is
# undefined.
m4_define([m4_undefine],
[m4_ifndef([$1]
[m4_ifndef([$1],
[m4_fatal([$0: undefined: $1])])dnl
m4_builtin([undefine], $@)])

14
tests/aclocal.m4 vendored
View File

@ -49,17 +49,3 @@ test $? = 0 || rm -f state-env.$1
ls -1 | grep -v '^state' | sort >state-ls.$1
])# AC_STATE_SAVE
# AC_DEFUBST(NAME)
# ----------------
# Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
# used in the torture tests.
m4_defun([AC_DEFUBST],
[AC_DUMMY_VAR($1)="AC_DEFUBST_VALUE"
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1),
"$AC_DUMMY_VAR($1)",
[Define to a long string if your `Autoconf' works
properly.])
AC_SUBST(AC_DUMMY_VAR($1))])

View File

@ -207,13 +207,15 @@ AT_CLEANUP
## in config.status. sed is used to skip the first two lines
## `Generated by...'.
AT_SETUP([Torturing config.status])
dnl The value used as a big value for AC_DEFINE.
dnl Don't use sh active chars here, below it is also used in a sh
dnl assignment.
m4_define([Big_Value],
m4_define([AT_BIG_VALUE],
[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.])
m4_define([DEFINE_Description],
m4_define([AT_DESCRIPTION],
[Define to a long string if your `Autoconf' works properly.])
@ -230,34 +232,47 @@ m4_define([DEFINE_Description],
m4_define([AT_DUMMY_VAR],
[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])])
dnl This call was quite delicate to write because we didn't want to
dnl produce the 100 commands by hand. Be very careful if you want to
dnl touch something.
AT_SETUP([Torturing config.status])
AT_DATA([dummy.in],
[m4_for([AT_Count], 1, 100, 1,
[@AT_DUMMY_VAR(AT_Count)@
])])
# ------------ #
# configure.ac #
# ------------ #
AT_DATA(configure.ac,
[[AC_INIT
dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and
dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc.
[[m4_define([AC_DUMMY_VAR],]
m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]]
[[m4_define([AC_DESCRIPTION],]
m4_dquote(m4_defn([AT_DESCRIPTION]))[)]]
[[m4_define([AC_BIG_VALUE],]
m4_dquote(m4_defn([AT_BIG_VALUE]))[)]]
[[# AC_DEFUBST(NAME)
# ----------------
# Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is
# used in the torture tests.
m4_defun([AC_DEFUBST],
[AC_DUMMY_VAR($1)="AC_BIG_VALUE"
AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)",
AC_DESCRIPTION)
AC_SUBST(AC_DUMMY_VAR($1))])
AC_INIT
AC_CONFIG_HEADERS(config.h:config.hin)
AC_CONFIG_FILES(dummy)
m4_define]([AC_DEFUBST_VALUE], Big_Value)
dnl The following 4 lines are a transfert from AT_DUMMY_VAR in Autotest
dnl to AC_DUMMY_VAR in Autoconf.
[m4_define]([AC_DUMMY_VAR],
m4_changequote({{, }})dnl
[m4_defn({{AT_DUMMY_VAR}})]dnl
m4_changequote([, ]))
m4_for(AT_Count, 1, 100, 1,
[AC_DEFUBST(AT_Count)
])
m4_for(AC_Count, 1, 100, 1,
[AC_DEFUBST(AC_Count)])
AC_OUTPUT
])
]])# configure.ac
AT_CHECK_AUTOCONF
AT_CHECK_AUTOHEADER
@ -267,15 +282,15 @@ AT_CHECK_CONFIGURE
AT_DATA(expout,
[m4_for(AT_Count, 1, 100, 1,
[
/* DEFINE_Description */
[#define] AT_DUMMY_VAR(AT_Count) "Big_Value"
/* AT_DESCRIPTION */
[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE"
])])
AT_CHECK([sed -n -e '3,$ p' config.h], 0, expout)
AT_CHECK([sed -n '3,$ p' config.h], 0, expout)
# Checking that AC_SUBST worked properly.
AT_DATA(expout,
[m4_for(AT_Count, 1, 100, 1,
[Big_Value
[AT_BIG_VALUE
])])
AT_CLEANUP(dummy)