Bug 1837620 - Part 1.5: Rename IC flag to 'mayHaveFoldedStub' to make it clear that...
[gecko.git] / build / moz.configure / headers.configure
blob5332c7365fb279a360c9f18a8fab6197cb8b3f50
1 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
2 # vim: set filetype=python:
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 # Check for headers defining standard int types.
8 check_header("stdint.h")
9 have_inttypes = check_header("inttypes.h")
11 # Assume we have ansi C header files available.
12 set_define("STDC_HEADERS", True)
14 set_config("HAVE_INTTYPES_H", have_inttypes)
16 building_linux = depends(target)(lambda target: target.kernel == "Linux")
18 have_malloc = check_header("malloc.h")
20 check_header("alloca.h")
22 add_old_configure_assignment("HAVE_MALLOC_H", have_malloc)
24 check_headers(
25     "sys/byteorder.h",
26     "getopt.h",
27     "unistd.h",
28     "nl_types.h",
29     "cpuid.h",
30     "fts.h",
33 # These are all the places some variant of statfs can be hiding.
34 check_headers(
35     "sys/statvfs.h",
36     "sys/statfs.h",
37     "sys/vfs.h",
38     "sys/mount.h",
41 # Quota support
42 # Check for both the header and quotactl() because Android headers can have the
43 # header but not quotactl().
44 set_define(
45     "HAVE_SYS_QUOTA_H",
46     try_compile(
47         includes=["sys/quota.h"],
48         body="quotactl(0, nullptr, 0, (caddr_t)nullptr);",
49         check_msg="for sys/quota.h",
50     ),
52 check_header("linux/quota.h", includes=["sys/socket.h"], when=building_linux)
54 # SCTP support - needs various network include headers
55 check_headers(
56     "linux/if_addr.h",
57     "linux/rtnetlink.h",
58     includes=["sys/socket.h"],
59     when=building_linux,
62 check_header("sys/queue.h")
64 check_headers(
65     "sys/types.h",
66     "netinet/in.h",
67     "byteswap.h",
70 # memfd_create(2) -- Note that older versions of the Linux man-pages
71 # project incorrectly cite <sys/memfd.h>, which doesn't exist; this
72 # was fixed in the man-pages-5.00 release.
73 set_define(
74     "HAVE_MEMFD_CREATE",
75     try_compile(
76         includes=["sys/mman.h"],
77         body='memfd_create("", 0);',
78         check_msg="for memfd_create in sys/mman.h",
79     ),
82 # TODO: Move these checks to file specific to --enable-project=js.
83 have_perf_event_h = check_header("linux/perf_event.h", when=building_linux)
85 option(
86     "--with-linux-headers",
87     help="location where the Linux kernel headers can be found",
88     nargs=1,
91 passed_linux_header_flags = depends_if("--with-linux-headers")(
92     lambda v: ["-I%s" % v[0]]
96 @depends(
97     try_compile(
98         includes=["asm/unistd.h"],
99         body="return sizeof(__NR_perf_event_open);",
100         flags=passed_linux_header_flags,
101         check_msg="for perf_event_open system call",
102     ),
103     when=have_perf_event_h,
105 def have_perf_event_open(have_perf_event_open):
106     if have_perf_event_open:
107         return True
110 set_config("HAVE_LINUX_PERF_EVENT_H", have_perf_event_open)
113 @depends(passed_linux_header_flags, have_perf_event_open)
114 def linux_headers_includes(passed_linux_header_flags, have_perf_event_open):
115     if have_perf_event_open and passed_linux_header_flags:
116         return passed_linux_header_flags[0]
119 set_config("LINUX_HEADERS_INCLUDES", linux_headers_includes)