-*- mode: m4 -*-
AC_PREREQ(2.52)

dnl the pygtk version number
m4_define(pygtk_major_version, 0)
m4_define(pygtk_minor_version, 6)
m4_define(pygtk_micro_version, 9)
m4_define(pygtk_version, pygtk_major_version.pygtk_minor_version.pygtk_micro_version)

dnl required versions of other packages
m4_define(gtk_required_version,    1.2.8)
m4_define(imlib_required_version,  1.8)
m4_define(pixbuf_required_version, 0.9.0)

AC_INIT(pygtk, pygtk_version,
	[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-python&component=pygtk])

AC_CONFIG_SRCDIR([gtkmodule.c])
AM_CONFIG_HEADER(config.h)

AC_DEFINE(PYGTK_MAJOR_VERSION, pygtk_major_version, [PyGtk major version])
AC_DEFINE(PYGTK_MINOR_VERSION, pygtk_minor_version, [PyGtk minor version])
AC_DEFINE(PYGTK_MICRO_VERSION, pygtk_micro_version, [PyGtk macro version])

AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)

AC_DISABLE_STATIC
AC_PROG_LIBTOOL

AM_PATH_PYTHON(1.5.2)
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])

AC_ARG_ENABLE(thread,
[  --disable-thread           Disable pygtk threading support],,
enable_thread=yes)
AM_CHECK_PYMOD(thread,,,enable_thread=no)
AC_MSG_CHECKING(whether to enable threading in pygtk)
if test "x$enable_thread" != xno; then
  extra_mods=gthread
  AC_DEFINE(ENABLE_PYGTK_THREADING)
  AC_MSG_RESULT(yes)
else
  extra_mods=
  AC_MSG_RESULT(no)
fi

AM_PATH_GTK(gtk_required_version,,,$extra_mods)
AM_PATH_GDK_IMLIB(imlib_required_version, build_imlib=true, build_imlib=false)
AM_CONDITIONAL(BUILD_IMLIB, $build_imlib)

AM_PATH_GDK_PIXBUF(pixbuf_required_version, build_pixbuf=true, build_pixbuf=false)
AM_CONDITIONAL(BUILD_PIXBUF, $build_pixbuf)

AM_PATH_GTKGL(build_gtkgl=true, build_gtkgl=false)
AM_CONDITIONAL(BUILD_GTKGL, $build_gtkgl)

AM_PATH_LIBGLADE(build_libglade=true, build_libglade=false)
AM_CONDITIONAL(BUILD_LIBGLADE, $build_libglade)


AC_ARG_ENABLE(numpy,
[  --disable-numpy            Disable numeric python features],,
enable_numpy=yes)

dnl checks to see if Numeric Python is installed.
if test "x$enable_numpy" != xno; then
  save_CPPFLAGS="$CPPFLAGS"
  CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
  AC_CHECK_HEADER(arrayobject.h,
    [AC_DEFINE(HAVE_NUMPY)
     AC_DEFINE(HAVE_ARRAYOBJECT_H)],
    [AC_CHECK_HEADER(Extensions/arrayobject.h,
      [AC_DEFINE(HAVE_NUMPY)
       AC_DEFINE(HAVE_EXTENSIONS_ARRAYOBJECT_H)],
      [AC_CHECK_HEADER(Numeric/arrayobject.h,
        [AC_DEFINE(HAVE_NUMPY)
         AC_DEFINE(HAVE_NUMERIC_ARRAYOBJECT_H)],[])])])
  CPPFLAGS="$save_CPPFLAGS"
fi

AC_CONFIG_FILES([Makefile
generate/Makefile
generate/pygtk-codegen-1.2
pyglade/Makefile
])
AC_OUTPUT


