build: move common autoconf calls to m4 dir

This commit is contained in:
Danny Robson 2015-01-30 16:49:14 +11:00
parent 819e45b441
commit a3e3160497
8 changed files with 357 additions and 194 deletions

View File

@ -19,8 +19,6 @@ AC_LANG([C++])
AC_PROG_CXX
AC_PROG_CXXCPP
AX_APPEND_COMPILE_FLAGS([-std=c++1y])
AX_COMPILER_VENDOR
AM_INIT_AUTOMAKE([1.14 dist-bzip2 dist-xz foreign subdir-objects])
@ -28,107 +26,11 @@ AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
###############################################################################
## Major compilation options
AC_ARG_ENABLE([debugging],
[AS_HELP_STRING([--enable-debugging], [enables developer debugging support])]
)
AC_ARG_ENABLE([sanitizer], [
AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])
])
###############################################################################
## Warnings
##
## Note: GCC will silently accept warnings that it doesn't handle but then
## complain about them at the first legitimate warning discovered in a source
## file. To work around this we have to detect GCC.
# Compound warnings
AX_APPEND_COMPILE_FLAGS([-Wall], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wextra], [], [-Werror])
# General warnings
AX_APPEND_COMPILE_FLAGS([-Wcast-align], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wcast-qual], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-aggressive-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnoexcept], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-parentheses], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wshadow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsign-compare], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsign-promo], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wstrict-aliasing], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wtype-limits], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
# Required extensions
#AX_APPEND_COMPILE_FLAGS([-Wgnu-flexible-array-union-member], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-flexible-array-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-conditional-omitted-operand], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-empty-struct], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-flexible-array-union-member], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-zero-variadic-macro-arguments], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-zero-length-array], [], [-Werror])
])
# Excessive warnings
AX_APPEND_COMPILE_FLAGS([-Wno-missing-braces], [], [-Werror])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-nested-anon-types], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-unused-const-variable], [], [-Werror])
])
#AX_APPEND_COMPILE_FLAGS([-Wunsafe-loop-optimizations], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Winline], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wconversion], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wdouble-promotion], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wold-style-cast], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Woverloaded-virtual], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wsign-conversion], [], [-Werror])
# Strict warnings
AX_APPEND_COMPILE_FLAGS([-pedantic], [], [-Werror])
######################################################################
## Platform compilation helpers
AX_APPEND_COMPILE_FLAGS([-fno-common], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fno-nonansi-builtins], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fno-deduce-init-list], [], [-Werror])
###############################################################################
## Compiler features
AC_C_CONST
AC_C_RESTRICT
AC_C_INLINE
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A { virtual void C (void) = 0; };
struct B : A { void C (void) override; }; ],
[])],
[], [AC_DEFINE([override], [], [Pretend about override keyword support])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A final { }; ],
[])],
[], [AC_DEFINE([final], [], [Pretend about final keyword support])])
NC_CXX
NC_PLATFORM
NC_WARNINGS
NC_DEBUGGING
NC_OPTIMISATION
###############################################################################
## Architecture features
@ -144,23 +46,6 @@ AC_TYPE_SSIZE_T
###############################################################################
## Platform features
AS_CASE([$host_os],
[mingw32], [
AM_CONDITIONAL([PLATFORM_WIN32], [true])
AM_CONDITIONAL([PLATFORM_LINUX], [false])
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
AC_SUBST([NET_LIBS], [-lws2_32])
],
[linux-gnu], [
AM_CONDITIONAL([PLATFORM_WIN32], [false])
AM_CONDITIONAL([PLATFORM_LINUX], [true])
],
[AC_ERROR([Unknown host_os])]
)
AC_FUNC_MMAP
AC_CHECK_FUNC([strndup], [
@ -178,59 +63,6 @@ AS_IF([test "x$ac_cv_search_clock_gettime" == "x-*"], [
###############################################################################
## Debug features
AS_IF([test "x$enable_debugging" = "xyes"], [
AS_IF([test "x$enable_sanitizer" = "xyes"], [
AX_APPEND_COMPILE_FLAGS([-fsanitize=address], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fsanitize=undefined], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fsanitize=leak], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=address], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=undefined], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=leak], [], [-Werror])
AX_APPEND_LINK_FLAGS([-lasan], [], [-Werror])
AX_APPEND_LINK_FLAGS([-lubsan], [], [-Werror])
])
AX_APPEND_COMPILE_FLAGS([-ggdb], [], [-Werror])
AX_APPEND_LINK_FLAGS([-rdynamic])
AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled], [], [-Werror])
AC_DEFINE([_GLIBCXX_DEBUG], [], [Use glibcxx debugging mode], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-O0], [], [-Werror])
], [
AX_APPEND_COMPILE_FLAGS([-O2], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-vectorize], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funsafe-loop-optimizations], [], [-Werror])
# gcc >= 4.8 defaults to enabling stack-protector, we care more about
# performance than security.
AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror])
# mingw LTO support currently appears to be broken
AS_IF([test x"${host_os}" != x"mingw32"], [
AX_APPEND_COMPILE_FLAGS([-flto])
AX_APPEND_LINK_FLAGS([-fuse-linker-plugin], [], [-Werror])
])
])
AS_CASE([$host_os],
[mingw32], [
AX_APPEND_COMPILE_FLAGS([-gstabs], [], [-Werror])
],
[linux-gnu], [
AX_APPEND_COMPILE_FLAGS([-g], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ggdb], [], [-Werror])
],
[AC_MSG_WARN([Unknown host_os])]
)
###############################################################################
## Documentation
@ -266,26 +98,6 @@ AC_SUBST(ZLIB_LIBS)
###############################################################################
## Performance and build optimisations
AS_CASE([$host_cpu],
[x86_64], [
AX_APPEND_COMPILE_FLAGS([-mtune=generic], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msse], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msse2], [], [-Werror])
],
[i686], [
AX_APPEND_COMPILE_FLAGS([-march=prescott], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-mtune=generic], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-mcmov], [], [-Werror])
],
[AC_MSG_WARN([unknown host_cpu])]
)
AX_APPEND_COMPILE_FLAGS([-pipe], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-mfpmath=sse], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msahf], [], [-Werror])
###############################################################################
## Output

1
m4/.gitignore vendored
View File

@ -1 +0,0 @@
*.m4

149
m4/ax_boost_thread.m4 Normal file
View File

@ -0,0 +1,149 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_thread.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_THREAD
#
# DESCRIPTION
#
# Test for Thread library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_THREAD_LIB)
#
# And sets:
#
# HAVE_BOOST_THREAD
#
# LICENSE
#
# Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
# Copyright (c) 2009 Michael Tindal
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 27
AC_DEFUN([AX_BOOST_THREAD],
[
AC_ARG_WITH([boost-thread],
AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@],
[use the Thread library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-thread=boost_thread-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_thread_lib=""
else
want_boost="yes"
ax_boost_user_thread_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Thread library is available,
ax_cv_boost_thread,
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
if test "x$host_os" = "xsolaris" ; then
CXXFLAGS="-pthreads $CXXFLAGS"
elif test "x$host_os" = "xmingw32" ; then
CXXFLAGS="-mthreads $CXXFLAGS"
else
CXXFLAGS="-pthread $CXXFLAGS"
fi
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
[[boost::thread_group thrds;
return 0;]])],
ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_thread" = "xyes"; then
if test "x$host_os" = "xsolaris" ; then
BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
elif test "x$host_os" = "xmingw32" ; then
BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
else
BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
fi
AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS
case "x$host_os" in
*bsd* )
LDFLAGS="-pthread $LDFLAGS"
break;
;;
esac
if test "x$ax_boost_user_thread_lib" = "x"; then
for libextension in `ls -r $BOOSTLIBDIR/libboost_thread* 2>/dev/null | sed 's,.*/lib,,' | sed 's,\..*,,'`; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
[link_thread="no"])
done
if test "x$link_thread" != "xyes"; then
for libextension in `ls -r $BOOSTLIBDIR/boost_thread* 2>/dev/null | sed 's,.*/,,' | sed 's,\..*,,'`; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
[link_thread="no"])
done
fi
else
for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
[link_thread="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_thread" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
else
case "x$host_os" in
*bsd* )
BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
break;
;;
esac
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

20
m4/nc_cxx.m4 Normal file
View File

@ -0,0 +1,20 @@
AC_DEFUN([NC_CXX],[
AX_APPEND_COMPILE_FLAGS([-std=c++1y])
AX_APPEND_COMPILE_FLAGS([-fno-deduce-init-list], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fno-deduce-init-list], [], [-Werror])
AC_C_CONST
AC_C_RESTRICT
AC_C_INLINE
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A { virtual void C (void) = 0; };
struct B : A { void C (void) override; }; ],
[])],
[], [AC_DEFINE([override], [], [Pretend about override keyword support])])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([struct A final { }; ],
[])],
[], [AC_DEFINE([final], [], [Pretend about final keyword support])])
])

42
m4/nc_debugging.m4 Normal file
View File

@ -0,0 +1,42 @@
AC_DEFUN([NC_DEBUGGING],[
##-------------------------------------------------------------------------
AX_REQUIRE_DEFINED([AS_HELP_STRING])
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
##-------------------------------------------------------------------------
AC_ARG_ENABLE([sanitizer], [
AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])
])
AS_IF([test "x$enable_sanitizer" = "xyes"], [
AX_APPEND_COMPILE_FLAGS([-fsanitize=address], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fsanitize=undefined], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fsanitize=leak], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=address], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=undefined], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=leak], [], [-Werror])
AX_APPEND_LINK_FLAGS([-lasan], [], [-Werror])
AX_APPEND_LINK_FLAGS([-lubsan], [], [-Werror])
])
##-------------------------------------------------------------------------
AC_ARG_ENABLE([debugging], [
AS_HELP_STRING([--enable-debugging], [enables developer debugging support])
])
AS_IF([test "x${enable_debugging}" = "xyes"], [
AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled])
AC_DEFINE([_GLIBCXX_DEBUG], [], [Use glibcxx debugging mode])
AX_APPEND_COMPILE_FLAGS([-O0])
], [
AX_APPEND_COMPILE_FLAGS([-O2])
])
##-------------------------------------------------------------------------
AX_APPEND_COMPILE_FLAGS([-g], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ggdb], [], [-Werror])
])

54
m4/nc_optimisation.m4 Normal file
View File

@ -0,0 +1,54 @@
AC_DEFUN([NC_OPTIMISATION],[
##-------------------------------------------------------------------------
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AC_CANONICAL_HOST])
##-------------------------------------------------------------------------
AC_ARG_ENABLE([lto], [
AS_HELP_STRING([--enable-lto], [enable link-time optimisation])
])
AS_IF([test "x$enable_lto" == "xyes"], [
AS_IF([test x"${host_os}" != x"mingw32"], [
AC_ERROR([mingw32 link-time optimisation is currently broken])
])
AX_APPEND_COMPILE_FLAGS([-flto], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fno-fat-lto-objects], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fuse-linker-plugin], [], [-Werror])
])
##-------------------------------------------------------------------------
AC_CANONICAL_HOST
AS_CASE([$host_cpu],
[x86_64], [
AX_APPEND_COMPILE_FLAGS([-mtune=generic], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msse], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msse2], [], [-Werror])
],
[i686], [
AX_APPEND_COMPILE_FLAGS([-march=prescott], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-mtune=generic], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-mcmov], [], [-Werror])
],
[AC_MSG_WARN([unknown host_cpu])]
)
AX_APPEND_COMPILE_FLAGS([-pipe])
AX_APPEND_COMPILE_FLAGS([-mfpmath=sse], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-msahf], [], [-Werror])
AS_IF([test "x$enable_debugging" != "xyes"], [
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-vectorize], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funsafe-loop-optimizations], [], [-Werror])
# gcc >= 4.8 defaults to enabling stack-protector, we care more about
# performance than security.
AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror])
])
])

28
m4/nc_platform.m4 Normal file
View File

@ -0,0 +1,28 @@
AC_DEFUN([NC_PLATFORM],[
AC_CANONICAL_HOST
AM_CONDITIONAL([PLATFORM_WIN32], [test "x$host_os" = "xmingw32"])
AM_CONDITIONAL([PLATFORM_LINUX], [test "x$host_os" = "xlinux-gnu"])
AS_CASE([$host_os],
[mingw32], [
AC_CHECK_HEADERS([winsock2.h ws2tcpip.h])
AC_CHECK_HEADERS([windows.h],[],[],[AC_INCLUDES_DEFAULT])
AC_SUBST([NET_LIBS], [-lws2_32])
AX_APPEND_COMPILE_FLAGS([-DBOOST_THREAD_USE_LIB], [], [-Werror])
## Force as many static libraries as possible to avoid bullshit libc
## cross-library memory management issues.
AX_APPEND_LINK_FLAGS([-static-libstdc++], [], [-Werror])
AX_APPEND_LINK_FLAGS([-static-libgcc], [], [-Werror])
],
[linux-gnu], [ ],
[AC_MSG_ERROR([Unknown platform])]
)
AX_APPEND_COMPILE_FLAGS([-fno-common], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fno-nonansi-builtins], [], [-Werror])
])

59
m4/nc_warnings.m4 Normal file
View File

@ -0,0 +1,59 @@
AC_DEFUN([NC_WARNINGS],[
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR])
AX_COMPILER_VENDOR
# Compound warnings
AX_APPEND_COMPILE_FLAGS([-Wall], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wextra], [], [-Werror])
# General warnings
AX_APPEND_COMPILE_FLAGS([-Wcast-align], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wcast-qual], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-aggressive-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnoexcept], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnon-virtual-dtor], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-parentheses], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wshadow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsign-compare], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsign-promo], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wstrict-aliasing], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wstrict-overflow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wtype-limits], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
# Required extensions
#AX_APPEND_COMPILE_FLAGS([-Wgnu-flexible-array-union-member], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
#AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [], [-Werror])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-c99-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-flexible-array-extensions], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-conditional-omitted-operand], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-empty-struct], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-flexible-array-union-member], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-gnu-zero-variadic-macro-arguments], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-vla-extension], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-zero-length-array], [], [-Werror])
])
# Excessive warnings
AX_APPEND_COMPILE_FLAGS([-Wno-missing-braces], [], [-Werror])
AS_IF([test "x$ax_cv_cxx_compiler_vendor" != "xgnu"], [
AX_APPEND_COMPILE_FLAGS([-Wno-nested-anon-types], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wno-unused-const-variable], [], [-Werror])
])
# Strict warnings
AX_APPEND_COMPILE_FLAGS([-pedantic], [], [-Werror])
])