From d7a04a4e113b3d08aa0fde66ee658b7abe02e714 Mon Sep 17 00:00:00 2001 From: Jaakko Heinonen Date: Mon, 11 Mar 2002 10:29:28 +0000 Subject: [PATCH] readline tweaks --- ChangeLog | 2 +- abook_rl.c | 6 ++++-- acinclude.m4 | 6 ++++-- aclocal.m4 | 6 ++++-- configure | 30 +++++++++++++++--------------- configure.in | 4 +--- 6 files changed, 29 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7980b99..bcdf9f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -2002-03-10 +2002-03-11 - readline support - abook can be compiled with g++ - attempt to improve --datafile behavior diff --git a/abook_rl.c b/abook_rl.c index 0cd591e..fe07070 100644 --- a/abook_rl.c +++ b/abook_rl.c @@ -6,7 +6,6 @@ * Copyright (C) Jaakko Heinonen */ - #include #include #include @@ -81,8 +80,10 @@ abook_rl_init(int use_completion) if(use_completion) rl_bind_key('\t', rl_menu_complete); - else + else { rl_unbind_function_in_map(rl_complete, rl_get_keymap()); + rl_unbind_function_in_map(rl_menu_complete, rl_get_keymap()); + } clear_history(); } @@ -105,3 +106,4 @@ abook_readline(WINDOW *w, int y, int x, char *s, int limit, int use_completion) return ret; } + diff --git a/acinclude.m4 b/acinclude.m4 index c722454..c8eba20 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -137,7 +137,7 @@ dnl AC_DEFUN([AC_LIB_READLINE], [ AC_CACHE_CHECK([for a readline compatible library], ac_cv_lib_readline, [ - ORIG_LIBS=$LIBS + ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then @@ -157,11 +157,12 @@ AC_DEFUN([AC_LIB_READLINE], [ done if test -z "$ac_cv_lib_readline"; then ac_cv_lib_readline="no" - LIBS=$ORIG_LIBS fi + LIBS="$ORIG_LIBS" ]) if test "$ac_cv_lib_readline" != "no"; then + LIBS="$LIBS $ac_cv_lib_readline" AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a readline compatible library]) AC_CHECK_HEADERS(readline.h readline/readline.h) @@ -176,4 +177,5 @@ AC_DEFUN([AC_LIB_READLINE], [ AC_CHECK_HEADERS(history.h readline/history.h) fi fi + ]) diff --git a/aclocal.m4 b/aclocal.m4 index d427868..2496321 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -149,7 +149,7 @@ dnl AC_DEFUN([AC_LIB_READLINE], [ AC_CACHE_CHECK([for a readline compatible library], ac_cv_lib_readline, [ - ORIG_LIBS=$LIBS + ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then @@ -169,11 +169,12 @@ AC_DEFUN([AC_LIB_READLINE], [ done if test -z "$ac_cv_lib_readline"; then ac_cv_lib_readline="no" - LIBS=$ORIG_LIBS fi + LIBS="$ORIG_LIBS" ]) if test "$ac_cv_lib_readline" != "no"; then + LIBS="$LIBS $ac_cv_lib_readline" AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a readline compatible library]) AC_CHECK_HEADERS(readline.h readline/readline.h) @@ -188,6 +189,7 @@ AC_DEFUN([AC_LIB_READLINE], [ AC_CHECK_HEADERS(history.h readline/history.h) fi fi + ]) # Do all the work for Automake. This macro actually does too much -- diff --git a/configure b/configure index a4f2c48..7256612 100755 --- a/configure +++ b/configure @@ -695,7 +695,7 @@ fi PACKAGE=abook -VERSION=2002-xx-xx +VERSION=2002-03-11 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } @@ -2303,7 +2303,7 @@ if eval "test \"`echo '$''{'ac_cv_lib_readline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ORIG_LIBS=$LIBS + ORIG_LIBS="$LIBS" for readline_lib in readline edit editline; do for termcap_lib in "" termcap curses ncurses; do if test -z "$termcap_lib"; then @@ -2342,14 +2342,15 @@ rm -f conftest* done if test -z "$ac_cv_lib_readline"; then ac_cv_lib_readline="no" - LIBS=$ORIG_LIBS fi + LIBS="$ORIG_LIBS" fi echo "$ac_t""$ac_cv_lib_readline" 1>&6 if test "$ac_cv_lib_readline" != "no"; then + LIBS="$LIBS $ac_cv_lib_readline" cat >> confdefs.h <<\EOF #define HAVE_LIBREADLINE 1 EOF @@ -2358,17 +2359,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2362: checking for $ac_hdr" >&5 +echo "configure:2363: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2372: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2395,14 +2396,14 @@ fi done echo $ac_n "checking whether readline supports history""... $ac_c" 1>&6 -echo "configure:2399: checking whether readline supports history" >&5 +echo "configure:2400: checking whether readline supports history" >&5 if eval "test \"`echo '$''{'ac_cv_lib_readline_history'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_lib_readline_history="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_lib_readline_history="yes" else @@ -2434,17 +2435,17 @@ EOF do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2438: checking for $ac_hdr" >&5 +echo "configure:2439: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2474,12 +2475,11 @@ done fi -if test x$ac_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then + +if test x$ac_cv_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then { echo "configure: error: *** readline library not found or it doesn't support history ***" 1>&2; exit 1; } fi -LDFLAGS="$ac_cv_lib_readline $LDFLAGS" - for ac_func in resizeterm do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 diff --git a/configure.in b/configure.in index d4556b9..b09f46b 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl abook configure.in AC_INIT(abook.c) -AM_INIT_AUTOMAKE(abook, 2002-xx-xx) +AM_INIT_AUTOMAKE(abook, 2002-03-11) AM_CONFIG_HEADER(config.h) AC_CANONICAL_HOST @@ -52,8 +52,6 @@ if test x$ac_cv_lib_readline = xno -o x$ac_cv_lib_readline_history = xno; then AC_MSG_ERROR([*** readline library not found or it doesn't support history ***]) fi -LDFLAGS="$ac_cv_lib_readline $LDFLAGS" - AC_CHECK_FUNCS(resizeterm) AC_CHECK_FUNC(snprintf, [AC_DEFINE(HAVE_SNPRINTF)],) -- 2.39.2