0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-09-22 10:43:39 -04:00
Files
nasm/autoconf/m4/pa_variadic_macros.m4
H. Peter Anvin 33eda43042 autoconf: update m4 macros and config/unconfig.h
(Does unconfig.h really need to be in the git tree?)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2025-08-11 18:54:17 -07:00

37 lines
1.2 KiB
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.])
AC_CACHE_CHECK([if $CC supports varadic macro comma dropping],
[pa_cv_varadic_macros_comma_hack],
[AC_LINK_IFELSE([AC_LANG_SOURCE([
AC_INCLUDES_DEFAULT
#define myprintf(f, ...) printf(f, ## __VA_ARGS__)
int main(void)
{
myprintf("hello");
return 0;
}
])])],
[pa_cv_varadic_macros_comma_hack=yes],
[pa_cv_varadic_macros_comma_hack=no])
AS_IF([test "x$pa_cv_varadic_macros_comma_hack" = xyes],
[AC_DEFINE([HAVE_VARADIC_MACROS_COMMA_HACK], 1,
[define to 1 if your compiler supports the , ## __VA_ARGS__ hack.])])
])])