aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m464
-rw-r--r--configure.ac1
2 files changed, 65 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 459e1e4ba..34616d7da 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1963,3 +1963,67 @@ main()
dnl if this test fails, configure has already stopped
fi
])
+
+
+dnl CURL_CHECK_VARIADIC_MACROS
+dnl -------------------------------------------------
+dnl Check compiler support of variadic macros
+
+AC_DEFUN([CURL_CHECK_VARIADIC_MACROS], [
+ AC_CACHE_CHECK([for compiler support of C99 variadic macro style],
+ [curl_cv_variadic_macros_c99], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+#define c99_vmacro3(first, ...) fun3(first, __VA_ARGS__)
+#define c99_vmacro2(first, ...) fun2(first, __VA_ARGS__)
+ int fun3(int arg1, int arg2, int arg3);
+ int fun2(int arg1, int arg2);
+ int fun3(int arg1, int arg2, int arg3)
+ { return arg1 + arg2 + arg3; }
+ int fun2(int arg1, int arg2)
+ { return arg1 + arg2; }
+ ],[
+ int res3 = c99_vmacro3(1, 2, 3);
+ int res2 = c99_vmacro2(1, 2);
+ ])
+ ],[
+ curl_cv_variadic_macros_c99="yes"
+ ],[
+ curl_cv_variadic_macros_c99="no"
+ ])
+ ])
+ case "$curl_cv_variadic_macros_c99" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_C99, 1,
+ [Define to 1 if compiler supports C99 variadic macro style.])
+ ;;
+ esac
+ AC_CACHE_CHECK([for compiler support of old gcc variadic macro style],
+ [curl_cv_variadic_macros_gcc], [
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+#define gcc_vmacro3(first, args...) fun3(first, args)
+#define gcc_vmacro2(first, args...) fun2(first, args)
+ int fun3(int arg1, int arg2, int arg3);
+ int fun2(int arg1, int arg2);
+ int fun3(int arg1, int arg2, int arg3)
+ { return arg1 + arg2 + arg3; }
+ int fun2(int arg1, int arg2)
+ { return arg1 + arg2; }
+ ],[
+ int res3 = c99_vmacro3(1, 2, 3);
+ int res2 = c99_vmacro2(1, 2);
+ ])
+ ],[
+ curl_cv_variadic_macros_gcc="yes"
+ ],[
+ curl_cv_variadic_macros_gcc="no"
+ ])
+ ])
+ case "$curl_cv_variadic_macros_gcc" in
+ yes)
+ AC_DEFINE_UNQUOTED(HAVE_VARIADIC_MACROS_GCC, 1,
+ [Define to 1 if compiler supports old gcc variadic macro style.])
+ ;;
+ esac
+])
diff --git a/configure.ac b/configure.ac
index ceeda5e91..31edb8f04 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1739,6 +1739,7 @@ dnl default includes
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
+CURL_CHECK_VARIADIC_MACROS
AC_TYPE_SIZE_T
AC_HEADER_TIME
CURL_CHECK_STRUCT_TIMEVAL