From a3ffb9fe3d224692b1a17bef839581672c008f68 Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sun, 5 Sep 2021 14:04:45 +0100 Subject: [PATCH v3] Don't add flags when MacPorts is installed but GCC isn't * configure.ac: Check whether there is any value in $PORT_PACKAGE before trying to use it. --- configure.ac | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 418a62fd5e..e451ba09f2 100644 --- a/configure.ac +++ b/configure.ac @@ -3840,12 +3840,14 @@ AC_DEFUN # instance). PORT_PACKAGE=$(port installed active | grep '^ *gcc@<:@0-9@:>@* ' | \ awk '{ print $1; }') - MACPORTS_LIBGCCJIT_INCLUDE=$(dirname $(port contents $PORT_PACKAGE | \ - grep libgccjit.h)) - MACPORTS_LIBGCCJIT_LIB=$(dirname $(port contents $PORT_PACKAGE | \ + if test -n "$PORT_PACKAGE"; then + MACPORTS_LIBGCCJIT_INCLUDE=$(dirname $(port contents $PORT_PACKAGE | \ + grep libgccjit.h)) + MACPORTS_LIBGCCJIT_LIB=$(dirname $(port contents $PORT_PACKAGE | \ grep libgccjit.dylib)) - CFLAGS="$CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}" - LDFLAGS="$LDFLAGS -L${MACPORTS_LIBGCCJIT_LIB}" + CFLAGS="$CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}" + LDFLAGS="$LDFLAGS -L${MACPORTS_LIBGCCJIT_LIB}" + fi fi # Check if libgccjit is available. @@ -3870,7 +3872,8 @@ AC_DEFUN AC_DEFINE(HAVE_NATIVE_COMP, 1, [Define to 1 if native compiler is available.]) # Ensure libgccjit installed by MacPorts can be found. - if test -n "$HAVE_MACPORTS"; then + if test -n "${MACPORTS_LIBGCCJIT_INCLUDE}" && + test -n "${MACPORTS_LIBGCCJIT_LIB}"; then LIBGCCJIT_CFLAGS="$LIBGCCJIT_CFLAGS -I${MACPORTS_LIBGCCJIT_INCLUDE}" LIBGCCJIT_LIBS="-L${MACPORTS_LIBGCCJIT_LIB} $LIBGCCJIT_LIBS" fi -- 2.30.2