summaryrefslogtreecommitdiff
path: root/bitmask_android/openvpn/m4/ax_varargs.m4
blob: c295d21f4e2c6e4616ad8ab3bf46d21208301cae (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
dnl @synopsis AX_CPP_VARARG_MACRO_GCC
dnl
dnl Test if the preprocessor understands GNU GCC-style vararg macros.
dnl If it does, defines HAVE_CPP_VARARG_MACRO_GCC to 1.
dnl
dnl @version
dnl @author James Yonan <jim@yonan.net>, Matthias Andree <matthias.andree@web.de>
AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
	AS_VAR_PUSHDEF([VAR], [ax_cv_cpp_vararg_macro_gcc])dnl
	AC_CACHE_CHECK(
		[for GNU GCC vararg macro support],
		[VAR],
		[AC_COMPILE_IFELSE(
			[AC_LANG_PROGRAM(
				[[
#define macro(a, b...) func(a, b)
int func(int a, int b, int c);
				]],
				[[
int i = macro(1, 2, 3);
				]]
			)],
			[VAR=yes],
			[VAR=no]
		)]
	)dnl

	AS_VAR_IF(
		[VAR],
		[yes],
		[AC_DEFINE(
			[HAVE_CPP_VARARG_MACRO_GCC],
			[1], 
			[Define to 1 if your compiler supports GNU GCC-style variadic macros]
		)]
	)dnl
	AS_VAR_POPDEF([VAR])dnl
])

dnl @synopsis AX_CPP_VARARG_MACRO_ISO
dnl
dnl Test if the preprocessor understands ISO C 1999 vararg macros.
dnl If it does, defines HAVE_CPP_VARARG_MACRO_ISO to 1.
dnl
dnl @version
dnl @author James Yonan <jim@yonan.net>, Matthias Andree <matthias.andree@web.de>
AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
	AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
	AC_CACHE_CHECK(
		[for ISO C 1999 vararg macro support],
		[VAR],
		[AC_COMPILE_IFELSE(
			[AC_LANG_PROGRAM(
				[[
#define macro(a, ...) func(a, __VA_ARGS__)
int func(int a, int b, int c);
				]],
				[[
int i = macro(1, 2, 3);
				]]
			)],
			[VAR=yes],
			[VAR=no]
		)]
	)dnl

	AS_VAR_IF(
		[VAR],
		[yes],
		[AC_DEFINE(
			[HAVE_CPP_VARARG_MACRO_ISO],
			[1], 
			[Define to 1 if your compiler supports ISO C99 variadic macros]
		)]
	)dnl
	AS_VAR_POPDEF([VAR])dnl
])