On Wed, 3 Apr 2024 at 16:05, Bart Van Assche <bvanass...@acm.org> wrote:

> Something else must be going on. This is the code from configure.ac that
> checks for libnl-3:
>
>         if test "x$ac_cv_header_netlink_netlink_h" = xyes; then
>             AC_EGREP_HEADER([nl_socket_free], [netlink/socket.h],
>                             [AC_DEFINE([HAVE_LIBNL3], [1],
>                             [Define to 1 if <netlink/netlink.h> provides
> the
>                             libnl3 API])])
>         fi
>
It's a little bit more complicated than that.
The issue is when HAVE_LIBNL3 is not defined but HAVE_NETLINK_NETLINK_H is
defined.
/* Define to 1 if you have the <netlink/netlink.h> header file. */
#define HAVE_NETLINK_NETLINK_H 1
/* Define to 1 if <netlink/netlink.h> provides the libnl3 API */
/* #undef HAVE_LIBNL3 */

Then the compat stuff around line 622 of tcpTable.c comes into play, but
its not nl1, its nl3 we have here.
So what's going on with the detection? Something strange in automake and
some magic variables.

The reason why HAVE_LIBNL3 is blank is the test for AC_EGREP_HEADER fails:
configure:28188: result: no
conftest.c:186:10: fatal error: netlink/socket.h: No such file or directory
  186 | #include <netlink/socket.h>
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.

It can't find the include file because the CFLAGS needs to set the include
path and it doesn't if the libnl-route-3 test fails
 (I guess it zeroes it on failure or maybe because LIBNLROUTE3_CFLAGS is
blank?)
Moving the EGREP test for nl_socket_free immediately before the test for
libnl-route-3 works,
because it uses the CFLAGS of the previous successful test. Compiling works
too, until you try to link it to the missing library
for some of the data_access/*_linux.c files.

The fix isn't to move the EGREP(nl_socket_free) test, that's a symptom.
I'm not sure if the older library needs the route library or not, so the
next steps are hard to say.
If it was just the new library then a fatal error on Linux for the absence
of either libnl3 or libnl-route-3 would do it.
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to