diff --git a/configure b/configure
index 680d009ec9f964172a88dc720b9127f39ba6cba2..54434ece1578311ad0c3ed956d35ebd50b1e681f 100755
--- a/configure
+++ b/configure
@@ -6568,17 +6568,17 @@ if test $fftw == true ; then
     ac_fn_cxx_check_header_mongrel "$LINENO" "fftw3.h" "ac_cv_header_fftw3_h" "$ac_includes_default"
 if test "x$ac_cv_header_fftw3_h" = xyes; then :
 
-      ac_fn_cxx_check_func "$LINENO" "exit" "ac_cv_func_exit"
-if test "x$ac_cv_func_exit" = xyes; then :
+      ac_fn_cxx_check_func "$LINENO" "fftw_execute" "ac_cv_func_fftw_execute"
+if test "x$ac_cv_func_fftw_execute" = xyes; then :
   found=ok
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -lfftw" >&5
-$as_echo_n "checking for exit in -lfftw... " >&6; }
-if ${ac_cv_lib_fftw_exit+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fftw_execute in -lfftw3" >&5
+$as_echo_n "checking for fftw_execute in -lfftw3... " >&6; }
+if ${ac_cv_lib_fftw3_fftw_execute+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfftw  $LIBS"
+LIBS="-lfftw3  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -6588,28 +6588,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char exit ();
+char fftw_execute ();
 int
 main ()
 {
-return exit ();
+return fftw_execute ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_cxx_try_link "$LINENO"; then :
-  ac_cv_lib_fftw_exit=yes
+  ac_cv_lib_fftw3_fftw_execute=yes
 else
-  ac_cv_lib_fftw_exit=no
+  ac_cv_lib_fftw3_fftw_execute=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw_exit" >&5
-$as_echo "$ac_cv_lib_fftw_exit" >&6; }
-if test "x$ac_cv_lib_fftw_exit" = xyes; then :
-  LIBS="-lfftw $LIBS" && found=ok
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_fftw3_fftw_execute" >&5
+$as_echo "$ac_cv_lib_fftw3_fftw_execute" >&6; }
+if test "x$ac_cv_lib_fftw3_fftw_execute" = xyes; then :
+  LIBS="-lfftw3 $LIBS" && found=ok
 fi
 
 
diff --git a/configure.ac b/configure.ac
index d9e9f31f8ee2e10405c7a586212a4762c1e0c24c..cd09cf4e1ceadb16305f4f32211ddc4597b97895 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,7 +469,7 @@ if test $boost_graph == true ; then
   PLUMED_CHECK_PACKAGE([boost/graph/graph_utility.hpp],[exit],[__PLUMED_HAS_BOOST_GRAPH],[boost_graph])
 fi
 if test $fftw == true ; then
-  PLUMED_CHECK_PACKAGE([fftw3.h],[exit],[__PLUMED_HAS_FFTW],[fftw])
+  PLUMED_CHECK_PACKAGE([fftw3.h],[fftw_execute],[__PLUMED_HAS_FFTW],[fftw3])
 fi
 
 # in non-debug mode, add -DNDEBUG