Add C++ compiler flags with --enable-werror, remove -Wall from CPPFLAGS

This commit is contained in:
Tatsuhiro Tsujikawa 2016-01-22 22:48:45 +09:00
parent cf06c3fbc5
commit 2f80c453bb
4 changed files with 18 additions and 3 deletions

View File

@ -643,9 +643,13 @@ AM_CONDITIONAL([ENABLE_TINY_NGHTTPD],
test "x${have_timerfd_create}" = "xyes"])
ac_save_CFLAGS=$CFLAGS
ac_save_CXXFLAGS=$CXXFLAGS
CFLAGS=
CXXFLAGS=
if test "x$werror" != "xno"; then
# For C compiler
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([-Wextra], [CFLAGS="$CFLAGS -Wextra"])
AX_CHECK_COMPILE_FLAG([-Werror], [CFLAGS="$CFLAGS -Werror"])
@ -691,12 +695,23 @@ if test "x$werror" != "xno"; then
AX_CHECK_COMPILE_FLAG([-Wredundant-decls], [CFLAGS="$CFLAGS -Wredundant-decls"])
# Only work with Clang for the moment
AX_CHECK_COMPILE_FLAG([-Wheader-guard], [CFLAGS="$CFLAGS -Wheader-guard"])
# For C++ compiler
AC_LANG_PUSH(C++)
AX_CHECK_COMPILE_FLAG([-Wall], [CXXFLAGS="$CXXFLAGS -Wall"])
AX_CHECK_COMPILE_FLAG([-Werror], [CXXFLAGS="$CXXFLAGS -Werror"])
AX_CHECK_COMPILE_FLAG([-Wformat-security], [CXXFLAGS="$CXXFLAGS -Wformat-security"])
AC_LANG_POP()
fi
WARNCFLAGS=$CFLAGS
WARNCXXFLAGS=$CXXFLAGS
CFLAGS=$ac_save_CFLAGS
CXXFLAGS=$ac_save_CXXFLAGS
AC_SUBST([WARNCFLAGS])
AC_SUBST([WARNCXXFLAGS])
EXTRACFLAG=
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [EXTRACFLAG="-fvisibility=hidden"])

View File

@ -24,8 +24,8 @@
if ENABLE_EXAMPLES
AM_CFLAGS = $(WARNCFLAGS)
AM_CXXFLAGS = $(WARNCXXFLAGS)
AM_CPPFLAGS = \
-Wall \
-I$(top_srcdir)/lib/includes \
-I$(top_builddir)/lib/includes \
-I$(top_srcdir)/src/includes \

View File

@ -27,9 +27,9 @@ check_PROGRAMS =
TESTS =
AM_CFLAGS = $(WARNCFLAGS)
AM_CXXFLAGS = $(WARNCXXFLAGS)
AM_CPPFLAGS = \
-DPKGDATADIR='"$(pkgdatadir)"' \
-Wall \
-I$(top_srcdir)/lib/includes \
-I$(top_builddir)/lib/includes \
-I$(top_srcdir)/lib \

View File

@ -21,7 +21,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AM_CPPFLAGS = -Wall @DEFS@
AM_CPPFLAGS = @DEFS@
if ENABLE_THIRD_PARTY