000-cross-compile.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. From: Jo-Philipp Wich <jo@mein.io>
  2. Date: Fri, 6 Jan 2017 13:41:00 +0100
  3. Subject: [PATCH] configure: allow overriding hardcoded /usr/include/libnl3
  4. In a cross-compile setting we do not want to probe the host systems
  5. /usr/include path, therfore allow to disable this include path by passing
  6. ac_cv_header_netlink_netlink_h=yes to configure.
  7. Also disable the testing for libraries providing nl_connect when
  8. netsnmp_cv_func_nl_connect_LIBS is predefined since the proprietary
  9. NETSNMP_SEARCH_LIBS() macro will clobber the internal link flags upon
  10. encountering predefined cache variables, causing all subsequent configure
  11. link tests to fail due to a stray "no" word getting passed to the linker.
  12. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
  13. --- a/configure.d/config_os_libs2
  14. +++ b/configure.d/config_os_libs2
  15. @@ -226,14 +226,22 @@ if test "x$with_nl" != "xno"; then
  16. case $target_os in
  17. linux*) # Check for libnl (linux)
  18. netsnmp_save_CPPFLAGS="$CPPFLAGS"
  19. - CPPFLAGS="-I/usr/include/libnl3 $CPPFLAGS"
  20. - NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
  21. - [AC_CHECK_HEADERS(netlink/netlink.h)
  22. - EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES -I/usr/include/libnl3"],
  23. - [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
  24. + netsnmp_netlink_include_flags=""
  25. if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
  26. - NETSNMP_SEARCH_LIBS(nl_connect, nl, [
  27. - AC_CHECK_HEADERS(netlink/netlink.h)], [], [], LMIBLIBS)
  28. + netsnmp_netlink_include_flags="-I/usr/include/libnl3"
  29. + fi
  30. + CPPFLAGS="$netsnmp_netlink_include_flags $CPPFLAGS"
  31. + if test "x$netsnmp_cv_func_nl_connect_LIBS" = x; then
  32. + NETSNMP_SEARCH_LIBS(nl_connect, nl-3,
  33. + [AC_CHECK_HEADERS(netlink/netlink.h)
  34. + EXTERNAL_MIBGROUP_INCLUDES="$EXTERNAL_MIBGROUP_INCLUDES $netsnmp_netlink_include_flags"],
  35. + [CPPFLAGS="$netsnmp_save_CPPFLAGS"], [], [], [LMIBLIBS])
  36. + if test "x$ac_cv_header_netlink_netlink_h" != xyes; then
  37. + NETSNMP_SEARCH_LIBS(nl_connect, nl, [
  38. + AC_CHECK_HEADERS(netlink/netlink.h)], [], [], LMIBLIBS)
  39. + fi
  40. + else
  41. + LMIBLIBS="$LMIBLIBS $netsnmp_cv_func_nl_connect_LIBS"
  42. fi
  43. if test "x$ac_cv_header_netlink_netlink_h" = xyes; then
  44. AC_EGREP_HEADER([nl_socket_free], [netlink/socket.h],