2 from waflib
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')
9 conf
.CHECK_HEADERS('execinfo.h libunwind.h')
11 conf
.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define
='HAVE_FRSIZE', headers
='sys/statvfs.h')
13 # all the different ways of doing statfs
17 'struct statvfs fsd; exit(statvfs(0, &fsd))',
20 ( 'STAT_STATFS3_OSF1',
21 '3-argument statfs function (DEC OSF/1)',
22 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd, sizeof(struct statfs)))',
23 'sys/param.h sys/mount.h' ),
25 ( 'STAT_STATFS2_BSIZE',
26 'two-argument statfs with statfs.bsize',
27 'struct statfs fsd; fsd.f_bsize = 0; exit(statfs(".", &fsd))',
28 'sys/param.h sys/mount.h sys/vfs.h' ),
31 'four-argument statfs (AIX-3.2.5, SVR3)',
32 'struct statfs fsd; exit(statfs(".", &fsd, sizeof fsd, 0))',
35 ( 'STAT_STATFS2_FSIZE',
36 'two-argument statfs with statfs.fsize',
37 'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd))',
38 'sys/param.h sys/mount.h' ),
40 ( 'STAT_STATFS2_FS_DATA',
41 'two-argument statfs with struct fs_data (Ultrix)',
42 'struct fs_data fsd; exit(statfs(".", &fsd) != 1)',
43 'sys/param.h sys/mount.h sys/fs_types.h' )
47 for (define
, msg
, code
, headers
) in statfs_types
:
48 if conf
.CHECK_CODE(code
,
51 msg
='Checking for %s' % msg
,
57 print("FATAL: Failed to find a statfs method")
60 conf
.CHECK_CODE("""struct statfs fsd;
63 return (statfs (".", &fsd));
65 headers
='sys/param.h sys/mount.h sys/vfs.h',
66 define
='BSD_STYLE_STATVFS',
67 msg
='Checking for *bsd style statfs with statfs.f_iosize',
71 conf
.CHECK_CODE('struct statvfs buf; buf.f_fsid = 0',
72 define
='HAVE_FSID_INT',
73 msg
='Checking if f_fsid is an integer',
76 headers
='sys/statvfs.h')
78 # fsusage.c assumes that statvfs has an f_frsize entry. Some weird
79 # systems use f_bsize.
80 conf
.CHECK_CODE('struct statvfs buf; buf.f_frsize = 0',
82 msg
='Checking that statvfs.f_frsize works',
83 headers
='sys/statvfs.h',
87 # Some systems use f_flag in struct statvfs while others use f_flags
88 conf
.CHECK_CODE('struct statvfs buf; buf.f_flag = 0',
89 define
='HAVE_STATVFS_F_FLAG',
90 msg
='Checking whether statvfs.f_flag exists',
91 headers
='sys/statvfs.h',
95 conf
.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
96 define
='HAVE_STATVFS_F_FLAGS',
97 msg
='Checking whether statvfs.f_flags exists',
98 headers
='sys/statvfs.h',
103 # systemd removed the libsystemd-daemon and libsystemd-journal libraries. In newer
104 # versions it is only libsystemd. As waf pkg-config handling does not provide
105 # targets which could be used as a dependency based on the package name we need
106 # to look for them on our own. This enabled one of the library targets based on
107 # which version we detect.
109 conf
.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
110 conf
.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
111 conf
.SET_TARGET_TYPE('systemd', 'EMPTY')
113 if Options
.options
.enable_systemd
!= False:
114 r_daemon
= conf
.CHECK_CFG(package
='libsystemd-daemon', args
='--cflags --libs',
115 msg
='Checking for libsystemd-daemon')
116 r_journal
= conf
.CHECK_CFG(package
='libsystemd-journal', args
='--cflags --libs',
117 msg
='Checking for libsystemd-journal')
118 if r_daemon
is None and r_journal
is None:
119 conf
.CHECK_CFG(package
='libsystemd', args
='--cflags --libs',
120 msg
='Checking for libsystemd')
121 conf
.CHECK_LIB('systemd', shlib
=True)
123 conf
.CHECK_LIB('systemd-daemon', shlib
=True)
124 conf
.CHECK_LIB('systemd-journal', shlib
=True)
126 conf
.SET_TARGET_TYPE('lttng-ust', 'EMPTY')
128 if Options
.options
.enable_lttng
!= False:
129 conf
.CHECK_CFG(package
='lttng-ust', args
='--cflags --libs',
130 msg
='Checking for lttng-ust', uselib_store
="LTTNG-UST")
131 conf
.CHECK_HEADERS('lttng/tracef.h', lib
='lttng-st')
132 conf
.CHECK_LIB('lttng-ust', shlib
=True)
134 if (conf
.CONFIG_SET('HAVE_LTTNG_TRACEF_H') and
135 conf
.CONFIG_SET('HAVE_LTTNG_UST')):
136 conf
.DEFINE('HAVE_LTTNG_TRACEF', '1')
137 conf
.env
['HAVE_LTTNG_TRACEF'] = True
139 conf
.env
['CPPPATH_GPFS'] = Options
.options
.gpfs_headers_dir
140 if conf
.CHECK_HEADERS('gpfs.h', False, False, "gpfs"):
141 conf
.DEFINE('HAVE_GPFS', '1')