Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c327044

Browse files
committed
Add configure probe for rl_completion_suppress_quote.
I had supposed that all versions of Readline that have filename quoting hooks also have the rl_completion_suppress_quote variable. But it seems OpenBSD managed to find a version someplace that does not, so we'll have to expend a separate configure probe for that. (Light testing suggests that this version also lacks the bugs that make it necessary to frob that variable. Hooray!) Per buildfarm.
1 parent 9a3a75c commit c327044

File tree

5 files changed

+67
-4
lines changed

5 files changed

+67
-4
lines changed

config/programs.m4

+19-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ fi
211211

212212
# PGAC_READLINE_VARIABLES
213213
# -----------------------
214-
# Readline versions < 2.1 don't have rl_completion_append_character
214+
# Readline versions < 2.1 don't have rl_completion_append_character,
215+
# and some versions lack rl_completion_suppress_quote.
215216
# Libedit lacks rl_filename_quote_characters and rl_filename_quoting_function
216217

217218
AC_DEFUN([PGAC_READLINE_VARIABLES],
@@ -232,6 +233,23 @@ if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
232233
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
233234
[Define to 1 if you have the global variable 'rl_completion_append_character'.])
234235
fi
236+
AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
237+
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
238+
#if defined(HAVE_READLINE_READLINE_H)
239+
#include <readline/readline.h>
240+
#elif defined(HAVE_EDITLINE_READLINE_H)
241+
#include <editline/readline.h>
242+
#elif defined(HAVE_READLINE_H)
243+
#include <readline.h>
244+
#endif
245+
],
246+
[rl_completion_suppress_quote = 1;])],
247+
[pgac_cv_var_rl_completion_suppress_quote=yes],
248+
[pgac_cv_var_rl_completion_suppress_quote=no])])
249+
if test x"$pgac_cv_var_rl_completion_suppress_quote" = x"yes"; then
250+
AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_QUOTE, 1,
251+
[Define to 1 if you have the global variable 'rl_completion_suppress_quote'.])
252+
fi
235253
AC_CACHE_CHECK([for rl_filename_quote_characters], pgac_cv_var_rl_filename_quote_characters,
236254
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
237255
#if defined(HAVE_READLINE_READLINE_H)

configure

+39
Original file line numberDiff line numberDiff line change
@@ -16346,6 +16346,45 @@ if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
1634616346

1634716347
$as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h
1634816348

16349+
fi
16350+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
16351+
$as_echo_n "checking for rl_completion_suppress_quote... " >&6; }
16352+
if ${pgac_cv_var_rl_completion_suppress_quote+:} false; then :
16353+
$as_echo_n "(cached) " >&6
16354+
else
16355+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
16356+
/* end confdefs.h. */
16357+
#include <stdio.h>
16358+
#if defined(HAVE_READLINE_READLINE_H)
16359+
#include <readline/readline.h>
16360+
#elif defined(HAVE_EDITLINE_READLINE_H)
16361+
#include <editline/readline.h>
16362+
#elif defined(HAVE_READLINE_H)
16363+
#include <readline.h>
16364+
#endif
16365+
16366+
int
16367+
main ()
16368+
{
16369+
rl_completion_suppress_quote = 1;
16370+
;
16371+
return 0;
16372+
}
16373+
_ACEOF
16374+
if ac_fn_c_try_link "$LINENO"; then :
16375+
pgac_cv_var_rl_completion_suppress_quote=yes
16376+
else
16377+
pgac_cv_var_rl_completion_suppress_quote=no
16378+
fi
16379+
rm -f core conftest.err conftest.$ac_objext \
16380+
conftest$ac_exeext conftest.$ac_ext
16381+
fi
16382+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_completion_suppress_quote" >&5
16383+
$as_echo "$pgac_cv_var_rl_completion_suppress_quote" >&6; }
16384+
if test x"$pgac_cv_var_rl_completion_suppress_quote" = x"yes"; then
16385+
16386+
$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_QUOTE 1" >>confdefs.h
16387+
1634916388
fi
1635016389
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_filename_quote_characters" >&5
1635116390
$as_echo_n "checking for rl_filename_quote_characters... " >&6; }

src/bin/psql/tab-complete.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -4468,11 +4468,10 @@ complete_from_files(const char *text, int state)
44684468
* anyway. Set rl_completion_suppress_quote to prevent that. If we do
44694469
* get to quote_file_name(), we'll clear this again. (Yes, this seems
44704470
* like it's working around Readline bugs.)
4471-
*
4472-
* (For now, we assume that rl_completion_suppress_quote exists if the
4473-
* filename quoting hooks do.)
44744471
*/
4472+
#ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
44754473
rl_completion_suppress_quote = 1;
4474+
#endif
44764475

44774476
/* If user typed a quote, force quoting (never remove user's quote) */
44784477
if (*text == '\'')
@@ -4842,7 +4841,9 @@ quote_file_name(char *fname, int match_type, char *quote_pointer)
48424841
* on its own accord. (This covers some additional cases beyond those
48434842
* dealt with above.)
48444843
*/
4844+
#ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
48454845
rl_completion_suppress_quote = 0;
4846+
#endif
48464847

48474848
/*
48484849
* If user typed a leading quote character other than single quote (i.e.,

src/include/pg_config.h.in

+4
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@
485485
/* Define to 1 if you have the `rl_completion_matches' function. */
486486
#undef HAVE_RL_COMPLETION_MATCHES
487487

488+
/* Define to 1 if you have the global variable 'rl_completion_suppress_quote'.
489+
*/
490+
#undef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
491+
488492
/* Define to 1 if you have the `rl_filename_completion_function' function. */
489493
#undef HAVE_RL_FILENAME_COMPLETION_FUNCTION
490494

src/tools/msvc/Solution.pm

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ sub GenerateFiles
332332
HAVE_RINT => 1,
333333
HAVE_RL_COMPLETION_APPEND_CHARACTER => undef,
334334
HAVE_RL_COMPLETION_MATCHES => undef,
335+
HAVE_RL_COMPLETION_SUPPRESS_QUOTE => undef,
335336
HAVE_RL_FILENAME_COMPLETION_FUNCTION => undef,
336337
HAVE_RL_FILENAME_QUOTE_CHARACTERS => undef,
337338
HAVE_RL_FILENAME_QUOTING_FUNCTION => undef,

0 commit comments

Comments
 (0)