| 1 | #!/usr/bin/env python
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 | # backtrace could be in libexecinfo or in libc
|
|---|
| 5 | conf.CHECK_FUNCS_IN('backtrace', 'execinfo', checklibc=True, headers='execinfo.h')
|
|---|
| 6 |
|
|---|
| 7 | conf.CHECK_FUNCS('sigprocmask sigblock sigaction')
|
|---|
| 8 |
|
|---|
| 9 | xattr_headers='sys/attributes.h attr/xattr.h sys/xattr.h'
|
|---|
| 10 | conf.CHECK_FUNCS_IN('flistxattr', 'attr', checklibc=True, headers=xattr_headers)
|
|---|
| 11 |
|
|---|
| 12 | conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
|
|---|
| 13 | headers=xattr_headers, local_include=False,
|
|---|
| 14 | define='XATTR_ADDITIONAL_OPTIONS',
|
|---|
| 15 | msg='Checking for darwin xattr api')
|
|---|
| 16 |
|
|---|
| 17 | if conf.CONFIG_SET('HAVE_FLISTXATTR'):
|
|---|
| 18 | conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE', headers='sys/statvfs.h')
|
|---|
| 23 |
|
|---|
| 24 | # all the different ways of doing statfs
|
|---|
| 25 | statfs_types = [
|
|---|
| 26 | ( 'STAT_STATVFS64',
|
|---|
| 27 | 'Linux statvfs64',
|
|---|
| 28 | 'struct statvfs64 fsd; exit(statvfs64 (".", &fsd))',
|
|---|
| 29 | 'sys/statvfs.h' ),
|
|---|
| 30 |
|
|---|
| 31 | ( 'STAT_STATVFS',
|
|---|
| 32 | 'statvfs (SVR4)',
|
|---|
| 33 | 'struct statvfs fsd; exit(statvfs(0, &fsd))',
|
|---|
| 34 | 'sys/statvfs.h' ),
|
|---|
| 35 |
|
|---|
| 36 | ( 'STAT_STATFS3_OSF1',
|
|---|
| 37 | '3-argument statfs function (DEC OSF/1)',
|
|---|
| 38 | 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd, sizeof(struct statfs)))'
|
|---|
| 39 | 'sys/param.h sys/mount.h' ),
|
|---|
| 40 |
|
|---|
| 41 | ( 'STAT_STATFS2_BSIZE',
|
|---|
| 42 | 'two-argument statfs with statfs.bsize',
|
|---|
| 43 | 'struct statfs fsd; fsd.f_bsize = 0; exit(statfs(".", &fsd))',
|
|---|
| 44 | 'sys/param.h sys/mount.h sys/vfs.h' ),
|
|---|
| 45 |
|
|---|
| 46 | ( 'STAT_STATFS4',
|
|---|
| 47 | 'four-argument statfs (AIX-3.2.5, SVR3)',
|
|---|
| 48 | 'struct statfs fsd; exit(statfs(".", &fsd, sizeof fsd, 0))',
|
|---|
| 49 | 'sys/statfs.h' ),
|
|---|
| 50 |
|
|---|
| 51 | ( 'STAT_STATFS2_FSIZE',
|
|---|
| 52 | 'two-argument statfs with statfs.fsize',
|
|---|
| 53 | 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd))'
|
|---|
| 54 | 'sys/param.h sys/mount.h' ),
|
|---|
| 55 |
|
|---|
| 56 | ( 'STAT_STATFS2_FS_DATA',
|
|---|
| 57 | 'two-argument statfs with struct fs_data (Ultrix)',
|
|---|
| 58 | 'struct fs_data fsd; exit(statfs(".", &fsd) != 1)',
|
|---|
| 59 | 'sys/param.h sys/mount.h sys/fs_types.h' )
|
|---|
| 60 | ]
|
|---|
| 61 |
|
|---|
| 62 | found_statfs=False
|
|---|
| 63 | for (define, msg, code, headers) in statfs_types:
|
|---|
| 64 | if conf.CHECK_CODE(code,
|
|---|
| 65 | define=define,
|
|---|
| 66 | headers=headers,
|
|---|
| 67 | msg='Checking for %s' % msg,
|
|---|
| 68 | local_include=False):
|
|---|
| 69 | found_statfs=True
|
|---|
| 70 | break
|
|---|
| 71 |
|
|---|
| 72 | if not found_statfs:
|
|---|
| 73 | print("FATAL: Failed to find a statfs method")
|
|---|
| 74 | raise
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | conf.CHECK_CODE('struct statvfs buf; buf.f_fsid = 0',
|
|---|
| 78 | define='HAVE_FSID_INT',
|
|---|
| 79 | msg='Checking if f_fsid is an integer',
|
|---|
| 80 | execute=False,
|
|---|
| 81 | local_include=False,
|
|---|
| 82 | headers='sys/statvfs.h')
|
|---|
| 83 |
|
|---|
| 84 | # fsusage.c assumes that statvfs has an f_frsize entry. Some weird
|
|---|
| 85 | # systems use f_bsize.
|
|---|
| 86 | conf.CHECK_CODE('struct statvfs buf; buf.f_frsize = 0',
|
|---|
| 87 | define='HAVE_FRSIZE',
|
|---|
| 88 | msg='Checking that statvfs.f_frsize works',
|
|---|
| 89 | headers='sys/statvfs.h',
|
|---|
| 90 | execute=False,
|
|---|
| 91 | local_include=False)
|
|---|
| 92 |
|
|---|
| 93 | # Some systems use f_flag in struct statvfs while others use f_flags
|
|---|
| 94 | conf.CHECK_CODE('struct statvfs buf; buf.f_flag = 0',
|
|---|
| 95 | define='HAVE_STATVFS_F_FLAG',
|
|---|
| 96 | msg='Checking whether statvfs.f_flag exists',
|
|---|
| 97 | headers='sys/statvfs.h',
|
|---|
| 98 | local_include=False,
|
|---|
| 99 | execute=False)
|
|---|
| 100 |
|
|---|
| 101 | conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
|
|---|
| 102 | define='HAVE_STATVFS_F_FLAGS',
|
|---|
| 103 | msg='Checking whether statvfs.f_flags exists',
|
|---|
| 104 | headers='sys/statvfs.h',
|
|---|
| 105 | local_include=False,
|
|---|
| 106 | execute=False)
|
|---|