Lennart Kolmodin 2009 Make GHC 6.10.1 use readline instead of editline diff -rN -u old-ghc-readline/ghc-6.10.1/aclocal.m4 new-ghc-readline/ghc-6.10.1/aclocal.m4 --- old-ghc-readline/ghc-6.10.1/aclocal.m4 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/aclocal.m4 2009-03-15 15:48:14.000000000 +0100 @@ -897,18 +897,18 @@ fi])# FP_PROG_GHC_PKG -# FP_GHC_HAS_EDITLINE +# FP_GHC_HAS_READLINE # ------------------- -AC_DEFUN([FP_GHC_HAS_EDITLINE], +AC_DEFUN([FP_GHC_HAS_READLINE], [AC_REQUIRE([FP_PROG_GHC_PKG]) -AC_CACHE_CHECK([whether ghc has editline package], [fp_cv_ghc_has_editline], -[if "${GhcPkgCmd-ghc-pkg}" --show-package editline >/dev/null 2>&1; then - fp_cv_ghc_has_editline=yes +AC_CACHE_CHECK([whether ghc has readline package], [fp_cv_ghc_has_readline], +[if "${GhcPkgCmd-ghc-pkg}" describe readline >/dev/null 2>&1; then + fp_cv_ghc_has_readline=yes else - fp_cv_ghc_has_editline=no + fp_cv_ghc_has_readline=no fi]) -AC_SUBST([GhcHasEditline], [`echo $fp_cv_ghc_has_editline | sed 'y/yesno/YESNO/'`]) -])# FP_GHC_HAS_EDITLINE +AC_SUBST([GhcHasReadline], [`echo $fp_cv_ghc_has_readline | sed 'y/yesno/YESNO/'`]) +])# FP_GHC_HAS_READLINE # FP_GCC_EXTRA_FLAGS diff -rN -u old-ghc-readline/ghc-6.10.1/compiler/ghc.cabal.in new-ghc-readline/ghc-6.10.1/compiler/ghc.cabal.in --- old-ghc-readline/ghc-6.10.1/compiler/ghc.cabal.in 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/compiler/ghc.cabal.in 2009-03-15 15:48:14.000000000 +0100 @@ -28,8 +28,8 @@ Default: False Manual: True -Flag editline - Description: Use editline +Flag readline + Description: Use readline Default: False Manual: True @@ -71,8 +71,8 @@ else Build-Depends: unix - if flag(editline) - Build-Depends: editline + if flag(readline) + Build-Depends: readline CPP-Options: -DUSE_EDITLINE GHC-Options: -Wall -fno-warn-name-shadowing -fno-warn-orphans diff -rN -u old-ghc-readline/ghc-6.10.1/compiler/ghci/InteractiveUI.hs new-ghc-readline/ghc-6.10.1/compiler/ghci/InteractiveUI.hs --- old-ghc-readline/ghc-6.10.1/compiler/ghci/InteractiveUI.hs 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/compiler/ghci/InteractiveUI.hs 2009-03-15 15:48:14.000000000 +0100 @@ -66,7 +66,7 @@ #ifdef USE_EDITLINE import Control.Concurrent ( yield ) -- Used in readline loop -import System.Console.Editline.Readline as Readline +import System.Console.Readline as Readline #endif --import SystemExts @@ -326,10 +326,6 @@ when is_tty $ withReadline $ do Readline.initialize - withGhcAppData - (\dir -> Readline.readHistory (dir "ghci_history")) - (return True) - Readline.setAttemptedCompletionFunction (Just completeWord) --Readline.parseAndBind "set show-all-if-ambiguous 1" @@ -367,9 +363,6 @@ #ifdef USE_EDITLINE liftIO $ do - Readline.stifleHistory 100 - withGhcAppData (\dir -> Readline.writeHistory (dir "ghci_history")) - (return True) Readline.resetTerminal Nothing #endif @@ -641,14 +634,9 @@ return (Just str) withReadline :: IO a -> IO a -withReadline = bracket_ stopTimer (do startTimer; setNonBlockingFD 0) - -- Two problems are being worked around here: +withReadline = flip finally (setNonBlockingFD 0) -- 1. readline sometimes puts stdin into blocking mode, -- so we need to put it back for the IO library - -- 2. editline doesn't handle some of its system calls returning - -- EINTR, so our timer signal confuses it, hence we turn off - -- the timer signal when making calls to editline. (#2277) - -- If editline is ever fixed, we can remove this. -- These come from the RTS foreign import ccall unsafe startTimer :: IO () diff -rN -u old-ghc-readline/ghc-6.10.1/compiler/ghci/Linker.lhs new-ghc-readline/ghc-6.10.1/compiler/ghci/Linker.lhs --- old-ghc-readline/ghc-6.10.1/compiler/ghci/Linker.lhs 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/compiler/ghci/Linker.lhs 2009-03-15 15:48:14.000000000 +0100 @@ -953,7 +953,7 @@ partOfGHCi | isWindowsTarget || isDarwinTarget = [] | otherwise = map PackageName - ["base", "haskell98", "template-haskell", "editline"] + ["base", "haskell98", "template-haskell", "readline"] showLS :: LibrarySpec -> String showLS (Object nm) = "(static) " ++ nm diff -rN -u old-ghc-readline/ghc-6.10.1/compiler/Makefile new-ghc-readline/ghc-6.10.1/compiler/Makefile --- old-ghc-readline/ghc-6.10.1/compiler/Makefile 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/compiler/Makefile 2009-03-15 15:48:14.000000000 +0100 @@ -118,15 +118,15 @@ CONFIGURE_FLAGS_STAGE2 += --ghc-option=-DDEBUGGER endif -# Enable editline if: -# - we're building stage 2/3, and we have built the editline package +# Enable readline if: +# - we're building stage 2/3, and we have built the readline package # -# But we don't enable editline on Windows, as Windows terminals have -# editline-like support builtin. +# But we don't enable readline on Windows, as Windows terminals have +# readline-like support builtin. # ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32" -ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/editline/unbuildable)" "" -CONFIGURE_FLAGS_STAGE2 += --flags=editline +ifeq "$(wildcard $(FPTOOLS_TOP_ABS)/libraries/readline/unbuildable)" "" +CONFIGURE_FLAGS_STAGE2 += --flags=readline endif endif endif diff -rN -u old-ghc-readline/ghc-6.10.1/configure.ac new-ghc-readline/ghc-6.10.1/configure.ac --- old-ghc-readline/ghc-6.10.1/configure.ac 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/configure.ac 2009-03-15 15:48:15.000000000 +0100 @@ -679,8 +679,8 @@ AC_SUBST(ghc_ge_609)dnl fi -# Check whether this GHC has editline installed -FP_GHC_HAS_EDITLINE +# Check whether this GHC has readline installed +FP_GHC_HAS_READLINE AC_PATH_PROGS(NHC,nhc nhc98) AC_PATH_PROG(HBC,hbc) diff -rN -u old-ghc-readline/ghc-6.10.1/libraries/ifBuildable.hs new-ghc-readline/ghc-6.10.1/libraries/ifBuildable.hs --- old-ghc-readline/ghc-6.10.1/libraries/ifBuildable.hs 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/libraries/ifBuildable.hs 2009-03-15 15:48:15.000000000 +0100 @@ -36,5 +36,5 @@ requiredLines = filter ((3 == ) . length) $ map words nonCommentLines requiredLibraries = [ x | 'l':'i':'b':'r':'a':'r':'i':'e':'s':'/':x <- map head requiredLines ] - return $ filter ("editline" /=) requiredLibraries + return $ filter ("readline" /=) requiredLibraries diff -rN -u old-ghc-readline/ghc-6.10.1/libraries/Makefile new-ghc-readline/ghc-6.10.1/libraries/Makefile --- old-ghc-readline/ghc-6.10.1/libraries/Makefile 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/libraries/Makefile 2009-03-15 15:48:15.000000000 +0100 @@ -46,7 +46,7 @@ ifeq "$(Windows)" "YES" SUBDIRS += $(wildcard Win32) endif -SUBDIRS += directory process pretty hpc template-haskell editline Cabal random haskell98 +SUBDIRS += directory process pretty hpc template-haskell readline Cabal random haskell98 # Set GhcBootLibs=YES from the command line to work with just the libraries # needed to bootstrap GHC. diff -rN -u old-ghc-readline/ghc-6.10.1/Makefile new-ghc-readline/ghc-6.10.1/Makefile --- old-ghc-readline/ghc-6.10.1/Makefile 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/Makefile 2009-03-15 15:48:14.000000000 +0100 @@ -376,7 +376,7 @@ echo "HaveLibGmp = $(HaveLibGmp)" >> $(BIN_DIST_VARFILE) echo "GhcLibsWithUnix = $(GhcLibsWithUnix)" >> $(BIN_DIST_VARFILE) echo "GhcWithInterpreter = $(GhcWithInterpreter)" >> $(BIN_DIST_VARFILE) - echo "GhcHasEditline = $(GhcHasEditline)" >> $(BIN_DIST_VARFILE) + echo "GhcHasReadline = $(GhcHasReadline)" >> $(BIN_DIST_VARFILE) echo "BootingFromHc = $(BootingFromHc)" >> $(BIN_DIST_VARFILE) echo "XMLDocWays = $(XMLDocWays)" >> $(BIN_DIST_VARFILE) # We won't actually use xsltproc, but we need to know if it's "" or not diff -rN -u old-ghc-readline/ghc-6.10.1/mk/config.mk.in new-ghc-readline/ghc-6.10.1/mk/config.mk.in --- old-ghc-readline/ghc-6.10.1/mk/config.mk.in 2009-03-15 15:48:14.000000000 +0100 +++ new-ghc-readline/ghc-6.10.1/mk/config.mk.in 2009-03-15 15:48:15.000000000 +0100 @@ -889,8 +889,8 @@ GHC = @WithGhc@ GhcDir = $(dir $(GHC)) -# Set to YES if $(GHC) has the editline package installed -GhcHasEditline = @GhcHasEditline@ +# Set to YES if $(GHC) has the readline package installed +GhcHasReadline = @GhcHasReadline@ HBC = @HBC@ NHC = @NHC@