Recompiling ghc-5.00 with itself on my debian linux box, failed pretty
early for me when generating dependencies in ghc/compiler.  It seems
that my build of hslibs/*/Readline had (silently?) failed while
building ghc 5.0 with my old compiler and so dependency generation 
failed.  

Obviously, this is easy enough to fix - just install readline header
files on my machine but I thought I'd try to find a way that made ghc
more portable.

The first thing I tried was tweaking the setting of HS_SRCS in the
Makefile to include the ghci directory only if ghci was enabled.  This
worked but... what if I wanted to run ghci?

I then found that autoconf had checked to see if readline/readline.h
was installed - all I had to do was tweak ghci to pay attention to
HAVE_READLINE_HEADERS and I'd be golden.  This also works - diffs
attached.  (Note that this patch removes the "NO_READLINE" flag - you
might want to keep this?)

A third solution which I haven't tried yet but might try soon is to
write a dumb (possibly very dumb) implementation of Readline in pure
Haskell and have Readline use the dumb implementation if the C library
and headers aren't available.  I'm in two minds about this approach
because the semantics of my dumb version would be a fairly poor match
for the semantics of the real thing.

--
Alastair Reid


$ cvs diff -C2
cvs server: Diffing .
Index: InteractiveUI.hs
===================================================================
RCS file: /home/cvs/root/fptools/ghc/compiler/ghci/InteractiveUI.hs,v
retrieving revision 1.60
diff -C2 -r1.60 InteractiveUI.hs
*** InteractiveUI.hs    2001/03/28 16:51:03     1.60
--- InteractiveUI.hs    2001/04/20 23:22:20
***************
*** 29,33 ****
  import Exception
  import Dynamic
! #ifndef NO_READLINE
  import Readline
  #endif
--- 29,33 ----
  import Exception
  import Dynamic
! #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
  import Readline
  #endif
***************
*** 122,126 ****
             Just m -> cmLoadModule cmstate m
  
! #ifndef NO_READLINE
     Readline.initialize
  #endif
--- 122,126 ----
             Just m -> cmLoadModule cmstate m
  
! #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
     Readline.initialize
  #endif
***************
*** 167,171 ****
  
    -- read commands from stdin
! #ifndef NO_READLINE
    readlineLoop
  #else
--- 167,171 ----
  
    -- read commands from stdin
! #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
    readlineLoop
  #else
***************
*** 201,205 ****
                   if quit then return () else stringLoop ss
  
! #ifndef NO_READLINE
  readlineLoop :: GHCi ()
  readlineLoop = do
--- 201,205 ----
                   if quit then return () else stringLoop ss
  
! #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
  readlineLoop :: GHCi ()
  readlineLoop = do


_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to