* 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.
This commit is contained in:
Paul Eggert 2005-07-06 21:39:30 +00:00
parent f18ce65fb6
commit 7d9430d8b1
5 changed files with 63 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2005-07-06 Paul Eggert <eggert@cs.ucla.edu>
* 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.
Fix problems reported by Nicolas Joly.
* tests/base.at (Input/Output): Ignore 'loading site script' chatter.
* tests/local.at (AT_CONFIG_CMP): Ignore lines like "LIBS=''" too.

3
NEWS
View File

@ -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.

View File

@ -5949,6 +5949,16 @@ found in macros such as this:
@end example
@end defmac
@defmac AC_C_TYPEOF
@acindex{C_TYPEOF}
@cvindex HAVE_TYPEOF
@cvindex typeof
If the C compiler supports GCC's @code{typeof} syntax, define
@code{HAVE_TYPEOF}. If the support is available only via a different
spelling of the keyword (e.g., @code{__typeof__}), define @code{typeof}
to that spelling.
@end defmac
@defmac AC_C_PROTOTYPES
@acindex{C_PROTOTYPES}
@cvindex PROTOTYPES

View File

@ -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
])

View File

@ -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
]])