###
### Welcome to Beagle's configure.in.  We hope you enjoy your stay.
###

AC_INIT(beagled/BeagleDaemon.cs)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(beagle, 0.2.8)

########################################################################

###
### Some dependencies
###

MONO_REQUIRED=1.1.13.5
GTK_SHARP_REQUIRED=2.3.90
GMIME_SHARP_REQUIRED=2.1.19
EVOLUTION_SHARP_REQUIRED=0.10.2
GSF_SHARP_REQUIRED=0.6
GTK_REQUIRED=2.6.0

AVAHI_SHARP_REQUIRED=0.6.10

LIBBEAGLE_GOBJECT_REQUIRED=2.6
LIBBEAGLE_LIBXML_REQUIRED=2.6.19

PYTHON_REQUIRED=2.3
PYGTK_REQUIRED=2.6

########################################################################

AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)

AC_PROG_INSTALL
AM_PROG_LIBTOOL
AC_PROG_CXX

VERSION=${VERSION}
AC_SUBST(VERSION)

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
	AC_MSG_ERROR([You need to install pkg-config])
fi

AC_PATH_PROG(BASH, bash)
AC_SUBST(BASH)

# mozilla extension uses zip to create the jar/xpi files
AC_PATH_PROG(ZIP, zip)

AC_PATH_PROG(MONO, mono)
AC_PATH_PROG(MCS, mcs)

AC_MSG_CHECKING([for mono.pc])
if test -z `$PKG_CONFIG --variable=prefix mono`; then
  AC_MSG_ERROR([missing the mono.pc file, usually found in the mono-devel package])
else
  AC_MSG_RESULT([found])
fi

# check that we have the require version of mono
PKG_CHECK_MODULES(MONO, mono >= $MONO_REQUIRED) 

# SharpZipLib broke API in 1.1.11.  Route around the damage.
if `$PKG_CONFIG --atleast-version=1.1.11 mono`; then
  SHARPZIPLIB_LIBS="-r:`$PKG_CONFIG --variable=prefix mono`/lib/mono/compat-1.0/ICSharpCode.SharpZipLib.dll"
else
  SHARPZIPLIB_LIBS="-r:ICSharpCode.SharpZipLib"
fi
AC_SUBST(SHARPZIPLIB_LIBS)

# check for various mono DLLs that we need.
needed_dlls="Mono.Data.SqliteClient Mono.Posix System.Runtime.Remoting System.Web System.Web.Services"
for i in $needed_dlls; do
  AC_MSG_CHECKING([for $i.dll])
  if test ! -e `$PKG_CONFIG --variable=prefix mono`/lib/mono/1.0/$i.dll; then
    AC_MSG_ERROR([missing required mono DLL: $i.dll])
  else
    AC_MSG_RESULT([found])
  fi
done

# check for OS
case "$target" in
  *-*-linux*)
    os=linux
	os_has_inotify=yes
    ;;
  *-*-freebsd*)
    os=freebsd
	os_has_inotify=no
    ;;
  *)
    AC_MSG_ERROR([Unrecognised target OS: $target])
    ;;
esac
AM_CONDITIONAL(OS_LINUX, test "x$os" = "xlinux")
AM_CONDITIONAL(OS_FREEBSD, test "x$os" = "xfreebsd")

# xdgmime really wants to have HAVE_MMAP defined
AC_FUNC_MMAP()

# check for desktop-launch

AC_PATH_PROG(DESKTOP_LAUNCH, desktop-launch, no)
AM_CONDITIONAL(ENABLE_DESKTOP_LAUNCH, test "x$DESKTOP_LAUNCH" != "xno")

# Google QueryDriver
# Disable GoogleDriver by default, enable if you want know what you are doing
dnl -----------------------------------------------
AC_ARG_ENABLE([googledriver],
	AC_HELP_STRING([--enable-googledriver], [Enable Google backend]),
	enable_googledriver=$enableval,
	enable_googledriver=no)

if test "x$enable_googledriver" = "xyes"; then
	# check for wsdl
	AC_PATH_PROG(WSDL, wsdl)
fi

AM_CONDITIONAL(ENABLE_GOOGLEDRIVER, test "x$enable_googledriver" = "xyes")

#
# I18N
#

AC_PROG_INTLTOOL([0.23])
GETTEXT_PACKAGE=beagle
AC_SUBST(GETTEXT_PACKAGE)
ALL_LINGUAS="bg ca cs da de el en_CA en_GB es fi fr gl he hi hu it ja ka ko lt lv mk nb nl pa pl pt_BR ru sv tr uk vi zh_CN zh_HK zh_TW"
AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Name of the package for translations])

# Many distros don't have a dependency on sqlite for their
# mono-data-sqlite packages, and the mono build process itself
# doesn't require it.  But we do, so check for it here.
SQLITE_MAJ_VER="0"
PKG_CHECK_MODULES(SQLITE, sqlite, SQLITE_MAJ_VER="2", do_nothing="1")
# Note we really need 3.3.1, but the pkgconfig file from upstream only
# reports 3.3 for all releases in the 3.3 line.
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.3, SQLITE_MAJ_VER="3", do_nothing="1")

if test "x$SQLITE_MAJ_VER" = "x0"; then
	# Note we really need 3.3.1, but the pkgconfig file from upstream only
	# reports 3.3 for all releases in the 3.3 line.  Make sure we error out
	# with the correct 3.3.1 version requirement, though.
	AC_MSG_ERROR([You need to install sqlite 2.x or >= 3.3.1])
fi

AC_SUBST(SQLITE_MAJ_VER)

AC_ARG_ENABLE([xss],
	      AC_HELP_STRING([--disable-xss], [Disable monitoring xscreensaver to speed up indexing when user is idle]),
	      enable_xss=$enableval,
	      enable_xss=yes)

AC_PATH_XTRA

# Needed by glue/screensaver-glue.c
# The OLD_CFLAGS/CFLAGS hack is needed to build on Ubuntu Breezy Badger 
OLD_CFLAGS="$CFLAGS"
OLD_LDFLAGS="$LDFLAGS"
OLD_LIBS="$LIBS"
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LIBS"
AC_CHECK_HEADER(X11/extensions/scrnsaver.h, enable_scrnsaver=yes, enable_scrnsaver=no)
AC_CHECK_LIB(Xss,XScreenSaverQueryExtension, enable_libxss=yes, enable_libxss=no)
have_xss=no
if test "x$enable_xss$enable_scrnsaver$enable_libxss" = "xyesyesyes"; then
	XSS_LIBS="-lXss"
	have_xss=yes
	AC_DEFINE(HAVE_LIBXSS,1,[Define to 1 if libXss is installed])
fi
AM_CONDITIONAL(ENABLE_LIBXSS, test "x$have_xss" = "xyes")
CFLAGS="$OLD_CFLAGS"
LDFLAGS="$OLD_LDFLAGS"
LIBS="$OLD_LIBS"

dnl ----------------------------------------------
AC_ARG_ENABLE([thunderbird],
	AC_HELP_STRING([--disable-thunderbird], [Disable Thunderbird Mail Backend]),
	enable_tbird=$enableval,
	enable_tbird=yes)
AM_CONDITIONAL(ENABLE_THUNDERBIRD, test "x$enable_tbird" = "xyes")

dnl -------------------------------------------------------

AC_ARG_ENABLE([gui],
	AC_HELP_STRING([--disable-gui], [Disable beagle-search]),
	enable_gui=$enableval,
	enable_gui=yes)

AM_CONDITIONAL(ENABLE_GUI, test "x$enable_gui" = "xyes")

if test "x$enable_gui" = "xyes"; then

	# We pinvoke into gnome-vfs directly from Util/GnomeFu.cs, and
	# we get the GNOME prefix from libgnome-2.0
	PKG_CHECK_MODULES(GNOME_VFS, gnome-vfs-2.0 libgnome-2.0)

	dnl -------------------------------------------------------
	dnl Various version requirements

	PKG_CHECK_MODULES(BEAGLE_UI,
[
	gtk-sharp-2.0 >= $GTK_SHARP_REQUIRED
	gconf-sharp-2.0 >= $GTK_SHARP_REQUIRED
	glade-sharp-2.0 >= $GTK_SHARP_REQUIRED
	gnome-sharp-2.0 >= $GTK_SHARP_REQUIRED
	gnome-vfs-sharp-2.0 >= $GTK_SHARP_REQUIRED
	gmime-sharp >= $GMIME_SHARP_REQUIRED
])
	AC_SUBST(BEAGLE_UI_LIBS)

	PKG_CHECK_MODULES(UIGLUE, gtk+-2.0 >= $GTK_REQUIRED librsvg-2.0)
	AC_SUBST(UIGLUE_CFLAGS)
	AC_SUBST(UIGLUE_LIBS)
	
	dnl Gdk and Atk are needed for trayicon glue
	
	GDK20_MINIMUM_VERSION=2.2.3
	ATK_MINIMUM_VERSION=1.2.4
	
	PKG_CHECK_MODULES(LIBTRAYICON,
[
	gdk-2.0 >= $GDK20_MINIMUM_VERSION 
	atk >= $ATK_MINIMUM_VERSION
])
	AC_SUBST(LIBTRAYICON_CFLAGS)
	AC_SUBST(LIBTRAYICON_LIBS)
	
fi

dnl ----------------------------------------------

dnl "Open With" Menu (Requires GTK 2.8)
	PKG_CHECK_MODULES(OPEN_WITH,
[
	gtk-sharp-2.0 >= 2.8
],OPEN_WITH=yes,OPEN_WITH=no)
AM_CONDITIONAL(ENABLE_OPEN_WITH, test "x$OPEN_WITH" != "xno")
dnl ----------------------------------------------

dnl evolution support

AC_ARG_ENABLE([evolution],
	AC_HELP_STRING([--disable-evolution], [Disable evolution support (default auto)]),
	enable_evo=$enableval,
	enable_evo_sharp=auto)


EVO_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix evolution-sharp`

EVO_LIBDIR=`$PKG_CONFIG --variable=evolibdir evolution-sharp`
AC_SUBST(EVO_LIBDIR)

PKG_CHECK_MODULES(EVO,
                  evolution-sharp >= $EVOLUTION_SHARP_REQUIRED 	\
                  gconf-sharp-2.0 >= $GTK_SHARP_REQUIRED	\
                  gmime-sharp >= $GMIME_SHARP_REQUIRED,
                  have_evo_dependencies=yes, have_evo_dependencies=no)
AC_SUBST(EVO_LIBS)

if test "x$have_evo_dependencies" = "xno"; then

	dnl error out if user has explicitly requested evolution support
	if test "x$enable_evo" = "xyes"; then
		AC_MSG_ERROR([Could not find Evolution dependencies])
	fi

	enable_evo="no (missing dependencies)"

else

	if test "x$enable_evo" != "xno"; then
		enable_evo="yes"
	else
		enable_evo="no (disabled)"
	fi

fi

AM_CONDITIONAL(ENABLE_EVOLUTION, test "x$enable_evo" = "xyes")

dnl ----------------------------------------------

dnl Should we use our own copy of the sqlite bindings or the version
dnl that got installed along with mono?

use_local_sqlite="yes" # hard-wired for now
AM_CONDITIONAL(USE_LOCAL_SQLITE, test "x$use_local_sqlite" = "xyes")

dnl ----------------------------------------------

dnl inotify

AC_ARG_ENABLE([inotify],
	 AC_HELP_STRING([--disable-inotify], [Disable inotify filesystem monitoring support (default auto)]),
	 enable_inotify=$enableval,
	 enable_inotify=auto)

if test "x$os_has_inotify" = "xno"; then

	dnl error out if user has explicitly requested inotify
	if test "x$enable_inotify" = "xyes"; then
		AC_MSG_ERROR([inotify is unavailable on your system architecture])
	fi

	enable_inotify="no (unavailable)"

else

	if test "x$enable_inotify" != "xno"; then
		enable_inotify="yes"
	else
		enable_inotify="no (disabled)"
	fi

fi

AM_CONDITIONAL(ENABLE_INOTIFY, test "x$enable_inotify" = "xyes")

dnl ----------------------------------------------

dnl beagled

PKG_CHECK_MODULES(GSF_SHARP, gsf-sharp >= 0.5, enable_gsf_sharp=yes, enable_gsf_sharp=no)
AM_CONDITIONAL(ENABLE_GSF_SHARP, test "x$enable_gsf_sharp" = "xyes")

dnl ----------------------------------------------

dnl libexif: Needed to index jpeg metadata

LIBEXIF_API_CHANGE=0.6.0
LIBEXIF_REQUIRED_MIN=0.5.7
LIBEXIF_REQUIRED_MAX=0.7.0

PKG_CHECK_MODULES(LIBEXIF, libexif >= $LIBEXIF_REQUIRED_MIN libexif < $LIBEXIF_REQUIRED_MAX)
PKG_CHECK_MODULES(LIBEXIF_API_CHECK, libexif >= $LIBEXIF_API_CHANGE, have_old_libexif=no, have_old_libexif=yes)

if test "x$have_old_libexif" = "xyes"; then
	EXIF_SOVERSION=9
else
	PKG_CHECK_MODULES(LIBEXIF_VERSION_CHECK, libexif >= 0.6.12, EXIF_SOVERSION=12, EXIF_SOVERSION=10)
fi
AC_SUBST(EXIF_SOVERSION)

PKG_CHECK_MODULES(BEAGLED,
[
	shared-mime-info
	gmime-sharp >= $GMIME_SHARP_REQUIRED
	glib-sharp-2.0 >= $GTK_SHARP_REQUIRED
])
	BEAGLED_LIBS="$BEAGLED_LIBS $GSF_SHARP_LIBS"
AC_SUBST(BEAGLED_LIBS)

GSF_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gsf-sharp`
GMIME_SHARP_PREFIX=`$PKG_CONFIG --variable=prefix gmime-sharp`

dnl ----------------------------------------------

dnl libbeagle

GTK_DOC_CHECK(1.0)

AC_ARG_ENABLE([libbeagle],
	AC_HELP_STRING([--disable-libbeagle], [Disable libbeagle (C API)]),
	enable_libbeagle=$enableval,
	enable_libbeagle=auto)

dnl library versioning
dnl Increase when changing the API
LIBBEAGLE_CURRENT=0

dnl Update when changing implementation of current API,
dnl reset to 0 when changing CURRENT.  This is the revision of
dnl current API version
LIBBEAGLE_REVISION=0

dnl Increase of API change is ABI compatible, otherwise reset to 0
LIBBEAGLE_AGE=0

LIBBEAGLE_VERSION_INFO="$LIBBEAGLE_CURRENT:$LIBBEAGLE_REVISION:$LIBBEAGLE_AGE"
AC_SUBST(LIBBEAGLE_VERSION_INFO)

PKG_CHECK_MODULES(LIBBEAGLE, [
	gobject-2.0 >= $LIBBEAGLE_GOBJECT_REQUIRED
	libxml-2.0  >= $LIBBEAGLE_LIBXML_REQUIRED
], have_libbeagle_deps=yes, have_libbeagle_deps=no)

AC_SUBST(LIBBEAGLE_CFLAGS)
AC_SUBST(LIBBEAGLE_LIBS)

if test "x$have_libbeagle_deps" = "xno"; then

	if test "x$enable_libbeagle" = "xyes"; then
		AC_MSG_ERROR([Missing libbeagle dependencies])
	fi

	enable_libbeagle="no (missing dependencies)"
else
	if test "x$enable_libbeagle" != "xno"; then
		enable_libbeagle="yes"
	else
		enable_libbeagle="no (disabled)"
	fi
fi

AM_CONDITIONAL(ENABLE_LIBBEAGLE, test "x$enable_libbeagle" = "xyes")

dnl ----------------------------------------------
AC_ARG_ENABLE([bludgeon],
	AC_HELP_STRING([--disable-bludgeon], [Disable bludgeon testing tool]),
	enable_bludgeon=$enableval,
	enable_bludgeon=yes)
AM_CONDITIONAL(ENABLE_BLUDGEON, test "x$enable_bludgeon" = "xyes")

	
dnl ----------------------------------------------
dnl Epiphany Extension
dnl Much of this is cut&pasted from epiphany-extensions/configure.ac

AC_ARG_ENABLE([epiphany-extension],
	AC_HELP_STRING([--enable-epiphany-extension], [Enable Epiphany Extension (default auto)]),
	enable_epiphany_extension=$enableval,
	enable_epiphany_extension=auto)

if $PKG_CONFIG --exists epiphany-2.14; then
        EPIPHANY_MAJOR=2.14
        EPIPHANY_REQUIRED=2.14.0
elif $PKG_CONFIG --exists epiphany-1.8; then
	EPIPHANY_MAJOR=1.8
	EPIPHANY_REQUIRED=1.7.0
elif $PKG_CONFIG --exists epiphany-1.6; then
	EPIPHANY_MAJOR=1.6
	EPIPHANY_REQUIRED=1.6.0
else
	enable_epiphany_extension="no (Epiphany not installed)"
fi

if test "x$enable_epiphany_extension" = "xyes"; then

LIBXML_REQUIRED=2.6.0
LIBGLIB_REQUIRED=2.4.0
LIBGTK_REQUIRED=2.4.0

AC_SUBST(EPIPHANY_REQUIRED)
AC_SUBST(LIBXML_REQUIRED)
AC_SUBST(LIBGLIB_REQUIRED)
AC_SUBST(LIBGTK_REQUIRED)

PKG_CHECK_MODULES(EPIPHANY_DEPENDENCY, 
		  libxml-2.0 >= $LIBXML_REQUIRED \
		  libglade-2.0 \
		  glib-2.0 >= $LIBGLIB_REQUIRED \
		  gmodule-2.0 \
		  gtk+-2.0 >= $LIBGTK_REQUIRED \
		  epiphany-$EPIPHANY_MAJOR >= $EPIPHANY_REQUIRED,
		  have_epiphany_dependencies=yes,
		  have_epiphany_dependencies=no)
AC_SUBST(EPIPHANY_DEPENDENCY_CFLAGS)
AC_SUBST(EPIPHANY_DEPENDENCY_LIBS)

EPIPHANY_EXTENSIONS_DIR="`$PKG_CONFIG --variable=extensionsdir epiphany-$EPIPHANY_MAJOR`"
AC_SUBST([EPIPHANY_EXTENSIONS_DIR])
EPIPHANY_PREFIX="`$PKG_CONFIG --variable=prefix epiphany-$EPIPHANY_MAJOR`"
AC_SUBST(EPIPHANY_PREFIX)

if test "x$have_epiphany_dependencies" = "xno"; then
	enable_epiphany_extension="no (missing dependencies)"
elif test "x$enable_epiphany_extension" != "xyes"; then
	enable_epiphany_extension="disabled"
fi

fi

AM_CONDITIONAL(ENABLE_EPIPHANY_EXTENSION, test "x$enable_epiphany_extension" = "xyes")

AC_ARG_ENABLE([epiphany-extension-install],
	AS_HELP_STRING([--enable-epiphany-extension-install],[Install Epiphany Extension]),
	[install_epiphany_extension=$enableval],
	[install_epiphany_extension=yes])

AM_CONDITIONAL([INSTALL_EPIPHANY_EXTENSION], [test "x$install_epiphany_extension" = "xyes"])

dnl ----------------------------------------------

dnl Galago

PKG_CHECK_MODULES(GALAGO, galago-sharp <= 0.3.4 , enable_galago=yes, enable_galago=no)
AM_CONDITIONAL(ENABLE_GALAGO, test "x$enable_galago" = "xyes")
AC_SUBST(GALAGO_LIBS)


dnl ----------------------------------------------

GTK_BINARY_VERSION=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
AC_SUBST(GTK_BINARY_VERSION)

dnl For the systeminfo glue

SYSTEMINFO_GLUE_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 $XSS_LIBS $X_EXTRA_LIBS"
AC_SUBST(SYSTEMINFO_GLUE_X_LIBS)

dnl ----------------------------------------------

dnl For the wv1 glue

PKG_CHECK_MODULES(WV1, wv-1.0, enable_wv1=yes, enable_wv1=no)
AM_CONDITIONAL(ENABLE_WV1, test "x$enable_wv1" = "xyes")
AC_SUBST(WV1_LIBS)

dnl ----------------------------------------------

dnl KDE launcher/icon support

kde_prefix_print="unknown; will guess at runtime"
AC_PATH_PROG(KDE_CONFIG, [kde-config], [no])
if test ! "x$KDE_CONFIG" = "xno"; then
	KDE_PREFIX=`$KDE_CONFIG --prefix`
	kde_prefix_print="$KDE_PREFIX"
fi
AC_SUBST(KDE_PREFIX)

dnl ----------------------------------------------

dnl Zeroconf support

AC_ARG_ENABLE([networking],
        AC_HELP_STRING([--enable-networking], [Enable Networking (default disabled)]),
        enable_networking=$enableval,
        enable_networking=no)

AM_CONDITIONAL(ENABLE_NETWORKING, test "x$enable_networking" = "xyes")

if test "x$enable_networking" = "xyes"; then
	dnl -------------------------------------------------------
	dnl Avahi version requirements
        PKG_CHECK_MODULES(AVAHI_SHARP, avahi-sharp >= $AVAHI_SHARP_REQUIRED)
        AC_SUBST(AVAHI_SHARP_LIBS)
fi


dnl ----------------------------------------------

dnl Beagle webservices

dnl AC_ARG_ENABLE([webservices],
dnl        AC_HELP_STRING([--enable-webservices], [Enable WebServices (default disabled)]),
dnl        enable_webservices=$enableval,
dnl        enable_webservices=no)

enable_webservices=no
AM_CONDITIONAL(ENABLE_WEBSERVICES, test "x$enable_webservices" = "xyes")

dnl ----------------------------------------------

dnl Prefixes for helper scripts
GAC_PREFIX="$EVO_SHARP_PREFIX:$GSF_SHARP_PREFIX:$GMIME_SHARP_PREFIX"
dnl Remove duplicate prefixes
GAC_PREFIX="`echo $GAC_PREFIX | sed -e 's|:|\n|g' | sort | uniq | tr '\n' ':'`"
dnl Remove stray :s
GAC_PREFIX="`echo $GAC_PREFIX | sed -e 's|::\+|:|g' -e 's|^:\+||' -e 's|:\+$||'`"
AC_SUBST(GAC_PREFIX)

GNOME_PREFIX="`$PKG_CONFIG --variable=prefix libgnome-2.0`"
AC_SUBST(GNOME_PREFIX)

dnl ----------------------------------------------

dnl Check if the system has libchm, used by the CHMFilter

# Check for libchm for CHM filter
AC_CHECK_LIB(chm,chm_open,has_libchm=yes,has_libchm=no)
AM_CONDITIONAL(HAS_LIBCHM, test "x$has_libchm" = "xyes")

dnl ----------------------------------------------

dnl Conditional for debugging XML messages.

BEAGLE_DEFINES=""

AC_ARG_ENABLE([xml-dump],
	AC_HELP_STRING([--enable-xml-dump], [Enables printing of the XML messages sent between components (default no)]),
	enable_xml_dump=$enableval,
	enable_xml_dump=no)

if test "x$enable_xml_dump" = "xyes"; then
	AC_DEFINE_UNQUOTED(ENABLE_XML_DUMP, 1, [Dump XML messages for debugging])
	BEAGLE_DEFINES="-define:ENABLE_XML_DUMP"
fi

AC_SUBST(BEAGLE_DEFINES)

dnl ----------------------------------------------

dnl Python 2.3

AC_ARG_ENABLE(python,
	AC_HELP_STRING([--disable-python], [Disable python support (default auto)]),
	enable_python=$enableval,
	enable_python=auto)

have_python=no
if test "x$enable_libbeagle" = "xyes" -a "x$enable_python" != "xno"; then
	have_python_version=no
	have_python_headers=no
	have_pygtk_deps=no
	have_pygtk_codegen=no

	AM_PATH_PYTHON()

	if test -z "$PYTHON"; then
		AC_MSG_WARN([Python not found])
	else
		AM_PYTHON_CHECK_VERSION($PYTHON, $PYTHON_REQUIRED,
			have_python_version=yes,
			have_python_version=no)
	fi

	if test "x$have_python_version" != "xyes"; then
		AC_MSG_WARN([Python version $PYTHON_REQUIRED not found])
	else
		AM_CHECK_PYTHON_HEADERS(have_python_headers=yes, have_python_headers=no)
	fi

	if test "x$have_python_headers" != "xyes"; then
		AC_MSG_WARN([could not find Python headers])
	else
		PKG_CHECK_MODULES(PYBEAGLE,
			pygtk-2.0 >= $PYGTK_REQUIRED
			pygobject-2.0 >= $PYGTK_REQUIRED,
			have_pygtk_deps=yes,
			have_pygtk_deps=no)
	fi

	if test "x$have_pygtk_deps" != "xyes"; then
		AC_MSG_WARN([could not find pygtk])
	else
		AC_PATH_PROG(PYGTK_CODEGEN, pygtk-codegen-2.0, no)
	fi

	if test -z "$PYGTK_CODEGEN"; then
		AC_MSG_WARN([could not find pygtk-codegen in path])
	else
		AC_MSG_CHECKING(for pygtk defs)
		PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygtk-2.0`
		AC_MSG_RESULT($PYGTK_DEFSDIR)

		have_python=yes
	fi
fi

if test "x$enable_python" = "xyes"; then
	if test "x$enable_libbeagle" != "xyes"; then
		AC_MSG_ERROR([Python bindings are requested, but libbeagle isn't to be built])
	elif test "x$have_python" = "xno"; then
		AC_MSG_ERROR([Python bindings are requested, but cannot be built])
	fi
fi

AM_CONDITIONAL(ENABLE_PYTHON, test "x$have_python" = "xyes")
AC_SUBST(PYBEAGLE_LIBS)
AC_SUBST(PYBEAGLE_CFLAGS)
AC_SUBST(PYGTK_DEFSDIR)

dnl ----------------------------------------------

AC_OUTPUT([
Makefile
Util/Makefile
Util/Util.dll.config
images/Makefile
glue/Makefile
BeagleClient/Makefile
beagled/Makefile
Filters/Makefile
tools/Makefile
search/Makefile
ImLogViewer/Makefile
ContactViewer/Makefile
libbeagle/Makefile
libbeagle/libbeagle-0.0.pc
libbeagle/beagle/Makefile
libbeagle/examples/Makefile
libbeagle/docs/Makefile
libbeagle/docs/reference/Makefile
epiphany-extension/Makefile
mozilla-extension/Makefile
bludgeon/Makefile
wrappers/Makefile
wrappers/python/Makefile
beagle-0.0.pc
beagle-daemon.pc
beagle-ui-0.0.pc
beagle.spec
po/Makefile.in
])

echo "
	Beagle Version:           ${VERSION}
	Target OS:		  ${os}
	inotify?		  ${enable_inotify}

	Prefix:			  ${prefix}
	GNOME Prefix:             ${GNOME_PREFIX}
	KDE Prefix:		  ${kde_prefix_print}

	Evolution support?	  ${enable_evo}
	gsf-sharp?		  ${enable_gsf_sharp}
	wv1?			  ${enable_wv1}
	galago-sharp?		  ${enable_galago}
	libchm?			  ${has_libchm} 
	google backend?		  ${enable_googledriver} (Unsupported)
	Thunderbird backend? 	  ${enable_tbird}

	Mozilla Extension?	  yes
	Epiphany Extension?	  ${enable_epiphany_extension}

	Local SqliteClient?	  ${use_local_sqlite}
	Sqlite version:		  ${SQLITE_MAJ_VER}.x

	Enable WebServices	  no (WebServices are deprecated)
        Enable Networking         ${enable_networking}
	Enable libbeagle	  ${enable_libbeagle}
	Enable python bindings	  ${have_python}
	Monitor screensaver       ${have_xss}

	Enable beagle-search GUI  ${enable_gui}
	Enable \"Open With\" menu   ${OPEN_WITH}
"
echo

if test "x$enable_epiphany_extension" = "xyes"; then
   echo "NOTE: The Beagle Epiphany Extension Is Totally Insecure!"
   echo "      Use it at your own risk!"
   echo
fi
