Commit aef2d0d8 authored by Tom Lane's avatar Tom Lane

Fix readline/libedit selection code to prefer readline over libedit

reliably (ie, regardless of which libraries they depend on).  Also
make sure that we don't select headers that obviously belong to the
wrong one of the two libraries.  This was discussed back around 4-Sep
but seems to have slipped through the cracks.  The header selection
could be checked more closely, perhaps, but let's see if this is good
enough.
parent c3df447a
# $PostgreSQL: pgsql/config/programs.m4,v 1.16 2004/09/02 20:39:57 tgl Exp $ # $PostgreSQL: pgsql/config/programs.m4,v 1.17 2004/11/30 06:13:02 tgl Exp $
# PGAC_PATH_FLEX # PGAC_PATH_FLEX
...@@ -82,10 +82,10 @@ AC_MSG_CHECKING([for readline]) ...@@ -82,10 +82,10 @@ AC_MSG_CHECKING([for readline])
AC_CACHE_VAL([pgac_cv_check_readline], AC_CACHE_VAL([pgac_cv_check_readline],
[pgac_cv_check_readline=no [pgac_cv_check_readline=no
for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do pgac_save_LIBS=$LIBS
for pgac_rllib in -lreadline -ledit ; do for pgac_rllib in -lreadline -ledit ; do
pgac_save_LIBS=$LIBS for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
LIBS="${pgac_rllib}${pgac_lib} $LIBS" LIBS="${pgac_rllib}${pgac_lib} $pgac_save_LIBS"
AC_TRY_LINK_FUNC([readline], [[ AC_TRY_LINK_FUNC([readline], [[
# NetBSD, OpenBSD, and Irix have a broken linker that does not # NetBSD, OpenBSD, and Irix have a broken linker that does not
# recognize dependent libraries # recognize dependent libraries
...@@ -99,7 +99,6 @@ for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do ...@@ -99,7 +99,6 @@ for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
pgac_cv_check_readline="${pgac_rllib}${pgac_lib}" pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"
break 2 break 2
]]) ]])
LIBS=$pgac_save_LIBS
done done
done done
LIBS=$pgac_save_LIBS LIBS=$pgac_save_LIBS
......
This diff is collapsed.
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
dnl $PostgreSQL: pgsql/configure.in,v 1.386 2004/11/22 03:06:35 pgsql Exp $ dnl $PostgreSQL: pgsql/configure.in,v 1.387 2004/11/30 06:13:04 tgl Exp $
dnl dnl
dnl Developers, please strive to achieve this order: dnl Developers, please strive to achieve this order:
dnl dnl
...@@ -714,21 +714,34 @@ AC_CHECK_HEADERS(netinet/tcp.h, [], [], ...@@ -714,21 +714,34 @@ AC_CHECK_HEADERS(netinet/tcp.h, [], [],
#endif #endif
]) ])
if test "$with_readline" = yes; then if expr x"$pgac_cv_check_readline" : 'x-lreadline' >/dev/null ; then
AC_CHECK_HEADERS(readline/readline.h, [], AC_CHECK_HEADERS(readline/readline.h, [],
[AC_CHECK_HEADERS(editline/readline.h, [], [AC_CHECK_HEADERS(readline.h, [],
[AC_CHECK_HEADERS(readline.h, [], [AC_MSG_ERROR([readline header not found
[AC_MSG_ERROR([readline header not found
If you have readline already installed, see config.log for details on the If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory. failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.])])])]) Use --without-readline to disable readline support.])])])
AC_CHECK_HEADERS(readline/history.h, [], AC_CHECK_HEADERS(readline/history.h, [],
[AC_CHECK_HEADERS(editline/history.h, [], [AC_CHECK_HEADERS(history.h, [],
[AC_CHECK_HEADERS(history.h, [], [AC_MSG_ERROR([history header not found
[AC_MSG_ERROR([history header not found
If you have readline already installed, see config.log for details on the If you have readline already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory. failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.])])])]) Use --without-readline to disable readline support.])])])
fi
if expr x"$pgac_cv_check_readline" : 'x-ledit' >/dev/null ; then
AC_CHECK_HEADERS(editline/readline.h, [],
[AC_CHECK_HEADERS(readline.h, [],
[AC_MSG_ERROR([readline header not found
If you have libedit already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable libedit support.])])])
AC_CHECK_HEADERS(editline/history.h, [],
[AC_CHECK_HEADERS(history.h, [],
[AC_MSG_ERROR([history header not found
If you have libedit already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable libedit support.])])])
fi fi
if test "$with_zlib" = yes; then if test "$with_zlib" = yes; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment