diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | configure.ac | 42 | ||||
-rw-r--r-- | m4/gecko.m4 | 101 |
3 files changed, 117 insertions, 38 deletions
@@ -1,3 +1,15 @@ +2006-02-23 Christian Persch <chpe@cvs.gnome.org> + + * m4/gecko.m4: + + Refactored. Added GECKO_XPCOM_PROGRAM modelled after AC_LANG_PROGRAM + but which produces a program which uses XPCOM; and made + GECKO_CHECK_CONTRACTID use this. + + * configure.ac: + + Add a check for the gecko typeaheadfind extension. Bug #329118. + 2006-02-22 Peter Harvey <peter.a.harvey@gmail.com> * src/bookmarks/ephy-topics-entry.c diff --git a/configure.ac b/configure.ac index bb17a488e..7ded1d15d 100644 --- a/configure.ac +++ b/configure.ac @@ -269,10 +269,46 @@ GECKO_COMPILE_IFELSE([fastfind], [[nsITypeAheadFind *p; p->SetDocShell(nsnull);]] )], - [AC_DEFINE([HAVE_TYPEAHEADFIND],[1],[Define if we have tookit's typeaheadfind]) result=yes], - [result=no]) + [AC_DEFINE([HAVE_TYPEAHEADFIND],[1],[Define if we have tookit's typeaheadfind]) have_typeaheadfind=yes], + [have_typeaheadfind=no]) -AC_MSG_RESULT([$result]) +AC_MSG_RESULT([$have_typeaheadfind]) + +# Make sure we DON'T have the typeaheadfind extension + +if test "$have_typeaheadfind" = "yes"; then + +AC_MSG_CHECKING([whether the typeaheadfind extension was enabled]) + +GECKO_RUN_IFELSE([], +[GECKO_XPCOM_PROGRAM( +[[#include <nsIComponentRegistrar.h>]], +[[ +nsCOMPtr<nsIComponentRegistrar> registrar; +rv = NS_GetComponentRegistrar (getter_AddRefs (registrar)); +if (NS_FAILED (rv)) break; + +nsCID *classID = nsnull; +rv = registrar->ContractIDToCID ("@mozilla.org/typeaheadfind;1", &classID); +if (NS_FAILED (rv) || !classID) break; + +nsCID badClassID = { 0x46590685, 0xbc00, 0x4aac, + { 0xab, 0xed, 0x2c, 0x10, 0xa5, 0xb9, 0x45, 0xa4 } }; + +retval = ! classID->Equals(badClassID); +]] +)], +[have_typeaheadfind_ext=no], +[have_typeaheadfind_ext=yes], +[have_typeaheadfind_ext=maybe]) + +AC_MSG_RESULT([$have_typeaheadfind_ext]) + +if test "$have_typeaheadfind_ext" = "yes"; then + AC_MSG_ERROR([You must not compile gecko with the "typeaheadfind" extension enabled!]) +fi + +fi # have_typeaheadfind = yes # Make sure we don't accidentally build without PSM support diff --git a/m4/gecko.m4 b/m4/gecko.m4 index d34ab2f28..80125084e 100644 --- a/m4/gecko.m4 +++ b/m4/gecko.m4 @@ -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 @@ -305,9 +305,9 @@ $1[]_EXTRA_LIBS="$gecko_cv_extra_libs" # *************************************************************************** # *************************************************************************** -# GECKO_DISPATCH([MACRO], [INCLUDEDIRS], ...) +# _GECKO_DISPATCH(MACRO, INCLUDEDIRS, ...) -m4_define([GECKO_DISPATCH], +m4_define([_GECKO_DISPATCH], [ if test "$gecko_cv_have_gecko" != "yes"; then @@ -351,35 +351,34 @@ AC_LANG_POP([C++]) # GECKO_CHECK_HEADERS(INCLUDEDIRS, HEADERS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [INCLUDES]) -AC_DEFUN([GECKO_CHECK_HEADERS],[GECKO_DISPATCH([AC_CHECK_HEADERS],$@)]) +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(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_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 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 +# PRBool retval (set to PR_FALSE) +# +# The program's exit status will be EXIT_FAILURE if you retval is PR_FALSE; +# else it will be EXIT_SUCCESS. +# +# 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> @@ -388,43 +387,75 @@ 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> #endif -]],[[ -// redirect unwanted mozilla debug output +]] +[$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); } -nsCOMPtr<nsIServiceManager> sm; -rv = NS_InitXPCOM2 (getter_AddRefs (sm), directory, nsnull); +rv = NS_InitXPCOM2 (nsnull, directory, nsnull); if (NS_FAILED (rv)) { exit (EXIT_FAILURE); } -nsCOMPtr<nsIComponentRegistrar> registar (do_QueryInterface (sm, &rv)); -sm = nsnull; // release service manager -if (NS_FAILED (rv)) { - NS_ShutdownXPCOM (nsnull); - exit (EXIT_FAILURE); -} +PRBool retval = PR_FALSE; -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 (retval ? EXIT_SUCCESS : EXIT_FAILURE); +]]) +]) # GECKO_PROGRAM + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# 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> +]],[[ +nsCOMPtr<nsIComponentRegistrar> registrar; +rv = NS_GetComponentRegistrar (getter_AddRefs (registrar)); +if (NS_FAILED (rv)) break; + +PRBool isRegistered = PR_FALSE; +rv = registrar->IsContractIDRegistered ("$1", &isRegistered); +retval = NS_SUCCEEDED (rv) && isRegistered; ]]) ], [AS_VAR_SET(gecko_cv_have_CID,[yes])], |