]> granicus.if.org Git - sudo/commitdiff
Add check for variadic macro support in cpp.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 1 Mar 2012 18:05:03 +0000 (13:05 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 1 Mar 2012 18:05:03 +0000 (13:05 -0500)
--HG--
branch : 1.8

configure
configure.in

index 67950da164af2320c3118d0a68702eee5d0e2786..bcff8f7930d8c6b0db4083ff5b160d55acc269cb 100755 (executable)
--- a/configure
+++ b/configure
@@ -14538,6 +14538,31 @@ $as_echo "#define volatile /**/" >>confdefs.h
 
 fi
 
+# Check for variadic macro support in cpp
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+$ac_includes_default
+#if defined(__GNUC__) && __GNUC__ == 2
+# define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
+#else
+# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
+#endif
+
+int
+main ()
+{
+sudo_fprintf(stderr, "a %s", "test");
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
     _CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS -static-libgcc"
index 905af514373277c44f7bfb345f21a52ec507eb48..e4478c74db7f27e843570d4e03195a329a7f5b86 100644 (file)
@@ -1913,6 +1913,15 @@ dnl
 AC_PROG_GCC_TRADITIONAL
 AC_C_CONST
 AC_C_VOLATILE
+# Check for variadic macro support in cpp
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+AC_INCLUDES_DEFAULT
+#if defined(__GNUC__) && __GNUC__ == 2
+# define sudo_fprintf(fp, fmt...) fprintf((fp), (fmt))
+#else
+# define sudo_fprintf(fp, ...) fprintf((fp), __VA_ARGS__)
+#endif
+], [sudo_fprintf(stderr, "a %s", "test");])], [], [AC_MSG_ERROR([Your C compiler doesn't support variadic macros, try building with gcc instead])])
 if test X"$with_gnu_ld" != "yes" -a -n "$GCC"; then
     _CFLAGS="$CFLAGS"
     CFLAGS="$CFLAGS -static-libgcc"