dnl ***
dnl *** Process this file with autoconf to produce a configure script.
dnl ***

dnl Require autoconf 2.54 or later
AC_PREREQ(2.54)

dnl Initialize
AC_INIT(xmms-sid, 0.8.0rc1, ccr@tnsp.org)
AC_COPYRIGHT([[(C) 2002 Michael Schwendt, Matti 'ccr' H�m�l�inen]])
AC_CONFIG_SRCDIR(src/xmms-sid.h)
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS(config.h)


dnl ***
dnl *** Some general checks
dnl ***
AC_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL


dnl ***
dnl *** Checks for programs
dnl ***
AC_PROG_CC
AC_PROG_CXX
dnl AC_PROG_CPP
AC_PROG_INSTALL
AC_HEADER_STDC


dnl ***
dnl *** Checks for libraries
dnl ***
AC_PATH_LIBSIDPLAY
dnl AC_PATH_LIBSIDPLAY2

AM_PATH_GLIB(1.2.8,,AC_MSG_ERROR([*** GLIB >= 1.2.8 not found. You either don't have GLIB at all or your GLIB is too old. Latest GLIB can be found from Gtk+ homepages (http://www.gtk.org/)]))

AM_PATH_GTK(1.2.8,,AC_MSG_ERROR([*** Gtk+ >= 1.2.8 not found. You either don't have Gtk+ at all or your Gtk+ is too old. Latest Gtk+ can be found from Gtk+ homepages (http://www.gtk.org/)]), gthread)


dnl ***
dnl *** Check XMMS version
dnl ***
AM_PATH_XMMS(1.2.0,, [
AC_MSG_ERROR([*** XMMS >= 1.2.0 not found. You need XMMS v1.2.0 or later to use XMMS-SID plugin.])
])
libdir=$XMMS_INPUT_PLUGIN_DIR

XMMS_TEST_VERSION($XMMS_VERSION, 1.2.5, [
AC_DEFINE(HAVE_XMMSEXTRA)
OPT_XMMSEXTRA="yes"
], [
OPT_XMMSEXTRA="no"
])


dnl ***
dnl *** Check for optional settings
dnl ***
OPT_SUBSONGSEL="yes"

AC_ARG_ENABLE(subsongsel,
[
XMMS-SID specific options:
  --disable-subsongsel		Disable SIDAmp-style sub-song selector],
[
OPT_SUBSONGSEL="yes"
], [
OPT_SUBSONGSEL="no"
])

if test $OPT_SUBSONGSEL = "yes"; then
AC_DEFINE(USE_SUBSONGSEL)
fi


dnl ***
dnl *** Define some templates
dnl ***
AC_DEFINE(USE_SUBSONGSEL, 0, Define to 1 if user wants to use SIDAmp-style sub-song selector)
AC_DEFINE(HAVE_XMMSEXTRA, 0, Define to 1 if you have XMMS version 1.2.5 or later)


dnl ***
dnl *** And finally, output the all generatable files!
dnl ***
AC_CONFIG_FILES([
Makefile
src/Makefile
xmms-sid.spec
])

AC_OUTPUT


dnl ***
dnl *** Show the result message
dnl ***
AC_MSG_RESULT([
	XMMS-SID has been configured successfully:

	Installation directory        : $libdir
	Sub-song selector enabled     : $OPT_SUBSONGSEL
	XMMS >= v1.2.5 extra features : $OPT_XMMSEXTRA
	libSIDPlay 1                  : $have_sidplay
	libSIDPlay 2                  : $have_sidplay2

	Now just run 'make && make install'!
])
