diff: fix bug in readline autoconf test

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Apr 4 03:06:24 AEST 1999


Estimated hours taken: 0.5

aclocal.m4:
	Fix a bug in the autoconf test for readline: the test for libreadline
	needs to link against $mercury_cv_termcap_lib, otherwise the test
	reports spurious failures even when readline is properly installed.
	This also means that we need to test for libtermcap etc.
	_before_ testing for libreadline.

Index: aclocal.m4
===================================================================
RCS file: /home/staff/zs/imp/mercury/aclocal.m4,v
retrieving revision 1.1
diff -u -r1.1 aclocal.m4
--- aclocal.m4	1999/03/30 05:45:18	1.1
+++ aclocal.m4	1999/04/03 16:57:48
@@ -28,26 +28,22 @@
 	AC_DEFINE(HAVE_READLINE_HISTORY)
 fi
 
+# check for the libraries that readline depends on
+MERCURY_MSG('looking for termcap or curses (needed by readline)...')
+AC_CHECK_LIB(termcap, tgetent, mercury_cv_termcap_lib=-ltermcap,
+ [AC_CHECK_LIB(curses,  tgetent, mercury_cv_termcap_lib=-lcurses,
+  [AC_CHECK_LIB(ncurses, tgetent, mercury_cv_termcap_lib=-lncurses,
+   mercury_cv_termcap_lib='')])])
+
 # check for the readline library
 AC_CHECK_LIB(readline, readline, mercury_cv_have_readline=yes,
-	mercury_cv_have_readline=no)
-
-# check for the libraries that readline depends on
-if test $mercury_cv_have_readline = yes; then
-	MERCURY_MSG('looking for termcap or curses (needed by readline)...')
-	AC_CHECK_LIB(termcap, tgetent, mercury_cv_termcap_lib=-ltermcap,
-	 [AC_CHECK_LIB(curses,  tgetent, mercury_cv_termcap_lib=-lcurses,
-	  [AC_CHECK_LIB(ncurses, tgetent, mercury_cv_termcap_lib=-lncurses,
-	   mercury_cv_termcap_lib=none)])])
-fi
+	mercury_cv_have_readline=no, $mercury_cv_termcap_lib)
 
 # Now figure out whether we can use readline, and define variables according.
 # Note that on most systems, we don't actually need the header files in
 # order to use readline. (Ain't C grand? ;-).
 
-if test $mercury_cv_have_readline = no ||
-	test $mercury_cv_termcap_lib = none
-then
+if test $mercury_cv_have_readline = no; then
 	TERMCAP_LIBRARY=""
 	READLINE_LIBRARIES=""
 	AC_DEFINE(MR_NO_USE_READLINE)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list