annotate src/fftw-3.3.5/configure.ac @ 42:2cd0e3b3e1fd

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