changeset 1802:3ab9b1133b7d

Add conditional compilation to accomodate changed api in xulrunner 1.9.1
author Deepak Bhole <dbhole@redhat.com>
date Tue, 05 May 2009 17:04:37 -0400
parents db595a21b09d
children 9fdc241371af
files ChangeLog IcedTeaPlugin.cc Makefile.am configure.ac
diffstat 4 files changed, 62 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed May 20 20:31:58 2009 +0100
+++ b/ChangeLog	Tue May 05 17:04:37 2009 -0400
@@ -1,3 +1,11 @@
+2009-05-05  Deepak Bhole <dbhole@redhat.com>
+
+	* IcedTeaPlugin.cc: Add conditional compilation block.
+	* Makefile.am: Define a collapsed (comparable) version when compiling the
+	plugin.
+	* configure.ac: Determine a collapsed (comparable) version that can be
+	used by the preprocessor for conditional compilation.
+
 2009-05-04  Mark Wielaard  <mjw@redhat.com>
 
 	* autogen.sh: Lower requirements to autoconf 2.59 and automake 1.9.6.
--- a/IcedTeaPlugin.cc	Wed May 20 20:31:58 2009 +0100
+++ b/IcedTeaPlugin.cc	Tue May 05 17:04:37 2009 -0400
@@ -3788,7 +3788,11 @@
     }
   PLUGIN_DEBUG_TWO ("created output fifo:", out_pipe_name);
 
+#if MOZILLA_VERSION_COLLAPSED < 1090100
   result = applet_viewer_process->Run (PR_FALSE, args, numArgs, nsnull);
+#else
+  result = applet_viewer_process->Run (PR_FALSE, args, numArgs);
+#endif
   PLUGIN_CHECK_RETURN ("run process", result);
 
   out_to_appletviewer = g_io_channel_new_file (out_pipe_name,
--- a/Makefile.am	Wed May 20 20:31:58 2009 +0100
+++ b/Makefile.am	Tue May 05 17:04:37 2009 -0400
@@ -3075,6 +3075,7 @@
 	$(CXX) $(CXXFLAGS) \
 	  -DPACKAGE_VERSION="\"$(PACKAGE_VERSION)\"" \
 	  -DPLUGIN_VERSION="\"$$plugin_version\"" \
+	  -DMOZILLA_VERSION_COLLAPSED="$(MOZILLA_VERSION_COLLAPSED)" \
 	  $(GTK_CFLAGS) \
 	  $(XULRUNNER_CFLAGS) \
 	  -fPIC -c -o $@ $<
--- a/configure.ac	Wed May 20 20:31:58 2009 +0100
+++ b/configure.ac	Tue May 05 17:04:37 2009 -0400
@@ -559,6 +559,55 @@
   fi
 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'.]),