@@ -185,6 +185,9 @@ AC_ARG_ENABLE([debug],
185
185
[ enable_debug=$enableval] ,
186
186
[ enable_debug=no] )
187
187
188
+ AC_LANG_PUSH ( [ C++] )
189
+ AX_CHECK_COMPILE_FLAG ( [ -Werror] ,[ CXXFLAG_WERROR="-Werror"] ,[ CXXFLAG_WERROR=""] )
190
+
188
191
if test "x$enable_debug" = xyes; then
189
192
CPPFLAGS="$CPPFLAGS -DDEBUG -DDEBUG_LOCKORDER"
190
193
if test "x$GCC" = xyes; then
@@ -196,11 +199,19 @@ if test "x$enable_debug" = xyes; then
196
199
fi
197
200
fi
198
201
199
- # # TODO: Remove these hard-coded paths and flags. They are here for the sake of
200
- # # compatibility with the legacy buildsystem.
201
- # #
202
202
if test "x$CXXFLAGS_overridden" = "xno"; then
203
- CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wno-self-assign"
203
+ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,[ CXXFLAGS="$CXXFLAGS -Wall"] ,,[ [ $CXXFLAG_WERROR] ] )
204
+ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,[ CXXFLAGS="$CXXFLAGS -Wextra"] ,,[ [ $CXXFLAG_WERROR] ] )
205
+ AX_CHECK_COMPILE_FLAG ( [ -Wformat] ,[ CXXFLAGS="$CXXFLAGS -Wformat"] ,,[ [ $CXXFLAG_WERROR] ] )
206
+ AX_CHECK_COMPILE_FLAG ( [ -Wformat-security] ,[ CXXFLAGS="$CXXFLAGS -Wformat-security"] ,,[ [ $CXXFLAG_WERROR] ] )
207
+
208
+ # # Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
209
+ # # unknown options if any other warning is produced. Test the -Wfoo case, and
210
+ # # set the -Wno-foo case if it works.
211
+ AX_CHECK_COMPILE_FLAG ( [ -Wunused-parameter] ,[ CXXFLAGS="$CXXFLAGS -Wno-unused-parameter"] ,,[ [ $CXXFLAG_WERROR] ] )
212
+ AX_CHECK_COMPILE_FLAG ( [ -Wself-assign] ,[ CXXFLAGS="$CXXFLAGS -Wno-self-assign"] ,,[ [ $CXXFLAG_WERROR] ] )
213
+ AX_CHECK_COMPILE_FLAG ( [ -Wunused-local-typedef] ,[ CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedef"] ,,[ [ $CXXFLAG_WERROR] ] )
214
+ AX_CHECK_COMPILE_FLAG ( [ -Wdeprecated-register] ,[ CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"] ,,[ [ $CXXFLAG_WERROR] ] )
204
215
fi
205
216
CPPFLAGS="$CPPFLAGS -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS"
206
217
@@ -222,8 +233,6 @@ AC_ARG_WITH([daemon],
222
233
[ build_bitcoind=$withval] ,
223
234
[ build_bitcoind=yes] )
224
235
225
- AC_LANG_PUSH ( [ C++] )
226
-
227
236
use_pkgconfig=yes
228
237
case $host in
229
238
*mingw*)
0 commit comments