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