@@ -322,8 +322,30 @@ AC_ARG_ENABLE([werror],
322322 [ enable_werror=no] )
323323
324324AC_LANG_PUSH ( [ C++] )
325+
326+ dnl Check for a flag to turn compiler warnings into errors. This is helpful for checks which may
327+ dnl appear to succeed because by default they merely emit warnings when they fail.
328+ dnl
329+ dnl Note that this is not necessarily a check to see if -Werror is supported, but rather to see if
330+ dnl a compile with -Werror can succeed. This is important because the compiler may already be
331+ dnl warning about something unrelated, for example about some path issue. If that is the case,
332+ dnl -Werror cannot be used because all of those warnings would be turned into errors.
325333AX_CHECK_COMPILE_FLAG ( [ -Werror] ,[ CXXFLAG_WERROR="-Werror"] ,[ CXXFLAG_WERROR=""] )
326334
335+ dnl Check for a flag to turn linker warnings into errors. When flags are passed to linkers via the
336+ dnl compiler driver using a -Wl,-foo flag, linker warnings may be swallowed rather than bubbling up.
337+ dnl See note above, the same applies here as well.
338+ dnl
339+ dnl LDFLAG_WERROR Should only be used when testing -Wl,*
340+ case $host in
341+ *darwin*)
342+ AX_CHECK_LINK_FLAG ( [ -Wl,-fatal_warnings] ,[ LDFLAG_WERROR="-Wl,-fatal_warnings"] ,[ LDFLAG_WERROR=""] )
343+ ;;
344+ *)
345+ AX_CHECK_LINK_FLAG ( [ -Wl,--fatal-warnings] ,[ LDFLAG_WERROR="-Wl,--fatal-warnings"] ,[ LDFLAG_WERROR=""] )
346+ ;;
347+ esac
348+
327349if test "x$enable_debug" = xyes; then
328350 dnl Clear default -g -O2 flags
329351 if test "x$CXXFLAGS_overridden" = xno; then
@@ -762,7 +784,7 @@ case $host in
762784 esac
763785 fi
764786
765- AX_CHECK_LINK_FLAG ( [ [ -Wl,-headerpad_max_install_names] ] , [ LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"] )
787+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-headerpad_max_install_names] ] , [ LDFLAGS="$LDFLAGS -Wl,-headerpad_max_install_names"] ,, [ [ $LDFLAG_WERROR ] ] )
766788 CPPFLAGS="$CPPFLAGS -DMAC_OSX -DOBJC_OLD_DISPATCH_PROTOTYPES=0"
767789 OBJCXXFLAGS="$CXXFLAGS"
768790 ;;
@@ -917,12 +939,12 @@ if test x$use_hardening != xno; then
917939 fi
918940
919941 AX_CHECK_LINK_FLAG ( [ [ -Wl,--enable-reloc-section] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--enable-reloc-section"] ,, [ [ $LDFLAG_WERROR] ] )
920- AX_CHECK_LINK_FLAG ( [ [ -Wl,--dynamicbase] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"] )
921- AX_CHECK_LINK_FLAG ( [ [ -Wl,--nxcompat] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"] )
922- AX_CHECK_LINK_FLAG ( [ [ -Wl,--high-entropy-va] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"] )
923- AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,relro] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"] )
924- AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,now] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"] )
925- AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,separate-code] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"] )
942+ AX_CHECK_LINK_FLAG ( [ [ -Wl,--dynamicbase] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--dynamicbase"] ,, [ [ $LDFLAG_WERROR ] ] )
943+ AX_CHECK_LINK_FLAG ( [ [ -Wl,--nxcompat] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--nxcompat"] ,, [ [ $LDFLAG_WERROR ] ] )
944+ AX_CHECK_LINK_FLAG ( [ [ -Wl,--high-entropy-va] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,--high-entropy-va"] ,, [ [ $LDFLAG_WERROR ] ] )
945+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,relro] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"] ,, [ [ $LDFLAG_WERROR ] ] )
946+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,now] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"] ,, [ [ $LDFLAG_WERROR ] ] )
947+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-z,separate-code] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"] ,, [ [ $LDFLAG_WERROR ] ] )
926948 AX_CHECK_LINK_FLAG ( [ [ -fPIE -pie] ] , [ PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"] ,, [ [ $CXXFLAG_WERROR] ] )
927949
928950 case $host in
@@ -936,14 +958,14 @@ dnl These flags are specific to ld64, and may cause issues with other linkers.
936958dnl For example: GNU ld will interpret -dead_strip as -de and then try and use
937959dnl "ad_strip" as the symbol for the entry point.
938960if test x$TARGET_OS = xdarwin; then
939- AX_CHECK_LINK_FLAG ( [ [ -Wl,-dead_strip] ] , [ LDFLAGS="$LDFLAGS -Wl,-dead_strip"] )
940- AX_CHECK_LINK_FLAG ( [ [ -Wl,-dead_strip_dylibs] ] , [ LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"] )
941- AX_CHECK_LINK_FLAG ( [ [ -Wl,-bind_at_load] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"] )
961+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-dead_strip] ] , [ LDFLAGS="$LDFLAGS -Wl,-dead_strip"] ,, [ [ $LDFLAG_WERROR ] ] )
962+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-dead_strip_dylibs] ] , [ LDFLAGS="$LDFLAGS -Wl,-dead_strip_dylibs"] ,, [ [ $LDFLAG_WERROR ] ] )
963+ AX_CHECK_LINK_FLAG ( [ [ -Wl,-bind_at_load] ] , [ HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-bind_at_load"] ,, [ [ $LDFLAG_WERROR ] ] )
942964fi
943965
944966if test x$enable_determinism = xyes; then
945967 if test x$TARGET_OS = xwindows; then
946- AX_CHECK_LINK_FLAG ( [ [ -Wl,--no-insert-timestamp] ] , [ LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"] )
968+ AX_CHECK_LINK_FLAG ( [ [ -Wl,--no-insert-timestamp] ] , [ LDFLAGS="$LDFLAGS -Wl,--no-insert-timestamp"] ,, [ [ $LDFLAG_WERROR ] ] )
947969 fi
948970fi
949971
@@ -1289,7 +1311,7 @@ else
12891311 BITCOIN_QT_INIT
12901312
12911313 dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
1292- BITCOIN_QT_CONFIGURE([ 5.5.1 ] )
1314+ BITCOIN_QT_CONFIGURE([ 5.11.3 ] )
12931315
12941316 dnl Keep a copy of the original $QT_INCLUDES and use it when invoking qt's moc
12951317 QT_INCLUDES_UNSUPPRESSED=$QT_INCLUDES
14051427
14061428if test x$use_reduce_exports = xyes; then
14071429 CXXFLAGS="$CXXFLAGS $RE_CXXFLAGS"
1408- AX_CHECK_LINK_FLAG ( [ [ -Wl,--exclude-libs,ALL] ] , [ RELDFLAGS="-Wl,--exclude-libs,ALL"] )
1430+ AX_CHECK_LINK_FLAG ( [ [ -Wl,--exclude-libs,ALL] ] , [ RELDFLAGS="-Wl,--exclude-libs,ALL"] ,, [ [ $LDFLAG_WERROR ] ] )
14091431fi
14101432
14111433if test x$use_tests = xyes; then
0 commit comments