changeset 2941:14c3c86148a4

Complete work on PR1119 by making javax.security.sasl.Sasl conditional and working with empty ICEDTEA_BOOTSTRAP_CLASSES. 2013-01-25 Andrew John Hughes <gnu.andrew@redhat.com> PR1119: Only add classes to rt-source-files.txt if the class, or one or more of its methods/fields, are actually missing from the boot JDK * Makefile.am: (ICEDTEA_BOOTSTRAP_CLASSES): Initialise to empty. Make the inclusion of javax.security.sasl.Sasl dependent on the CREDENTIALS field being missing. * acinclude.m4: (IT_CHECK_FOR_STATIC_FIELD): New method to check for a static field. * configure.ac: Invoke IT_CHECK_FOR_STATIC_FIELD for javax.security.sasl.Sasl.CREDENTIALS. 2012-08-16 Andrew John Hughes <gnu_andrew@member.fsf.org> * Makefile.am: (rt-class-files.stamp): Add test of contents of ICEDTEA_BOOTSTRAP_CLASSES. Note; need to use grep as field contains whitespace. (rt.stamp): Likewise. 2010-09-14 Andrew John Hughes <ahughes@redhat.com> * Makefile.am, (rt-source-files.txt): Remove any existing version prior to generation to avoid duplication of source files.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Fri, 25 Jan 2013 15:16:55 +0000
parents 5c83d26b2437
children b6442f2ba732
files ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 4 files changed, 109 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 23 20:58:41 2013 +0000
+++ b/ChangeLog	Fri Jan 25 15:16:55 2013 +0000
@@ -1,3 +1,34 @@
+2013-01-25  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	PR1119: Only add classes to rt-source-files.txt if
+	the class, or one or more of its methods/fields,
+	are actually missing from the boot JDK
+	* Makefile.am:
+	(ICEDTEA_BOOTSTRAP_CLASSES):  Initialise to
+	empty.  Make the inclusion of
+	javax.security.sasl.Sasl dependent on the
+	CREDENTIALS field being missing.
+	* acinclude.m4:
+	(IT_CHECK_FOR_STATIC_FIELD): New method to
+	check for a static field.
+	* configure.ac: Invoke IT_CHECK_FOR_STATIC_FIELD
+	for javax.security.sasl.Sasl.CREDENTIALS.
+
+2012-08-16  Andrew John Hughes  <gnu_andrew@member.fsf.org>
+
+	* Makefile.am:
+	(rt-class-files.stamp): Add test of contents of
+	ICEDTEA_BOOTSTRAP_CLASSES.  Note; need to use grep as
+	field contains whitespace.
+	(rt.stamp): Likewise.
+
+2010-09-14  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am,
+	(rt-source-files.txt): Remove any existing
+	version prior to generation to avoid duplication
+	of source files.
+
 2013-01-23  Andrew John Hughes  <gnu.andrew@redhat.com>
 
 	CA172, PR1266: Add ARM hardfloat support to CACAO.
--- a/Makefile.am	Wed Jan 23 20:58:41 2013 +0000
+++ b/Makefile.am	Fri Jan 25 15:16:55 2013 +0000
@@ -63,9 +63,7 @@
 
 # Sources used from OpenJDK.
 
-# PR54275 - sun.security.sasl requires missing Sasl.CREDENTIALS field
-ICEDTEA_BOOTSTRAP_CLASSES = \
-	$(SHARE)/javax/security/sasl/Sasl.java
+ICEDTEA_BOOTSTRAP_CLASSES =
 
 #PR42003 - Missing javax.swing.plaf.basic.BasicDirectoryModel methods cause OpenJDK build failure 
 if LACKS_JAVAX_SWING_PLAF_BASIC_BASICDIRECTORYMODEL_ADDPROPERTYCHANGELISTENER
@@ -123,6 +121,12 @@
 	$(SHARE)/javax/security/auth/kerberos/KerberosTicket.java
 endif
 
+# PR54275 - sun.security.sasl requires missing Sasl.CREDENTIALS field
+if LACKS_JAVAX_SECURITY_SASL_SASL_CREDENTIALS
+ICEDTEA_BOOTSTRAP_CLASSES += \
+	$(SHARE)/javax/security/sasl/Sasl.java
+endif
+
 # Flags
 MEMORY_LIMIT = -J-Xmx1024m
 IT_CFLAGS=$(CFLAGS) $(ARCHFLAG)
@@ -2555,18 +2559,22 @@
 
 # rt.jar additional class files.
 rt-source-files.txt: $(OPENJDK_ECJ_TREE)
+	rm -f $@
 	for files in $(ICEDTEA_BOOTSTRAP_CLASSES) ; \
 	do \
 	  echo $$files >> $@ ; \
 	done
+	touch $@
 
 stamps/rt-class-files.stamp: $(INITIAL_BOOTSTRAP_LINK_STAMP) rt-source-files.txt
 if BOOTSTRAPPING
 	mkdir -p lib/rt
-	$(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) -d lib/rt \
-          -sourcepath $(SOURCEPATH_DIRS) -bootclasspath \'\' \
-          -classpath $(SYSTEM_JDK_DIR)/jre/lib/rt.jar \
-	  @rt-source-files.txt ;
+	if echo $(ICEDTEA_BOOTSTRAP_CLASSES) | grep '\S' &> /dev/null ; then \
+	  $(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) -d lib/rt \
+            -classpath $(SYSTEM_JDK_DIR)/jre/lib/rt.jar \
+            -sourcepath $(SOURCEPATH_DIRS) \
+	    -bootclasspath \'\' @rt-source-files.txt ; \
+	fi
 endif
 	mkdir -p stamps
 	touch stamps/rt-class-files.stamp
@@ -2586,8 +2594,10 @@
 stamps/rt.stamp: stamps/rt-class-files.stamp
 	mkdir -p stamps
 if BOOTSTRAPPING
-	$(BOOT_DIR)/bin/jar uf $(RUNTIME) -C lib/rt com -C lib/rt java \
-	  -C lib/rt javax -C lib/rt sun 
+	if echo $(ICEDTEA_BOOTSTRAP_CLASSES) | grep '\S' &> /dev/null ; then \
+	  $(BOOT_DIR)/bin/jar uf $(RUNTIME) -C lib/rt com -C lib/rt java \
+	    -C lib/rt javax -C lib/rt sun ; \
+	fi 
 endif
 	touch stamps/rt.stamp
 
--- a/acinclude.m4	Wed Jan 23 20:58:41 2013 +0000
+++ b/acinclude.m4	Fri Jan 25 15:16:55 2013 +0000
@@ -1938,3 +1938,59 @@
 AM_CONDITIONAL([LACKS_$1], test x"${it_cv_$1}" = "xyes")
 AC_PROVIDE([$0])dnl
 ])
+
+dnl Generic macro to check for a Java field
+dnl Takes five arguments: the name of the macro,
+dnl the name of the field and the name of the class.
+dnl The macro name is usually the name of the class
+dnl with '.' replaced by '_' and all letters
+dnl capitalised.
+dnl e.g. IT_CHECK_FOR_FIELD([JAVAX_SECURITY_SASL_SASL_CREDENTIALS],
+dnl [CREDENTIALS], [javax.security.sasl.Sasl])
+AC_DEFUN([IT_CHECK_FOR_STATIC_FIELD],[
+AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
+AC_CACHE_CHECK([if $3.$2 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.Field;
+
+public class Test
+{
+  public static void main(String[] args)
+  {
+    Class<?> cl = $3.class;
+    try
+      {
+        Field f = cl.getDeclaredField("$2");
+	System.err.println("Field found: " + f);
+	System.err.println("Field value: " + $3.$2);
+      }
+    catch (NoSuchFieldException e)
+      {
+        System.exit(-1);
+      }
+  }
+
+}
+]
+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 Jan 23 20:58:41 2013 +0000
+++ b/configure.ac	Fri Jan 25 15:16:55 2013 +0000
@@ -116,6 +116,9 @@
   [new javax.security.auth.kerberos.KerberosTicket(null,null,null,null,0,null,null,null,null,null,null).getSessionKeyType()]
 )
 
+# PR54275 - sun.security.sasl requires missing Sasl.CREDENTIALS field
+IT_CHECK_FOR_STATIC_FIELD([JAVAX_SECURITY_SASL_SASL_CREDENTIALS],[CREDENTIALS],[javax.security.sasl.Sasl])
+
 # 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)