@@ -513,19 +513,22 @@ AX_CHECK_COMPILE_FLAG([-Wsuggest-override], [WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsug
513
513
AX_CHECK_COMPILE_FLAG ( [ -Wimplicit-fallthrough] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wimplicit-fallthrough"] , [ ] , [ $CXXFLAG_WERROR] )
514
514
AX_CHECK_COMPILE_FLAG ( [ -Wunreachable-code] , [ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunreachable-code"] , [ ] , [ $CXXFLAG_WERROR] )
515
515
AX_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] )
516
517
517
518
dnl Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
518
519
dnl unknown options if any other warning is produced. Test the -Wfoo case, and
519
520
dnl set the -Wno-foo case if it works.
520
521
AX_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
525
522
526
523
dnl Don't allow extended (non-ASCII) symbols in identifiers. This is easier for code review.
527
524
AX_CHECK_COMPILE_FLAG ( [ -fno-extended-identifiers] , [ CORE_CXXFLAGS="$CORE_CXXFLAGS -fno-extended-identifiers"] , [ ] , [ $CXXFLAG_WERROR] )
528
525
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
+
529
532
enable_arm_crc=no
530
533
enable_arm_shani=no
531
534
enable_sse42=no
@@ -782,17 +785,23 @@ case $host in
782
785
dnl It's safe to add these paths even if the functionality is disabled by
783
786
dnl the user (--without-wallet or --without-gui for example).
784
787
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
+
785
798
if test "$use_bdb" != "no" && $BREW list --versions berkeley-db@4 >/dev/null && test "$BDB_CFLAGS" = "" && test "$BDB_LIBS" = ""; then
786
799
bdb_prefix=$($BREW --prefix berkeley-db@4 2>/dev/null)
787
800
dnl This must precede the call to BITCOIN_FIND_BDB48 below.
788
801
BDB_CFLAGS="-I$bdb_prefix/include"
789
802
BDB_LIBS="-L$bdb_prefix/lib -ldb_cxx-4.8"
790
803
fi
791
804
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
-
796
805
if $BREW list --versions qt@5 >/dev/null; then
797
806
export PKG_CONFIG_PATH="$($BREW --prefix qt@5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
798
807
fi
@@ -812,20 +821,20 @@ case $host in
812
821
if test "$use_upnp" != "no" && $BREW list --versions miniupnpc >/dev/null; then
813
822
miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
814
823
if test "$suppress_external_warnings" != "no"; then
815
- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
824
+ MINIUPNPC_CPPFLAGS=" -isystem $miniupnpc_prefix/include"
816
825
else
817
- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
826
+ MINIUPNPC_CPPFLAGS=" -I$miniupnpc_prefix/include"
818
827
fi
819
- CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
828
+ MINIUPNPC_LIBS=" -L$miniupnpc_prefix/lib"
820
829
fi
821
830
if test "$use_natpmp" != "no" && $BREW list --versions libnatpmp >/dev/null; then
822
831
libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
823
832
if test "$suppress_external_warnings" != "no"; then
824
- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
833
+ NATPMP_CPPFLAGS=" -isystem $libnatpmp_prefix/include"
825
834
else
826
- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
835
+ NATPMP_CPPFLAGS=" -I$libnatpmp_prefix/include"
827
836
fi
828
- CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
837
+ NATPMP_LIBS=" -L$libnatpmp_prefix/lib"
829
838
fi
830
839
;;
831
840
esac
@@ -981,11 +990,6 @@ if test "$TARGET_OS" != "windows"; then
981
990
AX_CHECK_COMPILE_FLAG ( [ -fPIC] , [ PIC_FLAGS="-fPIC"] )
982
991
fi
983
992
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"] )
989
993
if test "$use_hardening" != "no"; then
990
994
use_hardening=yes
991
995
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"])
1418
1422
1419
1423
dnl Check for libminiupnpc (optional)
1420
1424
if test "$use_upnp" != "no"; then
1425
+ TEMP_CPPFLAGS="$CPPFLAGS"
1426
+ CPPFLAGS="$CPPFLAGS $MINIUPNPC_CPPFLAGS"
1421
1427
AC_CHECK_HEADERS (
1422
1428
[ 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 ] ) ] ,
1424
1430
[ have_miniupnpc=no]
1425
1431
)
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"
1446
1453
fi
1447
1454
1448
1455
dnl Check for libnatpmp (optional).
1449
1456
if test "$use_natpmp" != "no"; then
1457
+ TEMP_CPPFLAGS="$CPPFLAGS"
1458
+ CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS"
1450
1459
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 ] ) ] ,
1452
1461
[ have_natpmp=no] )
1462
+ CPPFLAGS="$TEMP_CPPFLAGS"
1453
1463
fi
1454
1464
1455
1465
if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" = "nonononononono"; then
1508
1518
1509
1519
dnl libevent check
1510
1520
1521
+ use_libevent=no
1511
1522
if test "$build_bitcoin_cli$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" != "nonononono"; then
1512
1523
PKG_CHECK_MODULES([ EVENT] , [ libevent >= 2.0.21] , [ use_libevent=yes] , [ AC_MSG_ERROR ( [ libevent version 2.0.21 or greater not found.] ) ] )
1513
1524
if test "$TARGET_OS" != "windows"; then
@@ -1681,7 +1692,7 @@ else
1681
1692
use_upnp=yes
1682
1693
AC_DEFINE ( [ USE_UPNP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
1683
1694
if test "$TARGET_OS" = "windows"; then
1684
- MINIUPNPC_CPPFLAGS="-DSTATICLIB -DMINIUPNP_STATICLIB"
1695
+ MINIUPNPC_CPPFLAGS="$MINIUPNPC_CPPFLAGS -DMINIUPNP_STATICLIB"
1685
1696
fi
1686
1697
else
1687
1698
AC_MSG_RESULT ( [ no] )
@@ -1702,7 +1713,7 @@ else
1702
1713
use_natpmp=yes
1703
1714
AC_DEFINE ( [ USE_NATPMP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
1704
1715
if test "$TARGET_OS" = "windows"; then
1705
- NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
1716
+ NATPMP_CPPFLAGS="$NATPMP_CPPFLAGS -DSTATICLIB -DNATPMP_STATICLIB"
1706
1717
fi
1707
1718
else
1708
1719
AC_MSG_RESULT ( [ no] )
0 commit comments