Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.12-107) unstable; urgency=medium
 .
   * Version_2.6.13pre103
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: 2021-11-09

--- gcl-2.6.12.orig/configure
+++ gcl-2.6.12/configure
@@ -7954,6 +7954,48 @@ if test "x$ac_cv_lib_readline_rl_initial
 
 $as_echo "#define USE_READLINE 1" >>confdefs.h
 
+				 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for el_getc in -lreadline" >&5
+$as_echo_n "checking for el_getc in -lreadline... " >&6; }
+if ${ac_cv_lib_readline_el_getc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lreadline  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char el_getc ();
+int
+main ()
+{
+return el_getc ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_readline_el_getc=yes
+else
+  ac_cv_lib_readline_el_getc=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_readline_el_getc" >&5
+$as_echo "$ac_cv_lib_readline_el_getc" >&6; }
+if test "x$ac_cv_lib_readline_el_getc" = xyes; then :
+
+$as_echo "#define READLINE_IS_EDITLINE 1" >>confdefs.h
+
+fi
+
 				 # These tests discover differences between readline 4.1 and 4.3
 				 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_matches in -lreadline" >&5
 $as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; }
--- gcl-2.6.12.orig/configure.in
+++ gcl-2.6.12/configure.in
@@ -1707,7 +1707,8 @@ fi
 if test "$enable_readline" != "no" ; then
     AC_CHECK_HEADERS([readline/readline.h],
 			AC_CHECK_LIB([readline],[rl_initialize],
-				[AC_DEFINE(USE_READLINE,1,[use readline library]) 
+				[AC_DEFINE(USE_READLINE,1,[use readline library])
+				 AC_CHECK_LIB([readline],[el_getc],AC_DEFINE(READLINE_IS_EDITLINE,1,[readline is editline]))
 				 # These tests discover differences between readline 4.1 and 4.3
 				 AC_CHECK_LIB([readline],[rl_completion_matches],
 					[AC_DEFINE(HAVE_DECL_RL_COMPLETION_MATCHES,1,[have readline completion matches])
--- gcl-2.6.12.orig/h/gclincl.h.in
+++ gcl-2.6.12/h/gclincl.h.in
@@ -339,6 +339,9 @@
 /* system pagewidth */
 #undef PAGEWIDTH
 
+/* readline is editline */
+#undef READLINE_IS_EDITLINE
+
 /* asm string to set the stack pointer */
 #undef SET_STACK_POINTER
 
--- gcl-2.6.12.orig/o/error.c
+++ gcl-2.6.12/o/error.c
@@ -148,6 +148,8 @@ Icall_gen_error_handler(object ci,object
 
   IapplyVector(sSuniversal_error_handler,n,b);
 
+  while (1);
+
 }
 
 /*
--- gcl-2.6.12.orig/o/main.c
+++ gcl-2.6.12/o/main.c
@@ -1201,8 +1201,12 @@ init_main(void) {
 #endif	 
   
 #ifdef USE_READLINE
+#ifdef READLINE_IS_EDITLINE
+  ADD_FEATURE("EDITLINE");
+#else
   ADD_FEATURE("READLINE");
 #endif
+#endif
 #if !defined(USE_DLOPEN)
   ADD_FEATURE("NATIVE-RELOC");
 #if defined(HAVE_LIBBFD) 
--- gcl-2.6.12.orig/o/prelink.c
+++ gcl-2.6.12/o/prelink.c
@@ -8,7 +8,12 @@ extern FILE *stderr __attribute__((weak)
 extern FILE *stdout __attribute__((weak));
 
 #ifdef USE_READLINE
-#if RL_READLINE_VERSION < 0x0600
+#ifdef READLINE_IS_EDITLINE
+#define MY_RL_VERSION 0x0600
+#else
+#define MY_RL_VERSION RL_READLINE_VERSION
+#endif
+#if MY_RL_VERSION < 0x0600
 extern Function		*rl_completion_entry_function __attribute__((weak));
 extern char		*rl_readline_name __attribute__((weak));
 #else
