s4-selftest: add functions which create with desired access
[Samba.git] / lib / util / wscript_configure
bloba1e58011b3f3921f75456505c84783e91f6e3f7c
1 #!/usr/bin/env python
2 import Options
4 if Options.options.disable_fault_handling:
5 conf.DEFINE('HAVE_DISABLE_FAULT_HANDLING',1)
7 # backtrace could be in libexecinfo or in libc
8 conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
10 conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE', headers='sys/statvfs.h')
12 # all the different ways of doing statfs
13 statfs_types = [
14 ( 'STAT_STATVFS',
15 'statvfs (SVR4)',
16 'struct statvfs fsd; exit(statvfs(0, &fsd))',
17 'sys/statvfs.h' ),
19 ( 'STAT_STATFS3_OSF1',
20 '3-argument statfs function (DEC OSF/1)',
21 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd, sizeof(struct statfs)))',
22 'sys/param.h sys/mount.h' ),
24 ( 'STAT_STATFS2_BSIZE',
25 'two-argument statfs with statfs.bsize',
26 'struct statfs fsd; fsd.f_bsize = 0; exit(statfs(".", &fsd))',
27 'sys/param.h sys/mount.h sys/vfs.h' ),
29 ( 'STAT_STATFS4',
30 'four-argument statfs (AIX-3.2.5, SVR3)',
31 'struct statfs fsd; exit(statfs(".", &fsd, sizeof fsd, 0))',
32 'sys/statfs.h' ),
34 ( 'STAT_STATFS2_FSIZE',
35 'two-argument statfs with statfs.fsize',
36 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd))',
37 'sys/param.h sys/mount.h' ),
39 ( 'STAT_STATFS2_FS_DATA',
40 'two-argument statfs with struct fs_data (Ultrix)',
41 'struct fs_data fsd; exit(statfs(".", &fsd) != 1)',
42 'sys/param.h sys/mount.h sys/fs_types.h' )
45 found_statfs=False
46 for (define, msg, code, headers) in statfs_types:
47 if conf.CHECK_CODE(code,
48 define=define,
49 headers=headers,
50 msg='Checking for %s' % msg,
51 local_include=False):
52 found_statfs=True
53 break
55 if not found_statfs:
56 print("FATAL: Failed to find a statfs method")
57 raise
59 conf.CHECK_CODE("""struct statfs fsd;
60 fsd.f_bsize = 0;
61 fsd.f_iosize = 0;
62 return (statfs (".", &fsd));
63 """,
64 headers='sys/param.h sys/mount.h sys/vfs.h',
65 define='BSD_STYLE_STATVFS',
66 msg='Checking for *bsd style statfs with statfs.f_iosize',
67 execute=True,
68 local_include=False)
70 conf.CHECK_CODE('struct statvfs buf; buf.f_fsid = 0',
71 define='HAVE_FSID_INT',
72 msg='Checking if f_fsid is an integer',
73 execute=False,
74 local_include=False,
75 headers='sys/statvfs.h')
77 # fsusage.c assumes that statvfs has an f_frsize entry. Some weird
78 # systems use f_bsize.
79 conf.CHECK_CODE('struct statvfs buf; buf.f_frsize = 0',
80 define='HAVE_FRSIZE',
81 msg='Checking that statvfs.f_frsize works',
82 headers='sys/statvfs.h',
83 execute=False,
84 local_include=False)
86 # Some systems use f_flag in struct statvfs while others use f_flags
87 conf.CHECK_CODE('struct statvfs buf; buf.f_flag = 0',
88 define='HAVE_STATVFS_F_FLAG',
89 msg='Checking whether statvfs.f_flag exists',
90 headers='sys/statvfs.h',
91 local_include=False,
92 execute=False)
94 conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
95 define='HAVE_STATVFS_F_FLAGS',
96 msg='Checking whether statvfs.f_flags exists',
97 headers='sys/statvfs.h',
98 local_include=False,
99 execute=False)
102 # systemd removed the libsystemd-daemon and libsystemd-journal libraries. In newer
103 # versions it is only libsystemd. As waf pkg-config handling does not provide
104 # targets which could be used as a dependency based on the package name we need
105 # to look for them on our own. This enabled one of the library targets based on
106 # which version we detect.
108 conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
109 conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
110 conf.SET_TARGET_TYPE('systemd', 'EMPTY')
112 if Options.options.enable_systemd != False:
113 conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
114 msg='Checking for libsystemd-daemon')
115 if not conf.CHECK_LIB('systemd-daemon', shlib=True):
116 conf.CHECK_LIB('systemd', shlib=True)
118 if Options.options.enable_systemd != False:
119 conf.CHECK_CFG(package='libsystemd-journal', args='--cflags --libs',
120 msg='Checking for libsystemd-journal')
121 if not conf.CHECK_LIB('systemd-journal', shlib=True):
122 conf.CHECK_LIB('systemd', shlib=True)
124 if Options.options.enable_lttng != False:
125 conf.CHECK_CFG(package='lttng-ust', args='--cflags --libs',
126 msg='Checking for lttng-ust', uselib_store="LTTNG-UST")
127 conf.CHECK_HEADERS('lttng/tracef.h', lib='lttng-st')
128 conf.CHECK_LIB('lttng-ust', shlib=True)
130 if (conf.CONFIG_SET('HAVE_LTTNG_TRACEF_H') and
131 conf.CONFIG_SET('HAVE_LTTNG_UST')):
132 conf.DEFINE('HAVE_LTTNG_TRACEF', '1')
133 conf.env['HAVE_LTTNG_TRACEF'] = True
134 else:
135 conf.SET_TARGET_TYPE('lttng-ust', 'EMPTY')
136 conf.undefine('HAVE_LTTNG_TRACEF')
138 conf.env['CPPPATH_GPFS'] = Options.options.gpfs_headers_dir
139 if conf.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
140 conf.DEFINE('HAVE_GPFS', '1')