annotate src/fftw-3.3.8/m4/ax_cc_maxopt.m4 @ 84:08ae793730bd

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