diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-11-10 05:40:27 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-11-10 05:40:27 +0800 |
commit | 907535f1e786cea8bd30f74cf93f6600fec4e09d (patch) | |
tree | 2e3a0c574a47ba8fa277b5b8056440e9f86f7661 | |
parent | b3e5d966c4ab222cf9bcf35e1905a3d396f47d27 (diff) | |
download | gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar.gz gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar.bz2 gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar.lz gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar.xz gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.tar.zst gsoc2013-epiphany-907535f1e786cea8bd30f74cf93f6600fec4e09d.zip |
A m4/gecko.m4:
2005-11-09 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
A m4/gecko.m4:
Distill the gecko detection logic into a macro package.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | configure.ac | 131 | ||||
-rw-r--r-- | m4/gecko.m4 | 241 |
3 files changed, 261 insertions, 118 deletions
@@ -1,3 +1,10 @@ +2005-11-09 Christian Persch <chpe@cvs.gnome.org> + + * configure.ac: + A m4/gecko.m4: + + Distill the gecko detection logic into a macro package. + 2005-11-08 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-embed-persist.c: (ephy_embed_persist_class_init): diff --git a/configure.ac b/configure.ac index 200ce4441..c34aa0a6a 100644 --- a/configure.ac +++ b/configure.ac @@ -180,100 +180,25 @@ dnl ******* dnl Mozilla dnl ******* -AC_MSG_CHECKING([which gecko to use]) - -AC_ARG_WITH([mozilla], - AS_HELP_STRING([--with-mozilla@<:@=mozilla|firefox|xulrunner|thunderbird@:>@], - [Which gecko engine to use (default: autodetect)])) - -GECKOS="firefox mozilla-firefox seamonkey mozilla xulrunner thunderbird mozilla-thunderbird" -gecko=$with_mozilla - -if test "x$gecko" = "x"; then - dnl Autodetect gecko - for g in $GECKOS; do - if $PKG_CONFIG --exists $g-xpcom; then - gecko=$g - break; - fi - done -fi - -if test "x$gecko" = "x"; then - AC_MSG_ERROR([No gecko found]) -elif ! ( echo "$GECKOS" | egrep "(^| )$gecko(\$| )" > /dev/null); then - AC_MSG_ERROR([Unknown gecko "$gecko" specified]) -fi +GECKO_INIT([MOZILLA]) -AC_MSG_RESULT([$gecko]) - -case "$gecko" in -mozilla) min_version=1.7.9 flavour=mozilla ;; -seamonkey) min_version=1.0 flavour=mozilla ;; -*firefox) min_version=1.0.5 flavour=toolkit ;; -*thunderbird) min_version=1.0.5 flavour=toolkit ;; -xulrunner) min_version=1.8 flavour=toolkit ;; -esac - -MOZILLA=$gecko AC_SUBST([MOZILLA]) - -MOZILLA_FLAVOUR=$flavour AC_SUBST([MOZILLA_FLAVOUR]) - -PKG_CHECK_MODULES([GECKO],[$MOZILLA-gtkmozembed >= $min_version $MOZILLA-xpcom >= $min_version]) -AC_SUBST([GECKO_CFLAGS]) -AC_SUBST([GECKO_LIBS]) - -MOZILLA_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $MOZILLA-gtkmozembed`" AC_SUBST([MOZILLA_INCLUDE_ROOT]) - -MOZILLA_HOME="`$PKG_CONFIG --variable=libdir $MOZILLA-gtkmozembed`" AC_SUBST([MOZILLA_HOME]) - -MOZILLA_PREFIX="`$PKG_CONFIG --variable=prefix $MOZILLA-gtkmozembed`" AC_SUBST([MOZILLA_PREFIX]) -AC_ARG_ENABLE([cpp-rtti], - AS_HELP_STRING([--enable-cpp-rtti],[Enable C++ RTTI]),[], - [enable_cpp_rtti=no]) - -if test "x$enable_cpp_rtti" = "xno"; then - AM_CXXFLAGS="-fno-rtti $AM_CXXFLAGS" -fi - -dnl ************************************************************************* -dnl This is from Mozilla's configure.in. They set almost all the config stuff -dnl they need in mozilla-config.h Except for this compiler flag, which can't -dnl go in mozilla-config.h So we check the flag too and now we can include -dnl mozilla-config.h without breaking epiphany. -dnl This is really gcc-only -dnl Do this test using CXX only since some versions of gcc -dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions -dnl only have short-wchar support for c++. - -AC_LANG_PUSH([C++]) +case "$MOZILLA" in +mozilla) min_version=1.7.9 ;; +seamonkey) min_version=1.0 ;; +*firefox) min_version=1.0.5 ;; +*thunderbird) min_version=1.0.5 ;; +xulrunner) min_version=1.8 ;; +esac -_SAVE_CPPFLAGS=$CPPFLAGS -_SAVE_CXXFLAGS=$CXXFLAGS -_SAVE_AM_CXXFLAGS=$AM_CXXFLAGS -AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar" -CXXFLAGS="$CXXFLAGS $AM_CXXFLAGS" - -AC_CACHE_CHECK([for compiler -fshort-wchar option], - ac_cv_have_usable_wchar_option, - [AC_RUN_IFELSE([AC_LANG_SOURCE( - [[#include <stddef.h> - int main () { - return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; - } ]])], - [ac_cv_have_usable_wchar_option="yes"], - [ac_cv_have_usable_wchar_option="no"], - [ac_cv_have_usable_wchar_option="maybe"])]) - -if test "$ac_cv_have_usable_wchar_option" != "yes"; then - AM_CXXFLAGS=$_SAVE_AM_CXXFLAGS -fi +PKG_CHECK_MODULES([GECKO],[$MOZILLA-gtkmozembed >= $min_version $MOZILLA-xpcom >= $min_version]) +AC_SUBST([GECKO_CFLAGS]) +AC_SUBST([GECKO_LIBS]) dnl ********************************** dnl now tests for mozilla API variance @@ -281,6 +206,8 @@ dnl ********************************** dnl FIXME find a m4/autoconf guru who can distill this into a nice macro +_SAVE_CFLAGS=$CXXFLAGS +_SAVE_CPPFLAGS=$CPPFLAGS CPPFLAGS="-I$MOZILLA_INCLUDE_ROOT -I$MOZILLA_INCLUDE_ROOT/pipnss `$PKG_CONFIG --cflags-only-I $MOZILLA-xpcom`" CXXFLAGS="$_SAVE_CXXFLAGS $AM_CXXFLAGS `$PKG_CONFIG --cflags-only-other $MOZILLA-xpcom`" @@ -292,38 +219,6 @@ for i in $TEST_MOZILLA_INCLUDE_DIRS ; do CPPFLAGS="$CPPFLAGS -I$MOZILLA_INCLUDE_ROOT/$i" done -AC_MSG_CHECKING([[whether we have a gtk 2 mozilla build]]) - -AC_RUN_IFELSE( - [AC_LANG_SOURCE( - [[#include <mozilla-config.h> - #include <string.h> - int main(void) { - return strcmp (MOZ_DEFAULT_TOOLKIT, "gtk2") != 0; - } ]] - )], - [result=yes], - [AC_MSG_ERROR([[Epiphany needs a gtk 2 mozilla build]])], - [result=maybe]) - -AC_MSG_RESULT([$result]) - -dnl Check whether we have a mozilla debug build - -AC_MSG_CHECKING([[whether we have a mozilla debug build]]) - -AC_PREPROC_IFELSE( - [AC_LANG_SOURCE( - [[#include <mozilla-config.h> - #if !defined(MOZ_REFLOW_PERF) || !defined(MOZ_REFLOW_PERF_DSP) - #error No - #endif]] - )], - [AM_CXXFLAGS="-DDEBUG -D_DEBUG $AM_CXXFLAGS" have_mozilla_debug=yes], - [have_mozilla_debug=no]) - -AC_MSG_RESULT([$have_mozilla_debug]) - dnl Determine gecko version dnl We don't use the version from the .pc file, since that's the app version dnl and not the Gecko version diff --git a/m4/gecko.m4 b/m4/gecko.m4 new file mode 100644 index 000000000..2c656d0a7 --- /dev/null +++ b/m4/gecko.m4 @@ -0,0 +1,241 @@ +dnl Copyright (C) 2000-2004 Marco Pesenti Gritti +dnl Copyright (C) 2003, 2004, 2005 Christian Persch +dnl +dnl This program is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU General Public License as published by the +dnl Free Software Foundation; either version 2 of the License, or (at your +dnl option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with this program; if not, write to the Free Software Foundation, Inc., +dnl 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +dnl GECKO_INIT([VARIABLE]) +dnl +dnl Checks for gecko, and aborts if it's not found +dnl +dnl Checks for -fshort-wchar compiler variable, and adds it to +dnl CXXFLAGS and AM_CXXFLAGS if found +dnl +dnl Checks whether RTTI is enabled, and adds -fno-rtti to +dnl CXXFLAGS and AM_CXXFLAGS otherwise +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 +dnl VARIABLE_HOME: +dnl VARIABLE_PREFIX: +dnl VARIABLE_INCLUDE_ROOT: + +AC_DEFUN([GECKO_INIT], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl + +AC_MSG_CHECKING([which gecko to use]) + +AC_ARG_WITH([gecko], + AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|xulrunner@:>@], + [Which gecko engine to use (default: autodetect)])) + +dnl Backward compat +AC_ARG_WITH([mozilla],[],[with_gecko=$withval],[]) + +_GECKO=$with_gecko + +dnl Autodetect gecko +_geckos="firefox mozilla-firefox seamonkey mozilla xulrunner" +if test "x$_GECKO" = "x"; then + for lizard in $_geckos; do + if $PKG_CONFIG --exists $lizard-xpcom; then + _GECKO=$lizard + break; + fi + done +fi + +if test "x$_GECKO" = "x"; then + AC_MSG_ERROR([No gecko found]) +elif ! ( echo "$_geckos" | egrep "(^| )$_GECKO(\$| )" > /dev/null); then + AC_MSG_ERROR([Unknown gecko "$_GECKO" specified]) +fi + +AC_MSG_RESULT([$_GECKO]) + +case "$_GECKO" in +mozilla) _GECKO_FLAVOUR=mozilla ;; +seamonkey) _GECKO_FLAVOUR=mozilla ;; +*firefox) _GECKO_FLAVOUR=toolkit ;; +xulrunner) _GECKO_FLAVOUR=toolkit ;; +esac + + +_GECKO_INCLUDE_ROOT="`$PKG_CONFIG --variable=includedir $_GECKO-gtkmozembed`" +_GECKO_HOME="`$PKG_CONFIG --variable=libdir $_GECKO-gtkmozembed`" +_GECKO_PREFIX="`$PKG_CONFIG --variable=prefix $_GECKO-gtkmozembed`" + +$1[]=$_GECKO +$1[]_FLAVOUR=$_GECKO_FLAVOUR +$1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT +$1[]_HOME=$_GECKO_HOME +$1[]_PREFIX=$_GECKO_PREFIX + +dnl ************************************************************** +dnl This is really gcc-only +dnl Do this test using CXX only since some versions of gcc +dnl 2.95-2.97 have a signed wchar_t in c++ only and some versions +dnl only have short-wchar support for c++. +dnl ************************************************************** + +AC_LANG_PUSH([C++]) + +_SAVE_CPPFLAGS=$CPPFLAGS +_SAVE_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS -fshort-wchar" + +AC_CACHE_CHECK([for compiler -fshort-wchar option], + gecko_cv_have_usable_wchar_option, + [AC_RUN_IFELSE([AC_LANG_SOURCE( + [[#include <stddef.h> + int main () { + return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; + } ]])], + [gecko_cv_have_usable_wchar_option="yes"], + [gecko_cv_have_usable_wchar_option="no"], + [gecko_cv_have_usable_wchar_option="maybe"])]) + +CXXFLAGS="$_SAVE_CXXFLAGS" + +if test "$_GECKO_cv_have_usable_wchar_option" = "yes"; then + CXXFLAGS="$CXXFLAGS -fshort-wchar" + AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar" +fi + +dnl ************** +dnl Check for RTTI +dnl ************** + +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 "x$enable_cpp_rtti" = "xno"; then + CXXFLAGS="-fno-rtti $CXXFLAGS" + AM_CXXFLAGS="-fno-rtti $AM_CXXFLAGS" +fi + +dnl ************* +dnl Various tests +dnl ************* + +AC_LANG_PUSH([C++]) +_SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT" + +AC_MSG_CHECKING([[whether we have a gtk 2 gecko build]]) +AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include <mozilla-config.h> + #include <string.h> + int main(void) { + return strcmp (MOZ_DEFAULT_TOOLKIT, "gtk2") != 0; + } ]] + )], + [result=yes], + [AC_MSG_ERROR([[This program needs a gtk 2 gecko build]])], + [result=maybe]) +AC_MSG_RESULT([$result]) + +AC_MSG_CHECKING([[whether we have a gecko debug build]]) +AC_PREPROC_IFELSE( + [AC_LANG_SOURCE( + [[#include <mozilla-config.h> + #if !defined(MOZ_REFLOW_PERF) || !defined(MOZ_REFLOW_PERF_DSP) + #error No + #endif]] + )], + [gecko_cv_have_debug=yes], + [gecko_cv_have_debug=no]) +AC_MSG_RESULT([$gecko_cv_have_debug]) + +CPPFLAGS="$_SAVE_CPPFLAGS" +AC_LANG_POP([C++]) + +if test "$gecko_cv_have_debug" = "xyes"; then + CXXFLAGS="-DDEBUG -D_DEBUG $CXXFLAGS" + AM_CXXFLAGS="-DDEBUG -D_DEBUG $AM_CXXFLAGS" +fi + +]) + +dnl *************************************************************************** +dnl *************************************************************************** +dnl *************************************************************************** + +dnl GECKO_CHECK_CONTRACTID_REGISTERED(IDENTIFIER, CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl +AC_DEFUN([GECKO_CHECK_CONTRACTID_REGISTERED], +[AC_REQUIRE([GECKO_INIT])dnl + +AC_CACHE_CHECK([for the $2 XPCOM component], +[gecko_cv_xpcom_service_[]$1], +[ +gecko_cv_xpcom_service_[]$1[]=no + +AC_LANG_PUSH([C++]) + +_SAVE_CPPFLAGS="$CPPFLAGS" +_SAVE_CXXFLAGS="$CFLAGS" +_SAVE_LDFLAGS="$LDFLAGS" +CPPFLAGS="$CPPFLAGS -I$_GECKO_INCLUDE_ROOT $($PKG_CONFIG --cflags-only-I $_GECKO-xpcom)" +CXXFLAGS="$CXXFLAGS $($PKG_CONFIG --cflags-only-other $_GECKO-xpcom)" +LDFLAGS="$LDFLAGS $($PKG_CONFIG --libs $_GECKO-xpcom) -Wl,--rpath=$_GECKO_HOME" + +AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <stdlib.h> +#include <nsXPCOM.h> +#include <nsCOMPtr.h> +#include <nsISupports.h> +#include <nsIServiceManager.h> +],[ +nsCOMPtr<nsIServiceManager> serviceManager; +nsresult rv = NS_InitXPCOM2 (getter_AddRefs (serviceManager), nsnull, nsnull); +if (NS_FAILED (rv) || !serviceManager) { + exit (EXIT_FAILURE); +} + +nsCOMPtr<nsISupports> service; +rv = serviceManager->GetServiceByContractID ($2, NS_GET_IID (nsISupports), getter_AddRefs (service)); +if (NS_FAILED (rv) || !service) { + NS_ShutdownXPCOM (nsnull); + exit (EXIT_FAILURE); +} + +NS_ShutdownXPCOM (nsnull); +exit (EXIT_SUCCESS); +]) +], +[gecko_cv_xpcom_service_[]$1[]=yes], +[gecko_cv_xpcom_service_[]$1[]=no], +[gecko_cv_xpcom_service_[]$1[]="no (cross-compiling)"]) + +CPPFLAGS="$_SAVE_CPPFLAGS" +CXXFLAGS="$_SAVE_CXXFLAGS" +LDFLAGS="$_SAVE_LDFLAGS" + +AC_LANG_POP([C++]) + +]) + +if test "$gecko_cv_xpcom_service_[]$1" = "yes"; then + ifelse([$3],,[:],[$3]) +else + ifelse([$4],,[:],[$4]) +fi + +]) |