summaryrefslogtreecommitdiff
path: root/ics-openvpn-stripped/main/openvpn/m4/ax_emptyarray.m4
blob: c6781c179c2636b37ef0f0622b3bb20a3c79ab48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
])