changeset 2600:830e2c11d9f3

Fix Makefile dependencies issue with xalan/xerces for F15 builds.
author Danesh Dadachanji <ddadacha@redhat.com>
date Wed, 15 Jun 2011 15:29:46 -0400
parents 7d491356b6d9
children f5b82f792313 5c6d4ea2f55d
files AUTHORS ChangeLog Makefile.am acinclude.m4 configure.ac
diffstat 5 files changed, 120 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Wed Jun 15 11:57:46 2011 -0400
+++ b/AUTHORS	Wed Jun 15 15:29:46 2011 -0400
@@ -8,6 +8,7 @@
 Deepak Bhole <dbhole@redhat.com>
 Tom Callaway <tcallawa@redhat.com>
 Pablo del Campo <pablogdc@gmail.com>
+Danesh Dadachanji <ddadacha@redhat.com>
 Thomas Fitzsimmons <fitzsim@redhat.com>
 Matthew Flaschen <matthew.flaschen@gatech.edu>
 Michael Franz <mvfranz@gmail.com>
--- a/ChangeLog	Wed Jun 15 11:57:46 2011 -0400
+++ b/ChangeLog	Wed Jun 15 15:29:46 2011 -0400
@@ -1,3 +1,14 @@
+2011-06-15  Danesh Dadachanji  <ddadacha@redhat.com>
+
+	* AUTHORS: Added myself.
+	* Makefile.am: Use explicit xml-commons locations if necessary.
+	* acinclude.m4: Added explicit xml-commons check.
+	(IT_CHECK_IF_INSTANTIABLE): Added generic macro to instantiate any
+	class. Paramaters are the define, name of the class, paramaters
+	for instatiation and (optional) classpath.
+	* configure.ac: Invoke IT_FIND_XML_COMMONS_APIS_JAR macro after
+	IT_FIND_XERCES2_JAR, assigns XML_COMMONS_APIS_JAR if necessary.
+
 2011-06-15  Denis Lila  <dlila@redhat.com>
 
 	* Makefile.am: Add back the -classpath option to javah in
--- a/Makefile.am	Wed Jun 15 11:57:46 2011 -0400
+++ b/Makefile.am	Wed Jun 15 15:29:46 2011 -0400
@@ -1288,7 +1288,12 @@
 	ln -sf $(XALAN2_JAR) $(ECJ_BOOT_DIR)/lib/endorsed/xalan-j2.jar && \
 	ln -sf $(XALAN2_SERIALIZER_JAR) \
 	  $(ECJ_BOOT_DIR)/lib/endorsed/xalan-j2-serializer.jar && \
-	ln -sf $(XERCES2_JAR) $(ECJ_BOOT_DIR)/lib/endorsed/xerces-j2.jar
+	ln -sf $(XERCES2_JAR) $(ECJ_BOOT_DIR)/lib/endorsed/xerces-j2.jar && \
+	if test -n "$(XML_COMMONS_APIS_JAR)"; \
+		then \
+		ln -sf $(XML_COMMONS_APIS_JAR) \
+			$(ECJ_BOOT_DIR)/lib/endorsed/xml-commons-apis.jar; \
+	fi
 	mkdir -p $(ECJ_BOOT_DIR)/jre/lib && \
 	cp $(SYSTEM_JDK_DIR)/jre/lib/rt.jar $(ECJ_BOOT_DIR)/jre/lib/rt.jar && \
 	ln -sf $(SYSTEM_JDK_DIR)/jre/lib/$(JRE_ARCH_DIR) \
--- a/acinclude.m4	Wed Jun 15 11:57:46 2011 -0400
+++ b/acinclude.m4	Wed Jun 15 15:29:46 2011 -0400
@@ -725,6 +725,43 @@
   AC_SUBST(XERCES2_JAR)
 ])
 
+AC_DEFUN([IT_FIND_XML_COMMONS_APIS_JAR],
+[
+  AC_MSG_CHECKING([for an xml-commons-apis jar])
+  AC_ARG_WITH([xml-commons-apis-jar],
+              [AS_HELP_STRING(--with-xml-commons-apis-jar,specify location of the xml-commons-apis jar)],
+  [
+    if test -f "${withval}" || test -h "${withval}" ; then
+      XML_COMMONS_APIS_JAR="${withval}"
+    fi
+  ],
+  [
+    XML_COMMONS_APIS_JAR=
+  ])
+  if test -z "${XML_COMMONS_APIS_JAR}"; then
+    if test -e "/usr/share/java/xml-commons-apis.jar"; then
+      XML_COMMONS_APIS_JAR=/usr/share/java/xml-commons-apis.jar
+    elif test -e "/usr/share/java/xml-apis.jar"; then
+      XML_COMMONS_APIS_JAR=/usr/share/java/xml-apis.jar
+    elif test -e "/usr/share/xml-commons/lib/xml-apis.jar"; then
+      XML_COMMONS_APIS_JAR=/usr/share/xml-commons/lib/xml-apis.jar
+    elif test -e "/usr/share/java/xml-apis-ext.jar";  then
+      XML_COMMONS_APIS_JAR=/usr/share/java/xml-apis-ext.jar
+    elif test -e "/usr/share/java/xml-commons-external.jar";  then
+      XML_COMMONS_APIS_JAR=/usr/share/java/xml-commons-external.jar
+    elif test -e "/usr/share/java/apache-xml-commons-apis.jar";  then
+      XML_COMMONS_APIS_JAR=/usr/share/java/apache-xml-commons-apis.jar
+    else
+      AC_MSG_RESULT(no)
+    fi
+  fi
+  if test -z "${XML_COMMONS_APIS_JAR}"; then
+    AC_MSG_ERROR("An xml-commons-apis jar was not found.")
+  fi
+  AC_MSG_RESULT(${XML_COMMONS_APIS_JAR})
+  AC_SUBST(XML_COMMONS_APIS_JAR)
+])
+
 AC_DEFUN([IT_FIND_RHINO_JAR],
 [
   AC_MSG_CHECKING([whether to include Javascript support via Rhino])
@@ -1374,6 +1411,62 @@
 AC_PROVIDE([$0])dnl
 ])
 
+dnl Generic macro to instantiate a Java class
+dnl Takes three arguments: the name of the macro,
+dnl the name of the class and the instantiation
+dnl paramaters.  The macro name is usually the 
+dnl name of the class with '.' replaced by '_' 
+dnl and all letters capitalised.
+dnl Also takes optional classpath paramater.
+dnl e.g. IT_CHECK_FOR_INSTANTIABLE_CLASS([JAVA_LANG_INTEGER],
+dnl        [java.lang.Integer],[0],[./bin])
+AC_DEFUN([IT_CHECK_IF_INSTANTIABLE],[
+AC_CACHE_CHECK([if $2 is instantiable], it_cv_$1, [
+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)
+  {
+    new $2($3);
+  }
+}
+]
+EOF
+
+if test -z $4; then
+  WITH_CLASSPATH=.
+else
+  WITH_CLASSPATH=$4:.
+fi
+
+if $JAVAC -cp $WITH_CLASSPATH $JAVACFLAGS -nowarn $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+  if $JAVA -classpath $WITH_CLASSPATH $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
+    it_cv_$1=yes;
+  else
+    it_cv_$1=no;
+  fi
+else
+  it_cv_$1=no;
+fi
+])
+rm -f $CLASS *.class
+cd ..
+rmdir tmp.$$
+
+if test x"${it_cv_$1}" = "xyes"
+then
+  $1_INSTANTIABLE=yes
+else
+  $1_INSTANTIABLE=no
+fi
+AC_PROVIDE([$0])dnl
+])
+
 # Finds number of available processors using sysconf
 AC_DEFUN_ONCE([IT_FIND_NUMBER_OF_PROCESSORS],[
   IT_FIND_TOOL([GETCONF], [getconf])
--- a/configure.ac	Wed Jun 15 11:57:46 2011 -0400
+++ b/configure.ac	Wed Jun 15 15:29:46 2011 -0400
@@ -159,6 +159,15 @@
   IT_FIND_XALAN2_JAR
   IT_FIND_XALAN2_SERIALIZER_JAR
   IT_FIND_XERCES2_JAR
+  IT_CHECK_IF_INSTANTIABLE([ORG_APACHE_XERCES_DOM_DEFERREDDOCUMENTIMPL],
+[org.apache.xerces.dom.DeferredDocumentImpl],[],
+[$XALAN2_JAR:$XALAN2_SERIALIZER_JAR:$XERCES2_JAR])
+  if test x"${ORG_APACHE_XERCES_DOM_DEFERREDDOCUMENTIMPL_INSTANTIABLE}" = "xno"
+  then
+    IT_FIND_XML_COMMONS_APIS_JAR
+  else
+    XML_COMMONS_APIS_JAR=
+  fi
 fi
 AC_CONFIG_FILES([javac], [chmod +x javac])
 AC_CONFIG_FILES([javap], [chmod +x javap])