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 |
597 |
598 for plat, header in [ |
598 for plat, header in [ |
599 ('bsd|darwin|linux', 'sys/mount.h'), |
|
600 ('bsd|darwin|linux', 'sys/param.h'), |
|
601 ('linux', 'linux/magic.h'), |
599 ('linux', 'linux/magic.h'), |
602 ('linux', 'sys/vfs.h'), |
600 ('linux', 'sys/vfs.h'), |
603 ]: |
601 ]: |
604 if re.search(plat, sys.platform) and hasheader(new_compiler(), header): |
602 if re.search(plat, sys.platform) and hasheader(new_compiler(), header): |
605 macro = header.replace('/', '_').replace('.', '_').upper() |
603 macro = header.replace('/', '_').replace('.', '_').upper() |
|
604 osutil_cflags.append('-DHAVE_%s' % macro) |
|
605 |
|
606 for plat, macro, code in [ |
|
607 ('bsd|darwin', 'BSD_STATFS', ''' |
|
608 #include <sys/param.h> |
|
609 #include <sys/mount.h> |
|
610 int main() { struct statfs s; return sizeof(s.f_fstypename); } |
|
611 '''), |
|
612 ]: |
|
613 if re.search(plat, sys.platform) and cancompile(new_compiler(), code): |
606 osutil_cflags.append('-DHAVE_%s' % macro) |
614 osutil_cflags.append('-DHAVE_%s' % macro) |
607 |
615 |
608 if sys.platform == 'darwin': |
616 if sys.platform == 'darwin': |
609 osutil_ldflags += ['-framework', 'ApplicationServices'] |
617 osutil_ldflags += ['-framework', 'ApplicationServices'] |
610 |
618 |