# HG changeset patch # User Deepak Bhole # Date 1241557477 14400 # Node ID 3ab9b1133b7d652c407db24355619aa42aa6982e # Parent db595a21b09dcfde54046c1fbc61cdf4824e32d4 Add conditional compilation to accomodate changed api in xulrunner 1.9.1 diff -r db595a21b09d -r 3ab9b1133b7d ChangeLog --- 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 + + * 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 * autogen.sh: Lower requirements to autoconf 2.59 and automake 1.9.6. diff -r db595a21b09d -r 3ab9b1133b7d IcedTeaPlugin.cc --- 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, diff -r db595a21b09d -r 3ab9b1133b7d Makefile.am --- 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 $@ $< diff -r db595a21b09d -r 3ab9b1133b7d configure.ac --- 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 +#include +#include +#include +#include +]],[[ +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'.]),