summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--m4/ax_emptyarray.m449
1 files changed, 31 insertions, 18 deletions
diff --git a/m4/ax_emptyarray.m4 b/m4/ax_emptyarray.m4
index 0a8755c..c6781c1 100644
--- a/m4/ax_emptyarray.m4
+++ b/m4/ax_emptyarray.m4
@@ -7,21 +7,34 @@ dnl
dnl @version
dnl @author James Yonan <jim@yonan.net>
AC_DEFUN([AX_EMPTY_ARRAY], [
- AC_MSG_RESULT([checking for C compiler empty array support])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[0]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE, 0, [Dimension to use for empty array declaration])
- ], [
- AC_COMPILE_IFELSE([AC_LANG_SOURCE(
- [
- struct { int foo; int bar[[]]; } mystruct;
- ])], [
- AC_DEFINE_UNQUOTED(EMPTY_ARRAY_SIZE,, [Dimension to use for empty array declaration])
- ], [
- AC_MSG_ERROR([C compiler is unable to creaty empty arrays])
- ])
- ])
- ]
-)
+ AS_VAR_PUSHDEF([VAR],[ax_cv_c_empty_array])dnl
+ AC_CACHE_CHECK(
+ [for C compiler empty array size],
+ [VAR],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
+struct { int foo; int bar[0]; } mystruct;
+ ]]
+ )],
+ [VAR=0],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ ,
+ [[
+struct { int foo; int bar[]; } mystruct;
+ ]]
+ )],
+ [VAR=],
+ [AC_MSG_ERROR([C compiler is unable to creaty empty arrays])]
+ )]
+ )]
+ )dnl
+ AC_DEFINE_UNQUOTED(
+ [EMPTY_ARRAY_SIZE],
+ [$VAR],
+ [Dimension to use for empty array declaration]
+ )dnl
+ AS_VAR_POPDEF([VAR])dnl
+])