comparison src/fftw-3.3.8/configure.ac @ 82:d0c2a83c1364

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