setup.py
changeset 31596 ab51a2b18f87
parent 31562 3db113eef95f
child 31622 2243ba216f66
--- a/setup.py	Thu Mar 23 12:03:19 2017 -0700
+++ b/setup.py	Thu Mar 23 22:15:36 2017 -0700
@@ -596,8 +596,6 @@
         osutil_cflags.append('-DHAVE_%s' % func.upper())
 
 for plat, header in [
-    ('bsd|darwin|linux', 'sys/mount.h'),
-    ('bsd|darwin|linux', 'sys/param.h'),
     ('linux', 'linux/magic.h'),
     ('linux', 'sys/vfs.h'),
 ]:
@@ -605,6 +603,16 @@
         macro = header.replace('/', '_').replace('.', '_').upper()
         osutil_cflags.append('-DHAVE_%s' % macro)
 
+for plat, macro, code in [
+    ('bsd|darwin', 'BSD_STATFS', '''
+     #include <sys/param.h>
+     #include <sys/mount.h>
+     int main() { struct statfs s; return sizeof(s.f_fstypename); }
+     '''),
+]:
+    if re.search(plat, sys.platform) and cancompile(new_compiler(), code):
+        osutil_cflags.append('-DHAVE_%s' % macro)
+
 if sys.platform == 'darwin':
     osutil_ldflags += ['-framework', 'ApplicationServices']