From: Akim Demaille Date: Wed, 29 Nov 2000 10:11:38 +0000 (+0000) Subject: * tests/atgeneral.m4 (AT_DEFINE, AT_UNDEFINE, AT_SHIFT) X-Git-Tag: autoconf-2.50~387 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acbcc5f2b73f0d93dbc2326dbc292d0e635bef4d;p=thirdparty%2Fautoconf.git * tests/atgeneral.m4 (AT_DEFINE, AT_UNDEFINE, AT_SHIFT) (AT_INCLUDE): Remove, use the m4_ macros. --- diff --git a/ChangeLog b/ChangeLog index dbcecb576..ed86b73fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-11-29 Akim Demaille + + * tests/atgeneral.m4 (AT_DEFINE, AT_UNDEFINE, AT_SHIFT) + (AT_INCLUDE): Remove, use the m4_ macros. + 2000-11-29 Akim Demaille * m4sugar.m4 (ifval, ifset, ifdef, ifndef, m4_ifvanl): Rename as... diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4 index 775042032..a8a78b951 100644 --- a/lib/autotest/general.m4 +++ b/lib/autotest/general.m4 @@ -46,13 +46,6 @@ include(m4sh.m4) -*- Autoconf -*- # version. -m4_define([AT_DEFINE], m4_defn([m4_define])) -m4_define([AT_INCLUDE], m4_defn([m4_include])) -m4_define([AT_SHIFT], m4_defn([m4_shift])) -m4_define([AT_UNDEFINE], m4_defn([m4_undefine])) - - - # Use of diversions: # # - DEFAULT @@ -90,7 +83,7 @@ m4_divert_push([KILL]) # AT_LINE # ------- # Return the current file sans directory, a colon, and the current line. -AT_DEFINE([AT_LINE], +m4_define([AT_LINE], [m4_patsubst(__file__, ^.*/\(.*\), \1):__line__]) @@ -98,8 +91,8 @@ AT_DEFINE([AT_LINE], # ---------------- # Begin testing suite, using PROGRAM to check version. The search path # should be already preset so the proper executable will be selected. -AT_DEFINE([AT_INIT], -[AT_DEFINE([AT_ordinal], 0) +m4_define([AT_INIT], +[m4_define([AT_ordinal], 0) m4_divert_push([DEFAULT])dnl #! /bin/sh @@ -132,7 +125,8 @@ at_debug=false at_help=false # Tests to run at_tests= -m4_divert([OPTIONS])dnl Other vars inserted here. +dnl Other vars inserted here (DEFAULT). +m4_divert([OPTIONS]) while test $[#] -gt 0; do case $[1] in @@ -228,6 +222,7 @@ for at_test in $at_tests do at_status=0; case $at_test in +dnl Tests inserted here (TESTS). m4_divert([TAIL])[]dnl esac at_test_count=`expr 1 + $at_test_count` @@ -310,8 +305,8 @@ at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl # --------------------- # Start a group of related tests, all to be executed in the same subshell. # The group is testing what DESCRIPTION says. -AT_DEFINE([AT_SETUP], -[m4_define([AT_ordinal], m4_eval(AT_ordinal + 1)) +m4_define([AT_SETUP], +[m4_define([AT_ordinal], m4_incr(AT_ordinal)) m4_divert_text([HELP], [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])]) m4_pushdef([AT_data_files], [stdout stderr ]) @@ -335,7 +330,7 @@ m4_divert([TEST])[]dnl # AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED) # -------------------------------------------------------------- -AT_DEFINE([AT_CLEANUP_FILE_IFELSE], +m4_define([AT_CLEANUP_FILE_IFELSE], [ifelse(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), -1, [$3], [$2])]) @@ -344,7 +339,7 @@ AT_DEFINE([AT_CLEANUP_FILE_IFELSE], # AT_CLEANUP_FILE(FILE) # --------------------- # Register FILE for AT_CLEANUP. -AT_DEFINE([AT_CLEANUP_FILE], +m4_define([AT_CLEANUP_FILE], [AT_CLEANUP_FILE_IFELSE([$1], [], [m4_append([AT_data_files], [$1 ])])]) @@ -352,7 +347,7 @@ AT_DEFINE([AT_CLEANUP_FILE], # AT_CLEANUP_FILES(FILES) # ----------------------- # Declare a list of FILES to clean. -AT_DEFINE([AT_CLEANUP_FILES], +m4_define([AT_CLEANUP_FILES], [m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [ *], [,])), [AT_CLEANUP_FILE(AT_File)])]) @@ -362,7 +357,7 @@ AT_DEFINE([AT_CLEANUP_FILES], # Complete a group of related tests, recursively remove those FILES # created within the test. There is no need to list stdout, stderr, # nor files created with AT_DATA. -AT_DEFINE([AT_CLEANUP], +m4_define([AT_CLEANUP], [AT_CLEANUP_FILES([$1])dnl $at_traceoff ) @@ -382,7 +377,7 @@ m4_divert_pop()dnl # an end of line. # This macro is not robust to active symbols in CONTENTS *on purpose*. # If you don't want CONTENT to be evaluated, quote it twice. -AT_DEFINE([AT_DATA], +m4_define([AT_DATA], [AT_CLEANUP_FILES([$1])dnl cat >$1 <<'_ATEOF' $2[]_ATEOF @@ -400,14 +395,14 @@ $2[]_ATEOF # STATUS is not checked if it is empty. # STDOUT and STDERR can be the special value `ignore', in which case # their content is not checked. -AT_DEFINE([AT_CHECK], +m4_define([AT_CHECK], [$at_traceoff $at_verbose "$srcdir/AT_LINE: m4_patsubst([$1], [\([\"`$]\)], \\\1)" echo AT_LINE >at-check-line $at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr $at_traceon $1 -ifelse([$2], [], [], +m4_ifval([$2], [at_status=$? if test $at_status != $2; then $at_verbose "Exit code was $at_status, expected $2" >&6 diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 6703cac8b..95e18cc8e 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -179,8 +179,8 @@ m4_expansion_stack_dump()dnl m4_exit(ifelse([$2],, 1, [$2]))]) -# m4_assert( EXPRESSION [, EXIT-STATUS = 1 ]) -# ------------------------------------------- +# m4_assert(EXPRESSION, [EXIT-STATUS = 1]) +# ---------------------------------------- # This macro ensures that EXPRESSION evaluates to true, and exits if # EXPRESSION evaluates to false. m4_define([m4_assert], diff --git a/m4sugar.m4 b/m4sugar.m4 index 6703cac8b..95e18cc8e 100644 --- a/m4sugar.m4 +++ b/m4sugar.m4 @@ -179,8 +179,8 @@ m4_expansion_stack_dump()dnl m4_exit(ifelse([$2],, 1, [$2]))]) -# m4_assert( EXPRESSION [, EXIT-STATUS = 1 ]) -# ------------------------------------------- +# m4_assert(EXPRESSION, [EXIT-STATUS = 1]) +# ---------------------------------------- # This macro ensures that EXPRESSION evaluates to true, and exits if # EXPRESSION evaluates to false. m4_define([m4_assert], diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4 index 775042032..a8a78b951 100644 --- a/tests/atgeneral.m4 +++ b/tests/atgeneral.m4 @@ -46,13 +46,6 @@ include(m4sh.m4) -*- Autoconf -*- # version. -m4_define([AT_DEFINE], m4_defn([m4_define])) -m4_define([AT_INCLUDE], m4_defn([m4_include])) -m4_define([AT_SHIFT], m4_defn([m4_shift])) -m4_define([AT_UNDEFINE], m4_defn([m4_undefine])) - - - # Use of diversions: # # - DEFAULT @@ -90,7 +83,7 @@ m4_divert_push([KILL]) # AT_LINE # ------- # Return the current file sans directory, a colon, and the current line. -AT_DEFINE([AT_LINE], +m4_define([AT_LINE], [m4_patsubst(__file__, ^.*/\(.*\), \1):__line__]) @@ -98,8 +91,8 @@ AT_DEFINE([AT_LINE], # ---------------- # Begin testing suite, using PROGRAM to check version. The search path # should be already preset so the proper executable will be selected. -AT_DEFINE([AT_INIT], -[AT_DEFINE([AT_ordinal], 0) +m4_define([AT_INIT], +[m4_define([AT_ordinal], 0) m4_divert_push([DEFAULT])dnl #! /bin/sh @@ -132,7 +125,8 @@ at_debug=false at_help=false # Tests to run at_tests= -m4_divert([OPTIONS])dnl Other vars inserted here. +dnl Other vars inserted here (DEFAULT). +m4_divert([OPTIONS]) while test $[#] -gt 0; do case $[1] in @@ -228,6 +222,7 @@ for at_test in $at_tests do at_status=0; case $at_test in +dnl Tests inserted here (TESTS). m4_divert([TAIL])[]dnl esac at_test_count=`expr 1 + $at_test_count` @@ -310,8 +305,8 @@ at_tests_all="m4_for([i], 1, AT_ordinal, 1, [i ])"])])dnl # --------------------- # Start a group of related tests, all to be executed in the same subshell. # The group is testing what DESCRIPTION says. -AT_DEFINE([AT_SETUP], -[m4_define([AT_ordinal], m4_eval(AT_ordinal + 1)) +m4_define([AT_SETUP], +[m4_define([AT_ordinal], m4_incr(AT_ordinal)) m4_divert_text([HELP], [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])]) m4_pushdef([AT_data_files], [stdout stderr ]) @@ -335,7 +330,7 @@ m4_divert([TEST])[]dnl # AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED) # -------------------------------------------------------------- -AT_DEFINE([AT_CLEANUP_FILE_IFELSE], +m4_define([AT_CLEANUP_FILE_IFELSE], [ifelse(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [\([\[\]*.]\)], [\\\1])), -1, [$3], [$2])]) @@ -344,7 +339,7 @@ AT_DEFINE([AT_CLEANUP_FILE_IFELSE], # AT_CLEANUP_FILE(FILE) # --------------------- # Register FILE for AT_CLEANUP. -AT_DEFINE([AT_CLEANUP_FILE], +m4_define([AT_CLEANUP_FILE], [AT_CLEANUP_FILE_IFELSE([$1], [], [m4_append([AT_data_files], [$1 ])])]) @@ -352,7 +347,7 @@ AT_DEFINE([AT_CLEANUP_FILE], # AT_CLEANUP_FILES(FILES) # ----------------------- # Declare a list of FILES to clean. -AT_DEFINE([AT_CLEANUP_FILES], +m4_define([AT_CLEANUP_FILES], [m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [ *], [,])), [AT_CLEANUP_FILE(AT_File)])]) @@ -362,7 +357,7 @@ AT_DEFINE([AT_CLEANUP_FILES], # Complete a group of related tests, recursively remove those FILES # created within the test. There is no need to list stdout, stderr, # nor files created with AT_DATA. -AT_DEFINE([AT_CLEANUP], +m4_define([AT_CLEANUP], [AT_CLEANUP_FILES([$1])dnl $at_traceoff ) @@ -382,7 +377,7 @@ m4_divert_pop()dnl # an end of line. # This macro is not robust to active symbols in CONTENTS *on purpose*. # If you don't want CONTENT to be evaluated, quote it twice. -AT_DEFINE([AT_DATA], +m4_define([AT_DATA], [AT_CLEANUP_FILES([$1])dnl cat >$1 <<'_ATEOF' $2[]_ATEOF @@ -400,14 +395,14 @@ $2[]_ATEOF # STATUS is not checked if it is empty. # STDOUT and STDERR can be the special value `ignore', in which case # their content is not checked. -AT_DEFINE([AT_CHECK], +m4_define([AT_CHECK], [$at_traceoff $at_verbose "$srcdir/AT_LINE: m4_patsubst([$1], [\([\"`$]\)], \\\1)" echo AT_LINE >at-check-line $at_check_stds && exec 5>&1 6>&2 1>stdout 2>stderr $at_traceon $1 -ifelse([$2], [], [], +m4_ifval([$2], [at_status=$? if test $at_status != $2; then $at_verbose "Exit code was $at_status, expected $2" >&6 diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 index f792ac3c9..4af80db88 100644 --- a/tests/atspecific.m4 +++ b/tests/atspecific.m4 @@ -1,5 +1,5 @@ -divert(-1) -*- Autoconf -*- -# `m4' macros used in building Autoconf test suites. +include(atgeneral.m4) -*- Autoconf -*- +# M4 macros used in building Autoconf test suites. # 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 @@ -16,9 +16,6 @@ divert(-1) -*- Autoconf -*- # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. -include(atgeneral.m4)m4_divert(-1) - - ## ---------------------------------------- ## ## Macros specialized in testing Autoconf. ## @@ -27,21 +24,21 @@ include(atgeneral.m4)m4_divert(-1) # AT_CHECK_AUTOCONF # ----------------- -AT_DEFINE([AT_CHECK_AUTOCONF], +m4_define([AT_CHECK_AUTOCONF], [AT_CLEANUP_FILES(configure)dnl AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], [])]) # AT_CHECK_AUTOHEADER # ------------------- -AT_DEFINE([AT_CHECK_AUTOHEADER], +m4_define([AT_CHECK_AUTOHEADER], [AT_CLEANUP_FILES(config.hin)dnl AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])]) # AT_CHECK_CONFIGURE # ------------------- -AT_DEFINE([AT_CHECK_CONFIGURE], +m4_define([AT_CHECK_CONFIGURE], [AT_CLEANUP_FILE_IFELSE([config.hin], [AT_CLEANUP_FILE(config.h)])dnl AT_CLEANUP_FILES(config.log config.status config.cache)dnl @@ -56,7 +53,7 @@ test $at_verbose = echo && echo "--- config.log" && cat config.log]) # and that the shell runs correctly the configure. # TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', # `config.guess' etc.). -AT_DEFINE([_AT_CHECK_AC_MACRO], +m4_define([_AT_CHECK_AC_MACRO], [dnl Produce the configure.in AT_CLEANUP_FILES(env-after state*)dnl AT_DATA([configure.in], @@ -91,7 +88,7 @@ fi # and that the shell runs correctly the configure. # TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', # `config.guess' etc.). -AT_DEFINE([AT_CHECK_MACRO], +m4_define([AT_CHECK_MACRO], [AT_SETUP([$1]) _AT_CHECK_AC_MACRO([ifelse([$2],,[$1], [$2])]) @@ -107,7 +104,7 @@ AT_CLEANUP()dnl # on that script, and that the shell runs correctly the configure. # TOP_SRCDIR is needed to set the auxdir (some macros need # `install-sh', `config.guess' etc.). -AT_DEFINE([AT_CHECK_UPDATE], +m4_define([AT_CHECK_UPDATE], [AT_SETUP([the autoupdating of $1]) _AT_CHECK_AC_MACRO([$1], @@ -125,5 +122,5 @@ AT_CLEANUP()dnl # Stripping consists of keeping CPP lines (i.e. containing a hash), # but those of automatically checked features (STDC_HEADERS etc.). # AT_CHECK_HEADER is a better name, but too close from AC_CHECK_HEADER. -AT_DEFINE(AT_CHECK_DEFINES, +m4_define([AT_CHECK_DEFINES], [AT_CHECK([[fgrep '#' config.h | grep -v 'STDC_HEADERS']],, [$1])]) diff --git a/tests/semantics.at b/tests/semantics.at index 0d55023e8..046c14f40 100644 --- a/tests/semantics.at +++ b/tests/semantics.at @@ -28,7 +28,7 @@ AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this, # in libm. Nor can I imagine a lib more likely to exists than libm. # But there are systems without libm, on which we don't want to have # this test fail, so exit successfully if `cos' is in libc. -AT_CHECK_MACRO(AC_CHECK_LIB, +AT_CHECK_MACRO([AC_CHECK_LIB], [AC_TRY_LINK_FUNC(cos, [AS_EXIT(0)]) AC_CHECK_LIB(m, cos,, [AC_MSG_ERROR([cannot find `cos'])])]) @@ -38,7 +38,7 @@ AC_CHECK_LIB(m, cos,, # -------------- # Check that it performs the correct actions: # Must define NEED_NO_DECL, but not NEED_YES_DECL. -AT_CHECK_MACRO(AC_CHECK_DECLS, +AT_CHECK_MACRO([AC_CHECK_DECLS], [[AC_CHECK_DECLS([yes, no],,, [int yes = 1;])]], [AT_CHECK_DEFINES( @@ -76,7 +76,7 @@ AT_CHECK_MACRO([AC_HAVE_FUNCS], # ---------------- # Check that it performs the correct actions: # Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H. -AT_CHECK_MACRO(AC_CHECK_HEADERS, +AT_CHECK_MACRO([AC_CHECK_HEADERS], [AC_CHECK_HEADERS(stdio.h autoconf_io.h)], [AT_CHECK_DEFINES( [/* #undef HAVE_AUTOCONF_IO_H */ @@ -89,7 +89,7 @@ AT_CHECK_MACRO(AC_CHECK_HEADERS, # ---------------- # Check that it performs the correct actions. # Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO. -AT_CHECK_MACRO(AC_CHECK_MEMBERS, +AT_CHECK_MACRO([AC_CHECK_MEMBERS], [[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no],,, [struct yes_s { int yes ;} ;])]], [AT_CHECK_DEFINES( @@ -100,7 +100,7 @@ AT_CHECK_MACRO(AC_CHECK_MEMBERS, # AC_CHECK_SIZEOF # --------------- -AT_CHECK_MACRO(AC_CHECK_SIZEOF, +AT_CHECK_MACRO([AC_CHECK_SIZEOF], [AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(charchar,, [#include @@ -138,7 +138,7 @@ AC_CHECK_SIZEOF(ucharcharchar)], # Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S. # `int' and `struct yes_s' are both checked to test both the compiler # builtin types, and defined types. -AT_CHECK_MACRO(AC_CHECK_TYPES, +AT_CHECK_MACRO([AC_CHECK_TYPES], [[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,, [struct yes_s { int yes ;} ;])]], [AT_CHECK_DEFINES( @@ -192,7 +192,7 @@ AT_CLEANUP(autoconf.err) # -------------- # FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to # open AH_TEMPLATE to `configure.in', which is not yet the case. -AT_CHECK_MACRO(AC_CHECK_FILES, +AT_CHECK_MACRO([AC_CHECK_FILES], [touch ac-exists1 ac-exists2 ac_exists2=ac-exists2 ac_missing2=ac-missing2 @@ -214,7 +214,7 @@ rm ac-exists1 ac-exists2], # ---------------------- # Create a sub directory `path' with 6 subdirs which all 7 contain # an executable `tool'. `6' contains a `better' tool. -AT_DEFINE([AT_CHECK_PROGS_PREPARE], +m4_define([AT_CHECK_PROGS_PREPARE], [mkdir path cat >path/tool <<\EOF @@ -235,7 +235,7 @@ cp path/tool path/6/better]) # AC_CHECK_PROG & AC_CHECK_PROGS. # # -------------------------------- # -AT_SETUP(AC_CHECK_PROG & AC_CHECK_PROGS) +AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS]) AT_CHECK_PROGS_PREPARE diff --git a/tests/suite.at b/tests/suite.at index c27e8c171..58abac105 100644 --- a/tests/suite.at +++ b/tests/suite.at @@ -17,32 +17,32 @@ EOF # the most selective to the easiest. # M4sugar. -AT_INCLUDE([m4sugar.at]) +m4_include([m4sugar.at]) # M4sh.m4. -AT_INCLUDE([m4sh.at]) +m4_include([m4sh.at]) # Autoconf base macros. -AT_INCLUDE([base.at]) +m4_include([base.at]) # The executables. -AT_INCLUDE([tools.at]) +m4_include([tools.at]) # Testing config.status # --------------------- # Actually should be named config.status.at but I fear problems with # the name. Does no `checking...' at all, but exercises only code # which following section use too. Hence, run it first. -AT_INCLUDE([torture.at]) +m4_include([torture.at]) # Checking AC_PROG_CC, AC_COMPILE_IFELSE etc. -AT_INCLUDE([compile.at]) +m4_include([compile.at]) # Checking that AC_CHECK_FOO macros work properly. -AT_INCLUDE([semantics.at]) +m4_include([semantics.at]) # Checking all the AC_DEFUN'd macros. -AT_INCLUDE([syntax.at]) +m4_include([syntax.at]) # Checking that updating an obsolete macro produces a valid configure.in -AT_INCLUDE([update.at]) +m4_include([update.at])