From 5394e92c20ebf439cf150223a269526e8fdf249e Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine <Claus-Justus.Heine@IANS.Uni-Stuttgart.DE> Date: Thu, 3 May 2007 16:18:47 +0000 Subject: [PATCH] merge init-element-branch -> trunk --- m4/check-iso-c99.m4 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 m4/check-iso-c99.m4 diff --git a/m4/check-iso-c99.m4 b/m4/check-iso-c99.m4 new file mode 100644 index 0000000..142c3fb --- /dev/null +++ b/m4/check-iso-c99.m4 @@ -0,0 +1,30 @@ +# +# We need (at least) two features from the C99 standard: variadic +# macros and variable length arrays. We check here whether or those +# are available. +# +# Note that we do not further modify the compiler flags, we just check +# whether variadic macros and variable length arrays are available. +# +# The macro takes 2 arguments: +# +# $1: optional: a set of compiler flags in addition to CFLAGS +# +AC_DEFUN([ALBERTA_ISO_C99_CHECK], +[AC_REQUIRE([AC_PROG_CC]) +_alberta_save_cflags="${CFLAGS}" +m4_if($#,1,[CFLAGS="$1"]) +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([for ISO C99 features with "${CC} ${CFLAGS}"]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[[extern void exit(int status); +#define FOO(a, ...) (a, __VA_ARGS__) +extern int foo(int a, int b, int c);]], +[[int bar[foo FOO(3, 4, 5)]; +exit(bar[0]);]])], +[AC_MSG_RESULT([variadic macros and variable length arrays available])], +[AC_MSG_FAILURE([variadic macros and/or vairable length arrays NOT available])]) +AC_LANG_POP([C]) +CFLAGS="${_alberta_save_cflags}" +]) -- GitLab