# Configure.in
#
#  This file tests for various compiler features needed to configure 
#  the gtkmm package.  Original skeleton was provided by Stephan Kulow.
#  All tests were written by Tero Pulkkinen, Mirko Streckenbach, and 
#  Karl Nelson.
#
#
#  Copyright 2008 Hubert Figuiere
#  Copyright 2001 Free Software Foundation
#  Copyright 1999 gtkmm Development Team
#  Copyright 1998 Stephan Kulow 
#

#########################################################################
#  Version and initialization
#########################################################################
#We use pushdef here because we can't use shell variables before AC_INIT, but we want to use a variable with AC_INIT:
pushdef([LIBGEGLMM_MAJOR_VERSION],     [0])
pushdef([LIBGEGLMM_MINOR_VERSION],     [1])
pushdef([LIBGEGLMM_MICRO_VERSION],     [6])
pushdef([LIBGEGLMM_EXTRA_VERSION],     [])
pushdef([LIBGEGLMM_VERSION], LIBGEGLMM_MAJOR_VERSION.LIBGEGLMM_MINOR_VERSION.LIBGEGLMM_MICRO_VERSION[]LIBGEGLMM_EXTRA_VERSION)
AC_INIT([geglmm], LIBGEGLMM_VERSION, [gtkmm-list@gnome.org])
AC_CONFIG_SRCDIR([gegl/geglmmconfig.h.in])
#AC_PREREQ(2.59)

# Enable silent build rules by default, requires at least
# Automake-1.11. Disable by either passing --disable-silent-rules to
# configure or passing V=1 to make
m4_ifdef([AM_SILENT_RULES],
         [AM_SILENT_RULES([yes])],
         [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])

#
# +1 : ? : +1  == new interface that does not break old one
# +1 : ? : 0   == new interface that breaks old one
#  ? : ? : 0   == no new interfaces, but breaks apps
#  ? :+1 : ?   == just some internal changes, nothing breaks but might work 
#                 better
# CURRENT : REVISION : AGE
dnl 0.0.22 is 2:0:0
dnl 0.1.0 is 3:0:0
dnl 0.1.6 is 3:0:1
LIBGEGLMM_SO_VERSION=3:0:1

AC_SUBST([LIBGEGLMM_VERSION])
AC_SUBST(LIBGEGLMM_RELEASE)
AC_SUBST(LIBGEGLMM_SO_VERSION)

AC_CONFIG_MACRO_DIR(scripts)

dnl For automake.
VERSION=$LIBGEGLMM_VERSION
PACKAGE=geglmm

dnl Initialize automake stuff
# Initialize automake stuff
# tar-ustar asks it to use a sensible tar format that can handle long filenames.
AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])

dnl Specify a configuration file (no autoheader)
AM_CONFIG_HEADER(gegl/geglmmconfig.h)
AM_MAINTAINER_MODE
dnl AL_ACLOCAL_INCLUDE(scripts)

MM_PREREQ([0.9.5])
MM_INIT_MODULE([geglmm])

# Copy the mm-common .pl scripts into docs/,
# and use them from there,
# so we can dist them to avoid a tarball-build dependency.
MM_CONFIG_DOCTOOL_DIR([docs])

#########################################################################
#  Configure arguments 
#########################################################################

#########################################################################
#  Environment Checks
#########################################################################
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_CANONICAL_HOST

dnl Used for enabling the "-no-undefined" flag while generating DLLs
dnl Copied from the official gtk+-2 configure.in
AC_MSG_CHECKING([for some Win32 platform])
case "$host" in
  *-*-mingw*|*-*-cygwin*)
    platform_win32=yes
    ;;
  *)
    platform_win32=no
    ;;
esac
AC_MSG_RESULT([$platform_win32])
AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")

AC_MSG_CHECKING([for native Win32])
case "$host" in
  *-*-mingw*)
    os_win32=yes
    ;;
  *)
    os_win32=no
    ;;
esac
AC_MSG_RESULT([$os_win32])
AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")

AM_DISABLE_STATIC
AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL

AL_PROG_GNU_M4(AC_MSG_ERROR([dnl
SUN m4 does not work for building gtkmm. 
Please install GNU m4.]))

AL_PROG_GNU_MAKE(AC_MSG_ERROR([dnl
SUN make does not work for building gtkmm.
Please install GNU make.]))

MM_PATH_PERL
AS_IF([test "x$USE_MAINTAINER_MODE" != xno], [MM_CHECK_PERL])

#########################################################################
#  Dependancy checks
#########################################################################
PKG_CHECK_MODULES(LIBGEGLMM, glibmm-2.4 >= 2.28 gegl >= 0.1.4)
AC_SUBST(LIBGEGLMM_CFLAGS)
AC_SUBST(LIBGEGLMM_LIBS)

GLIBMM_PREFIX=`pkg-config --variable=prefix glibmm-2.4`
GLIBMM_LIBDIR=`pkg-config --variable=libdir glibmm-2.4`
GMM_PROCDIR=$GLIBMM_LIBDIR/glibmm-2.4/proc
AC_SUBST(GMM_PROCDIR)
GMM_PROC=$GMM_PROCDIR/gmmproc
AC_SUBST(GMM_PROC)

#########################################################################
#  C++ checks
#########################################################################
AC_PROG_CXX
AC_LANG_CPLUSPLUS


# Create a list of input directories for Doxygen.  We have to check wether
# we are building in the source directory, because Doxygen doesn't like
# duplicated directories in the input list.
LIBGEGLMM_DOXYGEN_INPUT=''
gtkmm_srcdir=`cd "$srcdir" && pwd`
gtkmm_builddir=`pwd`
for sublib in gegl
do
  LIBGEGLMM_DOXYGEN_INPUT="$LIBGEGLMM_DOXYGEN_INPUT $gtkmm_builddir/$sublib/$sublib""mm/"
  test "x$gtkmm_builddir" = "x$gtkmm_srcdir" || \
    LIBGEGLMM_DOXYGEN_INPUT="$LIBGEGLMM_DOXYGEN_INPUT $gtkmm_srcdir/$sublib/$sublib""mm/"
done
AC_SUBST(LIBGEGLMM_DOXYGEN_INPUT)

MM_ARG_ENABLE_DOCUMENTATION
MM_ARG_WITH_TAGFILE_DOC([libstdc++.tag], [mm-common-libstdc++])
MM_ARG_WITH_TAGFILE_DOC([libsigc++-2.0.tag], [sigc++-2.0])
MM_ARG_WITH_TAGFILE_DOC([glibmm-2.4.tag], [glibmm-2.4])

# Dummy conditional just to make automake-1.4 happy.
# We need an always-false condition in docs/Makefile.am.
AM_CONDITIONAL(LIBGEGLMM_FALSE,[false])

# HACK:  Assign a dummy in order to prevent execution of autoheader by the
# maintainer-mode rules.  That would fail since we aren't using autoheader.
AUTOHEADER=':'


AC_OUTPUT([
  Makefile

  gegl/Makefile
  gegl/geglmm.pc
  gegl/src/Makefile
  gegl/geglmm/Makefile
  gegl/geglmm/private/Makefile
  
  tools/Makefile
    tools/extra_defs_gen/Makefile
    tools/m4/Makefile

  scripts/Makefile

  docs/Makefile
    docs/reference/Doxyfile

  examples/Makefile
])

