blob: 94b785038f7f6e4f7f8a13d7cd2c9e59f1ecbf52 [file] [log] [blame]
Damjan Marioncb034b92016-12-28 18:38:59 +01001
2
3AC_DEFUN([AX_VPP_FIND_JDK8],
4[
5while true
6do
Damjan Marion2fbd1ae2017-01-03 13:09:10 +01007 if test "${JAVA_HOME+set}" = set ; then
8 AC_MSG_CHECKING([${JAVA_HOME} for Java 8 compiler])
9 JAVAC=${JAVA_HOME}/bin/javac
10 JAVAH=${JAVA_HOME}/bin/javah
11 JAR=${JAVA_HOME}/bin/jar
12 JAVA_VERSION=$(${JAVA_HOME}/bin/javac -source 8 -version 2>&1)
13 if test 0 -eq "$?"; then
14 JAVA_VERSION=$(echo "${JAVA_VERSION}" | cut -d\ -f2)
15 AC_MSG_RESULT([ok])
16 else
17 AC_MSG_RESULT([no])
18 AC_MSG_ERROR([Java in ${JAVA_HOME} (path specified in JAVA_HOME) cannot compile Java 8 code])
19 fi
20 break
21 fi
Damjan Marioncb034b92016-12-28 18:38:59 +010022
Marco Varlesec2e63fe2017-10-06 15:07:08 +020023 for dir in $(find /usr/lib*/jvm/* -maxdepth 0 -type d); do
Damjan Marioncb034b92016-12-28 18:38:59 +010024 AC_MSG_CHECKING([${dir} for Java 8 compiler])
25 JAVA_VERSION=$(${dir}/bin/javac -source 8 -version 2>&1)
26 if test 0 -eq "$?"; then
27 JAVA_VERSION=$(echo "${JAVA_VERSION}" | cut -d\ -f2)
28 JAVA_HOME=${dir}
29 JAVAC=${dir}/bin/javac
30 JAVAH=${dir}/bin/javah
31 JAR=${dir}/bin/jar
32 AC_MSG_RESULT([found version $JAVA_VERSION])
33 break
34 else
35 JAVA_VERSION=""
36 AC_MSG_RESULT([no])
37 fi
38 done
39
40 test "${JAVA_HOME}set" = set && AC_MSG_ERROR([Could not find Java 8 compiler])
41 break
42done
43])