From 1fa7c66f0f1fdd66a5f7efa3e0ccf37422b83d7b Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sun, 20 Jul 2008 11:11:27 +0000 Subject: [PATCH] * configure.ac: add a check for the __printf__ function attribute. --- configure.ac | 8 ++++++++ src/debug.h | 3 +-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 648f6ce..5eebf4a 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,14 @@ AC_TRY_COMPILE([], AC_DEFINE(HAVE_PRAGMA_INIT, 1, [Define to 1 if you have pragma INIT])], [AC_MSG_RESULT(no)]) +AC_MSG_CHECKING(for __printf__ attribute) +AC_TRY_COMPILE([], + [extern void foo(const char *, ...) + __attribute__((__format__(__printf__, 1, 2)));], + [AC_MSG_RESULT(yes) + AC_DEFINE(ATTRIBUTE_PRINTF(x,y), __attribute__((__format__(__printf__, x, y))), [Define to the __printf__ attribute if present])], + [AC_MSG_RESULT(no)]) + ac_cv_have_getopt_long="no" AC_CHECK_FUNCS(getopt_long, [ac_cv_have_getopt_long="yes"], diff --git a/src/debug.h b/src/debug.h index 91dab4c..b09c49b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -16,8 +16,7 @@ * debug.h: debugging support */ -extern void _zz_debug(const char *format, ...) - __attribute__((__format__(__printf__, 1, 2))); +extern void _zz_debug(const char *format, ...) ATTRIBUTE_PRINTF(1,2); #ifdef LIBZZUF # define debug _zz_debug