dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(gdmodule.c)
AC_PATH_PROG(PYTHON, python)

changequote(<<, >>)dnl
PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
changequote([, ])dnl

dnl AC_PREFIX_DEFAULT(/usr/lib/python1.5)

dnl Checks for programs.
AC_PROG_CC

dnl Checks for libraries.

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h)

dnl Check for the Python include dir. Use AC_PREFIX_DEFAULT....

AC_MSG_CHECKING(for headers required to compile python extensions)
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
PYTHON_INCLUDE="${py_prefix}/include/python${PYTHON_VERSION}"
PYTHON_LIB="${py_prefix}/lib/python${PYTHON_VERSION}/lib-dynload/"
PYTHON_PREFIX="${py_prefix}/lib/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDE="$PYTHON_INCLUDE -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi
AC_SUBST(PYTHON_INCLUDE)
AC_SUBST(PYTHON_LIB)
AC_SUBST(PYTHON_PREFIX)
dnl check if the headers exist:
if test -f "${py_exec_prefix}/include/python${PYTHON_VERSION}/Python.h"
then
  AC_MSG_RESULT(ok)
else
  AC_MSG_ERROR([not found])
fi

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.

dnl Check for files

AC_OUTPUT(Makefile)
