From 3757f2e69c8aeb392377a83b7b1d06fc401cc8ff Mon Sep 17 00:00:00 2001 From: Naofumi Yasufuku Date: Sat, 6 Aug 2022 22:10:36 +0900 Subject: [PATCH] Fix libgccjit library path lookup for Homebrew libgccjit 12.1.0 and above * configure.ac: Choose the first match from multiple libgccjit.dylib paths in 'brew ls -v libgccjit' output. Prefer 'current/libgccjit.dylib' over '${ver}/libgccjit.dylib' (Bug#57015) --- configure.ac | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 1a264275bd..55dcb93f9a 100644 --- a/configure.ac +++ b/configure.ac @@ -4240,8 +4240,15 @@ AC_DEFUN if test -n "`$BREW --prefix --installed libgccjit 2>/dev/null`"; then MAC_CFLAGS="-I$(dirname $($BREW ls -v libgccjit | \ grep libgccjit.h))" - MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit| \ - grep -E 'libgccjit\.(so|dylib)$'))" + MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | \ + grep -E 'current/libgccjit\.(so|dylib)$' | \ + head -1))" + if test "${MAC_LIBS}" = "-L"; then + # Try for Homebrew libgccjit < 12.1.0. + MAC_LIBS="-L$(dirname $($BREW ls -v libgccjit | \ + grep -E 'libgccjit\.(so|dylib)$' | \ + head -1))" + fi fi fi -- 2.37.1