2 # Check if glibc provided sys/mount.h can be used along related kernel
4 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
5 # This file is part of the GNU C Library.
7 # The GNU C Library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # The GNU C Library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with the GNU C Library; if not, see
19 # <https://www.gnu.org/licenses/>.
28 """The main entry point."""
29 parser
= argparse
.ArgumentParser(
30 description
='Check if glibc provided sys/mount.h can be '
31 ' used along related kernel headers.')
32 parser
.add_argument('--cc', metavar
='CC',
33 help='C compiler (including options) to use')
34 args
= parser
.parse_args()
36 if glibcextract
.compile_c_snippet(
37 '#include <linux/mount.h>',
38 args
.cc
).returncode
!= 0:
41 def check(testname
, snippet
):
42 # Add -Werror to catch macro redefinitions and _ISOMAC to avoid
43 # internal glibc definitions.
44 r
= glibcextract
.compile_c_snippet(snippet
, args
.cc
,
47 print('error: test {}:\n{}'.format(testname
, r
.output
.decode()))
51 check("sys/mount.h + linux/mount.h",
52 "#include <sys/mount.h>\n"
53 "#include <linux/mount.h>"),
54 check("sys/mount.h + linux/fs.h",
55 "#include <sys/mount.h>\n"
56 "#include <linux/fs.h>"),
57 check("linux/mount.h + sys/mount.h",
58 "#include <linux/mount.h>\n"
59 "#include <sys/mount.h>"),
60 check("linux/fs.h + sys/mount.h",
61 "#include <linux/fs.h>\n"
62 "#include <sys/mount.h>"))
65 if __name__
== '__main__':