Mercurial > hg > xmms-sid
diff acinclude.m4 @ 744:c7fa50576c70
Initial implementation for supporting libSIDPlay2-FP (or libSIDPlay-FP, as
they seem to call it.) Also removed support for the "old" libSIDPlay2 API,
only supporting the "new" CVS trunk COMI API for the old libSIDPlay2.
We'll see how that goes ..
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 05 Nov 2012 17:24:16 +0200 |
parents | c310c2a01a31 |
children | 3e305ce076e8 |
line wrap: on
line diff
--- a/acinclude.m4 Mon Nov 05 15:19:21 2012 +0200 +++ b/acinclude.m4 Mon Nov 05 17:24:16 2012 +0200 @@ -43,32 +43,6 @@ ]) -AC_DEFUN([XS_LIB_RESULT], -[ - define([Name], [translit([$1], [a-z], [A-Z])])dnl - if test "x$xs_have_$1" = "xyes"; then - if test "x$xs_$1_cxxflags" != "x" || test "x$xs_$1_ldflags" != "x"; then - AC_MSG_RESULT([$xs_$1_cxxflags $2 $xs_$1_ldflags $3]) - else - AC_MSG_RESULT([yes]) - fi - - Name[]_LIBS="$xs_$1_ldflags $2" - Name[]_CFLAGS="$xs_$1_cxxflags $3" - AC_SUBST(Name[]_LIBS)dnl - AC_SUBST(Name[]_CFLAGS)dnl - else - AC_MSG_RESULT([no]) - fi -]) - - -AC_DEFUN([XS_PROG_PKGCONFIG], -[ - AC_PATH_PROG([PKG_CONFIG], [pkg-config])dnl -]) - - AC_DEFUN([XS_ARG_WITH], [dnl define([Name], [translit([$1], [a-z], [A-Z])])dnl define([roflCopter], [Enable $2 with install-PREFIX])dnl @@ -156,7 +130,21 @@ fi ]) eval "$xs_cv_have_sidplay1" - XS_LIB_RESULT([sidplay1], [-lsidplay], []) + + if test "x$xs_have_sidplay1" = "xyes"; then + if test "x$xs_sidplay1_cxxflags" != "x" || test "x$xs_sidplay1_ldflags" != "x"; then + AC_MSG_RESULT([$xs_sidplay1_cxxflags $xs_sidplay1_ldflags -lsidplay]) + else + AC_MSG_RESULT([yes]) + fi + + SIDPLAY1_LIBS="$xs_sidplay1_ldflags -lsidplay" + SIDPLAY1_CFLAGS="$xs_sidplay1_cxxflags" + AC_SUBST([SIDPLAY1_LIBS])dnl + AC_SUBST([SIDPLAY1_CFLAGS])dnl + else + AC_MSG_RESULT([no]) + fi AC_LANG_POP([C++]) ]) @@ -201,99 +189,91 @@ dnl ------------------------------------------------------------------------- AC_DEFUN([XS_PATH_LIBSIDPLAY2], [ - AC_MSG_CHECKING([for working SIDPlay2 library and headers]) + AC_MSG_CHECKING([for working SIDPlay2/FP library and headers]) AC_LANG_PUSH([C++]) - AC_REQUIRE([XS_PROG_PKGCONFIG]) - if test "x$PKG_CONFIG" != "x" && $PKG_CONFIG --atleast-version m4_ifval([$1], [$1], [2.1.0]) libsidplay2; then - xs_pkgcfg_knows="yes" - else - xs_pkgcfg_knows="no" - fi + 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_TRY_LIBRARY([sidplay2], + [$xs_sidplay2_cxxflags -DHAVE_UNIX], [$xs_sidplay2_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\"" + fi + ]) + + elif test "x$xs_pkg_sidplay2" = "xyes"; then + + AC_CACHE_VAL([xs_cv_have_sidplay2], + [ + xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplay2` + xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplay2` - dnl Derive sidbuilders path from libsidplay2 root. - if test "x$xs_sidplay2_library" != "x"; then - xs_sidplay2_builders="$xs_sidplay2_library/sidplay/builders" - elif test "x$xs_pkgcfg_knows" = "xyes" ; then - xs_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2` + dnl Derive sidbuilders path from libsidplay2 root. + if test "x$xs_sidplay2_library" != "x"; then + xs_sidplay2_builders="$xs_sidplay2_library/sidplay/builders" + else + xs_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2` + fi + + dnl *** Check for new COMI API + xs_api_ok="no" + AC_MSG_CHECKING([libSIDPlay2 API compatibility]) + 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], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sidplay/sidunknown.h>], [ISidUnknown *i;])], [xs_api_ok="yes"], [])]) + ]) + + if test "x$xs_api_ok" = "xyes"; then + XS_TRY_LIBRARY([sidplay2], + [$xs_sidplay2_cxxflags -DHAVE_UNIX], [$xs_sidplay2_ldflags], + [sidplay2], [sidplay/sidplay2.h], [sidplay2 *myEngine;]) + fi + + if test "x$xs_sidplay2_works" = "xyes"; then + xs_cv_have_sidplay2="xs_have_sidplay2=yes \ + xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\" \ + xs_sidplay2_ldflags=\"$xs_sidplay2_ldflags\" \ + xs_sidplay2_builders=\"$xs_sidplay2_builders\" " + fi + ]) fi - AC_CACHE_VAL([xs_cv_have_sidplay2], - [ - dnl Run test compilation with either standard search path - dnl or user-defined paths. - xs_sidplay2_ldflags="-lsidplay2" - XS_TRY_LIBSIDPLAY2 - if test "x$xs_sidplay2_works" = "xyes"; then - xs_cv_have_sidplay2="xs_have_sidplay2=yes \ - xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\" \ - xs_sidplay2_ldflags=\"$xs_sidplay2_ldflags\" \ - xs_sidplay2_builders=\"$xs_sidplay2_builders\" " + 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_sidplay2_cxxflags" != "x" || test "x$xs_sidplay2_ldflags" != "x"; then + AC_MSG_RESULT([$xs_sidplay2_cxxflags $xs_sidplay2_ldflags]) else - XS_FIND_LIBSIDPLAY2 + AC_MSG_RESULT([yes]) fi - ]) - eval "$xs_cv_have_sidplay2" - XS_LIB_RESULT([sidplay2], [], []) - AC_LANG_POP([C++]) -]) - -dnl Functions used by XS_PATH_LIBSIDPLAY2. -AC_DEFUN([XS_FIND_LIBSIDPLAY2], -[ - dnl See whether user didn't provide paths. - if test "x$xs_sidplay2_includes" = "x"; then - if test "x$xs_pkgcfg_knows" = "xyes" ; then - xs_sidplay2_includes=`$PKG_CONFIG --variable=includedir libsidplay2` - xs_sidplay2_cxxflags=`$PKG_CONFIG --cflags libsidplay2` - else - dnl Search common locations where header files might be stored. - XS_FIND_FILE([xs_sidplay2_includes], [sidplay/sidplay2.h], - [$xs_sidplay2_includes $xs_sidplay2_includes/include /usr/include /usr/local/include /usr/lib/sidplay/include /usr/local/lib/sidplay/include /opt/sfw/include /opt/csw/include]) - xs_sidplay2_cxxflags="-I$xs_sidplay2_includes" - fi + SIDPLAY2_LIBS="$xs_sidplay2_ldflags" + SIDPLAY2_CFLAGS="$xs_sidplay2_cxxflags" + AC_SUBST([SIDPLAY2_LIBS])dnl + AC_SUBST([SIDPLAY2_CFLAGS])dnl else - xs_sidplay2_cxxflags="-I$xs_sidplay2_includes" + AC_MSG_RESULT([no]) fi - if test "x$xs_sidplay2_library" = "x"; then - if test "x$xs_pkgcfg_knows" = "xyes" ; then - xs_sidplay2_library=`$PKG_CONFIG --variable=libdir libsidplay2` - xs_sidplay2_ldflags=`$PKG_CONFIG --libs libsidplay2` - xs_sidplay2_builders=`$PKG_CONFIG --variable=builders libsidplay2` - else - dnl Search common locations where library might be stored. - XS_FIND_FILE([xs_sidplay2_library], [libsidplay2.la], - [$xs_sidplay2_library $xs_sidplay2_library/lib $xs_sidplay2_library/src /usr/lib /usr/lib/sidplay /usr/local/lib/sidplay /opt/sfw/lib /opt/csw/lib]) - xs_sidplay2_ldflags="-L$xs_sidplay2_library -lsidplay2" - xs_sidplay2_builders="$xs_sidplay2_library/sidplay/builders" - fi - else - xs_sidplay2_ldflags="-L$xs_sidplay2_library -lsidplay2" - fi - if test "x$xs_sidplay2_includes" = "x" || test "x$xs_sidplay2_library" = "x"; then - xs_cv_have_sidplay2="xs_have_sidplay2=no \ - xs_sidplay2_ldflags=\"\" xs_sidplay2_cxxflags=\"\" \ - xs_sidplay2_builders=\"\" " - else - dnl Test compilation with found paths. - xs_sidplay2_ldflags="-L$xs_sidplay2_library -lsidplay2" - xs_sidplay2_cxxflags="-I$xs_sidplay2_includes" - XS_TRY_LIBSIDPLAY2 - xs_cv_have_sidplay2="xs_have_sidplay2=$xs_sidplay2_works \ - xs_sidplay2_ldflags=\"$xs_sidplay2_ldflags\" \ - xs_sidplay2_cxxflags=\"$xs_sidplay2_cxxflags\" \ - xs_sidplay2_builders=\"$xs_sidplay2_builders\" " - fi -]) - -AC_DEFUN([XS_TRY_LIBSIDPLAY2], -[ - XS_TRY_LIBRARY([sidplay2], - [$xs_sidplay2_cxxflags -DHAVE_UNIX], [$xs_sidplay2_ldflags], - [sidplay2], [sidplay/sidplay2.h], [sidplay2 *myEngine;]) + AC_LANG_POP([C++]) ])