diff -r 5f425363afa9 modules/readline/readline.lisp
--- a/modules/readline/readline.lisp	Sun Feb 26 12:00:08 2017 +0100
+++ b/modules/readline/readline.lisp	Sun Feb 26 12:06:00 2017 +0100
@@ -59,6 +59,14 @@
 (def-c-type readline-vcpfunc (c-function (:arguments (text c-string))))
 (def-c-type keymap c-pointer)
 
+(c-lines "#if RL_VERSION_MAJOR >= 7
+typedef unsigned long rl_readline_state_t;
+#else
+typedef int rl_readline_state_t;
+#endif~%")
+(c-lines "#define HAVE_RL_READLINE_STATE_T 1~%")
+(def-c-type rl_readline_state_t)
+
 ;;; Basic behavior
 (def-call-out readline (:name "readline")
   (:documentation
@@ -432,7 +443,7 @@
    "The version of this incarnation of the readline library, e.g., 0x0402."))
 (def-c-var gnu-readline-p (:name "rl_gnu_readline_p") (:type int)
   (:documentation "True if this is real GNU readline."))
-(def-c-var readline-state (:name "rl_readline_state") (:type int)
+(def-c-var readline-state (:name "rl_readline_state") (:type rl_readline_state_t)
   (:documentation "Flags word encapsulating the current readline state."))
 (def-c-var editing-mode (:name "rl_editing_mode") (:type int)
   (:documentation "Says which editing mode readline is currently using.
