[Libguestfs] [PATCH] build: fix reading of the java version

Pino Toscano ptoscano at redhat.com
Mon Mar 7 16:25:56 UTC 2016


Update the check for the first line (the one containing the version) to
match also the message with OpenJDK; switch to awk so it is easier to
extract the version inside the double quotes.
---
 m4/guestfs_java.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/m4/guestfs_java.m4 b/m4/guestfs_java.m4
index f9bec94..649e21f 100644
--- a/m4/guestfs_java.m4
+++ b/m4/guestfs_java.m4
@@ -84,7 +84,7 @@ if test "x$with_java" != "xno"; then
         else
             JAR="$JAVA/bin/jar"
         fi
-        java_version=`$JAVA_EXE -version 2>&1 | grep "java version"`
+        java_version=`$JAVA_EXE -version 2>&1 | $AWK -F '"' '/^(java|openjdk) version/ {print $2;}'`
         AC_MSG_RESULT(found $java_version in $JAVA)
 
         dnl Find jni.h.
-- 
2.5.0




More information about the Libguestfs mailing list