[Python-checkins] cpython (3.6): Issue #28538: Fix the compilation error that occurs because if_nameindex() is

xavier.degaye python-checkins at python.org
Wed Dec 21 06:48:57 EST 2016


https://hg.python.org/cpython/rev/e248bfb0f520
changeset:   105769:e248bfb0f520
branch:      3.6
parent:      105765:9b2e71492b53
user:        Xavier de Gaye <xdegaye at users.sourceforge.net>
date:        Wed Dec 21 12:46:36 2016 +0100
summary:
  Issue #28538: Fix the compilation error that occurs because if_nameindex() is
available on Android API level 24, but the if_nameindex structure is not defined.

files:
  Misc/NEWS    |   4 ++++
  configure    |  34 +++++++++++++++++++++++++++++++++-
  configure.ac |  14 +++++++++++++-
  3 files changed, 50 insertions(+), 2 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -82,6 +82,10 @@
 Build
 -----
 
+- Issue #28538: Fix the compilation error that occurs because if_nameindex() is
+  available on Android API level 24, but the if_nameindex structure is not
+  defined.
+
 - Issue #20211: Do not add the directory for installing C header files and the
   directory for installing object code libraries to the cross compilation
   search paths. Original patch by Thomas Petazzoni.
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -11198,7 +11198,6 @@
  futimens futimes gai_strerror getentropy \
  getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
- if_nameindex \
  initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \
  memrchr mbrtowc mkdirat mkfifo \
  mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
@@ -12646,6 +12645,39 @@
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
+# On Android API level 24 if_nameindex() is available, but the if_nameindex
+# structure is not defined.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5
+$as_echo_n "checking for if_nameindex... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+
+int
+main ()
+{
+struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+$as_echo "#define HAVE_IF_NAMEINDEX 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
+
 # On OSF/1 V5.1, getaddrinfo is available, but a define
 # for [no]getaddrinfo in netdb.h.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -3384,7 +3384,6 @@
  futimens futimes gai_strerror getentropy \
  getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
  getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
- if_nameindex \
  initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \
  memrchr mbrtowc mkdirat mkfifo \
  mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
@@ -3737,6 +3736,19 @@
   AC_MSG_RESULT(no)
 ])
 
+# On Android API level 24 if_nameindex() is available, but the if_nameindex
+# structure is not defined.
+AC_MSG_CHECKING(for if_nameindex)
+AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+#ifdef HAVE_NET_IF_H
+# include <net/if.h>
+#endif
+]], [[struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;]])],
+  [AC_DEFINE(HAVE_IF_NAMEINDEX, 1, Define to 1 if you have the 'if_nameindex' function.)
+   AC_MSG_RESULT(yes)],
+  [AC_MSG_RESULT(no)
+])
+
 # On OSF/1 V5.1, getaddrinfo is available, but a define
 # for [no]getaddrinfo in netdb.h.
 AC_MSG_CHECKING(for getaddrinfo)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list