diff --git a/configure.in b/configure.in
index d18e57e3cb9e3048afe3443b2eb7a508c12030ee..045b890f35eb634fc226e7f994c15623124a3207 100644
--- a/configure.in
+++ b/configure.in
@@ -928,7 +928,7 @@ AC_TRY_LINK([#include <stdio.h>
 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
 [AC_MSG_RESULT(no)])
 
-AC_CHECK_FUNCS([rl_completion_matches])
+AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function])
 
 
 dnl Cannot use AC_CHECK_FUNC because finite may be a macro
diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c
index dd323162dda8397f85e619945f64ca0f5f8aaafd..e8ed3c668ae80143128b99fbb4655b246fca6c9c 100644
--- a/src/bin/psql/tab-complete.c
+++ b/src/bin/psql/tab-complete.c
@@ -3,7 +3,7 @@
  *
  * Copyright 2000 by PostgreSQL Global Development Group
  *
- * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.32 2001/05/08 21:06:43 petere Exp $
+ * $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.33 2001/06/11 22:12:48 momjian Exp $
  */
 
 /*----------------------------------------------------------------------
@@ -60,7 +60,9 @@
 #include "common.h"
 #include "settings.h"
 
-extern char *filename_completion_function();
+#ifdef HAVE_RL_FILENAME_COMPLETION_FUNCTION
+#define filename_completion_function rl_filename_completion_function
+#endif
 
 #ifdef HAVE_RL_COMPLETION_MATCHES
 #define completion_matches(x, y) rl_completion_matches((x), ((rl_compentry_func_t *)(y)))
diff --git a/src/include/config.h.in b/src/include/config.h.in
index b574774b838a8687c158fa0d50b149508f738919..fde5a1385ba5e0b44b60690a33a9a73239c13c81 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -8,7 +8,7 @@
  * or in config.h afterwards.  Of course, if you edit config.h, then your
  * changes will be overwritten the next time you run configure.
  *
- * $Id: config.h.in,v 1.165 2001/06/02 18:25:18 petere Exp $
+ * $Id: config.h.in,v 1.166 2001/06/11 22:12:48 momjian Exp $
  */
 
 #ifndef CONFIG_H
@@ -589,6 +589,9 @@ extern int fdatasync(int fildes);
 /* Set to 1 if you have rl_completion_matches */
 #undef HAVE_RL_COMPLETION_MATCHES
 
+/* Set to 1 if you have rl_filename_completion_function */
+#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION
+
 /* Set to 1 if you have getopt_long() (GNU long options) */
 #undef HAVE_GETOPT_LONG