annotate src/fftw-3.3.3/m4/ax_cc_maxopt.m4 @ 73:02caadb7509e

Rebuild with --disable-stack-protector for mingw32
author Chris Cannam
date Fri, 25 Jan 2019 14:31:07 +0000
parents 37bf6b4a2645
children
rev   line source
Chris@10 1 dnl @synopsis AX_CC_MAXOPT
Chris@10 2 dnl @summary turn on optimization flags for the C compiler
Chris@10 3 dnl @category C
Chris@10 4 dnl
Chris@10 5 dnl Try to turn on "good" C optimization flags for various compilers
Chris@10 6 dnl and architectures, for some definition of "good". (In our case,
Chris@10 7 dnl good for FFTW and hopefully for other scientific codes. Modify
Chris@10 8 dnl as needed.)
Chris@10 9 dnl
Chris@10 10 dnl The user can override the flags by setting the CFLAGS environment
Chris@10 11 dnl variable.
Chris@10 12 dnl
Chris@10 13 dnl Note also that the flags assume that ANSI C aliasing rules are
Chris@10 14 dnl followed by the code (e.g. for gcc's -fstrict-aliasing), and that
Chris@10 15 dnl floating-point computations can be re-ordered as needed.
Chris@10 16 dnl
Chris@10 17 dnl Requires macros: AX_CHECK_COMPILER_FLAGS, AX_COMPILER_VENDOR,
Chris@10 18 dnl
Chris@10 19 dnl @version 2011-06-22
Chris@10 20 dnl @license GPLWithACException
Chris@10 21 dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Matteo Frigo.
Chris@10 22 AC_DEFUN([AX_CC_MAXOPT],
Chris@10 23 [
Chris@10 24 AC_REQUIRE([AC_PROG_CC])
Chris@10 25 AC_REQUIRE([AX_COMPILER_VENDOR])
Chris@10 26 AC_REQUIRE([AC_CANONICAL_HOST])
Chris@10 27
Chris@10 28 # Try to determine "good" native compiler flags if none specified via CFLAGS
Chris@10 29 if test "$ac_test_CFLAGS" != "set"; then
Chris@10 30 CFLAGS=""
Chris@10 31 case $ax_cv_c_compiler_vendor in
Chris@10 32 dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host"
Chris@10 33 ;;
Chris@10 34
Chris@10 35 sun) CFLAGS="-native -fast -xO5 -dalign"
Chris@10 36 ;;
Chris@10 37
Chris@10 38 hp) CFLAGS="+Oall +Optrs_ansi +DSnative"
Chris@10 39 ;;
Chris@10 40
Chris@10 41 ibm) xlc_opt="-qtune=auto"
Chris@10 42 AX_CHECK_COMPILER_FLAGS($xlc_opt,
Chris@10 43 CFLAGS="-O3 -qansialias -w $xlc_opt",
Chris@10 44 [CFLAGS="-O3 -qansialias -w"
Chris@10 45 echo "******************************************************"
Chris@10 46 echo "* You seem to have the IBM C compiler. It is *"
Chris@10 47 echo "* recommended for best performance that you use: *"
Chris@10 48 echo "* *"
Chris@10 49 echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *"
Chris@10 50 echo "* ^^^ ^^^ *"
Chris@10 51 echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *"
Chris@10 52 echo "* CPU you have. (Set the CFLAGS environment var. *"
Chris@10 53 echo "* and re-run configure.) For more info, man cc. *"
Chris@10 54 echo "******************************************************"])
Chris@10 55 ;;
Chris@10 56
Chris@10 57 intel) CFLAGS="-O3"
Chris@10 58 # Intel seems to have changed the spelling of this flag recently
Chris@10 59 icc_ansi_alias="unknown"
Chris@10 60 for flag in -ansi-alias -ansi_alias; do
Chris@10 61 AX_CHECK_COMPILER_FLAGS($flag, [icc_ansi_alias=$flag; break])
Chris@10 62 done
Chris@10 63 if test "x$icc_ansi_alias" != xunknown; then
Chris@10 64 CFLAGS="$CFLAGS $icc_ansi_alias"
Chris@10 65 fi
Chris@10 66 AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
Chris@10 67 # We used to check for architecture flags here, e.g. -xHost etc.,
Chris@10 68 # but these flags are problematic. On icc-12.0.0, "-mavx -xHost"
Chris@10 69 # overrides -mavx with -xHost, generating SSE2 code instead of AVX
Chris@10 70 # code. ICC does not seem to support -mtune=host or equivalent
Chris@10 71 # non-ABI changing flag.
Chris@10 72 ;;
Chris@10 73
Chris@10 74 gnu)
Chris@10 75 # Default optimization flags for gcc on all systems.
Chris@10 76 # Somehow -O3 does not imply -fomit-frame-pointer on ia32
Chris@10 77 CFLAGS="-O3 -fomit-frame-pointer"
Chris@10 78
Chris@10 79 # tune for the host by default
Chris@10 80 AX_CHECK_COMPILER_FLAGS(-mtune=native, CFLAGS="$CFLAGS -mtune=native")
Chris@10 81
Chris@10 82 # -malign-double for x86 systems
Chris@10 83 AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double")
Chris@10 84
Chris@10 85 # -fstrict-aliasing for gcc-2.95+
Chris@10 86 AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing,
Chris@10 87 CFLAGS="$CFLAGS -fstrict-aliasing")
Chris@10 88
Chris@10 89 # -fno-schedule-insns is pretty much required on all risc
Chris@10 90 # processors.
Chris@10 91 #
Chris@10 92 # gcc performs one pass of instruction scheduling, then a pass of
Chris@10 93 # register allocation, then another pass of instruction
Chris@10 94 # scheduling. The first pass reorders instructions in a way that
Chris@10 95 # is pretty much the worst possible for the purposes of register
Chris@10 96 # allocation. We disable the first pass.
Chris@10 97 AX_CHECK_COMPILER_FLAGS(-fno-schedule-insns, CFLAGS="$CFLAGS -fno-schedule-insns")
Chris@10 98
Chris@10 99 # note that we enable "unsafe" fp optimization with other compilers, too
Chris@10 100 AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math")
Chris@10 101
Chris@10 102 ;;
Chris@10 103 esac
Chris@10 104
Chris@10 105 if test -z "$CFLAGS"; then
Chris@10 106 echo ""
Chris@10 107 echo "********************************************************"
Chris@10 108 echo "* WARNING: Don't know the best CFLAGS for this system *"
Chris@10 109 echo "* Use ./configure CFLAGS=... to specify your own flags *"
Chris@10 110 echo "* (otherwise, a default of CFLAGS=-O3 will be used) *"
Chris@10 111 echo "********************************************************"
Chris@10 112 echo ""
Chris@10 113 CFLAGS="-O3"
Chris@10 114 fi
Chris@10 115
Chris@10 116 AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [
Chris@10 117 echo ""
Chris@10 118 echo "********************************************************"
Chris@10 119 echo "* WARNING: The guessed CFLAGS don't seem to work with *"
Chris@10 120 echo "* your compiler. *"
Chris@10 121 echo "* Use ./configure CFLAGS=... to specify your own flags *"
Chris@10 122 echo "********************************************************"
Chris@10 123 echo ""
Chris@10 124 CFLAGS=""
Chris@10 125 ])
Chris@10 126
Chris@10 127 fi
Chris@10 128 ])