]> git.tue.mpg.de Git - paraslash.git/commitdiff
build: Check whether rl_free_keymap is declared.
authorAndre Noll <maan@systemlinux.org>
Wed, 26 Feb 2014 18:16:03 +0000 (19:16 +0100)
committerAndre Noll <maan@systemlinux.org>
Wed, 26 Feb 2014 19:06:52 +0000 (20:06 +0100)
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
interactive.c

index cdbc0e56b0f51992973076a4ae602ca0a2d1e33a..61ff547e1e09f62403fa65fde03f0ee0ce474aec 100644 (file)
@@ -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 <stdio.h>
+                       #include <readline/readline.h>
+               ]
+       )
        AC_SUBST(readline_cppflags)
        AC_SUBST(readline_ldflags)
        AC_DEFINE(HAVE_READLINE, 1, define to 1 to turn on readline support)
index 43cb99f2781979e74b66eef640fadb7878f30aeb..5e4a89b3aa8111cc4f9912893ca0c12bf8f93430 100644 (file)
@@ -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.