AC_INIT([Devhelp],[0.13],[http://bugzilla.gnome.org/enter_bug.cgi?product=devhelp],[devhelp])
  
AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-dist-gzip])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/dh-window.c])

AM_SANITY_CHECK
AM_MAINTAINER_MODE

AC_PROG_CC
AC_PROG_CXX
AC_ISC_POSIX
AC_HEADER_STDC
AM_PROG_LIBTOOL
AM_PATH_GLIB_2_0

AC_PROG_INTLTOOL
AC_PATH_PROG(GCONFTOOL, gconftool-2)

AM_GCONF_SOURCE_2

IMENDIO_COMPILE_WARNINGS

PKG_CHECK_MODULES(DEVHELP, [
	gtk+-2.0 >= 2.8.0
	gconf-2.0 >= 2.6.0
])

PKG_CHECK_MODULES(LIBDEVHELP, [
        gthread-2.0 >= 2.8.0
        gtk+-2.0 >= 2.8.0
	libglade-2.0 >= 2.4.0
	libwnck-1.0 >= 2.10.0
	gconf-2.0 >= 2.6.0
])

# *****
# Gecko
# *****

GECKO_INIT([GECKO])

AC_SUBST([GECKO])
AC_SUBST([GECKO_FLAVOUR])
AC_SUBST([GECKO_INCLUDE_ROOT])
AC_SUBST([GECKO_HOME])
AC_SUBST([GECKO_PREFIX])
AC_SUBST([GECKO_EXTRA_LIBS])

case "$GECKO" in
mozilla) gecko_min_version=1.7 ;;
seamonkey) gecko_min_version=1.0 ;;
*firefox) gecko_min_version=1.0 ;;
*thunderbird) gecko_min_version=1.0 ;;
xulrunner) gecko_min_version=1.8 ;;
esac

PKG_CHECK_MODULES([GECKO],[$GECKO_EXTRA_PKG_DEPENDENCIES $GECKO-xpcom >= $gecko_min_version])
AC_SUBST([GECKO_CFLAGS])
AC_SUBST([GECKO_LIBS])

# **********************************
# now tests for mozilla API variance
# **********************************

# Firefox doesn't have this API

AC_MSG_CHECKING([for nsIXULChromeRegistry API])

GECKO_COMPILE_IFELSE([content],
	[AC_LANG_PROGRAM(
		[[#include <nsEmbedString.h>
		  #include <nsIChromeRegistry.h>]],
		[[nsIXULChromeRegistry *p;
		  p->SelectSkin (nsEmbedCString(), PR_FALSE);]]
	)],
	[AC_DEFINE([MOZ_NSIXULCHROMEREGISTRY_SELECTSKIN],[1],[dummy]) result=yes],
	[result=no])

AC_MSG_RESULT([$result])

# changed from nsIXULChromeRegistry in 1.8a4

GECKO_CHECK_HEADERS([],[chrome/nsIChromeRegistrySea.h])

GECKO_WARN_CXXFLAGS="-Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor"
AC_SUBST(GECKO_WARN_CXXFLAGS)

dnl Checks for zlib library.
AC_LANG_PUSH([C])
_SAVE_CPPFLAGS="$CPPFLAGS"
_SAVE_LDFLAGS="$LDFLAGS"
 
AC_ARG_WITH(zlib,
[  --with-zlib[=DIR]       use libz in DIR],[
        if test "$withval" != "no" -a "$withval" != "yes"; then
                Z_DIR=$withval
                CPPFLAGS="$CPPFLAGS -I$withval/include"
                LDFLAGS="$LDFLAGS -L$withval/lib"
        fi
])
if test "$with_zlib" = "no"; then
        echo "Disabling compression support"
else
        AC_CHECK_HEADERS(zlib.h,
                AC_CHECK_LIB(z, gzread,[
                        AC_DEFINE(HAVE_LIBZ,1,[zlib is available])
                        if test "x${Z_DIR}" != "x"; then
                                Z_CFLAGS="-I${Z_DIR}/include"
                                Z_LIBS="-L${Z_DIR}/lib -lz"
                                [case ${host} in
                                        *-*-solaris*)
                                                Z_LIBS="-L${Z_DIR}/lib -R${Z_DIR}/lib -lz"
                                                ;;
                                esac]
                        else
                                Z_LIBS="-lz"
                        fi]))
fi

AC_SUBST(Z_CFLAGS)
AC_SUBST(Z_LIBS)

CPPFLAGS="$_SAVE_CPPFLAGS"
LDFLAGS="$_SAVE_LDFLAGS"
AC_LANG_POP([C])

ALL_LINGUAS="am ar az be bg ca cs da de el en_CA en_GB es et fi fr gl gu he hi hr hu is it ja kn ko lv mk ml ms nb ne nl pa pl pt pt_BR ru rw sk sl sq sr sr@Latn sv tr uk vi zh_CN zh_HK zh_TW"

GETTEXT_PACKAGE=devhelp
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Package name for gettext])

AM_GLIB_GNU_GETTEXT

AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)

AM_PATH_PYTHON([2.3],[],[no])

AC_CONFIG_FILES([
Makefile
libdevhelp-1.0.pc
dtd/Makefile
po/Makefile.in
src/Makefile
ui/Makefile
misc/Makefile
misc/gedit-plugin/Makefile
misc/gedit-plugin/devhelp/Makefile
contrib/Makefile
devhelp.desktop.in
])

AC_OUTPUT

