AC_INIT(bonobo/bonobo-ui-engine.h)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libbonoboui, 2.8.1)

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

AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_PROG_YACC
AC_PATH_PROGS(PATH_TO_XRDB, "xrdb")

GNOME_COMPILE_WARNINGS

GETTEXT_PACKAGE=libbonoboui-2.0
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
gnomelocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gnomelocaledir)

ALL_LINGUAS="af am ar az be bg bn bs ca cs cy da de el en_CA en_GB es et eu fa fi fr ga gl gu he hi hr hu id is it ja kn ko li lt lv ml mn mr ms nb ne nl nn no nso or pa pl pt pt_BR ro ru sk sl sq sr sr@ije sr@Latn sv ta tr uk vi wa yi zh_CN zh_TW zu"
AM_GLIB_GNU_GETTEXT

AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
if test x$PKG_CONFIG = xno; then
  AC_MSG_ERROR([Couldn't find pkg-config, please install it and retry])
fi

dnl X development libraries check

#
# If Pango included the shared library dependencies from X11 in
# the pkg-config output, then we use that (to avoid duplicates).
# but if they were omitted to avoid binary compatibility problems
# then we need to repeat the checks.
#
if $PKG_CONFIG --exists pangoxft ; then
  PANGO_PACKAGES="pangox pangoxft"
else
  PANGO_PACKAGES="pangox"
fi

x_libs="`$PKG_CONFIG --libs $PANGO_PACKAGES`"
case x_libs in
  *-lX11*) pango_omitted_x_deps=no ;;
  *)       pango_omitted_x_deps=yes ;;
esac

if test $pango_omitted_x_deps = yes ; then
  AC_PATH_XTRA

  if test x$no_x = xyes ; then
    AC_MSG_ERROR([X development libraries not found])
  else
    X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
  fi
fi

AC_SUBST(X_LIBS)

dnl
dnl Start of pkg-config checks
dnl
BONOBOUI_MODULES="libgnomecanvas-2.0 >= 1.116.0 \
		  libbonobo-2.0 >= 2.3.3 \
		  libgnome-2.0 >= 1.116.0 \
		  bonobo-activation-2.0 >= 1.0.0 \
		  libxml-2.0 >= 2.4.20 \
		  gconf-2.0 >= 1.1.9 \
		  gtk+-2.0 >= 2.3.1 \
		  gobject-2.0 >= 2.3.2"
PKG_CHECK_MODULES(BONOBOUI, $BONOBOUI_MODULES)
AC_SUBST(BONOBOUI_CFLAGS)
AC_SUBST(BONOBOUI_LIBS)

AC_MSG_CHECKING([for broken, old development packages])
if $PKG_CONFIG --exists gdk_pixbuf; then
	if $PKG_CONFIG --modversion 'gdk_pixbuf >= 0.12'; then
		AC_MSG_RESULT([parallel install ok]);
	else
		AC_ERROR([If you have gdk-pixbuf you need at least ver 0.12]);
	fi
else
	AC_MSG_RESULT([clean])
fi;

PKG_CHECK_MODULES(BONOBOUI_GLADE, $BONOBOUI_MODULES libglade-2.0 >= 1.99.11)
AC_SUBST(BONOBOUI_GLADE_CFLAGS)
AC_SUBST(BONOBOUI_GLADE_LIBS)

# glib-genmarshal
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
# glib-mkenums
AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)

GTK_DOC_CHECK([1.0])

AC_OUTPUT([
Makefile
po/Makefile.in
bonobo/Makefile
bonobo/libbonoboui-2.0.pc
bonobo/libbonoboui-2.0-uninstalled.pc
glade/Makefile
samples/Makefile
samples/controls/Makefile
samples/bonoboui/Makefile
samples/container/Makefile
samples/compound-doc/Makefile
samples/compound-doc/container/Makefile
samples/canvdemo/Makefile
tests/Makefile
tests/control/Makefile
tools/Makefile
tools/browser/Makefile
doc/Makefile
doc/api/Makefile
doc/api/figures/Makefile
])
