autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Make AC_COMPUTE_INT public


From: Paolo Bonzini
Subject: Re: [PATCH] Make AC_COMPUTE_INT public
Date: Tue, 20 Jun 2006 11:00:23 +0200
User-agent: Thunderbird 1.5.0.4 (Macintosh/20060530)


Not sure whether these are anywhere near show-stopping.  I guess not.
Thanks.
Please mark PROLOGUE as optional.
It is not really optional in _AC_COMPUTE_INT_{COMPILE,RUN}: an empty argument happens to not give errors, but only AC_COMPUTE_INT uses AC_INCLUDES_DEFAULT.

Thanks again for the quick review (and sorry for the bad timing...) Attached patch was regtested on powerpc-apple-darwin8.5.0, with 275 tests behaving as expected and 11 tests that were skipped (Fortran, /lib/cpp, AC_CHECK_LIB), ok to commit (I have write permission for the repository)?

Paolo
2006-06-19  Paolo Bonzini  <address@hidden>

        * doc/autoconf.texi (Generic compiler characteristics):
        Document AC_COMPUTE_INT.
        * lib/autoconf/general.m4 (AC_COMPUTE_INT): Renamed from
        _AC_COMPUTE_INT.  Add AU_ALIAS.  Modify default prolog to be 
        the default headers.
        * lib/autoconf/types.m4 (AC_CHECK_SIZEOF, AC_CHECK_ALIGNOF): Use
        new name of _AC_COMPUTE_INT.
        * NEWS: Document change.

Index: NEWS
===================================================================
RCS file: /sources/autoconf/autoconf/NEWS,v
retrieving revision 1.381
diff -p -u -b -r1.381 NEWS
--- NEWS        6 Jun 2006 06:18:40 -0000       1.381
+++ NEWS        20 Jun 2006 07:17:42 -0000
@@ -1,5 +1,9 @@
 * Major changes in Autoconf 2.59e
 
+** The _AC_COMPUTE_INT macro has been made public and documented, and
+  renamed to AC_COMPUTE_INT.  autoupdate will change the old private name
+  to the new one.
+
 * Major changes in Autoconf 2.59d
 
   Released 2006-06-05, by Ralf Wildenhues.
Index: doc/autoconf.texi
===================================================================
RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.1051
diff -p -u -b -r1.1051 autoconf.texi
--- doc/autoconf.texi   16 Jun 2006 20:38:03 -0000      1.1051
+++ doc/autoconf.texi   20 Jun 2006 07:17:45 -0000
@@ -6111,6 +6111,26 @@ include @file{stddef.h} and @file{stdio.
 macro to work correctly.
 @end defmac
 
address@hidden AC_COMPUTE_INT (@var{expression}, @var{var}, @dvar{includes, 
default-includes}, @ovar{if-fails})
address@hidden
+Compute the value of the integer @var{expression} in @var{var}.  The
+value should fit in an initializer in a C variable of type @code{signed
+long}.  To support cross compilation (in which case it only works on
+hosts that use twos-complement arithmetic), it should be possible to evaluate
+the expression at compile-time.  Furthermore, the range of the value
+should be one bit less than the size of a @code{signed long}.  That is,
+for a system where @code{long} is 32-bit, the value should be between
address@hidden << 30} and @code{1 << 30}, excluding the extrema).
+
+If no @var{includes} are specified, the default includes are used
+(@pxref{Default Includes}).  If you provide @var{includes}, be sure to
+include @file{stddef.h} and @file{stdio.h} which are required for this
+macro to work correctly.
+
+If the value cannot be determined correctly, the code in @var{if-fails}
+is executed.
address@hidden defmac
+
 @defmac AC_LANG_WERROR
 @acindex{LANG_WERROR}
 Normally Autoconf ignores warnings generated by the compiler, linker, and
Index: lib/autoconf/general.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.925
diff -p -u -b -r1.925 general.m4
--- lib/autoconf/general.m4     7 Jun 2006 05:35:46 -0000       1.925
+++ lib/autoconf/general.m4     20 Jun 2006 07:17:45 -0000
@@ -2716,14 +2716,16 @@ m4_define([_AC_COMPUTE_INT_RUN],
                [$2=`cat conftest.val`], [$4])])
 
 
-# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, PROLOGUE, IF-FAILS)
+# AC_COMPUTE_INT(EXPRESSION, VARIABLE, [PROLOGUE = DEFAULT-INCLUDES],
+                 [IF-FAILS])
 # ---------------------------------------------------------
-m4_define([_AC_COMPUTE_INT],
+AU_ALIAS([_AC_COMPUTE_INT], [AC_COMPUTE_INT])
+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([$1], [$2], [AC_INCLUDES_DEFAULT([$3])], [$4])
 else
-  _AC_COMPUTE_INT_RUN([$1], [$2], [$3], [$4])
+  _AC_COMPUTE_INT_RUN([$1], [$2], [AC_INCLUDES_DEFAULT([$3])], [$4])
 fi
 rm -f conftest.val[]dnl
-])# _AC_COMPUTE_INT
+])# AC_COMPUTE_INT
Index: lib/autoconf/types.m4
===================================================================
RCS file: /sources/autoconf/autoconf/lib/autoconf/types.m4,v
retrieving revision 1.39
diff -p -u -b -r1.39 types.m4
--- lib/autoconf/types.m4       19 Jun 2006 18:28:12 -0000      1.39
+++ lib/autoconf/types.m4       20 Jun 2006 07:17:46 -0000
@@ -676,7 +676,7 @@ AC_CACHE_CHECK([size of $1], AS_TR_SH([a
   # 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([(long int) (sizeof (ac__type_sizeof_))],
+  AC_COMPUTE_INT([(long int) (sizeof (ac__type_sizeof_))],
                  [AS_TR_SH([ac_cv_sizeof_$1])],
                  [AC_INCLUDES_DEFAULT([$3])
                   typedef $1 ac__type_sizeof_;],
@@ -699,7 +699,7 @@ AC_CACHE_CHECK([alignment of $1], AS_TR_
 [if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then
   # The cast to long int works around a bug in the HP C Compiler,
   # see AC_CHECK_SIZEOF for more information.
-  _AC_COMPUTE_INT([(long int) offsetof (ac__type_alignof_, y)],
+  AC_COMPUTE_INT([(long int) offsetof (ac__type_alignof_, y)],
                  [AS_TR_SH([ac_cv_alignof_$1])],
                  [AC_INCLUDES_DEFAULT([$2])
 #ifndef offsetof

reply via email to

[Prev in Thread] Current Thread [Next in Thread]