diff acinclude.m4 @ 800:1fe6005ed58c

Make it so that both libSIDPlay2 and libSIDPlay-FP can co-exist, though not at run-time, but either one can be chosen via --with-/--without- configure options.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Nov 2012 11:58:46 +0200
parents 3e305ce076e8
children ae1f6418d093
line wrap: on
line diff
--- a/acinclude.m4	Wed Nov 07 11:26:31 2012 +0200
+++ b/acinclude.m4	Wed Nov 07 11:58:46 2012 +0200
@@ -187,33 +187,66 @@
 dnl @SIDPLAY_LIBS@ will be substituted with linker parameters
 dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters
 dnl -------------------------------------------------------------------------
-AC_DEFUN([XS_PATH_LIBSIDPLAY2],
+
+
+AC_DEFUN([XS_PATH_LIBSIDPLAYFP],
 [
-    AC_MSG_CHECKING([for working SIDPlay2/FP library and headers])
+    AC_MSG_CHECKING([for working SIDPlayFP library and headers])
 
     AC_LANG_PUSH([C++])
     
-    PKG_CHECK_EXISTS([libsidplay2 >= 2.1.1], [xs_pkg_sidplay2="yes"], [])
     PKG_CHECK_EXISTS([libsidplayfp >= 0.3.7], [xs_pkg_sidplayfp="yes"], [])
 
     if test "x$xs_pkg_sidplayfp" = "xyes"; then
         AC_CACHE_VAL([xs_cv_have_sidplayfp],
         [
-            xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplayfp`
-            xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplayfp`
+            xs_sidplayfp_cflags=`$PKG_CONFIG --libs libsidplayfp`
+            xs_sidplayfp_ldflags=`$PKG_CONFIG --libs libsidplayfp`
 
-            XS_TRY_LIBRARY([sidplay2],
-                [$xs_sidplay2_cxxflags -DHAVE_UNIX], [$xs_sidplay2_ldflags],
+            XS_TRY_LIBRARY([sidplayfp],
+                [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
                 [sidplayfp], [sidplayfp/sidplay2.h], [sidplay2 *myEngine;])
 
-            if test "x$xs_sidplay2_works" = "xyes"; then
-              xs_cv_have_sidplay2="xs_have_sidplayfp=yes  \
-                xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\"  \
-                xs_sidplay2_ldflags=\"$xs_sidplay2_ldflags\""
+            if test "x$xs_sidplayfp_works" = "xyes"; then
+              xs_cv_have_sidplayfp="xs_have_sidplayfp=yes  \
+                xs_sidplayfp_cxxflags=\"$xs_sidplayfp_cxxflags\"  \
+                xs_sidplayfp_ldflags=\"$xs_sidplayfp_ldflags\""
             fi
         ])
+    fi
 
-    elif test "x$xs_pkg_sidplay2" = "xyes"; then
+    eval "$xs_cv_have_sidplayfp"
+
+    if test "x$xs_have_sidplayfp" = "xyes"; then
+        if test "x$xs_sidplayfp_cxxflags" != "x" || test "x$xs_sidplayfp_ldflags" != "x"; then
+            AC_MSG_RESULT([$xs_sidplayfp_cxxflags $xs_sidplayfp_ldflags])
+        else
+            AC_MSG_RESULT([yes])
+        fi
+
+        SIDPLAY2_LIBS="$xs_sidplayfp_ldflags"
+        SIDPLAY2_CFLAGS="$xs_sidplayfp_cxxflags"
+        AC_SUBST([SIDPLAY2_LIBS])dnl
+        AC_SUBST([SIDPLAY2_CFLAGS])dnl
+    else
+        AC_MSG_RESULT([no])
+    fi
+
+    AC_LANG_POP([C++])
+])
+
+
+
+
+AC_DEFUN([XS_PATH_LIBSIDPLAY2],
+[
+    AC_MSG_CHECKING([for working SIDPlay2 library and headers])
+
+    AC_LANG_PUSH([C++])
+    
+    PKG_CHECK_EXISTS([libsidplay2 >= 2.1.1], [xs_pkg_sidplay2="yes"], [])
+
+    if test "x$xs_pkg_sidplay2" = "xyes"; then
 
         AC_CACHE_VAL([xs_cv_have_sidplay2],
         [
@@ -256,9 +289,8 @@
     fi
 
     eval "$xs_cv_have_sidplay2"
-    eval "$xs_cv_have_sidplayfp"
 
-    if test "x$xs_have_sidplay2" = "xyes" -o "x$xs_have_sidplayfp" = "xyes"; then
+    if test "x$xs_have_sidplay2" = "xyes"; then
         if test "x$xs_sidplay2_cxxflags" != "x" || test "x$xs_sidplay2_ldflags" != "x"; then
             AC_MSG_RESULT([$xs_sidplay2_cxxflags $xs_sidplay2_ldflags])
         else