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