aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-11-10 18:45:26 +0800
committerChristian Persch <chpe@src.gnome.org>2005-11-10 18:45:26 +0800
commit8fa636f36bf250aa729409de2d77c562f809eebc (patch)
treeb6b6ff1aede0dc0bb8eebc93bce68fa2f96856d1
parent744e44b5a8af8b04f6965dd23c67a55d33e71db4 (diff)
downloadgsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar.gz
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar.bz2
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar.lz
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar.xz
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.tar.zst
gsoc2013-epiphany-8fa636f36bf250aa729409de2d77c562f809eebc.zip
Rewrite the contractid check. Now works with builds without
2005-11-09 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * m4/gecko.m4: Rewrite the contractid check. Now works with builds without --with-default-mozilla-five-home. Balance AC_LANG_POP/PUSH.
-rw-r--r--ChangeLog9
-rw-r--r--configure.ac1
-rw-r--r--m4/gecko.m443
3 files changed, 44 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 076d3dc56..10da019ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2005-11-09 Christian Persch <chpe@cvs.gnome.org>
+ * configure.ac:
+ * m4/gecko.m4:
+
+ Rewrite the contractid check. Now works with builds without
+ --with-default-mozilla-five-home.
+ Balance AC_LANG_POP/PUSH.
+
+2005-11-09 Christian Persch <chpe@cvs.gnome.org>
+
* m4/gecko.m4:
Use $PACKAGE_NAME.
diff --git a/configure.ac b/configure.ac
index fcd5f409a..6c3437873 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,7 @@ dnl **********************************
dnl FIXME find a m4/autoconf guru who can distill this into a nice macro
+AC_LANG_PUSH([C++])
_SAVE_CFLAGS=$CXXFLAGS
_SAVE_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-I$MOZILLA_INCLUDE_ROOT -I$MOZILLA_INCLUDE_ROOT/pipnss `$PKG_CONFIG --cflags-only-I $MOZILLA-xpcom`"
diff --git a/m4/gecko.m4 b/m4/gecko.m4
index 71468232f..091facf10 100644
--- a/m4/gecko.m4
+++ b/m4/gecko.m4
@@ -25,6 +25,9 @@ dnl
dnl Checks whether RTTI is enabled, and adds -fno-rtti to
dnl CXXFLAGS and AM_CXXFLAGS otherwise
dnl
+dnl Checks whether the gecko build is a debug build, and adds
+dnl debug flags to CXXFLAGS and AM_CXXFLAGS if it is.
+dnl
dnl Expanded variables:
dnl VARIABLE: Which gecko was found (e.g. "xulrunnner", "seamonkey", ...)
dnl VARIABLE_FLAVOUR: The flavour of the gecko that was found
@@ -38,7 +41,7 @@ AC_DEFUN([GECKO_INIT],
AC_MSG_CHECKING([which gecko to use])
AC_ARG_WITH([gecko],
- AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|xulrunner@:>@],
+ AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner@:>@],
[Which gecko engine to use (default: autodetect)]))
dnl Backward compat
@@ -108,6 +111,8 @@ AC_CACHE_CHECK([for compiler -fshort-wchar option],
CXXFLAGS="$_SAVE_CXXFLAGS"
+AC_LANG_POP([C++])
+
if test "$_GECKO_cv_have_usable_wchar_option" = "yes"; then
CXXFLAGS="$CXXFLAGS -fshort-wchar"
AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar"
@@ -133,6 +138,7 @@ dnl Various tests
dnl *************
AC_LANG_PUSH([C++])
+
_SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT"
@@ -163,6 +169,7 @@ AC_PREPROC_IFELSE(
AC_MSG_RESULT([$gecko_cv_have_debug])
CPPFLAGS="$_SAVE_CPPFLAGS"
+
AC_LANG_POP([C++])
if test "$gecko_cv_have_debug" = "xyes"; then
@@ -197,26 +204,44 @@ LDFLAGS="$LDFLAGS $($PKG_CONFIG --libs $_GECKO-xpcom) -Wl,--rpath=$_GECKO_HOME"
AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
+#include <stdio.h>
#include <nsXPCOM.h>
#include <nsCOMPtr.h>
-#include <nsISupports.h>
+#include <nsILocalFile.h>
#include <nsIServiceManager.h>
+#include <nsIComponentRegistrar.h>
+#include <nsString.h>
],[
-nsCOMPtr<nsIServiceManager> serviceManager;
-nsresult rv = NS_InitXPCOM2 (getter_AddRefs (serviceManager), nsnull, nsnull);
-if (NS_FAILED (rv) || !serviceManager) {
+// redirect unwanted mozilla debug output
+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));
+if (NS_FAILED (rv) || !directory) {
+ exit (EXIT_FAILURE);
+}
+
+nsCOMPtr<nsIServiceManager> sm;
+rv = NS_InitXPCOM2 (getter_AddRefs (sm), directory, nsnull);
+if (NS_FAILED (rv)) {
exit (EXIT_FAILURE);
}
-nsCOMPtr<nsISupports> service;
-rv = serviceManager->GetServiceByContractID ("$2", NS_GET_IID (nsISupports), getter_AddRefs (service));
-if (NS_FAILED (rv) || !service) {
+nsCOMPtr<nsIComponentRegistrar> registar (do_QueryInterface (sm, &rv));
+sm = nsnull; // release service manager
+if (NS_FAILED (rv)) {
NS_ShutdownXPCOM (nsnull);
exit (EXIT_FAILURE);
}
+PRBool isRegistered = PR_FALSE;
+rv = registar->IsContractIDRegistered ("$2", &isRegistered);
+registar = nsnull; // release registar before shutdown
+
NS_ShutdownXPCOM (nsnull);
-exit (EXIT_SUCCESS);
+exit (isRegistered ? EXIT_SUCCESS : EXIT_FAILURE);
])
],
[gecko_cv_xpcom_contractid_[]$1[]=present],