From e49421b04ba22b17c341bb9cc51e64b396a63c6f Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sat, 1 May 2010 19:07:16 +0200 Subject: [PATCH] Integrate OSS4 local audio output --- configure.in | 57 +++++++++++++++++++++++++++++++++++++++++++++---- src/Makefile.am | 8 +++++-- 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/configure.in b/configure.in index aaf19da1..22825748 100644 --- a/configure.in +++ b/configure.in @@ -61,6 +61,40 @@ AM_CONDITIONAL(COND_FLAC, test x$use_flac = xtrue) AM_CONDITIONAL(COND_MUSEPACK, test x$use_musepack = xtrue) AM_CONDITIONAL(COND_ITUNES, test x$use_itunes = xtrue) +AC_ARG_WITH(oss4, AC_HELP_STRING([--with-oss4=includedir], [Use OSS4 with soundcard.h in includedir (default /usr/lib/oss/include/sys)]), + [ case "$withval" in + no) + case "$host" in + *-*-linux-*) + use_oss4=false + ;; + *-*-kfreebsd*-*|*-*-freebsd-*) + AC_MSG_ERROR([OSS4 must be enabled on FreeBSD systems]) + ;; + esac + ;; + yes) + use_oss4=true + oss4_includedir=/usr/lib/oss/include/sys + ;; + [[\\/$]]* | ?:[[\\/]]* ) + use_oss4=true + oss4_includedir="$withval" + ;; + *) + AC_MSG_ERROR([expected an absolute directory name for --with-oss4: $withval]) + ;; + esac ], + [ case "$host" in + *-*-linux-*) + use_oss4=false + ;; + *-*-kfreebsd*-*|*-*-freebsd-*) + use_oss4=true + oss4_includedir=/usr/lib/oss/include/sys + ;; + esac ]) + dnl Checks for libraries. PKG_CHECK_MODULES(CONFUSE, [ libconfuse ]) PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6.24 ]) @@ -121,16 +155,31 @@ if test x$use_itunes = xtrue; then fi case "$host" in - *linux*) - use_alsa=true - PKG_CHECK_MODULES(ALSA, [ alsa ]) - AC_DEFINE(LAUDIO_USE_ALSA, 1, [define if local audio output uses ALSA]) + *-*-linux-*) + if test x$use_oss4 != xtrue; then + use_alsa=true + PKG_CHECK_MODULES(ALSA, [ alsa ]) + AC_DEFINE(LAUDIO_USE_ALSA, 1, [define if local audio output uses ALSA]) + fi AC_CHECK_HEADER(sys/signalfd.h, , AC_MSG_ERROR([signalfd required; glibc 2.9+ recommended])) ;; esac +if test x$use_oss4 = xtrue; then + OSS4CPPFLAGS="-I$oss4_includedir" + + save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$OSS4CPPFLAGS" + + AC_CHECK_HEADER(soundcard.h, , AC_MSG_ERROR([soundcard.h not found in $oss4_includedir])) + + CPPFLAGS="$save_CPPFLAGS" +fi + AM_CONDITIONAL(COND_ALSA, test x$use_alsa = xtrue) +AM_CONDITIONAL(COND_OSS4, test x$use_oss4 = xtrue) +AC_SUBST(OSS4CPPFLAGS) AC_CHECK_SIZEOF(void *) diff --git a/src/Makefile.am b/src/Makefile.am index d83657b0..cefa95c6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,10 @@ if COND_ALSA ALSASRC=laudio_alsa.c endif +if COND_OSS4 +OSS4SRC=laudio_oss4.c +endif + ANTLR_GRAMMARS = \ RSP.g RSP2SQL.g \ DAAP.g DAAP2SQL.g @@ -29,7 +33,7 @@ ANTLR_SOURCES = \ ANTLR_PRODUCTS = -forked_daapd_CPPFLAGS = -D_GNU_SOURCE @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @FFMPEG_CFLAGS@ @CONFUSE_CFLAGS@ @TAGLIB_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ @LIBGCRYPT_CFLAGS@ @ALSA_CFLAGS@ \ +forked_daapd_CPPFLAGS = -D_GNU_SOURCE @AVAHI_CFLAGS@ @SQLITE3_CFLAGS@ @FFMPEG_CFLAGS@ @CONFUSE_CFLAGS@ @TAGLIB_CFLAGS@ @MINIXML_CFLAGS@ @LIBPLIST_CFLAGS@ @LIBGCRYPT_CFLAGS@ @ALSA_CFLAGS@ @OSS4CPPFLAGS@ \ -DDATADIR="\"$(pkgdatadir)\"" -DCONFDIR="\"$(sysconfdir)\"" -DSTATEDIR="\"$(localstatedir)\"" forked_daapd_LDADD = @AVAHI_LIBS@ @SQLITE3_LIBS@ @FFMPEG_LIBS@ @CONFUSE_LIBS@ @FLAC_LIBS@ @TAGLIB_LIBS@ @LIBEVENT_LIBS@ @LIBAVL_LIBS@ @MINIXML_LIBS@ @ANTLR3C_LIBS@ @LIBPLIST_LIBS@ @LIBGCRYPT_LIBS@ @ALSA_LIBS@ @@ -56,7 +60,7 @@ forked_daapd_SOURCES = main.c \ rsp_query.c rsp_query.h \ daap_query.c daap_query.h \ player.c player.h \ - $(ALSASRC) laudio.h \ + $(ALSASRC) $(OSS4SRC) laudio.h \ raop.c raop.h \ evrtsp/rtsp.c evrtp/evrtsp.h \ evrtsp/rtsp-internal.h evrtsp/log.h \