From 71fd4c4c0a80648d89a324efa264298692e4370d Mon Sep 17 00:00:00 2001 From: Jon Griffiths Date: Thu, 28 May 2026 20:23:22 +1200 Subject: [PATCH] java: only set source level to 17 if supported by javac --- configure.ac | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bf83da840..735a205bb 100644 --- a/configure.ac +++ b/configure.ac @@ -422,7 +422,13 @@ AM_CONDITIONAL([HAVE_JAVAC], [test "x$JAVAC" != "x"]) AM_CONDITIONAL([RUN_JAVA_TESTS], dnl Only run tests if we have java-swig, compiler and interpreter [test "x$tests" = xyes -a "x$swig_java" = xyes -a -n "$JAVAC" -a -n "$JAVA"]) -JAVAC_TARGET=17 +JAVAC_TARGET=8 +if test "x$JAVAC" != "x"; then + # Use source version 17 if supported + TMP_OUTPUT=$($JAVAC --source 17 --help) + AS_IF([test $? -eq 0], [JAVAC_TARGET=17], + [AC_MSG_NOTICE([Java source level set to fallback (8)])]) +fi AC_SUBST([JAVAC_TARGET]) AC_SUBST([AM_CFLAGS])