AC_INIT(gtklife,5.3)
AC_PROG_CC
AC_PROG_INSTALL
AC_HEADER_STDC

docdir='${prefix}/doc/gtklife'
AC_ARG_WITH(docdir,
    [AS_HELP_STRING(--with-docdir=DIR, Where to install the documentation (default ${prefix}/doc/gtklife))],
    [docdir=$withval])
AC_SUBST(docdir)

AC_ARG_WITH(gtk2,
    [AS_HELP_STRING(--with-gtk2, Compile with Gtk+ 2 instead of Gtk+ 1.2)],
    [gtk2=$withval],
    [gtk2=no])

if test "$gtk2" = yes; then
    AM_PATH_GTK_2_0(2.0.0,,gtk2=no)
    if test "$gtk2" = no; then
        echo "Gtk 2 not found, trying Gtk 1.2..."
        AM_PATH_GTK(1.2.0,,[AC_MSG_ERROR([Gtk+ is required])])
    fi
else
    AM_PATH_GTK(1.2.0,,gtk2=yes)
    if test "$gtk2" = yes; then
        echo "Gtk 1.2 not found, trying Gtk 2..."
        AM_PATH_GTK_2_0(2.0.0,,[AC_MSG_ERROR([Gtk+ is required])])
    fi
fi

AC_OUTPUT(Makefile)
