From 1a16a3d5d8ad270cbb629d5cf37b925831a37698 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 20 Jul 2020 15:40:31 -0400 Subject: [PATCH] configure.ac,Makefile.am,build.sh : Updated to use external libcm. --- Makefile.am | 46 ++++++++++++++++++++------------------ build/linux/debug/build.sh | 4 ++-- configure.ac | 27 +++++++++++++++++++--- 3 files changed, 50 insertions(+), 27 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9b738af..70beeea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,24 +1,29 @@ +AM_CXXFLAGS = +AM_LDFLAGS = +AM_CPPFLAGS = +AM_CFLAGS = + ACLOCAL_AMFLAGS = -I m4 # use custom macro's in ./m4 -lib_LTLIBRARIES= -bin_PROGRAMS= -include_HEADERS= +# if we are building and linking to a nested copy of libcm +if BUILD_LIBCM +SUBDIRS = src/libcm +AM_CPPFLAGS += -I$(srcdir)/src/libcm/src -I$(srcdir)/src/libcm/src/dsp -I$(srcdir)/src/libcm/src/vop -I$(srcdir)/src/libcm/src/app +AM_LDFLAGS += -Lsrc/libcm/src +endif + +# To Profile w/ gprof: +# 1) Modify configure: ./configure --disable-shared CFLAGS="-pg" +# 2) Run the program. ./foo +# 3) Run gprof /libtool --mode=execute gprof ./foo # C compiler flags # _GNU_SOURCE - turns on GNU specific extensions and gives correct prototype for double log2(double) # -Wall turn on all warnings # -Wno-multichar - turns off multi-character constant warnings from cmAudioFile.c - - -AM_CPPFLAGS = -D _GNU_SOURCE -I.. -I$(srcdir)/src/libcm -I$(srcdir)/src/libcm/dsp -I$(srcdir)/src/libcm/vop -I$(srcdir)/src/libcm/app -AM_CPPFLAGS += -I$(srcdir)/src/libcmpp -I$(srcdir)/src/libcmpp/fltk -I$(srcdir)/src/tlCtl -AM_CFLAGS = -Wno-multichar -AM_CXXFLAGS = -AM_LDFLAGS = -MYLIBS = -lpthread -lfftw3f -lfftw3 -lfltk -lX11 -CMLIBS = src/libcm/libcm.la src/libcmpp/libcmpp.la # autoconfig manual recommends storing direct referenes to non-3rd party libraries rather than using -L and -l - +AM_CPPFLAGS += -D _GNU_SOURCE -I.. -I$(srcdir)/src/libcmpp -I$(srcdir)/src/libcmpp/fltk -I$(srcdir)/src/tlCtl +AM_CFLAGS += -Wno-multichar # debug/release switches if DEBUG @@ -29,6 +34,8 @@ else AM_CXXFLAGS += -O3 endif +MYLIBS = -lpthread -lfftw3f -lfftw3 -lfltk -lX11 -lcm + # NOTE: 10/25/12 The use of -Wl, -Bstatic -Wl, -Bdynamic forces linking # against the static version of 'libasound' and then turns dynamic linking # back on for the other libraries. @@ -53,15 +60,10 @@ if OS_OSX AM_LDFLAGS += -framework Cocoa -framework CoreAudio -framework CoreMIDI -framework Carbon -framework Accelerate endif -include src/libcm/Makefile.am -src_libcm_libcm_la_SOURCES = $(cmSRC) $(cmHDR) -include_HEADERS += $(cmHDR) -lib_LTLIBRARIES += src/libcm/libcm.la - include src/libcmpp/Makefile.am src_libcmpp_libcmpp_la_SOURCES = $(cmppSRC) $(cmppHDR) -include_HEADERS += $(cmppHDR) -lib_LTLIBRARIES += src/libcmpp/libcmpp.la +include_HEADERS = $(cmppHDR) +lib_LTLIBRARIES = src/libcmpp/libcmpp.la include src/tlCtl/Makefile.am src_kc_kc_SOURCES = $(tlCtlSRC) @@ -69,5 +71,5 @@ src_kc_kc_SOURCES = $(tlCtlSRC) src_kc_kc_SOURCES += src/kc/kcMain.cpp src_kc_kc_SOURCES += src/kc/kcApp.h src/kc/kcApp.cpp -src_kc_kc_LDADD = $(CMLIBS) $(MYLIBS) -bin_PROGRAMS += src/kc/kc +src_kc_kc_LDADD = src/libcmpp/libcmpp.la $(MYLIBS) +bin_PROGRAMS = src/kc/kc diff --git a/build/linux/debug/build.sh b/build/linux/debug/build.sh index b529293..5bfef5f 100755 --- a/build/linux/debug/build.sh +++ b/build/linux/debug/build.sh @@ -11,8 +11,8 @@ cd ${curdir} --enable-debug \ CFLAGS="-g -Wall" \ CXXFLAGS="-g -Wall" \ - CPPFLAGS= \ - LDFLAGS= \ + CPPFLAGS="-I/home/kevin/src/libcm/build/linux/debug/include " \ + LDFLAGS="-L/home/kevin/src/libcm/build/linux/debug/lib" \ LIBS= # --enable-sonicart \ diff --git a/configure.ac b/configure.ac index 1e61188..36a201a 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # this configure.ac or any of the Makefile.am files. # -AC_INIT([kc],[1.0],[kc@larke.org]) +AC_INIT([kc],[1.0],[kl@currawongproject.org]) AC_CONFIG_AUX_DIR([build-aux]) # put aux files in build-aux AM_INIT_AUTOMAKE([1.9 -Wall foreign subdir-objects]) # subdir-objects needed for non-recursive make AC_CONFIG_SRCDIR([src/kc/kcMain.cpp]) @@ -50,7 +50,6 @@ AC_CHECK_FUNCS([clock_gettime floor memmove memset mkdir pow rint select socket # be sure to also set "ACLOCAL_AMFLAGS = -I m4" in ./Makefile.am # Defines the config.h variable OS_LINUX or OS_OSX AX_FUNC_OS_TYPE - AX_FUNC_OS_64 # ac_cv_os_type is set by AX_FUNC_OS_TYPE @@ -61,6 +60,23 @@ echo "OS='${ax_cv_os_type}'" AM_CONDITIONAL([OS_64],[test x"${ax_cv_os_64}" == xx86_64]) echo "ptr width='${ax_cv_os_64}'" +# check if a request has been made to build libcm +AC_ARG_ENABLE([build_libcm], + [ --enable-build_libcm libcm is included in the local source tree], + [case "${enableval}" in + yes) build_libcm=true ;; + no) build_libcm=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-build_libcm]) ;; + esac],[build_libcm=false]) + +echo "build_libcm=${build_libcm}" + +# check if a nested copy of libcm exists in /src/libcm +AC_CHECK_FILE([${srcdir}/src/libcm/src/cmGlobal.h],[local_libcm=true],[local_libcm=false]) +echo "local_libcm=${local_libcm}" + +# set BUILD_LIBCM if a libcm build request was set and a nested copy of libcm exists +AM_CONDITIONAL([BUILD_LIBCM], [test x$build_libcm = xtrue -a x$local_libcm = xtrue ]) AC_ARG_ENABLE([debug], [ --enable-debug Turn on debugging], @@ -125,6 +141,11 @@ fi AM_CONDITIONAL([INC_SONICART], [test x$sonicart = xtrue]) - AC_CONFIG_FILES([ Makefile ]) + +# if local nested libcm then do recursive configure into subdirs +if test x$build_libcm = xtrue -a x$local_libcm = xtrue; then +AC_CONFIG_SUBDIRS([src/libcm]) +fi + AC_OUTPUT