? m4/intltool.m4
Index: configure.in
===================================================================
RCS file: /cvs/gnome/yelp/configure.in,v
retrieving revision 1.220
diff -p -u -u -p -r1.220 configure.in
--- configure.in	19 Apr 2006 18:04:54 -0000	1.220
+++ configure.in	19 Apr 2006 19:37:45 -0000
@@ -220,8 +220,11 @@ AC_SUBST([YELP_SEARCH_LIBS])
 GECKO_INIT([MOZILLA])
 
 AC_SUBST([MOZILLA])
+AC_SUBST([MOZILLA_FLAVOUR])
 AC_SUBST([MOZILLA_INCLUDE_ROOT])
 AC_SUBST([MOZILLA_HOME])
+AC_SUBST([MOZILLA_PREFIX])
+AC_SUBST([MOZILLA_EXTRA_LIBS])
 
 case "$MOZILLA" in
 mozilla) gecko_min_version=1.7 ;;
@@ -231,13 +234,14 @@ seamonkey) gecko_min_version=1.0 ;;
 xulrunner) gecko_min_version=1.8 ;;
 esac
 
-PKG_CHECK_MODULES([MOZILLA_COMPONENT],[$MOZILLA-gtkmozembed >= $gecko_min_version $MOZILLA-xpcom >= $gecko_min_version])
+PKG_CHECK_MODULES([MOZILLA_COMPONENT],[${gecko_cv_gecko}-xpcom >= $gecko_min_version $gecko_cv_extra_pkg_dependencies])
+
+if test "$gecko_cv_gecko_flavour" = "toolkit"; then
+	AC_DEFINE([TYPEAHEADFIND],[1],[Define if we have toolkit's typeaheadfind])
+fi
 
 dnl Needed since gecko 1.8b2
 AC_DEFINE([MOZILLA_INTERNAL_API],[1],[Define to have access to internal Mozilla APIs])
-
-AC_CHECK_FILE([$MOZILLA_INCLUDE_ROOT/fastfind/nsITypeAheadFind.h],
-	[AC_DEFINE([TYPEAHEADFIND],[1],[Define if we have toolkit's nsITypeAheadFind])])
 
 dnl ====================================
 dnl = zlib for help converters
Index: src/yelp-gecko-utils.cpp
===================================================================
RCS file: /cvs/gnome/yelp/src/yelp-gecko-utils.cpp,v
retrieving revision 1.17
diff -p -u -u -p -r1.17 yelp-gecko-utils.cpp
--- src/yelp-gecko-utils.cpp	19 Apr 2006 18:59:43 -0000	1.17
+++ src/yelp-gecko-utils.cpp	19 Apr 2006 19:37:45 -0000
@@ -200,19 +200,27 @@ yelp_gecko_set_font (YelpFontType font_t
 extern "C" gboolean
 yelp_gecko_init (void)
 {
+#ifdef HAVE_GECKO_1_9
+	NS_LogInit ();
+#endif
+	
+#ifdef HAVE_GECKO_1_9
+	gtk_moz_embed_set_path (MOZILLA_HOME);
+#else
 	gtk_moz_embed_set_comp_path (MOZILLA_HOME);
-	
+#endif
+
 	gtk_moz_embed_push_startup ();
-	
+
 	yelp_register_printing ();
-	
+
 	nsresult rv;
 	nsCOMPtr<nsIPrefService> prefService (do_GetService (NS_PREFSERVICE_CONTRACTID, &rv));
 	NS_ENSURE_SUCCESS (rv, FALSE);
-	
+
 	rv = CallQueryInterface (prefService, &gPrefBranch);
 	NS_ENSURE_SUCCESS (rv, FALSE);
-	
+
 	return TRUE;
 }
 
@@ -221,6 +229,10 @@ yelp_gecko_shutdown (void)
 {
 	NS_IF_RELEASE (gPrefBranch);
 	gPrefBranch = nsnull;
-	
+
 	gtk_moz_embed_pop_startup ();
+
+#ifdef HAVE_GECKO_1_9
+        NS_LogTerm ();
+#endif
 }
Index: src/Makefile.am
===================================================================
RCS file: /cvs/gnome/yelp/src/Makefile.am,v
retrieving revision 1.90
diff -p -u -u -p -r1.90 Makefile.am
--- src/Makefile.am	19 Apr 2006 18:59:43 -0000	1.90
+++ src/Makefile.am	19 Apr 2006 19:37:45 -0000
@@ -55,21 +55,22 @@ YELP_DEFINES =								\
 
 mozilla_include_subdirs =	\
 	.		\
+	commandhandler  \
+	content		\
 	docshell	\
 	dom		\
 	fastfind	\
 	find		\
 	gtkembedmoz	\
+	gfx		\
+	layout		\
+	necko		\
 	pref		\
-	webbrwsr	\
 	string		\
-	webshell	\
-	commandhandler  \
-	layout		\
 	uriloader	\
-	content		\
-	gfx		\
-	necko
+	webbrwsr	\
+	webshell	\
+	widget
 
 yelp_CPPFLAGS =									\
 	-I$(top_srcdir)								\
@@ -96,7 +97,8 @@ yelp_LDADD =				\
 	$(Z_LIBS)			\
 	$(BZ_LIBS)			\
 	$(X_LIBS)			\
-	$(MOZILLA_COMPONENT_LIBS)
+	$(MOZILLA_COMPONENT_LIBS)	\
+	$(MOZILLA_EXTRA_LIBS)
 
 yelp_LDFLAGS = -R$(MOZILLA_HOME) $(AM_LDFLAGS)
 
Index: m4/gecko.m4
===================================================================
RCS file: /cvs/gnome/yelp/m4/gecko.m4,v
retrieving revision 1.2
diff -p -u -u -p -r1.2 gecko.m4
--- m4/gecko.m4	15 Jan 2006 18:48:46 -0000	1.2
+++ m4/gecko.m4	19 Apr 2006 19:37:45 -0000
@@ -1,5 +1,5 @@
 # Copyright (C) 2000-2004 Marco Pesenti Gritti
-# Copyright (C) 2003, 2004, 2005 Christian Persch
+# Copyright (C) 2003, 2004, 2005, 2006 Christian Persch
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -88,9 +88,9 @@ seamonkey) gecko_cv_gecko_flavour=mozill
 xulrunner) gecko_cv_gecko_flavour=toolkit ;;
 esac
 
-_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-gtkmozembed`"
-_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-gtkmozembed`"
-_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-gtkmozembed`"
+_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir ${gecko_cv_gecko}-xpcom`"
+_GECKO_HOME="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix ${gecko_cv_gecko}-xpcom`"
 
 fi # if gecko_cv_have_gecko
 
@@ -182,8 +182,13 @@ AC_RUN_IFELSE(
 	[AC_LANG_SOURCE(
 		[[#include <mozilla-config.h>
 		  #include <string.h>
+		  #include <stdlib.h>
                   int main(void) {
-		    return strcmp (MOZ_DEFAULT_TOOLKIT, "gtk2") != 0;
+		    if (strcmp (MOZ_DEFAULT_TOOLKIT, "gtk2") == 0 ||
+		        strcmp (MOZ_DEFAULT_TOOLKIT, "cairo-gtk2") == 0)
+			    return EXIT_SUCCESS;
+		
+		    return EXIT_FAILURE;
 		  } ]]
 	)],
 	[result=yes],
@@ -210,10 +215,14 @@ AC_LANG_POP([C++])
 if test "$gecko_cv_have_debug" = "yes"; then
 	_GECKO_EXTRA_CXXFLAGS="$_GECKO_EXTRA_CXXFLAGS -DDEBUG -D_DEBUG"
 	AM_CXXFLAGS="-DDEBUG -D_DEBUG $AM_CXXFLAGS"
+
+	AC_DEFINE([HAVE_GECKO_DEBUG],[1],[Define if gecko is a debug build])
 fi
 
 fi # if gecko_cv_have_gecko
 
+AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"])
+
 # ***********************
 # Check for gecko version
 # ***********************
@@ -277,15 +286,31 @@ $1[]_VERSION=$gecko_cv_gecko_version
 $1[]_VERSION_MAJOR=$gecko_cv_gecko_version_major
 $1[]_VERSION_MINOR=$gecko_cv_gecko_version_minor
 
+# **************************************************
+# Packages that we need to check for with pkg-config 
+# **************************************************
+
+gecko_cv_extra_libs=
+gecko_cv_extra_pkg_dependencies=
+
+if test "$gecko_cv_gecko_version_major" = "1" -a "$gecko_cv_gecko_version_minor" -ge "9"; then
+	gecko_cv_extra_libs="-lxul"
+else
+	gecko_cv_extra_pkg_dependencies="${gecko_cv_gecko}-gtkmozembed"
+fi
+
+$1[]_EXTRA_PKG_DEPENDENCIES="$gecko_cv_extra_pkg_dependencies"
+$1[]_EXTRA_LIBS="$gecko_cv_extra_libs"
+
 ])
 
 # ***************************************************************************
 # ***************************************************************************
 # ***************************************************************************
 
-# GECKO_DISPATCH([MACRO], [HEADERS], ...)
+# _GECKO_DISPATCH(MACRO, INCLUDEDIRS, ...)
 
-m4_define([GECKO_DISPATCH],
+m4_define([_GECKO_DISPATCH],
 [
 
 if test "$gecko_cv_have_gecko" != "yes"; then
@@ -301,15 +326,15 @@ CPPFLAGS="$CPPFLAGS $_GECKO_EXTRA_CPPFLA
 CXXFLAGS="$CXXFLAGS $_GECKO_EXTRA_CXXFLAGS $($PKG_CONFIG --cflags-only-other ${gecko_cv_gecko}-xpcom)"
 LDFLAGS="$LDFLAGS $_GECKO_EXTRA_LDFLAGS $($PKG_CONFIG --libs ${gecko_cv_gecko}-xpcom) -Wl,--rpath=$_GECKO_HOME"
 
-_GECKO_DISPATCH_HEADERS="$2"
+_GECKO_DISPATCH_INCLUDEDIRS="$2"
 
 # Sigh Gentoo has a rubbish header layout
 # http://bugs.gentoo.org/show_bug.cgi?id=100804
 # Mind you, it's useful to be able to test against uninstalled mozilla builds...
-_GECKO_DISPATCH_HEADERS="$_GECKO_DISPATCH_HEADERS necko dom"
+_GECKO_DISPATCH_INCLUDEDIRS="$_GECKO_DISPATCH_INCLUDEDIRS dom necko pref"
 
 # Now add them to CPPFLAGS
-for i in $_GECKO_DISPATCH_HEADERS; do
+for i in $_GECKO_DISPATCH_INCLUDEDIRS; do
 	CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT/$i"
 done
 
@@ -327,33 +352,37 @@ AC_LANG_POP([C++])
 # ***************************************************************************
 # ***************************************************************************
 
-# GECKO_COMPILE_IFELSE(HEADERS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# GECKO_CHECK_HEADERS(INCLUDEDIRS, HEADERS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [INCLUDES])
+
+AC_DEFUN([GECKO_CHECK_HEADERS],[_GECKO_DISPATCH([AC_CHECK_HEADERS],$@)])
+
+# GECKO_COMPILE_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
-AC_DEFUN([GECKO_COMPILE_IFELSE],[GECKO_DISPATCH([AC_COMPILE_IFELSE],$@)])
+AC_DEFUN([GECKO_COMPILE_IFELSE],[_GECKO_DISPATCH([AC_COMPILE_IFELSE],$@)])
 
-# GECKO_RUN_IFELSE(HEADERS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# GECKO_RUN_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 
-AC_DEFUN([GECKO_RUN_IFELSE],[GECKO_DISPATCH([AC_RUN_IFELSE],$@)])
+AC_DEFUN([GECKO_RUN_IFELSE],[_GECKO_DISPATCH([AC_RUN_IFELSE],$@)])
 
 # ***************************************************************************
 # ***************************************************************************
 # ***************************************************************************
 
-# GECKO_CHECK_CONTRACTID(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# GECKO_XPCOM_PROGRAM([PROLOGUE], [BODY])
 #
-# Checks wheter CONTRACTID is a registered contract ID
-
-AC_DEFUN([GECKO_CHECK_CONTRACTID],
-[AC_REQUIRE([GECKO_INIT])dnl
-
-AS_VAR_PUSHDEF([gecko_cv_have_CID],[gecko_cv_have_$1])
-
-AC_CACHE_CHECK([for the $1 XPCOM component],
-[gecko_cv_have_CID],
-[
-AS_VAR_SET(gecko_cv_have_CID,[no])
+# Produce a template C++ program which starts XPCOM up and shuts it down after
+# the BODY part has run. In BODY, the the following variables are predeclared:
+#
+# nsresult rv
+# int status = 1 (EXIT_FAILURE)
+#
+# The program's exit status will be |status|; set it to 0 (or EXIT_SUCCESS)
+# to indicate success and to a value between 1 (EXIT_FAILURE) and 120 to
+# indicate failure.
+#
+# To jump out of the BODY and exit the test program, you can use |break|.
 
-GECKO_RUN_IFELSE([],
+AC_DEFUN([GECKO_XPCOM_PROGRAM],
 [AC_LANG_PROGRAM([[
 #include <mozilla-config.h>
 #include <stdlib.h>
@@ -362,39 +391,110 @@ GECKO_RUN_IFELSE([],
 #include <nsCOMPtr.h>
 #include <nsILocalFile.h>
 #include <nsIServiceManager.h>
-#include <nsIComponentRegistrar.h>
+#ifdef HAVE_GECKO_1_8
+#include <nsStringAPI.h>
+#else
 #include <nsString.h>
-]],[[
-// redirect unwanted mozilla debug output
+#endif
+]]
+[$1],
+[[
+// redirect unwanted mozilla debug output to the bit bucket
 freopen ("/dev/null", "w", stdout);
-freopen ("/dev/null", "w", stderr);
 
 nsresult rv;
 nsCOMPtr<nsILocalFile> directory;
-rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_GECKO_HOME"), PR_FALSE, getter_AddRefs (directory));
+rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_GECKO_HOME"), PR_FALSE,
+			    getter_AddRefs (directory));
 if (NS_FAILED (rv) || !directory) {
-	exit (EXIT_FAILURE);
+	exit (126);
 }
 
-nsCOMPtr<nsIServiceManager> sm;
-rv = NS_InitXPCOM2 (getter_AddRefs (sm), directory, nsnull);
+rv = NS_InitXPCOM2 (nsnull, directory, nsnull);
 if (NS_FAILED (rv)) {
-	exit (EXIT_FAILURE);
+	exit (125);
 }
 
-nsCOMPtr<nsIComponentRegistrar> registar (do_QueryInterface (sm, &rv));
-sm = nsnull; // release service manager
-if (NS_FAILED (rv)) {
-	NS_ShutdownXPCOM (nsnull);
-	exit (EXIT_FAILURE);
-}
+int status = EXIT_FAILURE;
 
-PRBool isRegistered = PR_FALSE;
-rv = registar->IsContractIDRegistered ("$1", &isRegistered);
-registar = nsnull; // release registar before shutdown
+// now put in the BODY, scoped with do...while(0) to ensure we don't hold a
+// COMptr after XPCOM shutdown and so we can jump out with a simple |break|.
+do {
+]]
+m4_shiftn(1,$@)
+[[
+} while (0);
 	
 NS_ShutdownXPCOM (nsnull);
-exit (isRegistered ? EXIT_SUCCESS : EXIT_FAILURE);
+exit (status);
+]])
+]) # GECKO_XPCOM_PROGRAM
+
+# ***************************************************************************
+# ***************************************************************************
+# ***************************************************************************
+
+# GECKO_XPCOM_PROGRAM_CHECK([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [ACTION-IF-CROSS-COMPILING])
+#
+# Checks whether we can build and run any XPCOM test programs at all
+
+AC_DEFUN([GECKO_XPCOM_PROGRAM_CHECK],
+[AC_REQUIRE([GECKO_INIT])dnl
+
+AC_CACHE_CHECK([whether we can compile and run XPCOM programs],
+[gecko_cv_xpcom_program_check],
+[
+gecko_cv_xpcom_program_check=no
+
+GECKO_RUN_IFELSE([],
+	[GECKO_XPCOM_PROGRAM([],[[status = EXIT_SUCCESS;]])],
+	[gecko_cv_xpcom_program_check=yes],
+	[gecko_cv_xpcom_program_check=no],
+	[gecko_cv_xpcom_program_check=maybe])
+])
+
+if test "$gecko_cv_xpcom_program_check" = "yes"; then
+	ifelse([$2],,[:],[$2])
+else
+	ifelse([$3],,[AC_MSG_FAILURE([Cannot compile and run XPCOM programs])],
+	[$3])
+fi
+
+]) # GECKO_XPCOM_PROGRAM_CHECK
+
+# ***************************************************************************
+# ***************************************************************************
+# ***************************************************************************
+
+# GECKO_CHECK_CONTRACTID(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Checks wheter CONTRACTID is a registered contract ID
+
+AC_DEFUN([GECKO_CHECK_CONTRACTID],
+[AC_REQUIRE([GECKO_INIT])dnl
+
+AS_VAR_PUSHDEF([gecko_cv_have_CID],[gecko_cv_have_$1])
+
+AC_CACHE_CHECK([for the $1 XPCOM component],
+gecko_cv_have_CID,
+[
+AS_VAR_SET(gecko_cv_have_CID,[no])
+
+GECKO_RUN_IFELSE([],
+[GECKO_XPCOM_PROGRAM([[
+#include <nsIComponentRegistrar.h>
+]],[[
+status = 99;
+nsCOMPtr<nsIComponentRegistrar> registrar;
+rv = NS_GetComponentRegistrar (getter_AddRefs (registrar));
+if (NS_FAILED (rv)) break;
+
+status = 98;
+PRBool isRegistered = PR_FALSE;
+rv = registrar->IsContractIDRegistered ("$1", &isRegistered);
+if (NS_FAILED (rv)) break;
+
+status = isRegistered ? EXIT_SUCCESS : 97;
 ]])
 ],
 [AS_VAR_SET(gecko_cv_have_CID,[yes])],
@@ -406,11 +506,79 @@ exit (isRegistered ? EXIT_SUCCESS : EXIT
 if test AS_VAR_GET(gecko_cv_have_CID) = "yes"; then
 	ifelse([$2],,[:],[$2])
 else
-	ifelse([$3],,[AC_MSG_FAILURE([dnl
+	ifelse([$3],,[AC_MSG_ERROR([dnl
 Contract ID "$1" is not registered, but $PACKAGE_NAME depends on it.])],
 	[$3])
 fi
 
 AS_VAR_POPDEF([gecko_cv_have_CID])
+
+]) # GECKO_CHECK_CONTRACTID
+
+# GECKO_CHECK_CONTRACTIDS(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Checks wheter CONTRACTIDs are registered contract IDs.
+# If ACTION-IF-NOT-FOUND is given, it is executed when one of the contract IDs
+# is not found and the missing contract ID is in the |as_contractid| variable.
+
+AC_DEFUN([GECKO_CHECK_CONTRACTIDS],
+[AC_REQUIRE([GECKO_INIT])dnl
+
+result=yes
+as_contractid=
+for as_contractid in $1
+do
+	GECKO_CHECK_CONTRACTID([$as_contractid],[],[result=no; break;])
+done
+
+if test "$result" = "yes"; then
+	ifelse([$2],,[:],[$2])
+else
+	ifelse([$3],,[AC_MSG_ERROR([dnl
+Contract ID "$as_contractid" is not registered, but $PACKAGE_NAME depends on it.])],
+	[$3])
+fi
+
+]) # GECKO_CHECK_CONTRACTIDS
+
+# ***************************************************************************
+# ***************************************************************************
+# ***************************************************************************
+
+# GECKO_XPIDL([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
+#
+# Checks for xpidl program and include directory
+#
+# Variables set:
+# XPIDL:        the xpidl program
+# XPIDL_IDLDIR: the xpidl include directory
+
+AC_DEFUN([GECKO_XPIDL],
+[AC_REQUIRE([GECKO_INIT])dnl
+
+_GECKO_LIBDIR="`$PKG_CONFIG --variable=libdir ${gecko_cv_gecko}-xpcom`"
+
+AC_PATH_PROG([XPIDL],[xpidl],[no],[$_GECKO_LIBDIR:$PATH])
+
+XPIDL_IDLDIR="`$PKG_CONFIG --variable=idldir ${gecko_cv_gecko}-xpcom`"
+
+# Older geckos don't have this variable, see
+# https://bugzilla.mozilla.org/show_bug.cgi?id=240473
+
+if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
+	XPIDL_IDLDIR="`echo $_GECKO_LIBDIR | sed -e s!lib!share/idl!`"
+fi
+
+# Some distributions (Gentoo) have it in unusual places
+
+if test -z "$XPIDL_IDLDIR" -o ! -f "$XPIDL_IDLDIR/nsISupports.idl"; then
+	XPIDL_IDLDIR="$_GECKO_INCLUDE_ROOT/idl"
+fi
+
+if test "$XPIDL" != "no" -a -n "$XPIDL_IDLDIR" -a -f "$XPIDL_IDLDIR/nsISupports.idl"; then
+	ifelse([$1],,[:],[$1])
+else
+	ifelse([$2],,[AC_MSG_FAILURE([XPIDL program or include directory not found])],[$2])
+fi
 
 ])
