Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7087842

Browse files
author
Xavier de Gaye
committed
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.
1 parent 690e81f commit 7087842

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Tests
8282
Build
8383
-----
8484

85+
- Issue #28538: Fix the compilation error that occurs because if_nameindex() is
86+
available on Android API level 24, but the if_nameindex structure is not
87+
defined.
88+
8589
- Issue #20211: Do not add the directory for installing C header files and the
8690
directory for installing object code libraries to the cross compilation
8791
search paths. Original patch by Thomas Petazzoni.

configure

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11198,7 +11198,6 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
1119811198
futimens futimes gai_strerror getentropy \
1119911199
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
1120011200
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
11201-
if_nameindex \
1120211201
initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \
1120311202
memrchr mbrtowc mkdirat mkfifo \
1120411203
mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
@@ -12642,6 +12641,39 @@ else
1264212641
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1264312642
$as_echo "no" >&6; }
1264412643

12644+
fi
12645+
rm -f core conftest.err conftest.$ac_objext \
12646+
conftest$ac_exeext conftest.$ac_ext
12647+
12648+
# On Android API level 24 if_nameindex() is available, but the if_nameindex
12649+
# structure is not defined.
12650+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for if_nameindex" >&5
12651+
$as_echo_n "checking for if_nameindex... " >&6; }
12652+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
12653+
/* end confdefs.h. */
12654+
12655+
#ifdef HAVE_NET_IF_H
12656+
# include <net/if.h>
12657+
#endif
12658+
12659+
int
12660+
main ()
12661+
{
12662+
struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;
12663+
;
12664+
return 0;
12665+
}
12666+
_ACEOF
12667+
if ac_fn_c_try_link "$LINENO"; then :
12668+
12669+
$as_echo "#define HAVE_IF_NAMEINDEX 1" >>confdefs.h
12670+
12671+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
12672+
$as_echo "yes" >&6; }
12673+
else
12674+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
12675+
$as_echo "no" >&6; }
12676+
1264512677
fi
1264612678
rm -f core conftest.err conftest.$ac_objext \
1264712679
conftest$ac_exeext conftest.$ac_ext

configure.ac

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3384,7 +3384,6 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
33843384
futimens futimes gai_strerror getentropy \
33853385
getgrouplist getgroups getlogin getloadavg getpeername getpgid getpid \
33863386
getpriority getresuid getresgid getpwent getspnam getspent getsid getwd \
3387-
if_nameindex \
33883387
initgroups kill killpg lchmod lchown lockf linkat lstat lutimes mmap \
33893388
memrchr mbrtowc mkdirat mkfifo \
33903389
mkfifoat mknod mknodat mktime mremap nice openat pathconf pause pipe2 plock poll \
@@ -3737,6 +3736,19 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
37373736
AC_MSG_RESULT(no)
37383737
])
37393738

3739+
# On Android API level 24 if_nameindex() is available, but the if_nameindex
3740+
# structure is not defined.
3741+
AC_MSG_CHECKING(for if_nameindex)
3742+
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
3743+
#ifdef HAVE_NET_IF_H
3744+
# include <net/if.h>
3745+
#endif
3746+
]], [[struct if_nameindex *ni = if_nameindex(); int x = ni[0].if_index;]])],
3747+
[AC_DEFINE(HAVE_IF_NAMEINDEX, 1, Define to 1 if you have the 'if_nameindex' function.)
3748+
AC_MSG_RESULT(yes)],
3749+
[AC_MSG_RESULT(no)
3750+
])
3751+
37403752
# On OSF/1 V5.1, getaddrinfo is available, but a define
37413753
# for [no]getaddrinfo in netdb.h.
37423754
AC_MSG_CHECKING(for getaddrinfo)

0 commit comments

Comments
 (0)