new parameter -s textonly
[swftools.git] / m4 / fftw.m4
1 AC_DEFUN([RFX_CHECK_FFTW],
2 [
3   OLDCPPFLAGS="${CPPFLAGS}"
4   OLDLIBS="${LIBS}"
5         
6   AC_CHECK_LIB(fftw3, fftw_plan_dft_r2c_2d, [HAVE_LIBFFTW3=1],)
7   AC_CHECK_HEADERS(fftw3.h,[HAVE_FFTW3_H=1])
8   
9   if test "x${HAVE_LIBFFTW3}" != "x";then
10     if test "x${HAVE_FFTW3_H}" != "x";then
11       HAVE_FFTW3=1
12     fi
13   fi
14   
15   if test "x${HAVE_FFTW3}" = "x1"; then 
16     LIBS="$LIBS -lfftw3"
17     AC_MSG_CHECKING([whether we can compile the fftw3 test program])
18   
19     cat > conftest.c << EOF
20     #include <fftw3.h>
21     
22     int main()
23     {
24         char*data = 0;
25         fftw_plan plan = fftw_plan_dft_2d(600, 800, (fftw_complex*)data, (fftw_complex*)data, FFTW_FORWARD, FFTW_ESTIMATE);
26         plan = fftw_plan_dft_r2c_2d(600, 800, (double*)data, (fftw_complex*)data, FFTW_ESTIMATE);
27         plan = fftw_plan_dft_c2r_2d(600, 800, (fftw_complex*)data, (double*)data, FFTW_ESTIMATE);
28         fftw_execute(plan);
29         fftw_destroy_plan(plan);
30     }
31 EOF
32     
33     ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}'
34     if { (eval echo fftw3.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
35       AC_MSG_RESULT(yes)
36       AC_DEFINE([HAVE_FFTW3], [1], [Define if fftw3 is available])
37     else
38       echo "configure: failed program was:" >&5
39       cat conftest.c >&5
40       HAVE_FFTW3=0
41       AC_MSG_RESULT(no)
42     fi
43     rm -f conftest*
44   fi
45   
46   # if the above didn't work out, reset all changes to the compiler variables.
47   if test "x${HAVE_FFTW3}" "!=" "x1"; then 
48       CPPFLAGS=$OLDCPPFLAGS
49       LIBS=$OLDLIBS
50   fi 
51 ])
52