[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08-fail-on-undefined.patch
From: |
Akim Demaille |
Subject: |
08-fail-on-undefined.patch |
Date: |
Thu, 18 Jan 2001 01:03:04 +0100 |
Index: ChangeLog
from Akim Demaille <address@hidden>
* 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.
Index: m4sugar.m4
--- m4sugar.m4 Wed, 17 Jan 2001 21:51:05 +0100 akim (ace/b/27_libm4.m4 1.51 644)
+++ m4sugar.m4 Wed, 17 Jan 2001 21:51:14 +0100 akim (ace/b/27_libm4.m4 1.51 644)
@@ -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_define([m4_dumpdefs],
# 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], $@)])
Index: tests/aclocal.m4
--- tests/aclocal.m4 Tue, 12 Dec 2000 20:23:51 +0100 akim (ace/b/23_actest.m4
1.20 666)
+++ tests/aclocal.m4 Wed, 17 Jan 2001 22:16:30 +0100 akim (ace/b/23_actest.m4
1.20 666)
@@ -49,17 +49,3 @@
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))])
Index: tests/torture.at
--- tests/torture.at Sat, 23 Dec 2000 11:36:46 +0100 akim (ace/b/26_torture.m4
1.24 644)
+++ tests/torture.at Wed, 17 Jan 2001 22:36:41 +0100 akim (ace/b/26_torture.m4
1.24 644)
@@ -207,13 +207,15 @@
## 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,
address@hidden(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 @@ m4_define]([AC_DEFUBST_VALUE], Big_Value
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)
- 08-fail-on-undefined.patch,
Akim Demaille <=