[patch] Fix --with-system-readline vs. readline-6.0+

Jan Kratochvil
2009-07-31T08:53:06Z

Hi,

configure --with-system-readline with system readline-6.0 do cause:
.../gdb/tui/tui-io.c:567: undefined reference to `readline_echoing_p'
.../gdb/tui/tui-io.c:525: undefined reference to `readline_echoing_p'
.../gdb/tui/tui-io.c:530: undefined reference to `readline_echoing_p'
http://koji.fedoraproject.org/koji/getfile?taskID=1515524&name=build.log

There are now various vendor patches out there
http://www.mail-archive.com/pld-cvs-commit@lists.pld-linux.org/msg174978.html
http://lists.opensuse.org/opensuse-commit/2009-03/msg00362.html
http://osdir.com/ml/fedora-extras-commits/2009-07/msg05039.html

After bundled readline gets upgraded to 6.0 this AC_DEFINE should be reversed
and tui/tui-io.c to be updated to use _rl_echoing_p of the bundled version.

Thanks,
Jan

gdb/
2009-07-31 Jan Kratochvil <jan.kratochvil@redhat.com>

Fix compatibility of --with-system-readline and readline-6.0+.
* configure.ac <--with-system-readline> (for readline_echoing_p): New
test.
* config.in: Regenerate.
* configure: Regenerate.

--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -536,6 +536,21 @@ if test "$with_system_readline" = yes; then
READLINE=-lreadline
READLINE_DEPS=
READLINE_CFLAGS=
+
+ # readline-6.0 started to use the name `_rl_echoing_p'.
+ # `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
+
+ AC_MSG_CHECKING([for readline_echoing_p])
+ save_LIBS=$LIBS
+ LIBS="$LIBS $READLINE"
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
+ return readline_echoing_p;]]),
+ [READLINE_ECHOING_P=yes],
+ [READLINE_ECHOING_P=no
+ AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
+ [readline-6.0 started to use different name.])])
+ LIBS="$save_LIBS"
+ AC_MSG_RESULT([$READLINE_ECHOING_P])
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'