
AC_INIT(libdbusmenu, 0.3.1, ted@canonical.com)
AC_COPYRIGHT([Copyright 2009,2010 Canonical])

AC_PREREQ(2.62)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libdbusmenu, 0.3.1, [-Wno-portability])

AM_MAINTAINER_MODE

IT_PROG_INTLTOOL([0.35.0])
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_C_O
AC_STDC_HEADERS
AC_PROG_LIBTOOL

AC_SUBST(VERSION)
AC_CONFIG_MACRO_DIR([m4])

m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

###########################
# GTK Doc 
###########################

GTK_DOC_CHECK([1.4])
GNOME_DOC_INIT

###########################
# Dependencies - GLib
###########################

GLIB_REQUIRED_VERSION=2.18
DBUS_REQUIRED_VERSION=0.76
XML_REQUIRED_VERSION=2.6

PKG_CHECK_MODULES(DBUSMENUGLIB, glib-2.0 >= $GLIB_REQUIRED_VERSION
                                dbus-glib-1 >= $DBUS_REQUIRED_VERSION
                                libxml-2.0 >= $XML_REQUIRED_VERSION)

AC_SUBST(DBUSMENUGLIB_CFLAGS)
AC_SUBST(DBUSMENUGLIB_LIBS)

###########################
# Dependencies - GTK
###########################

GTK_REQUIRED_VERSION=2.16

PKG_CHECK_MODULES(DBUSMENUGTK,  gtk+-2.0 >= $GTK_REQUIRED_VERSION
                                glib-2.0 >= $GLIB_REQUIRED_VERSION
                                dbus-glib-1 >= $DBUS_REQUIRED_VERSION
                                libxml-2.0 >= $XML_REQUIRED_VERSION)

AC_SUBST(DBUSMENUGTK_CFLAGS)
AC_SUBST(DBUSMENUGTK_LIBS)

###########################
# Dependencies - Testing
###########################

JSON_GLIB_REQUIRED_VERSION=0.6.0

PKG_CHECK_MODULES(DBUSMENUTESTS,  json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION)

AC_SUBST(DBUSMENUTESTS_CFLAGS)
AC_SUBST(DBUSMENUTESTS_LIBS)

###########################
# GObject Introspection
###########################

GOBJECT_INTROSPECTION_CHECK([0.6.7])

###########################
# Vala API Generation
###########################

AC_PATH_PROG([VALA_API_GEN], [vapigen])

###########################
# Lib versioning 
###########################

LIBDBUSMENU_CURRENT=1
LIBDBUSMENU_REVISION=7
LIBDBUSMENU_AGE=0

AC_SUBST(LIBDBUSMENU_CURRENT)
AC_SUBST(LIBDBUSMENU_REVISION)
AC_SUBST(LIBDBUSMENU_AGE)

###########################
# Internationalization
###########################

GETTEXT_PACKAGE=libdbusmenu
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the default gettext domain])

AM_GLIB_GNU_GETTEXT

###########################
# Massive Debugging
###########################

with_massivedebugging="no"
AC_ARG_ENABLE(massivedebugging, AS_HELP_STRING([--enable-massivedebugging], [Print out so much information your brain will hurt]), with_massivedebugging=$enableval, with_massivedebugging=no)
if test "x$with_massivedebugging" = "xyes"; then
	AC_DEFINE([MASSIVEDEBUGGING], [1], [Print everyting])
fi

###########################
# Files
###########################

AC_OUTPUT([
Makefile
po/Makefile.in
libdbusmenu-glib/Makefile
libdbusmenu-glib/dbusmenu-glib.pc
libdbusmenu-gtk/Makefile
libdbusmenu-gtk/dbusmenu-gtk.pc
tools/Makefile
tools/testapp/Makefile
tests/Makefile
docs/Makefile
docs/libdbusmenu-glib/Makefile
docs/libdbusmenu-glib/reference/Makefile
docs/libdbusmenu-glib/reference/version.xml
docs/libdbusmenu-gtk/Makefile
docs/libdbusmenu-gtk/reference/Makefile
docs/libdbusmenu-gtk/reference/version.xml
])

###########################
# Results
###########################

AC_MSG_NOTICE([

libdbusmenu Configuration:

	Prefix:                 $prefix
	Massive Debugging:      $with_massivedebugging
])

