changeset 31:ca6dab6c4ead

Re-wrote configuration scripts and libsidplay 1/2 detection.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 08 Jun 2003 03:03:01 +0000
parents fde5167bb736
children 13db37492b6d
files INSTALL acinclude.m4 configure.in
diffstat 3 files changed, 304 insertions(+), 273 deletions(-) [+]
line wrap: on
line diff
--- a/INSTALL	Sat Jun 07 23:54:00 2003 +0000
+++ b/INSTALL	Sun Jun 08 03:03:01 2003 +0000
@@ -42,10 +42,9 @@
 
 http://sidplay2.sourceforge.net/
 
-You need the following packages:
- - sidplay-libs-2.1.x  (earlier versions DON'T WORK)
- - resid
- - libsidutils-1.0.x
+You need the "sidplay-libs-2.1.x" package! Earlier versions
+WILL NOT WORK! Later versions MAY work, but it is not really
+guaranteed.
 
 
 Installing XMMS-SID
--- a/acinclude.m4	Sat Jun 07 23:54:00 2003 +0000
+++ b/acinclude.m4	Sun Jun 08 03:03:01 2003 +0000
@@ -1,5 +1,7 @@
 dnl *** These m4-macros are directly ripped from XSIDPlay's acinclude.m4
 dnl *** (C) Copyright 2002 Michael Schwendt, licensed under GNU GPL v2.
+dnl *** Updated for new automake/autoconf plus namespace and other
+dnl *** cosmetic changes by Matti 'ccr' Hämäläinen (C) 2003
 
 dnl -------------------------------------------------------------------------
 dnl Try to find a file (or one of more files in a list of dirs).
@@ -7,17 +9,15 @@
 
 AC_DEFUN(MY_FIND_FILE,
 [
-    $3=""
-    for i in $2;
-    do
-        for j in $1;
-        do
-	        if test -r "$i/$j"; then
-		        $3=$i
-                break 2
-            fi
-        done
-    done
+$3=""
+for i in $2; do
+for j in $1; do
+if test -r "$i/$j"; then
+	$3=$i
+	break 2
+	fi
+done
+done
 ])
 
 dnl -------------------------------------------------------------------------
@@ -47,104 +47,36 @@
 ])
 
 dnl -------------------------------------------------------------------------
-dnl Check whether compiler has a working ``bool'' type.
-dnl -------------------------------------------------------------------------
-
-AC_DEFUN(MY_CHECK_BOOL,
-[
-    AC_MSG_CHECKING([for bool])
-    AC_CACHE_VAL(my_cv_have_bool,
-    [
-        AC_TRY_COMPILE(
-            [],
-            [bool aBool = true;],
-            [my_cv_have_bool=yes],
-            [my_cv_have_bool=no]
-        )
-    ])
-    AC_MSG_RESULT($my_cv_have_bool)
-    if test "$my_cv_have_bool" = yes; then
-        AC_DEFINE(XSID_HAVE_BOOL)
-    fi 
-])
-
-dnl -------------------------------------------------------------------------
-dnl Check whether C++ library has openmode ios::bin instead of ios::binary.
-dnl Will define XSID_HAVE_IOS_BIN if ios::binary is not available.
-dnl -------------------------------------------------------------------------
-
-AC_DEFUN(MY_CHECK_IOS_BIN,
-[
-    AC_MSG_CHECKING(whether standard openmode ios::binary is available)
-    AC_CACHE_VAL(my_cv_have_ios_binary,
-    [
-        AC_TRY_COMPILE(
-            [#include <fstream.h>],
-		    [ifstream myTest("test",ios::in|ios::binary);],
-		    [my_cv_have_ios_binary=yes],
-		    [my_cv_have_ios_binary=no]
-	    )
-    ])
-    AC_MSG_RESULT($my_cv_have_ios_binary)
-    if test "$my_cv_have_ios_binary" = no; then
-        AC_DEFINE(XSID_HAVE_IOS_BIN)
-    fi
-])
-
-dnl -------------------------------------------------------------------------
-dnl Check whether C++ compiler supports the "nothrow allocator".
-dnl Will define XSID_HAVE_NOTHROW if test code compiles.
-dnl -------------------------------------------------------------------------
-
-AC_DEFUN(MY_CHECK_NOTHROW,
-[
-    AC_MSG_CHECKING(whether nothrow allocator is available)
-    AC_CACHE_VAL(my_cv_have_nothrow,
-    [
-        AC_TRY_COMPILE(
-            [#include <new>],
-		    [char* buf = new(std::nothrow) char[1024];],
-		    [my_cv_have_nothrow=yes],
-		    [my_cv_have_nothrow=no]
-	    )
-    ])
-    AC_MSG_RESULT($my_cv_have_nothrow)
-    if test "$my_cv_have_nothrow" = yes; then
-        AC_DEFINE(XSID_HAVE_NOTHROW)
-    fi
-])
-
-dnl -------------------------------------------------------------------------
 dnl Pass C++ compiler options to libtool which supports C only.
 dnl -------------------------------------------------------------------------
 
 AC_DEFUN(MY_PROG_LIBTOOL,
 [
-    my_save_cc="$CC"
-    my_save_cflags="$CFLAGS"
+    xs_save_cc="$CC"
+    xs_save_cflags="$CFLAGS"
     CC="$CXX"
     CFLAGS="$CXXFLAGS"
     AM_PROG_LIBTOOL
-    CC="$my_save_cc"
-    CFLAGS="$my_save_cflags"
+    CC="$xs_save_cc"
+    CFLAGS="$xs_save_cflags"
 ])
 
 dnl -------------------------------------------------------------------------
 
 AC_DEFUN(MY_TRY_LINK_SAVE,
 [
-    my_cxx_save="$CXX"
-    my_cxxflags_save="$CXXFLAGS"
-    my_ldflags_save="$LDFLAGS"
-    my_libs_save="$LIBS"
+    xs_cxx_save="$CXX"
+    xs_cxxflags_save="$CXXFLAGS"
+    xs_ldflags_save="$LDFLAGS"
+    xs_libs_save="$LIBS"
 ])
 
 AC_DEFUN(MY_TRY_LINK_RESTORE,
 [
-    CXX="$my_cxx_save"
-    CXXFLAGS="$my_cxxflags_save"
-    LDFLAGS="$my_ldflags_save"
-    LIBS="$my_libs_save"
+    CXX="$xs_cxx_save"
+    CXXFLAGS="$xs_cxxflags_save"
+    LDFLAGS="$xs_ldflags_save"
+    LIBS="$xs_libs_save"
 ])
 
 AC_DEFUN(MY_PROG_PKGCONFIG,
@@ -165,237 +97,238 @@
 
 dnl -------------------------------------------------------------------------
 dnl Try to find SIDPLAY library and header files.
-dnl $my_cv_have_sidplay will be "yes" or "no"
-dnl @SIDPLAY_LDADD@ will be substituted with linker parameters
-dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters
+dnl $xs_have_sidplay1 will be "yes" or "no"
+dnl @SIDPLAY1_LDADD@ will be substituted with linker parameters
+dnl @SIDPLAY1_INCLUDES@ will be substituted with compiler parameters
 dnl -------------------------------------------------------------------------
 
-AC_DEFUN(MY_PATH_LIBSIDPLAY,
+AC_DEFUN(XS_PATH_LIBSIDPLAY1,
 [
-    AC_MSG_CHECKING([for working SIDPLAY library and headers])
-    AC_REQUIRE([MY_ARGS_LIBSIDPLAY])
+    AC_MSG_CHECKING([for working SIDPlay1 library and headers])
+
+    AC_LANG_PUSH(C++)
     
     # Use include path given by user (if any).
-    if test -n "$my_sidplay_includes"; then
-        my_sidplay_cxxflags="-I$my_sidplay_includes"
+    if test -n "$xs_sidplay1_includes"; then
+        xs_sidplay1_cxxflags="-I$xs_sidplay1_includes"
     else
-        my_sidplay_cxxflags=""
+        xs_sidplay1_cxxflags=""
     fi
 
     # Use library path given by user (if any).
-    if test -n "$my_sidplay_library"; then
-        my_sidplay_ldflags="-L$my_sidplay_library"
+    if test -n "$xs_sidplay1_library"; then
+        xs_sidplay1_ldflags="-L$xs_sidplay1_library"
     else
-        my_sidplay_ldflags=""
+        xs_sidplay1_ldflags=""
     fi
 
-    AC_CACHE_VAL(my_cv_have_sidplay,
+    AC_CACHE_VAL(xs_cv_have_sidplay1,
     [
         # Run test compilation with either standard search path
         # or user-defined paths.
-        MY_TRY_LIBSIDPLAY
-        if test "$my_sidplay_works" = yes; then
-          my_cv_have_sidplay="my_have_sidplay=yes  \
-            my_sidplay_cxxflags=\"$my_sidplay_cxxflags\"  \
-            my_sidplay_ldflags=\"$my_sidplay_ldflags\"  "
+        MY_TRY_LIBSIDPLAY1
+        if test "$xs_sidplay1_works" = yes; then
+          xs_cv_have_sidplay1="xs_have_sidplay1=yes  \
+            xs_sidplay1_cxxflags=\"$xs_sidplay1_cxxflags\"  \
+            xs_sidplay1_ldflags=\"$xs_sidplay1_ldflags\"  "
         else
-            MY_FIND_LIBSIDPLAY        
+            MY_FIND_LIBSIDPLAY1        
         fi
     ])
-    eval "$my_cv_have_sidplay"
-    if test "$my_have_sidplay" = yes; then
-        if test -n "$my_sidplay_cxxflags" || test -n "$my_sidplay_ldflags"; then
-            AC_MSG_RESULT([$my_sidplay_cxxflags $my_sidplay_ldflags])
+
+    eval "$xs_cv_have_sidplay1"
+
+    if test "$xs_have_sidplay1" = yes; then
+        if test -n "$xs_sidplay1_cxxflags" || test -n "$xs_sidplay1_ldflags"; then
+            AC_MSG_RESULT([$xs_sidplay1_cxxflags $xs_sidplay1_ldflags])
         else
             AC_MSG_RESULT([yes])
         fi
     else
         AC_MSG_RESULT([no])
     fi
-    SIDPLAY_LDADD="$my_sidplay_ldflags -lsidplay"
-    SIDPLAY_INCLUDES="$my_sidplay_cxxflags"
-    AC_SUBST(SIDPLAY_LDADD)
-    AC_SUBST(SIDPLAY_INCLUDES)
+    SIDPLAY1_LDADD="$xs_sidplay1_ldflags -lsidplay"
+    SIDPLAY1_INCLUDES="$xs_sidplay1_cxxflags"
+    AC_SUBST(SIDPLAY1_LDADD)
+    AC_SUBST(SIDPLAY1_INCLUDES)
+
+    AC_LANG_POP(C++)
 ])
 
-dnl Functions used by MY_PATH_LIBSIDPLAY.
+dnl Functions used by XS_PATH_LIBSIDPLAY1.
 
-AC_DEFUN(MY_FIND_LIBSIDPLAY,
+AC_DEFUN(MY_FIND_LIBSIDPLAY1,
 [
     # Search common locations where header files might be stored.
-    my_sidplay_incdirs="$my_sidplay_includes /usr/include /usr/local/include \
-                        /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
-    MY_FIND_FILE(sidplay/sidtune.h, $my_sidplay_incdirs, \
-                 my_sidplay_includes)
+    xs_sidplay1_incdirs="$xs_sidplay1_includes /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include"
+    MY_FIND_FILE(sidplay/sidtune.h, $xs_sidplay1_incdirs, xs_sidplay1_includes)
 
     # Search common locations where library might be stored.
-    my_sidplay_libdirs="$my_sidplay_library /usr/lib /usr/lib/sidplay \
-                        /usr/local/lib/sidplay"
+    xs_sidplay1_libdirs="$xs_sidplay1_library /usr/lib /usr/lib/sidplay /usr/local/lib/sidplay"
     MY_FIND_FILE(libsidplay.a libsidplay.so libsidplay.so.1 libsidplay.so.1.36 libsidplay.so.1.37,
-                 $my_sidplaylibdirs, my_sidplay_library)
+                 $xs_sidplay1_libdirs, xs_sidplay1_library)
 
-    if test -z "$my_sidplay_includes" || test -z "$my_sidplay_library"; then
-        my_cv_have_sidplay="my_have_sidplay=no  \
-          my_sidplay_ldflags=\"\" my_sidplay_cxxflags=\"\"  "
+    if test -z "$xs_sidplay1_includes" || test -z "$xs_sidplay1_library"; then
+        xs_cv_have_sidplay1="xs_have_sidplay1=no  \
+          xs_sidplay1_ldflags=\"\" xs_sidplay1_cxxflags=\"\"  "
     else
         # Test compilation with found paths.
-        my_sidplay_ldflags="-L$my_sidplay_library"
-        my_sidplay_cxxflags="-I$my_sidplay_includes"
-        MY_TRY_LIBSIDPLAY
-        my_cv_have_sidplay="my_have_sidplay=$my_sidplay_works  \
-          my_sidplay_ldflags=\"$my_sidplay_ldflags\"  \
-          my_sidplay_cxxflags=\"$my_sidplay_cxxflags\"  "
+        xs_sidplay1_ldflags="-L$xs_sidplay1_library"
+        xs_sidplay1_cxxflags="-I$xs_sidplay1_includes"
+        MY_TRY_LIBSIDPLAY1
+        xs_cv_have_sidplay1="xs_have_sidplay1=$xs_sidplay1_works  \
+          xs_sidplay1_ldflags=\"$xs_sidplay1_ldflags\"  \
+          xs_sidplay1_cxxflags=\"$xs_sidplay1_cxxflags\"  "
     fi
 ])
 
-AC_DEFUN(MY_TRY_LIBSIDPLAY,
+AC_DEFUN(MY_TRY_LIBSIDPLAY1,
 [
     MY_TRY_LINK_SAVE
 
-    CXXFLAGS="$CXXFLAGS $my_sidplay_cxxflags"
-    LDFLAGS="$LDFLAGS $my_sidplay_ldflags"
+    CXXFLAGS="$CXXFLAGS $xs_sidplay1_cxxflags"
+    LDFLAGS="$LDFLAGS $xs_sidplay1_ldflags"
     LIBS="$LIBS -lsidplay"
 
-    AC_TRY_LINK(
-        [#include <sidplay/sidtune.h>],
-        [sidTune* myTest = new sidTune(0);],
-        [my_sidplay_works=yes],
-        [my_sidplay_works=no]
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+        [[#include <sidplay/sidtune.h>]],
+        [[sidTune* myTest = new sidTune(0);]])],
+        [xs_sidplay1_works=yes],
+        [xs_sidplay1_works=no]
     )
+
     MY_TRY_LINK_RESTORE
 ])
 
+
 dnl -------------------------------------------------------------------------
 dnl Try to find SIDPLAY2 library and header files.
-dnl $my_cv_have_sidplay2 will be "yes" or "no"
+dnl $xs_have_sidplay2 will be "yes" or "no"
 dnl @SIDPLAY_LDADD@ will be substituted with linker parameters
 dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters
 dnl -------------------------------------------------------------------------
+AC_DEFUN(XS_PATH_LIBSIDPLAY2,
+[
+    AC_MSG_CHECKING([for working SIDPlay2 library and headers])
 
-AC_DEFUN(MY_PATH_LIBSIDPLAY2,
-[
-    AC_MSG_CHECKING([for working SIDPLAY2 library and headers])
+    AC_LANG_PUSH(C++)
     
     AC_REQUIRE([MY_PROG_PKGCONFIG])
     if test -n "$PKG_CONFIG" && $PKG_CONFIG --atleast-version $LIBSIDPLAY2_REQUIRED_VERSION libsidplay2; then
-        my_pkgcfg_knows=yes
+        xs_pkgcfg_knows=yes
     else
-        my_pkgcfg_knows=no
+        xs_pkgcfg_knows=no
     fi
-dnl    echo "(" pkg-config knows = $my_pkgcfg_knows ")"
-
-    AC_REQUIRE([MY_ARGS_LIBSIDPLAY])
-    # Share --with-* args with libsidplay1.
-    my_sidplay2_library="$my_sidplay_library"
-    my_sidplay2_includes="$my_sidplay_includes"
 
     # Derive sidbuilders path from libsidplay2 root.
-    if test -n "$my_sidplay2_library"; then
-        my_sidplay2_builders="$my_sidplay2_library/sidplay/builders"
-    elif test "$my_pkgcfg_knows" = yes ; then
-        my_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2`
+    if test -n "$xs_sidplay2_library"; then
+        xs_sidplay2_builders="$xs_sidplay2_library/sidplay/builders"
+    elif test "$xs_pkgcfg_knows" = yes ; then
+        xs_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2`
     fi
 
-    AC_CACHE_VAL(my_cv_have_sidplay2,
+    AC_CACHE_VAL(xs_cv_have_sidplay2,
     [
         # Run test compilation with either standard search path
         # or user-defined paths.
-        my_sidplay2_ldadd="-lsidplay2"
+        xs_sidplay2_ldadd="-lsidplay2"
         MY_TRY_LIBSIDPLAY2
-        if test "$my_sidplay2_works" = yes; then
-          my_cv_have_sidplay2="my_have_sidplay2=yes  \
-            my_sidplay2_cxxflags=\"$my_sidplay2_cxxflags\"  \
-            my_sidplay2_ldadd=\"$my_sidplay2_ldadd\"  \
-            my_sidplay2_builders=\"$my_sidplay2_builders\"  "
+        if test "$xs_sidplay2_works" = yes; then
+          xs_cv_have_sidplay2="xs_have_sidplay2=yes  \
+            xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\"  \
+            xs_sidplay2_ldadd=\"$xs_sidplay2_ldadd\"  \
+            xs_sidplay2_builders=\"$xs_sidplay2_builders\"  "
         else
             MY_FIND_LIBSIDPLAY2
         fi
     ])
-    eval "$my_cv_have_sidplay2"
-    if test "$my_have_sidplay2" = yes; then
-        if test -n "$my_sidplay2_cxxflags" || test -n "$my_sidplay2_ldadd"; then
-            AC_MSG_RESULT([$my_sidplay2_cxxflags $my_sidplay2_ldadd])
+    eval "$xs_cv_have_sidplay2"
+    if test "$xs_have_sidplay2" = yes; then
+        if test -n "$xs_sidplay2_cxxflags" || test -n "$xs_sidplay2_ldadd"; then
+            AC_MSG_RESULT([$xs_sidplay2_cxxflags $xs_sidplay2_ldadd])
         else
             AC_MSG_RESULT([yes])
         fi
     else
         AC_MSG_RESULT([no])
     fi
-    SIDPLAY_LDADD="$my_sidplay2_ldadd"
-    SIDPLAY_INCLUDES="$my_sidplay2_cxxflags"
-    AC_SUBST(SIDPLAY_LDADD)
-    AC_SUBST(SIDPLAY_INCLUDES)
+    SIDPLAY2_LDADD="$xs_sidplay2_ldadd"
+    SIDPLAY2_INCLUDES="$xs_sidplay2_cxxflags"
+    AC_SUBST(SIDPLAY2_LDADD)
+    AC_SUBST(SIDPLAY2_INCLUDES)
+
+    AC_LANG_POP(C++)
 ])
 
-dnl Functions used by MY_PATH_LIBSIDPLAY.
 
+dnl Functions used by XS_PATH_LIBSIDPLAY2.
 AC_DEFUN(MY_FIND_LIBSIDPLAY2,
 [
     # See whether user didn't provide paths.
-    if test -z "$my_sidplay2_includes"; then
-        if test "$my_pkgcfg_knows" = yes ; then
-            my_sidplay2_includes=`$PKG_CONFIG --variable=includedir libsidplay2`
-            my_sidplay2_cxxflags=`$PKG_CONFIG --cflags libsidplay2`
+    if test -z "$xs_sidplay2_includes"; then
+        if test "$xs_pkgcfg_knows" = yes ; then
+            xs_sidplay2_includes=`$PKG_CONFIG --variable=includedir libsidplay2`
+            xs_sidplay2_cxxflags=`$PKG_CONFIG --cflags libsidplay2`
         else
             # Search common locations where header files might be stored.
-            my_sidplay2_incdirs="$my_sidplay2_includes $my_sidplay2_includes/include"
-            MY_FIND_FILE(sidplay/sidplay2.h,$my_sidplay2_incdirs,my_sidplay2_includes)
-            my_sidplay2_cxxflags="-I$my_sidplay2_includes"
+            xs_sidplay2_incdirs="$xs_sidplay2_includes $xs_sidplay2_includes/include"
+            MY_FIND_FILE(sidplay/sidplay2.h,$xs_sidplay2_incdirs,xs_sidplay2_includes)
+            xs_sidplay2_cxxflags="-I$xs_sidplay2_includes"
         fi
     else
-        my_sidplay2_cxxflags="-I$my_sidplay2_includes"
+        xs_sidplay2_cxxflags="-I$xs_sidplay2_includes"
     fi
-    if test -z "$my_sidplay2_library"; then
-        if test "$my_pkgcfg_knows" = yes ; then
-            my_sidplay2_library=`$PKG_CONFIG --variable=libdir libsidplay2`
-            my_sidplay2_ldadd=`$PKG_CONFIG --libs libsidplay2`
-            my_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2`
+    if test -z "$xs_sidplay2_library"; then
+        if test "$xs_pkgcfg_knows" = yes ; then
+            xs_sidplay2_library=`$PKG_CONFIG --variable=libdir libsidplay2`
+            xs_sidplay2_ldadd=`$PKG_CONFIG --libs libsidplay2`
+            xs_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2`
         else
             # Search common locations where library might be stored.
-            my_sidplay2_libdirs="$my_sidplay2_library $my_sidplay2_library/lib \
-                              $my_sidplay2_library/src"
-            MY_FIND_FILE(libsidplay2.la,$my_sidplay2_libdirs,my_sidplay2_library)
-            my_sidplay2_ldadd="-L$my_sidplay2_library -lsidplay2"
-            my_sidplay2_builders="$my_sidplay2_library/sidplay/builders"
+            xs_sidplay2_libdirs="$xs_sidplay2_library $xs_sidplay2_library/lib $xs_sidplay2_library/src"
+            MY_FIND_FILE(libsidplay2.la,$xs_sidplay2_libdirs,xs_sidplay2_library)
+            xs_sidplay2_ldadd="-L$xs_sidplay2_library -lsidplay2"
+            xs_sidplay2_builders="$xs_sidplay2_library/sidplay/builders"
         fi
     else
-        my_sidplay2_ldadd="-L$my_sidplay2_library -lsidplay2"
+        xs_sidplay2_ldadd="-L$xs_sidplay2_library -lsidplay2"
     fi
-    if test -z "$my_sidplay2_includes" || test -z "$my_sidplay2_library"; then
-        my_cv_have_sidplay2="my_have_sidplay2=no \
-          my_sidplay2_ldadd=\"\" my_sidplay2_cxxflags=\"\" \
-          my_sidplay2_builders=\"\" "
+    if test -z "$xs_sidplay2_includes" || test -z "$xs_sidplay2_library"; then
+        xs_cv_have_sidplay2="xs_have_sidplay2=no \
+          xs_sidplay2_ldadd=\"\" xs_sidplay2_cxxflags=\"\" \
+          xs_sidplay2_builders=\"\" "
     else
         # Test compilation with found paths.
-        my_sidplay2_ldadd="-L$my_sidplay2_library -lsidplay2"
-        my_sidplay2_cxxflags="-I$my_sidplay2_includes"
+        xs_sidplay2_ldadd="-L$xs_sidplay2_library -lsidplay2"
+        xs_sidplay2_cxxflags="-I$xs_sidplay2_includes"
         MY_TRY_LIBSIDPLAY2
-        my_cv_have_sidplay2="my_have_sidplay2=$my_sidplay2_works \
-          my_sidplay2_ldadd=\"$my_sidplay2_ldadd\" \
-          my_sidplay2_cxxflags=\"$my_sidplay2_cxxflags\" \
-          my_sidplay2_builders=\"$my_sidplay2_builders\" "
+        xs_cv_have_sidplay2="xs_have_sidplay2=$xs_sidplay2_works \
+          xs_sidplay2_ldadd=\"$xs_sidplay2_ldadd\" \
+          xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\" \
+          xs_sidplay2_builders=\"$xs_sidplay2_builders\" "
     fi
-    echo "DEBUG: $my_sidplay2_cxxflags"
-    echo "DEBUG: $my_sidplay2_ldadd"
 ])
 
+
 AC_DEFUN(MY_TRY_LIBSIDPLAY2,
 [
     MY_TRY_LINK_SAVE
 
     CXX="${SHELL-/bin/sh} ${srcdir}/libtool $CXX"
-    CXXFLAGS="$CXXFLAGS $my_sidplay2_cxxflags -DHAVE_UNIX"
-    LDFLAGS="$LDFLAGS $my_sidplay2_ldadd"
+    CXXFLAGS="$CXXFLAGS $xs_sidplay2_cxxflags -DHAVE_UNIX"
+    LDFLAGS="$LDFLAGS $xs_sidplay2_ldadd"
 
-    AC_TRY_LINK(
-        [#include <sidplay/sidplay2.h>],
-        [sidplay2 *myEngine;],
-        [my_sidplay2_works=yes],
-        [my_sidplay2_works=no]
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+        [[#include <sidplay/sidplay2.h>]],
+        [[sidplay2 *myEngine;]])],
+        [xs_sidplay2_works=yes],
+        [xs_sidplay2_works=no]
     )
+
     MY_TRY_LINK_RESTORE
 ])
 
+
 dnl -------------------------------------------------------------------------
 dnl Find libsidplay2 builders (sidbuilders) dir.
 dnl @BUILDERS_INCLUDES@
@@ -403,15 +336,18 @@
 dnl -------------------------------------------------------------------------
 AC_DEFUN(BUILDERS_FIND,
 [
-    AC_MSG_CHECKING([for SIDPLAY2 builders directory])
-    AC_REQUIRE([MY_PATH_LIBSIDPLAY2])
+    AC_MSG_CHECKING([for SIDPlay2 builders directory])
+
+    AC_LANG_PUSH(C++)
+
+    AC_REQUIRE([XS_PATH_LIBSIDPLAY2])
 
     dnl Be pessimistic.
     builders_available=no
 
     dnl Sidbuilder headers are included with "builders" prefix.
-    builders_includedir=$my_sidplay2_includes
-    builders_libdir=$my_sidplay2_builders
+    builders_includedir=$xs_sidplay2_includes
+    builders_libdir=$xs_sidplay2_builders
 
     dnl If libsidplay2 is in standard library search path, we need
     dnl to get an argument whether /usr, /usr/local, etc. Else we
@@ -425,41 +361,46 @@
     fi
 
     AC_ARG_WITH(sidbuilders,
-        [  --with-sidbuilders=DIR  what the SIDPLAY2 builders install PREFIX is],
+        [  --with-sidbuilders=DIR  what the SIDPlay2 builders install PREFIX is],
         [builders_includedir="$withval/include"
-         builders_libdir="$withval/lib/sidplay/builders"]
-    )
+         builders_libdir="$withval/lib/sidplay/builders"])
+
     AC_ARG_WITH(builders-inc,
-        [  --with-builders-inc=DIR where the SIDPLAY2 builders headers are located],
-        [builders_includedir="$withval"]
-    )
+        [  --with-builders-inc=DIR where the SIDPlay2 builders headers are located],
+        [builders_includedir="$withval"])
+
     AC_ARG_WITH(builders-lib,
-        [  --with-builders-lib=DIR where the SIDPLAY2 builders libraries are installed],
-        [builders_libdir="$withval"]
-    )
+        [  --with-builders-lib=DIR where the SIDPlay2 builders libraries are installed],
+        [builders_libdir="$withval"])
     
     if test -n "$builders_includedir"; then
         BUILDERS_INCLUDES="-I$builders_includedir"
     fi
+
     if test -n "$builders_libdir"; then
         BUILDERS_LDFLAGS="-L$builders_libdir"
     fi
+
     if test -d $builders_libdir; then
-        my_have_sidbuilders_dir=yes
+        xs_have_sidbuilders_dir=yes
         AC_MSG_RESULT([$builders_libdir])
     else
-        my_have_sidbuilders_dir=no
-        AC_MSG_RESULT([$my_have_sidbuilders_dir])
+        xs_have_sidbuilders_dir=no
+        AC_MSG_RESULT([$xs_have_sidbuilders_dir])
         AC_MSG_ERROR([$builders_libdir not found!
-Check --help on how to specify SIDPLAY2 and/or builders library and
+Check --help on how to specify SIDPlay2 and/or builders library and
 header path, or set --exec-prefix to the same prefix as your installation
 of libsidplay2.
         ])
     fi
+
     AC_SUBST(BUILDERS_INCLUDES)
     AC_SUBST(BUILDERS_LDFLAGS)
+
+    AC_LANG_POP(C++)
 ])
 
+
 dnl -------------------------------------------------------------------------
 dnl Test for working reSID builder.
 dnl sets $(RESID_LDADD), substitutes @RESID_LDADD@
@@ -467,6 +408,7 @@
 AC_DEFUN(BUILDERS_FIND_RESID,
 [
     AC_MSG_CHECKING([for reSID builder module])
+    AC_LANG_PUSH(C++)
     MY_TRY_LINK_SAVE
     
     CXX="${SHELL-/bin/sh} ${srcdir}/libtool $CXX"
@@ -474,12 +416,13 @@
     LDFLAGS="$LDFLAGS $BUILDERS_LDFLAGS"
     LIBS="$LIBS -lresid-builder"
 
-    AC_TRY_LINK(
-        [#include <sidplay/builders/resid.h>],
-        [ReSIDBuilder *sid;],
+    AC_LINK_IFELSE([AC_LANG_PROGRAM(
+        [[#include <sidplay/builders/resid.h>]],
+        [[ReSIDBuilder *sid;]])],
         [builders_work=yes],
         [builders_work=no]
     )
+
     MY_TRY_LINK_RESTORE
 
     if test "$builders_work" = yes; then
@@ -489,8 +432,10 @@
     fi
     AC_MSG_RESULT($builders_work)
     AC_SUBST(RESID_LDADD)
+    AC_LANG_POP(C++)
 ])
 
+
 dnl -------------------------------------------------------------------------
 dnl Test for working HardSID builder.
 dnl sets $(HARDSID_LDADD), substitutes @HARDSID_LDADD@
--- a/configure.in	Sat Jun 07 23:54:00 2003 +0000
+++ b/configure.in	Sun Jun 08 03:03:01 2003 +0000
@@ -6,8 +6,8 @@
 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_INIT(XMMS-SID, 0.8.0beta1, ccr@tnsp.org)
+AC_COPYRIGHT([[(C) 2002-2003 Matti 'ccr' Hämäläinen]])
 AC_CONFIG_SRCDIR(src/xmms-sid.h)
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS(config.h)
@@ -30,16 +30,125 @@
 AC_PROG_INSTALL
 AC_HEADER_STDC
 
+AC_PREFIX_PROGRAM(xmms)
+
+dnl ***
+dnl *** Checks for generic libraries
+dnl ***
+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 *** libSIDPlay 1 options
+dnl ***
+AC_ARG_WITH(libsidplay1,
+[  --with-libsidplay1=PREFIX   Enable SIDPlay1 with install-PREFIX is],
+[
+if test "$withval" = yes; then
+xs_sidplay1=yes
+xs_sidplay1_library=""
+xs_sidplay1_includes=""
+else
+if test "$withval" = no; then
+	xs_sidplay1=no
+	else
+	xs_sidplay1=yes
+	xs_sidplay1_includes="$withval/include"
+	xs_sidplay1_library="$withval/lib"
+	fi
+fi
+],[
+xs_sidplay1=yes
+xs_sidplay1_library=""
+xs_sidplay1_includes=""
+])
+
+AC_ARG_WITH(sidplay1-inc,
+[  --with-sidplay1-inc=DIR    Where the SIDPlay1 headers are located],
+[xs_sidplay1_includes="$withval"],)
+
+AC_ARG_WITH(sidplay1-lib,
+[  --with-sidplay1-lib=DIR    Where the SIDPlay1 library is installed],
+[xs_sidplay1_library="$withval"],)
+
 
 dnl ***
-dnl *** Checks for libraries
+dnl *** libSIDPlay 2 options
+dnl ***
+AC_ARG_WITH(libsidplay2,
+[  --with-libsidplay2=PREFIX   Enable SIDPlay1 with install-PREFIX is],
+[
+if test "$withval" = yes; then
+xs_sidplay2=yes
+xs_sidplay2_library=""
+xs_sidplay2_includes=""
+else
+if test "$withval" = no; then
+	xs_sidplay2=no
+	else
+	xs_sidplay2=yes
+	xs_sidplay2_includes="$withval/include"
+	xs_sidplay2_library="$withval/lib"
+	fi
+fi
+],[
+xs_sidplay2=yes
+xs_sidplay2_library=""
+xs_sidplay2_includes=""
+])
+
+AC_ARG_WITH(sidplay2-inc,
+[  --with-sidplay2-inc=DIR    Where the SIDPlay2 headers are located],
+[xs_sidplay2_includes="$withval"],)
+
+AC_ARG_WITH(sidplay2-lib,
+[  --with-sidplay2-lib=DIR    Where the SIDPlay2 library is installed],
+[xs_sidplay2_library="$withval"],)
+
+
+dnl ***
+dnl *** Determine if libraries are wanted and available
 dnl ***
-AC_PATH_LIBSIDPLAY
-dnl AC_PATH_LIBSIDPLAY2
+OPT_SIDPLAY1="no"
+if test "$xs_sidplay1" = yes; then
+XS_PATH_LIBSIDPLAY1
+if test "$xs_have_sidplay1" = yes; then
+AC_DEFINE(ENABLE_SIDPLAY1)
+OPT_SIDPLAY1="yes"
+else
+AC_MSG_ERROR([libSIDPlay1 library and/or headers were not found!])
+fi
+fi
+
 
-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/)]))
+OPT_SIDPLAY2="no"
+if test "$xs_sidplay2" = yes; then
+LIBSIDPLAY2_REQUIRED_VERSION="2.1.0"
+XS_PATH_LIBSIDPLAY2
+if test "$xs_have_sidplay2" = yes; then
+AC_DEFINE(ENABLE_SIDPLAY2)
+OPT_SIDPLAY2="yes"
+BUILDERS_FIND
+BUILDERS_FIND_RESID
+if test "$builders_available" = no; then
+AC_MSG_ERROR([No builder modules were found in the sidbuilders directory!]);
+fi
+else
+AC_MSG_ERROR([libSIDPlay2 library and/or headers were not found!])
+fi
+fi
 
-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 if we have some SIDPlay version
+dnl ***
+if test "$OPT_SIDPLAY1" = no; then
+if test "$OPT_SIDPLAY2" = no; then
+AC_MSG_ERROR([Either libSIDPlay1 or libSIDPlay2 is required! Please read INSTALL for more information!])
+fi
+fi
 
 
 dnl ***
@@ -51,7 +160,7 @@
 libdir=$XMMS_INPUT_PLUGIN_DIR
 
 XMMS_TEST_VERSION($XMMS_VERSION, 1.2.5, [
-AC_DEFINE(HAVE_XMMSEXTRA)
+AC_DEFINE(ENABLE_XMMSEXTRA)
 OPT_XMMSEXTRA="yes"
 ], [
 OPT_XMMSEXTRA="no"
@@ -59,30 +168,11 @@
 
 
 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)
+AC_DEFINE(ENABLE_XMMSEXTRA, 0, Define to 1 if you have XMMS version 1.2.5 or later)
+AC_DEFINE(ENABLE_SIDPLAY1, 1, Define to 1 if you want to use libSIDPlay 1)
+AC_DEFINE(ENABLE_SIDPLAY2, 1, Define to 1 if you want to use libSIDPlay 2)
 
 
 dnl ***
@@ -93,7 +183,6 @@
 src/Makefile
 xmms-sid.spec
 ])
-
 AC_OUTPUT
 
 
@@ -104,10 +193,8 @@
 	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
+	libSIDPlay 1 support          : $OPT_SIDPLAY1
+	libSIDPlay 2 support          : $OPT_SIDPLAY2
 
-	Now just run 'make && make install'!
 ])