]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* NEWS: New macro AC_CACHE_CHECK_INT. It replaces the
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2006 05:37:07 +0000 (05:37 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 2 Sep 2006 05:37:07 +0000 (05:37 +0000)
old AC_COMPUTE_INT, which now behaves like _AC_COMPUTE_INT
except the first two arguments are reversed.
* doc/autoconf.texi (Caching Results): New macro AC_CACHE_CHECK_INT.
(Generic Compiler Characteristics): AC_COMPUTE_INT no longer
caches nor outputs a diagnostic.  Suggested by Bruno Haible.
* lib/autoconf/general.m4 (AC_CACHE_CHECK_INT): New macro,
equivalent to the old AC_COMPUTE_INT.
(AC_COMPUTE_INT): No longer caches or reports.  New signature.
All uses changed to AC_CACHE_CHECK_INT.
* tests/base.at (AC_CACHE_CHECK_INT): New test.
* tests/mktests.sh (ac_exclude_lsit): Add AC_CACHE_CHECK_INT.

ChangeLog
NEWS
doc/autoconf.texi
lib/autoconf/general.m4
lib/autoconf/types.m4
tests/base.at
tests/mktests.sh

index 30f785bac655afa10785561155fa28a965aba85d..f6e702bd31a02c5fa01ed171b5c00b7214a7cc97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2006-09-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: New macro AC_CACHE_CHECK_INT.  It replaces the
+       old AC_COMPUTE_INT, which now behaves like _AC_COMPUTE_INT
+       except the first two arguments are reversed.
+       * doc/autoconf.texi (Caching Results): New macro AC_CACHE_CHECK_INT.
+       (Generic Compiler Characteristics): AC_COMPUTE_INT no longer
+       caches nor outputs a diagnostic.  Suggested by Bruno Haible.
+       * lib/autoconf/general.m4 (AC_CACHE_CHECK_INT): New macro,
+       equivalent to the old AC_COMPUTE_INT.
+       (AC_COMPUTE_INT): No longer caches or reports.  New signature.
+       All uses changed to AC_CACHE_CHECK_INT.
+       * tests/base.at (AC_CACHE_CHECK_INT): New test.
+       * tests/mktests.sh (ac_exclude_lsit): Add AC_CACHE_CHECK_INT.
+
 2006-08-31  Paul Eggert  <eggert@cs.ucla.edu>
 
        * NEWS: AC_FUNC_FNMATCH, AC_FUNC_FNMATCH_GNU, AC_FUNC_GETLOADVG,
diff --git a/NEWS b/NEWS
index 51320f4c15c447c2bcb37b4331ffe9ba9f85fcfd..37f81cfa8bfa6fdf5d77981fcb2ecfe7cfa46584 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@
   New programs should use the Gnulib counterparts of these macros.
   We have no current plans to remove them from Autoconf.
 
+** AC_CACHE_CHECK_INT
+  New macro, with the behavior of the 2.60a AC_COMPUTE_INT macro.
+  AC_COMPUTE_INT no longer caches or reports results.
+
 * Major changes in Autoconf 2.60a (2006-08-25)
 
 ** GNU M4 1.4.6 or later is now recommended.  At least one "make check"
index 3906cde10af7551d0b27c884e2493f1885352eaf..4ffe1edf7890820a25ac59aadf8b8a0f106b97e8 100644 (file)
@@ -6233,24 +6233,17 @@ of 0.  If no @var{includes} are specified, the default includes are used
 (@pxref{Default Includes}).
 @end defmac
 
-@defmac AC_COMPUTE_INT (@var{message}, @var{cache-id}, @var{expression}, @dvar{includes, default-includes}, @ovar{if-fails})
+@defmac AC_COMPUTE_INT (@var{var}, @var{expression}, @dvar{includes, default-includes}, @ovar{action-if-fails})
 @acindex{COMPUTE_INT}
-Compute the value of the integer @var{expression} in @var{cache-id}.  The
+Store into the shell variable @var{var} the value of the integer
+@var{expression}.  The
 value should fit in an initializer in a C variable of type @code{signed
 long}.  To support cross compilation (in which case, the macro only works on
 hosts that use twos-complement arithmetic), it should be possible to evaluate
 the expression at compile-time.  If no @var{includes} are specified, the default
 includes are used (@pxref{Default Includes}).
 
-The macro also takes care of checking if the result is already in the
-cache, and of reporting the test on the standard output
-with @code{AC_MSG_CHECKING} (which prints @var{message}) and
-@code{AC_MSG_RESULT}.
-
-If the value cannot be determined correctly, the code in @var{if-fails}
-is executed.  The @var{if-fails} commands @emph{must have no side effects}
-except for possibly setting the variable @var{cache-id}.
-@xref{Caching Results}, for more information.
+Execute @var{action-if-fails} if the value cannot be determined correctly.
 @end defmac
 
 @defmac AC_LANG_WERROR
@@ -8492,6 +8485,22 @@ The @var{commands-to-set-it} @emph{must have no side effects} except for
 setting the variable @var{cache-id}, see below.
 @end defmac
 
+@defmac AC_CACHE_CHECK_INT (@var{message}, @var{cache-id}, @var{expression}, @dvar{includes, default-includes}, @ovar{action-if-fails})
+@acindex{CACHE_CHECK_INT}
+This is a convenience macro for invoking @code{AC_COMPUTE_INT} to store
+into @var{cache-id} the value of the integer @var{expression}.
+
+This macro also checks whether the result is cached,
+and reports the test on the standard output
+with @code{AC_MSG_CHECKING} (which prints @var{message}) and
+@code{AC_MSG_RESULT}.
+
+Execute @var{action-if-fails} if the value cannot be determined correctly.
+Commands in @var{action-if-fails} must have no side effects
+except for possibly setting the variable @var{cache-id}.
+@xref{Caching Results}, for more information.
+@end defmac
+
 It is common to find buggy macros using @code{AC_CACHE_VAL} or
 @code{AC_CACHE_CHECK}, because people are tempted to call
 @code{AC_DEFINE} in the @var{commands-to-set-it}.  Instead, the code that
index 427bfbd7e63dab04260f24cddd67a18575806faf..ce0f9a5bf33fabfc1e2ec74bba30730772085847 100644 (file)
@@ -1934,6 +1934,14 @@ AS_LITERAL_IF([$2],
               AC_MSG_RESULT([$ac_res])])dnl
 ])
 
+# AC_CACHE_CHECK_INT(MESSAGE, CACHE-ID, EXPRESSION,
+#                    [PROLOGUE = DEFAULT-INCLUDES], [IF-FAILS])
+# -------------------------------------------------------------
+AC_DEFUN([AC_CACHE_CHECK_INT],
+[AC_CACHE_CHECK([$1], [$2],
+   [AC_COMPUTE_INT([$2], [$3], [$4], [$5])])
+])# AC_CACHE_CHECK_INT
+
 
 
 ## ---------------------- ##
@@ -2719,39 +2727,27 @@ m4_define([_AC_COMPUTE_INT_RUN],
                [$2=`cat conftest.val`], [$4])])
 
 
-# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
-# ---------------------------------------------------------
-# FIXME: this private interface was used by several packages.
-# Give them time to transition to AC_COMPUTE_INT (which is cleaner)
-# and then delete this one.  Or if they do not transition,
-# it may make sense to limit the code duplication and use
-# _AC_COMPUTE_INT from within the public macro.
-AC_DEFUN([_AC_COMPUTE_INT],
+# AC_COMPUTE_INT(VARIABLE, EXPRESSION, PROLOGUE, [IF-FAILS])
+# ----------------------------------------------------------
+AC_DEFUN([AC_COMPUTE_INT],
 [AC_LANG_COMPILER_REQUIRE()dnl
 if test "$cross_compiling" = yes; then
-  _AC_COMPUTE_INT_COMPILE([$1], [$2], [$3], [$4])
+  _AC_COMPUTE_INT_COMPILE([$2], [$1], [$3], [$4])
 else
-  _AC_COMPUTE_INT_RUN([$1], [$2], [$3], [$4])
+  _AC_COMPUTE_INT_RUN([$2], [$1], [$3], [$4])
 fi
 rm -f conftest.val[]dnl
+])# _AC_COMPUTE_INT
+
+# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, [IF-FAILS])
+# -----------------------------------------------------------
+# FIXME: this private interface was used by several packages.
+# Give them time to transition to AC_COMPUTE_INT and then delete this one.
+AC_DEFUN([_AC_COMPUTE_INT],
+[AC_COMPUTE_INT([$2], [$1], [$3], [$4])
 AC_DIAGNOSE([obsolete],
 [The macro `_AC_COMPUTE_INT' is obsolete and will be deleted in a
 future version or Autoconf.  Hence, it is suggested that you use
 instead the public AC_COMPUTE_INT macro.  Note that the arguments are
 slightly different between the two.])dnl
 ])# _AC_COMPUTE_INT
-
-# AC_COMPUTE_INT(MESSAGE, CACHE-ID, EXPRESSION, [PROLOGUE = DEFAULT-INCLUDES],
-#               [IF-FAILS])
-# ---------------------------------------------------------
-AC_DEFUN([AC_COMPUTE_INT],
-[AC_LANG_COMPILER_REQUIRE()dnl
-AC_CACHE_CHECK([$1], [$2],
-[if test "$cross_compiling" = yes; then
-  _AC_COMPUTE_INT_COMPILE([$3], [$2], [AC_INCLUDES_DEFAULT([$4])], [$5])
-else
-  _AC_COMPUTE_INT_RUN([$3], [$2], [AC_INCLUDES_DEFAULT([$4])], [$5])
-fi
-rm -f conftest.val[]dnl
-])
-])# AC_COMPUTE_INT
index 1c45101ed7e8144e0a352cc649b60e5005fa5ac6..9a0d2e4105dfb0c2b79f8250d0fc08a21e82c4ec 100644 (file)
@@ -684,15 +684,15 @@ AC_CHECK_TYPE([$1], [], [], [$3])
 # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
 # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
 # This bug is HP SR number 8606223364.
-AC_COMPUTE_INT([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])],
-              [(long int) (sizeof (ac__type_sizeof_))],
-              [AC_INCLUDES_DEFAULT([$3])
-               typedef $1 ac__type_sizeof_;],
-              [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
-                AC_MSG_FAILURE([cannot compute sizeof ($1)], 77)
-              else
-                AS_TR_SH([ac_cv_sizeof_$1])=0
-              fi])
+AC_CACHE_CHECK_INT([size of $1], [AS_TR_SH([ac_cv_sizeof_$1])],
+  [(long int) (sizeof (ac__type_sizeof_))],
+  [AC_INCLUDES_DEFAULT([$3])
+   typedef $1 ac__type_sizeof_;],
+  [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
+     AC_MSG_FAILURE([cannot compute sizeof ($1)], 77)
+   else
+     AS_TR_SH([ac_cv_sizeof_$1])=0
+   fi])
 
 AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]),
                   [The size of `$1', as computed by sizeof.])
@@ -707,18 +707,18 @@ AC_DEFUN([AC_CHECK_ALIGNOF],
 AC_CHECK_TYPE([$1], [], [], [$2])
 # The cast to long int works around a bug in the HP C Compiler,
 # see AC_CHECK_SIZEOF for more information.
-AC_COMPUTE_INT([alignment of $1], [AS_TR_SH([ac_cv_alignof_$1])],
-              [(long int) offsetof (ac__type_alignof_, y)],
-              [AC_INCLUDES_DEFAULT([$2])
+AC_CACHE_CHECK_INT([alignment of $1], [AS_TR_SH([ac_cv_alignof_$1])],
+  [(long int) offsetof (ac__type_alignof_, y)],
+  [AC_INCLUDES_DEFAULT([$2])
 #ifndef offsetof
 # define offsetof(type, member) ((char *) &((type *) 0)->member - (char *) 0)
 #endif
 typedef struct { char x; $1 y; } ac__type_alignof_;],
-              [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
-                AC_MSG_FAILURE([cannot compute alignment of $1], 77)
-              else
-                AS_TR_SH([ac_cv_alignof_$1])=0
-              fi])
+  [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
+     AC_MSG_FAILURE([cannot compute alignment of $1], 77)
+   else
+     AS_TR_SH([ac_cv_alignof_$1])=0
+   fi])
 
 AC_DEFINE_UNQUOTED(AS_TR_CPP(alignof_$1), $AS_TR_SH([ac_cv_alignof_$1]),
                   [The normal alignment of `$1', in bytes.])
index 18b7a15ad8b5f32d53e1f9c0fb55112d8107916e..b1133f72716c4afdf231cd2128526ac8fa1ecdfd 100644 (file)
@@ -220,6 +220,31 @@ AT_CHECK_CONFIGURE([-q])
 AT_CLEANUP
 
 
+## -------------------- ##
+## AC_CACHE_CHECK_INT.  ##
+## -------------------- ##
+-
+# Make sure AC_CACHE_CHECK_INT fails properly.
+
+AT_SETUP([AC_CACHE_CHECK_INT])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CACHE_CHECK_INT([for division by zero],
+                  [my_cv_divide_by_zero],
+                  [1 / 0],
+                  [],
+                  [my_cv_divide_by_zero=failed])
+test "$my_cv_divide_by_zero" = failed ||
+  AC_MSG_ERROR([1 / 0 did not fail])
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE
+
+AT_CLEANUP
+
+
 ## ---------------- ##
 ## AC_TRY_COMMAND.  ##
 ## ---------------- ##
index ac2e1e5a4169aab310113431ba30daf56ee8b6a0..157a7112a136d49ef7248f528caef38ca29814e8 100755 (executable)
@@ -86,7 +86,7 @@ ac_exclude_list='
        # Need an argument.
        /^AC_(CANONICALIZE|PREFIX_PROGRAM|PREREQ)$/ {next}
        /^AC_(SEARCH_LIBS|REPLACE_FUNCS)$/ {next}
-       /^AC_COMPUTE_INT$/ {next}
+       /^AC_(CACHE_CHECK|COMPUTE)_INT$/ {next}
 
        # Performed in the semantics tests.
        /^AC_CHECK_(ALIGNOF|DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|(TARGET_)?TOOL|TYPE)S?$/ {next}