Only define _XOPEN_SOURCE on Linux
This breaks the build on recent versions of macOS. Defining
_XOPEN_SOURCE is not necessary to access pthread_rwlock_t. Worse,
defining it makes __DARWIN_C_LEVEL equal to _POSIX_C_SOURCE, which
disables access to functions like timespec_get and aligned_alloc
on macOS 10.15 and newer, which are now used by libc++.
Change-Id: I5098dae8288bdb4a4ca912b35110240f35fbf69f
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/boringssl/+/419139
Reviewed-by: Roland McGrath <mcgrathr@google.com>
Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index 757c32e..2d8c9fe 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -241,8 +241,8 @@
"BORINGSSL_SHARED_LIBRARY",
"OPENSSL_SMALL",
]
- if (!is_fuchsia) {
- # pthread_rwlock_t on host requires a feature flag.
+ if (is_linux) {
+ # pthread_rwlock_t on Linux requires a feature flag.
defines += [ "_XOPEN_SOURCE=700" ]
}
cflags = [ "-Wno-unused-function" ]