Add check for compiler variadic macro support in configuration script

This commit is contained in:
Yang Tse 2007-03-22 18:25:38 +00:00
Родитель 3229a80c9f
Коммит 273b2b230b
2 изменённых файлов: 65 добавлений и 0 удалений

Просмотреть файл

@ -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
])

Просмотреть файл

@ -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