[test "$enableval" = no && BUILD_DETAILS=--no-build-details])
AC_SUBST([BUILD_DETAILS])
+# JAVA_PUSH_LINT(OPT)
+# -------------------
+# Check if javac supports the diagnostic flag -Xlint:OPT.
+# If it does, add it to JAVAFLAGS.
+
+AC_DEFUN([JAVA_PUSH_LINT],
+[
+ AC_CACHE_CHECK([whether Java compiler accepts -Xlint:$1],
+ [emacs_cv_javac_knows_lint_$1],
+ AS_IF([rm -f conftest.class
+cat << EOF > conftest.java
+
+class conftest
+{
+
+}
+
+EOF
+("$JAVAC" -Xlint:$1 conftest.java 2>&AS_MESSAGE_LOG_FD) \
+ && rm -f conftest.class], [emacs_cv_javac_knows_lint_$1=yes],
+ [emacs_cv_javac_knows_lint_$1=no]))
+
+ AS_IF([test "$emacs_cv_javac_knows_lint_$1" = "yes"],
+ [JAVAFLAGS="$JAVAFLAGS -Xlint:$1"])
+])
+
# Start Android configuration. This is done in three steps:
# First, the SDK tools needed to build the Android package on the host
DX=
ANDROID_JAR=
ANDROID_ABI=
+JAVAFLAGS=
# This is a list of Makefiles that have alternative versions for
# Android.
JARSIGNER=/opt/jdk/bin/jarsigner ./configure --with-android])
fi
- AC_CACHE_CHECK([whether or not the Java compiler works],
+ AC_CACHE_CHECK([whether the Java compiler works],
[emacs_cv_working_javac],
AS_IF([rm -f conftest.class
cat << EOF > conftest.java
a valid path to android.jar. See config.log for more details.])
fi
- AC_CACHE_CHECK([whether or not android.jar is new enough],
+ AC_CACHE_CHECK([whether android.jar is new enough],
[emacs_cv_android_s_or_later],
AS_IF([rm -f conftest.class
cat << EOF > conftest.java
Android 13 (Tiramisu) or later.])
fi
+ dnl See if the Java compiler supports the `--release' option which
+ dnl makes it check for and prevent using features introduced after
+ dnl Java 1.7.
+
+ AC_CACHE_CHECK([whether javac accepts --release 7],
+ [emacs_cv_javac_release_7], AS_IF([rm -f conftest.class
+cat << EOF > conftest.java
+
+class conftest
+{
+
+}
+
+EOF
+("$JAVAC" --release 7 conftest.java 2>&AS_MESSAGE_LOG_FD) \
+ && rm -f conftest.class],
+ [emacs_cv_javac_release_7=yes],
+ [emacs_cv_javac_release_7=no]))
+
+ if test "$emacs_cv_javac_release_7" = "yes"; then
+ JAVAFLAGS="$JAVAFLAGS --release 7"
+ else
+ dnl If not, just make sure the generated bytecode is correct.
+ JAVAFLAGS="$JAVAFLAGS -target 1.7 -source 1.7"
+ fi
+
+ dnl Enable some useful Java linting options.
+ JAVA_PUSH_LINT([deprecation])
+ JAVA_PUSH_LINT([cast])
+ JAVA_PUSH_LINT([divzero])
+ JAVA_PUSH_LINT([nonempty])
+ JAVA_PUSH_LINT([empty])
+ JAVA_PUSH_LINT([finally])
+ JAVA_PUSH_LINT([overrides])
+ JAVA_PUSH_LINT([path])
+ JAVA_PUSH_LINT([serial])
+ JAVA_PUSH_LINT([unchecked])
+
+ # Get the name of the android.jar file.
ANDROID_JAR="$with_android"
+ dnl Set up the class path to include android.jar, along with the cwd
+ dnl (which is $(top_builddir)/java.)
+ JAVAFLAGS="$JAVAFLAGS -classpath \"$ANDROID_JAR:.\""
+ AC_SUBST([JAVAFLAGS])
+
AC_PATH_PROGS([AAPT], [aapt], [], "${SDK_BUILD_TOOLS}:$PATH")
if test "$AAPT" = ""; then
AC_MSG_ERROR([The Android asset packaging tool was not found.