dnl Process this file with autoconf to produce a configure script.
AC_INIT(globals.c)
AC_CONFIG_HEADER(config.h)


GTK_EXTRA_LIBS="`gtk-config --libs` -lgdk_imlib -lutil"

VERSION=`gtk-config --version`
MAJOR=`echo $VERSION | cut -f 1 -d . -`
MINOR=`echo $VERSION | cut -f 2 -d . -`
MICRO=`echo $VERSION | cut -f 3 -d . -`

GNOMEVERSION=`gnome-config --version`
GVERSION=`echo $GNOMEVERSION | cut -f 2 -d " " -`
GNOMEMAJOR=`echo $GVERSION | cut -f 1 -d . -`
GNOMEMINOR=`echo $GVERSION | cut -f 2 -d . -`
GNOMEMICRO=`echo $GVERSION | cut -f 3 -d . -`

dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL


dnl Checks for libraries.

dnl check for gtk 1.2 or greater
dnl quick crappy check, but I don't feel like converting
dnl to automake to use the real one (automake confuses me :-)

AC_MSG_CHECKING(for GTK+ 1.2 or greater)
if let $(($MINOR < 2)); then
	AC_MSG_RESULT(no) 
	AC_MSG_ERROR([GTK 1.2 or greater required!]);
fi
AC_MSG_RESULT(yes)

dnl check for gnome 1.0.8 or greater

AC_MSG_CHECKING(for Gnome 1.0.8 or greater)
if let $(($GNOMEMAJOR < 1)); then
	AC_MSG_ERROR([Gnome 1.0.8 or greater required!])
fi

if let $(($GNOMEMINOR < 1)); then
	if let $((GNOMEMICRO < 8)); then
		AC_MSG_ERROR([Gnome 1.0.8 or greater required!])
	fi
fi

AC_MSG_RESULT(yes)
AC_CHECK_LIB(gdk_imlib, gdk_imlib_init,
  ,
  AC_MSG_ERROR([libgdk_imlib required!]),
  $GTK_EXTRA_LIBS)

AC_CHECK_LIB(util, login_tty,
  ,
  AC_MSG_ERROR([login_tty not found in libutil!]),
  $GTK_EXTRA_LIBS)

dnl AC_CHECK_LIB(zvt, zvt_term_match_add,
dnl   AC_CHECK_LIB(zvt, zvt_term_match_check, AC_DEFINE(ZVT_USE_MATCHING),
dnl	AC_MSG_WARN([URL handling will not be supported ************]),
dnl	$GTK_EXTRA_LIBS),
dnl   AC_MSG_WARN([URL handling will not be supported ************]),
dnl $GTK_EXTRA_LIBS)

AC_MSG_WARN([

		URL handling disabled due to library problems.  If you want
	       	to try it anyway (you may not have problems with it), edit
		config.h and add the line

		#define ZVT_USE_MATCHING 1
		
		To enable it.
		])


dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.

dnl Checks for library functions.
AC_CHECK_FUNCS(strstr)
AC_MSG_CHECKING(for Illuminati)
AC_MSG_RESULT(no.  Good.)	

AC_OUTPUT(Makefile, echo timestamp > stamp-h)

