[Libreoffice-commits] .: config_host.mk.in configure.in extensions/Library_npsoplugin.mk extensions/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue Feb 21 08:22:34 PST 2012


 config_host.mk.in                             |    1 +
 configure.in                                  |   20 ++++++++++++++++++++
 extensions/Library_npsoplugin.mk              |    6 ++++++
 extensions/source/nsplugin/source/npshell.cxx |    5 ++++-
 4 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit e6d0daefbdb8367384d8e5c217f65118bd8dc565
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Feb 21 16:56:10 2012 +0100

    build also with older npapi
    
    They were apparently lame enough to make a source-incompatible
    change without changing API version or anything similar.

diff --git a/config_host.mk.in b/config_host.mk.in
index 3da38d9..f0085ab 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -188,6 +188,7 @@ export HAVE_GCC_VISIBILITY_FEATURE=@HAVE_GCC_VISIBILITY_FEATURE@
 export HAVE_GETOPT=@HAVE_GETOPT@
 export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@
 export HAVE_LD_HASH_STYLE=@HAVE_LD_HASH_STYLE@
+export HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=@HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION@
 export HAVE_POSIX_FALLOCATE=@HAVE_POSIX_FALLOCATE@
 export HAVE_READDIR_R=@HAVE_READDIR_R@
 export HAVE_THREADSAFE_STATICS=@HAVE_THREADSAFE_STATICS@
diff --git a/configure.in b/configure.in
index c099579..22f6945 100644
--- a/configure.in
+++ b/configure.in
@@ -7192,6 +7192,7 @@ AC_SUBST(NSS_LIBS)
 dnl ===================================================================
 dnl Check for system mozilla headers
 dnl ===================================================================
+HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=
 AC_MSG_CHECKING([which mozilla headers to use])
 if test "$with_system_mozilla_headers" = "yes"; then
     AC_MSG_RESULT([external])
@@ -7206,12 +7207,31 @@ if test "$with_system_mozilla_headers" = "yes"; then
     if test "x$LOCATED" != "xyes"; then
         AC_MSG_ERROR([npapi.h header file not found])
     fi
+
+    AC_LANG_PUSH([C])
+    save_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $MOZILLA_HEADERS_CFLAGS"
+    AC_MSG_CHECKING([for NPP_GetMIMEDescription return type])
+    AC_COMPILE_IFELSE(
+        [AC_LANG_SOURCE([[
+            #define XP_UNIX
+            #include <npapi.h>
+            const char* NPP_GetMIMEDescription(void) { return "foo"; }
+            ]])],
+        [AC_MSG_RESULT([const char*])],
+        [
+        AC_MSG_RESULT([char*])
+        HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=TRUE
+        ])
+    CFLAGS=$save_CFLAGS
+    AC_LANG_POP([C])
 else
     AC_MSG_RESULT([internal])
     SYSTEM_MOZILLA_HEADERS=NO
 fi
 AC_SUBST(MOZILLA_HEADERS_CFLAGS)
 AC_SUBST(SYSTEM_MOZILLA_HEADERS)
+AC_SUBST(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION)
 
 dnl ===================================================================
 dnl Check for system sane
diff --git a/extensions/Library_npsoplugin.mk b/extensions/Library_npsoplugin.mk
index 94d9d23..3c68546 100644
--- a/extensions/Library_npsoplugin.mk
+++ b/extensions/Library_npsoplugin.mk
@@ -48,6 +48,12 @@ $(eval $(call gb_Library_add_defs,npsoplugin,\
 	-DMOZ_X11 \
 ))
 
+ifeq ($(HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION),TRUE)
+$(eval $(call gb_Library_add_defs,npsoplugin,\
+	-DHAVE_NON_CONST_NPP_GETMIMEDESCRIPTION=1 \
+))
+endif
+
 ifeq ($(filter-out LINUX FREEBSD NETBSD OPENBSD DRAGONFLY,$(OS)),)
 $(eval $(call gb_Library_add_defs,npsoplugin,\
 	-DNP_LINUX \
diff --git a/extensions/source/nsplugin/source/npshell.cxx b/extensions/source/nsplugin/source/npshell.cxx
index 6d61228..83f2371 100644
--- a/extensions/source/nsplugin/source/npshell.cxx
+++ b/extensions/source/nsplugin/source/npshell.cxx
@@ -361,7 +361,10 @@ MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII ":odp:OpenDocument Presentation;"
 MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII ":otp:OpenDocument Presentation Template;"
 MIMETYPE_OASIS_OPENDOCUMENT_FORMULA_ASCII ":odf:OpenDocument Formula;" );
 
-const char*
+#ifndef HAVE_NON_CONST_NPP_GETMIMEDESCRIPTION
+const
+#endif
+char*
 NPP_GetMIMEDescription(void)
 {
     debug_fprintf(NSP_LOG_APPEND, "print by Netscape Plugin,  NPP_GetMIMEDescription:%s.\n", pMimeTypes);


More information about the Libreoffice-commits mailing list