[llvm] [cmake] Hardcode some `check_include_file` checks (PR #104706)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 15 09:18:06 PST 2025


================
@@ -17,6 +17,124 @@ include(CheckCompilerVersion)
 include(CheckProblematicConfigurations)
 include(HandleLLVMStdlib)
 
+if (ANDROID OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Haiku|Linux|NetBSD|OpenBSD|SunOS")
+  set(HAVE_DLFCN_H 1)
+  set(HAVE_ERRNO_H 1)
+  set(HAVE_FCNTL_H 1)
+  set(HAVE_FENV_H 1)
+  set(HAVE_MACH_MACH_H 0)
+  set(HAVE_MALLOC_MALLOC_H 0)
+  set(HAVE_PTHREAD_H 1)
+  set(HAVE_SIGNAL_H 1)
+  set(HAVE_SYS_IOCTL_H 1)
+  set(HAVE_SYS_MMAN_H 1)
+  set(HAVE_SYS_PARAM_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
+  set(HAVE_SYS_STAT_H 1)
+  set(HAVE_SYS_TIME_H 1)
+  set(HAVE_SYS_TYPES_H 1)
+  set(HAVE_SYSEXITS_H 1)
+  set(HAVE_TERMIOS_H 1)
+  set(HAVE_UNISTD_H 1)
+elseif (CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CYGWIN)
+  set(HAVE_DLFCN_H 1)
+  set(HAVE_ERRNO_H 1)
+  set(HAVE_FCNTL_H 1)
+  set(HAVE_FENV_H 1)
+  set(HAVE_MACH_MACH_H 0)
+  set(HAVE_MALLOC_MALLOC_H 0)
+  set(HAVE_PTHREAD_H 1)
+  set(HAVE_SIGNAL_H 1)
+  set(HAVE_SYS_IOCTL_H 1)
+  set(HAVE_SYS_MMAN_H 1)
+  set(HAVE_SYS_PARAM_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
+  set(HAVE_SYS_STAT_H 1)
+  set(HAVE_SYS_TIME_H 1)
+  set(HAVE_SYS_TYPES_H 1)
+  set(HAVE_SYSEXITS_H 1)
+  set(HAVE_TERMIOS_H 1)
+  set(HAVE_UNISTD_H 1)
+elseif (APPLE)
+  set(HAVE_DLFCN_H 1)
+  set(HAVE_ERRNO_H 1)
+  set(HAVE_FCNTL_H 1)
+  set(HAVE_FENV_H 1)
+  set(HAVE_MACH_MACH_H 1)
+  set(HAVE_MALLOC_MALLOC_H 1)
+  set(HAVE_PTHREAD_H 1)
+  set(HAVE_SIGNAL_H 1)
+  set(HAVE_SYS_IOCTL_H 1)
+  set(HAVE_SYS_MMAN_H 1)
+  set(HAVE_SYS_PARAM_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
+  set(HAVE_SYS_STAT_H 1)
+  set(HAVE_SYS_TIME_H 1)
+  set(HAVE_SYS_TYPES_H 1)
+  set(HAVE_SYSEXITS_H 1)
+  set(HAVE_TERMIOS_H 1)
+  set(HAVE_UNISTD_H 1)
+elseif (PURE_WINDOWS)
+  set(HAVE_DLFCN_H 0)
+  set(HAVE_ERRNO_H 1)
+  set(HAVE_FCNTL_H 1)
+  set(HAVE_FENV_H 1)
+  set(HAVE_MACH_MACH_H 0)
+  set(HAVE_MALLOC_MALLOC_H 0)
+  set(HAVE_PTHREAD_H 0)
+  set(HAVE_SIGNAL_H 1)
+  set(HAVE_SYS_IOCTL_H 0)
+  set(HAVE_SYS_MMAN_H 0)
+  set(HAVE_SYS_PARAM_H 0)
+  set(HAVE_SYS_RESOURCE_H 0)
+  set(HAVE_SYS_STAT_H 1)
+  set(HAVE_SYS_TIME_H 0)
+  set(HAVE_SYS_TYPES_H 1)
----------------
MaskRay wrote:

`HAVE_SYS_TYPES_H` is no longer used and can be deleted everywhere

https://github.com/llvm/llvm-project/pull/104706


More information about the llvm-commits mailing list