--- a/meson.build	2018-08-29 14:57:20.688786000 -0500
+++ b/meson.build	2018-09-02 18:00:32.490563287 -0500
@@ -535,7 +535,7 @@
 #include <linux/ethtool.h>
 #include <linux/fib_rules.h>
 //#include <linux/stat.h>
-//#include <sys/stat.h>
+#include <sys/stat.h>
 '''
 # FIXME: key_serial_t is only defined in keyutils.h, this is bound to fail
 
@@ -548,10 +548,24 @@
                ]
 
         # We get -1 if the size cannot be determined
-        have = cc.sizeof(decl, prefix : decl_headers) > 0
+        have = cc.sizeof(decl, prefix : decl_headers, args : '-D_GNU_SOURCE') > 0
+
+        if decl == 'struct statx'
+                if have
+                        want_linux_stat_h = false
+                else
+                        have = cc.sizeof(decl,
+                                         prefix : decl_headers + '#include <linux/stat.h>',
+                                         args : '-D_GNU_SOURCE') > 0
+                        want_linux_stat_h = have
+                endif
+        endif
+
         conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
 endforeach
 
+conf.set10('WANT_LINUX_STAT_H', want_linux_stat_h)
+
 foreach decl : [['IFLA_INET6_ADDR_GEN_MODE',         'linux/if_link.h'],
                 ['IN6_ADDR_GEN_MODE_STABLE_PRIVACY', 'linux/if_link.h'],
                 ['IFLA_VRF_TABLE',                   'linux/if_link.h'],
--- a/src/basic/missing.h	2018-08-29 14:57:20.705452000 -0500
+++ b/src/basic/missing.h	2018-09-02 19:05:17.264515940 -0500
@@ -44,6 +44,10 @@
 #include <uchar.h>
 #include <unistd.h>
 
+#if WANT_LINUX_STAT_H
+#include <linux/stat.h>
+#endif
+
 /// Additional includes needed by elogind
 #include "musl_missing.h"
 
