Bug
On MinGW/MSYS2, passing --with-only-libndpi to configure triggers a PKG_CHECK_MODULES check for libpcap, causing configure to fail if libpcap-dev is not installed. This is the opposite of the intended behavior — building only the library should not require pcap.
Root cause
In configure.ac line 344, the AS_IF condition for the MinGW pcap check is inverted:
AS_IF([test "${enable_npcap+set}" != set && test "${with_only_libndpi+set}" != set],,
[PKG_CHECK_MODULES([PCAP], [libpcap], [PCAP_LIB="" PCAP_INC="${pkg_cv_PCAP_CFLAGS}"])
AC_CHECK_LIB([pcap], [pcap_open_live],, [AC_MSG_ERROR([Missing msys2/mingw libpcap library. ...])])])
The empty then-body (,,) means:
- When neither flag is set (default): pcap check skipped (correct)
- When
--with-only-libndpi is set: pcap check runs (incorrect)
Compare with the non-MinGW path (line 365) which correctly skips pcap when --with-only-libndpi is set:
elif test "${with_only_libndpi+set}" != set; then :
AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"])
Error output
checking for libpcap... no
configure: error: Package requirements (libpcap) were not met:
Package 'libpcap' not found
Steps to reproduce
On MSYS2/MinGW64:
./autogen.sh
./configure --with-only-libndpi
Suggested fix
The MinGW pcap check should only run when npcap is explicitly enabled and --with-only-libndpi is not set.
Bug
On MinGW/MSYS2, passing
--with-only-libndpito configure triggers aPKG_CHECK_MODULEScheck forlibpcap, causing configure to fail if libpcap-dev is not installed. This is the opposite of the intended behavior — building only the library should not require pcap.Root cause
In
configure.acline 344, theAS_IFcondition for the MinGW pcap check is inverted:The empty then-body (
,,) means:--with-only-libndpiis set: pcap check runs (incorrect)Compare with the non-MinGW path (line 365) which correctly skips pcap when
--with-only-libndpiis set:elif test "${with_only_libndpi+set}" != set; then : AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"])Error output
Steps to reproduce
On MSYS2/MinGW64:
Suggested fix
The MinGW pcap check should only run when npcap is explicitly enabled and
--with-only-libndpiis not set.