changeset 31562:3db113eef95f

setup: test some header files The next patch will use "statfs", which requires different header files on different platforms. Linux: sys/vfs.h or sys/statfs.h FreeBSD or OSX: sys/param.h and sys/mount.h Therefore test them so we can include the correct ones.
author Jun Wu <quark@fb.com>
date Mon, 20 Mar 2017 15:43:27 -0700
parents 312e62640798
children cc3ec3027695
files setup.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Mon Mar 20 15:11:18 2017 -0700
+++ b/setup.py	Mon Mar 20 15:43:27 2017 -0700
@@ -595,6 +595,16 @@
     if re.search(plat, sys.platform) and hasfunction(new_compiler(), func):
         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'),
+]:
+    if re.search(plat, sys.platform) and hasheader(new_compiler(), header):
+        macro = header.replace('/', '_').replace('.', '_').upper()
+        osutil_cflags.append('-DHAVE_%s' % macro)
+
 if sys.platform == 'darwin':
     osutil_ldflags += ['-framework', 'ApplicationServices']