diff --git a/configure.ac b/configure.ac index 8bc5f6daa11..7c592e6b89f 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) + # Check if libgccjit is available. + 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.