2016-07-27 01:27:19 +03:00
|
|
|
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
|
|
|
# vim: set filetype=python:
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
# Check for headers defining standard int types.
|
|
|
|
check_header('stdint.h')
|
|
|
|
have_inttypes = check_header('inttypes.h')
|
|
|
|
|
2016-09-15 22:11:11 +03:00
|
|
|
# Assume we have ansi C header files available.
|
|
|
|
set_define('STDC_HEADERS', True)
|
|
|
|
|
2016-07-27 01:27:19 +03:00
|
|
|
set_config('HAVE_INTTYPES_H', have_inttypes)
|
|
|
|
|
|
|
|
building_linux = depends(target)(lambda target: target.kernel == 'Linux')
|
|
|
|
|
|
|
|
have_malloc = check_header('malloc.h')
|
|
|
|
|
2016-08-09 02:58:54 +03:00
|
|
|
check_header('alloca.h')
|
|
|
|
|
2016-07-27 01:27:19 +03:00
|
|
|
add_old_configure_assignment('HAVE_MALLOC_H', have_malloc)
|
|
|
|
|
|
|
|
check_headers(
|
|
|
|
'sys/byteorder.h',
|
|
|
|
'getopt.h',
|
|
|
|
'unistd.h',
|
|
|
|
'nl_types.h',
|
|
|
|
'cpuid.h',
|
2020-02-07 08:17:12 +03:00
|
|
|
'fts.h',
|
2016-07-27 01:27:19 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# These are all the places some variant of statfs can be hiding.
|
|
|
|
check_headers(
|
|
|
|
'sys/statvfs.h',
|
|
|
|
'sys/statfs.h',
|
|
|
|
'sys/vfs.h',
|
|
|
|
'sys/mount.h',
|
|
|
|
)
|
|
|
|
|
|
|
|
# Quota support
|
2018-01-30 22:08:22 +03:00
|
|
|
# Check for both the header and quotactl() because Android headers can have the
|
|
|
|
# header but not quotactl().
|
|
|
|
set_define('HAVE_SYS_QUOTA_H',
|
|
|
|
try_compile(includes=['sys/quota.h'],
|
|
|
|
body='quotactl(0, nullptr, 0, (caddr_t)nullptr);',
|
|
|
|
check_msg='for sys/quota.h'))
|
2016-07-27 01:27:19 +03:00
|
|
|
check_header('linux/quota.h',
|
|
|
|
includes=['sys/socket.h'],
|
|
|
|
when=building_linux)
|
|
|
|
|
|
|
|
# SCTP support - needs various network include headers
|
|
|
|
check_headers(
|
|
|
|
'linux/if_addr.h',
|
|
|
|
'linux/rtnetlink.h',
|
|
|
|
includes=['sys/socket.h'],
|
|
|
|
when=building_linux,
|
|
|
|
)
|
|
|
|
|
2019-02-15 00:45:27 +03:00
|
|
|
check_header('sys/queue.h')
|
2016-07-27 01:27:19 +03:00
|
|
|
|
|
|
|
check_headers(
|
|
|
|
'sys/types.h',
|
|
|
|
'netinet/in.h',
|
|
|
|
'byteswap.h',
|
|
|
|
)
|
2016-09-01 00:29:29 +03:00
|
|
|
|
|
|
|
# TODO: Move these checks to file specific to --enable-project=js.
|
|
|
|
have_perf_event_h = check_header('linux/perf_event.h',
|
|
|
|
when=building_linux)
|
|
|
|
|
|
|
|
js_option('--with-linux-headers',
|
|
|
|
help='location where the Linux kernel headers can be found',
|
|
|
|
nargs=1)
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
passed_linux_header_flags = depends_if(
|
|
|
|
'--with-linux-headers')(lambda v: ['-I%s' % v[0]])
|
|
|
|
|
2016-09-01 00:29:29 +03:00
|
|
|
|
2017-02-01 10:25:29 +03:00
|
|
|
@depends(try_compile(includes=['asm/unistd.h'],
|
|
|
|
body='return sizeof(__NR_perf_event_open);',
|
|
|
|
flags=passed_linux_header_flags,
|
|
|
|
check_msg='for perf_event_open system call'),
|
|
|
|
when=have_perf_event_h)
|
2016-09-01 00:29:29 +03:00
|
|
|
def have_perf_event_open(have_perf_event_open):
|
|
|
|
if have_perf_event_open:
|
|
|
|
return True
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-09-01 00:29:29 +03:00
|
|
|
set_config('HAVE_LINUX_PERF_EVENT_H', have_perf_event_open)
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-09-01 00:29:29 +03:00
|
|
|
@depends(passed_linux_header_flags, have_perf_event_open)
|
|
|
|
def linux_headers_includes(passed_linux_header_flags, have_perf_event_open):
|
|
|
|
if have_perf_event_open and passed_linux_header_flags:
|
|
|
|
return passed_linux_header_flags[0]
|
|
|
|
|
2017-10-12 16:22:59 +03:00
|
|
|
|
2016-09-01 00:29:29 +03:00
|
|
|
set_config('LINUX_HEADERS_INCLUDES', linux_headers_includes)
|