m4_define([matecomponent_major_version], [1])
m4_define([matecomponent_minor_version], [2])
m4_define([matecomponent_micro_version], [0])
m4_define([matecomponent_version],[matecomponent_major_version.matecomponent_minor_version.matecomponent_micro_version])

AC_INIT([libmatecomponentui],[matecomponent_version],[http://www.mate-desktop.org])

AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2])

AM_MAINTAINER_MODE

AC_CANONICAL_HOST

case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
    ;;
esac

if test "$os_win32" = "yes"; then
  if test x$enable_static = xyes -o x$enable_static = x; then
    AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
    enable_static=no
  fi
  if test x$enable_shared = xno; then
    AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
  fi
  enable_shared=yes
fi

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")

MATE_COMMON_INIT
MATE_DEBUG_CHECK
MATE_COMPILE_WARNINGS([maximum])

# see bug #455597
# MATE_MAINTAINER_MODE_DEFINES

IT_PROG_INTLTOOL([0.40.0])

GETTEXT_PACKAGE=libmatecomponentui
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext domain])

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

gtk_target="`$PKG_CONFIG --variable=target gtk+-2.0`"

if test $gtk_target = x11 ; then
  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
fi

AC_SUBST(X_LIBS)

# popt
AC_CHECK_LIB(popt, poptStrippedArgv, POPT_LIBS=-lpopt, AC_MSG_ERROR([You must have popt version 1.5 or greater installed.]))
AC_SUBST(POPT_LIBS)
AC_CHECK_HEADER(popt.h,,AC_MSG_ERROR([Failed to find popt.h - you may have to adjust your environment]))

dnl
dnl Start of pkg-config checks
dnl
MATECOMPONENTUI_MODULES="libmatecanvas-2.0 \
		  libmatecomponent-2.0 \
		  libmate-2.0 \
		  matecomponent-activation-2.0 \
		  libxml-2.0 >= 2.4.20 \
		  mateconf-2.0 \
		  gtk+-2.0 >= 2.6.0 \
		  gobject-2.0 >= 2.6.0"
PKG_CHECK_MODULES(MATECOMPONENTUI, $MATECOMPONENTUI_MODULES)
AC_SUBST(MATECOMPONENTUI_CFLAGS)
AC_SUBST(MATECOMPONENTUI_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(MATECOMPONENTUI_GLADE, $MATECOMPONENTUI_MODULES libglade-2.0 >= 1.99.11)
AC_SUBST(MATECOMPONENTUI_GLADE_CFLAGS)
AC_SUBST(MATECOMPONENTUI_GLADE_LIBS)

if test "$enable_maintainer_mode" = "yes"; then
	MATECOMPONENTUI_SINGLE_INCLUDES="-DGTK_DISABLE_SINGLE_INCLUDES -DG_DISABLE_SINGLE_INCLUDES"
	AC_SUBST(MATECOMPONENTUI_SINGLE_INCLUDES)
fi

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

GTK_DOC_CHECK([1.0])

AC_CONFIG_FILES([
Makefile
libmatecomponentui-zip
po/Makefile.in
matecomponent/Makefile
matecomponent/libmatecomponentui-2.0.pc
matecomponent/libmatecomponentui-2.0-uninstalled.pc
glade/Makefile
samples/Makefile
samples/controls/Makefile
samples/matecomponentui/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
])

AC_OUTPUT
