Allow brew/macports libgccjit for default native compilation

* configure.ac: Move flag setup for libgccjit installed by
Homebrew or macports earlier, so default native compilation can
proceed (bug#81171).
This commit is contained in:
JD Smith 2026-06-02 16:38:58 -04:00 committed by Sean Whitton
parent 7226082f46
commit f3b17c4969

View file

@ -5227,25 +5227,7 @@ if test "$with_features" = "no" \
with_native_compilation=no
fi
if test "${with_native_compilation}" = "default"; then
# Check if libgccjit is available.
AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
[], [libgccjit_not_found])
AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found])
if test "${with_native_compilation}" != "no"; then
# Check if libgccjit really works.
AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken])
fi
fi
if test "${with_native_compilation}" != "no"; then
if test "${HAVE_ZLIB}" = no; then
AC_MSG_ERROR(['--with-native-compilation' requires zlib])
fi
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
if test "${opsys}" = "darwin"; then
# Ensure libgccjit installed by Homebrew or macports can be found.
if test -n "$BREW"; then
@ -5282,15 +5264,37 @@ if test "${with_native_compilation}" != "no"; then
fi
fi
# In the default case we already checked
if test "${with_native_compilation}" != "default"; then
# Check if libgccjit is available.
AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire],
[], [libgccjit_not_found_err])
AC_CHECK_HEADERS([libgccjit.h], [], [libgccjit_dev_not_found_err])
AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire], [],
[if test "${with_native_compilation}" = "default"; then
libgccjit_not_found
else
libgccjit_not_found_err
fi])
AC_CHECK_HEADERS([libgccjit.h], [],
[if test "${with_native_compilation}" = "default"; then
libgccjit_dev_not_found
else
libgccjit_dev_not_found_err
fi])
if test "${with_native_compilation}" != "no"; then
# Check if libgccjit really works.
AC_RUN_IFELSE([libgccjit_smoke_test], [], [libgccjit_broken_err])
AC_RUN_IFELSE([libgccjit_smoke_test], [],
[if test "${with_native_compilation}" = "default"; then
libgccjit_broken
else
libgccjit_broken_err
fi])
fi
fi
if test "${with_native_compilation}" != "no"; then
if test "${HAVE_ZLIB}" = no; then
AC_MSG_ERROR(['--with-native-compilation' requires zlib])
fi
SAVE_CFLAGS=$CFLAGS
SAVE_LIBS=$LIBS
HAVE_NATIVE_COMP=yes
case "${opsys}" in
# mingw32 loads the library dynamically.