AC_PREREQ(2.50)
AC_INIT(libexif-gtk/gtk-exif-browser.c)
AM_INIT_AUTOMAKE(libexif-gtk, 0.3.5)
AM_MAINTAINER_MODE
AC_CONFIG_HEADERS(config.h)

AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC

dnl ---------------------------------------------------------------------------
dnl Versioning (libexif-gtk-AGE.CURRENT.REVISION):
dnl  - AGE (Micro):      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.
dnl  - REVISION (Minor): Increment any time the source changes; set to 
dnl                      0 if you incremented CURRENT.
dnl  - CURRENT (Major):  Increment if the interface has additions, changes,
dnl                      removals.
dnl ---------------------------------------------------------------------------
LIBEXIF_GTK_AGE=0
LIBEXIF_GTK_REVISION=0
LIBEXIF_GTK_CURRENT=5
AC_SUBST(LIBEXIF_GTK_AGE)
AC_SUBST(LIBEXIF_GTK_REVISION)
AC_SUBST(LIBEXIF_GTK_CURRENT)
LIBEXIF_GTK_VERSION_INFO=`expr $LIBEXIF_GTK_CURRENT + $LIBEXIF_GTK_REVISION`:$LIBEXIF_GTK_AGE:$LIBEXIF_GTK_REVISION
AC_SUBST(LIBEXIF_GTK_VERSION_INFO)

AM_PROG_LIBTOOL

dnl ---------------------------------------------------------------------------
dnl i18n support
dnl ---------------------------------------------------------------------------
ALL_LINGUAS="es fr ru"
AM_GNU_GETTEXT

dnl ---------------------------------------------------------------------------
dnl libraries needed
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(LIBEXIF_GTK, gtk+-2.0 libexif >= 0.6.12)
AC_SUBST(LIBEXIF_GTK_LIBS)
AC_SUBST(LIBEXIF_GTK_CFLAGS)
PKG_CHECK_MODULES(GTK, gtk+-2.0)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)

dnl ---------------------------------------------------------------------------
dnl There are still some old version of libexif around. For now, don't force
dnl users to upgrade
dnl ---------------------------------------------------------------------------
CPPFLAGS_save="$CPPFLAGS"
CPPFLAGS=$LIBEXIF_GTK_CFLAGS
AC_CHECK_HEADER([exif-mem.h], [
	exif_msg=">= 0.6.12"
	AC_DEFINE(HAVE_EXIF_0_6_12,1,[whether we use a version of libexif greater than 0.6.12])],[
	exif_msg="< 0.6.12 (think about upgrading)"])
CPPFLAGS="$CPPFLAGS_save"

CFLAGS="$CFLAGS -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith"
AC_SUBST(CFLAGS)

AC_OUTPUT([ po/Makefile.in m4/Makefile 
  Makefile
  libexif-gtk/Makefile
  libexif-gtk/libexif-gtk.pc
  gtk-extensions/Makefile
  tests/Makefile
])

echo "

Configuration (${PACKAGE}):

	Source code location:    $(srcdir)
	Version:                 ${VERSION}
	Compiler:                ${CC}

	libexif:                 ${exif_msg}

"
