diff options
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r-- | config/c-compiler.m4 | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 9398ca6c477..069b468daac 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -121,6 +121,46 @@ fi])# PGAC_C_FUNCNAME_SUPPORT +# PGAC_C_STATIC_ASSERT +# ----------------------- +# Check if the C compiler understands _Static_assert(), +# and define HAVE__STATIC_ASSERT if so. +# +# We actually check the syntax ({ _Static_assert(...) }), because we need +# gcc-style compound expressions to be able to wrap the thing into macros. +AC_DEFUN([PGAC_C_STATIC_ASSERT], +[AC_CACHE_CHECK(for _Static_assert, pgac_cv__static_assert, +[AC_TRY_LINK([], +[({ _Static_assert(1, "foo"); })], +[pgac_cv__static_assert=yes], +[pgac_cv__static_assert=no])]) +if test x"$pgac_cv__static_assert" = xyes ; then +AC_DEFINE(HAVE__STATIC_ASSERT, 1, + [Define to 1 if your compiler understands _Static_assert.]) +fi])# PGAC_C_STATIC_ASSERT + + + +# PGAC_C_TYPES_COMPATIBLE +# ----------------------- +# Check if the C compiler understands __builtin_types_compatible_p, +# and define HAVE__BUILTIN_TYPES_COMPATIBLE_P if so. +# +# We check usage with __typeof__, though it's unlikely any compiler would +# have the former and not the latter. +AC_DEFUN([PGAC_C_TYPES_COMPATIBLE], +[AC_CACHE_CHECK(for __builtin_types_compatible_p, pgac_cv__types_compatible, +[AC_TRY_COMPILE([], +[ int x; static int y[__builtin_types_compatible_p(__typeof__(x), int)]; ], +[pgac_cv__types_compatible=yes], +[pgac_cv__types_compatible=no])]) +if test x"$pgac_cv__types_compatible" = xyes ; then +AC_DEFINE(HAVE__BUILTIN_TYPES_COMPATIBLE_P, 1, + [Define to 1 if your compiler understands __builtin_types_compatible_p.]) +fi])# PGAC_C_TYPES_COMPATIBLE + + + # PGAC_PROG_CC_CFLAGS_OPT # ----------------------- # Given a string, check if the compiler supports the string as a |