
On Thu, May 13, 2004 at 04:47:23PM +1000, Bernard James POPE wrote:
Hi all,
In buddha I've started using System.Console.Readline for the command line (which btw is very nice, thanks to those who made the binding).
Buddha uses autconf to configure itself. I want to check whether the host supports System.Console.Readline.
One option is to ask ghc-package to list the available packages and see if readline appears.
Another option is to try to compile a simple Haskell program that imports the library, and test if it succeeds or fails.
The first option looks simpler, but I have run across machines where ghc _thinks_ it has readline support, but in fact it is broken. In other words the package readline is mentioned in the package configuration, but it is broken (normally because libreadline isn't where ghc thinks it ought to be).
Are there other (better) ways to test for this?
If you want a solution now (or want to support older versions of the compiler), I've implemented a set of autoconf macros for darcs which do the second version. You stick them in your aclocal.m4, and then your configure.ac contains something like GHC_CHECK_MODULE(Graphics.UI.WX, wx, GHCFLAGS="$GHCFLAGS -DHAVEWX -package wx", AC_MSG_WARN([Couldn't find wx package])) which looks for Graphics.UI.WX first without -package wx, then with -package wx. I'm attaching the aclocal.m4 file in case you're interested. It also includes macros which test for ghc bugs and implement workarounds. -- David Roundy http://www.abridgegame.org