Description: Enable compatibility with JDK 9+ According to JEP-182 OpenJDK 9 will only support 1.6 or later for source and target flags. This patch adds supports for 1.6, 1.7, and 1.8 flags for detecting and building gettext java. Modified from opensuse to include support for 1.7 and 1.8. Origin: opensuse, https://build.opensuse.org/package/view_file/openSUSE:Factory/gettext-runtime/gettext-0.19.8.1-jdk9.patch Bug-Debian: Forwarded: no Last-Update: 2018-03-21 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/gettext-runtime/configure.ac +++ b/gettext-runtime/configure.ac @@ -35,7 +35,7 @@ gt_JAVA_CHOICE -gt_JAVACOMP([1.3], [1.1]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG([JAR], [jar], [jar]) if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then BUILDJAVA=yes --- a/gettext-runtime/gnulib-m4/javacomp.m4 +++ b/gettext-runtime/gnulib-m4/javacomp.m4 @@ -16,6 +16,8 @@ # 1.4 assert keyword # 1.5 generic classes and methods # 1.6 (not yet supported) +# 1.7 (not yet supported) +# 1.8 (not yet supported) # # target-version can be: classfile version: # 1.1 45.3 @@ -24,6 +26,8 @@ # 1.4 48.0 # 1.5 49.0 # 1.6 50.0 +# 1.7 51.0 +# 1.8 52.0 # The classfile version of a .class file can be determined through the "file" # command. More portably, the classfile major version can be determined through # "od -A n -t d1 -j 7 -N 1 classfile". @@ -36,6 +40,8 @@ # 1.4 JDK/JRE 1.4, gij 4.0, 4.1 # 1.5 JDK/JRE 1.5 # 1.6 JDK/JRE 1.6 +# 1.7 JDK/JRE 7 +# 1.8 JDK/JRE 8 # Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4, # and gij >= 4.1 can in some cases partially handle classes compiled with # -target 1.5, but I have no idea how complete this support is. @@ -47,7 +53,9 @@ # It is unreasonable to ask for: # - target-version < 1.4 with source-version >= 1.4, or # - target-version < 1.5 with source-version >= 1.5, or -# - target-version < 1.6 with source-version >= 1.6, +# - target-version < 1.6 with source-version >= 1.6, or +# - target-version < 1.7 with source-version >= 1.7, or +# - target-version < 1.8 with source-version >= 1.8 # because even Sun's javac doesn't support these combinations. # # It is redundant to ask for a target-version > source-version, since the @@ -99,7 +107,7 @@ CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD }` case "$target_version" in - 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;; + 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8) ;; null) dnl JDK 1.1.X returns null. target_version=1.1 ;; @@ -118,6 +126,12 @@ failcode='class conftestfail { T foo() { return null; } }' ;; 1.5) goodcode='class conftest { T foo() { return null; } }' failcode='class conftestfail syntax error' ;; + 1.6) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + 1.7) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + 1.8) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; *) AC_MSG_ERROR([invalid source-version argument to gt_@&address@hidden: $source_version]) ;; esac case "$target_version" in @@ -127,6 +141,8 @@ 1.4) cfversion=48 ;; 1.5) cfversion=49 ;; 1.6) cfversion=50 ;; + 1.7) cfversion=51 ;; + 1.8) cfversion=52 ;; *) AC_MSG_ERROR([invalid target-version argument to gt_@&address@hidden: $target_version]) ;; esac # Function to output the classfile version of a file (8th byte) in decimal. --- a/gettext-tools/configure.ac +++ b/gettext-tools/configure.ac @@ -44,7 +44,7 @@ AC_SUBST([BUILDJAVAEXE]) gt_JAVAEXEC -gt_JAVACOMP([1.3]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG([JAR], [jar], [jar]) if test -n "$HAVE_JAVACOMP" && test -n "$JAR" && test "$JAVA_CHOICE" != no; then BUILDJAVA=yes --- a/gettext-tools/examples/hello-java/configure.ac +++ b/gettext-tools/examples/hello-java/configure.ac @@ -24,7 +24,7 @@ dnl Check whether we can execute Java programs. gt_JAVAEXEC dnl Check whether we can build Java programs. -gt_JAVACOMP([1.3]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG(JAR, jar, jar) if test -n "$HAVE_JAVACOMP" && test -n "$JAR"; then BUILDJAVA=yes --- a/gettext-tools/examples/hello-java-awt/configure.ac +++ b/gettext-tools/examples/hello-java-awt/configure.ac @@ -24,7 +24,7 @@ dnl Check whether we can execute Java programs. gt_JAVAEXEC([TestAWT], [$srcdir/m4]) dnl Check whether we can build Java programs. -gt_JAVACOMP([1.3]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG(JAR, jar, jar) if test -n "$HAVE_JAVACOMP" && test -n "$JAR"; then BUILDJAVA=yes --- a/gettext-tools/examples/hello-java-qtjambi/configure.ac +++ b/gettext-tools/examples/hello-java-qtjambi/configure.ac @@ -26,7 +26,7 @@ dnl Check whether we can execute Java programs. gt_JAVAEXEC([Test15], [$srcdir/m4]) dnl Check whether we can build Java programs. -gt_JAVACOMP([1.5], [1.5]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG(JAR, jar, jar) if test -n "$HAVE_JAVACOMP" && test -n "$JAR"; then BUILDJAVA=yes --- a/gettext-tools/examples/hello-java-swing/configure.ac +++ b/gettext-tools/examples/hello-java-swing/configure.ac @@ -24,7 +24,7 @@ dnl Check whether we can execute Java programs. gt_JAVAEXEC([TestAWT], [$srcdir/m4]) dnl Check whether we can build Java programs. -gt_JAVACOMP([1.3]) +gt_JAVACOMP([1.6], [1.6]) AC_CHECK_PROG(JAR, jar, jar) if test -n "$HAVE_JAVACOMP" && test -n "$JAR"; then BUILDJAVA=yes --- a/gettext-tools/gnulib-m4/javacomp.m4 +++ b/gettext-tools/gnulib-m4/javacomp.m4 @@ -16,6 +16,8 @@ # 1.4 assert keyword # 1.5 generic classes and methods # 1.6 (not yet supported) +# 1.7 (not yet supported) +# 1.8 (not yet supported) # # target-version can be: classfile version: # 1.1 45.3 @@ -24,6 +26,8 @@ # 1.4 48.0 # 1.5 49.0 # 1.6 50.0 +# 1.7 51.0 +# 1.8 52.0 # The classfile version of a .class file can be determined through the "file" # command. More portably, the classfile major version can be determined through # "od -A n -t d1 -j 7 -N 1 classfile". @@ -36,6 +40,8 @@ # 1.4 JDK/JRE 1.4, gij 4.0, 4.1 # 1.5 JDK/JRE 1.5 # 1.6 JDK/JRE 1.6 +# 1.7 JDK/JRE 7 +# 1.8 JDK/JRE 8 # Note: gij >= 3.3 can in some cases handle classes compiled with -target 1.4, # and gij >= 4.1 can in some cases partially handle classes compiled with # -target 1.5, but I have no idea how complete this support is. @@ -47,7 +53,9 @@ # It is unreasonable to ask for: # - target-version < 1.4 with source-version >= 1.4, or # - target-version < 1.5 with source-version >= 1.5, or -# - target-version < 1.6 with source-version >= 1.6, +# - target-version < 1.6 with source-version >= 1.6, or +# - target-version < 1.7 with source-version >= 1.7, or +# - target-version < 1.8 with source-version >= 1.8 # because even Sun's javac doesn't support these combinations. # # It is redundant to ask for a target-version > source-version, since the @@ -99,7 +107,7 @@ CLASSPATH=.${CLASSPATH:+$CLASSPATH_SEPARATOR$CLASSPATH} $CONF_JAVA conftestver 2>&AS_MESSAGE_LOG_FD }` case "$target_version" in - 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6) ;; + 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8) ;; null) dnl JDK 1.1.X returns null. target_version=1.1 ;; @@ -118,6 +126,12 @@ failcode='class conftestfail { T foo() { return null; } }' ;; 1.5) goodcode='class conftest { T foo() { return null; } }' failcode='class conftestfail syntax error' ;; + 1.6) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + 1.7) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; + 1.8) goodcode='class conftest { T foo() { return null; } }' + failcode='class conftestfail syntax error' ;; *) AC_MSG_ERROR([invalid source-version argument to gt_@&address@hidden: $source_version]) ;; esac case "$target_version" in @@ -127,6 +141,8 @@ 1.4) cfversion=48 ;; 1.5) cfversion=49 ;; 1.6) cfversion=50 ;; + 1.7) cfversion=51 ;; + 1.8) cfversion=52 ;; *) AC_MSG_ERROR([invalid target-version argument to gt_@&address@hidden: $target_version]) ;; esac # Function to output the classfile version of a file (8th byte) in decimal.