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])
+])
APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
if test "$GCC" = "yes"; then
APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith])
- AC_CACHE_CHECK([whether gcc accepts -Wdeclaration-after-statement], [ap_cv_cc_Wdas], [
- save_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
- [ap_cv_cc_Wdas=yes], [ap_cv_cc_Wdas=no])
- CFLAGS=$save_CFLAGS
- ])
- if test "$ap_cv_cc_Wdas" = "yes"; then
- APR_ADDTO(CFLAGS,[-Wdeclaration-after-statement])
- fi
+ APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
+ APACHE_ADD_GCC_CFLAG([-Werror=declaration-after-statement])
+ APACHE_ADD_GCC_CFLAG([-Wformat])
+ APACHE_ADD_GCC_CFLAG([-Wformat-security])
+ APACHE_ADD_GCC_CFLAG([-Werror=format-security])
elif test "$AIX_XLC" = "yes"; then
APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
fi
APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
if test "$GCC" = "yes"; then
APR_ADDTO(CFLAGS,[-Wall -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Wpointer-arith -O0])
- AC_CACHE_CHECK([whether gcc accepts -Wdeclaration-after-statement], [ap_cv_cc_Wdas], [
- save_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo() { return 0; }])],
- [ap_cv_cc_Wdas=yes], [ap_cv_cc_Wdas=no])
- CFLAGS=$save_CFLAGS
- ])
- if test "$ap_cv_cc_Wdas" = "yes"; then
- APR_ADDTO(CFLAGS,[-Wdeclaration-after-statement])
- fi
+ APACHE_ADD_GCC_CFLAG([-Wdeclaration-after-statement])
+ APACHE_ADD_GCC_CFLAG([-Werror=declaration-after-statement])
+ APACHE_ADD_GCC_CFLAG([-Wformat])
+ APACHE_ADD_GCC_CFLAG([-Wformat-security])
+ APACHE_ADD_GCC_CFLAG([-Werror=format-security])
elif test "$AIX_XLC" = "yes"; then
APR_ADDTO(CFLAGS,-qfullpath -qinitauto=FE -qcheck=all -qinfo=pro)
fi