aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2018-01-21 10:43:45 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2018-01-21 11:19:30 +0100
commitd0e74bacf3a9129d0d2c6482d141d24528f5ca93 (patch)
tree56d9e8fd3378ee1ac9573c6f4e9d75c86dd33a54
parent8877729048f4de34229769c13c1e0e72f57bd0a0 (diff)
Make sound card support (Alsa) optional
-rw-r--r--configure.ac6
-rw-r--r--src/Makefile.am6
-rw-r--r--src/amps/Makefile.am8
-rw-r--r--src/anetz/Makefile.am8
-rw-r--r--src/bnetz/Makefile.am8
-rw-r--r--src/cnetz/Makefile.am8
-rw-r--r--src/jolly/Makefile.am8
-rw-r--r--src/jtacs/Makefile.am8
-rw-r--r--src/libmncc/Makefile.am5
-rw-r--r--src/libmncc/mncc_console.c17
-rw-r--r--src/libmobile/Makefile.am4
-rw-r--r--src/libmobile/sender.c6
-rw-r--r--src/libmobile/sender.h2
-rw-r--r--src/libsdr/sdr.h2
-rw-r--r--src/libsound/Makefile.am2
-rw-r--r--src/nmt/Makefile.am8
-rw-r--r--src/r2000/Makefile.am8
-rw-r--r--src/tacs/Makefile.am8
-rw-r--r--src/test/Makefile.am16
19 files changed, 112 insertions, 26 deletions
diff --git a/configure.ac b/configure.ac
index ccf4daf..0ae3f5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,8 +27,6 @@ AC_CANONICAL_HOST
AC_CHECK_LIB([m], [main])
AC_CHECK_LIB([pthread], [main])
-PKG_CHECK_MODULES(ALSA, alsa >= 1.0)
-
# disabled due to problems with api compatibilty with imagemagick
#AC_ARG_ENABLE(graphicsmagick,
# [AS_HELP_STRING(
@@ -63,13 +61,17 @@ fi
AM_CONDITIONAL(ENABLE_MAGICK, test x"$somethingmagick" = x"yes")
with_sdr=no
+AC_ARG_WITH([alsa], [AS_HELP_STRING([--with-alsa], [compile with Alsa driver @<:@default=check@:>@]) ], [], [with_alsa="check"])
AC_ARG_WITH([uhd], [AS_HELP_STRING([--with-uhd], [compile with UHD driver @<:@default=check@:>@]) ], [], [with_uhd="check"])
AC_ARG_WITH([soapy], [AS_HELP_STRING([--with-soapy], [compile with SoapySDR driver @<:@default=check@:>@]) ], [], [with_soapy="check"])
+AS_IF([test "x$with_alsa" != xno], [PKG_CHECK_MODULES(ALSA, alsa >= 1.0, with_alsa=yes, with_alsa=no)])
AS_IF([test "x$with_uhd" != xno], [PKG_CHECK_MODULES(UHD, uhd >= 3.0.0, with_sdr=yes with_uhd=yes, with_uhd=no)])
AS_IF([test "x$with_soapy" != xno], [PKG_CHECK_MODULES(SOAPY, SoapySDR >= 0.6.0, with_sdr=yes with_soapy=yes, with_soapy=no)])
+AM_CONDITIONAL(HAVE_ALSA, test "x$with_alsa" == "xyes" )
AM_CONDITIONAL(HAVE_UHD, test "x$with_uhd" == "xyes" )
AM_CONDITIONAL(HAVE_SOAPY, test "x$with_soapy" == "xyes" )
AM_CONDITIONAL(HAVE_SDR, test "x$with_sdr" == "xyes" )
+AS_IF([test "x$with_alsa" == "xyes"],[AC_MSG_NOTICE( Compiling with Alsa support )], [AC_MSG_NOTICE( Alsa sound card not supported. Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. )])
AS_IF([test "x$with_uhd" == "xyes"],[AC_MSG_NOTICE( Compiling with UHD SDR support )], [AC_MSG_NOTICE( UHD SDR not supported. Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. )])
AS_IF([test "x$with_soapy" == "xyes"],[AC_MSG_NOTICE( Compiling with SoapySDR support )], [AC_MSG_NOTICE( SoapySDR not supported. Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. )])
AS_IF([test "x$somethingmagick" == "xyes"],[AC_MSG_NOTICE( Compiling with ImageMagick )],[AC_MSG_NOTICE( ImageMagick not supported )])
diff --git a/src/Makefile.am b/src/Makefile.am
index cc9c829..197ec5b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,8 +22,12 @@ SUBDIRS = \
libfilter \
libwave \
libfft \
- libmncc \
+ libmncc
+
+if HAVE_ALSA
+SUBDIRS += \
libsound
+endif
if HAVE_SDR
SUBDIRS += \
diff --git a/src/amps/Makefile.am b/src/amps/Makefile.am
index 35f8b67..9bc972f 100644
--- a/src/amps/Makefile.am
+++ b/src/amps/Makefile.am
@@ -38,11 +38,15 @@ amps_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+amps_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
amps_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/anetz/Makefile.am b/src/anetz/Makefile.am
index ba993aa..175404d 100644
--- a/src/anetz/Makefile.am
+++ b/src/anetz/Makefile.am
@@ -30,11 +30,15 @@ anetz_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+anetz_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
anetz_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/bnetz/Makefile.am b/src/bnetz/Makefile.am
index 24da3fe..e00c026 100644
--- a/src/bnetz/Makefile.am
+++ b/src/bnetz/Makefile.am
@@ -27,11 +27,15 @@ bnetz_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+bnetz_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
bnetz_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/cnetz/Makefile.am b/src/cnetz/Makefile.am
index 64c5a87..ab7cf09 100644
--- a/src/cnetz/Makefile.am
+++ b/src/cnetz/Makefile.am
@@ -29,11 +29,15 @@ cnetz_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+cnetz_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
cnetz_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/jolly/Makefile.am b/src/jolly/Makefile.am
index 7afe84d..e36515f 100644
--- a/src/jolly/Makefile.am
+++ b/src/jolly/Makefile.am
@@ -24,12 +24,16 @@ jollycom_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
$(top_builddir)/src/libfm/libfm.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+jollycom_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
jollycom_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/jtacs/Makefile.am b/src/jtacs/Makefile.am
index 70b7587..f2b051b 100644
--- a/src/jtacs/Makefile.am
+++ b/src/jtacs/Makefile.am
@@ -24,11 +24,15 @@ jtacs_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+jtacs_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
jtacs_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/libmncc/Makefile.am b/src/libmncc/Makefile.am
index 7881872..491a3ef 100644
--- a/src/libmncc/Makefile.am
+++ b/src/libmncc/Makefile.am
@@ -8,3 +8,8 @@ libmncc_a_SOURCES = \
mncc_sock.c \
testton.c \
cause.c
+
+if HAVE_ALSA
+AM_CPPFLAGS += -DHAVE_ALSA
+endif
+
diff --git a/src/libmncc/mncc_console.c b/src/libmncc/mncc_console.c
index 72ce21c..912f339 100644
--- a/src/libmncc/mncc_console.c
+++ b/src/libmncc/mncc_console.c
@@ -33,7 +33,9 @@
#include "mncc_console.h"
#include "cause.h"
#include "../libmobile/call.h"
+#ifdef HAVE_ALSA
#include "../libsound/sound.h"
+#endif
static int new_callref = 0; /* toward mobile */
@@ -289,11 +291,12 @@ error:
return rc;
}
-int console_open_audio(int latspl)
+int console_open_audio(int __attribute__((unused)) latspl)
{
if (!console.audiodev[0])
return 0;
+#ifdef HAVE_ALSA
/* open sound device for call control */
/* use factor 1.4 of speech level for complete range of sound card */
console.sound = sound_open(console.audiodev, NULL, NULL, 1, 0.0, console.samplerate, latspl, 1.4, 4000.0);
@@ -301,6 +304,10 @@ int console_open_audio(int latspl)
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
return -EIO;
}
+#else
+ PDEBUG(DSENDER, DEBUG_ERROR, "No sound card support compiled in!\n");
+ return -ENOTSUP;
+#endif
return 0;
}
@@ -310,14 +317,20 @@ int console_start_audio(void)
if (!console.audiodev[0])
return 0;
+#ifdef HAVE_ALSA
return sound_start(console.sound);
+#else
+ return -EINVAL;
+#endif
}
void console_cleanup(void)
{
+#ifdef HAVE_ALSA
/* close sound devoice */
if (console.sound)
sound_close(console.sound);
+#endif
jitter_destroy(&console.dejitter);
}
@@ -428,6 +441,7 @@ void process_console(int c)
if (!console.sound)
return;
+#ifdef HAVE_ALSA
/* handle audio, if sound device is used */
sample_t samples[console.latspl + 10], *samples_list[1];
uint8_t *power_list[1];
@@ -487,5 +501,6 @@ void process_console(int c)
}
}
}
+#endif
}
diff --git a/src/libmobile/Makefile.am b/src/libmobile/Makefile.am
index 045d548..f75cfe5 100644
--- a/src/libmobile/Makefile.am
+++ b/src/libmobile/Makefile.am
@@ -7,6 +7,10 @@ libmobile_a_SOURCES = \
call.c \
main_mobile.c
+if HAVE_ALSA
+AM_CPPFLAGS += -DHAVE_ALSA
+endif
+
if HAVE_SDR
AM_CPPFLAGS += -DHAVE_SDR
endif
diff --git a/src/libmobile/sender.c b/src/libmobile/sender.c
index 728fa46..b309c4d 100644
--- a/src/libmobile/sender.c
+++ b/src/libmobile/sender.c
@@ -115,12 +115,18 @@ int sender_create(sender_t *sender, int kanal, double sendefrequenz, double empf
} else
#endif
{
+#ifdef HAVE_ALSA
sender->audio_open = sound_open;
sender->audio_start = sound_start;
sender->audio_close = sound_close;
sender->audio_read = sound_read;
sender->audio_write = sound_write;
sender->audio_get_tosend = sound_get_tosend;
+#else
+ PDEBUG(DSENDER, DEBUG_ERROR, "No sound card support compiled in!\n");
+ rc = -ENOTSUP;
+ goto error;
+#endif
}
}
diff --git a/src/libmobile/sender.h b/src/libmobile/sender.h
index 1bcb1c0..6591f35 100644
--- a/src/libmobile/sender.h
+++ b/src/libmobile/sender.h
@@ -1,4 +1,6 @@
+#ifdef HAVE_ALSA
#include "../libsound/sound.h"
+#endif
#ifdef HAVE_SDR
#include "../libsdr/sdr.h"
#endif
diff --git a/src/libsdr/sdr.h b/src/libsdr/sdr.h
index 360f424..8d31475 100644
--- a/src/libsdr/sdr.h
+++ b/src/libsdr/sdr.h
@@ -1,4 +1,6 @@
+enum paging_signal;
+
int sdr_start(void *inst);
void *sdr_open(const char *audiodev, double *tx_frequency, double *rx_frequency, int channels, double paging_frequency, int samplerate, int latspl, double bandwidth, double sample_deviation);
void sdr_close(void *inst);
diff --git a/src/libsound/Makefile.am b/src/libsound/Makefile.am
index ffa876f..afbbb0a 100644
--- a/src/libsound/Makefile.am
+++ b/src/libsound/Makefile.am
@@ -4,3 +4,5 @@ noinst_LIBRARIES = libsound.a
libsound_a_SOURCES = \
sound_alsa.c
+
+AM_CPPFLAGS += -DHAVE_ALSA
diff --git a/src/nmt/Makefile.am b/src/nmt/Makefile.am
index ac5c2eb..cee6953 100644
--- a/src/nmt/Makefile.am
+++ b/src/nmt/Makefile.am
@@ -38,11 +38,15 @@ nmt_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+nmt_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
nmt_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/r2000/Makefile.am b/src/r2000/Makefile.am
index f9a3a6a..9500a2c 100644
--- a/src/r2000/Makefile.am
+++ b/src/r2000/Makefile.am
@@ -26,11 +26,15 @@ radiocom2000_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+radiocom2000_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
radiocom2000_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/tacs/Makefile.am b/src/tacs/Makefile.am
index 3cdc017..ec9b593 100644
--- a/src/tacs/Makefile.am
+++ b/src/tacs/Makefile.am
@@ -25,11 +25,15 @@ tacs_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+tacs_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
tacs_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
diff --git a/src/test/Makefile.am b/src/test/Makefile.am
index 82bb8c7..5f7a86e 100644
--- a/src/test/Makefile.am
+++ b/src/test/Makefile.am
@@ -66,11 +66,15 @@ test_dms_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+test_dms_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
test_dms_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \
@@ -95,11 +99,15 @@ test_sms_LDADD = \
$(top_builddir)/src/libfilter/libfilter.a \
$(top_builddir)/src/libwave/libwave.a \
$(top_builddir)/src/libmncc/libmncc.a \
- $(top_builddir)/src/libsound/libsound.a \
$(top_builddir)/src/libsample/libsample.a \
- $(ALSA_LIBS) \
-lm
+if HAVE_ALSA
+test_sms_LDADD += \
+ $(top_builddir)/src/libsound/libsound.a \
+ $(ALSA_LIBS)
+endif
+
if HAVE_SDR
test_sms_LDADD += \
$(top_builddir)/src/libsdr/libsdr.a \