- make OSS backend optional
- make OSS backend optional
diff --git a/configure.in b/configure.in
index e872756..8d3ae94 100644
--- a/configure.in
+++ b/configure.in
@@ -69,6 +69,22 @@ if test "x$usejack" = "xyes"; then
CFLAGS="$CFLAGS -DJACK"
fi
+useoss=yes
+
+AC_ARG_ENABLE(
+ oss,
+ AC_HELP_STRING([--enable-oss], [use OSS @<:@default=yes@:>@]),
+ [
+ if test "x$enableval" = "xno"; then
+ useoss=no
+ fi
+ ])
+
+AM_CONDITIONAL(HAVE_OSS, test "x$useoss" = "xyes")
+
+if test "x$useoss" = "xyes"; then
+ CFLAGS="$CFLAGS -DOSS"
+fi
PKG_CHECK_MODULES([GLADE], [libglade-2.0])
AC_SUBST(GLADE_CFLAGS)
diff --git a/src/lingot-audio-oss.c b/src/lingot-audio-oss.c
index ee43ae6..1e1b998 100644
--- a/src/lingot-audio-oss.c
+++ b/src/lingot-audio-oss.c
@@ -20,11 +20,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifdef OSS
#include <sys/soundcard.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/errno.h>
+#endif
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
@@ -38,6 +40,9 @@
LingotAudioHandler* lingot_audio_oss_new(char* device, int sample_rate) {
+ LingotAudioHandler* audio = NULL;
+
+#ifdef OSS
int channels = 1;
int format = SAMPLE_FORMAT;
char error_message[100];
@@ -107,17 +112,25 @@ LingotAudioHandler* lingot_audio_oss_new(char* device, int sample_rate) {
lingot_msg_add_error(exception);
}
+# else
+ lingot_msg_add_error(
+ _("The application has not been built with OSS support"));
+# endif
+
return audio;
}
void lingot_audio_oss_destroy(LingotAudioHandler* audio) {
+#ifdef OSS
if (audio != NULL) {
close(audio->dsp);
free(audio->read_buffer);
}
+#endif
}
int lingot_audio_oss_read(LingotAudioHandler* audio) {
+#ifdef OSS
int i;
int read_size;
@@ -140,6 +153,8 @@ int lingot_audio_oss_read(LingotAudioHandler* audio) {
audio->flt_read_buffer[i] = audio->read_buffer[i];
}
+#endif
+
return 0;
}
diff --git a/src/lingot-core.c b/src/lingot-core.c
index 0d5c31f..d5883c4 100644
--- a/src/lingot-core.c
+++ b/src/lingot-core.c
@@ -22,7 +22,9 @@
#include <stdio.h>
#include <math.h>
+#ifdef OSS
#include <sys/soundcard.h>
+#endif
#include <string.h>
#include <errno.h>
#include <sys/time.h>