@@ -513,19 +513,22 @@ AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsug
513513AX_CHECK_COMPILE_FLAG ( [ -Wimplicit-fallthrough] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wimplicit-fallthrough"] , [ ] , [ $CXXFLAG_WERROR] )
514514AX_CHECK_COMPILE_FLAG ( [ -Wunreachable-code] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code"] , [ ] , [ $CXXFLAG_WERROR] )
515515AX_CHECK_COMPILE_FLAG ( [ -Wdocumentation] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdocumentation"] , [ ] , [ $CXXFLAG_WERROR] )
516+ AX_CHECK_COMPILE_FLAG ( [ -Wself-assign] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wself-assign"] , [ ] , [ $CXXFLAG_WERROR] )
516517
517518dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
518519dnl unknown options if any other warning is produced. Test the -Wfoo case, and
519520dnl set the -Wno-foo case if it works.
520521AX_CHECK_COMPILE_FLAG ( [ -Wunused-parameter] , [ NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-unused-parameter"] , [ ] , [ $CXXFLAG_WERROR] )
521- AX_CHECK_COMPILE_FLAG ( [ -Wself-assign] , [ NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-self-assign"] , [ ] , [ $CXXFLAG_WERROR] )
522- if test "$suppress_external_warnings" != "yes" ; then
523- AX_CHECK_COMPILE_FLAG ( [ -Wdeprecated-copy] , [ NOWARN_CXXFLAGS="$NOWARN_CXXFLAGS -Wno-deprecated-copy"] , [ ] , [ $CXXFLAG_WERROR] )
524- fi
525522
526523dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
527524AX_CHECK_COMPILE_FLAG ( [ -fno-extended-identifiers] , [ CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"] , [ ] , [ $CXXFLAG_WERROR] )
528525
526+ dnl Currently all versions of gcc are subject to a class of bugs, see the
527+ dnl gccbug_90348 test case (only reproduces on GCC 11 and earlier) and
528+ dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111843. To work around that, set
529+ dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
530+ AX_CHECK_COMPILE_FLAG ( [ -fstack-reuse=none] , [ CORE_CXXFLAGS="$CORE_CXXFLAGS -fstack-reuse=none"] )
531+
529532enable_arm_crc=no
530533enable_arm_shani=no
531534enable_sse42=no
@@ -782,17 +785,23 @@ case $host in
782785 dnl It's safe to add these paths even if the functionality is disabled by
783786 dnl the user (--without-wallet or --without-gui for example).
784787
788+ dnl Homebrew may create symlinks in /usr/local/include for some packages.
789+ dnl Because MacOS's clang internally adds "-I /usr/local/include" to its search
790+ dnl paths, this will negate efforts to use -isystem for those packages, as they
791+ dnl will be found first in /usr/local. Use the internal "-internal-isystem"
792+ dnl option to system-ify all /usr/local/include paths without adding it to the list
793+ dnl of search paths in case it's not already there.
794+ if test "$suppress_external_warnings" != "no"; then
795+ AX_CHECK_PREPROC_FLAG ( [ -Xclang -internal-isystem/usr/local/include] , [ CORE_CPPFLAGS="$CORE_CPPFLAGS -Xclang -internal-isystem/usr/local/include"] , [ ] , [ $CXXFLAG_WERROR] )
796+ fi
797+
785798 if test "$use_bdb" != "no" && $BREW list --versions berkeley-db@4 >/dev/null && test "$BDB_CFLAGS" = "" && test "$BDB_LIBS" = ""; then
786799 bdb_prefix=$($BREW --prefix berkeley-db@4 2>/dev/null)
787800 dnl This must precede the call to BITCOIN_FIND_BDB48 below.
788801 BDB_CFLAGS="-I$bdb_prefix/include"
789802 BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
790803 fi
791804
792- if test "$use_sqlite" != "no" && $BREW list --versions sqlite3 >/dev/null; then
793- export PKG_CONFIG_PATH="$($BREW --prefix sqlite3 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
794- fi
795-
796805 if $BREW list --versions qt@5 >/dev/null; then
797806 export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
798807 fi
@@ -812,20 +821,20 @@ case $host in
812821 if test "$use_upnp" != "no" && $BREW list --versions miniupnpc >/dev/null; then
813822 miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
814823 if test "$suppress_external_warnings" != "no"; then
815- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
824+ MINIUPNPC_CPPFLAGS=" -isystem $miniupnpc_prefix/include"
816825 else
817- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
826+ MINIUPNPC_CPPFLAGS=" -I$miniupnpc_prefix/include"
818827 fi
819- CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
828+ MINIUPNPC_LIBS=" -L$miniupnpc_prefix/lib"
820829 fi
821830 if test "$use_natpmp" != "no" && $BREW list --versions libnatpmp >/dev/null; then
822831 libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
823832 if test "$suppress_external_warnings" != "no"; then
824- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
833+ NATPMP_CPPFLAGS=" -isystem $libnatpmp_prefix/include"
825834 else
826- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
835+ NATPMP_CPPFLAGS=" -I$libnatpmp_prefix/include"
827836 fi
828- CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
837+ NATPMP_LIBS=" -L$libnatpmp_prefix/lib"
829838 fi
830839 ;;
831840 esac
@@ -981,11 +990,6 @@ if test "$TARGET_OS" != "windows"; then
981990 AX_CHECK_COMPILE_FLAG ( [ -fPIC] , [ PIC_FLAGS="-fPIC"] )
982991fi
983992
984- dnl Currently all versions of gcc are subject to a class of bugs, see the
985- dnl gccbug_90348 test case (only reproduces on GCC 11 and earlier) and the related bugs of
986- dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90348. To work around that, set
987- dnl -fstack-reuse=none for all gcc builds. (Only gcc understands this flag)
988- AX_CHECK_COMPILE_FLAG ( [ -fstack-reuse=none] , [ HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fstack-reuse=none"] )
989993if test "$use_hardening" != "no"; then
990994 use_hardening=yes
991995 AX_CHECK_COMPILE_FLAG ( [ -Wstack-protector] , [ HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -Wstack-protector"] )
@@ -1418,38 +1422,44 @@ AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"])
14181422
14191423dnl Check for libminiupnpc (optional)
14201424if test "$use_upnp" != "no"; then
1425+ TEMP_CPPFLAGS="$CPPFLAGS"
1426+ CPPFLAGS="$CPPFLAGS $MINIUPNPC_CPPFLAGS"
14211427 AC_CHECK_HEADERS (
14221428 [ miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h] ,
1423- [ AC_CHECK_LIB ( [ miniupnpc] , [ upnpDiscover] , [ MINIUPNPC_LIBS=-lminiupnpc] , [ have_miniupnpc=no] ) ] ,
1429+ [ AC_CHECK_LIB ( [ miniupnpc] , [ upnpDiscover] , [ MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc" ] , [ have_miniupnpc=no] , [ $MINIUPNPC_LIBS ] ) ] ,
14241430 [ have_miniupnpc=no]
14251431 )
1426- dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1427- dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1428- if test "$have_miniupnpc" != "no"; then
1429- AC_MSG_CHECKING ( [ whether miniUPnPc API version is supported] )
1430- AC_PREPROC_IFELSE ( [ AC_LANG_PROGRAM ( [ [
1431- @%:@ include <miniupnpc/miniupnpc.h>
1432- ] ] , [ [
1433- #if MINIUPNPC_API_VERSION >= 10
1434- // Everything is okay
1435- #else
1436- # error miniUPnPc API version is too old
1437- #endif
1438- ] ] ) ] ,[
1439- AC_MSG_RESULT ( [ yes] )
1440- ] ,[
1441- AC_MSG_RESULT ( [ no] )
1442- AC_MSG_WARN ( [ miniUPnPc API version < 10 is unsupported, disabling UPnP support.] )
1443- have_miniupnpc=no
1444- ] )
1445- fi
1432+ dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1433+ dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1434+ if test "$have_miniupnpc" != "no"; then
1435+ AC_MSG_CHECKING ( [ whether miniUPnPc API version is supported] )
1436+ AC_PREPROC_IFELSE ( [ AC_LANG_PROGRAM ( [ [
1437+ @%:@ include <miniupnpc/miniupnpc.h>
1438+ ] ] , [ [
1439+ #if MINIUPNPC_API_VERSION >= 10
1440+ // Everything is okay
1441+ #else
1442+ # error miniUPnPc API version is too old
1443+ #endif
1444+ ] ] ) ] ,[
1445+ AC_MSG_RESULT ( [ yes] )
1446+ ] ,[
1447+ AC_MSG_RESULT ( [ no] )
1448+ AC_MSG_WARN ( [ miniUPnPc API version < 10 is unsupported, disabling UPnP support.] )
1449+ have_miniupnpc=no
1450+ ] )
1451+ fi
1452+ CPPFLAGS="$TEMP_CPPFLAGS"
14461453fi
14471454
14481455dnl Check for libnatpmp (optional).
14491456if test "$use_natpmp" != "no"; then
1457+ TEMP_CPPFLAGS="$CPPFLAGS"
1458+ CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS"
14501459 AC_CHECK_HEADERS ( [ natpmp.h] ,
1451- [ AC_CHECK_LIB ( [ natpmp] , [ initnatpmp] , [ NATPMP_LIBS=-lnatpmp] , [ have_natpmp=no] ) ] ,
1460+ [ AC_CHECK_LIB ( [ natpmp] , [ initnatpmp] , [ NATPMP_LIBS="$NATPMP_LIBS -lnatpmp" ] , [ have_natpmp=no] , [ $NATPMP_LIBS ] ) ] ,
14521461 [ have_natpmp=no] )
1462+ CPPFLAGS="$TEMP_CPPFLAGS"
14531463fi
14541464
14551465if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" = "nonononononono"; then
15081518
15091519dnl libevent check
15101520
1521+ use_libevent=no
15111522if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" != "nonononono"; then
15121523 PKG_CHECK_MODULES([ EVENT] , [ libevent >= 2.0.21] , [ use_libevent=yes] , [ AC_MSG_ERROR ( [ libevent version 2.0.21 or greater not found.] ) ] )
15131524 if test "$TARGET_OS" != "windows"; then
@@ -1681,7 +1692,7 @@ else
16811692 use_upnp=yes
16821693 AC_DEFINE ( [ USE_UPNP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
16831694 if test "$TARGET_OS" = "windows"; then
1684- MINIUPNPC_CPPFLAGS="-DSTATICLIB -DMINIUPNP_STATICLIB"
1695+ MINIUPNPC_CPPFLAGS="$MINIUPNPC_CPPFLAGS -DMINIUPNP_STATICLIB"
16851696 fi
16861697 else
16871698 AC_MSG_RESULT ( [ no] )
@@ -1702,7 +1713,7 @@ else
17021713 use_natpmp=yes
17031714 AC_DEFINE ( [ USE_NATPMP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
17041715 if test "$TARGET_OS" = "windows"; then
1705- NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
1716+ NATPMP_CPPFLAGS="$NATPMP_CPPFLAGS -DSTATICLIB -DNATPMP_STATICLIB"
17061717 fi
17071718 else
17081719 AC_MSG_RESULT ( [ no] )
0 commit comments