diff options
author | Yang Tse <yangsita@gmail.com> | 2007-03-22 18:25:38 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2007-03-22 18:25:38 +0000 |
commit | 273b2b230bbf0924ca87038221333c59df0afb31 (patch) | |
tree | 1dfa04260caf30fbc8fe56d1b00e724263cf0d11 /acinclude.m4 | |
parent | 3229a80c9f50d7521c68e4b3cb2234624a37b40c (diff) | |
download | curl-273b2b230bbf0924ca87038221333c59df0afb31.tar.gz |
Add check for compiler variadic macro support in configuration script
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 64 |
1 files changed, 64 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 +]) |