Merge branch 'test-ip_mreq_source-android-only' into 'master'

build: only test for broken ip_mreq_source on Android. Fixes #1472

Closes #1472

See merge request GNOME/glib!222
This commit is contained in:
Philip Withnall 2018-08-03 09:33:35 +00:00
commit 516101c702
2 changed files with 21 additions and 15 deletions

View File

@ -922,20 +922,22 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
]) ])
AC_MSG_CHECKING([if ip_mreq_source.imr_interface has s_addr member]) # See https://bugzilla.gnome.org/show_bug.cgi?id=740791
AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AS_IF([test $glib_native_android = yes], [
[[ AC_MSG_CHECKING([if ip_mreq_source.imr_interface has s_addr member])
#include <netinet/in.h> AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
]], [[
[[ #include <netinet/in.h>
struct ip_mreq_source mc_req_src; ]],
mc_req_src.imr_interface.s_addr = 0; [[
]])], [ struct ip_mreq_source mc_req_src;
AC_MSG_RESULT(yes) mc_req_src.imr_interface.s_addr = 0;
], [ ]])], [
AC_MSG_RESULT(no) AC_MSG_RESULT(yes)
AC_DEFINE(BROKEN_IP_MREQ_SOURCE_STRUCT, 1, [struct ip_mreq_source definition is broken on Android NDK <= r16]) ], [
]) AC_MSG_RESULT(no)
AC_DEFINE(BROKEN_IP_MREQ_SOURCE_STRUCT, 1, [struct ip_mreq_source definition is broken on Android NDK <= r16])
])])
AS_IF([test $glib_native_win32 = yes], [ AS_IF([test $glib_native_win32 = yes], [
# <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for

View File

@ -152,6 +152,11 @@ if host_system != 'windows'
glib_conf.set('HAVE_SIOCGIFADDR', '/**/') glib_conf.set('HAVE_SIOCGIFADDR', '/**/')
endif endif
endif
if host_system.contains('android')
# struct ip_mreq_source definition is broken on Android NDK <= r16
# See https://bugzilla.gnome.org/show_bug.cgi?id=740791
if not cc.compiles('''#include <netinet/in.h> if not cc.compiles('''#include <netinet/in.h>
int main(int argc, char ** argv) { int main(int argc, char ** argv) {
struct ip_mreq_source mc_req_src; struct ip_mreq_source mc_req_src;
@ -161,7 +166,6 @@ if host_system != 'windows'
name : 'ip_mreq_source.imr_interface has s_addr member') name : 'ip_mreq_source.imr_interface has s_addr member')
glib_conf.set('BROKEN_IP_MREQ_SOURCE_STRUCT', 1) glib_conf.set('BROKEN_IP_MREQ_SOURCE_STRUCT', 1)
endif endif
endif endif
gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include) gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)