2010-09-21 04:08:53 +08:00
|
|
|
# config/programs.m4
|
2007-07-20 01:15:30 +08:00
|
|
|
|
|
|
|
|
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 23:40:00 +08:00
|
|
|
# PGAC_PATH_PROGS
|
|
|
|
# ---------------
|
|
|
|
# This wrapper for AC_PATH_PROGS behaves like that macro except when
|
|
|
|
# VARIABLE is already set; in that case we just accept the value verbatim.
|
|
|
|
# (AC_PATH_PROGS would accept it only if it looks like an absolute path.)
|
|
|
|
# A desirable future improvement would be to convert a non-absolute-path
|
|
|
|
# input into absolute form.
|
|
|
|
AC_DEFUN([PGAC_PATH_PROGS],
|
|
|
|
[if test -z "$$1"; then
|
|
|
|
AC_PATH_PROGS($@)
|
|
|
|
else
|
|
|
|
# Report the value of $1 in configure's output in all cases.
|
|
|
|
AC_MSG_CHECKING([for $1])
|
|
|
|
AC_MSG_RESULT([$$1])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
2008-08-29 21:02:33 +08:00
|
|
|
# PGAC_PATH_BISON
|
|
|
|
# ---------------
|
|
|
|
# Look for Bison, set the output variable BISON to its path if found.
|
2007-07-20 01:15:30 +08:00
|
|
|
# Reject versions before 1.875 (they have bugs or capacity limits).
|
|
|
|
# Note we do not accept other implementations of yacc.
|
|
|
|
|
2008-08-29 21:02:33 +08:00
|
|
|
AC_DEFUN([PGAC_PATH_BISON],
|
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 23:40:00 +08:00
|
|
|
[PGAC_PATH_PROGS(BISON, bison)
|
2007-07-20 01:15:30 +08:00
|
|
|
|
2008-08-29 21:02:33 +08:00
|
|
|
if test "$BISON"; then
|
|
|
|
pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
|
|
|
|
AC_MSG_NOTICE([using $pgac_bison_version])
|
|
|
|
if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 1.875) exit 0; else exit 1;}'
|
2007-07-20 01:15:30 +08:00
|
|
|
then
|
|
|
|
AC_MSG_WARN([
|
2009-07-13 13:36:53 +08:00
|
|
|
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
|
|
|
|
*** Bison version 1.875 or later is required, but this is $pgac_bison_version.])
|
2008-08-29 21:02:33 +08:00
|
|
|
BISON=""
|
2007-07-20 01:15:30 +08:00
|
|
|
fi
|
2014-06-04 10:36:35 +08:00
|
|
|
# Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
|
|
|
|
# of the now preferred %name-prefix "base_yy", but the latter
|
|
|
|
# doesn't work with Bison 2.3 or less. So for now we silence the
|
|
|
|
# deprecation warnings.
|
|
|
|
if echo "$pgac_bison_version" | $AWK '{ if ([$]4 >= 3) exit 0; else exit 1;}'
|
|
|
|
then
|
|
|
|
BISONFLAGS="$BISONFLAGS -Wno-deprecated"
|
|
|
|
fi
|
2007-07-20 01:15:30 +08:00
|
|
|
fi
|
|
|
|
|
2008-08-29 21:02:33 +08:00
|
|
|
if test -z "$BISON"; then
|
2007-07-20 01:15:30 +08:00
|
|
|
AC_MSG_WARN([
|
2010-09-23 07:51:39 +08:00
|
|
|
*** Without Bison you will not be able to build PostgreSQL from Git nor
|
2007-07-20 01:15:30 +08:00
|
|
|
*** change any of the parser definition files. You can obtain Bison from
|
2010-02-23 05:16:50 +08:00
|
|
|
*** a GNU mirror site. (If you are using the official distribution of
|
2007-07-20 01:15:30 +08:00
|
|
|
*** PostgreSQL then you do not need to worry about this, because the Bison
|
2008-08-29 21:02:33 +08:00
|
|
|
*** output is pre-generated.)])
|
2007-07-20 01:15:30 +08:00
|
|
|
fi
|
2019-02-09 22:55:17 +08:00
|
|
|
dnl We don't need AC_SUBST(BISON) because PGAC_PATH_PROGS did it
|
2008-08-29 21:02:33 +08:00
|
|
|
AC_SUBST(BISONFLAGS)
|
|
|
|
])# PGAC_PATH_BISON
|
2007-07-20 01:15:30 +08:00
|
|
|
|
2000-08-28 19:53:23 +08:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_PATH_FLEX
|
|
|
|
# --------------
|
|
|
|
# Look for Flex, set the output variable FLEX to its path if found.
|
2009-07-13 09:51:56 +08:00
|
|
|
# Reject versions before 2.5.31, as we need a reasonably non-buggy reentrant
|
|
|
|
# scanner. (Note: the well-publicized security problem in 2.5.31 does not
|
|
|
|
# affect Postgres, and there are still distros shipping patched 2.5.31,
|
|
|
|
# so allow it.) Also find Flex if its installed under `lex', but do not
|
|
|
|
# accept other Lex programs.
|
2000-08-28 19:53:23 +08:00
|
|
|
|
|
|
|
AC_DEFUN([PGAC_PATH_FLEX],
|
|
|
|
[AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
|
|
|
|
[# Let the user override the test
|
|
|
|
if test -n "$FLEX"; then
|
|
|
|
pgac_cv_path_flex=$FLEX
|
|
|
|
else
|
|
|
|
pgac_save_IFS=$IFS
|
2004-09-02 23:39:56 +08:00
|
|
|
IFS=$PATH_SEPARATOR
|
2000-08-28 19:53:23 +08:00
|
|
|
for pgac_dir in $PATH; do
|
2004-09-02 23:39:56 +08:00
|
|
|
IFS=$pgac_save_IFS
|
2000-08-28 19:53:23 +08:00
|
|
|
if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
|
|
|
|
pgac_dir=`pwd`
|
|
|
|
fi
|
|
|
|
for pgac_prog in flex lex; do
|
|
|
|
pgac_candidate="$pgac_dir/$pgac_prog"
|
|
|
|
if test -f "$pgac_candidate" \
|
2000-10-27 00:28:01 +08:00
|
|
|
&& $pgac_candidate --version </dev/null >/dev/null 2>&1
|
2000-08-28 19:53:23 +08:00
|
|
|
then
|
|
|
|
echo '%%' > conftest.l
|
|
|
|
if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
|
2009-07-13 09:51:56 +08:00
|
|
|
pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
|
2016-05-02 23:18:10 +08:00
|
|
|
if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 == 2 && ([$]2 > 5 || ([$]2 == 5 && [$]3 >= 31))) exit 0; else exit 1;}'
|
2009-07-13 09:51:56 +08:00
|
|
|
then
|
|
|
|
pgac_cv_path_flex=$pgac_candidate
|
|
|
|
break 2
|
|
|
|
else
|
|
|
|
AC_MSG_WARN([
|
|
|
|
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
|
2009-07-13 13:36:53 +08:00
|
|
|
*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version.])
|
2000-08-28 19:53:23 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2004-09-03 04:39:57 +08:00
|
|
|
rm -f conftest.l lex.yy.c
|
2000-08-28 19:53:23 +08:00
|
|
|
: ${pgac_cv_path_flex=no}
|
|
|
|
fi
|
|
|
|
])[]dnl AC_CACHE_CHECK
|
|
|
|
|
|
|
|
if test x"$pgac_cv_path_flex" = x"no"; then
|
|
|
|
AC_MSG_WARN([
|
2010-09-23 07:51:39 +08:00
|
|
|
*** Without Flex you will not be able to build PostgreSQL from Git nor
|
2001-02-11 06:31:42 +08:00
|
|
|
*** change any of the scanner definition files. You can obtain Flex from
|
2010-02-23 05:16:50 +08:00
|
|
|
*** a GNU mirror site. (If you are using the official distribution of
|
2001-02-11 06:31:42 +08:00
|
|
|
*** PostgreSQL then you do not need to worry about this because the Flex
|
|
|
|
*** output is pre-generated.)])
|
2000-08-28 19:53:23 +08:00
|
|
|
|
|
|
|
FLEX=
|
|
|
|
else
|
|
|
|
FLEX=$pgac_cv_path_flex
|
2009-07-13 09:51:56 +08:00
|
|
|
pgac_flex_version=`$FLEX --version 2>/dev/null`
|
2007-07-20 01:15:30 +08:00
|
|
|
AC_MSG_NOTICE([using $pgac_flex_version])
|
2000-08-28 19:53:23 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(FLEX)
|
|
|
|
AC_SUBST(FLEXFLAGS)
|
|
|
|
])# PGAC_PATH_FLEX
|
2001-02-07 03:20:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-26 06:51:35 +08:00
|
|
|
# PGAC_LDAP_SAFE
|
|
|
|
# --------------
|
|
|
|
# PostgreSQL sometimes loads libldap_r and plain libldap into the same
|
|
|
|
# process. Check for OpenLDAP versions known not to tolerate doing so; assume
|
|
|
|
# non-OpenLDAP implementations are safe. The dblink test suite exercises the
|
|
|
|
# hazardous interaction directly.
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_LDAP_SAFE],
|
|
|
|
[AC_CACHE_CHECK([for compatible LDAP implementation], [pgac_cv_ldap_safe],
|
|
|
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
|
|
|
[#include <ldap.h>
|
|
|
|
#if !defined(LDAP_VENDOR_VERSION) || \
|
|
|
|
(defined(LDAP_API_FEATURE_X_OPENLDAP) && \
|
|
|
|
LDAP_VENDOR_VERSION >= 20424 && LDAP_VENDOR_VERSION <= 20431)
|
|
|
|
choke me
|
|
|
|
#endif], [])],
|
|
|
|
[pgac_cv_ldap_safe=yes],
|
|
|
|
[pgac_cv_ldap_safe=no])])
|
|
|
|
|
|
|
|
if test "$pgac_cv_ldap_safe" != yes; then
|
|
|
|
AC_MSG_WARN([
|
|
|
|
*** With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, each backend
|
|
|
|
*** process that loads libpq (via WAL receiver, dblink, or postgres_fdw) and
|
|
|
|
*** also uses LDAP will crash on exit.])
|
|
|
|
fi])
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-02-07 03:20:16 +08:00
|
|
|
# PGAC_CHECK_READLINE
|
|
|
|
# -------------------
|
|
|
|
# Check for the readline library and dependent libraries, either
|
|
|
|
# termcap or curses. Also try libedit, since NetBSD's is compatible.
|
|
|
|
# Add the required flags to LIBS, define HAVE_LIBREADLINE.
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_CHECK_READLINE],
|
2001-08-28 22:59:11 +08:00
|
|
|
[AC_REQUIRE([AC_CANONICAL_HOST])
|
2001-02-07 03:20:16 +08:00
|
|
|
|
2010-09-30 03:38:04 +08:00
|
|
|
AC_CACHE_CHECK([for library containing readline], [pgac_cv_check_readline],
|
2001-02-07 03:20:16 +08:00
|
|
|
[pgac_cv_check_readline=no
|
2004-11-30 14:13:04 +08:00
|
|
|
pgac_save_LIBS=$LIBS
|
2005-12-04 11:52:29 +08:00
|
|
|
if test x"$with_libedit_preferred" != x"yes"
|
|
|
|
then READLINE_ORDER="-lreadline -ledit"
|
|
|
|
else READLINE_ORDER="-ledit -lreadline"
|
|
|
|
fi
|
|
|
|
for pgac_rllib in $READLINE_ORDER ; do
|
2004-11-30 14:13:04 +08:00
|
|
|
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
|
|
|
|
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
|
2001-08-28 22:59:11 +08:00
|
|
|
AC_TRY_LINK_FUNC([readline], [[
|
2019-08-18 12:53:28 +08:00
|
|
|
# Older NetBSD and OpenBSD have a broken linker that does not
|
2004-12-03 04:04:20 +08:00
|
|
|
# recognize dependent libraries; assume curses is needed if we didn't
|
|
|
|
# find any dependency.
|
|
|
|
case $host_os in
|
2019-08-18 12:53:28 +08:00
|
|
|
netbsd* | openbsd*)
|
2004-12-03 04:04:20 +08:00
|
|
|
if test x"$pgac_lib" = x"" ; then
|
|
|
|
pgac_lib=" -lcurses"
|
|
|
|
fi ;;
|
2001-08-28 22:59:11 +08:00
|
|
|
esac
|
|
|
|
|
|
|
|
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
|
2005-12-04 11:52:29 +08:00
|
|
|
break
|
2001-08-28 22:59:11 +08:00
|
|
|
]])
|
2001-02-07 03:20:16 +08:00
|
|
|
done
|
2005-12-04 11:52:29 +08:00
|
|
|
if test "$pgac_cv_check_readline" != no ; then
|
|
|
|
break
|
|
|
|
fi
|
2001-02-07 03:20:16 +08:00
|
|
|
done
|
|
|
|
LIBS=$pgac_save_LIBS
|
2010-09-30 03:38:04 +08:00
|
|
|
])[]dnl AC_CACHE_CHECK
|
2001-02-07 03:20:16 +08:00
|
|
|
|
|
|
|
if test "$pgac_cv_check_readline" != no ; then
|
|
|
|
LIBS="$pgac_cv_check_readline $LIBS"
|
2005-12-04 11:52:29 +08:00
|
|
|
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a function readline library])
|
|
|
|
fi
|
|
|
|
|
|
|
|
])# PGAC_CHECK_READLINE
|
2001-06-03 02:25:18 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
# PGAC_READLINE_VARIABLES
|
|
|
|
# -----------------------
|
2020-01-24 07:20:57 +08:00
|
|
|
# Readline versions < 2.1 don't have rl_completion_append_character,
|
|
|
|
# and some versions lack rl_completion_suppress_quote.
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
# Libedit lacks rl_filename_quote_characters and rl_filename_quoting_function
|
2002-04-11 06:47:09 +08:00
|
|
|
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
AC_DEFUN([PGAC_READLINE_VARIABLES],
|
2010-09-30 03:38:04 +08:00
|
|
|
[AC_CACHE_CHECK([for rl_completion_append_character], pgac_cv_var_rl_completion_append_character,
|
2015-07-03 00:21:23 +08:00
|
|
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
#if defined(HAVE_READLINE_READLINE_H)
|
|
|
|
#include <readline/readline.h>
|
|
|
|
#elif defined(HAVE_EDITLINE_READLINE_H)
|
|
|
|
#include <editline/readline.h>
|
2002-04-11 06:47:09 +08:00
|
|
|
#elif defined(HAVE_READLINE_H)
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
#include <readline.h>
|
2002-04-11 06:47:09 +08:00
|
|
|
#endif
|
|
|
|
],
|
2015-07-03 00:21:23 +08:00
|
|
|
[rl_completion_append_character = 'x';])],
|
2010-09-30 03:38:04 +08:00
|
|
|
[pgac_cv_var_rl_completion_append_character=yes],
|
|
|
|
[pgac_cv_var_rl_completion_append_character=no])])
|
|
|
|
if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
|
2002-04-11 06:47:09 +08:00
|
|
|
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
|
2010-09-30 03:38:04 +08:00
|
|
|
[Define to 1 if you have the global variable 'rl_completion_append_character'.])
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
fi
|
2020-01-24 07:20:57 +08:00
|
|
|
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
|
Improve psql's tab completion for filenames.
The Readline library contains a fair amount of knowledge about how to
tab-complete filenames, but it turns out that that doesn't work too well
unless we follow its expectation that we use its filename quoting hooks
to quote and de-quote filenames. We were trying to do such quote handling
within complete_from_files(), and that's still what we have to do if we're
using libedit, which lacks those hooks. But for Readline, it works a lot
better if we tell Readline that single-quote is a quoting character and
then provide hooks that know the details of the quoting rules for SQL
and psql meta-commands.
Hence, resurrect the quoting hook functions that existed in the original
version of tab-complete.c (and were disabled by commit f6689a328 because
they "didn't work so well yet"), and whack on them until they do seem to
work well.
Notably, this fixes bug #16059 from Steven Winfield, who pointed out
that the previous coding would strip quote marks from filenames in SQL
COPY commands, even though they're syntactically necessary there.
Now, we not only don't do that, but we'll add a quote mark when you
tab-complete, even if you didn't type one.
Getting this to work across a range of libedit versions (and, to a
lesser extent, libreadline versions) was depressingly difficult.
It will be interesting to see whether the new regression test cases
pass everywhere in the buildfarm.
Some future patch might try to handle quoted SQL identifiers with
similar explicit quoting/dequoting logic, but that's for another day.
Patch by me, reviewed by Peter Eisentraut.
Discussion: https://postgr.es/m/16059-8836946734c02b84@postgresql.org
2020-01-24 00:07:12 +08:00
|
|
|
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)
|
|
|
|
#include <readline/readline.h>
|
|
|
|
#elif defined(HAVE_EDITLINE_READLINE_H)
|
|
|
|
#include <editline/readline.h>
|
|
|
|
#elif defined(HAVE_READLINE_H)
|
|
|
|
#include <readline.h>
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[rl_filename_quote_characters = "x";])],
|
|
|
|
[pgac_cv_var_rl_filename_quote_characters=yes],
|
|
|
|
[pgac_cv_var_rl_filename_quote_characters=no])])
|
|
|
|
if test x"$pgac_cv_var_rl_filename_quote_characters" = x"yes"; then
|
|
|
|
AC_DEFINE(HAVE_RL_FILENAME_QUOTE_CHARACTERS, 1,
|
|
|
|
[Define to 1 if you have the global variable 'rl_filename_quote_characters'.])
|
|
|
|
fi
|
|
|
|
AC_CACHE_CHECK([for rl_filename_quoting_function], pgac_cv_var_rl_filename_quoting_function,
|
|
|
|
[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_filename_quoting_function = 0;])],
|
|
|
|
[pgac_cv_var_rl_filename_quoting_function=yes],
|
|
|
|
[pgac_cv_var_rl_filename_quoting_function=no])])
|
|
|
|
if test x"$pgac_cv_var_rl_filename_quoting_function" = x"yes"; then
|
|
|
|
AC_DEFINE(HAVE_RL_FILENAME_QUOTING_FUNCTION, 1,
|
|
|
|
[Define to 1 if you have the global variable 'rl_filename_quoting_function'.])
|
|
|
|
fi
|
|
|
|
])# PGAC_READLINE_VARIABLES
|
2002-04-11 06:47:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-03 02:25:18 +08:00
|
|
|
# PGAC_CHECK_GETTEXT
|
|
|
|
# ------------------
|
2008-05-28 06:18:04 +08:00
|
|
|
# We check for bind_textdomain_codeset() not just gettext(). GNU gettext
|
|
|
|
# before 0.10.36 does not have that function, and is generally too incomplete
|
|
|
|
# to be usable.
|
2001-06-03 02:25:18 +08:00
|
|
|
|
|
|
|
AC_DEFUN([PGAC_CHECK_GETTEXT],
|
|
|
|
[
|
2008-05-28 06:18:04 +08:00
|
|
|
AC_SEARCH_LIBS(bind_textdomain_codeset, intl, [],
|
2001-06-03 02:25:18 +08:00
|
|
|
[AC_MSG_ERROR([a gettext implementation is required for NLS])])
|
|
|
|
AC_CHECK_HEADER([libintl.h], [],
|
|
|
|
[AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
|
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 23:40:00 +08:00
|
|
|
PGAC_PATH_PROGS(MSGFMT, msgfmt)
|
2019-01-18 15:29:42 +08:00
|
|
|
AC_ARG_VAR(MSGFMT, [msgfmt program for NLS])dnl
|
2001-06-03 02:25:18 +08:00
|
|
|
if test -z "$MSGFMT"; then
|
|
|
|
AC_MSG_ERROR([msgfmt is required for NLS])
|
|
|
|
fi
|
2013-09-12 02:34:28 +08:00
|
|
|
AC_CACHE_CHECK([for msgfmt flags], pgac_cv_msgfmt_flags,
|
|
|
|
[if test x"$MSGFMT" != x"" && "$MSGFMT" --version 2>&1 | grep "GNU" >/dev/null; then
|
|
|
|
pgac_cv_msgfmt_flags=-c
|
|
|
|
fi])
|
|
|
|
AC_SUBST(MSGFMT_FLAGS, $pgac_cv_msgfmt_flags)
|
Further improve consistency of configure's program searching.
Peter Eisentraut noted that commit 40b9f1921 had broken a configure
behavior that some people might rely on: AC_CHECK_PROGS(FOO,...) will
allow the search to be overridden by specifying a value for FOO on
configure's command line or in its environment, but AC_PATH_PROGS(FOO,...)
accepts such an override only if it's an absolute path. We had worked
around that behavior for some, but not all, of the pre-existing uses
of AC_PATH_PROGS by just skipping the macro altogether when FOO is
already set. Let's standardize on that workaround for all uses of
AC_PATH_PROGS, new and pre-existing, by wrapping AC_PATH_PROGS in a
new macro PGAC_PATH_PROGS. While at it, fix a deficiency of the old
workaround code by making sure we report the setting to configure's log.
Eventually I'd like to improve PGAC_PATH_PROGS so that it converts
non-absolute override inputs to absolute form, eg "PYTHON=python3"
becomes, say, PYTHON = /usr/bin/python3. But that will take some
nontrivial coding so it doesn't seem like a thing to do in late beta.
Discussion: https://postgr.es/m/90a92a7d-938e-507a-3bd7-ecd2b4004689@2ndquadrant.com
2017-08-01 23:40:00 +08:00
|
|
|
PGAC_PATH_PROGS(MSGMERGE, msgmerge)
|
|
|
|
PGAC_PATH_PROGS(XGETTEXT, xgettext)
|
2001-06-03 02:25:18 +08:00
|
|
|
])# PGAC_CHECK_GETTEXT
|
2002-04-11 00:45:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# PGAC_CHECK_STRIP
|
|
|
|
# ----------------
|
|
|
|
# Check for a 'strip' program, and figure out if that program can
|
|
|
|
# strip libraries.
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_CHECK_STRIP],
|
|
|
|
[
|
|
|
|
AC_CHECK_TOOL(STRIP, strip, :)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([whether it is possible to strip libraries])
|
|
|
|
if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then
|
|
|
|
STRIP_STATIC_LIB="$STRIP -x"
|
|
|
|
STRIP_SHARED_LIB="$STRIP --strip-unneeded"
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
else
|
2012-08-22 11:42:43 +08:00
|
|
|
case $host_os in
|
|
|
|
darwin*)
|
|
|
|
STRIP="$STRIP -x"
|
|
|
|
STRIP_STATIC_LIB=$STRIP
|
|
|
|
STRIP_SHARED_LIB=$STRIP
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
STRIP_STATIC_LIB=:
|
|
|
|
STRIP_SHARED_LIB=:
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
;;
|
|
|
|
esac
|
2002-04-11 00:45:25 +08:00
|
|
|
fi
|
|
|
|
AC_SUBST(STRIP_STATIC_LIB)
|
|
|
|
AC_SUBST(STRIP_SHARED_LIB)
|
|
|
|
])# PGAC_CHECK_STRIP
|