minimodem: configure --with-alsa for ALSA instead of Pulseaudio

This commit is contained in:
Kamal Mostafa 2012-08-08 14:26:39 -07:00
parent e01ccb1d71
commit 95d7a87ce1
6 changed files with 68 additions and 10 deletions

View File

@ -21,6 +21,9 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 to enable ALSA support */
#undef USE_ALSA
/* Define to 1 to enable pulseaudio support */
#undef USE_PULSEAUDIO

26
configure vendored
View File

@ -656,6 +656,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
enable_dependency_tracking
with_alsa
with_pulseaudio
with_sndfile
'
@ -1294,6 +1295,7 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--without-alsa build without ALSA support
--without-pulseaudio build without pulseaudio support
--without-sndfile build without sndfile support
@ -3290,6 +3292,28 @@ fi
# fftw3f
deps_packages+=" fftw3f"
# ALSA
# Check whether --with-alsa was given.
if test "${with_alsa+set}" = set; then :
withval=$with_alsa;
fi
if test "x$with_alsa" != "xyes"; then :
# then
use_alsa=0
else
# else
use_alsa=1
with_pulseaudio=no # For now, ALSA precludes pulseaudio
deps_packages+=" alsa"
fi
cat >>confdefs.h <<_ACEOF
#define USE_ALSA $use_alsa
_ACEOF
# pulseaudio
# Check whether --with-pulseaudio was given.
@ -5026,11 +5050,13 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: minimodem 0.8.2 configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-alsa $with_alsa ($use_alsa)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
" >&5
$as_echo "minimodem 0.8.2 configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-alsa $with_alsa ($use_alsa)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
" >&6; }

View File

@ -33,6 +33,19 @@ AC_PROG_CC
# fftw3f
deps_packages+=" fftw3f"
# ALSA
AC_ARG_WITH([alsa],
AS_HELP_STRING([--without-alsa], [build without ALSA support]))
AS_IF([test "x$with_alsa" != "xyes"],
# then
use_alsa=0,
# else
use_alsa=1
with_pulseaudio=no # For now, ALSA precludes pulseaudio
deps_packages+=" alsa")
AC_DEFINE_UNQUOTED(USE_ALSA, $use_alsa,
[Define to 1 to enable ALSA support])
# pulseaudio
AC_ARG_WITH([pulseaudio],
AS_HELP_STRING([--without-pulseaudio], [build without pulseaudio support]))
@ -83,6 +96,7 @@ AC_OUTPUT
AC_MSG_RESULT([PKG_NAME PKG_VERSION configuration summary:
--with-pulseaudio $with_pulseaudio ($use_pulseaudio)
--with-alsa $with_alsa ($use_alsa)
--with-sndfile $with_sndfile ($use_sndfile)
deps_packages: $deps_packages
])

View File

@ -36,6 +36,7 @@ SIMPLEAUDIO_SRC = \
simpleaudio.c \
simple-tone-generator.c \
simpleaudio-pulse.c \
simpleaudio-alsa.c \
simpleaudio-sndfile.c
FSK_SRC = fsk.h fsk.c

View File

@ -68,7 +68,8 @@ PROGRAMS = $(bin_PROGRAMS)
am__objects_1 = baudot.$(OBJEXT)
am__objects_2 = fsk.$(OBJEXT)
am__objects_3 = simpleaudio.$(OBJEXT) simple-tone-generator.$(OBJEXT) \
simpleaudio-pulse.$(OBJEXT) simpleaudio-sndfile.$(OBJEXT)
simpleaudio-pulse.$(OBJEXT) simpleaudio-alsa.$(OBJEXT) \
simpleaudio-sndfile.$(OBJEXT)
am_minimodem_OBJECTS = minimodem.$(OBJEXT) $(am__objects_1) \
$(am__objects_2) $(am__objects_3)
minimodem_OBJECTS = $(am_minimodem_OBJECTS)
@ -218,6 +219,7 @@ SIMPLEAUDIO_SRC = \
simpleaudio.c \
simple-tone-generator.c \
simpleaudio-pulse.c \
simpleaudio-alsa.c \
simpleaudio-sndfile.c
FSK_SRC = fsk.h fsk.c
@ -311,6 +313,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fsk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/minimodem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple-tone-generator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio-alsa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio-pulse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio-sndfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simpleaudio.Po@am__quote@

View File

@ -372,17 +372,27 @@ main( int argc, char*argv[] )
if ( TX_mode == -1 )
TX_mode = 0;
#if !(USE_PULSEAUDIO || USE_SNDFILE)
#error At least one of {USE_PULSEAUDIO,USE_SNDFILE} must be enabled
#if !(USE_PULSEAUDIO || USE_ALSA || USE_SNDFILE)
#error At least one of {USE_PULSEAUDIO,USE_ALSA,USE_SNDFILE} must be enabled!
#endif
#if (USE_PULSEAUDIO && USE_ALSA)
#error For now, only one of {USE_PULSEAUDIO,USE_ALSA} can be enabled (FIXME)!
#endif
#if USE_PULSEAUDIO
#define simpleaudio_open_system_audio simpleaudio_open_stream_pulseaudio
#elif USE_ALSA
#define simpleaudio_open_system_audio simpleaudio_open_stream_alsa
#endif
if ( filename ) {
#if !USE_SNDFILE
fprintf(stderr, "E: This build of minimodem was configured without sndfile,\nE: so the --file flag is not supported.\n");
exit(1);
#endif
} else {
#if !USE_PULSEAUDIO
fprintf(stderr, "E: this build of minimodem was configured without pulseaudio,\nE: so only the --file mode is supported.\n");
#ifndef simpleaudio_open_system_audio
fprintf(stderr, "E: this build of minimodem was configured without system audio support,\nE: so only the --file mode is supported.\n");
exit(1);
#endif
}
@ -496,9 +506,10 @@ main( int argc, char*argv[] )
if ( ! sa_out )
return 1;
}
#if USE_PULSEAUDIO
#ifdef simpleaudio_open_system_audio
if ( ! sa_out )
sa_out = simpleaudio_open_stream_pulseaudio(SA_STREAM_PLAYBACK,
sa_out = simpleaudio_open_system_audio(SA_STREAM_PLAYBACK,
program_name, "output audio");
#endif
if ( ! sa_out )
@ -526,10 +537,10 @@ main( int argc, char*argv[] )
if ( ! sa )
return 1;
}
#if USE_PULSEAUDIO
#ifdef simpleaudio_open_system_audio
if ( ! sa )
sa = simpleaudio_open_stream_pulseaudio(SA_STREAM_RECORD,
program_name, "input audio");
sa = simpleaudio_open_system_audio(SA_STREAM_RECORD,
program_name, "input audio");
#endif
if ( !sa )
return 1;