[beast/temp-rc1] BUILD: cleanup and simplify compiler option selection in configure.ac



commit 14f6e08234ff25ce82f0952deba3587f7ecb7707
Author: Tim Janik <timj gnu org>
Date:   Fri Oct 17 04:17:49 2014 +0200

    BUILD: cleanup and simplify compiler option selection in configure.ac

 acbeast.m4   |  197 +++++++++------------------------------------------------
 configure.ac |  187 +++++++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 170 insertions(+), 214 deletions(-)
---
diff --git a/acbeast.m4 b/acbeast.m4
index 47e4931..751d96d 100644
--- a/acbeast.m4
+++ b/acbeast.m4
@@ -68,7 +68,7 @@ AC_DEFUN([MC_IF_VAR_EQ], [
 dnl # MC_STR_CONTAINS(src-string, sub-string [, contains-action] [, else-action])
 AC_DEFUN([MC_STR_CONTAINS], [
        case "[$1]" in
-       *"[$2]"*[)]
+       *"m4_bpatsubst([$2], ["], [\\"])"*[)]
                [$3]
                ;;
        *[)]
@@ -77,13 +77,13 @@ AC_DEFUN([MC_STR_CONTAINS], [
        esac
 ])
 
-dnl # MC_EVAR_ADD(environment-variable, check-string, add-string)
+dnl # MC_EVAR_ADD(environment-variable, find-or-add-string)
 AC_DEFUN([MC_EVAR_ADD], [
-       MC_STR_CONTAINS($[$1], [$2], [$1]="$[$1]", [$1]="$[$1] [$3]")
+       MC_STR_CONTAINS($[$1], [$2], :, [$1]="$[$1] [$2]")
 ])
 dnl # MC_EVAR_SUPPLEMENT(environment-variable, check-string, add-string)
 AC_DEFUN([MC_EVAR_SUPPLEMENT], [
-       MC_STR_CONTAINS($[$1], [$2], [$1]="$[$1] [$3]", [$1]="$[$1]")
+       MC_STR_CONTAINS($[$1], [$2], [$1]="$[$1] [$3]", :)
 ])
 
 
@@ -168,6 +168,33 @@ AC_DEFUN([MC_PKG_CONFIG_REQUIRE], [
     unset mc_VERSION
 ])
 
+dnl # MC_CC_TRY_OPTION(ENVVARIABLE, OPTION)
+dnl # Check whether CC accepts OPTION and add to ENVVARIABLE
+AC_DEFUN([MC_CC_TRY_OPTION], [
+AC_MSG_CHECKING([if ${CC-cc} supports [$2]])
+echo >conftest.c;
+if ${CC-cc} $CFLAGS [$2] -c conftest.c >/dev/null 2>&1 ; then
+    AC_MSG_RESULT(yes)
+    MC_STR_CONTAINS($[$1], [$2], :, [$1]="$[$1] [$2]")
+else
+    AC_MSG_RESULT(no)
+fi
+rm -fr conftest*
+])dnl
+dnl # MC_CXX_TRY_OPTION(ENVVARIABLE, OPTION)
+dnl # Check whether CXX accepts OPTION and add to ENVVARIABLE
+AC_DEFUN([MC_CXX_TRY_OPTION], [
+AC_MSG_CHECKING([if ${CXX-c++} supports [$2]])
+echo >conftest.c;
+if ${CXX-c++} $CXXFLAGS [$2] -c conftest.c >/dev/null 2>&1 ; then
+    AC_MSG_RESULT(yes)
+    MC_STR_CONTAINS($[$1], [$2], :, [$1]="$[$1] [$2]")
+else
+    AC_MSG_RESULT(no)
+fi
+rm -fr conftest*
+])dnl
+
 dnl # MC_PROG_CC_SUPPORTS_OPTION(OPTIONS, ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND])
 dnl # Check whether cc accepts a certain option
 AC_DEFUN([MC_PROG_CC_SUPPORTS_OPTION], [
@@ -182,165 +209,3 @@ else
 fi
 rm -fr conftest*
 ])dnl
-
-dnl # MC_PROG_CC_WITH_CFLAGS()
-dnl # Setup CC with default CFLAGS value.
-AC_DEFUN([MC_PROG_CC_WITH_CFLAGS], [
-       MC_IF_VAR_EQ(CFLAGS, "", CFLAGS="-g")
-       CFLAGS_saved="$CFLAGS"
-       unset CFLAGS
-       dnl Checks for compiler characteristics, CFLAGS.
-       AC_PROG_CC
-       MC_STR_CONTAINS($CFLAGS, -g, CFLAGS_include_g=yes)
-       MC_STR_CONTAINS($CFLAGS, -O, CFLAGS_include_O=yes)
-       CFLAGS="$CFLAGS_saved"
-
-       dnl Setup CFLAGS for debugging.
-       MC_IF_VAR_EQ(enable_debug, yes,
-               MC_IF_VAR_EQ(CFLAGS_include_g, yes,
-                       MC_EVAR_ADD(CFLAGS, -g, -g)
-               )
-               dnl Reading assembler Code
-               MC_IF_VAR_EQ(GCC, yes,
-                       dnl MC_EVAR_ADD(CFLAGS, -fvolatile-global, -fvolatile-global)
-                       dnl MC_EVAR_ADD(CFLAGS, -fverbose-asm, -fverbose-asm)
-               )
-       )
-
-       dnl Further setup CFLAGS for GCC.
-       MC_IF_VAR_EQ(GCC, yes,
-               dnl # Sane Behaviour
-               MC_EVAR_ADD(CFLAGS, -fno-cond-mismatch, -fno-cond-mismatch)
-               MC_PROG_CC_SUPPORTS_OPTION(-mcx16, MC_EVAR_ADD(CFLAGS, -mcx16, -mcx16))
-               MC_PROG_CC_SUPPORTS_OPTION(-rdynamic, MC_EVAR_ADD(CFLAGS, -rdynamic, -rdynamic))
-
-               dnl # Debugging
-               MC_EVAR_SUPPLEMENT(CFLAGS, -g, -ggdb3)
-
-               dnl # Warnings.
-               MC_EVAR_ADD(CFLAGS, -Wall, -Wall)
-               MC_EVAR_ADD(CFLAGS, -Wmissing-prototypes, -Wmissing-prototypes)
-               MC_EVAR_ADD(CFLAGS, -Wmissing-declarations, -Wmissing-declarations)
-               MC_EVAR_ADD(CFLAGS, -Wno-cast-qual, -Wno-cast-qual)
-               dnl MC_EVAR_ADD(CFLAGS, -Winline, -Winline)
-               MC_IF_VAR_EQ(enable_pedantic_ansi, yes,
-                   MC_EVAR_ADD(CFLAGS, -ansi, -ansi)
-                   MC_EVAR_ADD(CFLAGS, -pedantic, -pedantic)
-               )
-               dnl # avoid lots of bogus warnings with string pointers
-               MC_PROG_CC_SUPPORTS_OPTION(-Wno-pointer-sign,
-                 MC_EVAR_ADD(CFLAGS, -Wno-pointer-sign, -Wno-pointer-sign))
-               dnl problematic, triggers warnings in glibc headers
-               MC_EVAR_ADD(CFLAGS, -Wpointer-arith, -Wpointer-arith)
-               dnl problematic, warns on prototype arguments:
-               dnl MC_EVAR_ADD(CFLAGS, -Wshadow, -Wshadow)
-               dnl problematic, glibc breakage:
-               MC_EVAR_ADD(CFLAGS, -Wredundant-decls, -Wredundant-decls)
-               dnl instrument function workarounds
-               MC_STR_CONTAINS($CC $CFLAGS, -finstrument-functions,
-                               [mc_opt_warn_no_return=-Wno-missing-noreturn],
-                               [mc_opt_warn_no_return=-Wmissing-noreturn])
-               MC_PROG_CC_SUPPORTS_OPTION($mc_opt_warn_no_return,
-                     MC_EVAR_ADD(CFLAGS, $mc_opt_warn_no_return, $mc_opt_warn_no_return))
-
-               dnl # Optimizations
-               MC_EVAR_ADD(CFLAGS, -pipe, -pipe)
-               MC_EVAR_ADD(CFLAGS, -O, -O2)
-               MC_PROG_CC_SUPPORTS_OPTION(-ftracer,
-                   MC_EVAR_ADD(CFLAGS, -ftracer, -ftracer))
-               MC_EVAR_ADD(CFLAGS, -finline-functions, -finline-functions) dnl -O3 stuff as of gcc-3.3
-               MC_PROG_CC_SUPPORTS_OPTION(-fno-keep-static-consts,
-                   MC_EVAR_ADD(CFLAGS, -fno-keep-static-consts, -fno-keep-static-consts))
-               dnl MC_EVAR_ADD(CFLAGS, -freg-struct-return, -freg-struct-return) dnl buggy with gcc-3.2
-
-               dnl # Fun options
-               dnl MC_EVAR_ADD(CFLAGS, -Q, -Q) dnl report each compiled function
-               dnl MC_EVAR_ADD(CFLAGS, -ftime-report, -ftime-report)
-               dnl MC_EVAR_ADD(CFLAGS, -fmem-report, -fmem-report)
-       ,
-               MC_IF_VAR_EQ(CFLAGS_include_O, yes,
-                       MC_EVAR_ADD(CFLAGS, -O, -O2)
-               )
-       )
-])
-
-dnl # MC_PROG_CC_SPECIAL_FLAGS([VARNAME], [FLAG_LIST])
-AC_DEFUN([MC_PROG_CC_SPECIAL_FLAGS], [
-       for flag in [$2] ; do
-           MC_PROG_CC_SUPPORTS_OPTION($flag, MC_EVAR_ADD([$1], $flag, $flag))
-       done
-       AC_MSG_CHECKING([[$1]])
-       AC_MSG_RESULT($[$1])
-])
-
-dnl # MC_PROG_CXX_WITH_CXXFLAGS()
-dnl # Setup CXX with default CXXFLAGS value.
-AC_DEFUN([MC_PROG_CXX_WITH_CXXFLAGS], [
-       MC_IF_VAR_EQ(CXXFLAGS, "", CXXFLAGS="-g")
-       CXXFLAGS_saved="$CXXFLAGS"
-       unset CXXFLAGS
-       dnl Checks for compiler characteristics, CXXFLAGS.
-       AC_PROG_CXX
-       MC_STR_CONTAINS($CXXFLAGS, -g, CXXFLAGS_include_g=yes)
-       MC_STR_CONTAINS($CXXFLAGS, -O, CXXFLAGS_include_O=yes)
-       CXXFLAGS="$CXXFLAGS_saved"
-
-       dnl # Setup CXXFLAGS for debugging.
-       MC_IF_VAR_EQ(enable_debug, yes,
-               MC_IF_VAR_EQ(CXXFLAGS_include_g, yes,
-                       MC_EVAR_ADD(CXXFLAGS, -g, -g)
-               )
-               dnl Reading assembler Code
-               MC_IF_VAR_EQ(GCC, yes,
-                       dnl MC_EVAR_ADD(CXXFLAGS, -fvolatile-global, -fvolatile-global)
-                       dnl MC_EVAR_ADD(CXXFLAGS, -fverbose-asm, -fverbose-asm)
-               )
-       )
-
-       dnl # Further setup CXXFLAGS for GXX.
-       MC_IF_VAR_EQ(GXX, yes,
-               dnl # Sane Behaviour
-                MC_PROG_CC_SUPPORTS_OPTION(-mcx16,    MC_EVAR_ADD(CXXFLAGS, -mcx16, -mcx16))
-               MC_PROG_CC_SUPPORTS_OPTION(-rdynamic, MC_EVAR_ADD(CXXFLAGS, -rdynamic, -rdynamic))
-
-               dnl # enable many useful warnings
-               MC_EVAR_ADD(CXXFLAGS, -Wall, -Wall)
-               MC_EVAR_ADD(CXXFLAGS, -Wdeprecated, -Wdeprecated)
-               MC_EVAR_ADD(CXXFLAGS, -Wno-cast-qual, -Wno-cast-qual)
-               dnl # MC_EVAR_ADD(CXXFLAGS, -Wmissing-prototypes, -Wmissing-prototypes)
-               dnl # MC_EVAR_ADD(CXXFLAGS, -Winline, -Winline)
-
-               dnl # avoid bogus offsetof()-usage warnings
-               dnl MC_PROG_CC_SUPPORTS_OPTION(-Wno-invalid-offsetof,
-               dnl   MC_EVAR_ADD(CXXFLAGS, -Wno-invalid-offsetof, -Wno-invalid-offsetof))
-
-               dnl Optimizations
-               MC_EVAR_ADD(CXXFLAGS, -pipe, -pipe)
-               MC_EVAR_ADD(CXXFLAGS, -O, -O2)
-               MC_PROG_CC_SUPPORTS_OPTION(-ftracer,
-                   MC_EVAR_ADD(CXXFLAGS, -ftracer, -ftracer))
-               MC_EVAR_ADD(CXXFLAGS, -finline-functions, -finline-functions) dnl -O3 stuff as of gcc-3.3
-               MC_PROG_CC_SUPPORTS_OPTION(-fno-keep-static-consts,
-                   MC_EVAR_ADD(CXXFLAGS, -fno-keep-static-consts, -fno-keep-static-consts))
-               dnl MC_EVAR_ADD(CXXFLAGS, -freg-struct-return, -freg-struct-return) dnl buggy with gcc-3.2
-               dnl -funroll-loops gives problems with -O and templates (see Rep-CppBug_1.C)
-
-               dnl figure current screen width from ncurses to make g++
-               dnl format errors for screensizes!=80 correctly
-               gxx_columns=0
-               AC_CHECK_PROG(TPUT, tput, yes)
-               if test "$TPUT" = "yes"; then
-                   gxx_columns=`tput cols`
-               fi
-               if test "$gxx_columns" -gt 1 ; then
-                   MC_PROG_CC_SUPPORTS_OPTION(-fmessage-length=$gxx_columns,
-                       MC_EVAR_ADD(CXXFLAGS, -fmessage-length=, -fmessage-length=$gxx_columns))
-               fi
-               dnl
-
-       ,
-               MC_IF_VAR_EQ(CXXFLAGS_include_O, yes,
-                       MC_EVAR_ADD(CXXFLAGS, -O, -O2)
-               )
-       )
-])
diff --git a/configure.ac b/configure.ac
index 8e1d07a..de760e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,8 @@
 # Licensed GNU LGPL v2 or later: http://www.gnu.org/licenses/lgpl.html
 
 # include various m4 macros
-m4_include(acbeast.m4)
+m4_include(acbeast.m4)dnl # include special macros
+m4_include(ld-symbolic.m4)dnl # include special macros
 m4_include(autotools/glib-gettext.m4)
 
 
@@ -95,7 +96,8 @@ AM_MAINTAINER_MODE
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
 # declare --enable-* args and collect ac_help strings
-AC_ARG_ENABLE(debug,           [  --enable-debug=no/minimum/yes  turn on 
debugging],,enable_debug=$debug_default)
+AC_ARG_ENABLE(debug,      [  --enable-debug=no/minimum/yes  turn on debugging],,enable_debug=$debug_default)
+AC_ARG_ENABLE(devel-mode, [  --enable-devel-mode=[no/yes]   turn on development mode, 
default=no],,enable_devel_mode=no)
 AC_ARG_ENABLE(toyprof,         [  --enable-toyprof               turn on toy profiler, see 
sfi/toyprof.README],,)
 AC_ARG_ENABLE(distcheck-tests, [  --enable-distcheck-tests       turn on resource and time consuming 
distcheck tests],,enable_distcheck_tests=no)
 AC_SUBST(DOXRULE)
@@ -128,37 +130,151 @@ dnl # Foreign defaults:
 MC_IF_VAR_EQ(enable_static, yes, , enable_static=no)
 MC_IF_VAR_EQ(enable_shared, no, , enable_shared=yes)
 
-# check compilers and their behaviour, setup CFLAGS
-MC_PROG_CC_WITH_CFLAGS
-MC_PROG_CXX_WITH_CXXFLAGS
+# compiler, linker & libtool
+saved_CFLAGS="$CFLAGS"
+AC_PROG_CC
+CFLAGS="$saved_CFLAGS"                 # AC_PROG_CC_G called internally consistently breaks $CFLAGS
+saved_CXXFLAGS="$CFLAGS"
 AC_PROG_CPP
+CXXFLAGS="$saved_CXXFLAGS"     # AC_PROG_CXX_G called internally consistently breaks $CXXFLAGS
 AC_PROG_CXX
 AC_PROG_CXXCPP
+AC_PROG_LD
+AC_LANG_CPLUSPLUS      # use CXX for compilation tests
+AC_LIB_PROG_LD
+AC_LIB_PROG_LD_GNU
+ACX_PROG_LD_GNU_SYMBOLIC
+AC_SUBST([SYMBOLIC_LDFLAGS])
+ACX_PROG_LD_GNU_DYNAMIC_LIST_CPP_NEW
+AC_SUBST([DYNAMIC_LIST_CPP_NEW_LDFLAGS])
+AM_PROG_LIBTOOL
+AC_LIBTOOL_DLOPEN
+
+# AM_LDFLAGS, optimize linker to use faster ELF symbol hashing if we have compiler and linker support
+AC_MSG_CHECKING([whether CC and LD support gnu.hash sections])
+if ${CC-cc} -dumpspecs | grep -q -- '--hash-style=\(both\|gnu\).*--as-needed' && \
+   ${LD-ld} --help     | grep -q -- '--hash-style=.*\(both\|gnu\)' ; then
+  MC_EVAR_ADD(AM_LDFLAGS, [-Wl,--hash-style=both -Wl,--as-needed -Wl,-O1])
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+MC_EVAR_ADD(AM_LDFLAGS, -pthread)
+MC_EVAR_ADD(AM_LDFLAGS, -lrt)
+MC_EVAR_ADD(AM_LDFLAGS, -Wl,--no-undefined)
+AC_SUBST(AM_LDFLAGS)
+
+# Pick C++ dialect, needed in CXXFLAGS for compile tests
+MC_CXX_TRY_OPTION(CXXFLAGS,  -std=gnu++0x)
+
+# AM_CFLAGS & AM_CXXFLAGS
+MC_CXX_TRY_OPTION(AM_CXXFLAGS,  -std=gnu++0x)
+BOTHCCXXFLAGS=
+if test "x$enable_debug" = "xyes"; then
+  MC_EVAR_ADD(BOTHCCXXFLAGS,      -DG_ENABLE_DEBUG)
+  MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -g)
+  MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -ggdb3)
+  MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -fno-omit-frame-pointer)
+  MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -fverbose-asm)
+  dnl # MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Q -ftime-report -fmem-report)
+elif test "x$enable_debug" = "xno"; then
+  MC_EVAR_ADD(BOTHCCXXFLAGS, [-DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS]) # -DG_DISABLE_ASSERT
+else
+  : # minimum debugging
+fi
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -fmessage-length=0)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -fdiagnostics-color=auto)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Wall)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Wdeprecated)
+MC_CC_TRY_OPTION(AM_CFLAGS,     -Wmissing-prototypes)
+MC_CC_TRY_OPTION(AM_CFLAGS,     -Wno-pointer-sign)
+MC_CC_TRY_OPTION(AM_CFLAGS,     -Wnested-externs)
+MC_CC_TRY_OPTION(AM_CFLAGS,     -fno-cond-mismatch)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Wmissing-declarations)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Wpointer-arith)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Wredundant-decls)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -Werror=format-security)
+MC_CXX_TRY_OPTION(AM_CXXFLAGS,  -Wsign-promo)
+MC_CXX_TRY_OPTION(AM_CXXFLAGS,  -Woverloaded-virtual)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -rdynamic)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -pipe)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -O2)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -ftracer)
+MC_CC_TRY_OPTION(BOTHCCXXFLAGS, -mcx16)
+dnl # MC_CXX_TRY_OPTION(AM_CXXFLAGS,  -Wno-invalid-offsetof)
+MC_EVAR_ADD(AM_CFLAGS,   "$BOTHCCXXFLAGS")
+MC_EVAR_ADD(AM_CXXFLAGS, "$BOTHCCXXFLAGS")
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CXXFLAGS)
+AC_SUBST(AM_CPPFLAGS)
+
+# == CPU Optimizations ==
+# MMX and SSE instruction sets have been introduced way more than a decade ago:
+# Intel Pentium 3: CMOV MMX SSE (1999)
+# VIA C3 Nehemiah: CMOV MMX SSE (2003)
+# Athlon Palomino: CMOV MMX SSE 3DNow (2001)
+SIMD_FLAGS=
+MC_CC_TRY_OPTION(SIMD_FLAGS, -mmmx)
+MC_CC_TRY_OPTION(SIMD_FLAGS, -msse)
+# Note, -mfpmath=sse can harm FPU-algorithm performance
+# Note, -funroll-loops can harm SSE loop performance
+#MC_CC_TRY_OPTION(SIMD_FLAGS, -funroll-loops)
+#AC_SUBST(SIMD_FLAGS)
+# Expect the target architecture to support MMX/SSE if the compiler does it.
+MC_EVAR_ADD(AM_CFLAGS,   "$SIMD_FLAGS")
+MC_EVAR_ADD(AM_CXXFLAGS, "$SIMD_FLAGS")
+# Newer vectorization instruction sets, should be optionally supported
+# SSE >= 2, AVX
+SSEAVX_FLAGS=
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse2)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse3)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -mssse3)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse4)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse4.1)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse4.2)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -msse4a)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -mavx)
+MC_CC_TRY_OPTION(SSEAVX_FLAGS, -mavx2)
+AC_SUBST(SSEAVX_FLAGS)
+
+# == OPTIMIZE_FAST ==
+# Some critical code paths should be optimized to run as fast as possible
+OPTIMIZE_FAST=
+MC_CC_TRY_OPTION(OPTIMIZE_FAST, -O3)
+MC_CC_TRY_OPTION(OPTIMIZE_FAST, -ftree-vectorize)
+MC_CC_TRY_OPTION(OPTIMIZE_FAST, -finline-functions)
+MC_CC_TRY_OPTION(OPTIMIZE_FAST, -minline-all-stringops)
+AC_SUBST(OPTIMIZE_FAST)
+
+# == Bse Plugin FLAGS ==
+# * -funroll-loops significantly boosts FPU performance
+# * -mfpmath=sse harms FPU-algorithm performance
+# * -funroll-loops harms SSE loop performance
+MC_CXX_TRY_OPTION(FAST_MATH_FLAGS, -ftree-loop-ivcanon)
+MC_CXX_TRY_OPTION(FAST_MATH_FLAGS, -ftree-loop-linear)
+MC_CXX_TRY_OPTION(FAST_MATH_FLAGS, -ftree-loop-im)
+MC_CXX_TRY_OPTION(FAST_MATH_FLAGS, -ffast-math)
+MC_CXX_TRY_OPTION(FAST_MATH_FLAGS, -fivopts)
+AC_SUBST(FAST_MATH_FLAGS)
+MC_CXX_TRY_OPTION(FPU_FLAGS, -funroll-loops)
+AC_SUBST(FPU_FLAGS)
+SSE_FLAGS="$SIMD_FLAGS"
+AC_SUBST(SSE_FLAGS)
+
+# == SSE Build Conditionals ==
+lacking_mmx_sse=`echo "$SIMD_FLAGS" | grep 'mmx.*sse' -q ; echo $?` # sh truth values: 1 (without sse) or 0 
(with sse)
+AM_CONDITIONAL(WITH_SSE_FLAGS, test 0 == $lacking_mmx_sse)
+AC_DEFINE_UNQUOTED(BSE_WITH_SSE_FLAGS, [(0 == $lacking_mmx_sse)], [wether MMX and SSE are supported])
+
+# C & C++ idioms
 AC_C_CONST
 AC_C_INLINE
 AC_HEADER_STDC
 
-# == Compiler Flags ==
-MC_EVAR_ADD(CFLAGS, -Werror=format-security, -Werror=format-security)
-MC_EVAR_ADD(CXXFLAGS, -Werror=format-security, -Werror=format-security)
-MC_EVAR_ADD(CXXFLAGS, -std=gnu++0x, -std=gnu++0x -pthread)
-
 # Checks for programs
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
-# initialize libtool, we need dynamic module support
-AC_LIBTOOL_DLOPEN
-AM_PROG_LIBTOOL
-
-# Check for package requirements.
-MC_IF_VAR_EQ(GCC, yes,,
-    AC_MSG_ERROR(This package requires GNU gcc)
-)
-MC_IF_VAR_EQ(GXX, yes,,
-    AC_MSG_ERROR(This package requires GNU g++)
-)
-
 # require pkg-config
 MC_ASSERT_PROG(PKG_CONFIG, pkg-config, [pkg-config can be found at 
http://www.freedesktop.org/software/pkgconfig/])
 
@@ -324,29 +440,11 @@ AC_DEFUN([AC_BSE_REQUIREMENTS],
       AC_MSG_RESULT(no)
     ])
     AC_SUBST(SFI_HAVE_MUTEXATTR_SETTYPE)
-    
+
     dnl # --- math.h glibc extensions
     AC_CHECK_LIB(m, sincos,
       AC_DEFINE(HAVE_SINCOS, 1, [Define if you have the sincos function in <math.h>]))
 
-    # --- setup BSE PLUGIN flags ---
-    MC_PROG_CC_SPECIAL_FLAGS(PLUGIN_FLAGS, -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-im -fivopts 
-ffast-math)
-    AC_SUBST(PLUGIN_FLAGS)
-
-    # --- setup BSE FPU flags ---
-    # * -funroll-loops significantly boosts FPU performance
-    MC_PROG_CC_SPECIAL_FLAGS(FPU_FLAGS, -funroll-loops)
-    AC_SUBST(FPU_FLAGS)
-
-    # --- setup BSE SSE flags ---
-    # * -mfpmath=sse harms FPU-algorithm performance
-    # * -funroll-loops harms SSE loop performance
-    MC_PROG_CC_SPECIAL_FLAGS(SSE_FLAGS, -mmmx -msse -ftree-vectorize)
-    AC_SUBST(SSE_FLAGS)
-    not_with_sse_value=`echo "$SSE_FLAGS" | grep 'mmx.*sse' -q ; echo $?` # sh truth value: 1 (without sse) 
or 0 (with sse)
-    AM_CONDITIONAL(WITH_SSE_FLAGS, test 0 == $not_with_sse_value)
-    AC_DEFINE_UNQUOTED(BSE_WITH_SSE_FLAGS, [(0 == $not_with_sse_value)], [wether SSE_FLAGS are defined])
-
     # --- setup BSE search/install paths ---
     bseplugindir=\${libdir}/bse/v$BIN_VERSION/plugins
     AC_SUBST(bseplugindir)
@@ -647,13 +745,6 @@ AC_BEAST_REQUIREMENTS
 AC_SUIDMAIN_REQUIREMENTS
 AC_DOC_REQUIREMENTS
 
-# Decide on global --no-undefined linking
-# we only force all libraries and symbols to be present for development builds,
-# except for when building with toyprof which uses the GLIBC symbol _r_debug.
-if test x"$enable_maintainer_mode" = xyes -a x"$enable_toyprof" != xyes ; then
-       MC_EVAR_ADD(LDFLAGS, --no-undefined, -Xlinker --no-undefined)
-fi
-
 # Automake @VARIABLE@ exports.
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]