6
# Look for Bison, set the output variable BISON to its path if found.
7
# Reject versions before 1.875 (they have bugs or capacity limits).
8
# Note we do not accept other implementations of yacc.
10
AC_DEFUN([PGAC_PATH_BISON],
11
[# Let the user override the search
12
if test -z "$BISON"; then
13
AC_PATH_PROGS(BISON, bison)
16
if test "$BISON"; then
17
pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
18
AC_MSG_NOTICE([using $pgac_bison_version])
19
if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 1.875) exit 0; else exit 1;}'
22
*** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
23
*** Bison version 1.875 or later is required, but this is $pgac_bison_version.])
28
if test -z "$BISON"; then
30
*** Without Bison you will not be able to build PostgreSQL from Git nor
31
*** change any of the parser definition files. You can obtain Bison from
32
*** a GNU mirror site. (If you are using the official distribution of
33
*** PostgreSQL then you do not need to worry about this, because the Bison
34
*** output is pre-generated.)])
36
# We don't need AC_SUBST(BISON) because AC_PATH_PROG did it
44
# Look for Flex, set the output variable FLEX to its path if found.
45
# Reject versions before 2.5.31, as we need a reasonably non-buggy reentrant
46
# scanner. (Note: the well-publicized security problem in 2.5.31 does not
47
# affect Postgres, and there are still distros shipping patched 2.5.31,
48
# so allow it.) Also find Flex if its installed under `lex', but do not
49
# accept other Lex programs.
51
AC_DEFUN([PGAC_PATH_FLEX],
52
[AC_CACHE_CHECK([for flex], pgac_cv_path_flex,
53
[# Let the user override the test
54
if test -n "$FLEX"; then
55
pgac_cv_path_flex=$FLEX
59
for pgac_dir in $PATH; do
61
if test -z "$pgac_dir" || test x"$pgac_dir" = x"."; then
64
for pgac_prog in flex lex; do
65
pgac_candidate="$pgac_dir/$pgac_prog"
66
if test -f "$pgac_candidate" \
67
&& $pgac_candidate --version </dev/null >/dev/null 2>&1
69
echo '%%' > conftest.l
70
if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
71
pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
72
if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 = 2 && [$]2 = 5 && [$]3 >= 31) exit 0; else exit 1;}'
74
pgac_cv_path_flex=$pgac_candidate
78
*** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
79
*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version.])
85
rm -f conftest.l lex.yy.c
86
: ${pgac_cv_path_flex=no}
88
])[]dnl AC_CACHE_CHECK
90
if test x"$pgac_cv_path_flex" = x"no"; then
92
*** Without Flex you will not be able to build PostgreSQL from Git nor
93
*** change any of the scanner definition files. You can obtain Flex from
94
*** a GNU mirror site. (If you are using the official distribution of
95
*** PostgreSQL then you do not need to worry about this because the Flex
96
*** output is pre-generated.)])
100
FLEX=$pgac_cv_path_flex
101
pgac_flex_version=`$FLEX --version 2>/dev/null`
102
AC_MSG_NOTICE([using $pgac_flex_version])
111
# PGAC_CHECK_READLINE
112
# -------------------
113
# Check for the readline library and dependent libraries, either
114
# termcap or curses. Also try libedit, since NetBSD's is compatible.
115
# Add the required flags to LIBS, define HAVE_LIBREADLINE.
117
AC_DEFUN([PGAC_CHECK_READLINE],
118
[AC_REQUIRE([AC_CANONICAL_HOST])
120
AC_CACHE_CHECK([for library containing readline], [pgac_cv_check_readline],
121
[pgac_cv_check_readline=no
123
if test x"$with_libedit_preferred" != x"yes"
124
then READLINE_ORDER="-lreadline -ledit"
125
else READLINE_ORDER="-ledit -lreadline"
127
for pgac_rllib in $READLINE_ORDER ; do
128
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
129
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
130
AC_TRY_LINK_FUNC([readline], [[
131
# Older NetBSD, OpenBSD, and Irix have a broken linker that does not
132
# recognize dependent libraries; assume curses is needed if we didn't
133
# find any dependency.
135
netbsd* | openbsd* | irix*)
136
if test x"$pgac_lib" = x"" ; then
141
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
145
if test "$pgac_cv_check_readline" != no ; then
150
])[]dnl AC_CACHE_CHECK
152
if test "$pgac_cv_check_readline" != no ; then
153
LIBS="$pgac_cv_check_readline $LIBS"
154
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a function readline library])
157
])# PGAC_CHECK_READLINE
161
# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
162
# ---------------------------------------
163
# Readline versions < 2.1 don't have rl_completion_append_character
165
AC_DEFUN([PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER],
166
[AC_CACHE_CHECK([for rl_completion_append_character], pgac_cv_var_rl_completion_append_character,
167
[AC_TRY_LINK([#include <stdio.h>
168
#ifdef HAVE_READLINE_READLINE_H
169
# include <readline/readline.h>
170
#elif defined(HAVE_READLINE_H)
171
# include <readline.h>
174
[rl_completion_append_character = 'x';],
175
[pgac_cv_var_rl_completion_append_character=yes],
176
[pgac_cv_var_rl_completion_append_character=no])])
177
if test x"$pgac_cv_var_rl_completion_append_character" = x"yes"; then
178
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
179
[Define to 1 if you have the global variable 'rl_completion_append_character'.])
180
fi])# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
186
# We check for bind_textdomain_codeset() not just gettext(). GNU gettext
187
# before 0.10.36 does not have that function, and is generally too incomplete
190
AC_DEFUN([PGAC_CHECK_GETTEXT],
192
AC_SEARCH_LIBS(bind_textdomain_codeset, intl, [],
193
[AC_MSG_ERROR([a gettext implementation is required for NLS])])
194
AC_CHECK_HEADER([libintl.h], [],
195
[AC_MSG_ERROR([header file <libintl.h> is required for NLS])])
196
AC_CHECK_PROGS(MSGFMT, msgfmt)
197
if test -z "$MSGFMT"; then
198
AC_MSG_ERROR([msgfmt is required for NLS])
200
AC_CHECK_PROGS(MSGMERGE, msgmerge)
201
AC_CHECK_PROGS(XGETTEXT, xgettext)
202
])# PGAC_CHECK_GETTEXT
208
# Check for a 'strip' program, and figure out if that program can
211
AC_DEFUN([PGAC_CHECK_STRIP],
213
AC_CHECK_TOOL(STRIP, strip, :)
215
AC_MSG_CHECKING([whether it is possible to strip libraries])
216
if test x"$STRIP" != x"" && "$STRIP" -V 2>&1 | grep "GNU strip" >/dev/null; then
217
STRIP_STATIC_LIB="$STRIP -x"
218
STRIP_SHARED_LIB="$STRIP --strip-unneeded"
225
AC_SUBST(STRIP_STATIC_LIB)
226
AC_SUBST(STRIP_SHARED_LIB)