Force W32-specific POLL* constant values in meson

The winsock2-using test does work perfectly, however this is a new
thing that didn't exist in autotools-based builds of glib in the past.
Autotools builds used the generic case where values were just defined
to some agreed-upon numbers, and this is what all autotools-glib
binaries and binaries built against autotools-glib (since these
values go into public glibconfig.h header) use. At least one value,
G_POLLIN, is different, thus breaking ABI if some binaries are
built with autotools and the others are built with meson.

Force meson buildscript to use the same G_POLL* constant values
for Windows builds that autotools builds use.

https://bugzilla.gnome.org/show_bug.cgi?id=794687
This commit is contained in:
Руслан Ижбулатов 2018-03-31 13:59:55 +00:00
parent 9dc2da8f07
commit 85a32c7137

View File

@ -1371,17 +1371,30 @@ else
endif
poll_defines = [
[ 'POLLIN', 'g_pollin' ],
[ 'POLLOUT', 'g_pollout' ],
[ 'POLLPRI', 'g_pollpri' ],
[ 'POLLERR', 'g_pollerr' ],
[ 'POLLHUP', 'g_pollhup' ],
[ 'POLLNVAL', 'g_pollnval' ],
[ 'POLLIN', 'g_pollin', 1 ],
[ 'POLLOUT', 'g_pollout', 4 ],
[ 'POLLPRI', 'g_pollpri', 2 ],
[ 'POLLERR', 'g_pollerr', 8 ],
[ 'POLLHUP', 'g_pollhup', 16 ],
[ 'POLLNVAL', 'g_pollnval', 32 ],
]
foreach d : poll_defines
val = cc.compute_int(d[0], prefix: poll_includes)
glibconfig_conf.set(d[1], val)
endforeach
if has_syspoll and has_systypes
foreach d : poll_defines
val = cc.compute_int(d[0], prefix: poll_includes)
glibconfig_conf.set(d[1], val)
endforeach
elif has_winsock2
# Due to a missed bug in configure.ac the poll test
# never succeeded on Windows and used some pre-defined
# values as a fallback. Keep using them to maintain
# ABI compatibility with autotools builds of glibs
# and with *any* glib-using code compiled against them,
# since these values end up in a public header glibconfig.h.
foreach d : poll_defines
glibconfig_conf.set(d[1], d[2])
endforeach
endif
# Internet address families
# FIXME: what about Cygwin (G_WITH_CYGWIN)