Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libraries/Native/Unix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS
add_definitions(-D__APPLE_USE_RFC_3542)
endif ()

if (CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_ANDROID)
if (CLR_CMAKE_TARGET_LINUX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
endif ()

Expand Down
44 changes: 20 additions & 24 deletions src/mono/cmake/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
# Configure checks
#

include(CheckTypeSize)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckCCompilerFlag)
include(CheckCSourceCompiles)
include(CheckIncludeFiles)
include(CheckStructHasMember)
include(CheckSymbolExists)
include(CheckTypeSize)

# Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK,
# the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it.
Expand Down Expand Up @@ -64,8 +65,8 @@ function(ac_check_type type suffix includes)
endfunction()

ac_check_headers (
sys/types.h sys/stat.h sys/filio.h sys/sockio.h sys/utime.h sys/un.h sys/syscall.h sys/uio.h sys/param.h sys/sysctl.h
sys/prctl.h sys/socket.h sys/utsname.h sys/select.h sys/user.h sys/poll.h sys/wait.h sts/auxv.h sys/resource.h
sys/types.h sys/stat.h sys/filio.h sys/sockio.h sys/utime.h sys/un.h sys/syscall.h sys/uio.h sys/param.h
sys/prctl.h sys/socket.h sys/utsname.h sys/select.h sys/poll.h sys/wait.h sts/auxv.h sys/resource.h
sys/ioctl.h sys/errno.h sys/sendfile.h sys/statvfs.h sys/statfs.h sys/mman.h sys/mount.h sys/time.h sys/random.h
strings.h stdint.h unistd.h signal.h setjmp.h syslog.h netdb.h utime.h semaphore.h libproc.h alloca.h ucontext.h pwd.h elf.h
gnu/lib-names.h netinet/tcp.h netinet/in.h link.h arpa/inet.h unwind.h poll.h wchar.h linux/magic.h
Expand All @@ -84,6 +85,15 @@ ac_check_funcs (
gethrtime read_real_time gethostbyname gethostbyname2 getnameinfo getifaddrs
access inet_ntop Qp2getifaddrs getpid mktemp)

if (HOST_LINUX)
# sysctl is deprecated on Linux
set(HAVE_SYS_SYSCTL_H 0)
else ()
check_include_files("sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H)
endif()

check_include_files("sys/types.h;sys/user.h" HAVE_SYS_USER_H)

if(NOT HOST_DARWIN)
# getentropy was introduced in macOS 10.12 / iOS 10.0
ac_check_funcs (getentropy)
Expand Down Expand Up @@ -125,7 +135,7 @@ check_type_size("long" SIZEOF_LONG)
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size("size_t" SIZEOF_SIZE_T)

if (HOST_LINUX OR HOST_ANDROID)
if (HOST_LINUX)
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
endif()

Expand Down Expand Up @@ -175,9 +185,7 @@ if(HOST_WIN32)
set(HAVE_STRUCT_SOCKADDR_IN6 1)
set(HAVE_STRTOK_R 1)
set(HAVE_EXECVP 0)
endif()

if(HOST_IOS)
elseif(HOST_IOS)
set(HAVE_SYSTEM 0)
set(HAVE_GETPWUID_R 0)
set(HAVE_SYS_USER_H 0)
Expand All @@ -193,25 +201,13 @@ if(HOST_IOS)
endif()
elseif(HOST_MACCAT)
set(HAVE_SYSTEM 0)
endif()

if(HOST_BROWSER)
elseif(HOST_BROWSER)
set(HAVE_FORK 0)
endif()

if(HOST_SOLARIS)
elseif(HOST_SOLARIS)
set(HAVE_GETPROTOBYNAME 1)
set(HAVE_NETINET_TCP_H 1)
set(HAVE_GETADDRINFO 1)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD fails earlier ac_check_headers for these because <sys/types.h> is needed.
set(HAVE_SYS_SYSCTL_H 1)
set(HAVE_SYS_USER_H 1)
endif()

if(CMAKE_SYSTEM_NAME STREQUAL "WASI")
elseif(HOST_WASI)
# Redirected to errno.h
set(SYS_ERRNO_H 0)
# Some headers exist, but don't compile (wasi sdk 12.0)
Expand Down