diff --git a/acconfig.h b/acconfig.h
index c568b0ee3dc7d8469c1e71fea54d6230afc2f7f1..691d3c527beea7fac8d5fdf608b9bbca014f9da0 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -63,6 +63,9 @@
 /* Define if you support the production (and use) of Win32 DLLs. */
 #undef HAVE_WIN32_DLL_SUPPORT
 
+/* Define if you have and want to use readline in Hugs. */
+#undef HAVE_LIBREADLINE
+
 /* Define if C Symbols have a leading underscore added by the compiler */
 #undef LEADING_UNDERSCORE
 
diff --git a/configure.in b/configure.in
index c36b9ac29777bf9c805103723fdb273c6f8742cb..0465ab62ca56b79343c487a1f0a6c133296caafd 100644
--- a/configure.in
+++ b/configure.in
@@ -615,7 +615,17 @@ AC_CHECK_LIB(iberty, xmalloc)
 AC_CHECK_LIB(bfd,    bfd_init)
 
 dnl ** check for readline, for Hugs
-AC_CHECK_LIB(readline, readline)
+AC_CHECK_LIB(readline, readline,
+[
+AC_DEFINE(HAVE_LIBREADLINE,1)
+HaveLibReadline=YES
+],
+[
+AC_DEFINE(HAVE_LIBREADLINE,0)
+HaveLibReadline=NO
+])
+AC_SUBST(HaveLibReadline)
+
 
 dnl ################################################################
 dnl Check for libraries
diff --git a/mk/config.mk.in b/mk/config.mk.in
index 7ce15a81540dc2d262c9eda8e187723e372c325b..713b42ce4c5771b768d878b265c4b5224ca11d41 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -233,6 +233,7 @@ GhcLibsWithReadline=NO
 # (no path == in standard include path)
 #
 ReadlineIncludePath=
+HaveLibReadline=@HaveLibReadline@
 
 # Strip local symbols from libraries?  This can make the libraries smaller,
 # but makes debugging somewhat more difficult.  Doesn't work with all ld's.