Mercurial > hg > release > icedtea7-2.6
changeset 2959:9615e77f53ef
PR3652: Detect whether -Xprefer:source and -J-Xmx<limit> can be used, rather than assuming
2018-11-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR3652: Detect whether -Xprefer:source
and -J-Xmx<limit> can be used, rather than assuming
* Makefile.am:
(PREFER_SOURCE): Define if
COMPILER_SUPPORTS_XPREFERSOURCE is set
by configure.
(MEMORY_LIMIT): Define if
COMPILER_SUPPORTS_MAX_HEAP_SIZE is set
by configure.
* NEWS: Updated.
* acinclude.m4:
(IT_DIAMOND_CHECK): Use 'the Java compiler'
rather than 'javac' to avoid confusion with
the OpenJDK command.
(IT_UNDERSCORE_CHECK): Likewise.
(IT_JAVAC_OPTIONS_CHECK): Check whether the
selected Java compiler supports -Xprefer:source
and -J-Xmx.
* configure.ac: Invoke IT_JAVAC_OPTIONS_CHECK.
author | Andrew John Hughes <gnu_andrew@member.fsf.org> |
---|---|
date | Sat, 24 Nov 2018 03:43:26 +0000 |
parents | 6941de3a5f8c |
children | 250a19341b85 |
files | ChangeLog Makefile.am NEWS acinclude.m4 configure.ac |
diffstat | 5 files changed, 99 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Nov 24 02:28:03 2018 +0000 +++ b/ChangeLog Sat Nov 24 03:43:26 2018 +0000 @@ -1,3 +1,25 @@ +2018-11-23 Andrew John Hughes <gnu_andrew@member.fsf.org> + + PR3652: Detect whether -Xprefer:source + and -J-Xmx<limit> can be used, rather than assuming + * Makefile.am: + (PREFER_SOURCE): Define if + COMPILER_SUPPORTS_XPREFERSOURCE is set + by configure. + (MEMORY_LIMIT): Define if + COMPILER_SUPPORTS_MAX_HEAP_SIZE is set + by configure. + * NEWS: Updated. + * acinclude.m4: + (IT_DIAMOND_CHECK): Use 'the Java compiler' + rather than 'javac' to avoid confusion with + the OpenJDK command. + (IT_UNDERSCORE_CHECK): Likewise. + (IT_JAVAC_OPTIONS_CHECK): Check whether the + selected Java compiler supports -Xprefer:source + and -J-Xmx. + * configure.ac: Invoke IT_JAVAC_OPTIONS_CHECK. + 2018-11-23 Andrew John Hughes <gnu_andrew@member.fsf.org> * NEWS: Add section for 2.6.15.
--- a/Makefile.am Sat Nov 24 02:28:03 2018 +0000 +++ b/Makefile.am Sat Nov 24 03:43:26 2018 +0000 @@ -287,15 +287,16 @@ REV_ARG = -r $(HGREV) endif -# This should not depend on bootstrapping -# but on whether MEMORY_LIMIT is accepted -# as an argument to javac -if BOOTSTRAPPING +if COMPILER_SUPPORTS_XPREFERSOURCE + PREFER_SOURCE = -Xprefer:source +else + PREFER_SOURCE = +endif + +if COMPILER_SUPPORTS_MAX_HEAP_SIZE + MEMORY_LIMIT = -J-Xmx1024m +else MEMORY_LIMIT = - PREFER_SOURCE = -else - MEMORY_LIMIT = -J-Xmx1024m - PREFER_SOURCE = -Xprefer:source endif if ENABLE_CACAO
--- a/NEWS Sat Nov 24 02:28:03 2018 +0000 +++ b/NEWS Sat Nov 24 03:43:26 2018 +0000 @@ -14,6 +14,9 @@ New in release 2.6.15 (2018-11-XX): +* Bug fixes + - PR3652: Detect whether -Xprefer:source and -J-Xmx<limit> can be used, rather than assuming + New in release 2.6.14 (2018-05-23): * Security fixes
--- a/acinclude.m4 Sat Nov 24 02:28:03 2018 +0000 +++ b/acinclude.m4 Sat Nov 24 03:43:26 2018 +0000 @@ -1797,7 +1797,7 @@ AC_DEFUN([IT_DIAMOND_CHECK],[ AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK]) - AC_CACHE_CHECK([if javac lacks support for the diamond operator], it_cv_diamond, [ + AC_CACHE_CHECK([if the Java compiler lacks support for the diamond operator], it_cv_diamond, [ CLASS=Test.java BYTECODE=$(echo $CLASS|sed 's#\.java##') mkdir tmp.$$ @@ -2979,7 +2979,7 @@ AC_DEFUN([IT_UNDERSCORE_CHECK],[ AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK]) - AC_CACHE_CHECK([if javac lacks support for underscored literals], it_cv_underscore, [ + AC_CACHE_CHECK([if the Java compiler lacks support for underscored literals], it_cv_underscore, [ CLASS=Test.java BYTECODE=$(echo $CLASS|sed 's#\.java##') mkdir tmp.$$ @@ -3437,3 +3437,65 @@ AC_MSG_RESULT([$disable_systemtap_tests]) AM_CONDITIONAL([DISABLE_SYSTEMTAP_TESTS], test x"${disable_systemtap_tests}" = "xyes") ]) + +AC_DEFUN_ONCE([IT_JAVAC_OPTIONS_CHECK], +[ + AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK]) + AC_CACHE_CHECK([if the Java compiler supports -Xprefer:source], it_cv_xprefersource_works, [ + CLASS=Test.java + BYTECODE=$(echo $CLASS|sed 's#\.java##') + mkdir tmp.$$ + cd tmp.$$ + cat << \EOF > $CLASS +[/* [#]line __oline__ "configure" */ + +public class Test +{ + public static void main(String[] args) + { + System.out.println("Hello World!"); + } +}] +EOF + mkdir build + if $JAVAC -d build -cp . $JAVACFLAGS -Xprefer:source $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then + it_cv_xprefersource_works=yes; + else + it_cv_xprefersource_works=no; + fi + rm -f $CLASS build/*.class + rmdir build + cd .. + rmdir tmp.$$ + ]) + AC_CACHE_CHECK([if the Java compiler supports setting the maximum heap size], it_cv_max_heap_size_works, [ + CLASS=Test.java + BYTECODE=$(echo $CLASS|sed 's#\.java##') + mkdir tmp.$$ + cd tmp.$$ + cat << \EOF > $CLASS +[/* [#]line __oline__ "configure" */ + +public class Test +{ + public static void main(String[] args) + { + System.out.println("Hello World!"); + } +}] +EOF + mkdir build + if $JAVAC -d build -cp . $JAVACFLAGS -J-Xmx1024m $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then + it_cv_max_heap_size_works=yes; + else + it_cv_max_heap_size_works=no; + fi + rm -f $CLASS build/*.class + rmdir build + cd .. + rmdir tmp.$$ + ]) + AC_PROVIDE([$0])dnl + AM_CONDITIONAL([COMPILER_SUPPORTS_XPREFERSOURCE], test x"${it_cv_xprefersource_works}" = "xyes") + AM_CONDITIONAL([COMPILER_SUPPORTS_MAX_HEAP_SIZE], test x"${it_cv_max_heap_size_works}" = "xyes") +])