Fix check for rl_get_keymap
authorDaniel Llorens <lloda@sarc.name>
Mon, 27 Jan 2020 21:43:56 +0000 (22:43 +0100)
committerDaniel Llorens <lloda@sarc.name>
Tue, 28 Jan 2020 10:11:24 +0000 (11:11 +0100)
This lets Guile build on OS X (tested on 10.14) with the system-provided
libreadline.

* acinclude.m4 (GUILE_READLINE): Check for rl_get_keymap_name instead of
  rl_get_keymap. The system provided libreadline is an alias to libedit,
  which has _keymap but not _keymap_name, and Guile uses both.
* guile-readline/readline.c: Adjust the include guard.

acinclude.m4
guile-readline/readline.c

index 631f9b0640385f764664266718e3c568e8e2ea22..dd8f0bff55f75cbaa446a20b1c5fd645b026eb15 100644 (file)
@@ -427,10 +427,12 @@ AC_DEFUN([GUILE_READLINE], [
                    [[#include <stdio.h>]
                     [#include <readline/readline.h>]])
 
-    dnl Check for rl_get_keymap.  We only use this for deciding whether to
-    dnl install paren matching on the Guile command line (when using
-    dnl readline for input), so it's completely optional.
-    AC_CHECK_FUNCS([rl_get_keymap])
+    dnl Check rl_get_keymap_name instead of rl_get_keymap because some
+    dnl systems only have the latter and the feature needs both.
+    dnl We only use this for deciding whether to install paren matching on
+    dnl the Guile command line (when using readline for input), so it's
+    dnl completely optional.
+    AC_CHECK_FUNCS([rl_get_keymap_name])
 
     AC_CACHE_CHECK([for rl_getc_function pointer in readline],
                     ac_cv_var_rl_getc_function,
index b6e290b5080110aea7519c0115bbd2852fd896b7..5c4a32689607d5efd933b1f0a93914926c2616b2 100644 (file)
@@ -420,7 +420,7 @@ completion_function (char *text, int continuep)
     }
 }
 
-#if HAVE_RL_GET_KEYMAP
+#if HAVE_RL_GET_KEYMAP_NAME
 /*Bouncing parenthesis (reimplemented by GH, 11/23/98, since readline is strict gpl)*/
 
 static int match_paren (int x, int k);
@@ -515,7 +515,7 @@ match_paren (int x, int k)
     }
   return 0;
 }
-#endif /* HAVE_RL_GET_KEYMAP */
+#endif /* HAVE_RL_GET_KEYMAP_NAME */
 
 #endif /* HAVE_RL_GETC_FUNCTION */
 
@@ -551,7 +551,7 @@ scm_init_readline ()
   rl_variable_bind ("enable-bracketed-paste",
                     SCM_READLINE_BRACKETED_PASTE ? "on" : "off");
 
-#if HAVE_RL_GET_KEYMAP
+#if HAVE_RL_GET_KEYMAP_NAME
   init_bouncing_parens();
 #endif
   scm_add_feature ("readline");