diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/Makefile.am | 6 | ||||
-rw-r--r-- | macros/mozilla-version.pl | 12 | ||||
-rw-r--r-- | macros/mozilla.m4 | 66 | ||||
-rw-r--r-- | macros/xerces-version.pl | 13 | ||||
-rw-r--r-- | macros/xerces.m4 | 57 |
5 files changed, 152 insertions, 2 deletions
diff --git a/macros/Makefile.am b/macros/Makefile.am index cb7c18547d..2aec9ff058 100644 --- a/macros/Makefile.am +++ b/macros/Makefile.am @@ -22,9 +22,11 @@ MACROS= \ gnome.m4 \ gperf-check.m4 \ linger.m4 \ - need-declaration.m4 + need-declaration.m4 \ + xerces.m4 \ + mozilla.m4 -EXTRA_DIST=$(MACROS) gnome-common.m4 gnome-gettext.m4 autogen.sh +EXTRA_DIST=$(MACROS) gnome-common.m4 gnome-gettext.m4 autogen.sh mozilla-version.pl xerces-version.pl MAINTAINERCLEANFILES=macros.dep @MAINT@macros.dep: Makefile.am diff --git a/macros/mozilla-version.pl b/macros/mozilla-version.pl new file mode 100644 index 0000000000..21e20c63ff --- /dev/null +++ b/macros/mozilla-version.pl @@ -0,0 +1,12 @@ +#!/usr/bin/perl + +# Tiny Perl script to check the mozilla version. I don't even like Perl. +# to make things easier on myself, I'm just going to treat the mozilla version as base 10. This will probably break + +# Author: Andrew Chatham + +$ver = 0; +while (<>) { + if (/useragent.misc\", \"rv:([0-9]+)\.([0-9]+)\.([0-9]+)/) { $ver = $1 * 100 + $2 * 10 + $3; } +} +print $ver; diff --git a/macros/mozilla.m4 b/macros/mozilla.m4 new file mode 100644 index 0000000000..4d753be8e2 --- /dev/null +++ b/macros/mozilla.m4 @@ -0,0 +1,66 @@ +dnl - Determine where and which version of mozilla is installed on the system +dnl - Author: Andrew Chatham + +AC_DEFUN([AC_CHECK_MOZILLA],[ + has_mozilla=false + + CFLAGS=${CFLAGS--O} + + mozprefix="/usr" + + AC_ARG_WITH(mozilla, + [ --with-mozilla=dir Specify the Mozilla directory],[ + if test x$withval != x; then + mozprefix=$withval + fi + ], [ + if test x$MOZILLA != x; then + mozprefix="$MOZILLA/dist" + fi + ]) + + MOZILLA_INCLUDE_DIR="$mozprefix/include" + MOZILLA_LIB_DIR="$mozprefix/lib" + MOZILLA_BIN_DIR="$mozprefix/bin" + MOZILLA_IDL_DIR="$mozprefix/idl" + + AC_MSG_CHECKING(for mozilla) + + if ! test -f $MOZILLA_INCLUDE_DIR/nsError.h; then + AC_MSG_ERROR("Could not find header nsError.h in includes dir $MOZILLA_INCLUDE_DIR") + fi + + if ! test -f $MOZILLA_LIB_DIR/libgtkembedmoz.so; then + AC_MSG_ERROR("Could not find library libgtkembedmoz.so in lib dir $MOZILLA_LIB_DIR") + fi + + if ! test -f $MOZILLA_IDL_DIR/nsISupports.idl; then + AC_MSG_ERROR("Could not find nsISupports.idl in idl dir $MOZILLA_IDL_DIR") + fi + + if test -f $MOZILLA_LIB_DIR/defaults/pref/all.js; then + ALLJSLOC=$MOZILLA_LIB_DIR/defaults/pref/all.js + else + ALLJSLOC=$MOZILLA_FIVE_HOME/defaults/pref/all.js + fi + + MOZILLA_VER=$(perl $srcdir/macros/mozilla-version.pl $ALLJSLOC) + + if test $MOZILLA_VER -eq "0"; then + AC_MSG_ERROR("Could not determine mozilla version") + fi + + if test $MOZILLA_VER -lt "91"; then + AC_MSG_ERROR("Mozilla version must be at least 0.9.1") + else + AC_MSG_RESULT(found) + fi + + AC_SUBST(MOZILLA_BIN_DIR) + AC_SUBST(MOZILLA_LIB_DIR) + AC_SUBST(MOZILLA_INCLUDE_DIR) + AC_SUBST(MOZILLA_IDL_DIR) + AC_SUBST(MOZILLA_VER) +]) + + diff --git a/macros/xerces-version.pl b/macros/xerces-version.pl new file mode 100644 index 0000000000..5c21b4e275 --- /dev/null +++ b/macros/xerces-version.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +$maj = 0; +$min = 0; +while (<>) { + if (/xerces-c(\d+)_(\d+)\.so$/) { + if ($1 > $maj || (\\$1 == $maj && \$2 > $min)) { + $maj = $1; + $min = $2; + } + } +} +print $maj,"_",$min diff --git a/macros/xerces.m4 b/macros/xerces.m4 new file mode 100644 index 0000000000..bea87e2669 --- /dev/null +++ b/macros/xerces.m4 @@ -0,0 +1,57 @@ +dnl - Determine where and which version of xerces is installed on the system +dnl - Author: Andrew Chatham + +AC_DEFUN([AC_CHECK_XERCES],[ + has_xerces=false + + CFLAGS=${CFLAGS--O} + + AC_ARG_WITH(xerces, + [ --with-xerces=dir Specify the Xerces directory],[ + if test x$withval != x; then + XERCES_INCLUDE_DIR="$withval/include" + XERCES_LIB_DIR=$withval/lib + fi + ]) + + AC_MSG_CHECKING(for xerces) + if test x$XERCES_INCLUDE_DIR = x; then + if test x$XERCESCROOT = x; then + if test "x$prefix" != "xNONE"; then + XERCESCROOT="$prefix" + fi + fi + XERCES_INCLUDE_DIR=$XERCESCROOT/include + fi + + if test x$XERCES_LIB_DIR = x; then + XERCES_LIB_DIR=$XERCESCROOT/lib + fi + + XERCES_VER=`ls $XERCES_LIB_DIR/libxerces*.so | + perl $srcdir/macros/xerces-version.pl` + + if test "x$XERCES_VER" = "x0_0"; then + AC_MSG_ERROR("You must have Xerces installed and set XERCESCROOT or use --with-xerces") + else + AC_MSG_RESULT(found) + fi + + XERCES_LIBNAME=xerces-c + XERCES_LIBRARY_NAMES=-l${XERCES_LIBNAME}${XERCES_VER} + XERCES_LIBRARY_SEARCH_PATHS=-L${XERCES_LIB_DIR} + XERCES_INCLUDE=-I${XERCES_INCLUDE_DIR} + + AC_SUBST(XERCES_LIBRARY_NAMES) + AC_SUBST(XERCES_LIBNAME) + AC_SUBST(XERCES_INCLUDE) + AC_SUBST(XERCES_INCLUDE_DIR) + AC_SUBST(XERCES_VER) + AC_SUBST(XERCES_LIBRARY_SEARCH_PATHS) + + if test -f "${XERCES_INCLUDE_DIR}/util/XMLUniDefs.hpp"; then + AC_DEFINE(HAVE_XMLUNIDEFS) + fi +]) + + |