Commit Diff


commit - 3dd21119ff8737c73a7e2daf321b323584517b7c
commit + 143e1554bbea0421e48f1ea1d7b90b5d48cca9ce
blob - 425be919b0b631e6a0646357437a04e4336b53aa
blob + d7781879ab1ec4154e55c6d8548add0bee98a516
--- configure.ac
+++ configure.ac
@@ -90,7 +90,14 @@ AS_IF([test "x$with_libbsd" = "xyes"], [
 if test "x$PLATFORM" = "xdarwin"; then
 	export LDFLAGS="-L/opt/homebrew/opt/libressl/lib $LDFLAGS"
 	export CPPFLAGS="-I/opt/homebrew/opt/libressl/include $CPPFLAGS"
-	export PKG_CONFIG_PATH="/opt/homebrew/opt/libressl/lib/pkgconfig $PKG_CONFIG_PATH"
+
+	# This is not neat at all -- but if homebrew is used, it's often up to
+	# the user to define PKG_CONFIG_PATH in the environment.
+	# Some CI systems don't do this, so we'll have to.
+	AC_MSG_NOTICE([Setting PKG_CONFIG_PATH programatically])
+	export PKG_CONFIG_PATH="$(find ${HOMEBREW_PREFIX}/Cellar \
+				 -name 'pkgconfig' -type d | \
+				 tr '\n' ':' | sed s/.$//):$PKG_CONFIG_PATH"
 fi
 
 AC_REPLACE_FUNCS([