dnl Initialization

AC_INIT(src/gtkhtml.c)
AM_CONFIG_HEADER(config.h)

PACKAGE=gtkhtml

GTKHTML_API_VERSION=3.1
AC_DEFINE_UNQUOTED(GTKHTML_API_VERSION, "${GTKHTML_API_VERSION}", [GtkHTML API Version])
AC_SUBST(GTKHTML_API_VERSION)

EDITOR_API_VERSION=3.1
AC_DEFINE_UNQUOTED(EDITOR_API_VERSION, "${EDITOR_API_VERSION}", [Editor API Version])
AC_SUBST(EDITOR_API_VERSION)

GTKHTML_RELEASE_STRING=${PACKAGE}-${GTKHTML_API_VERSION}
AC_DEFINE_UNQUOTED(GTKHTML_RELEASE_STRING, "${GTKHTML_RELEASE_STRING}",
					   [GtkHTML Release String])
AC_SUBST(GTKHTML_RELEASE_STRING)

GETTEXT_PACKAGE=${GTKHTML_RELEASE_STRING}
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])

GNOME_EXPLICIT_TRANSLATION_DOMAIN=${GTKHTML_RELEASE_STRING}
AC_DEFINE_UNQUOTED(GNOME_EXPLICIT_TRANSLATION_DOMAIN, "${GNOME_EXPLICIT_TRANSLATION_DOMAIN}", [Gnome Explicit Translation Domain])

AM_INIT_AUTOMAKE($PACKAGE, 3.2.5)

AM_MAINTAINER_MODE

dnl
dnl Due to the sed scripts being split on 90 line
dnl blocks, this macro needs to be right at the beggining.
dnl
AC_PROG_INTLTOOL([0.30])

AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AM_PROG_LIBTOOL

GNOME_COMPILE_WARNINGS(yes)
CFLAGS="$CFLAGS $warning_flags"

AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)

ALL_LINGUAS="am ar az be bg bn ca cs da de el en_CA en_GB es et eu fi fr ga gl gu he hi hr hu id it ja ko lt lv ms nb nl nn no pa pl pt pt_BR ru sk sl sq sr sr@Latn sv ta tr uk vi zh_CN zh_TW"
AM_GLIB_GNU_GETTEXT

GAIL_MODULES="gail >= 0.13"
PKG_CHECK_MODULES(GAIL, $GAIL_MODULES)
AC_SUBST(GAIL_CFLAGS)
AC_SUBST(GAIL_LIBS)
AC_SUBST(GAIL_MODULES)

GTKHTML_MODULES="gtk+-2.0 >= 2.2.0 libgnomeui-2.0 >= 1.112.1 libgnomeprint-2.2 >= 2.2.0 libgnomeprintui-2.2 >= 2.2.1 libglade-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GTKHTML, $GTKHTML_MODULES)
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
AC_SUBST(GTKHTML_MODULES)

EDITOR_MODULES="${GTKHTML_MODULES} libbonoboui-2.0 >= 2.2.4"
PKG_CHECK_MODULES(EDITOR, $EDITOR_MODULES)
AC_SUBST(EDITOR_CFLAGS)
AC_SUBST(EDITOR_LIBS)

ORBIT_IDL="`$PKG_CONFIG --variable=orbit_idl ORBit-2.0`"
AC_SUBST(ORBIT_IDL)

BONOBO_IDL_INCLUDES="-I`$PKG_CONFIG --variable=idldir libbonobo-2.0` -I`$PKG_CONFIG --variable=idldir bonobo-activation-2.0`"
AC_SUBST(BONOBO_IDL_INCLUDES)

dnl **********************************
dnl soup for testgtkhtml
dnl **********************************

PKG_CHECK_MODULES(SOUP, libsoup-2.2 >= 2.1.6, have_soup="yes", have_soup="no")
if test "x$have_soup" = "xno"; then
	PKG_CHECK_MODULES(SOUP, soup-2.0 >= 0.7.9, [have_soup="yes"
						    AC_DEFINE(HAVE_OLD_SOUP)],
						   have_soup="no")
fi
AM_CONDITIONAL(HAVE_SOUP, test x$have_soup != xno)
AC_SUBST(SOUP_CFLAGS)
AC_SUBST(SOUP_LIBS)

dnl **************************************************
dnl * File Chooser
dnl **************************************************
AC_ARG_ENABLE(file-chooser, [  --enable-file-chooser    Enable the usage of the GtkFileChooser in place of the GtkFileSelection dialog], enable_file_chooser="$enableval", enable_file_chooser="yes")
if test "x$enable_file_chooser" = "xyes"; then
  if $PKG_CONFIG --atleast-version=2.4.0 gtk+-2.0; then
    AC_DEFINE(USE_GTKFILECHOOSER,1,[Use new GtkFileChooser])
  fi
fi

dnl **************************************************
dnl * Gnome Icon Theme
dnl **************************************************
PKG_CHECK_MODULES(GIT, gnome-icon-theme >= 1.2.0)

dnl ******************************
dnl shlib factory
dnl ******************************

AC_ARG_ENABLE(shlib-factory, [  --enable-shlib-factory  build editor factory as shared library [default=yes]],shlib_factory="$enableval", shlib_factory="yes")

if test "x$shlib_factory" = "xyes"; then
	GNOME_GTKHTML_EDITOR_SHLIB=1
	GNOME_GTKHTML_EDITOR_TYPE="shlib"
	AC_DEFINE(GNOME_GTKHTML_EDITOR_SHLIB,, [Editor shlib])
else
	GNOME_GTKHTML_EDITOR_TYPE="exe"
fi

AC_SUBST(GNOME_GTKHTML_EDITOR_TYPE)
AM_CONDITIONAL(EDITOR_SHLIB, test x$shlib_factory = xyes)

dnl **********************************
dnl Library version information.
dnl **********************************
 
dnl Increment the following if the interface has additions, changes,
dnl removals.
GTKHTML_CURRENT=12

dnl Increment any time the source changes; set to 0 if you
dnl increment CURRENT.
GTKHTML_REVISION=6

dnl Increment if any interfaces have been added; set to 0
dnl if any interfaces have been removed. removal has 
dnl precedence over adding, so set to 0 if both happened.
GTKHTML_AGE=1

AC_SUBST(GTKHTML_CURRENT)
AC_SUBST(GTKHTML_REVISION)
AC_SUBST(GTKHTML_AGE)

dnl **************
dnl Done.
dnl **************

AC_OUTPUT([
Makefile
gtkhtml.spec
po/Makefile.in
src/Makefile
src/libgtkhtml.pc
a11y/Makefile
components/Makefile
components/html-editor/Makefile
art/Makefile
])

echo "

Configuration:

	Editor component type:		${GNOME_GTKHTML_EDITOR_TYPE}
"
