Better coding of readline tests
This commit is contained in:
parent
1b7332fbab
commit
831e78e0c4
54
configure.in
54
configure.in
@ -612,9 +612,8 @@ fi
|
||||
AC_CHECK_LIB(sfio, main)
|
||||
AC_CHECK_LIB(ncurses, main, [], [AC_CHECK_LIB(curses, main)])
|
||||
AC_CHECK_LIB(termcap, main)
|
||||
AC_CHECK_LIB(readline, main)
|
||||
AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
|
||||
AC_CHECK_LIB(history, main) )
|
||||
AC_CHECK_LIB(readline, readline)
|
||||
AC_SEARCH_LIBS(using_history, history, [AC_DEFINE(HAVE_HISTORY_FUNCTIONS)])
|
||||
|
||||
if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
|
||||
then
|
||||
@ -832,24 +831,39 @@ AC_CHECK_FUNC(rint,
|
||||
AC_DEFINE(HAVE_RINT),
|
||||
AC_CHECK_LIB(m, rint, AC_DEFINE(HAVE_RINT), , $HPUXMATHLIB))
|
||||
|
||||
dnl Some old versions of libreadline don't have rl_completion_append_character
|
||||
AC_EGREP_HEADER(rl_completion_append_character, readline.h,
|
||||
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER),
|
||||
[AC_EGREP_HEADER(rl_completion_append_character, readline/readline.h,
|
||||
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER))])
|
||||
AC_SUBST(HAVE_RL_COMPLETION_APPEND_CHARACTER)
|
||||
|
||||
dnl Check for readline's filename_completion_function.
|
||||
dnl Some versions have it but it's not in the headers, so we have to take
|
||||
dnl care of that, too.
|
||||
AC_CHECK_FUNCS(filename_completion_function,
|
||||
AC_EGREP_HEADER(filename_completion_function, readline.h,
|
||||
AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL),
|
||||
[AC_EGREP_HEADER(filename_completion_function, readline/readline.h,
|
||||
AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL))])
|
||||
)
|
||||
AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION)
|
||||
AC_SUBST(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
|
||||
# Readline versions < 2.1 don't have rl_completion_append_character
|
||||
AC_MSG_CHECKING([for rl_completion_append_character])
|
||||
AC_TRY_LINK([#include <stdio.h>
|
||||
#ifdef HAVE_READLINE_H
|
||||
# include <readline.h>
|
||||
#endif
|
||||
#ifdef HAVE_READLINE_READLINE_H
|
||||
# include <readline/readline.h>
|
||||
#endif],
|
||||
[rl_completion_append_character = 'x';],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
# Check whether readline's filename_completion_function is declared.
|
||||
# Some prehistoric versions of readline, in particular those shipped
|
||||
# with earlier Cygwins don't have this declared, although it's in the
|
||||
# library.
|
||||
AC_MSG_CHECKING([whether filename_completion_function is declared])
|
||||
if test "$ac_cv_header_readline_h" = yes; then
|
||||
_readline_header='readline.h'
|
||||
elif test "$ac_cv_header_readline_readline_h" = yes; then
|
||||
_readline_header='readline/readline.h'
|
||||
else
|
||||
_readline_header='xxx'
|
||||
fi
|
||||
AC_EGREP_HEADER([filename_completion_function], [$_readline_header],
|
||||
[AC_DEFINE(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
|
||||
dnl Cannot use AC_CHECK_FUNC because finite may be a macro
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright 2000 by PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/input.h,v 1.10 2000/04/12 17:16:22 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/input.h,v 1.11 2000/10/03 19:50:20 petere Exp $
|
||||
*/
|
||||
#ifndef INPUT_H
|
||||
#define INPUT_H
|
||||
@ -24,7 +24,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBHISTORY) || (defined(HAVE_LIBREADLINE) && defined(HAVE_HISTORY_IN_READLINE))
|
||||
#if defined(HAVE_HISTORY_FUNCTIONS)
|
||||
#if defined(HAVE_READLINE_HISTORY_H)
|
||||
#include <readline/history.h>
|
||||
#define USE_HISTORY 1
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright 2000 by PostgreSQL Global Development Group
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.20 2000/06/25 14:25:51 petere Exp $
|
||||
* $Header: /cvsroot/pgsql/src/bin/psql/tab-complete.c,v 1.21 2000/10/03 19:50:20 petere Exp $
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
@ -60,7 +60,7 @@
|
||||
#include "common.h"
|
||||
#include "settings.h"
|
||||
|
||||
#if defined(HAVE_FILENAME_COMPLETION_FUNCTION) && !defined(HAVE_FILENAME_COMPLETION_FUNCTION_DECL)
|
||||
#ifndef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
|
||||
char *filename_completion_function(char *, int);
|
||||
|
||||
#endif
|
||||
@ -699,17 +699,7 @@ psql_completion(char *text, int start, int end)
|
||||
strcmp(prev_wd, "\\w") == 0 || strcmp(prev_wd, "\\write") == 0
|
||||
)
|
||||
{
|
||||
#ifdef HAVE_FILENAME_COMPLETION_FUNCTION
|
||||
matches = completion_matches(text, filename_completion_function);
|
||||
#else
|
||||
|
||||
/*
|
||||
* This will probably have the same effect, but you never know
|
||||
* what the heck some readline incarnation out there is going to
|
||||
* do.
|
||||
*/
|
||||
matches = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
* or in config.h afterwards. Of course, if you edit config.h, then your
|
||||
* changes will be overwritten the next time you run configure.
|
||||
*
|
||||
* $Id: config.h.in,v 1.139 2000/10/03 03:11:23 momjian Exp $
|
||||
* $Id: config.h.in,v 1.140 2000/10/03 19:50:21 petere Exp $
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
@ -384,8 +384,8 @@
|
||||
/* Define if you have the stricmp function. */
|
||||
#undef HAVE_STRICMP
|
||||
|
||||
/* Set to 1 if you have libreadline and it includes history functions */
|
||||
#undef HAVE_HISTORY_IN_READLINE
|
||||
/* Set to 1 if you have history functions (either in libhistory or libreadline) */
|
||||
#undef HAVE_HISTORY_FUNCTIONS
|
||||
|
||||
/* Set to 1 if you have <pwd.h> */
|
||||
#undef HAVE_PWD_H
|
||||
@ -547,10 +547,7 @@ extern void srandom(unsigned int seed);
|
||||
/* Set to 1 if your libreadline defines rl_completion_append_character */
|
||||
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
|
||||
|
||||
/* Set to 1 if your libreadline has filename_completion_function */
|
||||
#undef HAVE_FILENAME_COMPLETION_FUNCTION
|
||||
|
||||
/* Set to 1 if your readline headers actually declare the above */
|
||||
/* Set to 1 if filename_completion_function is declared in the readline header */
|
||||
#undef HAVE_FILENAME_COMPLETION_FUNCTION_DECL
|
||||
|
||||
/* Set to 1 if you have getopt_long() (GNU long options) */
|
||||
|
Loading…
Reference in New Issue
Block a user