annotate src/fftw-3.3.5/configure.ac @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 7867fa7e1b6b
children
rev   line source
cannam@127 1
cannam@127 2
cannam@127 3 dnl Process this file with autoconf to produce a configure script.
cannam@127 4
cannam@127 5 dnl Define the fftw version number as M4 macros, so that we can enforce
cannam@127 6 dnl the invariant that the minor version number in FFTW-X.Y.MINOR is the same
cannam@127 7 dnl as the revision number in SHARED_VERSION_INFO.
cannam@127 8 define(FFTW_MAJOR_VERSION, 3.3)dnl
cannam@127 9 define(FFTW_MINOR_VERSION, 5)dnl
cannam@127 10
cannam@127 11 dnl Version number of the FFTW source package.
cannam@127 12 AC_INIT(fftw, FFTW_MAJOR_VERSION.FFTW_MINOR_VERSION, fftw@fftw.org)
cannam@127 13 AC_CONFIG_SRCDIR(kernel/ifftw.h)
cannam@127 14
cannam@127 15 dnl Version number for libtool shared libraries. Libtool wants a string
cannam@127 16 dnl of the form CURRENT:REVISION:AGE. We adopt the convention that
cannam@127 17 dnl REVISION is the same as the FFTW minor version number.
cannam@127 18 dnl fftw-3.1.x was 4:x:1
cannam@127 19 dnl fftw-3.2.x was 5:x:2
cannam@127 20 dnl fftw-3.3.x was 6:x:3 for x < 4
cannam@127 21 dnl fftw-3.3.4 was 7:x:4
cannam@127 22 dnl fftw-3.3.5 was 8:x:5 (added planner hooks)
cannam@127 23 SHARED_VERSION_INFO="8:FFTW_MINOR_VERSION:5" # CURRENT:REVISION:AGE
cannam@127 24
cannam@127 25 AM_INIT_AUTOMAKE(1.7)
cannam@127 26 AM_CONFIG_HEADER(config.h)
cannam@127 27 AC_CONFIG_MACRO_DIR([m4])
cannam@127 28 AM_MAINTAINER_MODE
cannam@127 29 AC_SUBST(SHARED_VERSION_INFO)
cannam@127 30 AC_DISABLE_SHARED dnl to hell with shared libraries
cannam@127 31 AC_CANONICAL_HOST
cannam@127 32
cannam@127 33 dnl configure options
cannam@127 34 case "${host_cpu}" in
cannam@127 35 powerpc*) have_fma=yes;;
cannam@127 36 ia64*) have_fma=yes;;
cannam@127 37 hppa*) have_fma=yes;;
cannam@127 38 mips64*) have_fma=yes;;
cannam@127 39 *) have_fma=no;;
cannam@127 40 esac
cannam@127 41
cannam@127 42 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile fftw with extra runtime checks for debugging])], ok=$enableval, ok=no)
cannam@127 43 if test "$ok" = "yes"; then
cannam@127 44 AC_DEFINE(FFTW_DEBUG,1,[Define to enable extra FFTW debugging code.])
cannam@127 45 debug_malloc=yes
cannam@127 46 else
cannam@127 47 debug_malloc=no
cannam@127 48 fi
cannam@127 49
cannam@127 50 AC_ARG_ENABLE(doc, [AC_HELP_STRING([--disable-doc],[disable building the documentation])], build_doc=$enableval, build_doc=yes)
cannam@127 51 AM_CONDITIONAL(BUILD_DOC, test x"$build_doc" = xyes)
cannam@127 52
cannam@127 53 AC_ARG_ENABLE(debug-malloc, [AC_HELP_STRING([--enable-debug-malloc],[enable malloc debugging version])], ok=$enableval, ok=$debug_malloc)
cannam@127 54 if test "$ok" = "yes"; then
cannam@127 55 AC_DEFINE(FFTW_DEBUG_MALLOC,1,[Define to enable debugging malloc.])
cannam@127 56 fi
cannam@127 57
cannam@127 58 AC_ARG_ENABLE(debug-alignment, [AC_HELP_STRING([--enable-debug-alignment],[enable alignment debugging hacks])], ok=$enableval, ok=no)
cannam@127 59 if test "$ok" = "yes"; then
cannam@127 60 AC_DEFINE(FFTW_DEBUG_ALIGNMENT,1,[Define to enable alignment debugging hacks.])
cannam@127 61 fi
cannam@127 62
cannam@127 63 AC_ARG_ENABLE(random-estimator, [AC_HELP_STRING([--enable-random-estimator],[enable pseudorandom estimator (debugging hack)])], ok=$enableval, ok=no)
cannam@127 64 if test "$ok" = "yes"; then
cannam@127 65 AC_DEFINE(FFTW_RANDOM_ESTIMATOR,1,[Define to enable pseudorandom estimate planning for debugging.])
cannam@127 66 CHECK_PL_OPTS="--estimate"
cannam@127 67 fi
cannam@127 68
cannam@127 69 AC_ARG_ENABLE(alloca, [AC_HELP_STRING([--disable-alloca],[disable use of the alloca() function (may be broken on mingw64)])], ok=$enableval, ok=yes)
cannam@127 70 if test "$ok" = "yes"; then
cannam@127 71 AC_DEFINE(FFTW_ENABLE_ALLOCA,1,[Define to enable the use of alloca().])
cannam@127 72 fi
cannam@127 73
cannam@127 74 AC_ARG_ENABLE(single, [AC_HELP_STRING([--enable-single],[compile fftw in single precision])], ok=$enableval, ok=no)
cannam@127 75 AC_ARG_ENABLE(float, [AC_HELP_STRING([--enable-float],[synonym for --enable-single])], ok=$enableval)
cannam@127 76 if test "$ok" = "yes"; then
cannam@127 77 AC_DEFINE(FFTW_SINGLE,1,[Define to compile in single precision.])
cannam@127 78 AC_DEFINE(BENCHFFT_SINGLE,1,[Define to compile in single precision.])
cannam@127 79 PRECISION=s
cannam@127 80 else
cannam@127 81 PRECISION=d
cannam@127 82 fi
cannam@127 83 AM_CONDITIONAL(SINGLE, test "$ok" = "yes")
cannam@127 84
cannam@127 85 AC_ARG_ENABLE(long-double, [AC_HELP_STRING([--enable-long-double],[compile fftw in long-double precision])], ok=$enableval, ok=no)
cannam@127 86 if test "$ok" = "yes"; then
cannam@127 87 if test "$PRECISION" = "s"; then
cannam@127 88 AC_MSG_ERROR([--enable-single/--enable-long-double conflict])
cannam@127 89 fi
cannam@127 90 AC_DEFINE(FFTW_LDOUBLE,1,[Define to compile in long-double precision.])
cannam@127 91 AC_DEFINE(BENCHFFT_LDOUBLE,1,[Define to compile in long-double precision.])
cannam@127 92 PRECISION=l
cannam@127 93 fi
cannam@127 94 AM_CONDITIONAL(LDOUBLE, test "$ok" = "yes")
cannam@127 95
cannam@127 96 AC_ARG_ENABLE(quad-precision, [AC_HELP_STRING([--enable-quad-precision],[compile fftw in quadruple precision if available])], ok=$enableval, ok=no)
cannam@127 97 if test "$ok" = "yes"; then
cannam@127 98 if test "$PRECISION" != "d"; then
cannam@127 99 AC_MSG_ERROR([conflicting precisions specified])
cannam@127 100 fi
cannam@127 101 AC_DEFINE(FFTW_QUAD,1,[Define to compile in quad precision.])
cannam@127 102 AC_DEFINE(BENCHFFT_QUAD,1,[Define to compile in quad precision.])
cannam@127 103 PRECISION=q
cannam@127 104 fi
cannam@127 105 AM_CONDITIONAL(QUAD, test "$ok" = "yes")
cannam@127 106
cannam@127 107 AC_SUBST(PRECISION)
cannam@127 108 AC_SUBST(CHECK_PL_OPTS)
cannam@127 109
cannam@127 110 dnl SSE/SSE2 theory:
cannam@127 111 dnl
cannam@127 112 dnl Historically, you had to supply --enable-sse in single precision and --enable-sse2
cannam@127 113 dnl in double precision.
cannam@127 114 dnl
cannam@127 115 dnl This behavior is pointless in 2016. --enable-sse2 now works in both precisions,
cannam@127 116 dnl and is interpreted as --enable-sse in single precision. The old flag --enable--se
cannam@127 117 dnl is still supported in single-precision only.
cannam@127 118 AC_ARG_ENABLE(sse, [AC_HELP_STRING([--enable-sse],[enable SSE optimizations])], have_sse=$enableval, have_sse=no)
cannam@127 119 if test "$have_sse" = "yes"; then
cannam@127 120 if test "$PRECISION" != "s"; then
cannam@127 121 AC_MSG_ERROR([SSE requires single precision])
cannam@127 122 fi
cannam@127 123 fi
cannam@127 124
cannam@127 125 AC_ARG_ENABLE(sse2, [AC_HELP_STRING([--enable-sse2],[enable SSE/SSE2 optimizations])], have_sse2=$enableval, have_sse2=no)
cannam@127 126 if test "$have_sse" = "yes"; then have_sse2=yes; fi
cannam@127 127 if test "$have_sse2" = "yes"; then
cannam@127 128 AC_DEFINE(HAVE_SSE2,1,[Define to enable SSE/SSE2 optimizations.])
cannam@127 129 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
cannam@127 130 AC_MSG_ERROR([SSE2 requires single or double precision])
cannam@127 131 fi
cannam@127 132 fi
cannam@127 133 AM_CONDITIONAL(HAVE_SSE2, test "$have_sse2" = "yes")
cannam@127 134
cannam@127 135 AC_ARG_ENABLE(avx, [AC_HELP_STRING([--enable-avx],[enable AVX optimizations])], have_avx=$enableval, have_avx=no)
cannam@127 136 if test "$have_avx" = "yes"; then
cannam@127 137 AC_DEFINE(HAVE_AVX,1,[Define to enable AVX optimizations.])
cannam@127 138 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
cannam@127 139 AC_MSG_ERROR([AVX requires single or double precision])
cannam@127 140 fi
cannam@127 141 fi
cannam@127 142 AM_CONDITIONAL(HAVE_AVX, test "$have_avx" = "yes")
cannam@127 143
cannam@127 144 AC_ARG_ENABLE(avx2, [AC_HELP_STRING([--enable-avx2],[enable AVX2 optimizations])], have_avx2=$enableval, have_avx2=no)
cannam@127 145 if test "$have_avx2" = "yes"; then
cannam@127 146 AC_DEFINE(HAVE_AVX2,1,[Define to enable AVX2 optimizations.])
cannam@127 147 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
cannam@127 148 AC_MSG_ERROR([AVX2 requires single or double precision])
cannam@127 149 fi
cannam@127 150 have_fma="yes"
cannam@127 151 fi
cannam@127 152 AM_CONDITIONAL(HAVE_AVX2, test "$have_avx2" = "yes")
cannam@127 153
cannam@127 154 AC_ARG_ENABLE(avx512, [AC_HELP_STRING([--enable-avx512],[enable AVX512 optimizations])], have_avx512=$enableval, have_avx512=no)
cannam@127 155 if test "$have_avx512" = "yes"; then
cannam@127 156 AC_DEFINE(HAVE_AVX512,1,[Define to enable AVX512 optimizations.])
cannam@127 157 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
cannam@127 158 AC_MSG_ERROR([AVX512 requires single or double precision])
cannam@127 159 fi
cannam@127 160 have_fma="yes"
cannam@127 161 fi
cannam@127 162 AM_CONDITIONAL(HAVE_AVX512, test "$have_avx512" = "yes")
cannam@127 163
cannam@127 164 dnl 128-bit AVX is special. There is no reason to use it on Intel processors
cannam@127 165 dnl since SSE2 is just as fast. However, on AMD processors we can both use
cannam@127 166 dnl FMA4, and 128-bit SIMD is better than 256-bit since core pairs in a
cannam@127 167 dnl compute unit can execute two 128-bit instructions independently.
cannam@127 168 AC_ARG_ENABLE(avx-128-fma, [AC_HELP_STRING([--enable-avx-128-fma],[enable AVX128/FMA optimizations])], have_avx_128_fma=$enableval, have_avx_128_fma=no)
cannam@127 169 if test "$have_avx_128_fma" = "yes"; then
cannam@127 170 AC_DEFINE(HAVE_AVX_128_FMA,1,[Define to enable 128-bit FMA AVX optimization])
cannam@127 171 AVX_128_FMA_CFLAGS="${AVX_CFLAGS} -mfma4"
cannam@127 172 AC_SUBST(AVX_128_FMA_CFLAGS)
cannam@127 173 fi
cannam@127 174 AM_CONDITIONAL(HAVE_AVX_128_FMA, test "$have_avx_128_fma" = "yes")
cannam@127 175
cannam@127 176 AC_ARG_ENABLE(kcvi, [AC_HELP_STRING([--enable-kcvi],[enable Knights Corner vector instructions optimizations])], have_kcvi=$enableval, have_kcvi=no)
cannam@127 177 if test "$have_kcvi" = "yes"; then
cannam@127 178 AC_DEFINE(HAVE_KCVI,1,[Define to enable KCVI optimizations.])
cannam@127 179 if test "$PRECISION" != "d" -a "$PRECISION" != "s"; then
cannam@127 180 AC_MSG_ERROR([Knights Corner vector instructions requires single or double precision])
cannam@127 181 fi
cannam@127 182 fi
cannam@127 183 AM_CONDITIONAL(HAVE_KCVI, test "$have_kcvi" = "yes")
cannam@127 184
cannam@127 185 AC_ARG_ENABLE(altivec, [AC_HELP_STRING([--enable-altivec],[enable Altivec optimizations])], have_altivec=$enableval, have_altivec=no)
cannam@127 186 if test "$have_altivec" = "yes"; then
cannam@127 187 AC_DEFINE(HAVE_ALTIVEC,1,[Define to enable Altivec optimizations.])
cannam@127 188 if test "$PRECISION" != "s"; then
cannam@127 189 AC_MSG_ERROR([Altivec requires single precision])
cannam@127 190 fi
cannam@127 191 fi
cannam@127 192 AM_CONDITIONAL(HAVE_ALTIVEC, test "$have_altivec" = "yes")
cannam@127 193
cannam@127 194 AC_ARG_ENABLE(vsx, [AC_HELP_STRING([--enable-vsx],[enable IBM VSX optimizations])], have_vsx=$enableval, have_vsx=no)
cannam@127 195 if test "$have_vsx" = "yes"; then
cannam@127 196 AC_DEFINE(HAVE_VSX,1,[Define to enable IBM VSX optimizations.])
cannam@127 197 fi
cannam@127 198 AM_CONDITIONAL(HAVE_VSX, test "$have_vsx" = "yes")
cannam@127 199
cannam@127 200 AC_ARG_ENABLE(neon, [AC_HELP_STRING([--enable-neon],[enable ARM NEON optimizations])], have_neon=$enableval, have_neon=no)
cannam@127 201 if test "$have_neon" = "yes"; then
cannam@127 202 AC_DEFINE(HAVE_NEON,1,[Define to enable ARM NEON optimizations.])
cannam@127 203 case "${host_cpu}" in
cannam@127 204 aarch64)
cannam@127 205 ;;
cannam@127 206 *)
cannam@127 207 if test "$PRECISION" != "s"; then
cannam@127 208 AC_MSG_ERROR([NEON requires single precision])
cannam@127 209 fi
cannam@127 210 ;;
cannam@127 211 esac
cannam@127 212 fi
cannam@127 213 AM_CONDITIONAL(HAVE_NEON, test "$have_neon" = "yes")
cannam@127 214
cannam@127 215 AC_ARG_ENABLE(armv8cyclecounter, [AC_HELP_STRING([--enable-armv8cyclecounter],[enable the cycle counter on ARMv8 ; require enabling in kernel mode, see <https://github.com/rdolbeau/enable_arm_pmu>])], have_armv8cyclecounter=$enableval)
cannam@127 216 if test "$have_armv8cyclecounter"x = "yes"x; then
cannam@127 217 AC_DEFINE(HAVE_ARMV8CC,1,[Define if you have enabled the cycle counter on ARMv8])
cannam@127 218 fi
cannam@127 219
cannam@127 220 AC_ARG_ENABLE(generic-simd128, [AC_HELP_STRING([--enable-generic-simd128],[enable generic (gcc) 128-bit SIMD optimizations])], have_generic_simd128=$enableval, have_generic_simd128=no)
cannam@127 221 if test "$have_generic_simd128" = "yes"; then
cannam@127 222 AC_DEFINE(HAVE_GENERIC_SIMD128,1,[Define to enable generic (gcc) 128-bit SIMD optimizations.])
cannam@127 223 fi
cannam@127 224 AM_CONDITIONAL(HAVE_GENERIC_SIMD128, test "$have_generic_simd128" = "yes")
cannam@127 225
cannam@127 226 AC_ARG_ENABLE(generic-simd256, [AC_HELP_STRING([--enable-generic-simd256],[enable generic (gcc) 256-bit SIMD optimizations])], have_generic_simd256=$enableval, have_generic_simd256=no)
cannam@127 227 if test "$have_generic_simd256" = "yes"; then
cannam@127 228 AC_DEFINE(HAVE_GENERIC_SIMD256,1,[Define to enable generic (gcc) 256-bit SIMD optimizations.])
cannam@127 229 fi
cannam@127 230 AM_CONDITIONAL(HAVE_GENERIC_SIMD256, test "$have_generic_simd256" = "yes")
cannam@127 231
cannam@127 232
cannam@127 233 dnl FIXME:
cannam@127 234 dnl AC_ARG_ENABLE(mips-ps, [AC_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no)
cannam@127 235 dnl if test "$have_mips_ps" = "yes"; then
cannam@127 236 dnl AC_DEFINE(HAVE_MIPS_PS,1,[Define to enable MIPS paired-single optimizations.])
cannam@127 237 dnl if test "$PRECISION" != "s"; then
cannam@127 238 dnl AC_MSG_ERROR([MIPS paired-single requires single precision])
cannam@127 239 dnl fi
cannam@127 240 dnl fi
cannam@127 241 dnl AM_CONDITIONAL(HAVE_MIPS_PS, test "$have_mips_ps" = "yes")
cannam@127 242
cannam@127 243 AC_ARG_WITH(slow-timer, [AC_HELP_STRING([--with-slow-timer],[use low-precision timers (SLOW)])], with_slow_timer=$withval, with_slow_timer=no)
cannam@127 244 if test "$with_slow_timer" = "yes"; then
cannam@127 245 AC_DEFINE(WITH_SLOW_TIMER,1,[Use low-precision timers, making planner very slow])
cannam@127 246 fi
cannam@127 247
cannam@127 248 AC_ARG_ENABLE(mips_zbus_timer, [AC_HELP_STRING([--enable-mips-zbus-timer],[use MIPS ZBus cycle-counter])], have_mips_zbus_timer=$enableval, have_mips_zbus_timer=no)
cannam@127 249 if test "$have_mips_zbus_timer" = "yes"; then
cannam@127 250 AC_DEFINE(HAVE_MIPS_ZBUS_TIMER,1,[Define to enable use of MIPS ZBus cycle-counter.])
cannam@127 251 fi
cannam@127 252
cannam@127 253 AC_ARG_WITH(our-malloc, [AC_HELP_STRING([--with-our-malloc],[use our aligned malloc (helpful for Win32)])], with_our_malloc=$withval, with_our_malloc=no)
cannam@127 254 AC_ARG_WITH(our-malloc16, [AC_HELP_STRING([--with-our-malloc16],[Obsolete alias for --with-our-malloc16])], with_our_malloc=$withval)
cannam@127 255 if test "$with_our_malloc" = "yes"; then
cannam@127 256 AC_DEFINE(WITH_OUR_MALLOC,1,[Use our own aligned malloc routine; mainly helpful for Windows systems lacking aligned allocation system-library routines.])
cannam@127 257 fi
cannam@127 258
cannam@127 259 AC_ARG_WITH(windows-f77-mangling, [AC_HELP_STRING([--with-windows-f77-mangling],[use common Win32 Fortran interface styles])], with_windows_f77_mangling=$withval, with_windows_f77_mangling=no)
cannam@127 260 if test "$with_windows_f77_mangling" = "yes"; then
cannam@127 261 AC_DEFINE(WINDOWS_F77_MANGLING,1,[Use common Windows Fortran mangling styles for the Fortran interfaces.])
cannam@127 262 fi
cannam@127 263
cannam@127 264 AC_ARG_WITH(incoming-stack-boundary, [AC_HELP_STRING([--with-incoming-stack-boundary=X],[Assume that stack is aligned to (1<<X) bytes])], with_incoming_stack_boundary=$withval, with_incoming_stack_boundary=no)
cannam@127 265
cannam@127 266
cannam@127 267 AC_ARG_ENABLE(fma, [AC_HELP_STRING([--enable-fma],[enable optimizations for machines with fused multiply-add])], have_fma=$enableval)
cannam@127 268 if test "$have_fma"x = "yes"x; then
cannam@127 269 AC_DEFINE(HAVE_FMA,1,[Define if you have a machine with fused multiply-add])
cannam@127 270 fi
cannam@127 271
cannam@127 272 dnl compute library suffix
cannam@127 273 case "$PRECISION" in
cannam@127 274 s) PREC_SUFFIX=f;;
cannam@127 275 d) PREC_SUFFIX=;;
cannam@127 276 l) PREC_SUFFIX=l;;
cannam@127 277 q) PREC_SUFFIX=q;;
cannam@127 278 esac
cannam@127 279 AC_SUBST(PREC_SUFFIX)
cannam@127 280
cannam@127 281 dnl Checks for programs.
cannam@127 282 AC_PROG_CC
cannam@127 283 AM_PROG_CC_C_O
cannam@127 284 AX_COMPILER_VENDOR
cannam@127 285 AC_PROG_CC_STDC
cannam@127 286 AC_PROG_INSTALL
cannam@127 287 AC_PROG_LN_S
cannam@127 288 AC_PROG_MAKE_SET
cannam@127 289 AC_LIBTOOL_WIN32_DLL
cannam@127 290 AC_PROG_LIBTOOL
cannam@127 291
cannam@127 292 AC_CHECK_PROG(OCAMLBUILD, ocamlbuild, ocamlbuild)
cannam@127 293
cannam@127 294 dnl -----------------------------------------------------------------------
cannam@127 295
cannam@127 296 AC_ARG_ENABLE(mpi, [AC_HELP_STRING([--enable-mpi],[compile FFTW MPI library])], enable_mpi=$enableval, enable_mpi=no)
cannam@127 297
cannam@127 298 if test "$enable_mpi" = "yes"; then
cannam@127 299 if test $PRECISION = q; then
cannam@127 300 AC_MSG_ERROR([quad precision is not supported in MPI])
cannam@127 301 fi
cannam@127 302 ACX_MPI([],[AC_MSG_ERROR([could not find mpi library for --enable-mpi])])
cannam@127 303 AC_CHECK_PROG(MPIRUN, mpirun, mpirun)
cannam@127 304 AC_SUBST(MPIRUN)
cannam@127 305
cannam@127 306 save_CC=$CC
cannam@127 307 CC=$MPICC
cannam@127 308 AC_CHECK_SIZEOF(MPI_Fint, [], [#include <mpi.h>])
cannam@127 309 CC=$save_CC
cannam@127 310 if test 0 = $ac_cv_sizeof_MPI_Fint; then
cannam@127 311 AC_MSG_WARN([sizeof(MPI_Fint) test failed]);
cannam@127 312 dnl As a backup, assume Fortran integer == C int
cannam@127 313 AC_CHECK_SIZEOF(int)
cannam@127 314 if test 0 = $ac_cv_sizeof_int; then AC_MSG_ERROR([sizeof(int) test failed]); fi
cannam@127 315 ac_cv_sizeof_MPI_Fint=$ac_cv_sizeof_int
cannam@127 316 fi
cannam@127 317 C_MPI_FINT=C_INT`expr $ac_cv_sizeof_MPI_Fint \* 8`_T
cannam@127 318 AC_SUBST(C_MPI_FINT)
cannam@127 319 fi
cannam@127 320 AM_CONDITIONAL(MPI, test "$enable_mpi" = "yes")
cannam@127 321
cannam@127 322 dnl -----------------------------------------------------------------------
cannam@127 323
cannam@127 324 dnl determine CFLAGS first
cannam@127 325 AX_CC_MAXOPT
cannam@127 326
cannam@127 327 case "${ax_cv_c_compiler_vendor}" in
cannam@127 328 intel) # Stop icc from defining __GNUC__, except on MacOS where this fails
cannam@127 329 case "${host_os}" in
cannam@127 330 *darwin*) ;; # icc -no-gcc fails to compile some system headers
cannam@127 331 *)
cannam@127 332 AX_CHECK_COMPILER_FLAGS([-no-gcc], [CC="$CC -no-gcc"])
cannam@127 333 ;;
cannam@127 334 esac
cannam@127 335 ;;
cannam@127 336
cannam@127 337 hp) # must (sometimes) manually increase cpp limits to handle fftw3.h
cannam@127 338 AX_CHECK_COMPILER_FLAGS([-Wp,-H128000],
cannam@127 339 [CC="$CC -Wp,-H128000"])
cannam@127 340 ;;
cannam@127 341
cannam@127 342 portland) # -Masmkeyword required for asm("") cycle counters
cannam@127 343 AX_CHECK_COMPILER_FLAGS([-Masmkeyword],
cannam@127 344 [CC="$CC -Masmkeyword"])
cannam@127 345 ;;
cannam@127 346 esac
cannam@127 347
cannam@127 348 dnl Determine SIMD CFLAGS at least for gcc and icc
cannam@127 349 case "${ax_cv_c_compiler_vendor}" in
cannam@127 350 gnu|intel)
cannam@127 351 # SSE/SSE2
cannam@127 352 if test "$have_sse2" = "yes" -a "x$SSE2_CFLAGS" = x; then
cannam@127 353 if test "$PRECISION" = d; then flag=msse2; else flag=msse; fi
cannam@127 354 AX_CHECK_COMPILER_FLAGS(-$flag, [SSE2_CFLAGS="-$flag"],
cannam@127 355 [AC_MSG_ERROR([Need a version of gcc with -$flag])])
cannam@127 356 fi
cannam@127 357
cannam@127 358 # AVX
cannam@127 359 if test "$have_avx" = "yes" -a "x$AVX_CFLAGS" = x; then
cannam@127 360 AX_CHECK_COMPILER_FLAGS(-mavx, [AVX_CFLAGS="-mavx"],
cannam@127 361 [AC_MSG_ERROR([Need a version of gcc with -mavx])])
cannam@127 362 fi
cannam@127 363
cannam@127 364 # AVX2
cannam@127 365 # gcc-4.8 works with -march=core-avx2, but -mavx2 is not enough.
cannam@127 366 # Later versions seem to happy with -mavx2, so try the arch one first.
cannam@127 367 if test "$have_avx2" = "yes" -a "x$AVX2_CFLAGS" = x; then
cannam@127 368 AX_CHECK_COMPILER_FLAGS(-march=core-avx2, [AVX2_CFLAGS="-march=core-avx2"],
cannam@127 369 [AX_CHECK_COMPILER_FLAGS(-mavx2, [AVX2_CFLAGS="-mavx2"],
cannam@127 370 [AC_MSG_ERROR([Need a version of gcc with either -march=core-avx2 or -mavx2])])])
cannam@127 371 AX_CHECK_COMPILER_FLAGS(-mfma, [AVX2_CFLAGS="$AVX2_CFLAGS -mfma"],
cannam@127 372 [AC_MSG_WARN([Need a version of gcc with -mfma (harmless for icc)])])
cannam@127 373 fi
cannam@127 374
cannam@127 375 # AVX512
cannam@127 376 if test "$have_avx512" = "yes" -a "x$AVX512_CFLAGS" = x; then
cannam@127 377 AX_CHECK_COMPILER_FLAGS(-mavx512f, [AVX512_CFLAGS="-mavx512f"],
cannam@127 378 [AC_MSG_ERROR([Need a version of gcc with -mavx512f])])
cannam@127 379 fi
cannam@127 380
cannam@127 381 if test "$host_vendor" = "apple"; then
cannam@127 382 # We need to tell gcc to use an external assembler to get AVX/AVX2 with gcc on OS X
cannam@127 383 AX_CHECK_COMPILER_FLAGS([-Wa,-q], [CFLAGS="$CFLAGS -Wa,-q"])
cannam@127 384 # Disable the new compact unwinding format so we avoid warnings/potential errors.
cannam@127 385 AX_CHECK_COMPILER_FLAGS([-Wl,-no_compact_unwind], [CFLAGS="$CFLAGS -Wl,-no_compact_unwind"])
cannam@127 386 fi
cannam@127 387
cannam@127 388 # KCVI
cannam@127 389 if test "$have_kcvi" = "yes" -a "x$KCVI_CFLAGS" = x; then
cannam@127 390 AX_CHECK_COMPILER_FLAGS(-mmic, [KCVI_CFLAGS="-mmic"],
cannam@127 391 [AC_MSG_ERROR([Need a version of icc with -mmic])])
cannam@127 392 fi
cannam@127 393
cannam@127 394 if test "$have_altivec" = "yes" -a "x$ALTIVEC_CFLAGS" = x; then
cannam@127 395 # -DFAKE__VEC__ is a workaround because gcc-3.3 does not
cannam@127 396 # #define __VEC__ with -maltivec.
cannam@127 397 AX_CHECK_COMPILER_FLAGS(-faltivec, [ALTIVEC_CFLAGS="-faltivec"],
cannam@127 398 [AX_CHECK_COMPILER_FLAGS(-maltivec -mabi=altivec,
cannam@127 399 [ALTIVEC_CFLAGS="-maltivec -mabi=altivec -DFAKE__VEC__"],
cannam@127 400 [AX_CHECK_COMPILER_FLAGS(-fvec, [ALTIVEC_CFLAGS="-fvec"],
cannam@127 401 [AC_MSG_ERROR([Need a version of gcc with -maltivec])])])])
cannam@127 402 fi
cannam@127 403
cannam@127 404 case "${host_cpu}" in
cannam@127 405 aarch64)
cannam@127 406 ;;
cannam@127 407 *)
cannam@127 408 if test "$have_neon" = "yes" -a "x$NEON_CFLAGS" = x; then
cannam@127 409 AX_CHECK_COMPILER_FLAGS(-mfpu=neon, [NEON_CFLAGS="-mfpu=neon"],
cannam@127 410 [AC_MSG_ERROR([Need a version of gcc with -mfpu=neon])])
cannam@127 411 fi
cannam@127 412 ;;
cannam@127 413 esac
cannam@127 414
cannam@127 415 if test "$have_vsx" = "yes" -a "x$VSX_CFLAGS" = x; then
cannam@127 416 AX_CHECK_COMPILER_FLAGS(-mvsx, [VSX_CFLAGS="-mvsx"],
cannam@127 417 [AC_MSG_ERROR([Need a version of gcc with -mvsx])])
cannam@127 418 fi
cannam@127 419
cannam@127 420 dnl FIXME:
cannam@127 421 dnl elif test "$have_mips_ps" = "yes"; then
cannam@127 422 dnl # Just punt here and use only new 4.2 compiler :(
cannam@127 423 dnl # Should add section for older compilers...
cannam@127 424 dnl AX_CHECK_COMPILER_FLAGS(-mpaired-single,
cannam@127 425 dnl [SIMD_CFLAGS="-mpaired-single"],
cannam@127 426 dnl #[AC_MSG_ERROR([Need a version of gcc with -mpaired-single])])
cannam@127 427 dnl [AX_CHECK_COMPILER_FLAGS(-march=mips64,
cannam@127 428 dnl [SIMD_CFLAGS="-march=mips64"],
cannam@127 429 dnl [AC_MSG_ERROR(
cannam@127 430 dnl [Need a version of gcc with -mpaired-single or -march=mips64])
cannam@127 431 dnl ])])
cannam@127 432 dnl fi
cannam@127 433 ;;
cannam@127 434
cannam@127 435 clang)
cannam@127 436
cannam@127 437 if test "$have_avx" = "yes" -a "x$AVX_CFLAGS" = x; then
cannam@127 438 AX_CHECK_COMPILER_FLAGS(-mavx, [AVX_CFLAGS="-mavx"],
cannam@127 439 [AC_MSG_ERROR([Need a version of clang with -mavx])])
cannam@127 440 fi
cannam@127 441
cannam@127 442 if test "$have_avx2" = "yes" -a "x$AVX2_CFLAGS" = x; then
cannam@127 443 AX_CHECK_COMPILER_FLAGS(-mavx2, [AVX2_CFLAGS="-mavx2"],
cannam@127 444 [AC_MSG_ERROR([Need a version of clang with -mavx2])])
cannam@127 445 AX_CHECK_COMPILER_FLAGS(-mfma, [AVX2_CFLAGS="$AVX2_CFLAGS -mfma"])
cannam@127 446 fi
cannam@127 447
cannam@127 448 if test "$have_vsx" = "yes" -a "x$VSX_CFLAGS" = x; then
cannam@127 449 # clang appears to need both -mvsx and -maltivec for VSX
cannam@127 450 AX_CHECK_COMPILER_FLAGS(-maltivec, [VSX_CFLAGS="-maltivec"],
cannam@127 451 [AC_MSG_ERROR([Need a version of gcc with -maltivec])])
cannam@127 452 AX_CHECK_COMPILER_FLAGS(-mvsx, [VSX_CFLAGS="-mvsx $VSX_CFLAGS"],
cannam@127 453 [AC_MSG_ERROR([Need a version of gcc with -mvsx])])
cannam@127 454 fi
cannam@127 455 ;;
cannam@127 456
cannam@127 457 ibm)
cannam@127 458 if test "$have_vsx" = "yes" -a "x$VSX_CFLAGS" = x; then
cannam@127 459 # Note that IBM xlC uses -qaltivec for VSX too.
cannam@127 460 AX_CHECK_COMPILER_FLAGS(-qaltivec, [VSX_CFLAGS="-qaltivec"],
cannam@127 461 [AC_MSG_ERROR([Need a version of gcc with -qaltivec])])
cannam@127 462 fi
cannam@127 463 ;;
cannam@127 464 esac
cannam@127 465
cannam@127 466 AC_SUBST(SSE2_CFLAGS)
cannam@127 467 AC_SUBST(AVX_CFLAGS)
cannam@127 468 AC_SUBST(AVX2_CFLAGS)
cannam@127 469 AC_SUBST(AVX512_CFLAGS)
cannam@127 470 AC_SUBST(KCVI_CFLAGS)
cannam@127 471 AC_SUBST(ALTIVEC_CFLAGS)
cannam@127 472 AC_SUBST(VSX_CFLAGS)
cannam@127 473 AC_SUBST(NEON_CFLAGS)
cannam@127 474
cannam@127 475 dnl add stack alignment CFLAGS if so requested
cannam@127 476 if test "$with_incoming_stack_boundary"x != "no"x; then
cannam@127 477 case "${ax_cv_c_compiler_vendor}" in
cannam@127 478 gnu)
cannam@127 479 tentative_flags="-mincoming-stack-boundary=$with_incoming_stack_boundary";
cannam@127 480 AX_CHECK_COMPILER_FLAGS($tentative_flags,
cannam@127 481 [STACK_ALIGN_CFLAGS=$tentative_flags])
cannam@127 482 ;;
cannam@127 483 esac
cannam@127 484 fi
cannam@127 485 AC_SUBST(STACK_ALIGN_CFLAGS)
cannam@127 486
cannam@127 487 dnl Checks for header files.
cannam@127 488 AC_HEADER_STDC
cannam@127 489 AC_CHECK_HEADERS([libintl.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h limits.h c_asm.h intrinsics.h stdint.h mach/mach_time.h sys/sysctl.h])
cannam@127 490 dnl c_asm.h: Header file for enabling asm() on Digital Unix
cannam@127 491 dnl intrinsics.h: cray unicos
cannam@127 492 dnl sys/sysctl.h: MacOS X altivec detection
cannam@127 493
cannam@127 494 dnl altivec.h requires $ALTIVEC_CFLAGS (we use this for VSX too, which uses the same header)
cannam@127 495 save_CFLAGS="$CFLAGS"
cannam@127 496 save_CPPFLAGS="$CPPFLAGS"
cannam@127 497 CFLAGS="$CFLAGS $ALTIVEC_CFLAGS $VSX_CFLAGS"
cannam@127 498 CPPFLAGS="$CPPFLAGS $ALTIVEC_CFLAGS $VSX_CFLAGS"
cannam@127 499 AC_CHECK_HEADERS([altivec.h])
cannam@127 500 CFLAGS="$save_CFLAGS"
cannam@127 501 CPPFLAGS="$save_CPPFLAGS"
cannam@127 502
cannam@127 503 dnl Checks for typedefs, structures, and compiler characteristics.
cannam@127 504 AC_C_CONST
cannam@127 505 AC_C_INLINE
cannam@127 506 AC_TYPE_SIZE_T
cannam@127 507 AC_HEADER_TIME
cannam@127 508 AC_CHECK_TYPE([long double],
cannam@127 509 [AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports `long double'])],
cannam@127 510 [
cannam@127 511 if test $PRECISION = l; then
cannam@127 512 AC_MSG_ERROR([long double is not a supported type with your compiler.])
cannam@127 513 fi
cannam@127 514 ])
cannam@127 515 AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,
cannam@127 516 [
cannam@127 517 #if HAVE_SYS_TIME_H
cannam@127 518 #include <sys/time.h>
cannam@127 519 #endif
cannam@127 520 ])
cannam@127 521
cannam@127 522 AC_CHECK_SIZEOF(int)
cannam@127 523 AC_CHECK_SIZEOF(unsigned int)
cannam@127 524 AC_CHECK_SIZEOF(long)
cannam@127 525 AC_CHECK_SIZEOF(unsigned long)
cannam@127 526 AC_CHECK_SIZEOF(long long)
cannam@127 527 AC_CHECK_SIZEOF(unsigned long long)
cannam@127 528 AC_CHECK_SIZEOF(size_t)
cannam@127 529 AC_CHECK_SIZEOF(ptrdiff_t)
cannam@127 530
cannam@127 531 AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
cannam@127 532 #ifdef HAVE_STDINT_H
cannam@127 533 # include <stdint.h>
cannam@127 534 #endif])
cannam@127 535
cannam@127 536 AC_CHECK_SIZEOF(float)
cannam@127 537 AC_CHECK_SIZEOF(double)
cannam@127 538
cannam@127 539 dnl Check sizeof fftw_r2r_kind for Fortran interface [it has == sizeof(int)
cannam@127 540 dnl for years, but being paranoid]. Note: the definition here must match
cannam@127 541 dnl the one in api/fftw3.h!
cannam@127 542 AC_CHECK_SIZEOF(fftw_r2r_kind, [], [typedef enum {
cannam@127 543 FFTW_R2HC=0, FFTW_HC2R=1, FFTW_DHT=2,
cannam@127 544 FFTW_REDFT00=3, FFTW_REDFT01=4, FFTW_REDFT10=5, FFTW_REDFT11=6,
cannam@127 545 FFTW_RODFT00=7, FFTW_RODFT01=8, FFTW_RODFT10=9, FFTW_RODFT11=10
cannam@127 546 } fftw_r2r_kind;])
cannam@127 547 if test 0 = $ac_cv_sizeof_fftw_r2r_kind; then AC_MSG_ERROR([sizeof(fftw_r2r_kind) test failed]); fi
cannam@127 548 C_FFTW_R2R_KIND=C_INT`expr $ac_cv_sizeof_fftw_r2r_kind \* 8`_T
cannam@127 549 AC_SUBST(C_FFTW_R2R_KIND)
cannam@127 550
cannam@127 551 dnl Checks for library functions.
cannam@127 552 AC_FUNC_ALLOCA
cannam@127 553 AC_FUNC_STRTOD
cannam@127 554 AC_FUNC_VPRINTF
cannam@127 555 AC_CHECK_LIB(m, sin)
cannam@127 556
cannam@127 557 if test $PRECISION = q; then
cannam@127 558 AX_GCC_VERSION(4,6,0,[],[AC_MSG_ERROR([gcc 4.6 or later required for quad precision support])])
cannam@127 559 AC_CHECK_LIB(quadmath, sinq, [], [AC_MSG_ERROR([quad precision requires libquadmath for quad-precision trigonometric routines])])
cannam@127 560 LIBQUADMATH=-lquadmath
cannam@127 561 fi
cannam@127 562 AC_SUBST(LIBQUADMATH)
cannam@127 563
cannam@127 564 AC_CHECK_FUNCS([BSDgettimeofday gettimeofday gethrtime read_real_time time_base_to_time drand48 sqrt memset posix_memalign memalign _mm_malloc _mm_free clock_gettime mach_absolute_time sysctl abort sinl cosl snprintf])
cannam@127 565 AC_CHECK_DECLS([sinl, cosl, sinq, cosq],,,[#include <math.h>])
cannam@127 566 AC_CHECK_DECLS([memalign],,,[
cannam@127 567 #ifdef HAVE_MALLOC_H
cannam@127 568 #include <malloc.h>
cannam@127 569 #endif])
cannam@127 570 AC_CHECK_DECLS([drand48, srand48, posix_memalign]) dnl in stdlib.h
cannam@127 571
cannam@127 572 dnl Cray UNICOS _rtc() (real-time clock) intrinsic
cannam@127 573 AC_MSG_CHECKING([for _rtc intrinsic])
cannam@127 574 rtc_ok=yes
cannam@127 575 AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H
cannam@127 576 #include <intrinsics.h>
cannam@127 577 #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no])
cannam@127 578 AC_MSG_RESULT($rtc_ok)
cannam@127 579
cannam@127 580 if test "$PRECISION" = "l"; then
cannam@127 581 AC_CHECK_FUNCS([cosl sinl tanl], [], [AC_MSG_ERROR([long-double precision requires long-double trigonometric routines])])
cannam@127 582 fi
cannam@127 583
cannam@127 584 AC_MSG_CHECKING([for isnan])
cannam@127 585 AC_TRY_LINK([#include <math.h>
cannam@127 586 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
cannam@127 587 if test "$ok" = "yes"; then
cannam@127 588 AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
cannam@127 589 fi
cannam@127 590 AC_MSG_RESULT(${ok})
cannam@127 591
cannam@127 592 dnl TODO
cannam@127 593 AX_GCC_ALIGNS_STACK()
cannam@127 594
cannam@127 595 dnl override CFLAGS selection when debugging
cannam@127 596 if test "${enable_debug}" = "yes"; then
cannam@127 597 CFLAGS="-g"
cannam@127 598 fi
cannam@127 599
cannam@127 600 dnl add gcc warnings, in debug/maintainer mode only
cannam@127 601 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
cannam@127 602 if test "$ac_test_CFLAGS" != "set"; then
cannam@127 603 if test $ac_cv_prog_gcc = yes; then
cannam@127 604 CFLAGS="$CFLAGS -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic -Wno-long-long -Wshadow -Wbad-function-cast -Wwrite-strings -Wstrict-prototypes -Wredundant-decls -Wnested-externs" # -Wundef -Wconversion -Wmissing-prototypes -Wmissing-declarations
cannam@127 605 fi
cannam@127 606 fi
cannam@127 607 fi
cannam@127 608
cannam@127 609 dnl check for a proper indent in maintainer mode
cannam@127 610 if test "$USE_MAINTAINER_MODE" = yes; then
cannam@127 611 AC_PATH_PROG(INDENT, indent, indent)
cannam@127 612 # if INDENT is set to 'indent' then we didn't find indent
cannam@127 613 if test "$INDENT" != indent ; then
cannam@127 614 AC_MSG_CHECKING(if $INDENT is GNU indent)
cannam@127 615 if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then
cannam@127 616 AC_MSG_RESULT(yes)
cannam@127 617 INDENT="$INDENT -kr -cs -i5 -l800 -fca -nfc1 -sc -sob -cli4 -TR -Tplanner -TV"
cannam@127 618 else
cannam@127 619 AC_MSG_RESULT(no)
cannam@127 620 AC_MSG_WARN($INDENT does not appear to be GNU indent.)
cannam@127 621 fi
cannam@127 622 else
cannam@127 623 AC_MSG_WARN(no indent program found: codelets will be ugly)
cannam@127 624 INDENT=cat
cannam@127 625 fi
cannam@127 626 fi
cannam@127 627
cannam@127 628 dnl -----------------------------------------------------------------------
cannam@127 629
cannam@127 630 AC_ARG_ENABLE(fortran, [AC_HELP_STRING([--disable-fortran],[don't include Fortran-callable wrappers])], enable_fortran=$enableval, enable_fortran=yes)
cannam@127 631
cannam@127 632 if test "$enable_fortran" = "yes"; then
cannam@127 633 AC_PROG_F77
cannam@127 634 if test -z "$F77"; then
cannam@127 635 enable_fortran=no
cannam@127 636 AC_MSG_WARN([*** Couldn't find f77 compiler; using default Fortran wrappers.])
cannam@127 637 else
cannam@127 638 AC_F77_DUMMY_MAIN([], [enable_fortran=no
cannam@127 639 AC_MSG_WARN([*** Couldn't figure out how to link C and Fortran; using default Fortran wrappers.])])
cannam@127 640 fi
cannam@127 641 else
cannam@127 642 AC_DEFINE([DISABLE_FORTRAN], 1, [Define to disable Fortran wrappers.])
cannam@127 643 fi
cannam@127 644
cannam@127 645 if test "x$enable_fortran" = xyes; then
cannam@127 646 AC_F77_WRAPPERS
cannam@127 647 AC_F77_FUNC(f77foo)
cannam@127 648 AC_F77_FUNC(f77_foo)
cannam@127 649 f77_foo2=`echo $f77foo | sed 's/77/77_/'`
cannam@127 650 if test "$f77_foo" = "$f77_foo2"; then
cannam@127 651 AC_DEFINE(F77_FUNC_EQUIV, 1, [Define if F77_FUNC and F77_FUNC_ are equivalent.])
cannam@127 652
cannam@127 653 # Include g77 wrappers by default for GNU systems or gfortran
cannam@127 654 with_g77_wrappers=$ac_cv_f77_compiler_gnu
cannam@127 655 case $host_os in *gnu*) with_g77_wrappers=yes ;; esac
cannam@127 656 fi
cannam@127 657 else
cannam@127 658 with_g77_wrappers=no
cannam@127 659 fi
cannam@127 660
cannam@127 661 AC_ARG_WITH(g77-wrappers, [AC_HELP_STRING([--with-g77-wrappers],[force inclusion of g77-compatible wrappers in addition to any other Fortran compiler that is detected])], with_g77_wrappers=$withval)
cannam@127 662 if test "x$with_g77_wrappers" = "xyes"; then
cannam@127 663 AC_DEFINE(WITH_G77_WRAPPERS,1,[Include g77-compatible wrappers in addition to any other Fortran wrappers.])
cannam@127 664 fi
cannam@127 665
cannam@127 666 dnl -----------------------------------------------------------------------
cannam@127 667 have_smp="no"
cannam@127 668 AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],[use OpenMP directives for parallelism])], enable_openmp=$enableval, enable_openmp=no)
cannam@127 669
cannam@127 670 if test "$enable_openmp" = "yes"; then
cannam@127 671 AC_DEFINE(HAVE_OPENMP,1,[Define to enable OpenMP])
cannam@127 672 AX_OPENMP([], [AC_MSG_ERROR([don't know how to enable OpenMP])])
cannam@127 673 fi
cannam@127 674
cannam@127 675 AC_ARG_ENABLE(threads, [AC_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no)
cannam@127 676
cannam@127 677 if test "$enable_threads" = "yes"; then
cannam@127 678 AC_DEFINE(HAVE_THREADS,1,[Define to enable SMP threads])
cannam@127 679 fi
cannam@127 680
cannam@127 681 AC_ARG_WITH(combined-threads, [AC_HELP_STRING([--with-combined-threads],[combine threads into main libfftw3])], with_combined_threads=$withval, with_combined_threads=no)
cannam@127 682
cannam@127 683 if test "$with_combined_threads" = yes; then
cannam@127 684 if test "$enable_openmp" = "yes"; then
cannam@127 685 AC_MSG_ERROR([--with-combined-threads incompatible with --enable-openmp])
cannam@127 686 fi
cannam@127 687 if test "$enable_threads" != "yes"; then
cannam@127 688 AC_MSG_ERROR([--with-combined-threads requires --enable-threads])
cannam@127 689 fi
cannam@127 690 fi
cannam@127 691
cannam@127 692 dnl Check for threads library...
cannam@127 693 THREADLIBS=""
cannam@127 694 if test "$enable_threads" = "yes"; then
cannam@127 695 # Win32 threads are the default on Windows:
cannam@127 696 if test -z "$THREADLIBS"; then
cannam@127 697 AC_MSG_CHECKING([for Win32 threads])
cannam@127 698 AC_TRY_LINK([#include <windows.h>],
cannam@127 699 [_beginthreadex(0,0,0,0,0,0);],
cannam@127 700 [THREADLIBS=" "; AC_MSG_RESULT(yes)],
cannam@127 701 [AC_MSG_RESULT(no)])
cannam@127 702 fi
cannam@127 703
cannam@127 704 # POSIX threads, the default choice everywhere else:
cannam@127 705 if test -z "$THREADLIBS"; then
cannam@127 706 ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
cannam@127 707 CC="$PTHREAD_CC"
cannam@127 708 AC_DEFINE(USING_POSIX_THREADS, 1, [Define if we have and are using POSIX threads.])])
cannam@127 709 fi
cannam@127 710
cannam@127 711 if test -z "$THREADLIBS"; then
cannam@127 712 AC_MSG_ERROR([couldn't find threads library for --enable-threads])
cannam@127 713 fi
cannam@127 714 AC_DEFINE(HAVE_THREADS, 1, [Define if we have a threads library.])
cannam@127 715 fi
cannam@127 716 AC_SUBST(THREADLIBS)
cannam@127 717 AM_CONDITIONAL(THREADS, test "$enable_threads" = "yes")
cannam@127 718 AM_CONDITIONAL(OPENMP, test "$enable_openmp" = "yes")
cannam@127 719 AM_CONDITIONAL(SMP, test "$enable_threads" = "yes" -o "$enable_openmp" = "yes")
cannam@127 720 AM_CONDITIONAL(COMBINED_THREADS, test x"$with_combined_threads" = xyes)
cannam@127 721
cannam@127 722
cannam@127 723 dnl -----------------------------------------------------------------------
cannam@127 724 dnl Check for not-always-available (not quite) cycle counters
cannam@127 725 case "${host_cpu}" in
cannam@127 726 armv7*)
cannam@127 727 AC_MSG_CHECKING([armv7a has 64 bits readable CNTVCT])
cannam@127 728 AC_RUN_IFELSE(
cannam@127 729 [AC_LANG_PROGRAM([[#include <stdint.h>]],
cannam@127 730 [[uint32_t Rt, Rt2 = 0;asm volatile("mrrc p15, 1, %0, %1, c14" : "=r"(Rt), "=r"(Rt2));]]
cannam@127 731 )],
cannam@127 732 [AC_DEFINE(ARMV7A_HAS_CNTCVT,1,[Define if CNTVCT is 64 bits readable on armv7a ])
cannam@127 733 AC_MSG_RESULT([yes])],
cannam@127 734 [AC_MSG_RESULT([no])]
cannam@127 735 )
cannam@127 736 ;;
cannam@127 737 aarch64)
cannam@127 738 AC_MSG_CHECKING([armv8 has 64 bits readable CNTVCT_EL0])
cannam@127 739 AC_RUN_IFELSE(
cannam@127 740 [AC_LANG_PROGRAM([[#include <stdint.h>]],
cannam@127 741 [[uint64_t Rt;asm volatile("mrs %0, CNTVCT_EL0" : "=r" (Rt));]]
cannam@127 742 )],
cannam@127 743 [AC_DEFINE(ARMV8_HAS_CNTCVT_EL0,1,[Define if CNTVCT_EL0 is 64 bits readable on armv8 ])
cannam@127 744 AC_MSG_RESULT([yes])],
cannam@127 745 [AC_MSG_RESULT([no])]
cannam@127 746 )
cannam@127 747 ;;
cannam@127 748 *)
cannam@127 749 ;;
cannam@127 750 esac
cannam@127 751
cannam@127 752 dnl -----------------------------------------------------------------------
cannam@127 753
cannam@127 754 AC_MSG_CHECKING([whether a cycle counter is available])
cannam@127 755 save_CPPFLAGS=$CPPFLAGS
cannam@127 756 CPPFLAGS="$CPPFLAGS -I$srcdir/kernel"
cannam@127 757 AC_TRY_CPP([#include "cycle.h"
cannam@127 758 #ifndef HAVE_TICK_COUNTER
cannam@127 759 # error No cycle counter
cannam@127 760 #endif], [ok=yes], [ok=no])
cannam@127 761 CPPFLAGS=$save_CPPFLAGS
cannam@127 762 AC_MSG_RESULT($ok)
cannam@127 763 if test $ok = no && test "x$with_slow_timer" = xno; then
cannam@127 764 echo "***************************************************************"
cannam@127 765 echo "WARNING: No cycle counter found. FFTW will use ESTIMATE mode "
cannam@127 766 echo " for all plans. See the manual for more information."
cannam@127 767 echo "***************************************************************"
cannam@127 768 fi
cannam@127 769
cannam@127 770 dnl -----------------------------------------------------------------------
cannam@127 771
cannam@127 772 AC_DEFINE_UNQUOTED(FFTW_CC, "$CC $CFLAGS", [C compiler name and flags])
cannam@127 773
cannam@127 774 AC_CONFIG_FILES([
cannam@127 775 Makefile
cannam@127 776 support/Makefile
cannam@127 777 genfft/Makefile
cannam@127 778 kernel/Makefile
cannam@127 779 simd-support/Makefile
cannam@127 780
cannam@127 781 dft/Makefile
cannam@127 782 dft/scalar/Makefile
cannam@127 783 dft/scalar/codelets/Makefile
cannam@127 784 dft/simd/Makefile
cannam@127 785 dft/simd/common/Makefile
cannam@127 786 dft/simd/sse2/Makefile
cannam@127 787 dft/simd/avx/Makefile
cannam@127 788 dft/simd/avx-128-fma/Makefile
cannam@127 789 dft/simd/avx2/Makefile
cannam@127 790 dft/simd/avx2-128/Makefile
cannam@127 791 dft/simd/avx512/Makefile
cannam@127 792 dft/simd/kcvi/Makefile
cannam@127 793 dft/simd/altivec/Makefile
cannam@127 794 dft/simd/vsx/Makefile
cannam@127 795 dft/simd/neon/Makefile
cannam@127 796 dft/simd/generic-simd128/Makefile
cannam@127 797 dft/simd/generic-simd256/Makefile
cannam@127 798
cannam@127 799 rdft/Makefile
cannam@127 800 rdft/scalar/Makefile
cannam@127 801 rdft/scalar/r2cf/Makefile
cannam@127 802 rdft/scalar/r2cb/Makefile
cannam@127 803 rdft/scalar/r2r/Makefile
cannam@127 804 rdft/simd/Makefile
cannam@127 805 rdft/simd/common/Makefile
cannam@127 806 rdft/simd/sse2/Makefile
cannam@127 807 rdft/simd/avx/Makefile
cannam@127 808 rdft/simd/avx-128-fma/Makefile
cannam@127 809 rdft/simd/avx2/Makefile
cannam@127 810 rdft/simd/avx2-128/Makefile
cannam@127 811 rdft/simd/avx512/Makefile
cannam@127 812 rdft/simd/kcvi/Makefile
cannam@127 813 rdft/simd/altivec/Makefile
cannam@127 814 rdft/simd/vsx/Makefile
cannam@127 815 rdft/simd/neon/Makefile
cannam@127 816 rdft/simd/generic-simd128/Makefile
cannam@127 817 rdft/simd/generic-simd256/Makefile
cannam@127 818
cannam@127 819 reodft/Makefile
cannam@127 820
cannam@127 821 threads/Makefile
cannam@127 822
cannam@127 823 api/Makefile
cannam@127 824
cannam@127 825 mpi/Makefile
cannam@127 826
cannam@127 827 libbench2/Makefile
cannam@127 828 tests/Makefile
cannam@127 829 doc/Makefile
cannam@127 830 doc/FAQ/Makefile
cannam@127 831
cannam@127 832 tools/Makefile
cannam@127 833 tools/fftw_wisdom.1
cannam@127 834 tools/fftw-wisdom-to-conf
cannam@127 835
cannam@127 836 m4/Makefile
cannam@127 837
cannam@127 838 fftw.pc
cannam@127 839 ])
cannam@127 840
cannam@127 841 AC_OUTPUT