AC_PREREQ(2.61)


#######
# Setup
#######
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([src/engine.cpp])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign])
AC_CANONICAL_HOST


####################
# Check for programs
####################
AC_PROG_CC
AC_PROG_CXX
AC_LANG(C++)
AC_PROG_LIBTOOL
AC_PROG_INSTALL
#PKG_PROG_PKG_CONFIG([0.20])


#################
# Developers only
#################
AM_MAINTAINER_MODE

AC_ARG_VAR([DEBUG_FLAGS], [Debug flag to use with --enable debug (default: -g)])
if test -z "$DEBUG_FLAGS"; then
  DEBUG_FLAGS="-g";
fi

AC_MSG_CHECKING([whether to turn on debugging])
AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging (default=no)])
if test "$enable_debug" = "yes"; then
  AC_MSG_RESULT([yes ($DEBUG_FLAGS)])
  CPPFLAGS="$DEBUG_FLAGS $CPPFLAGS"
else
  AC_MSG_RESULT([no])
fi

AC_ARG_ENABLE(build-dist)
if test "$enable_build_dist" = "yes"; then
  SVN_VERSION=`svnversion .`
  PACKAGE_STRING="${PACKAGE_STRING}-r$SVN_VERSION"
  PACKAGE_VERSION="${PACKAGE_VERSION}-r$SVN_VERSION"
  VERSION="${VERSION}-r$SVN_VERSION"
fi

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T

AM_OPTIONS_WXCONFIG
AM_PATH_WXCONFIG(2.8.1, [have_wxconfig=1], [have_wxconfig=0], [std,gl,stc])

if test "$have_wxconfig" != 1; then
  AC_MSG_FAILURE([
wxWidgets detection failed, please set --with-wx* or add
the libraries to your LDFLAGS, CXX/CFLAGS.
  ])
fi

PKG_CHECK_MODULES(LIBAGG, libagg >= 2.5.0, [with_libagg=yes], [with_libagg=no])

if test "$with_libagg" != "yes"; then
  AC_MSG_FAILURE([You must have AGG installed: http://vector-agg.sourceforge.net/])
fi

AC_OUTPUT([
Makefile
libpropgrid/Makefile
src/wxAGG/Makefile
src/xpm/Makefile
src/Makefile
])
