m4: bump autocruft

This commit is contained in:
Danny Robson 2016-05-12 17:27:45 +10:00
parent 1a17f27b37
commit d4b951b4db
10 changed files with 88 additions and 68 deletions

View File

@ -12,7 +12,7 @@ dnl sets BOOST_LDFLAGS and BOOST_CPPFLAGS
AC_DEFUN([NC_BOOST], [
AC_REQUIRE([NC_BOOST_BASE])
for _nc_boost_lib in $2; do
AS_CASE([$_nc_boost_lib],
["system"], [NC_BOOST_SYSTEM],
@ -32,11 +32,11 @@ AC_DEFUN([NC_BOOST], [
dnl append flags and libs if they don't already exist
for flag in $_CPPFLAGS; do
[[[ ! " $BOOST_CPPFLAGS " =~ " $flag " ]]] && BOOST_CPPFLAGS="$BOOST_CPPFLAGS $flag"
AS_IF([test " $BOOST_CPPFLAGS " != " *$flag* "], [BOOST_CPPFLAGS="$BOOST_CPPFLAGS $flag"])
done
for lib in $_LDFLAGS; do
[[[ ! " $BOOST_LDFLAGS " =~ " $lib " ]]] && BOOST_LDFLAGS="$BOOST_LDFLAGS $lib"
AS_IF([test " $BOOST_LDFLAGS " != " *$lib* "], [BOOST_LDFLAGS="$BOOST_LDFLAGS $lib"])
done
done
])

View File

@ -2,6 +2,6 @@ AC_DEFUN([NC_BOOST_BASE], [
: ${BOOST_LDFLAGS=""}
: ${BOOST_CPPFLAGS=""}
BOOST_BASE_LDFLAGS=""
BOOST_BASE_CPPFLAGS=""
BOOST_BASE_LDFLAGS="${BOOST_LDFLAGS}"
BOOST_BASE_CPPFLAGS="${BOOST_CPPFLAGS}"
])

View File

@ -6,10 +6,10 @@ AC_DEFUN([NC_BOOST_FILESYSTEM], [
for lib in boost_filesystem; do
AC_MSG_CHECKING([if boost filesystem library is $lib])
nc_save_cflags=$CFLAGS
nc_save_cxxflags=$CXXFLAGS
nc_save_libs=$LIBS
CFLAGS="$CFLAGS $BOOST_BASE_CPPFLAGS $BOOST_SYSTEM_CPPFLAGS"
CXXFLAGS="$CXXFLAGS $BOOST_BASE_CPPFLAGS $BOOST_SYSTEM_CPPFLAGS"
LIBS="$LIBS $BOOST_BASE_LDFLAGS $BOOST_SYSTEM_LDFLAGS -l$lib"
dnl filesystem::path::filename appears to be extern. try calling it.
@ -20,10 +20,10 @@ AC_DEFUN([NC_BOOST_FILESYSTEM], [
[nc_cv_boost_filesystem=no]
)
BOOST_FILESYSTEM_CPPFLAGS=$CFLAGS
BOOST_FILESYSTEM_CPPFLAGS=$CXXFLAGS
BOOST_FILESYSTEM_LDFLAGS=-l$lib
CFLAGS=$nc_save_cflags
CXXFLAGS=$nc_save_cxxflags
LIBS=$nc_save_libs
AC_MSG_RESULT([$nc_cv_boost_filesystem])

View File

@ -5,10 +5,10 @@ AC_DEFUN([NC_BOOST_SYSTEM], [
for lib in boost_system; do
AC_MSG_CHECKING([if boost system library is $lib])
nc_save_cflags=$CFLAGS
nc_save_cxxflags=$CXXFLAGS
nc_save_libs=$LIBS
CFLAGS="$CFLAGS $BOOST_BASE_CPPFLAGS"
CXXFLAGS="$CXXFLAGS $BOOST_BASE_CPPFLAGS"
LIBS="$LIBS $BOOST_BASE_LDFLAGS -l$lib"
dnl Try to call boost::system::throws as it appears to be extern
@ -19,10 +19,10 @@ AC_DEFUN([NC_BOOST_SYSTEM], [
[nc_cv_boost_system=no]
)
BOOST_SYSTEM_CPPFLAGS=$CFLAGS
BOOST_SYSTEM_CPPFLAGS=$CXXFLAGS
BOOST_SYSTEM_LDFLAGS=-l$lib
CFLAGS=$nc_save_cflags
CXXFLAGS=$nc_save_cxxflags
LIBS=$nc_save_libs
AC_MSG_RESULT([$nc_cv_boost_system])

View File

@ -17,24 +17,27 @@ AC_DEFUN([NC_BOOST_THREAD], [
for lib in boost_thread boost_thread_win32; do
AC_MSG_CHECKING([if boost threading library is $lib])
nc_save_cflags=$CFLAGS
nc_save_cxxflags=$CXXFLAGS
nc_save_libs=$LIBS
CFLAGS="$CFLAGS $BOOST_BASE_CPPFLAGS $BOOST_SYSTEM_CPPFLAGS $extra_cflags"
CXXFLAGS="$CXXFLAGS $BOOST_BASE_CPPFLAGS $BOOST_SYSTEM_CPPFLAGS $extra_cflags"
LIBS="$LIBS $BOOST_BASE_LDFLAGS $BOOST_SYSTEM_LDFLAGS $extra_libs -l$lib"
dnl Try to call this_thread::yield as it appears to be extern
AC_TRY_LINK(
[@%:@include <boost/thread/thread.hpp>],
[
@%:@include <unistd.h>
@%:@include <boost/thread.hpp>
],
[boost::this_thread::yield ();],
[nc_cv_boost_thread=yes],
[nc_cv_boost_thread=no]
)
BOOST_THREAD_CPPFLAGS=$CFLAGS
BOOST_THREAD_CPPFLAGS=$CXXFLAGS
BOOST_THREAD_LDFLAGS=-l$lib
CFLAGS=$nc_save_cflags
CXXFLAGS=$nc_save_cxxflags
LIBS=$nc_save_libs
AC_MSG_RESULT([$nc_cv_boost_thread])

View File

@ -1,4 +1,6 @@
AC_DEFUN([NC_CXX],[
AC_REQUIRE([AX_COMPILER_VENDOR])
AX_CHECK_COMPILE_FLAG(
[-std=c++1z],
[AX_APPEND_FLAG([-std=c++1z], [CXXFLAGS])],
@ -14,5 +16,11 @@ AC_DEFUN([NC_CXX],[
AC_C_RESTRICT
AC_C_INLINE
AX_COMPILER_VENDOR
AS_IF(
[test "x$ax_cv_cxx_compiler_vendor" == "xclang"],
[AX_APPEND_COMPILE_FLAGS([-stdlib=libc++])]
)
AX_APPEND_COMPILE_FLAGS([-fvisibility=hidden], [], [-Werror])
])

View File

@ -3,51 +3,19 @@ AC_DEFUN([NC_DEBUGGING],[
AX_REQUIRE_DEFINED([AS_HELP_STRING])
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_APPEND_LINK_FLAGS])
AX_REQUIRE_DEFINED([NC_APPEND_ONE_COMPILE_FLAG])
##-------------------------------------------------------------------------
AC_ARG_ENABLE([sanitizer], [AS_HELP_STRING([--enable-sanitizer], [enable memory sanitizer])])
AS_IF([test "x$enable_sanitizer" = "xyes"], [
m4_foreach([NAME], [
dnl common top-level names. deliberately does not include
dnl 'undefined' due to false positives in some core libraries
dnl (eg, boost::format).
[address],
dnl gcc currently causes segfaults at configure time with [thread],
dnl
dnl gcc specific names. do not use vptr or boost::format will die
[alignment],
[bounds],
[enum],
[float-cast-overflow],
[float-divide-by-zero],
[integer-divide-by-zero],
[leak],
[nonnull-attribute],
[object-size],
[return],
[returns-nonnull-attribute],
[shift],
[signed-integer-overflow],
[unreachable],
[vla-bound],
dnl clang specific names
[integer],
[undefined-trap],
[cfi]dnl
], [
AX_APPEND_COMPILE_FLAGS([-fsanitize=[]NAME], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fsanitize=[]NAME], [], [-Werror])
])
AX_APPEND_COMPILE_FLAGS([-fsanitize=address])
AX_APPEND_COMPILE_FLAGS([-fsanitize=undefined])
## We, and the std library, tend to use unsigned overflow legitimately
AX_APPEND_COMPILE_FLAGS([-fno-sanitize=unsigned-integer-overflow], [], [-Werror])
AX_APPEND_LINK_FLAGS([-fno-sanitize=unsigned-integer-overflow], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftrapv], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftrapv])
])
AM_CONDITIONAL([WITH_SANITIZER], [test "x${enable_sanitizer}" == "xyes"])
##-------------------------------------------------------------------------
AC_ARG_ENABLE([debugging], [AS_HELP_STRING([--enable-debugging], [enables developer debugging support])])
@ -55,7 +23,9 @@ AC_DEFUN([NC_DEBUGGING],[
AC_DEFINE([ENABLE_DEBUGGING], [], [Debugging support enabled])
AC_DEFINE([_GLIBCXX_DEBUG], [], [Use glibcxx debugging mode])
NC_APPEND_ONE_COMPILE_FLAG([-O0])
AX_APPEND_COMPILE_FLAGS([-O0])
AX_APPEND_COMPILE_FLAGS([-fstack-protector])
], [
AX_APPEND_COMPILE_FLAGS([-O2])
AX_APPEND_COMPILE_FLAGS([-fno-rtti])
@ -64,10 +34,10 @@ AC_DEFUN([NC_DEBUGGING],[
##-------------------------------------------------------------------------
AS_CASE([${host_os}],
[mingw*], [AX_APPEND_COMPILE_FLAGS([-gstabs], [], [-Werror])],
[mingw*], [AX_APPEND_COMPILE_FLAGS([-gstabs])],
[
AX_APPEND_COMPILE_FLAGS([-g], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ggdb], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-g])
AX_APPEND_COMPILE_FLAGS([-ggdb])
]
)
])

View File

@ -75,15 +75,25 @@ AC_DEFUN([NC_OPTIMISATION],[
AX_APPEND_COMPILE_FLAGS([-fslp-vectorize-aggressive], [], [-Werror])
# loop hosting/distribution
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-floop-nest-optimize], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribution], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-distribute-patterns], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-im], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-if-convert-stores], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-ftree-loop-linear], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-fivopts], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funsafe-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-floop-interchange], [], [-Werror])
# safety removal for performance
AX_APPEND_COMPILE_FLAGS([-fpredictive-commoning], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-funswitch-loops], [], [-Werror])
# options that require substantial time/memory
AX_APPEND_COMPILE_FLAGS([-fipa-pta])
dnl # safety removal for performance
AX_APPEND_COMPILE_FLAGS([-fno-stack-protector], [], [-Werror])
])

View File

@ -1,8 +1,16 @@
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([x${host_os}],
[xmingw*], [nc_cv_platform_win32=yes],
[xlinux*], [nc_cv_platform_linux=yes],
[xfreebsd*], [nc_cv_platform_freebsd=yes],
[AC_MSG_ERROR([unhandled platform ${host_os}])]
)
AM_CONDITIONAL([PLATFORM_WIN32], [test "x$nc_cv_platform_win32" = "xyes"])
AM_CONDITIONAL([PLATFORM_LINUX], [test "x$nc_cv_platform_linux" = "xyes"])
AM_CONDITIONAL([PLATFORM_FREEBSD], [test "x$nc_cv_platform_freebsd" = "xyes"])
AS_CASE([$host_os],
[mingw32], [
@ -20,7 +28,12 @@ AC_DEFUN([NC_PLATFORM],[
AX_APPEND_LINK_FLAGS([-static-libgcc], [], [-Werror])
],
[linux-gnu], [ ],
[freebsd*], [
AX_APPEND_COMPILE_FLAGS([-I/usr/local/include])
AX_APPEND_LINK_FLAGS([-L/usr/local/lib])
],
[linux*], [:],
[AC_MSG_ERROR([Unknown platform])]
)

View File

@ -1,6 +1,6 @@
AC_DEFUN([NC_WARNINGS],[
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
AX_REQUIRE_DEFINED([AX_COMPILER_VENDOR])
AC_REQUIRE([AX_APPEND_COMPILE_FLAGS])
AC_REQUIRE([AX_COMPILER_VENDOR])
AX_COMPILER_VENDOR
@ -32,8 +32,22 @@ AC_DEFUN([NC_WARNINGS],[
AX_APPEND_COMPILE_FLAGS([-Wunsafe-loop-optimizations], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-but-set-variable], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wunused-parameter], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpessimizing-move], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wswitch-enum], [], [-Werror])
dnl gcc-6.1.0 warnings
AX_APPEND_COMPILE_FLAGS([-Wshift-negative-value], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wnull-dereference], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wduplicated-cond], [], [-Werror])
dnl useless-cast isn't usable on gcc-6.1 due to spurious warnings
dnl see gcc#70844
AX_APPEND_COMPILE_FLAGS([-Wuseless-cast], [], [-Werror])
dnl clang 3.7.1 warnings
AX_APPEND_COMPILE_FLAGS([-Wshorten-64-to-32], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wdeprecated], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wcovered-switch-default], [], [-Werror])
# -------------------------------------------------------------------------
# Required extensions
@ -76,5 +90,7 @@ AC_DEFUN([NC_WARNINGS],[
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-types], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsuggest-final-methods], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wsuggest-override], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wweak-vtables], [], [-Werror])
AX_APPEND_COMPILE_FLAGS([-Wpadded], [], [-Werror])
], [])
])