X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=m4%2Ffftw.m4;fp=m4%2Ffftw.m4;h=e26434b325b837724ec74f00ebd06ddd3b2966ad;hp=0000000000000000000000000000000000000000;hb=7306cea52f69df550a21b3256803064da9544e39;hpb=ffb347c7cdd34ca9a5acbf34c70e7539f956fdb0 diff --git a/m4/fftw.m4 b/m4/fftw.m4 new file mode 100644 index 0000000..e26434b --- /dev/null +++ b/m4/fftw.m4 @@ -0,0 +1,52 @@ +AC_DEFUN([RFX_CHECK_FFTW], +[ + OLDCPPFLAGS="${CPPFLAGS}" + OLDLIBS="${LIBS}" + + AC_CHECK_LIB(fftw3, fftw_plan_dft_r2c_2d, [HAVE_LIBFFTW3=1],) + AC_CHECK_HEADERS(fftw3.h,[HAVE_FFTW3_H=1]) + + if test "x${HAVE_LIBFFTW3}" != "x";then + if test "x${HAVE_FFTW3_H}" != "x";then + HAVE_FFTW3=1 + fi + fi + + if test "x${HAVE_FFTW3}" = "x1"; then + LIBS="$LIBS -lfftw3" + AC_MSG_CHECKING([whether we can compile the fftw3 test program]) + + cat > conftest.c << EOF + #include + + int main() + { + char*data = 0; + fftw_plan plan = fftw_plan_dft_2d(600, 800, (fftw_complex*)data, (fftw_complex*)data, FFTW_FORWARD, FFTW_ESTIMATE); + plan = fftw_plan_dft_r2c_2d(600, 800, (double*)data, (fftw_complex*)data, FFTW_ESTIMATE); + plan = fftw_plan_dft_c2r_2d(600, 800, (fftw_complex*)data, (double*)data, FFTW_ESTIMATE); + fftw_execute(plan); + fftw_destroy_plan(plan); + } +EOF + + ac_link='$CC $CPPFLAGS $CFLAGS conftest.c $LDFLAGS $LIBS -o conftest${ac_exeext}' + if { (eval echo fftw3.m4:71: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_FFTW3], [1], [Define if fftw3 is available]) + else + echo "configure: failed program was:" >&5 + cat conftest.c >&5 + HAVE_FFTW3=0 + AC_MSG_RESULT(no) + fi + rm -f conftest* + fi + + # if the above didn't work out, reset all changes to the compiler variables. + if test "x${HAVE_FFTW3}" "!=" "x1"; then + CPPFLAGS=$OLDCPPFLAGS + LIBS=$OLDLIBS + fi +]) +