changeset 1803:9fdc241371af

Cleanup XULRunner version check. 2009-05-20 Andrew John Hughes <ahughes@redhat.com> * acinclude.m4: (IT_XULRUNNER_VERSION): New macro. * configure.ac: Move XULRunner version check to its own macro and only execute when the plugin is turned on.
author Andrew John Hughes <ahughes@redhat.com>
date Wed, 20 May 2009 20:43:04 +0100
parents 3ab9b1133b7d
children bbac5c54022b
files ChangeLog acinclude.m4 configure.ac
diffstat 3 files changed, 65 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue May 05 17:04:37 2009 -0400
+++ b/ChangeLog	Wed May 20 20:43:04 2009 +0100
@@ -1,3 +1,12 @@
+2009-05-20  Andrew John Hughes  <ahughes@redhat.com>
+
+	* acinclude.m4:
+	(IT_XULRUNNER_VERSION): New macro.
+	* configure.ac:
+	Move XULRunner version check to its
+	own macro and only execute when the plugin
+	is turned on.
+
 2009-05-05  Deepak Bhole <dbhole@redhat.com>
 
 	* IcedTeaPlugin.cc: Add conditional compilation block.
--- a/acinclude.m4	Tue May 05 17:04:37 2009 -0400
+++ b/acinclude.m4	Wed May 20 20:43:04 2009 +0100
@@ -1447,3 +1447,54 @@
   AM_CONDITIONAL(ENABLE_NIMBUS, test x"${ENABLE_NIMBUS}" = "xyes")
   AC_SUBST(ENABLE_NIMBUS)
 ])
+
+AC_DEFUN([IT_XULRUNNER_VERSION],
+[
+AC_LANG_PUSH([C++])
+OLDCPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $XULRUNNER_CFLAGS"
+
+AC_CACHE_CHECK([for xulrunner version], [xulrunner_cv_collapsed_version],
+    [AC_RUN_IFELSE(
+      [AC_LANG_PROGRAM([[
+#include <mozilla-config.h>
+#include <math.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+]],[[
+int version = 0;
+const char* token = NULL;
+int power=6;
+FILE *datafile;
+
+datafile = fopen ("conftest.vdata", "w");
+if (!datafile) return 1;
+
+// 32 chars is more than enough to hold version
+char* mozilla_version = (char*) malloc(32*sizeof(char));
+snprintf(mozilla_version, 32, "%s", MOZILLA_VERSION);
+
+token = strtok(mozilla_version, ".");
+while (token)
+{
+    version += atoi(token)*(pow(10, power));
+    power -=2;
+    token = strtok(NULL, ".");
+}
+
+fprintf (datafile, "%d\n", version);
+free(mozilla_version);
+if (fclose(datafile)) return 1;
+
+return EXIT_SUCCESS;
+]])],
+    [xulrunner_cv_collapsed_version="$(cat conftest.vdata)"],
+    [AC_MSG_FAILURE([cannot determine xulrunner version])])],
+  [xulrunner_cv_collapsed_version="190000"])
+
+CPPFLAGS="$OLDCPPFLAGS"
+AC_LANG_POP([C++])
+
+AC_SUBST(MOZILLA_VERSION_COLLAPSED, $xulrunner_cv_collapsed_version)
+])
--- a/configure.ac	Tue May 05 17:04:37 2009 -0400
+++ b/configure.ac	Wed May 20 20:43:04 2009 +0100
@@ -502,112 +502,14 @@
 
 dnl Check for plugin support headers and libraries.
 dnl FIXME: use unstable
-if test "x${enable_gcjwebplugin}" = "xyes"
+if test "x${enable_plugin}" = "xyes"
 then
-    PKG_CHECK_MODULES(MOZILLA, mozilla-plugin libxul-unstable, \
-      [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, mozilla-plugin, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, firefox-plugin firefox-xpcom, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, xulrunner-plugin xulrunner-xpcom, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, mozilla-firefox-plugin mozilla-firefox-xpcom, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, seamonkey-plugin seamonkey-xpcom, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      PKG_CHECK_MODULES(MOZILLA, iceape-plugin iceape-xpcom, \
-        [MOZILLA_FOUND=yes], [MOZILLA_FOUND=no])
-    fi
-    if test "x${MOZILLA_FOUND}" = xno
-    then
-      AC_MSG_ERROR([Could not find plugin support headers and libraries.])
-    fi
-
-    PKG_CHECK_MODULES(GLIB, glib-2.0)
-    PKG_CHECK_MODULES(GTK, gtk+-2.0 gthread-2.0 gdk-pixbuf-2.0)
-
-    AC_SUBST(MOZILLA_CFLAGS)
-    AC_SUBST(MOZILLA_LIBS)
-    AC_SUBST(GLIB_CFLAGS)
-    AC_SUBST(GLIB_LIBS)
-    AC_SUBST(GTK_CFLAGS)
-    AC_SUBST(GTK_LIBS)
-else
-  if test "x${enable_plugin}" = "xyes"
-  then
-    PKG_CHECK_MODULES(XULRUNNER, \
-      nspr mozilla-js mozilla-plugin libxul-unstable >= 1.9)
-    PKG_CHECK_MODULES(GTK, gtk+-2.0)
-  fi
+  PKG_CHECK_MODULES(XULRUNNER, \
+    nspr mozilla-js mozilla-plugin libxul-unstable >= 1.9)
+  PKG_CHECK_MODULES(GTK, gtk+-2.0)
+  IT_XULRUNNER_VERSION
 fi
 
-AC_LANG_PUSH([C++])
-OLDCPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS $XULRUNNER_CFLAGS"
-
-AC_CACHE_CHECK([for xulrunner version], [xulrunner_cv_collapsed_version],
-    [AC_RUN_IFELSE(
-      [AC_LANG_PROGRAM([[
-#include <mozilla-config.h>
-#include <math.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-]],[[
-int version = 0;
-const char* token = NULL;
-int power=6;
-FILE *datafile;
-
-datafile = fopen ("conftest.vdata", "w");
-if (!datafile) return 1;
-
-// 32 chars is more than enough to hold version
-char* mozilla_version = (char*) malloc(32*sizeof(char));
-snprintf(mozilla_version, 32, "%s", MOZILLA_VERSION);
-
-token = strtok(mozilla_version, ".");
-while (token)
-{
-    version += atoi(token)*(pow(10, power));
-    power -=2;
-    token = strtok(NULL, ".");
-}
-
-fprintf (datafile, "%d\n", version);
-free(mozilla_version);
-if (fclose(datafile)) return 1;
-
-return EXIT_SUCCESS;
-]])],
-    [xulrunner_cv_collapsed_version="$(cat conftest.vdata)"],
-    [AC_MSG_FAILURE([cannot determine xulrunner version])])],
-  [xulrunner_cv_collapsed_version="190000"])
-
-CPPFLAGS="$OLDCPPFLAGS"
-AC_LANG_POP([C++])
-
-AC_SUBST(MOZILLA_VERSION_COLLAPSED, $xulrunner_cv_collapsed_version)
-
-
 AC_MSG_CHECKING(for --with-additional-vms)
 AC_ARG_WITH(additional-vms,
             AC_HELP_STRING([--with-additional-vms=vm-list], [build additional virtual machines. Valid value is a comma separated string with the backend names `cacao', `zero' and `shark'.]),