diff options
Diffstat (limited to 'm4/gecko.m4')
-rw-r--r-- | m4/gecko.m4 | 80 |
1 files changed, 57 insertions, 23 deletions
diff --git a/m4/gecko.m4 b/m4/gecko.m4 index b9053e148..035b0119b 100644 --- a/m4/gecko.m4 +++ b/m4/gecko.m4 @@ -15,7 +15,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# GECKO_INIT([VARIABLE]) +# GECKO_INIT(VARIABLE,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) # # Checks for gecko, and aborts if it's not found # @@ -45,7 +45,7 @@ AC_MSG_CHECKING([which gecko to use]) AC_ARG_WITH([gecko], AS_HELP_STRING([--with-gecko@<:@=mozilla|firefox|seamonkey|xulrunner@:>@], - [Which gecko engine to use (default: autodetect)])) + [Which gecko engine to use (autodetected by default)])) # Backward compat AC_ARG_WITH([mozilla],[],[with_gecko=$withval],[]) @@ -63,13 +63,23 @@ if test -z "$_GECKO"; then done fi +AC_MSG_RESULT([$_GECKO]) + if test "x$_GECKO" = "x"; then - AC_MSG_ERROR([No gecko found; you may need to adjust PKG_CONFIG_PATH or install a mozilla/firefox/xulrunner -devel package]) + ifelse([$3],,[AC_MSG_ERROR([No gecko found; you may need to adjust PKG_CONFIG_PATH or install a mozilla/firefox/xulrunner -devel package])],[$3]) + gecko_cv_have_gecko=no elif ! ( echo "$_geckos" | egrep "(^| )$_GECKO(\$| )" > /dev/null); then AC_MSG_ERROR([Unknown gecko "$_GECKO" specified]) +else + ifelse([$2],,[],[$2]) + gecko_cv_have_gecko=yes fi -AC_MSG_RESULT([$_GECKO]) +# **************** +# Define variables +# **************** + +if test "$gecko_cv_have_gecko" = "yes"; then case "$_GECKO" in mozilla) _GECKO_FLAVOUR=mozilla ;; @@ -78,11 +88,12 @@ seamonkey) _GECKO_FLAVOUR=mozilla ;; 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`" +fi # if gecko_cv_have_gecko + $1[]=$_GECKO $1[]_FLAVOUR=$_GECKO_FLAVOUR $1[]_INCLUDE_ROOT=$_GECKO_INCLUDE_ROOT @@ -101,6 +112,8 @@ _GECKO_EXTRA_CFLAGS= _GECKO_EXTRA_CXXFLAGS= _GECKO_EXTRA_LDFLAGS= +if test "$gecko_cv_have_gecko" = "yes"; then + AC_LANG_PUSH([C++]) _SAVE_CXXFLAGS=$CXXFLAGS @@ -126,10 +139,14 @@ if test "$gecko_cv_have_usable_wchar_option" = "yes"; then AM_CXXFLAGS="$AM_CXXFLAGS -fshort-wchar" fi +fi # if gecko_cv_have_gecko + # ************** # Check for RTTI # ************** +if test "$gecko_cv_have_gecko" = "yes"; then + AC_MSG_CHECKING([whether to enable C++ RTTI]) AC_ARG_ENABLE([cpp-rtti], AS_HELP_STRING([--enable-cpp-rtti],[Enable C++ RTTI]), @@ -141,10 +158,14 @@ if test "$enable_cpp_rtti" = "no"; then AM_CXXFLAGS="-fno-rtti $AM_CXXFLAGS" fi +fi # if gecko_cv_have_gecko + # ************* # Various tests # ************* +if test "$gecko_cv_have_gecko" = "yes"; then + AC_LANG_PUSH([C++]) _SAVE_CPPFLAGS="$CPPFLAGS" @@ -185,10 +206,14 @@ if test "$gecko_cv_have_debug" = "yes"; then AM_CXXFLAGS="-DDEBUG -D_DEBUG $AM_CXXFLAGS" fi +fi # if gecko_cv_have_gecko + # *********************** # Check for gecko version # *********************** +if test "$gecko_cv_have_gecko" = "yes"; then + AC_MSG_CHECKING([[for gecko version]]) _GECKO_VERSION_SPLIT=`cat $_GECKO_INCLUDE_ROOT/mozilla-config.h | grep MOZILLA_VERSION_U | awk '{ print $[3]; }' | tr ".ab+" " "` @@ -202,10 +227,6 @@ _GECKO_VERSION="$_GECKO_VERSION_MAJOR.$_GECKO_VERSION_MINOR" AC_MSG_RESULT([$_GECKO_VERSION]) -$1[]_VERSION=$_GECKO_VERSION -$1[]_VERSION_MAJOR=$_GECKO_VERSION_MAJOR -$1[]_VERSION_MINOR=$_GECKO_VERSION_MINOR - if test "$_GECKO_VERSION_MAJOR" != "1" -o "$_GECKO_VERSION_MINOR" -lt "7" -o "$_GECKO_VERSION_MINOR" -gt "9"; then AC_MSG_ERROR([Gecko version $_GECKO_VERSION is not supported!]) fi @@ -223,10 +244,16 @@ if test "$_GECKO_VERSION_MAJOR" = "1" -a "$_GECKO_VERSION_MINOR" -ge "9"; then gecko_cv_have_gecko_1_9=yes fi +fi # if gecko_cv_have_gecko + AM_CONDITIONAL([HAVE_GECKO_1_7],[test "$_GECKO_VERSION_MAJOR" = "1" -a "$_GECKO_VERSION_MINOR" -ge "7"]) AM_CONDITIONAL([HAVE_GECKO_1_8],[test "$_GECKO_VERSION_MAJOR" = "1" -a "$_GECKO_VERSION_MINOR" -ge "8"]) AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$_GECKO_VERSION_MAJOR" = "1" -a "$_GECKO_VERSION_MINOR" -ge "9"]) +$1[]_VERSION=$_GECKO_VERSION +$1[]_VERSION_MAJOR=$_GECKO_VERSION_MAJOR +$1[]_VERSION_MINOR=$_GECKO_VERSION_MINOR + ]) # *************************************************************************** @@ -238,6 +265,10 @@ AM_CONDITIONAL([HAVE_GECKO_1_9],[test "$_GECKO_VERSION_MAJOR" = "1" -a "$_GECKO_ m4_define([GECKO_DISPATCH], [ +if test "$gecko_cv_have_gecko" != "yes"; then + AC_MSG_FAILURE([Gecko not present; can't run this test!]) +fi + AC_LANG_PUSH([C++]) _SAVE_CPPFLAGS="$CPPFLAGS" @@ -285,17 +316,19 @@ AC_DEFUN([GECKO_RUN_IFELSE],[GECKO_DISPATCH([AC_RUN_IFELSE],$@)]) # *************************************************************************** # *************************************************************************** -# GECKO_CHECK_CONTRACTID(IDENTIFIER, CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# 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 -AC_CACHE_CHECK([for the $2 XPCOM component], -[gecko_cv_xpcom_contractid_[]$1], +AS_VAR_PUSHDEF([gecko_cv_have_CID],[gecko_cv_have_$1]) + +AC_CACHE_CHECK([for the $1 XPCOM component], +[gecko_cv_have_CID], [ -gecko_cv_xpcom_contractid_[]$1[]=no +gecko_cv_have_CID=no GECKO_RUN_IFELSE([], [AC_LANG_PROGRAM([[ @@ -334,26 +367,27 @@ if (NS_FAILED (rv)) { } PRBool isRegistered = PR_FALSE; -rv = registar->IsContractIDRegistered ("$2", &isRegistered); +rv = registar->IsContractIDRegistered ("$1", &isRegistered); registar = nsnull; // release registar before shutdown NS_ShutdownXPCOM (nsnull); exit (isRegistered ? EXIT_SUCCESS : EXIT_FAILURE); ]]) ], -[gecko_cv_xpcom_contractid_[]$1[]=present], -[gecko_cv_xpcom_contractid_[]$1[]="not present"], -[gecko_cv_xpcom_contractid_[]$1[]="not present (cross-compiling)"]) +[gecko_cv_have_CID=yes], +[gecko_cv_have_CID=no], +[gecko_cv_have_CID=maybe]) ]) -if test "$gecko_cv_xpcom_contractid_[]$1" = "present"; then - ifelse([$3],,[:],[$3]) +if test "$gecko_cv_have_CID" = "yes"; then + ifelse([$2],,[:],[$2]) else - ifelse([$4],,[AC_MSG_FAILURE([dnl -Contract ID "$2" is not registered, but $PACKAGE_NAME depends on it.])], - [$4]) + ifelse([$3],,[AC_MSG_FAILURE([dnl +Contract ID "$1" is not registered, but $PACKAGE_NAME depends on it.])], + [$3]) fi -]) +AS_VAR_POPDEF([gecko_cv_have_CID]) +]) |