configure.ac,Makefile.am,main.cpp,build.sh : Added --enable-alsa configure flag.

This commit is contained in:
kevin 2020-09-22 13:31:29 -04:00
parent b0b142059b
commit 11af53fff6
4 changed files with 49 additions and 10 deletions

View File

@ -39,7 +39,9 @@ if OS_64
AM_CFLAGS += -m64 AM_CFLAGS += -m64
endif endif
if cwALSA
AM_LDFLAGS += -Wl,-Bstatic -lasound -Wl,-Bdynamic AM_LDFLAGS += -Wl,-Bstatic -lasound -Wl,-Bdynamic
endif
endif endif
@ -53,7 +55,7 @@ include_HEADERS += $(libcwHDR)
src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp
# autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l # autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l
src_cwtest_cwtest_LDADD = libcw.la -lpthread src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl
if cwWEBSOCK if cwWEBSOCK
AM_CPPFLAGS += -I$(WS_DIR)/include AM_CPPFLAGS += -I$(WS_DIR)/include
@ -61,5 +63,6 @@ if cwWEBSOCK
src_cwtest_cwtest_LDADD += -lwebsockets src_cwtest_cwtest_LDADD += -lwebsockets
endif endif
# src_cwtest_cwtest_CPPFLAGS = -I$(srcdir)/src/libcw $(AM_CPPFLAGS) # src_cwtest_cwtest_CPPFLAGS = -I$(srcdir)/src/libcw $(AM_CPPFLAGS)
bin_PROGRAMS += src/cwtest/cwtest bin_PROGRAMS += src/cwtest/cwtest

View File

@ -13,9 +13,9 @@ cd ${curdir}
# 3) Run gprof /libtool --mode=execute gprof ./foo # 3) Run gprof /libtool --mode=execute gprof ./foo
# To enable websock: --enable-websock \ # To enable websock: --enable-websock \
# To enable alsa: --enable-alsa \
../../../configure --prefix=${curdir} \ ../../../configure --prefix=${curdir} --enable-debug --enable-alsa \
--enable-debug \
CFLAGS="-g -Wall" \ CFLAGS="-g -Wall" \
CXXFLAGS="-g -Wall" \ CXXFLAGS="-g -Wall" \
CPPFLAGS= \ CPPFLAGS= \

View File

@ -61,6 +61,9 @@ echo "OS='${ax_cv_os_type}'"
AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64]) AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64])
echo "ptr width='${ax_cv_os_64}'" echo "ptr width='${ax_cv_os_64}'"
#
# Enable Debug
#
AC_ARG_ENABLE([debug], AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging], [ --enable-debug Turn on debugging],
@ -78,7 +81,9 @@ if test x$debug = xfalse; then
AC_DEFINE([NDEBUG], 1,[Debugging off.]) AC_DEFINE([NDEBUG], 1,[Debugging off.])
fi fi
#
# Enable libwebsock
#
AC_ARG_ENABLE([websock], AC_ARG_ENABLE([websock],
[ --enable-websock Include websock dependencies], [ --enable-websock Include websock dependencies],
[case "${enableval}" in [case "${enableval}" in
@ -95,6 +100,25 @@ if test x"$websock" = xtrue; then
AC_DEFINE([cwWEBSOCK], 1,[Use libwebsock.]) AC_DEFINE([cwWEBSOCK], 1,[Use libwebsock.])
fi fi
#
# Enable ALSA
#
AC_ARG_ENABLE([alsa],
[ --enable-alsa Include ALSA dependencies],
[case "${enableval}" in
yes) alsa=true ;;
no) alsa=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-alsa]) ;;
esac],[alsa=false])
echo "alsa=${alsa}"
AM_CONDITIONAL([cwALSA], [test x$alsa = xtrue])
if test x"$alsa" = xtrue; then
AC_DEFINE([cwALSA], 1,[Use libalsa.])
fi
# AC_ARG_ENABLE([add_lib], # AC_ARG_ENABLE([add_lib],

View File

@ -27,10 +27,14 @@
#include "cwTime.h" #include "cwTime.h"
#include "cwMidi.h" #include "cwMidi.h"
#include "cwMidiPort.h"
#include "cwAudioDevice.h" #include "cwAudioDevice.h"
#if defined(cwALSA)
#include "cwMidiPort.h"
#include "cwAudioDeviceTest.h" #include "cwAudioDeviceTest.h"
#include "cwAudioDeviceAlsa.h" #include "cwAudioDeviceAlsa.h"
#endif
#include "cwAudioBuf.h" #include "cwAudioBuf.h"
#include "cwTcpSocket.h" #include "cwTcpSocket.h"
#include "cwTcpSocketSrv.h" #include "cwTcpSocketSrv.h"
@ -326,12 +330,8 @@ void threadTest( const cw::object_t* cfg, const cw::object_t* args, in
void spscBuf( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::spsc_buf::test(); } void spscBuf( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::spsc_buf::test(); }
void spscQueueTmpl( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::testSpScQueueTmpl(); } void spscQueueTmpl( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::testSpScQueueTmpl(); }
void serialPortSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::serialPortSrvTest(); } void serialPortSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::serialPortSrvTest(); }
void midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::midi::device::test();}
void textBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::textBuf::test(); } void textBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::textBuf::test(); }
void audioBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::buf::test(); } void audioBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::buf::test(); }
void audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::test( argc, argv ); }
void audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::alsa::report(); }
void audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::report(); }
void mtxTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::mtx::test(args); } void mtxTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::mtx::test(args); }
void audioFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audiofile::test(args); } void audioFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audiofile::test(args); }
void audioFileOp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::test(args); } void audioFileOp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::test(args); }
@ -355,6 +355,18 @@ void uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const
#endif #endif
#if defined(cwALSA)
void midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::midi::device::test();}
void audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::test( argc, argv ); }
void audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::alsa::report(); }
void audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::report(); }
#else
void _no_alsa() { cwLogError(cw::kResourceNotAvailableRC,"ALSA based functionality not included in this build."); }
void midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_alsa();}
void audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_alsa(); }
void audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_alsa(); }
void audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_alsa(); }
#endif
void socketTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) void socketTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ {