From c67982aa3f3660aace9832225b2e798317133db2 Mon Sep 17 00:00:00 2001 From: Dirk Zimoch Date: Wed, 16 Apr 2025 13:28:24 +0100 Subject: [PATCH] Always search homebrew and MacPorts directories This allows other modules like pvxs to find files there, too. Also, the install locations of homebrew and MacPorts are now detected rather than assumed. If a package is installed in both, the homebrew version is preferred. --- .../os/CONFIG_SITE.darwinCommon.darwinCommon | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/configure/os/CONFIG_SITE.darwinCommon.darwinCommon b/configure/os/CONFIG_SITE.darwinCommon.darwinCommon index d45422401..85ccbad38 100644 --- a/configure/os/CONFIG_SITE.darwinCommon.darwinCommon +++ b/configure/os/CONFIG_SITE.darwinCommon.darwinCommon @@ -6,24 +6,17 @@ # These settings are designed for users of Homebrew. # Users of other third-party package managers are welcome to # provide patches appropriate for their manager. -ifneq (,$(wildcard /opt/homebrew)) - # Default location on aarch64 - HOMEBREW_DIR = /opt/homebrew -else ifneq (,$(wildcard /usr/local/Homebrew)) - # Default location on x86_64 - HOMEBREW_DIR = /usr/local -else ifneq (,$(wildcard /opt/local/include/readline)) - # MacPorts - READLINE_DIR = /opt/local -endif +HOMEBREW_DIR := $(shell brew --prefix 2>/dev/null) +INCLUDES += $(HOMEBREW_DIR:%=-I%/include) +LDFLAGS += $(HOMEBREW_DIR:%=-L%/lib) # Look for Homebrew's readline ifneq (,$(wildcard $(HOMEBREW_DIR)/opt/readline)) - READLINE_DIR = $(HOMEBREW_DIR)/opt/readline + INCLUDES_READLINE += -I$(HOMEBREW_DIR)/opt/readline/include + LDFLAGS_READLINE += -L$(HOMEBREW_DIR)/opt/readline/lib endif -# Use GNU readline if it's avaiilable -ifneq (,$(wildcard $(READLINE_DIR)/include/readline/readline.h)) - INCLUDES_READLINE = -I$(READLINE_DIR)/include - LDFLAGS_READLINE = -L$(READLINE_DIR)/lib -endif +# Look for MacPorts +MACPORT_DIR := $(patsubst %/bin/port,%,$(shell which port)) +INCLUDES += $(MACPORT_DIR:%=-I%/include) +LDFLAGS += $(MACPORT_DIR:%=-L%/lib)