On 02/02/15 18:57, David Hauck wrote: > Hi Bart, > > On Sunday, February 01, 2015 9:05 AM, Bart Van Assche wrote: >> On 01/27/15 17:26, David Hauck wrote: >>> After going over this again (remember please that I'm not an 'autoconf' >> expert ;)) I'm not 100% certain that there are indeed issues here. >> Perhaps the original committer can comment (this was added in commit >> [3dde41]). >> Once I get confirmation that something indeed is suspect here I'll >> open a new ticket. >>> >>> The two key elements I kept wondering about were: >>> 1. Whether the configure script is doing the correct thing in the >>> case where >> the build environment (toolchain) contains *both* libnl2 and libnl3 >> (so libnl2 is available directly in <sysroot>/usr/include/netlink and >> libnl3 is available in <sysroot>/usr/include/libnl3/netlink). >>> 2. The include directory is hardcoded as /usr/include/libnl3 and I'm >> wondering whether this will do the right thing in a cross-development >> environment (where the toolchain is something other than the default - >> i.e., non-standard sysroot). In my tests I was only able to resolve >> libnl3 symbols when -I<sysroot>/usr/include/libnl3 was added to the >> conftest.c compile. >>> >>> In my cases above <sysroot> is the install area for my >>> cross-toolchain (e.g., >> /usr/local/x/y/toolchain...). >> >> How about using the appropriate pkg-config autoconf macro to determine >> the libnl3 include path and providing a dummy definition for these >> macros on non-Linux systems ? > > Not being any kind of 'autoconf' expert I can't really comment on whether > this is the "right" thing to do ;), but I can verify (see below) that this > does the appropriate thing on my system. > >> This is what pkg-config reports for >> libnl3 on my development system: >> >> $ pkg-config --cflags libnl-3.0 >> -I/usr/include/libnl3 > > $ pkg-config --cflags libnl-3.0 > -I/usr/local/netacquire/platform/1_2_0a/toolchain/include/libnl3 > > I assume this is something that you can fix up in the configure script?
Something like the patch below (+rerunning autoreconf) should be sufficient. The only part I have not yet figured out is where to get the pkg-config autoconf macros from. Should a copy of pkg.m4 be added in the Net-SNMP tree or should pkg-config be added to the list of packages mentioned on http://www.net-snmp.org/wiki/index.php/Build_System ? Bart. diff --git a/configure.d/config_os_libs2 b/configure.d/config_os_libs2 index 3934415..8a79cd4 100644 --- a/configure.d/config_os_libs2 +++ b/configure.d/config_os_libs2 @@ -225,11 +225,39 @@ fi if test "x$with_nl" != "xno"; then case $target_os in linux*) # Check for libnl (linux) + # The test below verifies whether the libnl-3 package been installed. + # This test works as follows: + # - If pkg-config was not installed at the time autogen.sh was run, + # the definition of the PKG_CHECK_EXISTS() macro will not be found by + # autogen.sh. Augogen.sh will generate a configure script that prints + # a warning about pkg-config and proceeds as if libnl-3 has not been + # installed. + # - If pkg-config was installed at the time autogen.sh was run, + # the generated configure script will try to detect the presence of + # the libnl-3 library by looking up compile and linker flags in the + # file called libnl-3.pc. + # - pkg-config settings can be overridden via the configure variables + # LIBNL3_CFLAGS and LIBNL3_LIBS (added by the pkg-config m4 macro's to + # the configure script -- see also ./configure --help). + # - The LIBNL3_CFLAGS and LIBNL3_LIBS configure variables can be used + # even if the pkg-config executable is not present on the system on + # which the configure script is run. + ifdef( + [PKG_CHECK_EXISTS], + [PKG_CHECK_EXISTS( + [libnl-3.0], + [PKG_CHECK_MODULES([LIBNL3], [libnl-3.0])], + ) + ], + AC_MSG_WARN([pkg-config has not been installed or is too old.]) + AC_MSG_WARN([Detection of libnl-3.0 will be skipped.]) + ) + netsnmp_save_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="-I/usr/include/libnl3 $CPPFLAGS" + CPPFLAGS="${LIBNL3_CFLAGS} $CPPFLAGS" NETSNMP_SEARCH_LIBS(nl_connect, nl-3, [AC_CHECK_HEADERS(netlink/netlink.h) - EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES -I/usr/include/libnl3"], + EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES ${LIBNL3_CFLAGS}"], [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS]) if test "x$ac_cv_header_netlink_netlink_h" != xyes; then NETSNMP_SEARCH_LIBS(nl_connect, nl, [ ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders