I need to set "-Wall -Werror" as CPPFLAGS for all the source files in my project. Is there a way to do that in autotools?
I have tried the following in configure.ac:
AC_SUBST([AM_CPPFLAGS], [-Wall -Wextra])
It doesn't seem to work.
EDIT: I found an m4 macro called AX_CXXFLAGS_WARN_ALL here: http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html However I get the following error when I try to use it:
configure.ac:10: /usr/bin/m4: ERROR: recursion limit of 1024 exceeded, use -L<N> to change it
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1
autoreconf: aclocal failed with exit status: 1
My configure.ac is as follows:
AC_INIT([foo], [1.0], [bar@baz.com])
m4_include([m4/ax_cflags_warn_all.m4])
m4_include([m4/ax_append_flag.m4])
m4_include([m4/ax_lib_oracle_oci.m4])
m4_include([m4/ax_check_openssl.m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_LIBTOOL
AX_CFLAGS_WARN_ALL
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AX_LIB_ORACLE_OCI([11.0])
AX_CHECK_OPENSSL
AC_SUBST([AM_CXXFLAGS], [-fpic])
AC_OUTPUT