mirror of
https://github.com/facebook/sapling.git
synced 2025-01-06 04:43:19 +03:00
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.
This commit is contained in:
parent
7fc770b181
commit
b78b032c28
12
setup.py
12
setup.py
@ -596,8 +596,6 @@ for plat, func in [('bsd', 'setproctitle'), ('bsd|darwin|linux', 'statfs')]:
|
||||
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 @@ for plat, header in [
|
||||
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']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user