errno = saved_errno;
}
+#ifdef NO_VARIADIC_MACROS
+void
+sudo_debug_printf_nvm(int pri, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ sudo_debug_vprintf2(NULL, NULL, 0, pri, fmt, ap);
+ va_end(ap);
+}
+#endif /* NO_VARIADIC_MACROS */
+
void
sudo_debug_printf2(const char *func, const char *file, int lineno, int level,
const char *fmt, ...)
/* Define to 1 if you want a single ticket file instead of per-tty files. */
#undef NO_TTY_TICKETS
+/* Define if your C preprocessor does not support variadic macros. */
+#undef NO_VARIADIC_MACROS
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
fi
-# Check for variadic macro support in cpp
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for variadic macro support in cpp" >&5
+$as_echo_n "checking for variadic macro support in cpp... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
else
- as_fn_error $? "Your C compiler doesn't support variadic macros, try building with gcc instead" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_VARIADIC_MACROS 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Your C compiler doesn't support variadic macros, debugging support will be limited" >&5
+$as_echo "$as_me: WARNING: Your C compiler doesn't support variadic macros, debugging support will be limited" >&2;}
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#include <sys/types.h>
-#if TIME_WITH_SYS_TIME
+#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
#endif
#include <time.h>
AC_PROG_GCC_TRADITIONAL
AC_C_CONST
AC_C_VOLATILE
-# Check for variadic macro support in cpp
+AC_MSG_CHECKING([for variadic macro support in cpp])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
AC_INCLUDES_DEFAULT
#if defined(__GNUC__) && __GNUC__ == 2
#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])])
+], [sudo_fprintf(stderr, "a %s", "test");])], [AC_MSG_RESULT([yes])],
+[AC_MSG_RESULT([no])
+ AC_DEFINE([NO_VARIADIC_MACROS], [1], [Define if your C preprocessor does not support variadic macros.])
+ AC_MSG_WARN([Your C compiler doesn't support variadic macros, debugging support will be limited])])
dnl
dnl Program checks
* We wrap fatal/fatalx and warning/warningx so that the same output can
* go to the debug file, if there is one.
*/
-#if defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0
-# if defined(__GNUC__) && __GNUC__ == 2
-# define fatal(fmt...) fatal_nodebug(fmt)
-# define fatalx(fmt...) fatalx_nodebug(fmt)
-# define warning(fmt...) warning_nodebug(fmt)
-# define warningx(fmt...) warningx_nodebug(fmt)
-# else
-# define fatal(...) fatal_nodebug(__VA_ARGS__)
-# define fatalx(...) fatalx_nodebug(__VA_ARGS__)
-# define warning(...) warning_nodebug(__VA_ARGS__)
-# define warningx(...) warningx_nodebug(__VA_ARGS__)
-# endif /* __GNUC__ == 2 */
+#if (defined(SUDO_ERROR_WRAP) && SUDO_ERROR_WRAP == 0) || defined(NO_VARIADIC_MACROS)
+# define fatal fatal_nodebug
+# define fatalx fatalx_nodebug
+# define warning warning_nodebug
+# define warningx warningx_nodebug
# define vfatal(fmt, ap) fatal_nodebug((fmt), (ap))
# define vfatalx(fmt, ap) fatalx_nodebug((fmt), (ap))
# define vwarning(fmt, ap) warning_nodebug((fmt), (ap))
* Variadic macros are a C99 feature but GNU cpp has supported
* a (different) version of them for a long time.
*/
-#if defined(__GNUC__) && __GNUC__ == 2
+#if defined(NO_VARIADIC_MACROS)
+# define sudo_debug_printf sudo_debug_printf_nvm
+#elif defined(__GNUC__) && __GNUC__ == 2
# define sudo_debug_printf(pri, fmt...) \
sudo_debug_printf2(__func__, __FILE__, __LINE__, (pri)|sudo_debug_subsys, \
fmt)
void sudo_debug_exit_ptr(const char *func, const char *file, int line, int subsys, const void *rval);
int sudo_debug_fd_set(int fd);
int sudo_debug_init(const char *debugfile, const char *settings);
+void sudo_debug_printf_nvm(int pri, const char *fmt, ...) __printf0like(2, 3);
void sudo_debug_printf2(const char *func, const char *file, int line, int level, const char *fmt, ...) __printf0like(5, 6);
void sudo_debug_vprintf2(const char *func, const char *file, int line, int level, const char *fmt, va_list ap) __printf0like(5, 0);
void sudo_debug_write(const char *str, int len, int errno_val);