1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/lib/util/wscript_configure

144 lines
5.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env python
import Options
if Options.options.disable_fault_handling:
conf.DEFINE('HAVE_DISABLE_FAULT_HANDLING',1)
2010-03-07 06:07:32 +03:00
# backtrace could be in libexecinfo or in libc
conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h')
2010-03-07 07:19:27 +03:00
conf.CHECK_FUNCS('sigprocmask sigblock sigaction')
2010-03-07 08:05:19 +03:00
conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE', headers='sys/statvfs.h')
2010-03-07 16:06:53 +03:00
# all the different ways of doing statfs
statfs_types = [
( 'STAT_STATVFS',
'statvfs (SVR4)',
'struct statvfs fsd; exit(statvfs(0, &fsd))',
'sys/statvfs.h' ),
( 'STAT_STATFS3_OSF1',
'3-argument statfs function (DEC OSF/1)',
'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd, sizeof(struct statfs)))',
'sys/param.h sys/mount.h' ),
( 'STAT_STATFS2_BSIZE',
'two-argument statfs with statfs.bsize',
'struct statfs fsd; fsd.f_bsize = 0; exit(statfs(".", &fsd))',
'sys/param.h sys/mount.h sys/vfs.h' ),
( 'STAT_STATFS4',
'four-argument statfs (AIX-3.2.5, SVR3)',
'struct statfs fsd; exit(statfs(".", &fsd, sizeof fsd, 0))',
'sys/statfs.h' ),
( 'STAT_STATFS2_FSIZE',
'two-argument statfs with statfs.fsize',
'struct statfs fsd; fsd.f_fsize = 0; exit(statfs(".", &fsd))',
'sys/param.h sys/mount.h' ),
( 'STAT_STATFS2_FS_DATA',
'two-argument statfs with struct fs_data (Ultrix)',
'struct fs_data fsd; exit(statfs(".", &fsd) != 1)',
'sys/param.h sys/mount.h sys/fs_types.h' )
]
found_statfs=False
for (define, msg, code, headers) in statfs_types:
if conf.CHECK_CODE(code,
define=define,
headers=headers,
msg='Checking for %s' % msg,
local_include=False):
found_statfs=True
break
if not found_statfs:
print("FATAL: Failed to find a statfs method")
raise
conf.CHECK_CODE("""struct statfs fsd;
fsd.f_bsize = 0;
fsd.f_iosize = 0;
return (statfs (".", &fsd));
""",
headers='sys/param.h sys/mount.h sys/vfs.h',
define='BSD_STYLE_STATVFS',
msg='Checking for *bsd style statfs with statfs.f_iosize',
execute=True,
local_include=False)
conf.CHECK_CODE('struct statvfs buf; buf.f_fsid = 0',
define='HAVE_FSID_INT',
msg='Checking if f_fsid is an integer',
execute=False,
local_include=False,
headers='sys/statvfs.h')
# fsusage.c assumes that statvfs has an f_frsize entry. Some weird
# systems use f_bsize.
conf.CHECK_CODE('struct statvfs buf; buf.f_frsize = 0',
define='HAVE_FRSIZE',
msg='Checking that statvfs.f_frsize works',
headers='sys/statvfs.h',
execute=False,
local_include=False)
# Some systems use f_flag in struct statvfs while others use f_flags
conf.CHECK_CODE('struct statvfs buf; buf.f_flag = 0',
define='HAVE_STATVFS_F_FLAG',
msg='Checking whether statvfs.f_flag exists',
headers='sys/statvfs.h',
local_include=False,
execute=False)
conf.CHECK_CODE('struct statvfs buf; buf.f_flags = 0',
define='HAVE_STATVFS_F_FLAGS',
msg='Checking whether statvfs.f_flags exists',
headers='sys/statvfs.h',
local_include=False,
execute=False)
if Options.options.enable_systemd != False:
conf.CHECK_CFG(package='libsystemd-daemon', args='--cflags --libs',
msg='Checking for libsystemd-daemon', uselib_store="SYSTEMD-DAEMON")
conf.CHECK_HEADERS('systemd/sd-daemon.h', lib='systemd-daemon')
conf.CHECK_LIB('systemd-daemon', shlib=True)
if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_DAEMON_H') and
conf.CONFIG_SET('HAVE_LIBSYSTEMD_DAEMON')):
conf.DEFINE('HAVE_SYSTEMD', '1')
conf.env['ENABLE_SYSTEMD'] = True
else:
conf.SET_TARGET_TYPE('systemd-daemon', 'EMPTY')
conf.undefine('HAVE_SYSTEMD')
if Options.options.enable_systemd != False:
conf.check_cfg(package='libsystemd-journal', args='--cflags --libs',
msg='Checking for libsystemd-journal',
uselib_store="SYSTEMD-JOURNAL")
conf.CHECK_HEADERS('systemd/sd-journal.h', lib='systemd-journal')
conf.CHECK_LIB('systemd-journal', shlib=True)
if (conf.CONFIG_SET('HAVE_SYSTEMD_SD_JOURNAL_H') and
conf.CONFIG_SET('HAVE_LIBSYSTEMD_JOURNAL')):
conf.DEFINE('HAVE_SYSTEMD_JOURNAL', '1')
else:
conf.SET_TARGET_TYPE('systemd-journal', 'EMPTY')
conf.undefine('HAVE_SYSTEMD_JOURNAL')
if Options.options.enable_lttng != False:
conf.check_cfg(package='lttng-ust', args='--cflags --libs',
msg='Checking for lttng-ust', uselib_store="LTTNG-UST")
conf.CHECK_HEADERS('lttng/tracef.h', lib='lttng-st')
conf.CHECK_LIB('lttng-ust', shlib=True)
if (conf.CONFIG_SET('HAVE_LTTNG_TRACEF_H') and
conf.CONFIG_SET('HAVE_LTTNG_UST')):
conf.DEFINE('HAVE_LTTNG_TRACEF', '1')
conf.env['HAVE_LTTNG_TRACEF'] = True
else:
conf.SET_TARGET_TYPE('lttng-ust', 'EMPTY')
conf.undefine('HAVE_LTTNG_TRACEF')