AC_PREREQ(2.50)
AC_INIT(libiptcdata/iptc-data.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libiptcdata, 1.0.4)
AM_MAINTAINER_MODE

dnl ---------------------------------------------------------------------------
dnl When making a release:
dnl  1. If the library source code has changed at all since the last release,
dnl     then increment REVISION.
dnl  2. If the interface has been changed since the last release, increment
dnl     CURRENT, and set REVISION to 0.
dnl  3. If the interface changes consist solely of additions, increment AGE.
dnl  4. If the interface has removed elements, set AGE to 0.
dnl ---------------------------------------------------------------------------
LIBIPTCDATA_AGE=3
LIBIPTCDATA_REVISION=3
LIBIPTCDATA_CURRENT=3
AC_SUBST(LIBIPTCDATA_AGE)
AC_SUBST(LIBIPTCDATA_REVISION)
AC_SUBST(LIBIPTCDATA_CURRENT)
LIBIPTCDATA_VERSION_INFO=$LIBIPTCDATA_CURRENT:$LIBIPTCDATA_REVISION:$LIBIPTCDATA_AGE
AC_SUBST(LIBIPTCDATA_VERSION_INFO)

AM_DISABLE_STATIC
AM_PROG_LIBTOOL


AC_ARG_ENABLE(python,
[  --enable-python         Build Python wrapper library],
[case "${enableval}" in
  yes) pythonlib=true ;;
  no)  pythonlib=false ;;
  *) AC_MSG_ERROR(bad value ${enableval} for --enable-python) ;;
esac],[pythonlib=false])
AM_CONDITIONAL([PYTHONLIB], [test x$pythonlib = xtrue])

if test "x$pythonlib" = "xtrue"; then
    dnl setup python devel environment
    AC_PYTHON_DEVEL
    AM_PATH_PYTHON
fi

dnl Create a stdint.h-like file containing size-specific integer definitions
dnl that will always be available
AC_NEED_STDINT_H(libiptcdata/_stdint.h)

dnl ---------------------------------------------------------------------------
dnl i18n support
dnl ---------------------------------------------------------------------------
dnl ALL_LINGUAS="de it"

dnl The gettext domain of the command-line utility
IPTC_GETTEXT_PACKAGE=iptc
AC_DEFINE_UNQUOTED(IPTC_GETTEXT_PACKAGE,"$IPTC_GETTEXT_PACKAGE",[The gettext domain for the command-line utility])
AC_SUBST(IPTC_GETTEXT_PACKAGE)

dnl The gettext domain of the library
GETTEXT_PACKAGE=${PACKAGE}
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[The gettext domain for the library])
AC_SUBST(GETTEXT_PACKAGE)
#if test -f po/Makevars.template
#then
#	sed -e "s/^DOMAIN.*/DOMAIN = ${GETTEXT_PACKAGE}/" < po/Makevars.template > po/Makevars
#	AC_MSG_RESULT([yes. done.])
#else
#	AC_MSG_RESULT([no])
#fi
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.13.1)

AM_ICONV()

dnl Check for headers (Mac OSX often doesn't have them)
AC_CHECK_HEADERS([getopt.h wchar.h iconv.h])


GTK_DOC_CHECK([1.0])


dnl ---------------------------------------------------------------------------
dnl Warnings
dnl ---------------------------------------------------------------------------
if test "x$GCC" = "xyes"; then
    CFLAGS="$CFLAGS -g -Wall -Wmissing-declarations -Wmissing-prototypes"
    LDFLAGS="$LDFLAGS -g -Wall"
    AC_SUBST(CFLAGS)
    AC_SUBST(LDFLAGS)
fi

AC_OUTPUT([
  Makefile
  libiptcdata.spec
  libiptcdata/Makefile
  m4/Makefile
  libiptcdata/libiptcdata.pc
  iptc/Makefile
  docs/Makefile
  docs/reference/Makefile
  docs/reference/version.xml
  po/Makefile.in
  iptc/po/Makefile.in
  win/Makefile
  win/iptctool/Makefile
  python/Makefile
])

echo "

Configuration (libiptcdata):

	Source code location:  ${srcdir}
	Compiler:              ${CC}
	Python Library:        ${pythonlib}
"
