From 22caf3d448ea1ba0c181646d0296e394efead1f3 Mon Sep 17 00:00:00 2001 From: Gitea Date: Sun, 4 Oct 2020 18:47:51 +0000 Subject: [PATCH] Makefile.am,configure.ac,main.cpp : Added use of cwWEB in autoconfig. --- Makefile.am | 12 ++++++++++++ configure.ac | 45 ++++++++++++++++++++++++++++++++------------- src/cwtest/main.cpp | 13 +++++++++++++ 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/Makefile.am b/Makefile.am index 69706a8..7bfa767 100644 --- a/Makefile.am +++ b/Makefile.am @@ -45,6 +45,18 @@ endif endif +if cwWEB + FFT_DIR = $(HOME)/src/fftw-3.3.8/build + FFT_DIR_D = $(FFT_DIR)/d + FFT_DIR_S = $(FFT_DIR)/s + + AM_CXXFLAGS += --std=c++11 + AM_CPPFLAGS += -I$(FFT_DIR)/include -I$(FFT_DIR_D)/include -I$(FFT_DIR_S)/include + AM_LDFLAGS += -L$(FFT_DIR)/lib -L$(FFT_DIR_D)/lib -L$(FFT_DIR_S)/lib +else + AM_CXXFLAGS += --std=c++17 +endif + include src/libcw/Makefile.am libcw_la_SOURCES = $(libcwSRC) $(libcwHDR) diff --git a/configure.ac b/configure.ac index d49baae..9a8fb49 100644 --- a/configure.ac +++ b/configure.ac @@ -125,24 +125,43 @@ echo "alsa=${alsa}" # check for C++17 -hasCpp17=true -AX_CHECK_COMPILE_FLAG(-std=c++17, [CXXFLAGS="$CXXFLAGS -std=c++17"],[hasCpp17=false]) -if test x"$hasCpp17" = xtrue; then -AC_DEFINE([cwCPP17], 1,[C++ 17 is available.]) -else +# hasCpp17=true +# AX_CHECK_COMPILE_FLAG(-std=c++17, [CXXFLAGS="$CXXFLAGS -std=c++17"],[hasCpp17=false]) +# if test x"$hasCpp17" = xtrue; then +# AC_DEFINE([cwCPP17], 1,[C++ 17 is available.]) +# else # C++17 is not available check for C++11 -hasCpp11=true -AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS="$CXXFLAGS -std=c++11"], [hasCpp11=false]) -if test x"$hasCpp11" = xtrue; then -AC_DEFINE([cwCPP11], 1,[C++ 11 is available.]) +# hasCpp11=true +# AX_CHECK_COMPILE_FLAG([-std=c++11], [CXXFLAGS="$CXXFLAGS -std=c++11"], [hasCpp11=false]) +# if test x"$hasCpp11" = xtrue; then +# AC_DEFINE([cwCPP11], 1,[C++ 11 is available.]) +# fi +# echo "c++11=${hasCpp11}" + +#fi +#echo "c++17=${hasCpp17}" + +# +# Enable ALSA +# + +AC_ARG_ENABLE([web], + [ --enable-web Include WEB dependencies], + [case "${enableval}" in + yes) web=true ;; + no) web=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-web]) ;; + esac],[web=false]) + + +if test x"$web" = xtrue; then +AC_DEFINE([cwWEB], 1,[Use libweb.]) fi -echo "c++11=${hasCpp11}" - -fi -echo "c++17=${hasCpp17}" +AM_CONDITIONAL([cwWEB], [test x$web = xtrue]) +echo "web=${web}" # AC_ARG_ENABLE([add_lib], diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 248c075..e3c38f7 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -51,8 +51,11 @@ #include "cwIoTest.h" #endif +#if defined(cwWeb) #include "cwDataSets.h" #include "cwSvg.h" +#endif + #include "cwAudioFile.h" #include "cwAudioFileOps.h" @@ -542,6 +545,15 @@ cw::rc_t sockMgrTest( const cw::object_t* cfg, const cw::object_t* args, int arg return rc; } +#if defined(cwWEB) +cw::rc_t _no_c11() { return cwLogError(cw::kResourceNotAvailableRC,"C++11 functionality not included in this build."); } + +cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_c11(); } +cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_c11(); } +cw::rc_t svgTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_c11(); } + +#else + cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { char* inDir = requiredExistingDir( args, "inDir"); @@ -564,6 +576,7 @@ cw::rc_t svgTest( const cw::object_t* cfg, const cw::object_t* args, int argc, cw::mem::release(cssFn); return rc; } +#endif cw::rc_t dirEntryTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) {