mirror of https://github.com/djcb/mu.git
buildsys: remove some stray files
Since we depend on autoconf-archive now, we don't need the copies of some of the m4 files, esp. since those break the autoconf-archive check in configure.ac.
This commit is contained in:
parent
72a1da9da8
commit
5a03c115c9
|
@ -24,8 +24,11 @@ AC_CONFIG_SRCDIR([mu/mu.cc])
|
|||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_AUX_DIR([xua]) # Win/DOS don't like 'aux'
|
||||
|
||||
m4_ifdef([AX_COMPILER_FLAGS], [],
|
||||
AC_MSG_ERROR([Please install autoconf-archive]))
|
||||
m4_ifndef([AX_COMPILER_FLAGS],[
|
||||
AC_MSG_ERROR([
|
||||
*** We need autoconf-archive for reconfiguring, but it is not found
|
||||
*** Please install it.])
|
||||
])
|
||||
|
||||
AX_IS_RELEASE([git-directory])
|
||||
AX_CHECK_ENABLE_DEBUG([yes])
|
||||
|
|
|
@ -16,15 +16,5 @@
|
|||
|
||||
include $(top_srcdir)/gtest.mk
|
||||
|
||||
EXTRA_DIST = \
|
||||
ax_check_enable_debug.m4 \
|
||||
ax_compiler_flags.m4 \
|
||||
ax_compiler_flags_cflags.m4 \
|
||||
ax_compiler_flags_cxxflags.m4 \
|
||||
ax_is_release.m4 \
|
||||
libtool.m4 \
|
||||
ltoptions.m4 \
|
||||
ltversion.m4 \
|
||||
lt~obsolete.m4 \
|
||||
ltsugar.m4 \
|
||||
EXTRA_DIST = \
|
||||
perlmod.m4
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for the presence of an --enable-debug option to configure, with
|
||||
# the specified default value used when the option is not present. Return
|
||||
# the value in the variable $ax_enable_debug.
|
||||
#
|
||||
# Specifying 'yes' adds '-g -O0' to the compilation flags for all
|
||||
# languages. Specifying 'info' adds '-g' to the compilation flags.
|
||||
# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to
|
||||
# the linking flags. Otherwise, nothing is added.
|
||||
#
|
||||
# Define the variables listed in the second argument if debug is enabled,
|
||||
# defaulting to no variables. Defines the variables listed in the third
|
||||
# argument if debug is disabled, defaulting to NDEBUG. All lists of
|
||||
# variables should be space-separated.
|
||||
#
|
||||
# If debug is not enabled, ensure AC_PROG_* will not add debugging flags.
|
||||
# Should be invoked prior to any AC_PROG_* compiler checks.
|
||||
#
|
||||
# IS-RELEASE can be used to change the default to 'no' when making a
|
||||
# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it
|
||||
# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE
|
||||
# macro, there is no need to pass this parameter.
|
||||
#
|
||||
# AX_IS_RELEASE([git-directory])
|
||||
# AX_CHECK_ENABLE_DEBUG()
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2011 Rhys Ulerich <rhys.ulerich@gmail.com>
|
||||
# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
#
|
||||
# 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.
|
||||
|
||||
#serial 5
|
||||
|
||||
AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[
|
||||
AC_BEFORE([$0],[AC_PROG_CC])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_CXX])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_F77])dnl
|
||||
AC_BEFORE([$0],[AC_PROG_FC])dnl
|
||||
|
||||
AC_MSG_CHECKING(whether to enable debugging)
|
||||
|
||||
ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1])))
|
||||
ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],,
|
||||
[$ax_is_release],
|
||||
[$4])))
|
||||
|
||||
# If this is a release, override the default.
|
||||
AS_IF([test "$ax_enable_debug_is_release" = "yes"],
|
||||
[ax_enable_debug_default="no"])
|
||||
|
||||
m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))])
|
||||
m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))])
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])],
|
||||
[],enable_debug=$ax_enable_debug_default)
|
||||
|
||||
# empty mean debug yes
|
||||
AS_IF([test "x$enable_debug" = "x"],
|
||||
[enable_debug="yes"])
|
||||
|
||||
# case of debug
|
||||
AS_CASE([$enable_debug],
|
||||
[yes],[
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="${CFLAGS} -g -O0"
|
||||
CXXFLAGS="${CXXFLAGS} -g -O0"
|
||||
FFLAGS="${FFLAGS} -g -O0"
|
||||
FCFLAGS="${FCFLAGS} -g -O0"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g -O0"
|
||||
],
|
||||
[info],[
|
||||
AC_MSG_RESULT(info)
|
||||
CFLAGS="${CFLAGS} -g"
|
||||
CXXFLAGS="${CXXFLAGS} -g"
|
||||
FFLAGS="${FFLAGS} -g"
|
||||
FCFLAGS="${FCFLAGS} -g"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g"
|
||||
],
|
||||
[profile],[
|
||||
AC_MSG_RESULT(profile)
|
||||
CFLAGS="${CFLAGS} -g -pg"
|
||||
CXXFLAGS="${CXXFLAGS} -g -pg"
|
||||
FFLAGS="${FFLAGS} -g -pg"
|
||||
FCFLAGS="${FCFLAGS} -g -pg"
|
||||
OBJCFLAGS="${OBJCFLAGS} -g -pg"
|
||||
LDFLAGS="${LDFLAGS} -pg"
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT(no)
|
||||
dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags
|
||||
dnl by setting any unset environment flag variables
|
||||
AS_IF([test "x${CFLAGS+set}" != "xset"],
|
||||
[CFLAGS=""])
|
||||
AS_IF([test "x${CXXFLAGS+set}" != "xset"],
|
||||
[CXXFLAGS=""])
|
||||
AS_IF([test "x${FFLAGS+set}" != "xset"],
|
||||
[FFLAGS=""])
|
||||
AS_IF([test "x${FCFLAGS+set}" != "xset"],
|
||||
[FCFLAGS=""])
|
||||
AS_IF([test "x${OBJCFLAGS+set}" != "xset"],
|
||||
[OBJCFLAGS=""])
|
||||
])
|
||||
|
||||
dnl Define various variables if debugging is disabled.
|
||||
dnl assert.h is a NOP if NDEBUG is defined, so define it by default.
|
||||
AS_IF([test "x$enable_debug" = "xyes"],
|
||||
[m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])],
|
||||
[m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])])
|
||||
ax_enable_debug=$enable_debug
|
||||
])
|
|
@ -1,158 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_FLAGS([CFLAGS-VARIABLE], [LDFLAGS-VARIABLE], [IS-RELEASE], [EXTRA-BASE-CFLAGS], [EXTRA-YES-CFLAGS], [UNUSED], [UNUSED], [UNUSED], [EXTRA-BASE-LDFLAGS], [EXTRA-YES-LDFLAGS], [UNUSED], [UNUSED], [UNUSED])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check for the presence of an --enable-compile-warnings option to
|
||||
# configure, defaulting to "error" in normal operation, or "yes" if
|
||||
# IS-RELEASE is equal to "yes". Return the value in the variable
|
||||
# $ax_enable_compile_warnings.
|
||||
#
|
||||
# Depending on the value of --enable-compile-warnings, different compiler
|
||||
# warnings are checked to see if they work with the current compiler and,
|
||||
# if so, are appended to CFLAGS-VARIABLE and LDFLAGS-VARIABLE. This
|
||||
# allows a consistent set of baseline compiler warnings to be used across
|
||||
# a code base, irrespective of any warnings enabled locally by individual
|
||||
# developers. By standardising the warnings used by all developers of a
|
||||
# project, the project can commit to a zero-warnings policy, using -Werror
|
||||
# to prevent compilation if new warnings are introduced. This makes
|
||||
# catching bugs which are flagged by warnings a lot easier.
|
||||
#
|
||||
# By providing a consistent --enable-compile-warnings argument across all
|
||||
# projects using this macro, continuous integration systems can easily be
|
||||
# configured the same for all projects. Automated systems or build
|
||||
# systems aimed at beginners may want to pass the --disable-Werror
|
||||
# argument to unconditionally prevent warnings being fatal.
|
||||
#
|
||||
# --enable-compile-warnings can take the values:
|
||||
#
|
||||
# * no: Base compiler warnings only; not even -Wall.
|
||||
# * yes: The above, plus a broad range of useful warnings.
|
||||
# * error: The above, plus -Werror so that all warnings are fatal.
|
||||
# Use --disable-Werror to override this and disable fatal
|
||||
# warnings.
|
||||
#
|
||||
# The set of base and enabled flags can be augmented using the
|
||||
# EXTRA-*-CFLAGS and EXTRA-*-LDFLAGS variables, which are tested and
|
||||
# appended to the output variable if --enable-compile-warnings is not
|
||||
# "no". Flags should not be disabled using these arguments, as the entire
|
||||
# point of AX_COMPILER_FLAGS is to enforce a consistent set of useful
|
||||
# compiler warnings on code, using warnings which have been chosen for low
|
||||
# false positive rates. If a compiler emits false positives for a
|
||||
# warning, a #pragma should be used in the code to disable the warning
|
||||
# locally. See:
|
||||
#
|
||||
# https://gcc.gnu.org/onlinedocs/gcc-4.9.2/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
|
||||
#
|
||||
# The EXTRA-* variables should only be used to supply extra warning flags,
|
||||
# and not general purpose compiler flags, as they are controlled by
|
||||
# configure options such as --disable-Werror.
|
||||
#
|
||||
# IS-RELEASE can be used to disable -Werror when making a release, which
|
||||
# is useful for those hairy moments when you just want to get the release
|
||||
# done as quickly as possible. Set it to "yes" to disable -Werror. By
|
||||
# default, it uses the value of $ax_is_release, so if you are using the
|
||||
# AX_IS_RELEASE macro, there is no need to pass this parameter. For
|
||||
# example:
|
||||
#
|
||||
# AX_IS_RELEASE([git-directory])
|
||||
# AX_COMPILER_FLAGS()
|
||||
#
|
||||
# CFLAGS-VARIABLE defaults to WARN_CFLAGS, and LDFLAGS-VARIABLE defaults
|
||||
# to WARN_LDFLAGS. Both variables are AC_SUBST-ed by this macro, but must
|
||||
# be manually added to the CFLAGS and LDFLAGS variables for each target in
|
||||
# the code base.
|
||||
#
|
||||
# If C++ language support is enabled with AC_PROG_CXX, which must occur
|
||||
# before this macro in configure.ac, warning flags for the C++ compiler
|
||||
# are AC_SUBST-ed as WARN_CXXFLAGS, and must be manually added to the
|
||||
# CXXFLAGS variables for each target in the code base. EXTRA-*-CFLAGS can
|
||||
# be used to augment the base and enabled flags.
|
||||
#
|
||||
# Warning flags for g-ir-scanner (from GObject Introspection) are
|
||||
# AC_SUBST-ed as WARN_SCANNERFLAGS. This variable must be manually added
|
||||
# to the SCANNERFLAGS variable for each GIR target in the code base. If
|
||||
# extra g-ir-scanner flags need to be enabled, the AX_COMPILER_FLAGS_GIR
|
||||
# macro must be invoked manually.
|
||||
#
|
||||
# AX_COMPILER_FLAGS may add support for other tools in future, in addition
|
||||
# to the compiler and linker. No extra EXTRA-* variables will be added
|
||||
# for those tools, and all extra support will still use the single
|
||||
# --enable-compile-warnings configure option. For finer grained control
|
||||
# over the flags for individual tools, use AX_COMPILER_FLAGS_CFLAGS,
|
||||
# AX_COMPILER_FLAGS_LDFLAGS and AX_COMPILER_FLAGS_* for new tools.
|
||||
#
|
||||
# The UNUSED variables date from a previous version of this macro, and are
|
||||
# automatically appended to the preceding non-UNUSED variable. They should
|
||||
# be left empty in new uses of the macro.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
# Copyright (c) 2015 David King <amigadave@amigadave.com>
|
||||
#
|
||||
# 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 13
|
||||
|
||||
# _AX_COMPILER_FLAGS_LANG([LANGNAME])
|
||||
m4_defun([_AX_COMPILER_FLAGS_LANG],
|
||||
[m4_ifdef([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [],
|
||||
[m4_define([_AX_COMPILER_FLAGS_LANG_]$1[_enabled], [])dnl
|
||||
AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_]$1[FLAGS])])dnl
|
||||
])
|
||||
|
||||
AC_DEFUN([AX_COMPILER_FLAGS],[
|
||||
# C support is enabled by default.
|
||||
_AX_COMPILER_FLAGS_LANG([C])
|
||||
# Only enable C++ support if AC_PROG_CXX is called. The redefinition of
|
||||
# AC_PROG_CXX is so that a fatal error is emitted if this macro is called
|
||||
# before AC_PROG_CXX, which would otherwise cause no C++ warnings to be
|
||||
# checked.
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AX_COMPILER_FLAGS_LANG([CXX])],
|
||||
[m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AX_COMPILER_FLAGS_LANG([CXX])])])
|
||||
AX_REQUIRE_DEFINED([AX_COMPILER_FLAGS_LDFLAGS])
|
||||
|
||||
# Default value for IS-RELEASE is $ax_is_release
|
||||
ax_compiler_flags_is_release=m4_tolower(m4_normalize(ifelse([$3],,
|
||||
[$ax_is_release],
|
||||
[$3])))
|
||||
|
||||
AC_ARG_ENABLE([compile-warnings],
|
||||
AS_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
|
||||
[Enable compiler warnings and errors]),,
|
||||
[AS_IF([test "$ax_compiler_flags_is_release" = "yes"],
|
||||
[enable_compile_warnings="yes"],
|
||||
[enable_compile_warnings="error"])])
|
||||
AC_ARG_ENABLE([Werror],
|
||||
AS_HELP_STRING([--disable-Werror],
|
||||
[Unconditionally make all compiler warnings non-fatal]),,
|
||||
[enable_Werror=maybe])
|
||||
|
||||
# Return the user's chosen warning level
|
||||
AS_IF([test "$enable_Werror" = "no" -a \
|
||||
"$enable_compile_warnings" = "error"],[
|
||||
enable_compile_warnings="yes"
|
||||
])
|
||||
|
||||
ax_enable_compile_warnings=$enable_compile_warnings
|
||||
|
||||
AX_COMPILER_FLAGS_CFLAGS([$1],[$ax_compiler_flags_is_release],
|
||||
[$4],[$5 $6 $7 $8])
|
||||
m4_ifdef([_AX_COMPILER_FLAGS_LANG_CXX_enabled],
|
||||
[AX_COMPILER_FLAGS_CXXFLAGS([WARN_CXXFLAGS],
|
||||
[$ax_compiler_flags_is_release],
|
||||
[$4],[$5 $6 $7 $8])])
|
||||
AX_COMPILER_FLAGS_LDFLAGS([$2],[$ax_compiler_flags_is_release],
|
||||
[$9],[$10 $11 $12 $13])
|
||||
AX_COMPILER_FLAGS_GIR([WARN_SCANNERFLAGS],[$ax_compiler_flags_is_release])
|
||||
])dnl AX_COMPILER_FLAGS
|
|
@ -1,133 +0,0 @@
|
|||
# ============================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cflags.html
|
||||
# ============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_FLAGS_CFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Add warning flags for the C compiler to VARIABLE, which defaults to
|
||||
# WARN_CFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
|
||||
# manually added to the CFLAGS variable for each target in the code base.
|
||||
#
|
||||
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
|
||||
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
|
||||
# which flags to enable.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2014, 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
#
|
||||
# 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 11
|
||||
|
||||
AC_DEFUN([AX_COMPILER_FLAGS_CFLAGS],[
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
|
||||
# Variable names
|
||||
m4_define(ax_warn_cflags_variable,
|
||||
[m4_normalize(ifelse([$1],,[WARN_CFLAGS],[$1]))])
|
||||
|
||||
AC_LANG_PUSH([C])
|
||||
|
||||
# Always pass -Werror=unknown-warning-option to get Clang to fail on bad
|
||||
# flags, otherwise they are always appended to the warn_cflags variable, and
|
||||
# Clang warns on them for every compilation unit.
|
||||
# If this is passed to GCC, it will explode, so the flag must be enabled
|
||||
# conditionally.
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
|
||||
ax_compiler_flags_test="-Werror=unknown-warning-option"
|
||||
],[
|
||||
ax_compiler_flags_test=""
|
||||
])
|
||||
|
||||
# Base flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-fno-strict-aliasing dnl
|
||||
$3 dnl
|
||||
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
|
||||
|
||||
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
|
||||
# "yes" flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-Wall dnl
|
||||
-Wextra dnl
|
||||
-Wundef dnl
|
||||
-Wnested-externs dnl
|
||||
-Wwrite-strings dnl
|
||||
-Wpointer-arith dnl
|
||||
-Wmissing-declarations dnl
|
||||
-Wmissing-prototypes dnl
|
||||
-Wstrict-prototypes dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wno-unused-parameter dnl
|
||||
-Wno-missing-field-initializers dnl
|
||||
-Wdeclaration-after-statement dnl
|
||||
-Wformat=2 dnl
|
||||
-Wold-style-definition dnl
|
||||
-Wcast-align dnl
|
||||
-Wformat-nonliteral dnl
|
||||
-Wformat-security dnl
|
||||
-Wsign-compare dnl
|
||||
-Wstrict-aliasing dnl
|
||||
-Wshadow dnl
|
||||
-Winline dnl
|
||||
-Wpacked dnl
|
||||
-Wmissing-format-attribute dnl
|
||||
-Wmissing-noreturn dnl
|
||||
-Winit-self dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wmissing-include-dirs dnl
|
||||
-Wunused-but-set-variable dnl
|
||||
-Warray-bounds dnl
|
||||
-Wimplicit-function-declaration dnl
|
||||
-Wreturn-type dnl
|
||||
-Wswitch-enum dnl
|
||||
-Wswitch-default dnl
|
||||
$4 dnl
|
||||
$5 dnl
|
||||
$6 dnl
|
||||
$7 dnl
|
||||
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
|
||||
# "error" flags; -Werror has to be appended unconditionally because
|
||||
# it's not possible to test for
|
||||
#
|
||||
# suggest-attribute=format is disabled because it gives too many false
|
||||
# positives
|
||||
AX_APPEND_FLAG([-Werror],ax_warn_cflags_variable)
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-Wno-suggest-attribute=format dnl
|
||||
],ax_warn_cflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
|
||||
# In the flags below, when disabling specific flags, always add *both*
|
||||
# -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
|
||||
# we enable -Werror, disable a flag, and a build bot passes CFLAGS=-Wall,
|
||||
# which effectively turns that flag back on again as an error.
|
||||
for flag in $ax_warn_cflags_variable; do
|
||||
AS_CASE([$flag],
|
||||
[-Wno-*=*],[],
|
||||
[-Wno-*],[
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
|
||||
ax_warn_cflags_variable,
|
||||
[$ax_compiler_flags_test])
|
||||
])
|
||||
done
|
||||
|
||||
AC_LANG_POP([C])
|
||||
|
||||
# Substitute the variables
|
||||
AC_SUBST(ax_warn_cflags_variable)
|
||||
])dnl AX_COMPILER_FLAGS
|
|
@ -1,129 +0,0 @@
|
|||
# ==============================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_compiler_flags_cxxflags.html
|
||||
# ==============================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_COMPILER_FLAGS_CXXFLAGS([VARIABLE], [IS-RELEASE], [EXTRA-BASE-FLAGS], [EXTRA-YES-FLAGS])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Add warning flags for the C++ compiler to VARIABLE, which defaults to
|
||||
# WARN_CXXFLAGS. VARIABLE is AC_SUBST-ed by this macro, but must be
|
||||
# manually added to the CXXFLAGS variable for each target in the code
|
||||
# base.
|
||||
#
|
||||
# This macro depends on the environment set up by AX_COMPILER_FLAGS.
|
||||
# Specifically, it uses the value of $ax_enable_compile_warnings to decide
|
||||
# which flags to enable.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 David King <amigadave@amigadave.com>
|
||||
#
|
||||
# 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 7
|
||||
|
||||
AC_DEFUN([AX_COMPILER_FLAGS_CXXFLAGS],[
|
||||
AC_REQUIRE([AC_PROG_SED])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_COMPILE_FLAGS])
|
||||
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||
AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
|
||||
|
||||
# Variable names
|
||||
m4_define(ax_warn_cxxflags_variable,
|
||||
[m4_normalize(ifelse([$1],,[WARN_CXXFLAGS],[$1]))])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
|
||||
# Always pass -Werror=unknown-warning-option to get Clang to fail on bad
|
||||
# flags, otherwise they are always appended to the warn_cxxflags variable,
|
||||
# and Clang warns on them for every compilation unit.
|
||||
# If this is passed to GCC, it will explode, so the flag must be enabled
|
||||
# conditionally.
|
||||
AX_CHECK_COMPILE_FLAG([-Werror=unknown-warning-option],[
|
||||
ax_compiler_flags_test="-Werror=unknown-warning-option"
|
||||
],[
|
||||
ax_compiler_flags_test=""
|
||||
])
|
||||
|
||||
# Base flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-fno-strict-aliasing dnl
|
||||
$3 dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
|
||||
AS_IF([test "$ax_enable_compile_warnings" != "no"],[
|
||||
# "yes" flags
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-Wall dnl
|
||||
-Wextra dnl
|
||||
-Wundef dnl
|
||||
-Wwrite-strings dnl
|
||||
-Wpointer-arith dnl
|
||||
-Wmissing-declarations dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wno-unused-parameter dnl
|
||||
-Wno-missing-field-initializers dnl
|
||||
-Wformat=2 dnl
|
||||
-Wcast-align dnl
|
||||
-Wformat-nonliteral dnl
|
||||
-Wformat-security dnl
|
||||
-Wsign-compare dnl
|
||||
-Wstrict-aliasing dnl
|
||||
-Wshadow dnl
|
||||
-Winline dnl
|
||||
-Wpacked dnl
|
||||
-Wmissing-format-attribute dnl
|
||||
-Wmissing-noreturn dnl
|
||||
-Winit-self dnl
|
||||
-Wredundant-decls dnl
|
||||
-Wmissing-include-dirs dnl
|
||||
-Wunused-but-set-variable dnl
|
||||
-Warray-bounds dnl
|
||||
-Wreturn-type dnl
|
||||
-Wno-overloaded-virtual dnl
|
||||
-Wswitch-enum dnl
|
||||
-Wswitch-default dnl
|
||||
$4 dnl
|
||||
$5 dnl
|
||||
$6 dnl
|
||||
$7 dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
AS_IF([test "$ax_enable_compile_warnings" = "error"],[
|
||||
# "error" flags; -Werror has to be appended unconditionally because
|
||||
# it's not possible to test for
|
||||
#
|
||||
# suggest-attribute=format is disabled because it gives too many false
|
||||
# positives
|
||||
AX_APPEND_FLAG([-Werror],ax_warn_cxxflags_variable)
|
||||
|
||||
AX_APPEND_COMPILE_FLAGS([ dnl
|
||||
-Wno-suggest-attribute=format dnl
|
||||
],ax_warn_cxxflags_variable,[$ax_compiler_flags_test])
|
||||
])
|
||||
|
||||
# In the flags below, when disabling specific flags, always add *both*
|
||||
# -Wno-foo and -Wno-error=foo. This fixes the situation where (for example)
|
||||
# we enable -Werror, disable a flag, and a build bot passes CXXFLAGS=-Wall,
|
||||
# which effectively turns that flag back on again as an error.
|
||||
for flag in $ax_warn_cxxflags_variable; do
|
||||
AS_CASE([$flag],
|
||||
[-Wno-*=*],[],
|
||||
[-Wno-*],[
|
||||
AX_APPEND_COMPILE_FLAGS([-Wno-error=$(AS_ECHO([$flag]) | $SED 's/^-Wno-//')],
|
||||
ax_warn_cxxflags_variable,
|
||||
[$ax_compiler_flags_test])
|
||||
])
|
||||
done
|
||||
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
# Substitute the variables
|
||||
AC_SUBST(ax_warn_cxxflags_variable)
|
||||
])dnl AX_COMPILER_FLAGS_CXXFLAGS
|
|
@ -1,69 +0,0 @@
|
|||
# ===========================================================================
|
||||
# http://www.gnu.org/software/autoconf-archive/ax_is_release.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_IS_RELEASE(POLICY)
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Determine whether the code is being configured as a release, or from
|
||||
# git. Set the ax_is_release variable to 'yes' or 'no'.
|
||||
#
|
||||
# If building a release version, it is recommended that the configure
|
||||
# script disable compiler errors and debug features, by conditionalising
|
||||
# them on the ax_is_release variable. If building from git, these
|
||||
# features should be enabled.
|
||||
#
|
||||
# The POLICY parameter specifies how ax_is_release is determined. It can
|
||||
# take the following values:
|
||||
#
|
||||
# * git-directory: ax_is_release will be 'no' if a '.git' directory exists
|
||||
# * minor-version: ax_is_release will be 'no' if the minor version number
|
||||
# in $PACKAGE_VERSION is odd; this assumes
|
||||
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
||||
# * micro-version: ax_is_release will be 'no' if the micro version number
|
||||
# in $PACKAGE_VERSION is odd; this assumes
|
||||
# $PACKAGE_VERSION follows the 'major.minor.micro' scheme
|
||||
# * always: ax_is_release will always be 'yes'
|
||||
# * never: ax_is_release will always be 'no'
|
||||
#
|
||||
# Other policies may be added in future.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
|
||||
#
|
||||
# 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.
|
||||
|
||||
#serial 4
|
||||
|
||||
AC_DEFUN([AX_IS_RELEASE],[
|
||||
AC_BEFORE([AC_INIT],[$0])
|
||||
|
||||
m4_case([$1],
|
||||
[git-directory],[
|
||||
# $is_release = (.git directory does not exist)
|
||||
AS_IF([test -d ${top_srcdir}/.git],[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[minor-version],[
|
||||
# $is_release = ($minor_version is even)
|
||||
minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
|
||||
AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
|
||||
[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[micro-version],[
|
||||
# $is_release = ($micro_version is even)
|
||||
micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
|
||||
AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
|
||||
[ax_is_release=no],[ax_is_release=yes])
|
||||
],
|
||||
[always],[ax_is_release=yes],
|
||||
[never],[ax_is_release=no],
|
||||
[
|
||||
AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version.])
|
||||
])
|
||||
])
|
Loading…
Reference in New Issue