Currently the setup.py strategy is to look for pcap.h in a fixed set of locations. Please support either LDFLAGS / CFLAGS (or CPPFLAGS) to specify additional locations, and / or use pkg-config to locate the prefix.
For example, running pkg-config --libs-only-L --cflags libpcap on conforming systems gives you the correct -I and -L flags (to then be parsed further) or use pkg-config --variable=includedir libpcap and pkg-config --variable=libdir libpcap to get the include and library paths as two separate strings on stdout.
For LDFLAGS and CFLAGS no further parsing would be required, as setuptools.Extension() supports those natively, provided you don't override those. Perhaps only do the current manual search if a pkg-config search fails and no LDFLAGS / CFLAGS / CPPFLAGS environment variables are set?
This then allows for isolated builds that use a specific, bundled version of libpcap.
Currently the
setup.py
strategy is to look forpcap.h
in a fixed set of locations. Please support eitherLDFLAGS
/CFLAGS
(orCPPFLAGS
) to specify additional locations, and / or usepkg-config
to locate the prefix.For example, running
pkg-config --libs-only-L --cflags libpcap
on conforming systems gives you the correct-I
and-L
flags (to then be parsed further) or usepkg-config --variable=includedir libpcap
andpkg-config --variable=libdir libpcap
to get the include and library paths as two separate strings on stdout.For
LDFLAGS
andCFLAGS
no further parsing would be required, assetuptools.Extension()
supports those natively, provided you don't override those. Perhaps only do the current manual search if apkg-config
search fails and noLDFLAGS
/CFLAGS
/CPPFLAGS
environment variables are set?This then allows for isolated builds that use a specific, bundled version of
libpcap
.