added ffmpeg_fft lib to fftw build system. Eventually, the static lib should be taken...
[gsoc2010-fftw-neon:gsoc2010-fftw-neon.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(fftw, 3.2.2, fftw@fftw.org)
3 AC_CONFIG_SRCDIR(kernel/ifftw.h)
4 SHARED_VERSION_INFO="5:4:2" # CURRENT:REVISION:AGE
5
6 AM_INIT_AUTOMAKE(1.7)
7 AM_CONFIG_HEADER(config.h)
8 AC_CONFIG_MACRO_DIR([m4])
9 AM_MAINTAINER_MODE
10 AC_SUBST(SHARED_VERSION_INFO)
11 AC_DISABLE_SHARED dnl to hell with shared libraries
12 AC_CANONICAL_HOST
13
14 dnl configure options
15 case "${host_cpu}" in
16   arm*) have_arm=yes;;
17   powerpc*) have_fma=yes;;
18   ia64*) have_fma=yes;;
19   hppa*) have_fma=yes;;
20   mips64*) have_fma=yes;;
21   *) have_fma=no;;
22 esac
23
24 AC_ARG_ENABLE(fma, [AC_HELP_STRING([--enable-fma],[enable optimizations for machines with fused multiply-add])], have_fma=$enableval)
25 if test "$have_fma"x = "yes"x; then
26         AC_DEFINE(HAVE_FMA,1,[Define if you have a machine with fused multiply-add])
27 fi
28
29
30 AC_ARG_ENABLE(debug, [AC_HELP_STRING([--enable-debug],[compile fftw with extra runtime checks for debugging])], ok=$enableval, ok=no)
31 if test "$ok" = "yes"; then
32         AC_DEFINE(FFTW_DEBUG,1,[Define to enable extra FFTW debugging code.])
33         debug_malloc=yes
34 else
35         debug_malloc=no
36 fi
37
38 AC_ARG_ENABLE(debug-malloc, [AC_HELP_STRING([--enable-debug-malloc],[enable malloc debugging version])], ok=$enableval, ok=$debug_malloc)
39 if test "$ok" = "yes"; then
40         AC_DEFINE(FFTW_DEBUG_MALLOC,1,[Define to enable debugging malloc.])
41 fi
42
43 AC_ARG_ENABLE(debug-alignment, [AC_HELP_STRING([--enable-debug-alignment],[enable alignment debugging hacks])], ok=$enableval, ok=no)
44 if test "$ok" = "yes"; then
45         AC_DEFINE(FFTW_DEBUG_ALIGNMENT,1,[Define to enable alignment debugging hacks.])
46 fi
47
48 AC_ARG_ENABLE(alloca, [AC_HELP_STRING([--enable-alloca],[enable use of the alloca() function (may be broken on mingw64)])], ok=$enableval, ok=yes)
49 if test "$ok" = "yes"; then
50         AC_DEFINE(FFTW_ENABLE_ALLOCA,1,[Define to enable the use of alloca().])
51 fi
52
53 AC_ARG_ENABLE(single, [AC_HELP_STRING([--enable-single],[compile fftw in single precision])], ok=$enableval, ok=no)
54 AC_ARG_ENABLE(float, [AC_HELP_STRING([--enable-float],[synonym for --enable-single])], ok=$enableval)
55 if test "$ok" = "yes"; then
56         AC_DEFINE(FFTW_SINGLE,1,[Define to compile in single precision.])
57         AC_DEFINE(BENCHFFT_SINGLE,1,[Define to compile in single precision.])
58         PRECISION=s
59 else
60         PRECISION=d
61 fi
62 AM_CONDITIONAL(SINGLE, test "$ok" = "yes")
63
64 AC_ARG_ENABLE(long-double, [AC_HELP_STRING([--enable-long-double],[compile fftw in long-double precision])], ok=$enableval, ok=no)
65 if test "$ok" = "yes"; then
66         if test "$PRECISION" = "s"; then
67                 AC_MSG_ERROR([--enable-single/--enable-long-double conflict])
68         fi
69         AC_DEFINE(FFTW_LDOUBLE,1,[Define to compile in long-double precision.])
70         AC_DEFINE(BENCHFFT_LDOUBLE,1,[Define to compile in long-double precision.])
71         PRECISION=l
72 fi
73 AM_CONDITIONAL(LDOUBLE, test "$ok" = "yes")
74 AC_SUBST(PRECISION)
75
76 have_simd="no"
77 simd_precision="s"
78
79 AC_ARG_ENABLE(neon, [AC_HELP_STRING([--enable-neon],[enable NEON optimizations])], have_neon=$enableval, have_neon=no)
80 if test "$have_neon" = "yes"; then
81         AC_DEFINE(HAVE_NEON,1,[Define to enable NEON optimizations.])
82         have_simd="yes"
83 fi
84
85 AC_ARG_ENABLE(sse, [AC_HELP_STRING([--enable-sse],[enable SSE optimizations])], have_sse=$enableval, have_sse=no)
86 if test "$have_sse" = "yes"; then
87         AC_DEFINE(HAVE_SSE,1,[Define to enable SSE optimizations.])
88         have_simd="yes"
89 fi
90
91 AC_ARG_ENABLE(sse2, [AC_HELP_STRING([--enable-sse2],[enable SSE2 optimizations])], have_sse2=$enableval, have_sse2=no)
92 if test "$have_sse2" = "yes"; then
93         AC_DEFINE(HAVE_SSE2,1,[Define to enable SSE2 optimizations.])
94         have_simd="yes"
95         simd_precision="d"
96         if test "$have_sse" = "yes"; then
97                 AC_MSG_ERROR([you cannot use SSE and SSE2 at the same time])
98         fi
99 fi
100
101 AC_ARG_ENABLE(altivec, [AC_HELP_STRING([--enable-altivec],[enable Altivec optimizations])], have_altivec=$enableval, have_altivec=no)
102 if test "$have_altivec" = "yes"; then
103         AC_DEFINE(HAVE_ALTIVEC,1,[Define to enable Altivec optimizations.])
104         have_simd="yes"
105 fi
106
107 AC_ARG_ENABLE(mips-ps, [AC_HELP_STRING([--enable-mips-ps],[enable MIPS pair-single optimizations])], have_mips_ps=$enableval, have_mips_ps=no)
108 if test "$have_mips_ps" = "yes"; then
109         AC_DEFINE(HAVE_MIPS_PS,1,[Define to enable MIPS paired-single optimizations.])
110         have_simd="yes"
111 fi
112
113 if test "$PRECISION" != "$simd_precision" && test "$have_simd" = "yes"; then
114         AC_MSG_ERROR([requested SIMD type does not match selected precision])
115 fi
116
117 AC_ARG_ENABLE(cell, [AC_HELP_STRING([--enable-cell],[enable optimizations for the Cell Broadband Engine])], have_cell=$enableval, have_cell=no)
118 if test "$have_cell" = "yes"; then
119         AC_DEFINE(HAVE_CELL,1,[Define to enable optimizations for the Cell Broadband Engine])
120         if test "$PRECISION" = "l"; then
121            AC_MSG_ERROR([Cell does not support long double])
122         fi
123 fi
124
125 AM_CONDITIONAL(HAVE_CELL, test "$have_cell" = "yes")
126 AM_CONDITIONAL(HAVE_SIMD, test "$have_simd" = "yes")
127
128 AC_ARG_WITH(slow-timer, [AC_HELP_STRING([--with-slow-timer],[use low-precision timers (SLOW)])], with_slow_timer=$withval, with_slow_timer=no)
129 if test "$with_slow_timer" = "yes"; then
130         AC_DEFINE(WITH_SLOW_TIMER,1,[Use low-precision timers, making planner very slow])
131 fi
132
133 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)
134 if test "$have_mips_zbus_timer" = "yes"; then
135         AC_DEFINE(HAVE_MIPS_ZBUS_TIMER,1,[Define to enable use of MIPS ZBus cycle-counter.])
136 fi
137
138 AC_ARG_ENABLE(armv7_cycle_counter, [AC_HELP_STRING([--enable-armv7-cycle-counter],[enable ARMv7 cycle counter])], have_armv7_cycle_counter=$enableval, have_armv7_cycle_counter=no)
139 if test "$have_armv7_cycle_counter" = "yes"; then
140         AC_DEFINE(HAVE_ARMV7_CYCLE_COUNTER,1,[Define to enable ARMV7 cycle counter])
141 fi
142
143 AC_ARG_WITH(our-malloc16, [AC_HELP_STRING([--with-our-malloc16],[use our 16-byte aligned malloc (helpful for Win32)])], with_our_malloc16=$withval, with_our_malloc16=no)
144 if test "$with_our_malloc16" = "yes"; then
145         AC_DEFINE(WITH_OUR_MALLOC16,1,[Use our own 16-byte aligned malloc routine; mainly helpful for Windows systems lacking aligned allocation system-library routines.])
146 fi
147
148 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)
149 if test "$with_windows_f77_mangling" = "yes"; then
150         AC_DEFINE(WINDOWS_F77_MANGLING,1,[Use common Windows Fortran mangling styles for the Fortran interfaces.])
151 fi
152
153 OCAML_INIT_PATHS
154
155 dnl compute library suffix
156 case "$PRECISION" in
157      s) PREC_SUFFIX=fn;;
158      d) PREC_SUFFIX=;;
159      l) PREC_SUFFIX=l;;
160 esac
161 AC_SUBST(PREC_SUFFIX)
162
163 dnl Checks for programs.
164 # for allowing subdir-objects in dft/simd/nonportable/arm/ffmpeg/Makefile.am
165 AM_PROG_CC_C_O
166 AM_PROG_AS
167 # AC_PROG_CC
168 AX_COMPILER_VENDOR
169 AC_PROG_CC_STDC
170 AC_PROG_INSTALL
171 AC_PROG_LN_S
172 AC_PROG_MAKE_SET
173 AC_LIBTOOL_WIN32_DLL
174 AC_PROG_LIBTOOL
175
176 AC_CHECK_PROG(OCAMLC, ocamlc, ocamlc)
177 AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt)
178 AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
179
180 AC_SUBST(OCAMLCFLAGS)
181 AC_SUBST(OCAMLOPTCFLAGS)
182 AC_SUBST(OCAMLDEFS)
183 AC_SUBST(OCAMLLDFLAGS)
184
185 dnl -----------------------------------------------------------------------
186
187 AC_ARG_ENABLE(mpi, [AC_HELP_STRING([--enable-mpi],[compile FFTW MPI library])], enable_mpi=$enableval, enable_mpi=no)
188
189 if test "$enable_mpi" = "yes"; then
190    ACX_MPI([],[AC_MSG_ERROR([could not find mpi library for --enable-mpi])])
191    AC_CHECK_PROG(MPIRUN, mpirun, mpirun)
192    AC_SUBST(MPIRUN)
193 fi
194 AM_CONDITIONAL(MPI, test "$enable_mpi" = "yes")
195
196 dnl -----------------------------------------------------------------------
197
198 dnl determine CFLAGS first
199 AX_CC_MAXOPT
200
201 # some additional FFTW-specific tweaks to the flags
202 if test "$ac_test_CFLAGS" != "set"; then # if user didn't override CFLAGS
203     if test "x$CODELET_OPTIM" = x; then
204
205       case "${ax_cv_c_compiler_vendor}" in
206         gnu)
207             case "${host_cpu}" in
208                # gcc's ``optimizations'' slow down everything on IA32.
209                # (not to mention compiler bugs)
210                i?86*) CODELET_OPTIM=-O ;;
211             esac
212
213             # disable certain other gcc ``optimizations'' that produce worse 
214             # codelets
215             AX_CHECK_COMPILER_FLAGS(-fno-schedule-insns,
216                     [CODELET_OPTIM="$CODELET_OPTIM -fno-schedule-insns"])
217             AX_CHECK_COMPILER_FLAGS(-fno-web,
218                     [CODELET_OPTIM="$CODELET_OPTIM -fno-web"])
219             AX_CHECK_COMPILER_FLAGS(-fno-loop-optimize,
220                     [CODELET_OPTIM="$CODELET_OPTIM -fno-loop-optimize"])
221
222             # The gcc-3.4 inliner is totally broken; it does not inline
223             # small functions like VFMAI.
224             AX_CHECK_COMPILER_FLAGS(
225                     [--param inline-unit-growth=1000],
226                     [CODELET_OPTIM="$CODELET_OPTIM --param inline-unit-growth=1000"])
227             AX_CHECK_COMPILER_FLAGS(
228                     [--param large-function-growth=1000],
229                     [CODELET_OPTIM="$CODELET_OPTIM --param large-function-growth=1000"])
230             ;;
231
232         ibm) CODELET_OPTIM=-O;;
233
234       esac
235     fi
236 fi
237
238 AC_SUBST(CODELET_OPTIM)
239
240 case "${ax_cv_c_compiler_vendor}" in
241    intel) # Stop icc from defining __GNUC__, except on MacOS where this fails
242         case "${host_os}" in
243             *darwin*) ;; # icc -no-gcc fails to compile some system headers
244             *) 
245                AX_CHECK_COMPILER_FLAGS([-no-gcc], [CC="$CC -no-gcc"])
246                ;;
247         esac
248         ;;
249
250    hp) # must (sometimes) manually increase cpp limits to handle fftw3.h
251         AX_CHECK_COMPILER_FLAGS([-Wp,-H128000],
252                                 [CC="$CC -Wp,-H128000"])
253         ;;
254
255    portland) # -Masmkeyword required for asm("") cycle counters
256         AX_CHECK_COMPILER_FLAGS([-Masmkeyword],
257                                 [CC="$CC -Masmkeyword"])
258         ;;
259 esac
260
261 if test "x$SIMD_CFLAGS" = x; then
262 if test "${ax_cv_c_compiler_vendor}" = "gnu"; then
263     if test "$have_neon" = "yes"; then
264         if test "$have_arm" != "yes"; then
265                 AC_MSG_ERROR([Need an ARM cpu in order to use NEON optimizations])
266         fi
267         AX_CHECK_COMPILER_FLAGS(-mfpu=neon, [SIMD_CFLAGS="-mfpu=neon"],
268             [AC_MSG_ERROR([Target or compiler does not support -mfpu=neon])])
269     elif test "$have_sse" = "yes"; then
270         AX_CHECK_COMPILER_FLAGS(-msse, [SIMD_CFLAGS="-msse"],
271             [AC_MSG_ERROR([Need a version of gcc with -msse])])
272     elif test "$have_sse2" = "yes"; then
273         AX_CHECK_COMPILER_FLAGS(-msse2, [SIMD_CFLAGS="-msse2"],
274             [AC_MSG_ERROR([Need a version of gcc with -msse2])])
275     elif test "$have_altivec" = "yes"; then
276         # -DFAKE__VEC__ is a workaround because gcc-3.3 does not
277         # #define __VEC__ with -maltivec.
278         AX_CHECK_COMPILER_FLAGS(-faltivec, [SIMD_CFLAGS="-faltivec"],
279             [AX_CHECK_COMPILER_FLAGS(-maltivec -mabi=altivec,
280                 [SIMD_CFLAGS="-maltivec -mabi=altivec -DFAKE__VEC__"],
281                 [AX_CHECK_COMPILER_FLAGS(-fvec, [SIMD_CFLAGS="-fvec"],
282                     [AC_MSG_ERROR([Need a version of gcc with -maltivec])])])])
283     elif test "$have_mips_ps" = "yes"; then
284         # Just punt here and use only new 4.2 compiler :(
285         # Should add section for older compilers...
286         AX_CHECK_COMPILER_FLAGS(-mpaired-single,
287             [SIMD_CFLAGS="-mpaired-single"],
288             #[AC_MSG_ERROR([Need a version of gcc with -mpaired-single])])
289             [AX_CHECK_COMPILER_FLAGS(-march=mips64,
290               [SIMD_CFLAGS="-march=mips64"],
291                 [AC_MSG_ERROR(
292                  [Need a version of gcc with -mpaired-single or -march=mips64])
293                 ])])
294     fi
295 fi
296 fi
297 AC_SUBST(SIMD_CFLAGS)
298
299 dnl Checks for header files.
300 AC_HEADER_STDC
301 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 xmmintrin.h])
302 dnl c_asm.h: Header file for enabling asm() on Digital Unix  
303 dnl intrinsics.h: cray unicos
304 dnl sys/sysctl.h: MacOS X altivec detection
305
306 dnl altivec.h requires the simd cflags
307 save_CFLAGS="$CFLAGS"
308 save_CPPFLAGS="$CPPFLAGS"
309 CFLAGS="$CFLAGS $SIMD_CFLAGS"
310 CPPFLAGS="$CPPFLAGS $SIMD_CFLAGS"
311 AC_CHECK_HEADERS([altivec.h])
312 CFLAGS="$save_CFLAGS"
313 CPPFLAGS="$save_CPPFLAGS"
314
315
316
317 dnl Checks for typedefs, structures, and compiler characteristics.
318 AC_C_CONST
319 AC_C_INLINE
320 AC_TYPE_SIZE_T
321 AC_HEADER_TIME
322 AC_CHECK_TYPE([long double],
323               [AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports `long double'])],
324 [
325 if test $PRECISION = l; then
326     AC_MSG_ERROR([long double is not a supported type with your compiler.])
327 fi
328 ])
329 AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,
330 [
331 #if HAVE_SYS_TIME_H
332 #include <sys/time.h>
333 #endif
334 ])
335
336 AC_CHECK_SIZEOF(int)
337 AC_CHECK_SIZEOF(unsigned int)
338 AC_CHECK_SIZEOF(long)
339 AC_CHECK_SIZEOF(unsigned long)
340 AC_CHECK_SIZEOF(long long)
341 AC_CHECK_SIZEOF(unsigned long long)
342 AC_CHECK_SIZEOF(size_t)
343 AC_CHECK_SIZEOF(ptrdiff_t)
344
345 AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
346 #ifdef HAVE_STDINT_H
347 #  include <stdint.h>
348 #endif])
349
350 AC_CHECK_SIZEOF(float)
351 AC_CHECK_SIZEOF(double)
352
353 dnl Checks for library functions.
354 AC_FUNC_ALLOCA
355 AC_FUNC_STRTOD
356 AC_FUNC_VPRINTF
357 AC_CHECK_LIB(m, sin)
358 if test "$have_cell" = "yes"; then
359    AC_CHECK_LIB(spe2, spe_context_run, [], [AC_CHECK_LIB(spe, spe_wait)])
360 fi
361
362 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])
363 AC_CHECK_DECLS([drand48, memalign, posix_memalign, sinl, cosl])
364
365 dnl Cray UNICOS _rtc() (real-time clock) intrinsic
366 AC_MSG_CHECKING([for _rtc intrinsic])
367 rtc_ok=yes
368 AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H
369 #include <intrinsics.h>
370 #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no])
371 AC_MSG_RESULT($rtc_ok)
372
373 if test "$PRECISION" = "l"; then
374         AC_CHECK_FUNCS([cosl sinl tanl], [], [AC_MSG_ERROR([long-double precision requires long-double trigonometric routines])])
375 fi
376
377 AC_MSG_CHECKING([for isnan])
378 AC_TRY_LINK([#include <math.h>
379 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
380 if test "$ok" = "yes"; then
381         AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
382 fi
383 AC_MSG_RESULT(${ok})
384
385 dnl TODO
386 AX_GCC_ALIGNS_STACK()
387
388 dnl override CFLAGS selection when debugging
389 if test "${enable_debug}" = "yes"; then
390         CFLAGS="-g"
391 fi
392
393 dnl add gcc warnings, in debug/maintainer mode only
394 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
395 if test "$ac_test_CFLAGS" != "set"; then
396         if test $ac_cv_prog_gcc = yes; then
397                 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 
398         fi
399 fi
400 fi
401
402 dnl -----------------------------------------------------------------------
403
404 AC_ARG_ENABLE(fortran, [AC_HELP_STRING([--disable-fortran],[don't include Fortran-callable wrappers])], enable_fortran=$enableval, enable_fortran=yes)
405
406 if test "$enable_fortran" = "yes"; then
407         AC_PROG_F77
408         if test -z "$F77"; then
409                 enable_fortran=no
410                 AC_MSG_WARN([*** Couldn't find f77 compiler; using default Fortran wrappers.])
411         else
412                 AC_F77_DUMMY_MAIN([], [enable_fortran=no
413                         AC_MSG_WARN([*** Couldn't figure out how to link C and Fortran; using default Fortran wrappers.])])
414         fi
415 else
416         AC_DEFINE([DISABLE_FORTRAN], 1, [Define to disable Fortran wrappers.])
417 fi
418
419 if test "x$enable_fortran" = xyes; then
420         AC_F77_WRAPPERS
421         AC_F77_FUNC(f77foo)
422         AC_F77_FUNC(f77_foo)
423         f77_foo2=`echo $f77foo | sed 's/77/77_/'`
424         if test "$f77_foo" = "$f77_foo2"; then
425                 AC_DEFINE(F77_FUNC_EQUIV, 1, [Define if F77_FUNC and F77_FUNC_ are equivalent.])
426
427                 # Include g77 wrappers by default for GNU systems or gfortran
428                 with_g77_wrappers=$ac_cv_f77_compiler_gnu
429                 case $host_os in *gnu*) with_g77_wrappers=yes ;; esac
430         fi
431 else
432         with_g77_wrappers=no
433 fi
434
435 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)
436 if test "x$with_g77_wrappers" = "xyes"; then
437         AC_DEFINE(WITH_G77_WRAPPERS,1,[Include g77-compatible wrappers in addition to any other Fortran wrappers.])
438 fi
439
440 dnl -----------------------------------------------------------------------
441 have_smp="no"
442 AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],[use OpenMP directives for parallelism])], enable_openmp=$enableval, enable_openmp=no)
443
444 if test "$enable_openmp" = "yes"; then
445         AC_DEFINE(HAVE_OPENMP,1,[Define to enable OpenMP])
446         have_smp="yes"
447 fi
448
449 AC_ARG_ENABLE(threads, [AC_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no)
450
451 if test "$enable_threads" = "yes"; then
452    AC_DEFINE(HAVE_THREADS,1,[Define to enable SMP threads])
453    if test "$enable_openmp" = "yes"; then
454       AC_MSG_ERROR([--enable-threads/--enable-openmp are mutually exclusive])
455    fi
456    if test "$have_cell" = "yes"; then
457       AC_MSG_ERROR([--enable-threads/--enable-cell are mutually exclusive])
458    fi
459    have_smp="yes"
460 fi
461
462 if test "$enable_openmp"x != "nox" -a "$enable_threads"x != "nox"; then
463    AC_MSG_ERROR([--enable-threads/--enable-openmp are mutually exclusive])
464 fi
465
466 AC_ARG_WITH(combined-threads, [AC_HELP_STRING([--with-combined-threads],[combine threads into main libfftw3])], with_combined_threads=$withval, with_combined_threads=no)
467
468 if test "$enable_openmp"x != nox; then
469    AX_OPENMP([THREADLIBS=" "
470      AC_DEFINE(USING_OPENMP_THREADS, 1, [Define if we have and are using OpenMP multithreading directives])
471      CFLAGS="$CFLAGS $OPENMP_CFLAGS"],
472      [AC_MSG_ERROR([don't know how to enable OpenMP])])
473 fi
474
475 dnl Check for threads library...
476 THREADLIBS=""
477 if test "$enable_threads" = "yes"; then
478         # POSIX threads, the default choice:
479         if test -z "$THREADLIBS"; then
480                 ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
481                              CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
482                              CC="$PTHREAD_CC"
483                              AC_DEFINE(USING_POSIX_THREADS, 1, [Define if we have and are using POSIX threads.])])
484         fi
485
486         if test -z "$THREADLIBS"; then
487                 AC_MSG_CHECKING([for Win32 threads])
488                 AC_TRY_LINK([#include <windows.h>],
489                         [_beginthreadex(0,0,0,0,0,0);],
490                         [THREADLIBS=" "; AC_MSG_RESULT(yes)],
491                         [AC_MSG_RESULT(no)])
492         fi
493
494         if test -z "$THREADLIBS"; then
495                 AC_MSG_ERROR([couldn't find threads library for --enable-threads])
496         fi
497         AC_DEFINE(HAVE_THREADS, 1, [Define if we have a threads library.])
498 fi
499 AC_SUBST(THREADLIBS)
500 AM_CONDITIONAL(SMP, test "$have_smp" = "yes")
501 AM_CONDITIONAL(COMBINED_THREADS, test x"$with_combined_threads" = xyes)
502
503 dnl -----------------------------------------------------------------------
504
505 AC_MSG_CHECKING([whether a cycle counter is available])
506 save_CPPFLAGS=$CPPFLAGS
507 CPPFLAGS="$CPPFLAGS -I$srcdir/kernel"
508 AC_TRY_CPP([#include "cycle.h"
509 #ifndef HAVE_TICK_COUNTER
510 #  error No cycle counter
511 #endif], [ok=yes], [ok=no])
512 CPPFLAGS=$save_CPPFLAGS
513 AC_MSG_RESULT($ok)
514 if test $ok = no && test "x$with_slow_timer" = xno; then
515         echo "***************************************************************"
516         echo "WARNING: No cycle counter found.  FFTW will use ESTIMATE mode  "
517         echo "         for all plans.  See the manual for more information."
518         echo "***************************************************************"
519 fi
520
521 dnl -----------------------------------------------------------------------
522
523 AC_DEFINE_UNQUOTED(FFTW_CC, "$CC $CFLAGS", [C compiler name and flags])
524 AC_DEFINE_UNQUOTED(CODELET_OPTIM, "$CODELET_OPTIM", [extra CFLAGS for codelets])
525
526 AC_CONFIG_FILES([
527    Makefile
528    support/Makefile
529    genfft/Makefile
530    kernel/Makefile
531    simd/Makefile
532    simd/nonportable/Makefile
533
534    dft/Makefile
535    dft/scalar/Makefile
536    dft/scalar/codelets/Makefile
537    dft/simd/Makefile
538    dft/simd/codelets/Makefile
539    dft/simd/nonportable/Makefile
540    dft/simd/nonportable/arm/Makefile
541    dft/simd/nonportable/arm/ffmpeg/Makefile
542
543    rdft/Makefile
544    rdft/scalar/Makefile
545    rdft/scalar/r2cf/Makefile
546    rdft/scalar/r2cb/Makefile
547    rdft/scalar/r2r/Makefile
548    rdft/simd/Makefile
549    rdft/simd/codelets/Makefile
550
551    reodft/Makefile
552
553    threads/Makefile
554    cell/Makefile
555    cell/spu/Makefile
556
557    api/Makefile
558
559    libbench2/Makefile
560    tests/Makefile
561    doc/Makefile
562    doc/FAQ/Makefile
563
564    tools/Makefile
565    tools/fftw_wisdom.1
566    tools/fftw-wisdom-to-conf
567
568    m4/Makefile
569
570    fftw.pc
571 ])
572
573 AC_OUTPUT