From b3a75061677399de19355802c54c4d355653f284 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sun, 9 Sep 2007 21:11:39 +0000 Subject: A m4/libxul.m4: Integrate the "xulrunner" backend with configure. Not 2007-09-09 Christian Persch * configure.ac: * embed/Makefile.am: * embed/ephy-embed-factory.c: (ephy_embed_factory_new_object): * m4/gecko.m4: A m4/libxul.m4: * src/Makefile.am: Integrate the "xulrunner" backend with configure. Not building yet. svn path=/trunk/; revision=7359 --- ChangeLog | 10 ++ configure.ac | 67 ++++++-- embed/Makefile.am | 14 +- embed/ephy-embed-factory.c | 23 ++- m4/gecko.m4 | 24 ++- m4/libxul.m4 | 417 +++++++++++++++++++++++++++++++++++++++++++++ src/Makefile.am | 12 +- 7 files changed, 541 insertions(+), 26 deletions(-) create mode 100644 m4/libxul.m4 diff --git a/ChangeLog b/ChangeLog index 93c9adf96..4f07ce364 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-09-09 Christian Persch + + * configure.ac: + * embed/Makefile.am: + * embed/ephy-embed-factory.c: (ephy_embed_factory_new_object): + * m4/gecko.m4: + A m4/libxul.m4: + * src/Makefile.am: Integrate the "xulrunner" backend with configure. + Not building yet. + 2007-09-09 Cosimo Cecchi * lib/widgets/ephy-search-entry.c: (ephy_search_entry_get_type), diff --git a/configure.ac b/configure.ac index 58cb668d7..ee669dded 100644 --- a/configure.ac +++ b/configure.ac @@ -171,9 +171,9 @@ fi AC_MSG_CHECKING(for which engine to use) AC_ARG_WITH([engine], - AS_HELP_STRING([--with-engine@<:@=mozilla|webkit@:>@], + AS_HELP_STRING([--with-engine@<:@=mozilla|webkit|xulrunner@:>@], [Which engine to build against @<:@mozilla@:>@]), - [], [with_engine="mozilla"]) + [],[with_engine="mozilla"]) AC_MSG_RESULT($with_engine) AC_SUBST([with_engine]) @@ -182,10 +182,9 @@ AC_SUBST([with_engine]) # Mozilla # ******* -GECKO_INIT([GECKO], [gecko_found=yes],[gecko_found=no]) +if test "$with_engine" = "mozilla"; then -AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "$with_engine" = "mozilla"]) -if test "$with_engine" = "mozilla" ; then +GECKO_INIT([GECKO]) AC_DEFINE([WITH_GECKO_ENGINE],[1],[Define if you wish to enable mozilla engine]) @@ -343,17 +342,38 @@ REQUIRED_EXTENSIONS="cookie,permissions" GECKO_CHECK_CONTRACTIDS([$REQUIRED_CONTRACTS], [],[AC_MSG_ERROR([$gecko_cv_gecko needs to be compiled with at least --enable-extensions=default,$REQUIRED_EXTENSIONS])]) -fi # with_engine = gecko +fi # with_engine = mozilla +GECKO_DEFINES +AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "$with_engine" = "mozilla"]) AM_CONDITIONAL([HAVE_XULRUNNER],[test "$gecko_cv_gecko" = "xulrunner"]) AM_CONDITIONAL([HAVE_MOZILLA_PSM],[test "$enable_psm" = "yes" -a "$have_psm" = "yes"]) AM_CONDITIONAL([ENABLE_FILEPICKER],[test "$enable_filepicker" = "yes"]) -# ******************************* -# webkit renderer -# ******************************* +# ********* +# Xulrunner +# ********* + +# This is the mozilla backend for xulrunner 1.9 + +if test "$with_engine" = "xulrunner"; then + +LIBXUL_INIT + +WEASEL_UA_VERSION=3.0 +AC_SUBST([WEASEL_UA_VERSION]) + + +fi + +LIBXUL_DEFINES + +AM_CONDITIONAL([WITH_XULRUNNER_ENGINE],[test "$with_engine" = "xulrunner"]) + +# ****** +# WebKit +# ****** -AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "$with_engine" = "webkit") if test "$with_engine" = "webkit" ; then AC_DEFINE([WITH_WEBKIT_ENGINE],[1],[Define if you wish to enable webkit engine]) PKG_CHECK_MODULES([WEBKIT], WebKitGdk) @@ -361,6 +381,8 @@ if test "$with_engine" = "webkit" ; then AC_SUBST([WEBKIT_LIBS]) fi # with_engine = webkit +AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "$with_engine" = "webkit") + # *************** # Multimedia keys # *************** @@ -720,6 +742,31 @@ po/Makefile.in [], [EPIPHANY_API_VERSION=$EPIPHANY_API_VERSION]) +# new gecko embedding + +PKG_CHECK_MODULES([GTK],[gtk+-2.0 >= $GTK_REQUIRED]) + +# compat cruft +GGE_VERSION=0 +AC_SUBST([GGE_VERSION]) + +GGE_API_VERSION=0 +AC_SUBST([GGE_API_VERSION]) + +AC_CONFIG_FILES([ +embed/xulrunner/Makefile +embed/xulrunner/src/Makefile +embed/xulrunner/embed/Makefile +embed/xulrunner/data/Makefile +embed/xulrunner/bindings/Makefile +embed/xulrunner/bindings/python/Makefile +embed/xulrunner/tests/Makefile +]) + +AC_CONFIG_FILES([ +embed/xulrunner/data/gnome-gecko-embed-${GGE_API_VERSION}.pc:embed/xulrunner/data/gnome-gecko-embed.pc.in +],[],[GGE_API_VERSION=$GGE_API_VERSION]) + AC_OUTPUT # ************************************* diff --git a/embed/Makefile.am b/embed/Makefile.am index e073b5d57..f6b432aab 100644 --- a/embed/Makefile.am +++ b/embed/Makefile.am @@ -1,9 +1,12 @@ SUBDIRS = $(with_engine) -DIST_SUBDIRS = mozilla webkit + +DIST_SUBDIRS = xulrunner mozilla webkit + +NULL = noinst_LTLIBRARIES = libephyembed.la libephyembedfactory.la -headerdir = $(prefix)/include/epiphany/@EPIPHANY_MAJOR@/epiphany +headerdir = $(prefix)/include/epiphany/$(EPIPHANY_MAJOR)/epiphany header_DATA = \ ephy-embed-type-builtins.h \ $(INST_H_FILES) @@ -91,6 +94,13 @@ libephyembedfactory_la_CPPFLAGS = \ -I$(top_srcdir)/embed/$(with_engine) \ $(AM_CPPFLAGS) +if WITH_XULRUNNER_ENGINE +libephyembedfactory_la_CPPFLAGS += \ + -I$(srcdir)xulrunner/embed \ + $(LIBXUL_INCLUDES) \ + $(NULL) +endif + if WITH_GECKO_ENGINE libephyembedfactory_la_CPPFLAGS += -I$(GECKO_INCLUDE_ROOT)/gtkembedmoz endif diff --git a/embed/ephy-embed-factory.c b/embed/ephy-embed-factory.c index 1ab59f4a5..6a80faf41 100644 --- a/embed/ephy-embed-factory.c +++ b/embed/ephy-embed-factory.c @@ -21,7 +21,12 @@ #include "config.h" #include "ephy-embed-factory.h" -#if defined(WITH_GECKO_ENGINE) +#if defined(WITH_XULRUNNER_ENGINE) +#include "mozilla-embed.h" +#include "mozilla-embed-find.h" +#include "mozilla-embed-persist.h" +#include "mozilla-embed-single.h" +#elif defined(WITH_GECKO_ENGINE) #include "mozilla-embed.h" #include "mozilla-embed-find.h" #include "mozilla-embed-persist.h" @@ -52,7 +57,9 @@ ephy_embed_factory_new_object (GType type) if (type == EPHY_TYPE_EMBED) { -#if defined(WITH_GECKO_ENGINE) +#if defined(WITH_XULRUNNER_ENGINE) + object = g_object_new (MOZILLA_TYPE_EMBED, NULL); +#elif defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED, NULL); #elif defined(WITH_WEBKIT_ENGINE) object = g_object_new (WEBKIT_TYPE_EMBED, NULL); @@ -60,7 +67,9 @@ ephy_embed_factory_new_object (GType type) } else if (type == EPHY_TYPE_EMBED_PERSIST) { -#if defined(WITH_GECKO_ENGINE) +#if defined(WITH_XULRUNNER_ENGINE) + object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL); +#elif defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_PERSIST, NULL); #elif defined(WITH_WEBKIT_ENGINE) object = g_object_new (WEBKIT_TYPE_EMBED_PERSIST, NULL); @@ -68,7 +77,9 @@ ephy_embed_factory_new_object (GType type) } else if (type == EPHY_TYPE_EMBED_FIND) { -#if defined(WITH_GECKO_ENGINE) +#if defined(WITH_XULRUNNER_ENGINE) + object = g_object_new (MOZILLA_TYPE_EMBED_FIND, NULL); +#elif defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_FIND, NULL); #elif defined(WITH_WEBKIT_ENGINE) object = g_object_new (WEBKIT_TYPE_EMBED_FIND, NULL); @@ -76,7 +87,9 @@ ephy_embed_factory_new_object (GType type) } else if (type == EPHY_TYPE_EMBED_SINGLE) { -#if defined(WITH_GECKO_ENGINE) +#if defined(WITH_XULRUNNER_ENGINE) + object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL); +#elif defined(WITH_GECKO_ENGINE) object = g_object_new (MOZILLA_TYPE_EMBED_SINGLE, NULL); #elif defined(WITH_WEBKIT_ENGINE) object = g_object_new (WEBKIT_TYPE_EMBED_SINGLE, NULL); diff --git a/m4/gecko.m4 b/m4/gecko.m4 index c537e02ff..f35e12add 100644 --- a/m4/gecko.m4 +++ b/m4/gecko.m4 @@ -106,8 +106,6 @@ if test "$gecko_cv_gecko_flavour" = "toolkit"; then AC_DEFINE([HAVE_MOZILLA_TOOLKIT],[1],[Define if mozilla is of the toolkit flavour]) fi -AM_CONDITIONAL([HAVE_MOZILLA_TOOLKIT],[test "$gecko_cv_gecko_flavour" = "toolkit"]) - $1[]=$gecko_cv_gecko $1[]_FLAVOUR=$gecko_cv_gecko_flavour $1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT @@ -230,7 +228,6 @@ fi fi # if gecko_cv_have_gecko -AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_debug" = "yes"]) # *********************** # Check for gecko version @@ -311,11 +308,6 @@ fi fi # if gecko_cv_have_gecko -AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_gecko_version_int" -ge "1007000"]) -AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_gecko_version_int" -ge "1008000"]) -AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_gecko_version_int" -ge "1008001"]) -AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_gecko_version_int" -ge "1009000"]) - $1[]_VERSION=$gecko_cv_gecko_version $1[]_VERSION_INT=$gecko_cv_gecko_version_int @@ -340,6 +332,22 @@ $1[]_GLUE_LIBS="$gecko_cv_glue_libs" ]) +# GECKO_DEFINES +# +# Defines the AM_CONDITIONALS for GECKO_INIT. This is a separate call +# so that you may call GECKO_INIT conditionally; but note that you must +# call GECKO_DEFINES _unconditionally_ ! + +AC_DEFUN([GECKO_DEFINES], +[ +AM_CONDITIONAL([HAVE_MOZILLA_TOOLKIT],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_flavour" = "toolkit"]) +AM_CONDITIONAL([HAVE_GECKO_DEBUG],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_have_debug" = "yes"]) +AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1007000"]) +AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008000"]) +AM_CONDITIONAL([HAVE_GECKO_1_8_1],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1008001"]) +AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$gecko_cv_have_gecko" = "yes" -a "$gecko_cv_gecko_version_int" -ge "1009000"]) +]) + # *************************************************************************** # *************************************************************************** # *************************************************************************** diff --git a/m4/libxul.m4 b/m4/libxul.m4 new file mode 100644 index 000000000..9e9d029a5 --- /dev/null +++ b/m4/libxul.m4 @@ -0,0 +1,417 @@ +# Copyright © 2000-2004 Marco Pesenti Gritti +# Copyright © 2003, 2004, 2005, 2006, 2007 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 +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# LIBXUL_INIT([DO-CHECK],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) +# +# Checks for libxul, and aborts if it's not found +# +# Checks for -fshort-wchar compiler variable, and adds it to +# AM_CXXFLAGS if found +# +# Checks whether RTTI is enabled, and adds -fno-rtti to +# AM_CXXFLAGS otherwise +# +# Checks whether the gecko build is a debug build, and adds +# debug flags to AM_CXXFLAGS if it is. + +AC_DEFUN([LIBXUL_INIT], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl + +PKG_CHECK_EXISTS([libxul],[libxul_cv_have_libxul=yes],[libxul_cv_have_libxul=no]) +if test "$libxul_cv_have_libxul" != "yes"; then + AC_MSG_ERROR([libxul not found]) +fi + +libxul_cv_prefix="$($PKG_CONFIG --variable=prefix libxul)" +libxul_cv_include_root="$($PKG_CONFIG --variable=includedir libxul)" +libxul_libdir="$($PKG_CONFIG --variable=sdkdir libxul)" + +libxul_includes="$libxul_cv_include_root/stable $libxul_cv_include_root/unstable" + +AC_DEFINE([HAVE_LIBXUL],[1],[Define for libxul]) + +LIBXUL_PREFIX="$libxul_cv_prefix" +LIBXUL_INCLUDE_ROOT="$libxul_cv_include_root" +LIBXUL_INCLUDES="$libxul_cv_includes" +LIBXUL_LIBDIR="$libxul_cv_libdir" + +# ************************************************************** +# This is really gcc-only +# Do this test using CXX only since some versions of gcc +# 2.95-2.97 have a signed wchar_t in c++ only and some versions +# only have short-wchar support for c++. +# ************************************************************** + +LIBXUL_CXXCPPFLAGS= +LIBXUL_CXXFLAGS= +LIBXUL_LDFLAGS= + +AC_LANG_PUSH([C++]) + +_SAVE_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $LIBXUL_CXXFLAGS -fshort-wchar" + +AC_CACHE_CHECK([for compiler -fshort-wchar option], + libxul_cv_have_usable_wchar_option, + [AC_RUN_IFELSE([AC_LANG_SOURCE( + [[#include + int main () { + return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; + } ]])], + [libxul_cv_have_usable_wchar_option="yes"], + [libxul_cv_have_usable_wchar_option="no"], + [libxul_cv_have_usable_wchar_option="maybe (cross-compiling)"])]) + +CXXFLAGS="$_SAVE_CXXFLAGS" + +AC_LANG_POP([C++]) + +if test "$libxul_cv_have_usable_wchar_option" = "yes"; then + LIBXUL_CXXFLAGS="$LIBXUL_CXXFLAGS -fshort-wchar" +fi + +# ************** +# Check for RTTI +# ************** + +AC_MSG_CHECKING([whether to enable C++ RTTI]) +AC_ARG_ENABLE([cpp-rtti], + AS_HELP_STRING([--enable-cpp-rtti],[Enable C++ RTTI]), + [],[enable_cpp_rtti=no]) +AC_MSG_RESULT([$enable_cpp_rtti]) + +if test "$enable_cpp_rtti" = "no"; then + LIBXUL_CXXFLAGS="-fno-rtti $LIBXUL_CXXFLAGS" +fi + +# ************* +# Various tests +# ************* + +# FIXMEchpe: remove this test, it shouldn't be needed anymore thanks to static glue libs + +AC_LANG_PUSH([C++]) + +_SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $LIBXUL_CXXCPPFLAGS $LIBXUL_INCLUDES" + +AC_MSG_CHECKING([[whether we have a libxul debug build]]) +AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[#include + #if !defined(MOZ_REFLOW_PERF) || !defined(MOZ_REFLOW_PERF_DSP) + #error No + #endif]] + )], + [libxul_cv_have_debug=yes], + [libxul_cv_have_debug=no]) +AC_MSG_RESULT([$libxul_cv_have_debug]) + +CPPFLAGS="$_SAVE_CPPFLAGS" + +AC_LANG_POP([C++]) + +if test "$libxul_cv_have_debug" = "yes"; then + LIBXUL_CXXCPPFLAGS="$LIBXUL_CXXCPPFLAGS -DDEBUG -D_DEBUG" + + AC_DEFINE([HAVE_LIBXUL_DEBUG],[1],[Define if libxul is a debug build]) +fi + +# ********* +# Finish up +# ********* + +AC_SUBST([LIBXUL_PREFIX]) +AC_SUBST([LIBXUL_INCLUDE_ROOT]) +AC_SUBST([LIBXUL_INCLUDES]) +AC_SUBST([LIBXUL_LIBDIR]) +AC_SUBST([LIBXUL_CXXCPPFLAGS]) +AC_SUBST([LIBXUL_CXXFLAGS]) +AC_SUBST([LIBXUL_LDFLAGS]) + +]) + +# LIBXUL_DEFINES +# +# Automake defines for libxul. Not included in LIBXUL_INIT so that +# LIBXUL_INIT may be called conditionally. If you use LIBXUL_INIT, +# you _must_ call LIBXUL_DEFINES, unconditionally. + +AC_DEFUN([LIBXUL_DEFINES], +[ + +AM_CONDITIONAL([HAVE_LIBXUL],[test "$libxul_cv_have_libxul" = "yes"]) +AM_CONDITIONAL([HAVE_LIBXUL_DEBUG],[test "$libxul_cv_have_debug" = "yes"]) + +]) + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# _LIBXUL_DISPATCH(MACRO, INCLUDEDIRS, ...) + +m4_define([_LIBXUL_DISPATCH], +[ + +AC_LANG_PUSH([C++]) + +_SAVE_CPPFLAGS="$CPPFLAGS" +_SAVE_CXXFLAGS="$CXXFLAGS" +_SAVE_LDFLAGS="$LDFLAGS" +_SAVE_LIBS="$LIBS" +CPPFLAGS="$CPPFLAGS $LIBXUL_CXXCPPFLAGS $LIBXUL_INCLUDES" +CXXFLAGS="$CXXFLAGS $LIBXUL_CXXFLAGS $($PKG_CONFIG --cflags-only-other libxul)" +LDFLAGS="$LDFLAGS $LIBXUL_LDFLAGS -Wl,--rpath=$LIBXUL_LIBDIR" +LIBS="$LIBS $($PKG_CONFIG --libs libxul)" + +# FIXMEchpe: remove this, since the header layout is now flat (only stable and unstable) + +_LIBXUL_DISPATCH_INCLUDEDIRS="$2" + +_LIBXUL_DISPATCH_INCLUDEDIRS="$_LIBXUL_DISPATCH_INCLUDEDIRS dom necko pref" + +# Now add them to CPPFLAGS +for i in $_LIBXUL_DISPATCH_INCLUDEDIRS; do + CPPFLAGS="$CPPFLAGS -I$LIBXUL_INCLUDE_ROOT/$i" +done + +m4_indir([$1],m4_shiftn(2,$@)) + +CPPFLAGS="$_SAVE_CPPFLAGS" +CXXFLAGS="$_SAVE_CXXFLAGS" +LDFLAGS="$_SAVE_LDFLAGS" +LIBS="$_SAVE_LIBS" + +AC_LANG_POP([C++]) + +])# _LIBXUL_DISPATCH + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# LIBXUL_CHECK_HEADERS(INCLUDEDIRS, HEADERS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [INCLUDES]) + +AC_DEFUN([LIBXUL_CHECK_HEADERS],[_LIBXUL_DISPATCH([AC_CHECK_HEADERS],$@)]) + +# LIBXUL_COMPILE_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([LIBXUL_COMPILE_IFELSE],[_LIBXUL_DISPATCH([AC_COMPILE_IFELSE],$@)]) + +# LIBXUL_RUN_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + +AC_DEFUN([LIBXUL_RUN_IFELSE],[_LIBXUL_DISPATCH([AC_RUN_IFELSE],$@)]) + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# LIBXUL_XPCOM_PROGRAM([PROLOGUE], [BODY]) +# +# 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|. + +AC_DEFUN([LIBXUL_XPCOM_PROGRAM], +[AC_LANG_PROGRAM([[ +#include +#include +#include +#include +#include +#include +#include +#include +]] +[$1], +[[ +// redirect unwanted mozilla debug output to the bit bucket +freopen ("/dev/null", "w", stdout); + +nsresult rv; +nsCOMPtr directory; +rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_LIBXUL_HOME"), PR_FALSE, + getter_AddRefs (directory)); +if (NS_FAILED (rv) || !directory) { + exit (126); +} + +rv = NS_InitXPCOM2 (nsnull, directory, nsnull); +if (NS_FAILED (rv)) { + exit (125); +} + +int status = EXIT_FAILURE; + +// 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 (status); +]]) +]) # LIBXUL_XPCOM_PROGRAM + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# LIBXUL_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([LIBXUL_XPCOM_PROGRAM_CHECK], +[AC_REQUIRE([LIBXUL_INIT])dnl + +AC_CACHE_CHECK([whether we can compile and run XPCOM programs], +[libxul_cv_xpcom_program_check], +[ +libxul_cv_xpcom_program_check=no + +LIBXUL_RUN_IFELSE([], + [LIBXUL_XPCOM_PROGRAM([],[[status = EXIT_SUCCESS;]])], + [libxul_cv_xpcom_program_check=yes], + [libxul_cv_xpcom_program_check=no], + [libxul_cv_xpcom_program_check=maybe]) +]) + +if test "$libxul_cv_xpcom_program_check" = "yes"; then + ifelse([$2],,[:],[$2]) +else + ifelse([$3],,[AC_MSG_FAILURE([Cannot compile and run XPCOM programs])], + [$3]) +fi + +]) # LIBXUL_XPCOM_PROGRAM_CHECK + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# LIBXUL_CHECK_CONTRACTID(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Checks wheter CONTRACTID is a registered contract ID + +AC_DEFUN([LIBXUL_CHECK_CONTRACTID], +[AC_REQUIRE([LIBXUL_INIT])dnl + +AS_VAR_PUSHDEF([libxul_cv_have_CID],[libxul_cv_have_$1]) + +AC_CACHE_CHECK([for the $1 XPCOM component], +libxul_cv_have_CID, +[ +AS_VAR_SET(libxul_cv_have_CID,[no]) + +LIBXUL_RUN_IFELSE([], +[LIBXUL_XPCOM_PROGRAM([[ +#include +]],[[ +status = 99; +nsCOMPtr 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(libxul_cv_have_CID,[yes])], +[AS_VAR_SET(libxul_cv_have_CID,[no])], +[AS_VAR_SET(libxul_cv_have_CID,[maybe])]) + +]) + +if test AS_VAR_GET(libxul_cv_have_CID) = "yes"; then + ifelse([$2],,[:],[$2]) +else + ifelse([$3],,[AC_MSG_ERROR([dnl +Contract ID "$1" is not registered, but $PACKAGE_NAME depends on it.])], + [$3]) +fi + +AS_VAR_POPDEF([libxul_cv_have_CID]) + +]) # LIBXUL_CHECK_CONTRACTID + +# LIBXUL_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([LIBXUL_CHECK_CONTRACTIDS], +[AC_REQUIRE([LIBXUL_INIT])dnl + +result=yes +as_contractid= +for as_contractid in $1 +do + LIBXUL_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 + +]) # LIBXUL_CHECK_CONTRACTIDS + +# *************************************************************************** +# *************************************************************************** +# *************************************************************************** + +# LIBXUL_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([LIBXUL_XPIDL], +[AC_REQUIRE([LIBXUL_INIT])dnl + +_C_PATH_PROG([XPIDL],[xpidl],[no],[$LIBXUL_LIBDIR:$PATH]) + +XPIDL_IDLDIR="$($PKG_CONFIG --variable=idldir libxul)" + +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 + +]) diff --git a/src/Makefile.am b/src/Makefile.am index 214b813b5..cf5545b73 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,7 @@ bin_PROGRAMS = epiphany EXTRA_DIST = -headerdir = $(prefix)/include/epiphany/@EPIPHANY_MAJOR@/epiphany +headerdir = $(prefix)/include/epiphany/$(EPIPHANY_MAJOR)/epiphany header_DATA = \ ephy-type-builtins.h \ $(INST_H_FILES) @@ -210,6 +210,11 @@ epiphany_LDADD = \ $(top_builddir)/src/bookmarks/libephybookmarks.la \ $(top_builddir)/embed/libephyembedfactory.la +if WITH_XULRUNNER_ENGINE +epiphany_LDADD += \ + $(top_builddir)/embed/xulrunner/embed/libephymozillaembed.la +endif + if WITH_GECKO_ENGINE epiphany_LDADD += \ $(top_builddir)/embed/mozilla/libephymozillaembed.la @@ -226,6 +231,11 @@ epiphany_LDADD += \ $(top_builddir)/lib/libephymisc.la \ $(top_builddir)/lib/egg/libegg.la +if WITH_XULRUNNER_ENGINE +epiphany_LDFLAGS += -R$(LIBXUL_LIBDIR) +epiphany_LDADD += $(LIBXUL_LIBS) +endif + if WITH_GECKO_ENGINE epiphany_LDFLAGS += -R$(GECKO_HOME) -- cgit v1.2.3