[llvm] [CMake] Test more things under -D_GNU_SOURCE (PR #116640)
Raul Tambre via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 03:41:10 PST 2024
================
@@ -40,6 +40,21 @@ if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
endif()
+check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
+if(LLVM_USING_GLIBC)
+ # Newer POSIX functions aren't available without the appropriate defines.
----------------
tambry wrote:
I've the changed the comment and commit.
While surprisingly this does affect `HAVE_PERFMON_PERF_EVENT_H` that's not really the point. I'd rather have it there to avoid us accidentally regressing for newly introduced checks due to them being placed before it.
FYI `HAVE_PERFMON_PERF_EVENT_H` example:
```
[1/2] /usr/bin/cc -O3 -DNDEBUG -MD -MT CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o -MF CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o.d -o CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o -c /home/tambre/dev/llvm/build/CMakeFiles/CMakeScratch/TryCompile-rdhBLT/CheckIncludeFile.c
FAILED: CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o
/usr/bin/cc -O3 -DNDEBUG -MD -MT CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o -MF CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o.d -o CMakeFiles/cmTC_38507.dir/CheckIncludeFile.c.o -c /home/tambre/dev/llvm/build/CMakeFiles/CMakeScratch/TryCompile-rdhBLT/CheckIncludeFile.c
In file included from /home/tambre/dev/llvm/build/CMakeFiles/CMakeScratch/TryCompile-rdhBLT/CheckIncludeFile.c:1:
/usr/include/perfmon/perf_event.h:604:9: error: use of undeclared identifier 'syscall'
604 | return syscall(
| ^
1 error generated.
ninja: build stopped: subcommand failed.
```
https://github.com/llvm/llvm-project/pull/116640
More information about the llvm-commits
mailing list