mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
Meson: Set _WIN32_WINNT to 0x0601 (Windows 7)
We want to set _WIN32_WINNT so that functions will be properly found in the headers, to target the NT6.1+ (Windows 7+) APIs. Also improve the checks for if_nametoindex() and if_indextoname() on Windows as they are supported in Windows Vista+, but they have to be checked by linking against iphlpapi.lib (or -liphlpapi). On other platforms, they are still checked as they were before. https://bugzilla.gnome.org/show_bug.cgi?id=783270
This commit is contained in:
parent
ea6ac5f71e
commit
54aee1f627
@ -768,7 +768,7 @@
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#mesondefine _LARGE_FILES
|
||||
|
||||
/* Target the Windows XP API */
|
||||
/* Target the Windows 7 API */
|
||||
#mesondefine _WIN32_WINNT
|
||||
|
||||
/* Needed to get declarations for msg_control and msg_controllen on Solaris */
|
||||
|
@ -369,7 +369,7 @@ if host_system == 'windows'
|
||||
contenttype_sources += ['gcontenttype-win32.c']
|
||||
platform_deps += [cc.find_library('shlwapi'),
|
||||
cc.find_library('dnsapi'),
|
||||
cc.find_library('iphlpapi'),
|
||||
iphlpapi_dep,
|
||||
winsock2]
|
||||
win32_sources += [
|
||||
'gwin32registrykey.c',
|
||||
|
27
meson.build
27
meson.build
@ -255,6 +255,11 @@ foreach m : struct_members
|
||||
endif
|
||||
endforeach
|
||||
|
||||
# Windows Support (Vista+)
|
||||
if host_system == 'windows'
|
||||
glib_conf.set('_WIN32_WINNT', '0x0601')
|
||||
endif
|
||||
|
||||
functions = [
|
||||
'alloca',
|
||||
'mmap',
|
||||
@ -311,8 +316,6 @@ functions = [
|
||||
'kqueue',
|
||||
'kevent',
|
||||
'endservent',
|
||||
'if_indextoname',
|
||||
'if_nametoindex',
|
||||
'sendmmsg',
|
||||
'recvmmsg',
|
||||
]
|
||||
@ -328,6 +331,25 @@ else
|
||||
have_func_statfs = false
|
||||
endif
|
||||
|
||||
if host_system == 'windows'
|
||||
iphlpapi_dep = cc.find_library('iphlpapi')
|
||||
iphlpapi_funcs = ['if_nametoindex', 'if_indextoname']
|
||||
foreach ifunc : iphlpapi_funcs
|
||||
if cc.has_function(ifunc,
|
||||
prefix : '#define _WIN32_WINNT 0x0601\n#include <winsock2.h>\n#include <iphlpapi.h>',
|
||||
dependencies : iphlpapi_dep)
|
||||
idefine = 'HAVE_' + ifunc.underscorify().to_upper()
|
||||
glib_conf.set(idefine, 1)
|
||||
glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(idefine)
|
||||
set_variable('have_func_' + ifunc, true)
|
||||
else
|
||||
set_variable('have_func_' + ifunc, false)
|
||||
endif
|
||||
endforeach
|
||||
else
|
||||
functions += ['if_indextoname', 'if_nametoindex']
|
||||
endif
|
||||
|
||||
# AIX splice is something else
|
||||
if host_system != 'aix'
|
||||
functions += ['splice']
|
||||
@ -674,6 +696,7 @@ endif
|
||||
# AC_FUNC_PRINTF_UNIX98
|
||||
# Nothing uses HAVE_UNIX98_PRINTF
|
||||
|
||||
|
||||
# Check for nl_langinfo and CODESET
|
||||
# FIXME: Check for HAVE_BIND_TEXTDOMAIN_CODESET
|
||||
if cc.links('''#include <langinfo.h>
|
||||
|
Loading…
Reference in New Issue
Block a user