summaryrefslogtreecommitdiff
path: root/app/openvpn/m4/ax_emptyarray.m4
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-04-09 17:07:48 +0200
committerParménides GV <parmegv@sdf.org>2014-04-09 17:15:17 +0200
commit51ff5a18f1f074e27e97d822745551a7e8fa068d (patch)
tree402e7dd42778a218635bb29a4c2dff93ea7f6525 /app/openvpn/m4/ax_emptyarray.m4
parent910b0e1746ab3f63e63808b198ad51fec5b635e5 (diff)
parentb5ba0abc1610dd4bf573ebcabc5e8f6ab0c9528f (diff)
Merge branch 'feature/implement-gradle-build-system-#4676' into develop
Diffstat (limited to 'app/openvpn/m4/ax_emptyarray.m4')
-rw-r--r--app/openvpn/m4/ax_emptyarray.m440
1 files changed, 40 insertions, 0 deletions
diff --git a/app/openvpn/m4/ax_emptyarray.m4 b/app/openvpn/m4/ax_emptyarray.m4
new file mode 100644
index 00000000..c6781c17
--- /dev/null
+++ b/app/openvpn/m4/ax_emptyarray.m4
@@ -0,0 +1,40 @@
+dnl @synopsis AX_EMPTY_ARRAY
+dnl
+dnl Define EMPTY_ARRAY_SIZE to be either "0"
+dnl or "" depending on which syntax the compiler
+dnl prefers for empty arrays in structs.
+dnl
+dnl @version
+dnl @author James Yonan <jim@yonan.net>
+AC_DEFUN([AX_EMPTY_ARRAY], [
+ 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
+])