summaryrefslogtreecommitdiff
path: root/config/programs.m4
diff options
context:
space:
mode:
authorPeter Eisentraut2001-02-06 19:20:16 +0000
committerPeter Eisentraut2001-02-06 19:20:16 +0000
commit5610b6d9cb2e801f6a7108ccd74cd35d30620388 (patch)
tree162ccdd16043c9204acf9dd42086237fa7f7a701 /config/programs.m4
parent659a1d65c6349441f3ca1cd306b552be7de1e6dd (diff)
Only use termcap xor [n]curses, depending on what readline needs. Solaris
has problems when linking with both.
Diffstat (limited to 'config/programs.m4')
-rw-r--r--config/programs.m434
1 files changed, 33 insertions, 1 deletions
diff --git a/config/programs.m4 b/config/programs.m4
index 660591bbd1f..8202e1fa7f5 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/config/programs.m4,v 1.2 2000/10/26 16:28:00 petere Exp $
+# $Header: /cvsroot/pgsql/config/programs.m4,v 1.3 2001/02/06 19:20:16 petere Exp $
# PGAC_PATH_FLEX
@@ -70,3 +70,35 @@ fi
AC_SUBST(FLEX)
AC_SUBST(FLEXFLAGS)
])# PGAC_PATH_FLEX
+
+
+
+# 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],
+[AC_MSG_CHECKING([for readline])
+
+AC_CACHE_VAL([pgac_cv_check_readline],
+[pgac_cv_check_readline=no
+for pgac_lib in "" " -ltermcap" " -lncurses" " -lcurses" ; do
+ for pgac_rllib in -lreadline -ledit ; do
+ pgac_save_LIBS=$LIBS
+ LIBS="${pgac_rllib}${pgac_lib} $LIBS"
+ AC_TRY_LINK_FUNC([readline], [pgac_cv_check_readline="${pgac_rllib}${pgac_lib}"; break 2])
+ LIBS=$pgac_save_LIBS
+ done
+done
+LIBS=$pgac_save_LIBS
+])[]dnl AC_CACHE_VAL
+
+if test "$pgac_cv_check_readline" != no ; then
+ AC_DEFINE(HAVE_LIBREADLINE)
+ LIBS="$pgac_cv_check_readline $LIBS"
+ AC_MSG_RESULT([yes ($pgac_cv_check_readline)])
+else
+ AC_MSG_RESULT(no)
+fi])# PGAC_CHECK_READLINE