changeset 1722:b60e655cb130

Add a test for the Classpath 39408 bug in gjavah. 2009-03-17 Andrew John Hughes <ahughes@redhat.com> * acinclude.m4: (IT_CP39408_JAVAH): New test for Classpath bug 39408. * configure.ac: Enable new test. Result as yet unused.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 18 Mar 2009 04:33:56 +0000
parents e6d83e63e8e3
children 839024180a41
files ChangeLog acinclude.m4 configure.ac
diffstat 3 files changed, 58 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Mar 17 00:44:07 2009 +0000
+++ b/ChangeLog	Wed Mar 18 04:33:56 2009 +0000
@@ -1,3 +1,11 @@
+2009-03-17  Andrew John Hughes  <ahughes@redhat.com>
+
+	* acinclude.m4:
+	(IT_CP39408_JAVAH): New test for Classpath
+	bug 39408.
+	* configure.ac: Enable new test.  Result
+	as yet unused.
+
 2009-03-17  Andrew John Hughes  <ahughes@redhat.com>
 
 	* overlays/nio2/openjdk/jdk/src/share/classes/java/nio/file/attribute/NamedAttributeView.java,
--- a/acinclude.m4	Tue Mar 17 00:44:07 2009 +0000
+++ b/acinclude.m4	Wed Mar 18 04:33:56 2009 +0000
@@ -1,4 +1,4 @@
-AC_DEFUN([SET_ARCH_DIRS],
+ AC_DEFUN([SET_ARCH_DIRS],
 [
   case "${host}" in
     x86_64-*-*)
@@ -1172,4 +1172,51 @@
   AC_SUBST(SYSTEM_ICEDTEA_DIR)
 ])
 
-
+AC_DEFUN([IT_CP39408_JAVAH],[
+AC_CACHE_CHECK([if $JAVAH exhibits Classpath bug 39408], it_cv_cp39408_javah, [
+SUPERCLASS=Test.java
+SUBCLASS=TestImpl.java
+SUB=$(echo $SUBCLASS|sed 's#\.java##')
+SUBHEADER=$(echo $SUBCLASS|sed 's#\.java#.h#')
+mkdir tmp.$$
+cd tmp.$$
+cat << \EOF > $SUPERCLASS
+/* [#]line __oline__ "configure" */
+public class Test 
+{
+  public static final int POTATO = 0;
+  public static final int CABBAGE = 1;
+}
+EOF
+cat << \EOF > $SUBCLASS
+/* [#]line __oline__ "configure" */
+public class TestImpl
+  extends Test
+{
+  public native void doStuff();
+}
+EOF
+if $JAVAC $JAVACFLAGS $SUBCLASS >/dev/null 2>&1; then
+  if $JAVAH -classpath . $SUB > /dev/null 2>&1; then
+    if cat $SUBHEADER | grep POTATO > /dev/null 2>&1; then
+      it_cv_cp39408_javah=no;
+    else
+      it_cv_cp39408_javah=yes;
+    fi
+  else
+    AC_MSG_ERROR([The Java header generator $JAVAH failed])
+    echo "configure: failed program was:" >&AC_FD_CC
+    cat $SUBCLASS >&AC_FD_CC
+  fi
+else
+  AC_MSG_ERROR([The Java compiler $JAVAC failed])
+  echo "configure: failed program was:" >&AC_FD_CC
+  cat $SUBCLASS >&AC_FD_CC
+fi
+rm -f $SUBCLASS $SUPERCLASS $SUBHEADER *.class
+cd ..
+rmdir tmp.$$
+])
+AM_CONDITIONAL([CP39408_JAVAH], test x"${it_cv_cp39408_javah}" = "xyes")
+AC_PROVIDE([$0])dnl
+])
--- a/configure.ac	Tue Mar 17 00:44:07 2009 +0000
+++ b/configure.ac	Wed Mar 18 04:33:56 2009 +0000
@@ -269,6 +269,7 @@
   AC_CONFIG_FILES([javap], [chmod +x javap])
 fi
 fi
+IT_CP39408_JAVAH
 FIND_RHINO_JAR
 WITH_OPENJDK_SRC_ZIP
 WITH_HOTSPOT_SRC_ZIP