Skip to content

Commit d58781b

Browse files
Merge pull request #1070 from YSaxon/fix-mac-homebrew-paths
Improve macOS Homebrew dependency detection (General Fix)
2 parents e77f57c + e8d4044 commit d58781b

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

configure

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,30 @@ if [ -d "/Library/Developer/CommandLineTools/usr/lib" ]; then
165165
fi
166166
LIBDIRS="$LIBDIRS /lib /usr/lib /usr/local/lib /opt/local/lib /mingw64/lib /mingw64/bin"
167167
INCDIRS="$SDK_PATH/usr/include /usr/local/include /opt/include /opt/local/include /mingw64/include"
168+
169+
if [ "$SYSS" = "Darwin" ]; then
170+
# 1. Add standard Homebrew paths for ARM/Intel
171+
for brew_path in /opt/homebrew /usr/local /opt/local; do
172+
if [ -d "$brew_path/lib" ]; then
173+
LIBDIRS="$LIBDIRS $brew_path/lib"
174+
INCDIRS="$INCDIRS $brew_path/include"
175+
fi
176+
done
177+
178+
# 2. Use pkg-config to find paths for common Hydra dependencies (especially keg-only ones)
179+
# This handles libpq, openssl, libssh, etc. in a generic way.
180+
if command -v "$PKG_CONFIG" >/dev/null 2>&1; then
181+
for pkg in libpq openssl libssh libidn2 libidn pcre2-8 libpcre mysqlclient libmariadb apr-1 apr-util-1 libsvn_client; do
182+
if "$PKG_CONFIG" --exists "$pkg" 2>/dev/null; then
183+
pkg_libdir=`"$PKG_CONFIG" --variable=libdir "$pkg" 2>/dev/null`
184+
pkg_incdir=`"$PKG_CONFIG" --variable=includedir "$pkg" 2>/dev/null`
185+
[ -d "$pkg_libdir" ] && LIBDIRS="$LIBDIRS $pkg_libdir"
186+
[ -d "$pkg_incdir" ] && INCDIRS="$INCDIRS $pkg_incdir"
187+
fi
188+
done
189+
fi
190+
fi
191+
168192
if [ -n "$PREFIX" ]; then
169193
if [ -d "$PREFIX/lib" ]; then
170194
LIBDIRS="$LIBDIRS $PREFIX/lib"

0 commit comments

Comments
 (0)