]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autotest/general.m4 (AT_INIT): Remove the diversion HELP and
authorAkim Demaille <akim@epita.fr>
Mon, 10 Sep 2001 07:18:17 +0000 (07:18 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 10 Sep 2001 07:18:17 +0000 (07:18 +0000)
SETUP: no longer used.
Support -k, --keywords.
<at_help>: Be `no', `short', or `long'.
<at_help_all>: New variable.
(AT_KEYWORDS): New.
(AT_CLEANUP_FILE_IFELSE, AT_CLEANUP_FILE): Rename as...
(_AT_CLEANUP_FILE_IF, _AT_CLEANUP_FILE): these.
(_AT_CLEANUP_FILE_IF): Simplify the regexp.
(AT_SETUP): Reset AT_line, AT_keywords, AT_description.
No longer fill the HELP diversion.
(AT_CLEANUP): Use them.
* lib/m4sugar/m4sugar.m4 (m4_append): Support a separator.
(m4_list_append): Remove.
Spread a few keywords in the Autoconf test suite.

ChangeLog
lib/autotest/general.m4
lib/m4sugar/m4sugar.m4
tests/atspecific.m4
tests/semantics.at
tests/tools.at

index 508727f73771fecdfbb18f244841f21d2f622d05..d0f801478307b44bad4bdbee6c6dd9346d208d6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2001-09-10  Akim Demaille  <akim@epita.fr>
+
+       * lib/autotest/general.m4 (AT_INIT): Remove the diversion HELP and
+       SETUP: no longer used.
+       Support -k, --keywords.
+       <at_help>: Be `no', `short', or `long'.
+       <at_help_all>: New variable.
+       (AT_KEYWORDS): New.
+       (AT_CLEANUP_FILE_IFELSE, AT_CLEANUP_FILE): Rename as...
+       (_AT_CLEANUP_FILE_IF, _AT_CLEANUP_FILE): these.
+       (_AT_CLEANUP_FILE_IF): Simplify the regexp.
+       (AT_SETUP): Reset AT_line, AT_keywords, AT_description.
+       No longer fill the HELP diversion.
+       (AT_CLEANUP): Use them.
+       * lib/m4sugar/m4sugar.m4 (m4_append): Support a separator.
+       (m4_list_append): Remove.
+
+       Spread a few keywords in the Autoconf test suite.
+
 2001-09-10  Akim Demaille  <akim@epita.fr>
 
        * lib/autoconf/autotest.m4 (AC_CONFIG_TESTDIR): Don't pass
index 1978c4299a0fff19353d9f4cee439448f316d52b..eb6471713e8a3454b5e4bc2b00c3f1ead8897b11 100644 (file)
 #    Overall initialization, value of $at_tests_all.
 #  - OPTIONS
 #    Option processing
-#  - HELP
-#    Help message.  Of course it is useless, you could just push into
-#    OPTIONS, but that's much clearer this way.
-#  - SETUP
 #    Be ready to run the tests.
 #  - TESTS
 #    The core of the test suite, the ``normal'' diversion.
@@ -63,8 +59,6 @@
 
 m4_define([_m4_divert(DEFAULT)],       5)
 m4_define([_m4_divert(OPTIONS)],      10)
-m4_define([_m4_divert(HELP)],         20)
-m4_define([_m4_divert(SETUP)],        30)
 m4_define([_m4_divert(TESTS)],        50)
 m4_define([_m4_divert(TAIL)],         60)
 
@@ -139,7 +133,7 @@ at_quiet=echo
 # run by a debug script, so that the script doesn't remove itself.
 at_debug=false
 # Display help message?
-at_help=false
+at_help=no
 # Tests to run
 at_tests=
 dnl Other vars inserted here (DEFAULT).
@@ -147,7 +141,8 @@ m4_divert([OPTIONS])
 
 while test $[@%:@] -gt 0; do
   case $[1] in
-    --help | -h) at_help=: ;;
+    --help | -h) at_help=short ;;
+    --full-help | -H ) at_help=long;;
     --version)
         if test -n "$at_package_string"; then
           echo "$as_me ($at_package_string)"
@@ -156,32 +151,45 @@ while test $[@%:@] -gt 0; do
           echo "$as_me ($at_testsuite_name)"
           echo "Stand-alone test suite."
         fi
-        exit 0 ;;
+        exit 0
+        ;;
+
     --clean | -c )
         rm -rf $at_data_files debug-*.sh $as_me.log devnull
-       exit 0;;
+       exit 0
+        ;;
+
+    -d) at_debug=:
+        ;;
 
-    -d) at_debug=:;;
     -e) at_debug=:
-        at_stop_on_error=:;;
-    -v) at_verbose=echo; at_quiet=:;;
-    -x) at_traceon='set -vx'; at_traceoff='set +vx';;
+        at_stop_on_error=:
+        ;;
+
+    -v) at_verbose=echo; at_quiet=:
+        ;;
+
+    -x) at_traceon='set -vx'; at_traceoff='set +vx'
+        ;;
 
     [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
-        at_tests="$at_tests$[1] ";;
+        at_tests="$at_tests$[1] "
+        ;;
 
     # Ranges
     [[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-])
         at_range_start=`echo $[1] |tr -d '-'`
         at_range=`echo " $at_tests_all " | \
           sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,'`
-        at_tests="$at_tests$at_range ";;
+        at_tests="$at_tests$at_range "
+        ;;
 
     [-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]])
         at_range_end=`echo $[1] |tr -d '-'`
         at_range=`echo " $at_tests_all " | \
           sed -e 's, '$at_range_end' .*$, '$at_range_end','`
-        at_tests="$at_tests$at_range ";;
+        at_tests="$at_tests$at_range "
+        ;;
 
     [[0-9]-[0-9] | [0-9]-[0-9][0-9] | [0-9]-[0-9][0-9][0-9]] | \
     [[0-9]-[0-9][0-9][0-9][0-9] | [0-9][0-9]-[0-9][0-9]] | \
@@ -195,28 +203,44 @@ while test $[@%:@] -gt 0; do
         at_range=`echo " $at_tests_all " | \
           sed -e 's,^.* '$at_range_start' ,'$at_range_start' ,' \
               -e 's, '$at_range_end' .*$, '$at_range_end','`
-        at_tests="$at_tests$at_range ";;
+        at_tests="$at_tests$at_range "
+        ;;
+
+    # Keywords.
+    --keywords | -k )
+        shift
+        at_tests_selected=$at_help_all
+        for at_keyword in `IFS=,; set X $[1]; shift; echo ${1+$[@]}`
+        do
+          at_tests_selected=`echo "$at_tests_selected" |
+                             egrep -i "^[[^;]]*;[[^;]]*;[[^;]]*;.*$at_keyword"`
+        done
+        at_tests_selected=`echo "$at_tests_selected" | sed 's/;.*//'`
+        at_tests="$at_tests$at_tests_selected "
+        ;;
 
     *=*)
-      at_debug_args="$1"
-      at_envvar=`expr "x$[1]" : 'x\([[^=]]*\)='`
-      # Reject names that are not valid shell variable names.
-      expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
-       AS_ERROR([invalid variable name: $at_envvar])
-      at_value=`expr "x$[1]" : 'x[[^=]]*=\(.*\)'`
-      at_value=`echo "$at_value" | sed "s/'/'\\\\\\\\''/g"`
-      eval "$at_envvar='$at_value'"
-      export $at_envvar ;;
+       at_debug_args="$1"
+       at_envvar=`expr "x$[1]" : 'x\([[^=]]*\)='`
+       # Reject names that are not valid shell variable names.
+       expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
+         AS_ERROR([invalid variable name: $at_envvar])
+       at_value=`expr "x$[1]" : 'x[[^=]]*=\(.*\)'`
+       at_value=`echo "$at_value" | sed "s/'/'\\\\\\\\''/g"`
+       eval "$at_envvar='$at_value'"
+       export $at_envvar
+       ;;
 
      *) echo "$as_me: invalid option: $[1]" >&2
         echo "Try \`$[0] --help' for more information." >&2
-        exit 1 ;;
+        exit 1
+        ;;
   esac
   shift
 done
 
 # Help message.
-if $at_help; then
+if test "$at_help" != no; then
   # If tests were specified, display only their title.
   if test -z "$at_tests"; then
     cat <<_ATEOF
@@ -239,11 +263,21 @@ _ATEOF
     at_tests_pattern=`echo "$at_tests" | sed 's/^  *//;s/  *$//;s/  */|/g'`
     at_tests_pattern=" (${at_tests_pattern}): "
   fi
-  egrep -e "$at_tests_pattern" <<_ATEOF
-m4_divert([HELP])dnl Help message inserted here.
-m4_divert([SETUP])dnl
-Report bugs to <$at_bugreport>.
-_ATEOF
+  case $at_help in
+  short)
+    echo "$at_help_all" |
+      egrep -e "$at_tests_pattern" |
+      awk 'BEGIN { FS = ";" }
+           { if ($[1]) printf " %3d: %s\n", $[1], $[3] } ';;
+  long)
+    echo "$at_help_all" |
+      egrep -e "$at_tests_pattern" |
+      awk 'BEGIN { FS = ";" }
+           { if ($[1]) printf " %3d: %-18s %s\n", $[1], $[2], $[3]
+             if ($[4]) printf "      %s\n", $[4] } ';;
+  esac
+  echo
+  echo "Report bugs to <$at_bugreport>."
   exit 0
 fi
 
@@ -549,6 +583,8 @@ m4_divert_pop([TAIL])dnl
 m4_wrap([m4_divert_text([DEFAULT],
                         [# List of the tests.
 at_tests_all="AT_TESTS_ALL "
+# Description of all the tests.
+at_help_all="AT_help"
 # List of the output files.
 at_data_files="AT_data_files "])])dnl
 ])# AT_INIT
@@ -573,50 +609,45 @@ at_victims="$1"
 # Start a group of related tests, all to be executed in the same subshell.
 # The group is testing what DESCRIPTION says.
 m4_define([AT_SETUP],
-[m4_define([AT_ordinal], m4_incr(AT_ordinal))
+[m4_ifdef([AT_keywords], [m4_undefine([AT_keywords])])
+m4_define([AT_line], AT_LINE)
+m4_define([AT_description], [$1])
+m4_define([AT_ordinal], m4_incr(AT_ordinal))
 m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
-m4_divert_text([HELP],
-               [m4_format([[ %3d: %-15s %s]], AT_ordinal, AT_LINE, [$1])])
 m4_divert_push([TESTS])dnl
-  AT_ordinal ) @%:@ AT_ordinal. AT_LINE: $1
-    at_setup_line='AT_LINE'
-    $at_verbose "AT_ordinal. AT_LINE: testing $1..."
-    $at_quiet $at_n "m4_format([[%3d: %-18s]], AT_ordinal, AT_LINE)[]$at_c"
+  AT_ordinal ) @%:@ AT_ordinal. AT_line: $1
+    at_setup_line='AT_line'
+    $at_verbose "AT_ordinal. AT_line: testing $1..."
+    $at_quiet $at_n "m4_format([[%3d: %-18s]], AT_ordinal, AT_line)[]$at_c"
     (
       $at_traceon
 ])
 
 
-# AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED)
-# --------------------------------------------------------------
+# AT_KEYWORDS(KEYOWRDS)
+# ---------------------
+# Declare a list of keywords associated to the current test group.
+m4_define([AT_KEYWORDS],
+[m4_append([AT_keywords], [$1], [,])])
+
+
+
+# _AT_CLEANUP_FILE_IF(FILE, IF-REGISTERED, IF-NOT-REGISTERED)
+# -----------------------------------------------------------
 # We try to build a regular expression matching `[', `]', `*', and
 # `.', i.e., the regexp active characters.
-#
-# Novices would write, `[[]*.]', which sure fails since the character
-# class ends with the first closing braquet.
-# M4 gurus will sure write `[\[\]*.]', but it will fail too because
-# regexp does not support this and understands `\' per se.
-# Regexp gurus will write `[][*.]' which is indeed what Regexp expects,
-# but it will fail for M4 reasons: it's the same as `[*.]'.
-#
-# So the question is:
-#
-#       Can you write a regexp that matches those four characters,
-#       and respects the M4 quotation contraints?
-#
-# The answer is: (rot13) tvira va gur ertrkc orybj, lbh vqvbg!
-m4_define([AT_CLEANUP_FILE_IFELSE],
-[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[[]\|[]]\|[*.]], [\\\&])),
+m4_define([_AT_CLEANUP_FILE_IF],
+[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[][*.]], [\\\&])),
        -1,
        [$3], [$2])])
 
 
-# AT_CLEANUP_FILE(FILE)
-# ---------------------
+# _AT_CLEANUP_FILE(FILE)
+# ----------------------
 # Register FILE for AT_CLEANUP.
-m4_define([AT_CLEANUP_FILE],
-[AT_CLEANUP_FILE_IFELSE([$1], [],
-                        [m4_append([AT_data_files], [$1 ])])])
+m4_define([_AT_CLEANUP_FILE],
+[_AT_CLEANUP_FILE_IF([$1], [],
+                     [m4_append([AT_data_files], [$1 ])])])
 
 
 # AT_CLEANUP_FILES(FILES)
@@ -624,7 +655,7 @@ m4_define([AT_CLEANUP_FILE],
 # Declare a list of FILES to clean.
 m4_define([AT_CLEANUP_FILES],
 [m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [  *], [,])),
-            [AT_CLEANUP_FILE(AT_File)])])
+            [_AT_CLEANUP_FILE(AT_File)])])
 
 
 # AT_CLEANUP(FILES)
@@ -634,13 +665,15 @@ m4_define([AT_CLEANUP_FILES],
 # AT_DATA.
 m4_define([AT_CLEANUP],
 [AT_CLEANUP_FILES([$1])dnl
+m4_append([AT_help],
+m4_defn([AT_ordinal]);m4_defn([AT_line]);m4_defn([AT_description]);m4_ifdef([AT_keywords], [m4_defn([AT_keywords])])
+)dnl
     $at_times >at-times
     )
     at_status=$?
     ;;
 
-m4_divert([TESTS])[]dnl
-m4_divert_pop()dnl
+m4_divert_pop([TESTS])dnl Back to KILL.
 ])# AT_CLEANUP
 
 
@@ -650,16 +683,16 @@ m4_divert_pop()dnl
 m4_define([AT_BANNER],
 [m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal))
 m4_append([AT_TESTS_ALL], [ banner-]m4_defn([AT_banner_ordinal]))
-m4_divert_push([TESTS])dnl
-  banner-AT_banner_ordinal ) [#] Banner AT_banner_ordinal. AT_LINE
+m4_divert_text([TESTS],
+[
+  banner-AT_banner_ordinal ) @%:@ Banner AT_banner_ordinal. AT_LINE
     cat <<\_ATEOF
 
 $1
 
 _ATEOF
     ;;
-
-m4_divert_pop()dnl
+])dnl
 ])# AT_BANNER
 
 
index 6a8bddb117d7442b933a40c62b08671189e2a0bf..905ff1effec048110b136475d89e9f7a9684f27a 100644 (file)
@@ -1477,10 +1477,12 @@ m4_defun([m4_join],
 
 
 
-# m4_append(MACRO-NAME, STRING)
-# -----------------------------
-# Redefine MACRO-NAME to hold its former content plus STRING at the
-# end.  It is valid to use this macro with MACRO-NAME undefined.
+# m4_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR`'STRING'
+# at the end.  It is valid to use this macro with MACRO-NAME undefined,
+# in which case no SEPARATOR is added.  Be aware that the criterion is
+# `not being defined', and not `not being empty'.
 #
 # This macro is robust to active symbols.  It can be used to grow
 # strings.
@@ -1509,15 +1511,7 @@ m4_defun([m4_join],
 #    => active
 m4_define([m4_append],
 [m4_define([$1],
-           m4_ifdef([$1], [m4_defn([$1])])[$2])])
-
-
-# m4_list_append(MACRO-NAME, STRING)
-# ----------------------------------
-# Same as `m4_append', but each element is separated by `, '.
-m4_define([m4_list_append],
-[m4_define([$1],
-           m4_ifdef([$1], [m4_defn([$1]), ])[$2])])
+           m4_ifdef([$1], [m4_defn([$1])$3])[$2])])
 
 
 # m4_foreach_quoted(VARIABLE, LIST, EXPRESSION)
index d0b2984eee505a267d49dadabfa1e2f9264f1b8d..5c2a04f7887ca8b2386fd8bcc0fea250bc45c110 100644 (file)
@@ -87,9 +87,7 @@ AT_CHECK([autoheader --localdir=$srcdir $1], [$2],
 # `top_srcdir' is needed so that `./configure' finds install-sh.
 # Using --srcdir is more expensive.
 m4_define([AT_CHECK_CONFIGURE],
-[AT_CLEANUP_FILE_IFELSE([config.hin], [AT_CLEANUP_FILE(config.h)])dnl
-AT_CLEANUP_FILE_IFELSE([defs.in], [AT_CLEANUP_FILE(defs)])dnl
-AT_CLEANUP_FILES(config.log config.status config.cache)dnl
+[AT_CLEANUP_FILES(config.h defs config.log config.status config.cache)dnl
 AT_CHECK([top_srcdir=$top_srcdir ./configure $1],
          [$2],
          m4_default([$3], [ignore]), [$4],
@@ -163,6 +161,8 @@ AT_CHECK_ENV
 # New macros are not expected to depend upon obsolete macros.
 m4_define([AT_CHECK_MACRO],
 [AT_SETUP([$1])
+AT_KEYWORDS([$1])
+
 AT_CONFIGURE_AC([m4_default([$2], [$1])])
 
 AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
@@ -189,6 +189,8 @@ AT_CLEANUP()dnl
 # Remove config.hin to avoid `autoheader: config.hin is unchanged'.
 m4_define([AT_CHECK_AU_MACRO],
 [AT_SETUP([$1])
+AT_KEYWORDS([$1])
+
 AT_CONFIGURE_AC([$1])
 
 AT_CHECK_AUTOCONF
index 1454c0b0efe64b86d25938d43925690429d94a26..a36e47507098d9eaab75c1e9af83442df7fa46e6 100644 (file)
@@ -201,6 +201,7 @@ AT_CHECK_MACRO([AC_CHECK_TYPES],
 # Check that we properly dispatch properly to the old implementation
 # or to the new one.
 AT_SETUP([AC_CHECK_TYPES: backward compatibility])
+AT_KEYWORDS([AC_CHECK_TYPES])
 
 AT_DATA([configure.ac],
 [[AC_INIT
@@ -329,6 +330,7 @@ AT_CLEANUP(path)
 ## ---------------- ##
 
 AT_SETUP([[AC_C_BIGENDIAN]])
+AT_KEYWORDS([AC_C_BIGENDIAN,cross])
 
 # Make sure that AC_C_BIGENDIAN behave the same whether we are
 # cross-compiling or not.
index 540f3236720165bd2d13ca88b07c712dd66a471c..2f2d6a248a0ab2cd872acd54231ee4b1f583e1f5 100644 (file)
@@ -137,6 +137,8 @@ AT_CLEANUP
 # autoconf --trace: user macros
 # -----------------------------
 AT_SETUP([autoconf --trace: user macros])
+AT_KEYWORDS([autoconf,traces])
+
 
 m4_pattern_allow([^m4_(define|shift)$])
 AT_DATA([configure.ac],
@@ -225,6 +227,7 @@ AT_CLEANUP
 # autoconf --trace: builtins
 # --------------------------
 AT_SETUP([autoconf --trace: builtins])
+AT_KEYWORDS([autoconf,traces])
 
 AT_DATA([configure.ac],
 [[define([active], [ACTIVE])