From a92b98bfa4e988ec4a4af08e7023f56485b38b40 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 18 Aug 2024 14:46:27 +0300 Subject: [PATCH 01/11] Header-centric implementation --- llvm/cmake/config-ix.cmake | 129 ++++++++++++++++++++++++++++++------- 1 file changed, 106 insertions(+), 23 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 0aae13e30f2ab..fd90309723c96 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -3,6 +3,34 @@ if( WIN32 AND NOT CYGWIN ) set(PURE_WINDOWS 1) endif() +if (CMAKE_SYSTEM_NAME STREQUAL "AIX") + set(AIX 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + set(FREEBSD 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Haiku") + set(HAIKU 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(LINUX 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + set(NETBSD 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") + set(OPENBSD 1) +endif() + +if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") + set(SOLARIS 1) +endif() + include(CheckIncludeFile) include(CheckLibraryExists) include(CheckSymbolExists) @@ -17,6 +45,8 @@ include(CheckCompilerVersion) include(CheckProblematicConfigurations) include(HandleLLVMStdlib) +check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) + if( UNIX AND NOT (APPLE OR BEOS OR HAIKU) ) # Used by check_symbol_exists: list(APPEND CMAKE_REQUIRED_LIBRARIES "m") @@ -40,28 +70,83 @@ if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") endif() -# include checks -check_include_file(dlfcn.h HAVE_DLFCN_H) -check_include_file(errno.h HAVE_ERRNO_H) -check_include_file(fcntl.h HAVE_FCNTL_H) -check_include_file(link.h HAVE_LINK_H) -check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) -if( NOT PURE_WINDOWS ) - check_include_file(pthread.h HAVE_PTHREAD_H) -endif() -check_include_file(signal.h HAVE_SIGNAL_H) -check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) -check_include_file(sys/mman.h HAVE_SYS_MMAN_H) -check_include_file(sys/param.h HAVE_SYS_PARAM_H) -check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(sysexits.h HAVE_SYSEXITS_H) -check_include_file(termios.h HAVE_TERMIOS_H) -check_include_file(unistd.h HAVE_UNISTD_H) +if (AIX OR ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_DLFCN_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_ERRNO_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR HAIKU OR FREEBSD OR LINUX OR SOLARIS) + set(HAVE_FCNTL_H 1) +endif() + +if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_FENV_H 1) +endif() + +if (ANDROID OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_LINK_H 1) +endif() + +if (APPLE OR LLVM_USING_GLIBC) + set(HAVE_MACH_MACH_H 1) +endif() + +if (APPLE OR LLVM_USING_GLIBC) + set(HAVE_MALLOC_MALLOC_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR OPENBSD OR SOLARIS) + set(HAVE_PTHREAD_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_SIGNAL_H 1) +endif() + +if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_SYS_IOCTL_H 1) +endif() + +if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_SYS_MMAN_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_SYS_PARAM_H 1) +endif() + +if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_SYS_RESOURCE_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_SYS_STAT_H 1) +endif() + +if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_SYS_TIME_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_SYS_TYPES_H 1) +endif() + +if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) + set(HAVE_SYSEXITS_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR SOLARIS) + set(HAVE_TERMIOS_H 1) +endif() + +if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) + set(HAVE_UNISTD_H 1) +endif() + check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) -check_include_file(fenv.h HAVE_FENV_H) check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT) check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT) check_c_source_compiles(" @@ -76,7 +161,6 @@ check_c_source_compiles(" int main(void) { return 0; }" HAVE_BUILTIN_THREAD_POINTER) -check_include_file(mach/mach.h HAVE_MACH_MACH_H) check_include_file(CrashReporterClient.h HAVE_CRASHREPORTERCLIENT_H) if(APPLE) check_c_source_compiles(" @@ -339,7 +423,6 @@ else() "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) endif() -check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) if( LLVM_USING_GLIBC ) add_compile_definitions(_GNU_SOURCE) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") From 0d468fdb9c92944b621cee14b25b8925be231328 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 18 Aug 2024 16:03:02 +0300 Subject: [PATCH 02/11] Move to platform-centric approach --- llvm/cmake/config-ix.cmake | 201 +++++++++++++++++++++++-------------- 1 file changed, 126 insertions(+), 75 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index fd90309723c96..a10082cedac24 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -7,6 +7,10 @@ if (CMAKE_SYSTEM_NAME STREQUAL "AIX") set(AIX 1) endif() +if (CMAKE_SYSTEM_NAME STREQUAL "DragonFly") + set(DRAGONFLY 1) +endif() + if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set(FREEBSD 1) endif() @@ -47,103 +51,150 @@ include(HandleLLVMStdlib) check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) -if( UNIX AND NOT (APPLE OR BEOS OR HAIKU) ) - # Used by check_symbol_exists: - list(APPEND CMAKE_REQUIRED_LIBRARIES "m") -endif() -# x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly. -if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND - CMAKE_SIZEOF_VOID_P EQUAL 8 ) - list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt") -endif() - -# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build -# with those too. -if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") - list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700") - list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API") -endif() - -# Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build -# with those too. -if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") -endif() - -if (AIX OR ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) +if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_DLFCN_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_ERRNO_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR HAIKU OR FREEBSD OR LINUX OR SOLARIS) set(HAVE_FCNTL_H 1) -endif() - -if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_FENV_H 1) -endif() - -if (ANDROID OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) set(HAVE_LINK_H 1) -endif() - -if (APPLE OR LLVM_USING_GLIBC) + 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 (AIX) + set(HAVE_DLFCN_H 1) + set(HAVE_ERRNO_H 1) + set(HAVE_FCNTL_H 1) + set(HAVE_FENV_H 0) + set(HAVE_LINK_H 0) + 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 0) + set(HAVE_SYS_MMAN_H 0) + set(HAVE_SYS_PARAM_H 1) + set(HAVE_SYS_RESOURCE_H 0) + set(HAVE_SYS_STAT_H 1) + set(HAVE_SYS_TIME_H 0) + set(HAVE_SYS_TYPES_H 1) + set(HAVE_SYSEXITS_H 0) + 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_LINK_H 0) set(HAVE_MACH_MACH_H 1) -endif() - -if (APPLE OR LLVM_USING_GLIBC) set(HAVE_MALLOC_MALLOC_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR OPENBSD OR SOLARIS) set(HAVE_PTHREAD_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_SIGNAL_H 1) -endif() - -if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) set(HAVE_SYS_IOCTL_H 1) -endif() - -if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_SYS_MMAN_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) set(HAVE_SYS_PARAM_H 1) -endif() - -if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_SYS_RESOURCE_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_SYS_STAT_H 1) -endif() - -if (ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) set(HAVE_SYS_TIME_H 1) -endif() - -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_SYS_TYPES_H 1) + set(HAVE_SYSEXITS_H 1) + set(HAVE_TERMIOS_H 1) + set(HAVE_UNISTD_H 1) +elseif (CYGWIN) + set(HAVE_DLFCN_H 1) + set(HAVE_ERRNO_H 1) + set(HAVE_FCNTL_H 1) + set(HAVE_FENV_H 1) + set(HAVE_LINK_H 0) + 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 (PURE_WINDOWS) + set(HAVE_DLFCN_H 0) + set(HAVE_ERRNO_H 1) + set(HAVE_FCNTL_H 1) + set(HAVE_FENV_H 1) + set(HAVE_LINK_H 0) + 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) + set(HAVE_SYSEXITS_H 0) + set(HAVE_TERMIOS_H 0) +else() + # Other platforms that we don't promise support for. + # Notable exception is z/OS, which can't be detected via CMAKE_SYSTEM_NAME. + check_include_file(dlfcn.h HAVE_DLFCN_H) + check_include_file(errno.h HAVE_ERRNO_H) + check_include_file(fcntl.h HAVE_FCNTL_H) + check_include_file(fenv.h HAVE_FENV_H) + check_include_file(link.h HAVE_LINK_H) + check_include_file(mach/mach.h HAVE_MACH_MACH_H) + check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) + check_include_file(pthread.h HAVE_PTHREAD_H) + check_include_file(signal.h HAVE_SIGNAL_H) + check_include_file(sys/ioctl.h HAVE_SYS_IOCTL_H) + check_include_file(sys/mman.h HAVE_SYS_MMAN_H) + check_include_file(sys/param.h HAVE_SYS_PARAM_H) + check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) + check_include_file(sys/stat.h HAVE_SYS_STAT_H) + check_include_file(sys/time.h HAVE_SYS_TIME_H) + check_include_file(sys/types.h HAVE_SYS_TYPES_H) + check_include_file(sysexits.h HAVE_SYSEXITS_H) + check_include_file(termios.h HAVE_TERMIOS_H) + check_include_file(unistd.h HAVE_UNISTD_H) endif() -if (ANDROID OR APPLE OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD) - set(HAVE_SYSEXITS_H 1) +if( UNIX AND NOT (APPLE OR BEOS OR HAIKU) ) + # Used by check_symbol_exists: + list(APPEND CMAKE_REQUIRED_LIBRARIES "m") +endif() +# x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly. +if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND + CMAKE_SIZEOF_VOID_P EQUAL 8 ) + list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt") endif() -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR SOLARIS) - set(HAVE_TERMIOS_H 1) +# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build +# with those too. +if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700") + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API") endif() -if (AIX OR ANDROID OR APPLE OR CYGWIN OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) - set(HAVE_UNISTD_H 1) +# Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build +# with those too. +if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") endif() check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H) From 31f51e44ba737bbdc22ccd2ef6d1a08c781095ba Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Sun, 18 Aug 2024 16:49:12 +0300 Subject: [PATCH 03/11] Move `LLVM_USING_GLIBC` back --- llvm/cmake/config-ix.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index a10082cedac24..8ded6939b94d2 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -49,8 +49,6 @@ include(CheckCompilerVersion) include(CheckProblematicConfigurations) include(HandleLLVMStdlib) -check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) - if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) set(HAVE_DLFCN_H 1) set(HAVE_ERRNO_H 1) @@ -474,6 +472,7 @@ else() "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) endif() +check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC) if( LLVM_USING_GLIBC ) add_compile_definitions(_GNU_SOURCE) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") From 25c080a54a057073420b86535de2c218c3e011b4 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Mon, 19 Aug 2024 23:36:53 +0300 Subject: [PATCH 04/11] Add z/OS values --- llvm/cmake/config-ix.cmake | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 8ded6939b94d2..9932eac55d04b 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -27,6 +27,12 @@ if (CMAKE_SYSTEM_NAME STREQUAL "NetBSD") set(NETBSD 1) endif() +# Confirmed in +# https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297153534 +if (CMAKE_SYSTEM_NAME MATCHES "OS390") + set(ZOS 1) +endif() + if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") set(OPENBSD 1) endif() @@ -148,9 +154,30 @@ elseif (PURE_WINDOWS) set(HAVE_SYS_TYPES_H 1) set(HAVE_SYSEXITS_H 0) set(HAVE_TERMIOS_H 0) +elseif (ZOS) + # Confirmed in + # https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297109613 + set(HAVE_DLFCN_H 1) + set(HAVE_ERRNO_H 1) + set(HAVE_FCNTL_H 1) + set(HAVE_FENV_H 1) + set(HAVE_LINK_H 0) + 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 0) + 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 0) + set(HAVE_TERMIOS_H 1) + set(HAVE_UNISTD_H 1) else() # Other platforms that we don't promise support for. - # Notable exception is z/OS, which can't be detected via CMAKE_SYSTEM_NAME. check_include_file(dlfcn.h HAVE_DLFCN_H) check_include_file(errno.h HAVE_ERRNO_H) check_include_file(fcntl.h HAVE_FCNTL_H) From d226369c7bebfe4b432043f030131a96f5fb6850 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 20 Aug 2024 14:50:58 +0300 Subject: [PATCH 05/11] Adjust AIX values --- llvm/cmake/config-ix.cmake | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 9932eac55d04b..e394e63b8be09 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -75,36 +75,16 @@ if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SO set(HAVE_SYSEXITS_H 1) set(HAVE_TERMIOS_H 1) set(HAVE_UNISTD_H 1) -elseif (AIX) +elseif (AIX OR CYGWIN) set(HAVE_DLFCN_H 1) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) - set(HAVE_FENV_H 0) + set(HAVE_FENV_H 1) set(HAVE_LINK_H 0) 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 0) - set(HAVE_SYS_MMAN_H 0) - set(HAVE_SYS_PARAM_H 1) - set(HAVE_SYS_RESOURCE_H 0) - set(HAVE_SYS_STAT_H 1) - set(HAVE_SYS_TIME_H 0) - set(HAVE_SYS_TYPES_H 1) - set(HAVE_SYSEXITS_H 0) - 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_LINK_H 0) - 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) @@ -115,14 +95,14 @@ elseif (APPLE) set(HAVE_SYSEXITS_H 1) set(HAVE_TERMIOS_H 1) set(HAVE_UNISTD_H 1) -elseif (CYGWIN) +elseif (APPLE) set(HAVE_DLFCN_H 1) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) set(HAVE_LINK_H 0) - set(HAVE_MACH_MACH_H 0) - set(HAVE_MALLOC_MALLOC_H 0) + 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) From 82bcfdb79de1234ca7d6346ec0f43ef904c8341f Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Tue, 20 Aug 2024 14:51:51 +0300 Subject: [PATCH 06/11] Don't define ZOS --- llvm/cmake/config-ix.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index e394e63b8be09..37c5a2975185a 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -27,12 +27,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "NetBSD") set(NETBSD 1) endif() -# Confirmed in -# https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297153534 -if (CMAKE_SYSTEM_NAME MATCHES "OS390") - set(ZOS 1) -endif() - if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") set(OPENBSD 1) endif() From b25fbf6fb6ecce9d1f6071ab45034c49bc623964 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 21 Aug 2024 16:46:06 +0300 Subject: [PATCH 07/11] Remove `HAVE_LINK_H` --- llvm/cmake/config-ix.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 37c5a2975185a..17590fb45ecd5 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -54,7 +54,6 @@ if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SO set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) - set(HAVE_LINK_H 1) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 1) @@ -74,7 +73,6 @@ elseif (AIX OR CYGWIN) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) - set(HAVE_LINK_H 0) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 1) @@ -94,7 +92,6 @@ elseif (APPLE) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) - set(HAVE_LINK_H 0) set(HAVE_MACH_MACH_H 1) set(HAVE_MALLOC_MALLOC_H 1) set(HAVE_PTHREAD_H 1) @@ -114,7 +111,6 @@ elseif (PURE_WINDOWS) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) - set(HAVE_LINK_H 0) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 0) @@ -135,7 +131,6 @@ elseif (ZOS) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) set(HAVE_FENV_H 1) - set(HAVE_LINK_H 0) set(HAVE_MACH_MACH_H 0) set(HAVE_MALLOC_MALLOC_H 0) set(HAVE_PTHREAD_H 1) @@ -156,7 +151,6 @@ else() check_include_file(errno.h HAVE_ERRNO_H) check_include_file(fcntl.h HAVE_FCNTL_H) check_include_file(fenv.h HAVE_FENV_H) - check_include_file(link.h HAVE_LINK_H) check_include_file(mach/mach.h HAVE_MACH_MACH_H) check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) check_include_file(pthread.h HAVE_PTHREAD_H) From 4ebf4aca0e2e693825d780c9b87f089aca98c9fb Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 21 Aug 2024 16:54:33 +0300 Subject: [PATCH 08/11] Inline checks for `CMAKE_SYSTEM_NAME` --- llvm/cmake/config-ix.cmake | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 17590fb45ecd5..ee79ebd3512e6 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -3,38 +3,6 @@ if( WIN32 AND NOT CYGWIN ) set(PURE_WINDOWS 1) endif() -if (CMAKE_SYSTEM_NAME STREQUAL "AIX") - set(AIX 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "DragonFly") - set(DRAGONFLY 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") - set(FREEBSD 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "Haiku") - set(HAIKU 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(LINUX 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "NetBSD") - set(NETBSD 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") - set(OPENBSD 1) -endif() - -if (CMAKE_SYSTEM_NAME STREQUAL "SunOS") - set(SOLARIS 1) -endif() - include(CheckIncludeFile) include(CheckLibraryExists) include(CheckSymbolExists) @@ -49,7 +17,7 @@ include(CheckCompilerVersion) include(CheckProblematicConfigurations) include(HandleLLVMStdlib) -if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SOLARIS) +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) @@ -68,7 +36,7 @@ if (ANDROID OR DRAGONFLY OR FREEBSD OR HAIKU OR LINUX OR NETBSD OR OPENBSD OR SO set(HAVE_SYSEXITS_H 1) set(HAVE_TERMIOS_H 1) set(HAVE_UNISTD_H 1) -elseif (AIX OR CYGWIN) +elseif (CMAKE_SYSTEM_NAME STREQUAL "AIX" OR CYGWIN) set(HAVE_DLFCN_H 1) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) From d5478cf0e3c4e7757ad52020981a2c82e4c40cdd Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 15 Jan 2025 21:37:15 +0400 Subject: [PATCH 09/11] Fill in UNISTD_H for PURE_WINDOWS --- llvm/cmake/config-ix.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 05944d7d09f63..73101a8444ba3 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -92,6 +92,7 @@ elseif (PURE_WINDOWS) set(HAVE_SYS_TYPES_H 1) set(HAVE_SYSEXITS_H 0) set(HAVE_TERMIOS_H 0) + set(HAVE_UNISTD_H 0) elseif (ZOS) # Confirmed in # https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297109613 From 51278c19a5d7b6ffbb715e2dd222d9e5b4032829 Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 15 Jan 2025 21:37:40 +0400 Subject: [PATCH 10/11] Merge AIX and Cygwin with the majority of platforms --- llvm/cmake/config-ix.cmake | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 73101a8444ba3..abef1a8b32660 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -17,26 +17,7 @@ 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) +if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|Linux|NetBSD|OpenBSD|SunOS") set(HAVE_DLFCN_H 1) set(HAVE_ERRNO_H 1) set(HAVE_FCNTL_H 1) From 43dfb842c97d45cfb855c2ae7c5da443dc703f5e Mon Sep 17 00:00:00 2001 From: Vlad Serebrennikov Date: Wed, 15 Jan 2025 22:01:01 +0400 Subject: [PATCH 11/11] Factor in recent clean-up by MaskRay --- llvm/cmake/config-ix.cmake | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index abef1a8b32660..38f339d17c852 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -19,9 +19,6 @@ include(HandleLLVMStdlib) if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|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) @@ -32,15 +29,11 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku| 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) @@ -51,15 +44,11 @@ elseif (APPLE) 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) @@ -70,7 +59,6 @@ elseif (PURE_WINDOWS) set(HAVE_SYS_RESOURCE_H 0) set(HAVE_SYS_STAT_H 1) set(HAVE_SYS_TIME_H 0) - set(HAVE_SYS_TYPES_H 1) set(HAVE_SYSEXITS_H 0) set(HAVE_TERMIOS_H 0) set(HAVE_UNISTD_H 0) @@ -78,9 +66,6 @@ elseif (ZOS) # Confirmed in # https://github.com/llvm/llvm-project/pull/104706#issuecomment-2297109613 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) @@ -91,16 +76,12 @@ elseif (ZOS) 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 0) set(HAVE_TERMIOS_H 1) set(HAVE_UNISTD_H 1) else() # Other platforms that we don't promise support for. check_include_file(dlfcn.h HAVE_DLFCN_H) - check_include_file(errno.h HAVE_ERRNO_H) - check_include_file(fcntl.h HAVE_FCNTL_H) - check_include_file(fenv.h HAVE_FENV_H) check_include_file(mach/mach.h HAVE_MACH_MACH_H) check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) check_include_file(pthread.h HAVE_PTHREAD_H) @@ -111,7 +92,6 @@ else() check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H) check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) - check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(sysexits.h HAVE_SYSEXITS_H) check_include_file(termios.h HAVE_TERMIOS_H) check_include_file(unistd.h HAVE_UNISTD_H)