Merge #20195: build: fix mutex detection when building bdb on macOS

d0a829e963 build: fix mutex detection when building bdb on macOS (fanquake)

Pull request description:

  Starting with the Apple Clang shipped with Xcode 12, [Apple has enabled -Werror=implicit-function-declaration by default](https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notes):
  > Clang now reports an error when you use a function without an explicit declaration when building C or Objective-C code for macOS (-Werror=implicit-function-declaration flag is on). This additional error detection unifies Clang’s behavior for iOS/tvOS and macOS 64-bit targets for this diagnostic. (49917738)

  This causes bdbs mutex detection to fail when building on macOS (not cross-compiling):
  ```bash
  checking for mutexes... UNIX/fcntl
  configure: WARNING: NO SHARED LATCH IMPLEMENTATION FOUND FOR THIS PLATFORM.
  configure: error: Unable to find a mutex implementation
  ```

  as previously emitted warnings are being turned into errors. i.e:
  ```bash
  configure:18704: checking for mutexes
  configure:18815: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -mmacosx-version-min=10.12 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o conftest -pipe -O2  -I/Users/michael/github/fanquake-bitcoin/depends/x86_64-apple-darwin19.6.0/include -L/Users/michael/github/fanquake-bitcoin/depends/x86_64-apple-darwin19.6.0/lib conftest.c  -lpthread >&5
  conftest.c:46:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  main() {
  ^
  conftest.c:51:2: error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' [-Werror,-Wimplicit-function-declaration]
          exit (
          ^
  conftest.c:51:2: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
  1 warning and 1 error generated.
  ```

  Append `-Wno-error=implicit-function-declaration` to `cflags` so that `-Wimplicit-function-declaration` [returns to being a warning](https://clang.llvm.org/docs/UsersManual.html#cmdoption-wno-error), and the configure checks succeed.

  Fixes #19411.

ACKs for top commit:
  laanwj:
    Code review ACK d0a829e963

Tree-SHA512: 7813005b1fc0b370f843b6c0672acab32c999416e92c3f02b75d866e9c7aa41fe5822704fc74de6b65f0d7d94f2cdd05cc7c3ee83295ff1ecbc71d8492b9a2bf
pull/764/head
Wladimir J. van der Laan 4 years ago
commit 5b82f253b6
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D

@ -10,6 +10,7 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-cxx --disable-replication --enable-option-checking
$(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic
$(package)_cflags+=-Wno-error=implicit-function-declaration
$(package)_cxxflags=-std=c++11
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
endef

Loading…
Cancel
Save