6 AC_ARG_WITH(fftw,[ --with-fftw=PFX Prefix where fftw is installed (optional)], fftw_prefix="$withval", fftw_prefix="")
7 AC_ARG_WITH(fftw-libraries,[ --with-fftw-libraries=DIR Directory where fftw library is installed (optional)], fftw_libraries="$withval", fftw_libraries="")
8 AC_ARG_WITH(fftw-includes,[ --with-fftw-includes=DIR Directory where fftw header files are installed (optional)], fftw_includes="$withval", fftw_includes="")
9 AC_ARG_ENABLE(fftwtest, [ --disable-fftwtest Do not try to compile and run a test fftw program],, enable_fftwtest=yes)
11 if test "x$fftw_libraries" != "x" ; then
12 FFTW_LIBS="-L$fftw_libraries"
13 elif test "x$fftw_prefix" != "x" ; then
14 FFTW_LIBS="-L$fftw_prefix/lib"
15 elif test "x$prefix" != "xNONE"; then
16 FFTW_LIBS="-L$prefix/lib"
19 if test `uname` == Darwin; then
20 FFTW_LIBS="$FFTW_LIBS -framework FFTW3"
22 FFTW_LIBS="$FFTW_LIBS -lfftw3f"
25 if test "x$fftw_includes" != "x" ; then
26 FFTW_CFLAGS="-I$fftw_includes"
27 elif test "x$fftw_prefix" != "x" ; then
28 FFTW_CFLAGS="-I$fftw_prefix/include"
29 elif test "x$prefix" != "xNONE"; then
30 FFTW_CFLAGS="-I$prefix/include -I/usr/include"
33 AC_MSG_CHECKING(for FFTW)
36 if test "x$enable_fftwtest" = "xyes" ; then
37 ac_save_CFLAGS="$CFLAGS"
39 CFLAGS="$CFLAGS $FFTW_CFLAGS"
40 LIBS="$LIBS $FFTW_LIBS"
42 dnl Now check if the installed fftw is sufficiently new.
50 #include <fftw3/fftw3.h>
55 #ifdef FFTW_USE_DOUBLE
56 #define FFT_COMPLEX_TYPE fftw_complex
57 #define FFT_REAL_TYPE double
58 #define FFT_PLAN_TYPE fftw_plan
59 #define FFT_CREATE_PLAN fftw_plan_dft_c2r_2d
60 #define FFT_DELETE_PLAN fftw_destroy_plan
61 #define FFT_EXECUTE_PLAN fftw_execute
63 #define FFT_COMPLEX_TYPE fftwf_complex
64 #define FFT_REAL_TYPE float
65 #define FFT_PLAN_TYPE fftwf_plan
66 #define FFT_CREATE_PLAN fftwf_plan_dft_c2r_2d
67 #define FFT_DELETE_PLAN fftwf_destroy_plan
68 #define FFT_EXECUTE_PLAN fftwf_execute
75 FFT_COMPLEX_TYPE fft_in[N*(N/2+1)];
76 FFT_REAL_TYPE fft_out[N*N];
79 plan = FFT_CREATE_PLAN(N, N, fft_in, fft_out, 0);
82 system("touch conf.fftwtest");
86 ],, no_fftw=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
87 CFLAGS="$ac_save_CFLAGS"
91 if test "x$no_fftw" = "x" ; then
95 if test -f conf.fftwtest ; then
98 echo "*** Could not run FFTW test program, checking why..."
99 CFLAGS="$CFLAGS $FFTW_CFLAGS"
100 LIBS="$LIBS $FFTW_LIBS"
104 #include <fftw3/fftw3.h>
109 [ echo "*** The test program compiled, but did not run. This usually means"
110 echo "*** that the run-time linker is not finding FFTW or finding the wrong"
111 echo "*** version of FFTW. If it is not finding FFTW, you'll need to set your"
112 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
113 echo "*** to the installed location Also, make sure you have run ldconfig if that"
114 echo "*** is required on your system"
116 echo "*** If you have an old version installed, it is best to remove it, although"
117 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
118 [ echo "*** The test program failed to compile or link. See the file config.log for the"
119 echo "*** exact error that occured. This usually means FFTW was incorrectly installed"
120 echo "*** or that you have moved FFTW since it was installed." ])
121 CFLAGS="$ac_save_CFLAGS"
128 FFTW must be installed on your system but couldn't be found.
129 Please check that FFTW is installed.
130 FFTW version 3 is required.
138 AC_SUBST(FFTW_CFLAGS)