[glib] Force W32-specific POLL* constant values in meson



commit 85a32c713740340e296e6db1acc220b535d7011c
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Sat Mar 31 13:59:55 2018 +0000

    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

 meson.build | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index b52d4d857..cf8c69b25 100644
--- a/meson.build
+++ b/meson.build
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]