comparison setup.py @ 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 ab51a2b18f87
comparison
equal deleted inserted replaced
31561:312e62640798 31562:3db113eef95f
592 592
593 # platform specific macros 593 # platform specific macros
594 for plat, func in [('bsd', 'setproctitle'), ('bsd|darwin|linux', 'statfs')]: 594 for plat, func in [('bsd', 'setproctitle'), ('bsd|darwin|linux', 'statfs')]:
595 if re.search(plat, sys.platform) and hasfunction(new_compiler(), func): 595 if re.search(plat, sys.platform) and hasfunction(new_compiler(), func):
596 osutil_cflags.append('-DHAVE_%s' % func.upper()) 596 osutil_cflags.append('-DHAVE_%s' % func.upper())
597
598 for plat, header in [
599 ('bsd|darwin|linux', 'sys/mount.h'),
600 ('bsd|darwin|linux', 'sys/param.h'),
601 ('linux', 'linux/magic.h'),
602 ('linux', 'sys/vfs.h'),
603 ]:
604 if re.search(plat, sys.platform) and hasheader(new_compiler(), header):
605 macro = header.replace('/', '_').replace('.', '_').upper()
606 osutil_cflags.append('-DHAVE_%s' % macro)
597 607
598 if sys.platform == 'darwin': 608 if sys.platform == 'darwin':
599 osutil_ldflags += ['-framework', 'ApplicationServices'] 609 osutil_ldflags += ['-framework', 'ApplicationServices']
600 610
601 extmodules = [ 611 extmodules = [