modified PREC_SUFFIX so that libfftw3f.so would be named libfftw3fn.so, to facilitate...
[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 AC_PROG_CC
165 AX_COMPILER_VENDOR
166 AC_PROG_CC_STDC
167 AC_PROG_INSTALL
168 AC_PROG_LN_S
169 AC_PROG_MAKE_SET
170 AC_LIBTOOL_WIN32_DLL
171 AC_PROG_LIBTOOL
172
173 AC_CHECK_PROG(OCAMLC, ocamlc, ocamlc)
174 AC_CHECK_PROG(OCAMLOPT, ocamlopt, ocamlopt)
175 AC_CHECK_PROG(OCAMLDEP, ocamldep, ocamldep)
176
177 AC_SUBST(OCAMLCFLAGS)
178 AC_SUBST(OCAMLOPTCFLAGS)
179 AC_SUBST(OCAMLDEFS)
180 AC_SUBST(OCAMLLDFLAGS)
181
182 dnl -----------------------------------------------------------------------
183
184 AC_ARG_ENABLE(mpi, [AC_HELP_STRING([--enable-mpi],[compile FFTW MPI library])], enable_mpi=$enableval, enable_mpi=no)
185
186 if test "$enable_mpi" = "yes"; then
187    ACX_MPI([],[AC_MSG_ERROR([could not find mpi library for --enable-mpi])])
188    AC_CHECK_PROG(MPIRUN, mpirun, mpirun)
189    AC_SUBST(MPIRUN)
190 fi
191 AM_CONDITIONAL(MPI, test "$enable_mpi" = "yes")
192
193 dnl -----------------------------------------------------------------------
194
195 dnl determine CFLAGS first
196 AX_CC_MAXOPT
197
198 # some additional FFTW-specific tweaks to the flags
199 if test "$ac_test_CFLAGS" != "set"; then # if user didn't override CFLAGS
200     if test "x$CODELET_OPTIM" = x; then
201
202       case "${ax_cv_c_compiler_vendor}" in
203         gnu)
204             case "${host_cpu}" in
205                # gcc's ``optimizations'' slow down everything on IA32.
206                # (not to mention compiler bugs)
207                i?86*) CODELET_OPTIM=-O ;;
208             esac
209
210             # disable certain other gcc ``optimizations'' that produce worse 
211             # codelets
212             AX_CHECK_COMPILER_FLAGS(-fno-schedule-insns,
213                     [CODELET_OPTIM="$CODELET_OPTIM -fno-schedule-insns"])
214             AX_CHECK_COMPILER_FLAGS(-fno-web,
215                     [CODELET_OPTIM="$CODELET_OPTIM -fno-web"])
216             AX_CHECK_COMPILER_FLAGS(-fno-loop-optimize,
217                     [CODELET_OPTIM="$CODELET_OPTIM -fno-loop-optimize"])
218
219             # The gcc-3.4 inliner is totally broken; it does not inline
220             # small functions like VFMAI.
221             AX_CHECK_COMPILER_FLAGS(
222                     [--param inline-unit-growth=1000],
223                     [CODELET_OPTIM="$CODELET_OPTIM --param inline-unit-growth=1000"])
224             AX_CHECK_COMPILER_FLAGS(
225                     [--param large-function-growth=1000],
226                     [CODELET_OPTIM="$CODELET_OPTIM --param large-function-growth=1000"])
227             ;;
228
229         ibm) CODELET_OPTIM=-O;;
230
231       esac
232     fi
233 fi
234
235 AC_SUBST(CODELET_OPTIM)
236
237 case "${ax_cv_c_compiler_vendor}" in
238    intel) # Stop icc from defining __GNUC__, except on MacOS where this fails
239         case "${host_os}" in
240             *darwin*) ;; # icc -no-gcc fails to compile some system headers
241             *) 
242                AX_CHECK_COMPILER_FLAGS([-no-gcc], [CC="$CC -no-gcc"])
243                ;;
244         esac
245         ;;
246
247    hp) # must (sometimes) manually increase cpp limits to handle fftw3.h
248         AX_CHECK_COMPILER_FLAGS([-Wp,-H128000],
249                                 [CC="$CC -Wp,-H128000"])
250         ;;
251
252    portland) # -Masmkeyword required for asm("") cycle counters
253         AX_CHECK_COMPILER_FLAGS([-Masmkeyword],
254                                 [CC="$CC -Masmkeyword"])
255         ;;
256 esac
257
258 if test "x$SIMD_CFLAGS" = x; then
259 if test "${ax_cv_c_compiler_vendor}" = "gnu"; then
260     if test "$have_neon" = "yes"; then
261         if test "$have_arm" != "yes"; then
262                 AC_MSG_ERROR([Need an ARM cpu in order to use NEON optimizations])
263         fi
264         AX_CHECK_COMPILER_FLAGS(-mfpu=neon, [SIMD_CFLAGS="-mfpu=neon"],
265             [AC_MSG_ERROR([Target or compiler does not support -mfpu=neon])])
266     elif test "$have_sse" = "yes"; then
267         AX_CHECK_COMPILER_FLAGS(-msse, [SIMD_CFLAGS="-msse"],
268             [AC_MSG_ERROR([Need a version of gcc with -msse])])
269     elif test "$have_sse2" = "yes"; then
270         AX_CHECK_COMPILER_FLAGS(-msse2, [SIMD_CFLAGS="-msse2"],
271             [AC_MSG_ERROR([Need a version of gcc with -msse2])])
272     elif test "$have_altivec" = "yes"; then
273         # -DFAKE__VEC__ is a workaround because gcc-3.3 does not
274         # #define __VEC__ with -maltivec.
275         AX_CHECK_COMPILER_FLAGS(-faltivec, [SIMD_CFLAGS="-faltivec"],
276             [AX_CHECK_COMPILER_FLAGS(-maltivec -mabi=altivec,
277                 [SIMD_CFLAGS="-maltivec -mabi=altivec -DFAKE__VEC__"],
278                 [AX_CHECK_COMPILER_FLAGS(-fvec, [SIMD_CFLAGS="-fvec"],
279                     [AC_MSG_ERROR([Need a version of gcc with -maltivec])])])])
280     elif test "$have_mips_ps" = "yes"; then
281         # Just punt here and use only new 4.2 compiler :(
282         # Should add section for older compilers...
283         AX_CHECK_COMPILER_FLAGS(-mpaired-single,
284             [SIMD_CFLAGS="-mpaired-single"],
285             #[AC_MSG_ERROR([Need a version of gcc with -mpaired-single])])
286             [AX_CHECK_COMPILER_FLAGS(-march=mips64,
287               [SIMD_CFLAGS="-march=mips64"],
288                 [AC_MSG_ERROR(
289                  [Need a version of gcc with -mpaired-single or -march=mips64])
290                 ])])
291     fi
292 fi
293 fi
294 AC_SUBST(SIMD_CFLAGS)
295
296 dnl Checks for header files.
297 AC_HEADER_STDC
298 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])
299 dnl c_asm.h: Header file for enabling asm() on Digital Unix  
300 dnl intrinsics.h: cray unicos
301 dnl sys/sysctl.h: MacOS X altivec detection
302
303 dnl altivec.h requires the simd cflags
304 save_CFLAGS="$CFLAGS"
305 save_CPPFLAGS="$CPPFLAGS"
306 CFLAGS="$CFLAGS $SIMD_CFLAGS"
307 CPPFLAGS="$CPPFLAGS $SIMD_CFLAGS"
308 AC_CHECK_HEADERS([altivec.h])
309 CFLAGS="$save_CFLAGS"
310 CPPFLAGS="$save_CPPFLAGS"
311
312
313
314 dnl Checks for typedefs, structures, and compiler characteristics.
315 AC_C_CONST
316 AC_C_INLINE
317 AC_TYPE_SIZE_T
318 AC_HEADER_TIME
319 AC_CHECK_TYPE([long double],
320               [AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define to 1 if the compiler supports `long double'])],
321 [
322 if test $PRECISION = l; then
323     AC_MSG_ERROR([long double is not a supported type with your compiler.])
324 fi
325 ])
326 AC_CHECK_TYPE([hrtime_t],[AC_DEFINE(HAVE_HRTIME_T, 1, [Define to 1 if hrtime_t is defined in <sys/time.h>])],,
327 [
328 #if HAVE_SYS_TIME_H
329 #include <sys/time.h>
330 #endif
331 ])
332
333 AC_CHECK_SIZEOF(int)
334 AC_CHECK_SIZEOF(unsigned int)
335 AC_CHECK_SIZEOF(long)
336 AC_CHECK_SIZEOF(unsigned long)
337 AC_CHECK_SIZEOF(long long)
338 AC_CHECK_SIZEOF(unsigned long long)
339 AC_CHECK_SIZEOF(size_t)
340 AC_CHECK_SIZEOF(ptrdiff_t)
341
342 AC_CHECK_TYPES(uintptr_t, [], [AC_CHECK_SIZEOF(void *)], [$ac_includes_default
343 #ifdef HAVE_STDINT_H
344 #  include <stdint.h>
345 #endif])
346
347 AC_CHECK_SIZEOF(float)
348 AC_CHECK_SIZEOF(double)
349
350 dnl Checks for library functions.
351 AC_FUNC_ALLOCA
352 AC_FUNC_STRTOD
353 AC_FUNC_VPRINTF
354 AC_CHECK_LIB(m, sin)
355 if test "$have_cell" = "yes"; then
356    AC_CHECK_LIB(spe2, spe_context_run, [], [AC_CHECK_LIB(spe, spe_wait)])
357 fi
358
359 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])
360 AC_CHECK_DECLS([drand48, memalign, posix_memalign, sinl, cosl])
361
362 dnl Cray UNICOS _rtc() (real-time clock) intrinsic
363 AC_MSG_CHECKING([for _rtc intrinsic])
364 rtc_ok=yes
365 AC_TRY_LINK([#ifdef HAVE_INTRINSICS_H
366 #include <intrinsics.h>
367 #endif], [_rtc()], [AC_DEFINE(HAVE__RTC,1,[Define if you have the UNICOS _rtc() intrinsic.])], [rtc_ok=no])
368 AC_MSG_RESULT($rtc_ok)
369
370 if test "$PRECISION" = "l"; then
371         AC_CHECK_FUNCS([cosl sinl tanl], [], [AC_MSG_ERROR([long-double precision requires long-double trigonometric routines])])
372 fi
373
374 AC_MSG_CHECKING([for isnan])
375 AC_TRY_LINK([#include <math.h>
376 ], if (!isnan(3.14159)) isnan(2.7183);, ok=yes, ok=no)
377 if test "$ok" = "yes"; then
378         AC_DEFINE(HAVE_ISNAN,1,[Define if the isnan() function/macro is available.])
379 fi
380 AC_MSG_RESULT(${ok})
381
382 dnl TODO
383 AX_GCC_ALIGNS_STACK()
384
385 dnl override CFLAGS selection when debugging
386 if test "${enable_debug}" = "yes"; then
387         CFLAGS="-g"
388 fi
389
390 dnl add gcc warnings, in debug/maintainer mode only
391 if test "$enable_debug" = yes || test "$USE_MAINTAINER_MODE" = yes; then
392 if test "$ac_test_CFLAGS" != "set"; then
393         if test $ac_cv_prog_gcc = yes; then
394                 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 
395         fi
396 fi
397 fi
398
399 dnl -----------------------------------------------------------------------
400
401 AC_ARG_ENABLE(fortran, [AC_HELP_STRING([--disable-fortran],[don't include Fortran-callable wrappers])], enable_fortran=$enableval, enable_fortran=yes)
402
403 if test "$enable_fortran" = "yes"; then
404         AC_PROG_F77
405         if test -z "$F77"; then
406                 enable_fortran=no
407                 AC_MSG_WARN([*** Couldn't find f77 compiler; using default Fortran wrappers.])
408         else
409                 AC_F77_DUMMY_MAIN([], [enable_fortran=no
410                         AC_MSG_WARN([*** Couldn't figure out how to link C and Fortran; using default Fortran wrappers.])])
411         fi
412 else
413         AC_DEFINE([DISABLE_FORTRAN], 1, [Define to disable Fortran wrappers.])
414 fi
415
416 if test "x$enable_fortran" = xyes; then
417         AC_F77_WRAPPERS
418         AC_F77_FUNC(f77foo)
419         AC_F77_FUNC(f77_foo)
420         f77_foo2=`echo $f77foo | sed 's/77/77_/'`
421         if test "$f77_foo" = "$f77_foo2"; then
422                 AC_DEFINE(F77_FUNC_EQUIV, 1, [Define if F77_FUNC and F77_FUNC_ are equivalent.])
423
424                 # Include g77 wrappers by default for GNU systems or gfortran
425                 with_g77_wrappers=$ac_cv_f77_compiler_gnu
426                 case $host_os in *gnu*) with_g77_wrappers=yes ;; esac
427         fi
428 else
429         with_g77_wrappers=no
430 fi
431
432 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)
433 if test "x$with_g77_wrappers" = "xyes"; then
434         AC_DEFINE(WITH_G77_WRAPPERS,1,[Include g77-compatible wrappers in addition to any other Fortran wrappers.])
435 fi
436
437 dnl -----------------------------------------------------------------------
438 have_smp="no"
439 AC_ARG_ENABLE(openmp, [AC_HELP_STRING([--enable-openmp],[use OpenMP directives for parallelism])], enable_openmp=$enableval, enable_openmp=no)
440
441 if test "$enable_openmp" = "yes"; then
442         AC_DEFINE(HAVE_OPENMP,1,[Define to enable OpenMP])
443         have_smp="yes"
444 fi
445
446 AC_ARG_ENABLE(threads, [AC_HELP_STRING([--enable-threads],[compile FFTW SMP threads library])], enable_threads=$enableval, enable_threads=no)
447
448 if test "$enable_threads" = "yes"; then
449    AC_DEFINE(HAVE_THREADS,1,[Define to enable SMP threads])
450    if test "$enable_openmp" = "yes"; then
451       AC_MSG_ERROR([--enable-threads/--enable-openmp are mutually exclusive])
452    fi
453    if test "$have_cell" = "yes"; then
454       AC_MSG_ERROR([--enable-threads/--enable-cell are mutually exclusive])
455    fi
456    have_smp="yes"
457 fi
458
459 if test "$enable_openmp"x != "nox" -a "$enable_threads"x != "nox"; then
460    AC_MSG_ERROR([--enable-threads/--enable-openmp are mutually exclusive])
461 fi
462
463 AC_ARG_WITH(combined-threads, [AC_HELP_STRING([--with-combined-threads],[combine threads into main libfftw3])], with_combined_threads=$withval, with_combined_threads=no)
464
465 if test "$enable_openmp"x != nox; then
466    AX_OPENMP([THREADLIBS=" "
467      AC_DEFINE(USING_OPENMP_THREADS, 1, [Define if we have and are using OpenMP multithreading directives])
468      CFLAGS="$CFLAGS $OPENMP_CFLAGS"],
469      [AC_MSG_ERROR([don't know how to enable OpenMP])])
470 fi
471
472 dnl Check for threads library...
473 THREADLIBS=""
474 if test "$enable_threads" = "yes"; then
475         # POSIX threads, the default choice:
476         if test -z "$THREADLIBS"; then
477                 ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
478                              CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
479                              CC="$PTHREAD_CC"
480                              AC_DEFINE(USING_POSIX_THREADS, 1, [Define if we have and are using POSIX threads.])])
481         fi
482
483         if test -z "$THREADLIBS"; then
484                 AC_MSG_CHECKING([for Win32 threads])
485                 AC_TRY_LINK([#include <windows.h>],
486                         [_beginthreadex(0,0,0,0,0,0);],
487                         [THREADLIBS=" "; AC_MSG_RESULT(yes)],
488                         [AC_MSG_RESULT(no)])
489         fi
490
491         if test -z "$THREADLIBS"; then
492                 AC_MSG_ERROR([couldn't find threads library for --enable-threads])
493         fi
494         AC_DEFINE(HAVE_THREADS, 1, [Define if we have a threads library.])
495 fi
496 AC_SUBST(THREADLIBS)
497 AM_CONDITIONAL(SMP, test "$have_smp" = "yes")
498 AM_CONDITIONAL(COMBINED_THREADS, test x"$with_combined_threads" = xyes)
499
500 dnl -----------------------------------------------------------------------
501
502 AC_MSG_CHECKING([whether a cycle counter is available])
503 save_CPPFLAGS=$CPPFLAGS
504 CPPFLAGS="$CPPFLAGS -I$srcdir/kernel"
505 AC_TRY_CPP([#include "cycle.h"
506 #ifndef HAVE_TICK_COUNTER
507 #  error No cycle counter
508 #endif], [ok=yes], [ok=no])
509 CPPFLAGS=$save_CPPFLAGS
510 AC_MSG_RESULT($ok)
511 if test $ok = no && test "x$with_slow_timer" = xno; then
512         echo "***************************************************************"
513         echo "WARNING: No cycle counter found.  FFTW will use ESTIMATE mode  "
514         echo "         for all plans.  See the manual for more information."
515         echo "***************************************************************"
516 fi
517
518 dnl -----------------------------------------------------------------------
519
520 AC_DEFINE_UNQUOTED(FFTW_CC, "$CC $CFLAGS", [C compiler name and flags])
521 AC_DEFINE_UNQUOTED(CODELET_OPTIM, "$CODELET_OPTIM", [extra CFLAGS for codelets])
522
523 AC_CONFIG_FILES([
524    Makefile
525    support/Makefile
526    genfft/Makefile
527    kernel/Makefile
528    simd/Makefile
529    simd/nonportable/Makefile
530
531    dft/Makefile
532    dft/scalar/Makefile
533    dft/scalar/codelets/Makefile
534    dft/simd/Makefile
535    dft/simd/codelets/Makefile
536
537    rdft/Makefile
538    rdft/scalar/Makefile
539    rdft/scalar/r2cf/Makefile
540    rdft/scalar/r2cb/Makefile
541    rdft/scalar/r2r/Makefile
542    rdft/simd/Makefile
543    rdft/simd/codelets/Makefile
544
545    reodft/Makefile
546
547    threads/Makefile
548    cell/Makefile
549    cell/spu/Makefile
550
551    api/Makefile
552
553    libbench2/Makefile
554    tests/Makefile
555    doc/Makefile
556    doc/FAQ/Makefile
557
558    tools/Makefile
559    tools/fftw_wisdom.1
560    tools/fftw-wisdom-to-conf
561
562    m4/Makefile
563
564    fftw.pc
565 ])
566
567 AC_OUTPUT