Make dependency on HSX *optional*. Use ./configure --enable-hsx to use it

This commit is contained in:
Don Stewart
2005-08-19 01:43:17 +00:00
parent 9d68153395
commit e59c59d3ea
7 changed files with 78 additions and 34 deletions

View File

@ -1,4 +1,4 @@
{-# OPTIONS -fglasgow-exts #-}
{-# OPTIONS -cpp -fglasgow-exts #-}
--
-- Copyright (C) 2004 Don Stewart - http://www.cse.unsw.edu.au/~dons
--
@ -24,11 +24,19 @@ module System.Plugins.Parser (
replaceModName
) where
#include "../../../config.h"
import Data.List
import Data.Char
import Data.Either
#if defined(WITH_HSX)
import Language.Haskell.Hsx
#else
import Language.Haskell.Parser
import Language.Haskell.Syntax
import Language.Haskell.Pretty
#endif
--
-- | parse a file (as a string) as Haskell src
@ -38,7 +46,11 @@ parse :: FilePath -- ^ module name
-> Either String HsModule -- ^ abstract syntax
parse f fsrc =
#if defined(WITH_HSX)
case parseFileContentsWithMode (ParseMode f) fsrc of
#else
case parseModuleWithMode (ParseMode f) fsrc of
#endif
ParseOk src -> Right src
ParseFailed loc _ -> Left $ srcmsg loc
where

View File

@ -69,7 +69,6 @@ import Data.List
import System.IO
import System.Environment ( getEnv )
import System.Directory
import qualified Control.Exception as Control.Exception (handle)
-- ---------------------------------------------------------------------
-- some misc types we use

View File

@ -32,6 +32,6 @@ exposed-modules:
c-sources:
Language/Hi/hschooks.c
includes: Linker.h
Build-Depends: base, haskell98, Cabal, haskell-src-exts>=0.2
Build-Depends: base, haskell98, Cabal, @HASKELL_SRC@
ghc-options: -Wall -O -fvia-C -funbox-strict-fields -fno-warn-missing-signatures -threaded