summaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorStefan Fritsch <sf@apache.org>2011-10-08 09:48:01 +0200
committerStefan Fritsch <sf@apache.org>2011-10-08 09:48:01 +0200
commit03227ed1c40290d0db2abcf6e6f70b4d28c5a92d (patch)
tree65bbed0d0b8236b1337d3f0574724b34af0fd6b2 /acinclude.m4
parentAdd another AP_DEBUG_ASSERT to document some assumptions in the code, (diff)
downloadapache2-03227ed1c40290d0db2abcf6e6f70b4d28c5a92d.tar.xz
apache2-03227ed1c40290d0db2abcf6e6f70b4d28c5a92d.zip
Add some CFLAGS in maintainer mode if supported by gcc:
-Wformat -Wformat-security -Werror=format-security -Werror=declaration-after-statement Add new macro APACHE_ADD_GCC_CFLAGS to do the compatibility check. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1180331 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m422
1 files changed, 22 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 2e0907e6a9..f51d27d960 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -706,3 +706,25 @@ YES_IS_DEFINED
CPPFLAGS="$apache_old_cppflags"
])
])
+
+dnl
+dnl APACHE_ADD_GCC_CFLAGS
+dnl
+dnl Check if compiler is gcc and supports flag. If yes, add to CFLAGS.
+dnl
+AC_DEFUN([APACHE_ADD_GCC_CFLAG], [
+ define([ap_gcc_ckvar], [ac_cv_gcc_]translit($1, [-:.=], [____]))
+ if test "$GCC" = "yes"; then
+ AC_CACHE_CHECK([whether gcc accepts $1], ap_gcc_ckvar, [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
+ [ap_gcc_ckvar=yes], [ap_gcc_ckvar=no])
+ CFLAGS="$save_CFLAGS"
+ ])
+ if test "$]ap_gcc_ckvar[" = "yes" ; then
+ APR_ADDTO(CFLAGS,[$1])
+ fi
+ fi
+ undefine([ap_gcc_ckvar])
+])