0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-07-24 10:25:42 -04:00
nasm/autoconf/m4/pa_variadic_macros.m4
H. Peter Anvin 0e7eae99e8 autoconf: add detection of variadic macros support
Variadic macros are really useful, even if we can only use them
conditionally.

Unfortunately this means removing -Wc90-c99-compat, because apparently
-Wno-variadic-macros is broken in gcc 13.2. Fortunately it is 2023...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2023-10-11 13:32:52 -07:00

21 lines
751 B
Plaintext

dnl --------------------------------------------------------------------------
dnl PA_VARIADIC_MACROS
dnl
dnl Check to see if the compiler supports C99 variadic macros.
dnl --------------------------------------------------------------------------
AC_DEFUN([PA_VARIADIC_MACROS],
[AC_CACHE_CHECK([if $CC supports variadic macros], [pa_cv_variadic_macros],
[AC_LINK_IFELSE([AC_LANG_SOURCE([
AC_INCLUDES_DEFAULT
#define myprintf(f, ...) printf(f, __VA_ARGS__)
int main(void)
{
myprintf("%s", "Hello, World!\n");
return 0;
}
])],[pa_cv_variadic_macros=yes],[pa_cv_variadic_macros=no])])
AS_IF([test "x$pa_cv_variadic_macros" = xyes],
[AC_DEFINE([HAVE_VARIADIC_MACROS], 1,
[define to 1 if your compiler supports C99 __VA_ARGS__ variadic macros.])])
])