# HG changeset patch # User Jun Wu # Date 1490332536 25200 # Node ID ab51a2b18f87fd14ba4d37eaab402c8aa5e22ce2 # Parent e8bd005c0af791a87903de339482692db1137ff0 setup: use a more strict way to test BSD or OSX's statfs We want to use the `f_fstypename` field to get the filesystem type. Test it directly. The new macro HAVE_BSD_STATFS implys the old HAVE_SYS_MOUNT_H and HAVE_SYS_PARAM_H. So the latter ones are removed. diff -r e8bd005c0af7 -r ab51a2b18f87 setup.py --- 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 + #include + 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']