Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 1 | |
| 2 | |
| 3 | AC_DEFUN([AX_VPP_FIND_JDK8], |
| 4 | [ |
| 5 | while true |
| 6 | do |
Damjan Marion | 2fbd1ae | 2017-01-03 13:09:10 +0100 | [diff] [blame] | 7 | 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 Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 22 | |
Marco Varlese | c2e63fe | 2017-10-06 15:07:08 +0200 | [diff] [blame] | 23 | for dir in $(find /usr/lib*/jvm/* -maxdepth 0 -type d); do |
Damjan Marion | cb034b9 | 2016-12-28 18:38:59 +0100 | [diff] [blame] | 24 | 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 |
| 42 | done |
| 43 | ]) |