[PATCH 4/6] configure: Add a test for SO_BINDTODEVICE

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <[email protected]>
---
 configure                             | 34 +++++++++++++++++++++++++++
 configure.d/config_os_misc4           | 15 ++++++++++++
 include/net-snmp/net-snmp-config.h.in |  3 +++
 3 files changed, 52 insertions(+)

diff --git a/configure b/configure
index 282631f4266e..fe05c50374f0 100755
--- a/configure
+++ b/configure
@@ -31462,6 +31462,40 @@ And this can be very slow." >&2;}
     ;;
 esac
 
+#   Check whether SO_BINDTODEVICE is available.
+#
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SO_BINDTODEVICE" >&5
+$as_echo_n "checking for SO_BINDTODEVICE... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+main ()
+{
+
+return SO_BINDTODEVICE
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_SO_BINDTODEVICE 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
 #   Check whether struct in_pktinfo.ipi_spec_dst is available.
 #
 
diff --git a/configure.d/config_os_misc4 b/configure.d/config_os_misc4
index 2899bb8adb98..9a4542274d14 100644
--- a/configure.d/config_os_misc4
+++ b/configure.d/config_os_misc4
@@ -318,6 +318,21 @@ And this can be very slow.])
     ;;
 esac
 
+#   Check whether SO_BINDTODEVICE is available.
+#
+
+AC_MSG_CHECKING([for SO_BINDTODEVICE])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <sys/types.h>
+#include <sys/socket.h>
+], [
+return SO_BINDTODEVICE
+])],
+[AC_DEFINE([HAVE_SO_BINDTODEVICE], [1],
+  [Define to 1 if SO_BINDTODEVICE is available])
+ AC_MSG_RESULT([yes])],
+[AC_MSG_RESULT([no])])
+
 #   Check whether struct in_pktinfo.ipi_spec_dst is available.
 #
 
diff --git a/include/net-snmp/net-snmp-config.h.in b/include/net-snmp/net-snmp-config.h.in
index e34af9f7e6e2..90e005d53f51 100644
--- a/include/net-snmp/net-snmp-config.h.in
+++ b/include/net-snmp/net-snmp-config.h.in
@@ -831,6 +831,9 @@
 /* Define to 1 if the system has the type `socklen_t'. */
 #undef HAVE_SOCKLEN_T
 
+/* Define to 1 if SO_BINDTODEVICE is available */
+#undef HAVE_SO_BINDTODEVICE
+
 /* Define to 1 if you have the `srand' function. */
 #undef HAVE_SRAND
 
-- 
2.19.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.