mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
build: add --enable-werror option
This turns some compiler warnings into errors. Useful for c-i.
This commit is contained in:
parent
b602fe0f73
commit
205830a37b
17
configure.ac
17
configure.ac
@ -192,6 +192,13 @@ AC_ARG_ENABLE([debug],
|
|||||||
[enable_debug=$enableval],
|
[enable_debug=$enableval],
|
||||||
[enable_debug=no])
|
[enable_debug=no])
|
||||||
|
|
||||||
|
# Turn warnings into errors
|
||||||
|
AC_ARG_ENABLE([werror],
|
||||||
|
[AS_HELP_STRING([--enable-werror],
|
||||||
|
[Treat certain compiler warnings as errors (default is no)])],
|
||||||
|
[enable_werror=$enableval],
|
||||||
|
[enable_werror=no])
|
||||||
|
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""])
|
AX_CHECK_COMPILE_FLAG([-Werror],[CXXFLAG_WERROR="-Werror"],[CXXFLAG_WERROR=""])
|
||||||
|
|
||||||
@ -206,6 +213,14 @@ if test "x$enable_debug" = xyes; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ERROR_CXXFLAGS=
|
||||||
|
if test "x$enable_werror" = "xyes"; then
|
||||||
|
if test "x$CXXFLAG_WERROR" = "x"; then
|
||||||
|
AC_MSG_ERROR("enable-werror set but -Werror is not usable")
|
||||||
|
fi
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Werror=vla],[ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=vla"],,[[$CXXFLAG_WERROR]])
|
||||||
|
fi
|
||||||
|
|
||||||
if test "x$CXXFLAGS_overridden" = "xno"; then
|
if test "x$CXXFLAGS_overridden" = "xno"; then
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall],[CXXFLAGS="$CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]])
|
AX_CHECK_COMPILE_FLAG([-Wall],[CXXFLAGS="$CXXFLAGS -Wall"],,[[$CXXFLAG_WERROR]])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wextra],[CXXFLAGS="$CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]])
|
AX_CHECK_COMPILE_FLAG([-Wextra],[CXXFLAGS="$CXXFLAGS -Wextra"],,[[$CXXFLAG_WERROR]])
|
||||||
@ -1067,6 +1082,7 @@ AC_SUBST(BITCOIN_CLI_NAME)
|
|||||||
AC_SUBST(BITCOIN_TX_NAME)
|
AC_SUBST(BITCOIN_TX_NAME)
|
||||||
|
|
||||||
AC_SUBST(RELDFLAGS)
|
AC_SUBST(RELDFLAGS)
|
||||||
|
AC_SUBST(ERROR_CXXFLAGS)
|
||||||
AC_SUBST(HARDENED_CXXFLAGS)
|
AC_SUBST(HARDENED_CXXFLAGS)
|
||||||
AC_SUBST(HARDENED_CPPFLAGS)
|
AC_SUBST(HARDENED_CPPFLAGS)
|
||||||
AC_SUBST(HARDENED_LDFLAGS)
|
AC_SUBST(HARDENED_LDFLAGS)
|
||||||
@ -1156,6 +1172,7 @@ echo " with test = $use_tests"
|
|||||||
echo " with bench = $use_bench"
|
echo " with bench = $use_bench"
|
||||||
echo " with upnp = $use_upnp"
|
echo " with upnp = $use_upnp"
|
||||||
echo " debug enabled = $enable_debug"
|
echo " debug enabled = $enable_debug"
|
||||||
|
echo " werror = $enable_werror"
|
||||||
echo
|
echo
|
||||||
echo " target os = $TARGET_OS"
|
echo " target os = $TARGET_OS"
|
||||||
echo " build os = $BUILD_OS"
|
echo " build os = $BUILD_OS"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
DIST_SUBDIRS = secp256k1 univalue
|
DIST_SUBDIRS = secp256k1 univalue
|
||||||
|
|
||||||
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
|
AM_LDFLAGS = $(PTHREAD_CFLAGS) $(LIBTOOL_LDFLAGS) $(HARDENED_LDFLAGS)
|
||||||
AM_CXXFLAGS = $(HARDENED_CXXFLAGS)
|
AM_CXXFLAGS = $(HARDENED_CXXFLAGS) $(ERROR_CXXFLAGS)
|
||||||
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
|
AM_CPPFLAGS = $(HARDENED_CPPFLAGS)
|
||||||
EXTRA_LIBRARIES =
|
EXTRA_LIBRARIES =
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user