summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-25 22:02:18 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-25 22:07:46 +0200
commit153d17961a746e389c8d0810ac932c0546122eb8 (patch)
tree4be8ed75e6a9278e18caaf39f8edc4d727114817 /configure.ac
parent69892f64641a965a1bd586c916913018b54f7c71 (diff)
downloadskonfig-c-153d17961a746e389c8d0810ac932c0546122eb8.tar.gz
skonfig-c-153d17961a746e389c8d0810ac932c0546122eb8.zip
Use format __attribute__ instead of -Wformat-nonliteral hack
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 16 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 8780d5b..d673e2d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,6 +6,7 @@ AC_INIT([skonfig-c],[0.1],[skonfig@dtnr.ch],[],[http://www.skonfig.li/])
AC_CONFIG_SRCDIR([src/skonfig.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES([Makefile])
AM_INIT_AUTOMAKE([subdir-objects])
@@ -78,6 +79,21 @@ check_set_ccopt -fstack-protector-strong \
check_set_ccopt -fstack-clash-protection \
|| check_set_ccopt -fstack-check # fallback
+# Check compiler capabilities
+AX_C___ATTRIBUTE__
+
+if test x"${ax_cv___attribute__}" = x'yes'
+then
+ _sk_attribute='__attribute__ ((__VA_ARGS__))'
+
+ AX_GCC_FUNC_ATTRIBUTE([format])
+ if test x"${ax_cv_have_func_attribute_format}" = x'yes'
+ then
+ _sk_printf='SK_ATTRIBUTE(format (printf, i, j))'
+ fi
+fi
+AC_DEFINE_UNQUOTED([SK_ATTRIBUTE(...)], [${_sk_attribute:-/* attribute(x) */}], [Define to the compiler name of its __attribute__])
+AC_DEFINE_UNQUOTED([SK_PRINTF(i, j)], [${_sk_printf:-/* format(printf, i, j) */}], [Define to a code snippet your compiler uses for __attribute__ (format)])
# Checks for libraries.