diff options
Diffstat (limited to 'config/c-compiler.m4')
-rw-r--r-- | config/c-compiler.m4 | 55 |
1 files changed, 54 insertions, 1 deletions
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index a7f6773ae1..7275ea69fe 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -71,8 +71,10 @@ int does_int64_work() return 0; return 1; } + +int main() { - exit(! does_int64_work()); + return (! does_int64_work()); }])], [Ac_cachevar=yes], [Ac_cachevar=no], @@ -176,6 +178,33 @@ fi])# PGAC_C_STATIC_ASSERT +# PGAC_C_TYPEOF +# ------------- +# Check if the C compiler understands typeof or a variant. Define +# HAVE_TYPEOF if so, and define 'typeof' to the actual key word. +# +AC_DEFUN([PGAC_C_TYPEOF], +[AC_CACHE_CHECK(for typeof, pgac_cv_c_typeof, +[pgac_cv_c_typeof=no +for pgac_kw in typeof __typeof__ decltype; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], +[int x = 0; +$pgac_kw(x) y; +y = x; +return y;])], +[pgac_cv_c_typeof=$pgac_kw]) + test "$pgac_cv_c_typeof" != no && break +done]) +if test "$pgac_cv_c_typeof" != no; then + AC_DEFINE(HAVE_TYPEOF, 1, + [Define to 1 if your compiler understands `typeof' or something similar.]) + if test "$pgac_cv_c_typeof" != typeof; then + AC_DEFINE_UNQUOTED(typeof, $pgac_cv_c_typeof, [Define to how the compiler spells `typeof'.]) + fi +fi])# PGAC_C_TYPEOF + + + # PGAC_C_TYPES_COMPATIBLE # ----------------------- # Check if the C compiler understands __builtin_types_compatible_p, @@ -271,6 +300,30 @@ fi])# PGAC_C_BUILTIN_UNREACHABLE +# PGAC_C_COMPUTED_GOTO +# ----------------------- +# Check if the C compiler knows computed gotos (gcc extension, also +# available in at least clang). If so, define HAVE_COMPUTED_GOTO. +# +# Checking whether computed gotos are supported syntax-wise ought to +# be enough, as the syntax is otherwise illegal. +AC_DEFUN([PGAC_C_COMPUTED_GOTO], +[AC_CACHE_CHECK(for computed goto support, pgac_cv_computed_goto, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], +[[void *labeladdrs[] = {&&my_label}; + goto *labeladdrs[0]; + my_label: + return 1; +]])], +[pgac_cv_computed_goto=yes], +[pgac_cv_computed_goto=no])]) +if test x"$pgac_cv_computed_goto" = xyes ; then +AC_DEFINE(HAVE_COMPUTED_GOTO, 1, + [Define to 1 if your compiler handles computed gotos.]) +fi])# PGAC_C_COMPUTED_GOTO + + + # PGAC_C_VA_ARGS # -------------- # Check if the C compiler understands C99-style variadic macros, |