]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
build: m4/ax_emptyarray.m4: cleanup
authorAlon Bar-Lev <alon.barlev@gmail.com>
Wed, 29 Feb 2012 20:11:54 +0000 (22:11 +0200)
committerDavid Sommerseth <davids@redhat.com>
Thu, 22 Mar 2012 21:07:07 +0000 (22:07 +0100)
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
m4/ax_emptyarray.m4

index 0a8755cf608e3080249f244f653ee3f58e9e1dcb..c6781c179c2636b37ef0f0622b3bb20a3c79ab48 100644 (file)
@@ -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
+])