changeset 2935:de38248f4db4

Explicitly test for the presence of Classpath bug PR43389 and only pre-build StandardMBean if present. 2013-01-11 Andrew John Hughes <gnu.andrew@redhat.com> * Makefile.am: (ICEDTEA_BOOTSTRAP_CLASSES): Make the inclusion of javax.management.StandardMBean dependent on the 1.6 constructors being missing. * acinclude.m4: (IT_CHECK_FOR_CLASS): Write class toString() output to System.err rather than throwing it away. It then appears in config.log and may be useful in debugging. (IT_CHECK_FOR_METHOD): Fix documentation and add System.err output as for IT_CHECK_FOR_CLASS. (IT_CHECK_FOR_CONSTRUCTOR): New macro to test for the presence of a specific constructor. Works with both private & protected constructors by using a subclass for the compile test. * configure.ac: Add IT_CHECK_FOR_CONSTRUCTOR calls for the two javax.management.StandardMBean constructors added in 1.6.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Fri, 11 Jan 2013 17:11:43 +0000
parents cea49ba2afcd
children 5c5bde48dfb9
files ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 4 files changed, 108 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 28 14:42:31 2012 +0000
+++ b/ChangeLog	Fri Jan 11 17:11:43 2013 +0000
@@ -1,3 +1,24 @@
+2013-01-11  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* Makefile.am:
+	(ICEDTEA_BOOTSTRAP_CLASSES): Make the inclusion
+	of javax.management.StandardMBean dependent on
+	the 1.6 constructors being missing.
+	* acinclude.m4:
+	(IT_CHECK_FOR_CLASS): Write class toString() output
+	to System.err rather than throwing it away.  It then
+	appears in config.log and may be useful in debugging.
+	(IT_CHECK_FOR_METHOD): Fix documentation and add
+	System.err output as for IT_CHECK_FOR_CLASS.
+	(IT_CHECK_FOR_CONSTRUCTOR): New macro to test for
+	the presence of a specific constructor.  Works
+	with both private & protected constructors by
+	using a subclass for the compile test.
+	* configure.ac:
+	Add IT_CHECK_FOR_CONSTRUCTOR calls for the
+	two javax.management.StandardMBean constructors
+	added in 1.6.
+
 2012-11-28  Andrew John Hughes  <gnu.andrew@redhat.com>
 
 	* javac.in:
--- a/Makefile.am	Wed Nov 28 14:42:31 2012 +0000
+++ b/Makefile.am	Fri Jan 11 17:11:43 2013 +0000
@@ -63,12 +63,9 @@
 
 # Sources used from OpenJDK.
 
-# PR42003 - javax.swing.plaf.basic.BasicDirectoryModel
-# PR43389 - javax.management.StandardMBean
 # PR54274 - sun.security.other requires missing X509CRLSelector methods
 # PR54275 - sun.security.sasl requires missing Sasl.CREDENTIALS field
 ICEDTEA_BOOTSTRAP_CLASSES = \
-	$(SHARE)/javax/management/StandardMBean.java \
 	$(SHARE)/java/security/cert/X509CRLSelector.java \
 	$(SHARE)/java/security/cert/X509CertSelector.java \
 	$(SHARE)/javax/security/sasl/Sasl.java \
@@ -88,6 +85,17 @@
 endif
 endif
 
+# PR43389 - javax.management.StandardMBean
+if LACKS_JAVAX_MANAGEMENT_STANDARDMBEAN_MXBEAN_TWO_ARG
+ICEDTEA_BOOTSTRAP_CLASSES += \
+	$(SHARE)/javax/management/StandardMBean.java
+else
+if LACKS_JAVAX_MANAGEMENT_STANDARDMBEAN_MXBEAN_THREE_ARG
+ICEDTEA_BOOTSTRAP_CLASSES += \
+	$(SHARE)/javax/management/StandardMBean.java
+endif
+endif
+
 # Flags
 MEMORY_LIMIT = -J-Xmx1024m
 IT_CFLAGS=$(CFLAGS) $(ARCHFLAG)
--- a/acinclude.m4	Wed Nov 28 14:42:31 2012 +0000
+++ b/acinclude.m4	Fri Jan 11 17:11:43 2013 +0000
@@ -1306,7 +1306,7 @@
 {
   public static void main(String[] args)
   {
-    $2.class.toString();
+    System.err.println("Class found: " + $2.class);
   }
 }
 ]
@@ -1781,11 +1781,12 @@
 ])
 
 dnl Generic macro to check for a Java method
-dnl Takes four arguments: the name of the macro,
-dnl the name of the class, the method signature
-dnl and an example call to the method.  The macro name
-dnl is usually the name of the class with '.'
-dnl replaced by '_' and all letters capitalised.
+dnl Takes five arguments: the name of the macro,
+dnl the name of the method, the name of the class,
+dnl the method signature and an example call to the
+dnl method.  The macro name is usually the name of
+dnl the class with '.' replaced by '_' and all letters
+dnl capitalised.
 dnl e.g. IT_CHECK_FOR_METHOD([JAVA_UTIL_REGEX_MATCHER_QUOTEREPLACEMENT],[java.util.regex.Matcher.quoteReplacement],[java.util.rgex.Matcher],["quoteReplacement",String.class],java.util.regex.Matcher.quoteReplacement("Blah"))
 AC_DEFUN([IT_CHECK_FOR_METHOD],[
 AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
@@ -1806,6 +1807,7 @@
     try
       {
         Method m = cl.getDeclaredMethod($4);
+	System.err.println("Method found: " + m);
       }
     catch (NoSuchMethodException e)
       {
@@ -1873,3 +1875,66 @@
 AC_SUBST(USING_ECJ)
 AC_PROVIDE([$0])dnl
 ])
+
+dnl Generic macro to check for a Java constructor
+dnl Takes four arguments: the name of the macro,
+dnl the name of the class, the method signature
+dnl and an example call to the method.  The macro name
+dnl is usually the name of the class with '.'
+dnl replaced by '_' and all letters capitalised.
+dnl e.g. IT_CHECK_FOR_CONSTRUCTOR([JAVAX_MANAGEMENT_STANDARDMBEAN_MXBEAN_TWO_ARG],[javax.management.StandardMBean],[Class.class,Boolean.TYPE],[Object.class, true])
+AC_DEFUN([IT_CHECK_FOR_CONSTRUCTOR],[
+AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
+AC_CACHE_CHECK([if $2($3) is missing], it_cv_$1, [
+CLASS=Test.java
+BYTECODE=$(echo $CLASS|sed 's#\.java##')
+mkdir tmp.$$
+cd tmp.$$
+cat << \EOF > $CLASS
+[/* [#]line __oline__ "configure" */
+import java.lang.reflect.Constructor;
+
+public class Test
+{
+  public static void main(String[] args)
+  {
+    Class<?> cl = $2.class;
+    try
+      {
+      	Constructor<?> cons = cl.getDeclaredConstructor($3);
+	System.err.println("Constructor found: " + cons);
+      }
+    catch (NoSuchMethodException e)
+      {
+        System.exit(-1);
+      }
+  }
+
+  private class TestCons extends $2
+  {
+     TestCons()
+     {
+       super($4);
+     }
+  }
+
+}
+
+]
+EOF
+if $JAVAC -cp . $JAVACFLAGS -source 5 -target 5 -nowarn $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+  if $JAVA -classpath . $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_$1=no;
+  else
+      it_cv_$1=yes;
+  fi
+else
+  it_cv_$1=yes;
+fi
+])
+rm -f $CLASS *.class
+cd ..
+rmdir tmp.$$
+AM_CONDITIONAL([LACKS_$1], test x"${it_cv_$1}" = "xyes")
+AC_PROVIDE([$0])dnl
+])
--- a/configure.ac	Wed Nov 28 14:42:31 2012 +0000
+++ b/configure.ac	Fri Jan 11 17:11:43 2013 +0000
@@ -57,6 +57,7 @@
 IT_DISABLE_LANGTOOLS_TESTS
 IT_DISABLE_JDK_TESTS
 
+#PR42003 - Missing javax.swing.plaf.basic.BasicDirectoryModel methods cause OpenJDK build failure 
 IT_CHECK_FOR_METHOD([JAVAX_SWING_PLAF_BASIC_BASICDIRECTORYMODEL_ADDPROPERTYCHANGELISTENER],
   [javax.swing.plaf.basic.BasicDirectoryModel.addPropertyChangeListener(PropertyChangeListener)],
   [javax.swing.plaf.basic.BasicDirectoryModel],
@@ -73,6 +74,10 @@
   [new com.sun.corba.se.impl.logging.ORBUtilSystemException(null).ioExceptionOnClose(new InternalError())]
 )
 
+# PR43389 - javax.management.StandardMBean
+IT_CHECK_FOR_CONSTRUCTOR([JAVAX_MANAGEMENT_STANDARDMBEAN_MXBEAN_TWO_ARG],[javax.management.StandardMBean],[Class.class,Boolean.TYPE],[Object.class, true])
+IT_CHECK_FOR_CONSTRUCTOR([JAVAX_MANAGEMENT_STANDARDMBEAN_MXBEAN_THREE_ARG],[javax.management.StandardMBean],[Object.class,Class.class,Boolean.TYPE],[new Object(), Object.class, true])
+
 # Use xvfb-run if found to run gui tests (check-jdk).
 AC_CHECK_PROG(XVFB_RUN_CMD, xvfb-run, [xvfb-run -a -e xvfb-errors], [])
 AC_SUBST(XVFB_RUN_CMD)