changeset 275:fe8436ed6d95

Made buildable against both xulrunners
author Jiri Vanek <jvanek@redhat.com>
date Wed, 21 Dec 2011 10:34:41 +0100
parents d494ec44a194
children 88e6e058cdf3
files ChangeLog acinclude.m4 configure.ac plugin/icedteanp/IcedTeaNPPlugin.cc
diffstat 4 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 08 16:09:22 2011 -0500
+++ b/ChangeLog	Wed Dec 21 10:34:41 2011 +0100
@@ -1,3 +1,13 @@
+2011-12-21  Jiri Vanek  <jvanek@redhat.com>
+
+	* acinclude.m4: added definition of IT_CHECK_XULRUNNER_API_VERSION,
+	which tries to compile small program against new xulrunner api
+	* configure.ac: added call of IT_CHECK_XULRUNNER_API_VERSION
+	* plugin/icedteanp/IcedTeaNPPlugin.cc: (NP_GetMIMEDescription) 
+	return type set-up by dependency on defined LEGACY_XULRUNNERAPI.
+	 This one is set by IT_CHECK_XULRUNNER_API_VERSION during configure.
+	if defined, then old char* is used. New const char* is used otherwise.
+
 2011-12-08  Omair Majid  <omajid@redhat.com>
 
 	* netx/net/sourceforge/jnlp/Launcher.java
--- a/acinclude.m4	Thu Dec 08 16:09:22 2011 -0500
+++ b/acinclude.m4	Wed Dec 21 10:34:41 2011 +0100
@@ -491,6 +491,26 @@
 AC_SUBST(PKGVERSION)
 ])
 
+AC_DEFUN_ONCE([IT_CHECK_XULRUNNER_API_VERSION],
+[
+  AC_MSG_CHECKING([for legacy xulrunner api])
+  AC_LANG_PUSH(C++)
+  CXXFLAGS_BACKUP=$CXXFLAGS
+  CXXFLAGS=$CXXFLAGS" "$MOZILLA_CFLAGS
+  AC_TRY_COMPILE([
+    #include <npfunctions.h>
+    const  char* NP_GetMIMEDescription ()
+    {return (char*) "yap!";}
+  ],[],[
+    AC_MSG_RESULT(no)
+  ],[
+    AC_MSG_RESULT(yes)
+    AC_DEFINE([LEGACY_XULRUNNERAPI])
+  ])
+  CXXFLAGS=$CXXFLAGS_BACKUP
+  AC_LANG_POP(C++)
+])
+
 AC_DEFUN([IT_CHECK_WITH_GCJ],
 [
   AC_MSG_CHECKING([whether to compile ecj natively])
--- a/configure.ac	Thu Dec 08 16:09:22 2011 -0500
+++ b/configure.ac	Wed Dec 21 10:34:41 2011 +0100
@@ -78,6 +78,7 @@
 IT_CHECK_FOR_CLASS(COM_SUN_JNDI_TOOLKIT_URL_URLUTIL, [com.sun.jndi.toolkit.url.UrlUtil])
 IT_CHECK_FOR_CLASS(SUN_APPLET_APPLETIMAGEREF, [sun.applet.AppletImageRef])
 IT_CHECK_FOR_APPLETVIEWERPANEL_HOLE
+IT_CHECK_XULRUNNER_API_VERSION
 
 #
 # Find optional depedencies
--- a/plugin/icedteanp/IcedTeaNPPlugin.cc	Thu Dec 08 16:09:22 2011 -0500
+++ b/plugin/icedteanp/IcedTeaNPPlugin.cc	Wed Dec 21 10:34:41 2011 +0100
@@ -2262,7 +2262,11 @@
 
 // Returns a string describing the MIME type that this plugin
 // handles.
-char*
+#ifdef LEGACY_XULRUNNERAPI
+  char* 
+#else
+  const char* 
+#endif
 NP_GetMIMEDescription ()
 {
   PLUGIN_DEBUG ("NP_GetMIMEDescription\n");