Correct default native-comp tests

Supersedes 5bd9d1f7df3.

* configure.ac: Store `with_native_compilation' to correctly test
whether to use the soft or hard (error) checks, as these set the
variable by side-effect.
This commit is contained in:
JD Smith 2026-06-05 18:34:24 -04:00
parent a25cf2b986
commit 2ac289d096

View file

@ -5176,19 +5176,6 @@ You can find the instructions on how to compile and install libgccjit from
source on this site:
<https://gcc.gnu.org/wiki/JIT>.])])
HAVE_NATIVE_COMP=no
LIBGCCJIT_LIBS=
LIBGCCJIT_CFLAGS=
if test "$canonical" = i686-pc-cygwin; then
if test "${with_cygwin32_native_compilation}" = yes; then
with_native_compilation=yes
elif test "${with_native_compilation}" != no; then
AC_MSG_ERROR([Native compilation is not supported on 32-bit Cygwin.
If you really want to try it anyway, use the configure option
'--with-cygwin32-native-compilation'.])
fi
fi
AC_DEFUN([libgccjit_not_found], [
AC_MSG_WARN([Elisp native compiler can't be enabled as libgccjit was not
found.
@ -5222,6 +5209,19 @@ source on this site:
with_native_compilation=no])
HAVE_NATIVE_COMP=no
LIBGCCJIT_LIBS=
LIBGCCJIT_CFLAGS=
if test "$canonical" = i686-pc-cygwin; then
if test "${with_cygwin32_native_compilation}" = yes; then
with_native_compilation=yes
elif test "${with_native_compilation}" != no; then
AC_MSG_ERROR([Native compilation is not supported on 32-bit Cygwin.
If you really want to try it anyway, use the configure option
'--with-cygwin32-native-compilation'.])
fi
fi
if test "$with_features" = "no" \
&& test "${with_native_compilation}" = "default"; then
with_native_compilation=no
@ -5265,14 +5265,15 @@ if test "${with_native_compilation}" != "no"; then
fi
# Check if libgccjit is available.
native_compilation_requested=${with_native_compilation}
AC_CHECK_LIB([gccjit], [gcc_jit_context_acquire], [],
[if test "${with_native_compilation}" = "default"; then
[if test "${native_compilation_requested}" = "default"; then
libgccjit_not_found
else
libgccjit_not_found_err
fi])
AC_CHECK_HEADERS([libgccjit.h], [],
[if test "${with_native_compilation}" = "default"; then
[if test "${native_compilation_requested}" = "default"; then
libgccjit_dev_not_found
else
libgccjit_dev_not_found_err
@ -5280,7 +5281,7 @@ if test "${with_native_compilation}" != "no"; then
if test "${with_native_compilation}" != "no"; then
# Check if libgccjit really works.
AC_RUN_IFELSE([libgccjit_smoke_test], [],
[if test "${with_native_compilation}" = "default"; then
[if test "${native_compilation_requested}" = "default"; then
libgccjit_broken
else
libgccjit_broken_err