Limit _XOPEN_SOURCE to Linux.

POSIX feature macros are a mess. Reportedly, FreeBSD also breaks with
_XOPEN_SOURCE, so try leaving it unset by default.

Update-Note: It's possible this will break yet another obscure UNIX.
Hopefully we can eventually find a combination that works?

Bug: 471
Change-Id: I103f8093110d343789b9c5a22eb056ab78d9cd14
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51145
Reviewed-by: Adam Langley <agl@google.com>
fips-20220613
David Benjamin 3 years ago committed by Adam Langley
parent c03e99a59f
commit 387f82054c
  1. 9
      CMakeLists.txt

@ -257,10 +257,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
endif() endif()
# pthread_rwlock_t on Linux requires a feature flag. However, it should not be # pthread_rwlock_t on Linux requires a feature flag. We limit this to Linux
# set on Apple platforms, where it instead disables APIs we use. See compat(5) # because, on Apple platforms, it instead disables APIs we use. See compat(5)
# and sys/cdefs.h. # and sys/cdefs.h. Reportedly, FreeBSD also breaks when this is set. See
if(NOT WIN32 AND NOT APPLE) # https://crbug.com/boringssl/471.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700")
endif() endif()

Loading…
Cancel
Save