make: Add macos M1 support
The M1 Macs support both x86_64 and arm64 architectures, which forced homebrew to use a different path for its storage (`/opt/homebrew/` instead of `/usr/local`). If we don't adjust the path we'd mix x86_64 and arm64 libraries which can lead to weird compiler and linker errors. This patch just introduces `CPATH` and `LIBRARY_PATH` as suggested by the homebrew team, and detects the current architecture automatically. Changelog-Added: macos: Added m1 architecture support for macos
This commit is contained in:
committed by
neil saitug
parent
42783aaa92
commit
e3f53e072f
12
configure
vendored
12
configure
vendored
@@ -8,6 +8,18 @@ CONFIG_VAR_FILE=config.vars
|
||||
CONFIG_HEADER=ccan/config.h
|
||||
BASE_WARNFLAGS="-Wall -Wundef -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wold-style-definition -Werror"
|
||||
|
||||
OS=$(uname -s)
|
||||
ARCH=$(uname -m)
|
||||
if [ "$OS-$ARCH" = "Darwin-arm64" ]; then
|
||||
CPATH=/opt/homebrew/include
|
||||
LIBRARY_PATH=/opt/homebrew/lib
|
||||
export PKG_CONFIG_PATH=/opt/homebrew/opt/sqlite/lib/pkgconfig
|
||||
else
|
||||
CPATH=/usr/local/lib
|
||||
LIBRARY_PATH=/usr/local/lib
|
||||
export PKG_CONFIG_PATH=/usr/local/opt/sqlite/lib/pkgconfig
|
||||
fi
|
||||
|
||||
: ${PKG_CONFIG=pkg-config}
|
||||
|
||||
# You can set PG_CONFIG in the environment to direct configure to call
|
||||
|
||||
Reference in New Issue
Block a user