From eaf1c41bde2b58446697360af454266c4dc594a4 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 25 Dec 2016 21:58:24 +0100 Subject: Add -ffast-math configure option --- INSTALL | 2 ++ Makefile.am | 12 +++--------- configure.ac | 30 ++++++++++++++++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/INSTALL b/INSTALL index 8e529a6..e0c7bd4 100644 --- a/INSTALL +++ b/INSTALL @@ -25,6 +25,8 @@ The configure script can be launch with a variety of options: --disable-zeromq Disable ZeroMQ input (to be used with ODR-DabMux), output and remotecontrol. --disable-output-uhd Disable the binding to the UHD driver for USRPs + --enable-fast-math Compile using the -ffast-math option that gives a substantial + speedup at the cost of correctness. Debugging options: You should not enable debug if you need good performance. By default, debug is disabled. diff --git a/Makefile.am b/Makefile.am index c52405e..a778975 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Copyright (C) 2007, 2008, 2009, 2010 Her Majesty the Queen in Right # of Canada (Communications Research Center Canada) # -# Copyright (C) 2014, 2015 +# Copyright (C) 2016 # Matthias P. Braendli, matthias.braendli@mpb.li # http://opendigitalradio.org @@ -31,20 +31,14 @@ else GITVERSION_FLAGS = endif -if DEBUG -DEBUG_FLAGS = -DDEBUG -else -DEBUG_FLAGS = -endif - bin_PROGRAMS = odr-dabmod FFT_LDADD= odr_dabmod_CXXFLAGS = -Wall -Isrc -std=c++11 \ - $(GITVERSION_FLAGS) $(DEBUG_FLAGS) + $(GITVERSION_FLAGS) odr_dabmod_CFLAGS = -Wall -Isrc \ - $(GITVERSION_FLAGS) $(DEBUG_FLAGS) + $(GITVERSION_FLAGS) odr_dabmod_LDADD = $(FFT_LDADD) odr_dabmod_SOURCES = src/DabMod.cpp \ src/PcDebug.h \ diff --git a/configure.ac b/configure.ac index f0688c8..ed35cdd 100644 --- a/configure.ac +++ b/configure.ac @@ -28,8 +28,6 @@ AC_CONFIG_SRCDIR([src/DabMod.cpp]) AM_CONFIG_HEADER([config.h]) AM_SILENT_RULES([yes]) -ACLOCAL_AMFLAGS = -I m4 - case $target_cpu in x86_64) AC_DEFINE([__64BIT__], [], [__16BIT__, __32BIT__]) @@ -56,6 +54,9 @@ AC_ARG_ENABLE([debug], AC_ARG_ENABLE([prof], [AS_HELP_STRING([--enable-prof], [Enable profiling])], [], [enable_prof=no]) +AC_ARG_ENABLE([fast-math], + [AS_HELP_STRING([--enable-fast-math], [Set -ffast-math])], + [], [enable_fast_math=no]) AC_ARG_WITH([debug-malloc], [AS_HELP_STRING([--with-debug-malloc[=no|yes|duma|efence|...]], [Add malloc debugger support])], @@ -79,16 +80,26 @@ PKG_CHECK_MODULES([FFTW], [fftw3f], enable_fftw=yes, enable_fftw=no) echo "Checking zeromq" AS_IF([test "x$enable_zeromq" = "xyes"], - [AC_DEFINE(HAVE_ZEROMQ, [1], [Define if ZeroMQ is enabled]) , - AC_CHECK_LIB(zmq, zmq_init, ZMQ_LIBS="-lzmq" ,[AC_MSG_ERROR([ZeroMQ libzmq is required])])]) + [AC_CHECK_LIB([zmq], [zmq_init], [ZMQ_LIBS="-lzmq"], + [AC_MSG_ERROR([ZeroMQ libzmq is required])])]) + +AS_IF([test "x$enable_zeromq" = "xyes"], + [AC_DEFINE(HAVE_ZEROMQ, [1], [Define if ZeroMQ is enabled])]) + AS_IF([test "x$enable_debug" = "xno"], [EXTRA="$EXTRA -DNDEBUG"], [EXTRA="$EXTRA"]) + AS_IF([test "x$enable_prof" != "xno"], [EXTRA="$EXTRA -pg"]) +AS_IF([test "x$enable_fast_math" != "xno"], + [EXTRA="$EXTRA -ffast-math"]) + +AS_IF([test "x$enable_trace" != "xno"], + [EXTRA="$EXTRA -DDEBUG"]) + # Define conditionals for Makefile.am -AM_CONDITIONAL([DEBUG], [test "x$enable_trace" = "xyes"]) AM_CONDITIONAL([IS_GIT_REPO], [test -d '.git']) # Defines for config.h @@ -100,8 +111,11 @@ AC_SUBST([LIBS], ["$FFTW_LIBS $PTHREAD_LIBS $ZMQ_LIBS"]) # Checks for UHD. AS_IF([test "x$enable_output_uhd" = "xyes"], - [AC_DEFINE(HAVE_OUTPUT_UHD, [1], [Define if UHD output is enabled]) , - AC_CHECK_LIB([uhd], [main], [], [AC_MSG_ERROR([library uhd is missing])])]) + [AC_CHECK_LIB([uhd], [main], [], + [AC_MSG_ERROR([library uhd is missing])] )]) + +AS_IF([test "x$enable_output_uhd" = "xyes"], + [AC_DEFINE(HAVE_OUTPUT_UHD, [1], [Define if UHD output is enabled])]) AX_BOOST_BASE([1.55.0], [], AC_MSG_ERROR([BOOST 1.55 or later is required])) AC_CHECK_LIB([boost_system], [main], [], [AC_MSG_ERROR([library boost_system is missing])]) @@ -192,7 +206,7 @@ echo echo enabled="" disabled="" -for feat in with_debug_malloc has_sse +for feat in with_debug_malloc has_sse enable_fast_math do eval var=\$$feat AS_IF([test "x$var" != "xno"], -- cgit v1.2.3