2008-05-28 02:18:04 +04:00
|
|
|
# $PostgreSQL: pgsql/config/programs.m4,v 1.23 2008/05/27 22:18:04 tgl Exp $
|
2007-07-19 21:15:30 +04:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_PATH_YACC
|
|
|
|
# --------------
|
|
|
|
# Look for Bison, set the output variable YACC to its path if found.
|
|
|
|
# Reject versions before 1.875 (they have bugs or capacity limits).
|
|
|
|
# Note we do not accept other implementations of yacc.
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_PATH_YACC],
|
|
|
|
[# Let the user override the search
|
|
|
|
if test -z "$YACC"; then
|
|
|
|
AC_CHECK_PROGS(YACC, ['bison -y'])
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test "$YACC"; then
|
|
|
|
pgac_yacc_version=`$YACC --version 2>/dev/null | sed q`
|
|
|
|
AC_MSG_NOTICE([using $pgac_yacc_version])
|
|
|
|
if echo "$pgac_yacc_version" | $AWK '{ if ([$]4 < 1.875) exit 0; else exit 1;}'
|
|
|
|
then
|
|
|
|
AC_MSG_WARN([
|
|
|
|
*** The installed version of Bison is too old to use with PostgreSQL.
|
|
|
|
*** Bison version 1.875 or later is required.])
|
|
|
|
YACC=""
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -z "$YACC"; then
|
|
|
|
AC_MSG_WARN([
|
|
|
|
*** Without Bison you will not be able to build PostgreSQL from CVS nor
|
|
|
|
*** change any of the parser definition files. You can obtain Bison from
|
|
|
|
*** a GNU mirror site. (If you are using the official distribution of
|
|
|
|
*** PostgreSQL then you do not need to worry about this, because the Bison
|
|
|
|
*** output is pre-generated.) To use a different yacc program (possible,
|
|
|
|
*** but not recommended), set the environment variable YACC before running
|
|
|
|
*** 'configure'.])
|
|
|
|
fi
|
|
|
|
# We don't need AC_SUBST(YACC) because AC_PATH_PROG did it
|
|
|
|
AC_SUBST(YFLAGS)
|
|
|
|
])# PGAC_PATH_YACC
|
|
|
|
|
2000-08-28 15:53:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
# PGAC_PATH_FLEX
|
|
|
|
# --------------
|
|
|
|
# Look for Flex, set the output variable FLEX to its path if found.
|
|
|
|
# Avoid the buggy version 2.5.3. Also find Flex if its installed
|
|
|
|
# under `lex', but do not accept other Lex programs.
|
|
|
|
|
|
|
|
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 19:39:56 +04:00
|
|
|
IFS=$PATH_SEPARATOR
|
2000-08-28 15:53:23 +04:00
|
|
|
for pgac_dir in $PATH; do
|
2004-09-02 19:39:56 +04:00
|
|
|
IFS=$pgac_save_IFS
|
2000-08-28 15:53:23 +04: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-26 20:28:01 +04:00
|
|
|
&& $pgac_candidate --version </dev/null >/dev/null 2>&1
|
2000-08-28 15:53:23 +04:00
|
|
|
then
|
|
|
|
echo '%%' > conftest.l
|
|
|
|
if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
|
2003-05-07 03:33:52 +04:00
|
|
|
if $pgac_candidate --version | grep ' 2\.5\.3$' >/dev/null 2>&1; then
|
2000-08-28 15:53:23 +04:00
|
|
|
pgac_broken_flex=$pgac_candidate
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
pgac_cv_path_flex=$pgac_candidate
|
|
|
|
break 2
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2004-09-03 00:39:57 +04:00
|
|
|
rm -f conftest.l lex.yy.c
|
2000-08-28 15:53:23 +04:00
|
|
|
: ${pgac_cv_path_flex=no}
|
|
|
|
fi
|
|
|
|
])[]dnl AC_CACHE_CHECK
|
|
|
|
|
|
|
|
if test x"$pgac_cv_path_flex" = x"no"; then
|
|
|
|
if test -n "$pgac_broken_flex"; then
|
|
|
|
AC_MSG_WARN([
|
2001-02-11 01:31:42 +03:00
|
|
|
*** The Flex version 2.5.3 you have at $pgac_broken_flex contains a bug. You
|
|
|
|
*** should get version 2.5.4 or later.])
|
2000-08-28 15:53:23 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_MSG_WARN([
|
2001-02-11 01:31:42 +03:00
|
|
|
*** Without Flex you will not be able to build PostgreSQL from CVS or
|
|
|
|
*** change any of the scanner definition files. You can obtain Flex from
|
|
|
|
*** a GNU mirror site. (If you are using the official distribution of
|
|
|
|
*** PostgreSQL then you do not need to worry about this because the Flex
|
|
|
|
*** output is pre-generated.)])
|
2000-08-28 15:53:23 +04:00
|
|
|
|
|
|
|
FLEX=
|
|
|
|
else
|
|
|
|
FLEX=$pgac_cv_path_flex
|
2007-07-19 21:15:30 +04:00
|
|
|
pgac_flex_version=`$FLEX -V 2>/dev/null`
|
|
|
|
AC_MSG_NOTICE([using $pgac_flex_version])
|
2000-08-28 15:53:23 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(FLEX)
|
|
|
|
AC_SUBST(FLEXFLAGS)
|
|
|
|
])# PGAC_PATH_FLEX
|
2001-02-06 22:20:16 +03: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 18:59:11 +04:00
|
|
|
[AC_REQUIRE([AC_CANONICAL_HOST])
|
2001-02-06 22:20:16 +03:00
|
|
|
|
|
|
|
AC_CACHE_VAL([pgac_cv_check_readline],
|
|
|
|
[pgac_cv_check_readline=no
|
2004-11-30 09:13:04 +03:00
|
|
|
pgac_save_LIBS=$LIBS
|
2005-12-04 06:52:29 +03: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
|
|
|
|
AC_MSG_CHECKING([for ${pgac_rllib}])
|
2004-11-30 09:13:04 +03:00
|
|
|
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
|
|
|
|
LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
|
2001-08-28 18:59:11 +04:00
|
|
|
AC_TRY_LINK_FUNC([readline], [[
|
2004-12-02 23:04:20 +03:00
|
|
|
# Older NetBSD, OpenBSD, and Irix have a broken linker that does not
|
|
|
|
# recognize dependent libraries; assume curses is needed if we didn't
|
|
|
|
# find any dependency.
|
|
|
|
case $host_os in
|
|
|
|
netbsd* | openbsd* | irix*)
|
|
|
|
if test x"$pgac_lib" = x"" ; then
|
|
|
|
pgac_lib=" -lcurses"
|
|
|
|
fi ;;
|
2001-08-28 18:59:11 +04:00
|
|
|
esac
|
|
|
|
|
|
|
|
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
|
2005-12-04 06:52:29 +03:00
|
|
|
break
|
2001-08-28 18:59:11 +04:00
|
|
|
]])
|
2001-02-06 22:20:16 +03:00
|
|
|
done
|
2005-12-04 06:52:29 +03:00
|
|
|
if test "$pgac_cv_check_readline" != no ; then
|
|
|
|
AC_MSG_RESULT([yes ($pgac_cv_check_readline)])
|
|
|
|
break
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
2001-02-06 22:20:16 +03:00
|
|
|
done
|
|
|
|
LIBS=$pgac_save_LIBS
|
|
|
|
])[]dnl AC_CACHE_VAL
|
|
|
|
|
|
|
|
if test "$pgac_cv_check_readline" != no ; then
|
|
|
|
LIBS="$pgac_cv_check_readline $LIBS"
|
2005-12-04 06:52:29 +03:00
|
|
|
AC_DEFINE(HAVE_LIBREADLINE, 1, [Define if you have a function readline library])
|
|
|
|
fi
|
|
|
|
|
|
|
|
])# PGAC_CHECK_READLINE
|
2001-06-02 22:25:18 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2002-04-11 02:47:09 +04:00
|
|
|
# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
|
|
|
|
# ---------------------------------------
|
|
|
|
# Readline versions < 2.1 don't have rl_completion_append_character
|
|
|
|
|
|
|
|
AC_DEFUN([PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER],
|
|
|
|
[AC_MSG_CHECKING([for rl_completion_append_character])
|
|
|
|
AC_TRY_LINK([#include <stdio.h>
|
|
|
|
#ifdef HAVE_READLINE_READLINE_H
|
|
|
|
# include <readline/readline.h>
|
|
|
|
#elif defined(HAVE_READLINE_H)
|
|
|
|
# include <readline.h>
|
|
|
|
#endif
|
|
|
|
],
|
|
|
|
[rl_completion_append_character = 'x';],
|
|
|
|
[AC_MSG_RESULT(yes)
|
|
|
|
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
|
2003-04-07 02:45:23 +04:00
|
|
|
[Define to 1 if you have the global variable 'rl_completion_append_character'.])],
|
2002-04-11 02:47:09 +04:00
|
|
|
[AC_MSG_RESULT(no)])])# PGAC_VAR_RL_COMPLETION_APPEND_CHARACTER
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-06-02 22:25:18 +04:00
|
|
|
# PGAC_CHECK_GETTEXT
|
|
|
|
# ------------------
|
2008-05-28 02:18:04 +04: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-02 22:25:18 +04:00
|
|
|
|
|
|
|
AC_DEFUN([PGAC_CHECK_GETTEXT],
|
|
|
|
[
|
2008-05-28 02:18:04 +04:00
|
|
|
AC_SEARCH_LIBS(bind_textdomain_codeset, intl, [],
|
2001-06-02 22:25:18 +04: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])])
|
|
|
|
AC_CHECK_PROGS(MSGFMT, msgfmt)
|
|
|
|
if test -z "$MSGFMT"; then
|
|
|
|
AC_MSG_ERROR([msgfmt is required for NLS])
|
|
|
|
fi
|
|
|
|
AC_CHECK_PROGS(MSGMERGE, msgmerge)
|
|
|
|
AC_CHECK_PROGS(XGETTEXT, xgettext)
|
|
|
|
])# PGAC_CHECK_GETTEXT
|
2002-04-10 20:45:25 +04: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
|
|
|
|
STRIP_STATIC_LIB=:
|
|
|
|
STRIP_SHARED_LIB=:
|
|
|
|
AC_MSG_RESULT(no)
|
|
|
|
fi
|
|
|
|
AC_SUBST(STRIP_STATIC_LIB)
|
|
|
|
AC_SUBST(STRIP_SHARED_LIB)
|
|
|
|
])# PGAC_CHECK_STRIP
|