view configure.ac @ 732:8312acdb7b15

Bump autotools version requirement.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 05 Nov 2012 12:06:05 +0200
parents 337b3c17b4db
children ee48a7323280
line wrap: on
line source

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

dnl Require autoconf 2.60 or later
AC_PREREQ([2.60])

dnl Initialize
AC_INIT([XMMS-SID], [0.8.0beta20], [ccr@tnsp.org])
AC_COPYRIGHT([[(C) 2003-2011 Matti 'ccr' Hamalainen]])
AC_CONFIG_SRCDIR([src/xmms-sid.h])
AM_INIT_AUTOMAKE
AC_CONFIG_HEADERS([src/config.h])
AM_GNU_GETTEXT_VERSION([0.14])
AM_GNU_GETTEXT([external])


dnl ***
dnl *** Define some templates
dnl ***
AH_TEMPLATE([HAVE_SONG_POSITION], [Define if you have XMMS patched with the songpos patch.])
AH_TEMPLATE([HAVE_XMMSEXTRA], [Define if you have XMMS version 1.2.5 or later and you want XMMS-SID to support some extra features.])
AH_TEMPLATE([HAVE_SIDPLAY1], [Define if you have and want to use libSIDPlay 1])
AH_TEMPLATE([HAVE_SIDPLAY2], [Define if you have and want to use libSIDPlay 2])
AH_TEMPLATE([HAVE_SIDPLAY2_COMI], [Define if you have libSIDPlay2 v2.2.x or later (or CVS version) with the new COMI API])
AH_TEMPLATE([HAVE_SIDPLAY2_DISTORTION], [Define if you have libSIDPlay2 + reSID with Antti Lankila's distortion patches (v10 and possibly later) http://bel.fi/~alankila/c64-sw/])
AH_TEMPLATE([HAVE_THEMETUNE], [Define if you want to build code to play XMMS-SID theme SID-tune. The tune needs to be installed too, though.])


dnl ***
dnl *** Some general checks
dnl ***
AC_PREFIX_PROGRAM([xmms])
AC_DISABLE_STATIC
AC_LIB_RPATH
AM_PROG_LIBTOOL
AC_SYS_LARGEFILE


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


dnl ***
dnl *** Checks for generic libraries
dnl ***
AC_CHECK_HEADER([pthread.h],,AC_MSG_ERROR([[*** POSIX thread support not found. Strange, maybe you don't have some development packages installed?]]))
AM_PATH_GLIB([1.2.5],,AC_MSG_ERROR([[*** GLib >= 1.2.5 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.5],,AC_MSG_ERROR([[*** Gtk+ >= 1.2.5 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 *** Checks for header files, types and functions
dnl ***
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h])

AC_TYPE_SIZE_T
AC_C_CONST
AC_C_INLINE
AC_CHECK_FUNCS([memset],[],[[*** memset function not found. Your libc has failed you.]])


dnl ***
dnl *** Enable or disable themetune support/installation
dnl ***
AC_ARG_ENABLE([themetune],
[AS_HELP_STRING([--disable-themetune],
[Disable XMMS-SID theme song-related code and installation of the SID-tune file. The tune is not under GNU GPL, refer to README for license.])
], [
if test "x$enableval" = "xyes"; then
	xs_have_themetune=yes
else
	if test "x$enableval" = "xno"; then
		xs_have_themetune=no
	else
		xs_have_themetune=no
	fi
fi
], [xs_have_themetune=yes])
if test "x$xs_have_themetune" = "xyes"; then
	AC_DEFINE([HAVE_THEMETUNE])
fi


dnl ***
dnl *** libSIDPlay1/2 options
dnl ***
XS_ARG_WITH([sidplay1], [libSIDPlay1], [XS_PATH_LIBSIDPLAY1])
if test "x$xs_have_sidplay1" = "xyes"; then
	AC_DEFINE([HAVE_SIDPLAY1])
fi

XS_ARG_WITH([sidplay2], [libSIDPlay2], [XS_PATH_LIBSIDPLAY2])
xs_have_sidplay2_api=""
xs_have_distortion="no"
if test "x$xs_have_sidplay2" = "xyes"; then
	AC_DEFINE([HAVE_SIDPLAY2])
	AC_LANG_PUSH([C++])
	
	XS_BUILDERS_CHECK
        xs_builders_available="no"
	XS_BUILDERS_FIND([reSID], [resid-builder], [resid.h], [ReSIDBuilder])
	XS_BUILDERS_FIND([HardSID], [hardsid-builder], [hardsid.h], [HardSID])
	if test "x$xs_builders_available" = "xno"; then
		AC_MSG_ERROR([No builder modules were found in the sidbuilders directory!]);
	fi
	
	dnl *** Check for new COMI API
	AC_MSG_CHECKING([libSIDPlay2 API style])
	tmp_CPPFLAGS="$CPPFLAGS"
	if test -d "$xs_sidplay2_includes"; then
		CPPFLAGS="$CPPFLAGS -I${xs_sidplay2_includes}"
	fi
	AC_EGREP_HEADER([::Iid], [sidplay/sidplay2.h],
		[xs_have_sidplay2_api="yes"],
		[
		AC_EGREP_HEADER([SIDIID], [sidplay/sidplay2.h],
			[xs_have_sidplay2_api="yes"],
			[xs_have_sidplay2_api="(old style API)"])
		]
	)
	if test "x$xs_have_sidplay2_api" = "xyes"; then
	AC_LINK_IFELSE([
		AC_LANG_PROGRAM(
		[#include <sidplay/sidunknown.h>],
		[ISidUnknown *i;])
	], [
		xs_have_sidplay2_api="(new COMI style API)"
		AC_DEFINE([HAVE_SIDPLAY2_COMI], [1], [Define if using new libSIDPlay2 with COM-style API.])
	],[
		xs_have_sidplay2_api="(broken version!)"
	])
	fi
	AC_MSG_RESULT([$xs_have_sidplay2_api])
	
	AC_LANG_POP([C++])
	
	dnl *** Check for distortion patch
	AC_MSG_CHECKING([libSIDPlay2+reSID distortion patch])
	AC_EGREP_HEADER([minimumfetresistance], [sidplay/sidtypes.h], [
		xs_have_distortion="yes"
		AC_DEFINE([HAVE_SIDPLAY2_DISTORTION])
	],[
		xs_have_distortion="no"
	])
	AC_MSG_RESULT([$xs_have_distortion])
	CPPFLAGS="$tmp_CPPFLAGS"
fi


dnl ***
dnl *** Check if we have some emulator library available?
dnl ***
if test "x$xs_have_sidplay1" = "xno" && test "x$xs_have_sidplay2" = "xno"; then
	AC_MSG_ERROR([Either libSIDPlay1 or libSIDPlay2 is required! Please read INSTALL for more information!])
fi


dnl ***
dnl *** Song position patch check
dnl ***
AC_MSG_CHECKING([for song position patch])
tmp_CPPFLAGS="$CPPFLAGS"
if test -d "$prefix"; then
	CPPFLAGS="$CPPFLAGS -I${prefix}/include"
fi

AC_EGREP_HEADER([set_song_position], [xmms/plugin.h], [
	xs_have_songpos="yes"
	AC_DEFINE([HAVE_SONG_POSITION])
],[
	xs_have_songpos="no"
])
AC_MSG_RESULT([$xs_have_songpos])
CPPFLAGS="$tmp_CPPFLAGS"


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])
	xs_have_xmmsextra="yes"
], [
	xs_have_xmmsextra="no"
])


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


dnl ***
dnl *** Show the result message
dnl ***
AC_MSG_RESULT([
	$PACKAGE_STRING has been configured successfully:

	Installation directory        : $libdir
	XMMS >= v1.2.5 extra features : $xs_have_xmmsextra
	Song-position patch           : $xs_have_songpos
	libSIDPlay 1 support          : $xs_have_sidplay1
	libSIDPlay 2 support          : $xs_have_sidplay2 $xs_have_sidplay2_api
	    With distortion patch?    : $xs_have_distortion
	    Included builders         : $xs_builders
	XMMS-SID theme SID-tune       : $xs_have_themetune
	Translations (i18n/nls)       : $USE_NLS
])

if test "x$xs_have_distortion" = "xyes"; then
	echo "***"
	echo "*** WARNING! A version of libSIDPlay2 with Antti Lankila's distortion"
	echo "*** patches has been detected. Due to the fast-changing nature of this"
	echo "*** particular patch-set, it is possible that this version of XMMS-SID"
	echo "*** may be incompatible."
	echo "***"
	echo "*** If you encounter any compilation problems, try a non-patched"
	echo "*** version of libSIDPlay2+reSID."
	echo "***"
fi