@@ -812,20 +812,20 @@ case $host in
812812 if test "$use_upnp" != "no" && $BREW list --versions miniupnpc >/dev/null; then
813813 miniupnpc_prefix=$($BREW --prefix miniupnpc 2>/dev/null)
814814 if test "$suppress_external_warnings" != "no"; then
815- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $miniupnpc_prefix/include"
815+ MINIUPNPC_CPPFLAGS=" -isystem $miniupnpc_prefix/include"
816816 else
817- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$miniupnpc_prefix/include"
817+ MINIUPNPC_CPPFLAGS=" -I$miniupnpc_prefix/include"
818818 fi
819- CORE_LDFLAGS="$CORE_LDFLAGS -L$miniupnpc_prefix/lib"
819+ MINIUPNPC_LIBS=" -L$miniupnpc_prefix/lib"
820820 fi
821821 if test "$use_natpmp" != "no" && $BREW list --versions libnatpmp >/dev/null; then
822822 libnatpmp_prefix=$($BREW --prefix libnatpmp 2>/dev/null)
823823 if test "$suppress_external_warnings" != "no"; then
824- CORE_CPPFLAGS="$CORE_CPPFLAGS -isystem $libnatpmp_prefix/include"
824+ NATPMP_CPPFLAGS=" -isystem $libnatpmp_prefix/include"
825825 else
826- CORE_CPPFLAGS="$CORE_CPPFLAGS -I$libnatpmp_prefix/include"
826+ NATPMP_CPPFLAGS=" -I$libnatpmp_prefix/include"
827827 fi
828- CORE_LDFLAGS="$CORE_LDFLAGS -L$libnatpmp_prefix/lib"
828+ NATPMP_LIBS=" -L$libnatpmp_prefix/lib"
829829 fi
830830 ;;
831831 esac
@@ -1418,38 +1418,44 @@ AM_CONDITIONAL([ENABLE_USDT_TRACEPOINTS], [test "$use_usdt" = "yes"])
14181418
14191419dnl Check for libminiupnpc (optional)
14201420if test "$use_upnp" != "no"; then
1421+ TEMP_CPPFLAGS="$CPPFLAGS"
1422+ CPPFLAGS="$CPPFLAGS $MINIUPNPC_CPPFLAGS"
14211423 AC_CHECK_HEADERS (
14221424 [ miniupnpc/miniupnpc.h miniupnpc/upnpcommands.h miniupnpc/upnperrors.h] ,
1423- [ AC_CHECK_LIB ( [ miniupnpc] , [ upnpDiscover] , [ MINIUPNPC_LIBS=-lminiupnpc] , [ have_miniupnpc=no] ) ] ,
1425+ [ AC_CHECK_LIB ( [ miniupnpc] , [ upnpDiscover] , [ MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc" ] , [ have_miniupnpc=no] , [ $MINIUPNPC_LIBS ] ) ] ,
14241426 [ have_miniupnpc=no]
14251427 )
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
1428+ dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1429+ dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1430+ if test "$have_miniupnpc" != "no"; then
1431+ AC_MSG_CHECKING ( [ whether miniUPnPc API version is supported] )
1432+ AC_PREPROC_IFELSE ( [ AC_LANG_PROGRAM ( [ [
1433+ @%:@ include <miniupnpc/miniupnpc.h>
1434+ ] ] , [ [
1435+ #if MINIUPNPC_API_VERSION >= 10
1436+ // Everything is okay
1437+ #else
1438+ # error miniUPnPc API version is too old
1439+ #endif
1440+ ] ] ) ] ,[
1441+ AC_MSG_RESULT ( [ yes] )
1442+ ] ,[
1443+ AC_MSG_RESULT ( [ no] )
1444+ AC_MSG_WARN ( [ miniUPnPc API version < 10 is unsupported, disabling UPnP support.] )
1445+ have_miniupnpc=no
1446+ ] )
1447+ fi
1448+ CPPFLAGS="$TEMP_CPPFLAGS"
14461449fi
14471450
14481451dnl Check for libnatpmp (optional).
14491452if test "$use_natpmp" != "no"; then
1453+ TEMP_CPPFLAGS="$CPPFLAGS"
1454+ CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS"
14501455 AC_CHECK_HEADERS ( [ natpmp.h] ,
1451- [ AC_CHECK_LIB ( [ natpmp] , [ initnatpmp] , [ NATPMP_LIBS=-lnatpmp] , [ have_natpmp=no] ) ] ,
1456+ [ AC_CHECK_LIB ( [ natpmp] , [ initnatpmp] , [ NATPMP_LIBS="$NATPMP_LIBS -lnatpmp" ] , [ have_natpmp=no] , [ $NATPMP_LIBS ] ) ] ,
14521457 [ have_natpmp=no] )
1458+ CPPFLAGS="$TEMP_CPPFLAGS"
14531459fi
14541460
14551461if test "$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench" = "nonononononono"; then
@@ -1681,7 +1687,7 @@ else
16811687 use_upnp=yes
16821688 AC_DEFINE ( [ USE_UPNP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
16831689 if test "$TARGET_OS" = "windows"; then
1684- MINIUPNPC_CPPFLAGS="-DSTATICLIB -DMINIUPNP_STATICLIB"
1690+ MINIUPNPC_CPPFLAGS="$MINIUPNPC_CPPFLAGS -DSTATICLIB -DMINIUPNP_STATICLIB"
16851691 fi
16861692 else
16871693 AC_MSG_RESULT ( [ no] )
@@ -1702,7 +1708,7 @@ else
17021708 use_natpmp=yes
17031709 AC_DEFINE ( [ USE_NATPMP] , [ 1] , [ Define to 1 if UPnP support should be compiled in.] )
17041710 if test "$TARGET_OS" = "windows"; then
1705- NATPMP_CPPFLAGS="-DSTATICLIB -DNATPMP_STATICLIB"
1711+ NATPMP_CPPFLAGS="$NATPMP_CPPFLAGS -DSTATICLIB -DNATPMP_STATICLIB"
17061712 fi
17071713 else
17081714 AC_MSG_RESULT ( [ no] )
0 commit comments