From 3f986572f2d5bb62fe94349ba30bdd459f323752 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 26 Feb 2014 19:16:03 +0100 Subject: [PATCH] build: Check whether rl_free_keymap is declared. Readline versions up to and including 6.2 miss to declare the public symbol rl_free_keymap(). We currently work around this issue by manually declaring the function in interactive.c. The recently released readline-6.3, however, does declare that symbol. Since we compile with -Wredundant-decls this leads to the following warning: interactive.c:239:6: warning: redundant redeclaration of 'rl_free_keymap' [-Wredundant-decls] void rl_free_keymap(Keymap keymap); This patch gets rid of the warning by adding a check to configure.ac which detects whether the symbol is declared in the readline header file. Only if it is uncdelared we declare it manually as before. --- configure.ac | 10 +++++++++- interactive.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cdbc0e56..61ff547e 100644 --- a/configure.ac +++ b/configure.ac @@ -751,7 +751,15 @@ if test "$have_readline" = "yes"; then fi if test "$have_readline" = "yes"; then - : + AC_CHECK_DECL( + [rl_free_keymap], + [AC_DEFINE(RL_FREE_KEYMAP_DECLARED, 1, readline >= 6.3)], + [], + [ + #include + #include + ] + ) AC_SUBST(readline_cppflags) AC_SUBST(readline_ldflags) AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support) diff --git a/interactive.c b/interactive.c index 43cb99f2..5e4a89b3 100644 --- a/interactive.c +++ b/interactive.c @@ -227,6 +227,7 @@ static void wipe_bottom_line(void) fprintf(i9ep->stderr_stream, "\r"); } +#ifndef RL_FREE_KEYMAP_DECLARED /** * Free all storage associated with a keymap. * @@ -237,6 +238,7 @@ static void wipe_bottom_line(void) * \param keymap The keymap to deallocate. */ void rl_free_keymap(Keymap keymap); +#endif /** * Reset the terminal and save the in-memory command line history. -- 2.39.5