From 708f1d7e0b22c17f49d493396a8f010333c07926 Mon Sep 17 00:00:00 2001 From: oparviai Date: Fri, 1 May 2015 07:55:47 +0000 Subject: [PATCH] Revised autoconf/automake scripts for easier adding of custom CXXFLAGS --- configure.ac | 22 ++++++++++++++-------- source/SoundStretch/Makefile.am | 2 +- source/SoundTouch/Makefile.am | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 5fd7868..e399dc5 100644 --- a/configure.ac +++ b/configure.ac @@ -113,7 +113,7 @@ fi if test "x$enable_openmp" = "xyes"; then echo "****** openmp optimizations enabled ******" - CXXFLAGS="-fopenmp $CXXFLAGS" + AM_CXXFLAGS="-fopenmp $AM_CXXFLAGS" else echo "****** openmp optimizations disabled ******" fi @@ -123,10 +123,9 @@ fi if test "x$enable_x86_optimizations" = "xyes" -a "x$ac_cv_header_cpuid_h" = "xyes"; then echo "****** x86 optimizations enabled ******" - original_saved_CXXFLAGS=$CXXFLAGS + original_saved_CXXFLAGS=$AM_CXXFLAGS have_mmx_intrinsics=no - OPT_CXXFLAGS="-mmmx -Winline" - CXXFLAGS="$OPT_CXXFLAGS $CXXFLAGS" + AM_CXXFLAGS="-mmmx -Winline $AM_CXXFLAGS" # Check if the user can compile MMX code using intrinsics. # GCC supports MMX intrinsics since version 3.3 @@ -140,7 +139,7 @@ if test "x$enable_x86_optimizations" = "xyes" -a "x$ac_cv_header_cpuid_h" = "xye __m64 loop = _mm_cvtsi32_si64 (1); return _mm_cvtsi64_si32 (loop); }]])],[have_mmx_intrinsics=yes]) - CXXFLAGS=$original_saved_CXXFLAGS + AM_CXXFLAGS=$original_saved_CXXFLAGS # Inform the user if we did or did not find MMX support. # @@ -157,9 +156,9 @@ if test "x$enable_x86_optimizations" = "xyes" -a "x$ac_cv_header_cpuid_h" = "xye fi + # SSE support have_sse_intrinsics=no - OPT_CXXFLAGS="-msse -Winline" - CXXFLAGS="$OPT_CXXFLAGS $CXXFLAGS" + AM_CXXFLAGS="-msse -Winline $AM_CXXFLAGS" # Check if the user can compile SSE code using intrinsics. # GCC supports SSE intrinsics since version 3.3 @@ -173,7 +172,7 @@ if test "x$enable_x86_optimizations" = "xyes" -a "x$ac_cv_header_cpuid_h" = "xye _mm_setzero_ps(); return 0; }]])],[have_sse_intrinsics=yes]) - CXXFLAGS=$original_saved_CXXFLAGS + AM_CXXFLAGS=$original_saved_CXXFLAGS # Inform the user if we did or did not find SSE support. # @@ -195,6 +194,13 @@ else AC_DEFINE([SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS],[1],[Do not use x86 optimizations]) fi +# Set AM_CXXFLAGS +AC_SUBST([AM_CXXFLAGS], [$AM_CXXFLAGS]) + +# Empty default CXXFLAGS so user can set them if desirable +AC_SUBST([CXXFLAGS], [ ]) + + # SSTypes.h by default enables optimizations. Those already got disabled if # the user requested for it or if the system does not support them. # diff --git a/source/SoundStretch/Makefile.am b/source/SoundStretch/Makefile.am index 0b4668f..6ed5146 100644 --- a/source/SoundStretch/Makefile.am +++ b/source/SoundStretch/Makefile.am @@ -48,7 +48,7 @@ soundstretch_LDADD=../SoundTouch/libSoundTouch.la -lm #soundstretch_LDFLAGS=-s ## additional compiler flags -soundstretch_CXXFLAGS=-O3 +soundstretch_CXXFLAGS=-O3 $(AM_CXXFLAGS) #clean-local: # -rm -f additional-files-to-remove-on-make-clean diff --git a/source/SoundTouch/Makefile.am b/source/SoundTouch/Makefile.am index 6dda197..7aff51c 100644 --- a/source/SoundTouch/Makefile.am +++ b/source/SoundTouch/Makefile.am @@ -34,7 +34,7 @@ libSoundTouch_la_SOURCES=AAFilter.cpp FIRFilter.cpp FIFOSampleBuffer.cpp \ InterpolateShannon.cpp # Compiler flags -AM_CXXFLAGS=-O3 -I../../include +AM_CXXFLAGS+=-O3 # Compile the files that need MMX and SSE individually. libSoundTouch_la_LIBADD=libSoundTouchMMX.la libSoundTouchSSE.la