Skip to content

configure: --with-only-libndpi triggers pcap check on MinGW instead of skipping it #3114

@drnpkr

Description

@drnpkr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions