From 75238b73742c37caab08bb7c6f3c2e49e13688fc Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 11 Oct 2020 15:35:12 -0400 Subject: [PATCH] configure.ac,Makefile.am,build.sh : Added cwFFTW library detection variable. --- Makefile.am | 15 +++++++++++++-- build/linux/debug/build.sh | 6 +++--- configure.ac | 14 ++++++++++---- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7bfa767..9e7bba1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,11 +46,14 @@ endif endif if cwWEB + + AM_CXXFLAGS += --std=c++11 + 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 @@ -68,7 +71,15 @@ src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp # 1) autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l # 2) -ldl is required for dlopen(),dlclose() ... -src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl -lfftw3 -lfftw3f +src_cwtest_cwtest_LDADD = libcw.la -lpthread -ldl + +if cwFFTW + src_cwtest_cwtest_LDADD += -lfftw3 -lfftw3f +endif + +if cwWEB + src_cwtest_cwtest_LDADD += -lfftw3 -lfftw3f +endif if cwWEBSOCK AM_CPPFLAGS += -I$(WS_DIR)/include diff --git a/build/linux/debug/build.sh b/build/linux/debug/build.sh index b9a24a8..74c8774 100755 --- a/build/linux/debug/build.sh +++ b/build/linux/debug/build.sh @@ -15,11 +15,11 @@ cd ${curdir} # To enable websock: --enable-websock \ # To enable alsa: --enable-alsa \ -../../../configure --prefix=${curdir} --enable-debug --enable-alsa \ +../../../configure --prefix=${curdir} --enable-debug --enable-alsa \ CFLAGS="-g -Wall" \ CXXFLAGS="-g -Wall" \ -CPPFLAGS= \ -LDFLAGS= \ +CPPFLAGS="-I${HOME}/sdk/libwebsockets/build/out/include" \ +LDFLAGS="-L${HOME}/sdk/libwebsockets/build/out/lib" \ LIBS= diff --git a/configure.ac b/configure.ac index 9a8fb49..189b6e5 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,6 @@ AC_PROG_CXX AM_PROG_CC_C_O -# Checks for libraries. -# AC_CHECK_LIB([cairo],[cairo_debug_reset_static_data],[AC_MSG_RESULT([The 'cairo' library was found.])],[AC_MSG_ERROR([The 'cairo' library was not found.])]) -#TODO: add more library checks - # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h fcntl.h float.h limits.h mach/mach.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h termios.h unistd.h]) @@ -46,6 +42,16 @@ AC_FUNC_REALLOC AC_FUNC_STRTOD AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket sqrt strcasecmp strchr strcspn strerror strspn strstr strtol]) +# Checks for libraries. +fftw=false +AC_CHECK_LIB([fftw3],[fftw_malloc],[fftw=true],[]) +AM_CONDITIONAL([cwFFTW],[test x"${fftw}" = xtrue]) + +if test x"$fftw" = xtrue; then +AC_DEFINE([cwFFTW], 1,[Use libfftw3.]) +fi + +echo "fftw='${fftw}'" # The following is a custom macro in ./m4/os_type.m4 # be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am