[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 02/63: configure/cmake: check for if_nametoindex()
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 02/63: configure/cmake: check for if_nametoindex() |
Date: |
Fri, 07 Jun 2019 18:36:24 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit c9c4f7b547190709622fb012c446d060710a7d9f
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue May 21 16:47:53 2019 +0200
configure/cmake: check for if_nametoindex()
- adds the check to cmake
- fixes the configure check to work for cross-compiled windows builds
Closes #3917
---
CMakeLists.txt | 1 +
configure.ac | 1 +
lib/curl_config.h.cmake | 3 ++
m4/curl-functions.m4 | 113 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 118 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8c77e1d8..388f790db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -887,6 +887,7 @@ check_symbol_exists(ftruncate "${CURL_INCLUDES}"
HAVE_FTRUNCATE)
check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME)
check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME)
check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME)
+check_symbol_exists(if_nametoindex "${CURL_INCLUDES}" HAVE_IF_NAMETOINDEX)
check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT)
check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
diff --git a/configure.ac b/configure.ac
index 3e45b5151..43f33d70e 100755
--- a/configure.ac
+++ b/configure.ac
@@ -3721,6 +3721,7 @@ CURL_CHECK_FUNC_GETHOSTBYNAME_R
CURL_CHECK_FUNC_GETHOSTNAME
CURL_CHECK_FUNC_GETPEERNAME
CURL_CHECK_FUNC_GETSOCKNAME
+CURL_CHECK_FUNC_IF_NAMETOINDEX
CURL_CHECK_FUNC_GETIFADDRS
CURL_CHECK_FUNC_GETSERVBYPORT_R
CURL_CHECK_FUNC_GMTIME_R
diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake
index 9ac64f651..afa59d538 100644
--- a/lib/curl_config.h.cmake
+++ b/lib/curl_config.h.cmake
@@ -241,6 +241,9 @@
/* Define to 1 if you have the `getsockname' function. */
#cmakedefine HAVE_GETSOCKNAME 1
+/* Define to 1 if you have the `if_nametoindex' function. */
+#cmakedefine HAVE_IF_NAMETOINDEX 1
+
/* Define to 1 if you have the `getpwuid' function. */
#cmakedefine HAVE_GETPWUID 1
diff --git a/m4/curl-functions.m4 b/m4/curl-functions.m4
index b79e18198..84f6ffcb2 100644
--- a/m4/curl-functions.m4
+++ b/m4/curl-functions.m4
@@ -563,6 +563,23 @@ curl_includes_bsdsocket="\
[], [], [ $curl_includes_bsdsocket])
])
+dnl CURL_INCLUDES_NETIF
+dnl -------------------------------------------------
+dnl Set up variable with list of headers that must be
+dnl included when net/if.h is to be included.
+
+AC_DEFUN([CURL_INCLUDES_NETIF], [
+curl_includes_netif="\
+/* includes start */
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+/* includes end */"
+ AC_CHECK_HEADERS(
+ net/if.h,
+ [], [], [$curl_includes_netif])
+])
+
dnl CURL_PREPROCESS_CALLCONV
dnl -------------------------------------------------
@@ -3108,6 +3125,102 @@ AC_DEFUN([CURL_CHECK_FUNC_GETSOCKNAME], [
fi
])
+dnl CURL_CHECK_FUNC_IF_NAMETOINDEX
+dnl -------------------------------------------------
+dnl Verify if if_nametoindex is available, prototyped, and
+dnl can be compiled. If all of these are true, and
+dnl usage has not been previously disallowed with
+dnl shell variable curl_disallow_if_nametoindex, then
+dnl HAVE_IF_NAMETOINDEX will be defined.
+
+AC_DEFUN([CURL_CHECK_FUNC_IF_NAMETOINDEX], [
+ AC_REQUIRE([CURL_INCLUDES_WINSOCK2])dnl
+ AC_REQUIRE([CURL_INCLUDES_NETIF])dnl
+ AC_REQUIRE([CURL_PREPROCESS_CALLCONV])dnl
+ #
+ tst_links_if_nametoindex="unknown"
+ tst_proto_if_nametoindex="unknown"
+ tst_compi_if_nametoindex="unknown"
+ tst_allow_if_nametoindex="unknown"
+ #
+ AC_MSG_CHECKING([if if_nametoindex can be linked])
+ AC_LINK_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_winsock2
+ $curl_includes_bsdsocket
+ #include <net/if.h>
+ ]],[[
+ if(0 != if_nametoindex(""))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_links_if_nametoindex="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_links_if_nametoindex="no"
+ ])
+ #
+ if test "$tst_links_if_nametoindex" = "yes"; then
+ AC_MSG_CHECKING([if if_nametoindex is prototyped])
+ AC_EGREP_CPP([if_nametoindex],[
+ $curl_includes_winsock2
+ $curl_includes_netif
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_proto_if_nametoindex="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_proto_if_nametoindex="no"
+ ])
+ fi
+ #
+ if test "$tst_proto_if_nametoindex" = "yes"; then
+ AC_MSG_CHECKING([if if_nametoindex is compilable])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([[
+ $curl_includes_winsock2
+ $curl_includes_netif
+ ]],[[
+ if(0 != if_nametoindex(""))
+ return 1;
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ tst_compi_if_nametoindex="yes"
+ ],[
+ AC_MSG_RESULT([no])
+ tst_compi_if_nametoindex="no"
+ ])
+ fi
+ #
+ if test "$tst_compi_if_nametoindex" = "yes"; then
+ AC_MSG_CHECKING([if if_nametoindex usage allowed])
+ if test "x$curl_disallow_if_nametoindex" != "xyes"; then
+ AC_MSG_RESULT([yes])
+ tst_allow_if_nametoindex="yes"
+ else
+ AC_MSG_RESULT([no])
+ tst_allow_if_nametoindex="no"
+ fi
+ fi
+ #
+ AC_MSG_CHECKING([if if_nametoindex might be used])
+ if test "$tst_links_if_nametoindex" = "yes" &&
+ test "$tst_proto_if_nametoindex" = "yes" &&
+ test "$tst_compi_if_nametoindex" = "yes" &&
+ test "$tst_allow_if_nametoindex" = "yes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE_UNQUOTED(HAVE_IF_NAMETOINDEX, 1,
+ [Define to 1 if you have the if_nametoindex function.])
+ curl_cv_func_if_nametoindex="yes"
+ else
+ AC_MSG_RESULT([no])
+ curl_cv_func_if_nametoindex="no"
+ fi
+])
+
+
dnl CURL_CHECK_FUNC_GETIFADDRS
dnl -------------------------------------------------
dnl Verify if getifaddrs is available, prototyped, can
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] branch master updated (7959939f1 -> 5d5e1c738), gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 03/63: PolarSSL: deprecate support step 1. Removed from configure., gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 01/63: parse_proxy: use the IPv6 zone id if given, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 04/63: http2-download: fix format specifier, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 05/63: examples: reduce variable scopes, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 11/63: sasl: Implement SASL authorisation identity via CURLOPT_SASL_AUTHZID, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 10/63: tests: add support to test against OpenSSH for Windows, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 08/63: examples: fix "clarify calculation precedence" warnings, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 02/63: configure/cmake: check for if_nametoindex(),
gnunet <=
- [GNUnet-SVN] [gnurl] 13/63: examples: Added SASL PLAIN authorisation identity (authzid) examples, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 09/63: bump: start on the next release, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 15/63: url: fix bad #ifdef, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 14/63: Revert "progress: CURL_DISABLE_PROGRESS_METER", gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 23/63: winbuild: Use two space indentation, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 17/63: config-win32: add support for if_nametoindex and getsockname, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 22/63: tool_parse_cfg: Avoid 2 fopen() for WIN32, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 39/63: parse_proxy: make sure portptr is initialized, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 29/63: Revert all SASL authzid (new feature) commits, gnunet, 2019/06/07
- [GNUnet-SVN] [gnurl] 21/63: md4: include the mbedtls config.h to get the MD4 info, gnunet, 2019/06/07