From aac071824f6c98003f30d49ab440c15b4b53692c Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 23 May 2013 13:14:37 +0200 Subject: Enable printf format string checking https://fedorahosted.org/sssd/ticket/1945 --- configure.ac | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ebce20254..c389bec4f 100644 --- a/configure.ac +++ b/configure.ac @@ -268,6 +268,24 @@ if test x"$sss_client_cv_attribute_destructor" = xyes ; then [whether compiler supports __attribute__((destructor))]) fi +AC_CACHE_CHECK([whether compiler supports __attribute__((format))], + sss_cv_attribute_format, + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [void debug_fn(const char *format, ...) __attribute__ ((format (printf, 1, 2)));] + )], + [sss_cv_attribute_format=yes], + [ + AC_MSG_RESULT([no]) + AC_MSG_WARN([compiler does NOT support __attribute__((format))]) + ]) + ]) + +if test x"$sss_cv_attribute_format" = xyes ; then + AC_DEFINE(HAVE_FUNCTION_ATTRIBUTE_FORMAT, 1, + [whether compiler supports __attribute__((format))]) +fi + PKG_CHECK_MODULES([CHECK], [check >= 0.9.5], [have_check=1], [have_check=]) if test x$have_check = x; then AC_MSG_WARN([Without the 'CHECK' libraries, you will be unable to run all tests in the 'make check' suite]) -- cgit