build: remove potential for duplciate natpmp linking

Consolidate the lib checking logic to be the same as miniupnpc.
This commit is contained in:
fanquake 2023-10-31 10:49:40 +00:00
parent 4e95096952
commit b74e449ffa
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -1455,9 +1455,12 @@ dnl Check for libnatpmp (optional).
if test "$use_natpmp" != "no"; then
TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $NATPMP_CPPFLAGS"
AC_CHECK_HEADERS([natpmp.h],
[AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS="$NATPMP_LIBS -lnatpmp"], [have_natpmp=no], [$NATPMP_LIBS])],
[have_natpmp=no])
AC_CHECK_HEADERS([natpmp.h], [], [have_natpmp=no])
if test "$have_natpmp" != "no"; then
AC_CHECK_LIB([natpmp], [initnatpmp], [NATPMP_LIBS="$NATPMP_LIBS -lnatpmp"], [have_natpmp=no], [$NATPMP_LIBS])
fi
CPPFLAGS="$TEMP_CPPFLAGS"
fi