Add configure probe for rl_variable_bind().
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Dec 2021 18:06:27 +0000 (13:06 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Dec 2021 18:06:27 +0000 (13:06 -0500)
Some exceedingly ancient readline libraries lack this function, causing
commit 3d858af07 to fail.  Per buildfarm (via Michael Paquier).

Discussion: https://postgr.es/m/E1msTLm-0007Cm-Ri@gemulon.postgresql.org

configure
configure.ac
src/bin/psql/input.c
src/include/pg_config.h.in
src/tools/msvc/Solution.pm

index 5d72ee3fdea197d62d00b7d507a8d756820bca6f..5f842a86b27b0ab0fe7181cb50dc0f6883332496 100755 (executable)
--- a/configure
+++ b/configure
@@ -17164,19 +17164,7 @@ $as_echo "#define HAVE_RL_FILENAME_QUOTING_FUNCTION 1" >>confdefs.h
 
 fi
 
-  for ac_func in rl_completion_matches rl_filename_completion_function rl_reset_screen_size
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-  for ac_func in append_history history_truncate_file
+  for ac_func in append_history history_truncate_file rl_completion_matches rl_filename_completion_function rl_reset_screen_size rl_variable_bind
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 03ca3a4dc059e6db226656c0e51480c598461b0a..566a6010dd7a4895dbe0d205c5737d2c396f63b2 100644 (file)
@@ -2001,8 +2001,14 @@ LIBS="$LIBS_including_readline"
 
 if test "$with_readline" = yes; then
   PGAC_READLINE_VARIABLES
-  AC_CHECK_FUNCS([rl_completion_matches rl_filename_completion_function rl_reset_screen_size])
-  AC_CHECK_FUNCS([append_history history_truncate_file])
+  AC_CHECK_FUNCS(m4_normalize([
+   append_history
+   history_truncate_file
+   rl_completion_matches
+   rl_filename_completion_function
+   rl_reset_screen_size
+   rl_variable_bind
+  ]))
 fi
 
 
index 1dcd95a7b9e0db4c59cf06506febb178275242be..501f5d5fbc52c0a4d4a7a9711902b06897f9258a 100644 (file)
@@ -356,8 +356,10 @@ initializeInput(int flags)
        /* set appropriate values for Readline's global variables */
        initialize_readline();
 
+#ifdef HAVE_RL_VARIABLE_BIND
        /* set comment-begin to a useful value for SQL */
        (void) rl_variable_bind("comment-begin", "-- ");
+#endif
 
        /* this reads ~/.inputrc, so do it after rl_variable_bind */
        rl_initialize();
index d793734fe10c0473930a961cb81de30fabfc8b4f..7525c165974b92817377a024258ad76c6bda35a5 100644 (file)
 /* Define to 1 if you have the `rl_reset_screen_size' function. */
 #undef HAVE_RL_RESET_SCREEN_SIZE
 
+/* Define to 1 if you have the `rl_variable_bind' function. */
+#undef HAVE_RL_VARIABLE_BIND
+
 /* Define to 1 if you have the <security/pam_appl.h> header file. */
 #undef HAVE_SECURITY_PAM_APPL_H
 
index 1cb31d929fea8a5c30d9a5a979ca2d64cf99a1d4..2c8cd521e946e8d52ff567fee2bf7ebdcf5b61af 100644 (file)
@@ -354,6 +354,7 @@ sub GenerateFiles
        HAVE_RL_FILENAME_QUOTE_CHARACTERS        => undef,
        HAVE_RL_FILENAME_QUOTING_FUNCTION        => undef,
        HAVE_RL_RESET_SCREEN_SIZE                => undef,
+       HAVE_RL_VARIABLE_BIND                    => undef,
        HAVE_SECURITY_PAM_APPL_H                 => undef,
        HAVE_SETENV                              => undef,
        HAVE_SETPROCTITLE                        => undef,