# Paleta - GNOME personal log program
# Copyright (C) 2001, 2002  Adrian Del Campo
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

# This script should work with both autoconf 2.13 and 2.50.

# Process this file with autoconf to produce a configure script.

AC_INIT([code/main.py])

PACKAGE=paleta
AC_SUBST(PACKAGE)

MAJOR_VERSION=0
MINOR_VERSION=0
PATCH_LEVEL=0
VERSION=0.0.0

AC_SUBST(MAJOR_VERSION)
AC_SUBST(MINOR_VERSION)
AC_SUBST(PATCH_LEVEL)
AC_SUBST(VERSION)

dnl Python stuff
AC_PATH_PROG(PYTHON, python)

if test -z $PYTHON
then
AC_MSG_ERROR([
*** You need to install python to complete the configure script.])
fi
AC_SUBST(PYTHON)

changequote(, )
PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
PYTHON_SITE_DIR=`$PYTHON -c "import sys; print sys.prefix"`/lib/python$PYTHON_VERSION/site-packages

AC_MSG_CHECKING("python version")
dnl sys.version_info was added in python 2.0, so we have to do this
dnl test first.
PYTHON_IS_REALLY_OLD=`$PYTHON -c "import sys; print sys.version[:5]< '2.1'"`
changequote([, ])

if test "x$PYTHON_IS_REALLY_OLD" = "x1"
then
AC_MSG_ERROR([
*** You have to install python 2.1 or newer.
])
fi

PYTHON_VERSION_OK=`$PYTHON -c "import sys; print sys.version_info >= (2, 1, 0, 'final')"`


if test "x$PYTHON_VERSION_OK" = "x0"
then
AC_MSG_ERROR([
*** You have to install python 2.1 or newer.
])
else
AC_MSG_RESULT($PYTHON_VERSION)
fi

AC_SUBST(PYTHON_VERSION)
AC_SUBST(PYTHON_PREFIX)
AC_SUBST(PYTHON_SITE_DIR)

AC_PROG_INSTALL
AC_PROG_MAKE_SET

dnl Check for programs

AC_CHECK_PROG(HAVE_GNOME_CONFIG, gnome-config, yes, no)

dnl Check if python bindings for gtk are installed

AC_CHECK_PROG(have_pygtk, gtk.py, yes, no, $PYTHON_SITE_DIR)

if test "x$have_pygtk" != xyes
then
   AC_MSG_ERROR([
**** The python interpreter can't find the python bindings for gtk.])
fi

AC_CHECK_PROG(have_pygnome, gnome/__init__.py, yes, no, $PYTHON_SITE_DIR)
  if test xyes != x$have_pygnome
  then
     AC_MSG_ERROR([
**** The python interpreter can't find the python bindings for GNOME.])
  fi

  if test x"$sysconfdir" = x"\${prefix}/etc"; then
          if test x"$HAVE_GNOME_CONFIG" = xYES; then
                  sysconfdir=`gnome-config --sysconfdir`
          fi
  fi

if test x"$sysconfdir" = x"\${prefix}/etc"; then
        sysconfdir='/etc'
fi

dnl Checks for libraries.

dnl Checks for header files.

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

#AC_CONFIG_FILES
AC_OUTPUT([\
	 bindir-paleta.py \
         Makefile.inc Makefile ])
#AC_OUTPUT
