Haskell Readline library on Windows

The binary distributions of GHC for Windows do not contain support for the readline library. This is needed in Kaya 0.2.7 and later. If you are building Kaya 0.2.6 or earlier on Windows you can ignore these steps.

These steps do not completely recompile GHC - they simply add the readline library to an existing distribution.

Compiling GHC's readline library on MinGW

  1. Download the GHC source from the Haskell download site into your MSys directory, and unpack it using tar -xjf - make sure you download exactly the same version as the binary distribution you already have.
  2. Make sure that your pdcurses library is installed correctly, and that libpdcurses.a is copied to libcurses.a and libncurses.a
  3. Go to the libraries/readline directory of the unpacked distribution, and make the following changes to the configure file. (Yes, this would be better done by editing configure.ac and re-running autoconf, but the MinGW system installed so far doesn't have a working autoconf.)

    For GHC 6.6

    • Find the line ac_cv_lib_curses_tputs=no and change no to yes. (Windows curses libraries don't have or need the tputs function.)
    • Find the line ac_cv_lib_readline_rl_readline_version=no and change no to yes. (This function does not exist on Windows, but for some reason this isn't a problem).

    For GHC 6.8

    • Change ac_cv_lib_curses_tputs=yes to ac_cv_lib_curses_tputs=no
    • Change ac_cv_func_rl_readline_version=no to ac_cv_func_rl_readline_version=yes
    • Change ac_cv_func_rl_begin_undo_group=no to ac_cv_func_rl_begin_undo_group=yes
  4. Go back to the top directory of the unpacked distribution and run ./configure (no need to specify any options)
  5. Edit the rts/Makefile file that has now been generated, finding the line WAYS=$(GhcLibWays) $(GhcRTSWays). Remove $(GhcRTSWays) - it's not necessary for the readline library and saves a lot of time in compiling.
  6. Run make stage1 and find something else to do for a few hours.
  7. Go back to the libraries/readline directory, and run ghc-pkg.exe update package.conf.inplace

Your GHC installation should now have a usable readline package. Do not delete or move the directories you have just created.

kaya@kayalang.org | Last modified 13 July 2009 | Supported by Durham CompSoc | Powered by Kaya