Re: [PATCH iptables] build: use pkg-config for libpcap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-04-01, at 19:54:12 +0000, Alyssa Ross wrote:
> On Sat, Apr 01, 2023 at 01:30:18PM +0100, Jeremy Sowden wrote:
> > > > diff --git a/configure.ac b/configure.ac
> > > > index bc2ed47b..e0bb26aa 100644
> > > > --- a/configure.ac
> > > > +++ b/configure.ac
> > > > @@ -114,7 +114,8 @@ AM_CONDITIONAL([ENABLE_NFTABLES], [test "$enable_nftables" = "yes"])
> > > >  AM_CONDITIONAL([ENABLE_CONNLABEL], [test "$enable_connlabel" = "yes"])
> > > >
> > > >  if test "x$enable_bpfc" = "xyes" || test "x$enable_nfsynproxy" = "xyes"; then
> > > > -	AC_CHECK_LIB(pcap, pcap_compile,, AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool))
> > > > +	PKG_CHECK_MODULES([libpcap], [libpcap], [], [
> > > > +		AC_MSG_ERROR(missing libpcap library required by bpf compiler or nfsynproxy tool)])
> > > >  fi
> >
> > When autoconf first encounters `PKG_CHECK_MODULES`, if `$PKG_CONFIG` is
> > not already defined it will execute `PKG_PROG_PKG_CONFIG` to find it.
> > However, because you are calling `PKG_CHECK_MODULES` in a conditional,
> > if `$enable_bpfc` and `$enable_nfsynproxy` are not `yes`, the expansion
> > of `PKG_PROG_PKG_CONFIG` will not be executed and so the following
> > pkg-config checks will fail:
> >
> >   checking for libnfnetlink >= 1.0... no
> >   checking for libmnl >= 1.0... no
> >   *** Error: No suitable libmnl found. ***
> >       Please install the 'libmnl' package
> >       Or consider --disable-nftables to skip
> >       iptables-compat over nftables support.
> >
> > Something like this will fix it:
> >
> >   @@ -14,6 +14,7 @@ AC_PROG_CC
> >    AM_PROG_CC_C_O
> >    m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
> >    LT_INIT([disable-static])
> >   +PKG_PROG_PKG_CONFIG
> >
> >    AC_ARG_WITH([kernel],
> >           AS_HELP_STRING([--with-kernel=PATH],
> >
> > > >  PKG_CHECK_MODULES([libnfnetlink], [libnfnetlink >= 1.0],
> 
> Another option would be to just move the libpcap change after this
> unconditional one, avoiding the manual initialization.  Do you have a
> preference?

Not really.  Atm, I am marginally inclined to think that the explicit
initialization is more robust, but I don't remember ever having done it
myself in the past, so if you prefer to move the conditional that's fine
by me.

J.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux