Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Add configure probe for rl_completion_suppress_quote.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Jan 2020 23:20:57 +0000 (18:20 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Jan 2020 23:20:57 +0000 (18:20 -0500)
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.

config/programs.m4
configure
src/bin/psql/tab-complete.c
src/include/pg_config.h.in
src/tools/msvc/Solution.pm

index 68ab82351ad4f60012253e2e1cdf901909df8cd7..6a118ece24eebfd8c00f849883f59b346440766e 100644 (file)
@@ -211,7 +211,8 @@ fi
 
 # PGAC_READLINE_VARIABLES
 # -----------------------
-# Readline versions < 2.1 don't have rl_completion_append_character
+# Readline versions < 2.1 don't have rl_completion_append_character,
+# and some versions lack rl_completion_suppress_quote.
 # Libedit lacks rl_filename_quote_characters and rl_filename_quoting_function
 
 AC_DEFUN([PGAC_READLINE_VARIABLES],
@@ -232,6 +233,23 @@ if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
 AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
           [Define to 1 if you have the global variable 'rl_completion_append_character'.])
 fi
+AC_CACHE_CHECK([for rl_completion_suppress_quote], pgac_cv_var_rl_completion_suppress_quote,
+[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#elif defined(HAVE_EDITLINE_READLINE_H)
+#include <editline/readline.h>
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#endif
+],
+[rl_completion_suppress_quote = 1;])],
+[pgac_cv_var_rl_completion_suppress_quote=yes],
+[pgac_cv_var_rl_completion_suppress_quote=no])])
+if test x"$pgac_cv_var_rl_completion_suppress_quote" = x"yes"; then
+AC_DEFINE(HAVE_RL_COMPLETION_SUPPRESS_QUOTE, 1,
+          [Define to 1 if you have the global variable 'rl_completion_suppress_quote'.])
+fi
 AC_CACHE_CHECK([for rl_filename_quote_characters], pgac_cv_var_rl_filename_quote_characters,
 [AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
 #if defined(HAVE_READLINE_READLINE_H)
index a46ba4010481a829777466ae5fcf7dcc3426e3f0..702adba8390aedb877bc78ebf4600d99559a4730 100755 (executable)
--- a/configure
+++ b/configure
@@ -16346,6 +16346,45 @@ if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
 
 $as_echo "#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1" >>confdefs.h
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_completion_suppress_quote" >&5
+$as_echo_n "checking for rl_completion_suppress_quote... " >&6; }
+if ${pgac_cv_var_rl_completion_suppress_quote+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+#if defined(HAVE_READLINE_READLINE_H)
+#include <readline/readline.h>
+#elif defined(HAVE_EDITLINE_READLINE_H)
+#include <editline/readline.h>
+#elif defined(HAVE_READLINE_H)
+#include <readline.h>
+#endif
+
+int
+main ()
+{
+rl_completion_suppress_quote = 1;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  pgac_cv_var_rl_completion_suppress_quote=yes
+else
+  pgac_cv_var_rl_completion_suppress_quote=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_var_rl_completion_suppress_quote" >&5
+$as_echo "$pgac_cv_var_rl_completion_suppress_quote" >&6; }
+if test x"$pgac_cv_var_rl_completion_suppress_quote" = x"yes"; then
+
+$as_echo "#define HAVE_RL_COMPLETION_SUPPRESS_QUOTE 1" >>confdefs.h
+
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_filename_quote_characters" >&5
 $as_echo_n "checking for rl_filename_quote_characters... " >&6; }
index 086348824323cab55f8343701dba0b37a8af84c2..dc03fbde131e48606a576a2d8910ee462a4d6568 100644 (file)
@@ -4468,11 +4468,10 @@ complete_from_files(const char *text, int state)
     * anyway.  Set rl_completion_suppress_quote to prevent that.  If we do
     * get to quote_file_name(), we'll clear this again.  (Yes, this seems
     * like it's working around Readline bugs.)
-    *
-    * (For now, we assume that rl_completion_suppress_quote exists if the
-    * filename quoting hooks do.)
     */
+#ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
    rl_completion_suppress_quote = 1;
+#endif
 
    /* If user typed a quote, force quoting (never remove user's quote) */
    if (*text == '\'')
@@ -4842,7 +4841,9 @@ quote_file_name(char *fname, int match_type, char *quote_pointer)
     * on its own accord.  (This covers some additional cases beyond those
     * dealt with above.)
     */
+#ifdef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
    rl_completion_suppress_quote = 0;
+#endif
 
    /*
     * If user typed a leading quote character other than single quote (i.e.,
index 983d94e3fe7c7a66947ddcb0e9dc1811392ef5d4..6f485f73cd12cfc5af2eb272a5b5adfddcb4511b 100644 (file)
 /* Define to 1 if you have the `rl_completion_matches' function. */
 #undef HAVE_RL_COMPLETION_MATCHES
 
+/* Define to 1 if you have the global variable 'rl_completion_suppress_quote'.
+   */
+#undef HAVE_RL_COMPLETION_SUPPRESS_QUOTE
+
 /* Define to 1 if you have the `rl_filename_completion_function' function. */
 #undef HAVE_RL_FILENAME_COMPLETION_FUNCTION
 
index cc4e238318158a2c3c66aa6232094067ad213ded..90de0583203bd86d0c8aa6ab375a3c34e9587f35 100644 (file)
@@ -332,6 +332,7 @@ sub GenerateFiles
        HAVE_RINT                   => 1,
        HAVE_RL_COMPLETION_APPEND_CHARACTER      => undef,
        HAVE_RL_COMPLETION_MATCHES               => undef,
+       HAVE_RL_COMPLETION_SUPPRESS_QUOTE        => undef,
        HAVE_RL_FILENAME_COMPLETION_FUNCTION     => undef,
        HAVE_RL_FILENAME_QUOTE_CHARACTERS        => undef,
        HAVE_RL_FILENAME_QUOTING_FUNCTION        => undef,