diff --git a/src/coreclr/pal/src/configure.cmake b/src/coreclr/pal/src/configure.cmake index 8ada9b82c11ad9..9c284590e99f41 100644 --- a/src/coreclr/pal/src/configure.cmake +++ b/src/coreclr/pal/src/configure.cmake @@ -141,7 +141,18 @@ check_function_exists(vm_read HAVE_VM_READ) check_function_exists(semget HAS_SYSV_SEMAPHORES) check_function_exists(pthread_mutex_init HAS_PTHREAD_MUTEXES) check_function_exists(ttrace HAVE_TTRACE) -check_function_exists(pipe2 HAVE_PIPE2) + +set(PREVIOUS_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +if(CLR_CMAKE_HOST_APPLE) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unguarded-availability-new") +endif() +check_cxx_symbol_exists(pipe2 unistd.h PAL_HAVE_PIPE2) +if(PAL_HAVE_PIPE2) + set(HAVE_PIPE2 1 CACHE INTERNAL "" FORCE) +else() + set(HAVE_PIPE2 0 CACHE INTERNAL "" FORCE) +endif() +set(CMAKE_REQUIRED_FLAGS ${PREVIOUS_CMAKE_REQUIRED_FLAGS}) check_cxx_source_compiles(" #include