changeset 1850:a82258f09fae

Enable the new plugin by default for xulrunner >= 1.9.2 and don't use libxul-unstable in such cases. 2010-01-25 Andrew John Hughes <ahughes@redhat.com> * acinclude.m4: (IT_CHECK_OLD_PLUGIN): New macro for --enable/disable-plugin. (IT_CHECK_NEW_PLUGIN): Likewise for --enable/disable-npplugin. (IT_CHECK_PLUGIN_DEPENDENCIES): New macro to run pkg-config checks. Enables the new plugin if xulrunner 1.9.2 or above is detected. (IT_CHECK_XULRUNNER_VERSION): Obtain the XULrunner vgersion for MOZILLA_VERSION_COLLAPSED. * configure.ac: Replace old plugin stuff with a single call to IT_CHECK_XULRUNNER_VERSION (which depends on the other macros).
author Andrew John Hughes <ahughes@redhat.com>
date Tue, 26 Jan 2010 19:45:53 +0000
parents 51f89f2b360e
children a6503bfb7390 80b2080f8c91
files ChangeLog acinclude.m4 configure.ac
diffstat 3 files changed, 142 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jan 25 23:05:52 2010 +0000
+++ b/ChangeLog	Tue Jan 26 19:45:53 2010 +0000
@@ -1,3 +1,21 @@
+2010-01-25 Andrew John Hughes  <ahughes@redhat.com>
+
+	* acinclude.m4:
+	(IT_CHECK_OLD_PLUGIN): New macro for
+	--enable/disable-plugin.
+	(IT_CHECK_NEW_PLUGIN): Likewise for
+	--enable/disable-npplugin.
+	(IT_CHECK_PLUGIN_DEPENDENCIES): New macro
+	to run pkg-config checks.  Enables the new
+	plugin if xulrunner 1.9.2 or above is
+	detected.
+	(IT_CHECK_XULRUNNER_VERSION): Obtain the
+	XULrunner vgersion for MOZILLA_VERSION_COLLAPSED.
+	* configure.ac:
+	Replace old plugin stuff with a single call
+	to IT_CHECK_XULRUNNER_VERSION (which depends
+	on the other macros).
+
 2010-01-25 Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am:
--- a/acinclude.m4	Mon Jan 25 23:05:52 2010 +0000
+++ b/acinclude.m4	Tue Jan 26 19:45:53 2010 +0000
@@ -1222,3 +1222,126 @@
   AM_CONDITIONAL([HAS_JDK_REVISION], test "x${JDK_REVISION}" != xnone)
   AM_CONDITIONAL([HAS_HOTSPOT_REVISION], test "x${HOTSPOT_REVISION}" != xnone)
 ])
+
+AC_DEFUN_ONCE([IT_CHECK_OLD_PLUGIN],
+[
+AC_MSG_CHECKING([whether to build the browser plugin])
+AC_ARG_ENABLE([plugin],
+              [AS_HELP_STRING([--disable-plugin],
+                              [Disable compilation of browser plugin])],
+              [enable_plugin="${enableval}"], [enable_plugin="yes"])
+AC_MSG_RESULT(${enable_plugin})
+])
+
+AC_DEFUN_ONCE([IT_CHECK_NEW_PLUGIN],
+[
+AC_MSG_CHECKING([whether to build the new experimental browser plugin based on npruntime])
+AC_ARG_ENABLE([npplugin],
+              [AS_HELP_STRING([--enable-npplugin],
+                              [Enable compilation of browser plugin (automatically disables default plugin)])],
+              [enable_npplugin="${enableval}"], [enable_npplugin="no"])
+AC_MSG_RESULT(${enable_npplugin})
+])
+
+AC_DEFUN_ONCE([IT_CHECK_PLUGIN_DEPENDENCIES],
+[
+dnl Check for plugin support headers and libraries.
+dnl FIXME: use unstable
+AC_REQUIRE([IT_CHECK_OLD_PLUGIN])
+AC_REQUIRE([IT_CHECK_NEW_PLUGIN])
+if test "x${enable_plugin}" = "xyes" -o "x${enable_npplugin}" = "xyes" ; then
+  PKG_CHECK_MODULES(GTK, gtk+-2.0)
+  PKG_CHECK_MODULES(GLIB, glib-2.0)
+  AC_SUBST(GLIB_CFLAGS)
+  AC_SUBST(GLIB_LIBS)
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+
+
+  if $PKG_CONFIG --atleast-version 1.9.2 libxul 2>&AS_MESSAGE_LOG_FD ; then
+    if test "x${enable_npplugin}" != "xyes" ; then
+      AC_MSG_WARN([The old plugin does not work with xulrunner >= 1.9.2.  Enabling new plugin.])
+      enable_npplugin=yes;
+    fi
+    xullibs=libxul
+  else
+    xullibs="libxul libxul-unstable"
+  fi
+
+  if test "x${enable_npplugin}" = "xyes" ;
+  then
+    PKG_CHECK_MODULES(MOZILLA, \
+      mozilla-plugin ${xullibs})
+    
+    AC_SUBST(MOZILLA_CFLAGS)
+    AC_SUBST(MOZILLA_LIBS)
+  else
+    if test "x${enable_plugin}" = "xyes"
+    then
+      PKG_CHECK_MODULES(MOZILLA, \
+        nspr mozilla-js mozilla-plugin libxul-unstable >= 1.9)
+
+      AC_SUBST(MOZILLA_CFLAGS)
+      AC_SUBST(MOZILLA_LIBS)
+    fi
+  fi
+fi
+AM_CONDITIONAL(ENABLE_PLUGIN, test "x${enable_plugin}" = "xyes")
+AM_CONDITIONAL(ENABLE_NPPLUGIN, test "x${enable_npplugin}" = "xyes")
+])
+
+AC_DEFUN_ONCE([IT_CHECK_XULRUNNER_VERSION],
+[
+AC_REQUIRE([IT_CHECK_PLUGIN_DEPENDENCIES])
+if test "x${enable_plugin}" = "xyes" -o "x${enable_npplugin}" = "xyes"
+then
+  AC_LANG_PUSH([C++])
+  OLDCPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS $MOZILLA_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)
+fi
+])
+
--- a/configure.ac	Mon Jan 25 23:05:52 2010 +0000
+++ b/configure.ac	Tue Jan 26 19:45:53 2010 +0000
@@ -93,22 +93,6 @@
 AM_CONDITIONAL(WITH_VISUALVM, test "x${enable_visualvm}" = "xyes")
 AC_MSG_RESULT(${enable_visualvm})
 
-AC_MSG_CHECKING([whether to build the browser plugin])
-AC_ARG_ENABLE([plugin],
-              [AS_HELP_STRING([--disable-plugin],
-                              [Disable compilation of browser plugin])],
-              [enable_plugin="${enableval}"], [enable_plugin="yes"])
-AM_CONDITIONAL(ENABLE_PLUGIN, test "x${enable_plugin}" = "xyes")
-AC_MSG_RESULT(${enable_plugin})
-
-AC_MSG_CHECKING([whether to build the new experimental browser plugin based on npruntime])
-AC_ARG_ENABLE([npplugin],
-              [AS_HELP_STRING([--enable-npplugin],
-                              [Enable compilation of browser plugin (automatically disables default plugin)])],
-              [enable_npplugin="${enableval}"], [enable_npplugin="no"])
-AM_CONDITIONAL(ENABLE_NPPLUGIN, test "x${enable_npplugin}" = "xyes")
-AC_MSG_RESULT(${enable_npplugin})
-
 AC_MSG_CHECKING([whether to include PulseAudio support])
 AC_ARG_ENABLE([pulse-java],
               [AS_HELP_STRING([--enable-pulse-java],
@@ -213,6 +197,7 @@
 IT_CHECK_ADDITIONAL_VMS
 ENABLE_HG
 AC_CHECK_WITH_HG_REVISION
+IT_CHECK_XULRUNNER_VERSION
 
 if test "x${enable_visualvm}" = "xyes"
 then
@@ -414,89 +399,6 @@
   AC_SUBST(LIBPULSE_LIBS)
 fi
 
-dnl Check for plugin support headers and libraries.
-dnl FIXME: use unstable
-if test "x${enable_plugin}" = "xyes"
-  then
-    PKG_CHECK_MODULES(MOZILLA, \
-      nspr mozilla-js mozilla-plugin libxul-unstable >= 1.9)
-    PKG_CHECK_MODULES(GTK, gtk+-2.0)
-    PKG_CHECK_MODULES(GLIB, glib-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)
-  fi
-
-if test "x${enable_npplugin}" = "xyes"
-  then
-    PKG_CHECK_MODULES(MOZILLA, \
-      mozilla-plugin libxul libxul-unstable)
-    PKG_CHECK_MODULES(GTK, gtk+-2.0)
-    PKG_CHECK_MODULES(GLIB, glib-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)
-  fi
-
-if test "x${enable_plugin}" = "xyes" -o "x${enable_npplugin}" = "xyes"
-then
-  AC_LANG_PUSH([C++])
-  OLDCPPFLAGS="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $MOZILLA_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)
-fi
-
 if test "x${ENABLE_NSS}" = "xyes"
 then
   PKG_CHECK_MODULES(NSS, nss, [NSS_FOUND=yes], [NSS_FOUND=no])