aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-09-06 17:55:14 +0200
committerW. J. van der Laan <laanwj@protonmail.com>2021-09-06 17:55:34 +0200
commit6718fbe90a0d9384c4d954b65f1fd4e69838d10c (patch)
tree4c74b7426898003dce94967e01625e1e201e66c6 /configure.ac
parent92aad5303b9b96c46015156b5dc96b48e9e7bc76 (diff)
parent2445df4eb36ba0d90e1283f36e629e1cf69eeef7 (diff)
downloadbitcoin-6718fbe90a0d9384c4d954b65f1fd4e69838d10c.tar.xz
Merge bitcoin/bitcoin#22397: build: Fix macOS Apple Silicon build with miniupnpc and libnatpmp
2445df4eb36ba0d90e1283f36e629e1cf69eeef7 build: Fix macOS Apple Silicon build with miniupnpc and libnatpmp (Hennadii Stepanov) Pull request description: On master (7a49fdc58115845ece3a9890bf9498bee6b559de) the `configure` script does not pick up Homebrew's `miniupnpc` and `libnatpmp` packages on macOS Apple Silicon: ``` % ./configure --with-miniupnpc ... checking for miniupnpc/miniupnpc.h... no checking for miniupnpc/upnpcommands.h... no checking for miniupnpc/upnperrors.h... no ... checking whether to build with support for UPnP... configure: error: "UPnP requested but cannot be built. Use --without-miniupnpc." ``` ``` % ./configure --with-natpmp ... checking for natpmp.h... no ... checking whether to build with support for NAT-PMP... configure: error: NAT-PMP requested but cannot be built. Use --without-natpmp ``` The preferred Homebrew [prefix for Apple Silicon](https://docs.brew.sh/Installation) is `/opt/homebrew`. Therefore, if we do not use `pkg-config` to detect packages, we should set the `CPPFLAGS` and `LDFLAGS` variables for them explicitly. ACKs for top commit: Zero-1729: re-tACK 2445df4eb36ba0d90e1283f36e629e1cf69eeef7 (re-tested on an M1 Machine running macOS 11.4). jarolrod: re-ACK 2445df4eb36ba0d90e1283f36e629e1cf69eeef7 Tree-SHA512: d623d26492f463812bf66ca519847ff4b23d517466b6c51c3caf3642a582d02e5f03ce57915742b29f01bf9bceb731a3978ef9a5fdc82e568bcb62548eda758a
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac27
1 files changed, 27 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index f03025d3c1..e50d53f6dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -705,6 +705,33 @@ case $host in
if $BREW list --versions qt5 >/dev/null; then
export PKG_CONFIG_PATH="$($BREW --prefix qt5 2>/dev/null)/lib/pkgconfig:$PKG_CONFIG_PATH"
fi
+
+ case $host in
+ *aarch64*)
+ dnl The preferred Homebrew prefix for Apple Silicon is /opt/homebrew.
+ dnl Therefore, as we do not use pkg-config to detect miniupnpc and libnatpmp
+ dnl packages, we should set the CPPFLAGS and LDFLAGS variables for them
+ dnl explicitly.
+ if test "x$use_upnp" != xno && $BREW list --versions miniupnpc >/dev/null; then
+ miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
+ if test "x$suppress_external_warnings" != xno; then
+ CPPFLAGS="$CPPFLAGS -isystem $miniupnpc_prefix/include"
+ else
+ CPPFLAGS="$CPPFLAGS -I$miniupnpc_prefix/include"
+ fi
+ LDFLAGS="$LDFLAGS -L$miniupnpc_prefix/lib"
+ fi
+ if test "x$use_natpmp" != xno && $BREW list --versions libnatpmp >/dev/null; then
+ libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
+ if test "x$suppress_external_warnings" != xno; then
+ CPPFLAGS="$CPPFLAGS -isystem $libnatpmp_prefix/include"
+ else
+ CPPFLAGS="$CPPFLAGS -I$libnatpmp_prefix/include"
+ fi
+ LDFLAGS="$LDFLAGS -L$libnatpmp_prefix/lib"
+ fi
+ ;;
+ esac
fi
else
case $build_os in