[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
new macro AC_C_TYPEOF
From: |
Paul Eggert |
Subject: |
new macro AC_C_TYPEOF |
Date: |
Wed, 06 Jul 2005 14:41:28 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
I installed this:
2005-07-06 Paul Eggert <address@hidden>
* NEWS: New macro AC_C_TYPEOF.
* doc/autoconf.texi (C Compiler): Document AC_C_TYPEOF.
* lib/autoconf/c.m4 (AC_C_TYPEOF): New macro.
* tests/c.at (C keywords): Test AC_C_TYPEOF.
Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.344
diff -p -u -r1.344 NEWS
--- NEWS 1 Jul 2005 22:20:56 -0000 1.344
+++ NEWS 6 Jul 2005 21:36:39 -0000
@@ -32,6 +32,9 @@
future release; the old style value, which matches (../)*, is (and will
continue to be) available as ac_top_build_prefix.
+** AC_C_TYPEOF
+ New macro to check for support of 'typeof' syntax a la GNU C.
+
** AC_PROG_CC_C89, AC_PROG_CC_C99
New macros for ISO C99 support. AC_PROG_CC_C89 and AC_PROG_CC_C99
check for ANSI C89 and ISO C99 support respectively.
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.924
diff -p -u -r1.924 autoconf.texi
--- doc/autoconf.texi 1 Jul 2005 05:55:41 -0000 1.924
+++ doc/autoconf.texi 6 Jul 2005 21:36:40 -0000
@@ -5949,6 +5949,16 @@ found in macros such as this:
@end example
@end defmac
address@hidden AC_C_TYPEOF
address@hidden
address@hidden HAVE_TYPEOF
address@hidden typeof
+If the C compiler supports GCC's @code{typeof} syntax, define
address@hidden If the support is available only via a different
+spelling of the keyword (e.g., @code{__typeof__}), define @code{typeof}
+to that spelling.
address@hidden defmac
+
@defmac AC_C_PROTOTYPES
@acindex{C_PROTOTYPES}
@cvindex PROTOTYPES
Index: lib/autoconf/c.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/c.m4,v
retrieving revision 1.201
diff -p -u -r1.201 c.m4
--- lib/autoconf/c.m4 24 May 2005 07:29:57 -0000 1.201
+++ lib/autoconf/c.m4 6 Jul 2005 21:36:40 -0000
@@ -45,6 +45,7 @@
# to the GPL from your modified version.
#
# Written by David MacKenzie, with help from
+# Akim Demaille, Paul Eggert,
# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
# Roland McGrath, Noah Friedman, david d zuhn, and many others.
@@ -1433,3 +1434,43 @@ else
AC_MSG_RESULT([no])
fi
])# AC_C_PROTOTYPES
+
+
+# AC_C_TYPEOF
+# -----------
+# Check if the C compiler supports GCC's typeof syntax.
+# The test case provokes incompatibilities in the Sun C compilers
+# (both Solaris 8 and Solaris 10).
+AC_DEFUN([AC_C_TYPEOF],
+[
+ AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof,
+ [ac_cv_c_typeof=no
+ for ac_kw in typeof __typeof__ no; do
+ test $ac_kw = no && break
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+ [[
+ int value;
+ return
+ (! ((void)
+ ((struct {
+ char a [1
+ + ! (($ac_kw (value))
+ (($ac_kw (value)) 0 < ($ac_kw (value)) -1
+ ? ($ac_kw (value)) - 1
+ : ~ (~ ($ac_kw (value)) 0
+ << sizeof ($ac_kw (value)))))]; } *)
+ 0),
+ 0));
+ ]])],
+ [ac_cv_c_typeof=$ac_kw])
+ test $ac_cv_c_typeof != no && break
+ done])
+ if test $ac_cv_c_typeof != no; then
+ AC_DEFINE([HAVE_TYPEOF], 1,
+ [Define to 1 if typeof works with your compiler.])
+ if test $ac_cv_c_typeof != typeof; then
+ AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof],
+ [Define to __typeof__ if your compiler spells it that way.])
+ fi
+ fi
+])
Index: tests/c.at
===================================================================
RCS file: /cvsroot/autoconf/autoconf/tests/c.at,v
retrieving revision 1.6
diff -p -u -r1.6 c.at
--- tests/c.at 14 May 2005 07:00:40 -0000 1.6
+++ tests/c.at 6 Jul 2005 21:36:41 -0000
@@ -74,14 +74,15 @@ AT_CLEANUP
## C keywords. ##
## ------------ ##
-# GCC supports `const' and `volatile'.
+# GCC supports `const', `typeof', and `volatile'.
AT_CHECK_MACRO([C keywords],
[[AC_PROG_CC
AC_C_CONST
+AC_C_TYPEOF
AC_C_VOLATILE
-case $GCC,$ac_cv_c_const,$ac_cv_c_volatile in
+case $GCC,$ac_cv_c_const,$ac_cv_c_typeof,$ac_cv_c_volatile in
yes,*no*)
- AC_MSG_ERROR([failed to detect `const' or `volatile' support]);;
+ AC_MSG_ERROR([failed to detect `const', `typeof', or `volatile' support]);;
esac
]])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- new macro AC_C_TYPEOF,
Paul Eggert <=